Fix previous commit
[official-gcc.git] / gcc / ipa-prop.h
blobeb3397a6d81a37c4ff51ca95e484f74562364414
1 /* Interprocedural analyses.
2 Copyright (C) 2005-2019 Free Software Foundation, Inc.
4 This file is part of GCC.
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
8 Software Foundation; either version 3, or (at your option) any later
9 version.
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.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef IPA_PROP_H
21 #define IPA_PROP_H
23 /* The following definitions and interfaces are used by
24 interprocedural analyses or parameters. */
26 #define IPA_UNDESCRIBED_USE -1
28 /* ipa-prop.c stuff (ipa-cp, indirect inlining): */
30 /* A jump function for a callsite represents the values passed as actual
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 :
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.
42 IPA_JF_ANCESTOR is a special pass-through jump function, which means that
43 the result is an address of a part of the object pointed to by the formal
44 parameter to which the function refers. It is mainly intended to represent
45 getting addresses of ancestor fields in C++
46 (e.g. &this_1(D)->D.1766.D.1756). Note that if the original pointer is
47 NULL, ancestor jump function must behave like a simple pass-through.
49 Other pass-through functions can either simply pass on an unchanged formal
50 parameter or can apply one simple binary operation to it (such jump
51 functions are called polynomial).
53 Jump functions are computed in ipa-prop.c by function
54 update_call_notes_after_inlining. Some information can be lost and jump
55 functions degraded accordingly when inlining, see
56 update_call_notes_after_inlining in the same file. */
58 enum jump_func_type
60 IPA_JF_UNKNOWN = 0, /* newly allocated and zeroed jump functions default */
61 IPA_JF_CONST, /* represented by field costant */
62 IPA_JF_PASS_THROUGH, /* represented by field pass_through */
63 IPA_JF_ANCESTOR /* represented by field ancestor */
66 struct ipa_cst_ref_desc;
68 /* Structure holding data required to describe a constant jump function. */
69 struct GTY(()) ipa_constant_data
71 /* THe value of the constant. */
72 tree value;
73 /* Pointer to the structure that describes the reference. */
74 struct ipa_cst_ref_desc GTY((skip)) *rdesc;
77 /* Structure holding data required to describe a pass-through jump function. */
79 struct GTY(()) ipa_pass_through_data
81 /* If an operation is to be performed on the original parameter, this is the
82 second (constant) operand. */
83 tree operand;
84 /* Number of the caller's formal parameter being passed. */
85 int formal_id;
86 /* Operation that is performed on the argument before it is passed on.
87 NOP_EXPR means no operation. Otherwise oper must be a simple binary
88 arithmetic operation where the caller's parameter is the first operand and
89 operand field from this structure is the second one. */
90 enum tree_code operation;
91 /* When the passed value is a pointer, it is set to true only when we are
92 certain that no write to the object it points to has occurred since the
93 caller functions started execution, except for changes noted in the
94 aggregate part of the jump function (see description of
95 ipa_agg_jump_function). The flag is used only when the operation is
96 NOP_EXPR. */
97 unsigned agg_preserved : 1;
100 /* Structure holding data required to describe an ancestor pass-through
101 jump function. */
103 struct GTY(()) ipa_ancestor_jf_data
105 /* Offset of the field representing the ancestor. */
106 HOST_WIDE_INT offset;
107 /* Number of the caller's formal parameter being passed. */
108 int formal_id;
109 /* Flag with the same meaning like agg_preserve in ipa_pass_through_data. */
110 unsigned agg_preserved : 1;
113 /* An element in an aggegate part of a jump function describing a known value
114 at a given offset. When it is part of a pass-through jump function with
115 agg_preserved set or an ancestor jump function with agg_preserved set, all
116 unlisted positions are assumed to be preserved but the value can be a type
117 node, which means that the particular piece (starting at offset and having
118 the size of the type) is clobbered with an unknown value. When
119 agg_preserved is false or the type of the containing jump function is
120 different, all unlisted parts are assumed to be unknown and all values must
121 fulfill is_gimple_ip_invariant. */
123 struct GTY(()) ipa_agg_jf_item
125 /* The offset at which the known value is located within the aggregate. */
126 HOST_WIDE_INT offset;
128 /* The known constant or type if this is a clobber. */
129 tree value;
133 /* Aggregate jump function - i.e. description of contents of aggregates passed
134 either by reference or value. */
136 struct GTY(()) ipa_agg_jump_function
138 /* Description of the individual items. */
139 vec<ipa_agg_jf_item, va_gc> *items;
140 /* True if the data was passed by reference (as opposed to by value). */
141 bool by_ref;
144 typedef struct ipa_agg_jump_function *ipa_agg_jump_function_p;
146 /* Information about zero/non-zero bits. */
147 class GTY(()) ipa_bits
149 public:
150 /* The propagated value. */
151 widest_int value;
152 /* Mask corresponding to the value.
153 Similar to ccp_lattice_t, if xth bit of mask is 0,
154 implies xth bit of value is constant. */
155 widest_int mask;
158 /* Info about value ranges. */
160 class GTY(()) ipa_vr
162 public:
163 /* The data fields below are valid only if known is true. */
164 bool known;
165 enum value_range_kind type;
166 wide_int min;
167 wide_int max;
168 bool nonzero_p (tree) const;
171 /* A jump function for a callsite represents the values passed as actual
172 arguments of the callsite. See enum jump_func_type for the various
173 types of jump functions supported. */
174 struct GTY (()) ipa_jump_func
176 /* Aggregate contants description. See struct ipa_agg_jump_function and its
177 description. */
178 struct ipa_agg_jump_function agg;
180 /* Information about zero/non-zero bits. The pointed to structure is shared
181 betweed different jump functions. Use ipa_set_jfunc_bits to set this
182 field. */
183 class ipa_bits *bits;
185 /* Information about value range, containing valid data only when vr_known is
186 true. The pointed to structure is shared betweed different jump
187 functions. Use ipa_set_jfunc_vr to set this field. */
188 class value_range_base *m_vr;
190 enum jump_func_type type;
191 /* Represents a value of a jump function. pass_through is used only in jump
192 function context. constant represents the actual constant in constant jump
193 functions and member_cst holds constant c++ member functions. */
194 union jump_func_value
196 struct ipa_constant_data GTY ((tag ("IPA_JF_CONST"))) constant;
197 struct ipa_pass_through_data GTY ((tag ("IPA_JF_PASS_THROUGH"))) pass_through;
198 struct ipa_ancestor_jf_data GTY ((tag ("IPA_JF_ANCESTOR"))) ancestor;
199 } GTY ((desc ("%1.type"))) value;
203 /* Return the constant stored in a constant jump functin JFUNC. */
205 static inline tree
206 ipa_get_jf_constant (struct ipa_jump_func *jfunc)
208 gcc_checking_assert (jfunc->type == IPA_JF_CONST);
209 return jfunc->value.constant.value;
212 static inline struct ipa_cst_ref_desc *
213 ipa_get_jf_constant_rdesc (struct ipa_jump_func *jfunc)
215 gcc_checking_assert (jfunc->type == IPA_JF_CONST);
216 return jfunc->value.constant.rdesc;
219 /* Return the operand of a pass through jmp function JFUNC. */
221 static inline tree
222 ipa_get_jf_pass_through_operand (struct ipa_jump_func *jfunc)
224 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
225 return jfunc->value.pass_through.operand;
228 /* Return the number of the caller's formal parameter that a pass through jump
229 function JFUNC refers to. */
231 static inline int
232 ipa_get_jf_pass_through_formal_id (struct ipa_jump_func *jfunc)
234 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
235 return jfunc->value.pass_through.formal_id;
238 /* Return operation of a pass through jump function JFUNC. */
240 static inline enum tree_code
241 ipa_get_jf_pass_through_operation (struct ipa_jump_func *jfunc)
243 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
244 return jfunc->value.pass_through.operation;
247 /* Return the agg_preserved flag of a pass through jump function JFUNC. */
249 static inline bool
250 ipa_get_jf_pass_through_agg_preserved (struct ipa_jump_func *jfunc)
252 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
253 return jfunc->value.pass_through.agg_preserved;
256 /* Return true if pass through jump function JFUNC preserves type
257 information. */
259 static inline bool
260 ipa_get_jf_pass_through_type_preserved (struct ipa_jump_func *jfunc)
262 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
263 return jfunc->value.pass_through.agg_preserved;
266 /* Return the offset of an ancestor jump function JFUNC. */
268 static inline HOST_WIDE_INT
269 ipa_get_jf_ancestor_offset (struct ipa_jump_func *jfunc)
271 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
272 return jfunc->value.ancestor.offset;
275 /* Return the number of the caller's formal parameter that an ancestor jump
276 function JFUNC refers to. */
278 static inline int
279 ipa_get_jf_ancestor_formal_id (struct ipa_jump_func *jfunc)
281 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
282 return jfunc->value.ancestor.formal_id;
285 /* Return the agg_preserved flag of an ancestor jump function JFUNC. */
287 static inline bool
288 ipa_get_jf_ancestor_agg_preserved (struct ipa_jump_func *jfunc)
290 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
291 return jfunc->value.ancestor.agg_preserved;
294 /* Return true if ancestor jump function JFUNC presrves type information. */
296 static inline bool
297 ipa_get_jf_ancestor_type_preserved (struct ipa_jump_func *jfunc)
299 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
300 return jfunc->value.ancestor.agg_preserved;
303 /* Summary describing a single formal parameter. */
305 struct GTY(()) ipa_param_descriptor
307 /* In analysis and modification phase, this is the PARAM_DECL of this
308 parameter, in IPA LTO phase, this is the type of the the described
309 parameter or NULL if not known. Do not read this field directly but
310 through ipa_get_param and ipa_get_type as appropriate. */
311 tree decl_or_type;
312 /* If all uses of the parameter are described by ipa-prop structures, this
313 says how many there are. If any use could not be described by means of
314 ipa-prop structures, this is IPA_UNDESCRIBED_USE. */
315 int controlled_uses;
316 unsigned int move_cost : 31;
317 /* The parameter is used. */
318 unsigned used : 1;
321 /* ipa_node_params stores information related to formal parameters of functions
322 and some other information for interprocedural passes that operate on
323 parameters (such as ipa-cp). */
325 class GTY((for_user)) ipa_node_params
327 public:
328 /* Default constructor. */
329 ipa_node_params ();
331 /* Default destructor. */
332 ~ipa_node_params ();
334 /* Information about individual formal parameters that are gathered when
335 summaries are generated. */
336 vec<ipa_param_descriptor, va_gc> *descriptors;
337 /* Pointer to an array of structures describing individual formal
338 parameters. */
339 class ipcp_param_lattices * GTY((skip)) lattices;
340 /* Only for versioned nodes this field would not be NULL,
341 it points to the node that IPA cp cloned from. */
342 struct cgraph_node * GTY((skip)) ipcp_orig_node;
343 /* If this node is an ipa-cp clone, these are the known constants that
344 describe what it has been specialized for. */
345 vec<tree> GTY((skip)) known_csts;
346 /* If this node is an ipa-cp clone, these are the known polymorphic contexts
347 that describe what it has been specialized for. */
348 vec<ipa_polymorphic_call_context> GTY((skip)) known_contexts;
349 /* Whether the param uses analysis and jump function computation has already
350 been performed. */
351 unsigned analysis_done : 1;
352 /* Whether the function is enqueued in ipa-cp propagation stack. */
353 unsigned node_enqueued : 1;
354 /* Whether we should create a specialized version based on values that are
355 known to be constant in all contexts. */
356 unsigned do_clone_for_all_contexts : 1;
357 /* Set if this is an IPA-CP clone for all contexts. */
358 unsigned is_all_contexts_clone : 1;
359 /* Node has been completely replaced by clones and will be removed after
360 ipa-cp is finished. */
361 unsigned node_dead : 1;
362 /* Node is involved in a recursion, potentionally indirect. */
363 unsigned node_within_scc : 1;
364 /* Node is calling a private function called only once. */
365 unsigned node_calling_single_call : 1;
366 /* False when there is something makes versioning impossible. */
367 unsigned versionable : 1;
370 inline
371 ipa_node_params::ipa_node_params ()
372 : descriptors (NULL), lattices (NULL), ipcp_orig_node (NULL),
373 known_csts (vNULL), known_contexts (vNULL), analysis_done (0),
374 node_enqueued (0), do_clone_for_all_contexts (0), is_all_contexts_clone (0),
375 node_dead (0), node_within_scc (0), node_calling_single_call (0),
376 versionable (0)
380 inline
381 ipa_node_params::~ipa_node_params ()
383 free (lattices);
384 known_csts.release ();
385 known_contexts.release ();
388 /* Intermediate information that we get from alias analysis about a particular
389 parameter in a particular basic_block. When a parameter or the memory it
390 references is marked modified, we use that information in all dominated
391 blocks without consulting alias analysis oracle. */
393 struct ipa_param_aa_status
395 /* Set when this structure contains meaningful information. If not, the
396 structure describing a dominating BB should be used instead. */
397 bool valid;
399 /* Whether we have seen something which might have modified the data in
400 question. PARM is for the parameter itself, REF is for data it points to
401 but using the alias type of individual accesses and PT is the same thing
402 but for computing aggregate pass-through functions using a very inclusive
403 ao_ref. */
404 bool parm_modified, ref_modified, pt_modified;
407 /* Information related to a given BB that used only when looking at function
408 body. */
410 struct ipa_bb_info
412 /* Call graph edges going out of this BB. */
413 vec<cgraph_edge *> cg_edges;
414 /* Alias analysis statuses of each formal parameter at this bb. */
415 vec<ipa_param_aa_status> param_aa_statuses;
418 /* Structure with global information that is only used when looking at function
419 body. */
421 struct ipa_func_body_info
423 /* The node that is being analyzed. */
424 cgraph_node *node;
426 /* Its info. */
427 class ipa_node_params *info;
429 /* Information about individual BBs. */
430 vec<ipa_bb_info> bb_infos;
432 /* Number of parameters. */
433 int param_count;
435 /* Number of statements we are still allowed to walked by when analyzing this
436 function. */
437 unsigned int aa_walk_budget;
440 /* ipa_node_params access functions. Please use these to access fields that
441 are or will be shared among various passes. */
443 /* Return the number of formal parameters. */
445 static inline int
446 ipa_get_param_count (class ipa_node_params *info)
448 return vec_safe_length (info->descriptors);
451 /* Return the declaration of Ith formal parameter of the function corresponding
452 to INFO. Note there is no setter function as this array is built just once
453 using ipa_initialize_node_params. This function should not be called in
454 WPA. */
456 static inline tree
457 ipa_get_param (class ipa_node_params *info, int i)
459 gcc_checking_assert (info->descriptors);
460 gcc_checking_assert (!flag_wpa);
461 tree t = (*info->descriptors)[i].decl_or_type;
462 gcc_checking_assert (TREE_CODE (t) == PARM_DECL);
463 return t;
466 /* Return the type of Ith formal parameter of the function corresponding
467 to INFO if it is known or NULL if not. */
469 static inline tree
470 ipa_get_type (class ipa_node_params *info, int i)
472 if (vec_safe_length (info->descriptors) <= (unsigned) i)
473 return NULL;
474 tree t = (*info->descriptors)[i].decl_or_type;
475 if (!t)
476 return NULL;
477 if (TYPE_P (t))
478 return t;
479 gcc_checking_assert (TREE_CODE (t) == PARM_DECL);
480 return TREE_TYPE (t);
483 /* Return the move cost of Ith formal parameter of the function corresponding
484 to INFO. */
486 static inline int
487 ipa_get_param_move_cost (class ipa_node_params *info, int i)
489 gcc_checking_assert (info->descriptors);
490 return (*info->descriptors)[i].move_cost;
493 /* Set the used flag corresponding to the Ith formal parameter of the function
494 associated with INFO to VAL. */
496 static inline void
497 ipa_set_param_used (class ipa_node_params *info, int i, bool val)
499 gcc_checking_assert (info->descriptors);
500 (*info->descriptors)[i].used = val;
503 /* Return how many uses described by ipa-prop a parameter has or
504 IPA_UNDESCRIBED_USE if there is a use that is not described by these
505 structures. */
506 static inline int
507 ipa_get_controlled_uses (class ipa_node_params *info, int i)
509 /* FIXME: introducing speculation causes out of bounds access here. */
510 if (vec_safe_length (info->descriptors) > (unsigned)i)
511 return (*info->descriptors)[i].controlled_uses;
512 return IPA_UNDESCRIBED_USE;
515 /* Set the controlled counter of a given parameter. */
517 static inline void
518 ipa_set_controlled_uses (class ipa_node_params *info, int i, int val)
520 gcc_checking_assert (info->descriptors);
521 (*info->descriptors)[i].controlled_uses = val;
524 /* Return the used flag corresponding to the Ith formal parameter of the
525 function associated with INFO. */
527 static inline bool
528 ipa_is_param_used (class ipa_node_params *info, int i)
530 gcc_checking_assert (info->descriptors);
531 return (*info->descriptors)[i].used;
534 /* Information about replacements done in aggregates for a given node (each
535 node has its linked list). */
536 struct GTY(()) ipa_agg_replacement_value
538 /* Next item in the linked list. */
539 struct ipa_agg_replacement_value *next;
540 /* Offset within the aggregate. */
541 HOST_WIDE_INT offset;
542 /* The constant value. */
543 tree value;
544 /* The paramter index. */
545 int index;
546 /* Whether the value was passed by reference. */
547 bool by_ref;
550 /* Structure holding information for the transformation phase of IPA-CP. */
552 struct GTY(()) ipcp_transformation
554 /* Linked list of known aggregate values. */
555 ipa_agg_replacement_value *agg_values;
556 /* Known bits information. */
557 vec<ipa_bits *, va_gc> *bits;
558 /* Value range information. */
559 vec<ipa_vr, va_gc> *m_vr;
562 void ipa_set_node_agg_value_chain (struct cgraph_node *node,
563 struct ipa_agg_replacement_value *aggvals);
564 void ipcp_transformation_initialize (void);
565 void ipcp_free_transformation_sum (void);
567 /* ipa_edge_args stores information related to a callsite and particularly its
568 arguments. It can be accessed by the IPA_EDGE_REF macro. */
570 class GTY((for_user)) ipa_edge_args
572 public:
574 /* Default constructor. */
575 ipa_edge_args () : jump_functions (NULL), polymorphic_call_contexts (NULL)
578 /* Destructor. */
579 ~ipa_edge_args ()
581 vec_free (jump_functions);
582 vec_free (polymorphic_call_contexts);
585 /* Vectors of the callsite's jump function and polymorphic context
586 information of each parameter. */
587 vec<ipa_jump_func, va_gc> *jump_functions;
588 vec<ipa_polymorphic_call_context, va_gc> *polymorphic_call_contexts;
591 /* ipa_edge_args access functions. Please use these to access fields that
592 are or will be shared among various passes. */
594 /* Return the number of actual arguments. */
596 static inline int
597 ipa_get_cs_argument_count (class ipa_edge_args *args)
599 return vec_safe_length (args->jump_functions);
602 /* Returns a pointer to the jump function for the ith argument. Please note
603 there is no setter function as jump functions are all set up in
604 ipa_compute_jump_functions. */
606 static inline struct ipa_jump_func *
607 ipa_get_ith_jump_func (class ipa_edge_args *args, int i)
609 return &(*args->jump_functions)[i];
612 /* Returns a pointer to the polymorphic call context for the ith argument.
613 NULL if contexts are not computed. */
614 static inline class ipa_polymorphic_call_context *
615 ipa_get_ith_polymorhic_call_context (class ipa_edge_args *args, int i)
617 if (!args->polymorphic_call_contexts)
618 return NULL;
619 return &(*args->polymorphic_call_contexts)[i];
622 /* Function summary for ipa_node_params. */
623 class GTY((user)) ipa_node_params_t: public function_summary <ipa_node_params *>
625 public:
626 ipa_node_params_t (symbol_table *table, bool ggc):
627 function_summary<ipa_node_params *> (table, ggc) { }
629 /* Hook that is called by summary when a node is duplicated. */
630 virtual void duplicate (cgraph_node *node,
631 cgraph_node *node2,
632 ipa_node_params *data,
633 ipa_node_params *data2);
636 /* Summary to manange ipa_edge_args structures. */
638 class GTY((user)) ipa_edge_args_sum_t : public call_summary <ipa_edge_args *>
640 public:
641 ipa_edge_args_sum_t (symbol_table *table, bool ggc)
642 : call_summary<ipa_edge_args *> (table, ggc) { }
644 /* Hook that is called by summary when an edge is duplicated. */
645 virtual void remove (cgraph_edge *cs, ipa_edge_args *args);
646 /* Hook that is called by summary when an edge is duplicated. */
647 virtual void duplicate (cgraph_edge *src,
648 cgraph_edge *dst,
649 ipa_edge_args *old_args,
650 ipa_edge_args *new_args);
653 /* Function summary where the parameter infos are actually stored. */
654 extern GTY(()) ipa_node_params_t * ipa_node_params_sum;
655 /* Call summary to store information about edges such as jump functions. */
656 extern GTY(()) ipa_edge_args_sum_t *ipa_edge_args_sum;
658 /* Function summary for IPA-CP transformation. */
659 class ipcp_transformation_t
660 : public function_summary<ipcp_transformation *>
662 public:
663 ipcp_transformation_t (symbol_table *table, bool ggc):
664 function_summary<ipcp_transformation *> (table, ggc) {}
666 ~ipcp_transformation_t () {}
668 static ipcp_transformation_t *create_ggc (symbol_table *symtab)
670 ipcp_transformation_t *summary
671 = new (ggc_cleared_alloc <ipcp_transformation_t> ())
672 ipcp_transformation_t (symtab, true);
673 return summary;
677 /* Function summary where the IPA CP transformations are actually stored. */
678 extern GTY(()) function_summary <ipcp_transformation *> *ipcp_transformation_sum;
680 /* Return the associated parameter/argument info corresponding to the given
681 node/edge. */
682 #define IPA_NODE_REF(NODE) (ipa_node_params_sum->get_create (NODE))
683 #define IPA_EDGE_REF(EDGE) (ipa_edge_args_sum->get_create (EDGE))
684 /* This macro checks validity of index returned by
685 ipa_get_param_decl_index function. */
686 #define IS_VALID_JUMP_FUNC_INDEX(I) ((I) != -1)
688 /* Creating and freeing ipa_node_params and ipa_edge_args. */
689 void ipa_create_all_node_params (void);
690 void ipa_create_all_edge_args (void);
691 void ipa_check_create_edge_args (void);
692 void ipa_free_all_node_params (void);
693 void ipa_free_all_edge_args (void);
694 void ipa_free_all_structures_after_ipa_cp (void);
695 void ipa_free_all_structures_after_iinln (void);
697 void ipa_register_cgraph_hooks (void);
698 int count_formal_params (tree fndecl);
700 /* This function ensures the array of node param infos is big enough to
701 accommodate a structure for all nodes and reallocates it if not. */
703 static inline void
704 ipa_check_create_node_params (void)
706 if (!ipa_node_params_sum)
707 ipa_node_params_sum
708 = (new (ggc_cleared_alloc <ipa_node_params_t> ())
709 ipa_node_params_t (symtab, true));
712 /* Returns true if edge summary contains a record for EDGE. The main purpose
713 of this function is that debug dumping function can check info availability
714 without causing allocations. */
716 static inline bool
717 ipa_edge_args_info_available_for_edge_p (struct cgraph_edge *edge)
719 return ipa_edge_args_sum->exists (edge);
722 static inline ipcp_transformation *
723 ipcp_get_transformation_summary (cgraph_node *node)
725 if (ipcp_transformation_sum == NULL)
726 return NULL;
728 return ipcp_transformation_sum->get (node);
731 /* Return the aggregate replacements for NODE, if there are any. */
733 static inline struct ipa_agg_replacement_value *
734 ipa_get_agg_replacements_for_node (cgraph_node *node)
736 ipcp_transformation *ts = ipcp_get_transformation_summary (node);
737 return ts ? ts->agg_values : NULL;
740 /* Function formal parameters related computations. */
741 void ipa_initialize_node_params (struct cgraph_node *node);
742 bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
743 vec<cgraph_edge *> *new_edges);
745 /* Indirect edge and binfo processing. */
746 tree ipa_get_indirect_edge_target (struct cgraph_edge *ie,
747 vec<tree> ,
748 vec<ipa_polymorphic_call_context>,
749 vec<ipa_agg_jump_function_p>,
750 bool *);
751 struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree,
752 bool speculative = false);
753 tree ipa_impossible_devirt_target (struct cgraph_edge *, tree);
754 ipa_bits *ipa_get_ipa_bits_for_value (const widest_int &value,
755 const widest_int &mask);
758 /* Functions related to both. */
759 void ipa_analyze_node (struct cgraph_node *);
761 /* Aggregate jump function related functions. */
762 tree ipa_find_agg_cst_for_param (struct ipa_agg_jump_function *agg, tree scalar,
763 HOST_WIDE_INT offset, bool by_ref,
764 bool *from_global_constant = NULL);
765 bool ipa_load_from_parm_agg (struct ipa_func_body_info *fbi,
766 vec<ipa_param_descriptor, va_gc> *descriptors,
767 gimple *stmt, tree op, int *index_p,
768 HOST_WIDE_INT *offset_p, poly_int64 *size_p,
769 bool *by_ref, bool *guaranteed_unmodified = NULL);
771 /* Debugging interface. */
772 void ipa_print_node_params (FILE *, struct cgraph_node *node);
773 void ipa_print_all_params (FILE *);
774 void ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node);
775 void ipa_print_all_jump_functions (FILE * f);
776 void ipcp_verify_propagated_values (void);
778 template <typename value>
779 class ipcp_value;
781 extern object_allocator<ipcp_value<tree> > ipcp_cst_values_pool;
782 extern object_allocator<ipcp_value<ipa_polymorphic_call_context> >
783 ipcp_poly_ctx_values_pool;
785 template <typename valtype>
786 struct ipcp_value_source;
788 extern object_allocator<ipcp_value_source<tree> > ipcp_sources_pool;
790 struct ipcp_agg_lattice;
792 extern object_allocator<ipcp_agg_lattice> ipcp_agg_lattice_pool;
794 void ipa_dump_agg_replacement_values (FILE *f,
795 struct ipa_agg_replacement_value *av);
796 void ipa_prop_write_jump_functions (void);
797 void ipa_prop_read_jump_functions (void);
798 void ipcp_write_transformation_summaries (void);
799 void ipcp_read_transformation_summaries (void);
800 int ipa_get_param_decl_index (class ipa_node_params *, tree);
801 tree ipa_value_from_jfunc (class ipa_node_params *info,
802 struct ipa_jump_func *jfunc, tree type);
803 unsigned int ipcp_transform_function (struct cgraph_node *node);
804 ipa_polymorphic_call_context ipa_context_from_jfunc (ipa_node_params *,
805 cgraph_edge *,
806 int,
807 ipa_jump_func *);
808 void ipa_dump_param (FILE *, class ipa_node_params *info, int i);
809 void ipa_release_body_info (struct ipa_func_body_info *);
810 tree ipa_get_callee_param_type (struct cgraph_edge *e, int i);
812 /* From tree-sra.c: */
813 tree build_ref_for_offset (location_t, tree, poly_int64, bool, tree,
814 gimple_stmt_iterator *, bool);
816 /* In ipa-cp.c */
817 void ipa_cp_c_finalize (void);
819 #endif /* IPA_PROP_H */