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