summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-11-18 02:37:31 +0000
committerChris Lattner <sabre@nondot.org>2004-11-18 02:37:31 +0000
commit0624f951751e5270dd7d42bca8e0512cdb521a06 (patch)
tree01a832a915229558f59f7c5be3cfbf2474113d8b /llvm/lib
parent7d92fc7e893241ff8149ab1acaf43a104980838d (diff)
downloadbcm5719-llvm-0624f951751e5270dd7d42bca8e0512cdb521a06.tar.gz
bcm5719-llvm-0624f951751e5270dd7d42bca8e0512cdb521a06.zip
Add new advanceTo method
llvm-svn: 17932
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/LiveInterval.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LiveInterval.h b/llvm/lib/CodeGen/LiveInterval.h
index 2784ba7f2b1..05ebcc1ca2f 100644
--- a/llvm/lib/CodeGen/LiveInterval.h
+++ b/llvm/lib/CodeGen/LiveInterval.h
@@ -81,6 +81,19 @@ namespace llvm {
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);
OpenPOWER on IntegriCloud