Merge branch 'vendor/GCC50' - gcc 5.0 snapshot 1 FEB 2015
[dragonfly.git] / contrib / gcc-5.0 / gcc / domwalk.h
1 /* Generic dominator tree walker
2    Copyright (C) 2003-2015 Free Software Foundation, Inc.
3    Contributed by Diego Novillo <dnovillo@redhat.com>
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
11
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3.  If not see
19 <http://www.gnu.org/licenses/>.  */
20
21 #ifndef GCC_DOM_WALK_H
22 #define GCC_DOM_WALK_H
23
24 /**
25  * This is the main class for the dominator walker. It is expected that
26  * consumers will have a custom class inheriting from it, which will over ride
27  * at least one of before_dom_children and after_dom_children to implement the
28  * custom behavior.
29  */
30 class dom_walker
31 {
32 public:
33   dom_walker (cdi_direction direction) : m_dom_direction (direction) {}
34
35   /* Walk the dominator tree.  */
36   void walk (basic_block);
37
38   /* Function to call before the recursive walk of the dominator children.  */
39   virtual void before_dom_children (basic_block) {}
40
41   /* Function to call after the recursive walk of the dominator children.  */
42   virtual void after_dom_children (basic_block) {}
43
44 private:
45   /* This is the direction of the dominator tree we want to walk.  i.e.,
46      if it is set to CDI_DOMINATORS, then we walk the dominator tree,
47      if it is set to CDI_POST_DOMINATORS, then we walk the post
48      dominator tree.  */
49   const ENUM_BITFIELD (cdi_direction) m_dom_direction : 2;
50 };
51
52 #endif