Fix a few cases where the scheduler is not checking for phys reg copies. The scheduli...
[oota-llvm.git] / include / llvm / CodeGen / LiveInterval.h
index 57f0b624244fbd36ac2d22926520cfe93377175e..192f07ec569fe32bbe59b60f3708b711a09f654b 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef LLVM_CODEGEN_LIVEINTERVAL_H
 #define LLVM_CODEGEN_LIVEINTERVAL_H
 
-#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/IntEqClasses.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/AlignOf.h"
 #include "llvm/CodeGen/SlotIndexes.h"
@@ -250,6 +250,7 @@ namespace llvm {
     /// position is in a hole, this method returns an iterator pointing to the
     /// LiveRange immediately after the hole.
     iterator advanceTo(iterator I, SlotIndex Pos) {
+      assert(I != end());
       if (Pos >= endIndex())
         return end();
       while (I->end <= Pos) ++I;
@@ -560,11 +561,7 @@ namespace llvm {
 
   class ConnectedVNInfoEqClasses {
     LiveIntervals &lis_;
-
-    // Map each value number to its equivalence class.
-    // The invariant is that EqClass[x] <= x.
-    // Two values are connected iff EqClass[x] == EqClass[b].
-    SmallVector<unsigned, 8> eqClass_;
+    IntEqClasses eqClass_;
 
     // Note that values a and b are connected.
     void Connect(unsigned a, unsigned b);
@@ -578,10 +575,15 @@ namespace llvm {
     /// Return the number of connected components.
     unsigned Classify(const LiveInterval *LI);
 
-    // Distribute values in LIV[0] into a separate LiveInterval for each connected
-    // component. LIV must have a LiveInterval for each connected component.
-    // The LiveIntervals in Liv[1..] must be empty.
+    /// getEqClass - Classify creates equivalence classes numbered 0..N. Return
+    /// the equivalence class assigned the VNI.
+    unsigned getEqClass(const VNInfo *VNI) { return eqClass_[VNI->id]; }
+
+    /// Distribute - Distribute values in LIV[0] into a separate LiveInterval
+    /// for each connected component. LIV must have a LiveInterval for each
+    /// connected component. The LiveIntervals in Liv[1..] must be empty.
     void Distribute(LiveInterval *LIV[]);
+
   };
 
 }