Merge from trunk @217148.
[official-gcc.git] / gcc / ipa-prop.h
blob34fd7ce6da5f21b1ca354f677043747f478eb9a2
1 /* Interprocedural analyses.
2 Copyright (C) 2005-2014 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
24 /* The following definitions and interfaces are used by
25 interprocedural analyses or parameters. */
27 #define IPA_UNDESCRIBED_USE -1
29 /* ipa-prop.c stuff (ipa-cp, indirect inlining): */
31 /* A jump function for a callsite represents the values passed as actual
32 arguments of the callsite. They were originally proposed in a paper called
33 "Interprocedural Constant Propagation", by David Callahan, Keith D Cooper,
34 Ken Kennedy, Linda Torczon in Comp86, pg 152-161. There are three main
35 types of values :
37 Pass-through - the caller's formal parameter is passed as an actual
38 argument, possibly one simple operation performed on it.
39 Constant - a constant (is_gimple_ip_invariant)is passed as an actual
40 argument.
41 Unknown - neither of the above.
43 IPA_JF_ANCESTOR is a special pass-through jump function, which means that
44 the result is an address of a part of the object pointed to by the formal
45 parameter to which the function refers. It is mainly intended to represent
46 getting addresses of of ancestor fields in C++
47 (e.g. &this_1(D)->D.1766.D.1756). Note that if the original pointer is
48 NULL, ancestor jump function must behave like a simple pass-through.
50 Other pass-through functions can either simply pass on an unchanged formal
51 parameter or can apply one simple binary operation to it (such jump
52 functions are called polynomial).
54 IPA_JF_KNOWN_TYPE is a special type of an "unknown" function that applies
55 only to pointer parameters. It means that even though we cannot prove that
56 the passed value is an interprocedural constant, we still know the exact
57 type of the containing object which may be valuable for devirtualization.
59 Jump functions are computed in ipa-prop.c by function
60 update_call_notes_after_inlining. Some information can be lost and jump
61 functions degraded accordingly when inlining, see
62 update_call_notes_after_inlining in the same file. */
64 enum jump_func_type
66 IPA_JF_UNKNOWN = 0, /* newly allocated and zeroed jump functions default */
67 IPA_JF_KNOWN_TYPE, /* represented by field known_type */
68 IPA_JF_CONST, /* represented by field costant */
69 IPA_JF_PASS_THROUGH, /* represented by field pass_through */
70 IPA_JF_ANCESTOR /* represented by field ancestor */
73 /* Structure holding data required to describe a known type jump function. */
74 struct GTY(()) ipa_known_type_data
76 /* Offset of the component of the base_type being described. */
77 HOST_WIDE_INT offset;
78 /* Type of the whole object. */
79 tree base_type;
80 /* Type of the component of the object that is being described. */
81 tree component_type;
84 struct ipa_cst_ref_desc;
86 /* Structure holding data required to describe a constant jump function. */
87 struct GTY(()) ipa_constant_data
89 /* THe value of the constant. */
90 tree value;
91 /* Pointer to the structure that describes the reference. */
92 struct ipa_cst_ref_desc GTY((skip)) *rdesc;
95 /* Structure holding data required to describe a pass-through jump function. */
97 struct GTY(()) ipa_pass_through_data
99 /* If an operation is to be performed on the original parameter, this is the
100 second (constant) operand. */
101 tree operand;
102 /* Number of the caller's formal parameter being passed. */
103 int formal_id;
104 /* Operation that is performed on the argument before it is passed on.
105 NOP_EXPR means no operation. Otherwise oper must be a simple binary
106 arithmetic operation where the caller's parameter is the first operand and
107 operand field from this structure is the second one. */
108 enum tree_code operation;
109 /* When the passed value is a pointer, it is set to true only when we are
110 certain that no write to the object it points to has occurred since the
111 caller functions started execution, except for changes noted in the
112 aggregate part of the jump function (see description of
113 ipa_agg_jump_function). The flag is used only when the operation is
114 NOP_EXPR. */
115 unsigned agg_preserved : 1;
117 /* When set to true, we guarantee that, if there is a C++ object pointed to
118 by this object, it does not undergo dynamic type change in the course of
119 functions decribed by this jump function. */
120 unsigned type_preserved : 1;
123 /* Structure holding data required to describe an ancestor pass-through
124 jump function. */
126 struct GTY(()) ipa_ancestor_jf_data
128 /* Offset of the field representing the ancestor. */
129 HOST_WIDE_INT offset;
130 /* Type of the result.
131 When TYPE_PRESERVED is false, TYPE is NULL, since it is only
132 relevant for the devirtualization machinery. */
133 tree type;
134 /* Number of the caller's formal parameter being passed. */
135 int formal_id;
136 /* Flag with the same meaning like agg_preserve in ipa_pass_through_data. */
137 unsigned agg_preserved : 1;
138 /* When set to true, we guarantee that, if there is a C++ object pointed to
139 by this object, it does not undergo dynamic type change in the course of
140 functions decribed by this jump function. */
141 unsigned type_preserved : 1;
144 /* An element in an aggegate part of a jump function describing a known value
145 at a given offset. When it is part of a pass-through jump function with
146 agg_preserved set or an ancestor jump function with agg_preserved set, all
147 unlisted positions are assumed to be preserved but the value can be a type
148 node, which means that the particular piece (starting at offset and having
149 the size of the type) is clobbered with an unknown value. When
150 agg_preserved is false or the type of the containing jump function is
151 different, all unlisted parts are assumed to be unknown and all values must
152 fulfill is_gimple_ip_invariant. */
154 struct GTY(()) ipa_agg_jf_item
156 /* The offset at which the known value is located within the aggregate. */
157 HOST_WIDE_INT offset;
159 /* The known constant or type if this is a clobber. */
160 tree value;
164 /* Aggregate jump function - i.e. description of contents of aggregates passed
165 either by reference or value. */
167 struct GTY(()) ipa_agg_jump_function
169 /* Description of the individual items. */
170 vec<ipa_agg_jf_item, va_gc> *items;
171 /* True if the data was passed by reference (as opposed to by value). */
172 bool by_ref;
175 typedef struct ipa_agg_jump_function *ipa_agg_jump_function_p;
177 /* A jump function for a callsite represents the values passed as actual
178 arguments of the callsite. See enum jump_func_type for the various
179 types of jump functions supported. */
180 struct GTY (()) ipa_jump_func
182 /* Aggregate contants description. See struct ipa_agg_jump_function and its
183 description. */
184 struct ipa_agg_jump_function agg;
186 enum jump_func_type type;
187 /* Represents a value of a jump function. pass_through is used only in jump
188 function context. constant represents the actual constant in constant jump
189 functions and member_cst holds constant c++ member functions. */
190 union jump_func_value
192 struct ipa_known_type_data GTY ((tag ("IPA_JF_KNOWN_TYPE"))) known_type;
193 struct ipa_constant_data GTY ((tag ("IPA_JF_CONST"))) constant;
194 struct ipa_pass_through_data GTY ((tag ("IPA_JF_PASS_THROUGH"))) pass_through;
195 struct ipa_ancestor_jf_data GTY ((tag ("IPA_JF_ANCESTOR"))) ancestor;
196 } GTY ((desc ("%1.type"))) value;
200 /* Return the offset of the component that is described by a known type jump
201 function JFUNC. */
203 static inline HOST_WIDE_INT
204 ipa_get_jf_known_type_offset (struct ipa_jump_func *jfunc)
206 gcc_checking_assert (jfunc->type == IPA_JF_KNOWN_TYPE);
207 return jfunc->value.known_type.offset;
210 /* Return the base type of a known type jump function JFUNC. */
212 static inline tree
213 ipa_get_jf_known_type_base_type (struct ipa_jump_func *jfunc)
215 gcc_checking_assert (jfunc->type == IPA_JF_KNOWN_TYPE);
216 return jfunc->value.known_type.base_type;
219 /* Return the component type of a known type jump function JFUNC. */
221 static inline tree
222 ipa_get_jf_known_type_component_type (struct ipa_jump_func *jfunc)
224 gcc_checking_assert (jfunc->type == IPA_JF_KNOWN_TYPE);
225 return jfunc->value.known_type.component_type;
228 /* Return the constant stored in a constant jump functin JFUNC. */
230 static inline tree
231 ipa_get_jf_constant (struct ipa_jump_func *jfunc)
233 gcc_checking_assert (jfunc->type == IPA_JF_CONST);
234 return jfunc->value.constant.value;
237 static inline struct ipa_cst_ref_desc *
238 ipa_get_jf_constant_rdesc (struct ipa_jump_func *jfunc)
240 gcc_checking_assert (jfunc->type == IPA_JF_CONST);
241 return jfunc->value.constant.rdesc;
244 /* Return the operand of a pass through jmp function JFUNC. */
246 static inline tree
247 ipa_get_jf_pass_through_operand (struct ipa_jump_func *jfunc)
249 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
250 return jfunc->value.pass_through.operand;
253 /* Return the number of the caller's formal parameter that a pass through jump
254 function JFUNC refers to. */
256 static inline int
257 ipa_get_jf_pass_through_formal_id (struct ipa_jump_func *jfunc)
259 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
260 return jfunc->value.pass_through.formal_id;
263 /* Return operation of a pass through jump function JFUNC. */
265 static inline enum tree_code
266 ipa_get_jf_pass_through_operation (struct ipa_jump_func *jfunc)
268 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
269 return jfunc->value.pass_through.operation;
272 /* Return the agg_preserved flag of a pass through jump function JFUNC. */
274 static inline bool
275 ipa_get_jf_pass_through_agg_preserved (struct ipa_jump_func *jfunc)
277 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
278 return jfunc->value.pass_through.agg_preserved;
281 /* Return the type_preserved flag of a pass through jump function JFUNC. */
283 static inline bool
284 ipa_get_jf_pass_through_type_preserved (struct ipa_jump_func *jfunc)
286 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
287 return jfunc->value.pass_through.type_preserved;
290 /* Return the offset of an ancestor jump function JFUNC. */
292 static inline HOST_WIDE_INT
293 ipa_get_jf_ancestor_offset (struct ipa_jump_func *jfunc)
295 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
296 return jfunc->value.ancestor.offset;
299 /* Return the result type of an ancestor jump function JFUNC. */
301 static inline tree
302 ipa_get_jf_ancestor_type (struct ipa_jump_func *jfunc)
304 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
305 return jfunc->value.ancestor.type;
308 /* Return the number of the caller's formal parameter that an ancestor jump
309 function JFUNC refers to. */
311 static inline int
312 ipa_get_jf_ancestor_formal_id (struct ipa_jump_func *jfunc)
314 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
315 return jfunc->value.ancestor.formal_id;
318 /* Return the agg_preserved flag of an ancestor jump function JFUNC. */
320 static inline bool
321 ipa_get_jf_ancestor_agg_preserved (struct ipa_jump_func *jfunc)
323 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
324 return jfunc->value.ancestor.agg_preserved;
327 /* Return the type_preserved flag of an ancestor jump function JFUNC. */
329 static inline bool
330 ipa_get_jf_ancestor_type_preserved (struct ipa_jump_func *jfunc)
332 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
333 return jfunc->value.ancestor.type_preserved;
336 /* Summary describing a single formal parameter. */
338 struct ipa_param_descriptor
340 /* PARAM_DECL of this parameter. */
341 tree decl;
342 /* If all uses of the parameter are described by ipa-prop structures, this
343 says how many there are. If any use could not be described by means of
344 ipa-prop structures, this is IPA_UNDESCRIBED_USE. */
345 int controlled_uses;
346 unsigned int move_cost : 31;
347 /* The parameter is used. */
348 unsigned used : 1;
351 struct ipcp_lattice;
353 /* ipa_node_params stores information related to formal parameters of functions
354 and some other information for interprocedural passes that operate on
355 parameters (such as ipa-cp). */
357 struct ipa_node_params
359 /* Information about individual formal parameters that are gathered when
360 summaries are generated. */
361 vec<ipa_param_descriptor> descriptors;
362 /* Pointer to an array of structures describing individual formal
363 parameters. */
364 struct ipcp_param_lattices *lattices;
365 /* Only for versioned nodes this field would not be NULL,
366 it points to the node that IPA cp cloned from. */
367 struct cgraph_node *ipcp_orig_node;
368 /* If this node is an ipa-cp clone, these are the known values that describe
369 what it has been specialized for. */
370 vec<tree> known_vals;
371 /* Whether the param uses analysis and jump function computation has already
372 been performed. */
373 unsigned analysis_done : 1;
374 /* Whether the function is enqueued in ipa-cp propagation stack. */
375 unsigned node_enqueued : 1;
376 /* Whether we should create a specialized version based on values that are
377 known to be constant in all contexts. */
378 unsigned do_clone_for_all_contexts : 1;
379 /* Set if this is an IPA-CP clone for all contexts. */
380 unsigned is_all_contexts_clone : 1;
381 /* Node has been completely replaced by clones and will be removed after
382 ipa-cp is finished. */
383 unsigned node_dead : 1;
386 /* ipa_node_params access functions. Please use these to access fields that
387 are or will be shared among various passes. */
389 /* Return the number of formal parameters. */
391 static inline int
392 ipa_get_param_count (struct ipa_node_params *info)
394 return info->descriptors.length ();
397 /* Return the declaration of Ith formal parameter of the function corresponding
398 to INFO. Note there is no setter function as this array is built just once
399 using ipa_initialize_node_params. */
401 static inline tree
402 ipa_get_param (struct ipa_node_params *info, int i)
404 gcc_checking_assert (!flag_wpa);
405 return info->descriptors[i].decl;
408 /* Return the move cost of Ith formal parameter of the function corresponding
409 to INFO. */
411 static inline int
412 ipa_get_param_move_cost (struct ipa_node_params *info, int i)
414 return info->descriptors[i].move_cost;
417 /* Set the used flag corresponding to the Ith formal parameter of the function
418 associated with INFO to VAL. */
420 static inline void
421 ipa_set_param_used (struct ipa_node_params *info, int i, bool val)
423 info->descriptors[i].used = val;
426 /* Return how many uses described by ipa-prop a parameter has or
427 IPA_UNDESCRIBED_USE if there is a use that is not described by these
428 structures. */
429 static inline int
430 ipa_get_controlled_uses (struct ipa_node_params *info, int i)
432 /* FIXME: introducing speuclation causes out of bounds access here. */
433 if (info->descriptors.length () > (unsigned)i)
434 return info->descriptors[i].controlled_uses;
435 return IPA_UNDESCRIBED_USE;
438 /* Set the controlled counter of a given parameter. */
440 static inline void
441 ipa_set_controlled_uses (struct ipa_node_params *info, int i, int val)
443 info->descriptors[i].controlled_uses = val;
446 /* Return the used flag corresponding to the Ith formal parameter of the
447 function associated with INFO. */
449 static inline bool
450 ipa_is_param_used (struct ipa_node_params *info, int i)
452 return info->descriptors[i].used;
455 /* Information about replacements done in aggregates for a given node (each
456 node has its linked list). */
457 struct GTY(()) ipa_agg_replacement_value
459 /* Next item in the linked list. */
460 struct ipa_agg_replacement_value *next;
461 /* Offset within the aggregate. */
462 HOST_WIDE_INT offset;
463 /* The constant value. */
464 tree value;
465 /* The paramter index. */
466 int index;
467 /* Whether the value was passed by reference. */
468 bool by_ref;
471 typedef struct ipa_agg_replacement_value *ipa_agg_replacement_value_p;
473 void ipa_set_node_agg_value_chain (struct cgraph_node *node,
474 struct ipa_agg_replacement_value *aggvals);
476 /* ipa_edge_args stores information related to a callsite and particularly its
477 arguments. It can be accessed by the IPA_EDGE_REF macro. */
478 struct GTY(()) ipa_edge_args
480 /* Vector of the callsite's jump function of each parameter. */
481 vec<ipa_jump_func, va_gc> *jump_functions;
482 vec<ipa_polymorphic_call_context, va_gc> *polymorphic_call_contexts;
485 /* ipa_edge_args access functions. Please use these to access fields that
486 are or will be shared among various passes. */
488 /* Return the number of actual arguments. */
490 static inline int
491 ipa_get_cs_argument_count (struct ipa_edge_args *args)
493 return vec_safe_length (args->jump_functions);
496 /* Returns a pointer to the jump function for the ith argument. Please note
497 there is no setter function as jump functions are all set up in
498 ipa_compute_jump_functions. */
500 static inline struct ipa_jump_func *
501 ipa_get_ith_jump_func (struct ipa_edge_args *args, int i)
503 return &(*args->jump_functions)[i];
506 /* Returns a pointer to the polymorphic call context for the ith argument.
507 NULL if contexts are not computed. */
508 static inline struct ipa_polymorphic_call_context *
509 ipa_get_ith_polymorhic_call_context (struct ipa_edge_args *args, int i)
511 if (!args->polymorphic_call_contexts)
512 return NULL;
513 return &(*args->polymorphic_call_contexts)[i];
516 /* Types of vectors holding the infos. */
518 /* Vector where the parameter infos are actually stored. */
519 extern vec<ipa_node_params> ipa_node_params_vector;
520 /* Vector of known aggregate values in cloned nodes. */
521 extern GTY(()) vec<ipa_agg_replacement_value_p, va_gc> *ipa_node_agg_replacements;
522 /* Vector where the parameter infos are actually stored. */
523 extern GTY(()) vec<ipa_edge_args, va_gc> *ipa_edge_args_vector;
525 /* Return the associated parameter/argument info corresponding to the given
526 node/edge. */
527 #define IPA_NODE_REF(NODE) (&ipa_node_params_vector[(NODE)->uid])
528 #define IPA_EDGE_REF(EDGE) (&(*ipa_edge_args_vector)[(EDGE)->uid])
529 /* This macro checks validity of index returned by
530 ipa_get_param_decl_index function. */
531 #define IS_VALID_JUMP_FUNC_INDEX(I) ((I) != -1)
533 /* Creating and freeing ipa_node_params and ipa_edge_args. */
534 void ipa_create_all_node_params (void);
535 void ipa_create_all_edge_args (void);
536 void ipa_free_edge_args_substructures (struct ipa_edge_args *);
537 void ipa_free_node_params_substructures (struct ipa_node_params *);
538 void ipa_free_all_node_params (void);
539 void ipa_free_all_edge_args (void);
540 void ipa_free_all_structures_after_ipa_cp (void);
541 void ipa_free_all_structures_after_iinln (void);
542 void ipa_register_cgraph_hooks (void);
543 int count_formal_params (tree fndecl);
545 /* This function ensures the array of node param infos is big enough to
546 accommodate a structure for all nodes and reallocates it if not. */
548 static inline void
549 ipa_check_create_node_params (void)
551 if (!ipa_node_params_vector.exists ())
552 ipa_node_params_vector.create (symtab->cgraph_max_uid);
554 if (ipa_node_params_vector.length () <= (unsigned) symtab->cgraph_max_uid)
555 ipa_node_params_vector.safe_grow_cleared (symtab->cgraph_max_uid + 1);
558 /* This function ensures the array of edge arguments infos is big enough to
559 accommodate a structure for all edges and reallocates it if not. */
561 static inline void
562 ipa_check_create_edge_args (void)
564 if (vec_safe_length (ipa_edge_args_vector)
565 <= (unsigned) symtab->edges_max_uid)
566 vec_safe_grow_cleared (ipa_edge_args_vector, symtab->edges_max_uid + 1);
569 /* Returns true if the array of edge infos is large enough to accommodate an
570 info for EDGE. The main purpose of this function is that debug dumping
571 function can check info availability without causing reallocations. */
573 static inline bool
574 ipa_edge_args_info_available_for_edge_p (struct cgraph_edge *edge)
576 return ((unsigned) edge->uid < vec_safe_length (ipa_edge_args_vector));
579 /* Return the aggregate replacements for NODE, if there are any. */
581 static inline struct ipa_agg_replacement_value *
582 ipa_get_agg_replacements_for_node (struct cgraph_node *node)
584 if ((unsigned) node->uid >= vec_safe_length (ipa_node_agg_replacements))
585 return NULL;
586 return (*ipa_node_agg_replacements)[node->uid];
589 /* Function formal parameters related computations. */
590 void ipa_initialize_node_params (struct cgraph_node *node);
591 bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
592 vec<cgraph_edge *> *new_edges);
594 /* Indirect edge and binfo processing. */
595 tree ipa_get_indirect_edge_target (struct cgraph_edge *ie,
596 vec<tree> ,
597 vec<tree> ,
598 vec<ipa_agg_jump_function_p> );
599 struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree,
600 bool speculative = false);
601 tree ipa_binfo_from_known_type_jfunc (struct ipa_jump_func *);
602 tree ipa_impossible_devirt_target (struct cgraph_edge *, tree);
604 /* Functions related to both. */
605 void ipa_analyze_node (struct cgraph_node *);
607 /* Aggregate jump function related functions. */
608 tree ipa_find_agg_cst_for_param (struct ipa_agg_jump_function *, HOST_WIDE_INT,
609 bool);
610 bool ipa_load_from_parm_agg (struct ipa_node_params *, gimple, tree, int *,
611 HOST_WIDE_INT *, bool *);
613 /* Debugging interface. */
614 void ipa_print_node_params (FILE *, struct cgraph_node *node);
615 void ipa_print_all_params (FILE *);
616 void ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node);
617 void ipa_print_all_jump_functions (FILE * f);
618 void ipcp_verify_propagated_values (void);
620 extern alloc_pool ipcp_values_pool;
621 extern alloc_pool ipcp_sources_pool;
622 extern alloc_pool ipcp_agg_lattice_pool;
624 /* Operation to be performed for the parameter in ipa_parm_adjustment
625 below. */
626 enum ipa_parm_op {
627 IPA_PARM_OP_NONE,
629 /* This describes a brand new parameter.
631 The field `type' should be set to the new type, `arg_prefix'
632 should be set to the string prefix for the new DECL_NAME, and
633 `new_decl' will ultimately hold the newly created argument. */
634 IPA_PARM_OP_NEW,
636 /* This new parameter is an unmodified parameter at index base_index. */
637 IPA_PARM_OP_COPY,
639 /* This adjustment describes a parameter that is about to be removed
640 completely. Most users will probably need to book keep those so that they
641 don't leave behinfd any non default def ssa names belonging to them. */
642 IPA_PARM_OP_REMOVE
645 /* Structure to describe transformations of formal parameters and actual
646 arguments. Each instance describes one new parameter and they are meant to
647 be stored in a vector. Additionally, most users will probably want to store
648 adjustments about parameters that are being removed altogether so that SSA
649 names belonging to them can be replaced by SSA names of an artificial
650 variable. */
651 struct ipa_parm_adjustment
653 /* The original PARM_DECL itself, helpful for processing of the body of the
654 function itself. Intended for traversing function bodies.
655 ipa_modify_formal_parameters, ipa_modify_call_arguments and
656 ipa_combine_adjustments ignore this and use base_index.
657 ipa_modify_formal_parameters actually sets this. */
658 tree base;
660 /* Type of the new parameter. However, if by_ref is true, the real type will
661 be a pointer to this type. */
662 tree type;
664 /* Alias refrerence type to be used in MEM_REFs when adjusting caller
665 arguments. */
666 tree alias_ptr_type;
668 /* The new declaration when creating/replacing a parameter. Created
669 by ipa_modify_formal_parameters, useful for functions modifying
670 the body accordingly. For brand new arguments, this is the newly
671 created argument. */
672 tree new_decl;
674 /* New declaration of a substitute variable that we may use to replace all
675 non-default-def ssa names when a parm decl is going away. */
676 tree new_ssa_base;
678 /* If non-NULL and the original parameter is to be removed (copy_param below
679 is NULL), this is going to be its nonlocalized vars value. */
680 tree nonlocal_value;
682 /* This holds the prefix to be used for the new DECL_NAME. */
683 const char *arg_prefix;
685 /* Offset into the original parameter (for the cases when the new parameter
686 is a component of an original one). */
687 HOST_WIDE_INT offset;
689 /* Zero based index of the original parameter this one is based on. */
690 int base_index;
692 /* Whether this parameter is a new parameter, a copy of an old one,
693 or one about to be removed. */
694 enum ipa_parm_op op;
696 /* Storage order of the original parameter (for the cases when the new
697 parameter is a component of an original one). */
698 unsigned reverse : 1;
700 /* The parameter is to be passed by reference. */
701 unsigned by_ref : 1;
704 typedef vec<ipa_parm_adjustment> ipa_parm_adjustment_vec;
706 vec<tree> ipa_get_vector_of_formal_parms (tree fndecl);
707 vec<tree> ipa_get_vector_of_formal_parm_types (tree fntype);
708 void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec);
709 void ipa_modify_call_arguments (struct cgraph_edge *, gimple,
710 ipa_parm_adjustment_vec);
711 ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec,
712 ipa_parm_adjustment_vec);
713 void ipa_dump_param_adjustments (FILE *, ipa_parm_adjustment_vec, tree);
714 void ipa_dump_agg_replacement_values (FILE *f,
715 struct ipa_agg_replacement_value *av);
716 void ipa_prop_write_jump_functions (void);
717 void ipa_prop_read_jump_functions (void);
718 void ipa_prop_write_all_agg_replacement (void);
719 void ipa_prop_read_all_agg_replacement (void);
720 void ipa_update_after_lto_read (void);
721 int ipa_get_param_decl_index (struct ipa_node_params *, tree);
722 tree ipa_value_from_jfunc (struct ipa_node_params *info,
723 struct ipa_jump_func *jfunc);
724 unsigned int ipcp_transform_function (struct cgraph_node *node);
725 void ipa_dump_param (FILE *, struct ipa_node_params *info, int i);
726 bool ipa_modify_expr (tree *, bool, ipa_parm_adjustment_vec);
727 ipa_parm_adjustment *ipa_get_adjustment_candidate (tree **, bool *,
728 ipa_parm_adjustment_vec,
729 bool);
732 /* From tree-sra.c: */
733 tree build_ref_for_offset (location_t, tree, HOST_WIDE_INT, bool, tree,
734 gimple_stmt_iterator *, bool);
736 /* In ipa-cp.c */
737 void ipa_cp_c_finalize (void);
739 #endif /* IPA_PROP_H */