diff --git a/llvm/include/llvm/CodeGen/MachineInstrBundle.h b/llvm/include/llvm/CodeGen/MachineInstrBundle.h --- a/llvm/include/llvm/CodeGen/MachineInstrBundle.h +++ b/llvm/include/llvm/CodeGen/MachineInstrBundle.h @@ -75,12 +75,12 @@ } //===----------------------------------------------------------------------===// -// MachineOperand iterator +// MachineBundleOperand iterator // -/// MachineOperandIteratorBase - Iterator that can visit all operands on a -/// MachineInstr, or all operands on a bundle of MachineInstrs. This class is -/// not intended to be used directly, use one of the sub-classes instead. +/// MIBundleOperandIteratorBase - Iterator that visits all operands in a bundle +/// of MachineInstrs. This class is not intended to be used directly, use one +/// of the sub-classes instead. /// /// Intended use: /// @@ -90,7 +90,7 @@ /// ... /// } /// -class MachineOperandIteratorBase { +class MIBundleOperandIteratorBase { MachineBasicBlock::instr_iterator InstrI, InstrE; MachineInstr::mop_iterator OpI, OpE; @@ -107,24 +107,17 @@ } protected: - /// MachineOperandIteratorBase - Create an iterator that visits all operands + /// MIBundleOperandIteratorBase - Create an iterator that visits all operands /// on MI, or all operands on every instruction in the bundle containing MI. /// /// @param MI The instruction to examine. - /// @param WholeBundle When true, visit all operands on the entire bundle. /// - explicit MachineOperandIteratorBase(MachineInstr &MI, bool WholeBundle) { - if (WholeBundle) { - InstrI = getBundleStart(MI.getIterator()); - InstrE = MI.getParent()->instr_end(); - } else { - InstrI = InstrE = MI.getIterator(); - ++InstrE; - } + explicit MIBundleOperandIteratorBase(MachineInstr &MI) { + InstrI = getBundleStart(MI.getIterator()); + InstrE = MI.getParent()->instr_end(); OpI = InstrI->operands_begin(); OpE = InstrI->operands_end(); - if (WholeBundle) - advance(); + advance(); } MachineOperand &deref() const { return *OpI; } @@ -146,34 +139,14 @@ unsigned getOperandNo() const { return OpI - InstrI->operands_begin(); } - -}; - -/// MIOperands - Iterate over operands of a single instruction. -/// -class MIOperands : public MachineOperandIteratorBase { -public: - MIOperands(MachineInstr &MI) : MachineOperandIteratorBase(MI, false) {} - MachineOperand &operator* () const { return deref(); } - MachineOperand *operator->() const { return &deref(); } -}; - -/// ConstMIOperands - Iterate over operands of a single const instruction. -/// -class ConstMIOperands : public MachineOperandIteratorBase { -public: - ConstMIOperands(const MachineInstr &MI) - : MachineOperandIteratorBase(const_cast(MI), false) {} - const MachineOperand &operator* () const { return deref(); } - const MachineOperand *operator->() const { return &deref(); } }; /// MIBundleOperands - Iterate over all operands in a bundle of machine /// instructions. /// -class MIBundleOperands : public MachineOperandIteratorBase { +class MIBundleOperands : public MIBundleOperandIteratorBase { public: - MIBundleOperands(MachineInstr &MI) : MachineOperandIteratorBase(MI, true) {} + MIBundleOperands(MachineInstr &MI) : MIBundleOperandIteratorBase(MI) {} MachineOperand &operator* () const { return deref(); } MachineOperand *operator->() const { return &deref(); } }; @@ -181,10 +154,10 @@ /// ConstMIBundleOperands - Iterate over all operands in a const bundle of /// machine instructions. /// -class ConstMIBundleOperands : public MachineOperandIteratorBase { +class ConstMIBundleOperands : public MIBundleOperandIteratorBase { public: ConstMIBundleOperands(const MachineInstr &MI) - : MachineOperandIteratorBase(const_cast(MI), true) {} + : MIBundleOperandIteratorBase(const_cast(MI)) {} const MachineOperand &operator* () const { return deref(); } const MachineOperand *operator->() const { return &deref(); } };