зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1132390 - Consider immediately adjacent move groups when assigning scratch registers to move groups, r=sunfish.
This commit is contained in:
Родитель
19acecca55
Коммит
6b5ad1ac1f
|
@ -1545,15 +1545,36 @@ BacktrackingAllocator::annotateMoveGroups()
|
||||||
// or (b) it is an operand in one of the group's moves. The
|
// or (b) it is an operand in one of the group's moves. The
|
||||||
// latter case handles live intervals which end immediately
|
// latter case handles live intervals which end immediately
|
||||||
// before the move group or start immediately after.
|
// 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;
|
bool found = false;
|
||||||
LGeneralReg alloc(reg.reg.gpr());
|
LInstructionIterator niter(iter);
|
||||||
for (size_t j = 0; j < iter->toMoveGroup()->numMoves(); j++) {
|
for (niter++; niter != block->end(); niter++) {
|
||||||
LMove move = iter->toMoveGroup()->getMove(j);
|
if (niter->isMoveGroup()) {
|
||||||
if (*move.from() == alloc || *move.to() == alloc) {
|
if (niter->toMoveGroup()->uses(reg.reg.gpr())) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
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))
|
if (found || reg.allocations.contains(search, &existing))
|
||||||
|
|
|
@ -153,6 +153,15 @@ class LMoveGroup : public LInstructionHelper<0, 0, 0>
|
||||||
return LAllocation();
|
return LAllocation();
|
||||||
#endif
|
#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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче