# HG changeset patch # User Roland Schatz # Date 1366111332 -7200 # Node ID f5c6a9b0262f4d1cf853706e7f5cb548385a97e5 # Parent 2cfdde00307640537641cd2993ec0ca543d3bfe5 MidTier phase suite. diff -r 2cfdde003076 -r f5c6a9b0262f graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- 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); diff -r 2cfdde003076 -r f5c6a9b0262f graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/BasicConfiguration.java --- 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 createHighTier() { return new HighTier(); } + + public PhaseSuite createMidTier() { + return new MidTier(); + } } diff -r 2cfdde003076 -r f5c6a9b0262f graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/MidTier.java --- /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 { + + public MidTier() { + if (GraalOptions.OptPushThroughPi) { + addPhase(new PushThroughPiPhase()); + if (GraalOptions.OptCanonicalizer) { + addPhase(new CanonicalizerPhase()); + } + } + + if (GraalOptions.OptFloatingReads) { + PartialCanonicalizerPhase 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()); + } + } +} diff -r 2cfdde003076 -r f5c6a9b0262f graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhaseSuite.java --- 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 phase) { + public final void addPhase(BasePhase phase) { phases.add(phase); } - protected final ListIterator> findPhase(Class> phaseClass) { + public final ListIterator> findPhase(Class> phaseClass) { ListIterator> it = phases.listIterator(); findNextPhase(it, phaseClass); return it; } - protected static void findNextPhase(ListIterator> it, Class> phaseClass) { + public static void findNextPhase(ListIterator> it, Class> phaseClass) { while (it.hasNext()) { BasePhase phase = it.next(); if (phaseClass.isInstance(phase)) { diff -r 2cfdde003076 -r f5c6a9b0262f graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/CompilerConfiguration.java --- 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 createHighTier(); + + PhaseSuite createMidTier(); } diff -r 2cfdde003076 -r f5c6a9b0262f graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/MidTierContext.java --- /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); + } +} diff -r 2cfdde003076 -r f5c6a9b0262f graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java --- 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 highTier; + public final PhaseSuite midTier; public static final Suites DEFAULT; @@ -50,6 +51,7 @@ private Suites(CompilerConfiguration config) { highTier = config.createHighTier(); + midTier = config.createMidTier(); } public static Suites createDefaultSuites() {