From 41f8a0243268f7548fde3b179eafd2d909166bff Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Wed, 4 Dec 2019 20:46:08 +0000 Subject: [PATCH] [MIBundle] Remove unused/obsolete MIOperands/ConstMIOperands (NFC). Those iterators are unused and the respective iterators from MachineInstr should be used (e.g. MachineInstr::operands(), https://llvm.org/doxygen/classllvm_1_1MachineInstr.html#aef0e7e42e45e15f86b2a122b56ab829c) Reviewers: evandro, t.p.northover, paquette, MatzeB, arsenm, ab Reviewed By: ab Differential Revision: https://reviews.llvm.org/D70560 --- .../include/llvm/CodeGen/MachineInstrBundle.h | 55 +++++-------------- 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/llvm/include/llvm/CodeGen/MachineInstrBundle.h b/llvm/include/llvm/CodeGen/MachineInstrBundle.h index a6e10e39ec3a..a54f2795d911 100644 --- a/llvm/include/llvm/CodeGen/MachineInstrBundle.h +++ b/llvm/include/llvm/CodeGen/MachineInstrBundle.h @@ -75,12 +75,12 @@ inline MachineBasicBlock::const_instr_iterator getBundleEnd( } //===----------------------------------------------------------------------===// -// 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 @@ inline MachineBasicBlock::const_instr_iterator getBundleEnd( /// ... /// } /// -class MachineOperandIteratorBase { +class MIBundleOperandIteratorBase { MachineBasicBlock::instr_iterator InstrI, InstrE; MachineInstr::mop_iterator OpI, OpE; @@ -107,24 +107,17 @@ class MachineOperandIteratorBase { } 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 @@ public: 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 @@ public: /// 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(); } };