Branch data Line data Source code
1 : : /* Header file for any pass which requires SSA routines.
2 : : Copyright (C) 2013-2025 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 under
7 : : the terms of the GNU General Public License as published by the Free
8 : : Software Foundation; either version 3, or (at your option) any later
9 : : version.
10 : :
11 : : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 : : WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 : : FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 : : 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_TREE_SSA_H
21 : : #define GCC_TREE_SSA_H
22 : :
23 : : /* Mapping for redirected edges. */
24 : : struct edge_var_map {
25 : : tree result; /* PHI result. */
26 : : tree def; /* PHI arg definition. */
27 : : location_t locus; /* PHI arg location. */
28 : : };
29 : :
30 : : /* A vector of var maps. */
31 : : typedef vec<edge_var_map, va_heap, vl_embed> edge_var_map_vector;
32 : :
33 : :
34 : : extern void redirect_edge_var_map_add (edge, tree, tree, location_t);
35 : : extern void redirect_edge_var_map_clear (edge);
36 : : extern void redirect_edge_var_map_dup (edge, edge);
37 : : extern vec<edge_var_map> *redirect_edge_var_map_vector (edge);
38 : : extern void redirect_edge_var_map_empty (void);
39 : : extern edge ssa_redirect_edge (edge, basic_block);
40 : : extern void flush_pending_stmts (edge);
41 : : extern void gimple_replace_ssa_lhs (gimple *, tree);
42 : : extern tree target_for_debug_bind (tree);
43 : : extern void insert_debug_temp_for_var_def (gimple_stmt_iterator *, tree);
44 : : extern void insert_debug_temps_for_defs (gimple_stmt_iterator *);
45 : : extern void reset_debug_uses (gimple *);
46 : : extern void release_defs_bitset (bitmap toremove);
47 : : extern void verify_ssa (bool, bool);
48 : : extern void init_tree_ssa (function *, int size = 0);
49 : : extern void delete_tree_ssa (function *);
50 : : extern bool tree_ssa_useless_type_conversion (tree);
51 : : extern tree tree_ssa_strip_useless_type_conversions (tree);
52 : : extern tree find_released_ssa_name (tree *, int *, void *);
53 : :
54 : :
55 : : extern bool ssa_defined_default_def_p (tree t);
56 : : extern bool ssa_undefined_value_p (tree, bool = true);
57 : :
58 : :
59 : : bool ssa_name_any_use_dominates_bb_p (tree var, basic_block bb);
60 : : extern void mark_ssa_maybe_undefs (void);
61 : :
62 : : /* Return TRUE iff VAR is marked as maybe-undefined. See
63 : : mark_ssa_maybe_undefs. */
64 : :
65 : : inline bool
66 : 46215600 : ssa_name_maybe_undef_p (tree var)
67 : : {
68 : 46215600 : gcc_checking_assert (TREE_CODE (var) == SSA_NAME);
69 : 46215600 : return TREE_VISITED (var);
70 : : }
71 : :
72 : : /* Set (or clear, depending on VALUE) VAR's maybe-undefined mark. */
73 : :
74 : : inline void
75 : 354355727 : ssa_name_set_maybe_undef (tree var, bool value = true)
76 : : {
77 : 354355727 : gcc_checking_assert (TREE_CODE (var) == SSA_NAME);
78 : 354355727 : TREE_VISITED (var) = value;
79 : 354355727 : }
80 : :
81 : :
82 : : extern void execute_update_addresses_taken (void);
83 : :
84 : : /* Given an edge_var_map V, return the PHI arg definition. */
85 : :
86 : : inline tree
87 : 7829315 : redirect_edge_var_map_def (edge_var_map *v)
88 : : {
89 : 7829315 : return v->def;
90 : : }
91 : :
92 : : /* Given an edge_var_map V, return the PHI result. */
93 : :
94 : : inline tree
95 : 2865915 : redirect_edge_var_map_result (edge_var_map *v)
96 : : {
97 : 2865915 : return v->result;
98 : : }
99 : :
100 : : /* Given an edge_var_map V, return the PHI arg location. */
101 : :
102 : : inline location_t
103 : 6298223 : redirect_edge_var_map_location (edge_var_map *v)
104 : : {
105 : 6298223 : return v->locus;
106 : : }
107 : :
108 : : /* Verify SSA invariants, if internal consistency checks are enabled. */
109 : :
110 : : inline void
111 : 148 : checking_verify_ssa (bool check_modified_stmt, bool check_ssa_operands)
112 : : {
113 : 148 : if (flag_checking)
114 : 148 : verify_ssa (check_modified_stmt, check_ssa_operands);
115 : : }
116 : :
117 : : #endif /* GCC_TREE_SSA_H */
|