Commit a1981458 by Jan Hubicka Committed by Jan Hubicka

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
parent c6195f58
2014-09-24 Jan Hubicka <hubicka@ucw.cz>
* 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.
2014-09-24 Aldy Hernandez <aldyh@redhat.com>
* cgraph.h, dbxout.c, dwarfout2.c, gimple-fold.c,
......@@ -2357,7 +2357,8 @@ ipa_analyze_call_uses (struct func_body_info *fbi, gimple call)
if (context.get_dynamic_type (instance,
OBJ_TYPE_REF_OBJECT (target),
otr_type, call))
otr_type, call)
&& context.offset == cs->indirect_info->offset)
{
gcc_assert (TREE_CODE (otr_type) == RECORD_TYPE);
cs->indirect_info->polymorphic = true;
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment