GCC Middle and Back End API Reference
tree-ssanames.h
Go to the documentation of this file.
1/* SSA name expresssons routines
2 Copyright (C) 2013-2026 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef GCC_TREE_SSANAMES_H
21#define GCC_TREE_SSANAMES_H
22
23inline irange_storage *
25{
27 return s ? s->dyn_irange () : NULL;
28}
29
30inline prange_storage *
32{
34 return s ? s->dyn_prange () : NULL;
35}
36
37inline frange_storage *
39{
41 return s ? s->dyn_frange () : NULL;
42}
43
44/* Return NAME's points-to solution, or NULL if it has none. Returns NULL
45 for a non pointer type. */
46inline const pt_solution *
48{
50 return s ? s->pt : NULL;
51}
52
53/* Make PT the points-to solution for NAME, which must have pointer type. */
54extern void set_ssa_name_pt_solution (tree name, const pt_solution &pt);
55
56#define SSANAMES(fun) (fun)->gimple_df->ssa_names
57#define DEFAULT_DEFS(fun) (fun)->gimple_df->default_defs
58
59#define num_ssa_names (vec_safe_length (cfun->gimple_df->ssa_names))
60#define ssa_name(i) ((*cfun->gimple_df->ssa_names)[(i)])
61
62#define FOR_EACH_SSA_NAME(I, VAR, FN) \
63 for (I = 1; SSANAMES (FN)->iterate (I, &VAR); ++I) \
64 if (VAR)
65
66/* Sets the value range to SSA. */
67extern bool set_range_info (tree, const vrange &);
68extern void set_nonzero_bits (tree, const wide_int &);
69extern void set_bitmask (tree, const wide_int &value, const wide_int &mask);
72extern bool ssa_name_has_boolean_range (tree, gimple * = nullptr);
73extern void init_ssanames (struct function *, int);
74extern void fini_ssanames (struct function *);
75extern void ssanames_print_statistics (void);
76extern tree make_ssa_name_fn (struct function *, tree, gimple *,
77 unsigned int version = 0);
78extern void init_ssa_name_imm_use (tree);
79extern void release_ssa_name_fn (struct function *, tree);
80extern bool get_ssa_name_alignment (const_tree, unsigned int *,
81 unsigned int *);
83extern void set_ssa_name_alignment (tree, unsigned int, unsigned int);
84extern void set_ptr_nonnull (tree);
85extern bool ptr_nonnull_p (tree);
86
87extern tree copy_ssa_name_fn (struct function *, tree, gimple *);
88extern tree duplicate_ssa_name_fn (struct function *, tree, gimple *);
89extern void duplicate_ssa_name_pt_solution (tree dest, const pt_solution *);
90extern void duplicate_ssa_name_pt_solution (tree dest, tree src);
91extern void duplicate_ssa_name_range_info (tree dest, tree src,
92 bool remove_local_addr = false);
93extern void maybe_duplicate_ssa_info_at_copy (tree dest, tree src);
96extern void release_defs (gimple *);
97extern void replace_ssa_name_symbol (tree, tree);
98extern void flush_ssaname_freelist (void);
99
100
101/* Return an SSA_NAME node for variable VAR defined in statement STMT
102 in function cfun. */
103
104inline tree
106{
107 return make_ssa_name_fn (cfun, var, stmt);
108}
109
110/* Return an SSA_NAME node using the template SSA name NAME defined in
111 statement STMT in function cfun. */
112
113inline tree
115{
116 return copy_ssa_name_fn (cfun, var, stmt);
117}
118
119/* Creates a duplicate of a SSA name NAME tobe defined by statement STMT
120 in function cfun. */
121
122inline tree
124{
125 return duplicate_ssa_name_fn (cfun, var, stmt);
126}
127
128/* Release the SSA name NAME used in function cfun. */
129
130inline void
132{
134}
135
136/* Return an anonymous SSA_NAME node for type TYPE defined in statement STMT
137 in function cfun. Arrange so that it uses NAME in dumps. */
138
139inline tree
148
149/* A class which is used to save/restore the flow sensitive information. */
151{
152public:
153 /* Save the flow sensitive info from NAME. */
154 inline void save (tree name)
155 {
158 state = 1;
159 }
160
161 /* Restore the flow sensitive info from NAME. */
162 inline void restore (tree name) const
163 {
166 }
167
168 /* Save the flow sensitive info from NAME and reset that info. */
169 inline void save_and_clear (tree name)
170 {
171 save (name);
173 }
174
175 /* Clear the storage. */
176 inline void clear_storage () { state = 0; }
177private:
178 /* 0 means there is nothing saved. 1 means something is saved. */
179 int state = 0;
180 /* The range info contains all flow sensitive information now. */
182};
183
184#endif /* GCC_TREE_SSANAMES_H */
Definition tree-ssanames.h:151
vrange_storage * range_info
Definition tree-ssanames.h:181
void save_and_clear(tree name)
Definition tree-ssanames.h:169
void clear_storage()
Definition tree-ssanames.h:176
void restore(tree name) const
Definition tree-ssanames.h:162
void save(tree name)
Definition tree-ssanames.h:154
int state
Definition tree-ssanames.h:179
Definition value-range-storage.h:193
Definition value-range-storage.h:69
Definition value-range-storage.h:121
Definition value-range-storage.h:46
Definition value-range.h:88
struct basic_block_def * basic_block
Definition coretypes.h:359
const union tree_node * const_tree
Definition coretypes.h:98
union tree_node * tree
Definition coretypes.h:97
#define cfun
Definition function.h:485
tree get_identifier(const char *text)
Definition stringpool.cc:105
Definition function.h:249
Definition gimple.h:225
Definition tree-ssa-alias.h:29
Definition gengtype.h:252
#define NULL
Definition system.h:55
#define gcc_checking_assert(EXPR)
Definition system.h:779
void release_ssa_name_fn(struct function *fn, tree var)
Definition tree-ssanames.cc:733
void release_defs(gimple *stmt)
Definition tree-ssanames.cc:1067
wide_int get_known_nonzero_bits(const_tree name)
Definition tree-ssanames.cc:670
void maybe_duplicate_ssa_info_at_copy(tree dest, tree src)
Definition tree-ssanames.cc:988
void set_nonzero_bits(tree name, const wide_int &mask)
Definition tree-ssanames.cc:520
tree copy_ssa_name_fn(struct function *fn, tree name, gimple *stmt)
Definition tree-ssanames.cc:915
void reset_flow_sensitive_info(tree name)
Definition tree-ssanames.cc:1026
void init_ssa_name_imm_use(tree name)
Definition tree-ssanames.cc:371
tree duplicate_ssa_name_fn(struct function *fn, tree name, gimple *stmt)
Definition tree-ssanames.cc:1008
void flush_ssaname_freelist(void)
Definition tree-ssanames.cc:359
void set_ssa_name_pt_solution(tree name, const pt_solution &pt)
Definition tree-ssanames.cc:135
void ssanames_print_statistics(void)
Definition tree-ssanames.cc:226
void set_bitmask(tree name, const wide_int &value, const wide_int &mask)
Definition tree-ssanames.cc:541
void replace_ssa_name_symbol(tree ssa_name, tree sym)
Definition tree-ssanames.cc:1081
wide_int get_nonzero_bits(const_tree name)
Definition tree-ssanames.cc:605
void fini_ssanames(struct function *fn)
Definition tree-ssanames.cc:208
void set_ptr_nonnull(tree name)
Definition tree-ssanames.cc:503
void duplicate_ssa_name_range_info(tree name, tree src, bool remove_local_addr)
Definition tree-ssanames.cc:968
tree make_ssa_name_fn(struct function *fn, tree var, gimple *stmt, unsigned int version)
Definition tree-ssanames.cc:388
bool get_ssa_name_alignment(const_tree name, unsigned int *alignp, unsigned int *misalignp)
Definition tree-ssanames.cc:846
void duplicate_ssa_name_pt_solution(tree dest, const pt_solution *pt)
Definition tree-ssanames.cc:935
void reset_flow_sensitive_info_in_bb(basic_block bb)
Definition tree-ssanames.cc:1044
void set_ssa_name_alignment(tree name, unsigned int align, unsigned int misalign)
Definition tree-ssanames.cc:883
bool ptr_nonnull_p(tree name)
Definition tree-ssanames.cc:493
void mark_ssa_name_alignment_unknown(tree name)
Definition tree-ssanames.cc:863
bool set_range_info(tree name, const vrange &r)
Definition tree-ssanames.cc:455
void init_ssanames(struct function *fn, int size)
Definition tree-ssanames.cc:183
bool ssa_name_has_boolean_range(tree op, gimple *stmt)
Definition tree-ssanames.cc:696
tree make_temp_ssa_name(tree type, gimple *stmt, const char *name)
Definition tree-ssanames.h:140
tree duplicate_ssa_name(tree var, gimple *stmt)
Definition tree-ssanames.h:123
tree make_ssa_name(tree var, gimple *stmt=NULL)
Definition tree-ssanames.h:105
#define ssa_name(i)
Definition tree-ssanames.h:60
void reset_flow_sensitive_info(tree)
Definition tree-ssanames.cc:1026
frange_storage * ssa_name_frange_info(const_tree name)
Definition tree-ssanames.h:38
irange_storage * ssa_name_irange_info(const_tree name)
Definition tree-ssanames.h:24
const pt_solution * ssa_name_pt_solution(const_tree name)
Definition tree-ssanames.h:47
prange_storage * ssa_name_prange_info(const_tree name)
Definition tree-ssanames.h:31
tree copy_ssa_name(tree var, gimple *stmt=NULL)
Definition tree-ssanames.h:114
void release_ssa_name(tree name)
Definition tree-ssanames.h:131
#define SSA_NAME_RANGE_INFO(N)
Definition tree.h:2328
#define SET_SSA_NAME_VAR_OR_IDENTIFIER(NODE, VAR)
Definition tree.h:2281
#define TYPE_P(NODE)
Definition tree.h:229
generic_wide_int< wide_int_storage > wide_int
Definition wide-int.h:343