1/* Calculate (post)dominators header file.
2 Copyright (C) 2014-2017 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
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.
10
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.
15
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/>. */
19
20#ifndef GCC_DOMINANCE_H
21#define GCC_DOMINANCE_H
22
23enum cdi_direction
24{
25 CDI_DOMINATORS = 1,
26 CDI_POST_DOMINATORS = 2
27};
28
29/* State of dominance information. */
30
31enum dom_state
32{
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. */
36};
37
38extern void calculate_dominance_info (enum cdi_direction);
39extern void calculate_dominance_info_for_region (enum cdi_direction,
40 vec<basic_block>);
41extern void free_dominance_info (function *, enum cdi_direction);
42extern void free_dominance_info (enum cdi_direction);
43extern void free_dominance_info_for_region (function *,
44 enum cdi_direction,
45 vec<basic_block>);
46extern basic_block get_immediate_dominator (enum cdi_direction, basic_block);
47extern void set_immediate_dominator (enum cdi_direction, basic_block,
48 basic_block);
49extern vec<basic_block> get_dominated_by (enum cdi_direction, basic_block);
50extern vec<basic_block> get_dominated_by_region (enum cdi_direction,
51 basic_block *,
52 unsigned);
53extern vec<basic_block> get_dominated_to_depth (enum cdi_direction,
54 basic_block, int);
55extern vec<basic_block> get_all_dominated_blocks (enum cdi_direction,
56 basic_block);
57extern void redirect_immediate_dominators (enum cdi_direction, basic_block,
58 basic_block);
59extern basic_block nearest_common_dominator (enum cdi_direction,
60 basic_block, basic_block);
61extern basic_block nearest_common_dominator_for_set (enum cdi_direction,
62 bitmap);
63extern bool dominated_by_p (enum cdi_direction, const_basic_block,
64 const_basic_block);
65unsigned bb_dom_dfs_in (enum cdi_direction, basic_block);
66unsigned bb_dom_dfs_out (enum cdi_direction, basic_block);
67extern void verify_dominators (enum cdi_direction);
68
69/* Verify invariants of computed dominance information, if internal consistency
70 checks are enabled. */
71
72static inline void
73checking_verify_dominators (cdi_direction dir)
74{
75 if (flag_checking)
76 verify_dominators (dir);
77}
78
79basic_block recompute_dominator (enum cdi_direction, basic_block);
80extern void iterate_fix_dominators (enum cdi_direction,
81 vec<basic_block> , bool);
82extern void add_to_dominance_info (enum cdi_direction, basic_block);
83extern void delete_from_dominance_info (enum cdi_direction, basic_block);
84extern basic_block first_dom_son (enum cdi_direction, basic_block);
85extern basic_block next_dom_son (enum cdi_direction, basic_block);
86extern enum dom_state dom_info_state (function *, enum cdi_direction);
87extern enum dom_state dom_info_state (enum cdi_direction);
88extern void set_dom_info_availability (enum cdi_direction, enum dom_state);
89extern bool dom_info_available_p (function *, enum cdi_direction);
90extern bool dom_info_available_p (enum cdi_direction);
91
92
93
94#endif /* GCC_DOMINANCE_H */
95