diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-16 12:04:17 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-16 12:04:17 +0000 |
commit | 7c455d87c55a2de426f8f1a455f1a97050340dc7 (patch) | |
tree | 011c878ee2a5ec6071bdb8be9c3d3d3fc62db1a9 /gcc/ipa.c | |
parent | 06734da8d7e6f650da5a652c933eb8095f8d6133 (diff) | |
download | gcc-7c455d87c55a2de426f8f1a455f1a97050340dc7.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186492 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa.c')
-rw-r--r-- | gcc/ipa.c | 41 |
1 files changed, 20 insertions, 21 deletions
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); |