aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SimpleRegisterCoalescing.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
commit7e8c86d3f88e4b5e3977210dc2a76ae1946a157c (patch)
tree2efabfe39798bf60c60055e0eaf965f96e49acd7 /lib/CodeGen/SimpleRegisterCoalescing.cpp
parent690b8d58190f71ff277f1f8b74a13ba35bedce4f (diff)
downloadexternal_llvm-7e8c86d3f88e4b5e3977210dc2a76ae1946a157c.zip
external_llvm-7e8c86d3f88e4b5e3977210dc2a76ae1946a157c.tar.gz
external_llvm-7e8c86d3f88e4b5e3977210dc2a76ae1946a157c.tar.bz2
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/SimpleRegisterCoalescing.cpp')
-rw-r--r--lib/CodeGen/SimpleRegisterCoalescing.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp
index 12001d0..f5d85ab 100644
--- a/lib/CodeGen/SimpleRegisterCoalescing.cpp
+++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp
@@ -1969,7 +1969,24 @@ bool SimpleRegisterCoalescing::SimpleJoin(LiveInterval &LHS, LiveInterval &RHS){
LHSValNo->setHasPHIKill(true);
LHS.addKills(LHSValNo, VNI->kills);
LHS.MergeRangesInAsValue(RHS, LHSValNo);
- LHS.weight += RHS.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 (LHS.weight == HUGE_VALF && !TargetRegisterInfo::isPhysicalRegister(LHS.reg)) {
+ // Remove this assert if you have an iterative coalescer
+ assert(0 && "Joining to spilled interval");
+ LHS.weight = RHS.weight;
+ }
+ else if (RHS.weight != HUGE_VALF) {
+ LHS.weight += RHS.weight;
+ }
+ else {
+ // Remove this assert if you have an iterative coalescer
+ assert(0 && "Joining from spilled interval");
+ }
+
+ // Otherwise the LHS weight stays the same
// Update regalloc hint if both are virtual registers.
if (TargetRegisterInfo::isVirtualRegister(LHS.reg) &&