summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveInterval.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-11-18 03:47:34 +0000
committerChris Lattner <sabre@nondot.org>2004-11-18 03:47:34 +0000
commitbae74d9192f04d8185c7b4580565d56cc4ef53f2 (patch)
tree248a1eff0330784505a938d9ce0dd01e3b6a6f2a /lib/CodeGen/LiveInterval.cpp
parentcbb5625cecc4f051094fc3afdc5d78fc703cb644 (diff)
downloadllvm-bae74d9192f04d8185c7b4580565d56cc4ef53f2.tar.gz
llvm-bae74d9192f04d8185c7b4580565d56cc4ef53f2.tar.bz2
llvm-bae74d9192f04d8185c7b4580565d56cc4ef53f2.tar.xz
Add ability to give hints to the overlaps routines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17934 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveInterval.cpp')
-rw-r--r--lib/CodeGen/LiveInterval.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp
index 8306116b1a..3c7e8dd763 100644
--- a/lib/CodeGen/LiveInterval.cpp
+++ b/lib/CodeGen/LiveInterval.cpp
@@ -42,6 +42,9 @@ bool LiveInterval::liveAt(unsigned I) const {
return r->contains(I);
}
+// overlaps - Return true if the intersection of the two live intervals is
+// not empty.
+//
// An example for overlaps():
//
// 0: A = ...
@@ -56,11 +59,16 @@ bool LiveInterval::liveAt(unsigned I) const {
//
// A->overlaps(C) should return false since we want to be able to join
// A and C.
-bool LiveInterval::overlaps(const LiveInterval& other) const {
- Ranges::const_iterator i = ranges.begin();
- Ranges::const_iterator ie = ranges.end();
- Ranges::const_iterator j = other.ranges.begin();
- Ranges::const_iterator je = other.ranges.end();
+//
+bool LiveInterval::overlapsFrom(const LiveInterval& other,
+ const_iterator StartPos) const {
+ const_iterator i = begin();
+ const_iterator ie = end();
+ const_iterator j = StartPos;
+ const_iterator je = other.end();
+
+ assert((StartPos->start <= i->start || StartPos == other.begin()) &&
+ "Bogus start position hint!");
if (i->start < j->start) {
i = std::upper_bound(i, ie, j->start);