1 /* |
1 /* |
2 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
27 import org.graalvm.compiler.debug.DebugContext; |
27 import org.graalvm.compiler.debug.DebugContext; |
28 import org.graalvm.compiler.loop.LoopEx; |
28 import org.graalvm.compiler.loop.LoopEx; |
29 import org.graalvm.compiler.loop.LoopPolicies; |
29 import org.graalvm.compiler.loop.LoopPolicies; |
30 import org.graalvm.compiler.loop.LoopsData; |
30 import org.graalvm.compiler.loop.LoopsData; |
31 import org.graalvm.compiler.nodes.StructuredGraph; |
31 import org.graalvm.compiler.nodes.StructuredGraph; |
32 import org.graalvm.compiler.phases.tiers.PhaseContext; |
32 import org.graalvm.compiler.nodes.spi.CoreProviders; |
33 |
33 |
34 public class LoopPeelingPhase extends LoopPhase<LoopPolicies> { |
34 public class LoopPeelingPhase extends LoopPhase<LoopPolicies> { |
35 |
35 |
36 public LoopPeelingPhase(LoopPolicies policies) { |
36 public LoopPeelingPhase(LoopPolicies policies) { |
37 super(policies); |
37 super(policies); |
38 } |
38 } |
39 |
39 |
40 @Override |
40 @Override |
41 @SuppressWarnings("try") |
41 @SuppressWarnings("try") |
42 protected void run(StructuredGraph graph, PhaseContext context) { |
42 protected void run(StructuredGraph graph, CoreProviders context) { |
43 DebugContext debug = graph.getDebug(); |
43 DebugContext debug = graph.getDebug(); |
44 if (graph.hasLoops()) { |
44 if (graph.hasLoops()) { |
45 LoopsData data = new LoopsData(graph); |
45 LoopsData data = new LoopsData(graph); |
46 try (DebugContext.Scope s = debug.scope("peeling", data.getCFG())) { |
46 try (DebugContext.Scope s = debug.scope("peeling", data.getCFG())) { |
47 for (LoopEx loop : data.outerFirst()) { |
47 for (LoopEx loop : data.outerFirst()) { |