[llvm] 41f8a02 - [MIBundle] Remove unused/obsolete MIOperands/ConstMIOperands (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 4 13:21:37 PST 2019


Author: Florian Hahn
Date: 2019-12-04T21:20:16Z
New Revision: 41f8a0243268f7548fde3b179eafd2d909166bff

URL: https://github.com/llvm/llvm-project/commit/41f8a0243268f7548fde3b179eafd2d909166bff
DIFF: https://github.com/llvm/llvm-project/commit/41f8a0243268f7548fde3b179eafd2d909166bff.diff

LOG: [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

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/MachineInstrBundle.h

Removed: 
    


################################################################################
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 @@ class MachineOperandIteratorBase {
   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<MachineInstr &>(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 @@ class MIBundleOperands : public MachineOperandIteratorBase {
 /// 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<MachineInstr &>(MI), true) {}
+      : MIBundleOperandIteratorBase(const_cast<MachineInstr &>(MI)) {}
   const MachineOperand &operator* () const { return deref(); }
   const MachineOperand *operator->() const { return &deref(); }
 };


        


More information about the llvm-commits mailing list