Search in sources :

Example 6 with BasePhase

use of org.graalvm.compiler.phases.BasePhase in project graal by oracle.

the class GraalCompilerTest method getCustomGraphBuilderSuite.

protected PhaseSuite<HighTierContext> getCustomGraphBuilderSuite(GraphBuilderConfiguration gbConf) {
    PhaseSuite<HighTierContext> suite = getDefaultGraphBuilderSuite();
    ListIterator<BasePhase<? super HighTierContext>> iterator = suite.findPhase(GraphBuilderPhase.class);
    initializeInvocationPluginExtensions();
    GraphBuilderConfiguration gbConfCopy = editGraphBuilderConfiguration(gbConf.copy());
    iterator.remove();
    iterator.add(new GraphBuilderPhase(gbConfCopy));
    return suite;
}
Also used : GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) GraphBuilderPhase(org.graalvm.compiler.java.GraphBuilderPhase) BasePhase(org.graalvm.compiler.phases.BasePhase)

Example 7 with BasePhase

use of org.graalvm.compiler.phases.BasePhase in project graal by oracle.

the class AddressLoweringHotSpotSuitesProvider method createSuites.

@Override
public Suites createSuites(OptionValues options) {
    Suites suites = super.createSuites(options);
    ListIterator<BasePhase<? super LowTierContext>> findPhase = suites.getLowTier().findPhase(FixReadsPhase.class);
    if (findPhase == null) {
        findPhase = suites.getLowTier().findPhase(ExpandLogicPhase.class);
    }
    findPhase.add(new AddressLoweringPhase(addressLowering));
    return suites;
}
Also used : LowTierContext(org.graalvm.compiler.phases.tiers.LowTierContext) ExpandLogicPhase(org.graalvm.compiler.phases.common.ExpandLogicPhase) BasePhase(org.graalvm.compiler.phases.BasePhase) AddressLoweringPhase(org.graalvm.compiler.phases.common.AddressLoweringPhase) Suites(org.graalvm.compiler.phases.tiers.Suites)

Example 8 with BasePhase

use of org.graalvm.compiler.phases.BasePhase in project graal by oracle.

the class GraalCompilerTest method createSuites.

protected Suites createSuites(OptionValues opts) {
    Suites ret = backend.getSuites().getDefaultSuites(opts).copy();
    ListIterator<BasePhase<? super HighTierContext>> iter = ret.getHighTier().findPhase(ConvertDeoptimizeToGuardPhase.class, true);
    if (iter == null) {
        /*
             * in the economy configuration, we don't have the ConvertDeoptimizeToGuard phase, so we
             * just select the first CanonicalizerPhase in HighTier
             */
        iter = ret.getHighTier().findPhase(CanonicalizerPhase.class);
    }
    iter.add(new Phase() {

        @Override
        protected void run(StructuredGraph graph) {
            ComputeLoopFrequenciesClosure.compute(graph);
        }

        @Override
        public float codeSizeIncrease() {
            return NodeSize.IGNORE_SIZE_CONTRACT_FACTOR;
        }

        @Override
        protected CharSequence getName() {
            return "ComputeLoopFrequenciesPhase";
        }
    });
    ret.getHighTier().appendPhase(new Phase() {

        @Override
        protected void run(StructuredGraph graph) {
            assert checkHighTierGraph(graph) : "failed HighTier graph check";
        }

        @Override
        public float codeSizeIncrease() {
            return NodeSize.IGNORE_SIZE_CONTRACT_FACTOR;
        }

        @Override
        protected CharSequence getName() {
            return "CheckGraphPhase";
        }
    });
    ret.getMidTier().appendPhase(new Phase() {

        @Override
        protected void run(StructuredGraph graph) {
            assert checkMidTierGraph(graph) : "failed MidTier graph check";
        }

        @Override
        public float codeSizeIncrease() {
            return NodeSize.IGNORE_SIZE_CONTRACT_FACTOR;
        }

        @Override
        protected CharSequence getName() {
            return "CheckGraphPhase";
        }
    });
    ret.getLowTier().appendPhase(new Phase() {

        @Override
        protected void run(StructuredGraph graph) {
            assert checkLowTierGraph(graph) : "failed LowTier graph check";
        }

        @Override
        public float codeSizeIncrease() {
            return NodeSize.IGNORE_SIZE_CONTRACT_FACTOR;
        }

        @Override
        protected CharSequence getName() {
            return "CheckGraphPhase";
        }
    });
    return ret;
}
Also used : BasePhase(org.graalvm.compiler.phases.BasePhase) SchedulePhase(org.graalvm.compiler.phases.schedule.SchedulePhase) GraphBuilderPhase(org.graalvm.compiler.java.GraphBuilderPhase) Phase(org.graalvm.compiler.phases.Phase) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) ConvertDeoptimizeToGuardPhase(org.graalvm.compiler.phases.common.ConvertDeoptimizeToGuardPhase) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) BasePhase(org.graalvm.compiler.phases.BasePhase) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) Suites(org.graalvm.compiler.phases.tiers.Suites)

Example 9 with BasePhase

use of org.graalvm.compiler.phases.BasePhase in project graal by oracle.

the class LoopPartialUnrollTest method createSuites.

@Override
protected Suites createSuites(OptionValues opts) {
    Suites suites = super.createSuites(opts).copy();
    PhaseSuite<MidTierContext> mid = suites.getMidTier();
    ListIterator<BasePhase<? super MidTierContext>> iter = mid.findPhase(LoopPartialUnrollPhase.class);
    BasePhase<? super MidTierContext> partialUnoll = iter.previous();
    if (iter.previous().getClass() != FrameStateAssignmentPhase.class) {
        // Ensure LoopPartialUnrollPhase runs immediately after FrameStateAssignment, so it gets
        // priority over other optimizations in these tests.
        mid.findPhase(LoopPartialUnrollPhase.class).remove();
        ListIterator<BasePhase<? super MidTierContext>> fsa = mid.findPhase(FrameStateAssignmentPhase.class);
        fsa.add(partialUnoll);
    }
    return suites;
}
Also used : MidTierContext(org.graalvm.compiler.phases.tiers.MidTierContext) LoopPartialUnrollPhase(org.graalvm.compiler.loop.phases.LoopPartialUnrollPhase) BasePhase(org.graalvm.compiler.phases.BasePhase) Suites(org.graalvm.compiler.phases.tiers.Suites)

Aggregations

BasePhase (org.graalvm.compiler.phases.BasePhase)9 Suites (org.graalvm.compiler.phases.tiers.Suites)8 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)5 LowTierContext (org.graalvm.compiler.phases.tiers.LowTierContext)4 LIRSuites (org.graalvm.compiler.lir.phases.LIRSuites)3 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)3 MidTierContext (org.graalvm.compiler.phases.tiers.MidTierContext)3 GraphBuilderPhase (org.graalvm.compiler.java.GraphBuilderPhase)2 AddressLoweringPhase (org.graalvm.compiler.phases.common.AddressLoweringPhase)2 ConvertDeoptimizeToGuardPhase (org.graalvm.compiler.phases.common.ConvertDeoptimizeToGuardPhase)2 ExpandLogicPhase (org.graalvm.compiler.phases.common.ExpandLogicPhase)2 InliningPhase (org.graalvm.compiler.phases.common.inlining.InliningPhase)2 SchedulePhase (org.graalvm.compiler.phases.schedule.SchedulePhase)2 HostedProviders (com.oracle.graal.pointsto.meta.HostedProviders)1 SubstrateAMD64AddressLowering (com.oracle.svm.core.graal.code.amd64.SubstrateAMD64AddressLowering)1 SubstrateAMD64RegisterConfig (com.oracle.svm.core.graal.code.amd64.SubstrateAMD64RegisterConfig)1 CollectDeoptimizationSourcePositionsPhase (com.oracle.svm.core.graal.phases.CollectDeoptimizationSourcePositionsPhase)1 DeadStoreRemovalPhase (com.oracle.svm.core.graal.phases.DeadStoreRemovalPhase)1 MethodSafepointInsertionPhase (com.oracle.svm.core.graal.phases.MethodSafepointInsertionPhase)1 OptimizeExceptionCallsPhase (com.oracle.svm.core.graal.phases.OptimizeExceptionCallsPhase)1