From 633021e6ff6b9a57a374a994e74cfd69275ce100 Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Wed, 1 Oct 2014 14:12:25 +0100 Subject: 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 --- compiler/optimizing/graph_checker.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'compiler/optimizing/graph_checker.h') 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`. -- cgit v1.2.3-59-g8ed1b