ipa-utils.h (subbinfo_with_vtable_at_offset, [...]): Declare.

* ipa-utils.h (subbinfo_with_vtable_at_offset, type_all_derivations_known_p,
	type_known_to_have_no_deriavations_p, types_must_be_same_for_odr,
	types_odr_comparable): Declare.
	(polymorphic_type_binfo_p): Move here from ipa-devirt.c
	* ipa-polymorphic-call.c: New file.
	(contains_polymorphic_type_p, possible_placement_new,
	ipa_polymorphic_call_context::restrict_to_inner_class,
	contains_type_p, decl_maybe_in_construction_p,
	ipa_polymorphic_call_context::stream_out,
	ipa_polymorphic_call_context::debug,
	ipa_polymorphic_call_context::stream_in,
	ipa_polymorphic_call_context::set_by_decl,
	ipa_polymorphic_call_context::set_by_invariant,
	walk_ssa_copies,
	ipa_polymorphic_call_context::ipa_polymorphic_call_context,
	type_change_info, noncall_stmt_may_be_vtbl_ptr_store,
	extr_type_from_vtbl_ptr_store, record_known_type
	check_stmt_for_type_change,
	ipa_polymorphic_call_context::get_dynamic_type): Move here from
	ipa-devirt.c
	* ipa-devirt.c: No longer include data-streamer.h, lto-streamer.h
	and streamer-hooks.h
	(contains_polymorphic_type_p, possible_placement_new,
	ipa_polymorphic_call_context::restrict_to_inner_class,
	contains_type_p, decl_maybe_in_construction_p,
	ipa_polymorphic_call_context::stream_out,
	ipa_polymorphic_call_context::debug,
	ipa_polymorphic_call_context::stream_in,
	ipa_polymorphic_call_context::set_by_decl,
	ipa_polymorphic_call_context::set_by_invariant,
	walk_ssa_copies,
	ipa_polymorphic_call_context::ipa_polymorphic_call_context,
	type_change_info, noncall_stmt_may_be_vtbl_ptr_store,
	extr_type_from_vtbl_ptr_store, record_known_type
	check_stmt_for_type_change,
	ipa_polymorphic_call_context::get_dynamic_type): Move to
	ipa-polymorphic-call.c
	(type_all_derivations_known_p, types_odr_comparable,
	types_must_be_same_for_odr): Export.
	(type_known_to_have_no_deriavations_p): New function.
	* Makefile.in: Add ipa-polymorphic-call.c

From-SVN: r215615
This commit is contained in:
Jan Hubicka 2014-09-25 21:52:20 +02:00 committed by Jan Hubicka
parent 2f28755fbf
commit aa803cc76e
5 changed files with 1599 additions and 1492 deletions

View File

@ -1,3 +1,47 @@
2014-09-25 Jan Hubicka <hubicka@ucw.cz>
* ipa-utils.h (subbinfo_with_vtable_at_offset, type_all_derivations_known_p,
type_known_to_have_no_deriavations_p, types_must_be_same_for_odr,
types_odr_comparable): Declare.
(polymorphic_type_binfo_p): Move here from ipa-devirt.c
* ipa-polymorphic-call.c: New file.
(contains_polymorphic_type_p, possible_placement_new,
ipa_polymorphic_call_context::restrict_to_inner_class,
contains_type_p, decl_maybe_in_construction_p,
ipa_polymorphic_call_context::stream_out,
ipa_polymorphic_call_context::debug,
ipa_polymorphic_call_context::stream_in,
ipa_polymorphic_call_context::set_by_decl,
ipa_polymorphic_call_context::set_by_invariant,
walk_ssa_copies,
ipa_polymorphic_call_context::ipa_polymorphic_call_context,
type_change_info, noncall_stmt_may_be_vtbl_ptr_store,
extr_type_from_vtbl_ptr_store, record_known_type
check_stmt_for_type_change,
ipa_polymorphic_call_context::get_dynamic_type): Move here from
ipa-devirt.c
* ipa-devirt.c: No longer include data-streamer.h, lto-streamer.h
and streamer-hooks.h
(contains_polymorphic_type_p, possible_placement_new,
ipa_polymorphic_call_context::restrict_to_inner_class,
contains_type_p, decl_maybe_in_construction_p,
ipa_polymorphic_call_context::stream_out,
ipa_polymorphic_call_context::debug,
ipa_polymorphic_call_context::stream_in,
ipa_polymorphic_call_context::set_by_decl,
ipa_polymorphic_call_context::set_by_invariant,
walk_ssa_copies,
ipa_polymorphic_call_context::ipa_polymorphic_call_context,
type_change_info, noncall_stmt_may_be_vtbl_ptr_store,
extr_type_from_vtbl_ptr_store, record_known_type
check_stmt_for_type_change,
ipa_polymorphic_call_context::get_dynamic_type): Move to
ipa-polymorphic-call.c
(type_all_derivations_known_p, types_odr_comparable,
types_must_be_same_for_odr): Export.
(type_known_to_have_no_deriavations_p): New function.
* Makefile.in: Add ipa-polymorphic-call.c
2014-09-25 Jan Hubicka <hubicka@ucw.cz>
* ipa-devirt.c (polymorphic_call_target_d): Add SPECULATIVE; reorder

View File

@ -1255,6 +1255,7 @@ OBJS = \
internal-fn.o \
ipa-cp.o \
ipa-devirt.o \
ipa-polymorphic-call.o \
ipa-split.o \
ipa-inline.o \
ipa-comdats.o \

File diff suppressed because it is too large Load Diff

1518
gcc/ipa-polymorphic-call.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -74,9 +74,14 @@ tree method_class_type (const_tree);
bool decl_maybe_in_construction_p (tree, tree, gimple, tree);
tree vtable_pointer_value_to_binfo (const_tree);
bool vtable_pointer_value_to_vtable (const_tree, tree *, unsigned HOST_WIDE_INT *);
tree subbinfo_with_vtable_at_offset (tree, unsigned HOST_WIDE_INT, tree);
void compare_virtual_tables (varpool_node *, varpool_node *);
bool type_all_derivations_known_p (const_tree);
bool type_known_to_have_no_deriavations_p (tree);
bool contains_polymorphic_type_p (const_tree);
void register_odr_type (tree);
bool types_must_be_same_for_odr (tree, tree);
bool types_odr_comparable (tree, tree);
/* Return vector containing possible targets of polymorphic call E.
If COMPLETEP is non-NULL, store true if the list is complette.
@ -162,6 +167,21 @@ odr_type_p (const_tree t)
return (TYPE_NAME (t)
&& (DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t))));
}
/* Return true if BINFO corresponds to a type with virtual methods.
Every type has several BINFOs. One is the BINFO associated by the type
while other represents bases of derived types. The BINFOs representing
bases do not have BINFO_VTABLE pointer set when this is the single
inheritance (because vtables are shared). Look up the BINFO of type
and check presence of its vtable. */
inline bool
polymorphic_type_binfo_p (const_tree binfo)
{
/* See if BINFO's type has an virtual table associtated with it. */
return BINFO_VTABLE (TYPE_BINFO (BINFO_TYPE (binfo)));
}
#endif /* GCC_IPA_UTILS_H */