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/lto-cgraph.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/lto-cgraph.c')
-rw-r--r-- | gcc/lto-cgraph.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index ffc62473d1c..af480bcaea2 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -315,14 +315,15 @@ lto_output_edge (struct lto_simple_output_block *ob, struct cgraph_edge *edge, } } -/* Return if LIST contain references from other partitions. */ +/* Return if NODE contain references from other partitions. */ bool -referenced_from_other_partition_p (struct ipa_ref_list *list, lto_symtab_encoder_t encoder) +referenced_from_other_partition_p (symtab_node *node, lto_symtab_encoder_t encoder) { int i; - struct ipa_ref *ref; - for (i = 0; ipa_ref_list_referring_iterate (list, i, ref); i++) + struct ipa_ref *ref = NULL; + + for (i = 0; node->iterate_referring (i, ref); i++) { if (ref->referring->in_other_partition || !lto_symtab_encoder_in_partition_p (encoder, ref->referring)) @@ -348,15 +349,16 @@ reachable_from_other_partition_p (struct cgraph_node *node, lto_symtab_encoder_t return false; } -/* Return if LIST contain references from other partitions. */ +/* Return if NODE contain references from other partitions. */ bool -referenced_from_this_partition_p (struct ipa_ref_list *list, +referenced_from_this_partition_p (symtab_node *node, lto_symtab_encoder_t encoder) { int i; - struct ipa_ref *ref; - for (i = 0; ipa_ref_list_referring_iterate (list, i, ref); i++) + struct ipa_ref *ref = NULL; + + for (i = 0; node->iterate_referring (i, ref); i++) if (lto_symtab_encoder_in_partition_p (encoder, ref->referring)) return true; return false; @@ -523,8 +525,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node, bp_pack_value (&bp, tag == LTO_symtab_analyzed_node && symtab_get_symbol_partitioning_class (node) == SYMBOL_PARTITION && (reachable_from_other_partition_p (node, encoder) - || referenced_from_other_partition_p (&node->ref_list, - encoder)), 1); + || referenced_from_other_partition_p (node, encoder)), 1); bp_pack_value (&bp, node->lowered, 1); bp_pack_value (&bp, in_other_partition, 1); /* Real aliases in a boundary become non-aliases. However we still stream @@ -607,8 +608,7 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node, else { bp_pack_value (&bp, node->definition - && referenced_from_other_partition_p (&node->ref_list, - encoder), 1); + && referenced_from_other_partition_p (node, encoder), 1); bp_pack_value (&bp, node->analyzed && boundary_p && !DECL_EXTERNAL (node->decl), 1); /* in_other_partition. */ @@ -760,14 +760,13 @@ output_refs (lto_symtab_encoder_t encoder) { symtab_node *node = lsei_node (lsei); - count = ipa_ref_list_nreferences (&node->ref_list); + count = node->ref_list.nreferences (); if (count) { streamer_write_gcov_count_stream (ob->main_stream, count); streamer_write_uhwi_stream (ob->main_stream, lto_symtab_encoder_lookup (encoder, node)); - for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, - i, ref); i++) + for (i = 0; node->iterate_reference (i, ref); i++) lto_output_ref (ob, ref, encoder); } } @@ -791,17 +790,16 @@ add_node_to (lto_symtab_encoder_t encoder, struct cgraph_node *node, lto_symtab_encoder_encode (encoder, node); } -/* Add all references in LIST to encoders. */ +/* Add all references in NODE to encoders. */ static void -add_references (lto_symtab_encoder_t encoder, - struct ipa_ref_list *list) +add_references (lto_symtab_encoder_t encoder, symtab_node *node) { int i; - struct ipa_ref *ref; - for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++) + struct ipa_ref *ref = NULL; + for (i = 0; node->iterate_reference (i, ref); i++) if (is_a <cgraph_node *> (ref->referred)) - add_node_to (encoder, ipa_ref_node (ref), false); + add_node_to (encoder, dyn_cast <cgraph_node *> (ref->referred), false); else lto_symtab_encoder_encode (encoder, ref->referred); } @@ -834,7 +832,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder) struct cgraph_node *node = lsei_cgraph_node (lsei); add_node_to (encoder, node, true); lto_set_symtab_encoder_in_partition (encoder, node); - add_references (encoder, &node->ref_list); + add_references (encoder, node); /* For proper debug info, we need to ship the origins, too. */ if (DECL_ABSTRACT_ORIGIN (node->decl)) { @@ -850,7 +848,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder) lto_set_symtab_encoder_in_partition (encoder, vnode); lto_set_symtab_encoder_encode_initializer (encoder, vnode); - add_references (encoder, &vnode->ref_list); + add_references (encoder, vnode); /* For proper debug info, we need to ship the origins, too. */ if (DECL_ABSTRACT_ORIGIN (vnode->decl)) { @@ -872,7 +870,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder) && ctor_for_folding (vnode->decl) != error_mark_node) { lto_set_symtab_encoder_encode_initializer (encoder, vnode); - add_references (encoder, &vnode->ref_list); + add_references (encoder, vnode); } } } @@ -1317,7 +1315,7 @@ input_ref (struct lto_input_block *ib, use = (enum ipa_ref_use) bp_unpack_value (&bp, 2); speculative = (enum ipa_ref_use) bp_unpack_value (&bp, 1); node = nodes[streamer_read_hwi (ib)]; - ref = ipa_record_reference (referring_node, node, use, NULL); + ref = referring_node->add_reference (node, use); ref->speculative = speculative; if (is_a <cgraph_node *> (referring_node)) ref->lto_stmt_uid = streamer_read_hwi (ib); |