use of org.graalvm.compiler.lir.ValueProcedure in project graal by oracle.
the class TrivialTraceAllocator method handlePhiOut.
private static void handlePhiOut(LIRInstruction jump, int[] varIn, Value[] locIn) {
// handle outgoing phi values
ValueProcedure outputConsumer = new ValueProcedure() {
@Override
public Value doValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) {
if (isVariable(value)) {
// since incoming variables are sorted, we can do a binary search
return locIn[Arrays.binarySearch(varIn, asVariable(value).index)];
}
return value;
}
};
// Jumps have only alive values (outgoing phi values)
jump.forEachAlive(outputConsumer);
}
use of org.graalvm.compiler.lir.ValueProcedure in project graal by oracle.
the class UseEntry method replaceValue.
private static void replaceValue(LIRInstruction op, Value oldValue, Value newValue) {
ValueProcedure proc = (value, mode, flags) -> value.identityEquals(oldValue) ? newValue : value;
op.forEachAlive(proc);
op.forEachInput(proc);
op.forEachOutput(proc);
op.forEachTemp(proc);
op.forEachState(proc);
}
use of org.graalvm.compiler.lir.ValueProcedure in project graal by oracle.
the class SimpleStackSlotAllocator method updateLIR.
@SuppressWarnings("try")
protected void updateLIR(LIRGenerationResult res, StackSlot[] mapping) {
DebugContext debug = res.getLIR().getDebug();
try (DebugContext.Scope scope = debug.scope("StackSlotMappingLIR")) {
ValueProcedure updateProc = (value, mode, flags) -> {
if (isVirtualStackSlot(value)) {
StackSlot stackSlot = mapping[asVirtualStackSlot(value).getId()];
debug.log("map %s -> %s", value, stackSlot);
return stackSlot;
}
return value;
};
for (AbstractBlockBase<?> block : res.getLIR().getControlFlowGraph().getBlocks()) {
try (Indent indent0 = debug.logAndIndent("block: %s", block)) {
for (LIRInstruction inst : res.getLIR().getLIRforBlock(block)) {
try (Indent indent1 = debug.logAndIndent("Inst: %d: %s", inst.id(), inst)) {
inst.forEachAlive(updateProc);
inst.forEachInput(updateProc);
inst.forEachOutput(updateProc);
inst.forEachTemp(updateProc);
inst.forEachState(updateProc);
}
}
}
}
}
}
Aggregations