use of org.graalvm.compiler.lir.sparc.SPARCDelayedControlTransfer in project graal by oracle.
the class SPARCHotSpotBackend method stuffDelayedControlTransfers.
/**
* Tries to put DelayedControlTransfer instructions and DelayableLIRInstructions together. Also
* it tries to move the DelayedLIRInstruction to the DelayedControlTransfer instruction, if
* possible.
*/
private static void stuffDelayedControlTransfers(LIR l, AbstractBlockBase<?> block) {
ArrayList<LIRInstruction> instructions = l.getLIRforBlock(block);
if (instructions.size() >= 2) {
LIRDependencyAccumulator acc = new LIRDependencyAccumulator();
SPARCDelayedControlTransfer delayedTransfer = null;
int delayTransferPosition = -1;
for (int i = instructions.size() - 1; i >= 0; i--) {
LIRInstruction inst = instructions.get(i);
boolean adjacent = delayTransferPosition - i == 1;
if (!adjacent || inst.destroysCallerSavedRegisters() || leavesRegisterWindow(inst)) {
delayedTransfer = null;
}
if (inst instanceof SPARCDelayedControlTransfer) {
delayedTransfer = (SPARCDelayedControlTransfer) inst;
acc.start(inst);
delayTransferPosition = i;
} else if (delayedTransfer != null) {
boolean overlap = acc.add(inst);
if (!overlap && inst instanceof SPARCTailDelayedLIRInstruction) {
// We have found a non overlapping LIR instruction which can be delayed
((SPARCTailDelayedLIRInstruction) inst).setDelayedControlTransfer(delayedTransfer);
delayedTransfer = null;
}
}
}
}
}
Aggregations