[PATCH] LocalStackSlotAllocation improvements

Hal Finkel hfinkel at anl.gov
Mon Apr 8 16:33:35 PDT 2013


Jim, et al.,

Please review the attached patch that improves LocalStackSlotAllocation. It does a few things:

 - Taking advantage of the fact that the virtual base registers are allocated in order of the local frame offsets, remove the quadratic register-searching behavior. Because of the ordering, we only need to check the last virtual base register created.

 - Store the frame index in the FrameRef structure, and get the frame index and the local offset from this structure at the top of the loop iteration. This allows us to de-nest the loops in insertFrameReferenceRegisters (and I think makes the code cleaner). I also moved the needsFrameBaseReg check into the first loop over instructions so that we don't bother pushing FrameRefs for instructions that don't want a virtual base register anyway.

 - Avoids the creation of single-use virtual base registers. These are currently not useful because, in general, they end up replacing what would be one r+r instruction with an add and a r+i instruction. 

Thanks again,
Hal

P.S. I'll commit some tests to cover the single-use behavior when I enable this on PPC.

-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lsa-v2.patch
Type: text/x-patch
Size: 11298 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130408/c24147cd/attachment.bin>


More information about the llvm-commits mailing list