]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/cgraphclones.c
tree-core.h: Include symtab.h.
[thirdparty/gcc.git] / gcc / cgraphclones.c
CommitLineData
564fe867 1/* Callgraph clones
5624e564 2 Copyright (C) 2003-2015 Free Software Foundation, Inc.
564fe867
JH
3 Contributed by Jan Hubicka
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21/* This module provide facilities for clonning functions. I.e. creating
22 new functions based on existing functions with simple modifications,
23 such as replacement of parameters.
24
25 To allow whole program optimization without actual presence of function
26 bodies, an additional infrastructure is provided for so-called virtual
27 clones
28
29 A virtual clone in the callgraph is a function that has no
30 associated body, just a description of how to create its body based
31 on a different function (which itself may be a virtual clone).
32
33 The description of function modifications includes adjustments to
34 the function's signature (which allows, for example, removing or
35 adding function arguments), substitutions to perform on the
36 function body, and, for inlined functions, a pointer to the
37 function that it will be inlined into.
38
39 It is also possible to redirect any edge of the callgraph from a
40 function to its virtual clone. This implies updating of the call
41 site to adjust for the new function signature.
42
43 Most of the transformations performed by inter-procedural
44 optimizations can be represented via virtual clones. For
45 instance, a constant propagation pass can produce a virtual clone
46 of the function which replaces one of its arguments by a
47 constant. The inliner can represent its decisions by producing a
48 clone of a function whose body will be later integrated into
49 a given function.
50
51 Using virtual clones, the program can be easily updated
52 during the Execute stage, solving most of pass interactions
53 problems that would otherwise occur during Transform.
54
55 Virtual clones are later materialized in the LTRANS stage and
56 turned into real functions. Passes executed after the virtual
57 clone were introduced also perform their Transform stage
58 on new functions, so for a pass there is no significant
59 difference between operating on a real function or a virtual
60 clone introduced before its Execute stage.
61
62 Optimization passes then work on virtual clones introduced before
63 their Execute stage as if they were real functions. The
64 only difference is that clones are not visible during the
65 Generate Summary stage. */
66
67#include "config.h"
68#include "system.h"
69#include "coretypes.h"
c7131fb2
AM
70#include "backend.h"
71#include "tree.h"
72#include "gimple.h"
d8a2d370 73#include "rtl.h"
40e23961 74#include "alias.h"
40e23961
MC
75#include "fold-const.h"
76#include "stringpool.h"
d8a2d370 77#include "emit-rtl.h"
2fb9a547
AM
78#include "internal-fn.h"
79#include "tree-eh.h"
442b4905 80#include "tree-cfg.h"
564fe867
JH
81#include "tree-inline.h"
82#include "langhooks.h"
564fe867
JH
83#include "toplev.h"
84#include "flags.h"
564fe867
JH
85#include "debug.h"
86#include "target.h"
564fe867 87#include "diagnostic.h"
564fe867 88#include "params.h"
564fe867 89#include "intl.h"
c582198b
AM
90#include "cgraph.h"
91#include "alloc-pool.h"
dd912cb8 92#include "symbol-summary.h"
564fe867 93#include "ipa-prop.h"
564fe867 94#include "tree-iterator.h"
564fe867
JH
95#include "tree-dump.h"
96#include "gimple-pretty-print.h"
564fe867 97#include "coverage.h"
564fe867
JH
98#include "ipa-inline.h"
99#include "ipa-utils.h"
100#include "lto-streamer.h"
101#include "except.h"
102
3dafb85c
ML
103/* Create clone of edge in the node N represented by CALL_EXPR
104 the callgraph. */
105
106cgraph_edge *
538dd0b7 107cgraph_edge::clone (cgraph_node *n, gcall *call_stmt, unsigned stmt_uid,
3dafb85c 108 gcov_type count_scale, int freq_scale, bool update_original)
564fe867 109{
3dafb85c
ML
110 cgraph_edge *new_edge;
111 gcov_type gcov_count = apply_probability (count, count_scale);
564fe867
JH
112 gcov_type freq;
113
114 /* We do not want to ignore loop nest after frequency drops to 0. */
115 if (!freq_scale)
116 freq_scale = 1;
3dafb85c 117 freq = frequency * (gcov_type) freq_scale / CGRAPH_FREQ_BASE;
564fe867
JH
118 if (freq > CGRAPH_FREQ_MAX)
119 freq = CGRAPH_FREQ_MAX;
120
3dafb85c 121 if (indirect_unknown_callee)
564fe867
JH
122 {
123 tree decl;
124
e57872ee
JH
125 if (call_stmt && (decl = gimple_call_fndecl (call_stmt))
126 /* When the call is speculative, we need to resolve it
127 via cgraph_resolve_speculation and not here. */
3dafb85c 128 && !speculative)
564fe867 129 {
3dafb85c 130 cgraph_node *callee = cgraph_node::get (decl);
564fe867 131 gcc_checking_assert (callee);
3dafb85c 132 new_edge = n->create_edge (callee, call_stmt, gcov_count, freq);
564fe867
JH
133 }
134 else
135 {
d52f5295 136 new_edge = n->create_indirect_edge (call_stmt,
3dafb85c 137 indirect_info->ecf_flags,
d34af022 138 count, freq, false);
3dafb85c 139 *new_edge->indirect_info = *indirect_info;
564fe867
JH
140 }
141 }
142 else
143 {
3dafb85c
ML
144 new_edge = n->create_edge (callee, call_stmt, gcov_count, freq);
145 if (indirect_info)
564fe867
JH
146 {
147 new_edge->indirect_info
766090c2 148 = ggc_cleared_alloc<cgraph_indirect_call_info> ();
3dafb85c 149 *new_edge->indirect_info = *indirect_info;
564fe867
JH
150 }
151 }
152
3dafb85c
ML
153 new_edge->inline_failed = inline_failed;
154 new_edge->indirect_inlining_edge = indirect_inlining_edge;
564fe867
JH
155 new_edge->lto_stmt_uid = stmt_uid;
156 /* Clone flags that depend on call_stmt availability manually. */
3dafb85c
ML
157 new_edge->can_throw_external = can_throw_external;
158 new_edge->call_stmt_cannot_inline_p = call_stmt_cannot_inline_p;
159 new_edge->speculative = speculative;
f9bb202b 160 new_edge->in_polymorphic_cdtor = in_polymorphic_cdtor;
564fe867
JH
161 if (update_original)
162 {
3dafb85c
ML
163 count -= new_edge->count;
164 if (count < 0)
165 count = 0;
564fe867 166 }
3dafb85c 167 symtab->call_edge_duplication_hooks (this, new_edge);
564fe867
JH
168 return new_edge;
169}
170
610c8ef0
MJ
171/* Build variant of function type ORIG_TYPE skipping ARGS_TO_SKIP and the
172 return value if SKIP_RETURN is true. */
173
174static tree
175build_function_type_skip_args (tree orig_type, bitmap args_to_skip,
176 bool skip_return)
177{
178 tree new_type = NULL;
5ae5a238 179 tree args, new_args = NULL;
610c8ef0
MJ
180 tree new_reversed;
181 int i = 0;
182
183 for (args = TYPE_ARG_TYPES (orig_type); args && args != void_list_node;
184 args = TREE_CHAIN (args), i++)
185 if (!args_to_skip || !bitmap_bit_p (args_to_skip, i))
186 new_args = tree_cons (NULL_TREE, TREE_VALUE (args), new_args);
187
188 new_reversed = nreverse (new_args);
189 if (args)
190 {
191 if (new_reversed)
192 TREE_CHAIN (new_args) = void_list_node;
193 else
194 new_reversed = void_list_node;
195 }
196
197 /* Use copy_node to preserve as much as possible from original type
198 (debug info, attribute lists etc.)
199 Exception is METHOD_TYPEs must have THIS argument.
200 When we are asked to remove it, we need to build new FUNCTION_TYPE
201 instead. */
202 if (TREE_CODE (orig_type) != METHOD_TYPE
203 || !args_to_skip
204 || !bitmap_bit_p (args_to_skip, 0))
205 {
206 new_type = build_distinct_type_copy (orig_type);
207 TYPE_ARG_TYPES (new_type) = new_reversed;
208 }
209 else
210 {
211 new_type
212 = build_distinct_type_copy (build_function_type (TREE_TYPE (orig_type),
213 new_reversed));
214 TYPE_CONTEXT (new_type) = TYPE_CONTEXT (orig_type);
215 }
216
217 if (skip_return)
218 TREE_TYPE (new_type) = void_type_node;
219
610c8ef0
MJ
220 return new_type;
221}
222
223/* Build variant of function decl ORIG_DECL skipping ARGS_TO_SKIP and the
224 return value if SKIP_RETURN is true.
225
226 Arguments from DECL_ARGUMENTS list can't be removed now, since they are
227 linked by TREE_CHAIN directly. The caller is responsible for eliminating
228 them when they are being duplicated (i.e. copy_arguments_for_versioning). */
229
230static tree
231build_function_decl_skip_args (tree orig_decl, bitmap args_to_skip,
232 bool skip_return)
233{
234 tree new_decl = copy_node (orig_decl);
235 tree new_type;
236
237 new_type = TREE_TYPE (orig_decl);
238 if (prototype_p (new_type)
239 || (skip_return && !VOID_TYPE_P (TREE_TYPE (new_type))))
240 new_type
241 = build_function_type_skip_args (new_type, args_to_skip, skip_return);
242 TREE_TYPE (new_decl) = new_type;
243
244 /* For declarations setting DECL_VINDEX (i.e. methods)
245 we expect first argument to be THIS pointer. */
246 if (args_to_skip && bitmap_bit_p (args_to_skip, 0))
247 DECL_VINDEX (new_decl) = NULL_TREE;
248
249 /* When signature changes, we need to clear builtin info. */
250 if (DECL_BUILT_IN (new_decl)
251 && args_to_skip
252 && !bitmap_empty_p (args_to_skip))
253 {
254 DECL_BUILT_IN_CLASS (new_decl) = NOT_BUILT_IN;
255 DECL_FUNCTION_CODE (new_decl) = (enum built_in_function) 0;
256 }
257 /* The FE might have information and assumptions about the other
258 arguments. */
259 DECL_LANG_SPECIFIC (new_decl) = NULL;
260 return new_decl;
261}
262
263/* Set flags of NEW_NODE and its decl. NEW_NODE is a newly created private
264 clone or its thunk. */
265
266static void
267set_new_clone_decl_and_node_flags (cgraph_node *new_node)
268{
269 DECL_EXTERNAL (new_node->decl) = 0;
610c8ef0
MJ
270 TREE_PUBLIC (new_node->decl) = 0;
271 DECL_COMDAT (new_node->decl) = 0;
272 DECL_WEAK (new_node->decl) = 0;
273 DECL_VIRTUAL_P (new_node->decl) = 0;
274 DECL_STATIC_CONSTRUCTOR (new_node->decl) = 0;
275 DECL_STATIC_DESTRUCTOR (new_node->decl) = 0;
276
277 new_node->externally_visible = 0;
278 new_node->local.local = 1;
279 new_node->lowered = true;
280}
281
282/* Duplicate thunk THUNK if necessary but make it to refer to NODE.
283 ARGS_TO_SKIP, if non-NULL, determines which parameters should be omitted.
284 Function can return NODE if no thunk is necessary, which can happen when
285 thunk is this_adjusting but we are removing this parameter. */
286
287static cgraph_node *
d284e1b8 288duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node)
610c8ef0
MJ
289{
290 cgraph_node *new_thunk, *thunk_of;
d52f5295 291 thunk_of = thunk->callees->callee->ultimate_alias_target ();
610c8ef0
MJ
292
293 if (thunk_of->thunk.thunk_p)
d284e1b8 294 node = duplicate_thunk_for_node (thunk_of, node);
610c8ef0 295
48fb6d40 296 if (!DECL_ARGUMENTS (thunk->decl))
70486010 297 thunk->get_untransformed_body ();
48fb6d40 298
3dafb85c 299 cgraph_edge *cs;
610c8ef0
MJ
300 for (cs = node->callers; cs; cs = cs->next_caller)
301 if (cs->caller->thunk.thunk_p
302 && cs->caller->thunk.this_adjusting == thunk->thunk.this_adjusting
303 && cs->caller->thunk.fixed_offset == thunk->thunk.fixed_offset
304 && cs->caller->thunk.virtual_offset_p == thunk->thunk.virtual_offset_p
305 && cs->caller->thunk.virtual_value == thunk->thunk.virtual_value)
306 return cs->caller;
307
308 tree new_decl;
d284e1b8 309 if (!node->clone.args_to_skip)
610c8ef0
MJ
310 new_decl = copy_node (thunk->decl);
311 else
312 {
313 /* We do not need to duplicate this_adjusting thunks if we have removed
314 this. */
315 if (thunk->thunk.this_adjusting
d284e1b8 316 && bitmap_bit_p (node->clone.args_to_skip, 0))
610c8ef0
MJ
317 return node;
318
d284e1b8
MJ
319 new_decl = build_function_decl_skip_args (thunk->decl,
320 node->clone.args_to_skip,
610c8ef0
MJ
321 false);
322 }
bec63208
MJ
323
324 tree *link = &DECL_ARGUMENTS (new_decl);
325 int i = 0;
326 for (tree pd = DECL_ARGUMENTS (thunk->decl); pd; pd = DECL_CHAIN (pd), i++)
327 {
328 if (!node->clone.args_to_skip
329 || !bitmap_bit_p (node->clone.args_to_skip, i))
330 {
331 tree nd = copy_node (pd);
332 DECL_CONTEXT (nd) = new_decl;
333 *link = nd;
334 link = &DECL_CHAIN (nd);
335 }
336 }
337 *link = NULL_TREE;
338
610c8ef0
MJ
339 gcc_checking_assert (!DECL_STRUCT_FUNCTION (new_decl));
340 gcc_checking_assert (!DECL_INITIAL (new_decl));
341 gcc_checking_assert (!DECL_RESULT (new_decl));
342 gcc_checking_assert (!DECL_RTL_SET_P (new_decl));
343
344 DECL_NAME (new_decl) = clone_function_name (thunk->decl, "artificial_thunk");
345 SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
610c8ef0 346
d52f5295 347 new_thunk = cgraph_node::create (new_decl);
610c8ef0
MJ
348 set_new_clone_decl_and_node_flags (new_thunk);
349 new_thunk->definition = true;
350 new_thunk->thunk = thunk->thunk;
351 new_thunk->unique_name = in_lto_p;
352 new_thunk->former_clone_of = thunk->decl;
d284e1b8
MJ
353 new_thunk->clone.args_to_skip = node->clone.args_to_skip;
354 new_thunk->clone.combined_args_to_skip = node->clone.combined_args_to_skip;
610c8ef0 355
3dafb85c 356 cgraph_edge *e = new_thunk->create_edge (node, NULL, 0,
d52f5295 357 CGRAPH_FREQ_BASE);
610c8ef0 358 e->call_stmt_cannot_inline_p = true;
3dafb85c 359 symtab->call_edge_duplication_hooks (thunk->callees, e);
3dafb85c 360 symtab->call_cgraph_duplication_hooks (thunk, new_thunk);
610c8ef0
MJ
361 return new_thunk;
362}
363
364/* If E does not lead to a thunk, simply redirect it to N. Otherwise create
365 one or more equivalent thunks for N and redirect E to the first in the
6a4bad95
MJ
366 chain. Note that it is then necessary to call
367 n->expand_all_artificial_thunks once all callers are redirected. */
610c8ef0
MJ
368
369void
6a4bad95 370cgraph_edge::redirect_callee_duplicating_thunks (cgraph_node *n)
610c8ef0 371{
6a4bad95 372 cgraph_node *orig_to = callee->ultimate_alias_target ();
610c8ef0 373 if (orig_to->thunk.thunk_p)
d284e1b8 374 n = duplicate_thunk_for_node (orig_to, n);
610c8ef0 375
6a4bad95
MJ
376 redirect_callee (n);
377}
378
379/* Call expand_thunk on all callers that are thunks and if analyze those nodes
380 that were expanded. */
381
382void
383cgraph_node::expand_all_artificial_thunks ()
384{
385 cgraph_edge *e;
386 for (e = callers; e;)
387 if (e->caller->thunk.thunk_p)
388 {
389 cgraph_node *thunk = e->caller;
390
391 e = e->next_caller;
392 if (thunk->expand_thunk (false, false))
393 {
394 thunk->thunk.thunk_p = false;
395 thunk->analyze ();
396 }
397 thunk->expand_all_artificial_thunks ();
398 }
399 else
400 e = e->next_caller;
610c8ef0 401}
564fe867
JH
402
403/* Create node representing clone of N executed COUNT times. Decrease
404 the execution counts from original node too.
405 The new clone will have decl set to DECL that may or may not be the same
406 as decl of N.
407
408 When UPDATE_ORIGINAL is true, the counts are subtracted from the original
409 function's profile to reflect the fact that part of execution is handled
410 by node.
411 When CALL_DUPLICATOIN_HOOK is true, the ipa passes are acknowledged about
44a60244
MJ
412 the new clone. Otherwise the caller is responsible for doing so later.
413
414 If the new node is being inlined into another one, NEW_INLINED_TO should be
415 the outline function the new one is (even indirectly) inlined to. All hooks
416 will see this in node's global.inlined_to, when invoked. Can be NULL if the
417 node is not inlined. */
564fe867 418
d52f5295 419cgraph_node *
ed6ef490 420cgraph_node::create_clone (tree new_decl, gcov_type gcov_count, int freq,
d52f5295
ML
421 bool update_original,
422 vec<cgraph_edge *> redirect_callers,
423 bool call_duplication_hook,
3dafb85c 424 cgraph_node *new_inlined_to,
d52f5295 425 bitmap args_to_skip)
564fe867 426{
3dafb85c
ML
427 cgraph_node *new_node = symtab->create_empty ();
428 cgraph_edge *e;
564fe867
JH
429 gcov_type count_scale;
430 unsigned i;
431
ed6ef490 432 new_node->decl = new_decl;
d52f5295
ML
433 new_node->register_symbol ();
434 new_node->origin = origin;
435 new_node->lto_file_data = lto_file_data;
564fe867
JH
436 if (new_node->origin)
437 {
438 new_node->next_nested = new_node->origin->nested;
439 new_node->origin->nested = new_node;
440 }
d52f5295
ML
441 new_node->analyzed = analyzed;
442 new_node->definition = definition;
443 new_node->local = local;
67348ccc 444 new_node->externally_visible = false;
7861b648 445 new_node->no_reorder = no_reorder;
564fe867 446 new_node->local.local = true;
d52f5295 447 new_node->global = global;
44a60244 448 new_node->global.inlined_to = new_inlined_to;
d52f5295 449 new_node->rtl = rtl;
564fe867 450 new_node->count = count;
d52f5295
ML
451 new_node->frequency = frequency;
452 new_node->tp_first_run = tp_first_run;
9d6171dc 453 new_node->tm_clone = tm_clone;
0a7246ee
JH
454 new_node->icf_merged = icf_merged;
455 new_node->merged = merged;
d284e1b8
MJ
456
457 new_node->clone.tree_map = NULL;
458 new_node->clone.args_to_skip = args_to_skip;
ed6ef490 459 new_node->split_part = split_part;
d284e1b8 460 if (!args_to_skip)
d52f5295
ML
461 new_node->clone.combined_args_to_skip = clone.combined_args_to_skip;
462 else if (clone.combined_args_to_skip)
d284e1b8
MJ
463 {
464 new_node->clone.combined_args_to_skip = BITMAP_GGC_ALLOC ();
465 bitmap_ior (new_node->clone.combined_args_to_skip,
d52f5295 466 clone.combined_args_to_skip, args_to_skip);
d284e1b8
MJ
467 }
468 else
469 new_node->clone.combined_args_to_skip = args_to_skip;
470
d52f5295 471 if (count)
564fe867 472 {
d52f5295 473 if (new_node->count > count)
564fe867
JH
474 count_scale = REG_BR_PROB_BASE;
475 else
d52f5295 476 count_scale = GCOV_COMPUTE_SCALE (new_node->count, count);
564fe867
JH
477 }
478 else
479 count_scale = 0;
480 if (update_original)
481 {
d52f5295
ML
482 count -= gcov_count;
483 if (count < 0)
484 count = 0;
564fe867
JH
485 }
486
9771b263 487 FOR_EACH_VEC_ELT (redirect_callers, i, e)
564fe867
JH
488 {
489 /* Redirect calls to the old version node to point to its new
9de6f6c3
JH
490 version. The only exception is when the edge was proved to
491 be unreachable during the clonning procedure. */
492 if (!e->callee
493 || DECL_BUILT_IN_CLASS (e->callee->decl) != BUILT_IN_NORMAL
494 || DECL_FUNCTION_CODE (e->callee->decl) != BUILT_IN_UNREACHABLE)
6a4bad95 495 e->redirect_callee_duplicating_thunks (new_node);
564fe867 496 }
6a4bad95 497 new_node->expand_all_artificial_thunks ();
564fe867 498
d52f5295 499 for (e = callees;e; e=e->next_callee)
3dafb85c
ML
500 e->clone (new_node, e->call_stmt, e->lto_stmt_uid, count_scale,
501 freq, update_original);
564fe867 502
d52f5295 503 for (e = indirect_calls; e; e = e->next_callee)
3dafb85c
ML
504 e->clone (new_node, e->call_stmt, e->lto_stmt_uid,
505 count_scale, freq, update_original);
d52f5295 506 new_node->clone_references (this);
564fe867 507
d52f5295
ML
508 new_node->next_sibling_clone = clones;
509 if (clones)
510 clones->prev_sibling_clone = new_node;
511 clones = new_node;
512 new_node->clone_of = this;
564fe867
JH
513
514 if (call_duplication_hook)
3dafb85c 515 symtab->call_cgraph_duplication_hooks (this, new_node);
564fe867
JH
516 return new_node;
517}
518
564fe867
JH
519static GTY(()) unsigned int clone_fn_id_num;
520
9816367c
BS
521/* Return a new assembler name for a clone with SUFFIX of a decl named
522 NAME. */
523
564fe867 524tree
9816367c 525clone_function_name_1 (const char *name, const char *suffix)
564fe867 526{
9816367c 527 size_t len = strlen (name);
564fe867
JH
528 char *tmp_name, *prefix;
529
530 prefix = XALLOCAVEC (char, len + strlen (suffix) + 2);
9816367c 531 memcpy (prefix, name, len);
564fe867
JH
532 strcpy (prefix + len + 1, suffix);
533#ifndef NO_DOT_IN_LABEL
534 prefix[len] = '.';
535#elif !defined NO_DOLLAR_IN_LABEL
536 prefix[len] = '$';
537#else
538 prefix[len] = '_';
539#endif
540 ASM_FORMAT_PRIVATE_NAME (tmp_name, prefix, clone_fn_id_num++);
541 return get_identifier (tmp_name);
542}
543
9816367c
BS
544/* Return a new assembler name for a clone of DECL with SUFFIX. */
545
546tree
547clone_function_name (tree decl, const char *suffix)
548{
549 tree name = DECL_ASSEMBLER_NAME (decl);
550 return clone_function_name_1 (IDENTIFIER_POINTER (name), suffix);
551}
552
553
564fe867
JH
554/* Create callgraph node clone with new declaration. The actual body will
555 be copied later at compilation stage.
556
557 TODO: after merging in ipa-sra use function call notes instead of args_to_skip
558 bitmap interface.
559 */
3dafb85c 560cgraph_node *
d52f5295
ML
561cgraph_node::create_virtual_clone (vec<cgraph_edge *> redirect_callers,
562 vec<ipa_replace_map *, va_gc> *tree_map,
563 bitmap args_to_skip, const char * suffix)
564fe867 564{
d52f5295 565 tree old_decl = decl;
3dafb85c 566 cgraph_node *new_node = NULL;
564fe867 567 tree new_decl;
440a5082 568 size_t len, i;
3dafb85c 569 ipa_replace_map *map;
440a5082 570 char *name;
564fe867 571
a2e2a668 572 if (!in_lto_p)
ed89033d 573 gcc_checking_assert (tree_versionable_function_p (old_decl));
564fe867 574
d52f5295 575 gcc_assert (local.can_change_signature || !args_to_skip);
564fe867
JH
576
577 /* Make a new FUNCTION_DECL tree node */
578 if (!args_to_skip)
579 new_decl = copy_node (old_decl);
580 else
581 new_decl = build_function_decl_skip_args (old_decl, args_to_skip, false);
49bde175
JH
582
583 /* These pointers represent function body and will be populated only when clone
584 is materialized. */
585 gcc_assert (new_decl != old_decl);
564fe867 586 DECL_STRUCT_FUNCTION (new_decl) = NULL;
49bde175
JH
587 DECL_ARGUMENTS (new_decl) = NULL;
588 DECL_INITIAL (new_decl) = NULL;
589 DECL_RESULT (new_decl) = NULL;
590 /* We can not do DECL_RESULT (new_decl) = NULL; here because of LTO partitioning
591 sometimes storing only clone decl instead of original. */
564fe867
JH
592
593 /* Generate a new name for the new version. */
440a5082
EB
594 len = IDENTIFIER_LENGTH (DECL_NAME (old_decl));
595 name = XALLOCAVEC (char, len + strlen (suffix) + 2);
596 memcpy (name, IDENTIFIER_POINTER (DECL_NAME (old_decl)), len);
597 strcpy (name + len + 1, suffix);
598 name[len] = '.';
599 DECL_NAME (new_decl) = get_identifier (name);
600 SET_DECL_ASSEMBLER_NAME (new_decl, clone_function_name (old_decl, suffix));
564fe867
JH
601 SET_DECL_RTL (new_decl, NULL);
602
d52f5295
ML
603 new_node = create_clone (new_decl, count, CGRAPH_FREQ_BASE, false,
604 redirect_callers, false, NULL, args_to_skip);
605
564fe867
JH
606 /* Update the properties.
607 Make clone visible only within this translation unit. Make sure
608 that is not weak also.
609 ??? We cannot use COMDAT linkage because there is no
610 ABI support for this. */
610c8ef0 611 set_new_clone_decl_and_node_flags (new_node);
564fe867 612 new_node->clone.tree_map = tree_map;
4ab26ee0 613 if (!implicit_section)
ed89033d 614 new_node->set_section (get_section ());
702d8703
JH
615
616 /* Clones of global symbols or symbols with unique names are unique. */
617 if ((TREE_PUBLIC (old_decl)
618 && !DECL_EXTERNAL (old_decl)
619 && !DECL_WEAK (old_decl)
620 && !DECL_COMDAT (old_decl))
621 || in_lto_p)
67348ccc 622 new_node->unique_name = true;
9771b263 623 FOR_EACH_VEC_SAFE_ELT (tree_map, i, map)
3dafb85c 624 new_node->maybe_create_reference (map->new_tree, IPA_REF_ADDR, NULL);
d284e1b8 625
d52f5295 626 if (ipa_transforms_to_apply.exists ())
ca860d03 627 new_node->ipa_transforms_to_apply
d52f5295 628 = ipa_transforms_to_apply.copy ();
564fe867 629
3dafb85c 630 symtab->call_cgraph_duplication_hooks (this, new_node);
564fe867
JH
631
632 return new_node;
633}
634
d52f5295
ML
635/* callgraph node being removed from symbol table; see if its entry can be
636 replaced by other inline clone. */
637cgraph_node *
638cgraph_node::find_replacement (void)
564fe867 639{
3dafb85c 640 cgraph_node *next_inline_clone, *replacement;
564fe867 641
d52f5295 642 for (next_inline_clone = clones;
564fe867 643 next_inline_clone
d52f5295 644 && next_inline_clone->decl != decl;
564fe867
JH
645 next_inline_clone = next_inline_clone->next_sibling_clone)
646 ;
647
648 /* If there is inline clone of the node being removed, we need
649 to put it into the position of removed node and reorganize all
650 other clones to be based on it. */
651 if (next_inline_clone)
652 {
3dafb85c
ML
653 cgraph_node *n;
654 cgraph_node *new_clones;
564fe867
JH
655
656 replacement = next_inline_clone;
657
658 /* Unlink inline clone from the list of clones of removed node. */
659 if (next_inline_clone->next_sibling_clone)
660 next_inline_clone->next_sibling_clone->prev_sibling_clone
661 = next_inline_clone->prev_sibling_clone;
662 if (next_inline_clone->prev_sibling_clone)
663 {
d52f5295 664 gcc_assert (clones != next_inline_clone);
564fe867
JH
665 next_inline_clone->prev_sibling_clone->next_sibling_clone
666 = next_inline_clone->next_sibling_clone;
667 }
668 else
669 {
d52f5295
ML
670 gcc_assert (clones == next_inline_clone);
671 clones = next_inline_clone->next_sibling_clone;
564fe867
JH
672 }
673
d52f5295
ML
674 new_clones = clones;
675 clones = NULL;
564fe867
JH
676
677 /* Copy clone info. */
d52f5295 678 next_inline_clone->clone = clone;
564fe867
JH
679
680 /* Now place it into clone tree at same level at NODE. */
d52f5295 681 next_inline_clone->clone_of = clone_of;
564fe867
JH
682 next_inline_clone->prev_sibling_clone = NULL;
683 next_inline_clone->next_sibling_clone = NULL;
d52f5295 684 if (clone_of)
564fe867 685 {
d52f5295
ML
686 if (clone_of->clones)
687 clone_of->clones->prev_sibling_clone = next_inline_clone;
688 next_inline_clone->next_sibling_clone = clone_of->clones;
689 clone_of->clones = next_inline_clone;
564fe867
JH
690 }
691
692 /* Merge the clone list. */
693 if (new_clones)
694 {
695 if (!next_inline_clone->clones)
696 next_inline_clone->clones = new_clones;
697 else
698 {
699 n = next_inline_clone->clones;
700 while (n->next_sibling_clone)
d52f5295 701 n = n->next_sibling_clone;
564fe867
JH
702 n->next_sibling_clone = new_clones;
703 new_clones->prev_sibling_clone = n;
704 }
705 }
706
707 /* Update clone_of pointers. */
708 n = new_clones;
709 while (n)
710 {
711 n->clone_of = next_inline_clone;
712 n = n->next_sibling_clone;
713 }
714 return replacement;
715 }
716 else
717 return NULL;
718}
719
720/* Like cgraph_set_call_stmt but walk the clone tree and update all
042ae7d2
JH
721 clones sharing the same function body.
722 When WHOLE_SPECULATIVE_EDGES is true, all three components of
723 speculative edge gets updated. Otherwise we update only direct
724 call. */
564fe867
JH
725
726void
538dd0b7
DM
727cgraph_node::set_call_stmt_including_clones (gimple old_stmt,
728 gcall *new_stmt,
d52f5295 729 bool update_speculative)
564fe867 730{
3dafb85c
ML
731 cgraph_node *node;
732 cgraph_edge *edge = get_edge (old_stmt);
564fe867
JH
733
734 if (edge)
3dafb85c 735 edge->set_call_stmt (new_stmt, update_speculative);
564fe867 736
d52f5295 737 node = clones;
564fe867 738 if (node)
d52f5295 739 while (node != this)
564fe867 740 {
3dafb85c 741 cgraph_edge *edge = node->get_edge (old_stmt);
564fe867 742 if (edge)
042ae7d2 743 {
3dafb85c 744 edge->set_call_stmt (new_stmt, update_speculative);
042ae7d2
JH
745 /* If UPDATE_SPECULATIVE is false, it means that we are turning
746 speculative call into a real code sequence. Update the
747 callgraph edges. */
748 if (edge->speculative && !update_speculative)
749 {
3dafb85c
ML
750 cgraph_edge *direct, *indirect;
751 ipa_ref *ref;
042ae7d2
JH
752
753 gcc_assert (!edge->indirect_unknown_callee);
3dafb85c 754 edge->speculative_call_info (direct, indirect, ref);
042ae7d2
JH
755 direct->speculative = false;
756 indirect->speculative = false;
757 ref->speculative = false;
758 }
759 }
564fe867
JH
760 if (node->clones)
761 node = node->clones;
762 else if (node->next_sibling_clone)
763 node = node->next_sibling_clone;
764 else
765 {
d52f5295 766 while (node != this && !node->next_sibling_clone)
564fe867 767 node = node->clone_of;
d52f5295 768 if (node != this)
564fe867
JH
769 node = node->next_sibling_clone;
770 }
771 }
772}
773
774/* Like cgraph_create_edge walk the clone tree and update all clones sharing
775 same function body. If clones already have edge for OLD_STMT; only
776 update the edge same way as cgraph_set_call_stmt_including_clones does.
777
778 TODO: COUNT and LOOP_DEPTH should be properly distributed based on relative
779 frequencies of the clones. */
780
781void
3dafb85c 782cgraph_node::create_edge_including_clones (cgraph_node *callee,
538dd0b7 783 gimple old_stmt, gcall *stmt,
d52f5295
ML
784 gcov_type count,
785 int freq,
786 cgraph_inline_failed_t reason)
564fe867 787{
3dafb85c
ML
788 cgraph_node *node;
789 cgraph_edge *edge;
564fe867 790
d52f5295 791 if (!get_edge (stmt))
564fe867 792 {
d52f5295 793 edge = create_edge (callee, stmt, count, freq);
564fe867
JH
794 edge->inline_failed = reason;
795 }
796
d52f5295 797 node = clones;
564fe867 798 if (node)
d52f5295 799 while (node != this)
564fe867 800 {
3dafb85c 801 cgraph_edge *edge = node->get_edge (old_stmt);
564fe867
JH
802
803 /* It is possible that clones already contain the edge while
804 master didn't. Either we promoted indirect call into direct
805 call in the clone or we are processing clones of unreachable
806 master where edges has been removed. */
807 if (edge)
3dafb85c 808 edge->set_call_stmt (stmt);
d52f5295 809 else if (! node->get_edge (stmt))
564fe867 810 {
d52f5295 811 edge = node->create_edge (callee, stmt, count, freq);
564fe867
JH
812 edge->inline_failed = reason;
813 }
814
815 if (node->clones)
816 node = node->clones;
817 else if (node->next_sibling_clone)
818 node = node->next_sibling_clone;
819 else
820 {
d52f5295 821 while (node != this && !node->next_sibling_clone)
564fe867 822 node = node->clone_of;
d52f5295 823 if (node != this)
564fe867
JH
824 node = node->next_sibling_clone;
825 }
826 }
827}
828
829/* Remove the node from cgraph and all inline clones inlined into it.
830 Skip however removal of FORBIDDEN_NODE and return true if it needs to be
831 removed. This allows to call the function from outer loop walking clone
832 tree. */
833
834bool
d52f5295 835cgraph_node::remove_symbol_and_inline_clones (cgraph_node *forbidden_node)
564fe867 836{
3dafb85c 837 cgraph_edge *e, *next;
564fe867
JH
838 bool found = false;
839
d52f5295 840 if (this == forbidden_node)
39f9719e 841 {
3dafb85c 842 callers->remove ();
39f9719e
JH
843 return true;
844 }
d52f5295 845 for (e = callees; e; e = next)
564fe867
JH
846 {
847 next = e->next_callee;
848 if (!e->inline_failed)
d52f5295 849 found |= e->callee->remove_symbol_and_inline_clones (forbidden_node);
564fe867 850 }
d52f5295 851 remove ();
564fe867
JH
852 return found;
853}
854
855/* The edges representing the callers of the NEW_VERSION node were
856 fixed by cgraph_function_versioning (), now the call_expr in their
857 respective tree code should be updated to call the NEW_VERSION. */
858
859static void
3dafb85c 860update_call_expr (cgraph_node *new_version)
564fe867 861{
3dafb85c 862 cgraph_edge *e;
564fe867
JH
863
864 gcc_assert (new_version);
865
866 /* Update the call expr on the edges to call the new version. */
867 for (e = new_version->callers; e; e = e->next_caller)
868 {
3dafb85c 869 function *inner_function = DECL_STRUCT_FUNCTION (e->caller->decl);
67348ccc 870 gimple_call_set_fndecl (e->call_stmt, new_version->decl);
564fe867
JH
871 maybe_clean_eh_stmt_fn (inner_function, e->call_stmt);
872 }
873}
874
875
876/* Create a new cgraph node which is the new version of
d52f5295 877 callgraph node. REDIRECT_CALLERS holds the callers
564fe867 878 edges which should be redirected to point to
d52f5295 879 NEW_VERSION. ALL the callees edges of the node
564fe867
JH
880 are cloned to the new version node. Return the new
881 version node.
882
883 If non-NULL BLOCK_TO_COPY determine what basic blocks
884 was copied to prevent duplications of calls that are dead
885 in the clone. */
886
d52f5295
ML
887cgraph_node *
888cgraph_node::create_version_clone (tree new_decl,
889 vec<cgraph_edge *> redirect_callers,
890 bitmap bbs_to_copy)
564fe867 891 {
3dafb85c
ML
892 cgraph_node *new_version;
893 cgraph_edge *e;
564fe867
JH
894 unsigned i;
895
d52f5295 896 new_version = cgraph_node::create (new_decl);
564fe867 897
d52f5295
ML
898 new_version->analyzed = analyzed;
899 new_version->definition = definition;
900 new_version->local = local;
67348ccc 901 new_version->externally_visible = false;
7861b648 902 new_version->no_reorder = no_reorder;
67348ccc 903 new_version->local.local = new_version->definition;
d52f5295
ML
904 new_version->global = global;
905 new_version->rtl = rtl;
906 new_version->count = count;
564fe867 907
d52f5295 908 for (e = callees; e; e=e->next_callee)
564fe867
JH
909 if (!bbs_to_copy
910 || bitmap_bit_p (bbs_to_copy, gimple_bb (e->call_stmt)->index))
3dafb85c
ML
911 e->clone (new_version, e->call_stmt,
912 e->lto_stmt_uid, REG_BR_PROB_BASE,
913 CGRAPH_FREQ_BASE,
914 true);
d52f5295 915 for (e = indirect_calls; e; e=e->next_callee)
564fe867
JH
916 if (!bbs_to_copy
917 || bitmap_bit_p (bbs_to_copy, gimple_bb (e->call_stmt)->index))
3dafb85c
ML
918 e->clone (new_version, e->call_stmt,
919 e->lto_stmt_uid, REG_BR_PROB_BASE,
920 CGRAPH_FREQ_BASE,
921 true);
9771b263 922 FOR_EACH_VEC_ELT (redirect_callers, i, e)
564fe867
JH
923 {
924 /* Redirect calls to the old version node to point to its new
925 version. */
3dafb85c 926 e->redirect_callee (new_version);
564fe867
JH
927 }
928
3dafb85c 929 symtab->call_cgraph_duplication_hooks (this, new_version);
564fe867
JH
930
931 return new_version;
932 }
933
934/* Perform function versioning.
935 Function versioning includes copying of the tree and
936 a callgraph update (creating a new cgraph node and updating
937 its callees and callers).
938
939 REDIRECT_CALLERS varray includes the edges to be redirected
940 to the new version.
941
942 TREE_MAP is a mapping of tree nodes we want to replace with
943 new ones (according to results of prior analysis).
564fe867
JH
944
945 If non-NULL ARGS_TO_SKIP determine function parameters to remove
946 from new version.
947 If SKIP_RETURN is true, the new version will return void.
948 If non-NULL BLOCK_TO_COPY determine what basic blocks to copy.
949 If non_NULL NEW_ENTRY determine new entry BB of the clone.
950
951 Return the new version's cgraph node. */
952
d52f5295
ML
953cgraph_node *
954cgraph_node::create_version_clone_with_body
955 (vec<cgraph_edge *> redirect_callers,
956 vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip,
957 bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block,
958 const char *clone_name)
564fe867 959{
d52f5295 960 tree old_decl = decl;
3dafb85c 961 cgraph_node *new_version_node = NULL;
564fe867
JH
962 tree new_decl;
963
964 if (!tree_versionable_function_p (old_decl))
965 return NULL;
966
d52f5295 967 gcc_assert (local.can_change_signature || !args_to_skip);
564fe867
JH
968
969 /* Make a new FUNCTION_DECL tree node for the new version. */
970 if (!args_to_skip && !skip_return)
971 new_decl = copy_node (old_decl);
972 else
973 new_decl
974 = build_function_decl_skip_args (old_decl, args_to_skip, skip_return);
975
976 /* Generate a new name for the new version. */
977 DECL_NAME (new_decl) = clone_function_name (old_decl, clone_name);
978 SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
979 SET_DECL_RTL (new_decl, NULL);
980
981 /* When the old decl was a con-/destructor make sure the clone isn't. */
c3284718
RS
982 DECL_STATIC_CONSTRUCTOR (new_decl) = 0;
983 DECL_STATIC_DESTRUCTOR (new_decl) = 0;
564fe867
JH
984
985 /* Create the new version's call-graph node.
986 and update the edges of the new node. */
d52f5295
ML
987 new_version_node = create_version_clone (new_decl, redirect_callers,
988 bbs_to_copy);
564fe867 989
d52f5295 990 if (ipa_transforms_to_apply.exists ())
c6d43074 991 new_version_node->ipa_transforms_to_apply
d52f5295 992 = ipa_transforms_to_apply.copy ();
564fe867
JH
993 /* Copy the OLD_VERSION_NODE function tree to the new version. */
994 tree_function_versioning (old_decl, new_decl, tree_map, false, args_to_skip,
995 skip_return, bbs_to_copy, new_entry_block);
996
997 /* Update the new version's properties.
998 Make The new version visible only within this translation unit. Make sure
999 that is not weak also.
1000 ??? We cannot use COMDAT linkage because there is no
1001 ABI support for this. */
d52f5295 1002 new_version_node->make_decl_local ();
67348ccc
DM
1003 DECL_VIRTUAL_P (new_version_node->decl) = 0;
1004 new_version_node->externally_visible = 0;
564fe867
JH
1005 new_version_node->local.local = 1;
1006 new_version_node->lowered = true;
4ab26ee0
JJ
1007 if (!implicit_section)
1008 new_version_node->set_section (get_section ());
702d8703
JH
1009 /* Clones of global symbols or symbols with unique names are unique. */
1010 if ((TREE_PUBLIC (old_decl)
1011 && !DECL_EXTERNAL (old_decl)
1012 && !DECL_WEAK (old_decl)
1013 && !DECL_COMDAT (old_decl))
1014 || in_lto_p)
67348ccc 1015 new_version_node->unique_name = true;
564fe867
JH
1016
1017 /* Update the call_expr on the edges to call the new version node. */
1018 update_call_expr (new_version_node);
1019
3dafb85c 1020 symtab->call_cgraph_insertion_hooks (this);
564fe867
JH
1021 return new_version_node;
1022}
1023
1024/* Given virtual clone, turn it into actual clone. */
1025
1026static void
3dafb85c 1027cgraph_materialize_clone (cgraph_node *node)
564fe867
JH
1028{
1029 bitmap_obstack_initialize (NULL);
67348ccc 1030 node->former_clone_of = node->clone_of->decl;
564fe867
JH
1031 if (node->clone_of->former_clone_of)
1032 node->former_clone_of = node->clone_of->former_clone_of;
1033 /* Copy the OLD_VERSION_NODE function tree to the new version. */
67348ccc 1034 tree_function_versioning (node->clone_of->decl, node->decl,
564fe867
JH
1035 node->clone.tree_map, true,
1036 node->clone.args_to_skip, false,
1037 NULL, NULL);
3dafb85c 1038 if (symtab->dump_file)
564fe867 1039 {
3dafb85c
ML
1040 dump_function_to_file (node->clone_of->decl, symtab->dump_file,
1041 dump_flags);
1042 dump_function_to_file (node->decl, symtab->dump_file, dump_flags);
564fe867
JH
1043 }
1044
1045 /* Function is no longer clone. */
1046 if (node->next_sibling_clone)
1047 node->next_sibling_clone->prev_sibling_clone = node->prev_sibling_clone;
1048 if (node->prev_sibling_clone)
1049 node->prev_sibling_clone->next_sibling_clone = node->next_sibling_clone;
1050 else
1051 node->clone_of->clones = node->next_sibling_clone;
1052 node->next_sibling_clone = NULL;
1053 node->prev_sibling_clone = NULL;
67348ccc 1054 if (!node->clone_of->analyzed && !node->clone_of->clones)
564fe867 1055 {
d52f5295
ML
1056 node->clone_of->release_body ();
1057 node->clone_of->remove_callees ();
d122681a 1058 node->clone_of->remove_all_references ();
564fe867
JH
1059 }
1060 node->clone_of = NULL;
1061 bitmap_obstack_release (NULL);
1062}
1063
1064/* Once all functions from compilation unit are in memory, produce all clones
1065 and update all calls. We might also do this on demand if we don't want to
1066 bring all functions to memory prior compilation, but current WHOPR
1067 implementation does that and it is is bit easier to keep everything right in
1068 this order. */
1069
1070void
3dafb85c 1071symbol_table::materialize_all_clones (void)
564fe867 1072{
3dafb85c 1073 cgraph_node *node;
564fe867 1074 bool stabilized = false;
042ae7d2 1075
564fe867 1076
3dafb85c
ML
1077 if (symtab->dump_file)
1078 fprintf (symtab->dump_file, "Materializing clones\n");
564fe867 1079#ifdef ENABLE_CHECKING
d52f5295 1080 cgraph_node::verify_cgraph_nodes ();
564fe867
JH
1081#endif
1082
1083 /* We can also do topological order, but number of iterations should be
1084 bounded by number of IPA passes since single IPA pass is probably not
1085 going to create clones of clones it created itself. */
1086 while (!stabilized)
1087 {
1088 stabilized = true;
1089 FOR_EACH_FUNCTION (node)
1090 {
67348ccc
DM
1091 if (node->clone_of && node->decl != node->clone_of->decl
1092 && !gimple_has_body_p (node->decl))
564fe867 1093 {
a2e2a668 1094 if (!node->clone_of->clone_of)
70486010 1095 node->clone_of->get_untransformed_body ();
67348ccc 1096 if (gimple_has_body_p (node->clone_of->decl))
564fe867 1097 {
3dafb85c 1098 if (symtab->dump_file)
564fe867 1099 {
3dafb85c 1100 fprintf (symtab->dump_file, "cloning %s to %s\n",
2a72a953
DM
1101 xstrdup_for_dump (node->clone_of->name ()),
1102 xstrdup_for_dump (node->name ()));
564fe867
JH
1103 if (node->clone.tree_map)
1104 {
1105 unsigned int i;
3dafb85c 1106 fprintf (symtab->dump_file, " replace map: ");
9771b263
DN
1107 for (i = 0;
1108 i < vec_safe_length (node->clone.tree_map);
1109 i++)
564fe867 1110 {
3dafb85c 1111 ipa_replace_map *replace_info;
9771b263 1112 replace_info = (*node->clone.tree_map)[i];
3dafb85c
ML
1113 print_generic_expr (symtab->dump_file, replace_info->old_tree, 0);
1114 fprintf (symtab->dump_file, " -> ");
1115 print_generic_expr (symtab->dump_file, replace_info->new_tree, 0);
1116 fprintf (symtab->dump_file, "%s%s;",
564fe867
JH
1117 replace_info->replace_p ? "(replace)":"",
1118 replace_info->ref_p ? "(ref)":"");
1119 }
3dafb85c 1120 fprintf (symtab->dump_file, "\n");
564fe867
JH
1121 }
1122 if (node->clone.args_to_skip)
1123 {
3dafb85c
ML
1124 fprintf (symtab->dump_file, " args_to_skip: ");
1125 dump_bitmap (symtab->dump_file,
1126 node->clone.args_to_skip);
564fe867
JH
1127 }
1128 if (node->clone.args_to_skip)
1129 {
3dafb85c
ML
1130 fprintf (symtab->dump_file, " combined_args_to_skip:");
1131 dump_bitmap (symtab->dump_file, node->clone.combined_args_to_skip);
564fe867
JH
1132 }
1133 }
1134 cgraph_materialize_clone (node);
1135 stabilized = false;
1136 }
1137 }
1138 }
1139 }
1140 FOR_EACH_FUNCTION (node)
67348ccc 1141 if (!node->analyzed && node->callees)
71cafea9 1142 {
d52f5295 1143 node->remove_callees ();
d122681a 1144 node->remove_all_references ();
71cafea9
JH
1145 }
1146 else
d122681a 1147 node->clear_stmts_in_references ();
3dafb85c
ML
1148 if (symtab->dump_file)
1149 fprintf (symtab->dump_file, "Materialization Call site updates done.\n");
564fe867 1150#ifdef ENABLE_CHECKING
d52f5295 1151 cgraph_node::verify_cgraph_nodes ();
564fe867 1152#endif
17e0fc92 1153 symtab->remove_unreachable_nodes (symtab->dump_file);
564fe867
JH
1154}
1155
1156#include "gt-cgraphclones.h"