aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveInterval.cpp
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-07-21 23:36:14 +0000
committerDavid Greene <greened@obbligato.org>2009-07-21 23:36:14 +0000
commit80607c9b2bdb09993ac48e40c48852e124eb2c0b (patch)
tree2efabfe39798bf60c60055e0eaf965f96e49acd7 /lib/CodeGen/LiveInterval.cpp
parent354c0165e755fd857bc89792243b82387ee3936d (diff)
Add some support for iterative coalescers to calculate a joined live
range's weight properly. This is turned off right now in the sense that you'll get an assert if you get into a situation that can only be caused by an iterative coalescer. All other code paths operate exactly as before so there is no functional change with this patch. The asserts should be disabled if/when an iterative coalescer gets added to trunk. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76680 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveInterval.cpp')
-rw-r--r--lib/CodeGen/LiveInterval.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp
index b786b1d85b..0d2f6ba76a 100644
--- a/lib/CodeGen/LiveInterval.cpp
+++ b/lib/CodeGen/LiveInterval.cpp
@@ -503,7 +503,23 @@ void LiveInterval::join(LiveInterval &Other, const int *LHSValNoAssignments,
InsertPos = addRangeFrom(*I, InsertPos);
}
- weight += Other.weight;
+ // If either of these intervals was spilled, the weight is the
+ // weight of the non-spilled interval. This can only happen with
+ // iterative coalescers.
+
+ if (weight == HUGE_VALF && !TargetRegisterInfo::isPhysicalRegister(reg)) {
+ // Remove this assert if you have an iterative coalescer
+ assert(0 && "Joining to spilled interval");
+ weight = Other.weight;
+ }
+ else if (Other.weight != HUGE_VALF) {
+ weight += Other.weight;
+ }
+ else {
+ // Remove this assert if you have an iterative coalescer
+ assert(0 && "Joining from spilled interval");
+ }
+ // Otherwise the weight stays the same
// Update regalloc hint if currently there isn't one.
if (TargetRegisterInfo::isVirtualRegister(reg) &&