[llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Oct 19 23:06:42 PDT 2005
Changes in directory llvm/lib/CodeGen:
LiveInterval.cpp updated: 1.22 -> 1.23
---
Log message:
Refactor some code, pulling it out into a function. No functionality change.
---
Diffs of the changes: (+26 -15)
LiveInterval.cpp | 41 ++++++++++++++++++++++++++---------------
1 files changed, 26 insertions(+), 15 deletions(-)
Index: llvm/lib/CodeGen/LiveInterval.cpp
diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.22 llvm/lib/CodeGen/LiveInterval.cpp:1.23
--- llvm/lib/CodeGen/LiveInterval.cpp:1.22 Tue Sep 20 23:19:08 2005
+++ llvm/lib/CodeGen/LiveInterval.cpp Thu Oct 20 01:06:30 2005
@@ -101,6 +101,29 @@
return false;
}
+/// NontrivialOverlap - Check to see if the two live ranges specified by i and j
+/// overlap. If so, check to see if they have value numbers that are not
+/// iIdx/jIdx respectively. If both conditions are true, return true.
+static inline bool NontrivialOverlap(LiveInterval::Ranges::const_iterator i,
+ LiveInterval::Ranges::const_iterator j,
+ unsigned iIdx, unsigned jIdx) {
+ if (i->start == j->start) {
+ // If this is not the allowed value merge, we cannot join.
+ if (i->ValId != iIdx || j->ValId != jIdx)
+ return true;
+ } else if (i->start < j->start) {
+ if (i->end > j->start && i->ValId != iIdx || j->ValId != jIdx) {
+ return true;
+ }
+ } else {
+ if (j->end > i->start &&
+ i->ValId != iIdx || j->ValId != jIdx)
+ return true;
+ }
+
+ return false;
+}
+
/// joinable - Two intervals are joinable if the either don't overlap at all
/// or if the destination of the copy is a single assignment value, and it
/// only overlaps with one value in the source interval.
@@ -125,21 +148,9 @@
}
while (i != ie && j != je) {
- if (i->start == j->start) {
- // If this is not the allowed value merge, we cannot join.
- if (i->ValId != ThisValIdx || j->ValId != OtherValIdx)
- return false;
- } else if (i->start < j->start) {
- if (i->end > j->start) {
- if (i->ValId != ThisValIdx || j->ValId != OtherValIdx)
- return false;
- }
- } else {
- if (j->end > i->start) {
- if (i->ValId != ThisValIdx || j->ValId != OtherValIdx)
- return false;
- }
- }
+ if (NontrivialOverlap(i, j, ThisValIdx, OtherValIdx))
+ return false;
+
if (i->end < j->end)
++i;
else
More information about the llvm-commits
mailing list