aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-utils.h
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2013-08-19 12:14:06 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2013-08-19 10:14:06 +0000
commiteefe9a995ceec7fc5ca79505e96bda214e6bd82c (patch)
tree6500dfce0eb1776cd3cf03771e785f6de3bc1607 /gcc/ipa-utils.h
parent5eb5ec2f3034a1c62262914b090f64a5d5f0bc86 (diff)
downloadgcc-eefe9a995ceec7fc5ca79505e96bda214e6bd82c.zip
gcc-eefe9a995ceec7fc5ca79505e96bda214e6bd82c.tar.gz
gcc-eefe9a995ceec7fc5ca79505e96bda214e6bd82c.tar.bz2
Makeifle-in (ipa-devirt.o): New.
* Makeifle-in (ipa-devirt.o): New. (GTFILES): Add ipa-utils.h and ipa-devirt.c * cgraphunit.c (decide_is_symbol_needed): Do not care about virtuals. (analyze_functions): Look into possible targets of polymorphic call. * dumpfile.c (dump_files): Add type-inheritance dump. * dumpfile.h (TDI_inheritance): New. * ipa-devirt.c: New file. * ipa-utils.h (odr_type_d): Forward declare. (odr_type): New type. (build_type_inheritance_graph): Declare. (possible_polymorphic_call_targets): Declare and introduce inline variant when only edge is pased. (dump_possible_polymorphic_call_targets): Likewise. * timevar.def (TV_IPA_INHERITANCE, TV_IPA_VIRTUAL_CALL): New. * tree.c (type_in_anonymous_namespace_p): Break out from ... (types_same_for_odr): ... here. * tree.h (type_in_anonymous_namespace_p): Declare. * g++.dg/ipa/type-inheritance-1.C: New testcase. From-SVN: r201836
Diffstat (limited to 'gcc/ipa-utils.h')
-rw-r--r--gcc/ipa-utils.h42
1 files changed, 41 insertions, 1 deletions
diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h
index f388598..f35ddb5 100644
--- a/gcc/ipa-utils.h
+++ b/gcc/ipa-utils.h
@@ -36,7 +36,6 @@ struct ipa_dfs_info {
};
-
/* In ipa-utils.c */
void ipa_print_order (FILE*, const char *, struct cgraph_node**, int);
int ipa_reduced_postorder (struct cgraph_node **, bool, bool,
@@ -46,7 +45,48 @@ vec<cgraph_node_ptr> ipa_get_nodes_in_cycle (struct cgraph_node *);
int ipa_reverse_postorder (struct cgraph_node **);
tree get_base_var (tree);
+/* In ipa-devirt.c */
+
+struct odr_type_d;
+typedef odr_type_d *odr_type;
+void build_type_inheritance_graph (void);
+vec <cgraph_node *>
+possible_polymorphic_call_targets (tree, HOST_WIDE_INT,
+ bool *final = NULL,
+ void **cache_token = NULL);
+odr_type get_odr_type (tree, bool insert = false);
+void dump_possible_polymorphic_call_targets (FILE *, tree, HOST_WIDE_INT);
+
+/* Return vector containing possible targets of polymorphic call E.
+ If FINALP is non-NULL, store true if the list is complette.
+ CACHE_TOKEN (if non-NULL) will get stored to an unique ID of entry
+ in the target cache. If user needs to visit every target list
+ just once, it can memoize them.
+
+ Returned vector is placed into cache. It is NOT caller's responsibility
+ to free it. The vector can be freed on cgraph_remove_node call if
+ the particular node is a virtual function present in the cache. */
+
+inline vec <cgraph_node *>
+possible_polymorphic_call_targets (struct cgraph_edge *e,
+ bool *final = NULL,
+ void **cache_token = NULL)
+{
+ gcc_checking_assert (e->indirect_info->polymorphic);
+ return possible_polymorphic_call_targets (e->indirect_info->otr_type,
+ e->indirect_info->otr_token,
+ final, cache_token);
+}
+
+/* Dump possible targets of a polymorphic call E into F. */
+inline void
+dump_possible_polymorphic_call_targets (FILE *f, struct cgraph_edge *e)
+{
+ gcc_checking_assert (e->indirect_info->polymorphic);
+ dump_possible_polymorphic_call_targets (f, e->indirect_info->otr_type,
+ e->indirect_info->otr_token);
+}
#endif /* GCC_IPA_UTILS_H */