X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FPrologEpilogInserter.cpp;h=7b6747363663249a39644c410f3e33468ea05533;hb=fecdea0bf77599038eb368db3bc6a38a14900308;hp=8f1d3a6da612f6a4faa5aee16e6756afd4a47cd9;hpb=3d72367d30c9ce6f387764a028763f7a366cc443;p=oota-llvm.git diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp index 8f1d3a6da61..7b674736366 100644 --- a/lib/CodeGen/PrologEpilogInserter.cpp +++ b/lib/CodeGen/PrologEpilogInserter.cpp @@ -556,10 +556,22 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) { AdjustStackOffset(MFI, SFI, StackGrowsDown, Offset, MaxAlign); } - // Store the offset of the start of the local allocation block. This - // will be used later when resolving frame base virtual register pseudos. - MFI->setLocalFrameBaseOffset(Offset); + // FIXME: Once this is working, then enable flag will change to a target + // check for whether the frame is large enough to want to use virtual + // frame index registers. Functions which don't want/need this optimization + // will continue to use the existing code path. if (EnableLocalStackAlloc) { + unsigned Align = MFI->getLocalFrameMaxAlign(); + + // Adjust to alignment boundary. + Offset = (Offset + Align - 1) / Align * Align; + + // Store the offset of the start of the local allocation block. This + // will be used later when resolving frame base virtual register pseudos. + MFI->setLocalFrameBaseOffset(Offset); + + DEBUG(dbgs() << "Local frame base offset: " << Offset << "\n"); + // Allocate the local block Offset += MFI->getLocalFrameSize(); @@ -571,10 +583,6 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) { AdjustStackOffset(MFI, Entry.first, StackGrowsDown, FIOffset, MaxAlign); } } - // FIXME: Allocate locals. Once the block allocation pass is turned on, - // this simplifies to just the second loop, since all of the large objects - // will have already been handled. The second loop can also simplify a - // bit, as the conditionals inside aren't all necessary. // Make sure that the stack protector comes before the local variables on the // stack.