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

Chris Lattner lattner at cs.uiuc.edu
Sat May 14 20:10:15 PDT 2005



Changes in directory llvm/lib/CodeGen:

PrologEpilogInserter.cpp updated: 1.43 -> 1.44
---
Log message:

When inserting callee-save register reloads, make sure to skip over any
terminator instructions before the 'ret' in case the target has a 
multi-instruction return sequence.


---
Diffs of the changes:  (+8 -0)

 PrologEpilogInserter.cpp |    8 ++++++++
 1 files changed, 8 insertions(+)


Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.43 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.44
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.43	Fri May 13 16:07:15 2005
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp	Sat May 14 22:09:58 2005
@@ -211,6 +211,14 @@
       MBB = FI;
       I = MBB->end(); --I;
 
+      // Skip over all terminator instructions, which are part of the return
+      // sequence.
+      MachineBasicBlock::iterator I2 = I;
+      while (I2 != MBB->begin() && TII.isTerminatorInstr((--I2)->getOpcode()))
+        I = I2;
+
+      // Restore all registers immediately before the return and any terminators
+      // that preceed it.
       for (unsigned i = 0, e = RegsToSave.size(); i != e; ++i) {
         RegInfo->loadRegFromStackSlot(*MBB, I, RegsToSave[i], StackSlots[i]);
         assert(I != MBB->begin() &&






More information about the llvm-commits mailing list