Push constness through LoopInfo::isLoopHeader and clean it up a bit.
[oota-llvm.git] / include / llvm / CodeGen / MachineInstr.h
index c5f11c31b2b98fd88333f06f6e572ec986d83a17..564b8da37dc723e82a6a6196d0518ce2d1c43853 100644 (file)
@@ -331,6 +331,11 @@ public:
         operands_begin() + getDesc().getNumDefs(), operands_end());
   }
 
+  /// Returns the number of the operand iterator \p I points to.
+  unsigned getOperandNo(const_mop_iterator I) const {
+    return I - operands_begin();
+  }
+
   /// Access to memory operands of the instruction
   mmo_iterator memoperands_begin() const { return MemRefs; }
   mmo_iterator memoperands_end() const { return MemRefs + NumMemRefs; }
@@ -483,6 +488,13 @@ public:
     return hasProperty(MCID::NotDuplicable, Type);
   }
 
+  /// Return true if this instruction is convergent.
+  /// Convergent instructions can only be moved to locations that are
+  /// control-equivalent to their initial position.
+  bool isConvergent(QueryType Type = AnyInBundle) const {
+    return hasProperty(MCID::Convergent, Type);
+  }
+
   /// Returns true if the specified instruction has a delay slot
   /// which must be filled by the code generator.
   bool hasDelaySlot(QueryType Type = AnyInBundle) const {
@@ -560,7 +572,6 @@ public:
     return hasProperty(MCID::MayLoad, Type);
   }
 
-
   /// Return true if this instruction could possibly modify memory.
   /// Instructions with this flag set are not necessarily simple store
   /// instructions, they may store a modified value based on their operands, or
@@ -574,6 +585,11 @@ public:
     return hasProperty(MCID::MayStore, Type);
   }
 
+  /// Return true if this instruction could possibly read or modify memory.
+  bool mayLoadOrStore(QueryType Type = AnyInBundle) const {
+    return mayLoad(Type) || mayStore(Type);
+  }
+
   //===--------------------------------------------------------------------===//
   // Flags that indicate whether an instruction can be modified by a method.
   //===--------------------------------------------------------------------===//