use of org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult in project graal by oracle.
the class ConditionalEliminationPhase method run.
@Override
@SuppressWarnings("try")
protected void run(StructuredGraph graph, PhaseContext context) {
try (DebugContext.Scope s = graph.getDebug().scope("DominatorConditionalElimination")) {
BlockMap<List<Node>> blockToNodes = null;
NodeMap<Block> nodeToBlock = null;
ControlFlowGraph cfg = ControlFlowGraph.compute(graph, true, true, true, true);
if (fullSchedule) {
if (moveGuards) {
cfg.visitDominatorTree(new MoveGuardsUpwards(), graph.hasValueProxies());
}
try (DebugContext.Scope scheduleScope = graph.getDebug().scope(SchedulePhase.class)) {
SchedulePhase.run(graph, SchedulingStrategy.EARLIEST_WITH_GUARD_ORDER, cfg);
} catch (Throwable t) {
throw graph.getDebug().handle(t);
}
ScheduleResult r = graph.getLastSchedule();
blockToNodes = r.getBlockToNodesMap();
nodeToBlock = r.getNodeToBlockMap();
} else {
nodeToBlock = cfg.getNodeToBlock();
blockToNodes = getBlockToNodes(cfg);
}
ControlFlowGraph.RecursiveVisitor<?> visitor = createVisitor(graph, cfg, blockToNodes, nodeToBlock, context);
cfg.visitDominatorTree(visitor, graph.hasValueProxies());
}
}
use of org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult in project graal by oracle.
the class FixReadsPhase method run.
@Override
protected void run(StructuredGraph graph, LowTierContext context) {
schedulePhase.apply(graph);
ScheduleResult schedule = graph.getLastSchedule();
FixReadsClosure fixReadsClosure = new FixReadsClosure();
for (Block block : schedule.getCFG().getBlocks()) {
fixReadsClosure.processNodes(block, schedule);
}
if (GraalOptions.RawConditionalElimination.getValue(graph.getOptions())) {
schedule.getCFG().visitDominatorTree(createVisitor(graph, schedule, context), false);
}
graph.setAfterFixReadPhase(true);
}
use of org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult in project graal by oracle.
the class TypeSystemTest method outputGraph.
public static void outputGraph(StructuredGraph graph, String message) {
TTY.println("========================= " + message);
SchedulePhase schedulePhase = new SchedulePhase(graph.getOptions());
schedulePhase.apply(graph);
ScheduleResult schedule = graph.getLastSchedule();
for (Block block : schedule.getCFG().getBlocks()) {
TTY.print("Block " + block + " ");
if (block == schedule.getCFG().getStartBlock()) {
TTY.print("* ");
}
TTY.print("-> ");
for (Block succ : block.getSuccessors()) {
TTY.print(succ + " ");
}
TTY.println();
for (Node node : schedule.getBlockToNodesMap().get(block)) {
outputNode(node);
}
}
}
use of org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult in project graal by oracle.
the class MemoryScheduleTest method testLoop5.
@Test
public void testLoop5() {
ScheduleResult schedule = getFinalSchedule("testLoop5Snippet", TestMode.WITHOUT_FRAMESTATES);
assertDeepEquals(10, schedule.getCFG().getBlocks().length);
assertReadWithinStartBlock(schedule, false);
assertReadWithinAllReturnBlocks(schedule, false);
}
use of org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult in project graal by oracle.
the class MemoryScheduleTest method testBlockSchedule2.
@Test
public void testBlockSchedule2() {
ScheduleResult schedule = getFinalSchedule("testBlockSchedule2Snippet", TestMode.WITHOUT_FRAMESTATES, SchedulingStrategy.LATEST);
assertReadWithinStartBlock(schedule, false);
assertReadWithinAllReturnBlocks(schedule, false);
assertReadAndWriteInSameBlock(schedule, false);
}
Aggregations