1 /* Manipulation of formal and actual parameters of functions and function
3 Copyright (C) 2017-2021 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
23 #include "coretypes.h"
29 #include "fold-const.h"
31 #include "stor-layout.h"
33 #include "gimple-iterator.h"
34 #include "gimplify-me.h"
37 #include "ipa-param-manipulation.h"
38 #include "print-tree.h"
39 #include "gimple-pretty-print.h"
42 #include "tree-inline.h"
43 #include "alloc-pool.h"
44 #include "symbol-summary.h"
45 #include "symtab-clones.h"
48 /* Actual prefixes of different newly synthetized parameters. Keep in sync
49 with IPA_PARAM_PREFIX_* defines. */
51 static const char *ipa_param_prefixes
[IPA_PARAM_PREFIX_COUNT
]
57 /* Names of parameters for dumping. Keep in sync with enum ipa_parm_op. */
59 static const char *ipa_param_op_names
[IPA_PARAM_PREFIX_COUNT
]
60 = {"IPA_PARAM_OP_UNDEFINED",
63 "IPA_PARAM_OP_SPLIT"};
65 /* Structure to hold declarations representing pass-through IPA-SRA splits. In
66 essence, it tells new index for a combination of original index and
69 struct pass_through_split_map
71 /* Original argument index. */
73 /* Offset of the split part in the original argument. */
75 /* Index of the split part in the call statement - where clone
76 materialization put it. */
80 /* Information about some call statements that needs to be conveyed from clone
81 materialization to edge redirection. */
83 class ipa_edge_modification_info
86 ipa_edge_modification_info ()
89 /* Mapping of original argument indices to where those arguments sit in the
90 call statement now or to a negative index if they were removed. */
91 auto_vec
<int> index_map
;
92 /* Information about ISRA replacements put into the call statement at the
93 clone materialization stages. */
94 auto_vec
<pass_through_split_map
> pass_through_map
;
95 /* Necessary adjustment to ipa_param_adjustments::m_always_copy_start when
96 redirecting the call. */
97 int always_copy_delta
= 0;
100 /* Class for storing and retrieving summaries about cal statement
103 class ipa_edge_modification_sum
104 : public call_summary
<ipa_edge_modification_info
*>
107 ipa_edge_modification_sum (symbol_table
*table
)
108 : call_summary
<ipa_edge_modification_info
*> (table
)
112 /* Hook that is called by summary when an edge is duplicated. */
114 virtual void duplicate (cgraph_edge
*,
116 ipa_edge_modification_info
*old_info
,
117 ipa_edge_modification_info
*new_info
)
119 new_info
->index_map
.safe_splice (old_info
->index_map
);
120 new_info
->pass_through_map
.safe_splice (old_info
->pass_through_map
);
121 new_info
->always_copy_delta
= old_info
->always_copy_delta
;
125 /* Call summary to store information about edges which have had their arguments
126 partially modified already. */
128 static ipa_edge_modification_sum
*ipa_edge_modifications
;
130 /* Fail compilation if CS has any summary associated with it in
131 ipa_edge_modifications. */
134 ipa_verify_edge_has_no_modifications (cgraph_edge
*cs
)
136 gcc_assert (!ipa_edge_modifications
|| !ipa_edge_modifications
->get (cs
));
139 /* Fill an empty vector ARGS with PARM_DECLs representing formal parameters of
140 FNDECL. The function should not be called during LTO WPA phase except for
141 thunks (or functions with bodies streamed in). */
144 push_function_arg_decls (vec
<tree
> *args
, tree fndecl
)
149 /* Safety check that we do not attempt to use the function in WPA, except
150 when the function is a thunk and then we have DECL_ARGUMENTS or when we
151 have already explicitely loaded its body. */
152 gcc_assert (!flag_wpa
153 || DECL_ARGUMENTS (fndecl
)
154 || gimple_has_body_p (fndecl
));
156 for (parm
= DECL_ARGUMENTS (fndecl
); parm
; parm
= DECL_CHAIN (parm
))
159 args
->reserve_exact (count
);
160 for (parm
= DECL_ARGUMENTS (fndecl
); parm
; parm
= DECL_CHAIN (parm
))
161 args
->quick_push (parm
);
164 /* Fill an empty vector TYPES with trees representing formal parameters of
165 function type FNTYPE. */
168 push_function_arg_types (vec
<tree
> *types
, tree fntype
)
173 for (t
= TYPE_ARG_TYPES (fntype
); t
; t
= TREE_CHAIN (t
))
176 types
->reserve_exact (count
);
177 for (t
= TYPE_ARG_TYPES (fntype
); t
; t
= TREE_CHAIN (t
))
178 types
->quick_push (TREE_VALUE (t
));
181 /* Dump the adjustments in the vector ADJUSTMENTS to dump_file in a human
182 friendly way, assuming they are meant to be applied to FNDECL. */
185 ipa_dump_adjusted_parameters (FILE *f
,
186 vec
<ipa_adjusted_param
, va_gc
> *adj_params
)
188 unsigned i
, len
= vec_safe_length (adj_params
);
194 fprintf (f
, " IPA adjusted parameters: ");
195 for (i
= 0; i
< len
; i
++)
197 struct ipa_adjusted_param
*apm
;
198 apm
= &(*adj_params
)[i
];
205 fprintf (f
, "%i. %s %s", i
, ipa_param_op_names
[apm
->op
],
206 apm
->prev_clone_adjustment
? "prev_clone_adjustment " : "");
209 case IPA_PARAM_OP_UNDEFINED
:
212 case IPA_PARAM_OP_COPY
:
213 fprintf (f
, ", base_index: %u", apm
->base_index
);
214 fprintf (f
, ", prev_clone_index: %u", apm
->prev_clone_index
);
217 case IPA_PARAM_OP_SPLIT
:
218 fprintf (f
, ", offset: %u", apm
->unit_offset
);
220 case IPA_PARAM_OP_NEW
:
221 fprintf (f
, ", base_index: %u", apm
->base_index
);
222 fprintf (f
, ", prev_clone_index: %u", apm
->prev_clone_index
);
223 print_node_brief (f
, ", type: ", apm
->type
, 0);
224 print_node_brief (f
, ", alias type: ", apm
->alias_ptr_type
, 0);
225 fprintf (f
, " prefix: %s",
226 ipa_param_prefixes
[apm
->param_prefix_index
]);
228 fprintf (f
, ", reverse-sso");
235 /* Fill NEW_TYPES with types of a function after its current OTYPES have been
236 modified as described in ADJ_PARAMS. When USE_PREV_INDICES is true, use
237 prev_clone_index from ADJ_PARAMS as opposed to base_index when the parameter
241 fill_vector_of_new_param_types (vec
<tree
> *new_types
, vec
<tree
> *otypes
,
242 vec
<ipa_adjusted_param
, va_gc
> *adj_params
,
243 bool use_prev_indices
)
245 unsigned adj_len
= vec_safe_length (adj_params
);
246 new_types
->reserve_exact (adj_len
);
247 for (unsigned i
= 0; i
< adj_len
; i
++)
249 ipa_adjusted_param
*apm
= &(*adj_params
)[i
];
250 if (apm
->op
== IPA_PARAM_OP_COPY
)
253 = use_prev_indices
? apm
->prev_clone_index
: apm
->base_index
;
254 /* The following needs to be handled gracefully because of type
255 mismatches. This happens with LTO but apparently also in Fortran
256 with -fcoarray=lib -O2 -lcaf_single -latomic. */
257 if (index
>= otypes
->length ())
259 new_types
->quick_push ((*otypes
)[index
]);
261 else if (apm
->op
== IPA_PARAM_OP_NEW
262 || apm
->op
== IPA_PARAM_OP_SPLIT
)
264 tree ntype
= apm
->type
;
265 if (is_gimple_reg_type (ntype
)
266 && TYPE_MODE (ntype
) != BLKmode
)
268 unsigned malign
= GET_MODE_ALIGNMENT (TYPE_MODE (ntype
));
269 if (TYPE_ALIGN (ntype
) != malign
)
270 ntype
= build_aligned_type (ntype
, malign
);
272 new_types
->quick_push (ntype
);
279 /* Build and return a function type just like ORIG_TYPE but with parameter
280 types given in NEW_PARAM_TYPES - which can be NULL if, but only if,
281 ORIG_TYPE itself has NULL TREE_ARG_TYPEs. If METHOD2FUNC is true, also make
282 it a FUNCTION_TYPE instead of FUNCTION_TYPE. */
285 build_adjusted_function_type (tree orig_type
, vec
<tree
> *new_param_types
,
286 bool method2func
, bool skip_return
)
288 tree new_arg_types
= NULL
;
289 if (TYPE_ARG_TYPES (orig_type
))
291 gcc_checking_assert (new_param_types
);
292 bool last_parm_void
= (TREE_VALUE (tree_last (TYPE_ARG_TYPES (orig_type
)))
294 unsigned len
= new_param_types
->length ();
295 for (unsigned i
= 0; i
< len
; i
++)
296 new_arg_types
= tree_cons (NULL_TREE
, (*new_param_types
)[i
],
299 tree new_reversed
= nreverse (new_arg_types
);
303 TREE_CHAIN (new_arg_types
) = void_list_node
;
305 new_reversed
= void_list_node
;
307 new_arg_types
= new_reversed
;
310 /* Use build_distinct_type_copy to preserve as much as possible from original
311 type (debug info, attribute lists etc.). The one exception is
312 METHOD_TYPEs which must have THIS argument and when we are asked to remove
313 it, we need to build new FUNCTION_TYPE instead. */
314 tree new_type
= NULL
;
319 ret_type
= void_type_node
;
321 ret_type
= TREE_TYPE (orig_type
);
324 = build_distinct_type_copy (build_function_type (ret_type
,
326 TYPE_CONTEXT (new_type
) = TYPE_CONTEXT (orig_type
);
330 new_type
= build_distinct_type_copy (orig_type
);
331 TYPE_ARG_TYPES (new_type
) = new_arg_types
;
333 TREE_TYPE (new_type
) = void_type_node
;
339 /* Return the maximum index in any IPA_PARAM_OP_COPY adjustment or -1 if there
343 ipa_param_adjustments::get_max_base_index ()
345 unsigned adj_len
= vec_safe_length (m_adj_params
);
347 for (unsigned i
= 0; i
< adj_len
; i
++)
349 ipa_adjusted_param
*apm
= &(*m_adj_params
)[i
];
350 if (apm
->op
== IPA_PARAM_OP_COPY
351 && max_index
< apm
->base_index
)
352 max_index
= apm
->base_index
;
358 /* Fill SURVIVING_PARAMS with an array of bools where each one says whether a
359 parameter that originally was at that position still survives in the given
360 clone or is removed/replaced. If the final array is smaller than an index
361 of an original parameter, that parameter also did not survive. That a
362 parameter survives does not mean it has the same index as before. */
365 ipa_param_adjustments::get_surviving_params (vec
<bool> *surviving_params
)
367 unsigned adj_len
= vec_safe_length (m_adj_params
);
368 int max_index
= get_max_base_index ();
372 surviving_params
->reserve_exact (max_index
+ 1);
373 surviving_params
->quick_grow_cleared (max_index
+ 1);
374 for (unsigned i
= 0; i
< adj_len
; i
++)
376 ipa_adjusted_param
*apm
= &(*m_adj_params
)[i
];
377 if (apm
->op
== IPA_PARAM_OP_COPY
)
378 (*surviving_params
)[apm
->base_index
] = true;
382 /* Fill NEW_INDICES with new indices of each surviving parameter or -1 for
383 those which do not survive. Any parameter outside of lenght of the vector
384 does not survive. There is currently no support for a parameter to be
385 copied to two distinct new parameters. */
388 ipa_param_adjustments::get_updated_indices (vec
<int> *new_indices
)
390 unsigned adj_len
= vec_safe_length (m_adj_params
);
391 int max_index
= get_max_base_index ();
395 unsigned res_len
= max_index
+ 1;
396 new_indices
->reserve_exact (res_len
);
397 for (unsigned i
= 0; i
< res_len
; i
++)
398 new_indices
->quick_push (-1);
399 for (unsigned i
= 0; i
< adj_len
; i
++)
401 ipa_adjusted_param
*apm
= &(*m_adj_params
)[i
];
402 if (apm
->op
== IPA_PARAM_OP_COPY
)
403 (*new_indices
)[apm
->base_index
] = i
;
407 /* Return the original index for the given new parameter index. Return a
408 negative number if not available. */
411 ipa_param_adjustments::get_original_index (int newidx
)
413 const ipa_adjusted_param
*adj
= &(*m_adj_params
)[newidx
];
414 if (adj
->op
!= IPA_PARAM_OP_COPY
)
416 return adj
->base_index
;
419 /* Return true if the first parameter (assuming there was one) survives the
420 transformation intact and remains the first one. */
423 ipa_param_adjustments::first_param_intact_p ()
425 return (!vec_safe_is_empty (m_adj_params
)
426 && (*m_adj_params
)[0].op
== IPA_PARAM_OP_COPY
427 && (*m_adj_params
)[0].base_index
== 0);
430 /* Return true if we have to change what has formerly been a method into a
434 ipa_param_adjustments::method2func_p (tree orig_type
)
436 return ((TREE_CODE (orig_type
) == METHOD_TYPE
) && !first_param_intact_p ());
439 /* Given function type OLD_TYPE, return a new type derived from it after
440 performing all atored modifications. TYPE_ORIGINAL_P should be true when
441 OLD_TYPE refers to the type before any IPA transformations, as opposed to a
442 type that can be an intermediate one in between various IPA
446 ipa_param_adjustments::build_new_function_type (tree old_type
,
447 bool type_original_p
)
449 auto_vec
<tree
,16> new_param_types
, *new_param_types_p
;
450 if (prototype_p (old_type
))
452 auto_vec
<tree
, 16> otypes
;
453 push_function_arg_types (&otypes
, old_type
);
454 fill_vector_of_new_param_types (&new_param_types
, &otypes
, m_adj_params
,
456 new_param_types_p
= &new_param_types
;
459 new_param_types_p
= NULL
;
461 return build_adjusted_function_type (old_type
, new_param_types_p
,
462 method2func_p (old_type
), m_skip_return
);
465 /* Build variant of function decl ORIG_DECL which has no return value if
466 M_SKIP_RETURN is true and, if ORIG_DECL's types or parameters is known, has
467 this type adjusted as indicated in M_ADJ_PARAMS. Arguments from
468 DECL_ARGUMENTS list are not processed now, since they are linked by
469 TREE_CHAIN directly and not accessible in LTO during WPA. The caller is
470 responsible for eliminating them when clones are properly materialized. */
473 ipa_param_adjustments::adjust_decl (tree orig_decl
)
475 tree new_decl
= copy_node (orig_decl
);
476 tree orig_type
= TREE_TYPE (orig_decl
);
477 if (prototype_p (orig_type
)
478 || (m_skip_return
&& !VOID_TYPE_P (TREE_TYPE (orig_type
))))
480 tree new_type
= build_new_function_type (orig_type
, false);
481 TREE_TYPE (new_decl
) = new_type
;
483 if (method2func_p (orig_type
))
484 DECL_VINDEX (new_decl
) = NULL_TREE
;
486 /* When signature changes, we need to clear builtin info. */
487 if (fndecl_built_in_p (new_decl
))
488 set_decl_built_in_function (new_decl
, NOT_BUILT_IN
, 0);
490 DECL_VIRTUAL_P (new_decl
) = 0;
491 DECL_LANG_SPECIFIC (new_decl
) = NULL
;
493 /* Drop MALLOC attribute for a void function. */
495 DECL_IS_MALLOC (new_decl
) = 0;
500 /* Wrapper around get_base_ref_and_offset for cases interesting for IPA-SRA
501 transformations. Return true if EXPR has an interesting form and fill in
502 *BASE_P and *UNIT_OFFSET_P with the appropriate info. */
505 isra_get_ref_base_and_offset (tree expr
, tree
*base_p
, unsigned *unit_offset_p
)
507 HOST_WIDE_INT offset
, size
;
510 = get_ref_base_and_extent_hwi (expr
, &offset
, &size
, &reverse
);
511 if (!base
|| size
< 0)
514 if ((offset
% BITS_PER_UNIT
) != 0)
517 if (TREE_CODE (base
) == MEM_REF
)
519 poly_int64 plmoff
= mem_ref_offset (base
).force_shwi ();
521 bool is_cst
= plmoff
.is_constant (&moff
);
524 offset
+= moff
* BITS_PER_UNIT
;
525 base
= TREE_OPERAND (base
, 0);
528 if (offset
< 0 || (offset
/ BITS_PER_UNIT
) > UINT_MAX
)
532 *unit_offset_p
= offset
/ BITS_PER_UNIT
;
536 /* Modify actual arguments of a function call in statement currently belonging
537 to CS, and make it call CS->callee->decl. Return the new statement that
538 replaced the old one. When invoked, cfun and current_function_decl have to
539 be set to the caller. */
542 ipa_param_adjustments::modify_call (cgraph_edge
*cs
,
543 bool update_references
)
545 gcall
*stmt
= cs
->call_stmt
;
546 tree callee_decl
= cs
->callee
->decl
;
548 ipa_edge_modification_info
*mod_info
549 = ipa_edge_modifications
? ipa_edge_modifications
->get (cs
) : NULL
;
550 if (mod_info
&& symtab
->dump_file
)
552 fprintf (symtab
->dump_file
, "Information about pre-exiting "
553 "modifications.\n Index map:");
554 unsigned idx_len
= mod_info
->index_map
.length ();
555 for (unsigned i
= 0; i
< idx_len
; i
++)
556 fprintf (symtab
->dump_file
, " %i", mod_info
->index_map
[i
]);
557 fprintf (symtab
->dump_file
, "\n Pass-through split map: ");
558 unsigned ptm_len
= mod_info
->pass_through_map
.length ();
559 for (unsigned i
= 0; i
< ptm_len
; i
++)
560 fprintf (symtab
->dump_file
,
561 " (base_index: %u, offset: %u, new_index: %i)",
562 mod_info
->pass_through_map
[i
].base_index
,
563 mod_info
->pass_through_map
[i
].unit_offset
,
564 mod_info
->pass_through_map
[i
].new_index
);
565 fprintf (symtab
->dump_file
, "\n Always-copy delta: %i\n",
566 mod_info
->always_copy_delta
);
569 unsigned len
= vec_safe_length (m_adj_params
);
570 auto_vec
<tree
, 16> vargs (len
);
571 unsigned old_nargs
= gimple_call_num_args (stmt
);
572 unsigned orig_nargs
= mod_info
? mod_info
->index_map
.length () : old_nargs
;
573 auto_vec
<bool, 16> kept (old_nargs
);
574 kept
.quick_grow_cleared (old_nargs
);
576 cgraph_node
*current_node
= cgraph_node::get (current_function_decl
);
577 if (update_references
)
578 current_node
->remove_stmt_references (stmt
);
580 gimple_stmt_iterator gsi
= gsi_for_stmt (stmt
);
581 gimple_stmt_iterator prev_gsi
= gsi
;
582 gsi_prev (&prev_gsi
);
583 for (unsigned i
= 0; i
< len
; i
++)
585 ipa_adjusted_param
*apm
= &(*m_adj_params
)[i
];
586 if (apm
->op
== IPA_PARAM_OP_COPY
)
588 int index
= apm
->base_index
;
589 if ((unsigned) index
>= orig_nargs
)
590 /* Can happen if the original call has argument mismatch,
595 index
= mod_info
->index_map
[apm
->base_index
];
596 gcc_assert (index
>= 0);
599 tree arg
= gimple_call_arg (stmt
, index
);
601 vargs
.quick_push (arg
);
606 /* At the moment the only user of IPA_PARAM_OP_NEW modifies calls itself.
607 If we ever want to support it during WPA IPA stage, we'll need a
608 mechanism to call into the IPA passes that introduced them. Currently
609 we simply mandate that IPA infrastructure understands all argument
610 modifications. Remember, edge redirection/modification is done only
611 once, not in steps for each pass modifying the callee like clone
613 gcc_assert (apm
->op
== IPA_PARAM_OP_SPLIT
);
615 /* We have to handle pass-through changes differently using the map
616 clone materialziation might have left behind. */
617 tree repl
= NULL_TREE
;
618 unsigned ptm_len
= mod_info
? mod_info
->pass_through_map
.length () : 0;
619 for (unsigned j
= 0; j
< ptm_len
; j
++)
620 if (mod_info
->pass_through_map
[j
].base_index
== apm
->base_index
621 && mod_info
->pass_through_map
[j
].unit_offset
== apm
->unit_offset
)
623 int repl_idx
= mod_info
->pass_through_map
[j
].new_index
;
624 gcc_assert (repl_idx
>= 0);
625 repl
= gimple_call_arg (stmt
, repl_idx
);
630 vargs
.quick_push (repl
);
634 int index
= apm
->base_index
;
635 if ((unsigned) index
>= orig_nargs
)
636 /* Can happen if the original call has argument mismatch, ignore. */
640 index
= mod_info
->index_map
[apm
->base_index
];
641 gcc_assert (index
>= 0);
643 tree base
= gimple_call_arg (stmt
, index
);
645 /* We create a new parameter out of the value of the old one, we can
646 do the following kind of transformations:
648 - A scalar passed by reference, potentially as a part of a larger
649 aggregate, is converted to a scalar passed by value.
651 - A part of an aggregate is passed instead of the whole aggregate. */
653 location_t loc
= gimple_location (stmt
);
655 bool deref_base
= false;
656 unsigned int deref_align
= 0;
657 if (TREE_CODE (base
) != ADDR_EXPR
658 && is_gimple_reg_type (TREE_TYPE (base
)))
660 /* Detect type mismatches in calls in invalid programs and make a
661 poor attempt to gracefully convert them so that we don't ICE. */
662 if (!POINTER_TYPE_P (TREE_TYPE (base
)))
663 base
= force_value_to_type (ptr_type_node
, base
);
665 off
= build_int_cst (apm
->alias_ptr_type
, apm
->unit_offset
);
670 if (TREE_CODE (base
) == ADDR_EXPR
)
672 base
= TREE_OPERAND (base
, 0);
678 tree prev_base
= base
;
679 poly_int64 base_offset
;
680 base
= get_addr_base_and_unit_offset (base
, &base_offset
);
682 /* Aggregate arguments can have non-invariant addresses. */
685 base
= build_fold_addr_expr (prev_base
);
686 off
= build_int_cst (apm
->alias_ptr_type
, apm
->unit_offset
);
688 else if (TREE_CODE (base
) == MEM_REF
)
693 deref_align
= TYPE_ALIGN (TREE_TYPE (base
));
695 off
= build_int_cst (apm
->alias_ptr_type
,
696 base_offset
+ apm
->unit_offset
);
697 off
= int_const_binop (PLUS_EXPR
, TREE_OPERAND (base
, 1),
699 base
= TREE_OPERAND (base
, 0);
703 off
= build_int_cst (apm
->alias_ptr_type
,
704 base_offset
+ apm
->unit_offset
);
705 base
= build_fold_addr_expr (base
);
709 tree type
= apm
->type
;
711 unsigned HOST_WIDE_INT misalign
;
720 get_pointer_alignment_1 (base
, &align
, &misalign
);
721 /* All users must make sure that we can be optimistic when it
722 comes to alignment in this case (by inspecting the final users
723 of these new parameters). */
724 if (TYPE_ALIGN (type
) > align
)
725 align
= TYPE_ALIGN (type
);
728 += (offset_int::from (wi::to_wide (off
), SIGNED
).to_short_addr ()
730 misalign
= misalign
& (align
- 1);
732 align
= least_bit_hwi (misalign
);
733 if (align
< TYPE_ALIGN (type
))
734 type
= build_aligned_type (type
, align
);
735 base
= force_gimple_operand_gsi (&gsi
, base
,
736 true, NULL
, true, GSI_SAME_STMT
);
737 tree expr
= fold_build2_loc (loc
, MEM_REF
, type
, base
, off
);
738 REF_REVERSE_STORAGE_ORDER (expr
) = apm
->reverse
;
739 /* If expr is not a valid gimple call argument emit
740 a load into a temporary. */
741 if (is_gimple_reg_type (TREE_TYPE (expr
)))
743 gimple
*tem
= gimple_build_assign (NULL_TREE
, expr
);
744 if (gimple_in_ssa_p (cfun
))
746 gimple_set_vuse (tem
, gimple_vuse (stmt
));
747 expr
= make_ssa_name (TREE_TYPE (expr
), tem
);
750 expr
= create_tmp_reg (TREE_TYPE (expr
));
751 gimple_assign_set_lhs (tem
, expr
);
752 gsi_insert_before (&gsi
, tem
, GSI_SAME_STMT
);
754 vargs
.quick_push (expr
);
757 if (m_always_copy_start
>= 0)
759 int always_copy_start
= m_always_copy_start
;
762 always_copy_start
+= mod_info
->always_copy_delta
;
763 gcc_assert (always_copy_start
>= 0);
765 for (unsigned i
= always_copy_start
; i
< old_nargs
; i
++)
766 vargs
.safe_push (gimple_call_arg (stmt
, i
));
769 /* For optimized away parameters, add on the caller side
771 DEBUG D#X => parm_Y(D)
772 stmts and associate D#X with parm in decl_debug_args_lookup
773 vector to say for debug info that if parameter parm had been passed,
774 it would have value parm_Y(D). */
775 tree old_decl
= gimple_call_fndecl (stmt
);
776 if (MAY_HAVE_DEBUG_BIND_STMTS
&& old_decl
&& callee_decl
)
778 vec
<tree
, va_gc
> **debug_args
= NULL
;
780 cgraph_node
*callee_node
= cgraph_node::get (callee_decl
);
782 /* FIXME: we don't seem to be able to insert debug args before clone
783 is materialized. Materializing them early leads to extra memory
785 if (callee_node
->clone_of
)
786 callee_node
->get_untransformed_body ();
787 for (tree old_parm
= DECL_ARGUMENTS (old_decl
);
788 old_parm
&& i
< old_nargs
&& ((int) i
) < m_always_copy_start
;
789 old_parm
= DECL_CHAIN (old_parm
), i
++)
791 if (!is_gimple_reg (old_parm
) || kept
[i
])
796 if (mod_info
->index_map
[i
] < 0)
798 arg
= gimple_call_arg (stmt
, mod_info
->index_map
[i
]);
801 arg
= gimple_call_arg (stmt
, i
);
803 tree origin
= DECL_ORIGIN (old_parm
);
804 if (!useless_type_conversion_p (TREE_TYPE (origin
), TREE_TYPE (arg
)))
806 if (!fold_convertible_p (TREE_TYPE (origin
), arg
))
809 if (TREE_CODE (arg
) == SSA_NAME
810 && gimple_assign_cast_p (SSA_NAME_DEF_STMT (arg
))
812 = gimple_assign_rhs1 (SSA_NAME_DEF_STMT (arg
)))
813 && useless_type_conversion_p (TREE_TYPE (origin
),
817 arg
= fold_convert_loc (gimple_location (stmt
),
818 TREE_TYPE (origin
), arg
);
820 if (debug_args
== NULL
)
821 debug_args
= decl_debug_args_insert (callee_decl
);
823 tree ddecl
= NULL_TREE
;
824 for (ix
= 0; vec_safe_iterate (*debug_args
, ix
, &ddecl
); ix
+= 2)
827 ddecl
= (**debug_args
)[ix
+ 1];
832 ddecl
= make_node (DEBUG_EXPR_DECL
);
833 DECL_ARTIFICIAL (ddecl
) = 1;
834 TREE_TYPE (ddecl
) = TREE_TYPE (origin
);
835 SET_DECL_MODE (ddecl
, DECL_MODE (origin
));
837 vec_safe_push (*debug_args
, origin
);
838 vec_safe_push (*debug_args
, ddecl
);
840 gimple
*def_temp
= gimple_build_debug_bind (ddecl
,
841 unshare_expr (arg
), stmt
);
842 gsi_insert_before (&gsi
, def_temp
, GSI_SAME_STMT
);
846 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
848 fprintf (dump_file
, "replacing stmt:");
849 print_gimple_stmt (dump_file
, gsi_stmt (gsi
), 0);
852 gcall
*new_stmt
= gimple_build_call_vec (callee_decl
, vargs
);
854 tree ssa_to_remove
= NULL
;
855 if (tree lhs
= gimple_call_lhs (stmt
))
858 gimple_call_set_lhs (new_stmt
, lhs
);
859 else if (TREE_CODE (lhs
) == SSA_NAME
)
861 /* LHS should now by a default-def SSA. Unfortunately default-def
862 SSA_NAMEs need a backing variable (or at least some code examining
863 SSAs assumes it is non-NULL). So we either have to re-use the
864 decl we have at hand or introdice a new one. */
865 tree repl
= create_tmp_var (TREE_TYPE (lhs
), "removed_return");
866 repl
= get_or_create_ssa_default_def (cfun
, repl
);
867 SSA_NAME_IS_DEFAULT_DEF (repl
) = true;
871 FOR_EACH_IMM_USE_STMT (using_stmt
, ui
, lhs
)
873 FOR_EACH_IMM_USE_ON_STMT (use_p
, ui
)
875 SET_USE (use_p
, repl
);
877 update_stmt (using_stmt
);
883 gimple_set_block (new_stmt
, gimple_block (stmt
));
884 if (gimple_has_location (stmt
))
885 gimple_set_location (new_stmt
, gimple_location (stmt
));
886 gimple_call_set_chain (new_stmt
, gimple_call_chain (stmt
));
887 gimple_call_copy_flags (new_stmt
, stmt
);
888 if (gimple_in_ssa_p (cfun
))
889 gimple_move_vops (new_stmt
, stmt
);
891 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
893 fprintf (dump_file
, "with stmt:");
894 print_gimple_stmt (dump_file
, new_stmt
, 0);
895 fprintf (dump_file
, "\n");
897 gsi_replace (&gsi
, new_stmt
, true);
899 release_ssa_name (ssa_to_remove
);
900 if (update_references
)
903 current_node
->record_stmt_references (gsi_stmt (gsi
));
906 while (gsi_stmt (gsi
) != gsi_stmt (prev_gsi
));
909 ipa_edge_modifications
->remove (cs
);
913 /* Dump information contained in the object in textual form to F. */
916 ipa_param_adjustments::dump (FILE *f
)
918 fprintf (f
, " m_always_copy_start: %i\n", m_always_copy_start
);
919 ipa_dump_adjusted_parameters (f
, m_adj_params
);
921 fprintf (f
, " Will SKIP return.\n");
924 /* Dump information contained in the object in textual form to stderr. */
927 ipa_param_adjustments::debug ()
932 /* Register that REPLACEMENT should replace parameter described in APM. */
935 ipa_param_body_adjustments::register_replacement (ipa_adjusted_param
*apm
,
938 gcc_checking_assert (apm
->op
== IPA_PARAM_OP_SPLIT
939 || apm
->op
== IPA_PARAM_OP_NEW
);
940 gcc_checking_assert (!apm
->prev_clone_adjustment
);
941 ipa_param_body_replacement psr
;
942 psr
.base
= m_oparms
[apm
->prev_clone_index
];
943 psr
.repl
= replacement
;
944 psr
.dummy
= NULL_TREE
;
945 psr
.unit_offset
= apm
->unit_offset
;
946 m_replacements
.safe_push (psr
);
949 /* Copy or not, as appropriate given m_id and decl context, a pre-existing
950 PARM_DECL T so that it can be included in the parameters of the modified
954 ipa_param_body_adjustments::carry_over_param (tree t
)
959 new_parm
= remap_decl (t
, m_id
);
960 if (TREE_CODE (new_parm
) != PARM_DECL
)
961 new_parm
= m_id
->copy_decl (t
, m_id
);
963 else if (DECL_CONTEXT (t
) != m_fndecl
)
965 new_parm
= copy_node (t
);
966 DECL_CONTEXT (new_parm
) = m_fndecl
;
973 /* Populate m_dead_stmts given that DEAD_PARAM is going to be removed without
974 any replacement or splitting. REPL is the replacement VAR_SECL to base any
975 remaining uses of a removed parameter on. */
978 ipa_param_body_adjustments::mark_dead_statements (tree dead_param
)
980 /* Current IPA analyses which remove unused parameters never remove a
981 non-gimple register ones which have any use except as parameters in other
982 calls, so we can safely leve them as they are. */
983 if (!is_gimple_reg (dead_param
))
985 tree parm_ddef
= ssa_default_def (m_id
->src_cfun
, dead_param
);
986 if (!parm_ddef
|| has_zero_uses (parm_ddef
))
989 auto_vec
<tree
, 4> stack
;
990 m_dead_ssas
.add (parm_ddef
);
991 stack
.safe_push (parm_ddef
);
992 while (!stack
.is_empty ())
994 imm_use_iterator imm_iter
;
996 tree t
= stack
.pop ();
998 insert_decl_map (m_id
, t
, error_mark_node
);
999 FOR_EACH_IMM_USE_FAST (use_p
, imm_iter
, t
)
1001 gimple
*stmt
= USE_STMT (use_p
);
1003 /* Calls containing dead arguments cannot be deleted,
1004 modify_call_stmt will instead remove just the argument later on.
1005 If isra_track_scalar_value_uses in ipa-sra.c is extended to look
1006 through const functions, we will need to do so here too. */
1007 if (is_gimple_call (stmt
)
1008 || (m_id
->blocks_to_copy
1009 && !bitmap_bit_p (m_id
->blocks_to_copy
,
1010 gimple_bb (stmt
)->index
)))
1013 if (is_gimple_debug (stmt
))
1015 m_dead_stmts
.add (stmt
);
1016 gcc_assert (gimple_debug_bind_p (stmt
));
1018 else if (gimple_code (stmt
) == GIMPLE_PHI
)
1020 gphi
*phi
= as_a
<gphi
*> (stmt
);
1021 int ix
= PHI_ARG_INDEX_FROM_USE (use_p
);
1023 if (!m_id
->blocks_to_copy
1024 || bitmap_bit_p (m_id
->blocks_to_copy
,
1025 gimple_phi_arg_edge (phi
, ix
)->src
->index
))
1027 m_dead_stmts
.add (phi
);
1028 tree res
= gimple_phi_result (phi
);
1029 if (!m_dead_ssas
.add (res
))
1030 stack
.safe_push (res
);
1033 else if (is_gimple_assign (stmt
))
1035 m_dead_stmts
.add (stmt
);
1036 if (!gimple_clobber_p (stmt
))
1038 tree lhs
= gimple_assign_lhs (stmt
);
1039 gcc_assert (TREE_CODE (lhs
) == SSA_NAME
);
1040 if (!m_dead_ssas
.add (lhs
))
1041 stack
.safe_push (lhs
);
1045 /* IPA-SRA does not analyze other types of statements. */
1051 /* Common initialization performed by all ipa_param_body_adjustments
1052 constructors. OLD_FNDECL is the declaration we take original arguments
1053 from, (it may be the same as M_FNDECL). VARS, if non-NULL, is a pointer to
1054 a chained list of new local variables. TREE_MAP is the IPA-CP produced
1055 mapping of trees to constants.
1057 The function is rather long but it really onlu initializes all data members
1058 of the class. It creates new param DECLs, finds their new types, */
1061 ipa_param_body_adjustments::common_initialization (tree old_fndecl
,
1063 vec
<ipa_replace_map
*,
1066 push_function_arg_decls (&m_oparms
, old_fndecl
);
1067 auto_vec
<tree
,16> otypes
;
1068 if (TYPE_ARG_TYPES (TREE_TYPE (old_fndecl
)) != NULL_TREE
)
1069 push_function_arg_types (&otypes
, TREE_TYPE (old_fndecl
));
1072 auto_vec
<tree
,16> oparms
;
1073 push_function_arg_decls (&oparms
, old_fndecl
);
1074 unsigned ocount
= oparms
.length ();
1075 otypes
.reserve_exact (ocount
);
1076 for (unsigned i
= 0; i
< ocount
; i
++)
1077 otypes
.quick_push (TREE_TYPE (oparms
[i
]));
1079 fill_vector_of_new_param_types (&m_new_types
, &otypes
, m_adj_params
, true);
1081 auto_vec
<bool, 16> kept
;
1082 kept
.reserve_exact (m_oparms
.length ());
1083 kept
.quick_grow_cleared (m_oparms
.length ());
1084 auto_vec
<bool, 16> split
;
1085 split
.reserve_exact (m_oparms
.length ());
1086 split
.quick_grow_cleared (m_oparms
.length ());
1088 unsigned adj_len
= vec_safe_length (m_adj_params
);
1089 m_method2func
= ((TREE_CODE (TREE_TYPE (m_fndecl
)) == METHOD_TYPE
)
1091 || (*m_adj_params
)[0].op
!= IPA_PARAM_OP_COPY
1092 || (*m_adj_params
)[0].base_index
!= 0));
1094 /* The main job of the this function is to go over the vector of adjusted
1095 parameters and create declarations or find corresponding old ones and push
1096 them to m_new_decls. For IPA-SRA replacements it also creates
1097 corresponding m_id->dst_node->clone.performed_splits entries. */
1099 m_new_decls
.reserve_exact (adj_len
);
1100 for (unsigned i
= 0; i
< adj_len
; i
++)
1102 ipa_adjusted_param
*apm
= &(*m_adj_params
)[i
];
1103 unsigned prev_index
= apm
->prev_clone_index
;
1105 if (apm
->op
== IPA_PARAM_OP_COPY
1106 || apm
->prev_clone_adjustment
)
1108 kept
[prev_index
] = true;
1109 new_parm
= carry_over_param (m_oparms
[prev_index
]);
1110 m_new_decls
.quick_push (new_parm
);
1112 else if (apm
->op
== IPA_PARAM_OP_NEW
1113 || apm
->op
== IPA_PARAM_OP_SPLIT
)
1115 tree new_type
= m_new_types
[i
];
1116 gcc_checking_assert (new_type
);
1117 new_parm
= build_decl (UNKNOWN_LOCATION
, PARM_DECL
, NULL_TREE
,
1119 const char *prefix
= ipa_param_prefixes
[apm
->param_prefix_index
];
1120 DECL_NAME (new_parm
) = create_tmp_var_name (prefix
);
1121 DECL_ARTIFICIAL (new_parm
) = 1;
1122 DECL_ARG_TYPE (new_parm
) = new_type
;
1123 DECL_CONTEXT (new_parm
) = m_fndecl
;
1124 TREE_USED (new_parm
) = 1;
1125 DECL_IGNORED_P (new_parm
) = 1;
1126 layout_decl (new_parm
, 0);
1127 m_new_decls
.quick_push (new_parm
);
1129 if (apm
->op
== IPA_PARAM_OP_SPLIT
)
1131 m_split_modifications_p
= true;
1132 split
[prev_index
] = true;
1133 register_replacement (apm
, new_parm
);
1141 /* As part of body modifications, we will also have to replace remaining uses
1142 of remaining uses of removed PARM_DECLs (which do not however use the
1143 initial value) with their VAR_DECL copies.
1145 We do this differently with and without m_id. With m_id, we rely on its
1146 mapping and create a replacement straight away. Without it, we have our
1147 own mechanism for which we have to populate m_removed_decls vector. Just
1148 don't mix them, that is why you should not call
1149 replace_removed_params_ssa_names or perform_cfun_body_modifications when
1150 you construct with ID not equal to NULL. */
1152 unsigned op_len
= m_oparms
.length ();
1153 for (unsigned i
= 0; i
< op_len
; i
++)
1158 if (!m_id
->decl_map
->get (m_oparms
[i
]))
1160 tree var
= copy_decl_to_var (m_oparms
[i
], m_id
);
1161 insert_decl_map (m_id
, m_oparms
[i
], var
);
1162 /* Declare this new variable. */
1163 DECL_CHAIN (var
) = *vars
;
1166 /* If this is not a split but a real removal, init hash sets
1167 that will guide what not to copy to the new body. */
1169 mark_dead_statements (m_oparms
[i
]);
1174 m_removed_decls
.safe_push (m_oparms
[i
]);
1175 m_removed_map
.put (m_oparms
[i
], m_removed_decls
.length () - 1);
1179 if (!MAY_HAVE_DEBUG_STMTS
)
1182 /* Finally, when generating debug info, we fill vector m_reset_debug_decls
1183 with removed parameters declarations. We do this in order to re-map their
1184 debug bind statements and create debug decls for them. */
1188 /* Do not output debuginfo for parameter declarations as if they vanished
1189 when they were in fact replaced by a constant. */
1190 auto_vec
<int, 16> index_mapping
;
1191 bool need_remap
= false;
1192 clone_info
*info
= clone_info::get (m_id
->src_node
);
1194 if (m_id
&& info
&& info
->param_adjustments
)
1196 ipa_param_adjustments
*prev_adjustments
= info
->param_adjustments
;
1197 prev_adjustments
->get_updated_indices (&index_mapping
);
1201 for (unsigned i
= 0; i
< tree_map
->length (); i
++)
1203 int parm_num
= (*tree_map
)[i
]->parm_num
;
1204 gcc_assert (parm_num
>= 0);
1206 parm_num
= index_mapping
[parm_num
];
1207 kept
[parm_num
] = true;
1211 for (unsigned i
= 0; i
< op_len
; i
++)
1212 if (!kept
[i
] && is_gimple_reg (m_oparms
[i
]))
1213 m_reset_debug_decls
.safe_push (m_oparms
[i
]);
1216 /* Constructor of ipa_param_body_adjustments from a simple list of
1217 modifications to parameters listed in ADJ_PARAMS which will prepare ground
1218 for modification of parameters of fndecl. Return value of the function will
1219 not be removed and the object will assume it does not run as a part of
1220 tree-function_versioning. */
1222 ipa_param_body_adjustments
1223 ::ipa_param_body_adjustments (vec
<ipa_adjusted_param
, va_gc
> *adj_params
,
1225 : m_adj_params (adj_params
), m_adjustments (NULL
), m_reset_debug_decls (),
1226 m_split_modifications_p (false), m_dead_stmts (), m_dead_ssas (),
1227 m_fndecl (fndecl
), m_id (NULL
), m_oparms (), m_new_decls (),
1228 m_new_types (), m_replacements (), m_removed_decls (), m_removed_map (),
1229 m_method2func (false)
1231 common_initialization (fndecl
, NULL
, NULL
);
1234 /* Constructor of ipa_param_body_adjustments from ipa_param_adjustments in
1235 ADJUSTMENTS which will prepare ground for modification of parameters of
1236 fndecl. The object will assume it does not run as a part of
1237 tree-function_versioning. */
1239 ipa_param_body_adjustments
1240 ::ipa_param_body_adjustments (ipa_param_adjustments
*adjustments
,
1242 : m_adj_params (adjustments
->m_adj_params
), m_adjustments (adjustments
),
1243 m_reset_debug_decls (), m_split_modifications_p (false), m_dead_stmts (),
1244 m_dead_ssas (), m_fndecl (fndecl
), m_id (NULL
), m_oparms (), m_new_decls (),
1245 m_new_types (), m_replacements (), m_removed_decls (), m_removed_map (),
1246 m_method2func (false)
1248 common_initialization (fndecl
, NULL
, NULL
);
1251 /* Constructor of ipa_param_body_adjustments which sets it up as a part of
1252 running tree_function_versioning. Planned modifications to the function are
1253 in ADJUSTMENTS. FNDECL designates the new function clone which is being
1254 modified. OLD_FNDECL is the function of which FNDECL is a clone (and which
1255 at the time of invocation still share DECL_ARGUMENTS). ID is the
1256 copy_body_data structure driving the wholy body copying process. VARS is a
1257 pointer to the head of the list of new local variables, TREE_MAP is the map
1258 that drives tree substitution in the cloning process. */
1260 ipa_param_body_adjustments
1261 ::ipa_param_body_adjustments (ipa_param_adjustments
*adjustments
,
1262 tree fndecl
, tree old_fndecl
,
1263 copy_body_data
*id
, tree
*vars
,
1264 vec
<ipa_replace_map
*, va_gc
> *tree_map
)
1265 : m_adj_params (adjustments
->m_adj_params
), m_adjustments (adjustments
),
1266 m_reset_debug_decls (), m_split_modifications_p (false), m_dead_stmts (),
1267 m_dead_ssas (),m_fndecl (fndecl
), m_id (id
), m_oparms (), m_new_decls (),
1268 m_new_types (), m_replacements (), m_removed_decls (), m_removed_map (),
1269 m_method2func (false)
1271 common_initialization (old_fndecl
, vars
, tree_map
);
1274 /* Chain new param decls up and return them. */
1277 ipa_param_body_adjustments::get_new_param_chain ()
1280 tree
*link
= &result
;
1282 unsigned len
= vec_safe_length (m_adj_params
);
1283 for (unsigned i
= 0; i
< len
; i
++)
1285 tree new_decl
= m_new_decls
[i
];
1287 link
= &DECL_CHAIN (new_decl
);
1293 /* Modify the function parameters FNDECL and its type according to the plan in
1294 ADJUSTMENTS. This function needs to be called when the decl has not already
1295 been processed with ipa_param_adjustments::adjust_decl, otherwise just
1296 seting DECL_ARGUMENTS to whatever get_new_param_chain will do is enough. */
1299 ipa_param_body_adjustments::modify_formal_parameters ()
1301 tree orig_type
= TREE_TYPE (m_fndecl
);
1302 DECL_ARGUMENTS (m_fndecl
) = get_new_param_chain ();
1304 /* When signature changes, we need to clear builtin info. */
1305 if (fndecl_built_in_p (m_fndecl
))
1306 set_decl_built_in_function (m_fndecl
, NOT_BUILT_IN
, 0);
1308 /* At this point, removing return value is only implemented when going
1309 through tree_function_versioning, not when modifying function body
1311 gcc_assert (!m_adjustments
|| !m_adjustments
->m_skip_return
);
1312 tree new_type
= build_adjusted_function_type (orig_type
, &m_new_types
,
1313 m_method2func
, false);
1315 TREE_TYPE (m_fndecl
) = new_type
;
1316 DECL_VIRTUAL_P (m_fndecl
) = 0;
1317 DECL_LANG_SPECIFIC (m_fndecl
) = NULL
;
1319 DECL_VINDEX (m_fndecl
) = NULL_TREE
;
1322 /* Given BASE and UNIT_OFFSET, find the corresponding record among replacement
1325 ipa_param_body_replacement
*
1326 ipa_param_body_adjustments::lookup_replacement_1 (tree base
,
1327 unsigned unit_offset
)
1329 unsigned int len
= m_replacements
.length ();
1330 for (unsigned i
= 0; i
< len
; i
++)
1332 ipa_param_body_replacement
*pbr
= &m_replacements
[i
];
1334 if (pbr
->base
== base
1335 && (pbr
->unit_offset
== unit_offset
))
1341 /* Given BASE and UNIT_OFFSET, find the corresponding replacement expression
1342 and return it, assuming it is known it does not hold value by reference or
1343 in reverse storage order. */
1346 ipa_param_body_adjustments::lookup_replacement (tree base
, unsigned unit_offset
)
1348 ipa_param_body_replacement
*pbr
= lookup_replacement_1 (base
, unit_offset
);
1354 /* If T is an SSA_NAME, return NULL if it is not a default def or
1355 return its base variable if it is. If IGNORE_DEFAULT_DEF is true,
1356 the base variable is always returned, regardless if it is a default
1357 def. Return T if it is not an SSA_NAME. */
1360 get_ssa_base_param (tree t
, bool ignore_default_def
)
1362 if (TREE_CODE (t
) == SSA_NAME
)
1364 if (ignore_default_def
|| SSA_NAME_IS_DEFAULT_DEF (t
))
1365 return SSA_NAME_VAR (t
);
1372 /* Given an expression, return the structure describing how it should be
1373 replaced if it accesses a part of a split parameter or NULL otherwise.
1375 Do not free the result, it will be deallocated when the object is destroyed.
1377 If IGNORE_DEFAULT_DEF is cleared, consider only SSA_NAMEs of PARM_DECLs
1378 which are default definitions, if set, consider all SSA_NAMEs of
1381 ipa_param_body_replacement
*
1382 ipa_param_body_adjustments::get_expr_replacement (tree expr
,
1383 bool ignore_default_def
)
1386 unsigned unit_offset
;
1388 if (!isra_get_ref_base_and_offset (expr
, &base
, &unit_offset
))
1391 base
= get_ssa_base_param (base
, ignore_default_def
);
1392 if (!base
|| TREE_CODE (base
) != PARM_DECL
)
1394 return lookup_replacement_1 (base
, unit_offset
);
1397 /* Given OLD_DECL, which is a PARM_DECL of a parameter that is being removed
1398 (which includes it being split or replaced), return a new variable that
1399 should be used for any SSA names that will remain in the function that
1400 previously belonged to OLD_DECL. */
1403 ipa_param_body_adjustments::get_replacement_ssa_base (tree old_decl
)
1405 unsigned *idx
= m_removed_map
.get (old_decl
);
1410 if (TREE_CODE (m_removed_decls
[*idx
]) == PARM_DECL
)
1412 gcc_assert (m_removed_decls
[*idx
] == old_decl
);
1413 repl
= copy_var_decl (old_decl
, DECL_NAME (old_decl
),
1414 TREE_TYPE (old_decl
));
1415 m_removed_decls
[*idx
] = repl
;
1418 repl
= m_removed_decls
[*idx
];
1422 /* If OLD_NAME, which is being defined by statement STMT, is an SSA_NAME of a
1423 parameter which is to be removed because its value is not used, create a new
1424 SSA_NAME relating to a replacement VAR_DECL, replace all uses of the
1425 original with it and return it. If there is no need to re-map, return NULL.
1426 ADJUSTMENTS is a pointer to a vector of IPA-SRA adjustments. */
1429 ipa_param_body_adjustments::replace_removed_params_ssa_names (tree old_name
,
1433 if (TREE_CODE (old_name
) != SSA_NAME
)
1436 tree decl
= SSA_NAME_VAR (old_name
);
1437 if (decl
== NULL_TREE
1438 || TREE_CODE (decl
) != PARM_DECL
)
1441 tree repl
= get_replacement_ssa_base (decl
);
1445 tree new_name
= make_ssa_name (repl
, stmt
);
1446 SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_name
)
1447 = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (old_name
);
1449 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1451 fprintf (dump_file
, "replacing an SSA name of a removed param ");
1452 print_generic_expr (dump_file
, old_name
);
1453 fprintf (dump_file
, " with ");
1454 print_generic_expr (dump_file
, new_name
);
1455 fprintf (dump_file
, "\n");
1458 replace_uses_by (old_name
, new_name
);
1462 /* If the expression *EXPR_P should be replaced, do so. CONVERT specifies
1463 whether the function should care about type incompatibility of the current
1464 and new expressions. If it is false, the function will leave
1465 incompatibility issues to the caller - note that when the function
1466 encounters a BIT_FIELD_REF, IMAGPART_EXPR or REALPART_EXPR, it will modify
1467 their bases instead of the expressions themselves and then also performs any
1468 necessary conversions. */
1471 ipa_param_body_adjustments::modify_expression (tree
*expr_p
, bool convert
)
1473 tree expr
= *expr_p
;
1475 if (TREE_CODE (expr
) == BIT_FIELD_REF
1476 || TREE_CODE (expr
) == IMAGPART_EXPR
1477 || TREE_CODE (expr
) == REALPART_EXPR
)
1479 expr_p
= &TREE_OPERAND (expr
, 0);
1484 ipa_param_body_replacement
*pbr
= get_expr_replacement (expr
, false);
1488 tree repl
= pbr
->repl
;
1489 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1491 fprintf (dump_file
, "About to replace expr ");
1492 print_generic_expr (dump_file
, expr
);
1493 fprintf (dump_file
, " with ");
1494 print_generic_expr (dump_file
, repl
);
1495 fprintf (dump_file
, "\n");
1498 if (convert
&& !useless_type_conversion_p (TREE_TYPE (expr
),
1501 tree vce
= build1 (VIEW_CONVERT_EXPR
, TREE_TYPE (expr
), repl
);
1509 /* If the assignment statement STMT contains any expressions that need to
1510 replaced with a different one as noted by ADJUSTMENTS, do so. Handle any
1511 potential type incompatibilities. If any conversion sttements have to be
1512 pre-pended to STMT, they will be added to EXTRA_STMTS. Return true iff the
1513 statement was modified. */
1516 ipa_param_body_adjustments::modify_assignment (gimple
*stmt
,
1517 gimple_seq
*extra_stmts
)
1519 tree
*lhs_p
, *rhs_p
;
1522 if (!gimple_assign_single_p (stmt
))
1525 rhs_p
= gimple_assign_rhs1_ptr (stmt
);
1526 lhs_p
= gimple_assign_lhs_ptr (stmt
);
1528 any
= modify_expression (lhs_p
, false);
1529 any
|= modify_expression (rhs_p
, false);
1531 && !useless_type_conversion_p (TREE_TYPE (*lhs_p
), TREE_TYPE (*rhs_p
)))
1533 if (TREE_CODE (*rhs_p
) == CONSTRUCTOR
)
1535 /* V_C_Es of constructors can cause trouble (PR 42714). */
1536 if (is_gimple_reg_type (TREE_TYPE (*lhs_p
)))
1537 *rhs_p
= build_zero_cst (TREE_TYPE (*lhs_p
));
1539 *rhs_p
= build_constructor (TREE_TYPE (*lhs_p
),
1544 tree new_rhs
= fold_build1_loc (gimple_location (stmt
),
1545 VIEW_CONVERT_EXPR
, TREE_TYPE (*lhs_p
),
1547 tree tmp
= force_gimple_operand (new_rhs
, extra_stmts
, true,
1549 gimple_assign_set_rhs1 (stmt
, tmp
);
1557 /* Record information about what modifications to call arguments have already
1558 been done by clone materialization into a summary describing CS. The
1559 information is stored in NEW_INDEX_MAP, NEW_PT_MAP and NEW_ALWAYS_COPY_DELTA
1560 and correspond to equivalent fields in ipa_edge_modification_info. Return
1561 the edge summary. */
1563 static ipa_edge_modification_info
*
1564 record_argument_state_1 (cgraph_edge
*cs
, const vec
<int> &new_index_map
,
1565 const vec
<pass_through_split_map
> &new_pt_map
,
1566 int new_always_copy_delta
)
1569 ipa_edge_modification_info
*sum
= ipa_edge_modifications
->get_create (cs
);
1571 unsigned len
= sum
->pass_through_map
.length ();
1572 for (unsigned i
= 0; i
< len
; i
++)
1574 unsigned oldnew
= sum
->pass_through_map
[i
].new_index
;
1575 sum
->pass_through_map
[i
].new_index
= new_index_map
[oldnew
];
1578 len
= sum
->index_map
.length ();
1581 unsigned nptlen
= new_pt_map
.length ();
1582 for (unsigned j
= 0; j
< nptlen
; j
++)
1585 for (unsigned i
= 0; i
< len
; i
++)
1586 if ((unsigned) sum
->index_map
[i
] == new_pt_map
[j
].base_index
)
1591 gcc_assert (inverse
>= 0);
1592 pass_through_split_map ptm_item
;
1594 ptm_item
.base_index
= inverse
;
1595 ptm_item
.unit_offset
= new_pt_map
[j
].unit_offset
;
1596 ptm_item
.new_index
= new_pt_map
[j
].new_index
;
1597 sum
->pass_through_map
.safe_push (ptm_item
);
1600 for (unsigned i
= 0; i
< len
; i
++)
1602 int idx
= sum
->index_map
[i
];
1605 sum
->index_map
[i
] = new_index_map
[idx
];
1610 sum
->pass_through_map
.safe_splice (new_pt_map
);
1611 sum
->index_map
.safe_splice (new_index_map
);
1613 sum
->always_copy_delta
+= new_always_copy_delta
;
1617 /* Record information about what modifications to call arguments have already
1618 been done by clone materialization into a summary of an edge describing the
1619 call in this clone and all its clones. NEW_INDEX_MAP, NEW_PT_MAP and
1620 NEW_ALWAYS_COPY_DELTA have the same meaning as record_argument_state_1.
1622 In order to associate the info with the right edge summaries, we need
1623 address of the ORIG_STMT in the function from which we are cloning (because
1624 the edges have not yet been re-assigned to the new statement that has just
1625 been created) and ID, the structure governing function body copying. */
1628 record_argument_state (copy_body_data
*id
, gimple
*orig_stmt
,
1629 const vec
<int> &new_index_map
,
1630 const vec
<pass_through_split_map
> &new_pt_map
,
1631 int new_always_copy_delta
)
1633 if (!ipa_edge_modifications
)
1634 ipa_edge_modifications
= new ipa_edge_modification_sum (symtab
);
1636 struct cgraph_node
*this_node
= id
->dst_node
;
1637 ipa_edge_modification_info
*first_sum
= NULL
;
1638 cgraph_edge
*cs
= this_node
->get_edge (orig_stmt
);
1640 first_sum
= record_argument_state_1 (cs
, new_index_map
, new_pt_map
,
1641 new_always_copy_delta
);
1643 gcc_assert (this_node
->clones
);
1645 if (!this_node
->clones
)
1647 for (cgraph_node
*subclone
= this_node
->clones
; subclone
!= this_node
;)
1649 cs
= subclone
->get_edge (orig_stmt
);
1653 first_sum
= record_argument_state_1 (cs
, new_index_map
, new_pt_map
,
1654 new_always_copy_delta
);
1657 ipa_edge_modification_info
*s2
1658 = ipa_edge_modifications
->get_create (cs
);
1659 s2
->index_map
.truncate (0);
1660 s2
->index_map
.safe_splice (first_sum
->index_map
);
1661 s2
->pass_through_map
.truncate (0);
1662 s2
->pass_through_map
.safe_splice (first_sum
->pass_through_map
);
1663 s2
->always_copy_delta
= first_sum
->always_copy_delta
;
1667 gcc_assert (subclone
->clones
);
1669 if (subclone
->clones
)
1670 subclone
= subclone
->clones
;
1671 else if (subclone
->next_sibling_clone
)
1672 subclone
= subclone
->next_sibling_clone
;
1675 while (subclone
!= this_node
&& !subclone
->next_sibling_clone
)
1676 subclone
= subclone
->clone_of
;
1677 if (subclone
!= this_node
)
1678 subclone
= subclone
->next_sibling_clone
;
1683 /* If the call statement pointed at by STMT_P contains any expressions that
1684 need to replaced with a different one as noted by ADJUSTMENTS, do so. f the
1685 statement needs to be rebuilt, do so. Return true if any modifications have
1686 been performed. ORIG_STMT, if not NULL, is the original statement in the
1687 function that is being cloned from, which at this point can be used to look
1688 up call_graph edges.
1690 If the method is invoked as a part of IPA clone materialization and if any
1691 parameter split is pass-through, i.e. it applies to the functin that is
1692 being modified and also to the callee of the statement, replace the
1693 parameter passed to old callee with all of the replacement a callee might
1694 possibly want and record the performed argument modifications in
1695 ipa_edge_modifications. Likewise if any argument has already been left out
1696 because it is not necessary. */
1699 ipa_param_body_adjustments::modify_call_stmt (gcall
**stmt_p
,
1702 auto_vec
<unsigned, 4> pass_through_args
;
1703 auto_vec
<unsigned, 4> pass_through_pbr_indices
;
1704 auto_vec
<HOST_WIDE_INT
, 4> pass_through_offsets
;
1705 gcall
*stmt
= *stmt_p
;
1706 unsigned nargs
= gimple_call_num_args (stmt
);
1707 bool recreate
= false;
1709 for (unsigned i
= 0; i
< gimple_call_num_args (stmt
); i
++)
1711 tree t
= gimple_call_arg (stmt
, i
);
1712 gcc_assert (TREE_CODE (t
) != BIT_FIELD_REF
1713 && TREE_CODE (t
) != IMAGPART_EXPR
1714 && TREE_CODE (t
) != REALPART_EXPR
);
1716 if (TREE_CODE (t
) == SSA_NAME
1717 && m_dead_ssas
.contains (t
))
1720 if (!m_split_modifications_p
)
1724 unsigned agg_arg_offset
;
1725 if (!isra_get_ref_base_and_offset (t
, &base
, &agg_arg_offset
))
1728 bool by_ref
= false;
1729 if (TREE_CODE (base
) == SSA_NAME
)
1731 if (!SSA_NAME_IS_DEFAULT_DEF (base
))
1733 base
= SSA_NAME_VAR (base
);
1734 gcc_checking_assert (base
);
1737 if (TREE_CODE (base
) != PARM_DECL
)
1740 bool base_among_replacements
= false;
1741 unsigned j
, repl_list_len
= m_replacements
.length ();
1742 for (j
= 0; j
< repl_list_len
; j
++)
1744 ipa_param_body_replacement
*pbr
= &m_replacements
[j
];
1745 if (pbr
->base
== base
)
1747 base_among_replacements
= true;
1751 if (!base_among_replacements
)
1754 /* We still have to distinguish between an end-use that we have to
1755 transform now and a pass-through, which happens in the following
1758 /* TODO: After we adjust ptr_parm_has_nonarg_uses to also consider
1759 &MEM_REF[ssa_name + offset], we will also have to detect that case
1762 if (TREE_CODE (t
) == SSA_NAME
1763 && SSA_NAME_IS_DEFAULT_DEF (t
)
1765 && TREE_CODE (SSA_NAME_VAR (t
)) == PARM_DECL
)
1767 /* This must be a by_reference pass-through. */
1769 gcc_assert (POINTER_TYPE_P (TREE_TYPE (t
)));
1770 pass_through_args
.safe_push (i
);
1771 pass_through_pbr_indices
.safe_push (j
);
1772 pass_through_offsets
.safe_push (agg_arg_offset
);
1774 else if (!by_ref
&& AGGREGATE_TYPE_P (TREE_TYPE (t
)))
1776 /* Currently IPA-SRA guarantees the aggregate access type
1777 exactly matches in this case. So if it does not match, it is
1778 a pass-through argument that will be sorted out at edge
1779 redirection time. */
1780 ipa_param_body_replacement
*pbr
1781 = lookup_replacement_1 (base
, agg_arg_offset
);
1784 || (TYPE_MAIN_VARIANT (TREE_TYPE (t
))
1785 != TYPE_MAIN_VARIANT (TREE_TYPE (pbr
->repl
))))
1788 pass_through_args
.safe_push (i
);
1789 pass_through_pbr_indices
.safe_push (j
);
1790 pass_through_offsets
.safe_push (agg_arg_offset
);
1797 /* No need to rebuild the statement, let's just modify arguments
1798 and the LHS if/as appropriate. */
1799 bool modified
= false;
1800 for (unsigned i
= 0; i
< nargs
; i
++)
1802 tree
*t
= gimple_call_arg_ptr (stmt
, i
);
1803 modified
|= modify_expression (t
, true);
1805 if (gimple_call_lhs (stmt
))
1807 tree
*t
= gimple_call_lhs_ptr (stmt
);
1808 modified
|= modify_expression (t
, false);
1813 auto_vec
<int, 16> index_map
;
1814 auto_vec
<pass_through_split_map
, 4> pass_through_map
;
1815 auto_vec
<tree
, 16> vargs
;
1816 int always_copy_delta
= 0;
1817 unsigned pt_idx
= 0;
1818 int new_arg_idx
= 0;
1819 for (unsigned i
= 0; i
< nargs
; i
++)
1821 if (pt_idx
< pass_through_args
.length ()
1822 && i
== pass_through_args
[pt_idx
])
1824 unsigned j
= pass_through_pbr_indices
[pt_idx
];
1825 unsigned agg_arg_offset
= pass_through_offsets
[pt_idx
];
1827 always_copy_delta
--;
1828 tree base
= m_replacements
[j
].base
;
1830 /* In order to be put into SSA form, we have to push all replacements
1831 pertaining to this parameter as parameters to the call statement.
1832 Edge redirection will need to use edge summary to weed out the
1833 unnecessary ones. */
1834 unsigned repl_list_len
= m_replacements
.length ();
1835 for (; j
< repl_list_len
; j
++)
1837 if (m_replacements
[j
].base
!= base
)
1839 if (m_replacements
[j
].unit_offset
< agg_arg_offset
)
1841 pass_through_split_map pt_map
;
1842 pt_map
.base_index
= i
;
1844 = m_replacements
[j
].unit_offset
- agg_arg_offset
;
1845 pt_map
.new_index
= new_arg_idx
;
1846 pass_through_map
.safe_push (pt_map
);
1847 vargs
.safe_push (m_replacements
[j
].repl
);
1849 always_copy_delta
++;
1851 index_map
.safe_push (-1);
1855 tree t
= gimple_call_arg (stmt
, i
);
1856 if (TREE_CODE (t
) == SSA_NAME
1857 && m_dead_ssas
.contains (t
))
1859 always_copy_delta
--;
1860 index_map
.safe_push (-1);
1864 modify_expression (&t
, true);
1865 vargs
.safe_push (t
);
1866 index_map
.safe_push (new_arg_idx
);
1872 gcall
*new_stmt
= gimple_build_call_vec (gimple_call_fn (stmt
), vargs
);
1873 if (gimple_has_location (stmt
))
1874 gimple_set_location (new_stmt
, gimple_location (stmt
));
1875 gimple_call_set_chain (new_stmt
, gimple_call_chain (stmt
));
1876 gimple_call_copy_flags (new_stmt
, stmt
);
1877 if (tree lhs
= gimple_call_lhs (stmt
))
1879 modify_expression (&lhs
, false);
1880 /* Avoid adjusting SSA_NAME_DEF_STMT of a SSA lhs, SSA names
1881 have not yet been remapped. */
1882 *gimple_call_lhs_ptr (new_stmt
) = lhs
;
1887 record_argument_state (m_id
, orig_stmt
, index_map
, pass_through_map
,
1892 /* If the statement STMT contains any expressions that need to replaced with a
1893 different one as noted by ADJUSTMENTS, do so. Handle any potential type
1894 incompatibilities. If any conversion sttements have to be pre-pended to
1895 STMT, they will be added to EXTRA_STMTS. Return true iff the statement was
1899 ipa_param_body_adjustments::modify_gimple_stmt (gimple
**stmt
,
1900 gimple_seq
*extra_stmts
,
1903 bool modified
= false;
1906 switch (gimple_code (*stmt
))
1909 t
= gimple_return_retval_ptr (as_a
<greturn
*> (*stmt
));
1910 if (m_adjustments
&& m_adjustments
->m_skip_return
)
1912 else if (*t
!= NULL_TREE
)
1913 modified
|= modify_expression (t
, true);
1917 modified
|= modify_assignment (*stmt
, extra_stmts
);
1921 modified
|= modify_call_stmt ((gcall
**) stmt
, orig_stmt
);
1926 gasm
*asm_stmt
= as_a
<gasm
*> (*stmt
);
1927 for (unsigned i
= 0; i
< gimple_asm_ninputs (asm_stmt
); i
++)
1929 t
= &TREE_VALUE (gimple_asm_input_op (asm_stmt
, i
));
1930 modified
|= modify_expression (t
, true);
1932 for (unsigned i
= 0; i
< gimple_asm_noutputs (asm_stmt
); i
++)
1934 t
= &TREE_VALUE (gimple_asm_output_op (asm_stmt
, i
));
1935 modified
|= modify_expression (t
, false);
1947 /* Traverse body of the current function and perform the requested adjustments
1948 on its statements. Return true iff the CFG has been changed. */
1951 ipa_param_body_adjustments::modify_cfun_body ()
1953 bool cfg_changed
= false;
1956 FOR_EACH_BB_FN (bb
, cfun
)
1958 gimple_stmt_iterator gsi
;
1960 for (gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
1962 gphi
*phi
= as_a
<gphi
*> (gsi_stmt (gsi
));
1963 tree new_lhs
, old_lhs
= gimple_phi_result (phi
);
1964 new_lhs
= replace_removed_params_ssa_names (old_lhs
, phi
);
1967 gimple_phi_set_result (phi
, new_lhs
);
1968 release_ssa_name (old_lhs
);
1972 gsi
= gsi_start_bb (bb
);
1973 while (!gsi_end_p (gsi
))
1975 gimple
*stmt
= gsi_stmt (gsi
);
1976 gimple
*stmt_copy
= stmt
;
1977 gimple_seq extra_stmts
= NULL
;
1978 bool modified
= modify_gimple_stmt (&stmt
, &extra_stmts
, NULL
);
1979 if (stmt
!= stmt_copy
)
1981 gcc_checking_assert (modified
);
1982 gsi_replace (&gsi
, stmt
, false);
1984 if (!gimple_seq_empty_p (extra_stmts
))
1985 gsi_insert_seq_before (&gsi
, extra_stmts
, GSI_SAME_STMT
);
1989 FOR_EACH_SSA_DEF_OPERAND (defp
, stmt
, iter
, SSA_OP_DEF
)
1991 tree old_def
= DEF_FROM_PTR (defp
);
1992 if (tree new_def
= replace_removed_params_ssa_names (old_def
,
1995 SET_DEF (defp
, new_def
);
1996 release_ssa_name (old_def
);
2004 if (maybe_clean_eh_stmt (stmt
)
2005 && gimple_purge_dead_eh_edges (gimple_bb (stmt
)))
2015 /* Call gimple_debug_bind_reset_value on all debug statements describing
2016 gimple register parameters that are being removed or replaced. */
2019 ipa_param_body_adjustments::reset_debug_stmts ()
2022 gimple_stmt_iterator
*gsip
= NULL
, gsi
;
2024 if (MAY_HAVE_DEBUG_STMTS
&& single_succ_p (ENTRY_BLOCK_PTR_FOR_FN (cfun
)))
2026 gsi
= gsi_after_labels (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun
)));
2029 len
= m_reset_debug_decls
.length ();
2030 for (i
= 0; i
< len
; i
++)
2032 imm_use_iterator ui
;
2035 tree name
, vexpr
, copy
= NULL_TREE
;
2036 use_operand_p use_p
;
2037 tree decl
= m_reset_debug_decls
[i
];
2039 gcc_checking_assert (is_gimple_reg (decl
));
2040 name
= ssa_default_def (cfun
, decl
);
2043 FOR_EACH_IMM_USE_STMT (stmt
, ui
, name
)
2045 if (gimple_clobber_p (stmt
))
2047 gimple_stmt_iterator cgsi
= gsi_for_stmt (stmt
);
2048 unlink_stmt_vdef (stmt
);
2049 gsi_remove (&cgsi
, true);
2050 release_defs (stmt
);
2053 /* All other users must have been removed by function body
2055 gcc_assert (is_gimple_debug (stmt
));
2056 if (vexpr
== NULL
&& gsip
!= NULL
)
2058 vexpr
= make_node (DEBUG_EXPR_DECL
);
2059 def_temp
= gimple_build_debug_source_bind (vexpr
, decl
, NULL
);
2060 DECL_ARTIFICIAL (vexpr
) = 1;
2061 TREE_TYPE (vexpr
) = TREE_TYPE (name
);
2062 SET_DECL_MODE (vexpr
, DECL_MODE (decl
));
2063 gsi_insert_before (gsip
, def_temp
, GSI_SAME_STMT
);
2067 FOR_EACH_IMM_USE_ON_STMT (use_p
, ui
)
2068 SET_USE (use_p
, vexpr
);
2071 gimple_debug_bind_reset_value (stmt
);
2074 /* Create a VAR_DECL for debug info purposes. */
2075 if (!DECL_IGNORED_P (decl
))
2077 copy
= build_decl (DECL_SOURCE_LOCATION (current_function_decl
),
2078 VAR_DECL
, DECL_NAME (decl
),
2080 if (DECL_PT_UID_SET_P (decl
))
2081 SET_DECL_PT_UID (copy
, DECL_PT_UID (decl
));
2082 TREE_ADDRESSABLE (copy
) = TREE_ADDRESSABLE (decl
);
2083 TREE_READONLY (copy
) = TREE_READONLY (decl
);
2084 TREE_THIS_VOLATILE (copy
) = TREE_THIS_VOLATILE (decl
);
2085 DECL_NOT_GIMPLE_REG_P (copy
) = DECL_NOT_GIMPLE_REG_P (decl
);
2086 DECL_ARTIFICIAL (copy
) = DECL_ARTIFICIAL (decl
);
2087 DECL_IGNORED_P (copy
) = DECL_IGNORED_P (decl
);
2088 DECL_ABSTRACT_ORIGIN (copy
) = DECL_ORIGIN (decl
);
2089 DECL_SEEN_IN_BIND_EXPR_P (copy
) = 1;
2090 SET_DECL_RTL (copy
, 0);
2091 TREE_USED (copy
) = 1;
2092 DECL_CONTEXT (copy
) = current_function_decl
;
2093 add_local_decl (cfun
, copy
);
2095 = BLOCK_VARS (DECL_INITIAL (current_function_decl
));
2096 BLOCK_VARS (DECL_INITIAL (current_function_decl
)) = copy
;
2098 if (gsip
!= NULL
&& copy
&& target_for_debug_bind (decl
))
2100 gcc_assert (TREE_CODE (decl
) == PARM_DECL
);
2102 def_temp
= gimple_build_debug_bind (copy
, vexpr
, NULL
);
2104 def_temp
= gimple_build_debug_source_bind (copy
, decl
,
2106 gsi_insert_before (gsip
, def_temp
, GSI_SAME_STMT
);
2111 /* Perform all necessary body changes to change signature, body and debug info
2112 of fun according to adjustments passed at construction. Return true if CFG
2113 was changed in any way. The main entry point for modification of standalone
2114 functions that is not part of IPA clone materialization. */
2117 ipa_param_body_adjustments::perform_cfun_body_modifications ()
2120 modify_formal_parameters ();
2121 cfg_changed
= modify_cfun_body ();
2122 reset_debug_stmts ();
2128 /* Deallocate summaries which otherwise stay alive until the end of
2132 ipa_edge_modifications_finalize ()
2134 if (!ipa_edge_modifications
)
2136 delete ipa_edge_modifications
;
2137 ipa_edge_modifications
= NULL
;