[PR67828] don't unswitch on default defs of non-parms
[official-gcc.git] / gcc / varpool.c
blob7d11e20e1165621f8a5e85936b7855ce819ec93a
1 /* Callgraph handling code.
2 Copyright (C) 2003-2015 Free Software Foundation, Inc.
3 Contributed by Jan Hubicka
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
10 version.
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
15 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 "backend.h"
25 #include "tree.h"
26 #include "gimple.h"
27 #include "hard-reg-set.h"
28 #include "alias.h"
29 #include "fold-const.h"
30 #include "varasm.h"
31 #include "cgraph.h"
32 #include "langhooks.h"
33 #include "diagnostic-core.h"
34 #include "timevar.h"
35 #include "debug.h"
36 #include "target.h"
37 #include "output.h"
38 #include "flags.h"
39 #include "lto-streamer.h"
40 #include "context.h"
41 #include "omp-low.h"
43 const char * const tls_model_names[]={"none", "emulated",
44 "global-dynamic", "local-dynamic",
45 "initial-exec", "local-exec"};
47 /* List of hooks triggered on varpool_node events. */
48 struct varpool_node_hook_list {
49 varpool_node_hook hook;
50 void *data;
51 struct varpool_node_hook_list *next;
54 /* Register HOOK to be called with DATA on each removed node. */
55 varpool_node_hook_list *
56 symbol_table::add_varpool_removal_hook (varpool_node_hook hook, void *data)
58 varpool_node_hook_list *entry;
59 varpool_node_hook_list **ptr = &m_first_varpool_removal_hook;
61 entry = (varpool_node_hook_list *) xmalloc (sizeof (*entry));
62 entry->hook = hook;
63 entry->data = data;
64 entry->next = NULL;
65 while (*ptr)
66 ptr = &(*ptr)->next;
67 *ptr = entry;
68 return entry;
71 /* Remove ENTRY from the list of hooks called on removing nodes. */
72 void
73 symbol_table::remove_varpool_removal_hook (varpool_node_hook_list *entry)
75 varpool_node_hook_list **ptr = &m_first_varpool_removal_hook;
77 while (*ptr != entry)
78 ptr = &(*ptr)->next;
79 *ptr = entry->next;
80 free (entry);
83 /* Call all node removal hooks. */
84 void
85 symbol_table::call_varpool_removal_hooks (varpool_node *node)
87 varpool_node_hook_list *entry = m_first_varpool_removal_hook;
88 while (entry)
90 entry->hook (node, entry->data);
91 entry = entry->next;
95 /* Register HOOK to be called with DATA on each inserted node. */
96 varpool_node_hook_list *
97 symbol_table::add_varpool_insertion_hook (varpool_node_hook hook, void *data)
99 varpool_node_hook_list *entry;
100 varpool_node_hook_list **ptr = &m_first_varpool_insertion_hook;
102 entry = (varpool_node_hook_list *) xmalloc (sizeof (*entry));
103 entry->hook = hook;
104 entry->data = data;
105 entry->next = NULL;
106 while (*ptr)
107 ptr = &(*ptr)->next;
108 *ptr = entry;
109 return entry;
112 /* Remove ENTRY from the list of hooks called on inserted nodes. */
113 void
114 symbol_table::remove_varpool_insertion_hook (varpool_node_hook_list *entry)
116 varpool_node_hook_list **ptr = &m_first_varpool_insertion_hook;
118 while (*ptr != entry)
119 ptr = &(*ptr)->next;
120 *ptr = entry->next;
121 free (entry);
124 /* Call all node insertion hooks. */
125 void
126 symbol_table::call_varpool_insertion_hooks (varpool_node *node)
128 varpool_node_hook_list *entry = m_first_varpool_insertion_hook;
129 while (entry)
131 entry->hook (node, entry->data);
132 entry = entry->next;
136 /* Allocate new callgraph node and insert it into basic data structures. */
138 varpool_node *
139 varpool_node::create_empty (void)
141 varpool_node *node = ggc_cleared_alloc<varpool_node> ();
142 node->type = SYMTAB_VARIABLE;
143 return node;
146 /* Return varpool node assigned to DECL. Create new one when needed. */
147 varpool_node *
148 varpool_node::get_create (tree decl)
150 varpool_node *node = varpool_node::get (decl);
151 gcc_checking_assert (TREE_CODE (decl) == VAR_DECL);
152 if (node)
153 return node;
155 node = varpool_node::create_empty ();
156 node->decl = decl;
158 if ((flag_openacc || flag_openmp) && !DECL_EXTERNAL (decl)
159 && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl)))
161 node->offloadable = 1;
162 #ifdef ENABLE_OFFLOADING
163 g->have_offload = true;
164 if (!in_lto_p)
165 vec_safe_push (offload_vars, decl);
166 node->force_output = 1;
167 #endif
170 node->register_symbol ();
171 return node;
174 /* Remove variable from symbol table. */
176 void
177 varpool_node::remove (void)
179 symtab->call_varpool_removal_hooks (this);
180 if (lto_file_data)
182 lto_free_function_in_decl_state_for_node (this);
183 lto_file_data = NULL;
186 /* When streaming we can have multiple nodes associated with decl. */
187 if (symtab->state == LTO_STREAMING)
189 /* Keep constructor when it may be used for folding. We remove
190 references to external variables before final compilation. */
191 else if (DECL_INITIAL (decl) && DECL_INITIAL (decl) != error_mark_node
192 && !ctor_useable_for_folding_p ())
193 remove_initializer ();
195 unregister ();
196 ggc_free (this);
199 /* Remove node initializer when it is no longer needed. */
200 void
201 varpool_node::remove_initializer (void)
203 if (DECL_INITIAL (decl)
204 && !DECL_IN_CONSTANT_POOL (decl)
205 /* Keep vtables for BINFO folding. */
206 && !DECL_VIRTUAL_P (decl)
207 /* FIXME: http://gcc.gnu.org/PR55395 */
208 && debug_info_level == DINFO_LEVEL_NONE
209 /* When doing declaration merging we have duplicate
210 entries for given decl. Do not attempt to remove
211 the boides, or we will end up remiving
212 wrong one. */
213 && symtab->state != LTO_STREAMING)
214 DECL_INITIAL (decl) = error_mark_node;
217 /* Dump given varpool node to F. */
218 void
219 varpool_node::dump (FILE *f)
221 dump_base (f);
222 fprintf (f, " Availability: %s\n",
223 symtab->function_flags_ready
224 ? cgraph_availability_names[get_availability ()]
225 : "not-ready");
226 fprintf (f, " Varpool flags:");
227 if (DECL_INITIAL (decl))
228 fprintf (f, " initialized");
229 if (output)
230 fprintf (f, " output");
231 if (used_by_single_function)
232 fprintf (f, " used-by-single-function");
233 if (need_bounds_init)
234 fprintf (f, " need-bounds-init");
235 if (TREE_READONLY (decl))
236 fprintf (f, " read-only");
237 if (ctor_useable_for_folding_p ())
238 fprintf (f, " const-value-known");
239 if (writeonly)
240 fprintf (f, " write-only");
241 if (tls_model)
242 fprintf (f, " tls-%s", tls_model_names [tls_model]);
243 fprintf (f, "\n");
247 /* Dump given varpool node to stderr. */
248 void varpool_node::debug (void)
250 varpool_node::dump (stderr);
253 /* Dump the variable pool to F. */
254 void
255 varpool_node::dump_varpool (FILE *f)
257 varpool_node *node;
259 fprintf (f, "variable pool:\n\n");
260 FOR_EACH_VARIABLE (node)
261 node->dump (f);
264 /* Dump the variable pool to stderr. */
266 DEBUG_FUNCTION void
267 varpool_node::debug_varpool (void)
269 dump_varpool (stderr);
272 /* Given an assembler name, lookup node. */
273 varpool_node *
274 varpool_node::get_for_asmname (tree asmname)
276 if (symtab_node *node = symtab_node::get_for_asmname (asmname))
277 return dyn_cast <varpool_node *> (node);
278 else
279 return NULL;
282 /* When doing LTO, read variable's constructor from disk if
283 it is not already present. */
285 tree
286 varpool_node::get_constructor (void)
288 lto_file_decl_data *file_data;
289 const char *data, *name;
290 size_t len;
292 if (DECL_INITIAL (decl) != error_mark_node
293 || !in_lto_p
294 || !lto_file_data)
295 return DECL_INITIAL (decl);
297 timevar_push (TV_IPA_LTO_CTORS_IN);
299 file_data = lto_file_data;
300 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
302 /* We may have renamed the declaration, e.g., a static function. */
303 name = lto_get_decl_name_mapping (file_data, name);
305 data = lto_get_section_data (file_data, LTO_section_function_body,
306 name, &len);
307 if (!data)
308 fatal_error (input_location, "%s: section %s is missing",
309 file_data->file_name,
310 name);
312 lto_input_variable_constructor (file_data, this, data);
313 gcc_assert (DECL_INITIAL (decl) != error_mark_node);
314 lto_stats.num_function_bodies++;
315 lto_free_section_data (file_data, LTO_section_function_body, name,
316 data, len);
317 lto_free_function_in_decl_state_for_node (this);
318 timevar_pop (TV_IPA_LTO_CTORS_IN);
319 return DECL_INITIAL (decl);
322 /* Return true if variable has constructor that can be used for folding. */
324 bool
325 varpool_node::ctor_useable_for_folding_p (void)
327 varpool_node *real_node = this;
329 if (real_node->alias && real_node->definition)
330 real_node = ultimate_alias_target ();
332 if (TREE_CODE (decl) == CONST_DECL
333 || DECL_IN_CONSTANT_POOL (decl))
334 return true;
335 if (TREE_THIS_VOLATILE (decl))
336 return false;
338 /* If we do not have a constructor, we can't use it. */
339 if (DECL_INITIAL (real_node->decl) == error_mark_node
340 && !real_node->lto_file_data)
341 return false;
343 /* Avoid attempts to load constructors that was not streamed. */
344 if (flag_ltrans && DECL_INITIAL (real_node->decl) == error_mark_node
345 && real_node->body_removed)
346 return false;
348 /* Vtables are defined by their types and must match no matter of interposition
349 rules. */
350 if (DECL_VIRTUAL_P (decl))
352 /* The C++ front end creates VAR_DECLs for vtables of typeinfo
353 classes not defined in the current TU so that it can refer
354 to them from typeinfo objects. Avoid returning NULL_TREE. */
355 return DECL_INITIAL (real_node->decl) != NULL;
358 /* Alias of readonly variable is also readonly, since the variable is stored
359 in readonly memory. We also accept readonly aliases of non-readonly
360 locations assuming that user knows what he is asking for. */
361 if (!TREE_READONLY (decl) && !TREE_READONLY (real_node->decl))
362 return false;
364 /* Variables declared 'const' without an initializer
365 have zero as the initializer if they may not be
366 overridden at link or run time.
368 It is actually requirement for C++ compiler to optimize const variables
369 consistently. As a GNU extension, do not enfore this rule for user defined
370 weak variables, so we support interposition on:
371 static const int dummy = 0;
372 extern const int foo __attribute__((__weak__, __alias__("dummy")));
374 if ((!DECL_INITIAL (real_node->decl)
375 || (DECL_WEAK (decl) && !DECL_COMDAT (decl)))
376 && (DECL_EXTERNAL (decl) || decl_replaceable_p (decl)))
377 return false;
379 /* Variables declared `const' with an initializer are considered
380 to not be overwritable with different initializer by default.
382 ??? Previously we behaved so for scalar variables but not for array
383 accesses. */
384 return true;
387 /* If DECLARATION is constant variable and its initial value is known
388 (so we can do constant folding), return its constructor (DECL_INITIAL).
389 This may be an expression or NULL when DECL is initialized to 0.
390 Return ERROR_MARK_NODE otherwise.
392 In LTO this may actually trigger reading the constructor from disk.
393 For this reason varpool_ctor_useable_for_folding_p should be used when
394 the actual constructor value is not needed. */
396 tree
397 ctor_for_folding (tree decl)
399 varpool_node *node, *real_node;
400 tree real_decl;
402 if (TREE_CODE (decl) != VAR_DECL
403 && TREE_CODE (decl) != CONST_DECL)
404 return error_mark_node;
406 /* Static constant bounds are created to be
407 used instead of constants and therefore
408 do not let folding it. */
409 if (POINTER_BOUNDS_P (decl))
410 return error_mark_node;
412 if (TREE_CODE (decl) == CONST_DECL
413 || DECL_IN_CONSTANT_POOL (decl))
414 return DECL_INITIAL (decl);
416 if (TREE_THIS_VOLATILE (decl))
417 return error_mark_node;
419 /* Do not care about automatic variables. Those are never initialized
420 anyway, because gimplifier exapnds the code. */
421 if (!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
423 gcc_assert (!TREE_PUBLIC (decl));
424 return error_mark_node;
427 gcc_assert (TREE_CODE (decl) == VAR_DECL);
429 real_node = node = varpool_node::get (decl);
430 if (node)
432 real_node = node->ultimate_alias_target ();
433 real_decl = real_node->decl;
435 else
436 real_decl = decl;
438 /* See if we are dealing with alias.
439 In most cases alias is just alternative symbol pointing to a given
440 constructor. This allows us to use interposition rules of DECL
441 constructor of REAL_NODE. However weakrefs are special by being just
442 alternative name of their target (if defined). */
443 if (decl != real_decl)
445 gcc_assert (!DECL_INITIAL (decl)
446 || (node->alias && node->get_alias_target () == real_node)
447 || DECL_INITIAL (decl) == error_mark_node);
448 if (node->weakref)
450 node = node->get_alias_target ();
451 decl = node->decl;
455 if ((!DECL_VIRTUAL_P (real_decl)
456 || DECL_INITIAL (real_decl) == error_mark_node
457 || !DECL_INITIAL (real_decl))
458 && (!node || !node->ctor_useable_for_folding_p ()))
459 return error_mark_node;
461 /* OK, we can return constructor. See if we need to fetch it from disk
462 in LTO mode. */
463 if (DECL_INITIAL (real_decl) != error_mark_node
464 || !in_lto_p)
465 return DECL_INITIAL (real_decl);
466 return real_node->get_constructor ();
469 /* Add the variable DECL to the varpool.
470 Unlike finalize_decl function is intended to be used
471 by middle end and allows insertion of new variable at arbitrary point
472 of compilation. */
473 void
474 varpool_node::add (tree decl)
476 varpool_node *node;
477 varpool_node::finalize_decl (decl);
478 node = varpool_node::get_create (decl);
479 symtab->call_varpool_insertion_hooks (node);
480 if (node->externally_visible_p ())
481 node->externally_visible = true;
482 if (lookup_attribute ("no_reorder", DECL_ATTRIBUTES (decl)))
483 node->no_reorder = 1;
486 /* Return variable availability. See cgraph.h for description of individual
487 return values. */
488 enum availability
489 varpool_node::get_availability (void)
491 if (!definition)
492 return AVAIL_NOT_AVAILABLE;
493 if (!TREE_PUBLIC (decl))
494 return AVAIL_AVAILABLE;
495 if (DECL_IN_CONSTANT_POOL (decl)
496 || DECL_VIRTUAL_P (decl))
497 return AVAIL_AVAILABLE;
498 if (alias && weakref)
500 enum availability avail;
502 ultimate_alias_target (&avail)->get_availability ();
503 return avail;
505 /* If the variable can be overwritten, return OVERWRITABLE. Takes
506 care of at least one notable extension - the COMDAT variables
507 used to share template instantiations in C++. */
508 if (decl_replaceable_p (decl)
509 || DECL_EXTERNAL (decl))
510 return AVAIL_INTERPOSABLE;
511 return AVAIL_AVAILABLE;
514 void
515 varpool_node::analyze (void)
517 /* When reading back varpool at LTO time, we re-construct the queue in order
518 to have "needed" list right by inserting all needed nodes into varpool.
519 We however don't want to re-analyze already analyzed nodes. */
520 if (!analyzed)
522 gcc_assert (!in_lto_p || symtab->function_flags_ready);
523 /* Compute the alignment early so function body expanders are
524 already informed about increased alignment. */
525 align_variable (decl, 0);
527 if (alias)
528 resolve_alias (varpool_node::get (alias_target));
529 else if (DECL_INITIAL (decl))
530 record_references_in_initializer (decl, analyzed);
531 analyzed = true;
534 /* Assemble thunks and aliases associated to varpool node. */
536 void
537 varpool_node::assemble_aliases (void)
539 ipa_ref *ref;
541 FOR_EACH_ALIAS (this, ref)
543 varpool_node *alias = dyn_cast <varpool_node *> (ref->referring);
544 do_assemble_alias (alias->decl,
545 DECL_ASSEMBLER_NAME (decl));
546 alias->assemble_aliases ();
550 /* Output one variable, if necessary. Return whether we output it. */
552 bool
553 varpool_node::assemble_decl (void)
555 /* Aliases are outout when their target is produced or by
556 output_weakrefs. */
557 if (alias)
558 return false;
560 /* Constant pool is output from RTL land when the reference
561 survive till this level. */
562 if (DECL_IN_CONSTANT_POOL (decl) && TREE_ASM_WRITTEN (decl))
563 return false;
565 /* Decls with VALUE_EXPR should not be in the varpool at all. They
566 are not real variables, but just info for debugging and codegen.
567 Unfortunately at the moment emutls is not updating varpool correctly
568 after turning real vars into value_expr vars. */
569 if (DECL_HAS_VALUE_EXPR_P (decl)
570 && !targetm.have_tls)
571 return false;
573 /* Hard register vars do not need to be output. */
574 if (DECL_HARD_REGISTER (decl))
575 return false;
577 gcc_checking_assert (!TREE_ASM_WRITTEN (decl)
578 && TREE_CODE (decl) == VAR_DECL
579 && !DECL_HAS_VALUE_EXPR_P (decl));
581 if (!in_other_partition
582 && !DECL_EXTERNAL (decl))
584 get_constructor ();
585 assemble_variable (decl, 0, 1, 0);
586 gcc_assert (TREE_ASM_WRITTEN (decl));
587 gcc_assert (definition);
588 assemble_aliases ();
589 /* After the parser has generated debugging information, augment
590 this information with any new location/etc information that may
591 have become available after the compilation proper. */
592 timevar_start (TV_PHASE_DBGINFO);
593 debug_hooks->late_global_decl (decl);
594 timevar_stop (TV_PHASE_DBGINFO);
595 return true;
598 return false;
601 /* Add NODE to queue starting at FIRST.
602 The queue is linked via AUX pointers and terminated by pointer to 1. */
604 static void
605 enqueue_node (varpool_node *node, varpool_node **first)
607 if (node->aux)
608 return;
609 gcc_checking_assert (*first);
610 node->aux = *first;
611 *first = node;
614 /* Optimization of function bodies might've rendered some variables as
615 unnecessary so we want to avoid these from being compiled. Re-do
616 reachability starting from variables that are either externally visible
617 or was referred from the asm output routines. */
619 void
620 symbol_table::remove_unreferenced_decls (void)
622 varpool_node *next, *node;
623 varpool_node *first = (varpool_node *)(void *)1;
624 int i;
625 ipa_ref *ref = NULL;
626 hash_set<varpool_node *> referenced;
628 if (seen_error ())
629 return;
631 if (dump_file)
632 fprintf (dump_file, "Trivially needed variables:");
633 FOR_EACH_DEFINED_VARIABLE (node)
635 if (node->analyzed
636 && (!node->can_remove_if_no_refs_p ()
637 /* We just expanded all function bodies. See if any of
638 them needed the variable. */
639 || DECL_RTL_SET_P (node->decl)))
641 enqueue_node (node, &first);
642 if (dump_file)
643 fprintf (dump_file, " %s", node->asm_name ());
646 while (first != (varpool_node *)(void *)1)
648 node = first;
649 first = (varpool_node *)first->aux;
651 if (node->same_comdat_group)
653 symtab_node *next;
654 for (next = node->same_comdat_group;
655 next != node;
656 next = next->same_comdat_group)
658 varpool_node *vnext = dyn_cast <varpool_node *> (next);
659 if (vnext && vnext->analyzed && !next->comdat_local_p ())
660 enqueue_node (vnext, &first);
663 for (i = 0; node->iterate_reference (i, ref); i++)
665 varpool_node *vnode = dyn_cast <varpool_node *> (ref->referred);
666 if (vnode
667 && !vnode->in_other_partition
668 && (!DECL_EXTERNAL (ref->referred->decl)
669 || vnode->alias)
670 && vnode->analyzed)
671 enqueue_node (vnode, &first);
672 else
673 referenced.add (node);
676 if (dump_file)
677 fprintf (dump_file, "\nRemoving variables:");
678 for (node = first_defined_variable (); node; node = next)
680 next = next_defined_variable (node);
681 if (!node->aux && !node->no_reorder)
683 if (dump_file)
684 fprintf (dump_file, " %s", node->asm_name ());
685 if (referenced.contains(node))
686 node->remove_initializer ();
687 else
688 node->remove ();
692 if (dump_file)
693 fprintf (dump_file, "\n");
696 /* For variables in named sections make sure get_variable_section
697 is called before we switch to those sections. Then section
698 conflicts between read-only and read-only requiring relocations
699 sections can be resolved. */
700 void
701 varpool_node::finalize_named_section_flags (void)
703 if (!TREE_ASM_WRITTEN (decl)
704 && !alias
705 && !in_other_partition
706 && !DECL_EXTERNAL (decl)
707 && TREE_CODE (decl) == VAR_DECL
708 && !DECL_HAS_VALUE_EXPR_P (decl)
709 && get_section ())
710 get_variable_section (decl, false);
713 /* Output all variables enqueued to be assembled. */
714 bool
715 symbol_table::output_variables (void)
717 bool changed = false;
718 varpool_node *node;
720 if (seen_error ())
721 return false;
723 remove_unreferenced_decls ();
725 timevar_push (TV_VAROUT);
727 FOR_EACH_VARIABLE (node)
728 if (!node->definition
729 && !DECL_HAS_VALUE_EXPR_P (node->decl)
730 && !DECL_HARD_REGISTER (node->decl))
731 assemble_undefined_decl (node->decl);
732 FOR_EACH_DEFINED_VARIABLE (node)
734 /* Handled in output_in_order. */
735 if (node->no_reorder)
736 continue;
738 node->finalize_named_section_flags ();
741 FOR_EACH_DEFINED_VARIABLE (node)
743 /* Handled in output_in_order. */
744 if (node->no_reorder)
745 continue;
746 if (node->assemble_decl ())
747 changed = true;
749 timevar_pop (TV_VAROUT);
750 return changed;
753 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
754 Extra name aliases are output whenever DECL is output. */
756 varpool_node *
757 varpool_node::create_alias (tree alias, tree decl)
759 varpool_node *alias_node;
761 gcc_assert (TREE_CODE (decl) == VAR_DECL);
762 gcc_assert (TREE_CODE (alias) == VAR_DECL);
763 alias_node = varpool_node::get_create (alias);
764 alias_node->alias = true;
765 alias_node->definition = true;
766 alias_node->alias_target = decl;
767 if (lookup_attribute ("weakref", DECL_ATTRIBUTES (alias)) != NULL)
768 alias_node->weakref = true;
769 return alias_node;
772 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
773 Extra name aliases are output whenever DECL is output. */
775 varpool_node *
776 varpool_node::create_extra_name_alias (tree alias, tree decl)
778 varpool_node *alias_node;
780 #ifndef ASM_OUTPUT_DEF
781 /* If aliases aren't supported by the assembler, fail. */
782 return NULL;
783 #endif
784 alias_node = varpool_node::create_alias (alias, decl);
785 alias_node->cpp_implicit_alias = true;
787 /* Extra name alias mechanizm creates aliases really late
788 via DECL_ASSEMBLER_NAME mechanizm.
789 This is unfortunate because they are not going through the
790 standard channels. Ensure they get output. */
791 if (symtab->cpp_implicit_aliases_done)
792 alias_node->resolve_alias (varpool_node::get_create (decl));
793 return alias_node;
796 /* Worker for call_for_symbol_and_aliases. */
798 bool
799 varpool_node::call_for_symbol_and_aliases_1 (bool (*callback) (varpool_node *,
800 void *),
801 void *data,
802 bool include_overwritable)
804 ipa_ref *ref;
806 FOR_EACH_ALIAS (this, ref)
808 varpool_node *alias = dyn_cast <varpool_node *> (ref->referring);
809 if (include_overwritable
810 || alias->get_availability () > AVAIL_INTERPOSABLE)
811 if (alias->call_for_symbol_and_aliases (callback, data,
812 include_overwritable))
813 return true;
815 return false;