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