[llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.h

Chris Lattner lattner at cs.uiuc.edu
Wed Nov 17 18:37:45 PST 2004



Changes in directory llvm/lib/CodeGen:

LiveInterval.h updated: 1.10 -> 1.11
---
Log message:

Add new advanceTo method


---
Diffs of the changes:  (+13 -0)

Index: llvm/lib/CodeGen/LiveInterval.h
diff -u llvm/lib/CodeGen/LiveInterval.h:1.10 llvm/lib/CodeGen/LiveInterval.h:1.11
--- llvm/lib/CodeGen/LiveInterval.h:1.10	Wed Nov 17 19:34:44 2004
+++ llvm/lib/CodeGen/LiveInterval.h	Wed Nov 17 20:37:31 2004
@@ -81,6 +81,19 @@
     iterator begin() { return ranges.begin(); }
     iterator end()   { return ranges.end(); }
 
+
+    /// advanceTo - Advance the specified iterator to point to the LiveRange
+    /// containing the specified position, or end() if the position is past the
+    /// end of the interval.  If no LiveRange contains this position, but the
+    /// position is in a hole, this method returns an iterator pointing the the
+    /// LiveRange immediately after the hold.
+    iterator advanceTo(iterator I, unsigned Pos) {
+      if (Pos >= endNumber())
+        return end();
+      while (I->end <= Pos) ++I;
+      return I;
+    }
+
     void swap(LiveInterval& other) {
       std::swap(reg, other.reg);
       std::swap(weight, other.weight);






More information about the llvm-commits mailing list