diff options
author | Martin Liska <mliska@suse.cz> | 2014-06-25 18:55:46 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2014-06-25 16:55:46 +0000 |
commit | d122681a3c4491cec5152d5c528005c1f5083e83 (patch) | |
tree | b3a5f8f8784d867b1c0b7b15ee92950397c414aa /gcc/cgraph.c | |
parent | 81d0a226820c32b487bbb855e9873684f51400f8 (diff) | |
download | gcc-d122681a3c4491cec5152d5c528005c1f5083e83.zip gcc-d122681a3c4491cec5152d5c528005c1f5083e83.tar.gz gcc-d122681a3c4491cec5152d5c528005c1f5083e83.tar.bz2 |
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.
From-SVN: r211987
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index afd41b7..7360f77 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1101,7 +1101,7 @@ cgraph_turn_edge_to_speculative (struct cgraph_edge *e, int direct_frequency) { struct cgraph_node *n = e->caller; - struct ipa_ref *ref; + struct ipa_ref *ref = NULL; struct cgraph_edge *e2; if (dump_file) @@ -1123,8 +1123,7 @@ cgraph_turn_edge_to_speculative (struct cgraph_edge *e, e->count -= e2->count; e->frequency -= e2->frequency; cgraph_call_edge_duplication_hooks (e, e2); - ref = ipa_record_reference (n, n2, - IPA_REF_ADDR, e->call_stmt); + ref = n->add_reference (n2, IPA_REF_ADDR, e->call_stmt); ref->lto_stmt_uid = e->lto_stmt_uid; ref->speculative = e->speculative; cgraph_mark_address_taken_node (n2); @@ -1177,8 +1176,7 @@ cgraph_speculative_call_info (struct cgraph_edge *e, indirect = e2; reference = NULL; - for (i = 0; ipa_ref_list_reference_iterate (&e->caller->ref_list, - i, ref); i++) + for (i = 0; e->caller->iterate_reference (i, ref); i++) if (ref->speculative && ((ref->stmt && ref->stmt == e->call_stmt) || (!ref->stmt && ref->lto_stmt_uid == e->lto_stmt_uid))) @@ -1257,7 +1255,7 @@ cgraph_resolve_speculation (struct cgraph_edge *edge, tree callee_decl) edge->frequency = CGRAPH_FREQ_MAX; edge->speculative = false; e2->speculative = false; - ipa_remove_reference (ref); + ref->remove_reference (); if (e2->indirect_unknown_callee || e2->inline_failed) cgraph_remove_edge (e2); else @@ -2197,7 +2195,7 @@ cgraph_for_node_thunks_and_aliases (struct cgraph_node *node, { struct cgraph_edge *e; int i; - struct ipa_ref *ref; + struct ipa_ref *ref = NULL; if (callback (node, data)) return true; @@ -2208,10 +2206,10 @@ cgraph_for_node_thunks_and_aliases (struct cgraph_node *node, if (cgraph_for_node_thunks_and_aliases (e->caller, callback, data, include_overwritable)) return true; - for (i = 0; ipa_ref_list_referring_iterate (&node->ref_list, i, ref); i++) + for (i = 0; node->iterate_referring (i, ref); i++) if (ref->use == IPA_REF_ALIAS) { - struct cgraph_node *alias = ipa_ref_referring_node (ref); + struct cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring); if (include_overwritable || cgraph_function_body_availability (alias) > AVAIL_OVERWRITABLE) if (cgraph_for_node_thunks_and_aliases (alias, callback, data, @@ -2232,14 +2230,14 @@ cgraph_for_node_and_aliases (struct cgraph_node *node, bool include_overwritable) { int i; - struct ipa_ref *ref; + struct ipa_ref *ref = NULL; if (callback (node, data)) return true; - for (i = 0; ipa_ref_list_referring_iterate (&node->ref_list, i, ref); i++) + for (i = 0; node->iterate_referring (i, ref); i++) if (ref->use == IPA_REF_ALIAS) { - struct cgraph_node *alias = ipa_ref_referring_node (ref); + struct cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring); if (include_overwritable || cgraph_function_body_availability (alias) > AVAIL_OVERWRITABLE) if (cgraph_for_node_and_aliases (alias, callback, data, @@ -2843,15 +2841,14 @@ verify_cgraph_node (struct cgraph_node *node) { bool ref_found = false; int i; - struct ipa_ref *ref; + struct ipa_ref *ref = NULL; if (node->callees) { error ("Alias has call edges"); error_found = true; } - for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, - i, ref); i++) + for (i = 0; node->iterate_reference (i, ref); i++) if (ref->use != IPA_REF_ALIAS) { error ("Alias has non-alias reference"); @@ -2897,7 +2894,7 @@ verify_cgraph_node (struct cgraph_node *node) { pointer_set_t *stmts = pointer_set_create (); int i; - struct ipa_ref *ref; + struct ipa_ref *ref = NULL; /* Reach the trees by walking over the CFG, and note the enclosing basic-blocks in the call edges. */ @@ -2955,8 +2952,7 @@ verify_cgraph_node (struct cgraph_node *node) } } for (i = 0; - ipa_ref_list_reference_iterate (&node->ref_list, i, ref); - i++) + node->iterate_reference (i, ref); i++) if (ref->stmt && !pointer_set_contains (stmts, ref->stmt)) { error ("reference to dead statement"); |