2015-05-01 Paolo Carlini <paolo.carlini@oracle.com>
[official-gcc.git] / gcc / varpool.c
blob76148a584b32da7f64b30673982ed31634b4b862
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 "tm.h"
25 #include "hash-set.h"
26 #include "machmode.h"
27 #include "vec.h"
28 #include "double-int.h"
29 #include "input.h"
30 #include "alias.h"
31 #include "symtab.h"
32 #include "wide-int.h"
33 #include "inchash.h"
34 #include "tree.h"
35 #include "fold-const.h"
36 #include "varasm.h"
37 #include "predict.h"
38 #include "basic-block.h"
39 #include "hash-map.h"
40 #include "is-a.h"
41 #include "plugin-api.h"
42 #include "hard-reg-set.h"
43 #include "input.h"
44 #include "function.h"
45 #include "ipa-ref.h"
46 #include "cgraph.h"
47 #include "langhooks.h"
48 #include "diagnostic-core.h"
49 #include "timevar.h"
50 #include "debug.h"
51 #include "target.h"
52 #include "output.h"
53 #include "gimple-expr.h"
54 #include "flags.h"
55 #include "tree-ssa-alias.h"
56 #include "gimple.h"
57 #include "lto-streamer.h"
58 #include "context.h"
59 #include "omp-low.h"
61 const char * const tls_model_names[]={"none", "emulated",
62 "global-dynamic", "local-dynamic",
63 "initial-exec", "local-exec"};
65 /* List of hooks triggered on varpool_node events. */
66 struct varpool_node_hook_list {
67 varpool_node_hook hook;
68 void *data;
69 struct varpool_node_hook_list *next;
72 /* Register HOOK to be called with DATA on each removed node. */
73 varpool_node_hook_list *
74 symbol_table::add_varpool_removal_hook (varpool_node_hook hook, void *data)
76 varpool_node_hook_list *entry;
77 varpool_node_hook_list **ptr = &m_first_varpool_removal_hook;
79 entry = (varpool_node_hook_list *) xmalloc (sizeof (*entry));
80 entry->hook = hook;
81 entry->data = data;
82 entry->next = NULL;
83 while (*ptr)
84 ptr = &(*ptr)->next;
85 *ptr = entry;
86 return entry;
89 /* Remove ENTRY from the list of hooks called on removing nodes. */
90 void
91 symbol_table::remove_varpool_removal_hook (varpool_node_hook_list *entry)
93 varpool_node_hook_list **ptr = &m_first_varpool_removal_hook;
95 while (*ptr != entry)
96 ptr = &(*ptr)->next;
97 *ptr = entry->next;
98 free (entry);
101 /* Call all node removal hooks. */
102 void
103 symbol_table::call_varpool_removal_hooks (varpool_node *node)
105 varpool_node_hook_list *entry = m_first_varpool_removal_hook;
106 while (entry)
108 entry->hook (node, entry->data);
109 entry = entry->next;
113 /* Register HOOK to be called with DATA on each inserted node. */
114 varpool_node_hook_list *
115 symbol_table::add_varpool_insertion_hook (varpool_node_hook hook, void *data)
117 varpool_node_hook_list *entry;
118 varpool_node_hook_list **ptr = &m_first_varpool_insertion_hook;
120 entry = (varpool_node_hook_list *) xmalloc (sizeof (*entry));
121 entry->hook = hook;
122 entry->data = data;
123 entry->next = NULL;
124 while (*ptr)
125 ptr = &(*ptr)->next;
126 *ptr = entry;
127 return entry;
130 /* Remove ENTRY from the list of hooks called on inserted nodes. */
131 void
132 symbol_table::remove_varpool_insertion_hook (varpool_node_hook_list *entry)
134 varpool_node_hook_list **ptr = &m_first_varpool_insertion_hook;
136 while (*ptr != entry)
137 ptr = &(*ptr)->next;
138 *ptr = entry->next;
139 free (entry);
142 /* Call all node insertion hooks. */
143 void
144 symbol_table::call_varpool_insertion_hooks (varpool_node *node)
146 varpool_node_hook_list *entry = m_first_varpool_insertion_hook;
147 while (entry)
149 entry->hook (node, entry->data);
150 entry = entry->next;
154 /* Allocate new callgraph node and insert it into basic data structures. */
156 varpool_node *
157 varpool_node::create_empty (void)
159 varpool_node *node = ggc_cleared_alloc<varpool_node> ();
160 node->type = SYMTAB_VARIABLE;
161 return node;
164 /* Return varpool node assigned to DECL. Create new one when needed. */
165 varpool_node *
166 varpool_node::get_create (tree decl)
168 varpool_node *node = varpool_node::get (decl);
169 gcc_checking_assert (TREE_CODE (decl) == VAR_DECL);
170 if (node)
171 return node;
173 node = varpool_node::create_empty ();
174 node->decl = decl;
176 if ((flag_openacc || flag_openmp) && !DECL_EXTERNAL (decl)
177 && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl)))
179 node->offloadable = 1;
180 #ifdef ENABLE_OFFLOADING
181 g->have_offload = true;
182 if (!in_lto_p)
183 vec_safe_push (offload_vars, decl);
184 node->force_output = 1;
185 #endif
188 node->register_symbol ();
189 return node;
192 /* Remove variable from symbol table. */
194 void
195 varpool_node::remove (void)
197 symtab->call_varpool_removal_hooks (this);
198 if (lto_file_data)
200 lto_free_function_in_decl_state_for_node (this);
201 lto_file_data = NULL;
204 /* When streaming we can have multiple nodes associated with decl. */
205 if (symtab->state == LTO_STREAMING)
207 /* Keep constructor when it may be used for folding. We remove
208 references to external variables before final compilation. */
209 else if (DECL_INITIAL (decl) && DECL_INITIAL (decl) != error_mark_node
210 && !ctor_useable_for_folding_p ())
211 remove_initializer ();
213 unregister ();
214 ggc_free (this);
217 /* Remove node initializer when it is no longer needed. */
218 void
219 varpool_node::remove_initializer (void)
221 if (DECL_INITIAL (decl)
222 && !DECL_IN_CONSTANT_POOL (decl)
223 /* Keep vtables for BINFO folding. */
224 && !DECL_VIRTUAL_P (decl)
225 /* FIXME: http://gcc.gnu.org/PR55395 */
226 && debug_info_level == DINFO_LEVEL_NONE
227 /* When doing declaration merging we have duplicate
228 entries for given decl. Do not attempt to remove
229 the boides, or we will end up remiving
230 wrong one. */
231 && symtab->state != LTO_STREAMING)
232 DECL_INITIAL (decl) = error_mark_node;
235 /* Dump given varpool node to F. */
236 void
237 varpool_node::dump (FILE *f)
239 dump_base (f);
240 fprintf (f, " Availability: %s\n",
241 symtab->function_flags_ready
242 ? cgraph_availability_names[get_availability ()]
243 : "not-ready");
244 fprintf (f, " Varpool flags:");
245 if (DECL_INITIAL (decl))
246 fprintf (f, " initialized");
247 if (output)
248 fprintf (f, " output");
249 if (used_by_single_function)
250 fprintf (f, " used-by-single-function");
251 if (need_bounds_init)
252 fprintf (f, " need-bounds-init");
253 if (TREE_READONLY (decl))
254 fprintf (f, " read-only");
255 if (ctor_useable_for_folding_p ())
256 fprintf (f, " const-value-known");
257 if (writeonly)
258 fprintf (f, " write-only");
259 if (tls_model)
260 fprintf (f, " tls-%s", tls_model_names [tls_model]);
261 fprintf (f, "\n");
265 /* Dump given varpool node to stderr. */
266 void varpool_node::debug (void)
268 varpool_node::dump (stderr);
271 /* Dump the variable pool to F. */
272 void
273 varpool_node::dump_varpool (FILE *f)
275 varpool_node *node;
277 fprintf (f, "variable pool:\n\n");
278 FOR_EACH_VARIABLE (node)
279 node->dump (f);
282 /* Dump the variable pool to stderr. */
284 DEBUG_FUNCTION void
285 varpool_node::debug_varpool (void)
287 dump_varpool (stderr);
290 /* Given an assembler name, lookup node. */
291 varpool_node *
292 varpool_node::get_for_asmname (tree asmname)
294 if (symtab_node *node = symtab_node::get_for_asmname (asmname))
295 return dyn_cast <varpool_node *> (node);
296 else
297 return NULL;
300 /* When doing LTO, read variable's constructor from disk if
301 it is not already present. */
303 tree
304 varpool_node::get_constructor (void)
306 lto_file_decl_data *file_data;
307 const char *data, *name;
308 size_t len;
310 if (DECL_INITIAL (decl) != error_mark_node
311 || !in_lto_p
312 || !lto_file_data)
313 return DECL_INITIAL (decl);
315 timevar_push (TV_IPA_LTO_CTORS_IN);
317 file_data = lto_file_data;
318 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
320 /* We may have renamed the declaration, e.g., a static function. */
321 name = lto_get_decl_name_mapping (file_data, name);
323 data = lto_get_section_data (file_data, LTO_section_function_body,
324 name, &len);
325 if (!data)
326 fatal_error (input_location, "%s: section %s is missing",
327 file_data->file_name,
328 name);
330 lto_input_variable_constructor (file_data, this, data);
331 gcc_assert (DECL_INITIAL (decl) != error_mark_node);
332 lto_stats.num_function_bodies++;
333 lto_free_section_data (file_data, LTO_section_function_body, name,
334 data, len);
335 lto_free_function_in_decl_state_for_node (this);
336 timevar_pop (TV_IPA_LTO_CTORS_IN);
337 return DECL_INITIAL (decl);
340 /* Return true if variable has constructor that can be used for folding. */
342 bool
343 varpool_node::ctor_useable_for_folding_p (void)
345 varpool_node *real_node = this;
347 if (real_node->alias && real_node->definition)
348 real_node = ultimate_alias_target ();
350 if (TREE_CODE (decl) == CONST_DECL
351 || DECL_IN_CONSTANT_POOL (decl))
352 return true;
353 if (TREE_THIS_VOLATILE (decl))
354 return false;
356 /* If we do not have a constructor, we can't use it. */
357 if (DECL_INITIAL (real_node->decl) == error_mark_node
358 && !real_node->lto_file_data)
359 return false;
361 /* Avoid attempts to load constructors that was not streamed. */
362 if (flag_ltrans && DECL_INITIAL (real_node->decl) == error_mark_node
363 && real_node->body_removed)
364 return false;
366 /* Vtables are defined by their types and must match no matter of interposition
367 rules. */
368 if (DECL_VIRTUAL_P (decl))
370 /* The C++ front end creates VAR_DECLs for vtables of typeinfo
371 classes not defined in the current TU so that it can refer
372 to them from typeinfo objects. Avoid returning NULL_TREE. */
373 return DECL_INITIAL (real_node->decl) != NULL;
376 /* Alias of readonly variable is also readonly, since the variable is stored
377 in readonly memory. We also accept readonly aliases of non-readonly
378 locations assuming that user knows what he is asking for. */
379 if (!TREE_READONLY (decl) && !TREE_READONLY (real_node->decl))
380 return false;
382 /* Variables declared 'const' without an initializer
383 have zero as the initializer if they may not be
384 overridden at link or run time.
386 It is actually requirement for C++ compiler to optimize const variables
387 consistently. As a GNU extension, do not enfore this rule for user defined
388 weak variables, so we support interposition on:
389 static const int dummy = 0;
390 extern const int foo __attribute__((__weak__, __alias__("dummy")));
392 if ((!DECL_INITIAL (real_node->decl)
393 || (DECL_WEAK (decl) && !DECL_COMDAT (decl)))
394 && (DECL_EXTERNAL (decl) || decl_replaceable_p (decl)))
395 return false;
397 /* Variables declared `const' with an initializer are considered
398 to not be overwritable with different initializer by default.
400 ??? Previously we behaved so for scalar variables but not for array
401 accesses. */
402 return true;
405 /* If DECLARATION is constant variable and its initial value is known
406 (so we can do constant folding), return its constructor (DECL_INITIAL).
407 This may be an expression or NULL when DECL is initialized to 0.
408 Return ERROR_MARK_NODE otherwise.
410 In LTO this may actually trigger reading the constructor from disk.
411 For this reason varpool_ctor_useable_for_folding_p should be used when
412 the actual constructor value is not needed. */
414 tree
415 ctor_for_folding (tree decl)
417 varpool_node *node, *real_node;
418 tree real_decl;
420 if (TREE_CODE (decl) != VAR_DECL
421 && TREE_CODE (decl) != CONST_DECL)
422 return error_mark_node;
424 /* Static constant bounds are created to be
425 used instead of constants and therefore
426 do not let folding it. */
427 if (POINTER_BOUNDS_P (decl))
428 return error_mark_node;
430 if (TREE_CODE (decl) == CONST_DECL
431 || DECL_IN_CONSTANT_POOL (decl))
432 return DECL_INITIAL (decl);
434 if (TREE_THIS_VOLATILE (decl))
435 return error_mark_node;
437 /* Do not care about automatic variables. Those are never initialized
438 anyway, because gimplifier exapnds the code. */
439 if (!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
441 gcc_assert (!TREE_PUBLIC (decl));
442 return error_mark_node;
445 gcc_assert (TREE_CODE (decl) == VAR_DECL);
447 real_node = node = varpool_node::get (decl);
448 if (node)
450 real_node = node->ultimate_alias_target ();
451 real_decl = real_node->decl;
453 else
454 real_decl = decl;
456 /* See if we are dealing with alias.
457 In most cases alias is just alternative symbol pointing to a given
458 constructor. This allows us to use interposition rules of DECL
459 constructor of REAL_NODE. However weakrefs are special by being just
460 alternative name of their target (if defined). */
461 if (decl != real_decl)
463 gcc_assert (!DECL_INITIAL (decl)
464 || (node->alias && node->get_alias_target () == real_node)
465 || DECL_INITIAL (decl) == error_mark_node);
466 if (node->weakref)
468 node = node->get_alias_target ();
469 decl = node->decl;
473 if ((!DECL_VIRTUAL_P (real_decl)
474 || DECL_INITIAL (real_decl) == error_mark_node
475 || !DECL_INITIAL (real_decl))
476 && (!node || !node->ctor_useable_for_folding_p ()))
477 return error_mark_node;
479 /* OK, we can return constructor. See if we need to fetch it from disk
480 in LTO mode. */
481 if (DECL_INITIAL (real_decl) != error_mark_node
482 || !in_lto_p)
483 return DECL_INITIAL (real_decl);
484 return real_node->get_constructor ();
487 /* Add the variable DECL to the varpool.
488 Unlike finalize_decl function is intended to be used
489 by middle end and allows insertion of new variable at arbitrary point
490 of compilation. */
491 void
492 varpool_node::add (tree decl)
494 varpool_node *node;
495 varpool_node::finalize_decl (decl);
496 node = varpool_node::get_create (decl);
497 symtab->call_varpool_insertion_hooks (node);
498 if (node->externally_visible_p ())
499 node->externally_visible = true;
500 if (lookup_attribute ("no_reorder", DECL_ATTRIBUTES (decl)))
501 node->no_reorder = 1;
504 /* Return variable availability. See cgraph.h for description of individual
505 return values. */
506 enum availability
507 varpool_node::get_availability (void)
509 if (!definition)
510 return AVAIL_NOT_AVAILABLE;
511 if (!TREE_PUBLIC (decl))
512 return AVAIL_AVAILABLE;
513 if (DECL_IN_CONSTANT_POOL (decl)
514 || DECL_VIRTUAL_P (decl))
515 return AVAIL_AVAILABLE;
516 if (alias && weakref)
518 enum availability avail;
520 ultimate_alias_target (&avail)->get_availability ();
521 return avail;
523 /* If the variable can be overwritten, return OVERWRITABLE. Takes
524 care of at least one notable extension - the COMDAT variables
525 used to share template instantiations in C++. */
526 if (decl_replaceable_p (decl)
527 || DECL_EXTERNAL (decl))
528 return AVAIL_INTERPOSABLE;
529 return AVAIL_AVAILABLE;
532 void
533 varpool_node::analyze (void)
535 /* When reading back varpool at LTO time, we re-construct the queue in order
536 to have "needed" list right by inserting all needed nodes into varpool.
537 We however don't want to re-analyze already analyzed nodes. */
538 if (!analyzed)
540 gcc_assert (!in_lto_p || symtab->function_flags_ready);
541 /* Compute the alignment early so function body expanders are
542 already informed about increased alignment. */
543 align_variable (decl, 0);
545 if (alias)
546 resolve_alias (varpool_node::get (alias_target));
547 else if (DECL_INITIAL (decl))
548 record_references_in_initializer (decl, analyzed);
549 analyzed = true;
552 /* Assemble thunks and aliases associated to varpool node. */
554 void
555 varpool_node::assemble_aliases (void)
557 ipa_ref *ref;
559 FOR_EACH_ALIAS (this, ref)
561 varpool_node *alias = dyn_cast <varpool_node *> (ref->referring);
562 do_assemble_alias (alias->decl,
563 DECL_ASSEMBLER_NAME (decl));
564 alias->assemble_aliases ();
568 /* Output one variable, if necessary. Return whether we output it. */
570 bool
571 varpool_node::assemble_decl (void)
573 /* Aliases are outout when their target is produced or by
574 output_weakrefs. */
575 if (alias)
576 return false;
578 /* Constant pool is output from RTL land when the reference
579 survive till this level. */
580 if (DECL_IN_CONSTANT_POOL (decl) && TREE_ASM_WRITTEN (decl))
581 return false;
583 /* Decls with VALUE_EXPR should not be in the varpool at all. They
584 are not real variables, but just info for debugging and codegen.
585 Unfortunately at the moment emutls is not updating varpool correctly
586 after turning real vars into value_expr vars. */
587 if (DECL_HAS_VALUE_EXPR_P (decl)
588 && !targetm.have_tls)
589 return false;
591 /* Hard register vars do not need to be output. */
592 if (DECL_HARD_REGISTER (decl))
593 return false;
595 gcc_checking_assert (!TREE_ASM_WRITTEN (decl)
596 && TREE_CODE (decl) == VAR_DECL
597 && !DECL_HAS_VALUE_EXPR_P (decl));
599 if (!in_other_partition
600 && !DECL_EXTERNAL (decl))
602 get_constructor ();
603 assemble_variable (decl, 0, 1, 0);
604 gcc_assert (TREE_ASM_WRITTEN (decl));
605 gcc_assert (definition);
606 assemble_aliases ();
607 return true;
610 return false;
613 /* Add NODE to queue starting at FIRST.
614 The queue is linked via AUX pointers and terminated by pointer to 1. */
616 static void
617 enqueue_node (varpool_node *node, varpool_node **first)
619 if (node->aux)
620 return;
621 gcc_checking_assert (*first);
622 node->aux = *first;
623 *first = node;
626 /* Optimization of function bodies might've rendered some variables as
627 unnecessary so we want to avoid these from being compiled. Re-do
628 reachability starting from variables that are either externally visible
629 or was referred from the asm output routines. */
631 void
632 symbol_table::remove_unreferenced_decls (void)
634 varpool_node *next, *node;
635 varpool_node *first = (varpool_node *)(void *)1;
636 int i;
637 ipa_ref *ref = NULL;
638 hash_set<varpool_node *> referenced;
640 if (seen_error ())
641 return;
643 if (dump_file)
644 fprintf (dump_file, "Trivially needed variables:");
645 FOR_EACH_DEFINED_VARIABLE (node)
647 if (node->analyzed
648 && (!node->can_remove_if_no_refs_p ()
649 /* We just expanded all function bodies. See if any of
650 them needed the variable. */
651 || DECL_RTL_SET_P (node->decl)))
653 enqueue_node (node, &first);
654 if (dump_file)
655 fprintf (dump_file, " %s", node->asm_name ());
658 while (first != (varpool_node *)(void *)1)
660 node = first;
661 first = (varpool_node *)first->aux;
663 if (node->same_comdat_group)
665 symtab_node *next;
666 for (next = node->same_comdat_group;
667 next != node;
668 next = next->same_comdat_group)
670 varpool_node *vnext = dyn_cast <varpool_node *> (next);
671 if (vnext && vnext->analyzed && !next->comdat_local_p ())
672 enqueue_node (vnext, &first);
675 for (i = 0; node->iterate_reference (i, ref); i++)
677 varpool_node *vnode = dyn_cast <varpool_node *> (ref->referred);
678 if (vnode
679 && !vnode->in_other_partition
680 && (!DECL_EXTERNAL (ref->referred->decl)
681 || vnode->alias)
682 && vnode->analyzed)
683 enqueue_node (vnode, &first);
684 else
685 referenced.add (node);
688 if (dump_file)
689 fprintf (dump_file, "\nRemoving variables:");
690 for (node = first_defined_variable (); node; node = next)
692 next = next_defined_variable (node);
693 if (!node->aux && !node->no_reorder)
695 if (dump_file)
696 fprintf (dump_file, " %s", node->asm_name ());
697 if (referenced.contains(node))
698 node->remove_initializer ();
699 else
700 node->remove ();
704 if (dump_file)
705 fprintf (dump_file, "\n");
708 /* For variables in named sections make sure get_variable_section
709 is called before we switch to those sections. Then section
710 conflicts between read-only and read-only requiring relocations
711 sections can be resolved. */
712 void
713 varpool_node::finalize_named_section_flags (void)
715 if (!TREE_ASM_WRITTEN (decl)
716 && !alias
717 && !in_other_partition
718 && !DECL_EXTERNAL (decl)
719 && TREE_CODE (decl) == VAR_DECL
720 && !DECL_HAS_VALUE_EXPR_P (decl)
721 && get_section ())
722 get_variable_section (decl, false);
725 /* Output all variables enqueued to be assembled. */
726 bool
727 symbol_table::output_variables (void)
729 bool changed = false;
730 varpool_node *node;
732 if (seen_error ())
733 return false;
735 remove_unreferenced_decls ();
737 timevar_push (TV_VAROUT);
739 FOR_EACH_VARIABLE (node)
740 if (!node->definition
741 && !DECL_HAS_VALUE_EXPR_P (node->decl)
742 && !DECL_HARD_REGISTER (node->decl))
743 assemble_undefined_decl (node->decl);
744 FOR_EACH_DEFINED_VARIABLE (node)
746 /* Handled in output_in_order. */
747 if (node->no_reorder)
748 continue;
750 node->finalize_named_section_flags ();
753 FOR_EACH_DEFINED_VARIABLE (node)
755 /* Handled in output_in_order. */
756 if (node->no_reorder)
757 continue;
758 if (node->assemble_decl ())
759 changed = true;
761 timevar_pop (TV_VAROUT);
762 return changed;
765 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
766 Extra name aliases are output whenever DECL is output. */
768 varpool_node *
769 varpool_node::create_alias (tree alias, tree decl)
771 varpool_node *alias_node;
773 gcc_assert (TREE_CODE (decl) == VAR_DECL);
774 gcc_assert (TREE_CODE (alias) == VAR_DECL);
775 alias_node = varpool_node::get_create (alias);
776 alias_node->alias = true;
777 alias_node->definition = true;
778 alias_node->alias_target = decl;
779 if (lookup_attribute ("weakref", DECL_ATTRIBUTES (alias)) != NULL)
780 alias_node->weakref = true;
781 return alias_node;
784 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
785 Extra name aliases are output whenever DECL is output. */
787 varpool_node *
788 varpool_node::create_extra_name_alias (tree alias, tree decl)
790 varpool_node *alias_node;
792 #ifndef ASM_OUTPUT_DEF
793 /* If aliases aren't supported by the assembler, fail. */
794 return NULL;
795 #endif
796 alias_node = varpool_node::create_alias (alias, decl);
797 alias_node->cpp_implicit_alias = true;
799 /* Extra name alias mechanizm creates aliases really late
800 via DECL_ASSEMBLER_NAME mechanizm.
801 This is unfortunate because they are not going through the
802 standard channels. Ensure they get output. */
803 if (symtab->cpp_implicit_aliases_done)
804 alias_node->resolve_alias (varpool_node::get_create (decl));
805 return alias_node;
808 /* Worker for call_for_symbol_and_aliases. */
810 bool
811 varpool_node::call_for_symbol_and_aliases_1 (bool (*callback) (varpool_node *,
812 void *),
813 void *data,
814 bool include_overwritable)
816 ipa_ref *ref;
818 FOR_EACH_ALIAS (this, ref)
820 varpool_node *alias = dyn_cast <varpool_node *> (ref->referring);
821 if (include_overwritable
822 || alias->get_availability () > AVAIL_INTERPOSABLE)
823 if (alias->call_for_symbol_and_aliases (callback, data,
824 include_overwritable))
825 return true;
827 return false;