diff options
-rw-r--r-- | gcc/ChangeLog | 45 | ||||
-rw-r--r-- | gcc/cgraph.c | 4 | ||||
-rw-r--r-- | gcc/cgraph.h | 10 | ||||
-rw-r--r-- | gcc/cgraphunit.c | 31 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 4 | ||||
-rw-r--r-- | gcc/ipa-inline-analysis.c | 4 | ||||
-rw-r--r-- | gcc/ipa-inline.c | 4 | ||||
-rw-r--r-- | gcc/ipa-prop.c | 6 | ||||
-rw-r--r-- | gcc/ipa-pure-const.c | 4 | ||||
-rw-r--r-- | gcc/ipa-reference.c | 11 | ||||
-rw-r--r-- | gcc/ipa-utils.c | 10 | ||||
-rw-r--r-- | gcc/ipa.c | 41 | ||||
-rw-r--r-- | gcc/lto-cgraph.c | 4 | ||||
-rw-r--r-- | gcc/lto-symtab.c | 4 | ||||
-rw-r--r-- | gcc/lto/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/lto/lto-partition.c | 18 | ||||
-rw-r--r-- | gcc/lto/lto.c | 21 | ||||
-rw-r--r-- | gcc/matrix-reorg.c | 154 | ||||
-rw-r--r-- | gcc/passes.c | 22 | ||||
-rw-r--r-- | gcc/trans-mem.c | 10 | ||||
-rw-r--r-- | gcc/tree-emutls.c | 4 | ||||
-rw-r--r-- | gcc/tree-profile.c | 15 | ||||
-rw-r--r-- | gcc/tree-ssa-structalias.c | 8 | ||||
-rw-r--r-- | gcc/tree-vectorizer.c | 4 | ||||
-rw-r--r-- | gcc/tree.c | 4 | ||||
-rw-r--r-- | gcc/value-prof.c | 2 | ||||
-rw-r--r-- | gcc/varpool.c | 6 |
28 files changed, 257 insertions, 207 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 173dfee8ac8..bb23d465365 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,48 @@ +2012-04-16 Jan Hubicka <jh@suse.cz> + + * cgraph.h (FOR_EACH_VARIABLE, FOR_EACH_VARIABLE, FOR_EACH_FUNCTION): + New macros. + * lto-symtab.c (lto_symtab_merge_cgraph_nodes): Use FOR_EACH + walkers to walk cgraph and varpool. + * cgraph.c (cgraph_node_for_asm): Likewise. + (dump_cgraph): Likewise. + * value-prof.c (init_node_map): Likewise. + * tree.c (free_lang_data_in_cgraph): Likewise. + * tree-emutls.c: (ipa_lower_emutls): Likewise. + * ipa-reference.c (generate_summary, propagate): Likewise. + * cgraphunit.c (verify_cgraph, cgraph_process_same_body_aliases, + cgraph_mark_functions_to_output, cgraph_output_in_order, + output_weakrefs, cgraph_materialize_all_clones, + cgraph_optimize): Likewise. + * lto-cgraph.c (merge_profile_summaries): Likewise. + (input_cgraph): Likewise. + * ipa-pure-const.c (generate_summary): Likewise. + (propagate): Likwise. + * ipa-utils.c (ipa_reduced_postorder): Likewise. + (ipa_free_postorder_info): Likewise. + (ipa_reverse_postorder): Likewise. + * ipa-inline.c (ipa_inline): Likewise. + * matrix-reorg.c (find_matrices_decl): Likewise. + (matrix_reorg): Likewise. + * tree-vectorizer.c (increase_alignment): Likewise. + * ipa.c (cgraph_remove_unreachable_nodes): Likewise. + (function_and_variable_visibility): Likewise. + (whole_program_function_and_variable_visibility): Likewise. + (ipa_cdtor_merge): Likewise. + * trans-mem.c (ipa_tm_execute): Likewise. + * ipa-inline-analysis.c (dump_inline_summaries): Likewise. + * ipa-prop.c (ipa_print_all_jump_functions): Likewise. + (ipa_print_all_params): Likewise. + (ipa_update_after_lto_read): Likewise. + * tree-profie.c (tree_profiling): Likewise. + * tree-ssa-structalias.c (ipa_pta_execute): Likewise. + * passes.c (dump_passes): Likewise. + (do_per_function): Likewise. + (ipa_write_summaries): Likewise. + * varpool.c (dump_varpool): Likewise. + (varpool_node_for_asm): Likewise. + (varpool_assemble_pending_decls): Likewise. + 2012-04-16 Richard Guenther <rguenther@suse.de> PR tree-optimization/52975 diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 1a354b65968..4f5a9dae52d 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -711,7 +711,7 @@ cgraph_node_for_asm (tree asmname) assembler_name_hash = htab_create_ggc (10, hash_node_by_assembler_name, eq_assembler_name, NULL); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) if (!node->global.inlined_to) { tree name = DECL_ASSEMBLER_NAME (node->symbol.decl); @@ -1962,7 +1962,7 @@ dump_cgraph (FILE *f) struct cgraph_node *node; fprintf (f, "callgraph:\n\n"); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) dump_cgraph_node (f, node); } diff --git a/gcc/cgraph.h b/gcc/cgraph.h index d5d9eb07ad3..e4c7b2a613c 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -773,6 +773,12 @@ varpool_next_static_initializer (struct varpool_node *node) #define FOR_EACH_STATIC_INITIALIZER(node) \ for ((node) = varpool_first_static_initializer (); (node); \ (node) = varpool_next_static_initializer (node)) +/* Walk all variables. */ +#define FOR_EACH_VARIABLE(node) \ + for ((node) = varpool_nodes; (node); (node) = (node)->next) +/* Walk all variables with definitions in current unit. */ +#define FOR_EACH_DEFINED_VARIABLE(node) \ + for ((node) = varpool_nodes_queue; (node); (node) = (node)->next_needed) /* Return first function with body defined. */ static inline struct cgraph_node * @@ -803,7 +809,9 @@ cgraph_next_defined_function (struct cgraph_node *node) #define FOR_EACH_DEFINED_FUNCTION(node) \ for ((node) = cgraph_first_defined_function (); (node); \ (node) = cgraph_next_defined_function (node)) - +/* Walk all functions. */ +#define FOR_EACH_FUNCTION(node) \ + for ((node) = cgraph_nodes; (node); (node) = (node)->next) /* Return true when NODE is a function with Gimple body defined in current unit. Functions can also be define externally or they diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 8c27eb4d32c..abe90120129 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -890,7 +890,7 @@ verify_cgraph (void) if (seen_error ()) return; - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) verify_cgraph_node (node); } @@ -1026,7 +1026,7 @@ void cgraph_process_same_body_aliases (void) { struct cgraph_node *node; - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) if (node->same_body_alias && !VEC_length (ipa_ref_t, node->symbol.ref_list.references)) { @@ -1398,11 +1398,11 @@ cgraph_mark_functions_to_output (void) #ifdef ENABLE_CHECKING bool check_same_comdat_groups = false; - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) gcc_assert (!node->process); #endif - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) { tree decl = node->symbol.decl; struct cgraph_edge *e; @@ -1472,7 +1472,7 @@ cgraph_mark_functions_to_output (void) } #ifdef ENABLE_CHECKING if (check_same_comdat_groups) - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) if (node->symbol.same_comdat_group && !node->process) { tree decl = node->symbol.decl; @@ -2081,7 +2081,7 @@ cgraph_output_in_order (void) varpool_analyze_pending_decls (); - for (pf = cgraph_nodes; pf; pf = pf->next) + FOR_EACH_DEFINED_FUNCTION (pf) { if (pf->process && !pf->thunk.thunk_p && !pf->alias) { @@ -2092,7 +2092,7 @@ cgraph_output_in_order (void) } } - for (pv = varpool_nodes_queue; pv; pv = pv->next_needed) + FOR_EACH_DEFINED_VARIABLE (pv) { i = pv->symbol.order; gcc_assert (nodes[i].kind == ORDER_UNDEFINED); @@ -2246,14 +2246,14 @@ output_weakrefs (void) { struct cgraph_node *node; struct varpool_node *vnode; - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) if (node->alias && DECL_EXTERNAL (node->symbol.decl) && !TREE_ASM_WRITTEN (node->symbol.decl) && lookup_attribute ("weakref", DECL_ATTRIBUTES (node->symbol.decl))) assemble_alias (node->symbol.decl, node->thunk.alias ? DECL_ASSEMBLER_NAME (node->thunk.alias) : get_alias_symbol (node->symbol.decl)); - for (vnode = varpool_nodes; vnode; vnode = vnode->next) + FOR_EACH_VARIABLE (vnode) if (vnode->alias && DECL_EXTERNAL (vnode->symbol.decl) && !TREE_ASM_WRITTEN (vnode->symbol.decl) && lookup_attribute ("weakref", DECL_ATTRIBUTES (vnode->symbol.decl))) @@ -2320,7 +2320,7 @@ cgraph_copy_node_for_versioning (struct cgraph_node *old_version, new_version->analyzed = old_version->analyzed; new_version->local = old_version->local; new_version->symbol.externally_visible = false; - new_version->local.local = true; + new_version->local.local = old_version->analyzed; new_version->global = old_version->global; new_version->rtl = old_version->rtl; new_version->reachable = true; @@ -2578,7 +2578,7 @@ cgraph_materialize_all_clones (void) while (!stabilized) { stabilized = true; - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) { if (node->clone_of && node->symbol.decl != node->clone_of->symbol.decl && !gimple_has_body_p (node->symbol.decl)) @@ -2628,7 +2628,7 @@ cgraph_materialize_all_clones (void) } } } - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) if (!node->analyzed && node->callees) cgraph_node_remove_callees (node); if (cgraph_dump_file) @@ -2745,10 +2745,9 @@ cgraph_optimize (void) struct cgraph_node *node; bool error_found = false; - for (node = cgraph_nodes; node; node = node->next) - if (node->analyzed - && (node->global.inlined_to - || gimple_has_body_p (node->symbol.decl))) + FOR_EACH_DEFINED_FUNCTION (node) + if (node->global.inlined_to + || gimple_has_body_p (node->symbol.decl)) { error_found = true; dump_cgraph_node (stderr, node); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 893ce5639a9..c511a128750 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2012-04-16 Jan Hubicka <jh@suse.cz> + + * decl2.c (collect_candidates_for_java_method_alias): Use FOR_EACH + walkers to walk cgraph and varpool. + 2012-04-15 Jason Merrill <jason@redhat.com> PR c++/47220 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index e7fb0f5235a..90498ea2941 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3489,7 +3489,7 @@ collect_candidates_for_java_method_aliases (void) return candidates; #endif - for (node = cgraph_nodes; node ; node = node->next) + FOR_EACH_FUNCTION (node) { tree fndecl = node->symbol.decl; @@ -3523,7 +3523,7 @@ build_java_method_aliases (struct pointer_set_t *candidates) return; #endif - for (node = cgraph_nodes; node ; node = node->next) + FOR_EACH_FUNCTION (node) { tree fndecl = node->symbol.decl; diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 40bbf340f76..dd01d33740f 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -1226,8 +1226,8 @@ dump_inline_summaries (FILE *f) { struct cgraph_node *node; - for (node = cgraph_nodes; node; node = node->next) - if (node->analyzed && !node->global.inlined_to) + FOR_EACH_DEFINED_FUNCTION (node) + if (!node->global.inlined_to) dump_inline_summary (f, node); } diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index ad728487ba1..ebee1f97e99 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -1685,7 +1685,7 @@ ipa_inline (void) nnodes = ipa_reverse_postorder (order); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) node->symbol.aux = 0; if (dump_file) @@ -1742,7 +1742,7 @@ ipa_inline (void) to be hot. */ for (cold = 0; cold <= 1; cold ++) { - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) { if (want_inline_function_called_once_p (node) && (cold diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 67f603beb6b..97a6a5cb0cf 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -260,7 +260,7 @@ ipa_print_all_jump_functions (FILE *f) struct cgraph_node *node; fprintf (f, "\nJump functions:\n"); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) { ipa_print_node_jump_functions (f, node); } @@ -2209,7 +2209,7 @@ ipa_print_all_params (FILE * f) struct cgraph_node *node; fprintf (f, "\nFunction parameters:\n"); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) ipa_print_node_params (f, node); } @@ -3087,7 +3087,7 @@ ipa_update_after_lto_read (void) ipa_check_create_node_params (); ipa_check_create_edge_args (); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) if (node->analyzed) ipa_initialize_node_params (node); } diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index ca36935d916..29b4c177b28 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -924,7 +924,7 @@ generate_summary (void) by default, but the info can be used at LTO with -fwhole-program or when function got cloned and the clone is AVAILABLE. */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) if (cgraph_function_body_availability (node) >= AVAIL_OVERWRITABLE) set_function_state (node, analyze_function (node, true)); @@ -1475,7 +1475,7 @@ propagate (void) propagate_pure_const (); /* Cleanup. */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) if (has_function_state (node)) free (get_function_state (node)); VEC_free (funct_state, heap, funct_state_vec); diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index e7950688b40..d8fd796ea25 100644 --- a/gcc/ipa-reference.c +++ b/gcc/ipa-reference.c @@ -530,9 +530,8 @@ generate_summary (void) bm_temp = BITMAP_ALLOC (&local_info_obstack); /* Process all of the functions next. */ - for (node = cgraph_nodes; node; node = node->next) - if (node->analyzed) - analyze_function (node); + FOR_EACH_DEFINED_FUNCTION (node) + analyze_function (node); if (dump_file) EXECUTE_IF_SET_IN_BITMAP (all_module_statics, 0, index, bi) @@ -544,7 +543,7 @@ generate_summary (void) BITMAP_FREE(bm_temp); if (dump_file) - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) if (cgraph_function_body_availability (node) >= AVAIL_OVERWRITABLE) { ipa_reference_local_vars_info_t l; @@ -884,13 +883,13 @@ propagate (void) } /* Cleanup. */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) { ipa_reference_vars_info_t node_info; ipa_reference_global_vars_info_t node_g; ipa_reference_optimization_summary_t opt; - if (!node->analyzed || node->alias) + if (node->alias) continue; node_info = get_reference_vars_info (node); diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c index 0f4dd504fa7..db0784db550 100644 --- a/gcc/ipa-utils.c +++ b/gcc/ipa-utils.c @@ -178,7 +178,7 @@ ipa_reduced_postorder (struct cgraph_node **order, env.reduce = reduce; env.allow_overwritable = allow_overwritable; - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) { enum availability avail = cgraph_function_body_availability (node); @@ -222,7 +222,7 @@ void ipa_free_postorder_info (void) { struct cgraph_node *node; - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) { /* Get rid of the aux information. */ if (node->symbol.aux) @@ -261,10 +261,10 @@ ipa_reverse_postorder (struct cgraph_node **order) output algorithm. Ignore the fact that some functions won't need to be output and put them into order as well, so we get dependencies right through inline functions. */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) node->symbol.aux = NULL; for (pass = 0; pass < 2; pass++) - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) if (!node->symbol.aux && (pass || (!node->symbol.address_taken @@ -317,7 +317,7 @@ ipa_reverse_postorder (struct cgraph_node **order) } } free (stack); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) node->symbol.aux = NULL; return order_pos; } diff --git a/gcc/ipa.c b/gcc/ipa.c index c96fede1e8e..7c35346fcbf 100644 --- a/gcc/ipa.c +++ b/gcc/ipa.c @@ -181,9 +181,9 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file) if (file) fprintf (file, "\nReclaiming functions:"); #ifdef ENABLE_CHECKING - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) gcc_assert (!node->symbol.aux); - for (vnode = varpool_nodes; vnode; vnode = vnode->next) + FOR_EACH_VARIABLE (vnode) gcc_assert (!vnode->symbol.aux); #endif varpool_reset_queue (); @@ -191,7 +191,7 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file) This is mostly when they can be referenced externally. Inline clones are special since their declarations are shared with master clone and thus cgraph_can_remove_if_no_direct_calls_and_refs_p should not be called on them. */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) if (node->analyzed && !node->global.inlined_to && (!cgraph_can_remove_if_no_direct_calls_and_refs_p (node) /* Keep around virtual functions for possible devirtualization. */ @@ -210,7 +210,7 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file) } /* Mark variables that are obviously needed. */ - for (vnode = varpool_nodes; vnode; vnode = vnode->next) + FOR_EACH_VARIABLE (vnode) { vnode->next_needed = NULL; vnode->prev_needed = NULL; @@ -405,7 +405,7 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file) } } } - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) { /* Inline clones might be kept around so their materializing allows further cloning. If the function the clone is inlined into is removed, we need @@ -441,7 +441,7 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file) if (file) fprintf (file, "\nClearing address taken flags:"); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) if (node->symbol.address_taken && !node->symbol.used_from_other_partition) { @@ -492,7 +492,7 @@ ipa_discover_readonly_nonaddressable_vars (void) struct varpool_node *vnode; if (dump_file) fprintf (dump_file, "Clearing variable flags:"); - for (vnode = varpool_nodes; vnode; vnode = vnode->next) + FOR_EACH_VARIABLE (vnode) if (vnode->finalized && varpool_all_refs_explicit_p (vnode) && (TREE_ADDRESSABLE (vnode->symbol.decl) || !TREE_READONLY (vnode->symbol.decl))) @@ -797,7 +797,7 @@ function_and_variable_visibility (bool whole_program) fprintf (dump_file, "\n"); } - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) { int flags = flags_from_decl_or_type (node->symbol.decl); @@ -889,9 +889,9 @@ function_and_variable_visibility (bool whole_program) DECL_EXTERNAL (node->symbol.decl) = 1; } } - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) node->local.local = cgraph_local_node_p (node); - for (vnode = varpool_nodes; vnode; vnode = vnode->next) + FOR_EACH_VARIABLE (vnode) { /* weak flag makes no sense on local variables. */ gcc_assert (!DECL_WEAK (vnode->symbol.decl) @@ -921,7 +921,7 @@ function_and_variable_visibility (bool whole_program) (TYPE_ADDR_SPACE (TREE_TYPE (vnode->symbol.decl)))))) DECL_COMMON (vnode->symbol.decl) = 0; } - for (vnode = varpool_nodes_queue; vnode; vnode = vnode->next_needed) + FOR_EACH_DEFINED_VARIABLE (vnode) { if (!vnode->finalized) continue; @@ -946,17 +946,17 @@ function_and_variable_visibility (bool whole_program) if (dump_file) { fprintf (dump_file, "\nMarking local functions:"); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) if (node->local.local) fprintf (dump_file, " %s", cgraph_node_name (node)); fprintf (dump_file, "\n\n"); fprintf (dump_file, "\nMarking externally visible functions:"); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) if (node->symbol.externally_visible) fprintf (dump_file, " %s", cgraph_node_name (node)); fprintf (dump_file, "\n\n"); fprintf (dump_file, "\nMarking externally visible variables:"); - for (vnode = varpool_nodes_queue; vnode; vnode = vnode->next_needed) + FOR_EACH_DEFINED_VARIABLE (vnode) if (vnode->symbol.externally_visible) fprintf (dump_file, " %s", varpool_node_name (vnode)); fprintf (dump_file, "\n\n"); @@ -1012,17 +1012,17 @@ whole_program_function_and_variable_visibility (void) function_and_variable_visibility (flag_whole_program); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) if ((node->symbol.externally_visible && !DECL_COMDAT (node->symbol.decl)) && node->local.finalized) cgraph_mark_needed_node (node); - for (vnode = varpool_nodes_queue; vnode; vnode = vnode->next_needed) + FOR_EACH_DEFINED_VARIABLE (vnode) if (vnode->symbol.externally_visible && !DECL_COMDAT (vnode->symbol.decl)) varpool_mark_needed_node (vnode); if (dump_file) { fprintf (dump_file, "\nNeeded variables:"); - for (vnode = varpool_nodes_queue; vnode; vnode = vnode->next_needed) + FOR_EACH_DEFINED_VARIABLE (vnode) if (vnode->needed) fprintf (dump_file, " %s", varpool_node_name (vnode)); fprintf (dump_file, "\n\n"); @@ -1405,10 +1405,9 @@ static unsigned int ipa_cdtor_merge (void) { struct cgraph_node *node; - for (node = cgraph_nodes; node; node = node->next) - if (node->analyzed - && (DECL_STATIC_CONSTRUCTOR (node->symbol.decl) - || DECL_STATIC_DESTRUCTOR (node->symbol.decl))) + FOR_EACH_DEFINED_FUNCTION (node) + if (DECL_STATIC_CONSTRUCTOR (node->symbol.decl) + || DECL_STATIC_DESTRUCTOR (node->symbol.decl)) record_cdtor_fn (node); build_cdtor_fns (); VEC_free (tree, heap, static_ctors); diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 69ddb0637b8..421f62bc875 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -1422,7 +1422,7 @@ merge_profile_summaries (struct lto_file_decl_data **file_data_vec) /* Now compute count_materialization_scale of each node. During LTRANS we already have values of count_materialization_scale computed, so just update them. */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) if (node->symbol.lto_file_data && node->symbol.lto_file_data->profile_info.runs) { @@ -1501,7 +1501,7 @@ input_cgraph (void) /* Clear out the aux field that was used to store enough state to tell which nodes should be overwritten. */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) { /* Some nodes may have been created by cgraph_node. This happens when the callgraph contains nested functions. If the diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c index 7d77f3565fe..406bc239471 100644 --- a/gcc/lto-symtab.c +++ b/gcc/lto-symtab.c @@ -761,11 +761,11 @@ lto_symtab_merge_cgraph_nodes (void) lto_symtab_maybe_init_hash_table (); htab_traverse (lto_symtab_identifiers, lto_symtab_merge_cgraph_nodes_1, NULL); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) if ((node->thunk.thunk_p || node->alias) && node->thunk.alias) node->thunk.alias = lto_symtab_prevailing_decl (node->thunk.alias); - for (vnode = varpool_nodes; vnode; vnode = vnode->next) + FOR_EACH_VARIABLE (vnode) if (vnode->alias_of) vnode->alias_of = lto_symtab_prevailing_decl (vnode->alias_of); } diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 4ff0882e114..bab0a77420d 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,12 @@ +2012-04-16 Jan Hubicka <jh@suse.cz> + + * lto.c (read_cgraph_and_symbols): Use FOR_EACH + walkers to walk cgraph and varpool. + (materialize_cgraph): Likewise. + * lto-partition.c (lto_1_to_1_map): Likewise. + (lto_balanced_map): Likewise. + (lto_promote_cross_file_statics): Likewise. + 2012-04-14 Jan Hubicka <jh@suse.cz> * lto.c: Update field referenced for new cgraph/varpool layout. diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c index af36b1440b2..1e6046218a4 100644 --- a/gcc/lto/lto-partition.c +++ b/gcc/lto/lto-partition.c @@ -313,7 +313,7 @@ lto_1_to_1_map (void) pmap = pointer_map_create (); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) { if (!partition_cgraph_node_p (node) || node->symbol.aux) @@ -348,7 +348,7 @@ lto_1_to_1_map (void) add_cgraph_node_to_partition (partition, node); } - for (vnode = varpool_nodes; vnode; vnode = vnode->next) + FOR_EACH_VARIABLE (vnode) { if (!partition_varpool_node_p (vnode) || vnode->symbol.aux) @@ -367,9 +367,9 @@ lto_1_to_1_map (void) add_varpool_node_to_partition (partition, vnode); } - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) node->symbol.aux = NULL; - for (vnode = varpool_nodes; vnode; vnode = vnode->next) + FOR_EACH_VARIABLE (vnode) vnode->symbol.aux = NULL; /* If the cgraph is empty, create one cgraph node set so that there is still @@ -463,7 +463,7 @@ lto_balanced_map (void) int npartitions; int current_order = -1; - for (vnode = varpool_nodes; vnode; vnode = vnode->next) + FOR_EACH_VARIABLE (vnode) gcc_assert (!vnode->symbol.aux); /* Until we have better ordering facility, use toplogical order. Include only nodes we will partition and compute estimate of program @@ -487,13 +487,13 @@ lto_balanced_map (void) { qsort (order, n_nodes, sizeof (struct cgraph_node *), node_cmp); - for (vnode = varpool_nodes; vnode; vnode = vnode->next) + FOR_EACH_VARIABLE (vnode) if (partition_varpool_node_p (vnode)) n_varpool_nodes++; varpool_order = XNEWVEC (struct varpool_node *, n_varpool_nodes); n_varpool_nodes = 0; - for (vnode = varpool_nodes; vnode; vnode = vnode->next) + FOR_EACH_VARIABLE (vnode) if (partition_varpool_node_p (vnode)) varpool_order[n_varpool_nodes++] = vnode; qsort (varpool_order, n_varpool_nodes, sizeof (struct varpool_node *), @@ -742,7 +742,7 @@ lto_balanced_map (void) /* Varables that are not reachable from the code go into last partition. */ if (flag_toplevel_reorder) { - for (vnode = varpool_nodes; vnode; vnode = vnode->next) + FOR_EACH_VARIABLE (vnode) if (partition_varpool_node_p (vnode) && !vnode->symbol.aux) add_varpool_node_to_partition (partition, vnode); } @@ -858,7 +858,7 @@ lto_promote_cross_file_statics (void) referenced from all initializers of read-only vars referenced from this partition that are not in this partition. This needs to be done recursively. */ - for (vnode = varpool_nodes; vnode; vnode = vnode->next) + FOR_EACH_VARIABLE (vnode) if (const_value_known_p (vnode->symbol.decl) && DECL_INITIAL (vnode->symbol.decl) && !varpool_node_in_set_p (vnode, vset) diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 0b48ce183e7..fb374ff0c9f 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -1868,18 +1868,15 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) lto_symtab_merge_cgraph_nodes (); ggc_collect (); + /* FIXME: ipa_transforms_to_apply holds list of passes that have optimization + summaries computed and needs to apply changes. At the moment WHOPR only + supports inlining, so we can push it here by hand. In future we need to stream + this field into ltrans compilation. */ if (flag_ltrans) - for (node = cgraph_nodes; node; node = node->next) - { - /* FIXME: ipa_transforms_to_apply holds list of passes that have optimization - summaries computed and needs to apply changes. At the moment WHOPR only - supports inlining, so we can push it here by hand. In future we need to stream - this field into ltrans compilation. */ - if (node->analyzed) - VEC_safe_push (ipa_opt_pass, heap, - node->ipa_transforms_to_apply, - (ipa_opt_pass)&pass_ipa_inline); - } + FOR_EACH_DEFINED_FUNCTION (node) + VEC_safe_push (ipa_opt_pass, heap, + node->ipa_transforms_to_apply, + (ipa_opt_pass)&pass_ipa_inline); lto_symtab_free (); timevar_pop (TV_IPA_LTO_CGRAPH_MERGE); @@ -1923,7 +1920,7 @@ materialize_cgraph (void) nodes and read the functions if we are not running in WPA mode. */ timevar_push (TV_IPA_LTO_GIMPLE_IN); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) { if (node->symbol.lto_file_data) { diff --git a/gcc/matrix-reorg.c b/gcc/matrix-reorg.c index 918fad2af6e..31e9a8e67d6 100644 --- a/gcc/matrix-reorg.c +++ b/gcc/matrix-reorg.c @@ -548,7 +548,7 @@ find_matrices_decl (void) /* For every global variable in the program: Check to see if it's of a candidate type and record it. */ - for (vnode = varpool_nodes_queue; vnode; vnode = vnode->next_needed) + FOR_EACH_DEFINED_VARIABLE (vnode) { tree var_decl = vnode->symbol.decl; @@ -2266,100 +2266,98 @@ matrix_reorg (void) else check_transpose_p = false; /* If there are hand written vectors, we skip this optimization. */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) if (!may_flatten_matrices (node)) return 0; matrices_to_reorg = htab_create (37, mtt_info_hash, mtt_info_eq, mat_free); /* Find and record all potential matrices in the program. */ find_matrices_decl (); /* Analyze the accesses of the matrices (escaping analysis). */ - for (node = cgraph_nodes; node; node = node->next) - if (node->analyzed) - { - tree temp_fn; + FOR_EACH_DEFINED_FUNCTION (node) + { + tree temp_fn; - temp_fn = current_function_decl; - current_function_decl = node->symbol.decl; - push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); - bitmap_obstack_initialize (NULL); - gimple_register_cfg_hooks (); + temp_fn = current_function_decl; + current_function_decl = node->symbol.decl; + push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); + bitmap_obstack_initialize (NULL); + gimple_register_cfg_hooks (); - if (!gimple_in_ssa_p (cfun)) - { - free_dominance_info (CDI_DOMINATORS); - free_dominance_info (CDI_POST_DOMINATORS); - pop_cfun (); - current_function_decl = temp_fn; - bitmap_obstack_release (NULL); + if (!gimple_in_ssa_p (cfun)) + { + free_dominance_info (CDI_DOMINATORS); + free_dominance_info (CDI_POST_DOMINATORS); + pop_cfun (); + current_function_decl = temp_fn; + bitmap_obstack_release (NULL); - return 0; - } + return 0; + } #ifdef ENABLE_CHECKING - verify_flow_info (); + verify_flow_info (); #endif - if (!matrices_to_reorg) - { - free_dominance_info (CDI_DOMINATORS); - free_dominance_info (CDI_POST_DOMINATORS); - pop_cfun (); - current_function_decl = temp_fn; - bitmap_obstack_release (NULL); + if (!matrices_to_reorg) + { + free_dominance_info (CDI_DOMINATORS); + free_dominance_info (CDI_POST_DOMINATORS); + pop_cfun (); + current_function_decl = temp_fn; + bitmap_obstack_release (NULL); - return 0; - } + return 0; + } - /* Create htap for phi nodes. */ - htab_mat_acc_phi_nodes = htab_create (37, mat_acc_phi_hash, - mat_acc_phi_eq, free); - if (!check_transpose_p) - find_sites_in_func (false); - else - { - find_sites_in_func (true); - loop_optimizer_init (LOOPS_NORMAL); - if (current_loops) - scev_initialize (); - htab_traverse (matrices_to_reorg, analyze_transpose, NULL); - if (current_loops) - { - scev_finalize (); - loop_optimizer_finalize (); - current_loops = NULL; - } - } - /* If the current function is the allocation function for any of - the matrices we check its allocation and the escaping level. */ - htab_traverse (matrices_to_reorg, check_allocation_function, NULL); - free_dominance_info (CDI_DOMINATORS); - free_dominance_info (CDI_POST_DOMINATORS); - pop_cfun (); - current_function_decl = temp_fn; - bitmap_obstack_release (NULL); - } + /* Create htap for phi nodes. */ + htab_mat_acc_phi_nodes = htab_create (37, mat_acc_phi_hash, + mat_acc_phi_eq, free); + if (!check_transpose_p) + find_sites_in_func (false); + else + { + find_sites_in_func (true); + loop_optimizer_init (LOOPS_NORMAL); + if (current_loops) + scev_initialize (); + htab_traverse (matrices_to_reorg, analyze_transpose, NULL); + if (current_loops) + { + scev_finalize (); + loop_optimizer_finalize (); + current_loops = NULL; + } + } + /* If the current function is the allocation function for any of + the matrices we check its allocation and the escaping level. */ + htab_traverse (matrices_to_reorg, check_allocation_function, NULL); + free_dominance_info (CDI_DOMINATORS); + free_dominance_info (CDI_POST_DOMINATORS); + pop_cfun (); + current_function_decl = temp_fn; + bitmap_obstack_release (NULL); + } htab_traverse (matrices_to_reorg, transform_allocation_sites, NULL); /* Now transform the accesses. */ - for (node = cgraph_nodes; node; node = node->next) - if (node->analyzed) - { - /* Remember that allocation sites have been handled. */ - tree temp_fn; - - temp_fn = current_function_decl; - current_function_decl = node->symbol.decl; - push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); - bitmap_obstack_initialize (NULL); - gimple_register_cfg_hooks (); - record_all_accesses_in_func (); - htab_traverse (matrices_to_reorg, transform_access_sites, NULL); - cgraph_rebuild_references (); - free_dominance_info (CDI_DOMINATORS); - free_dominance_info (CDI_POST_DOMINATORS); - pop_cfun (); - current_function_decl = temp_fn; - bitmap_obstack_release (NULL); - } + FOR_EACH_DEFINED_FUNCTION (node) + { + /* Remember that allocation sites have been handled. */ + tree temp_fn; + + temp_fn = current_function_decl; + current_function_decl = node->symbol.decl; + push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); + bitmap_obstack_initialize (NULL); + gimple_register_cfg_hooks (); + record_all_accesses_in_func (); + htab_traverse (matrices_to_reorg, transform_access_sites, NULL); + cgraph_rebuild_references (); + free_dominance_info (CDI_DOMINATORS); + free_dominance_info (CDI_POST_DOMINATORS); + pop_cfun (); + current_function_decl = temp_fn; + bitmap_obstack_release (NULL); + } htab_traverse (matrices_to_reorg, dump_matrix_reorg_analysis, NULL); current_function_decl = NULL; diff --git a/gcc/passes.c b/gcc/passes.c index 8c58710001b..c012a1290ee 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -703,16 +703,12 @@ dump_passes (void) create_pass_tab(); - n = cgraph_nodes; - while (n) - { - if (DECL_STRUCT_FUNCTION (n->symbol.decl)) - { - node = n; - break; - } - n = n->next; - } + FOR_EACH_DEFINED_FUNCTION (n) + if (DECL_STRUCT_FUNCTION (n->symbol.decl)) + { + node = n; + break; + } if (!node) return; @@ -1662,8 +1658,8 @@ do_per_function (void (*callback) (void *data), void *data) else { struct cgraph_node *node; - for (node = cgraph_nodes; node; node = node->next) - if (node->analyzed && gimple_has_body_p (node->symbol.decl) + FOR_EACH_DEFINED_FUNCTION (node) + if (gimple_has_body_p (node->symbol.decl) && (!node->clone_of || node->symbol.decl != node->clone_of->symbol.decl)) { push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); @@ -2346,7 +2342,7 @@ ipa_write_summaries (void) } vset = varpool_node_set_new (); - for (vnode = varpool_nodes; vnode; vnode = vnode->next) + FOR_EACH_VARIABLE (vnode) if (vnode->needed && (!vnode->alias || vnode->alias_of)) varpool_node_set_add (vset, vnode); diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index 97ec664fd96..97b4b3bbe51 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -4769,7 +4769,7 @@ ipa_tm_execute (void) bitmap_obstack_initialize (&tm_obstack); /* For all local functions marked tm_callable, queue them. */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) if (is_tm_callable (node->symbol.decl) && cgraph_function_body_availability (node) >= AVAIL_OVERWRITABLE) { @@ -4778,7 +4778,7 @@ ipa_tm_execute (void) } /* For all local reachable functions... */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) if (node->reachable && node->lowered && cgraph_function_body_availability (node) >= AVAIL_OVERWRITABLE) { @@ -4946,7 +4946,7 @@ ipa_tm_execute (void) /* Now validate all tm_safe functions, and all atomic regions in other functions. */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) if (node->reachable && node->lowered && cgraph_function_body_availability (node) >= AVAIL_OVERWRITABLE) { @@ -4994,7 +4994,7 @@ ipa_tm_execute (void) ipa_tm_transform_clone (node); } } - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) if (node->reachable && node->lowered && cgraph_function_body_availability (node) >= AVAIL_OVERWRITABLE) { @@ -5008,7 +5008,7 @@ ipa_tm_execute (void) VEC_free (cgraph_node_p, heap, irr_worklist); bitmap_obstack_release (&tm_obstack); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_FUNCTION (node) node->symbol.aux = NULL; #ifdef ENABLE_CHECKING diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c index cd9630f39c7..185d9f7728b 100644 --- a/gcc/tree-emutls.c +++ b/gcc/tree-emutls.c @@ -741,7 +741,7 @@ ipa_lower_emutls (void) tls_vars = varpool_node_set_new (); /* Examine all global variables for TLS variables. */ - for (var = varpool_nodes; var ; var = var->next) + FOR_EACH_VARIABLE (var) if (DECL_THREAD_LOCAL_P (var->symbol.decl)) { gcc_checking_assert (TREE_STATIC (var->symbol.decl) @@ -790,7 +790,7 @@ ipa_lower_emutls (void) } /* Adjust all uses of TLS variables within the function bodies. */ - for (func = cgraph_nodes; func; func = func->next) + FOR_EACH_DEFINED_FUNCTION (func) if (func->reachable && func->lowered) lower_emutls_function_body (func); diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c index 2c1ad8a020f..52d953ceb18 100644 --- a/gcc/tree-profile.c +++ b/gcc/tree-profile.c @@ -479,10 +479,9 @@ tree_profiling (void) init_node_map(); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) { - if (!node->analyzed - || !gimple_has_body_p (node->symbol.decl)) + if (!gimple_has_body_p (node->symbol.decl)) continue; /* Don't profile functions produced for builtin stuff. */ @@ -520,10 +519,9 @@ tree_profiling (void) } /* Drop pure/const flags from instrumented functions. */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) { - if (!node->analyzed - || !gimple_has_body_p (node->symbol.decl) + if (!gimple_has_body_p (node->symbol.decl) || !(!node->clone_of || node->symbol.decl != node->clone_of->symbol.decl)) continue; @@ -538,12 +536,11 @@ tree_profiling (void) } /* Update call statements and rebuild the cgraph. */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) { basic_block bb; - if (!node->analyzed - || !gimple_has_body_p (node->symbol.decl) + if (!gimple_has_body_p (node->symbol.decl) || !(!node->clone_of || node->symbol.decl != node->clone_of->symbol.decl)) continue; diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 8eb440af49e..3601bc37ec5 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -6862,7 +6862,7 @@ ipa_pta_execute (void) } /* Build the constraints. */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) { varinfo_t vi; /* Nodes without a body are not interesting. Especially do not @@ -6879,7 +6879,7 @@ ipa_pta_execute (void) } /* Create constraints for global variables and their initializers. */ - for (var = varpool_nodes; var; var = var->next) + FOR_EACH_VARIABLE (var) { if (var->alias) continue; @@ -6896,7 +6896,7 @@ ipa_pta_execute (void) } from = VEC_length (constraint_t, constraints); - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) { struct function *func; basic_block bb; @@ -7004,7 +7004,7 @@ ipa_pta_execute (void) ipa_escaped_pt.ipa_escaped = 0; /* Assign the points-to sets to the SSA names in the unit. */ - for (node = cgraph_nodes; node; node = node->next) + FOR_EACH_DEFINED_FUNCTION (node) { tree ptr; struct function *fn; diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index 448dd1e26b7..7df31f7c9d2 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -320,9 +320,7 @@ increase_alignment (void) struct varpool_node *vnode; /* Increase the alignment of all global arrays for vectorization. */ - for (vnode = varpool_nodes_queue; - vnode; - vnode = vnode->next_needed) + FOR_EACH_DEFINED_VARIABLE (vnode) { tree vectype, decl = vnode->symbol.decl; tree t; diff --git a/gcc/tree.c b/gcc/tree.c index 97d78dcceb5..fcefaab01a6 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -5176,14 +5176,14 @@ free_lang_data_in_cgraph (void) fld.types = VEC_alloc (tree, heap, 100); /* Find decls and types in the body of every function in the callgraph. */ - for (n = cgraph_nodes; n; n = n->next) + FOR_EACH_FUNCTION (n) find_decls_types_in_node (n, &fld); FOR_EACH_VEC_ELT (alias_pair, alias_pairs, i, p) find_decls_types (p->decl, &fld); /* Find decls and types in every varpool symbol. */ - for (v = varpool_nodes; v; v = v->next) + FOR_EACH_VARIABLE (v) find_decls_types_in_var (v, &fld); /* Set the assembler name on every decl found. We need to do this diff --git a/gcc/value-prof.c b/gcc/value-prof.c index e6c2310ac60..10a5319d3ec 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -1073,7 +1073,7 @@ init_node_map (void) VEC_safe_grow_cleared (cgraph_node_ptr, heap, cgraph_node_map, get_last_funcdef_no ()); - for (n = cgraph_nodes; n; n = n->next) + FOR_EACH_FUNCTION (n) { if (DECL_STRUCT_FUNCTION (n->symbol.decl)) VEC_replace (cgraph_node_ptr, cgraph_node_map, diff --git a/gcc/varpool.c b/gcc/varpool.c index d81aec97e9c..42acc58be60 100644 --- a/gcc/varpool.c +++ b/gcc/varpool.c @@ -254,7 +254,7 @@ dump_varpool (FILE *f) struct varpool_node *node; fprintf (f, "variable pool:\n\n"); - for (node = varpool_nodes; node; node = node->next) + FOR_EACH_VARIABLE (node) dump_varpool_node (f, node); } @@ -272,7 +272,7 @@ varpool_node_for_asm (tree asmname) { struct varpool_node *node; - for (node = varpool_nodes; node ; node = node->next) + FOR_EACH_VARIABLE (node) if (decl_assembler_name_equal (node->symbol.decl, asmname)) return node; @@ -652,7 +652,7 @@ varpool_assemble_pending_decls (void) elsewhere. */ varpool_analyze_pending_decls (); - for (node = varpool_nodes_queue; node; node = node->next_needed) + FOR_EACH_DEFINED_VARIABLE (node) varpool_finalize_named_section_flags (node); while (varpool_nodes_queue) |