Eli Bendersky
2014-Feb-14 21:52 UTC
[LLVMdev] Custom allocators for MachineBasicBlocks and STL containers
Hello, I was looking at how the memory for MachineBasicBlocks is managed and something seems strange. On one hand, a MachineFunction uses a recycling allocator to create and destroy MBBs without costly heap allocation (the same is done for MachineInstrs, MachineOperands, etc.). On the other hand, each MBB also has a number of STL vectors within it. For example, for Predecessors, Successors, Weights, LiveIns. Maintaining these vectors involves heap allocation and they don't have custom allocators, AFAICS. Is there some magic I'm missing here, or does this make little sense? Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140214/fa3aef2d/attachment.html>
Evan Cheng
2014-Feb-14 23:34 UTC
[LLVMdev] Custom allocators for MachineBasicBlocks and STL containers
On Feb 14, 2014, at 1:52 PM, Eli Bendersky <eliben at google.com> wrote:> Hello, > > I was looking at how the memory for MachineBasicBlocks is managed and something seems strange. > > On one hand, a MachineFunction uses a recycling allocator to create and destroy MBBs without costly heap allocation (the same is done for MachineInstrs, MachineOperands, etc.). > > On the other hand, each MBB also has a number of STL vectors within it. For example, for Predecessors, Successors, Weights, LiveIns. Maintaining these vectors involves heap allocation and they don't have custom allocators, AFAICS. > > Is there some magic I'm missing here, or does this make little sense?Jakob would know for sure. My guess is it takes time to move all the data structure over to the custom allocators so we just tackled the ones that provide the most bang for the buck. Evan> > Eli > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Jakob Stoklund Olesen
2014-Feb-14 23:40 UTC
[LLVMdev] Custom allocators for MachineBasicBlocks and STL containers
On Feb 14, 2014, at 3:34 PM, Evan Cheng <evan.cheng at apple.com> wrote:> > On Feb 14, 2014, at 1:52 PM, Eli Bendersky <eliben at google.com> wrote: > >> Hello, >> >> I was looking at how the memory for MachineBasicBlocks is managed and something seems strange. >> >> On one hand, a MachineFunction uses a recycling allocator to create and destroy MBBs without costly heap allocation (the same is done for MachineInstrs, MachineOperands, etc.). >> >> On the other hand, each MBB also has a number of STL vectors within it. For example, for Predecessors, Successors, Weights, LiveIns. Maintaining these vectors involves heap allocation and they don't have custom allocators, AFAICS. >> >> Is there some magic I'm missing here, or does this make little sense? > > Jakob would know for sure. My guess is it takes time to move all the data structure over to the custom allocators so we just tackled the ones that provide the most bang for the buck.What Evan said. The MachineInstr class is completely heap independent. It would be nice to do the same for MBB, but the gains are small. Thanks, /jakob
Reasonably Related Threads
- Update control flow graph when splitting a machine basic block?
- is a MachineBasicBlock a kind of superblock?
- [LLVMdev] Possible bug in LiveIntervalAnalysis?
- [LLVMdev] Basic block liveouts
- [LLVMdev] How to check for "SPARC code generation" in MachineBasicBlock.cpp?