Search in sources :

Example 1 with ExplodeLoopNode

use of org.graalvm.compiler.replacements.nodes.ExplodeLoopNode in project graal by oracle.

the class SnippetTemplate method explodeLoops.

public static void explodeLoops(final StructuredGraph snippetCopy, PhaseContext phaseContext) {
    // Do any required loop explosion
    boolean exploded = false;
    do {
        exploded = false;
        ExplodeLoopNode explodeLoop = snippetCopy.getNodes().filter(ExplodeLoopNode.class).first();
        if (explodeLoop != null) {
            // Earlier canonicalization may have removed the loop
            // altogether
            LoopBeginNode loopBegin = explodeLoop.findLoopBegin();
            if (loopBegin != null) {
                LoopEx loop = new LoopsData(snippetCopy).loop(loopBegin);
                Mark mark = snippetCopy.getMark();
                LoopTransformations.fullUnroll(loop, phaseContext, new CanonicalizerPhase());
                new CanonicalizerPhase().applyIncremental(snippetCopy, phaseContext, mark);
                loop.deleteUnusedNodes();
            }
            GraphUtil.removeFixedWithUnusedInputs(explodeLoop);
            exploded = true;
        }
    } while (exploded);
}
Also used : LoopBeginNode(org.graalvm.compiler.nodes.LoopBeginNode) LoopsData(org.graalvm.compiler.loop.LoopsData) LoopEx(org.graalvm.compiler.loop.LoopEx) ExplodeLoopNode(org.graalvm.compiler.replacements.nodes.ExplodeLoopNode) Mark(org.graalvm.compiler.graph.Graph.Mark) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase)

Aggregations

Mark (org.graalvm.compiler.graph.Graph.Mark)1 LoopEx (org.graalvm.compiler.loop.LoopEx)1 LoopsData (org.graalvm.compiler.loop.LoopsData)1 LoopBeginNode (org.graalvm.compiler.nodes.LoopBeginNode)1 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)1 ExplodeLoopNode (org.graalvm.compiler.replacements.nodes.ExplodeLoopNode)1