Search in sources :

Example 1 with SPARCTailDelayedLIRInstruction

use of org.graalvm.compiler.lir.sparc.SPARCTailDelayedLIRInstruction 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;
                }
            }
        }
    }
}
Also used : LIRInstruction(org.graalvm.compiler.lir.LIRInstruction) SPARCTailDelayedLIRInstruction(org.graalvm.compiler.lir.sparc.SPARCTailDelayedLIRInstruction) SPARCDelayedControlTransfer(org.graalvm.compiler.lir.sparc.SPARCDelayedControlTransfer) SPARCTailDelayedLIRInstruction(org.graalvm.compiler.lir.sparc.SPARCTailDelayedLIRInstruction)

Aggregations

LIRInstruction (org.graalvm.compiler.lir.LIRInstruction)1 SPARCDelayedControlTransfer (org.graalvm.compiler.lir.sparc.SPARCDelayedControlTransfer)1 SPARCTailDelayedLIRInstruction (org.graalvm.compiler.lir.sparc.SPARCTailDelayedLIRInstruction)1