* cgraph.h: Flatten. Remove all include files.
[official-gcc.git] / gcc / varpool.c
blob3d1ab690dcb9382ba4909c6c8ce148e1ced942b6
1 /* Callgraph handling code.
2 Copyright (C) 2003-2014 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 "tree.h"
26 #include "varasm.h"
27 #include "predict.h"
28 #include "basic-block.h"
29 #include "hash-map.h"
30 #include "is-a.h"
31 #include "plugin-api.h"
32 #include "vec.h"
33 #include "hashtab.h"
34 #include "hash-set.h"
35 #include "machmode.h"
36 #include "hard-reg-set.h"
37 #include "input.h"
38 #include "function.h"
39 #include "ipa-ref.h"
40 #include "cgraph.h"
41 #include "langhooks.h"
42 #include "diagnostic-core.h"
43 #include "timevar.h"
44 #include "debug.h"
45 #include "target.h"
46 #include "output.h"
47 #include "gimple-expr.h"
48 #include "flags.h"
49 #include "tree-ssa-alias.h"
50 #include "gimple.h"
51 #include "lto-streamer.h"
53 const char * const tls_model_names[]={"none", "tls-emulated", "tls-real",
54 "tls-global-dynamic", "tls-local-dynamic",
55 "tls-initial-exec", "tls-local-exec"};
57 /* List of hooks triggered on varpool_node events. */
58 struct varpool_node_hook_list {
59 varpool_node_hook hook;
60 void *data;
61 struct varpool_node_hook_list *next;
64 /* Register HOOK to be called with DATA on each removed node. */
65 varpool_node_hook_list *
66 symbol_table::add_varpool_removal_hook (varpool_node_hook hook, void *data)
68 varpool_node_hook_list *entry;
69 varpool_node_hook_list **ptr = &m_first_varpool_removal_hook;
71 entry = (varpool_node_hook_list *) xmalloc (sizeof (*entry));
72 entry->hook = hook;
73 entry->data = data;
74 entry->next = NULL;
75 while (*ptr)
76 ptr = &(*ptr)->next;
77 *ptr = entry;
78 return entry;
81 /* Remove ENTRY from the list of hooks called on removing nodes. */
82 void
83 symbol_table::remove_varpool_removal_hook (varpool_node_hook_list *entry)
85 varpool_node_hook_list **ptr = &m_first_varpool_removal_hook;
87 while (*ptr != entry)
88 ptr = &(*ptr)->next;
89 *ptr = entry->next;
90 free (entry);
93 /* Call all node removal hooks. */
94 void
95 symbol_table::call_varpool_removal_hooks (varpool_node *node)
97 varpool_node_hook_list *entry = m_first_varpool_removal_hook;
98 while (entry)
100 entry->hook (node, entry->data);
101 entry = entry->next;
105 /* Register HOOK to be called with DATA on each inserted node. */
106 varpool_node_hook_list *
107 symbol_table::add_varpool_insertion_hook (varpool_node_hook hook, void *data)
109 varpool_node_hook_list *entry;
110 varpool_node_hook_list **ptr = &m_first_varpool_insertion_hook;
112 entry = (varpool_node_hook_list *) xmalloc (sizeof (*entry));
113 entry->hook = hook;
114 entry->data = data;
115 entry->next = NULL;
116 while (*ptr)
117 ptr = &(*ptr)->next;
118 *ptr = entry;
119 return entry;
122 /* Remove ENTRY from the list of hooks called on inserted nodes. */
123 void
124 symbol_table::remove_varpool_insertion_hook (varpool_node_hook_list *entry)
126 varpool_node_hook_list **ptr = &m_first_varpool_insertion_hook;
128 while (*ptr != entry)
129 ptr = &(*ptr)->next;
130 *ptr = entry->next;
131 free (entry);
134 /* Call all node insertion hooks. */
135 void
136 symbol_table::call_varpool_insertion_hooks (varpool_node *node)
138 varpool_node_hook_list *entry = m_first_varpool_insertion_hook;
139 while (entry)
141 entry->hook (node, entry->data);
142 entry = entry->next;
146 /* Allocate new callgraph node and insert it into basic data structures. */
148 varpool_node *
149 varpool_node::create_empty (void)
151 varpool_node *node = ggc_cleared_alloc<varpool_node> ();
152 node->type = SYMTAB_VARIABLE;
153 return node;
156 /* Return varpool node assigned to DECL. Create new one when needed. */
157 varpool_node *
158 varpool_node::get_create (tree decl)
160 varpool_node *node = varpool_node::get (decl);
161 gcc_checking_assert (TREE_CODE (decl) == VAR_DECL);
162 if (node)
163 return node;
165 node = varpool_node::create_empty ();
166 node->decl = decl;
167 node->register_symbol ();
168 return node;
171 /* Remove variable from symbol table. */
173 void
174 varpool_node::remove (void)
176 symtab->call_varpool_removal_hooks (this);
177 unregister ();
179 /* When streaming we can have multiple nodes associated with decl. */
180 if (symtab->state == LTO_STREAMING)
182 /* Keep constructor when it may be used for folding. We remove
183 references to external variables before final compilation. */
184 else if (DECL_INITIAL (decl) && DECL_INITIAL (decl) != error_mark_node
185 && !ctor_useable_for_folding_p ())
186 remove_initializer ();
187 ggc_free (this);
190 /* Remove node initializer when it is no longer needed. */
191 void
192 varpool_node::remove_initializer (void)
194 if (DECL_INITIAL (decl)
195 && !DECL_IN_CONSTANT_POOL (decl)
196 /* Keep vtables for BINFO folding. */
197 && !DECL_VIRTUAL_P (decl)
198 /* FIXME: http://gcc.gnu.org/PR55395 */
199 && debug_info_level == DINFO_LEVEL_NONE
200 /* When doing declaration merging we have duplicate
201 entries for given decl. Do not attempt to remove
202 the boides, or we will end up remiving
203 wrong one. */
204 && symtab->state != LTO_STREAMING)
205 DECL_INITIAL (decl) = error_mark_node;
208 /* Dump given varpool node to F. */
209 void
210 varpool_node::dump (FILE *f)
212 dump_base (f);
213 fprintf (f, " Availability: %s\n",
214 symtab->function_flags_ready
215 ? cgraph_availability_names[get_availability ()]
216 : "not-ready");
217 fprintf (f, " Varpool flags:");
218 if (DECL_INITIAL (decl))
219 fprintf (f, " initialized");
220 if (output)
221 fprintf (f, " output");
222 if (used_by_single_function)
223 fprintf (f, " used-by-single-function");
224 if (TREE_READONLY (decl))
225 fprintf (f, " read-only");
226 if (ctor_useable_for_folding_p ())
227 fprintf (f, " const-value-known");
228 if (writeonly)
229 fprintf (f, " write-only");
230 if (tls_model)
231 fprintf (f, " %s", tls_model_names [tls_model]);
232 fprintf (f, "\n");
236 /* Dump given varpool node to stderr. */
237 void varpool_node::debug (void)
239 varpool_node::dump (stderr);
242 /* Dump the variable pool to F. */
243 void
244 varpool_node::dump_varpool (FILE *f)
246 varpool_node *node;
248 fprintf (f, "variable pool:\n\n");
249 FOR_EACH_VARIABLE (node)
250 node->dump (f);
253 /* Dump the variable pool to stderr. */
255 DEBUG_FUNCTION void
256 varpool_node::debug_varpool (void)
258 dump_varpool (stderr);
261 /* Given an assembler name, lookup node. */
262 varpool_node *
263 varpool_node::get_for_asmname (tree asmname)
265 if (symtab_node *node = symtab_node::get_for_asmname (asmname))
266 return dyn_cast <varpool_node *> (node);
267 else
268 return NULL;
271 /* When doing LTO, read variable's constructor from disk if
272 it is not already present. */
274 tree
275 varpool_node::get_constructor (void)
277 lto_file_decl_data *file_data;
278 const char *data, *name;
279 size_t len;
281 if (DECL_INITIAL (decl) != error_mark_node
282 || !in_lto_p)
283 return DECL_INITIAL (decl);
285 timevar_push (TV_IPA_LTO_CTORS_IN);
287 file_data = lto_file_data;
288 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
290 /* We may have renamed the declaration, e.g., a static function. */
291 name = lto_get_decl_name_mapping (file_data, name);
293 data = lto_get_section_data (file_data, LTO_section_function_body,
294 name, &len);
295 if (!data)
296 fatal_error ("%s: section %s is missing",
297 file_data->file_name,
298 name);
300 lto_input_variable_constructor (file_data, this, data);
301 lto_stats.num_function_bodies++;
302 lto_free_section_data (file_data, LTO_section_function_body, name,
303 data, len);
304 lto_free_function_in_decl_state_for_node (this);
305 timevar_pop (TV_IPA_LTO_CTORS_IN);
306 return DECL_INITIAL (decl);
309 /* Return true if variable has constructor that can be used for folding. */
311 bool
312 varpool_node::ctor_useable_for_folding_p (void)
314 varpool_node *real_node = this;
316 if (real_node->alias && real_node->definition)
317 real_node = ultimate_alias_target ();
319 if (TREE_CODE (decl) == CONST_DECL
320 || DECL_IN_CONSTANT_POOL (decl))
321 return true;
322 if (TREE_THIS_VOLATILE (decl))
323 return false;
325 /* If we do not have a constructor, we can't use it. */
326 if (DECL_INITIAL (real_node->decl) == error_mark_node
327 && !real_node->lto_file_data)
328 return false;
330 /* Avoid attempts to load constructors that was not streamed. */
331 if (flag_ltrans && DECL_INITIAL (real_node->decl) == error_mark_node
332 && real_node->body_removed)
333 return false;
335 /* Vtables are defined by their types and must match no matter of interposition
336 rules. */
337 if (DECL_VIRTUAL_P (decl))
339 /* The C++ front end creates VAR_DECLs for vtables of typeinfo
340 classes not defined in the current TU so that it can refer
341 to them from typeinfo objects. Avoid returning NULL_TREE. */
342 return DECL_INITIAL (real_node->decl) != NULL;
345 /* Alias of readonly variable is also readonly, since the variable is stored
346 in readonly memory. We also accept readonly aliases of non-readonly
347 locations assuming that user knows what he is asking for. */
348 if (!TREE_READONLY (decl) && !TREE_READONLY (real_node->decl))
349 return false;
351 /* Variables declared 'const' without an initializer
352 have zero as the initializer if they may not be
353 overridden at link or run time.
355 It is actually requirement for C++ compiler to optimize const variables
356 consistently. As a GNU extension, do not enfore this rule for user defined
357 weak variables, so we support interposition on:
358 static const int dummy = 0;
359 extern const int foo __attribute__((__weak__, __alias__("dummy")));
361 if ((!DECL_INITIAL (real_node->decl)
362 || (DECL_WEAK (decl) && !DECL_COMDAT (decl)))
363 && (DECL_EXTERNAL (decl) || decl_replaceable_p (decl)))
364 return false;
366 /* Variables declared `const' with an initializer are considered
367 to not be overwritable with different initializer by default.
369 ??? Previously we behaved so for scalar variables but not for array
370 accesses. */
371 return true;
374 /* If DECLARATION is constant variable and its initial value is known
375 (so we can do constant folding), return its constructor (DECL_INITIAL).
376 This may be an expression or NULL when DECL is initialized to 0.
377 Return ERROR_MARK_NODE otherwise.
379 In LTO this may actually trigger reading the constructor from disk.
380 For this reason varpool_ctor_useable_for_folding_p should be used when
381 the actual constructor value is not needed. */
383 tree
384 ctor_for_folding (tree decl)
386 varpool_node *node, *real_node;
387 tree real_decl;
389 if (TREE_CODE (decl) != VAR_DECL
390 && TREE_CODE (decl) != CONST_DECL)
391 return error_mark_node;
393 if (TREE_CODE (decl) == CONST_DECL
394 || DECL_IN_CONSTANT_POOL (decl))
395 return DECL_INITIAL (decl);
397 if (TREE_THIS_VOLATILE (decl))
398 return error_mark_node;
400 /* Do not care about automatic variables. Those are never initialized
401 anyway, because gimplifier exapnds the code. */
402 if (!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
404 gcc_assert (!TREE_PUBLIC (decl));
405 return error_mark_node;
408 gcc_assert (TREE_CODE (decl) == VAR_DECL);
410 real_node = node = varpool_node::get (decl);
411 if (node)
413 real_node = node->ultimate_alias_target ();
414 real_decl = real_node->decl;
416 else
417 real_decl = decl;
419 /* See if we are dealing with alias.
420 In most cases alias is just alternative symbol pointing to a given
421 constructor. This allows us to use interposition rules of DECL
422 constructor of REAL_NODE. However weakrefs are special by being just
423 alternative name of their target (if defined). */
424 if (decl != real_decl)
426 gcc_assert (!DECL_INITIAL (decl)
427 || (node->alias && node->get_alias_target () == real_node)
428 || DECL_INITIAL (decl) == error_mark_node);
429 if (node->weakref)
431 node = node->get_alias_target ();
432 decl = node->decl;
436 if ((!DECL_VIRTUAL_P (real_decl)
437 || DECL_INITIAL (real_decl) == error_mark_node
438 || !DECL_INITIAL (real_decl))
439 && (!node || !node->ctor_useable_for_folding_p ()))
440 return error_mark_node;
442 /* OK, we can return constructor. See if we need to fetch it from disk
443 in LTO mode. */
444 if (DECL_INITIAL (real_decl) != error_mark_node
445 || !in_lto_p)
446 return DECL_INITIAL (real_decl);
447 return real_node->get_constructor ();
450 /* Add the variable DECL to the varpool.
451 Unlike finalize_decl function is intended to be used
452 by middle end and allows insertion of new variable at arbitrary point
453 of compilation. */
454 void
455 varpool_node::add (tree decl)
457 varpool_node *node;
458 varpool_node::finalize_decl (decl);
459 node = varpool_node::get_create (decl);
460 symtab->call_varpool_insertion_hooks (node);
461 if (node->externally_visible_p ())
462 node->externally_visible = true;
463 if (lookup_attribute ("no_reorder", DECL_ATTRIBUTES (decl)))
464 node->no_reorder = 1;
467 /* Return variable availability. See cgraph.h for description of individual
468 return values. */
469 enum availability
470 varpool_node::get_availability (void)
472 if (!definition)
473 return AVAIL_NOT_AVAILABLE;
474 if (!TREE_PUBLIC (decl))
475 return AVAIL_AVAILABLE;
476 if (DECL_IN_CONSTANT_POOL (decl)
477 || DECL_VIRTUAL_P (decl))
478 return AVAIL_AVAILABLE;
479 if (alias && weakref)
481 enum availability avail;
483 ultimate_alias_target (&avail)->get_availability ();
484 return avail;
486 /* If the variable can be overwritten, return OVERWRITABLE. Takes
487 care of at least one notable extension - the COMDAT variables
488 used to share template instantiations in C++. */
489 if (decl_replaceable_p (decl)
490 || DECL_EXTERNAL (decl))
491 return AVAIL_INTERPOSABLE;
492 return AVAIL_AVAILABLE;
495 void
496 varpool_node::analyze (void)
498 /* When reading back varpool at LTO time, we re-construct the queue in order
499 to have "needed" list right by inserting all needed nodes into varpool.
500 We however don't want to re-analyze already analyzed nodes. */
501 if (!analyzed)
503 gcc_assert (!in_lto_p || symtab->function_flags_ready);
504 /* Compute the alignment early so function body expanders are
505 already informed about increased alignment. */
506 align_variable (decl, 0);
508 if (alias)
509 resolve_alias (varpool_node::get (alias_target));
510 else if (DECL_INITIAL (decl))
511 record_references_in_initializer (decl, analyzed);
512 analyzed = true;
515 /* Assemble thunks and aliases associated to varpool node. */
517 void
518 varpool_node::assemble_aliases (void)
520 ipa_ref *ref;
522 FOR_EACH_ALIAS (this, ref)
524 varpool_node *alias = dyn_cast <varpool_node *> (ref->referring);
525 do_assemble_alias (alias->decl,
526 DECL_ASSEMBLER_NAME (decl));
527 alias->assemble_aliases ();
531 /* Output one variable, if necessary. Return whether we output it. */
533 bool
534 varpool_node::assemble_decl (void)
536 /* Aliases are outout when their target is produced or by
537 output_weakrefs. */
538 if (alias)
539 return false;
541 /* Constant pool is output from RTL land when the reference
542 survive till this level. */
543 if (DECL_IN_CONSTANT_POOL (decl) && TREE_ASM_WRITTEN (decl))
544 return false;
546 /* Decls with VALUE_EXPR should not be in the varpool at all. They
547 are not real variables, but just info for debugging and codegen.
548 Unfortunately at the moment emutls is not updating varpool correctly
549 after turning real vars into value_expr vars. */
550 if (DECL_HAS_VALUE_EXPR_P (decl)
551 && !targetm.have_tls)
552 return false;
554 /* Hard register vars do not need to be output. */
555 if (DECL_HARD_REGISTER (decl))
556 return false;
558 gcc_checking_assert (!TREE_ASM_WRITTEN (decl)
559 && TREE_CODE (decl) == VAR_DECL
560 && !DECL_HAS_VALUE_EXPR_P (decl));
562 if (!in_other_partition
563 && !DECL_EXTERNAL (decl))
565 get_constructor ();
566 assemble_variable (decl, 0, 1, 0);
567 gcc_assert (TREE_ASM_WRITTEN (decl));
568 gcc_assert (definition);
569 assemble_aliases ();
570 return true;
573 return false;
576 /* Add NODE to queue starting at FIRST.
577 The queue is linked via AUX pointers and terminated by pointer to 1. */
579 static void
580 enqueue_node (varpool_node *node, varpool_node **first)
582 if (node->aux)
583 return;
584 gcc_checking_assert (*first);
585 node->aux = *first;
586 *first = node;
589 /* Optimization of function bodies might've rendered some variables as
590 unnecessary so we want to avoid these from being compiled. Re-do
591 reachability starting from variables that are either externally visible
592 or was referred from the asm output routines. */
594 void
595 symbol_table::remove_unreferenced_decls (void)
597 varpool_node *next, *node;
598 varpool_node *first = (varpool_node *)(void *)1;
599 int i;
600 ipa_ref *ref = NULL;
601 hash_set<varpool_node *> referenced;
603 if (seen_error ())
604 return;
606 if (dump_file)
607 fprintf (dump_file, "Trivially needed variables:");
608 FOR_EACH_DEFINED_VARIABLE (node)
610 if (node->analyzed
611 && (!node->can_remove_if_no_refs_p ()
612 /* We just expanded all function bodies. See if any of
613 them needed the variable. */
614 || DECL_RTL_SET_P (node->decl)))
616 enqueue_node (node, &first);
617 if (dump_file)
618 fprintf (dump_file, " %s", node->asm_name ());
621 while (first != (varpool_node *)(void *)1)
623 node = first;
624 first = (varpool_node *)first->aux;
626 if (node->same_comdat_group)
628 symtab_node *next;
629 for (next = node->same_comdat_group;
630 next != node;
631 next = next->same_comdat_group)
633 varpool_node *vnext = dyn_cast <varpool_node *> (next);
634 if (vnext && vnext->analyzed && !next->comdat_local_p ())
635 enqueue_node (vnext, &first);
638 for (i = 0; node->iterate_reference (i, ref); i++)
640 varpool_node *vnode = dyn_cast <varpool_node *> (ref->referred);
641 if (vnode
642 && !vnode->in_other_partition
643 && (!DECL_EXTERNAL (ref->referred->decl)
644 || vnode->alias)
645 && vnode->analyzed)
646 enqueue_node (vnode, &first);
647 else
648 referenced.add (node);
651 if (dump_file)
652 fprintf (dump_file, "\nRemoving variables:");
653 for (node = first_defined_variable (); node; node = next)
655 next = next_defined_variable (node);
656 if (!node->aux && !node->no_reorder)
658 if (dump_file)
659 fprintf (dump_file, " %s", node->asm_name ());
660 if (referenced.contains(node))
661 node->remove_initializer ();
662 else
663 node->remove ();
667 if (dump_file)
668 fprintf (dump_file, "\n");
671 /* For variables in named sections make sure get_variable_section
672 is called before we switch to those sections. Then section
673 conflicts between read-only and read-only requiring relocations
674 sections can be resolved. */
675 void
676 varpool_node::finalize_named_section_flags (void)
678 if (!TREE_ASM_WRITTEN (decl)
679 && !alias
680 && !in_other_partition
681 && !DECL_EXTERNAL (decl)
682 && TREE_CODE (decl) == VAR_DECL
683 && !DECL_HAS_VALUE_EXPR_P (decl)
684 && get_section ())
685 get_variable_section (decl, false);
688 /* Output all variables enqueued to be assembled. */
689 bool
690 symbol_table::output_variables (void)
692 bool changed = false;
693 varpool_node *node;
695 if (seen_error ())
696 return false;
698 remove_unreferenced_decls ();
700 timevar_push (TV_VAROUT);
702 FOR_EACH_DEFINED_VARIABLE (node)
704 /* Handled in output_in_order. */
705 if (node->no_reorder)
706 continue;
708 node->finalize_named_section_flags ();
711 FOR_EACH_DEFINED_VARIABLE (node)
713 /* Handled in output_in_order. */
714 if (node->no_reorder)
715 continue;
716 if (node->assemble_decl ())
717 changed = true;
719 timevar_pop (TV_VAROUT);
720 return changed;
723 /* Create a new global variable of type TYPE. */
724 tree
725 add_new_static_var (tree type)
727 tree new_decl;
728 varpool_node *new_node;
730 new_decl = create_tmp_var_raw (type, NULL);
731 DECL_NAME (new_decl) = create_tmp_var_name (NULL);
732 TREE_READONLY (new_decl) = 0;
733 TREE_STATIC (new_decl) = 1;
734 TREE_USED (new_decl) = 1;
735 DECL_CONTEXT (new_decl) = NULL_TREE;
736 DECL_ABSTRACT_P (new_decl) = false;
737 lang_hooks.dup_lang_specific_decl (new_decl);
738 new_node = varpool_node::get_create (new_decl);
739 varpool_node::finalize_decl (new_decl);
741 return new_node->decl;
744 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
745 Extra name aliases are output whenever DECL is output. */
747 varpool_node *
748 varpool_node::create_alias (tree alias, tree decl)
750 varpool_node *alias_node;
752 gcc_assert (TREE_CODE (decl) == VAR_DECL);
753 gcc_assert (TREE_CODE (alias) == VAR_DECL);
754 alias_node = varpool_node::get_create (alias);
755 alias_node->alias = true;
756 alias_node->definition = true;
757 alias_node->alias_target = decl;
758 if (lookup_attribute ("weakref", DECL_ATTRIBUTES (alias)) != NULL)
759 alias_node->weakref = true;
760 return alias_node;
763 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful.
764 Extra name aliases are output whenever DECL is output. */
766 varpool_node *
767 varpool_node::create_extra_name_alias (tree alias, tree decl)
769 varpool_node *alias_node;
771 #ifndef ASM_OUTPUT_DEF
772 /* If aliases aren't supported by the assembler, fail. */
773 return NULL;
774 #endif
775 alias_node = varpool_node::create_alias (alias, decl);
776 alias_node->cpp_implicit_alias = true;
778 /* Extra name alias mechanizm creates aliases really late
779 via DECL_ASSEMBLER_NAME mechanizm.
780 This is unfortunate because they are not going through the
781 standard channels. Ensure they get output. */
782 if (symtab->cpp_implicit_aliases_done)
783 alias_node->resolve_alias (varpool_node::get_create (decl));
784 return alias_node;
787 /* Call calback on varpool symbol and aliases associated to varpool symbol.
788 When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are
789 skipped. */
791 bool
792 varpool_node::call_for_node_and_aliases (bool (*callback) (varpool_node *,
793 void *),
794 void *data,
795 bool include_overwritable)
797 ipa_ref *ref;
799 if (callback (this, data))
800 return true;
802 FOR_EACH_ALIAS (this, ref)
804 varpool_node *alias = dyn_cast <varpool_node *> (ref->referring);
805 if (include_overwritable
806 || alias->get_availability () > AVAIL_INTERPOSABLE)
807 if (alias->call_for_node_and_aliases (callback, data,
808 include_overwritable))
809 return true;
811 return false;