# HG changeset patch # User Roland Schatz # Date 1401272236 -7200 # Node ID e4567f9acc4297dfb4e070a1f0755eaf7ad7aa8e # Parent 4243a6b8dd19f46bc38a5a12400d14359caed10e Interface to do graph verification after High/Mid/LowTier in unittests. diff -r 4243a6b8dd19 -r e4567f9acc42 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Wed May 28 12:17:09 2014 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Wed May 28 12:17:16 2014 +0200 @@ -86,6 +86,33 @@ private final Backend backend; private final Suites suites; + /** + * Can be overridden by unit tests to verify properties of the graph. + * + * @param graph the graph at the end of HighTier + */ + protected boolean checkHighTierGraph(StructuredGraph graph) { + return true; + } + + /** + * Can be overridden by unit tests to verify properties of the graph. + * + * @param graph the graph at the end of MidTier + */ + protected boolean checkMidTierGraph(StructuredGraph graph) { + return true; + } + + /** + * Can be overridden by unit tests to verify properties of the graph. + * + * @param graph the graph at the end of LowTier + */ + protected boolean checkLowTierGraph(StructuredGraph graph) { + return true; + } + private static boolean substitutionsInstalled; private void installSubstitutions() { @@ -104,6 +131,27 @@ ComputeLoopFrequenciesClosure.compute(graph); } }); + ret.getHighTier().appendPhase(new Phase("CheckGraphPhase") { + + @Override + protected void run(StructuredGraph graph) { + assert checkHighTierGraph(graph); + } + }); + ret.getMidTier().appendPhase(new Phase("CheckGraphPhase") { + + @Override + protected void run(StructuredGraph graph) { + assert checkMidTierGraph(graph); + } + }); + ret.getLowTier().appendPhase(new Phase("CheckGraphPhase") { + + @Override + protected void run(StructuredGraph graph) { + assert checkLowTierGraph(graph); + } + }); return ret; }