Debug Info: define a DIRef template.
[oota-llvm.git] / include / llvm / CodeGen / SlotIndexes.h
index 1c7bdb2e586cc8e684f82d47bdfcb2c4b44bd217..984796af8644e6a77c93b526bc85d7718fe59c7b 100644 (file)
@@ -218,6 +218,13 @@ namespace llvm {
       return other.getIndex() - getIndex();
     }
 
+    /// Return the scaled distance from this index to the given one, where all
+    /// slots on the same instruction have zero distance.
+    int getInstrDistance(SlotIndex other) const {
+      return (other.listEntry()->getIndex() - listEntry()->getIndex())
+        / Slot_Count;
+    }
+
     /// isBlock - Returns true if this is a block boundary slot.
     bool isBlock() const { return getSlot() == Slot_Block; }