bug 991153: Update the backtracking allocator to handle aliased registers. (r=bhackett)

This commit is contained in:
Marty Rosenberg 2014-06-25 12:54:34 -04:00
parent 80e08ccba8
commit 0b851a639a

View File

@ -209,7 +209,7 @@ BacktrackingAllocator::tryGroupRegisters(uint32_t vreg0, uint32_t vreg1)
// already grouped with reg0 or reg1.
BacktrackingVirtualRegister *reg0 = &vregs[vreg0], *reg1 = &vregs[vreg1];
if (reg0->isFloatReg() != reg1->isFloatReg())
if (!reg0->isCompatibleVReg(*reg1))
return true;
VirtualRegisterGroup *group0 = reg0->group(), *group1 = reg1->group();
@ -703,7 +703,7 @@ BacktrackingAllocator::tryAllocateGroupRegister(PhysicalRegister &r, VirtualRegi
if (!r.allocatable)
return true;
if (r.reg.isFloat() != vregs[group->registers[0]].isFloatReg())
if (!vregs[group->registers[0]].isCompatibleReg(r.reg))
return true;
bool allocatable = true;
@ -753,7 +753,7 @@ BacktrackingAllocator::tryAllocateRegister(PhysicalRegister &r, LiveInterval *in
return true;
BacktrackingVirtualRegister *reg = &vregs[interval->vreg()];
if (reg->isFloatReg() != r.reg.isFloat())
if (!reg->isCompatibleReg(r.reg))
return true;
JS_ASSERT_IF(interval->requirement()->kind() == Requirement::FIXED,
@ -761,25 +761,29 @@ BacktrackingAllocator::tryAllocateRegister(PhysicalRegister &r, LiveInterval *in
for (size_t i = 0; i < interval->numRanges(); i++) {
AllocatedRange range(interval, interval->getRange(i)), existing;
if (r.allocations.contains(range, &existing)) {
if (existing.interval->hasVreg()) {
if (IonSpewEnabled(IonSpew_RegAlloc)) {
for (int a = 0; a < r.reg.numAliased(); a++) {
PhysicalRegister &rAlias = registers[r.reg.aliased(a).code()];
if (rAlias.allocations.contains(range, &existing)) {
if (existing.interval->hasVreg()) {
if (IonSpewEnabled(IonSpew_RegAlloc)) {
IonSpew(IonSpew_RegAlloc, " %s collides with v%u[%u] %s [weight %lu]",
r.reg.name(), existing.interval->vreg(),
existing.interval->index(),
existing.range->toString(),
computeSpillWeight(existing.interval));
}
if (!*pconflicting || computeSpillWeight(existing.interval) < computeSpillWeight(*pconflicting))
*pconflicting = existing.interval;
} else {
if (IonSpewEnabled(IonSpew_RegAlloc)) {
rAlias.reg.name(), existing.interval->vreg(),
existing.interval->index(),
existing.range->toString(),
computeSpillWeight(existing.interval));
}
if (!*pconflicting || computeSpillWeight(existing.interval) < computeSpillWeight(*pconflicting))
*pconflicting = existing.interval;
} else {
if (IonSpewEnabled(IonSpew_RegAlloc)) {
IonSpew(IonSpew_RegAlloc, " %s collides with fixed use %s",
r.reg.name(), existing.range->toString());
rAlias.reg.name(), existing.range->toString());
}
*pfixed = true;
}
*pfixed = true;
return true;
}
return true;
}
}