summaryrefslogtreecommitdiff
path: root/compiler/optimizing/graph_checker.h
diff options
context:
space:
mode:
author Roland Levillain <rpl@google.com> 2014-10-01 14:12:25 +0100
committer Roland Levillain <rpl@google.com> 2014-10-14 14:44:16 +0100
commit633021e6ff6b9a57a374a994e74cfd69275ce100 (patch)
tree78755b7e5d90f1374b317cea2193605de9bdd2d9 /compiler/optimizing/graph_checker.h
parenta8069ce1c3caa4f9b1651988986f3732152c186d (diff)
Implement default traversals in CFG & SSA graph checkers.
- Check CFG graphs using an insertion order traversal. - Check SSA form graphs using a reverse post-order traversal. Change-Id: Ib9062599bdbf3c17b9f213b743274b2d71a9fa90
Diffstat (limited to 'compiler/optimizing/graph_checker.h')
-rw-r--r--compiler/optimizing/graph_checker.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/optimizing/graph_checker.h b/compiler/optimizing/graph_checker.h
index 34a770b5f3..862f1b600b 100644
--- a/compiler/optimizing/graph_checker.h
+++ b/compiler/optimizing/graph_checker.h
@@ -29,6 +29,9 @@ class GraphChecker : public HGraphVisitor {
allocator_(allocator),
errors_(allocator, 0) {}
+ // Check the whole graph (in insertion order).
+ virtual void Run() { VisitInsertionOrder(); }
+
// Check `block`.
virtual void VisitBasicBlock(HBasicBlock* block) OVERRIDE;
@@ -65,6 +68,14 @@ class SSAChecker : public GraphChecker {
SSAChecker(ArenaAllocator* allocator, HGraph* graph)
: GraphChecker(allocator, graph) {}
+ // Check the whole graph (in reverse post-order).
+ virtual void Run() {
+ // VisitReversePostOrder is used instead of VisitInsertionOrder,
+ // as the latter might visit dead blocks removed by the dominator
+ // computation.
+ VisitReversePostOrder();
+ }
+
// Perform SSA form checks on `block`.
virtual void VisitBasicBlock(HBasicBlock* block) OVERRIDE;
// Loop-related checks from block `loop_header`.