diff options
Diffstat (limited to 'gcc/ipa-utils.h')
-rw-r--r-- | gcc/ipa-utils.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h index bb2e0d50d6b..12543048289 100644 --- a/gcc/ipa-utils.h +++ b/gcc/ipa-utils.h @@ -38,13 +38,19 @@ struct ipa_dfs_info { type inheritance graph. */ struct ipa_polymorphic_call_context { /* The called object appears in an object of type OUTER_TYPE - at offset OFFSET. */ + at offset OFFSET. When information is not 100% reliable, we + use SPECULATIVE_OUTER_TYPE and SPECULATIVE_OFFSET. */ HOST_WIDE_INT offset; + HOST_WIDE_INT speculative_offset; tree outer_type; + tree speculative_outer_type; /* True if outer object may be in construction or destruction. */ bool maybe_in_construction; /* True if outer object may be of derived type. */ bool maybe_derived_type; + /* True if speculative outer object may be of derived type. We always + speculate that construction does not happen. */ + bool speculative_maybe_derived_type; }; /* Context representing "I know nothing". */ @@ -89,6 +95,7 @@ tree get_polymorphic_call_info (tree, tree, tree *, HOST_WIDE_INT *, ipa_polymorphic_call_context *, gimple call = NULL); +bool get_dynamic_type (tree, ipa_polymorphic_call_context *, tree, gimple); bool get_polymorphic_call_info_from_invariant (ipa_polymorphic_call_context *, tree, tree, HOST_WIDE_INT); bool decl_maybe_in_construction_p (tree, tree, gimple, tree); @@ -114,9 +121,12 @@ possible_polymorphic_call_targets (struct cgraph_edge *e, { gcc_checking_assert (e->indirect_info->polymorphic); ipa_polymorphic_call_context context = {e->indirect_info->offset, + e->indirect_info->speculative_offset, e->indirect_info->outer_type, + e->indirect_info->speculative_outer_type, e->indirect_info->maybe_in_construction, - e->indirect_info->maybe_derived_type}; + e->indirect_info->maybe_derived_type, + e->indirect_info->speculative_maybe_derived_type}; return possible_polymorphic_call_targets (e->indirect_info->otr_type, e->indirect_info->otr_token, context, @@ -153,9 +163,12 @@ dump_possible_polymorphic_call_targets (FILE *f, struct cgraph_edge *e) { gcc_checking_assert (e->indirect_info->polymorphic); ipa_polymorphic_call_context context = {e->indirect_info->offset, + e->indirect_info->speculative_offset, e->indirect_info->outer_type, + e->indirect_info->speculative_outer_type, e->indirect_info->maybe_in_construction, - e->indirect_info->maybe_derived_type}; + e->indirect_info->maybe_derived_type, + e->indirect_info->speculative_maybe_derived_type}; dump_possible_polymorphic_call_targets (f, e->indirect_info->otr_type, e->indirect_info->otr_token, context); @@ -168,10 +181,11 @@ inline bool possible_polymorphic_call_target_p (struct cgraph_edge *e, struct cgraph_node *n) { - ipa_polymorphic_call_context context = {e->indirect_info->offset, - e->indirect_info->outer_type, + ipa_polymorphic_call_context context = {e->indirect_info->offset, 0, + e->indirect_info->outer_type, NULL, e->indirect_info->maybe_in_construction, - e->indirect_info->maybe_derived_type}; + e->indirect_info->maybe_derived_type, + false}; return possible_polymorphic_call_target_p (e->indirect_info->otr_type, e->indirect_info->otr_token, context, n); |