Search in sources :

Example 1 with ZapRegistersAfterInstruction

use of org.graalvm.compiler.lir.gen.DiagnosticLIRGeneratorTool.ZapRegistersAfterInstruction in project graal by oracle.

the class HotSpotZapRegistersPhase method processBlock.

@SuppressWarnings("try")
private static void processBlock(DiagnosticLIRGeneratorTool diagnosticLirGenTool, HotSpotLIRGenerationResult res, LIR lir, LIRInsertionBuffer buffer, AbstractBlockBase<?> block, boolean zapRegisters, boolean zapStack) {
    DebugContext debug = lir.getDebug();
    try (Indent indent = debug.logAndIndent("Process block %s", block)) {
        ArrayList<LIRInstruction> instructions = lir.getLIRforBlock(block);
        buffer.init(instructions);
        for (int index = 0; index < instructions.size(); index++) {
            LIRInstruction inst = instructions.get(index);
            if (zapStack && inst instanceof ZapStackArgumentSpaceBeforeInstruction) {
                LIRInstruction zap = diagnosticLirGenTool.zapArgumentSpace();
                if (zap != null) {
                    buffer.append(index, zap);
                }
            }
            if (zapRegisters && inst instanceof ZapRegistersAfterInstruction) {
                LIRFrameState state = getLIRState(inst);
                if (state != null) {
                    SaveRegistersOp zap = diagnosticLirGenTool.createZapRegisters();
                    SaveRegistersOp old = res.getCalleeSaveInfo().put(state, zap);
                    assert old == null : "Already another SaveRegisterOp registered! " + old;
                    buffer.append(index + 1, (LIRInstruction) zap);
                    debug.log("Insert ZapRegister after %s", inst);
                }
            }
        }
        buffer.finish();
    }
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) Indent(org.graalvm.compiler.debug.Indent) ZapRegistersAfterInstruction(org.graalvm.compiler.lir.gen.DiagnosticLIRGeneratorTool.ZapRegistersAfterInstruction) ZapStackArgumentSpaceBeforeInstruction(org.graalvm.compiler.lir.gen.DiagnosticLIRGeneratorTool.ZapStackArgumentSpaceBeforeInstruction) LIRInstruction(org.graalvm.compiler.lir.LIRInstruction) DebugContext(org.graalvm.compiler.debug.DebugContext) SaveRegistersOp(org.graalvm.compiler.lir.StandardOp.SaveRegistersOp)

Aggregations

DebugContext (org.graalvm.compiler.debug.DebugContext)1 Indent (org.graalvm.compiler.debug.Indent)1 LIRFrameState (org.graalvm.compiler.lir.LIRFrameState)1 LIRInstruction (org.graalvm.compiler.lir.LIRInstruction)1 SaveRegistersOp (org.graalvm.compiler.lir.StandardOp.SaveRegistersOp)1 ZapRegistersAfterInstruction (org.graalvm.compiler.lir.gen.DiagnosticLIRGeneratorTool.ZapRegistersAfterInstruction)1 ZapStackArgumentSpaceBeforeInstruction (org.graalvm.compiler.lir.gen.DiagnosticLIRGeneratorTool.ZapStackArgumentSpaceBeforeInstruction)1