diff options
author | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-25 16:55:46 +0000 |
---|---|---|
committer | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-25 16:55:46 +0000 |
commit | 51ce56522e8bd1777558279bf6857bb23e4598c7 (patch) | |
tree | b3a5f8f8784d867b1c0b7b15ee92950397c414aa /gcc/cgraphbuild.c | |
parent | 83751f2c56d463b497b1f75fce4bfd5a9739d59c (diff) | |
download | gcc-51ce56522e8bd1777558279bf6857bb23e4598c7.tar.gz |
IPA REF refactoring
* Makefile.in: Removed header file (ipa-ref-inline.h).
* cgraph.c (cgraph_turn_edge_to_speculative): New IPA REF function
called.
(cgraph_speculative_call_info): Likewise.
(cgraph_for_node_thunks_and_aliases): Likewise.
(cgraph_for_node_and_aliases): Likewise.
(verify_cgraph_node): Likewise.
* cgraph.h: Batch of IPA REF functions become member functions of
symtab_node: add_reference, maybe_add_reference, clone_references,
clone_referring, clone_reference, find_reference,
remove_stmt_references, remove_all_references,
remove_all_referring, dump_references, dump_referring,
has_alias_p, iterate_reference, iterate_referring.
* cgraphbuild.c (record_reference): New IPA REF function used.
(record_type_list): Likewise.
(record_eh_tables): Likewise.
(mark_address): Likewise.
(mark_load): Likewise.
(mark_store): Likewise.
(pass_build_cgraph_edges): Likewise.
(rebuild_cgraph_edge): Likewise.
(cgraph_rebuild_references): Likewise.
(pass_remove_cgraph_callee_edges): Likewise.
* cgraphclones.c (cgraph_clone_node): Likewise.
(cgraph_create_virtual_clone): Likewise.
(cgraph_materialize_clone): Likewise.
(cgraph_materialize_all_clones): Likewise.
* cgraphunit.c (cgraph_reset_node): Likewise.
(cgraph_reset_node): Likewise.
(analyze_function): Likewise.
(assemble_thunks_and_aliases): Likewise.
(expand_function): Likewise.
* ipa-comdats.c (propagate_comdat_group): Likewise.
(enqueue_references): Likewise.
* ipa-cp.c (ipcp_discover_new_direct_edges): Likewise.
(create_specialized_node): Likewise.
* ipa-devirt.c (referenced_from_vtable_p): Likewise.
* ipa-inline-transform.c (can_remove_node_now_p_1): Likewise.
* ipa-inline.c (reset_edge_caches): Likewise.
(update_caller_keys): Likewise.
(execute): Likewise.
* ipa-prop.c (remove_described_reference): Likewise.
(propagate_controlled_uses): Likewise.
(ipa_edge_duplication_hook): Likewise.
(ipa_modify_call_arguments): Likewise.
* ipa-pure-const.c (propagate_pure_const): Likewise.
* ipa-ref-inline.h: Header file removed, functions moved
to symtab_node class.
* ipa-ref.c (remove_reference): New class member function.
(cannot_lead_to_return): New class member function.
(referring_ref_list): Likewise.
(referred_ref_list): Likewise.
Rest of functions moved to symtab_node class.
* ipa-ref.h: New member functions remove_reference,
cannot_lead_to_return, referring_ref_list, referred_ref_list added
to ipa_ref class.
ipa_ref_list class has new member functions: first_reference,
first_referring, clear, nreferences.
* ipa-reference.c (analyze_function): New IPA REF function used.
(write_node_summary_p): Likewise.
(ipa_reference_write_optimization_summary): Likewise.
* ipa-split.c (split_function): Likewise.
* ipa-utils.c (ipa_reverse_postorder): Likewise.
* ipa-visibility.c (cgraph_non_local_node_p_1): Likewise.
(function_and_variable_visibility): Likewise.
* ipa.c (has_addr_references_p): Likewise.
(process_references): Argument type changed.
(symtab_remove_unreachable_nodes): New IPA REF function used.
(process_references): Likewise.
(set_writeonly_bit): Likewise.
* lto-cgraph.c: Implementation of new symtab_node member functions
that uses new IPA REF functions.
* lto-streamer-in.c (fixup_call_stmt_edges_1): New IPA REF function used.
* lto-streamer-out.c (output_symbol_p): Likewise.
* lto-streamer.h (referenced_from_this_partition_p): Argument type
changed.
* lto/lto-partition.c (add_references_to_partition): New IPA REF function
used.
(add_symbol_to_partition_1): Likewise.
(lto_balanced_map): Likewise.
* lto/lto-symtab.c (lto_cgraph_replace_node): Likewise.
* symtab.c: Implementation of new IPA REF API.
* trans-mem.c (ipa_tm_create_version_alias): New IPA REF function used.
(ipa_tm_create_version): Likewise.
(ipa_tm_execute): Likewise.
* tree-emutls.c (gen_emutls_addr): Likewise.
* tree-inline.c (copy_bb): Likewise.
(delete_unreachable_blocks_update_callgraph): Likewise.
* varpool.c (varpool_remove_unreferenced_decls): Likewise.
(varpool_for_node_and_aliases): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211987 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphbuild.c')
-rw-r--r-- | gcc/cgraphbuild.c | 59 |
1 files changed, 20 insertions, 39 deletions
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index 6bdc8ca0eda..bfc4495ca19 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -82,17 +82,13 @@ record_reference (tree *tp, int *walk_subtrees, void *data) struct cgraph_node *node = cgraph_get_create_node (decl); if (!ctx->only_vars) cgraph_mark_address_taken_node (node); - ipa_record_reference (ctx->varpool_node, - node, - IPA_REF_ADDR, NULL); + ctx->varpool_node->add_reference (node, IPA_REF_ADDR); } if (TREE_CODE (decl) == VAR_DECL) { varpool_node *vnode = varpool_node_for_decl (decl); - ipa_record_reference (ctx->varpool_node, - vnode, - IPA_REF_ADDR, NULL); + ctx->varpool_node->add_reference (vnode, IPA_REF_ADDR); } *walk_subtrees = 0; break; @@ -129,9 +125,7 @@ record_type_list (struct cgraph_node *node, tree list) if (TREE_CODE (type) == VAR_DECL) { varpool_node *vnode = varpool_node_for_decl (type); - ipa_record_reference (node, - vnode, - IPA_REF_ADDR, NULL); + node->add_reference (vnode, IPA_REF_ADDR); } } } @@ -150,7 +144,7 @@ record_eh_tables (struct cgraph_node *node, struct function *fun) tree per_decl = DECL_FUNCTION_PERSONALITY (node->decl); struct cgraph_node *per_node = cgraph_get_create_node (per_decl); - ipa_record_reference (node, per_node, IPA_REF_ADDR, NULL); + node->add_reference (per_node, IPA_REF_ADDR); cgraph_mark_address_taken_node (per_node); } @@ -231,18 +225,14 @@ mark_address (gimple stmt, tree addr, tree, void *data) { struct cgraph_node *node = cgraph_get_create_node (addr); cgraph_mark_address_taken_node (node); - ipa_record_reference ((symtab_node *)data, - node, - IPA_REF_ADDR, stmt); + ((symtab_node *)data)->add_reference (node, IPA_REF_ADDR, stmt); } else if (addr && TREE_CODE (addr) == VAR_DECL && (TREE_STATIC (addr) || DECL_EXTERNAL (addr))) { varpool_node *vnode = varpool_node_for_decl (addr); - ipa_record_reference ((symtab_node *)data, - vnode, - IPA_REF_ADDR, stmt); + ((symtab_node *)data)->add_reference (vnode, IPA_REF_ADDR, stmt); } return false; @@ -260,18 +250,14 @@ mark_load (gimple stmt, tree t, tree, void *data) directly manipulated in the code. Pretend that it's an address. */ struct cgraph_node *node = cgraph_get_create_node (t); cgraph_mark_address_taken_node (node); - ipa_record_reference ((symtab_node *)data, - node, - IPA_REF_ADDR, stmt); + ((symtab_node *)data)->add_reference (node, IPA_REF_ADDR, stmt); } else if (t && TREE_CODE (t) == VAR_DECL && (TREE_STATIC (t) || DECL_EXTERNAL (t))) { varpool_node *vnode = varpool_node_for_decl (t); - ipa_record_reference ((symtab_node *)data, - vnode, - IPA_REF_LOAD, stmt); + ((symtab_node *)data)->add_reference (vnode, IPA_REF_LOAD, stmt); } return false; } @@ -287,9 +273,7 @@ mark_store (gimple stmt, tree t, tree, void *data) { varpool_node *vnode = varpool_node_for_decl (t); - ipa_record_reference ((symtab_node *)data, - vnode, - IPA_REF_STORE, stmt); + ((symtab_node *)data)->add_reference (vnode, IPA_REF_STORE, stmt); } return false; } @@ -375,22 +359,19 @@ pass_build_cgraph_edges::execute (function *fun) && gimple_omp_parallel_child_fn (stmt)) { tree fn = gimple_omp_parallel_child_fn (stmt); - ipa_record_reference (node, - cgraph_get_create_node (fn), - IPA_REF_ADDR, stmt); + node->add_reference (cgraph_get_create_node (fn), + IPA_REF_ADDR, stmt); } if (gimple_code (stmt) == GIMPLE_OMP_TASK) { tree fn = gimple_omp_task_child_fn (stmt); if (fn) - ipa_record_reference (node, - cgraph_get_create_node (fn), - IPA_REF_ADDR, stmt); + node->add_reference (cgraph_get_create_node (fn), + IPA_REF_ADDR, stmt); fn = gimple_omp_task_copy_fn (stmt); if (fn) - ipa_record_reference (node, - cgraph_get_create_node (fn), - IPA_REF_ADDR, stmt); + node->add_reference (cgraph_get_create_node (fn), + IPA_REF_ADDR, stmt); } } for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) @@ -446,7 +427,7 @@ rebuild_cgraph_edges (void) gimple_stmt_iterator gsi; cgraph_node_remove_callees (node); - ipa_remove_all_references (&node->ref_list); + node->remove_all_references (); node->count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count; @@ -492,13 +473,13 @@ cgraph_rebuild_references (void) basic_block bb; struct cgraph_node *node = cgraph_get_node (current_function_decl); gimple_stmt_iterator gsi; - struct ipa_ref *ref; + struct ipa_ref *ref = NULL; int i; /* Keep speculative references for further cgraph edge expansion. */ - for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, i, ref);) + for (i = 0; node->iterate_reference (i, ref);) if (!ref->speculative) - ipa_remove_reference (ref); + ref->remove_reference (); else i++; @@ -588,7 +569,7 @@ pass_remove_cgraph_callee_edges::execute (function *) { struct cgraph_node *node = cgraph_get_node (current_function_decl); cgraph_node_remove_callees (node); - ipa_remove_all_references (&node->ref_list); + node->remove_all_references (); return 0; } |