[llvm-commits] [llvm] r69434 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/LiveInterval.cpp
Evan Cheng
evan.cheng at apple.com
Sat Apr 18 01:52:16 PDT 2009
Author: evancheng
Date: Sat Apr 18 03:52:15 2009
New Revision: 69434
URL: http://llvm.org/viewvc/llvm-project?rev=69434&view=rev
Log:
Add a new LiveInterval::overlaps(). It checks if the live interval overlaps a range specified by [Start, End).
Modified:
llvm/trunk/include/llvm/CodeGen/LiveInterval.h
llvm/trunk/lib/CodeGen/LiveInterval.cpp
Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=69434&r1=69433&r2=69434&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Sat Apr 18 03:52:15 2009
@@ -379,6 +379,10 @@
return overlapsFrom(other, other.begin());
}
+ /// overlaps - Return true if the live interval overlaps a range specified
+ /// by [Start, End).
+ bool overlaps(unsigned Start, unsigned End) const;
+
/// overlapsFrom - Return true if the intersection of the two live intervals
/// is not empty. The specified iterator is a hint that we can begin
/// scanning the Other interval starting at I.
Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=69434&r1=69433&r2=69434&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Sat Apr 18 03:52:15 2009
@@ -123,6 +123,22 @@
return false;
}
+/// overlaps - Return true if the live interval overlaps a range specified
+/// by [Start, End).
+bool LiveInterval::overlaps(unsigned Start, unsigned End) const {
+ assert(Start < End && "Invalid range");
+ const_iterator I = begin();
+ const_iterator E = end();
+ const_iterator si = std::upper_bound(I, E, Start);
+ const_iterator ei = std::upper_bound(I, E, End);
+ if (si != ei)
+ return true;
+ if (si == I)
+ return false;
+ --si;
+ return si->contains(Start);
+}
+
/// extendIntervalEndTo - This method is used when we want to extend the range
/// specified by I to end at the specified endpoint. To do this, we should
/// merge and eliminate all ranges that this will overlap with. The iterator is
More information about the llvm-commits
mailing list