summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-08-16 22:30:41 +0000
committerJim Grosbach <grosbach@apple.com>2010-08-16 22:30:41 +0000
commit36d5ec383e30b98192463ab55fe130ae6cf9e555 (patch)
tree9062b45c66c987ec7aa9da5d13a904c13a466476 /llvm/lib/CodeGen/PrologEpilogInserter.cpp
parent804f6159f123267ddbe8a08e03706a1e33589c0c (diff)
downloadbcm5719-llvm-36d5ec383e30b98192463ab55fe130ae6cf9e555.tar.gz
bcm5719-llvm-36d5ec383e30b98192463ab55fe130ae6cf9e555.zip
Better handle alignment requirements for local objects in pre-regalloc frame
mapping. Have the local block track its alignment requirement, and then apply that when the block itself is allocated. Previously, offsets could get adjusted in PEI to be different, relative to one another, than the block allocation thought they would be, which defeats the point of doing the allocation this way. Continuing rdar://8277890 llvm-svn: 111197
Diffstat (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--llvm/lib/CodeGen/PrologEpilogInserter.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index 8f1d3a6da61..83aa0c44d78 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -556,10 +556,20 @@ 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);
+
// Allocate the local block
Offset += MFI->getLocalFrameSize();
@@ -571,10 +581,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.
OpenPOWER on IntegriCloud