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

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

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

Thanks. This makes sense - I just wanted to make sure I'm not missing
anything.

Eli