aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-utils.h
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-09-24 22:30:21 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2014-09-24 20:30:21 +0000
commita198145843f0b16e59069cb2da55c47a0a9bc2b9 (patch)
treefb085630166aa196f47f51404bc1b7f3f2c51098 /gcc/ipa-utils.h
parentc6195f588b1b8980b07d53394edaaa2cd6807588 (diff)
downloadgcc-a198145843f0b16e59069cb2da55c47a0a9bc2b9.zip
gcc-a198145843f0b16e59069cb2da55c47a0a9bc2b9.tar.gz
gcc-a198145843f0b16e59069cb2da55c47a0a9bc2b9.tar.bz2
ipa-utils.h (polymorphic_call_context): Add metdhos dump, debug and clear_outer_type.
* ipa-utils.h (polymorphic_call_context): Add metdhos dump, debug and clear_outer_type. (ipa_polymorphic_call_context::ipa_polymorphic_call_context): Simplify. (ipa_polymorphic_call_context::clear_outer_type): New method. * ipa-prop.c (ipa_analyze_call_uses): Do not overwrite offset. * ipa-devirt.c (types_odr_comparable): New function. (types_must_be_same_for_odr): New function. (odr_subtypes_equivalent_p): Simplify. (possible_placement_new): Break out from ... (ipa_polymorphic_call_context::restrict_to_inner_type): ... here; be more cuatious about returning false in cases the context may be valid in derived type or via placement new. (contains_type_p): Clear maybe_derived_type (ipa_polymorphic_call_context::dump): New method. (ipa_polymorphic_call_context::debug): New method. (ipa_polymorphic_call_context::set_by_decl): Cleanup comment. (ipa_polymorphic_call_context::set_by_invariant): Simplify. (ipa_polymorphic_call_context::ipa_polymorphic_call_context): Simplify. (possible_polymorphic_call_targets): Trust context.restrict_to_inner_class to suceed on all valid cases; remove confused sanity check. (dump_possible_polymorphic_call_targets): Simplify. From-SVN: r215569
Diffstat (limited to 'gcc/ipa-utils.h')
-rw-r--r--gcc/ipa-utils.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h
index c81232c..409e485 100644
--- a/gcc/ipa-utils.h
+++ b/gcc/ipa-utils.h
@@ -83,9 +83,14 @@ public:
containing EXPECTED_TYPE as base class. */
bool restrict_to_inner_class (tree expected_type);
+ /* Dump human readable context to F. */
+ void dump (FILE *f) const;
+ void DEBUG_FUNCTION debug () const;
+
private:
void set_by_decl (tree, HOST_WIDE_INT);
bool set_by_invariant (tree, tree, HOST_WIDE_INT);
+ void clear_outer_type (tree otr_type = NULL);
};
/* Build polymorphic call context for indirect call E. */
@@ -110,13 +115,8 @@ ipa_polymorphic_call_context::ipa_polymorphic_call_context (cgraph_edge *e)
inline
ipa_polymorphic_call_context::ipa_polymorphic_call_context ()
{
- offset = 0;
- speculative_offset = 0;
- outer_type = NULL;
- speculative_outer_type = NULL;
- maybe_in_construction = true;
- maybe_derived_type = true;
- speculative_maybe_derived_type = false;
+ clear_speculation ();
+ clear_outer_type ();
invalid = false;
}
@@ -130,6 +130,19 @@ ipa_polymorphic_call_context::clear_speculation ()
speculative_maybe_derived_type = false;
}
+/* Produce context specifying all derrived types of OTR_TYPE.
+ If OTR_TYPE is NULL or type of the OBJ_TYPE_REF, the context is set
+ to dummy "I know nothing" setting. */
+
+inline void
+ipa_polymorphic_call_context::clear_outer_type (tree otr_type)
+{
+ outer_type = otr_type ? TYPE_MAIN_VARIANT (otr_type) : NULL;
+ offset = 0;
+ maybe_derived_type = true;
+ maybe_in_construction = true;
+}
+
/* In ipa-utils.c */
void ipa_print_order (FILE*, const char *, struct cgraph_node**, int);
int ipa_reduced_postorder (struct cgraph_node **, bool, bool,