Commit 67a1b94c by Jan Hubicka Committed by Jan Hubicka

* ipa-polymorphic-call.c

	(ipa_polymorphic_call_context::restrict_to_inner_class):
	Rename EXPECTED_TYPE to OTR_TYPE; Validate speculation late;
	use speculation_consistent_p to do so; Add CONSDER_BASES
	and CONSIDER_PLACEMENT_NEW parameters.
	(contains_type_p): Add CONSDER_PLACEMENT_NEW and CONSIDER_BASES;
	short circuit obvious cases.
	(ipa_polymorphic_call_context::dump): Improve formatting.
	(ipa_polymorphic_call_context::ipa_polymorphic_call_context): Use
	combine_speculation_with to record speculations; Do not ICE when
	object is located in pointer type decl; do not ICE for methods
	of UNION_TYPE; do not record nonpolymorphic types.
	(ipa_polymorphic_call_context::speculation_consistent_p): New method.
	(ipa_polymorphic_call_context::combine_speculation_with): New method.
	(ipa_polymorphic_call_context::combine_with): New method.
	(ipa_polymorphic_call_context::make_speculative): Move here; use
	combine speculation.
	* cgraph.h (ipa_polymorphic_call_context): Update
	restrict_to_inner_class prototype; add offset_by, make_speculative, 
	combine_with, useless_p, combine_speculation_with and
	speculation_consistent_p methods.
	(ipa_polymorphic_call_context::offset_by): New method.
	(ipa_polymorphic_call_context::useless_p): New method.

From-SVN: r215790
parent fef32cf8
2014-10-01 Jan HUbicka <hubicka@ucw.cz>
* ipa-polymorphic-call.c
(ipa_polymorphic_call_context::restrict_to_inner_class):
Rename EXPECTED_TYPE to OTR_TYPE; Validate speculation late;
use speculation_consistent_p to do so; Add CONSDER_BASES
and CONSIDER_PLACEMENT_NEW parameters.
(contains_type_p): Add CONSDER_PLACEMENT_NEW and CONSIDER_BASES;
short circuit obvious cases.
(ipa_polymorphic_call_context::dump): Improve formatting.
(ipa_polymorphic_call_context::ipa_polymorphic_call_context): Use
combine_speculation_with to record speculations; Do not ICE when
object is located in pointer type decl; do not ICE for methods
of UNION_TYPE; do not record nonpolymorphic types.
(ipa_polymorphic_call_context::speculation_consistent_p): New method.
(ipa_polymorphic_call_context::combine_speculation_with): New method.
(ipa_polymorphic_call_context::combine_with): New method.
(ipa_polymorphic_call_context::make_speculative): Move here; use
combine speculation.
* cgraph.h (ipa_polymorphic_call_context): Update
restrict_to_inner_class prototype; add offset_by, make_speculative,
combine_with, useless_p, combine_speculation_with and
speculation_consistent_p methods.
(ipa_polymorphic_call_context::offset_by): New method.
(ipa_polymorphic_call_context::useless_p): New method.
2014-10-01 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/62151
......@@ -1314,8 +1314,35 @@ public:
void clear_speculation ();
/* Walk container types and modify context to point to actual class
containing EXPECTED_TYPE as base class. */
bool restrict_to_inner_class (tree expected_type);
containing OTR_TYPE (if non-NULL) as base class.
Return true if resulting context is valid.
When CONSIDER_PLACEMENT_NEW is false, reject contexts that may be made
valid only via alocation of new polymorphic type inside by means
of placement new.
When CONSIDER_BASES is false, only look for actual fields, not base types
of TYPE. */
bool restrict_to_inner_class (tree otr_type,
bool consider_placement_new = true,
bool consider_bases = true);
/* Adjust all offsets in contexts by given number of bits. */
void offset_by (HOST_WIDE_INT);
/* Take non-speculative info, merge it with speculative and clear speculatoin.
Used when we no longer manage to keep track of actual outer type, but we
think it is still there.
If OTR_TYPE is set, the transformation can be done more effectively assuming
that context is going to be used only that way. */
void make_speculative (tree otr_type = NULL);
/* Assume that both THIS and a given context is valid and strenghten THIS
if possible. Return true if any strenghtening was made.
If actual type the context is being used in is known, OTR_TYPE should be
set accordingly. This improves quality of combined result. */
bool combine_with (ipa_polymorphic_call_context, tree otr_type = NULL);
/* Return TRUE if context is fully useless. */
bool useless_p () const;
/* Dump human readable context to F. */
void dump (FILE *f) const;
......@@ -1326,9 +1353,11 @@ public:
void stream_in (struct lto_input_block *, struct data_in *data_in);
private:
bool combine_speculation_with (tree, HOST_WIDE_INT, bool, tree);
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);
bool speculation_consistent_p (tree, HOST_WIDE_INT, bool, tree);
};
/* Structure containing additional information about an indirect call. */
......@@ -2634,4 +2663,23 @@ ipa_polymorphic_call_context::clear_outer_type (tree otr_type)
maybe_derived_type = true;
maybe_in_construction = true;
}
/* Adjust all offsets in contexts by OFF bits. */
inline void
ipa_polymorphic_call_context::offset_by (HOST_WIDE_INT off)
{
if (outer_type)
offset += off;
if (speculative_outer_type)
speculative_offset += off;
}
/* Return TRUE if context is fully useless. */
inline bool
ipa_polymorphic_call_context::useless_p () const
{
return (!outer_type && !speculative_outer_type);
}
#endif /* GCC_CGRAPH_H */
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