diff options
Diffstat (limited to 'gcc/lto')
-rw-r--r-- | gcc/lto/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/lto/lto-partition.c | 18 | ||||
-rw-r--r-- | gcc/lto/lto.c | 21 |
3 files changed, 27 insertions, 21 deletions
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 <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 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) { |