use of org.graalvm.compiler.lir.LIRInstruction in project graal by oracle.
the class MoveProfiler method doBlock.
private void doBlock(AbstractBlockBase<?> block) {
ArrayList<LIRInstruction> instructions = lir.getLIRforBlock(block);
assert instructions.size() >= 2 : "Malformed block: " + block + ", " + instructions;
assert instructions.get(instructions.size() - 1) instanceof BlockEndOp : "Not a BlockEndOp: " + instructions.get(instructions.size() - 1);
assert !(instructions.get(instructions.size() - 2) instanceof BlockEndOp) : "Is a BlockEndOp: " + instructions.get(instructions.size() - 2);
assert instructions.get(0) instanceof LabelOp : "Not a LabelOp: " + instructions.get(0);
assert !(instructions.get(1) instanceof LabelOp) : "Is a LabelOp: " + instructions.get(1);
MoveStatistics stats = null;
// analysis phase
for (LIRInstruction inst : instructions) {
if (MoveOp.isMoveOp(inst)) {
if (stats == null) {
stats = new MoveStatistics();
blockMap.put(block, stats);
}
stats.add(MoveType.get(inst));
}
}
}
use of org.graalvm.compiler.lir.LIRInstruction in project graal by oracle.
the class SSAUtil method phiOut.
public static JumpOp phiOut(LIR lir, AbstractBlockBase<?> block) {
assert block.getSuccessorCount() == 1;
ArrayList<LIRInstruction> instructions = lir.getLIRforBlock(block);
int index = instructions.size() - 1;
LIRInstruction op = instructions.get(index);
return (JumpOp) op;
}
use of org.graalvm.compiler.lir.LIRInstruction 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;
}
}
}
}
}
use of org.graalvm.compiler.lir.LIRInstruction in project graal by oracle.
the class CFGPrinter method printTraceInstructions.
private void printTraceInstructions(Trace trace, TraceBuilderResult traceBuilderResult) {
if (lir == null) {
return;
}
begin("IR");
out.println("LIR");
for (AbstractBlockBase<?> block : trace.getBlocks()) {
ArrayList<LIRInstruction> lirInstructions = lir.getLIRforBlock(block);
if (lirInstructions == null) {
continue;
}
printBlockInstruction(block, traceBuilderResult);
for (int i = 0; i < lirInstructions.size(); i++) {
LIRInstruction inst = lirInstructions.get(i);
printLIRInstruction(inst);
}
}
end("IR");
}
use of org.graalvm.compiler.lir.LIRInstruction in project graal by oracle.
the class CFGPrinter method printLIR.
/**
* Prints the LIR for each instruction in a given block.
*
* @param block the block to print
*/
private void printLIR(AbstractBlockBase<?> block) {
if (lir == null) {
return;
}
ArrayList<LIRInstruction> lirInstructions = lir.getLIRforBlock(block);
if (lirInstructions == null) {
return;
}
begin("IR");
out.println("LIR");
if (livenessInfo != null) {
int opId = lirInstructions.get(0).id();
printLiveVars(livenessInfo.getBlockIn(block), "in(var)", opId);
printLiveLoc(livenessInfo.getInLocation(block), "in(loc)", opId);
}
for (int i = 0; i < lirInstructions.size(); i++) {
LIRInstruction inst = lirInstructions.get(i);
printLIRInstruction(inst);
}
if (livenessInfo != null) {
int opId = lirInstructions.get(lirInstructions.size() - 1).id();
printLiveVars(livenessInfo.getBlockOut(block), "out(var)", opId);
printLiveLoc(livenessInfo.getOutLocation(block), "out(loc)", opId);
}
end("IR");
}
Aggregations