changeset 15950:e4567f9acc42

Interface to do graph verification after High/Mid/LowTier in unittests.
author Roland Schatz <roland.schatz@oracle.com>
date Wed, 28 May 2014 12:17:16 +0200
parents 4243a6b8dd19
children aef229a61f96 272b64c1d65b
files graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java
diffstat 1 files changed, 48 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;
     }