2014-12-12 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / cp / optimize.c
blob62e32d21bfff5c75533a00d1f484030ccbdbc6ce
1 /* Perform optimizations on tree structure.
2 Copyright (C) 1998-2014 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)
10 any later version.
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/>. */
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "tm.h"
25 #include "tree.h"
26 #include "stringpool.h"
27 #include "cp-tree.h"
28 #include "input.h"
29 #include "params.h"
30 #include "hashtab.h"
31 #include "target.h"
32 #include "debug.h"
33 #include "tree-inline.h"
34 #include "flags.h"
35 #include "langhooks.h"
36 #include "diagnostic-core.h"
37 #include "dumpfile.h"
38 #include "tree-iterator.h"
39 #include "hash-map.h"
40 #include "is-a.h"
41 #include "plugin-api.h"
42 #include "vec.h"
43 #include "hash-set.h"
44 #include "machmode.h"
45 #include "hard-reg-set.h"
46 #include "function.h"
47 #include "ipa-ref.h"
48 #include "cgraph.h"
50 /* Prototypes. */
52 static void update_cloned_parm (tree, tree, bool);
54 /* CLONED_PARM is a copy of CLONE, generated for a cloned constructor
55 or destructor. Update it to ensure that the source-position for
56 the cloned parameter matches that for the original, and that the
57 debugging generation code will be able to find the original PARM. */
59 static void
60 update_cloned_parm (tree parm, tree cloned_parm, bool first)
62 DECL_ABSTRACT_ORIGIN (cloned_parm) = parm;
64 /* We may have taken its address. */
65 TREE_ADDRESSABLE (cloned_parm) = TREE_ADDRESSABLE (parm);
67 /* The definition might have different constness. */
68 TREE_READONLY (cloned_parm) = TREE_READONLY (parm);
70 TREE_USED (cloned_parm) = !first || TREE_USED (parm);
72 /* The name may have changed from the declaration. */
73 DECL_NAME (cloned_parm) = DECL_NAME (parm);
74 DECL_SOURCE_LOCATION (cloned_parm) = DECL_SOURCE_LOCATION (parm);
75 TREE_TYPE (cloned_parm) = TREE_TYPE (parm);
77 DECL_GIMPLE_REG_P (cloned_parm) = DECL_GIMPLE_REG_P (parm);
81 /* FN is a function in High GIMPLE form that has a complete body and no
82 CFG. CLONE is a function whose body is to be set to a copy of FN,
83 mapping argument declarations according to the ARG_MAP splay_tree. */
85 static void
86 clone_body (tree clone, tree fn, void *arg_map)
88 copy_body_data id;
89 tree stmts;
91 /* Clone the body, as if we were making an inline call. But, remap
92 the parameters in the callee to the parameters of caller. */
93 memset (&id, 0, sizeof (id));
94 id.src_fn = fn;
95 id.dst_fn = clone;
96 id.src_cfun = DECL_STRUCT_FUNCTION (fn);
97 id.decl_map = static_cast<hash_map<tree, tree> *> (arg_map);
99 id.copy_decl = copy_decl_no_change;
100 id.transform_call_graph_edges = CB_CGE_DUPLICATE;
101 id.transform_new_cfg = true;
102 id.transform_return_to_modify = false;
103 id.transform_lang_insert_block = NULL;
105 /* We're not inside any EH region. */
106 id.eh_lp_nr = 0;
108 stmts = DECL_SAVED_TREE (fn);
109 walk_tree (&stmts, copy_tree_body_r, &id, NULL);
111 /* Also remap the initializer of any static variables so that they (in
112 particular, any label addresses) correspond to the base variant rather
113 than the abstract one. */
114 if (DECL_NAME (clone) == base_dtor_identifier
115 || DECL_NAME (clone) == base_ctor_identifier)
117 unsigned ix;
118 tree decl;
120 FOR_EACH_LOCAL_DECL (DECL_STRUCT_FUNCTION (fn), ix, decl)
121 walk_tree (&DECL_INITIAL (decl), copy_tree_body_r, &id, NULL);
124 append_to_statement_list_force (stmts, &DECL_SAVED_TREE (clone));
127 /* DELETE_DTOR is a delete destructor whose body will be built.
128 COMPLETE_DTOR is the corresponding complete destructor. */
130 static void
131 build_delete_destructor_body (tree delete_dtor, tree complete_dtor)
133 tree call_dtor, call_delete;
134 tree parm = DECL_ARGUMENTS (delete_dtor);
135 tree virtual_size = cxx_sizeof (current_class_type);
137 /* Call the corresponding complete destructor. */
138 gcc_assert (complete_dtor);
139 call_dtor = build_cxx_call (complete_dtor, 1, &parm,
140 tf_warning_or_error);
141 add_stmt (call_dtor);
143 add_stmt (build_stmt (0, LABEL_EXPR, cdtor_label));
145 /* Call the delete function. */
146 call_delete = build_op_delete_call (DELETE_EXPR, current_class_ptr,
147 virtual_size,
148 /*global_p=*/false,
149 /*placement=*/NULL_TREE,
150 /*alloc_fn=*/NULL_TREE,
151 tf_warning_or_error);
152 add_stmt (call_delete);
154 /* Return the address of the object. */
155 if (targetm.cxx.cdtor_returns_this ())
157 tree val = DECL_ARGUMENTS (delete_dtor);
158 val = build2 (MODIFY_EXPR, TREE_TYPE (val),
159 DECL_RESULT (delete_dtor), val);
160 add_stmt (build_stmt (0, RETURN_EXPR, val));
164 /* Return name of comdat group for complete and base ctor (or dtor)
165 that have the same body. If dtor is virtual, deleting dtor goes
166 into this comdat group as well. */
168 static tree
169 cdtor_comdat_group (tree complete, tree base)
171 tree complete_name = DECL_ASSEMBLER_NAME (complete);
172 tree base_name = DECL_ASSEMBLER_NAME (base);
173 char *grp_name;
174 const char *p, *q;
175 bool diff_seen = false;
176 size_t idx;
177 gcc_assert (IDENTIFIER_LENGTH (complete_name)
178 == IDENTIFIER_LENGTH (base_name));
179 grp_name = XALLOCAVEC (char, IDENTIFIER_LENGTH (complete_name) + 1);
180 p = IDENTIFIER_POINTER (complete_name);
181 q = IDENTIFIER_POINTER (base_name);
182 for (idx = 0; idx < IDENTIFIER_LENGTH (complete_name); idx++)
183 if (p[idx] == q[idx])
184 grp_name[idx] = p[idx];
185 else
187 gcc_assert (!diff_seen
188 && idx > 0
189 && (p[idx - 1] == 'C' || p[idx - 1] == 'D')
190 && p[idx] == '1'
191 && q[idx] == '2');
192 grp_name[idx] = '5';
193 diff_seen = true;
195 grp_name[idx] = '\0';
196 gcc_assert (diff_seen);
197 return get_identifier (grp_name);
200 /* Returns true iff we can make the base and complete [cd]tor aliases of
201 the same symbol rather than separate functions. */
203 static bool
204 can_alias_cdtor (tree fn)
206 #ifndef ASM_OUTPUT_DEF
207 /* If aliases aren't supported by the assembler, fail. */
208 return false;
209 #endif
210 /* We can't use an alias if there are virtual bases. */
211 if (CLASSTYPE_VBASECLASSES (DECL_CONTEXT (fn)))
212 return false;
213 /* ??? Why not use aliases with -frepo? */
214 if (flag_use_repository)
215 return false;
216 gcc_assert (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn)
217 || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn));
218 /* Don't use aliases for weak/linkonce definitions unless we can put both
219 symbols in the same COMDAT group. */
220 return (DECL_INTERFACE_KNOWN (fn)
221 && (SUPPORTS_ONE_ONLY || !DECL_WEAK (fn))
222 && (!DECL_ONE_ONLY (fn)
223 || (HAVE_COMDAT_GROUP && DECL_WEAK (fn))));
226 /* FN is a [cd]tor, fns is a pointer to an array of length 3. Fill fns
227 with pointers to the base, complete, and deleting variants. */
229 static void
230 populate_clone_array (tree fn, tree *fns)
232 tree clone;
234 fns[0] = NULL_TREE;
235 fns[1] = NULL_TREE;
236 fns[2] = NULL_TREE;
238 /* Look for the complete destructor which may be used to build the
239 delete destructor. */
240 FOR_EACH_CLONE (clone, fn)
241 if (DECL_NAME (clone) == complete_dtor_identifier
242 || DECL_NAME (clone) == complete_ctor_identifier)
243 fns[1] = clone;
244 else if (DECL_NAME (clone) == base_dtor_identifier
245 || DECL_NAME (clone) == base_ctor_identifier)
246 fns[0] = clone;
247 else if (DECL_NAME (clone) == deleting_dtor_identifier)
248 fns[2] = clone;
249 else
250 gcc_unreachable ();
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. */
259 static bool
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;
265 tree fns[3];
267 if (!force && !flag_declone_ctor_dtor)
268 return 0;
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)
273 return 0;
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);
282 DECL_ABSTRACT_P (fn) = false;
283 if (!DECL_WEAK (fn))
285 TREE_PUBLIC (fn) = false;
286 DECL_EXTERNAL (fn) = false;
287 DECL_INTERFACE_KNOWN (fn) = true;
289 else if (HAVE_COMDAT_GROUP)
291 tree comdat_group = cdtor_comdat_group (fns[1], fns[0]);
292 cgraph_node::get_create (fns[0])->set_comdat_group (comdat_group);
293 cgraph_node::get_create (fns[1])->add_to_same_comdat_group
294 (cgraph_node::get_create (fns[0]));
295 symtab_node::get (fn)->add_to_same_comdat_group
296 (symtab_node::get (fns[0]));
297 if (fns[2])
298 /* If *[CD][12]* dtors go into the *[CD]5* comdat group and dtor is
299 virtual, it goes into the same comdat group as well. */
300 cgraph_node::get_create (fns[2])->add_to_same_comdat_group
301 (symtab_node::get (fns[0]));
302 TREE_PUBLIC (fn) = false;
303 DECL_EXTERNAL (fn) = false;
304 DECL_INTERFACE_KNOWN (fn) = true;
305 /* function_and_variable_visibility doesn't want !PUBLIC decls to
306 have these flags set. */
307 DECL_WEAK (fn) = false;
308 DECL_COMDAT (fn) = false;
311 /* Find the vtt_parm, if present. */
312 for (vtt_parmno = -1, parmno = 0, fn_parm = DECL_ARGUMENTS (fn);
313 fn_parm;
314 ++parmno, fn_parm = TREE_CHAIN (fn_parm))
316 if (DECL_ARTIFICIAL (fn_parm)
317 && DECL_NAME (fn_parm) == vtt_parm_identifier)
319 /* Compensate for removed in_charge parameter. */
320 vtt_parmno = parmno;
321 break;
325 /* Allocate an argument buffer for build_cxx_call().
326 Make sure it is large enough for any of the clones. */
327 max_parms = 0;
328 FOR_EACH_CLONE (clone, fn)
330 int length = list_length (DECL_ARGUMENTS (fn));
331 if (length > max_parms)
332 max_parms = length;
334 args = (tree *) alloca (max_parms * sizeof (tree));
336 /* We know that any clones immediately follow FN in TYPE_METHODS. */
337 FOR_EACH_CLONE (clone, fn)
339 tree clone_parm;
341 /* If we've already generated a body for this clone, avoid
342 duplicating it. (Is it possible for a clone-list to grow after we
343 first see it?) */
344 if (DECL_SAVED_TREE (clone) || TREE_ASM_WRITTEN (clone))
345 continue;
347 /* Start processing the function. */
348 start_preparsed_function (clone, NULL_TREE, SF_PRE_PARSED);
350 if (clone == fns[2])
352 for (clone_parm = DECL_ARGUMENTS (clone); clone_parm;
353 clone_parm = TREE_CHAIN (clone_parm))
354 DECL_ABSTRACT_ORIGIN (clone_parm) = NULL_TREE;
355 /* Build the delete destructor by calling complete destructor and
356 delete function. */
357 build_delete_destructor_body (clone, fns[1]);
359 else
361 /* Walk parameter lists together, creating parameter list for
362 call to original function. */
363 for (parmno = 0,
364 fn_parm = DECL_ARGUMENTS (fn),
365 fn_parm_typelist = TYPE_ARG_TYPES (TREE_TYPE (fn)),
366 clone_parm = DECL_ARGUMENTS (clone);
367 fn_parm;
368 ++parmno,
369 fn_parm = TREE_CHAIN (fn_parm))
371 if (parmno == vtt_parmno && ! DECL_HAS_VTT_PARM_P (clone))
373 gcc_assert (fn_parm_typelist);
374 /* Clobber argument with formal parameter type. */
375 args[parmno]
376 = convert (TREE_VALUE (fn_parm_typelist),
377 null_pointer_node);
379 else if (parmno == 1 && DECL_HAS_IN_CHARGE_PARM_P (fn))
381 tree in_charge
382 = copy_node (in_charge_arg_for_name (DECL_NAME (clone)));
383 args[parmno] = in_charge;
385 /* Map other parameters to their equivalents in the cloned
386 function. */
387 else
389 gcc_assert (clone_parm);
390 DECL_ABSTRACT_ORIGIN (clone_parm) = NULL;
391 args[parmno] = clone_parm;
392 clone_parm = TREE_CHAIN (clone_parm);
394 if (fn_parm_typelist)
395 fn_parm_typelist = TREE_CHAIN (fn_parm_typelist);
398 /* We built this list backwards; fix now. */
399 mark_used (fn);
400 call = build_cxx_call (fn, parmno, args, tf_warning_or_error);
401 /* Arguments passed to the thunk by invisible reference should
402 be transmitted to the callee unchanged. Do not create a
403 temporary and invoke the copy constructor. The thunking
404 transformation must not introduce any constructor calls. */
405 CALL_FROM_THUNK_P (call) = 1;
406 block = make_node (BLOCK);
407 if (targetm.cxx.cdtor_returns_this ())
409 clone_result = DECL_RESULT (clone);
410 modify = build2 (MODIFY_EXPR, TREE_TYPE (clone_result),
411 clone_result, call);
412 modify = build1 (RETURN_EXPR, void_type_node, modify);
413 add_stmt (modify);
415 else
417 add_stmt (call);
419 bind = c_build_bind_expr (DECL_SOURCE_LOCATION (clone),
420 block, cur_stmt_list);
421 DECL_SAVED_TREE (clone) = push_stmt_list ();
422 add_stmt (bind);
425 DECL_ABSTRACT_ORIGIN (clone) = NULL;
426 expand_or_defer_fn (finish_function (0));
428 return 1;
431 /* FN is a function that has a complete body. Clone the body as
432 necessary. Returns nonzero if there's no longer any need to
433 process the main body. */
435 bool
436 maybe_clone_body (tree fn)
438 tree comdat_group = NULL_TREE;
439 tree clone;
440 tree fns[3];
441 bool first = true;
442 int idx;
443 bool need_alias = false;
445 /* We only clone constructors and destructors. */
446 if (!DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn)
447 && !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn))
448 return 0;
450 populate_clone_array (fn, fns);
452 /* Remember if we can't have multiple clones for some reason. We need to
453 check this before we remap local static initializers in clone_body. */
454 if (!tree_versionable_function_p (fn))
455 need_alias = true;
457 /* We know that any clones immediately follow FN in the TYPE_METHODS
458 list. */
459 push_to_top_level ();
460 for (idx = 0; idx < 3; idx++)
462 tree parm;
463 tree clone_parm;
465 clone = fns[idx];
466 if (!clone)
467 continue;
469 /* Update CLONE's source position information to match FN's. */
470 DECL_SOURCE_LOCATION (clone) = DECL_SOURCE_LOCATION (fn);
471 DECL_DECLARED_INLINE_P (clone) = DECL_DECLARED_INLINE_P (fn);
472 DECL_DECLARED_CONSTEXPR_P (clone) = DECL_DECLARED_CONSTEXPR_P (fn);
473 DECL_COMDAT (clone) = DECL_COMDAT (fn);
474 DECL_WEAK (clone) = DECL_WEAK (fn);
476 /* We don't copy the comdat group from fn to clone because the assembler
477 name of fn was corrupted by write_mangled_name by adding *INTERNAL*
478 to it. By doing so, it also corrupted the comdat group. */
479 if (DECL_ONE_ONLY (fn))
480 cgraph_node::get_create (clone)->set_comdat_group (cxx_comdat_group (clone));
481 DECL_USE_TEMPLATE (clone) = DECL_USE_TEMPLATE (fn);
482 DECL_EXTERNAL (clone) = DECL_EXTERNAL (fn);
483 DECL_INTERFACE_KNOWN (clone) = DECL_INTERFACE_KNOWN (fn);
484 DECL_NOT_REALLY_EXTERN (clone) = DECL_NOT_REALLY_EXTERN (fn);
485 TREE_PUBLIC (clone) = TREE_PUBLIC (fn);
486 DECL_VISIBILITY (clone) = DECL_VISIBILITY (fn);
487 DECL_VISIBILITY_SPECIFIED (clone) = DECL_VISIBILITY_SPECIFIED (fn);
488 DECL_DLLIMPORT_P (clone) = DECL_DLLIMPORT_P (fn);
489 DECL_ATTRIBUTES (clone) = copy_list (DECL_ATTRIBUTES (fn));
490 DECL_DISREGARD_INLINE_LIMITS (clone) = DECL_DISREGARD_INLINE_LIMITS (fn);
491 set_decl_section_name (clone, DECL_SECTION_NAME (fn));
493 /* Adjust the parameter names and locations. */
494 parm = DECL_ARGUMENTS (fn);
495 clone_parm = DECL_ARGUMENTS (clone);
496 /* Update the `this' parameter, which is always first. */
497 update_cloned_parm (parm, clone_parm, first);
498 parm = DECL_CHAIN (parm);
499 clone_parm = DECL_CHAIN (clone_parm);
500 if (DECL_HAS_IN_CHARGE_PARM_P (fn))
501 parm = DECL_CHAIN (parm);
502 if (DECL_HAS_VTT_PARM_P (fn))
503 parm = DECL_CHAIN (parm);
504 if (DECL_HAS_VTT_PARM_P (clone))
505 clone_parm = DECL_CHAIN (clone_parm);
506 for (; parm;
507 parm = DECL_CHAIN (parm), clone_parm = DECL_CHAIN (clone_parm))
508 /* Update this parameter. */
509 update_cloned_parm (parm, clone_parm, first);
512 bool can_alias = can_alias_cdtor (fn);
514 /* If we decide to turn clones into thunks, they will branch to fn.
515 Must have original function available to call. */
516 if (!can_alias && maybe_thunk_body (fn, need_alias))
518 pop_from_top_level ();
519 /* We still need to emit the original function. */
520 return 0;
523 /* Emit the DWARF1 abstract instance. */
524 (*debug_hooks->deferred_inline_function) (fn);
526 /* We know that any clones immediately follow FN in the TYPE_METHODS list. */
527 for (idx = 0; idx < 3; idx++)
529 tree parm;
530 tree clone_parm;
531 int parmno;
532 hash_map<tree, tree> *decl_map;
533 bool alias = false;
535 clone = fns[idx];
536 if (!clone)
537 continue;
539 /* Start processing the function. */
540 start_preparsed_function (clone, NULL_TREE, SF_PRE_PARSED);
542 /* Tell cgraph if both ctors or both dtors are known to have
543 the same body. */
544 if (can_alias
545 && fns[0]
546 && idx == 1
547 && cgraph_node::get_create (fns[0])->create_same_body_alias
548 (clone, fns[0]))
550 alias = true;
551 if (DECL_ONE_ONLY (fns[0]))
553 /* For comdat base and complete cdtors put them
554 into the same, *[CD]5* comdat group instead of
555 *[CD][12]*. */
556 comdat_group = cdtor_comdat_group (fns[1], fns[0]);
557 cgraph_node::get_create (fns[0])->set_comdat_group (comdat_group);
558 if (symtab_node::get (clone)->same_comdat_group)
559 symtab_node::get (clone)->remove_from_same_comdat_group ();
560 symtab_node::get (clone)->add_to_same_comdat_group
561 (symtab_node::get (fns[0]));
565 /* Build the delete destructor by calling complete destructor
566 and delete function. */
567 if (idx == 2)
569 build_delete_destructor_body (clone, fns[1]);
570 /* If *[CD][12]* dtors go into the *[CD]5* comdat group and dtor is
571 virtual, it goes into the same comdat group as well. */
572 if (comdat_group)
573 cgraph_node::get_create (clone)->add_to_same_comdat_group
574 (symtab_node::get (fns[0]));
576 else if (alias)
577 /* No need to populate body. */ ;
578 else
580 /* If we can't have multiple copies of FN (say, because there's a
581 static local initialized with the address of a label), we need
582 to use an alias for the complete variant. */
583 if (idx == 1 && need_alias)
585 if (DECL_STRUCT_FUNCTION (fn)->cannot_be_copied_set)
586 sorry (DECL_STRUCT_FUNCTION (fn)->cannot_be_copied_reason, fn);
587 else
588 sorry ("making multiple clones of %qD", fn);
591 /* Remap the parameters. */
592 decl_map = new hash_map<tree, tree>;
593 for (parmno = 0,
594 parm = DECL_ARGUMENTS (fn),
595 clone_parm = DECL_ARGUMENTS (clone);
596 parm;
597 ++parmno,
598 parm = DECL_CHAIN (parm))
600 /* Map the in-charge parameter to an appropriate constant. */
601 if (DECL_HAS_IN_CHARGE_PARM_P (fn) && parmno == 1)
603 tree in_charge;
604 in_charge = in_charge_arg_for_name (DECL_NAME (clone));
605 decl_map->put (parm, in_charge);
607 else if (DECL_ARTIFICIAL (parm)
608 && DECL_NAME (parm) == vtt_parm_identifier)
610 /* For a subobject constructor or destructor, the next
611 argument is the VTT parameter. Remap the VTT_PARM
612 from the CLONE to this parameter. */
613 if (DECL_HAS_VTT_PARM_P (clone))
615 DECL_ABSTRACT_ORIGIN (clone_parm) = parm;
616 decl_map->put (parm, clone_parm);
617 clone_parm = DECL_CHAIN (clone_parm);
619 /* Otherwise, map the VTT parameter to `NULL'. */
620 else
622 tree t
623 = fold_convert (TREE_TYPE (parm), null_pointer_node);
624 decl_map->put (parm, t);
627 /* Map other parameters to their equivalents in the cloned
628 function. */
629 else
631 decl_map->put (parm, clone_parm);
632 clone_parm = DECL_CHAIN (clone_parm);
636 if (targetm.cxx.cdtor_returns_this ())
638 parm = DECL_RESULT (fn);
639 clone_parm = DECL_RESULT (clone);
640 decl_map->put (parm, clone_parm);
643 /* Clone the body. */
644 clone_body (clone, fn, decl_map);
646 /* Clean up. */
647 delete decl_map;
650 /* The clone can throw iff the original function can throw. */
651 cp_function_chain->can_throw = !TREE_NOTHROW (fn);
653 /* Now, expand this function into RTL, if appropriate. */
654 finish_function (0);
655 BLOCK_ABSTRACT_ORIGIN (DECL_INITIAL (clone)) = DECL_INITIAL (fn);
656 if (alias)
658 if (expand_or_defer_fn_1 (clone))
659 emit_associated_thunks (clone);
661 else
662 expand_or_defer_fn (clone);
663 first = false;
665 pop_from_top_level ();
667 /* We don't need to process the original function any further. */
668 return 1;