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

Chris Lattner lattner at cs.uiuc.edu
Sat Jul 26 18:30:01 PDT 2003


Changes in directory llvm/lib/CodeGen/InstrSelection:

InstrSelection.cpp updated: 1.58 -> 1.59

---
Log message:

Making this code const-correct would be a pain, so I'll hack it.


---
Diffs of the changes:

Index: llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp
diff -u llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.58 llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.59
--- llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp:1.58	Sat May 31 02:38:37 2003
+++ llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp	Sat Jul 26 18:29:40 2003
@@ -189,8 +189,8 @@
   //
   MachineFunction &MF = MachineFunction::get(&F);
   for (MachineFunction::iterator BB = MF.begin(); BB != MF.end(); ++BB) {
-    for (BasicBlock::iterator IIt = BB->getBasicBlock()->begin();
-         PHINode *PN = dyn_cast<PHINode>(IIt); ++IIt) {
+    for (BasicBlock::const_iterator IIt = BB->getBasicBlock()->begin();
+         const PHINode *PN = dyn_cast<PHINode>(IIt); ++IIt) {
       // FIXME: This is probably wrong...
       Value *PhiCpRes = new PHINode(PN->getType(), "PhiCp:");
 
@@ -209,7 +209,7 @@
         for (vector<MachineInstr*>::iterator MI=mvec.begin();
              MI != mvec.end(); ++MI) {
           vector<MachineInstr*> CpVec2 =
-            FixConstantOperandsForInstr(PN, *MI, Target);
+            FixConstantOperandsForInstr(const_cast<PHINode*>(PN), *MI, Target);
           CpVec2.push_back(*MI);
           CpVec.insert(CpVec.end(), CpVec2.begin(), CpVec2.end());
         }
@@ -218,7 +218,8 @@
       }
       
       vector<MachineInstr*> mvec;
-      Target.getRegInfo().cpValue2Value(PhiCpRes, PN, mvec);
+      Target.getRegInfo().cpValue2Value(PhiCpRes, const_cast<PHINode*>(PN),
+                                        mvec);
       BB->insert(BB->begin(), mvec.begin(), mvec.end());
     }  // for each Phi Instr in BB
   } // for all BBs in function





More information about the llvm-commits mailing list