diff options
author | Chris Lattner <sabre@nondot.org> | 2004-11-18 02:37:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-11-18 02:37:31 +0000 |
commit | 743ef6d70e710353c1e2b6a4b23af1262f4a475b (patch) | |
tree | a1446a13beb8517dc08c36cc5e11f1b8f34318ae /include/llvm/CodeGen | |
parent | 8d8d513d4dcd4d98b92ccce10a9907086af28f1e (diff) | |
download | external_llvm-743ef6d70e710353c1e2b6a4b23af1262f4a475b.zip external_llvm-743ef6d70e710353c1e2b6a4b23af1262f4a475b.tar.gz external_llvm-743ef6d70e710353c1e2b6a4b23af1262f4a475b.tar.bz2 |
Add new advanceTo method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17932 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r-- | include/llvm/CodeGen/LiveInterval.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h index 2784ba7..05ebcc1 100644 --- a/include/llvm/CodeGen/LiveInterval.h +++ b/include/llvm/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); |