]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ipa-prop.h
Daily bump.
[thirdparty/gcc.git] / gcc / ipa-prop.h
CommitLineData
518dc859 1/* Interprocedural analyses.
d652f226 2 Copyright (C) 2005, 2007, 2008, 2009, 2010
c75c517d 3 Free Software Foundation, Inc.
518dc859
RL
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9dcd6f09 9Software Foundation; either version 3, or (at your option) any later
518dc859
RL
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
9dcd6f09
NC
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
518dc859
RL
20
21#ifndef IPA_PROP_H
22#define IPA_PROP_H
23
24#include "tree.h"
771578a0 25#include "vec.h"
3e293154 26#include "cgraph.h"
d242d063 27#include "gimple.h"
310bc633 28#include "alloc-pool.h"
518dc859
RL
29
30/* The following definitions and interfaces are used by
133f9369
MJ
31 interprocedural analyses or parameters. */
32
33/* ipa-prop.c stuff (ipa-cp, indirect inlining): */
518dc859 34
be95e2b9 35/* A jump function for a callsite represents the values passed as actual
310bc633
MJ
36 arguments of the callsite. They were originally proposed in a paper called
37 "Interprocedural Constant Propagation", by David Callahan, Keith D Cooper,
38 Ken Kennedy, Linda Torczon in Comp86, pg 152-161. There are three main
39 types of values :
685b0d13
MJ
40
41 Pass-through - the caller's formal parameter is passed as an actual
42 argument, possibly one simple operation performed on it.
43 Constant - a constant (is_gimple_ip_invariant)is passed as an actual
44 argument.
45 Unknown - neither of the above.
46
b258210c
MJ
47 IPA_JF_ANCESTOR is a special pass-through jump function, which means that
48 the result is an address of a part of the object pointed to by the formal
49 parameter to which the function refers. It is mainly intended to represent
50 getting addresses of of ancestor fields in C++
51 (e.g. &this_1(D)->D.1766.D.1756). Note that if the original pointer is
52 NULL, ancestor jump function must behave like a simple pass-through.
53
54 Other pass-through functions can either simply pass on an unchanged formal
55 parameter or can apply one simple binary operation to it (such jump
56 functions are called polynomial).
57
58 IPA_JF_KNOWN_TYPE is a special type of an "unknown" function that applies
59 only to pointer parameters. It means that even though we cannot prove that
60 the passed value is an interprocedural constant, we still know the exact
61 type of the containing object which may be valuable for devirtualization.
62
63 Jump functions are computed in ipa-prop.c by function
64 update_call_notes_after_inlining. Some information can be lost and jump
65 functions degraded accordingly when inlining, see
66 update_call_notes_after_inlining in the same file. */
685b0d13 67
518dc859
RL
68enum jump_func_type
69{
133f9369 70 IPA_JF_UNKNOWN = 0, /* newly allocated and zeroed jump functions default */
c7573249 71 IPA_JF_KNOWN_TYPE, /* represented by field known_type */
b258210c 72 IPA_JF_CONST, /* represented by field costant */
b258210c
MJ
73 IPA_JF_PASS_THROUGH, /* represented by field pass_through */
74 IPA_JF_ANCESTOR /* represented by field ancestor */
518dc859
RL
75};
76
c7573249
MJ
77/* Structure holding data required to describe a known type jump function. */
78struct GTY(()) ipa_known_type_data
79{
80 /* Offset of the component of the base_type being described. */
81 HOST_WIDE_INT offset;
82 /* Type of the whole object. */
83 tree base_type;
84 /* Type of the component of the object that is being described. */
85 tree component_type;
86};
87
685b0d13
MJ
88/* Structure holding data required to describe a pass-through jump function. */
89
fb3f88cc 90struct GTY(()) ipa_pass_through_data
685b0d13
MJ
91{
92 /* If an operation is to be performed on the original parameter, this is the
93 second (constant) operand. */
94 tree operand;
95 /* Number of the caller's formal parameter being passed. */
96 int formal_id;
97 /* Operation that is performed on the argument before it is passed on.
98 NOP_EXPR means no operation. Otherwise oper must be a simple binary
99 arithmetic operation where the caller's parameter is the first operand and
100 operand field from this structure is the second one. */
101 enum tree_code operation;
8b7773a4
MJ
102 /* When the passed value is a pointer, it is set to true only when we are
103 certain that no write to the object it points to has occurred since the
104 caller functions started execution, except for changes noted in the
105 aggregate part of the jump function (see description of
106 ipa_agg_jump_function). The flag is used only when the operation is
107 NOP_EXPR. */
108 bool agg_preserved;
685b0d13
MJ
109};
110
b258210c
MJ
111/* Structure holding data required to describe an ancestor pass-through
112 jump function. */
685b0d13 113
fb3f88cc 114struct GTY(()) ipa_ancestor_jf_data
685b0d13
MJ
115{
116 /* Offset of the field representing the ancestor. */
117 HOST_WIDE_INT offset;
7b872d9e 118 /* Type of the result. */
685b0d13
MJ
119 tree type;
120 /* Number of the caller's formal parameter being passed. */
121 int formal_id;
8b7773a4
MJ
122 /* Flag with the same meaning like agg_preserve in ipa_pass_through_data. */
123 bool agg_preserved;
685b0d13
MJ
124};
125
8b7773a4
MJ
126/* An element in an aggegate part of a jump function describing a known value
127 at a given offset. When it is part of a pass-through jump function with
128 agg_preserved set or an ancestor jump function with agg_preserved set, all
129 unlisted positions are assumed to be preserved but the value can be a type
130 node, which means that the particular piece (starting at offset and having
131 the size of the type) is clobbered with an unknown value. When
132 agg_preserved is false or the type of the containing jump function is
133 different, all unlisted parts are assumed to be unknown and all values must
134 fullfill is_gimple_ip_invariant. */
135
136typedef struct GTY(()) ipa_agg_jf_item
137{
138 /* The offset at which the known value is located within the aggregate. */
139 HOST_WIDE_INT offset;
140
141 /* The known constant or type if this is a clobber. */
142 tree value;
143} ipa_agg_jf_item_t;
144
145DEF_VEC_O (ipa_agg_jf_item_t);
146DEF_VEC_ALLOC_O (ipa_agg_jf_item_t, gc);
147
148/* Aggregate jump function - i.e. description of contents of aggregates passed
149 either by reference or value. */
150
151struct GTY(()) ipa_agg_jump_function
3e293154 152{
8b7773a4
MJ
153 /* Description of the individual items. */
154 VEC (ipa_agg_jf_item_t, gc) *items;
155 /* True if the data was passed by reference (as opposed to by value). */
156 bool by_ref;
3e293154
MJ
157};
158
8b7773a4
MJ
159typedef struct ipa_agg_jump_function *ipa_agg_jump_function_p;
160DEF_VEC_P (ipa_agg_jump_function_p);
161DEF_VEC_ALLOC_P (ipa_agg_jump_function_p, heap);
162
be95e2b9
MJ
163/* A jump function for a callsite represents the values passed as actual
164 arguments of the callsite. See enum jump_func_type for the various
518dc859 165 types of jump functions supported. */
606d9a09 166typedef struct GTY (()) ipa_jump_func
518dc859 167{
8b7773a4
MJ
168 /* Aggregate contants description. See struct ipa_agg_jump_function and its
169 description. */
170 struct ipa_agg_jump_function agg;
171
518dc859 172 enum jump_func_type type;
fb3f88cc
JH
173 /* Represents a value of a jump function. pass_through is used only in jump
174 function context. constant represents the actual constant in constant jump
175 functions and member_cst holds constant c++ member functions. */
176 union jump_func_value
177 {
c7573249 178 struct ipa_known_type_data GTY ((tag ("IPA_JF_KNOWN_TYPE"))) known_type;
fb3f88cc
JH
179 tree GTY ((tag ("IPA_JF_CONST"))) constant;
180 struct ipa_pass_through_data GTY ((tag ("IPA_JF_PASS_THROUGH"))) pass_through;
181 struct ipa_ancestor_jf_data GTY ((tag ("IPA_JF_ANCESTOR"))) ancestor;
fb3f88cc 182 } GTY ((desc ("%1.type"))) value;
606d9a09
MJ
183} ipa_jump_func_t;
184
185DEF_VEC_O (ipa_jump_func_t);
186DEF_VEC_ALLOC_O (ipa_jump_func_t, gc);
518dc859 187
7b872d9e
MJ
188/* Return the offset of the component that is decribed by a known type jump
189 function JFUNC. */
190
191static inline HOST_WIDE_INT
192ipa_get_jf_known_type_offset (struct ipa_jump_func *jfunc)
193{
194 gcc_checking_assert (jfunc->type == IPA_JF_KNOWN_TYPE);
195 return jfunc->value.known_type.offset;
196}
197
198/* Return the base type of a known type jump function JFUNC. */
199
200static inline tree
201ipa_get_jf_known_type_base_type (struct ipa_jump_func *jfunc)
202{
203 gcc_checking_assert (jfunc->type == IPA_JF_KNOWN_TYPE);
204 return jfunc->value.known_type.base_type;
205}
206
207/* Return the component type of a known type jump function JFUNC. */
208
209static inline tree
210ipa_get_jf_known_type_component_type (struct ipa_jump_func *jfunc)
211{
212 gcc_checking_assert (jfunc->type == IPA_JF_KNOWN_TYPE);
213 return jfunc->value.known_type.component_type;
214}
215
216/* Return the constant stored in a constant jump functin JFUNC. */
217
218static inline tree
219ipa_get_jf_constant (struct ipa_jump_func *jfunc)
220{
221 gcc_checking_assert (jfunc->type == IPA_JF_CONST);
222 return jfunc->value.constant;
223}
224
225/* Return the operand of a pass through jmp function JFUNC. */
226
227static inline tree
228ipa_get_jf_pass_through_operand (struct ipa_jump_func *jfunc)
229{
230 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
231 return jfunc->value.pass_through.operand;
232}
233
234/* Return the number of the caller's formal parameter that a pass through jump
235 function JFUNC refers to. */
236
237static inline int
238ipa_get_jf_pass_through_formal_id (struct ipa_jump_func *jfunc)
239{
240 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
241 return jfunc->value.pass_through.formal_id;
242}
243
244/* Return operation of a pass through jump function JFUNC. */
245
246static inline enum tree_code
247ipa_get_jf_pass_through_operation (struct ipa_jump_func *jfunc)
248{
249 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
250 return jfunc->value.pass_through.operation;
251}
252
8b7773a4
MJ
253/* Return the agg_preserved flag of a pass through jump functin JFUNC. */
254
255static inline bool
256ipa_get_jf_pass_through_agg_preserved (struct ipa_jump_func *jfunc)
257{
258 gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
259 return jfunc->value.pass_through.agg_preserved;
260}
261
7b872d9e
MJ
262/* Return the offset of an ancestor jump function JFUNC. */
263
264static inline HOST_WIDE_INT
265ipa_get_jf_ancestor_offset (struct ipa_jump_func *jfunc)
266{
267 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
268 return jfunc->value.ancestor.offset;
269}
270
271/* Return the result type of an ancestor jump function JFUNC. */
272
273static inline tree
274ipa_get_jf_ancestor_type (struct ipa_jump_func *jfunc)
275{
276 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
277 return jfunc->value.ancestor.type;
278}
279
280/* Return the number of the caller's formal parameter that an ancestor jump
281 function JFUNC refers to. */
282
283static inline int
284ipa_get_jf_ancestor_formal_id (struct ipa_jump_func *jfunc)
285{
286 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
287 return jfunc->value.ancestor.formal_id;
288}
289
8b7773a4 290/* Return the agg_preserved flag of an ancestor jump functin JFUNC. */
7b872d9e 291
8b7773a4
MJ
292static inline bool
293ipa_get_jf_ancestor_agg_preserved (struct ipa_jump_func *jfunc)
7b872d9e 294{
8b7773a4
MJ
295 gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
296 return jfunc->value.ancestor.agg_preserved;
7b872d9e
MJ
297}
298
310bc633 299/* Summary describing a single formal parameter. */
b258210c 300
f8e2a1ed
MJ
301struct ipa_param_descriptor
302{
f8e2a1ed
MJ
303 /* PARAM_DECL of this parameter. */
304 tree decl;
339f49ec
JH
305 /* The parameter is used. */
306 unsigned used : 1;
f8e2a1ed
MJ
307};
308
310bc633
MJ
309typedef struct ipa_param_descriptor ipa_param_descriptor_t;
310DEF_VEC_O (ipa_param_descriptor_t);
311DEF_VEC_ALLOC_O (ipa_param_descriptor_t, heap);
312struct ipcp_lattice;
313
dcd416e3
MJ
314/* ipa_node_params stores information related to formal parameters of functions
315 and some other information for interprocedural passes that operate on
316 parameters (such as ipa-cp). */
310bc633 317
dcd416e3 318struct ipa_node_params
518dc859 319{
310bc633
MJ
320 /* Information about individual formal parameters that are gathered when
321 summaries are generated. */
322 VEC (ipa_param_descriptor_t, heap) *descriptors;
323 /* Pointer to an array of structures describing individual formal
324 parameters. */
325 struct ipcp_lattice *lattices;
326 /* Only for versioned nodes this field would not be NULL,
327 it points to the node that IPA cp cloned from. */
328 struct cgraph_node *ipcp_orig_node;
329 /* If this node is an ipa-cp clone, these are the known values that describe
330 what it has been specialized for. */
331 VEC (tree, heap) *known_vals;
448f65db
NF
332 /* Whether the param uses analysis has already been performed. */
333 unsigned uses_analysis_done : 1;
310bc633 334 /* Whether the function is enqueued in ipa-cp propagation stack. */
448f65db 335 unsigned node_enqueued : 1;
310bc633
MJ
336 /* Whether we should create a specialized version based on values that are
337 known to be constant in all contexts. */
338 unsigned clone_for_all_contexts : 1;
339 /* Node has been completely replaced by clones and will be removed after
340 ipa-cp is finished. */
341 unsigned node_dead : 1;
518dc859
RL
342};
343
dcd416e3
MJ
344/* ipa_node_params access functions. Please use these to access fields that
345 are or will be shared among various passes. */
346
dcd416e3 347/* Return the number of formal parameters. */
be95e2b9 348
dcd416e3
MJ
349static inline int
350ipa_get_param_count (struct ipa_node_params *info)
351{
310bc633 352 return VEC_length (ipa_param_descriptor_t, info->descriptors);
dcd416e3
MJ
353}
354
f8e2a1ed
MJ
355/* Return the declaration of Ith formal parameter of the function corresponding
356 to INFO. Note there is no setter function as this array is built just once
357 using ipa_initialize_node_params. */
be95e2b9 358
dcd416e3 359static inline tree
f8e2a1ed 360ipa_get_param (struct ipa_node_params *info, int i)
dcd416e3 361{
310bc633 362 return VEC_index (ipa_param_descriptor_t, info->descriptors, i)->decl;
339f49ec
JH
363}
364
310bc633
MJ
365/* Set the used flag corresponding to the Ith formal parameter of the function
366 associated with INFO to VAL. */
3949c4a7 367
310bc633
MJ
368static inline void
369ipa_set_param_used (struct ipa_node_params *info, int i, bool val)
3949c4a7 370{
310bc633 371 VEC_index (ipa_param_descriptor_t, info->descriptors, i)->used = val;
3949c4a7
MJ
372}
373
310bc633
MJ
374/* Return the used flag corresponding to the Ith formal parameter of the
375 function associated with INFO. */
3949c4a7
MJ
376
377static inline bool
310bc633 378ipa_is_param_used (struct ipa_node_params *info, int i)
3949c4a7 379{
310bc633 380 return VEC_index (ipa_param_descriptor_t, info->descriptors, i)->used;
3949c4a7
MJ
381}
382
93c594a3
MJ
383/* ipa_edge_args stores information related to a callsite and particularly its
384 arguments. It can be accessed by the IPA_EDGE_REF macro. */
fb3f88cc 385typedef struct GTY(()) ipa_edge_args
518dc859 386{
606d9a09
MJ
387 /* Vector of the callsite's jump function of each parameter. */
388 VEC (ipa_jump_func_t, gc) *jump_functions;
fb3f88cc 389} ipa_edge_args_t;
518dc859 390
dcd416e3
MJ
391/* ipa_edge_args access functions. Please use these to access fields that
392 are or will be shared among various passes. */
393
dcd416e3 394/* Return the number of actual arguments. */
be95e2b9 395
dcd416e3
MJ
396static inline int
397ipa_get_cs_argument_count (struct ipa_edge_args *args)
398{
606d9a09 399 return VEC_length (ipa_jump_func_t, args->jump_functions);
dcd416e3
MJ
400}
401
402/* Returns a pointer to the jump function for the ith argument. Please note
403 there is no setter function as jump functions are all set up in
404 ipa_compute_jump_functions. */
be95e2b9 405
dcd416e3
MJ
406static inline struct ipa_jump_func *
407ipa_get_ith_jump_func (struct ipa_edge_args *args, int i)
408{
606d9a09 409 return VEC_index (ipa_jump_func_t, args->jump_functions, i);
dcd416e3
MJ
410}
411
771578a0
MJ
412/* Vectors need to have typedefs of structures. */
413typedef struct ipa_node_params ipa_node_params_t;
771578a0 414
be95e2b9 415/* Types of vectors holding the infos. */
771578a0
MJ
416DEF_VEC_O (ipa_node_params_t);
417DEF_VEC_ALLOC_O (ipa_node_params_t, heap);
418DEF_VEC_O (ipa_edge_args_t);
fb3f88cc 419DEF_VEC_ALLOC_O (ipa_edge_args_t, gc);
771578a0
MJ
420
421/* Vector where the parameter infos are actually stored. */
422extern VEC (ipa_node_params_t, heap) *ipa_node_params_vector;
423/* Vector where the parameter infos are actually stored. */
fb3f88cc 424extern GTY(()) VEC (ipa_edge_args_t, gc) *ipa_edge_args_vector;
771578a0
MJ
425
426/* Return the associated parameter/argument info corresponding to the given
427 node/edge. */
428#define IPA_NODE_REF(NODE) (VEC_index (ipa_node_params_t, \
429 ipa_node_params_vector, (NODE)->uid))
430#define IPA_EDGE_REF(EDGE) (VEC_index (ipa_edge_args_t, \
431 ipa_edge_args_vector, (EDGE)->uid))
432/* This macro checks validity of index returned by
433 ipa_get_param_decl_index function. */
434#define IS_VALID_JUMP_FUNC_INDEX(I) ((I) != -1)
435
436/* Creating and freeing ipa_node_params and ipa_edge_args. */
437void ipa_create_all_node_params (void);
438void ipa_create_all_edge_args (void);
439void ipa_free_edge_args_substructures (struct ipa_edge_args *);
440void ipa_free_node_params_substructures (struct ipa_node_params *);
441void ipa_free_all_node_params (void);
442void ipa_free_all_edge_args (void);
e33c6cd6
MJ
443void ipa_free_all_structures_after_ipa_cp (void);
444void ipa_free_all_structures_after_iinln (void);
771578a0
MJ
445void ipa_register_cgraph_hooks (void);
446
447/* This function ensures the array of node param infos is big enough to
be95e2b9
MJ
448 accommodate a structure for all nodes and reallocates it if not. */
449
771578a0
MJ
450static inline void
451ipa_check_create_node_params (void)
452{
453 if (!ipa_node_params_vector)
454 ipa_node_params_vector = VEC_alloc (ipa_node_params_t, heap,
455 cgraph_max_uid);
456
457 if (VEC_length (ipa_node_params_t, ipa_node_params_vector)
458 <= (unsigned) cgraph_max_uid)
459 VEC_safe_grow_cleared (ipa_node_params_t, heap,
460 ipa_node_params_vector, cgraph_max_uid + 1);
461}
462
be95e2b9
MJ
463/* This function ensures the array of edge arguments infos is big enough to
464 accommodate a structure for all edges and reallocates it if not. */
465
771578a0
MJ
466static inline void
467ipa_check_create_edge_args (void)
468{
469 if (!ipa_edge_args_vector)
fb3f88cc 470 ipa_edge_args_vector = VEC_alloc (ipa_edge_args_t, gc,
771578a0
MJ
471 cgraph_edge_max_uid);
472
473 if (VEC_length (ipa_edge_args_t, ipa_edge_args_vector)
474 <= (unsigned) cgraph_edge_max_uid)
fb3f88cc 475 VEC_safe_grow_cleared (ipa_edge_args_t, gc, ipa_edge_args_vector,
771578a0
MJ
476 cgraph_edge_max_uid + 1);
477}
478
be95e2b9 479/* Returns true if the array of edge infos is large enough to accommodate an
0eae6bab
MJ
480 info for EDGE. The main purpose of this function is that debug dumping
481 function can check info availability without causing reallocations. */
be95e2b9 482
0eae6bab
MJ
483static inline bool
484ipa_edge_args_info_available_for_edge_p (struct cgraph_edge *edge)
485{
486 return ((unsigned) edge->uid < VEC_length (ipa_edge_args_t,
487 ipa_edge_args_vector));
488}
489
f8e2a1ed
MJ
490/* Function formal parameters related computations. */
491void ipa_initialize_node_params (struct cgraph_node *node);
f8e2a1ed 492bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
e56f5f3e 493 VEC (cgraph_edge_p, heap) **new_edges);
518dc859 494
3949c4a7 495/* Indirect edge and binfo processing. */
d2d668fb 496tree ipa_get_indirect_edge_target (struct cgraph_edge *ie,
8810cc52
MJ
497 VEC (tree, heap) *,
498 VEC (tree, heap) *,
499 VEC (ipa_agg_jump_function_p, heap) *);
81fa35bd 500struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree);
3949c4a7 501
310bc633
MJ
502/* Functions related to both. */
503void ipa_analyze_node (struct cgraph_node *);
3949c4a7 504
8b7773a4
MJ
505/* Aggregate jump function related functions. */
506tree ipa_find_agg_cst_for_param (struct ipa_agg_jump_function *, HOST_WIDE_INT,
507 bool);
508bool ipa_load_from_parm_agg (struct ipa_node_params *, gimple, tree, int *,
509 HOST_WIDE_INT *, bool *);
510
518dc859 511/* Debugging interface. */
ca30a539
JH
512void ipa_print_node_params (FILE *, struct cgraph_node *node);
513void ipa_print_all_params (FILE *);
3e293154
MJ
514void ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node);
515void ipa_print_all_jump_functions (FILE * f);
310bc633
MJ
516void ipcp_verify_propagated_values (void);
517
518extern alloc_pool ipcp_values_pool;
519extern alloc_pool ipcp_sources_pool;
518dc859 520
3f84bf08
MJ
521/* Structure to describe transformations of formal parameters and actual
522 arguments. Each instance describes one new parameter and they are meant to
523 be stored in a vector. Additionally, most users will probably want to store
524 adjustments about parameters that are being removed altogether so that SSA
525 names belonging to them can be replaced by SSA names of an artificial
526 variable. */
527struct ipa_parm_adjustment
528{
529 /* The original PARM_DECL itself, helpful for processing of the body of the
530 function itself. Intended for traversing function bodies.
531 ipa_modify_formal_parameters, ipa_modify_call_arguments and
532 ipa_combine_adjustments ignore this and use base_index.
533 ipa_modify_formal_parameters actually sets this. */
534 tree base;
535
536 /* Type of the new parameter. However, if by_ref is true, the real type will
537 be a pointer to this type. */
538 tree type;
539
82d49829
MJ
540 /* Alias refrerence type to be used in MEM_REFs when adjusting caller
541 arguments. */
542 tree alias_ptr_type;
543
3f84bf08
MJ
544 /* The new declaration when creating/replacing a parameter. Created by
545 ipa_modify_formal_parameters, useful for functions modifying the body
546 accordingly. */
547 tree reduction;
548
549 /* New declaration of a substitute variable that we may use to replace all
550 non-default-def ssa names when a parm decl is going away. */
551 tree new_ssa_base;
552
553 /* If non-NULL and the original parameter is to be removed (copy_param below
554 is NULL), this is going to be its nonlocalized vars value. */
555 tree nonlocal_value;
556
557 /* Offset into the original parameter (for the cases when the new parameter
558 is a component of an original one). */
559 HOST_WIDE_INT offset;
560
561 /* Zero based index of the original parameter this one is based on. (ATM
562 there is no way to insert a new parameter out of the blue because there is
563 no need but if it arises the code can be easily exteded to do so.) */
564 int base_index;
565
566 /* This new parameter is an unmodified parameter at index base_index. */
567 unsigned copy_param : 1;
568
569 /* This adjustment describes a parameter that is about to be removed
570 completely. Most users will probably need to book keep those so that they
571 don't leave behinfd any non default def ssa names belonging to them. */
572 unsigned remove_param : 1;
573
574 /* The parameter is to be passed by reference. */
575 unsigned by_ref : 1;
576};
577
578typedef struct ipa_parm_adjustment ipa_parm_adjustment_t;
579DEF_VEC_O (ipa_parm_adjustment_t);
580DEF_VEC_ALLOC_O (ipa_parm_adjustment_t, heap);
581
582typedef VEC (ipa_parm_adjustment_t, heap) *ipa_parm_adjustment_vec;
583
584VEC(tree, heap) *ipa_get_vector_of_formal_parms (tree fndecl);
585void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec,
586 const char *);
587void ipa_modify_call_arguments (struct cgraph_edge *, gimple,
588 ipa_parm_adjustment_vec);
589ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec,
590 ipa_parm_adjustment_vec);
591void ipa_dump_param_adjustments (FILE *, ipa_parm_adjustment_vec, tree);
592
fb3f88cc
JH
593void ipa_prop_write_jump_functions (cgraph_node_set set);
594void ipa_prop_read_jump_functions (void);
595void ipa_update_after_lto_read (void);
632b4f8e 596int ipa_get_param_decl_index (struct ipa_node_params *, tree);
d2d668fb
MK
597tree ipa_value_from_jfunc (struct ipa_node_params *info,
598 struct ipa_jump_func *jfunc);
411a20d6 599
fb3f88cc 600
3f84bf08 601/* From tree-sra.c: */
e4b5cace
MJ
602tree build_ref_for_offset (location_t, tree, HOST_WIDE_INT, tree,
603 gimple_stmt_iterator *, bool);
3f84bf08 604
518dc859 605#endif /* IPA_PROP_H */