summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LocalStackSlotAllocation.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/LocalStackSlotAllocation.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/LocalStackSlotAllocation.cpp')
-rw-r--r--llvm/lib/CodeGen/LocalStackSlotAllocation.cpp30
1 files changed, 2 insertions, 28 deletions
diff --git a/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp b/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp
index 8cacc179fa0..75498ed8e5a 100644
--- a/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp
+++ b/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp
@@ -99,7 +99,7 @@ void LocalStackSlotPass::calculateFrameObjectOffsets(MachineFunction &Fn) {
// Loop over all of the stack objects, assigning sequential addresses...
MachineFrameInfo *MFI = Fn.getFrameInfo();
int64_t Offset = 0;
- unsigned MaxAlign = MFI->getMaxAlignment();
+ unsigned MaxAlign = 0;
// Make sure that the stack protector comes before the local variables on the
// stack.
@@ -134,33 +134,7 @@ void LocalStackSlotPass::calculateFrameObjectOffsets(MachineFunction &Fn) {
AdjustStackOffset(MFI, i, Offset, MaxAlign);
}
- const TargetRegisterInfo *RegInfo = Fn.getTarget().getRegisterInfo();
- if (!RegInfo->targetHandlesStackFrameRounding()) {
- // If we have reserved argument space for call sites in the function
- // immediately on entry to the current function, count it as part of the
- // overall stack size.
- if (MFI->adjustsStack() && RegInfo->hasReservedCallFrame(Fn))
- Offset += MFI->getMaxCallFrameSize();
-
- // Round up the size to a multiple of the alignment. If the function has
- // any calls or alloca's, align to the target's StackAlignment value to
- // ensure that the callee's frame or the alloca data is suitably aligned;
- // otherwise, for leaf functions, align to the TransientStackAlignment
- // value.
- unsigned StackAlign;
- if (MFI->adjustsStack() || MFI->hasVarSizedObjects() ||
- (RegInfo->needsStackRealignment(Fn) && MFI->getObjectIndexEnd() != 0))
- StackAlign = TFI.getStackAlignment();
- else
- StackAlign = TFI.getTransientStackAlignment();
-
- // If the frame pointer is eliminated, all frame offsets will be relative to
- // SP not FP. Align to MaxAlign so this works.
- StackAlign = std::max(StackAlign, MaxAlign);
- unsigned AlignMask = StackAlign - 1;
- Offset = (Offset + AlignMask) & ~uint64_t(AlignMask);
- }
-
// Remember how big this blob of stack space is
MFI->setLocalFrameSize(Offset);
+ MFI->setLocalFrameMaxAlign(MaxAlign);
}
OpenPOWER on IntegriCloud