[llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp
Evan Cheng
evan.cheng at apple.com
Tue Jan 23 01:36:28 PST 2007
Changes in directory llvm/lib/CodeGen:
PrologEpilogInserter.cpp updated: 1.65 -> 1.66
---
Log message:
PEI is now responsible for adding MaxCallFrameSize to frame size and align the stack. Each target can further adjust the frame size if necessary.
---
Diffs of the changes: (+16 -1)
PrologEpilogInserter.cpp | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletion(-)
Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.65 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.66
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.65 Sat Jan 20 03:21:54 2007
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Tue Jan 23 03:36:03 2007
@@ -386,7 +386,22 @@
}
}
- // Set the final value of the stack pointer...
+ // Round up the size to a multiple of the alignment, but only if there are
+ // calls or alloca's in the function. This ensures that any calls to
+ // subroutines have their stack frames suitable aligned.
+ if (FFI->hasCalls() || FFI->hasVarSizedObjects()) {
+ // When we have no frame pointer, we reserve argument space for call sites
+ // in the function immediately on entry to the current function. This
+ // eliminates the need for add/sub sp brackets around call sites.
+ const MRegisterInfo *RegInfo = Fn.getTarget().getRegisterInfo();
+ if (!RegInfo->hasFP(Fn))
+ Offset += FFI->getMaxCallFrameSize();
+
+ unsigned AlignMask = TFI.getStackAlignment() - 1;
+ Offset = (Offset + AlignMask) & ~AlignMask;
+ }
+
+ // Update frame info to pretend that this is part of the stack...
FFI->setStackSize(Offset+TFI.getOffsetOfLocalArea());
// Remember the required stack alignment in case targets need it to perform
More information about the llvm-commits
mailing list