PR target/66563
[official-gcc.git] / gcc / varpool.c
blob9a97f77b389cd9c9d41d61ba7fcb784356144871
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 "alias.h"
26 #include "symtab.h"
27 #include "tree.h"
28 #include "fold-const.h"
29 #include "varasm.h"
30 #include "predict.h"
31 #include "basic-block.h"
32 #include "plugin-api.h"
33 #include "hard-reg-set.h"
34 #include "function.h"
35 #include "ipa-ref.h"
36 #include "cgraph.h"
37 #include "langhooks.h"
38 #include "diagnostic-core.h"
39 #include "timevar.h"
40 #include "debug.h"
41 #include "target.h"
42 #include "output.h"
43 #include "gimple-expr.h"
44 #include "flags.h"
45 #include "tree-ssa-alias.h"
46 #include "gimple.h"
47 #include "lto-streamer.h"
48 #include "context.h"
49 #include "omp-low.h"
51 const char * const tls_model_names[]={"none", "emulated",
52 "global-dynamic", "local-dynamic",
53 "initial-exec", "local-exec"};
55 /* List of hooks triggered on varpool_node events. */
56 struct varpool_node_hook_list {
57 varpool_node_hook hook;
58 void *data;
59 struct varpool_node_hook_list *next;
62 /* Register HOOK to be called with DATA on each removed node. */
63 varpool_node_hook_list *
64 symbol_table::add_varpool_removal_hook (varpool_node_hook hook, void *data)
66 varpool_node_hook_list *entry;
67 varpool_node_hook_list **ptr = &m_first_varpool_removal_hook;
69 entry = (varpool_node_hook_list *) xmalloc (sizeof (*entry));
70 entry->hook = hook;
71 entry->data = data;
72 entry->next = NULL;
73 while (*ptr)
74 ptr = &(*ptr)->next;
75 *ptr = entry;
76 return entry;
79 /* Remove ENTRY from the list of hooks called on removing nodes. */
80 void
81 symbol_table::remove_varpool_removal_hook (varpool_node_hook_list *entry)
83 varpool_node_hook_list **ptr = &m_first_varpool_removal_hook;
85 while (*ptr != entry)
86 ptr = &(*ptr)->next;
87 *ptr = entry->next;
88 free (entry);
91 /* Call all node removal hooks. */
92 void
93 symbol_table::call_varpool_removal_hooks (varpool_node *node)
95 varpool_node_hook_list *entry = m_first_varpool_removal_hook;
96 while (entry)
98 entry->hook (node, entry->data);
99 entry = entry->next;
103 /* Register HOOK to be called with DATA on each inserted node. */
104 varpool_node_hook_list *
105 symbol_table::add_varpool_insertion_hook (varpool_node_hook hook, void *data)
107 varpool_node_hook_list *entry;
108 varpool_node_hook_list **ptr = &m_first_varpool_insertion_hook;
110 entry = (varpool_node_hook_list *) xmalloc (sizeof (*entry));
111 entry->hook = hook;
112 entry->data = data;
113 entry->next = NULL;
114 while (*ptr)
115 ptr = &(*ptr)->next;
116 *ptr = entry;
117 return entry;
120 /* Remove ENTRY from the list of hooks called on inserted nodes. */
121 void
122 symbol_table::remove_varpool_insertion_hook (varpool_node_hook_list *entry)
124 varpool_node_hook_list **ptr = &m_first_varpool_insertion_hook;
126 while (*ptr != entry)
127 ptr = &(*ptr)->next;
128 *ptr = entry->next;
129 free (entry);
132 /* Call all node insertion hooks. */
133 void
134 symbol_table::call_varpool_insertion_hooks (varpool_node *node)
136 varpool_node_hook_list *entry = m_first_varpool_insertion_hook;
137 while (entry)
139 entry->hook (node, entry->data);
140 entry = entry->next;
144 /* Allocate new callgraph node and insert it into basic data structures. */
146 varpool_node *
147 varpool_node::create_empty (void)
149 varpool_node *node = ggc_cleared_alloc<varpool_node> ();
150 node->type = SYMTAB_VARIABLE;
151 return node;
154 /* Return varpool node assigned to DECL. Create new one when needed. */
155 varpool_node *
156 varpool_node::get_create (tree decl)
158 varpool_node *node = varpool_node::get (decl);
159 gcc_checking_assert (TREE_CODE (decl) == VAR_DECL);
160 if (node)
161 return node;
163 node = varpool_node::create_empty ();
164 node->decl = decl;
166 if ((flag_openacc || flag_openmp) && !DECL_EXTERNAL (decl)
167 && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl)))
169 node->offloadable = 1;
170 #ifdef ENABLE_OFFLOADING
171 g->have_offload = true;
172 if (!in_lto_p)
173 vec_safe_push (offload_vars, decl);
174 node->force_output = 1;
175 #endif
178 node->register_symbol ();
179 return node;
182 /* Remove variable from symbol table. */
184 void
185 varpool_node::remove (void)
187 symtab->call_varpool_removal_hooks (this);
188 if (lto_file_data)
190 lto_free_function_in_decl_state_for_node (this);
191 lto_file_data = NULL;
194 /* When streaming we can have multiple nodes associated with decl. */
195 if (symtab->state == LTO_STREAMING)
197 /* Keep constructor when it may be used for folding. We remove
198 references to external variables before final compilation. */
199 else if (DECL_INITIAL (decl) && DECL_INITIAL (decl) != error_mark_node
200 && !ctor_useable_for_folding_p ())
201 remove_initializer ();
203 unregister ();
204 ggc_free (this);
207 /* Remove node initializer when it is no longer needed. */
208 void
209 varpool_node::remove_initializer (void)
211 if (DECL_INITIAL (decl)
212 && !DECL_IN_CONSTANT_POOL (decl)
213 /* Keep vtables for BINFO folding. */
214 && !DECL_VIRTUAL_P (decl)
215 /* FIXME: http://gcc.gnu.org/PR55395 */
216 && debug_info_level == DINFO_LEVEL_NONE
217 /* When doing declaration merging we have duplicate
218 entries for given decl. Do not attempt to remove
219 the boides, or we will end up remiving
220 wrong one. */
221 && symtab->state != LTO_STREAMING)
222 DECL_INITIAL (decl) = error_mark_node;
225 /* Dump given varpool node to F. */
226 void
227 varpool_node::dump (FILE *f)
229 dump_base (f);
230 fprintf (f, " Availability: %s\n",
231 symtab->function_flags_ready
232 ? cgraph_availability_names[get_availability ()]
233 : "not-ready");
234 fprintf (f, " Varpool flags:");
235 if (DECL_INITIAL (decl))
236 fprintf (f, " initialized");
237 if (output)
238 fprintf (f, " output");
239 if (used_by_single_function)
240 fprintf (f, " used-by-single-function");
241 if (need_bounds_init)
242 fprintf (f, " need-bounds-init");
243 if (TREE_READONLY (decl))
244 fprintf (f, " read-only");
245 if (ctor_useable_for_folding_p ())
246 fprintf (f, " const-value-known");
247 if (writeonly)
248 fprintf (f, " write-only");
249 if (tls_model)
250 fprintf (f, " tls-%s", tls_model_names [tls_model]);
251 fprintf (f, "\n");
255 /* Dump given varpool node to stderr. */
256 void varpool_node::debug (void)
258 varpool_node::dump (stderr);
261 /* Dump the variable pool to F. */
262 void
263 varpool_node::dump_varpool (FILE *f)
265 varpool_node *node;
267 fprintf (f, "variable pool:\n\n");
268 FOR_EACH_VARIABLE (node)
269 node->dump (f);
272 /* Dump the variable pool to stderr. */
274 DEBUG_FUNCTION void
275 varpool_node::debug_varpool (void)
277 dump_varpool (stderr);
280 /* Given an assembler name, lookup node. */
281 varpool_node *
282 varpool_node::get_for_asmname (tree asmname)
284 if (symtab_node *node = symtab_node::get_for_asmname (asmname))
285 return dyn_cast <varpool_node *> (node);
286 else
287 return NULL;
290 /* When doing LTO, read variable's constructor from disk if
291 it is not already present. */
293 tree
294 varpool_node::get_constructor (void)
296 lto_file_decl_data *file_data;
297 const char *data, *name;
298 size_t len;
300 if (DECL_INITIAL (decl) != error_mark_node
301 || !in_lto_p
302 || !lto_file_data)
303 return DECL_INITIAL (decl);
305 timevar_push (TV_IPA_LTO_CTORS_IN);
307 file_data = lto_file_data;
308 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
310 /* We may have renamed the declaration, e.g., a static function. */
311 name = lto_get_decl_name_mapping (file_data, name);
313 data = lto_get_section_data (file_data, LTO_section_function_body,
314 name, &len);
315 if (!data)
316 fatal_error (input_location, "%s: section %s is missing",
317 file_data->file_name,
318 name);
320 lto_input_variable_constructor (file_data, this, data);
321 gcc_assert (DECL_INITIAL (decl) != error_mark_node);
322 lto_stats.num_function_bodies++;
323 lto_free_section_data (file_data, LTO_section_function_body, name,
324 data, len);
325 lto_free_function_in_decl_state_for_node (this);
326 timevar_pop (TV_IPA_LTO_CTORS_IN);
327 return DECL_INITIAL (decl);
330 /* Return true if variable has constructor that can be used for folding. */
332 bool
333 varpool_node::ctor_useable_for_folding_p (void)
335 varpool_node *real_node = this;
337 if (real_node->alias && real_node->definition)
338 real_node = ultimate_alias_target ();
340 if (TREE_CODE (decl) == CONST_DECL
341 || DECL_IN_CONSTANT_POOL (decl))
342 return true;
343 if (TREE_THIS_VOLATILE (decl))
344 return false;
346 /* If we do not have a constructor, we can't use it. */
347 if (DECL_INITIAL (real_node->decl) == error_mark_node
348 && !real_node->lto_file_data)
349 return false;
351 /* Avoid attempts to load constructors that was not streamed. */
352 if (flag_ltrans && DECL_INITIAL (real_node->decl) == error_mark_node
353 && real_node->body_removed)
354 return false;
356 /* Vtables are defined by their types and must match no matter of interposition
357 rules. */
358 if (DECL_VIRTUAL_P (decl))
360 /* The C++ front end creates VAR_DECLs for vtables of typeinfo
361 classes not defined in the current TU so that it can refer
362 to them from typeinfo objects. Avoid returning NULL_TREE. */
363 return DECL_INITIAL (real_node->decl) != NULL;
366 /* Alias of readonly variable is also readonly, since the variable is stored
367 in readonly memory. We also accept readonly aliases of non-readonly
368 locations assuming that user knows what he is asking for. */
369 if (!TREE_READONLY (decl) && !TREE_READONLY (real_node->decl))
370 return false;
372 /* Variables declared 'const' without an initializer
373 have zero as the initializer if they may not be
374 overridden at link or run time.
376 It is actually requirement for C++ compiler to optimize const variables
377 consistently. As a GNU extension, do not enfore this rule for user defined
378 weak variables, so we support interposition on:
379 static const int dummy = 0;
380 extern const int foo __attribute__((__weak__, __alias__("dummy")));
382 if ((!DECL_INITIAL (real_node->decl)
383 || (DECL_WEAK (decl) && !DECL_COMDAT (decl)))
384 && (DECL_EXTERNAL (decl) || decl_replaceable_p (decl)))
385 return false;
387 /* Variables declared `const' with an initializer are considered
388 to not be overwritable with different initializer by default.
390 ??? Previously we behaved so for scalar variables but not for array
391 accesses. */
392 return true;
395 /* If DECLARATION is constant variable and its initial value is known
396 (so we can do constant folding), return its constructor (DECL_INITIAL).
397 This may be an expression or NULL when DECL is initialized to 0.
398 Return ERROR_MARK_NODE otherwise.
400 In LTO this may actually trigger reading the constructor from disk.
401 For this reason varpool_ctor_useable_for_folding_p should be used when
402 the actual constructor value is not needed. */
404 tree
405 ctor_for_folding (tree decl)
407 varpool_node *node, *real_node;
408 tree real_decl;
410 if (TREE_CODE (decl) != VAR_DECL
411 && TREE_CODE (decl) != CONST_DECL)
412 return error_mark_node;
414 /* Static constant bounds are created to be
415 used instead of constants and therefore
416 do not let folding it. */
417 if (POINTER_BOUNDS_P (decl))
418 return error_mark_node;
420 if (TREE_CODE (decl) == CONST_DECL
421 || DECL_IN_CONSTANT_POOL (decl))
422 return DECL_INITIAL (decl);
424 if (TREE_THIS_VOLATILE (decl))
425 return error_mark_node;
427 /* Do not care about automatic variables. Those are never initialized
428 anyway, because gimplifier exapnds the code. */
429 if (!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
431 gcc_assert (!TREE_PUBLIC (decl));
432 return error_mark_node;
435 gcc_assert (TREE_CODE (decl) == VAR_DECL);
437 real_node = node = varpool_node::get (decl);
438 if (node)
440 real_node = node->ultimate_alias_target ();
441 real_decl = real_node->decl;
443 else
444 real_decl = decl;
446 /* See if we are dealing with alias.
447 In most cases alias is just alternative symbol pointing to a given
448 constructor. This allows us to use interposition rules of DECL
449 constructor of REAL_NODE. However weakrefs are special by being just
450 alternative name of their target (if defined). */
451 if (decl != real_decl)
453 gcc_assert (!DECL_INITIAL (decl)
454 || (node->alias && node->get_alias_target () == real_node)
455 || DECL_INITIAL (decl) == error_mark_node);
456 if (node->weakref)
458 node = node->get_alias_target ();
459 decl = node->decl;
463 if ((!DECL_VIRTUAL_P (real_decl)
464 || DECL_INITIAL (real_decl) == error_mark_node
465 || !DECL_INITIAL (real_decl))
466 && (!node || !node->ctor_useable_for_folding_p ()))
467 return error_mark_node;
469 /* OK, we can return constructor. See if we need to fetch it from disk
470 in LTO mode. */
471 if (DECL_INITIAL (real_decl) != error_mark_node
472 || !in_lto_p)
473 return DECL_INITIAL (real_decl);
474 return real_node->get_constructor ();
477 /* Add the variable DECL to the varpool.
478 Unlike finalize_decl function is intended to be used
479 by middle end and allows insertion of new variable at arbitrary point
480 of compilation. */
481 void
482 varpool_node::add (tree decl)
484 varpool_node *node;
485 varpool_node::finalize_decl (decl);
486 node = varpool_node::get_create (decl);
487 symtab->call_varpool_insertion_hooks (node);
488 if (node->externally_visible_p ())
489 node->externally_visible = true;
490 if (lookup_attribute ("no_reorder", DECL_ATTRIBUTES (decl)))
491 node->no_reorder = 1;
494 /* Return variable availability. See cgraph.h for description of individual
495 return values. */
496 enum availability
497 varpool_node::get_availability (void)
499 if (!definition)
500 return AVAIL_NOT_AVAILABLE;
501 if (!TREE_PUBLIC (decl))
502 return AVAIL_AVAILABLE;
503 if (DECL_IN_CONSTANT_POOL (decl)
504 || DECL_VIRTUAL_P (decl))
505 return AVAIL_AVAILABLE;
506 if (alias && weakref)
508 enum availability avail;
510 ultimate_alias_target (&avail)->get_availability ();
511 return avail;
513 /* If the variable can be overwritten, return OVERWRITABLE. Takes
514 care of at least one notable extension - the COMDAT variables
515 used to share template instantiations in C++. */
516 if (decl_replaceable_p (decl)
517 || DECL_EXTERNAL (decl))
518 return AVAIL_INTERPOSABLE;
519 return AVAIL_AVAILABLE;
522 void
523 varpool_node::analyze (void)
525 /* When reading back varpool at LTO time, we re-construct the queue in order
526 to have "needed" list right by inserting all needed nodes into varpool.
527 We however don't want to re-analyze already analyzed nodes. */
528 if (!analyzed)
530 gcc_assert (!in_lto_p || symtab->function_flags_ready);
531 /* Compute the alignment early so function body expanders are
532 already informed about increased alignment. */
533 align_variable (decl, 0);
535 if (alias)
536 resolve_alias (varpool_node::get (alias_target));
537 else if (DECL_INITIAL (decl))
538 record_references_in_initializer (decl, analyzed);
539 analyzed = true;
542 /* Assemble thunks and aliases associated to varpool node. */
544 void
545 varpool_node::assemble_aliases (void)
547 ipa_ref *ref;
549 FOR_EACH_ALIAS (this, ref)
551 varpool_node *alias = dyn_cast <varpool_node *> (ref->referring);
552 do_assemble_alias (alias->decl,
553 DECL_ASSEMBLER_NAME (decl));
554 alias->assemble_aliases ();
558 /* Output one variable, if necessary. Return whether we output it. */
560 bool
561 varpool_node::assemble_decl (void)
563 /* Aliases are outout when their target is produced or by
564 output_weakrefs. */
565 if (alias)
566 return false;
568 /* Constant pool is output from RTL land when the reference
569 survive till this level. */
570 if (DECL_IN_CONSTANT_POOL (decl) && TREE_ASM_WRITTEN (decl))
571 return false;
573 /* Decls with VALUE_EXPR should not be in the varpool at all. They
574 are not real variables, but just info for debugging and codegen.
575 Unfortunately at the moment emutls is not updating varpool correctly
576 after turning real vars into value_expr vars. */
577 if (DECL_HAS_VALUE_EXPR_P (decl)
578 && !targetm.have_tls)
579 return false;
581 /* Hard register vars do not need to be output. */
582 if (DECL_HARD_REGISTER (decl))
583 return false;
585 gcc_checking_assert (!TREE_ASM_WRITTEN (decl)
586 && TREE_CODE (decl) == VAR_DECL
587 && !DECL_HAS_VALUE_EXPR_P (decl));
589 if (!in_other_partition
590 && !DECL_EXTERNAL (decl))
592 get_constructor ();
593 assemble_variable (decl, 0, 1, 0);
594 gcc_assert (TREE_ASM_WRITTEN (decl));
595 gcc_assert (definition);
596 assemble_aliases ();
597 return true;
600 return false;
603 /* Add NODE to queue starting at FIRST.
604 The queue is linked via AUX pointers and terminated by pointer to 1. */
606 static void
607 enqueue_node (varpool_node *node, varpool_node **first)
609 if (node->aux)
610 return;
611 gcc_checking_assert (*first);
612 node->aux = *first;
613 *first = node;
616 /* Optimization of function bodies might've rendered some variables as
617 unnecessary so we want to avoid these from being compiled. Re-do
618 reachability starting from variables that are either externally visible
619 or was referred from the asm output routines. */
621 void
622 symbol_table::remove_unreferenced_decls (void)
624 varpool_node *next, *node;
625 varpool_node *first = (varpool_node *)(void *)1;
626 int i;
627 ipa_ref *ref = NULL;
628 hash_set<varpool_node *> referenced;
630 if (seen_error ())
631 return;
633 if (dump_file)
634 fprintf (dump_file, "Trivially needed variables:");
635 FOR_EACH_DEFINED_VARIABLE (node)
637 if (node->analyzed
638 && (!node->can_remove_if_no_refs_p ()
639 /* We just expanded all function bodies. See if any of
640 them needed the variable. */
641 || DECL_RTL_SET_P (node->decl)))
643 enqueue_node (node, &first);
644 if (dump_file)
645 fprintf (dump_file, " %s", node->asm_name ());
648 while (first != (varpool_node *)(void *)1)
650 node = first;
651 first = (varpool_node *)first->aux;
653 if (node->same_comdat_group)
655 symtab_node *next;
656 for (next = node->same_comdat_group;
657 next != node;
658 next = next->same_comdat_group)
660 varpool_node *vnext = dyn_cast <varpool_node *> (next);
661 if (vnext && vnext->analyzed && !next->comdat_local_p ())
662 enqueue_node (vnext, &first);
665 for (i = 0; node->iterate_reference (i, ref); i++)
667 varpool_node *vnode = dyn_cast <varpool_node *> (ref->referred);
668 if (vnode
669 && !vnode->in_other_partition
670 && (!DECL_EXTERNAL (ref->referred->decl)
671 || vnode->alias)
672 && vnode->analyzed)
673 enqueue_node (vnode, &first);
674 else
675 referenced.add (node);
678 if (dump_file)
679 fprintf (dump_file, "\nRemoving variables:");
680 for (node = first_defined_variable (); node; node = next)
682 next = next_defined_variable (node);
683 if (!node->aux && !node->no_reorder)
685 if (dump_file)
686 fprintf (dump_file, " %s", node->asm_name ());
687 if (referenced.contains(node))
688 node->remove_initializer ();
689 else
690 node->remove ();
694 if (dump_file)
695 fprintf (dump_file, "\n");
698 /* For variables in named sections make sure get_variable_section
699 is called before we switch to those sections. Then section
700 conflicts between read-only and read-only requiring relocations
701 sections can be resolved. */
702 void
703 varpool_node::finalize_named_section_flags (void)
705 if (!TREE_ASM_WRITTEN (decl)
706 && !alias
707 && !in_other_partition
708 && !DECL_EXTERNAL (decl)
709 && TREE_CODE (decl) == VAR_DECL
710 && !DECL_HAS_VALUE_EXPR_P (decl)
711 && get_section ())
712 get_variable_section (decl, false);
715 /* Output all variables enqueued to be assembled. */
716 bool
717 symbol_table::output_variables (void)
719 bool changed = false;
720 varpool_node *node;
722 if (seen_error ())
723 return false;
725 remove_unreferenced_decls ();
727 timevar_push (TV_VAROUT);
729 FOR_EACH_VARIABLE (node)
730 if (!node->definition
731 && !DECL_HAS_VALUE_EXPR_P (node->decl)
732 && !DECL_HARD_REGISTER (node->decl))
733 assemble_undefined_decl (node->decl);
734 FOR_EACH_DEFINED_VARIABLE (node)
736 /* Handled in output_in_order. */
737 if (node->no_reorder)
738 continue;
740 node->finalize_named_section_flags ();
743 FOR_EACH_DEFINED_VARIABLE (node)
745 /* Handled in output_in_order. */
746 if (node->no_reorder)
747 continue;
748 if (node->assemble_decl ())
749 changed = true;
751 timevar_pop (TV_VAROUT);
752 return changed;
755 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
756 Extra name aliases are output whenever DECL is output. */
758 varpool_node *
759 varpool_node::create_alias (tree alias, tree decl)
761 varpool_node *alias_node;
763 gcc_assert (TREE_CODE (decl) == VAR_DECL);
764 gcc_assert (TREE_CODE (alias) == VAR_DECL);
765 alias_node = varpool_node::get_create (alias);
766 alias_node->alias = true;
767 alias_node->definition = true;
768 alias_node->alias_target = decl;
769 if (lookup_attribute ("weakref", DECL_ATTRIBUTES (alias)) != NULL)
770 alias_node->weakref = true;
771 return alias_node;
774 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
775 Extra name aliases are output whenever DECL is output. */
777 varpool_node *
778 varpool_node::create_extra_name_alias (tree alias, tree decl)
780 varpool_node *alias_node;
782 #ifndef ASM_OUTPUT_DEF
783 /* If aliases aren't supported by the assembler, fail. */
784 return NULL;
785 #endif
786 alias_node = varpool_node::create_alias (alias, decl);
787 alias_node->cpp_implicit_alias = true;
789 /* Extra name alias mechanizm creates aliases really late
790 via DECL_ASSEMBLER_NAME mechanizm.
791 This is unfortunate because they are not going through the
792 standard channels. Ensure they get output. */
793 if (symtab->cpp_implicit_aliases_done)
794 alias_node->resolve_alias (varpool_node::get_create (decl));
795 return alias_node;
798 /* Worker for call_for_symbol_and_aliases. */
800 bool
801 varpool_node::call_for_symbol_and_aliases_1 (bool (*callback) (varpool_node *,
802 void *),
803 void *data,
804 bool include_overwritable)
806 ipa_ref *ref;
808 FOR_EACH_ALIAS (this, ref)
810 varpool_node *alias = dyn_cast <varpool_node *> (ref->referring);
811 if (include_overwritable
812 || alias->get_availability () > AVAIL_INTERPOSABLE)
813 if (alias->call_for_symbol_and_aliases (callback, data,
814 include_overwritable))
815 return true;
817 return false;