Mercurial > hg > CbC > CbC_gcc
annotate gcc/tree-ssa-sccvn.h @ 84:a5786e986ad2
modify gcc/c-parser.c
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 13 Nov 2011 16:21:32 +0900 |
parents | f6334be47118 |
children | 04ced10e8804 |
rev | line source |
---|---|
0 | 1 /* Tree SCC value numbering |
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
|
2 Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
0 | 3 Contributed by Daniel Berlin <dberlin@dberlin.org> |
4 | |
5 This file is part of GCC. | |
6 | |
7 GCC is free software; you can redistribute it and/or modify | |
8 under the terms of the GNU General Public License as published by | |
9 the Free Software Foundation; either version 3 of the License, or | |
10 (at your option) any later version. | |
11 | |
12 GCC is distributed in the hope that it will be useful, | |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 GNU General Public License for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with GCC; see the file COPYING3. If not see | |
19 <http://www.gnu.org/licenses/>. */ | |
20 | |
21 #ifndef TREE_SSA_SCCVN_H | |
22 #define TREE_SSA_SCCVN_H | |
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 | 28 /* TOP of the VN lattice. */ |
29 extern tree VN_TOP; | |
30 | |
31 /* N-ary operations in the hashtable consist of length operands, an | |
32 opcode, and a type. Result is the value number of the operation, | |
33 and hashcode is stored to avoid having to calculate it | |
34 repeatedly. */ | |
35 | |
36 typedef struct vn_nary_op_s | |
37 { | |
38 /* Unique identify that all expressions with the same value have. */ | |
39 unsigned int value_id; | |
40 ENUM_BITFIELD(tree_code) opcode : 16; | |
41 unsigned length : 16; | |
42 hashval_t hashcode; | |
43 tree result; | |
44 tree type; | |
45 tree op[4]; | |
46 } *vn_nary_op_t; | |
47 typedef const struct vn_nary_op_s *const_vn_nary_op_t; | |
48 | |
49 /* Phi nodes in the hashtable consist of their non-VN_TOP phi | |
50 arguments, and the basic block the phi is in. Result is the value | |
51 number of the operation, and hashcode is stored to avoid having to | |
52 calculate it repeatedly. Phi nodes not in the same block are never | |
53 considered equivalent. */ | |
54 | |
55 typedef struct vn_phi_s | |
56 { | |
57 /* Unique identifier that all expressions with the same value have. */ | |
58 unsigned int value_id; | |
59 hashval_t hashcode; | |
60 VEC (tree, heap) *phiargs; | |
61 basic_block block; | |
62 tree result; | |
63 } *vn_phi_t; | |
64 typedef const struct vn_phi_s *const_vn_phi_t; | |
65 | |
66 /* Reference operands only exist in reference operations structures. | |
67 They consist of an opcode, type, and some number of operands. For | |
68 a given opcode, some, all, or none of the operands may be used. | |
69 The operands are there to store the information that makes up the | |
70 portion of the addressing calculation that opcode performs. */ | |
71 | |
72 typedef struct vn_reference_op_struct | |
73 { | |
74 enum tree_code opcode; | |
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
|
75 /* Constant offset this op adds or -1 if it is variable. */ |
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
|
76 HOST_WIDE_INT off; |
0 | 77 tree type; |
78 tree op0; | |
79 tree op1; | |
80 tree op2; | |
81 } vn_reference_op_s; | |
82 typedef vn_reference_op_s *vn_reference_op_t; | |
83 typedef const vn_reference_op_s *const_vn_reference_op_t; | |
84 | |
85 DEF_VEC_O(vn_reference_op_s); | |
86 DEF_VEC_ALLOC_O(vn_reference_op_s, heap); | |
87 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
88 /* 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
|
89 the vuse, representing the memory state at the time of |
0 | 90 the operation, and a collection of operands that make up the |
91 addressing calculation. If two vn_reference_t's have the same set | |
92 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
|
93 the resulting value number, and the hashcode. */ |
0 | 94 |
95 typedef struct vn_reference_s | |
96 { | |
97 /* Unique identifier that all expressions with the same value have. */ | |
98 unsigned int value_id; | |
99 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
|
100 tree vuse; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
101 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
|
102 tree type; |
0 | 103 VEC (vn_reference_op_s, heap) *operands; |
104 tree result; | |
105 } *vn_reference_t; | |
106 typedef const struct vn_reference_s *const_vn_reference_t; | |
107 | |
108 typedef struct vn_constant_s | |
109 { | |
110 unsigned int value_id; | |
111 hashval_t hashcode; | |
112 tree constant; | |
113 } *vn_constant_t; | |
114 | |
115 /* Hash the constant CONSTANT with distinguishing type incompatible | |
116 constants in the types_compatible_p sense. */ | |
117 | |
118 static inline hashval_t | |
119 vn_hash_constant_with_type (tree constant) | |
120 { | |
121 tree type = TREE_TYPE (constant); | |
122 return (iterative_hash_expr (constant, 0) | |
123 + INTEGRAL_TYPE_P (type) | |
124 + (INTEGRAL_TYPE_P (type) | |
125 ? TYPE_PRECISION (type) + TYPE_UNSIGNED (type) : 0)); | |
126 } | |
127 | |
128 /* Compare the constants C1 and C2 with distinguishing type incompatible | |
129 constants in the types_compatible_p sense. */ | |
130 | |
131 static inline bool | |
132 vn_constant_eq_with_type (tree c1, tree c2) | |
133 { | |
134 return (expressions_equal_p (c1, c2) | |
135 && types_compatible_p (TREE_TYPE (c1), TREE_TYPE (c2))); | |
136 } | |
137 | |
138 typedef struct vn_ssa_aux | |
139 { | |
140 /* Value number. This may be an SSA name or a constant. */ | |
141 tree valnum; | |
142 /* Representative expression, if not a direct constant. */ | |
143 tree expr; | |
144 | |
145 /* Unique identifier that all expressions with the same value have. */ | |
146 unsigned int value_id; | |
147 | |
148 /* SCC information. */ | |
149 unsigned int dfsnum; | |
150 unsigned int low; | |
151 unsigned visited : 1; | |
152 unsigned on_sccstack : 1; | |
153 | |
154 /* Whether the representative expression contains constants. */ | |
155 unsigned has_constants : 1; | |
156 /* Whether the SSA_NAME has been value numbered already. This is | |
157 only saying whether visit_use has been called on it at least | |
158 once. It cannot be used to avoid visitation for SSA_NAME's | |
159 involved in non-singleton SCC's. */ | |
160 unsigned use_processed : 1; | |
161 | |
162 /* Whether the SSA_NAME has no defining statement and thus an | |
163 insertion of such with EXPR as definition is required before | |
164 a use can be created of it. */ | |
165 unsigned needs_insertion : 1; | |
166 } *vn_ssa_aux_t; | |
167 | |
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
|
168 typedef enum { VN_NOWALK, VN_WALK, VN_WALKREWRITE } vn_lookup_kind; |
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
|
169 |
0 | 170 /* Return the value numbering info for an SSA_NAME. */ |
171 extern vn_ssa_aux_t VN_INFO (tree); | |
172 extern vn_ssa_aux_t VN_INFO_GET (tree); | |
173 tree vn_get_expr_for (tree); | |
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
|
174 bool run_scc_vn (vn_lookup_kind); |
0 | 175 void free_scc_vn (void); |
176 tree vn_nary_op_lookup (tree, vn_nary_op_t *); | |
177 tree vn_nary_op_lookup_stmt (gimple, vn_nary_op_t *); | |
178 tree vn_nary_op_lookup_pieces (unsigned int, enum tree_code, | |
179 tree, tree, tree, tree, tree, | |
180 vn_nary_op_t *); | |
181 vn_nary_op_t vn_nary_op_insert (tree, tree); | |
182 vn_nary_op_t vn_nary_op_insert_stmt (gimple, tree); | |
183 vn_nary_op_t vn_nary_op_insert_pieces (unsigned int, enum tree_code, | |
184 tree, tree, tree, tree, | |
185 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
|
186 void vn_reference_fold_indirect (VEC (vn_reference_op_s, heap) **, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
187 unsigned int *); |
0 | 188 void copy_reference_ops_from_ref (tree, VEC(vn_reference_op_s, heap) **); |
189 void copy_reference_ops_from_call (gimple, VEC(vn_reference_op_s, heap) **); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
190 bool ao_ref_init_from_vn_reference (ao_ref *, alias_set_type, tree, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
191 VEC (vn_reference_op_s, heap) *); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
192 tree vn_reference_lookup_pieces (tree, alias_set_type, tree, |
0 | 193 VEC (vn_reference_op_s, heap) *, |
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
|
194 vn_reference_t *, vn_lookup_kind); |
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
|
195 tree vn_reference_lookup (tree, tree, vn_lookup_kind, 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
|
196 vn_reference_t vn_reference_insert (tree, tree, tree); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
197 vn_reference_t vn_reference_insert_pieces (tree, alias_set_type, tree, |
0 | 198 VEC (vn_reference_op_s, heap) *, |
199 tree, unsigned int); | |
200 | |
201 hashval_t vn_nary_op_compute_hash (const vn_nary_op_t); | |
202 int vn_nary_op_eq (const void *, const void *); | |
203 bool vn_nary_may_trap (vn_nary_op_t); | |
204 hashval_t vn_reference_compute_hash (const vn_reference_t); | |
205 int vn_reference_eq (const void *, const void *); | |
206 unsigned int get_max_value_id (void); | |
207 unsigned int get_next_value_id (void); | |
208 unsigned int get_constant_value_id (tree); | |
209 unsigned int get_or_alloc_constant_value_id (tree); | |
210 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
|
211 tree fully_constant_vn_reference_p (vn_reference_t); |
0 | 212 #endif /* TREE_SSA_SCCVN_H */ |