Compiler side new abi rtti (not enabled).

* cp-tree.h (new_abi_rtti_p): New macro.
	(emit_support_tinfos): Prototype new function.
	(tinfo_decl_p): Likewise.
	(emit_tinfo_decl): Likwise.
	* rtti.c (TINFO_PSEUDO_TYPE, TINFO_VTABLE_DECL): New accessor
	macros.
	(doing_runtime): New local static.
	(init_rtti_processing): Add new-abi initializer.
	(get_tinfo_decl): Add new-abi logic.
	(tinfo_from_decl): Likewise.
	(build_dynamic_cast_1): Likewise.
	(qualifier_flags): New static function.
	(tinfo_base_init): Likewise.
	(generic_initializer): Likewise.
	(ptr_ref_initializer): Likewise.
	(ptmd_initializer): Likewise.
	(class_hint_flags): Likewise.
	(class_initializer): Likewise.
	(synthesize_tinfo_var): Likewise.
	(create_real_tinfo_var): Likewise.
	(create_pseudo_type_info): Likewise.
	(get_vmi_pseudo_type_info): Likewise.
	(create_tinfo_types): Likewise.
	(emit_support_tinfos): New global function.
	(tinfo_decl_p): New global predicate.
	(emit_tinfo_decl): New global function.
	* class.c (set_rtti_entry): Generalize for old and new rtti.
	(build_vtbl_initializer): Likewise.
	* decl2.c (finish_file): Likewise.

From-SVN: r31668
This commit is contained in:
Nathan Sidwell 2000-01-28 13:30:13 +00:00 committed by Nathan Sidwell
parent 73565a7129
commit 7267d6924e
5 changed files with 933 additions and 84 deletions

View File

@ -1,3 +1,36 @@
2000-01-28 Nathan Sidwell <sidwell@codesourcery.com>
Compiler side new abi rtti (not enabled).
* cp-tree.h (new_abi_rtti_p): New macro.
(emit_support_tinfos): Prototype new function.
(tinfo_decl_p): Likewise.
(emit_tinfo_decl): Likwise.
* rtti.c (TINFO_PSEUDO_TYPE, TINFO_VTABLE_DECL): New accessor
macros.
(doing_runtime): New local static.
(init_rtti_processing): Add new-abi initializer.
(get_tinfo_decl): Add new-abi logic.
(tinfo_from_decl): Likewise.
(build_dynamic_cast_1): Likewise.
(qualifier_flags): New static function.
(tinfo_base_init): Likewise.
(generic_initializer): Likewise.
(ptr_ref_initializer): Likewise.
(ptmd_initializer): Likewise.
(class_hint_flags): Likewise.
(class_initializer): Likewise.
(synthesize_tinfo_var): Likewise.
(create_real_tinfo_var): Likewise.
(create_pseudo_type_info): Likewise.
(get_vmi_pseudo_type_info): Likewise.
(create_tinfo_types): Likewise.
(emit_support_tinfos): New global function.
(tinfo_decl_p): New global predicate.
(emit_tinfo_decl): New global function.
* class.c (set_rtti_entry): Generalize for old and new rtti.
(build_vtbl_initializer): Likewise.
* decl2.c (finish_file): Likewise.
Thu Jan 27 20:53:36 2000 Jim Wilson <wilson@cygnus.com> Thu Jan 27 20:53:36 2000 Jim Wilson <wilson@cygnus.com>
* cp/optimize.c (remap_decl): Add walk_tree calls for DECL_SIZE (t) * cp/optimize.c (remap_decl): Add walk_tree calls for DECL_SIZE (t)

View File

@ -963,34 +963,37 @@ static void
set_rtti_entry (virtuals, offset, type) set_rtti_entry (virtuals, offset, type)
tree virtuals, offset, type; tree virtuals, offset, type;
{ {
tree fn; tree decl;
if (CLASSTYPE_COM_INTERFACE (type)) if (CLASSTYPE_COM_INTERFACE (type))
return; return;
if (flag_rtti) if (flag_rtti)
fn = get_tinfo_decl (type); decl = get_tinfo_decl (type);
else else if (!new_abi_rtti_p ())
/* If someone tries to get RTTI information for a type compiled /* If someone tries to get RTTI information for a type compiled
without RTTI, they're out of luck. By calling __pure_virtual without RTTI, they're out of luck. By calling __pure_virtual
in this case, we give a small clue as to what went wrong. We in this case, we give a small clue as to what went wrong. We
could consider having a __no_typeinfo function as well, for a could consider having a __no_typeinfo function as well, for a
more specific hint. */ more specific hint. */
fn = abort_fndecl; decl = abort_fndecl;
else
/* For the new-abi, we just point to the type_info object. */
decl = NULL_TREE;
if (flag_vtable_thunks) if (flag_vtable_thunks)
{ {
/* The first slot holds the offset. */ /* The first slot holds the offset. */
TREE_PURPOSE (virtuals) = offset; TREE_PURPOSE (virtuals) = offset;
/* The next node holds the function. */ /* The next node holds the decl. */
virtuals = TREE_CHAIN (virtuals); virtuals = TREE_CHAIN (virtuals);
offset = integer_zero_node; offset = integer_zero_node;
} }
/* This slot holds the function to call. */ /* This slot holds the decl. */
TREE_PURPOSE (virtuals) = offset; TREE_PURPOSE (virtuals) = offset;
TREE_VALUE (virtuals) = fn; TREE_VALUE (virtuals) = decl;
} }
/* Get the VAR_DECL of the vtable for TYPE. TYPE need not be polymorphic, /* Get the VAR_DECL of the vtable for TYPE. TYPE need not be polymorphic,
@ -2615,9 +2618,26 @@ build_vtbl_initializer (binfo, t)
init = build_vtable_entry (integer_zero_node, init); init = build_vtable_entry (integer_zero_node, init);
inits = tree_cons (NULL_TREE, init, inits); inits = tree_cons (NULL_TREE, init, inits);
/* Even in this case, the second entry (the tdesc pointer) is
just an ordinary function. */
v = TREE_CHAIN (v); v = TREE_CHAIN (v);
if (new_abi_rtti_p ())
{
tree decl = TREE_VALUE (v);
if (decl)
decl = build_unary_op (ADDR_EXPR, decl, 0);
else
decl = integer_zero_node;
decl = build1 (NOP_EXPR, vfunc_ptr_type_node, decl);
TREE_CONSTANT (decl) = 1;
decl = build_vtable_entry (integer_zero_node, decl);
inits = tree_cons (NULL_TREE, decl, inits);
v = TREE_CHAIN (v);
}
/* In the old abi the second entry (the tdesc pointer) is
just an ordinary function, so it can be dealt with like the
virtual functions. */
} }
/* Go through all the ordinary virtual functions, building up /* Go through all the ordinary virtual functions, building up

View File

@ -238,6 +238,11 @@ extern int flag_rtti;
class). */ class). */
#define all_overridden_vfuns_in_vtables_p() (flag_new_abi) #define all_overridden_vfuns_in_vtables_p() (flag_new_abi)
/* Nonzero if we use access type_info objects directly, and use the
cross-vendor layout for them. Zero if we use an accessor function
to get the type_info object address. */
#define new_abi_rtti_p() (0)
/* Language-dependent contents of an identifier. */ /* Language-dependent contents of an identifier. */
@ -3988,13 +3993,16 @@ extern void init_repo PARAMS ((const char *));
extern void finish_repo PARAMS ((void)); extern void finish_repo PARAMS ((void));
/* in rtti.c */ /* in rtti.c */
extern void init_rtti_processing PARAMS ((void)); extern void init_rtti_processing PARAMS((void));
extern tree build_typeid PARAMS ((tree)); extern tree build_typeid PARAMS((tree));
extern tree get_tinfo_decl PARAMS ((tree)); extern tree get_tinfo_decl PARAMS((tree));
extern tree get_typeid PARAMS ((tree)); extern tree get_typeid PARAMS((tree));
extern tree get_typeid_1 PARAMS ((tree)); extern tree get_typeid_1 PARAMS((tree));
extern tree build_dynamic_cast PARAMS ((tree, tree)); extern tree build_dynamic_cast PARAMS((tree, tree));
extern void synthesize_tinfo_fn PARAMS ((tree)); extern void synthesize_tinfo_fn PARAMS((tree));
extern void emit_support_tinfos PARAMS((void));
extern int tinfo_decl_p PARAMS((tree, void *));
extern int emit_tinfo_decl PARAMS((tree *, void *));
/* in search.c */ /* in search.c */
extern int types_overlap_p PARAMS ((tree, tree)); extern int types_overlap_p PARAMS ((tree, tree));

View File

@ -3434,6 +3434,9 @@ finish_file ()
varconst_time += this_time - start_time; varconst_time += this_time - start_time;
start_time = get_run_time (); start_time = get_run_time ();
if (new_abi_rtti_p ())
emit_support_tinfos ();
do do
{ {
reconsider = 0; reconsider = 0;
@ -3450,6 +3453,12 @@ finish_file ()
/*data=*/0)) /*data=*/0))
reconsider = 1; reconsider = 1;
/* Write out needed type info variables. Writing out one variable
might cause others to be needed. */
if (new_abi_rtti_p ()
&& walk_globals (tinfo_decl_p, emit_tinfo_decl, /*data=*/0))
reconsider = 1;
/* The list of objects with static storage duration is built up /* The list of objects with static storage duration is built up
in reverse order. We clear STATIC_AGGREGATES so that any new in reverse order. We clear STATIC_AGGREGATES so that any new
aggregates added during the initialization of these will be aggregates added during the initialization of these will be

File diff suppressed because it is too large Load Diff