comparison gcc/tree-ssa-sccvn.h @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Tree SCC value numbering 1 /* Tree SCC value numbering
2 Copyright (C) 2007-2018 Free Software Foundation, Inc. 2 Copyright (C) 2007-2020 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
191 { 191 {
192 return (expressions_equal_p (c1, c2) 192 return (expressions_equal_p (c1, c2)
193 && types_compatible_p (TREE_TYPE (c1), TREE_TYPE (c2))); 193 && types_compatible_p (TREE_TYPE (c1), TREE_TYPE (c2)));
194 } 194 }
195 195
196 /* Instead of having a local availability lattice for each basic-block
197 and availability at X defined as union of the local availabilities
198 at X and its dominators we're turning this upside down and track
199 availability per value given values are usually made available at very
200 few points.
201 So we have a chain of LOCATION, LEADER entries where LOCATION is
202 specifying the basic-block LEADER is made available for VALUE.
203 We prepend to this chain in RPO order thus for iteration we can simply
204 remove the last entries.
205 LOCATION is the basic-block index and LEADER is its SSA name version. */
206 struct vn_avail
207 {
208 vn_avail *next;
209 /* The basic-block LEADER is made available. */
210 int location;
211 /* The LEADER for the value we are chained on. */
212 int leader;
213 };
214
196 typedef struct vn_ssa_aux 215 typedef struct vn_ssa_aux
197 { 216 {
198 /* SSA name this vn_ssa_aux is associated with in the lattice. */ 217 /* SSA name this vn_ssa_aux is associated with in the lattice. */
199 tree name; 218 tree name;
200 /* Value number. This may be an SSA name or a constant. */ 219 /* Value number. This may be an SSA name or a constant. */
201 tree valnum; 220 tree valnum;
202 /* Statements to insert if needs_insertion is true. */ 221 /* Statements to insert if needs_insertion is true. */
203 gimple_seq expr; 222 gimple_seq expr;
204 223
224 /* AVAIL entries, last in RPO order is first. This is only tracked
225 for SSA names also serving as values (NAME == VALNUM). */
226 vn_avail *avail;
227
205 /* Unique identifier that all expressions with the same value have. */ 228 /* Unique identifier that all expressions with the same value have. */
206 unsigned int value_id; 229 unsigned int value_id;
207 230
208 /* Whether the SSA_NAME has been processed at least once. */ 231 /* Whether the SSA_NAME has been processed at least once. */
209 unsigned visited : 1; 232 unsigned visited : 1;
219 /* Return the value numbering info for an SSA_NAME. */ 242 /* Return the value numbering info for an SSA_NAME. */
220 bool has_VN_INFO (tree); 243 bool has_VN_INFO (tree);
221 extern vn_ssa_aux_t VN_INFO (tree); 244 extern vn_ssa_aux_t VN_INFO (tree);
222 tree vn_get_expr_for (tree); 245 tree vn_get_expr_for (tree);
223 void scc_vn_restore_ssa_info (void); 246 void scc_vn_restore_ssa_info (void);
224 tree vn_nary_op_lookup (tree, vn_nary_op_t *);
225 tree vn_nary_op_lookup_stmt (gimple *, vn_nary_op_t *); 247 tree vn_nary_op_lookup_stmt (gimple *, vn_nary_op_t *);
226 tree vn_nary_op_lookup_pieces (unsigned int, enum tree_code, 248 tree vn_nary_op_lookup_pieces (unsigned int, enum tree_code,
227 tree, tree *, vn_nary_op_t *); 249 tree, tree *, vn_nary_op_t *);
228 vn_nary_op_t vn_nary_op_insert (tree, tree);
229 vn_nary_op_t vn_nary_op_insert_pieces (unsigned int, enum tree_code, 250 vn_nary_op_t vn_nary_op_insert_pieces (unsigned int, enum tree_code,
230 tree, tree *, tree, unsigned int); 251 tree, tree *, tree, unsigned int);
231 bool ao_ref_init_from_vn_reference (ao_ref *, alias_set_type, tree, 252 bool ao_ref_init_from_vn_reference (ao_ref *, alias_set_type, tree,
232 vec<vn_reference_op_s> ); 253 vec<vn_reference_op_s> );
233 vec<vn_reference_op_s> vn_reference_operands_for_lookup (tree); 254 vec<vn_reference_op_s> vn_reference_operands_for_lookup (tree);
234 tree vn_reference_lookup_pieces (tree, alias_set_type, tree, 255 tree vn_reference_lookup_pieces (tree, alias_set_type, tree,
235 vec<vn_reference_op_s> , 256 vec<vn_reference_op_s> ,
236 vn_reference_t *, vn_lookup_kind); 257 vn_reference_t *, vn_lookup_kind);
237 tree vn_reference_lookup (tree, tree, vn_lookup_kind, vn_reference_t *, bool); 258 tree vn_reference_lookup (tree, tree, vn_lookup_kind, vn_reference_t *, bool,
259 tree * = NULL);
238 void vn_reference_lookup_call (gcall *, vn_reference_t *, vn_reference_t); 260 void vn_reference_lookup_call (gcall *, vn_reference_t *, vn_reference_t);
239 vn_reference_t vn_reference_insert_pieces (tree, alias_set_type, tree, 261 vn_reference_t vn_reference_insert_pieces (tree, alias_set_type, tree,
240 vec<vn_reference_op_s> , 262 vec<vn_reference_op_s> ,
241 tree, unsigned int); 263 tree, unsigned int);
242 264
243 bool vn_nary_op_eq (const_vn_nary_op_t const vno1, 265 bool vn_nary_op_eq (const_vn_nary_op_t const vno1,
244 const_vn_nary_op_t const vno2); 266 const_vn_nary_op_t const vno2);
245 bool vn_nary_may_trap (vn_nary_op_t); 267 bool vn_nary_may_trap (vn_nary_op_t);
268 bool vn_reference_may_trap (vn_reference_t);
246 bool vn_reference_eq (const_vn_reference_t const, const_vn_reference_t const); 269 bool vn_reference_eq (const_vn_reference_t const, const_vn_reference_t const);
247 unsigned int get_max_value_id (void); 270 unsigned int get_max_value_id (void);
248 unsigned int get_next_value_id (void); 271 unsigned int get_next_value_id (void);
249 unsigned int get_constant_value_id (tree); 272 unsigned int get_constant_value_id (tree);
250 unsigned int get_or_alloc_constant_value_id (tree); 273 unsigned int get_or_alloc_constant_value_id (tree);