[llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp
Nate Begeman
natebegeman at mac.com
Sun Nov 6 01:01:06 PST 2005
Changes in directory llvm/lib/CodeGen:
PrologEpilogInserter.cpp updated: 1.49 -> 1.50
---
Log message:
Add the necessary support to the ISel to allow targets to codegen the new
alignment information appropriately. Includes code for PowerPC to support
fixed-size allocas with alignment larger than the stack. Support for
arbitrarily aligned dynamic allocas coming soon.
---
Diffs of the changes: (+11 -3)
PrologEpilogInserter.cpp | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.49 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.50
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.49 Fri Sep 30 12:19:22 2005
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Sun Nov 6 03:00:38 2005
@@ -258,6 +258,7 @@
MachineFrameInfo *FFI = Fn.getFrameInfo();
unsigned StackAlignment = TFI.getStackAlignment();
+ unsigned MaxAlign = StackAlignment;
// Start at the beginning of the local area.
// The Offset is the distance from the stack top in the direction
@@ -295,9 +296,11 @@
Offset += FFI->getObjectSize(i);
unsigned Align = FFI->getObjectAlignment(i);
- assert(Align <= StackAlignment && "Cannot align stack object to higher "
- "alignment boundary than the stack itself!");
- Offset = (Offset+Align-1)/Align*Align; // Adjust to Alignment boundary...
+ // If the alignment of this object is greater than that of the stack, then
+ // increase the stack alignment to match.
+ MaxAlign = std::max(MaxAlign, Align);
+ // Adjust to alignment boundary
+ Offset = (Offset+Align-1)/Align*Align;
if (StackGrowsDown) {
FFI->setObjectOffset(i, -Offset); // Set the computed offset
@@ -315,6 +318,11 @@
// Set the final value of the stack pointer...
FFI->setStackSize(Offset+TFI.getOffsetOfLocalArea());
+ // If we have a new stack alignment, set the preferred stack alignment so that
+ // the targets can do the appropriate thing to properly align the stack above
+ // the default alignment.
+ if (MaxAlign > StackAlignment)
+ FFI->setMaxAlignment(MaxAlign);
}
More information about the llvm-commits
mailing list