annotate gcc/tree-ssa-sccvn.h @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Tree SCC value numbering
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2007-2020 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 Contributed by Daniel Berlin <dberlin@dberlin.org>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 GCC is free software; you can redistribute it and/or modify
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 (at your option) any later version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 GCC is distributed in the hope that it will be useful,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 GNU General Public License for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #ifndef TREE_SSA_SCCVN_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 #define TREE_SSA_SCCVN_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
24 /* In tree-ssa-sccvn.c */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
25 bool expressions_equal_p (tree, tree);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
26
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
27
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 /* TOP of the VN lattice. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 extern tree VN_TOP;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
31 /* A predicated value. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
32 struct vn_pval
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
33 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
34 vn_pval *next;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
35 /* The value of the expression this is attached to is RESULT in
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
36 case the expression is computed dominated by one of the blocks
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
37 in valid_dominated_by_p. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
38 tree result;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
39 unsigned n;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
40 int valid_dominated_by_p[1];
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
41 };
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
42
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 /* N-ary operations in the hashtable consist of length operands, an
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 opcode, and a type. Result is the value number of the operation,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 and hashcode is stored to avoid having to calculate it
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 repeatedly. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 typedef struct vn_nary_op_s
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
50 vn_nary_op_s *next;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
51 vn_nary_op_s *unwind_to;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 /* Unique identify that all expressions with the same value have. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 unsigned int value_id;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 ENUM_BITFIELD(tree_code) opcode : 16;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 unsigned length : 16;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 hashval_t hashcode;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
57 unsigned predicated_values : 1;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
58 union {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
59 /* If ! predicated_values this is the value of the expression. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
60 tree result;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
61 /* If predicated_values this is a list of values of the expression. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
62 vn_pval *values;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
63 } u;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 tree type;
111
kono
parents: 67
diff changeset
65 tree op[1];
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 } *vn_nary_op_t;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 typedef const struct vn_nary_op_s *const_vn_nary_op_t;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68
111
kono
parents: 67
diff changeset
69 /* Return the size of a vn_nary_op_t with LENGTH operands. */
kono
parents: 67
diff changeset
70
kono
parents: 67
diff changeset
71 static inline size_t
kono
parents: 67
diff changeset
72 sizeof_vn_nary_op (unsigned int length)
kono
parents: 67
diff changeset
73 {
kono
parents: 67
diff changeset
74 return sizeof (struct vn_nary_op_s) + sizeof (tree) * length - sizeof (tree);
kono
parents: 67
diff changeset
75 }
kono
parents: 67
diff changeset
76
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 /* Phi nodes in the hashtable consist of their non-VN_TOP phi
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 arguments, and the basic block the phi is in. Result is the value
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 number of the operation, and hashcode is stored to avoid having to
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 calculate it repeatedly. Phi nodes not in the same block are never
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 considered equivalent. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 typedef struct vn_phi_s
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
85 vn_phi_s *next;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 /* Unique identifier that all expressions with the same value have. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 unsigned int value_id;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 hashval_t hashcode;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 basic_block block;
111
kono
parents: 67
diff changeset
90 /* Controlling condition lhs/rhs. */
kono
parents: 67
diff changeset
91 tree cclhs;
kono
parents: 67
diff changeset
92 tree ccrhs;
kono
parents: 67
diff changeset
93 tree type;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 tree result;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
95 /* The number of args is determined by EDGE_COUT (block->preds). */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
96 tree phiargs[1];
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 } *vn_phi_t;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 typedef const struct vn_phi_s *const_vn_phi_t;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 /* Reference operands only exist in reference operations structures.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 They consist of an opcode, type, and some number of operands. For
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 a given opcode, some, all, or none of the operands may be used.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 The operands are there to store the information that makes up the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 portion of the addressing calculation that opcode performs. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 typedef struct vn_reference_op_struct
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 {
111
kono
parents: 67
diff changeset
108 ENUM_BITFIELD(tree_code) opcode : 16;
kono
parents: 67
diff changeset
109 /* Dependence info, used for [TARGET_]MEM_REF only. */
kono
parents: 67
diff changeset
110 unsigned short clique;
kono
parents: 67
diff changeset
111 unsigned short base;
kono
parents: 67
diff changeset
112 unsigned reverse : 1;
kono
parents: 67
diff changeset
113 /* For storing TYPE_ALIGN for array ref element size computation. */
kono
parents: 67
diff changeset
114 unsigned align : 6;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
115 /* Constant offset this op adds or -1 if it is variable. */
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
116 poly_int64_pod off;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 tree type;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 tree op0;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 tree op1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 tree op2;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 } vn_reference_op_s;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 typedef vn_reference_op_s *vn_reference_op_t;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 typedef const vn_reference_op_s *const_vn_reference_op_t;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124
111
kono
parents: 67
diff changeset
125 inline unsigned
kono
parents: 67
diff changeset
126 vn_ref_op_align_unit (vn_reference_op_t op)
kono
parents: 67
diff changeset
127 {
kono
parents: 67
diff changeset
128 return op->align ? ((unsigned)1 << (op->align - 1)) / BITS_PER_UNIT : 0;
kono
parents: 67
diff changeset
129 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
131 /* A reference operation in the hashtable is representation as
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
132 the vuse, representing the memory state at the time of
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 the operation, and a collection of operands that make up the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 addressing calculation. If two vn_reference_t's have the same set
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 of operands, they access the same memory location. We also store
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
136 the resulting value number, and the hashcode. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 typedef struct vn_reference_s
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
140 vn_reference_s *next;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 /* Unique identifier that all expressions with the same value have. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 unsigned int value_id;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 hashval_t hashcode;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
144 tree vuse;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
145 alias_set_type set;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
146 tree type;
111
kono
parents: 67
diff changeset
147 vec<vn_reference_op_s> operands;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 tree result;
111
kono
parents: 67
diff changeset
149 tree result_vdef;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 } *vn_reference_t;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 typedef const struct vn_reference_s *const_vn_reference_t;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
152
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 typedef struct vn_constant_s
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
154 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 unsigned int value_id;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 hashval_t hashcode;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 tree constant;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 } *vn_constant_t;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159
111
kono
parents: 67
diff changeset
160 enum vn_kind { VN_NONE, VN_CONSTANT, VN_NARY, VN_REFERENCE, VN_PHI };
kono
parents: 67
diff changeset
161 enum vn_kind vn_get_stmt_kind (gimple *);
kono
parents: 67
diff changeset
162
kono
parents: 67
diff changeset
163 /* Hash the type TYPE using bits that distinguishes it in the
kono
parents: 67
diff changeset
164 types_compatible_p sense. */
kono
parents: 67
diff changeset
165
kono
parents: 67
diff changeset
166 static inline hashval_t
kono
parents: 67
diff changeset
167 vn_hash_type (tree type)
kono
parents: 67
diff changeset
168 {
kono
parents: 67
diff changeset
169 return (INTEGRAL_TYPE_P (type)
kono
parents: 67
diff changeset
170 + (INTEGRAL_TYPE_P (type)
kono
parents: 67
diff changeset
171 ? TYPE_PRECISION (type) + TYPE_UNSIGNED (type) : 0));
kono
parents: 67
diff changeset
172 }
kono
parents: 67
diff changeset
173
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 /* Hash the constant CONSTANT with distinguishing type incompatible
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 constants in the types_compatible_p sense. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 static inline hashval_t
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 vn_hash_constant_with_type (tree constant)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 {
111
kono
parents: 67
diff changeset
180 inchash::hash hstate;
kono
parents: 67
diff changeset
181 inchash::add_expr (constant, hstate);
kono
parents: 67
diff changeset
182 hstate.merge_hash (vn_hash_type (TREE_TYPE (constant)));
kono
parents: 67
diff changeset
183 return hstate.end ();
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
185
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 /* Compare the constants C1 and C2 with distinguishing type incompatible
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 constants in the types_compatible_p sense. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 static inline bool
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 vn_constant_eq_with_type (tree c1, tree c2)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
191 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 return (expressions_equal_p (c1, c2)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 && types_compatible_p (TREE_TYPE (c1), TREE_TYPE (c2)));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
195
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
196 /* Instead of having a local availability lattice for each basic-block
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
197 and availability at X defined as union of the local availabilities
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
198 at X and its dominators we're turning this upside down and track
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
199 availability per value given values are usually made available at very
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
200 few points.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
201 So we have a chain of LOCATION, LEADER entries where LOCATION is
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
202 specifying the basic-block LEADER is made available for VALUE.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
203 We prepend to this chain in RPO order thus for iteration we can simply
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
204 remove the last entries.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
205 LOCATION is the basic-block index and LEADER is its SSA name version. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
206 struct vn_avail
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
207 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
208 vn_avail *next;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
209 /* The basic-block LEADER is made available. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
210 int location;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
211 /* The LEADER for the value we are chained on. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
212 int leader;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
213 };
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
214
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 typedef struct vn_ssa_aux
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
217 /* SSA name this vn_ssa_aux is associated with in the lattice. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
218 tree name;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 /* Value number. This may be an SSA name or a constant. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 tree valnum;
111
kono
parents: 67
diff changeset
221 /* Statements to insert if needs_insertion is true. */
kono
parents: 67
diff changeset
222 gimple_seq expr;
kono
parents: 67
diff changeset
223
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
224 /* AVAIL entries, last in RPO order is first. This is only tracked
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
225 for SSA names also serving as values (NAME == VALNUM). */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
226 vn_avail *avail;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
227
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 /* Unique identifier that all expressions with the same value have. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 unsigned int value_id;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
231 /* Whether the SSA_NAME has been processed at least once. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 unsigned visited : 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
233
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 /* Whether the SSA_NAME has no defining statement and thus an
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
235 insertion of such with EXPR as definition is required before
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 a use can be created of it. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
237 unsigned needs_insertion : 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
238 } *vn_ssa_aux_t;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
239
111
kono
parents: 67
diff changeset
240 enum vn_lookup_kind { VN_NOWALK, VN_WALK, VN_WALKREWRITE };
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
241
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
242 /* Return the value numbering info for an SSA_NAME. */
111
kono
parents: 67
diff changeset
243 bool has_VN_INFO (tree);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
244 extern vn_ssa_aux_t VN_INFO (tree);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
245 tree vn_get_expr_for (tree);
111
kono
parents: 67
diff changeset
246 void scc_vn_restore_ssa_info (void);
kono
parents: 67
diff changeset
247 tree vn_nary_op_lookup_stmt (gimple *, vn_nary_op_t *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
248 tree vn_nary_op_lookup_pieces (unsigned int, enum tree_code,
111
kono
parents: 67
diff changeset
249 tree, tree *, vn_nary_op_t *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 vn_nary_op_t vn_nary_op_insert_pieces (unsigned int, enum tree_code,
111
kono
parents: 67
diff changeset
251 tree, tree *, tree, unsigned int);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
252 bool ao_ref_init_from_vn_reference (ao_ref *, alias_set_type, tree,
111
kono
parents: 67
diff changeset
253 vec<vn_reference_op_s> );
kono
parents: 67
diff changeset
254 vec<vn_reference_op_s> vn_reference_operands_for_lookup (tree);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
255 tree vn_reference_lookup_pieces (tree, alias_set_type, tree,
111
kono
parents: 67
diff changeset
256 vec<vn_reference_op_s> ,
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
257 vn_reference_t *, vn_lookup_kind);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
258 tree vn_reference_lookup (tree, tree, vn_lookup_kind, vn_reference_t *, bool,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
259 tree * = NULL);
111
kono
parents: 67
diff changeset
260 void vn_reference_lookup_call (gcall *, vn_reference_t *, vn_reference_t);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
261 vn_reference_t vn_reference_insert_pieces (tree, alias_set_type, tree,
111
kono
parents: 67
diff changeset
262 vec<vn_reference_op_s> ,
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 tree, unsigned int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
264
111
kono
parents: 67
diff changeset
265 bool vn_nary_op_eq (const_vn_nary_op_t const vno1,
kono
parents: 67
diff changeset
266 const_vn_nary_op_t const vno2);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
267 bool vn_nary_may_trap (vn_nary_op_t);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
268 bool vn_reference_may_trap (vn_reference_t);
111
kono
parents: 67
diff changeset
269 bool vn_reference_eq (const_vn_reference_t const, const_vn_reference_t const);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
270 unsigned int get_max_value_id (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
271 unsigned int get_next_value_id (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
272 unsigned int get_constant_value_id (tree);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
273 unsigned int get_or_alloc_constant_value_id (tree);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
274 bool value_id_constant_p (unsigned int);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
275 tree fully_constant_vn_reference_p (vn_reference_t);
111
kono
parents: 67
diff changeset
276 tree vn_nary_simplify (vn_nary_op_t);
kono
parents: 67
diff changeset
277
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
278 unsigned do_rpo_vn (function *, edge, bitmap);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
279 void run_rpo_vn (vn_lookup_kind);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
280 unsigned eliminate_with_rpo_vn (bitmap);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
281 void free_rpo_vn (void);
111
kono
parents: 67
diff changeset
282
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
283 /* Valueize NAME if it is an SSA name, otherwise just return it. This hook
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
284 is initialized by run_scc_vn. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
285 extern tree (*vn_valueize) (tree);
111
kono
parents: 67
diff changeset
286
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
287 /* Context that valueization should operate on. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
288 extern basic_block vn_context_bb;
111
kono
parents: 67
diff changeset
289
kono
parents: 67
diff changeset
290
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
291 #endif /* TREE_SSA_SCCVN_H */