1 /* Perform optimizations on tree structure.
2 Copyright (C) 1998-2024 Free Software Foundation, Inc.
3 Written by Mark Michell (mark@codesourcery.com).
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 GCC is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
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"
27 #include "stringpool.h"
30 #include "tree-inline.h"
31 #include "tree-iterator.h"
36 static void update_cloned_parm (tree
, tree
, bool);
38 /* CLONED_PARM is a copy of CLONE, generated for a cloned constructor
39 or destructor. Update it to ensure that the source-position for
40 the cloned parameter matches that for the original, and that the
41 debugging generation code will be able to find the original PARM. */
44 update_cloned_parm (tree parm
, tree cloned_parm
, bool first
)
46 DECL_ABSTRACT_ORIGIN (cloned_parm
) = parm
;
48 /* We may have taken its address. */
49 TREE_ADDRESSABLE (cloned_parm
) = TREE_ADDRESSABLE (parm
);
51 DECL_BY_REFERENCE (cloned_parm
) = DECL_BY_REFERENCE (parm
);
53 /* The definition might have different constness. */
54 TREE_READONLY (cloned_parm
) = TREE_READONLY (parm
);
56 TREE_USED (cloned_parm
) = !first
|| TREE_USED (parm
);
58 /* The name may have changed from the declaration. */
59 DECL_NAME (cloned_parm
) = DECL_NAME (parm
);
60 DECL_SOURCE_LOCATION (cloned_parm
) = DECL_SOURCE_LOCATION (parm
);
61 TREE_TYPE (cloned_parm
) = TREE_TYPE (parm
);
63 DECL_NOT_GIMPLE_REG_P (cloned_parm
) = DECL_NOT_GIMPLE_REG_P (parm
);
66 /* Like copy_decl_no_change, but handle DECL_OMP_PRIVATIZED_MEMBER
70 cxx_copy_decl (tree decl
, copy_body_data
*id
)
72 tree copy
= copy_decl_no_change (decl
, id
);
74 && DECL_HAS_VALUE_EXPR_P (decl
)
75 && DECL_ARTIFICIAL (decl
)
76 && DECL_LANG_SPECIFIC (decl
)
77 && DECL_OMP_PRIVATIZED_MEMBER (decl
))
79 tree expr
= DECL_VALUE_EXPR (copy
);
80 walk_tree (&expr
, copy_tree_body_r
, id
, NULL
);
81 SET_DECL_VALUE_EXPR (copy
, expr
);
86 /* FN is a function in High GIMPLE form that has a complete body and no
87 CFG. CLONE is a function whose body is to be set to a copy of FN,
88 mapping argument declarations according to the ARG_MAP splay_tree. */
91 clone_body (tree clone
, tree fn
, void *arg_map
)
96 /* Clone the body, as if we were making an inline call. But, remap
97 the parameters in the callee to the parameters of caller. */
98 memset (&id
, 0, sizeof (id
));
101 id
.src_cfun
= DECL_STRUCT_FUNCTION (fn
);
102 id
.decl_map
= static_cast<hash_map
<tree
, tree
> *> (arg_map
);
104 id
.copy_decl
= cxx_copy_decl
;
105 id
.transform_call_graph_edges
= CB_CGE_DUPLICATE
;
106 id
.transform_new_cfg
= true;
107 id
.transform_return_to_modify
= false;
109 /* We're not inside any EH region. */
112 stmts
= DECL_SAVED_TREE (fn
);
113 walk_tree (&stmts
, copy_tree_body_r
, &id
, NULL
);
115 /* Also remap the initializer of any static variables so that they (in
116 particular, any label addresses) correspond to the base variant rather
117 than the abstract one. */
118 if (DECL_NAME (clone
) == base_dtor_identifier
119 || DECL_NAME (clone
) == base_ctor_identifier
)
124 FOR_EACH_LOCAL_DECL (DECL_STRUCT_FUNCTION (fn
), ix
, decl
)
125 walk_tree (&DECL_INITIAL (decl
), copy_tree_body_r
, &id
, NULL
);
128 append_to_statement_list_force (stmts
, &DECL_SAVED_TREE (clone
));
131 /* DELETE_DTOR is a delete destructor whose body will be built.
132 COMPLETE_DTOR is the corresponding complete destructor. */
135 build_delete_destructor_body (tree delete_dtor
, tree complete_dtor
)
137 tree parm
= DECL_ARGUMENTS (delete_dtor
);
138 tree virtual_size
= cxx_sizeof (current_class_type
);
140 /* Call the delete function. */
141 tree call_delete
= build_op_delete_call (DELETE_EXPR
, current_class_ptr
,
144 /*placement=*/NULL_TREE
,
145 /*alloc_fn=*/NULL_TREE
,
146 tf_warning_or_error
);
148 tree op
= get_callee_fndecl (call_delete
);
149 if (op
&& DECL_P (op
) && destroying_delete_p (op
))
151 /* The destroying delete will handle calling complete_dtor. */
152 add_stmt (call_delete
);
156 /* Call the corresponding complete destructor. */
157 gcc_assert (complete_dtor
);
158 tree call_dtor
= build_cxx_call (complete_dtor
, 1, &parm
,
159 tf_warning_or_error
);
161 /* Operator delete must be called, whether or not the dtor throws. */
162 add_stmt (build2 (TRY_FINALLY_EXPR
, void_type_node
,
163 call_dtor
, call_delete
));
166 /* Return the address of the object.
167 ??? How is it useful to return an invalid address? */
168 maybe_return_this ();
171 /* Return name of comdat group for complete and base ctor (or dtor)
172 that have the same body. If dtor is virtual, deleting dtor goes
173 into this comdat group as well. */
176 cdtor_comdat_group (tree complete
, tree base
)
178 tree complete_name
= DECL_ASSEMBLER_NAME (complete
);
179 tree base_name
= DECL_ASSEMBLER_NAME (base
);
182 bool diff_seen
= false;
184 gcc_assert (IDENTIFIER_LENGTH (complete_name
)
185 == IDENTIFIER_LENGTH (base_name
));
186 grp_name
= XALLOCAVEC (char, IDENTIFIER_LENGTH (complete_name
) + 1);
187 p
= IDENTIFIER_POINTER (complete_name
);
188 q
= IDENTIFIER_POINTER (base_name
);
189 for (idx
= 0; idx
< IDENTIFIER_LENGTH (complete_name
); idx
++)
190 if (p
[idx
] == q
[idx
])
191 grp_name
[idx
] = p
[idx
];
194 gcc_assert (!diff_seen
196 && (p
[idx
- 1] == 'C' || p
[idx
- 1] == 'D'
197 || p
[idx
- 1] == 'I')
203 grp_name
[idx
] = '\0';
204 gcc_assert (diff_seen
);
205 return get_identifier (grp_name
);
208 /* Returns true iff we can make the base and complete [cd]tor aliases of
209 the same symbol rather than separate functions. */
212 can_alias_cdtor (tree fn
)
214 /* If aliases aren't supported by the assembler, fail. */
215 if (!TARGET_SUPPORTS_ALIASES
)
218 /* We can't use an alias if there are virtual bases. */
219 if (CLASSTYPE_VBASECLASSES (DECL_CONTEXT (fn
)))
221 gcc_assert (DECL_MAYBE_IN_CHARGE_CDTOR_P (fn
));
222 /* Don't use aliases for weak/linkonce definitions unless we can put both
223 symbols in the same COMDAT group. */
224 return (DECL_WEAK (fn
) ? (HAVE_COMDAT_GROUP
&& DECL_ONE_ONLY (fn
))
225 : (DECL_INTERFACE_KNOWN (fn
) && !DECL_ONE_ONLY (fn
)));
228 /* FN is a [cd]tor, fns is a pointer to an array of length 3. Fill fns
229 with pointers to the base, complete, and deleting variants. */
232 populate_clone_array (tree fn
, tree
*fns
)
240 FOR_EACH_CLONE (clone
, fn
)
241 if (DECL_NAME (clone
) == complete_dtor_identifier
242 || DECL_NAME (clone
) == complete_ctor_identifier
)
244 else if (DECL_NAME (clone
) == base_dtor_identifier
245 || DECL_NAME (clone
) == base_ctor_identifier
)
247 else if (DECL_NAME (clone
) == deleting_dtor_identifier
)
253 /* FN is a constructor or destructor, and there are FUNCTION_DECLs
254 cloned from it nearby. Instead of cloning this body, leave it
255 alone and create tiny one-call bodies for the cloned
256 FUNCTION_DECLs. These clones are sibcall candidates, and their
257 resulting code will be very thunk-esque. */
260 maybe_thunk_body (tree fn
, bool force
)
262 tree bind
, block
, call
, clone
, clone_result
, fn_parm
, fn_parm_typelist
;
263 tree last_arg
, modify
, *args
;
264 int parmno
, vtt_parmno
, max_parms
;
267 if (!force
&& !flag_declone_ctor_dtor
)
270 /* If function accepts variable arguments, give up. */
271 last_arg
= tree_last (TYPE_ARG_TYPES (TREE_TYPE (fn
)));
272 if (last_arg
!= void_list_node
)
275 /* If we got this far, we've decided to turn the clones into thunks. */
277 /* We're going to generate code for fn, so it is no longer "abstract."
278 Also make the unified ctor/dtor private to either the translation unit
279 (for non-vague linkage ctors) or the COMDAT group (otherwise). */
281 populate_clone_array (fn
, fns
);
283 /* Can happen during error recovery (c++/71464). */
284 if (!fns
[0] || !fns
[1])
287 /* Don't use thunks if the base clone omits inherited parameters. */
288 if (ctor_omit_inherited_parms (fns
[0]))
291 /* Don't diagnose deprecated or unavailable cdtors just because they
292 have thunks emitted for them. */
293 auto du
= make_temp_override (deprecated_state
,
294 UNAVAILABLE_DEPRECATED_SUPPRESS
);
296 DECL_ABSTRACT_P (fn
) = false;
299 TREE_PUBLIC (fn
) = false;
300 DECL_EXTERNAL (fn
) = false;
301 DECL_INTERFACE_KNOWN (fn
) = true;
303 else if (HAVE_COMDAT_GROUP
)
305 /* At eof, defer creation of mangling aliases temporarily. */
306 bool save_defer_mangling_aliases
= defer_mangling_aliases
;
307 defer_mangling_aliases
= true;
308 tree comdat_group
= cdtor_comdat_group (fns
[1], fns
[0]);
309 defer_mangling_aliases
= save_defer_mangling_aliases
;
310 cgraph_node::get_create (fns
[0])->set_comdat_group (comdat_group
);
311 cgraph_node::get_create (fns
[1])->add_to_same_comdat_group
312 (cgraph_node::get_create (fns
[0]));
313 symtab_node::get (fn
)->add_to_same_comdat_group
314 (symtab_node::get (fns
[0]));
316 /* If *[CD][12]* dtors go into the *[CD]5* comdat group and dtor is
317 virtual, it goes into the same comdat group as well. */
318 cgraph_node::get_create (fns
[2])->add_to_same_comdat_group
319 (symtab_node::get (fns
[0]));
320 /* Emit them now that the thunks are same comdat group aliases. */
321 if (!save_defer_mangling_aliases
)
322 generate_mangling_aliases ();
323 TREE_PUBLIC (fn
) = false;
324 DECL_EXTERNAL (fn
) = false;
325 DECL_INTERFACE_KNOWN (fn
) = true;
326 /* function_and_variable_visibility doesn't want !PUBLIC decls to
327 have these flags set. */
328 DECL_WEAK (fn
) = false;
329 DECL_COMDAT (fn
) = false;
332 /* Find the vtt_parm, if present. */
333 for (vtt_parmno
= -1, parmno
= 0, fn_parm
= DECL_ARGUMENTS (fn
);
335 ++parmno
, fn_parm
= TREE_CHAIN (fn_parm
))
337 if (DECL_ARTIFICIAL (fn_parm
)
338 && DECL_NAME (fn_parm
) == vtt_parm_identifier
)
340 /* Compensate for removed in_charge parameter. */
346 /* Allocate an argument buffer for build_cxx_call().
347 Make sure it is large enough for any of the clones. */
349 FOR_EACH_CLONE (clone
, fn
)
351 int length
= list_length (DECL_ARGUMENTS (fn
));
352 if (length
> max_parms
)
355 args
= XALLOCAVEC (tree
, max_parms
);
357 /* We know that any clones immediately follow FN in TYPE_FIELDS. */
358 FOR_EACH_CLONE (clone
, fn
)
362 /* If we've already generated a body for this clone, avoid
363 duplicating it. (Is it possible for a clone-list to grow after we
365 if (DECL_SAVED_TREE (clone
) || TREE_ASM_WRITTEN (clone
))
368 /* Start processing the function. */
369 start_preparsed_function (clone
, NULL_TREE
, SF_PRE_PARSED
);
373 for (clone_parm
= DECL_ARGUMENTS (clone
); clone_parm
;
374 clone_parm
= TREE_CHAIN (clone_parm
))
375 DECL_ABSTRACT_ORIGIN (clone_parm
) = NULL_TREE
;
376 /* Build the delete destructor by calling complete destructor and
378 build_delete_destructor_body (clone
, fns
[1]);
382 /* Walk parameter lists together, creating parameter list for
383 call to original function. */
385 fn_parm
= DECL_ARGUMENTS (fn
),
386 fn_parm_typelist
= TYPE_ARG_TYPES (TREE_TYPE (fn
)),
387 clone_parm
= DECL_ARGUMENTS (clone
);
390 fn_parm
= TREE_CHAIN (fn_parm
))
392 if (parmno
== vtt_parmno
&& ! DECL_HAS_VTT_PARM_P (clone
))
394 gcc_assert (fn_parm_typelist
);
395 /* Clobber argument with formal parameter type. */
397 = convert (TREE_VALUE (fn_parm_typelist
),
400 else if (parmno
== 1 && DECL_HAS_IN_CHARGE_PARM_P (fn
))
403 = copy_node (in_charge_arg_for_name (DECL_NAME (clone
)));
404 args
[parmno
] = in_charge
;
406 /* Map other parameters to their equivalents in the cloned
410 gcc_assert (clone_parm
);
411 DECL_ABSTRACT_ORIGIN (clone_parm
) = NULL
;
412 args
[parmno
] = clone_parm
;
413 /* Clear TREE_ADDRESSABLE on thunk arguments. */
414 TREE_ADDRESSABLE (clone_parm
) = 0;
415 clone_parm
= TREE_CHAIN (clone_parm
);
417 if (fn_parm_typelist
)
418 fn_parm_typelist
= TREE_CHAIN (fn_parm_typelist
);
421 /* We built this list backwards; fix now. */
423 call
= build_cxx_call (fn
, parmno
, args
, tf_warning_or_error
);
424 /* Arguments passed to the thunk by invisible reference should
425 be transmitted to the callee unchanged. Do not create a
426 temporary and invoke the copy constructor. The thunking
427 transformation must not introduce any constructor calls. */
428 CALL_FROM_THUNK_P (call
) = 1;
429 block
= make_node (BLOCK
);
430 if (targetm
.cxx
.cdtor_returns_this ())
432 clone_result
= DECL_RESULT (clone
);
433 modify
= build2 (MODIFY_EXPR
, TREE_TYPE (clone_result
),
435 modify
= build1 (RETURN_EXPR
, void_type_node
, modify
);
442 bind
= c_build_bind_expr (DECL_SOURCE_LOCATION (clone
),
443 block
, cur_stmt_list
);
444 DECL_SAVED_TREE (clone
) = push_stmt_list ();
448 DECL_ABSTRACT_ORIGIN (clone
) = NULL
;
449 expand_or_defer_fn (finish_function (/*inline_p=*/false));
454 /* Copy most attributes from ATTRS, omitting attributes that can really only
455 apply to a single decl. */
458 clone_attrs (tree attrs
)
460 tree new_attrs
= NULL_TREE
;
461 tree
*p
= &new_attrs
;
463 for (tree a
= attrs
; a
; a
= TREE_CHAIN (a
))
465 tree aname
= get_attribute_name (a
);
466 if (is_attribute_namespace_p ("", a
)
467 && (is_attribute_p ("alias", aname
)
468 || is_attribute_p ("ifunc", aname
)))
471 p
= &TREE_CHAIN (*p
);
477 /* FN is a function that has a complete body. Clone the body as
478 necessary. Returns nonzero if there's no longer any need to
479 process the main body. */
482 maybe_clone_body (tree fn
)
484 tree comdat_group
= NULL_TREE
;
489 bool need_alias
= false;
491 /* We only clone constructors and destructors. */
492 if (!DECL_MAYBE_IN_CHARGE_CDTOR_P (fn
))
495 populate_clone_array (fn
, fns
);
497 /* Remember if we can't have multiple clones for some reason. We need to
498 check this before we remap local static initializers in clone_body. */
499 if (!tree_versionable_function_p (fn
))
502 /* We know that any clones immediately follow FN in the TYPE_FIELDS
504 push_to_top_level ();
505 for (idx
= 0; idx
< 3; idx
++)
514 /* Update CLONE's source position information to match FN's. */
515 DECL_SOURCE_LOCATION (clone
) = DECL_SOURCE_LOCATION (fn
);
516 DECL_DECLARED_INLINE_P (clone
) = DECL_DECLARED_INLINE_P (fn
);
517 DECL_DECLARED_CONSTEXPR_P (clone
) = DECL_DECLARED_CONSTEXPR_P (fn
);
518 DECL_COMDAT (clone
) = DECL_COMDAT (fn
);
519 DECL_WEAK (clone
) = DECL_WEAK (fn
);
521 /* We don't copy the comdat group from fn to clone because the assembler
522 name of fn was corrupted by write_mangled_name by adding *INTERNAL*
523 to it. By doing so, it also corrupted the comdat group. */
524 if (DECL_ONE_ONLY (fn
))
525 cgraph_node::get_create (clone
)->set_comdat_group (cxx_comdat_group (clone
));
526 DECL_USE_TEMPLATE (clone
) = DECL_USE_TEMPLATE (fn
);
527 DECL_EXTERNAL (clone
) = DECL_EXTERNAL (fn
);
528 DECL_INTERFACE_KNOWN (clone
) = DECL_INTERFACE_KNOWN (fn
);
529 DECL_NOT_REALLY_EXTERN (clone
) = DECL_NOT_REALLY_EXTERN (fn
);
530 TREE_PUBLIC (clone
) = TREE_PUBLIC (fn
);
531 DECL_VISIBILITY (clone
) = DECL_VISIBILITY (fn
);
532 DECL_VISIBILITY_SPECIFIED (clone
) = DECL_VISIBILITY_SPECIFIED (fn
);
533 DECL_DLLIMPORT_P (clone
) = DECL_DLLIMPORT_P (fn
);
534 DECL_ATTRIBUTES (clone
) = clone_attrs (DECL_ATTRIBUTES (fn
));
535 DECL_DISREGARD_INLINE_LIMITS (clone
) = DECL_DISREGARD_INLINE_LIMITS (fn
);
536 set_decl_section_name (clone
, fn
);
538 /* Adjust the parameter names and locations. */
539 parm
= DECL_ARGUMENTS (fn
);
540 clone_parm
= DECL_ARGUMENTS (clone
);
541 /* Update the `this' parameter, which is always first. */
542 update_cloned_parm (parm
, clone_parm
, first
);
543 parm
= DECL_CHAIN (parm
);
544 clone_parm
= DECL_CHAIN (clone_parm
);
545 if (DECL_HAS_IN_CHARGE_PARM_P (fn
))
546 parm
= DECL_CHAIN (parm
);
547 if (DECL_HAS_VTT_PARM_P (fn
))
548 parm
= DECL_CHAIN (parm
);
549 if (DECL_HAS_VTT_PARM_P (clone
))
550 clone_parm
= DECL_CHAIN (clone_parm
);
551 for (; parm
&& clone_parm
;
552 parm
= DECL_CHAIN (parm
), clone_parm
= DECL_CHAIN (clone_parm
))
553 /* Update this parameter. */
554 update_cloned_parm (parm
, clone_parm
, first
);
557 bool can_alias
= can_alias_cdtor (fn
);
559 /* If we decide to turn clones into thunks, they will branch to fn.
560 Must have original function available to call. */
561 if (!can_alias
&& maybe_thunk_body (fn
, need_alias
))
563 pop_from_top_level ();
564 /* We still need to emit the original function. */
568 /* Emit the DWARF1 abstract instance. */
569 (*debug_hooks
->deferred_inline_function
) (fn
);
571 /* We know that any clones immediately follow FN in the TYPE_FIELDS. */
572 for (idx
= 0; idx
< 3; idx
++)
577 hash_map
<tree
, tree
> *decl_map
;
584 /* Start processing the function. */
585 start_preparsed_function (clone
, NULL_TREE
, SF_PRE_PARSED
);
587 /* Tell cgraph if both ctors or both dtors are known to have
592 && cgraph_node::get_create (fns
[0])->create_same_body_alias
596 if (DECL_ONE_ONLY (fns
[0]))
598 /* For comdat base and complete cdtors put them
599 into the same, *[CD]5* comdat group instead of
601 comdat_group
= cdtor_comdat_group (fns
[1], fns
[0]);
602 cgraph_node::get_create (fns
[0])->set_comdat_group (comdat_group
);
603 if (symtab_node::get (clone
)->same_comdat_group
)
604 symtab_node::get (clone
)->remove_from_same_comdat_group ();
605 symtab_node::get (clone
)->add_to_same_comdat_group
606 (symtab_node::get (fns
[0]));
610 /* Build the delete destructor by calling complete destructor
611 and delete function. */
614 build_delete_destructor_body (clone
, fns
[1]);
615 /* If *[CD][12]* dtors go into the *[CD]5* comdat group and dtor is
616 virtual, it goes into the same comdat group as well. */
618 cgraph_node::get_create (clone
)->add_to_same_comdat_group
619 (symtab_node::get (fns
[0]));
622 /* No need to populate body. */ ;
625 /* If we can't have multiple copies of FN (say, because there's a
626 static local initialized with the address of a label), we need
627 to use an alias for the complete variant. */
628 if (idx
== 1 && need_alias
)
630 if (DECL_STRUCT_FUNCTION (fn
)->cannot_be_copied_set
)
631 sorry (DECL_STRUCT_FUNCTION (fn
)->cannot_be_copied_reason
, fn
);
633 sorry ("making multiple clones of %qD", fn
);
636 /* Remap the parameters. */
637 decl_map
= new hash_map
<tree
, tree
>;
639 parm
= DECL_ARGUMENTS (fn
),
640 clone_parm
= DECL_ARGUMENTS (clone
);
643 parm
= DECL_CHAIN (parm
))
645 /* Map the in-charge parameter to an appropriate constant. */
646 if (DECL_HAS_IN_CHARGE_PARM_P (fn
) && parmno
== 1)
649 in_charge
= in_charge_arg_for_name (DECL_NAME (clone
));
650 decl_map
->put (parm
, in_charge
);
652 else if (DECL_ARTIFICIAL (parm
)
653 && DECL_NAME (parm
) == vtt_parm_identifier
)
655 /* For a subobject constructor or destructor, the next
656 argument is the VTT parameter. Remap the VTT_PARM
657 from the CLONE to this parameter. */
658 if (DECL_HAS_VTT_PARM_P (clone
))
660 DECL_ABSTRACT_ORIGIN (clone_parm
) = parm
;
661 decl_map
->put (parm
, clone_parm
);
662 clone_parm
= DECL_CHAIN (clone_parm
);
664 /* Otherwise, map the VTT parameter to `NULL'. */
668 = fold_convert (TREE_TYPE (parm
), null_pointer_node
);
669 decl_map
->put (parm
, t
);
672 /* Map other parameters to their equivalents in the cloned
679 replacement
= clone_parm
;
680 clone_parm
= DECL_CHAIN (clone_parm
);
684 /* Inheriting ctors can omit parameters from the base
685 clone. Replace them with null lvalues. */
686 tree reftype
= build_reference_type (TREE_TYPE (parm
));
687 replacement
= fold_convert (reftype
, null_pointer_node
);
688 replacement
= convert_from_reference (replacement
);
690 decl_map
->put (parm
, replacement
);
694 if (targetm
.cxx
.cdtor_returns_this ())
696 parm
= DECL_RESULT (fn
);
697 clone_parm
= DECL_RESULT (clone
);
698 decl_map
->put (parm
, clone_parm
);
701 /* Clone the body. */
702 clone_body (clone
, fn
, decl_map
);
708 /* The clone can throw iff the original function can throw. */
709 cp_function_chain
->can_throw
= !TREE_NOTHROW (fn
);
711 /* Now, expand this function into RTL, if appropriate. */
712 finish_function (/*inline_p=*/false);
713 BLOCK_ABSTRACT_ORIGIN (DECL_INITIAL (clone
)) = DECL_INITIAL (fn
);
716 if (expand_or_defer_fn_1 (clone
))
717 emit_associated_thunks (clone
);
718 /* We didn't generate a body, so remove the empty one. */
719 DECL_SAVED_TREE (clone
) = void_node
;
722 expand_or_defer_fn (clone
);
725 pop_from_top_level ();
727 /* We don't need to process the original function any further. */