diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-01-20 10:22:33 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-01-20 10:22:33 +0000 |
commit | e3d8e42e273957740fbca6529a6ad7136af16a61 (patch) | |
tree | b85c1924f755c66022caeeb37df073e7674015d7 /llvm/lib/Target/ARM/ARMRegisterInfo.cpp | |
parent | 706b6797a01d4824f49bd09919725f70eb0cbdbb (diff) | |
download | bcm5719-llvm-e3d8e42e273957740fbca6529a6ad7136af16a61.tar.gz bcm5719-llvm-e3d8e42e273957740fbca6529a6ad7136af16a61.zip |
Round up stack to multiple of alignment only if it's a leaf function without alloca.
llvm-svn: 33401
Diffstat (limited to 'llvm/lib/Target/ARM/ARMRegisterInfo.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMRegisterInfo.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/ARMRegisterInfo.cpp b/llvm/lib/Target/ARM/ARMRegisterInfo.cpp index 767be023a5a..979cb513ef9 100644 --- a/llvm/lib/Target/ARM/ARMRegisterInfo.cpp +++ b/llvm/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. |