]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/tree-ssanames.h
Correct a function pre/postcondition [PR102403].
[thirdparty/gcc.git] / gcc / tree-ssanames.h
CommitLineData
b12ebd96 1/* SSA name expresssons routines
99dee823 2 Copyright (C) 2013-2021 Free Software Foundation, Inc.
b12ebd96
AM
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
a895a2b8
KV
48/* Value range information for SSA_NAMEs representing non-pointer variables. */
49
807e902e
KZ
50struct GTY ((variable_size)) range_info_def {
51 /* Minimum, maximum and nonzero bits. */
52 TRAILING_WIDE_INT_ACCESSOR (min, ints, 0)
53 TRAILING_WIDE_INT_ACCESSOR (max, ints, 1)
54 TRAILING_WIDE_INT_ACCESSOR (nonzero_bits, ints, 2)
55 trailing_wide_ints <3> ints;
a895a2b8
KV
56};
57
b12ebd96
AM
58
59#define SSANAMES(fun) (fun)->gimple_df->ssa_names
b12ebd96
AM
60#define DEFAULT_DEFS(fun) (fun)->gimple_df->default_defs
61
62#define num_ssa_names (vec_safe_length (cfun->gimple_df->ssa_names))
63#define ssa_name(i) ((*cfun->gimple_df->ssa_names)[(i)])
64
46aa019a
KV
65#define FOR_EACH_SSA_NAME(I, VAR, FN) \
66 for (I = 1; SSANAMES (FN)->iterate (I, &VAR); ++I) \
67 if (VAR)
68
a895a2b8 69/* Sets the value range to SSA. */
54994253 70extern void set_range_info (tree, enum value_range_kind, const wide_int_ref &,
807e902e 71 const wide_int_ref &);
028d81b1 72extern void set_range_info (tree, const value_range &);
807e902e
KZ
73extern void set_nonzero_bits (tree, const wide_int_ref &);
74extern wide_int get_nonzero_bits (const_tree);
40c43aca 75extern bool ssa_name_has_boolean_range (tree);
b12ebd96 76extern void init_ssanames (struct function *, int);
61183076 77extern void fini_ssanames (struct function *);
b12ebd96 78extern void ssanames_print_statistics (void);
1ee62b92
PG
79extern tree make_ssa_name_fn (struct function *, tree, gimple *,
80 unsigned int version = 0);
5f487a34 81extern void init_ssa_name_imm_use (tree);
6a58ccca 82extern void release_ssa_name_fn (struct function *, tree);
b12ebd96
AM
83extern bool get_ptr_info_alignment (struct ptr_info_def *, unsigned int *,
84 unsigned int *);
85extern void mark_ptr_info_alignment_unknown (struct ptr_info_def *);
86extern void set_ptr_info_alignment (struct ptr_info_def *, unsigned int,
87 unsigned int);
bc83d568 88extern void adjust_ptr_info_misalignment (struct ptr_info_def *, poly_uint64);
b12ebd96 89extern struct ptr_info_def *get_ptr_info (tree);
735b8f9f 90extern void set_ptr_nonnull (tree);
b12ebd96 91
355fe088 92extern tree copy_ssa_name_fn (struct function *, tree, gimple *);
b12ebd96 93extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *);
355fe088 94extern tree duplicate_ssa_name_fn (struct function *, tree, gimple *);
54994253 95extern void duplicate_ssa_name_range_info (tree, enum value_range_kind,
f5c8b24c 96 struct range_info_def *);
8bb8e838 97extern void reset_flow_sensitive_info (tree);
6ea2f74c 98extern void reset_flow_sensitive_info_in_bb (basic_block);
355fe088 99extern void release_defs (gimple *);
b12ebd96 100extern void replace_ssa_name_symbol (tree, tree);
dc0ccbb3 101extern void flush_ssaname_freelist (void);
b12ebd96
AM
102
103
104/* Return an SSA_NAME node for variable VAR defined in statement STMT
105 in function cfun. */
106
107static inline tree
355fe088 108make_ssa_name (tree var, gimple *stmt = NULL)
b12ebd96
AM
109{
110 return make_ssa_name_fn (cfun, var, stmt);
111}
112
113/* Return an SSA_NAME node using the template SSA name NAME defined in
114 statement STMT in function cfun. */
115
116static inline tree
355fe088 117copy_ssa_name (tree var, gimple *stmt = NULL)
b12ebd96
AM
118{
119 return copy_ssa_name_fn (cfun, var, stmt);
120}
121
122/* Creates a duplicate of a SSA name NAME tobe defined by statement STMT
123 in function cfun. */
124
125static inline tree
355fe088 126duplicate_ssa_name (tree var, gimple *stmt)
b12ebd96
AM
127{
128 return duplicate_ssa_name_fn (cfun, var, stmt);
129}
130
6a58ccca
RB
131/* Release the SSA name NAME used in function cfun. */
132
133static inline void
134release_ssa_name (tree name)
135{
136 release_ssa_name_fn (cfun, name);
137}
138
b12ebd96
AM
139/* Return an anonymous SSA_NAME node for type TYPE defined in statement STMT
140 in function cfun. Arrange so that it uses NAME in dumps. */
141
142static inline tree
355fe088 143make_temp_ssa_name (tree type, gimple *stmt, const char *name)
b12ebd96
AM
144{
145 tree ssa_name;
146 gcc_checking_assert (TYPE_P (type));
147 ssa_name = make_ssa_name_fn (cfun, type, stmt);
148 SET_SSA_NAME_VAR_OR_IDENTIFIER (ssa_name, get_identifier (name));
149 return ssa_name;
150}
151
152
153#endif /* GCC_TREE_SSANAMES_H */