PR middle-end/66633
[official-gcc.git] / gcc / varpool.c
blob58cbbb8826faa4a5646454b341e6548cc03dbbce
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 "hard-reg-set.h"
33 #include "function.h"
34 #include "cgraph.h"
35 #include "langhooks.h"
36 #include "diagnostic-core.h"
37 #include "timevar.h"
38 #include "debug.h"
39 #include "target.h"
40 #include "output.h"
41 #include "gimple-expr.h"
42 #include "flags.h"
43 #include "tree-ssa-alias.h"
44 #include "gimple.h"
45 #include "lto-streamer.h"
46 #include "context.h"
47 #include "omp-low.h"
49 const char * const tls_model_names[]={"none", "emulated",
50 "global-dynamic", "local-dynamic",
51 "initial-exec", "local-exec"};
53 /* List of hooks triggered on varpool_node events. */
54 struct varpool_node_hook_list {
55 varpool_node_hook hook;
56 void *data;
57 struct varpool_node_hook_list *next;
60 /* Register HOOK to be called with DATA on each removed node. */
61 varpool_node_hook_list *
62 symbol_table::add_varpool_removal_hook (varpool_node_hook hook, void *data)
64 varpool_node_hook_list *entry;
65 varpool_node_hook_list **ptr = &m_first_varpool_removal_hook;
67 entry = (varpool_node_hook_list *) xmalloc (sizeof (*entry));
68 entry->hook = hook;
69 entry->data = data;
70 entry->next = NULL;
71 while (*ptr)
72 ptr = &(*ptr)->next;
73 *ptr = entry;
74 return entry;
77 /* Remove ENTRY from the list of hooks called on removing nodes. */
78 void
79 symbol_table::remove_varpool_removal_hook (varpool_node_hook_list *entry)
81 varpool_node_hook_list **ptr = &m_first_varpool_removal_hook;
83 while (*ptr != entry)
84 ptr = &(*ptr)->next;
85 *ptr = entry->next;
86 free (entry);
89 /* Call all node removal hooks. */
90 void
91 symbol_table::call_varpool_removal_hooks (varpool_node *node)
93 varpool_node_hook_list *entry = m_first_varpool_removal_hook;
94 while (entry)
96 entry->hook (node, entry->data);
97 entry = entry->next;
101 /* Register HOOK to be called with DATA on each inserted node. */
102 varpool_node_hook_list *
103 symbol_table::add_varpool_insertion_hook (varpool_node_hook hook, void *data)
105 varpool_node_hook_list *entry;
106 varpool_node_hook_list **ptr = &m_first_varpool_insertion_hook;
108 entry = (varpool_node_hook_list *) xmalloc (sizeof (*entry));
109 entry->hook = hook;
110 entry->data = data;
111 entry->next = NULL;
112 while (*ptr)
113 ptr = &(*ptr)->next;
114 *ptr = entry;
115 return entry;
118 /* Remove ENTRY from the list of hooks called on inserted nodes. */
119 void
120 symbol_table::remove_varpool_insertion_hook (varpool_node_hook_list *entry)
122 varpool_node_hook_list **ptr = &m_first_varpool_insertion_hook;
124 while (*ptr != entry)
125 ptr = &(*ptr)->next;
126 *ptr = entry->next;
127 free (entry);
130 /* Call all node insertion hooks. */
131 void
132 symbol_table::call_varpool_insertion_hooks (varpool_node *node)
134 varpool_node_hook_list *entry = m_first_varpool_insertion_hook;
135 while (entry)
137 entry->hook (node, entry->data);
138 entry = entry->next;
142 /* Allocate new callgraph node and insert it into basic data structures. */
144 varpool_node *
145 varpool_node::create_empty (void)
147 varpool_node *node = ggc_cleared_alloc<varpool_node> ();
148 node->type = SYMTAB_VARIABLE;
149 return node;
152 /* Return varpool node assigned to DECL. Create new one when needed. */
153 varpool_node *
154 varpool_node::get_create (tree decl)
156 varpool_node *node = varpool_node::get (decl);
157 gcc_checking_assert (TREE_CODE (decl) == VAR_DECL);
158 if (node)
159 return node;
161 node = varpool_node::create_empty ();
162 node->decl = decl;
164 if ((flag_openacc || flag_openmp) && !DECL_EXTERNAL (decl)
165 && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl)))
167 node->offloadable = 1;
168 #ifdef ENABLE_OFFLOADING
169 g->have_offload = true;
170 if (!in_lto_p)
171 vec_safe_push (offload_vars, decl);
172 node->force_output = 1;
173 #endif
176 node->register_symbol ();
177 return node;
180 /* Remove variable from symbol table. */
182 void
183 varpool_node::remove (void)
185 symtab->call_varpool_removal_hooks (this);
186 if (lto_file_data)
188 lto_free_function_in_decl_state_for_node (this);
189 lto_file_data = NULL;
192 /* When streaming we can have multiple nodes associated with decl. */
193 if (symtab->state == LTO_STREAMING)
195 /* Keep constructor when it may be used for folding. We remove
196 references to external variables before final compilation. */
197 else if (DECL_INITIAL (decl) && DECL_INITIAL (decl) != error_mark_node
198 && !ctor_useable_for_folding_p ())
199 remove_initializer ();
201 unregister ();
202 ggc_free (this);
205 /* Remove node initializer when it is no longer needed. */
206 void
207 varpool_node::remove_initializer (void)
209 if (DECL_INITIAL (decl)
210 && !DECL_IN_CONSTANT_POOL (decl)
211 /* Keep vtables for BINFO folding. */
212 && !DECL_VIRTUAL_P (decl)
213 /* FIXME: http://gcc.gnu.org/PR55395 */
214 && debug_info_level == DINFO_LEVEL_NONE
215 /* When doing declaration merging we have duplicate
216 entries for given decl. Do not attempt to remove
217 the boides, or we will end up remiving
218 wrong one. */
219 && symtab->state != LTO_STREAMING)
220 DECL_INITIAL (decl) = error_mark_node;
223 /* Dump given varpool node to F. */
224 void
225 varpool_node::dump (FILE *f)
227 dump_base (f);
228 fprintf (f, " Availability: %s\n",
229 symtab->function_flags_ready
230 ? cgraph_availability_names[get_availability ()]
231 : "not-ready");
232 fprintf (f, " Varpool flags:");
233 if (DECL_INITIAL (decl))
234 fprintf (f, " initialized");
235 if (output)
236 fprintf (f, " output");
237 if (used_by_single_function)
238 fprintf (f, " used-by-single-function");
239 if (need_bounds_init)
240 fprintf (f, " need-bounds-init");
241 if (TREE_READONLY (decl))
242 fprintf (f, " read-only");
243 if (ctor_useable_for_folding_p ())
244 fprintf (f, " const-value-known");
245 if (writeonly)
246 fprintf (f, " write-only");
247 if (tls_model)
248 fprintf (f, " tls-%s", tls_model_names [tls_model]);
249 fprintf (f, "\n");
253 /* Dump given varpool node to stderr. */
254 void varpool_node::debug (void)
256 varpool_node::dump (stderr);
259 /* Dump the variable pool to F. */
260 void
261 varpool_node::dump_varpool (FILE *f)
263 varpool_node *node;
265 fprintf (f, "variable pool:\n\n");
266 FOR_EACH_VARIABLE (node)
267 node->dump (f);
270 /* Dump the variable pool to stderr. */
272 DEBUG_FUNCTION void
273 varpool_node::debug_varpool (void)
275 dump_varpool (stderr);
278 /* Given an assembler name, lookup node. */
279 varpool_node *
280 varpool_node::get_for_asmname (tree asmname)
282 if (symtab_node *node = symtab_node::get_for_asmname (asmname))
283 return dyn_cast <varpool_node *> (node);
284 else
285 return NULL;
288 /* When doing LTO, read variable's constructor from disk if
289 it is not already present. */
291 tree
292 varpool_node::get_constructor (void)
294 lto_file_decl_data *file_data;
295 const char *data, *name;
296 size_t len;
298 if (DECL_INITIAL (decl) != error_mark_node
299 || !in_lto_p
300 || !lto_file_data)
301 return DECL_INITIAL (decl);
303 timevar_push (TV_IPA_LTO_CTORS_IN);
305 file_data = lto_file_data;
306 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
308 /* We may have renamed the declaration, e.g., a static function. */
309 name = lto_get_decl_name_mapping (file_data, name);
311 data = lto_get_section_data (file_data, LTO_section_function_body,
312 name, &len);
313 if (!data)
314 fatal_error (input_location, "%s: section %s is missing",
315 file_data->file_name,
316 name);
318 lto_input_variable_constructor (file_data, this, data);
319 gcc_assert (DECL_INITIAL (decl) != error_mark_node);
320 lto_stats.num_function_bodies++;
321 lto_free_section_data (file_data, LTO_section_function_body, name,
322 data, len);
323 lto_free_function_in_decl_state_for_node (this);
324 timevar_pop (TV_IPA_LTO_CTORS_IN);
325 return DECL_INITIAL (decl);
328 /* Return true if variable has constructor that can be used for folding. */
330 bool
331 varpool_node::ctor_useable_for_folding_p (void)
333 varpool_node *real_node = this;
335 if (real_node->alias && real_node->definition)
336 real_node = ultimate_alias_target ();
338 if (TREE_CODE (decl) == CONST_DECL
339 || DECL_IN_CONSTANT_POOL (decl))
340 return true;
341 if (TREE_THIS_VOLATILE (decl))
342 return false;
344 /* If we do not have a constructor, we can't use it. */
345 if (DECL_INITIAL (real_node->decl) == error_mark_node
346 && !real_node->lto_file_data)
347 return false;
349 /* Avoid attempts to load constructors that was not streamed. */
350 if (flag_ltrans && DECL_INITIAL (real_node->decl) == error_mark_node
351 && real_node->body_removed)
352 return false;
354 /* Vtables are defined by their types and must match no matter of interposition
355 rules. */
356 if (DECL_VIRTUAL_P (decl))
358 /* The C++ front end creates VAR_DECLs for vtables of typeinfo
359 classes not defined in the current TU so that it can refer
360 to them from typeinfo objects. Avoid returning NULL_TREE. */
361 return DECL_INITIAL (real_node->decl) != NULL;
364 /* Alias of readonly variable is also readonly, since the variable is stored
365 in readonly memory. We also accept readonly aliases of non-readonly
366 locations assuming that user knows what he is asking for. */
367 if (!TREE_READONLY (decl) && !TREE_READONLY (real_node->decl))
368 return false;
370 /* Variables declared 'const' without an initializer
371 have zero as the initializer if they may not be
372 overridden at link or run time.
374 It is actually requirement for C++ compiler to optimize const variables
375 consistently. As a GNU extension, do not enfore this rule for user defined
376 weak variables, so we support interposition on:
377 static const int dummy = 0;
378 extern const int foo __attribute__((__weak__, __alias__("dummy")));
380 if ((!DECL_INITIAL (real_node->decl)
381 || (DECL_WEAK (decl) && !DECL_COMDAT (decl)))
382 && (DECL_EXTERNAL (decl) || decl_replaceable_p (decl)))
383 return false;
385 /* Variables declared `const' with an initializer are considered
386 to not be overwritable with different initializer by default.
388 ??? Previously we behaved so for scalar variables but not for array
389 accesses. */
390 return true;
393 /* If DECLARATION is constant variable and its initial value is known
394 (so we can do constant folding), return its constructor (DECL_INITIAL).
395 This may be an expression or NULL when DECL is initialized to 0.
396 Return ERROR_MARK_NODE otherwise.
398 In LTO this may actually trigger reading the constructor from disk.
399 For this reason varpool_ctor_useable_for_folding_p should be used when
400 the actual constructor value is not needed. */
402 tree
403 ctor_for_folding (tree decl)
405 varpool_node *node, *real_node;
406 tree real_decl;
408 if (TREE_CODE (decl) != VAR_DECL
409 && TREE_CODE (decl) != CONST_DECL)
410 return error_mark_node;
412 /* Static constant bounds are created to be
413 used instead of constants and therefore
414 do not let folding it. */
415 if (POINTER_BOUNDS_P (decl))
416 return error_mark_node;
418 if (TREE_CODE (decl) == CONST_DECL
419 || DECL_IN_CONSTANT_POOL (decl))
420 return DECL_INITIAL (decl);
422 if (TREE_THIS_VOLATILE (decl))
423 return error_mark_node;
425 /* Do not care about automatic variables. Those are never initialized
426 anyway, because gimplifier exapnds the code. */
427 if (!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
429 gcc_assert (!TREE_PUBLIC (decl));
430 return error_mark_node;
433 gcc_assert (TREE_CODE (decl) == VAR_DECL);
435 real_node = node = varpool_node::get (decl);
436 if (node)
438 real_node = node->ultimate_alias_target ();
439 real_decl = real_node->decl;
441 else
442 real_decl = decl;
444 /* See if we are dealing with alias.
445 In most cases alias is just alternative symbol pointing to a given
446 constructor. This allows us to use interposition rules of DECL
447 constructor of REAL_NODE. However weakrefs are special by being just
448 alternative name of their target (if defined). */
449 if (decl != real_decl)
451 gcc_assert (!DECL_INITIAL (decl)
452 || (node->alias && node->get_alias_target () == real_node)
453 || DECL_INITIAL (decl) == error_mark_node);
454 if (node->weakref)
456 node = node->get_alias_target ();
457 decl = node->decl;
461 if ((!DECL_VIRTUAL_P (real_decl)
462 || DECL_INITIAL (real_decl) == error_mark_node
463 || !DECL_INITIAL (real_decl))
464 && (!node || !node->ctor_useable_for_folding_p ()))
465 return error_mark_node;
467 /* OK, we can return constructor. See if we need to fetch it from disk
468 in LTO mode. */
469 if (DECL_INITIAL (real_decl) != error_mark_node
470 || !in_lto_p)
471 return DECL_INITIAL (real_decl);
472 return real_node->get_constructor ();
475 /* Add the variable DECL to the varpool.
476 Unlike finalize_decl function is intended to be used
477 by middle end and allows insertion of new variable at arbitrary point
478 of compilation. */
479 void
480 varpool_node::add (tree decl)
482 varpool_node *node;
483 varpool_node::finalize_decl (decl);
484 node = varpool_node::get_create (decl);
485 symtab->call_varpool_insertion_hooks (node);
486 if (node->externally_visible_p ())
487 node->externally_visible = true;
488 if (lookup_attribute ("no_reorder", DECL_ATTRIBUTES (decl)))
489 node->no_reorder = 1;
492 /* Return variable availability. See cgraph.h for description of individual
493 return values. */
494 enum availability
495 varpool_node::get_availability (void)
497 if (!definition)
498 return AVAIL_NOT_AVAILABLE;
499 if (!TREE_PUBLIC (decl))
500 return AVAIL_AVAILABLE;
501 if (DECL_IN_CONSTANT_POOL (decl)
502 || DECL_VIRTUAL_P (decl))
503 return AVAIL_AVAILABLE;
504 if (alias && weakref)
506 enum availability avail;
508 ultimate_alias_target (&avail)->get_availability ();
509 return avail;
511 /* If the variable can be overwritten, return OVERWRITABLE. Takes
512 care of at least one notable extension - the COMDAT variables
513 used to share template instantiations in C++. */
514 if (decl_replaceable_p (decl)
515 || DECL_EXTERNAL (decl))
516 return AVAIL_INTERPOSABLE;
517 return AVAIL_AVAILABLE;
520 void
521 varpool_node::analyze (void)
523 /* When reading back varpool at LTO time, we re-construct the queue in order
524 to have "needed" list right by inserting all needed nodes into varpool.
525 We however don't want to re-analyze already analyzed nodes. */
526 if (!analyzed)
528 gcc_assert (!in_lto_p || symtab->function_flags_ready);
529 /* Compute the alignment early so function body expanders are
530 already informed about increased alignment. */
531 align_variable (decl, 0);
533 if (alias)
534 resolve_alias (varpool_node::get (alias_target));
535 else if (DECL_INITIAL (decl))
536 record_references_in_initializer (decl, analyzed);
537 analyzed = true;
540 /* Assemble thunks and aliases associated to varpool node. */
542 void
543 varpool_node::assemble_aliases (void)
545 ipa_ref *ref;
547 FOR_EACH_ALIAS (this, ref)
549 varpool_node *alias = dyn_cast <varpool_node *> (ref->referring);
550 do_assemble_alias (alias->decl,
551 DECL_ASSEMBLER_NAME (decl));
552 alias->assemble_aliases ();
556 /* Output one variable, if necessary. Return whether we output it. */
558 bool
559 varpool_node::assemble_decl (void)
561 /* Aliases are outout when their target is produced or by
562 output_weakrefs. */
563 if (alias)
564 return false;
566 /* Constant pool is output from RTL land when the reference
567 survive till this level. */
568 if (DECL_IN_CONSTANT_POOL (decl) && TREE_ASM_WRITTEN (decl))
569 return false;
571 /* Decls with VALUE_EXPR should not be in the varpool at all. They
572 are not real variables, but just info for debugging and codegen.
573 Unfortunately at the moment emutls is not updating varpool correctly
574 after turning real vars into value_expr vars. */
575 if (DECL_HAS_VALUE_EXPR_P (decl)
576 && !targetm.have_tls)
577 return false;
579 /* Hard register vars do not need to be output. */
580 if (DECL_HARD_REGISTER (decl))
581 return false;
583 gcc_checking_assert (!TREE_ASM_WRITTEN (decl)
584 && TREE_CODE (decl) == VAR_DECL
585 && !DECL_HAS_VALUE_EXPR_P (decl));
587 if (!in_other_partition
588 && !DECL_EXTERNAL (decl))
590 get_constructor ();
591 assemble_variable (decl, 0, 1, 0);
592 gcc_assert (TREE_ASM_WRITTEN (decl));
593 gcc_assert (definition);
594 assemble_aliases ();
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;