PR rtl-optimization/79386
[official-gcc.git] / gcc / dominance.h
blob1de43ee68349ad5117494f4e70a051bf7243d06f
1 /* Calculate (post)dominators header file.
2 Copyright (C) 2014-2017 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_DOMINANCE_H
21 #define GCC_DOMINANCE_H
23 enum cdi_direction
25 CDI_DOMINATORS = 1,
26 CDI_POST_DOMINATORS = 2
29 /* State of dominance information. */
31 enum dom_state
33 DOM_NONE, /* Not computed at all. */
34 DOM_NO_FAST_QUERY, /* The data is OK, but the fast query data are not usable. */
35 DOM_OK /* Everything is ok. */
38 extern void calculate_dominance_info (enum cdi_direction);
39 extern void calculate_dominance_info_for_region (enum cdi_direction,
40 vec<basic_block>);
41 extern void free_dominance_info (function *, enum cdi_direction);
42 extern void free_dominance_info (enum cdi_direction);
43 extern void free_dominance_info_for_region (function *,
44 enum cdi_direction,
45 vec<basic_block>);
46 extern basic_block get_immediate_dominator (enum cdi_direction, basic_block);
47 extern void set_immediate_dominator (enum cdi_direction, basic_block,
48 basic_block);
49 extern vec<basic_block> get_dominated_by (enum cdi_direction, basic_block);
50 extern vec<basic_block> get_dominated_by_region (enum cdi_direction,
51 basic_block *,
52 unsigned);
53 extern vec<basic_block> get_dominated_to_depth (enum cdi_direction,
54 basic_block, int);
55 extern vec<basic_block> get_all_dominated_blocks (enum cdi_direction,
56 basic_block);
57 extern void redirect_immediate_dominators (enum cdi_direction, basic_block,
58 basic_block);
59 extern basic_block nearest_common_dominator (enum cdi_direction,
60 basic_block, basic_block);
61 extern basic_block nearest_common_dominator_for_set (enum cdi_direction,
62 bitmap);
63 extern bool dominated_by_p (enum cdi_direction, const_basic_block,
64 const_basic_block);
65 unsigned bb_dom_dfs_in (enum cdi_direction, basic_block);
66 unsigned bb_dom_dfs_out (enum cdi_direction, basic_block);
67 extern void verify_dominators (enum cdi_direction);
69 /* Verify invariants of computed dominance information, if internal consistency
70 checks are enabled. */
72 static inline void
73 checking_verify_dominators (cdi_direction dir)
75 if (flag_checking)
76 verify_dominators (dir);
79 basic_block recompute_dominator (enum cdi_direction, basic_block);
80 extern void iterate_fix_dominators (enum cdi_direction,
81 vec<basic_block> , bool);
82 extern void add_to_dominance_info (enum cdi_direction, basic_block);
83 extern void delete_from_dominance_info (enum cdi_direction, basic_block);
84 extern basic_block first_dom_son (enum cdi_direction, basic_block);
85 extern basic_block next_dom_son (enum cdi_direction, basic_block);
86 extern enum dom_state dom_info_state (function *, enum cdi_direction);
87 extern enum dom_state dom_info_state (enum cdi_direction);
88 extern void set_dom_info_availability (enum cdi_direction, enum dom_state);
89 extern bool dom_info_available_p (function *, enum cdi_direction);
90 extern bool dom_info_available_p (enum cdi_direction);
94 #endif /* GCC_DOMINANCE_H */