[llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Jan 15 20:23:01 PST 2003


Changes in directory llvm/lib/CodeGen:

PrologEpilogInserter.cpp updated: 1.6 -> 1.7

---
Log message:

Add assertion


---
Diffs of the changes:

Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.6 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.7
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.6	Wed Jan 15 16:52:34 2003
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp	Wed Jan 15 20:22:08 2003
@@ -186,20 +186,23 @@
   // Loop over all of the stack objects, assigning sequential addresses...
   MachineFrameInfo *FFI = Fn.getFrameInfo();
 
+  unsigned StackAlign = TFI.getStackAlignment();
+
   // Start at the beginning of the local area...
   int Offset = TFI.getOffsetOfLocalArea();
   for (unsigned i = 0, e = FFI->getObjectIndexEnd(); i != e; ++i) {
     Offset += FFI->getObjectSize(i);         // Allocate Size bytes...
 
     unsigned Align = FFI->getObjectAlignment(i);
+    assert(Align < StackAlign && "Cannot align stack object to higher "
+           "alignment boundary than the stack itself!");
     Offset = (Offset+Align-1)/Align*Align;   // Adjust to Alignment boundary...
     
     FFI->setObjectOffset(i, -Offset);        // Set the computed offset
   }
 
   // Align the final stack pointer offset...
-  unsigned StackAlign = TFI.getStackAlignment();
-  Offset = (Offset+StackAlign-1)/StackAlign*StackAlign;
+  Offset = (Offset+StackAlignment-1)/StackAlignment*StackAlignment;
 
   // Set the final value of the stack pointer...
   FFI->setStackSize(Offset-TFI.getOffsetOfLocalArea());





More information about the llvm-commits mailing list