aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.h
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2014-06-25 18:55:46 +0200
committerMartin Liska <marxin@gcc.gnu.org>2014-06-25 16:55:46 +0000
commitd122681a3c4491cec5152d5c528005c1f5083e83 (patch)
treeb3a5f8f8784d867b1c0b7b15ee92950397c414aa /gcc/cgraph.h
parent81d0a226820c32b487bbb855e9873684f51400f8 (diff)
downloadgcc-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.h')
-rw-r--r--gcc/cgraph.h72
1 files changed, 67 insertions, 5 deletions
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index ce6b9e6..0761e26 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -189,6 +189,71 @@ public:
return x_section->name;
}
+ /* Return ipa reference from this symtab_node to
+ REFERED_NODE or REFERED_VARPOOL_NODE. USE_TYPE specify type
+ of the use and STMT the statement (if it exists). */
+ struct ipa_ref *add_reference (symtab_node *referred_node,
+ enum ipa_ref_use use_type);
+
+ /* Return ipa reference from this symtab_node to
+ REFERED_NODE or REFERED_VARPOOL_NODE. USE_TYPE specify type
+ of the use and STMT the statement (if it exists). */
+ struct ipa_ref *add_reference (symtab_node *referred_node,
+ enum ipa_ref_use use_type, gimple stmt);
+
+ /* If VAL is a reference to a function or a variable, add a reference from
+ this symtab_node to the corresponding symbol table node. USE_TYPE specify
+ type of the use and STMT the statement (if it exists). Return the new
+ reference or NULL if none was created. */
+ struct ipa_ref *maybe_add_reference (tree val, enum ipa_ref_use use_type,
+ gimple stmt);
+
+ /* Clone all references from symtab NODE to this symtab_node. */
+ void clone_references (symtab_node *node);
+
+ /* Remove all stmt references in non-speculative references.
+ Those are not maintained during inlining & clonning.
+ The exception are speculative references that are updated along
+ with callgraph edges associated with them. */
+ void clone_referring (symtab_node *node);
+
+ /* Clone reference REF to this symtab_node and set its stmt to STMT. */
+ struct ipa_ref *clone_reference (struct ipa_ref *ref, gimple stmt);
+
+ /* Find the structure describing a reference to REFERRED_NODE
+ and associated with statement STMT. */
+ struct ipa_ref *find_reference (symtab_node *, gimple, unsigned int);
+
+ /* Remove all references that are associated with statement STMT. */
+ void remove_stmt_references (gimple stmt);
+
+ /* Remove all stmt references in non-speculative references.
+ Those are not maintained during inlining & clonning.
+ The exception are speculative references that are updated along
+ with callgraph edges associated with them. */
+ void clear_stmts_in_references (void);
+
+ /* Remove all references in ref list. */
+ void remove_all_references (void);
+
+ /* Remove all referring items in ref list. */
+ void remove_all_referring (void);
+
+ /* Dump references in ref list to FILE. */
+ void dump_references (FILE *file);
+
+ /* Dump referring in list to FILE. */
+ void dump_referring (FILE *);
+
+ /* Return true if list contains an alias. */
+ bool has_aliases_p (void);
+
+ /* Iterates I-th reference in the list, REF is also set. */
+ struct ipa_ref *iterate_reference (unsigned i, struct ipa_ref *&ref);
+
+ /* Iterates I-th referring item in the list, REF is also set. */
+ struct ipa_ref *iterate_referring (unsigned i, struct ipa_ref *&ref);
+
/* Vectors of referring and referenced entities. */
struct ipa_ref_list ref_list;
@@ -1537,16 +1602,13 @@ varpool_all_refs_explicit_p (varpool_node *vnode)
/* Constant pool accessor function. */
htab_t constant_pool_htab (void);
-/* FIXME: inappropriate dependency of cgraph on IPA. */
-#include "ipa-ref-inline.h"
-
/* Return node that alias N is aliasing. */
static inline symtab_node *
symtab_alias_target (symtab_node *n)
{
- struct ipa_ref *ref;
- ipa_ref_list_reference_iterate (&n->ref_list, 0, ref);
+ struct ipa_ref *ref = NULL;
+ n->iterate_reference (0, ref);
gcc_checking_assert (ref->use == IPA_REF_ALIAS);
return ref->referred;
}