From 65c70e6b0311be59bddaba52ab10d837b61ea574 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 16 Apr 2012 14:04:17 +0200 Subject: cgraph.h (FOR_EACH_VARIABLE, [...]): New macros. * 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. * decl2.c (collect_candidates_for_java_method_alias): Use FOR_EACH walkers to walk cgraph and varpool. * 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. From-SVN: r186492 --- gcc/lto/ChangeLog | 9 +++++++++ gcc/lto/lto-partition.c | 18 +++++++++--------- gcc/lto/lto.c | 21 +++++++++------------ 3 files changed, 27 insertions(+), 21 deletions(-) (limited to 'gcc/lto') diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 4ff0882..bab0a77 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,12 @@ +2012-04-16 Jan Hubicka + + * 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 * 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 af36b14..1e60462 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 0b48ce1..fb374ff 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) { -- cgit v1.1