Mercurial > hg > graal-compiler
changeset 9137:f5c6a9b0262f
MidTier phase suite.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Tue, 16 Apr 2013 13:22:12 +0200 |
parents | 2cfdde003076 |
children | cf3c89ef00f7 |
files | graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/BasicConfiguration.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/MidTier.java graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhaseSuite.java graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/CompilerConfiguration.java graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/MidTierContext.java graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java |
diffstat | 7 files changed, 115 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Tue Apr 16 13:21:23 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Tue Apr 16 13:22:12 2013 +0200 @@ -143,42 +143,8 @@ new LoweringPhase(target, runtime, replacements, assumptions).apply(graph); - if (GraalOptions.OptPushThroughPi) { - new PushThroughPiPhase().apply(graph); - if (GraalOptions.OptCanonicalizer) { - new CanonicalizerPhase.Instance(runtime, assumptions).apply(graph); - } - } - - if (GraalOptions.OptFloatingReads) { - int mark = graph.getMark(); - new FloatingReadPhase().apply(graph); - new CanonicalizerPhase.Instance(runtime, assumptions, mark, null).apply(graph); - if (GraalOptions.OptReadElimination) { - new ReadEliminationPhase().apply(graph); - } - } - new RemoveValueProxyPhase().apply(graph); - - if (GraalOptions.OptCanonicalizer) { - new CanonicalizerPhase.Instance(runtime, assumptions).apply(graph); - } - - if (GraalOptions.OptEliminatePartiallyRedundantGuards) { - new EliminatePartiallyRedundantGuardsPhase(false, true).apply(graph); - } - - if (GraalOptions.ConditionalElimination && GraalOptions.OptCanonicalizer) { - new IterativeConditionalEliminationPhase().apply(graph, highTierContext); - } - - if (GraalOptions.OptEliminatePartiallyRedundantGuards) { - new EliminatePartiallyRedundantGuardsPhase(true, true).apply(graph); - } - - if (GraalOptions.OptCanonicalizer) { - new CanonicalizerPhase.Instance(runtime, assumptions).apply(graph); - } + MidTierContext midTierContext = new MidTierContext(runtime, assumptions); + Suites.DEFAULT.midTier.apply(graph, midTierContext); plan.runPhases(PhasePosition.MID_LEVEL, graph);
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/BasicConfiguration.java Tue Apr 16 13:21:23 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/BasicConfiguration.java Tue Apr 16 13:22:12 2013 +0200 @@ -32,4 +32,8 @@ public PhaseSuite<HighTierContext> createHighTier() { return new HighTier(); } + + public PhaseSuite<MidTierContext> createMidTier() { + return new MidTier(); + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/MidTier.java Tue Apr 16 13:22:12 2013 +0200 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.compiler.phases; + +import com.oracle.graal.phases.*; +import com.oracle.graal.phases.common.*; +import com.oracle.graal.phases.tiers.*; + +public class MidTier extends PhaseSuite<MidTierContext> { + + public MidTier() { + if (GraalOptions.OptPushThroughPi) { + addPhase(new PushThroughPiPhase()); + if (GraalOptions.OptCanonicalizer) { + addPhase(new CanonicalizerPhase()); + } + } + + if (GraalOptions.OptFloatingReads) { + PartialCanonicalizerPhase<MidTierContext> canonicalizer = new PartialCanonicalizerPhase<>(); + canonicalizer.addPhase(new FloatingReadPhase()); + addPhase(canonicalizer); + if (GraalOptions.OptReadElimination) { + addPhase(new ReadEliminationPhase()); + } + } + addPhase(new RemoveValueProxyPhase()); + + if (GraalOptions.OptCanonicalizer) { + addPhase(new CanonicalizerPhase()); + } + + if (GraalOptions.OptEliminatePartiallyRedundantGuards) { + addPhase(new EliminatePartiallyRedundantGuardsPhase(false, true)); + } + + if (GraalOptions.ConditionalElimination && GraalOptions.OptCanonicalizer) { + addPhase(new IterativeConditionalEliminationPhase()); + } + + if (GraalOptions.OptEliminatePartiallyRedundantGuards) { + addPhase(new EliminatePartiallyRedundantGuardsPhase(true, true)); + } + + if (GraalOptions.OptCanonicalizer) { + addPhase(new CanonicalizerPhase()); + } + } +}
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhaseSuite.java Tue Apr 16 13:21:23 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhaseSuite.java Tue Apr 16 13:22:12 2013 +0200 @@ -34,17 +34,17 @@ this.phases = new ArrayList<>(); } - protected final void addPhase(BasePhase<? super C> phase) { + public final void addPhase(BasePhase<? super C> phase) { phases.add(phase); } - protected final ListIterator<BasePhase<? super C>> findPhase(Class<? extends BasePhase<? super C>> phaseClass) { + public final ListIterator<BasePhase<? super C>> findPhase(Class<? extends BasePhase<? super C>> phaseClass) { ListIterator<BasePhase<? super C>> it = phases.listIterator(); findNextPhase(it, phaseClass); return it; } - protected static <C> void findNextPhase(ListIterator<BasePhase<? super C>> it, Class<? extends BasePhase<? super C>> phaseClass) { + public static <C> void findNextPhase(ListIterator<BasePhase<? super C>> it, Class<? extends BasePhase<? super C>> phaseClass) { while (it.hasNext()) { BasePhase<? super C> phase = it.next(); if (phaseClass.isInstance(phase)) {
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/CompilerConfiguration.java Tue Apr 16 13:21:23 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/CompilerConfiguration.java Tue Apr 16 13:22:12 2013 +0200 @@ -27,4 +27,6 @@ public interface CompilerConfiguration { PhaseSuite<HighTierContext> createHighTier(); + + PhaseSuite<MidTierContext> createMidTier(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/MidTierContext.java Tue Apr 16 13:22:12 2013 +0200 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.phases.tiers; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; + +public class MidTierContext extends PhaseContext { + + public MidTierContext(MetaAccessProvider runtime, Assumptions assumptions) { + super(runtime, assumptions); + } +}
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java Tue Apr 16 13:21:23 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java Tue Apr 16 13:22:12 2013 +0200 @@ -30,6 +30,7 @@ public final class Suites { public final PhaseSuite<HighTierContext> highTier; + public final PhaseSuite<MidTierContext> midTier; public static final Suites DEFAULT; @@ -50,6 +51,7 @@ private Suites(CompilerConfiguration config) { highTier = config.createHighTier(); + midTier = config.createMidTier(); } public static Suites createDefaultSuites() {