summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit3424275325c505d96d863377e51a632f6e2de99a (patch)
tree33aea479fe360b593023d0ba5bf1b6f80b71d6e9 /llvm/lib/CodeGen/LiveInterval.cpp
parent9bd736e2f754ec3bd4c2b1d0b96cb9cc0a97f9c8 (diff)
downloadbcm5719-llvm-3424275325c505d96d863377e51a632f6e2de99a.tar.gz
bcm5719-llvm-3424275325c505d96d863377e51a632f6e2de99a.zip
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. llvm-svn: 76680
Diffstat (limited to 'llvm/lib/CodeGen/LiveInterval.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveInterval.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp
index b786b1d85b0..0d2f6ba76a7 100644
--- a/llvm/lib/CodeGen/LiveInterval.cpp
+++ b/llvm/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) &&
OpenPOWER on IntegriCloud