summaryrefslogtreecommitdiff
path: root/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-08-23 20:40:38 +0000
committerJim Grosbach <grosbach@apple.com>2010-08-23 20:40:38 +0000
commit67ff81a08319f916571cea90ed92e17015c8584f (patch)
tree67ac334f7b7b359e113a753663da398d7bb6a1e1 /lib/CodeGen/PrologEpilogInserter.cpp
parent11bc1652c9447d85204dc6f7c878b9c95e668a96 (diff)
downloadllvm-67ff81a08319f916571cea90ed92e17015c8584f.tar.gz
llvm-67ff81a08319f916571cea90ed92e17015c8584f.tar.bz2
llvm-67ff81a08319f916571cea90ed92e17015c8584f.tar.xz
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111836 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--lib/CodeGen/PrologEpilogInserter.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp
index 4b8a4b5562..b600790d85 100644
--- a/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/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