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-2024 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
23/* Aliasing information for SSA_NAMEs representing pointer variables. */
24
25struct GTY(()) ptr_info_def
26{
27 /* The points-to solution. */
28 struct pt_solution pt;
29
30 /* Alignment and misalignment of the pointer in bytes. Together
31 align and misalign specify low known bits of the pointer.
32 ptr & (align - 1) == misalign. */
33
34 /* When known, this is the power-of-two byte alignment of the object this
35 pointer points into. This is usually DECL_ALIGN_UNIT for decls and
36 MALLOC_ABI_ALIGNMENT for allocated storage. When the alignment is not
37 known, it is zero. Do not access directly but use functions
38 get_ptr_info_alignment, set_ptr_info_alignment,
39 mark_ptr_info_alignment_unknown and similar. */
40 unsigned int align;
41
42 /* When alignment is known, the byte offset this pointer differs from the
43 above alignment. Access only through the same helper functions as align
44 above. */
45 unsigned int misalign;
46};
47
48
49#define SSANAMES(fun) (fun)->gimple_df->ssa_names
50#define DEFAULT_DEFS(fun) (fun)->gimple_df->default_defs
51
52#define num_ssa_names (vec_safe_length (cfun->gimple_df->ssa_names))
53#define ssa_name(i) ((*cfun->gimple_df->ssa_names)[(i)])
54
55#define FOR_EACH_SSA_NAME(I, VAR, FN) \
56 for (I = 1; SSANAMES (FN)->iterate (I, &VAR); ++I) \
57 if (VAR)
58
59/* Sets the value range to SSA. */
60extern bool set_range_info (tree, const vrange &);
61extern void set_nonzero_bits (tree, const wide_int &);
62extern void set_bitmask (tree, const wide_int &value, const wide_int &mask);
65extern void init_ssanames (struct function *, int);
66extern void fini_ssanames (struct function *);
67extern void ssanames_print_statistics (void);
68extern tree make_ssa_name_fn (struct function *, tree, gimple *,
69 unsigned int version = 0);
70extern void init_ssa_name_imm_use (tree);
71extern void release_ssa_name_fn (struct function *, tree);
72extern bool get_ptr_info_alignment (struct ptr_info_def *, unsigned int *,
73 unsigned int *);
75extern void set_ptr_info_alignment (struct ptr_info_def *, unsigned int,
76 unsigned int);
78extern struct ptr_info_def *get_ptr_info (tree);
79extern void set_ptr_nonnull (tree);
80
81extern tree copy_ssa_name_fn (struct function *, tree, gimple *);
82extern tree duplicate_ssa_name_fn (struct function *, tree, gimple *);
83extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *);
84extern void duplicate_ssa_name_range_info (tree dest, tree src);
85extern void maybe_duplicate_ssa_info_at_copy (tree dest, tree src);
88extern void release_defs (gimple *);
89extern void replace_ssa_name_symbol (tree, tree);
90extern void flush_ssaname_freelist (void);
91
92
93/* Return an SSA_NAME node for variable VAR defined in statement STMT
94 in function cfun. */
95
96inline tree
98{
99 return make_ssa_name_fn (cfun, var, stmt);
100}
101
102/* Return an SSA_NAME node using the template SSA name NAME defined in
103 statement STMT in function cfun. */
104
105inline tree
107{
108 return copy_ssa_name_fn (cfun, var, stmt);
109}
110
111/* Creates a duplicate of a SSA name NAME tobe defined by statement STMT
112 in function cfun. */
113
114inline tree
116{
117 return duplicate_ssa_name_fn (cfun, var, stmt);
118}
119
120/* Release the SSA name NAME used in function cfun. */
121
122inline void
124{
126}
127
128/* Return an anonymous SSA_NAME node for type TYPE defined in statement STMT
129 in function cfun. Arrange so that it uses NAME in dumps. */
130
131inline tree
140
141/* A class which is used to save/restore the flow sensitive information. */
143{
144public:
145 void save (tree);
146 void save_and_clear (tree);
147 void restore (tree);
148 void clear_storage ();
149private:
150 /* 0 means there is nothing saved.
151 1 means non pointer is saved.
152 -1 means a pointer type is saved.
153 -2 means a pointer type is saved but no information was saved. */
154 int state = 0;
155 /* The range info for non pointers */
157 /* Flow sensitive pointer information. */
158 unsigned int align = 0;
159 unsigned int misalign = 0;
160 bool null = true;
161};
162
163#endif /* GCC_TREE_SSANAMES_H */
Definition tree-ssanames.h:143
bool null
Definition tree-ssanames.h:160
void restore(tree)
Definition tree-ssanames.cc:999
vrange_storage * range_info
Definition tree-ssanames.h:156
void clear_storage()
Definition tree-ssanames.cc:1033
unsigned int align
Definition tree-ssanames.h:158
void save_and_clear(tree)
Definition tree-ssanames.cc:1025
unsigned int misalign
Definition tree-ssanames.h:159
void save(tree)
Definition tree-ssanames.cc:971
Definition value-range-storage.h:50
Definition value-range.h:78
const union tree_node * const_tree
Definition coretypes.h:98
#define GTY(x)
Definition coretypes.h:41
union tree_node * tree
Definition coretypes.h:97
#define cfun
Definition function.h:478
tree get_identifier(const char *text)
Definition stringpool.cc:105
Definition basic-block.h:117
Definition function.h:249
Definition gimple.h:225
Definition tree-ssa-alias.h:29
Definition tree-ssanames.h:26
unsigned int misalign
Definition tree-ssanames.h:45
unsigned int align
Definition tree-ssanames.h:40
struct pt_solution pt
Definition tree-ssanames.h:28
Definition genautomata.cc:669
Definition gengtype.h:252
#define NULL
Definition system.h:50
#define gcc_checking_assert(EXPR)
Definition system.h:828
void set_ptr_nonnull(tree)
Definition tree-ssanames.cc:462
void replace_ssa_name_symbol(tree, tree)
Definition tree-ssanames.cc:878
tree make_temp_ssa_name(tree type, gimple *stmt, const char *name)
Definition tree-ssanames.h:132
void init_ssanames(struct function *, int)
Definition tree-ssanames.cc:146
tree duplicate_ssa_name(tree var, gimple *stmt)
Definition tree-ssanames.h:115
void maybe_duplicate_ssa_info_at_copy(tree dest, tree src)
Definition tree-ssanames.cc:776
wide_int get_nonzero_bits(const_tree)
Definition tree-ssanames.cc:500
void duplicate_ssa_name_ptr_info(tree, struct ptr_info_def *)
Definition tree-ssanames.cc:742
tree make_ssa_name_fn(struct function *, tree, gimple *, unsigned int version=0)
Definition tree-ssanames.cc:351
void reset_flow_sensitive_info_in_bb(basic_block)
Definition tree-ssanames.cc:841
tree duplicate_ssa_name_fn(struct function *, tree, gimple *)
Definition tree-ssanames.cc:799
void set_nonzero_bits(tree, const wide_int &)
Definition tree-ssanames.cc:472
void set_bitmask(tree, const wide_int &value, const wide_int &mask)
Definition tree-ssanames.cc:487
void flush_ssaname_freelist(void)
Definition tree-ssanames.cc:322
struct ptr_info_def * get_ptr_info(tree)
Definition tree-ssanames.cc:699
tree make_ssa_name(tree var, gimple *stmt=NULL)
Definition tree-ssanames.h:97
void init_ssa_name_imm_use(tree)
Definition tree-ssanames.cc:334
void mark_ptr_info_alignment_unknown(struct ptr_info_def *)
Definition tree-ssanames.cc:656
bool ssa_name_has_boolean_range(tree)
Definition tree-ssanames.cc:533
void ssanames_print_statistics(void)
Definition tree-ssanames.cc:189
tree copy_ssa_name_fn(struct function *, tree, gimple *)
Definition tree-ssanames.cc:722
void duplicate_ssa_name_range_info(tree dest, tree src)
Definition tree-ssanames.cc:759
#define ssa_name(i)
Definition tree-ssanames.h:53
void set_ptr_info_alignment(struct ptr_info_def *, unsigned int, unsigned int)
Definition tree-ssanames.cc:667
void reset_flow_sensitive_info(tree)
Definition tree-ssanames.cc:820
void fini_ssanames(struct function *)
Definition tree-ssanames.cc:171
void release_defs(gimple *)
Definition tree-ssanames.cc:864
bool get_ptr_info_alignment(struct ptr_info_def *, unsigned int *, unsigned int *)
Definition tree-ssanames.cc:640
bool set_range_info(tree, const vrange &)
Definition tree-ssanames.cc:417
tree copy_ssa_name(tree var, gimple *stmt=NULL)
Definition tree-ssanames.h:106
void release_ssa_name_fn(struct function *, tree)
Definition tree-ssanames.cc:570
void adjust_ptr_info_misalignment(struct ptr_info_def *, poly_uint64)
Definition tree-ssanames.cc:682
void release_ssa_name(tree name)
Definition tree-ssanames.h:123
#define SET_SSA_NAME_VAR_OR_IDENTIFIER(NODE, VAR)
Definition tree.h:2092
#define TYPE_P(NODE)
Definition tree.h:226