ed991108363d9538c321d41d99ecd62fbd152fd5
[gcc.git] / gcc / ipa-prop.h
1 /* Interprocedural analyses.
2 Copyright (C) 2005-2014 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
10
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
19
20 #ifndef IPA_PROP_H
21 #define IPA_PROP_H
22
23
24 /* The following definitions and interfaces are used by
25 interprocedural analyses or parameters. */
26
27 #define IPA_UNDESCRIBED_USE -1
28
29 /* ipa-prop.c stuff (ipa-cp, indirect inlining): */
30
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 :
36
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.
42
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.
49
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).
53
54 Jump functions are computed in ipa-prop.c by function
55 update_call_notes_after_inlining. Some information can be lost and jump
56 functions degraded accordingly when inlining, see
57 update_call_notes_after_inlining in the same file. */
58
59 enum jump_func_type
60 {
61 IPA_JF_UNKNOWN = 0, /* newly allocated and zeroed jump functions default */
62 IPA_JF_CONST, /* represented by field costant */
63 IPA_JF_PASS_THROUGH, /* represented by field pass_through */
64 IPA_JF_ANCESTOR /* represented by field ancestor */
65 };
66
67 /* Structure holding data required to describe a known type jump function. */
68 struct GTY(()) ipa_known_type_data
69 {
70 /* Offset of the component of the base_type being described. */
71 HOST_WIDE_INT offset;
72 /* Type of the whole object. */
73 tree base_type;
74 /* Type of the component of the object that is being described. */
75 tree component_type;
76 };
77
78 struct ipa_cst_ref_desc;
79
80 /* Structure holding data required to describe a constant jump function. */
81 struct GTY(()) ipa_constant_data
82 {
83 /* THe value of the constant. */
84 tree value;
85 /* Pointer to the structure that describes the reference. */
86 struct ipa_cst_ref_desc GTY((skip)) *rdesc;
87 };
88
89 /* Structure holding data required to describe a pass-through jump function. */
90
91 struct GTY(()) ipa_pass_through_data
92 {
93 /* If an operation is to be performed on the original parameter, this is the
94 second (constant) operand. */
95 tree operand;
96 /* Number of the caller's formal parameter being passed. */
97 int formal_id;
98 /* Operation that is performed on the argument before it is passed on.
99 NOP_EXPR means no operation. Otherwise oper must be a simple binary
100 arithmetic operation where the caller's parameter is the first operand and
101 operand field from this structure is the second one. */
102 enum tree_code operation;
103 /* When the passed value is a pointer, it is set to true only when we are
104 certain that no write to the object it points to has occurred since the
105 caller functions started execution, except for changes noted in the
106 aggregate part of the jump function (see description of
107 ipa_agg_jump_function). The flag is used only when the operation is
108 NOP_EXPR. */
109 unsigned agg_preserved : 1;
110 };
111
112 /* Structure holding data required to describe an ancestor pass-through
113 jump function. */
114
115 struct GTY(()) ipa_ancestor_jf_data
116 {
117 /* Offset of the field representing the ancestor. */
118 HOST_WIDE_INT offset;
119 /* Number of the caller's formal parameter being passed. */
120 int formal_id;
121 /* Flag with the same meaning like agg_preserve in ipa_pass_through_data. */
122 unsigned agg_preserved : 1;
123 };
124
125 /* An element in an aggegate part of a jump function describing a known value
126 at a given offset. When it is part of a pass-through jump function with
127 agg_preserved set or an ancestor jump function with agg_preserved set, all
128 unlisted positions are assumed to be preserved but the value can be a type
129 node, which means that the particular piece (starting at offset and having
130 the size of the type) is clobbered with an unknown value. When
131 agg_preserved is false or the type of the containing jump function is
132 different, all unlisted parts are assumed to be unknown and all values must
133 fulfill is_gimple_ip_invariant. */
134
135 struct GTY(()) ipa_agg_jf_item
136 {
137 /* The offset at which the known value is located within the aggregate. */
138 HOST_WIDE_INT offset;
139
140 /* The known constant or type if this is a clobber. */
141 tree value;
142 };
143
144
145 /* Aggregate jump function - i.e. description of contents of aggregates passed
146 either by reference or value. */
147
148 struct GTY(()) ipa_agg_jump_function
149 {
150 /* Description of the individual items. */
151 vec<ipa_agg_jf_item, va_gc> *items;
152 /* True if the data was passed by reference (as opposed to by value). */
153 bool by_ref;
154 };
155
156 typedef struct ipa_agg_jump_function *ipa_agg_jump_function_p;
157
158 /* A jump function for a callsite represents the values passed as actual
159 arguments of the callsite. See enum jump_func_type for the various
160 types of jump functions supported. */
161 struct GTY (()) ipa_jump_func
162 {
163 /* Aggregate contants description. See struct ipa_agg_jump_function and its
164 description. */
165 struct ipa_agg_jump_function agg;
166
167 enum jump_func_type type;
168 /* Represents a value of a jump function. pass_through is used only in jump
169 function context. constant represents the actual constant in constant jump
170 functions and member_cst holds constant c++ member functions. */
171 union jump_func_value
172 {
173 struct ipa_constant_data GTY ((tag ("IPA_JF_CONST"))) constant;
174 struct ipa_pass_through_data GTY ((tag ("IPA_JF_PASS_THROUGH"))) pass_through;
175 struct ipa_ancestor_jf_data GTY ((tag ("IPA_JF_ANCESTOR"))) ancestor;
176 } GTY ((desc ("%1.type"))) value;
177 };
178
179
180 /* Return the constant stored in a constant jump functin JFUNC. */
181
182 static inline tree
183 ipa_get_jf_constant (struct ipa_jump_func *jfunc)
184 {
185 gcc_checking_assert (jfunc->type == IPA_JF_CONST);
186 return jfunc->value.constant.value;
187 }
188
189 static inline struct ipa_cst_ref_desc *
190 ipa_get_jf_constant_rdesc (struct ipa_jump_func *jfunc)
191 {
192 gcc_checking_assert (jfunc->type == IPA_JF_CONST);
193 return jfunc->value.constant.rdesc;
194 }
195
196 /* Return the operand of a pass through jmp function JFUNC. */
197
198 static inline tree
199 ipa_get_jf_pass_through_operand (struct ipa_jump_func *jfunc)
200 {
201 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
202 return jfunc->value.pass_through.operand;
203 }
204
205 /* Return the number of the caller's formal parameter that a pass through jump
206 function JFUNC refers to. */
207
208 static inline int
209 ipa_get_jf_pass_through_formal_id (struct ipa_jump_func *jfunc)
210 {
211 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
212 return jfunc->value.pass_through.formal_id;
213 }
214
215 /* Return operation of a pass through jump function JFUNC. */
216
217 static inline enum tree_code
218 ipa_get_jf_pass_through_operation (struct ipa_jump_func *jfunc)
219 {
220 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
221 return jfunc->value.pass_through.operation;
222 }
223
224 /* Return the agg_preserved flag of a pass through jump function JFUNC. */
225
226 static inline bool
227 ipa_get_jf_pass_through_agg_preserved (struct ipa_jump_func *jfunc)
228 {
229 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
230 return jfunc->value.pass_through.agg_preserved;
231 }
232
233 /* Return true if pass through jump function JFUNC preserves type
234 information. */
235
236 static inline bool
237 ipa_get_jf_pass_through_type_preserved (struct ipa_jump_func *jfunc)
238 {
239 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
240 return jfunc->value.pass_through.agg_preserved;
241 }
242
243 /* Return the offset of an ancestor jump function JFUNC. */
244
245 static inline HOST_WIDE_INT
246 ipa_get_jf_ancestor_offset (struct ipa_jump_func *jfunc)
247 {
248 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
249 return jfunc->value.ancestor.offset;
250 }
251
252 /* Return the number of the caller's formal parameter that an ancestor jump
253 function JFUNC refers to. */
254
255 static inline int
256 ipa_get_jf_ancestor_formal_id (struct ipa_jump_func *jfunc)
257 {
258 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
259 return jfunc->value.ancestor.formal_id;
260 }
261
262 /* Return the agg_preserved flag of an ancestor jump function JFUNC. */
263
264 static inline bool
265 ipa_get_jf_ancestor_agg_preserved (struct ipa_jump_func *jfunc)
266 {
267 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
268 return jfunc->value.ancestor.agg_preserved;
269 }
270
271 /* Return true if ancestor jump function JFUNC presrves type information. */
272
273 static inline bool
274 ipa_get_jf_ancestor_type_preserved (struct ipa_jump_func *jfunc)
275 {
276 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
277 return jfunc->value.ancestor.agg_preserved;
278 }
279
280 /* Summary describing a single formal parameter. */
281
282 struct ipa_param_descriptor
283 {
284 /* PARAM_DECL of this parameter. */
285 tree decl;
286 /* If all uses of the parameter are described by ipa-prop structures, this
287 says how many there are. If any use could not be described by means of
288 ipa-prop structures, this is IPA_UNDESCRIBED_USE. */
289 int controlled_uses;
290 unsigned int move_cost : 31;
291 /* The parameter is used. */
292 unsigned used : 1;
293 };
294
295 /* ipa_node_params stores information related to formal parameters of functions
296 and some other information for interprocedural passes that operate on
297 parameters (such as ipa-cp). */
298
299 struct ipa_node_params
300 {
301 /* Information about individual formal parameters that are gathered when
302 summaries are generated. */
303 vec<ipa_param_descriptor> descriptors;
304 /* Pointer to an array of structures describing individual formal
305 parameters. */
306 struct ipcp_param_lattices *lattices;
307 /* Only for versioned nodes this field would not be NULL,
308 it points to the node that IPA cp cloned from. */
309 struct cgraph_node *ipcp_orig_node;
310 /* If this node is an ipa-cp clone, these are the known constants that
311 describe what it has been specialized for. */
312 vec<tree> known_csts;
313 /* If this node is an ipa-cp clone, these are the known polymorphic contexts
314 that describe what it has been specialized for. */
315 vec<ipa_polymorphic_call_context> known_contexts;
316 /* Whether the param uses analysis and jump function computation has already
317 been performed. */
318 unsigned analysis_done : 1;
319 /* Whether the function is enqueued in ipa-cp propagation stack. */
320 unsigned node_enqueued : 1;
321 /* Whether we should create a specialized version based on values that are
322 known to be constant in all contexts. */
323 unsigned do_clone_for_all_contexts : 1;
324 /* Set if this is an IPA-CP clone for all contexts. */
325 unsigned is_all_contexts_clone : 1;
326 /* Node has been completely replaced by clones and will be removed after
327 ipa-cp is finished. */
328 unsigned node_dead : 1;
329 };
330
331 /* ipa_node_params access functions. Please use these to access fields that
332 are or will be shared among various passes. */
333
334 /* Return the number of formal parameters. */
335
336 static inline int
337 ipa_get_param_count (struct ipa_node_params *info)
338 {
339 return info->descriptors.length ();
340 }
341
342 /* Return the declaration of Ith formal parameter of the function corresponding
343 to INFO. Note there is no setter function as this array is built just once
344 using ipa_initialize_node_params. */
345
346 static inline tree
347 ipa_get_param (struct ipa_node_params *info, int i)
348 {
349 gcc_checking_assert (!flag_wpa);
350 return info->descriptors[i].decl;
351 }
352
353 /* Return the move cost of Ith formal parameter of the function corresponding
354 to INFO. */
355
356 static inline int
357 ipa_get_param_move_cost (struct ipa_node_params *info, int i)
358 {
359 return info->descriptors[i].move_cost;
360 }
361
362 /* Set the used flag corresponding to the Ith formal parameter of the function
363 associated with INFO to VAL. */
364
365 static inline void
366 ipa_set_param_used (struct ipa_node_params *info, int i, bool val)
367 {
368 info->descriptors[i].used = val;
369 }
370
371 /* Return how many uses described by ipa-prop a parameter has or
372 IPA_UNDESCRIBED_USE if there is a use that is not described by these
373 structures. */
374 static inline int
375 ipa_get_controlled_uses (struct ipa_node_params *info, int i)
376 {
377 /* FIXME: introducing speuclation causes out of bounds access here. */
378 if (info->descriptors.length () > (unsigned)i)
379 return info->descriptors[i].controlled_uses;
380 return IPA_UNDESCRIBED_USE;
381 }
382
383 /* Set the controlled counter of a given parameter. */
384
385 static inline void
386 ipa_set_controlled_uses (struct ipa_node_params *info, int i, int val)
387 {
388 info->descriptors[i].controlled_uses = val;
389 }
390
391 /* Return the used flag corresponding to the Ith formal parameter of the
392 function associated with INFO. */
393
394 static inline bool
395 ipa_is_param_used (struct ipa_node_params *info, int i)
396 {
397 return info->descriptors[i].used;
398 }
399
400 /* Information about replacements done in aggregates for a given node (each
401 node has its linked list). */
402 struct GTY(()) ipa_agg_replacement_value
403 {
404 /* Next item in the linked list. */
405 struct ipa_agg_replacement_value *next;
406 /* Offset within the aggregate. */
407 HOST_WIDE_INT offset;
408 /* The constant value. */
409 tree value;
410 /* The paramter index. */
411 int index;
412 /* Whether the value was passed by reference. */
413 bool by_ref;
414 };
415
416 typedef struct ipa_agg_replacement_value *ipa_agg_replacement_value_p;
417
418 void ipa_set_node_agg_value_chain (struct cgraph_node *node,
419 struct ipa_agg_replacement_value *aggvals);
420
421 /* ipa_edge_args stores information related to a callsite and particularly its
422 arguments. It can be accessed by the IPA_EDGE_REF macro. */
423 struct GTY(()) ipa_edge_args
424 {
425 /* Vector of the callsite's jump function of each parameter. */
426 vec<ipa_jump_func, va_gc> *jump_functions;
427 vec<ipa_polymorphic_call_context, va_gc> *polymorphic_call_contexts;
428 };
429
430 /* ipa_edge_args access functions. Please use these to access fields that
431 are or will be shared among various passes. */
432
433 /* Return the number of actual arguments. */
434
435 static inline int
436 ipa_get_cs_argument_count (struct ipa_edge_args *args)
437 {
438 return vec_safe_length (args->jump_functions);
439 }
440
441 /* Returns a pointer to the jump function for the ith argument. Please note
442 there is no setter function as jump functions are all set up in
443 ipa_compute_jump_functions. */
444
445 static inline struct ipa_jump_func *
446 ipa_get_ith_jump_func (struct ipa_edge_args *args, int i)
447 {
448 return &(*args->jump_functions)[i];
449 }
450
451 /* Returns a pointer to the polymorphic call context for the ith argument.
452 NULL if contexts are not computed. */
453 static inline struct ipa_polymorphic_call_context *
454 ipa_get_ith_polymorhic_call_context (struct ipa_edge_args *args, int i)
455 {
456 if (!args->polymorphic_call_contexts)
457 return NULL;
458 return &(*args->polymorphic_call_contexts)[i];
459 }
460
461 /* Types of vectors holding the infos. */
462
463 /* Vector where the parameter infos are actually stored. */
464 extern vec<ipa_node_params> ipa_node_params_vector;
465 /* Vector of known aggregate values in cloned nodes. */
466 extern GTY(()) vec<ipa_agg_replacement_value_p, va_gc> *ipa_node_agg_replacements;
467 /* Vector where the parameter infos are actually stored. */
468 extern GTY(()) vec<ipa_edge_args, va_gc> *ipa_edge_args_vector;
469
470 /* Return the associated parameter/argument info corresponding to the given
471 node/edge. */
472 #define IPA_NODE_REF(NODE) (&ipa_node_params_vector[(NODE)->uid])
473 #define IPA_EDGE_REF(EDGE) (&(*ipa_edge_args_vector)[(EDGE)->uid])
474 /* This macro checks validity of index returned by
475 ipa_get_param_decl_index function. */
476 #define IS_VALID_JUMP_FUNC_INDEX(I) ((I) != -1)
477
478 /* Creating and freeing ipa_node_params and ipa_edge_args. */
479 void ipa_create_all_node_params (void);
480 void ipa_create_all_edge_args (void);
481 void ipa_free_edge_args_substructures (struct ipa_edge_args *);
482 void ipa_free_node_params_substructures (struct ipa_node_params *);
483 void ipa_free_all_node_params (void);
484 void ipa_free_all_edge_args (void);
485 void ipa_free_all_structures_after_ipa_cp (void);
486 void ipa_free_all_structures_after_iinln (void);
487 void ipa_register_cgraph_hooks (void);
488 int count_formal_params (tree fndecl);
489
490 /* This function ensures the array of node param infos is big enough to
491 accommodate a structure for all nodes and reallocates it if not. */
492
493 static inline void
494 ipa_check_create_node_params (void)
495 {
496 if (!ipa_node_params_vector.exists ())
497 ipa_node_params_vector.create (symtab->cgraph_max_uid);
498
499 if (ipa_node_params_vector.length () <= (unsigned) symtab->cgraph_max_uid)
500 ipa_node_params_vector.safe_grow_cleared (symtab->cgraph_max_uid + 1);
501 }
502
503 /* This function ensures the array of edge arguments infos is big enough to
504 accommodate a structure for all edges and reallocates it if not. */
505
506 static inline void
507 ipa_check_create_edge_args (void)
508 {
509 if (vec_safe_length (ipa_edge_args_vector)
510 <= (unsigned) symtab->edges_max_uid)
511 vec_safe_grow_cleared (ipa_edge_args_vector, symtab->edges_max_uid + 1);
512 }
513
514 /* Returns true if the array of edge infos is large enough to accommodate an
515 info for EDGE. The main purpose of this function is that debug dumping
516 function can check info availability without causing reallocations. */
517
518 static inline bool
519 ipa_edge_args_info_available_for_edge_p (struct cgraph_edge *edge)
520 {
521 return ((unsigned) edge->uid < vec_safe_length (ipa_edge_args_vector));
522 }
523
524 /* Return the aggregate replacements for NODE, if there are any. */
525
526 static inline struct ipa_agg_replacement_value *
527 ipa_get_agg_replacements_for_node (struct cgraph_node *node)
528 {
529 if ((unsigned) node->uid >= vec_safe_length (ipa_node_agg_replacements))
530 return NULL;
531 return (*ipa_node_agg_replacements)[node->uid];
532 }
533
534 /* Function formal parameters related computations. */
535 void ipa_initialize_node_params (struct cgraph_node *node);
536 bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
537 vec<cgraph_edge *> *new_edges);
538
539 /* Indirect edge and binfo processing. */
540 tree ipa_get_indirect_edge_target (struct cgraph_edge *ie,
541 vec<tree> ,
542 vec<ipa_polymorphic_call_context>,
543 vec<ipa_agg_jump_function_p> );
544 struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree,
545 bool speculative = false);
546 tree ipa_binfo_from_known_type_jfunc (struct ipa_jump_func *);
547 tree ipa_impossible_devirt_target (struct cgraph_edge *, tree);
548
549 /* Functions related to both. */
550 void ipa_analyze_node (struct cgraph_node *);
551
552 /* Aggregate jump function related functions. */
553 tree ipa_find_agg_cst_for_param (struct ipa_agg_jump_function *, HOST_WIDE_INT,
554 bool);
555 bool ipa_load_from_parm_agg (struct ipa_node_params *, gimple, tree, int *,
556 HOST_WIDE_INT *, bool *);
557
558 /* Debugging interface. */
559 void ipa_print_node_params (FILE *, struct cgraph_node *node);
560 void ipa_print_all_params (FILE *);
561 void ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node);
562 void ipa_print_all_jump_functions (FILE * f);
563 void ipcp_verify_propagated_values (void);
564
565 extern alloc_pool ipcp_cst_values_pool;
566 extern alloc_pool ipcp_poly_ctx_values_pool;
567 extern alloc_pool ipcp_sources_pool;
568 extern alloc_pool ipcp_agg_lattice_pool;
569
570 /* Operation to be performed for the parameter in ipa_parm_adjustment
571 below. */
572 enum ipa_parm_op {
573 IPA_PARM_OP_NONE,
574
575 /* This describes a brand new parameter.
576
577 The field `type' should be set to the new type, `arg_prefix'
578 should be set to the string prefix for the new DECL_NAME, and
579 `new_decl' will ultimately hold the newly created argument. */
580 IPA_PARM_OP_NEW,
581
582 /* This new parameter is an unmodified parameter at index base_index. */
583 IPA_PARM_OP_COPY,
584
585 /* This adjustment describes a parameter that is about to be removed
586 completely. Most users will probably need to book keep those so that they
587 don't leave behinfd any non default def ssa names belonging to them. */
588 IPA_PARM_OP_REMOVE
589 };
590
591 /* Structure to describe transformations of formal parameters and actual
592 arguments. Each instance describes one new parameter and they are meant to
593 be stored in a vector. Additionally, most users will probably want to store
594 adjustments about parameters that are being removed altogether so that SSA
595 names belonging to them can be replaced by SSA names of an artificial
596 variable. */
597 struct ipa_parm_adjustment
598 {
599 /* The original PARM_DECL itself, helpful for processing of the body of the
600 function itself. Intended for traversing function bodies.
601 ipa_modify_formal_parameters, ipa_modify_call_arguments and
602 ipa_combine_adjustments ignore this and use base_index.
603 ipa_modify_formal_parameters actually sets this. */
604 tree base;
605
606 /* Type of the new parameter. However, if by_ref is true, the real type will
607 be a pointer to this type. */
608 tree type;
609
610 /* Alias refrerence type to be used in MEM_REFs when adjusting caller
611 arguments. */
612 tree alias_ptr_type;
613
614 /* The new declaration when creating/replacing a parameter. Created
615 by ipa_modify_formal_parameters, useful for functions modifying
616 the body accordingly. For brand new arguments, this is the newly
617 created argument. */
618 tree new_decl;
619
620 /* New declaration of a substitute variable that we may use to replace all
621 non-default-def ssa names when a parm decl is going away. */
622 tree new_ssa_base;
623
624 /* If non-NULL and the original parameter is to be removed (copy_param below
625 is NULL), this is going to be its nonlocalized vars value. */
626 tree nonlocal_value;
627
628 /* This holds the prefix to be used for the new DECL_NAME. */
629 const char *arg_prefix;
630
631 /* Offset into the original parameter (for the cases when the new parameter
632 is a component of an original one). */
633 HOST_WIDE_INT offset;
634
635 /* Zero based index of the original parameter this one is based on. */
636 int base_index;
637
638 /* Whether this parameter is a new parameter, a copy of an old one,
639 or one about to be removed. */
640 enum ipa_parm_op op;
641
642 /* The parameter is to be passed by reference. */
643 unsigned by_ref : 1;
644 };
645
646 typedef vec<ipa_parm_adjustment> ipa_parm_adjustment_vec;
647
648 vec<tree> ipa_get_vector_of_formal_parms (tree fndecl);
649 vec<tree> ipa_get_vector_of_formal_parm_types (tree fntype);
650 void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec);
651 void ipa_modify_call_arguments (struct cgraph_edge *, gimple,
652 ipa_parm_adjustment_vec);
653 ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec,
654 ipa_parm_adjustment_vec);
655 void ipa_dump_param_adjustments (FILE *, ipa_parm_adjustment_vec, tree);
656 void ipa_dump_agg_replacement_values (FILE *f,
657 struct ipa_agg_replacement_value *av);
658 void ipa_prop_write_jump_functions (void);
659 void ipa_prop_read_jump_functions (void);
660 void ipa_prop_write_all_agg_replacement (void);
661 void ipa_prop_read_all_agg_replacement (void);
662 void ipa_update_after_lto_read (void);
663 int ipa_get_param_decl_index (struct ipa_node_params *, tree);
664 tree ipa_value_from_jfunc (struct ipa_node_params *info,
665 struct ipa_jump_func *jfunc);
666 unsigned int ipcp_transform_function (struct cgraph_node *node);
667 ipa_polymorphic_call_context ipa_context_from_jfunc (ipa_node_params *,
668 cgraph_edge *,
669 int,
670 ipa_jump_func *);
671 void ipa_dump_param (FILE *, struct ipa_node_params *info, int i);
672 bool ipa_modify_expr (tree *, bool, ipa_parm_adjustment_vec);
673 ipa_parm_adjustment *ipa_get_adjustment_candidate (tree **, bool *,
674 ipa_parm_adjustment_vec,
675 bool);
676
677
678 /* From tree-sra.c: */
679 tree build_ref_for_offset (location_t, tree, HOST_WIDE_INT, tree,
680 gimple_stmt_iterator *, bool);
681
682 /* In ipa-cp.c */
683 void ipa_cp_c_finalize (void);
684
685 #endif /* IPA_PROP_H */