comparison gcc/tree-ssa-sccvn.h @ 132:d34655255c78

update gcc-8.2
author mir3636
date Thu, 25 Oct 2018 10:21:07 +0900
parents 84e7813d76e9
children 1830386684a0
comparison
equal deleted inserted replaced
130:e108057fa461 132:d34655255c78
1 /* Tree SCC value numbering 1 /* Tree SCC value numbering
2 Copyright (C) 2007-2017 Free Software Foundation, Inc. 2 Copyright (C) 2007-2018 Free Software Foundation, Inc.
3 Contributed by Daniel Berlin <dberlin@dberlin.org> 3 Contributed by Daniel Berlin <dberlin@dberlin.org>
4 4
5 This file is part of GCC. 5 This file is part of GCC.
6 6
7 GCC is free software; you can redistribute it and/or modify 7 GCC is free software; you can redistribute it and/or modify
26 26
27 27
28 /* TOP of the VN lattice. */ 28 /* TOP of the VN lattice. */
29 extern tree VN_TOP; 29 extern tree VN_TOP;
30 30
31 /* A predicated value. */
32 struct vn_pval
33 {
34 vn_pval *next;
35 /* The value of the expression this is attached to is RESULT in
36 case the expression is computed dominated by one of the blocks
37 in valid_dominated_by_p. */
38 tree result;
39 unsigned n;
40 int valid_dominated_by_p[1];
41 };
42
31 /* N-ary operations in the hashtable consist of length operands, an 43 /* N-ary operations in the hashtable consist of length operands, an
32 opcode, and a type. Result is the value number of the operation, 44 opcode, and a type. Result is the value number of the operation,
33 and hashcode is stored to avoid having to calculate it 45 and hashcode is stored to avoid having to calculate it
34 repeatedly. */ 46 repeatedly. */
35 47
36 typedef struct vn_nary_op_s 48 typedef struct vn_nary_op_s
37 { 49 {
50 vn_nary_op_s *next;
51 vn_nary_op_s *unwind_to;
38 /* Unique identify that all expressions with the same value have. */ 52 /* Unique identify that all expressions with the same value have. */
39 unsigned int value_id; 53 unsigned int value_id;
40 ENUM_BITFIELD(tree_code) opcode : 16; 54 ENUM_BITFIELD(tree_code) opcode : 16;
41 unsigned length : 16; 55 unsigned length : 16;
42 hashval_t hashcode; 56 hashval_t hashcode;
43 tree result; 57 unsigned predicated_values : 1;
58 union {
59 /* If ! predicated_values this is the value of the expression. */
60 tree result;
61 /* If predicated_values this is a list of values of the expression. */
62 vn_pval *values;
63 } u;
44 tree type; 64 tree type;
45 tree op[1]; 65 tree op[1];
46 } *vn_nary_op_t; 66 } *vn_nary_op_t;
47 typedef const struct vn_nary_op_s *const_vn_nary_op_t; 67 typedef const struct vn_nary_op_s *const_vn_nary_op_t;
48 68
60 calculate it repeatedly. Phi nodes not in the same block are never 80 calculate it repeatedly. Phi nodes not in the same block are never
61 considered equivalent. */ 81 considered equivalent. */
62 82
63 typedef struct vn_phi_s 83 typedef struct vn_phi_s
64 { 84 {
85 vn_phi_s *next;
65 /* Unique identifier that all expressions with the same value have. */ 86 /* Unique identifier that all expressions with the same value have. */
66 unsigned int value_id; 87 unsigned int value_id;
67 hashval_t hashcode; 88 hashval_t hashcode;
68 vec<tree> phiargs;
69 basic_block block; 89 basic_block block;
70 /* Controlling condition lhs/rhs. */ 90 /* Controlling condition lhs/rhs. */
71 tree cclhs; 91 tree cclhs;
72 tree ccrhs; 92 tree ccrhs;
73 tree type; 93 tree type;
74 tree result; 94 tree result;
95 /* The number of args is determined by EDGE_COUT (block->preds). */
96 tree phiargs[1];
75 } *vn_phi_t; 97 } *vn_phi_t;
76 typedef const struct vn_phi_s *const_vn_phi_t; 98 typedef const struct vn_phi_s *const_vn_phi_t;
77 99
78 /* Reference operands only exist in reference operations structures. 100 /* Reference operands only exist in reference operations structures.
79 They consist of an opcode, type, and some number of operands. For 101 They consist of an opcode, type, and some number of operands. For
85 { 107 {
86 ENUM_BITFIELD(tree_code) opcode : 16; 108 ENUM_BITFIELD(tree_code) opcode : 16;
87 /* Dependence info, used for [TARGET_]MEM_REF only. */ 109 /* Dependence info, used for [TARGET_]MEM_REF only. */
88 unsigned short clique; 110 unsigned short clique;
89 unsigned short base; 111 unsigned short base;
90 /* 1 for instrumented calls. */
91 unsigned with_bounds : 1;
92 unsigned reverse : 1; 112 unsigned reverse : 1;
93 /* For storing TYPE_ALIGN for array ref element size computation. */ 113 /* For storing TYPE_ALIGN for array ref element size computation. */
94 unsigned align : 6; 114 unsigned align : 6;
95 /* Constant offset this op adds or -1 if it is variable. */ 115 /* Constant offset this op adds or -1 if it is variable. */
96 HOST_WIDE_INT off; 116 poly_int64_pod off;
97 tree type; 117 tree type;
98 tree op0; 118 tree op0;
99 tree op1; 119 tree op1;
100 tree op2; 120 tree op2;
101 } vn_reference_op_s; 121 } vn_reference_op_s;
115 of operands, they access the same memory location. We also store 135 of operands, they access the same memory location. We also store
116 the resulting value number, and the hashcode. */ 136 the resulting value number, and the hashcode. */
117 137
118 typedef struct vn_reference_s 138 typedef struct vn_reference_s
119 { 139 {
140 vn_reference_s *next;
120 /* Unique identifier that all expressions with the same value have. */ 141 /* Unique identifier that all expressions with the same value have. */
121 unsigned int value_id; 142 unsigned int value_id;
122 hashval_t hashcode; 143 hashval_t hashcode;
123 tree vuse; 144 tree vuse;
124 alias_set_type set; 145 alias_set_type set;
172 && types_compatible_p (TREE_TYPE (c1), TREE_TYPE (c2))); 193 && types_compatible_p (TREE_TYPE (c1), TREE_TYPE (c2)));
173 } 194 }
174 195
175 typedef struct vn_ssa_aux 196 typedef struct vn_ssa_aux
176 { 197 {
198 /* SSA name this vn_ssa_aux is associated with in the lattice. */
199 tree name;
177 /* Value number. This may be an SSA name or a constant. */ 200 /* Value number. This may be an SSA name or a constant. */
178 tree valnum; 201 tree valnum;
179 /* Statements to insert if needs_insertion is true. */ 202 /* Statements to insert if needs_insertion is true. */
180 gimple_seq expr; 203 gimple_seq expr;
181 204
182 /* Saved SSA name info. */
183 tree_ssa_name::ssa_name_info_type info;
184
185 /* Unique identifier that all expressions with the same value have. */ 205 /* Unique identifier that all expressions with the same value have. */
186 unsigned int value_id; 206 unsigned int value_id;
187 207
188 /* SCC information. */ 208 /* Whether the SSA_NAME has been processed at least once. */
189 unsigned int dfsnum;
190 unsigned int low;
191 unsigned visited : 1; 209 unsigned visited : 1;
192 unsigned on_sccstack : 1;
193
194 /* Whether the SSA_NAME has been value numbered already. This is
195 only saying whether visit_use has been called on it at least
196 once. It cannot be used to avoid visitation for SSA_NAME's
197 involved in non-singleton SCC's. */
198 unsigned use_processed : 1;
199 210
200 /* Whether the SSA_NAME has no defining statement and thus an 211 /* Whether the SSA_NAME has no defining statement and thus an
201 insertion of such with EXPR as definition is required before 212 insertion of such with EXPR as definition is required before
202 a use can be created of it. */ 213 a use can be created of it. */
203 unsigned needs_insertion : 1; 214 unsigned needs_insertion : 1;
204
205 /* Whether range-info is anti-range. */
206 unsigned range_info_anti_range_p : 1;
207 } *vn_ssa_aux_t; 215 } *vn_ssa_aux_t;
208 216
209 enum vn_lookup_kind { VN_NOWALK, VN_WALK, VN_WALKREWRITE }; 217 enum vn_lookup_kind { VN_NOWALK, VN_WALK, VN_WALKREWRITE };
210 218
211 /* Return the value numbering info for an SSA_NAME. */ 219 /* Return the value numbering info for an SSA_NAME. */
212 bool has_VN_INFO (tree); 220 bool has_VN_INFO (tree);
213 extern vn_ssa_aux_t VN_INFO (tree); 221 extern vn_ssa_aux_t VN_INFO (tree);
214 extern vn_ssa_aux_t VN_INFO_GET (tree);
215 tree vn_get_expr_for (tree); 222 tree vn_get_expr_for (tree);
216 void run_scc_vn (vn_lookup_kind);
217 unsigned int vn_eliminate (bitmap);
218 void free_scc_vn (void);
219 void scc_vn_restore_ssa_info (void); 223 void scc_vn_restore_ssa_info (void);
220 tree vn_nary_op_lookup (tree, vn_nary_op_t *); 224 tree vn_nary_op_lookup (tree, vn_nary_op_t *);
221 tree vn_nary_op_lookup_stmt (gimple *, vn_nary_op_t *); 225 tree vn_nary_op_lookup_stmt (gimple *, vn_nary_op_t *);
222 tree vn_nary_op_lookup_pieces (unsigned int, enum tree_code, 226 tree vn_nary_op_lookup_pieces (unsigned int, enum tree_code,
223 tree, tree *, vn_nary_op_t *); 227 tree, tree *, vn_nary_op_t *);
246 unsigned int get_or_alloc_constant_value_id (tree); 250 unsigned int get_or_alloc_constant_value_id (tree);
247 bool value_id_constant_p (unsigned int); 251 bool value_id_constant_p (unsigned int);
248 tree fully_constant_vn_reference_p (vn_reference_t); 252 tree fully_constant_vn_reference_p (vn_reference_t);
249 tree vn_nary_simplify (vn_nary_op_t); 253 tree vn_nary_simplify (vn_nary_op_t);
250 254
251 /* Valueize NAME if it is an SSA name, otherwise just return it. */ 255 unsigned do_rpo_vn (function *, edge, bitmap);
252 256 void run_rpo_vn (vn_lookup_kind);
253 static inline tree 257 unsigned eliminate_with_rpo_vn (bitmap);
254 vn_valueize (tree name) 258 void free_rpo_vn (void);
255 { 259
256 if (TREE_CODE (name) == SSA_NAME) 260 /* Valueize NAME if it is an SSA name, otherwise just return it. This hook
257 { 261 is initialized by run_scc_vn. */
258 tree tem = VN_INFO (name)->valnum; 262 extern tree (*vn_valueize) (tree);
259 return tem == VN_TOP ? name : tem; 263
260 } 264 /* Context that valueization should operate on. */
261 return name; 265 extern basic_block vn_context_bb;
262 } 266
263
264 /* Get at the original range info for NAME. */
265
266 inline range_info_def *
267 VN_INFO_RANGE_INFO (tree name)
268 {
269 return (VN_INFO (name)->info.range_info
270 ? VN_INFO (name)->info.range_info
271 : SSA_NAME_RANGE_INFO (name));
272 }
273
274 /* Whether the original range info of NAME is an anti-range. */
275
276 inline bool
277 VN_INFO_ANTI_RANGE_P (tree name)
278 {
279 return (VN_INFO (name)->info.range_info
280 ? VN_INFO (name)->range_info_anti_range_p
281 : SSA_NAME_ANTI_RANGE_P (name));
282 }
283
284 /* Get at the original range info kind for NAME. */
285
286 inline value_range_type
287 VN_INFO_RANGE_TYPE (tree name)
288 {
289 return VN_INFO_ANTI_RANGE_P (name) ? VR_ANTI_RANGE : VR_RANGE;
290 }
291
292 /* Get at the original pointer info for NAME. */
293
294 inline ptr_info_def *
295 VN_INFO_PTR_INFO (tree name)
296 {
297 return (VN_INFO (name)->info.ptr_info
298 ? VN_INFO (name)->info.ptr_info
299 : SSA_NAME_PTR_INFO (name));
300 }
301 267
302 #endif /* TREE_SSA_SCCVN_H */ 268 #endif /* TREE_SSA_SCCVN_H */