Changes to fix up the inst_iterator to pass to boost iterator checks.  This
patch was graciously contributed by Vladimir Prus.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13185 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 807f8ab..09ee36c 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -955,19 +955,19 @@
 
   // print local variable information for the function
   for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ++I)
-    if (const AllocaInst *AI = isDirectAlloca(*I)) {
+    if (const AllocaInst *AI = isDirectAlloca(&*I)) {
       Out << "  ";
       printType(Out, AI->getAllocatedType(), Mang->getValueName(AI));
       Out << ";    /* Address exposed local */\n";
-    } else if ((*I)->getType() != Type::VoidTy && !isInlinableInst(**I)) {
+    } else if (I->getType() != Type::VoidTy && !isInlinableInst(*I)) {
       Out << "  ";
-      printType(Out, (*I)->getType(), Mang->getValueName(*I));
+      printType(Out, I->getType(), Mang->getValueName(&*I));
       Out << ";\n";
       
       if (isa<PHINode>(*I)) {  // Print out PHI node temporaries as well...
         Out << "  ";
-        printType(Out, (*I)->getType(),
-                  Mang->getValueName(*I)+"__PHI_TEMPORARY");
+        printType(Out, I->getType(),
+                  Mang->getValueName(&*I)+"__PHI_TEMPORARY");
         Out << ";\n";
       }
     }
diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp
index 807f8ab..09ee36c 100644
--- a/lib/Target/CBackend/Writer.cpp
+++ b/lib/Target/CBackend/Writer.cpp
@@ -955,19 +955,19 @@
 
   // print local variable information for the function
   for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ++I)
-    if (const AllocaInst *AI = isDirectAlloca(*I)) {
+    if (const AllocaInst *AI = isDirectAlloca(&*I)) {
       Out << "  ";
       printType(Out, AI->getAllocatedType(), Mang->getValueName(AI));
       Out << ";    /* Address exposed local */\n";
-    } else if ((*I)->getType() != Type::VoidTy && !isInlinableInst(**I)) {
+    } else if (I->getType() != Type::VoidTy && !isInlinableInst(*I)) {
       Out << "  ";
-      printType(Out, (*I)->getType(), Mang->getValueName(*I));
+      printType(Out, I->getType(), Mang->getValueName(&*I));
       Out << ";\n";
       
       if (isa<PHINode>(*I)) {  // Print out PHI node temporaries as well...
         Out << "  ";
-        printType(Out, (*I)->getType(),
-                  Mang->getValueName(*I)+"__PHI_TEMPORARY");
+        printType(Out, I->getType(),
+                  Mang->getValueName(&*I)+"__PHI_TEMPORARY");
         Out << ";\n";
       }
     }
diff --git a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
index 28fc75a..0f4c4bd 100644
--- a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
+++ b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
@@ -1167,9 +1167,9 @@
   unsigned Insn = 0;
   // Instructions themselves encoded as operand # -1
   for (const_inst_iterator II=inst_begin (Fn), IE=inst_end (Fn); II!=IE; ++II){
-    saveStateForValue (state, (*II), Insn, -1);
-    for (unsigned i = 0; i < (*II)->getNumOperands (); ++i) {
-      const Value *V = (*II)->getOperand (i);
+    saveStateForValue (state, (&*II), Insn, -1);
+    for (unsigned i = 0; i < (*II).getNumOperands (); ++i) {
+      const Value *V = (*II).getOperand (i);
       // Don't worry about it unless it's something whose reg. we'll need. 
       if (!isa<Argument> (V) && !isa<Instruction> (V)) 
         continue; 
@@ -1201,7 +1201,7 @@
   }
   int Insn = 0;
   for (const_inst_iterator II=inst_begin (Fn), IE=inst_end (Fn); II!=IE; ++II) {
-    const Instruction *I = *II;
+    const Instruction *I = &*II;
     MachineCodeForInstruction &Instrs = MachineCodeForInstruction::get (I);
     std::cerr << "Instruction: " << *I
               << "MachineCodeForInstruction:\n";