Bug 1132390 - Consider immediately adjacent move groups when assigning scratch registers to move groups, r=sunfish.

This commit is contained in:
Brian Hackett 2015-02-21 16:32:59 -06:00
Родитель 19acecca55
Коммит 6b5ad1ac1f
2 изменённых файлов: 35 добавлений и 5 удалений

Просмотреть файл

@ -1545,16 +1545,37 @@ BacktrackingAllocator::annotateMoveGroups()
// or (b) it is an operand in one of the group's moves. The
// latter case handles live intervals which end immediately
// before the move group or start immediately after.
// For (b) we need to consider move groups immediately
// preceding or following this one.
if (iter->toMoveGroup()->uses(reg.reg.gpr()))
continue;
bool found = false;
LGeneralReg alloc(reg.reg.gpr());
for (size_t j = 0; j < iter->toMoveGroup()->numMoves(); j++) {
LMove move = iter->toMoveGroup()->getMove(j);
if (*move.from() == alloc || *move.to() == alloc) {
found = true;
LInstructionIterator niter(iter);
for (niter++; niter != block->end(); niter++) {
if (niter->isMoveGroup()) {
if (niter->toMoveGroup()->uses(reg.reg.gpr())) {
found = true;
break;
}
} else {
break;
}
}
if (iter != block->begin()) {
LInstructionIterator riter(iter);
do {
riter--;
if (riter->isMoveGroup()) {
if (riter->toMoveGroup()->uses(reg.reg.gpr())) {
found = true;
break;
}
} else {
break;
}
} while (riter != block->begin());
}
if (found || reg.allocations.contains(search, &existing))
continue;

Просмотреть файл

@ -153,6 +153,15 @@ class LMoveGroup : public LInstructionHelper<0, 0, 0>
return LAllocation();
#endif
}
bool uses(Register reg) {
for (size_t i = 0; i < numMoves(); i++) {
LMove move = getMove(i);
if (*move.from() == LGeneralReg(reg) || *move.to() == LGeneralReg(reg))
return true;
}
return false;
}
};