1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

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
This commit is contained in:
David Greene 2009-07-21 23:36:14 +00:00
parent fb908d7671
commit ddaf106a0c
2 changed files with 35 additions and 2 deletions

View File

@ -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) &&

View File

@ -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) &&