x86: Update __CET__ check
[official-gcc.git] / gcc / varpool.c
blob418753cca2aee20c34352ad3564c5c33baafffd7
1 /* Callgraph handling code.
2 Copyright (C) 2003-2018 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 "target.h"
26 #include "tree.h"
27 #include "gimple.h"
28 #include "timevar.h"
29 #include "cgraph.h"
30 #include "lto-streamer.h"
31 #include "varasm.h"
32 #include "debug.h"
33 #include "output.h"
34 #include "omp-offload.h"
35 #include "context.h"
36 #include "stringpool.h"
37 #include "attribs.h"
39 const char * const tls_model_names[]={"none", "emulated",
40 "global-dynamic", "local-dynamic",
41 "initial-exec", "local-exec"};
43 /* List of hooks triggered on varpool_node events. */
44 struct varpool_node_hook_list {
45 varpool_node_hook hook;
46 void *data;
47 struct varpool_node_hook_list *next;
50 /* Register HOOK to be called with DATA on each removed node. */
51 varpool_node_hook_list *
52 symbol_table::add_varpool_removal_hook (varpool_node_hook hook, void *data)
54 varpool_node_hook_list *entry;
55 varpool_node_hook_list **ptr = &m_first_varpool_removal_hook;
57 entry = (varpool_node_hook_list *) xmalloc (sizeof (*entry));
58 entry->hook = hook;
59 entry->data = data;
60 entry->next = NULL;
61 while (*ptr)
62 ptr = &(*ptr)->next;
63 *ptr = entry;
64 return entry;
67 /* Remove ENTRY from the list of hooks called on removing nodes. */
68 void
69 symbol_table::remove_varpool_removal_hook (varpool_node_hook_list *entry)
71 varpool_node_hook_list **ptr = &m_first_varpool_removal_hook;
73 while (*ptr != entry)
74 ptr = &(*ptr)->next;
75 *ptr = entry->next;
76 free (entry);
79 /* Call all node removal hooks. */
80 void
81 symbol_table::call_varpool_removal_hooks (varpool_node *node)
83 varpool_node_hook_list *entry = m_first_varpool_removal_hook;
84 while (entry)
86 entry->hook (node, entry->data);
87 entry = entry->next;
91 /* Register HOOK to be called with DATA on each inserted node. */
92 varpool_node_hook_list *
93 symbol_table::add_varpool_insertion_hook (varpool_node_hook hook, void *data)
95 varpool_node_hook_list *entry;
96 varpool_node_hook_list **ptr = &m_first_varpool_insertion_hook;
98 entry = (varpool_node_hook_list *) xmalloc (sizeof (*entry));
99 entry->hook = hook;
100 entry->data = data;
101 entry->next = NULL;
102 while (*ptr)
103 ptr = &(*ptr)->next;
104 *ptr = entry;
105 return entry;
108 /* Remove ENTRY from the list of hooks called on inserted nodes. */
109 void
110 symbol_table::remove_varpool_insertion_hook (varpool_node_hook_list *entry)
112 varpool_node_hook_list **ptr = &m_first_varpool_insertion_hook;
114 while (*ptr != entry)
115 ptr = &(*ptr)->next;
116 *ptr = entry->next;
117 free (entry);
120 /* Call all node insertion hooks. */
121 void
122 symbol_table::call_varpool_insertion_hooks (varpool_node *node)
124 varpool_node_hook_list *entry = m_first_varpool_insertion_hook;
125 while (entry)
127 entry->hook (node, entry->data);
128 entry = entry->next;
132 /* Allocate new callgraph node and insert it into basic data structures. */
134 varpool_node *
135 varpool_node::create_empty (void)
137 varpool_node *node = ggc_cleared_alloc<varpool_node> ();
138 node->type = SYMTAB_VARIABLE;
139 return node;
142 /* Return varpool node assigned to DECL. Create new one when needed. */
143 varpool_node *
144 varpool_node::get_create (tree decl)
146 varpool_node *node = varpool_node::get (decl);
147 gcc_checking_assert (VAR_P (decl));
148 if (node)
149 return node;
151 node = varpool_node::create_empty ();
152 node->decl = decl;
154 if ((flag_openacc || flag_openmp)
155 && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl)))
157 node->offloadable = 1;
158 if (ENABLE_OFFLOADING && !DECL_EXTERNAL (decl))
160 g->have_offload = true;
161 if (!in_lto_p)
162 vec_safe_push (offload_vars, decl);
166 node->register_symbol ();
167 return node;
170 /* Remove variable from symbol table. */
172 void
173 varpool_node::remove (void)
175 symtab->call_varpool_removal_hooks (this);
176 if (lto_file_data)
178 lto_free_function_in_decl_state_for_node (this);
179 lto_file_data = NULL;
182 /* When streaming we can have multiple nodes associated with decl. */
183 if (symtab->state == LTO_STREAMING)
185 /* Keep constructor when it may be used for folding. We remove
186 references to external variables before final compilation. */
187 else if (DECL_INITIAL (decl) && DECL_INITIAL (decl) != error_mark_node
188 && !ctor_useable_for_folding_p ())
189 remove_initializer ();
191 unregister ();
192 ggc_free (this);
195 /* Remove node initializer when it is no longer needed. */
196 void
197 varpool_node::remove_initializer (void)
199 if (DECL_INITIAL (decl)
200 && !DECL_IN_CONSTANT_POOL (decl)
201 /* Keep vtables for BINFO folding. */
202 && !DECL_VIRTUAL_P (decl)
203 /* FIXME: http://gcc.gnu.org/PR55395 */
204 && debug_info_level == DINFO_LEVEL_NONE
205 /* When doing declaration merging we have duplicate
206 entries for given decl. Do not attempt to remove
207 the boides, or we will end up remiving
208 wrong one. */
209 && symtab->state != LTO_STREAMING)
210 DECL_INITIAL (decl) = error_mark_node;
213 /* Dump given varpool node to F. */
214 void
215 varpool_node::dump (FILE *f)
217 dump_base (f);
218 fprintf (f, " Availability: %s\n",
219 symtab->function_flags_ready
220 ? cgraph_availability_names[get_availability ()]
221 : "not-ready");
222 fprintf (f, " Varpool flags:");
223 if (DECL_INITIAL (decl))
224 fprintf (f, " initialized");
225 if (output)
226 fprintf (f, " output");
227 if (used_by_single_function)
228 fprintf (f, " used-by-single-function");
229 if (need_bounds_init)
230 fprintf (f, " need-bounds-init");
231 if (TREE_READONLY (decl))
232 fprintf (f, " read-only");
233 if (ctor_useable_for_folding_p ())
234 fprintf (f, " const-value-known");
235 if (writeonly)
236 fprintf (f, " write-only");
237 if (tls_model)
238 fprintf (f, " tls-%s", tls_model_names [tls_model]);
239 fprintf (f, "\n");
243 /* Dump given varpool node to stderr. */
244 void varpool_node::debug (void)
246 varpool_node::dump (stderr);
249 /* Dump the variable pool to F. */
250 void
251 varpool_node::dump_varpool (FILE *f)
253 varpool_node *node;
255 fprintf (f, "variable pool:\n\n");
256 FOR_EACH_VARIABLE (node)
257 node->dump (f);
260 /* Dump the variable pool to stderr. */
262 DEBUG_FUNCTION void
263 varpool_node::debug_varpool (void)
265 dump_varpool (stderr);
268 /* Given an assembler name, lookup node. */
269 varpool_node *
270 varpool_node::get_for_asmname (tree asmname)
272 if (symtab_node *node = symtab_node::get_for_asmname (asmname))
273 return dyn_cast <varpool_node *> (node);
274 else
275 return NULL;
278 /* When doing LTO, read variable's constructor from disk if
279 it is not already present. */
281 tree
282 varpool_node::get_constructor (void)
284 lto_file_decl_data *file_data;
285 const char *data, *name;
286 size_t len;
288 if (DECL_INITIAL (decl) != error_mark_node
289 || !in_lto_p
290 || !lto_file_data)
291 return DECL_INITIAL (decl);
293 timevar_push (TV_IPA_LTO_CTORS_IN);
295 file_data = lto_file_data;
296 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
298 /* We may have renamed the declaration, e.g., a static function. */
299 name = lto_get_decl_name_mapping (file_data, name);
300 struct lto_in_decl_state *decl_state
301 = lto_get_function_in_decl_state (file_data, decl);
303 data = lto_get_section_data (file_data, LTO_section_function_body,
304 name, &len, decl_state->compressed);
305 if (!data)
306 fatal_error (input_location, "%s: section %s is missing",
307 file_data->file_name,
308 name);
310 lto_input_variable_constructor (file_data, this, data);
311 gcc_assert (DECL_INITIAL (decl) != error_mark_node);
312 lto_stats.num_function_bodies++;
313 lto_free_section_data (file_data, LTO_section_function_body, name,
314 data, len, decl_state->compressed);
315 lto_free_function_in_decl_state_for_node (this);
316 timevar_pop (TV_IPA_LTO_CTORS_IN);
317 return DECL_INITIAL (decl);
320 /* Return true if variable has constructor that can be used for folding. */
322 bool
323 varpool_node::ctor_useable_for_folding_p (void)
325 varpool_node *real_node = this;
327 if (real_node->alias && real_node->definition)
328 real_node = ultimate_alias_target ();
330 if (TREE_CODE (decl) == CONST_DECL
331 || DECL_IN_CONSTANT_POOL (decl))
332 return true;
333 if (TREE_THIS_VOLATILE (decl))
334 return false;
336 /* If we do not have a constructor, we can't use it. */
337 if (DECL_INITIAL (real_node->decl) == error_mark_node
338 && !real_node->lto_file_data)
339 return false;
341 /* Avoid attempts to load constructors that was not streamed. */
342 if (flag_ltrans && DECL_INITIAL (real_node->decl) == error_mark_node
343 && real_node->body_removed)
344 return false;
346 /* Vtables are defined by their types and must match no matter of interposition
347 rules. */
348 if (DECL_VIRTUAL_P (decl))
350 /* The C++ front end creates VAR_DECLs for vtables of typeinfo
351 classes not defined in the current TU so that it can refer
352 to them from typeinfo objects. Avoid returning NULL_TREE. */
353 return DECL_INITIAL (real_node->decl) != NULL;
356 /* Alias of readonly variable is also readonly, since the variable is stored
357 in readonly memory. We also accept readonly aliases of non-readonly
358 locations assuming that user knows what he is asking for. */
359 if (!TREE_READONLY (decl) && !TREE_READONLY (real_node->decl))
360 return false;
362 /* Variables declared 'const' without an initializer
363 have zero as the initializer if they may not be
364 overridden at link or run time.
366 It is actually requirement for C++ compiler to optimize const variables
367 consistently. As a GNU extension, do not enfore this rule for user defined
368 weak variables, so we support interposition on:
369 static const int dummy = 0;
370 extern const int foo __attribute__((__weak__, __alias__("dummy")));
372 if ((!DECL_INITIAL (real_node->decl)
373 || (DECL_WEAK (decl) && !DECL_COMDAT (decl)))
374 && (DECL_EXTERNAL (decl) || decl_replaceable_p (decl)))
375 return false;
377 /* Variables declared `const' with an initializer are considered
378 to not be overwritable with different initializer by default.
380 ??? Previously we behaved so for scalar variables but not for array
381 accesses. */
382 return true;
385 /* If DECLARATION is constant variable and its initial value is known
386 (so we can do constant folding), return its constructor (DECL_INITIAL).
387 This may be an expression or NULL when DECL is initialized to 0.
388 Return ERROR_MARK_NODE otherwise.
390 In LTO this may actually trigger reading the constructor from disk.
391 For this reason varpool_ctor_useable_for_folding_p should be used when
392 the actual constructor value is not needed. */
394 tree
395 ctor_for_folding (tree decl)
397 varpool_node *node, *real_node;
398 tree real_decl;
400 if (!VAR_P (decl) && TREE_CODE (decl) != CONST_DECL)
401 return error_mark_node;
403 /* Static constant bounds are created to be
404 used instead of constants and therefore
405 do not let folding it. */
406 if (POINTER_BOUNDS_P (decl))
407 return error_mark_node;
409 if (TREE_CODE (decl) == CONST_DECL
410 || DECL_IN_CONSTANT_POOL (decl))
411 return DECL_INITIAL (decl);
413 if (TREE_THIS_VOLATILE (decl))
414 return error_mark_node;
416 /* Do not care about automatic variables. Those are never initialized
417 anyway, because gimplifier exapnds the code. */
418 if (!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
420 gcc_assert (!TREE_PUBLIC (decl));
421 return error_mark_node;
424 gcc_assert (VAR_P (decl));
426 real_node = node = varpool_node::get (decl);
427 if (node)
429 real_node = node->ultimate_alias_target ();
430 real_decl = real_node->decl;
432 else
433 real_decl = decl;
435 /* See if we are dealing with alias.
436 In most cases alias is just alternative symbol pointing to a given
437 constructor. This allows us to use interposition rules of DECL
438 constructor of REAL_NODE. However weakrefs are special by being just
439 alternative name of their target (if defined). */
440 if (decl != real_decl)
442 gcc_assert (!DECL_INITIAL (decl)
443 || (node->alias && node->get_alias_target () == real_node)
444 || DECL_INITIAL (decl) == error_mark_node);
445 while (node->transparent_alias && node->analyzed)
447 node = node->get_alias_target ();
448 decl = node->decl;
452 if ((!DECL_VIRTUAL_P (real_decl)
453 || DECL_INITIAL (real_decl) == error_mark_node
454 || !DECL_INITIAL (real_decl))
455 && (!node || !node->ctor_useable_for_folding_p ()))
456 return error_mark_node;
458 /* OK, we can return constructor. See if we need to fetch it from disk
459 in LTO mode. */
460 if (DECL_INITIAL (real_decl) != error_mark_node
461 || !in_lto_p)
462 return DECL_INITIAL (real_decl);
463 return real_node->get_constructor ();
466 /* Add the variable DECL to the varpool.
467 Unlike finalize_decl function is intended to be used
468 by middle end and allows insertion of new variable at arbitrary point
469 of compilation. */
470 void
471 varpool_node::add (tree decl)
473 varpool_node *node;
474 varpool_node::finalize_decl (decl);
475 node = varpool_node::get_create (decl);
476 symtab->call_varpool_insertion_hooks (node);
477 if (node->externally_visible_p ())
478 node->externally_visible = true;
479 if (lookup_attribute ("no_reorder", DECL_ATTRIBUTES (decl)))
480 node->no_reorder = 1;
483 /* Return variable availability. See cgraph.h for description of individual
484 return values. */
485 enum availability
486 varpool_node::get_availability (symtab_node *ref)
488 if (!definition)
489 return AVAIL_NOT_AVAILABLE;
490 if (!TREE_PUBLIC (decl))
491 return AVAIL_AVAILABLE;
492 if (DECL_IN_CONSTANT_POOL (decl)
493 || DECL_VIRTUAL_P (decl))
494 return AVAIL_AVAILABLE;
495 if (transparent_alias && definition)
497 enum availability avail;
499 ultimate_alias_target (&avail, ref);
500 return avail;
502 /* If this is a reference from symbol itself and there are no aliases, we
503 may be sure that the symbol was not interposed by something else because
504 the symbol itself would be unreachable otherwise. */
505 if ((this == ref && !has_aliases_p ())
506 || (ref && get_comdat_group ()
507 && get_comdat_group () == ref->get_comdat_group ()))
508 return AVAIL_AVAILABLE;
509 /* If the variable can be overwritten, return OVERWRITABLE. Takes
510 care of at least one notable extension - the COMDAT variables
511 used to share template instantiations in C++. */
512 if (decl_replaceable_p (decl)
513 || DECL_EXTERNAL (decl))
514 return AVAIL_INTERPOSABLE;
515 return AVAIL_AVAILABLE;
518 void
519 varpool_node::analyze (void)
521 /* When reading back varpool at LTO time, we re-construct the queue in order
522 to have "needed" list right by inserting all needed nodes into varpool.
523 We however don't want to re-analyze already analyzed nodes. */
524 if (!analyzed)
526 gcc_assert (!in_lto_p || symtab->function_flags_ready);
527 /* Compute the alignment early so function body expanders are
528 already informed about increased alignment. */
529 align_variable (decl, 0);
531 if (alias)
532 resolve_alias (varpool_node::get (alias_target));
533 else if (DECL_INITIAL (decl))
534 record_references_in_initializer (decl, analyzed);
535 analyzed = true;
538 /* Assemble thunks and aliases associated to varpool node. */
540 void
541 varpool_node::assemble_aliases (void)
543 ipa_ref *ref;
545 FOR_EACH_ALIAS (this, ref)
547 varpool_node *alias = dyn_cast <varpool_node *> (ref->referring);
548 if (!alias->transparent_alias)
549 do_assemble_alias (alias->decl,
550 DECL_ASSEMBLER_NAME (decl));
551 alias->assemble_aliases ();
555 /* Output one variable, if necessary. Return whether we output it. */
557 bool
558 varpool_node::assemble_decl (void)
560 /* Aliases are outout when their target is produced or by
561 output_weakrefs. */
562 if (alias)
563 return false;
565 /* Constant pool is output from RTL land when the reference
566 survive till this level. */
567 if (DECL_IN_CONSTANT_POOL (decl) && TREE_ASM_WRITTEN (decl))
568 return false;
570 /* Decls with VALUE_EXPR should not be in the varpool at all. They
571 are not real variables, but just info for debugging and codegen.
572 Unfortunately at the moment emutls is not updating varpool correctly
573 after turning real vars into value_expr vars. */
574 if (DECL_HAS_VALUE_EXPR_P (decl)
575 && !targetm.have_tls)
576 return false;
578 /* Hard register vars do not need to be output. */
579 if (DECL_HARD_REGISTER (decl))
580 return false;
582 gcc_checking_assert (!TREE_ASM_WRITTEN (decl)
583 && VAR_P (decl)
584 && !DECL_HAS_VALUE_EXPR_P (decl));
586 if (!in_other_partition
587 && !DECL_EXTERNAL (decl))
589 get_constructor ();
590 assemble_variable (decl, 0, 1, 0);
591 gcc_assert (TREE_ASM_WRITTEN (decl));
592 gcc_assert (definition);
593 assemble_aliases ();
594 /* After the parser has generated debugging information, augment
595 this information with any new location/etc information that may
596 have become available after the compilation proper. */
597 debug_hooks->late_global_decl (decl);
598 return true;
601 return false;
604 /* Add NODE to queue starting at FIRST.
605 The queue is linked via AUX pointers and terminated by pointer to 1. */
607 static void
608 enqueue_node (varpool_node *node, varpool_node **first)
610 if (node->aux)
611 return;
612 gcc_checking_assert (*first);
613 node->aux = *first;
614 *first = node;
617 /* Optimization of function bodies might've rendered some variables as
618 unnecessary so we want to avoid these from being compiled. Re-do
619 reachability starting from variables that are either externally visible
620 or was referred from the asm output routines. */
622 void
623 symbol_table::remove_unreferenced_decls (void)
625 varpool_node *next, *node;
626 varpool_node *first = (varpool_node *)(void *)1;
627 int i;
628 ipa_ref *ref = NULL;
629 hash_set<varpool_node *> referenced;
631 if (seen_error ())
632 return;
634 if (dump_file)
635 fprintf (dump_file, "Trivially needed variables:");
636 FOR_EACH_DEFINED_VARIABLE (node)
638 if (node->analyzed
639 && (!node->can_remove_if_no_refs_p ()
640 /* We just expanded all function bodies. See if any of
641 them needed the variable. */
642 || DECL_RTL_SET_P (node->decl)))
644 enqueue_node (node, &first);
645 if (dump_file)
646 fprintf (dump_file, " %s", node->asm_name ());
649 while (first != (varpool_node *)(void *)1)
651 node = first;
652 first = (varpool_node *)first->aux;
654 if (node->same_comdat_group)
656 symtab_node *next;
657 for (next = node->same_comdat_group;
658 next != node;
659 next = next->same_comdat_group)
661 varpool_node *vnext = dyn_cast <varpool_node *> (next);
662 if (vnext && vnext->analyzed && !next->comdat_local_p ())
663 enqueue_node (vnext, &first);
666 for (i = 0; node->iterate_reference (i, ref); i++)
668 varpool_node *vnode = dyn_cast <varpool_node *> (ref->referred);
669 if (vnode
670 && !vnode->in_other_partition
671 && (!DECL_EXTERNAL (ref->referred->decl)
672 || vnode->alias)
673 && vnode->analyzed)
674 enqueue_node (vnode, &first);
675 else
677 referenced.add (vnode);
678 while (vnode && vnode->alias && vnode->definition)
680 vnode = vnode->get_alias_target ();
681 referenced.add (vnode);
686 if (dump_file)
687 fprintf (dump_file, "\nRemoving variables:");
688 for (node = first_defined_variable (); node; node = next)
690 next = next_defined_variable (node);
691 if (!node->aux && !node->no_reorder)
693 if (dump_file)
694 fprintf (dump_file, " %s", node->asm_name ());
695 if (referenced.contains(node))
696 node->remove_initializer ();
697 else
698 node->remove ();
702 if (dump_file)
703 fprintf (dump_file, "\n");
706 /* For variables in named sections make sure get_variable_section
707 is called before we switch to those sections. Then section
708 conflicts between read-only and read-only requiring relocations
709 sections can be resolved. */
710 void
711 varpool_node::finalize_named_section_flags (void)
713 if (!TREE_ASM_WRITTEN (decl)
714 && !alias
715 && !in_other_partition
716 && !DECL_EXTERNAL (decl)
717 && VAR_P (decl)
718 && !DECL_HAS_VALUE_EXPR_P (decl)
719 && get_section ())
720 get_variable_section (decl, false);
723 /* Output all variables enqueued to be assembled. */
724 bool
725 symbol_table::output_variables (void)
727 bool changed = false;
728 varpool_node *node;
730 if (seen_error ())
731 return false;
733 remove_unreferenced_decls ();
735 timevar_push (TV_VAROUT);
737 FOR_EACH_DEFINED_VARIABLE (node)
739 /* Handled in output_in_order. */
740 if (node->no_reorder)
741 continue;
743 node->finalize_named_section_flags ();
746 /* There is a similar loop in output_in_order. Please keep them in sync. */
747 FOR_EACH_VARIABLE (node)
749 /* Handled in output_in_order. */
750 if (node->no_reorder)
751 continue;
752 if (DECL_HARD_REGISTER (node->decl)
753 || DECL_HAS_VALUE_EXPR_P (node->decl))
754 continue;
755 if (node->definition)
756 changed |= node->assemble_decl ();
757 else
758 assemble_undefined_decl (node->decl);
760 timevar_pop (TV_VAROUT);
761 return changed;
764 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
765 Extra name aliases are output whenever DECL is output. */
767 varpool_node *
768 varpool_node::create_alias (tree alias, tree decl)
770 varpool_node *alias_node;
772 gcc_assert (VAR_P (decl));
773 gcc_assert (VAR_P (alias));
774 alias_node = varpool_node::get_create (alias);
775 alias_node->alias = true;
776 alias_node->definition = true;
777 alias_node->alias_target = decl;
778 if (lookup_attribute ("weakref", DECL_ATTRIBUTES (alias)) != NULL)
779 alias_node->weakref = alias_node->transparent_alias = true;
780 return alias_node;
783 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
784 Extra name aliases are output whenever DECL is output. */
786 varpool_node *
787 varpool_node::create_extra_name_alias (tree alias, tree decl)
789 varpool_node *alias_node;
791 /* If aliases aren't supported by the assembler, fail. */
792 if (!TARGET_SUPPORTS_ALIASES)
793 return NULL;
795 alias_node = varpool_node::create_alias (alias, decl);
796 alias_node->cpp_implicit_alias = true;
798 /* Extra name alias mechanizm creates aliases really late
799 via DECL_ASSEMBLER_NAME mechanizm.
800 This is unfortunate because they are not going through the
801 standard channels. Ensure they get output. */
802 if (symtab->cpp_implicit_aliases_done)
803 alias_node->resolve_alias (varpool_node::get_create (decl));
804 return alias_node;
807 /* Worker for call_for_symbol_and_aliases. */
809 bool
810 varpool_node::call_for_symbol_and_aliases_1 (bool (*callback) (varpool_node *,
811 void *),
812 void *data,
813 bool include_overwritable)
815 ipa_ref *ref;
817 FOR_EACH_ALIAS (this, ref)
819 varpool_node *alias = dyn_cast <varpool_node *> (ref->referring);
820 if (include_overwritable
821 || alias->get_availability () > AVAIL_INTERPOSABLE)
822 if (alias->call_for_symbol_and_aliases (callback, data,
823 include_overwritable))
824 return true;
826 return false;