use of org.graalvm.compiler.lir.LIRInstruction in project graal by oracle.
the class LocationMarker method processBlock.
@SuppressWarnings("try")
private void processBlock(AbstractBlockBase<?> block, UniqueWorkList worklist) {
if (updateOutBlock(block)) {
DebugContext debug = lir.getDebug();
try (Indent indent = debug.logAndIndent("handle block %s", block)) {
currentSet = liveOutMap.get(block).copy();
ArrayList<LIRInstruction> instructions = lir.getLIRforBlock(block);
for (int i = instructions.size() - 1; i >= 0; i--) {
LIRInstruction inst = instructions.get(i);
processInstructionBottomUp(inst);
}
liveInMap.put(block, currentSet);
currentSet = null;
for (AbstractBlockBase<?> b : block.getPredecessors()) {
worklist.add(b);
}
}
}
}
use of org.graalvm.compiler.lir.LIRInstruction in project graal by oracle.
the class FixPointIntervalBuilder method processBlock.
@SuppressWarnings("try")
private void processBlock(AbstractBlockBase<?> block, Deque<AbstractBlockBase<?>> worklist) {
DebugContext debug = lir.getDebug();
if (updateOutBlock(block)) {
try (Indent indent = debug.logAndIndent("handle block %s", block)) {
ArrayList<LIRInstruction> instructions = lir.getLIRforBlock(block);
// get out set and mark intervals
BitSet outSet = liveOutMap.get(block);
markOutInterval(outSet, getBlockEnd(instructions));
printLiveSet("liveOut", outSet);
// process instructions
BlockClosure closure = new BlockClosure((BitSet) outSet.clone());
for (int i = instructions.size() - 1; i >= 0; i--) {
LIRInstruction inst = instructions.get(i);
closure.processInstructionBottomUp(inst);
}
// add predecessors to work list
for (AbstractBlockBase<?> b : block.getPredecessors()) {
worklist.add(b);
}
// set in set and mark intervals
BitSet inSet = closure.getCurrentSet();
liveInMap.put(block, inSet);
markInInterval(inSet, getBlockBegin(instructions));
printLiveSet("liveIn", inSet);
}
}
}
use of org.graalvm.compiler.lir.LIRInstruction 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);
}
}
}
}
}
}
use of org.graalvm.compiler.lir.LIRInstruction in project graal by oracle.
the class LIRGenerator method append.
@Override
public <I extends LIRInstruction> I append(I op) {
LIR lir = res.getLIR();
if (printIrWithLir) {
TTY.println(op.toStringWithIdPrefix());
TTY.println();
}
assert LIRVerifier.verify(op);
ArrayList<LIRInstruction> lirForBlock = lir.getLIRforBlock(getCurrentBlock());
op.setPosition(currentPosition);
lirForBlock.add(op);
return op;
}
use of org.graalvm.compiler.lir.LIRInstruction in project graal by oracle.
the class PhiResolver method emitMove.
private void emitMove(Value dest, Value src) {
assert isLegal(src);
assert isLegal(dest);
LIRInstruction move = moveFactory.createMove((AllocatableValue) dest, src);
buffer.append(insertBefore, move);
}
Aggregations