Move the operand iterator into MachineInstrBundle.h where it belongs.

Extract a base class and provide four specific sub-classes for iterating
over const/non-const bundles/instructions.

This eliminates the mystery bool constructor argument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151684 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/MachineVerifier.cpp b/lib/CodeGen/MachineVerifier.cpp
index ace8252..62e263a 100644
--- a/lib/CodeGen/MachineVerifier.cpp
+++ b/lib/CodeGen/MachineVerifier.cpp
@@ -28,6 +28,7 @@
 #include "llvm/CodeGen/LiveIntervalAnalysis.h"
 #include "llvm/CodeGen/LiveVariables.h"
 #include "llvm/CodeGen/LiveStackAnalysis.h"
+#include "llvm/CodeGen/MachineInstrBundle.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachineFrameInfo.h"
 #include "llvm/CodeGen/MachineMemOperand.h"
@@ -1104,7 +1105,7 @@
         }
       } else {
         // Non-PHI def.
-        MachineInstr *MI = LiveInts->getInstructionFromIndex(VNI->def);
+        const MachineInstr *MI = LiveInts->getInstructionFromIndex(VNI->def);
         if (!MI) {
           report("No instruction at def index", MF);
           *OS << "Valno #" << VNI->id << " is defined at " << VNI->def
@@ -1114,7 +1115,7 @@
 
         bool hasDef = false;
         bool isEarlyClobber = false;
-        for (MIOperands MOI(MI, true); MOI.isValid(); ++MOI) {
+        for (ConstMIBundleOperands MOI(MI); MOI.isValid(); ++MOI) {
           if (!MOI->isReg() || !MOI->isDef())
             continue;
           if (TargetRegisterInfo::isVirtualRegister(LI.reg)) {
@@ -1197,7 +1198,7 @@
         continue;
 
       // The live segment is ending inside EndMBB
-      MachineInstr *MI =
+      const MachineInstr *MI =
         LiveInts->getInstructionFromIndex(I->end.getPrevSlot());
       if (!MI) {
         report("Live segment doesn't end at a valid instruction", EndMBB);
@@ -1242,7 +1243,7 @@
         // use, or a dead flag on a def.
         bool hasRead = false;
         bool hasDeadDef = false;
-        for (MIOperands MOI(MI, true); MOI.isValid(); ++MOI) {
+        for (ConstMIBundleOperands MOI(MI); MOI.isValid(); ++MOI) {
           if (!MOI->isReg() || MOI->getReg() != LI.reg)
             continue;
           if (MOI->readsReg())