aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/ARM/ARMRegisterInfo.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-01-20 10:22:33 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-01-20 10:22:33 +0000
commit515674c7b66a411db4ea2fa1f5c30cd1461d3e51 (patch)
treed98656d26db883dcb8f280c9ce13f40b16df89cb /lib/Target/ARM/ARMRegisterInfo.cpp
parent2bd7b2b41fbfb4fd3f93b1e93a9e68e678fbce16 (diff)
Round up stack to multiple of alignment only if it's a leaf function without alloca.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33401 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMRegisterInfo.cpp')
-rw-r--r--lib/Target/ARM/ARMRegisterInfo.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Target/ARM/ARMRegisterInfo.cpp b/lib/Target/ARM/ARMRegisterInfo.cpp
index 767be023a5..979cb513ef 100644
--- a/lib/Target/ARM/ARMRegisterInfo.cpp
+++ b/lib/Target/ARM/ARMRegisterInfo.cpp
@@ -917,14 +917,17 @@ void ARMRegisterInfo::emitPrologue(MachineFunction &MF) const {
// If necessary, add one more SUBri to account for the call frame
// and/or local storage, alloca area.
- if (MFI->hasCalls() && !hasFP(MF))
+ if (MFI->hasCalls() || MF.getFrameInfo()->hasVarSizedObjects()) {
// We reserve argument space for call sites in the function immediately on
// entry to the current function. This eliminates the need for add/sub
// brackets around call sites.
- NumBytes += MFI->getMaxCallFrameSize();
+ if (!hasFP(MF))
+ NumBytes += MFI->getMaxCallFrameSize();
+
+ // Round the size to a multiple of the alignment.
+ NumBytes = (NumBytes+Align-1)/Align*Align;
+ }
- // Round the size to a multiple of the alignment.
- NumBytes = (NumBytes+Align-1)/Align*Align;
MFI->setStackSize(NumBytes);
// Determine starting offsets of spill areas.