]>
Commit | Line | Data |
---|---|---|
518dc859 | 1 | /* Interprocedural analyses. |
8d9254fc | 2 | Copyright (C) 2005-2020 Free Software Foundation, Inc. |
518dc859 RL |
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 | |
9dcd6f09 | 8 | Software Foundation; either version 3, or (at your option) any later |
518dc859 RL |
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 | |
9dcd6f09 NC |
17 | along with GCC; see the file COPYING3. If not see |
18 | <http://www.gnu.org/licenses/>. */ | |
518dc859 RL |
19 | |
20 | #ifndef IPA_PROP_H | |
21 | #define IPA_PROP_H | |
22 | ||
518dc859 | 23 | /* The following definitions and interfaces are used by |
133f9369 MJ |
24 | interprocedural analyses or parameters. */ |
25 | ||
4502fe8d MJ |
26 | #define IPA_UNDESCRIBED_USE -1 |
27 | ||
133f9369 | 28 | /* ipa-prop.c stuff (ipa-cp, indirect inlining): */ |
518dc859 | 29 | |
be95e2b9 | 30 | /* A jump function for a callsite represents the values passed as actual |
310bc633 MJ |
31 | arguments of the callsite. They were originally proposed in a paper called |
32 | "Interprocedural Constant Propagation", by David Callahan, Keith D Cooper, | |
33 | Ken Kennedy, Linda Torczon in Comp86, pg 152-161. There are three main | |
34 | types of values : | |
685b0d13 MJ |
35 | |
36 | Pass-through - the caller's formal parameter is passed as an actual | |
37 | argument, possibly one simple operation performed on it. | |
38 | Constant - a constant (is_gimple_ip_invariant)is passed as an actual | |
39 | argument. | |
40 | Unknown - neither of the above. | |
41 | ||
eb270950 FX |
42 | IPA_JF_LOAD_AGG is a compound pass-through jump function, in which primary |
43 | operation on formal parameter is memory dereference that loads a value from | |
44 | a part of an aggregate, which is represented or pointed to by the formal | |
45 | parameter. Moreover, an additional unary/binary operation can be applied on | |
46 | the loaded value, and final result is passed as actual argument of callee | |
47 | (e.g. *(param_1(D) + 4) op 24 ). It is meant to describe usage of aggregate | |
48 | parameter or by-reference parameter referenced in argument passing, commonly | |
49 | found in C++ and Fortran. | |
50 | ||
b258210c MJ |
51 | IPA_JF_ANCESTOR is a special pass-through jump function, which means that |
52 | the result is an address of a part of the object pointed to by the formal | |
53 | parameter to which the function refers. It is mainly intended to represent | |
026c3cfd | 54 | getting addresses of ancestor fields in C++ |
b258210c MJ |
55 | (e.g. &this_1(D)->D.1766.D.1756). Note that if the original pointer is |
56 | NULL, ancestor jump function must behave like a simple pass-through. | |
57 | ||
58 | Other pass-through functions can either simply pass on an unchanged formal | |
59 | parameter or can apply one simple binary operation to it (such jump | |
60 | functions are called polynomial). | |
61 | ||
b258210c MJ |
62 | Jump functions are computed in ipa-prop.c by function |
63 | update_call_notes_after_inlining. Some information can be lost and jump | |
64 | functions degraded accordingly when inlining, see | |
65 | update_call_notes_after_inlining in the same file. */ | |
685b0d13 | 66 | |
518dc859 RL |
67 | enum jump_func_type |
68 | { | |
133f9369 | 69 | IPA_JF_UNKNOWN = 0, /* newly allocated and zeroed jump functions default */ |
b258210c | 70 | IPA_JF_CONST, /* represented by field costant */ |
b258210c | 71 | IPA_JF_PASS_THROUGH, /* represented by field pass_through */ |
eb270950 | 72 | IPA_JF_LOAD_AGG, /* represented by field load_agg */ |
b258210c | 73 | IPA_JF_ANCESTOR /* represented by field ancestor */ |
518dc859 RL |
74 | }; |
75 | ||
4502fe8d MJ |
76 | struct ipa_cst_ref_desc; |
77 | ||
78 | /* Structure holding data required to describe a constant jump function. */ | |
79 | struct GTY(()) ipa_constant_data | |
80 | { | |
81 | /* THe value of the constant. */ | |
82 | tree value; | |
83 | /* Pointer to the structure that describes the reference. */ | |
84 | struct ipa_cst_ref_desc GTY((skip)) *rdesc; | |
85 | }; | |
86 | ||
685b0d13 MJ |
87 | /* Structure holding data required to describe a pass-through jump function. */ |
88 | ||
fb3f88cc | 89 | struct GTY(()) ipa_pass_through_data |
685b0d13 MJ |
90 | { |
91 | /* If an operation is to be performed on the original parameter, this is the | |
92 | second (constant) operand. */ | |
93 | tree operand; | |
94 | /* Number of the caller's formal parameter being passed. */ | |
95 | int formal_id; | |
96 | /* Operation that is performed on the argument before it is passed on. | |
97 | NOP_EXPR means no operation. Otherwise oper must be a simple binary | |
98 | arithmetic operation where the caller's parameter is the first operand and | |
99 | operand field from this structure is the second one. */ | |
100 | enum tree_code operation; | |
8b7773a4 MJ |
101 | /* When the passed value is a pointer, it is set to true only when we are |
102 | certain that no write to the object it points to has occurred since the | |
103 | caller functions started execution, except for changes noted in the | |
104 | aggregate part of the jump function (see description of | |
105 | ipa_agg_jump_function). The flag is used only when the operation is | |
106 | NOP_EXPR. */ | |
b8f6e610 | 107 | unsigned agg_preserved : 1; |
685b0d13 MJ |
108 | }; |
109 | ||
eb270950 FX |
110 | /* Structure holding data required to describe a load-value-from-aggregate |
111 | jump function. */ | |
112 | ||
113 | struct GTY(()) ipa_load_agg_data | |
114 | { | |
115 | /* Inherit from pass through jump function, describing unary/binary | |
116 | operation on the value loaded from aggregate that is represented or | |
117 | pointed to by the formal parameter, specified by formal_id in this | |
118 | pass_through jump function data structure. */ | |
119 | struct ipa_pass_through_data pass_through; | |
120 | /* Type of the value loaded from the aggregate. */ | |
121 | tree type; | |
122 | /* Offset at which the value is located within the aggregate. */ | |
123 | HOST_WIDE_INT offset; | |
124 | /* True if loaded by reference (the aggregate is pointed to by the formal | |
125 | parameter) or false if loaded by value (the aggregate is represented | |
126 | by the formal parameter). */ | |
127 | bool by_ref; | |
128 | }; | |
129 | ||
b258210c MJ |
130 | /* Structure holding data required to describe an ancestor pass-through |
131 | jump function. */ | |
685b0d13 | 132 | |
fb3f88cc | 133 | struct GTY(()) ipa_ancestor_jf_data |
685b0d13 MJ |
134 | { |
135 | /* Offset of the field representing the ancestor. */ | |
136 | HOST_WIDE_INT offset; | |
685b0d13 MJ |
137 | /* Number of the caller's formal parameter being passed. */ |
138 | int formal_id; | |
8b7773a4 | 139 | /* Flag with the same meaning like agg_preserve in ipa_pass_through_data. */ |
b8f6e610 | 140 | unsigned agg_preserved : 1; |
685b0d13 MJ |
141 | }; |
142 | ||
eb270950 FX |
143 | /* A jump function for an aggregate part at a given offset, which describes how |
144 | it content value is generated. All unlisted positions are assumed to have a | |
145 | value defined in an unknown way. */ | |
8b7773a4 | 146 | |
84562394 | 147 | struct GTY(()) ipa_agg_jf_item |
8b7773a4 | 148 | { |
eb270950 | 149 | /* The offset for the aggregate part. */ |
8b7773a4 MJ |
150 | HOST_WIDE_INT offset; |
151 | ||
eb270950 FX |
152 | /* Data type of the aggregate part. */ |
153 | tree type; | |
ac6f2e59 | 154 | |
eb270950 FX |
155 | /* Jump function type. */ |
156 | enum jump_func_type jftype; | |
8b7773a4 | 157 | |
eb270950 FX |
158 | /* Represents a value of jump function. constant represents the actual constant |
159 | in constant jump function content. pass_through is used only in simple pass | |
160 | through jump function context. load_agg is for load-value-from-aggregate | |
161 | jump function context. */ | |
162 | union jump_func_agg_value | |
163 | { | |
164 | tree GTY ((tag ("IPA_JF_CONST"))) constant; | |
165 | struct ipa_pass_through_data GTY ((tag ("IPA_JF_PASS_THROUGH"))) pass_through; | |
166 | struct ipa_load_agg_data GTY ((tag ("IPA_JF_LOAD_AGG"))) load_agg; | |
167 | } GTY ((desc ("%1.jftype"))) value; | |
168 | }; | |
8b7773a4 | 169 | |
eb270950 | 170 | /* Jump functions describing a set of aggregate contents. */ |
8b7773a4 MJ |
171 | |
172 | struct GTY(()) ipa_agg_jump_function | |
3e293154 | 173 | { |
eb270950 | 174 | /* Description of the individual jump function item. */ |
84562394 | 175 | vec<ipa_agg_jf_item, va_gc> *items; |
eb270950 | 176 | /* True if the data was passed by reference (as opposed to by value). */ |
8b7773a4 | 177 | bool by_ref; |
eb270950 FX |
178 | }; |
179 | ||
180 | /* An element in an aggregate part describing a known value at a given offset. | |
181 | All unlisted positions are assumed to be unknown and all listed values must | |
182 | fulfill is_gimple_ip_invariant. */ | |
183 | ||
184 | struct ipa_agg_value | |
185 | { | |
186 | /* The offset at which the known value is located within the aggregate. */ | |
187 | HOST_WIDE_INT offset; | |
ac6f2e59 | 188 | |
eb270950 FX |
189 | /* The known constant. */ |
190 | tree value; | |
191 | ||
192 | /* Return true if OTHER describes same agg value. */ | |
193 | bool equal_to (const ipa_agg_value &other); | |
194 | }; | |
195 | ||
196 | /* Structure describing a set of known offset/value for aggregate. */ | |
197 | ||
198 | struct ipa_agg_value_set | |
199 | { | |
200 | /* Description of the individual item. */ | |
201 | vec<ipa_agg_value> items; | |
202 | /* True if the data was passed by reference (as opposed to by value). */ | |
203 | bool by_ref; | |
204 | ||
205 | /* Return true if OTHER describes same agg values. */ | |
206 | bool equal_to (const ipa_agg_value_set &other) | |
ac6f2e59 JH |
207 | { |
208 | if (by_ref != other.by_ref) | |
209 | return false; | |
eb270950 | 210 | if (items.length () != other.items.length ()) |
ac6f2e59 | 211 | return false; |
eb270950 FX |
212 | for (unsigned int i = 0; i < items.length (); i++) |
213 | if (!items[i].equal_to (other.items[i])) | |
ac6f2e59 JH |
214 | return false; |
215 | return true; | |
216 | } | |
eb270950 FX |
217 | |
218 | /* Return true if there is any value for aggregate. */ | |
219 | bool is_empty () const | |
220 | { | |
221 | return items.is_empty (); | |
222 | } | |
223 | ||
224 | ipa_agg_value_set copy () const | |
225 | { | |
226 | ipa_agg_value_set new_copy; | |
227 | ||
228 | new_copy.items = items.copy (); | |
229 | new_copy.by_ref = by_ref; | |
230 | ||
231 | return new_copy; | |
232 | } | |
233 | ||
234 | void release () | |
235 | { | |
236 | items.release (); | |
237 | } | |
3e293154 MJ |
238 | }; |
239 | ||
eb270950 FX |
240 | /* Return copy of a vec<ipa_agg_value_set>. */ |
241 | ||
242 | static inline vec<ipa_agg_value_set> | |
243 | ipa_copy_agg_values (const vec<ipa_agg_value_set> &aggs) | |
244 | { | |
245 | vec<ipa_agg_value_set> aggs_copy = vNULL; | |
246 | ||
247 | if (!aggs.is_empty ()) | |
248 | { | |
249 | ipa_agg_value_set *agg; | |
250 | int i; | |
251 | ||
252 | aggs_copy.reserve_exact (aggs.length ()); | |
253 | ||
254 | FOR_EACH_VEC_ELT (aggs, i, agg) | |
255 | aggs_copy.quick_push (agg->copy ()); | |
256 | } | |
257 | ||
258 | return aggs_copy; | |
259 | } | |
260 | ||
261 | /* For vec<ipa_agg_value_set>, DO NOT call release(), use below function | |
262 | instead. Because ipa_agg_value_set contains a field of vector type, we | |
263 | should release this child vector in each element before reclaiming the | |
264 | whole vector. */ | |
265 | ||
266 | static inline void | |
9c572192 JH |
267 | ipa_release_agg_values (vec<ipa_agg_value_set> &aggs, |
268 | bool release_vector = true) | |
eb270950 FX |
269 | { |
270 | ipa_agg_value_set *agg; | |
271 | int i; | |
272 | ||
273 | FOR_EACH_VEC_ELT (aggs, i, agg) | |
274 | agg->release (); | |
9c572192 JH |
275 | if (release_vector) |
276 | aggs.release (); | |
eb270950 | 277 | } |
8b7773a4 | 278 | |
209ca542 | 279 | /* Information about zero/non-zero bits. */ |
6c1dae73 | 280 | class GTY(()) ipa_bits |
209ca542 | 281 | { |
6c1dae73 | 282 | public: |
209ca542 PK |
283 | /* The propagated value. */ |
284 | widest_int value; | |
285 | /* Mask corresponding to the value. | |
286 | Similar to ccp_lattice_t, if xth bit of mask is 0, | |
287 | implies xth bit of value is constant. */ | |
288 | widest_int mask; | |
209ca542 PK |
289 | }; |
290 | ||
8bc5448f | 291 | /* Info about value ranges. */ |
86cd0334 | 292 | |
6c1dae73 | 293 | class GTY(()) ipa_vr |
8bc5448f | 294 | { |
6c1dae73 | 295 | public: |
8bc5448f KV |
296 | /* The data fields below are valid only if known is true. */ |
297 | bool known; | |
54994253 | 298 | enum value_range_kind type; |
8bc5448f KV |
299 | wide_int min; |
300 | wide_int max; | |
523fe5b6 | 301 | bool nonzero_p (tree) const; |
8bc5448f KV |
302 | }; |
303 | ||
be95e2b9 MJ |
304 | /* A jump function for a callsite represents the values passed as actual |
305 | arguments of the callsite. See enum jump_func_type for the various | |
518dc859 | 306 | types of jump functions supported. */ |
84562394 | 307 | struct GTY (()) ipa_jump_func |
518dc859 | 308 | { |
eb270950 FX |
309 | /* Aggregate jump function description. See struct ipa_agg_jump_function |
310 | and its description. */ | |
8b7773a4 MJ |
311 | struct ipa_agg_jump_function agg; |
312 | ||
86cd0334 MJ |
313 | /* Information about zero/non-zero bits. The pointed to structure is shared |
314 | betweed different jump functions. Use ipa_set_jfunc_bits to set this | |
315 | field. */ | |
99b1c316 | 316 | class ipa_bits *bits; |
209ca542 | 317 | |
a5e14a42 | 318 | /* Information about value range, containing valid data only when vr_known is |
86cd0334 MJ |
319 | true. The pointed to structure is shared betweed different jump |
320 | functions. Use ipa_set_jfunc_vr to set this field. */ | |
028d81b1 | 321 | class value_range *m_vr; |
8bc5448f | 322 | |
518dc859 | 323 | enum jump_func_type type; |
fb3f88cc JH |
324 | /* Represents a value of a jump function. pass_through is used only in jump |
325 | function context. constant represents the actual constant in constant jump | |
326 | functions and member_cst holds constant c++ member functions. */ | |
327 | union jump_func_value | |
328 | { | |
4502fe8d | 329 | struct ipa_constant_data GTY ((tag ("IPA_JF_CONST"))) constant; |
fb3f88cc JH |
330 | struct ipa_pass_through_data GTY ((tag ("IPA_JF_PASS_THROUGH"))) pass_through; |
331 | struct ipa_ancestor_jf_data GTY ((tag ("IPA_JF_ANCESTOR"))) ancestor; | |
fb3f88cc | 332 | } GTY ((desc ("%1.type"))) value; |
84562394 | 333 | }; |
606d9a09 | 334 | |
518dc859 | 335 | |
7b872d9e MJ |
336 | /* Return the constant stored in a constant jump functin JFUNC. */ |
337 | ||
338 | static inline tree | |
339 | ipa_get_jf_constant (struct ipa_jump_func *jfunc) | |
340 | { | |
341 | gcc_checking_assert (jfunc->type == IPA_JF_CONST); | |
4502fe8d MJ |
342 | return jfunc->value.constant.value; |
343 | } | |
344 | ||
345 | static inline struct ipa_cst_ref_desc * | |
346 | ipa_get_jf_constant_rdesc (struct ipa_jump_func *jfunc) | |
347 | { | |
348 | gcc_checking_assert (jfunc->type == IPA_JF_CONST); | |
349 | return jfunc->value.constant.rdesc; | |
7b872d9e MJ |
350 | } |
351 | ||
352 | /* Return the operand of a pass through jmp function JFUNC. */ | |
353 | ||
354 | static inline tree | |
355 | ipa_get_jf_pass_through_operand (struct ipa_jump_func *jfunc) | |
356 | { | |
357 | gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH); | |
358 | return jfunc->value.pass_through.operand; | |
359 | } | |
360 | ||
361 | /* Return the number of the caller's formal parameter that a pass through jump | |
362 | function JFUNC refers to. */ | |
363 | ||
364 | static inline int | |
365 | ipa_get_jf_pass_through_formal_id (struct ipa_jump_func *jfunc) | |
366 | { | |
367 | gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH); | |
368 | return jfunc->value.pass_through.formal_id; | |
369 | } | |
370 | ||
371 | /* Return operation of a pass through jump function JFUNC. */ | |
372 | ||
373 | static inline enum tree_code | |
374 | ipa_get_jf_pass_through_operation (struct ipa_jump_func *jfunc) | |
375 | { | |
376 | gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH); | |
377 | return jfunc->value.pass_through.operation; | |
378 | } | |
379 | ||
b8f6e610 | 380 | /* Return the agg_preserved flag of a pass through jump function JFUNC. */ |
8b7773a4 MJ |
381 | |
382 | static inline bool | |
383 | ipa_get_jf_pass_through_agg_preserved (struct ipa_jump_func *jfunc) | |
384 | { | |
385 | gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH); | |
386 | return jfunc->value.pass_through.agg_preserved; | |
387 | } | |
388 | ||
44210a96 MJ |
389 | /* Return true if pass through jump function JFUNC preserves type |
390 | information. */ | |
b8f6e610 MJ |
391 | |
392 | static inline bool | |
393 | ipa_get_jf_pass_through_type_preserved (struct ipa_jump_func *jfunc) | |
394 | { | |
395 | gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH); | |
44210a96 | 396 | return jfunc->value.pass_through.agg_preserved; |
b8f6e610 MJ |
397 | } |
398 | ||
7b872d9e MJ |
399 | /* Return the offset of an ancestor jump function JFUNC. */ |
400 | ||
401 | static inline HOST_WIDE_INT | |
402 | ipa_get_jf_ancestor_offset (struct ipa_jump_func *jfunc) | |
403 | { | |
404 | gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR); | |
405 | return jfunc->value.ancestor.offset; | |
406 | } | |
407 | ||
7b872d9e MJ |
408 | /* Return the number of the caller's formal parameter that an ancestor jump |
409 | function JFUNC refers to. */ | |
410 | ||
411 | static inline int | |
412 | ipa_get_jf_ancestor_formal_id (struct ipa_jump_func *jfunc) | |
413 | { | |
414 | gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR); | |
415 | return jfunc->value.ancestor.formal_id; | |
416 | } | |
417 | ||
b8f6e610 | 418 | /* Return the agg_preserved flag of an ancestor jump function JFUNC. */ |
7b872d9e | 419 | |
8b7773a4 MJ |
420 | static inline bool |
421 | ipa_get_jf_ancestor_agg_preserved (struct ipa_jump_func *jfunc) | |
7b872d9e | 422 | { |
8b7773a4 MJ |
423 | gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR); |
424 | return jfunc->value.ancestor.agg_preserved; | |
7b872d9e MJ |
425 | } |
426 | ||
44210a96 | 427 | /* Return true if ancestor jump function JFUNC presrves type information. */ |
b8f6e610 MJ |
428 | |
429 | static inline bool | |
430 | ipa_get_jf_ancestor_type_preserved (struct ipa_jump_func *jfunc) | |
431 | { | |
432 | gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR); | |
44210a96 | 433 | return jfunc->value.ancestor.agg_preserved; |
b8f6e610 MJ |
434 | } |
435 | ||
310bc633 | 436 | /* Summary describing a single formal parameter. */ |
b258210c | 437 | |
f65f1ae3 | 438 | struct GTY(()) ipa_param_descriptor |
f8e2a1ed | 439 | { |
209ca542 | 440 | /* In analysis and modification phase, this is the PARAM_DECL of this |
700d4cb0 | 441 | parameter, in IPA LTO phase, this is the type of the described |
209ca542 PK |
442 | parameter or NULL if not known. Do not read this field directly but |
443 | through ipa_get_param and ipa_get_type as appropriate. */ | |
444 | tree decl_or_type; | |
4502fe8d MJ |
445 | /* If all uses of the parameter are described by ipa-prop structures, this |
446 | says how many there are. If any use could not be described by means of | |
447 | ipa-prop structures, this is IPA_UNDESCRIBED_USE. */ | |
448 | int controlled_uses; | |
40a777e8 | 449 | unsigned int move_cost : 28; |
339f49ec JH |
450 | /* The parameter is used. */ |
451 | unsigned used : 1; | |
40a777e8 JH |
452 | unsigned used_by_ipa_predicates : 1; |
453 | unsigned used_by_indirect_call : 1; | |
454 | unsigned used_by_polymorphic_call : 1; | |
f8e2a1ed MJ |
455 | }; |
456 | ||
dcd416e3 MJ |
457 | /* ipa_node_params stores information related to formal parameters of functions |
458 | and some other information for interprocedural passes that operate on | |
459 | parameters (such as ipa-cp). */ | |
310bc633 | 460 | |
6c1dae73 | 461 | class GTY((for_user)) ipa_node_params |
518dc859 | 462 | { |
6c1dae73 | 463 | public: |
e806796d ML |
464 | /* Default constructor. */ |
465 | ipa_node_params (); | |
466 | ||
467 | /* Default destructor. */ | |
468 | ~ipa_node_params (); | |
469 | ||
310bc633 MJ |
470 | /* Information about individual formal parameters that are gathered when |
471 | summaries are generated. */ | |
f65f1ae3 | 472 | vec<ipa_param_descriptor, va_gc> *descriptors; |
310bc633 MJ |
473 | /* Pointer to an array of structures describing individual formal |
474 | parameters. */ | |
99b1c316 | 475 | class ipcp_param_lattices * GTY((skip)) lattices; |
310bc633 MJ |
476 | /* Only for versioned nodes this field would not be NULL, |
477 | it points to the node that IPA cp cloned from. */ | |
f65f1ae3 | 478 | struct cgraph_node * GTY((skip)) ipcp_orig_node; |
44210a96 MJ |
479 | /* If this node is an ipa-cp clone, these are the known constants that |
480 | describe what it has been specialized for. */ | |
f65f1ae3 | 481 | vec<tree> GTY((skip)) known_csts; |
44210a96 MJ |
482 | /* If this node is an ipa-cp clone, these are the known polymorphic contexts |
483 | that describe what it has been specialized for. */ | |
f65f1ae3 | 484 | vec<ipa_polymorphic_call_context> GTY((skip)) known_contexts; |
8aab5218 MJ |
485 | /* Whether the param uses analysis and jump function computation has already |
486 | been performed. */ | |
487 | unsigned analysis_done : 1; | |
310bc633 | 488 | /* Whether the function is enqueued in ipa-cp propagation stack. */ |
448f65db | 489 | unsigned node_enqueued : 1; |
310bc633 MJ |
490 | /* Whether we should create a specialized version based on values that are |
491 | known to be constant in all contexts. */ | |
eb20b778 MJ |
492 | unsigned do_clone_for_all_contexts : 1; |
493 | /* Set if this is an IPA-CP clone for all contexts. */ | |
494 | unsigned is_all_contexts_clone : 1; | |
310bc633 MJ |
495 | /* Node has been completely replaced by clones and will be removed after |
496 | ipa-cp is finished. */ | |
497 | unsigned node_dead : 1; | |
af21714c MJ |
498 | /* Node is involved in a recursion, potentionally indirect. */ |
499 | unsigned node_within_scc : 1; | |
9b14fc33 FX |
500 | /* Node contains only direct recursion. */ |
501 | unsigned node_is_self_scc : 1; | |
af21714c MJ |
502 | /* Node is calling a private function called only once. */ |
503 | unsigned node_calling_single_call : 1; | |
7e729474 ML |
504 | /* False when there is something makes versioning impossible. */ |
505 | unsigned versionable : 1; | |
518dc859 RL |
506 | }; |
507 | ||
e806796d ML |
508 | inline |
509 | ipa_node_params::ipa_node_params () | |
510 | : descriptors (NULL), lattices (NULL), ipcp_orig_node (NULL), | |
511 | known_csts (vNULL), known_contexts (vNULL), analysis_done (0), | |
512 | node_enqueued (0), do_clone_for_all_contexts (0), is_all_contexts_clone (0), | |
513 | node_dead (0), node_within_scc (0), node_calling_single_call (0), | |
514 | versionable (0) | |
515 | { | |
516 | } | |
517 | ||
518 | inline | |
519 | ipa_node_params::~ipa_node_params () | |
520 | { | |
521 | free (lattices); | |
522 | known_csts.release (); | |
523 | known_contexts.release (); | |
524 | } | |
525 | ||
ff302741 PB |
526 | /* Intermediate information that we get from alias analysis about a particular |
527 | parameter in a particular basic_block. When a parameter or the memory it | |
56b40062 MJ |
528 | references is marked modified, we use that information in all dominated |
529 | blocks without consulting alias analysis oracle. */ | |
ff302741 | 530 | |
56b40062 | 531 | struct ipa_param_aa_status |
ff302741 PB |
532 | { |
533 | /* Set when this structure contains meaningful information. If not, the | |
534 | structure describing a dominating BB should be used instead. */ | |
535 | bool valid; | |
536 | ||
537 | /* Whether we have seen something which might have modified the data in | |
538 | question. PARM is for the parameter itself, REF is for data it points to | |
539 | but using the alias type of individual accesses and PT is the same thing | |
540 | but for computing aggregate pass-through functions using a very inclusive | |
541 | ao_ref. */ | |
542 | bool parm_modified, ref_modified, pt_modified; | |
543 | }; | |
544 | ||
545 | /* Information related to a given BB that used only when looking at function | |
546 | body. */ | |
547 | ||
548 | struct ipa_bb_info | |
549 | { | |
550 | /* Call graph edges going out of this BB. */ | |
551 | vec<cgraph_edge *> cg_edges; | |
552 | /* Alias analysis statuses of each formal parameter at this bb. */ | |
56b40062 | 553 | vec<ipa_param_aa_status> param_aa_statuses; |
ff302741 PB |
554 | }; |
555 | ||
556 | /* Structure with global information that is only used when looking at function | |
557 | body. */ | |
558 | ||
56b40062 | 559 | struct ipa_func_body_info |
ff302741 PB |
560 | { |
561 | /* The node that is being analyzed. */ | |
562 | cgraph_node *node; | |
563 | ||
564 | /* Its info. */ | |
99b1c316 | 565 | class ipa_node_params *info; |
ff302741 PB |
566 | |
567 | /* Information about individual BBs. */ | |
568 | vec<ipa_bb_info> bb_infos; | |
569 | ||
570 | /* Number of parameters. */ | |
571 | int param_count; | |
572 | ||
c628d1c3 MJ |
573 | /* Number of statements we are still allowed to walked by when analyzing this |
574 | function. */ | |
575 | unsigned int aa_walk_budget; | |
ff302741 PB |
576 | }; |
577 | ||
dcd416e3 MJ |
578 | /* ipa_node_params access functions. Please use these to access fields that |
579 | are or will be shared among various passes. */ | |
580 | ||
dcd416e3 | 581 | /* Return the number of formal parameters. */ |
be95e2b9 | 582 | |
dcd416e3 | 583 | static inline int |
99b1c316 | 584 | ipa_get_param_count (class ipa_node_params *info) |
dcd416e3 | 585 | { |
f65f1ae3 | 586 | return vec_safe_length (info->descriptors); |
dcd416e3 MJ |
587 | } |
588 | ||
f8e2a1ed MJ |
589 | /* Return the declaration of Ith formal parameter of the function corresponding |
590 | to INFO. Note there is no setter function as this array is built just once | |
209ca542 PK |
591 | using ipa_initialize_node_params. This function should not be called in |
592 | WPA. */ | |
be95e2b9 | 593 | |
dcd416e3 | 594 | static inline tree |
99b1c316 | 595 | ipa_get_param (class ipa_node_params *info, int i) |
dcd416e3 | 596 | { |
f65f1ae3 | 597 | gcc_checking_assert (info->descriptors); |
f65f1ae3 | 598 | tree t = (*info->descriptors)[i].decl_or_type; |
209ca542 PK |
599 | gcc_checking_assert (TREE_CODE (t) == PARM_DECL); |
600 | return t; | |
601 | } | |
602 | ||
603 | /* Return the type of Ith formal parameter of the function corresponding | |
604 | to INFO if it is known or NULL if not. */ | |
605 | ||
606 | static inline tree | |
99b1c316 | 607 | ipa_get_type (class ipa_node_params *info, int i) |
209ca542 | 608 | { |
e5cf5e11 PK |
609 | if (vec_safe_length (info->descriptors) <= (unsigned) i) |
610 | return NULL; | |
f65f1ae3 | 611 | tree t = (*info->descriptors)[i].decl_or_type; |
209ca542 PK |
612 | if (!t) |
613 | return NULL; | |
614 | if (TYPE_P (t)) | |
615 | return t; | |
616 | gcc_checking_assert (TREE_CODE (t) == PARM_DECL); | |
617 | return TREE_TYPE (t); | |
339f49ec JH |
618 | } |
619 | ||
0e8853ee JH |
620 | /* Return the move cost of Ith formal parameter of the function corresponding |
621 | to INFO. */ | |
622 | ||
623 | static inline int | |
99b1c316 | 624 | ipa_get_param_move_cost (class ipa_node_params *info, int i) |
0e8853ee | 625 | { |
f65f1ae3 MJ |
626 | gcc_checking_assert (info->descriptors); |
627 | return (*info->descriptors)[i].move_cost; | |
0e8853ee JH |
628 | } |
629 | ||
310bc633 MJ |
630 | /* Set the used flag corresponding to the Ith formal parameter of the function |
631 | associated with INFO to VAL. */ | |
3949c4a7 | 632 | |
310bc633 | 633 | static inline void |
99b1c316 | 634 | ipa_set_param_used (class ipa_node_params *info, int i, bool val) |
3949c4a7 | 635 | { |
f65f1ae3 MJ |
636 | gcc_checking_assert (info->descriptors); |
637 | (*info->descriptors)[i].used = val; | |
3949c4a7 MJ |
638 | } |
639 | ||
40a777e8 JH |
640 | /* Set the used_by_ipa_predicates flag corresponding to the Ith formal |
641 | parameter of the function associated with INFO to VAL. */ | |
642 | ||
643 | static inline void | |
644 | ipa_set_param_used_by_ipa_predicates (class ipa_node_params *info, int i, bool val) | |
645 | { | |
646 | gcc_checking_assert (info->descriptors); | |
647 | (*info->descriptors)[i].used_by_ipa_predicates = val; | |
648 | } | |
649 | ||
650 | /* Set the used_by_indirect_call flag corresponding to the Ith formal | |
651 | parameter of the function associated with INFO to VAL. */ | |
652 | ||
653 | static inline void | |
654 | ipa_set_param_used_by_indirect_call (class ipa_node_params *info, int i, bool val) | |
655 | { | |
656 | gcc_checking_assert (info->descriptors); | |
657 | (*info->descriptors)[i].used_by_indirect_call = val; | |
658 | } | |
659 | ||
660 | /* Set the .used_by_polymorphic_call flag corresponding to the Ith formal | |
661 | parameter of the function associated with INFO to VAL. */ | |
662 | ||
663 | static inline void | |
664 | ipa_set_param_used_by_polymorphic_call (class ipa_node_params *info, int i, bool val) | |
665 | { | |
666 | gcc_checking_assert (info->descriptors); | |
667 | (*info->descriptors)[i].used_by_polymorphic_call = val; | |
668 | } | |
669 | ||
4502fe8d MJ |
670 | /* Return how many uses described by ipa-prop a parameter has or |
671 | IPA_UNDESCRIBED_USE if there is a use that is not described by these | |
672 | structures. */ | |
673 | static inline int | |
99b1c316 | 674 | ipa_get_controlled_uses (class ipa_node_params *info, int i) |
4502fe8d | 675 | { |
f65f1ae3 MJ |
676 | /* FIXME: introducing speculation causes out of bounds access here. */ |
677 | if (vec_safe_length (info->descriptors) > (unsigned)i) | |
678 | return (*info->descriptors)[i].controlled_uses; | |
5ce97055 | 679 | return IPA_UNDESCRIBED_USE; |
4502fe8d MJ |
680 | } |
681 | ||
682 | /* Set the controlled counter of a given parameter. */ | |
683 | ||
684 | static inline void | |
99b1c316 | 685 | ipa_set_controlled_uses (class ipa_node_params *info, int i, int val) |
4502fe8d | 686 | { |
f65f1ae3 MJ |
687 | gcc_checking_assert (info->descriptors); |
688 | (*info->descriptors)[i].controlled_uses = val; | |
4502fe8d MJ |
689 | } |
690 | ||
310bc633 MJ |
691 | /* Return the used flag corresponding to the Ith formal parameter of the |
692 | function associated with INFO. */ | |
3949c4a7 MJ |
693 | |
694 | static inline bool | |
99b1c316 | 695 | ipa_is_param_used (class ipa_node_params *info, int i) |
3949c4a7 | 696 | { |
f65f1ae3 MJ |
697 | gcc_checking_assert (info->descriptors); |
698 | return (*info->descriptors)[i].used; | |
3949c4a7 MJ |
699 | } |
700 | ||
40a777e8 JH |
701 | /* Return the used_by_ipa_predicates flag corresponding to the Ith formal |
702 | parameter of the function associated with INFO. */ | |
703 | ||
704 | static inline bool | |
705 | ipa_is_param_used_by_ipa_predicates (class ipa_node_params *info, int i) | |
706 | { | |
707 | gcc_checking_assert (info->descriptors); | |
708 | return (*info->descriptors)[i].used_by_ipa_predicates; | |
709 | } | |
710 | ||
711 | /* Return the used_by_indirect_call flag corresponding to the Ith formal | |
712 | parameter of the function associated with INFO. */ | |
713 | ||
714 | static inline bool | |
715 | ipa_is_param_used_by_indirect_call (class ipa_node_params *info, int i) | |
716 | { | |
717 | gcc_checking_assert (info->descriptors); | |
718 | return (*info->descriptors)[i].used_by_indirect_call; | |
719 | } | |
720 | ||
721 | /* Return the used_by_polymorphic_call flag corresponding to the Ith formal | |
722 | parameter of the function associated with INFO. */ | |
723 | ||
724 | static inline bool | |
725 | ipa_is_param_used_by_polymorphic_call (class ipa_node_params *info, int i) | |
726 | { | |
727 | gcc_checking_assert (info->descriptors); | |
728 | return (*info->descriptors)[i].used_by_polymorphic_call; | |
729 | } | |
730 | ||
2c9561b5 MJ |
731 | /* Information about replacements done in aggregates for a given node (each |
732 | node has its linked list). */ | |
733 | struct GTY(()) ipa_agg_replacement_value | |
734 | { | |
735 | /* Next item in the linked list. */ | |
736 | struct ipa_agg_replacement_value *next; | |
737 | /* Offset within the aggregate. */ | |
738 | HOST_WIDE_INT offset; | |
739 | /* The constant value. */ | |
740 | tree value; | |
71837f64 | 741 | /* The parameter index. */ |
2c9561b5 | 742 | int index; |
7b920a9a MJ |
743 | /* Whether the value was passed by reference. */ |
744 | bool by_ref; | |
2c9561b5 MJ |
745 | }; |
746 | ||
04be694e MJ |
747 | /* Structure holding information for the transformation phase of IPA-CP. */ |
748 | ||
9d3e0adc | 749 | struct GTY(()) ipcp_transformation |
04be694e MJ |
750 | { |
751 | /* Linked list of known aggregate values. */ | |
752 | ipa_agg_replacement_value *agg_values; | |
209ca542 | 753 | /* Known bits information. */ |
86cd0334 | 754 | vec<ipa_bits *, va_gc> *bits; |
8bc5448f KV |
755 | /* Value range information. */ |
756 | vec<ipa_vr, va_gc> *m_vr; | |
98aad294 JH |
757 | |
758 | /* Default constructor. */ | |
759 | ipcp_transformation () | |
760 | : agg_values (NULL), bits (NULL), m_vr (NULL) | |
761 | { } | |
762 | ||
763 | /* Default destructor. */ | |
764 | ~ipcp_transformation () | |
765 | { | |
766 | ipa_agg_replacement_value *agg = agg_values; | |
767 | while (agg) | |
768 | { | |
769 | ipa_agg_replacement_value *next = agg->next; | |
770 | ggc_free (agg); | |
771 | agg = next; | |
772 | } | |
773 | vec_free (bits); | |
774 | vec_free (m_vr); | |
775 | } | |
04be694e | 776 | }; |
2c9561b5 MJ |
777 | |
778 | void ipa_set_node_agg_value_chain (struct cgraph_node *node, | |
779 | struct ipa_agg_replacement_value *aggvals); | |
9d3e0adc | 780 | void ipcp_transformation_initialize (void); |
12e088ba | 781 | void ipcp_free_transformation_sum (void); |
2c9561b5 | 782 | |
93c594a3 MJ |
783 | /* ipa_edge_args stores information related to a callsite and particularly its |
784 | arguments. It can be accessed by the IPA_EDGE_REF macro. */ | |
6fe906a3 MJ |
785 | |
786 | class GTY((for_user)) ipa_edge_args | |
518dc859 | 787 | { |
6fe906a3 MJ |
788 | public: |
789 | ||
790 | /* Default constructor. */ | |
791 | ipa_edge_args () : jump_functions (NULL), polymorphic_call_contexts (NULL) | |
792 | {} | |
793 | ||
794 | /* Destructor. */ | |
795 | ~ipa_edge_args () | |
796 | { | |
797 | vec_free (jump_functions); | |
798 | vec_free (polymorphic_call_contexts); | |
799 | } | |
800 | ||
801 | /* Vectors of the callsite's jump function and polymorphic context | |
802 | information of each parameter. */ | |
84562394 | 803 | vec<ipa_jump_func, va_gc> *jump_functions; |
5ce97055 | 804 | vec<ipa_polymorphic_call_context, va_gc> *polymorphic_call_contexts; |
84562394 | 805 | }; |
518dc859 | 806 | |
dcd416e3 MJ |
807 | /* ipa_edge_args access functions. Please use these to access fields that |
808 | are or will be shared among various passes. */ | |
809 | ||
dcd416e3 | 810 | /* Return the number of actual arguments. */ |
be95e2b9 | 811 | |
dcd416e3 | 812 | static inline int |
99b1c316 | 813 | ipa_get_cs_argument_count (class ipa_edge_args *args) |
dcd416e3 | 814 | { |
9771b263 | 815 | return vec_safe_length (args->jump_functions); |
dcd416e3 MJ |
816 | } |
817 | ||
818 | /* Returns a pointer to the jump function for the ith argument. Please note | |
819 | there is no setter function as jump functions are all set up in | |
820 | ipa_compute_jump_functions. */ | |
be95e2b9 | 821 | |
dcd416e3 | 822 | static inline struct ipa_jump_func * |
99b1c316 | 823 | ipa_get_ith_jump_func (class ipa_edge_args *args, int i) |
dcd416e3 | 824 | { |
9771b263 | 825 | return &(*args->jump_functions)[i]; |
dcd416e3 MJ |
826 | } |
827 | ||
5ce97055 JH |
828 | /* Returns a pointer to the polymorphic call context for the ith argument. |
829 | NULL if contexts are not computed. */ | |
99b1c316 MS |
830 | static inline class ipa_polymorphic_call_context * |
831 | ipa_get_ith_polymorhic_call_context (class ipa_edge_args *args, int i) | |
5ce97055 JH |
832 | { |
833 | if (!args->polymorphic_call_contexts) | |
834 | return NULL; | |
835 | return &(*args->polymorphic_call_contexts)[i]; | |
836 | } | |
837 | ||
9a1e784a | 838 | /* Function summary for ipa_node_params. */ |
f65f1ae3 | 839 | class GTY((user)) ipa_node_params_t: public function_summary <ipa_node_params *> |
dd912cb8 ML |
840 | { |
841 | public: | |
f65f1ae3 MJ |
842 | ipa_node_params_t (symbol_table *table, bool ggc): |
843 | function_summary<ipa_node_params *> (table, ggc) { } | |
771578a0 | 844 | |
dd912cb8 ML |
845 | /* Hook that is called by summary when a node is duplicated. */ |
846 | virtual void duplicate (cgraph_node *node, | |
847 | cgraph_node *node2, | |
848 | ipa_node_params *data, | |
849 | ipa_node_params *data2); | |
850 | }; | |
851 | ||
6fe906a3 MJ |
852 | /* Summary to manange ipa_edge_args structures. */ |
853 | ||
854 | class GTY((user)) ipa_edge_args_sum_t : public call_summary <ipa_edge_args *> | |
855 | { | |
856 | public: | |
857 | ipa_edge_args_sum_t (symbol_table *table, bool ggc) | |
858 | : call_summary<ipa_edge_args *> (table, ggc) { } | |
859 | ||
a33c028e JH |
860 | void remove (cgraph_edge *edge) |
861 | { | |
862 | call_summary <ipa_edge_args *>::remove (edge); | |
863 | } | |
864 | ||
f658ad30 | 865 | /* Hook that is called by summary when an edge is removed. */ |
6fe906a3 MJ |
866 | virtual void remove (cgraph_edge *cs, ipa_edge_args *args); |
867 | /* Hook that is called by summary when an edge is duplicated. */ | |
868 | virtual void duplicate (cgraph_edge *src, | |
869 | cgraph_edge *dst, | |
870 | ipa_edge_args *old_args, | |
871 | ipa_edge_args *new_args); | |
872 | }; | |
873 | ||
dd912cb8 | 874 | /* Function summary where the parameter infos are actually stored. */ |
f65f1ae3 | 875 | extern GTY(()) ipa_node_params_t * ipa_node_params_sum; |
6fe906a3 MJ |
876 | /* Call summary to store information about edges such as jump functions. */ |
877 | extern GTY(()) ipa_edge_args_sum_t *ipa_edge_args_sum; | |
f65f1ae3 | 878 | |
9d3e0adc ML |
879 | /* Function summary for IPA-CP transformation. */ |
880 | class ipcp_transformation_t | |
881 | : public function_summary<ipcp_transformation *> | |
882 | { | |
883 | public: | |
884 | ipcp_transformation_t (symbol_table *table, bool ggc): | |
885 | function_summary<ipcp_transformation *> (table, ggc) {} | |
886 | ||
887 | ~ipcp_transformation_t () {} | |
888 | ||
889 | static ipcp_transformation_t *create_ggc (symbol_table *symtab) | |
890 | { | |
891 | ipcp_transformation_t *summary | |
78cd68c0 | 892 | = new (ggc_alloc_no_dtor <ipcp_transformation_t> ()) |
9d3e0adc ML |
893 | ipcp_transformation_t (symtab, true); |
894 | return summary; | |
895 | } | |
98aad294 JH |
896 | /* Hook that is called by summary when a node is duplicated. */ |
897 | virtual void duplicate (cgraph_node *node, | |
898 | cgraph_node *node2, | |
899 | ipcp_transformation *data, | |
900 | ipcp_transformation *data2); | |
9d3e0adc ML |
901 | }; |
902 | ||
903 | /* Function summary where the IPA CP transformations are actually stored. */ | |
904 | extern GTY(()) function_summary <ipcp_transformation *> *ipcp_transformation_sum; | |
f65f1ae3 | 905 | |
771578a0 MJ |
906 | /* Return the associated parameter/argument info corresponding to the given |
907 | node/edge. */ | |
6cf67b62 JH |
908 | #define IPA_NODE_REF(NODE) (ipa_node_params_sum->get (NODE)) |
909 | #define IPA_NODE_REF_GET_CREATE(NODE) (ipa_node_params_sum->get_create (NODE)) | |
a33c028e JH |
910 | #define IPA_EDGE_REF(EDGE) (ipa_edge_args_sum->get (EDGE)) |
911 | #define IPA_EDGE_REF_GET_CREATE(EDGE) (ipa_edge_args_sum->get_create (EDGE)) | |
771578a0 MJ |
912 | /* This macro checks validity of index returned by |
913 | ipa_get_param_decl_index function. */ | |
914 | #define IS_VALID_JUMP_FUNC_INDEX(I) ((I) != -1) | |
915 | ||
916 | /* Creating and freeing ipa_node_params and ipa_edge_args. */ | |
917 | void ipa_create_all_node_params (void); | |
918 | void ipa_create_all_edge_args (void); | |
86cd0334 | 919 | void ipa_check_create_edge_args (void); |
771578a0 MJ |
920 | void ipa_free_all_node_params (void); |
921 | void ipa_free_all_edge_args (void); | |
e33c6cd6 MJ |
922 | void ipa_free_all_structures_after_ipa_cp (void); |
923 | void ipa_free_all_structures_after_iinln (void); | |
dd912cb8 | 924 | |
771578a0 | 925 | void ipa_register_cgraph_hooks (void); |
fd29c024 | 926 | int count_formal_params (tree fndecl); |
771578a0 MJ |
927 | |
928 | /* This function ensures the array of node param infos is big enough to | |
be95e2b9 MJ |
929 | accommodate a structure for all nodes and reallocates it if not. */ |
930 | ||
771578a0 MJ |
931 | static inline void |
932 | ipa_check_create_node_params (void) | |
933 | { | |
dd912cb8 | 934 | if (!ipa_node_params_sum) |
f65f1ae3 | 935 | ipa_node_params_sum |
78cd68c0 | 936 | = (new (ggc_alloc_no_dtor <ipa_node_params_t> ()) |
f65f1ae3 | 937 | ipa_node_params_t (symtab, true)); |
771578a0 MJ |
938 | } |
939 | ||
6fe906a3 MJ |
940 | /* Returns true if edge summary contains a record for EDGE. The main purpose |
941 | of this function is that debug dumping function can check info availability | |
942 | without causing allocations. */ | |
be95e2b9 | 943 | |
0eae6bab MJ |
944 | static inline bool |
945 | ipa_edge_args_info_available_for_edge_p (struct cgraph_edge *edge) | |
946 | { | |
6fe906a3 | 947 | return ipa_edge_args_sum->exists (edge); |
0eae6bab MJ |
948 | } |
949 | ||
9d3e0adc | 950 | static inline ipcp_transformation * |
04be694e MJ |
951 | ipcp_get_transformation_summary (cgraph_node *node) |
952 | { | |
9d3e0adc | 953 | if (ipcp_transformation_sum == NULL) |
04be694e | 954 | return NULL; |
9d3e0adc ML |
955 | |
956 | return ipcp_transformation_sum->get (node); | |
04be694e MJ |
957 | } |
958 | ||
2c9561b5 MJ |
959 | /* Return the aggregate replacements for NODE, if there are any. */ |
960 | ||
961 | static inline struct ipa_agg_replacement_value * | |
04be694e | 962 | ipa_get_agg_replacements_for_node (cgraph_node *node) |
2c9561b5 | 963 | { |
9d3e0adc | 964 | ipcp_transformation *ts = ipcp_get_transformation_summary (node); |
04be694e | 965 | return ts ? ts->agg_values : NULL; |
2c9561b5 MJ |
966 | } |
967 | ||
f8e2a1ed MJ |
968 | /* Function formal parameters related computations. */ |
969 | void ipa_initialize_node_params (struct cgraph_node *node); | |
f8e2a1ed | 970 | bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs, |
d52f5295 | 971 | vec<cgraph_edge *> *new_edges); |
518dc859 | 972 | |
3949c4a7 | 973 | /* Indirect edge and binfo processing. */ |
d2d668fb | 974 | tree ipa_get_indirect_edge_target (struct cgraph_edge *ie, |
eb270950 | 975 | vec<tree>, |
44210a96 | 976 | vec<ipa_polymorphic_call_context>, |
eb270950 | 977 | vec<ipa_agg_value_set>, |
231b4916 | 978 | bool *); |
5ce97055 JH |
979 | struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree, |
980 | bool speculative = false); | |
72972c22 | 981 | tree ipa_impossible_devirt_target (struct cgraph_edge *, tree); |
86cd0334 MJ |
982 | ipa_bits *ipa_get_ipa_bits_for_value (const widest_int &value, |
983 | const widest_int &mask); | |
984 | ||
3949c4a7 | 985 | |
310bc633 MJ |
986 | /* Functions related to both. */ |
987 | void ipa_analyze_node (struct cgraph_node *); | |
3949c4a7 | 988 | |
8b7773a4 | 989 | /* Aggregate jump function related functions. */ |
eb270950 | 990 | tree ipa_find_agg_cst_for_param (struct ipa_agg_value_set *agg, tree scalar, |
91bb9f80 MJ |
991 | HOST_WIDE_INT offset, bool by_ref, |
992 | bool *from_global_constant = NULL); | |
993 | bool ipa_load_from_parm_agg (struct ipa_func_body_info *fbi, | |
f65f1ae3 | 994 | vec<ipa_param_descriptor, va_gc> *descriptors, |
91bb9f80 | 995 | gimple *stmt, tree op, int *index_p, |
86003645 | 996 | HOST_WIDE_INT *offset_p, poly_int64 *size_p, |
91bb9f80 | 997 | bool *by_ref, bool *guaranteed_unmodified = NULL); |
8b7773a4 | 998 | |
518dc859 | 999 | /* Debugging interface. */ |
ca30a539 JH |
1000 | void ipa_print_node_params (FILE *, struct cgraph_node *node); |
1001 | void ipa_print_all_params (FILE *); | |
3e293154 MJ |
1002 | void ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node); |
1003 | void ipa_print_all_jump_functions (FILE * f); | |
310bc633 MJ |
1004 | void ipcp_verify_propagated_values (void); |
1005 | ||
2651e637 ML |
1006 | template <typename value> |
1007 | class ipcp_value; | |
1008 | ||
fb0b2914 ML |
1009 | extern object_allocator<ipcp_value<tree> > ipcp_cst_values_pool; |
1010 | extern object_allocator<ipcp_value<ipa_polymorphic_call_context> > | |
2651e637 ML |
1011 | ipcp_poly_ctx_values_pool; |
1012 | ||
1013 | template <typename valtype> | |
99b1c316 | 1014 | struct ipcp_value_source; |
2651e637 | 1015 | |
fb0b2914 | 1016 | extern object_allocator<ipcp_value_source<tree> > ipcp_sources_pool; |
2651e637 | 1017 | |
99b1c316 | 1018 | struct ipcp_agg_lattice; |
2651e637 | 1019 | |
fb0b2914 | 1020 | extern object_allocator<ipcp_agg_lattice> ipcp_agg_lattice_pool; |
518dc859 | 1021 | |
2c9561b5 MJ |
1022 | void ipa_dump_agg_replacement_values (FILE *f, |
1023 | struct ipa_agg_replacement_value *av); | |
f27c1867 | 1024 | void ipa_prop_write_jump_functions (void); |
fb3f88cc | 1025 | void ipa_prop_read_jump_functions (void); |
04be694e MJ |
1026 | void ipcp_write_transformation_summaries (void); |
1027 | void ipcp_read_transformation_summaries (void); | |
99b1c316 MS |
1028 | int ipa_get_param_decl_index (class ipa_node_params *, tree); |
1029 | tree ipa_value_from_jfunc (class ipa_node_params *info, | |
e5cf5e11 | 1030 | struct ipa_jump_func *jfunc, tree type); |
2c9561b5 | 1031 | unsigned int ipcp_transform_function (struct cgraph_node *node); |
44210a96 MJ |
1032 | ipa_polymorphic_call_context ipa_context_from_jfunc (ipa_node_params *, |
1033 | cgraph_edge *, | |
1034 | int, | |
1035 | ipa_jump_func *); | |
68718e8e JH |
1036 | value_range ipa_value_range_from_jfunc (ipa_node_params *, cgraph_edge *, |
1037 | ipa_jump_func *, tree); | |
eb270950 FX |
1038 | ipa_agg_value_set ipa_agg_value_set_from_jfunc (ipa_node_params *, |
1039 | cgraph_node *, | |
1040 | ipa_agg_jump_function *); | |
99b1c316 | 1041 | void ipa_dump_param (FILE *, class ipa_node_params *info, int i); |
c3431191 | 1042 | void ipa_release_body_info (struct ipa_func_body_info *); |
5d5f1e95 | 1043 | tree ipa_get_callee_param_type (struct cgraph_edge *e, int i); |
c7ac9a0c | 1044 | bool ipcp_get_parm_bits (tree, tree *, widest_int *); |
fb3f88cc | 1045 | |
3f84bf08 | 1046 | /* From tree-sra.c: */ |
f7ed3195 | 1047 | tree build_ref_for_offset (location_t, tree, poly_int64, bool, tree, |
e4b5cace | 1048 | gimple_stmt_iterator *, bool); |
3f84bf08 | 1049 | |
3edf64aa DM |
1050 | /* In ipa-cp.c */ |
1051 | void ipa_cp_c_finalize (void); | |
1052 | ||
518dc859 | 1053 | #endif /* IPA_PROP_H */ |