Search in sources :

Example 1 with ScheduleResult

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());
    }
}
Also used : ScheduleResult(org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult) AbstractControlFlowGraph(org.graalvm.compiler.core.common.cfg.AbstractControlFlowGraph) ControlFlowGraph(org.graalvm.compiler.nodes.cfg.ControlFlowGraph) Block(org.graalvm.compiler.nodes.cfg.Block) List(java.util.List) DebugContext(org.graalvm.compiler.debug.DebugContext)

Example 2 with ScheduleResult

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);
}
Also used : ScheduleResult(org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult) Block(org.graalvm.compiler.nodes.cfg.Block)

Example 3 with ScheduleResult

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);
        }
    }
}
Also used : SchedulePhase(org.graalvm.compiler.phases.schedule.SchedulePhase) ScheduleResult(org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult) AbstractMergeNode(org.graalvm.compiler.nodes.AbstractMergeNode) InstanceOfNode(org.graalvm.compiler.nodes.java.InstanceOfNode) Node(org.graalvm.compiler.graph.Node) PhiNode(org.graalvm.compiler.nodes.PhiNode) Block(org.graalvm.compiler.nodes.cfg.Block)

Example 4 with ScheduleResult

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);
}
Also used : ScheduleResult(org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult) Test(org.junit.Test)

Example 5 with ScheduleResult

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);
}
Also used : ScheduleResult(org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult) Test(org.junit.Test)

Aggregations

ScheduleResult (org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult)38 Test (org.junit.Test)24 Block (org.graalvm.compiler.nodes.cfg.Block)14 Node (org.graalvm.compiler.graph.Node)10 SchedulePhase (org.graalvm.compiler.phases.schedule.SchedulePhase)9 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)8 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)6 ValueNode (org.graalvm.compiler.nodes.ValueNode)6 List (java.util.List)5 AbstractMergeNode (org.graalvm.compiler.nodes.AbstractMergeNode)5 FixedWithNextNode (org.graalvm.compiler.nodes.FixedWithNextNode)5 LoopExitNode (org.graalvm.compiler.nodes.LoopExitNode)5 DebugContext (org.graalvm.compiler.debug.DebugContext)4 FixedNode (org.graalvm.compiler.nodes.FixedNode)4 FrameState (org.graalvm.compiler.nodes.FrameState)4 LoopBeginNode (org.graalvm.compiler.nodes.LoopBeginNode)4 ReturnNode (org.graalvm.compiler.nodes.ReturnNode)4 InitializeKlassNode (org.graalvm.compiler.hotspot.nodes.aot.InitializeKlassNode)3 LoadConstantIndirectlyFixedNode (org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyFixedNode)3 LoadConstantIndirectlyNode (org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyNode)3