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

Alkis Evlogimenos alkis at cs.uiuc.edu
Fri Feb 13 19:19:20 PST 2004


Changes in directory llvm/lib/CodeGen:

TwoAddressInstructionPass.cpp updated: 1.15 -> 1.16
PHIElimination.cpp updated: 1.17 -> 1.18

---
Log message:

Use newly added next() and prior() utility functions.


---
Diffs of the changes:  (+5 -6)

Index: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
diff -u llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.15 llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.16
--- llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.15	Fri Feb 13 15:01:20 2004
+++ llvm/lib/CodeGen/TwoAddressInstructionPass.cpp	Fri Feb 13 19:18:34 2004
@@ -38,6 +38,7 @@
 #include "llvm/Target/TargetMachine.h"
 #include "Support/Debug.h"
 #include "Support/Statistic.h"
+#include "Support/STLExtras.h"
 #include <iostream>
 using namespace llvm;
 
@@ -134,8 +135,7 @@
                 unsigned Added = MRI.copyRegToReg(*mbbi, mi, regA, regB, rc);
                 numInstrsAdded += Added;
 
-                MachineBasicBlock::iterator prevMi = mi;
-                --prevMi;
+                MachineBasicBlock::iterator prevMi = prior(mi);
                 DEBUG(std::cerr << "\t\tadded instruction: ";
                       prevMi->print(std::cerr, TM));
 


Index: llvm/lib/CodeGen/PHIElimination.cpp
diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.17 llvm/lib/CodeGen/PHIElimination.cpp:1.18
--- llvm/lib/CodeGen/PHIElimination.cpp:1.17	Fri Feb 13 15:01:20 2004
+++ llvm/lib/CodeGen/PHIElimination.cpp	Fri Feb 13 19:18:34 2004
@@ -20,6 +20,7 @@
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Support/CFG.h"
+#include "Support/STLExtras.h"
 
 namespace llvm {
 
@@ -171,8 +172,7 @@
       bool HaveNotEmitted = true;
       
       if (I != opBlock.begin()) {
-        MachineBasicBlock::iterator PrevInst = I;
-        --PrevInst;
+        MachineBasicBlock::iterator PrevInst = prior(I);
         for (unsigned i = 0, e = PrevInst->getNumOperands(); i != e; ++i) {
           MachineOperand &MO = PrevInst->getOperand(i);
           if (MO.isRegister() && MO.getReg() == IncomingReg)
@@ -253,8 +253,7 @@
           // kills the incoming value!
           //
           if (!ValueIsLive) {
-            MachineBasicBlock::iterator Prev = I;
-            --Prev;
+            MachineBasicBlock::iterator Prev = prior(I);
             LV->addVirtualRegisterKilled(SrcReg, &opBlock, Prev);
           }
         }





More information about the llvm-commits mailing list