diff options
author | Jim Grosbach <grosbach@apple.com> | 2010-08-23 20:40:38 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2010-08-23 20:40:38 +0000 |
commit | 754f8e600ef224f017da0d9f179b040c98e1d2a9 (patch) | |
tree | 256722e0ebf973f4ccade1dd1038ae8c3398145e /llvm/lib/CodeGen/PrologEpilogInserter.cpp | |
parent | 21fed6616c373fd82374b0833e12461c630b86ef (diff) | |
download | bcm5719-llvm-754f8e600ef224f017da0d9f179b040c98e1d2a9.tar.gz bcm5719-llvm-754f8e600ef224f017da0d9f179b040c98e1d2a9.zip |
Better handling of local offsets for downwards growing stacks. This corrects
relative offsets when there are offsets encoded in the instructions and
simplifies final allocation in PEI. rdar://8277890
llvm-svn: 111836
Diffstat (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/PrologEpilogInserter.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp index 4b8a4b5562f..b600790d851 100644 --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -572,16 +572,18 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) { DEBUG(dbgs() << "Local frame base offset: " << Offset << "\n"); - // Allocate the local block - Offset += MFI->getLocalFrameSize(); - // Resolve offsets for objects in the local block. for (unsigned i = 0, e = MFI->getLocalFrameObjectCount(); i != e; ++i) { std::pair<int, int64_t> Entry = MFI->getLocalFrameObjectMap(i); - int64_t FIOffset = MFI->getLocalFrameBaseOffset() + Entry.second; - - AdjustStackOffset(MFI, Entry.first, StackGrowsDown, FIOffset, MaxAlign); + int64_t FIOffset = (StackGrowsDown ? -Offset : Offset) + Entry.second; + DEBUG(dbgs() << "alloc FI(" << Entry.first << ") at SP[" << + FIOffset << "]\n"); + MFI->setObjectOffset(Entry.first, FIOffset); } + // Allocate the local block + Offset += MFI->getLocalFrameSize(); + + MaxAlign = std::max(Align, MaxAlign); } // Make sure that the stack protector comes before the local variables on the |