Making this code const-correct would be a pain, so I'll hack it.
authorChris Lattner <sabre@nondot.org>
Sat, 26 Jul 2003 23:29:51 +0000 (23:29 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 26 Jul 2003 23:29:51 +0000 (23:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7350 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/InstrSelection/InstrSelection.cpp
lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp

index e4dd2e9dace1722adaf6e506156068fc53a6875c..a666c5fe2e1ce7af3f3263ee28993dae819af190 100644 (file)
@@ -189,8 +189,8 @@ InstructionSelection::InsertCodeForPhis(Function &F)
   //
   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 @@ InstructionSelection::InsertCodeForPhis(Function &F)
         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 @@ InstructionSelection::InsertCodeForPhis(Function &F)
       }
       
       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
index f08e21fb933ae4dd3195e72738887429d06697da..4d68b15dea887e10612afdb17bc39b7e88c2419a 100644 (file)
@@ -569,7 +569,7 @@ void PhyRegAlloc::updateMachineCode()
     // 
     for (MachineBasicBlock::iterator MII = MBB.begin(); MII != MBB.end(); ++MII)
       if (!TM.getInstrInfo().isDummyPhiInstr((*MII)->getOpCode()))// ignore Phis
-        updateInstruction(*MII, MBB.getBasicBlock());
+        updateInstruction(*MII, const_cast<BasicBlock*>(MBB.getBasicBlock()));
 
     // Now, move code out of delay slots of branches and returns if needed.
     // (Also, move "after" code from calls to the last delay slot instruction.)
index e4dd2e9dace1722adaf6e506156068fc53a6875c..a666c5fe2e1ce7af3f3263ee28993dae819af190 100644 (file)
@@ -189,8 +189,8 @@ InstructionSelection::InsertCodeForPhis(Function &F)
   //
   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 @@ InstructionSelection::InsertCodeForPhis(Function &F)
         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 @@ InstructionSelection::InsertCodeForPhis(Function &F)
       }
       
       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
index f08e21fb933ae4dd3195e72738887429d06697da..4d68b15dea887e10612afdb17bc39b7e88c2419a 100644 (file)
@@ -569,7 +569,7 @@ void PhyRegAlloc::updateMachineCode()
     // 
     for (MachineBasicBlock::iterator MII = MBB.begin(); MII != MBB.end(); ++MII)
       if (!TM.getInstrInfo().isDummyPhiInstr((*MII)->getOpCode()))// ignore Phis
-        updateInstruction(*MII, MBB.getBasicBlock());
+        updateInstruction(*MII, const_cast<BasicBlock*>(MBB.getBasicBlock()));
 
     // Now, move code out of delay slots of branches and returns if needed.
     // (Also, move "after" code from calls to the last delay slot instruction.)