llvm.org GIT mirror llvm / 743ef6d
Add new advanceTo method git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17932 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 15 years ago
2 changed file(s) with 26 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
7979 typedef Ranges::iterator iterator;
8080 iterator begin() { return ranges.begin(); }
8181 iterator end() { return ranges.end(); }
82
83
84 /// advanceTo - Advance the specified iterator to point to the LiveRange
85 /// containing the specified position, or end() if the position is past the
86 /// end of the interval. If no LiveRange contains this position, but the
87 /// position is in a hole, this method returns an iterator pointing the the
88 /// LiveRange immediately after the hold.
89 iterator advanceTo(iterator I, unsigned Pos) {
90 if (Pos >= endNumber())
91 return end();
92 while (I->end <= Pos) ++I;
93 return I;
94 }
8295
8396 void swap(LiveInterval& other) {
8497 std::swap(reg, other.reg);
7979 typedef Ranges::iterator iterator;
8080 iterator begin() { return ranges.begin(); }
8181 iterator end() { return ranges.end(); }
82
83
84 /// advanceTo - Advance the specified iterator to point to the LiveRange
85 /// containing the specified position, or end() if the position is past the
86 /// end of the interval. If no LiveRange contains this position, but the
87 /// position is in a hole, this method returns an iterator pointing the the
88 /// LiveRange immediately after the hold.
89 iterator advanceTo(iterator I, unsigned Pos) {
90 if (Pos >= endNumber())
91 return end();
92 while (I->end <= Pos) ++I;
93 return I;
94 }
8295
8396 void swap(LiveInterval& other) {
8497 std::swap(reg, other.reg);