]>
Commit | Line | Data |
---|---|---|
9e2e2283 | 1 | /* SSA name expresssons routines |
fbd26352 | 2 | Copyright (C) 2013-2019 Free Software Foundation, Inc. |
9e2e2283 | 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_SSANAMES_H | |
21 | #define GCC_TREE_SSANAMES_H | |
22 | ||
23 | /* Aliasing information for SSA_NAMEs representing pointer variables. */ | |
24 | ||
25 | struct 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 | ||
3c59e4a7 | 48 | /* Value range information for SSA_NAMEs representing non-pointer variables. */ |
49 | ||
9c1be15e | 50 | struct 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; | |
3c59e4a7 | 56 | }; |
57 | ||
9e2e2283 | 58 | |
59 | #define SSANAMES(fun) (fun)->gimple_df->ssa_names | |
9e2e2283 | 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 | ||
f211616e | 65 | #define FOR_EACH_SSA_NAME(I, VAR, FN) \ |
66 | for (I = 1; SSANAMES (FN)->iterate (I, &VAR); ++I) \ | |
67 | if (VAR) | |
68 | ||
3c59e4a7 | 69 | /* Sets the value range to SSA. */ |
be44111e | 70 | extern void set_range_info (tree, enum value_range_kind, const wide_int_ref &, |
9c1be15e | 71 | const wide_int_ref &); |
de9df22a | 72 | extern void set_range_info (tree, const value_range_base &); |
3c59e4a7 | 73 | /* Gets the value range from SSA. */ |
be44111e | 74 | extern enum value_range_kind get_range_info (const_tree, wide_int *, |
9c1be15e | 75 | wide_int *); |
de9df22a | 76 | extern enum value_range_kind get_range_info (const_tree, value_range_base &); |
9c1be15e | 77 | extern void set_nonzero_bits (tree, const wide_int_ref &); |
78 | extern wide_int get_nonzero_bits (const_tree); | |
e390c57d | 79 | extern bool ssa_name_has_boolean_range (tree); |
9e2e2283 | 80 | extern void init_ssanames (struct function *, int); |
d4f078b5 | 81 | extern void fini_ssanames (struct function *); |
9e2e2283 | 82 | extern void ssanames_print_statistics (void); |
b1f04d34 | 83 | extern tree make_ssa_name_fn (struct function *, tree, gimple *, |
84 | unsigned int version = 0); | |
861b4e39 | 85 | extern void release_ssa_name_fn (struct function *, tree); |
9e2e2283 | 86 | extern bool get_ptr_info_alignment (struct ptr_info_def *, unsigned int *, |
87 | unsigned int *); | |
88 | extern void mark_ptr_info_alignment_unknown (struct ptr_info_def *); | |
89 | extern void set_ptr_info_alignment (struct ptr_info_def *, unsigned int, | |
90 | unsigned int); | |
fa6faa50 | 91 | extern void adjust_ptr_info_misalignment (struct ptr_info_def *, poly_uint64); |
9e2e2283 | 92 | extern struct ptr_info_def *get_ptr_info (tree); |
5b48910f | 93 | extern void set_ptr_nonnull (tree); |
94 | extern bool get_ptr_nonnull (const_tree); | |
9e2e2283 | 95 | |
42acab1c | 96 | extern tree copy_ssa_name_fn (struct function *, tree, gimple *); |
9e2e2283 | 97 | extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *); |
42acab1c | 98 | extern tree duplicate_ssa_name_fn (struct function *, tree, gimple *); |
be44111e | 99 | extern void duplicate_ssa_name_range_info (tree, enum value_range_kind, |
0c20fe49 | 100 | struct range_info_def *); |
ace499f6 | 101 | extern void reset_flow_sensitive_info (tree); |
43725011 | 102 | extern void reset_flow_sensitive_info_in_bb (basic_block); |
42acab1c | 103 | extern void release_defs (gimple *); |
9e2e2283 | 104 | extern void replace_ssa_name_symbol (tree, tree); |
16f88e4c | 105 | extern void flush_ssaname_freelist (void); |
9e2e2283 | 106 | |
107 | ||
108 | /* Return an SSA_NAME node for variable VAR defined in statement STMT | |
109 | in function cfun. */ | |
110 | ||
111 | static inline tree | |
42acab1c | 112 | make_ssa_name (tree var, gimple *stmt = NULL) |
9e2e2283 | 113 | { |
114 | return make_ssa_name_fn (cfun, var, stmt); | |
115 | } | |
116 | ||
117 | /* Return an SSA_NAME node using the template SSA name NAME defined in | |
118 | statement STMT in function cfun. */ | |
119 | ||
120 | static inline tree | |
42acab1c | 121 | copy_ssa_name (tree var, gimple *stmt = NULL) |
9e2e2283 | 122 | { |
123 | return copy_ssa_name_fn (cfun, var, stmt); | |
124 | } | |
125 | ||
126 | /* Creates a duplicate of a SSA name NAME tobe defined by statement STMT | |
127 | in function cfun. */ | |
128 | ||
129 | static inline tree | |
42acab1c | 130 | duplicate_ssa_name (tree var, gimple *stmt) |
9e2e2283 | 131 | { |
132 | return duplicate_ssa_name_fn (cfun, var, stmt); | |
133 | } | |
134 | ||
861b4e39 | 135 | /* Release the SSA name NAME used in function cfun. */ |
136 | ||
137 | static inline void | |
138 | release_ssa_name (tree name) | |
139 | { | |
140 | release_ssa_name_fn (cfun, name); | |
141 | } | |
142 | ||
9e2e2283 | 143 | /* Return an anonymous SSA_NAME node for type TYPE defined in statement STMT |
144 | in function cfun. Arrange so that it uses NAME in dumps. */ | |
145 | ||
146 | static inline tree | |
42acab1c | 147 | make_temp_ssa_name (tree type, gimple *stmt, const char *name) |
9e2e2283 | 148 | { |
149 | tree ssa_name; | |
150 | gcc_checking_assert (TYPE_P (type)); | |
151 | ssa_name = make_ssa_name_fn (cfun, type, stmt); | |
152 | SET_SSA_NAME_VAR_OR_IDENTIFIER (ssa_name, get_identifier (name)); | |
153 | return ssa_name; | |
154 | } | |
155 | ||
156 | ||
157 | #endif /* GCC_TREE_SSANAMES_H */ |