Commit 1f84ec23 by Mark Mitchell Committed by Mark Mitchell

Remove old ABI support.

From-SVN: r39599
parent 11662aaa
2001-02-12 Mark Mitchell <mark@codesourcery.com>
Remove old ABI support.
2001-02-11 Mark Mitchell <mark@codesourcery.com>
* decl2.c (flag_vtable_thunks): Always set it to 1.
......
......@@ -2355,9 +2355,7 @@ build_user_type_conversion_1 (totype, expr, flags)
if (IS_AGGR_TYPE (totype))
ctors = lookup_fnfields (TYPE_BINFO (totype),
(flag_new_abi
? complete_ctor_identifier
: ctor_identifier),
complete_ctor_identifier,
0);
if (IS_AGGR_TYPE (fromtype))
......@@ -4415,25 +4413,12 @@ build_new_method_call (instance, name, args, basetype_path, flags)
pretty_name = (constructor_p
? constructor_name (basetype) : dtor_identifier);
if (!flag_new_abi)
{
/* Add the in-charge parameter as an implicit first argument. */
if (!constructor_p
|| TYPE_USES_VIRTUAL_BASECLASSES (basetype))
args = tree_cons (NULL_TREE,
in_charge_arg_for_name (name),
args);
/* We want to call the normal constructor function under the
old ABI. */
name = constructor_p ? ctor_identifier : dtor_identifier;
}
/* If we're a call to a constructor or destructor for a
subobject that uses virtual base classes, then we need to
pass down a pointer to a VTT for the subobject. */
else if ((name == base_ctor_identifier
|| name == base_dtor_identifier)
&& TYPE_USES_VIRTUAL_BASECLASSES (basetype))
if ((name == base_ctor_identifier
|| name == base_dtor_identifier)
&& TYPE_USES_VIRTUAL_BASECLASSES (basetype))
{
tree vtt;
tree sub_vtt;
......
......@@ -213,10 +213,6 @@ Boston, MA 02111-1307, USA. */
/* ABI control. */
/* Nonzero to enable experimental ABI changes. */
extern int flag_new_abi;
/* Nonzero to use __cxa_atexit, rather than atexit, to register
destructors for local statics and global objects. */
......@@ -238,12 +234,12 @@ extern int flag_huge_objects;
/* Nonzero if virtual base class offsets are stored in the virtual
function table. Zero if, instead, a pointer to the virtual base is
stored in the object itself. */
#define vbase_offsets_in_vtable_p() (flag_new_abi)
#define vbase_offsets_in_vtable_p() (1)
/* Nonzero if displacements to the `this' pointer to use when calling
virtual functions in a virtual base class are present in the
vtable. */
#define vcall_offsets_in_vtable_p() (flag_new_abi)
#define vcall_offsets_in_vtable_p() (1)
/* Nonzero if a derived class that needs a vptr should always get one,
even if a non-primary base class already has one. For example,
......@@ -255,7 +251,7 @@ extern int flag_huge_objects;
one could either reuse the vptr in `S' for `T', or create a new
vptr for `T'. If this flag is nonzero we choose the latter
alternative; otherwise, we choose the former. */
#define vptrs_present_everywhere_p() (flag_new_abi)
#define vptrs_present_everywhere_p() (1)
/* Nonzero if the vtable for a derived class should contain the
virtual functions from the primary base and all virtual functions
......@@ -263,16 +259,16 @@ extern int flag_huge_objects;
only those virtual functions from the primary base together with
the functions declared in the derived class (but not in any base
class). */
#define all_overridden_vfuns_in_vtables_p() (flag_new_abi)
#define all_overridden_vfuns_in_vtables_p() (1)
/* 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() (flag_new_abi)
#define new_abi_rtti_p() (1)
/* Nonzero if primary and secondary vtables are combined into a single
vtable. */
#define merge_primary_and_secondary_vtables_p() (flag_new_abi)
#define merge_primary_and_secondary_vtables_p() (1)
/* Language-dependent contents of an identifier. */
......@@ -2681,9 +2677,7 @@ extern int flag_new_for_scope;
pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
before using this macro. */
#define TYPE_PTRMEMFUNC_FN_TYPE(NODE) \
(flag_new_abi \
? (TREE_TYPE (TYPE_FIELDS (NODE))) \
: (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (NODE))))))))
(TREE_TYPE (TYPE_FIELDS (NODE)))
/* Returns `A' for a type like `int (A::*)(double)' */
#define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
......@@ -3739,7 +3733,6 @@ extern void push_lang_context PARAMS ((tree));
extern void pop_lang_context PARAMS ((void));
extern tree instantiate_type PARAMS ((tree, tree, enum instantiate_type_flags));
extern void print_class_statistics PARAMS ((void));
extern int first_vfun_index PARAMS ((tree));
extern void build_self_reference PARAMS ((void));
extern void warn_hidden PARAMS ((tree));
extern tree get_enclosing_class PARAMS ((tree));
......@@ -4097,22 +4090,13 @@ extern int cp_type_qual_from_rid PARAMS ((tree));
/* in method.c */
extern void init_method PARAMS ((void));
extern char *build_overload_name PARAMS ((tree, int, int));
extern tree build_static_name PARAMS ((tree, tree));
extern tree build_decl_overload_real PARAMS ((tree, tree, tree, tree,
tree, int));
extern void set_mangled_name_for_decl PARAMS ((tree));
extern tree build_typename_overload PARAMS ((tree));
extern tree build_overload_with_type PARAMS ((tree, tree));
extern tree build_destructor_name PARAMS ((tree));
extern tree build_opfncall PARAMS ((enum tree_code, int, tree, tree, tree));
extern tree hack_identifier PARAMS ((tree, tree));
extern tree make_thunk PARAMS ((tree, tree, tree, int));
extern void use_thunk PARAMS ((tree, int));
extern void synthesize_method PARAMS ((tree));
extern tree get_id_2 PARAMS ((const char *, tree));
extern tree implicitly_declare_fn PARAMS ((special_function_kind, tree, int));
extern tree get_ctor_vtbl_name PARAMS ((tree, tree));
/* In optimize.c */
extern void optimize_function PARAMS ((tree));
......@@ -4191,7 +4175,6 @@ extern tree get_tinfo_decl PARAMS((tree));
extern tree get_typeid PARAMS((tree));
extern tree get_typeid_1 PARAMS((tree));
extern tree build_dynamic_cast PARAMS((tree, 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 *));
......@@ -4500,7 +4483,7 @@ extern int cp_type_quals PARAMS ((tree));
extern int cp_has_mutable_p PARAMS ((tree));
extern int at_least_as_qualified_p PARAMS ((tree, tree));
extern int more_qualified_p PARAMS ((tree, tree));
extern tree build_ptrmemfunc1 PARAMS ((tree, tree, tree, tree, tree));
extern tree build_ptrmemfunc1 PARAMS ((tree, tree, tree));
extern void expand_ptrmemfunc_cst PARAMS ((tree, tree *, tree *, tree *, tree *));
extern tree delta2_from_ptrmemfunc PARAMS ((tree));
extern tree pfn_from_ptrmemfunc PARAMS ((tree));
......
......@@ -258,7 +258,7 @@ cp_convert_to_pointer (type, expr, force)
if (TYPE_PTRMEMFUNC_P (type))
return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0);
if (flag_new_abi && TYPE_PTRMEM_P (type))
if (TYPE_PTRMEM_P (type))
/* Under the new ABI, a NULL pointer-to-member is represented
by -1, not by zero. */
expr = build_int_2 (-1, -1);
......
......@@ -51,15 +51,10 @@ extern tree global_namespace;
extern int (*valid_lang_attribute) PARAMS ((tree, tree, tree, tree));
#ifndef BOOL_TYPE_SIZE
#ifdef SLOW_BYTE_ACCESS
/* In the new ABI, `bool' has size and alignment `1', on all
platforms. */
#define BOOL_TYPE_SIZE \
((SLOW_BYTE_ACCESS && !flag_new_abi) ? (POINTER_SIZE) : (CHAR_TYPE_SIZE))
#else
#define BOOL_TYPE_SIZE CHAR_TYPE_SIZE
#endif
#endif
static tree grokparms PARAMS ((tree));
static const char *redeclaration_error_message PARAMS ((tree, tree));
......@@ -149,7 +144,7 @@ static void end_cleanup_fn PARAMS ((void));
static tree cp_make_fname_decl PARAMS ((tree, const char *, int));
static void initialize_predefined_identifiers PARAMS ((void));
static tree check_special_function_return_type
PARAMS ((special_function_kind, tree, tree, tree));
PARAMS ((special_function_kind, tree, tree));
static tree push_cp_library_fn PARAMS ((enum tree_code, tree));
static tree build_cp_library_fn PARAMS ((tree, enum tree_code, tree));
static void store_parm_decls PARAMS ((tree));
......@@ -2844,13 +2839,7 @@ pushtag (name, type, globalize)
VARRAY_PUSH_TREE (local_classes, type);
if (!uses_template_parms (type))
{
if (flag_new_abi)
DECL_ASSEMBLER_NAME (d) = mangle_type (type);
else
DECL_ASSEMBLER_NAME (d)
= get_identifier (build_overload_name (type, 1, 1));
}
DECL_ASSEMBLER_NAME (d) = mangle_type (type);
}
if (b->parm_flag == 2)
{
......@@ -6307,8 +6296,8 @@ init_decl_processing ()
/* Check to see that the user did not specify an invalid combination
of command-line options. */
if (flag_new_abi && !flag_vtable_thunks)
error ("the new ABI requires vtable thunks");
if (!flag_vtable_thunks)
error ("the ABI requires vtable thunks");
/* Create all the identifiers we need. */
initialize_predefined_identifiers ();
......@@ -6411,17 +6400,8 @@ init_decl_processing ()
record_builtin_type (RID_MAX, NULL_PTR, string_type_node);
#endif
if (flag_new_abi)
delta_type_node = ptrdiff_type_node;
else if (flag_huge_objects)
delta_type_node = long_integer_type_node;
else
delta_type_node = short_integer_type_node;
if (flag_new_abi)
vtable_index_type = ptrdiff_type_node;
else
vtable_index_type = delta_type_node;
delta_type_node = ptrdiff_type_node;
vtable_index_type = ptrdiff_type_node;
vtt_parm_type = build_pointer_type (const_ptr_type_node);
lang_type_promotes_to = convert_type_from_ellipsis;
......@@ -6490,12 +6470,9 @@ init_decl_processing ()
layout_type (vtbl_ptr_type_node);
record_builtin_type (RID_MAX, NULL_PTR, vtbl_ptr_type_node);
if (flag_new_abi)
{
push_namespace (get_identifier ("__cxxabiv1"));
abi_node = current_namespace;
pop_namespace ();
}
push_namespace (get_identifier ("__cxxabiv1"));
abi_node = current_namespace;
pop_namespace ();
global_type_node = make_node (LANG_TYPE);
record_unknown_type (global_type_node, "global type");
......@@ -6521,10 +6498,7 @@ init_decl_processing ()
}
abort_fndecl
= build_library_fn_ptr ((flag_new_abi
? "__cxa_pure_virtual"
: "__pure_virtual"),
void_ftype);
= build_library_fn_ptr ("__cxa_pure_virtual", void_ftype);
/* Perform other language dependent initializations. */
init_class_processing ();
......@@ -7534,13 +7508,7 @@ maybe_commonize_var (decl)
which we can't if it has been initialized. */
if (TREE_PUBLIC (decl))
{
if (flag_new_abi)
DECL_ASSEMBLER_NAME (decl) = mangle_decl (decl);
else
DECL_ASSEMBLER_NAME (decl)
= build_static_name (current_function_decl, DECL_NAME (decl));
}
DECL_ASSEMBLER_NAME (decl) = mangle_decl (decl);
else
{
cp_warning_at ("sorry: semantics of inline function static data `%#D' are wrong (you'll wind up with multiple copies)", decl);
......@@ -8977,13 +8945,7 @@ grokvardecl (type, declarator, specbits_in, initialized, constp, in_namespace)
/* DECL_ASSEMBLER_NAME is needed only for full-instantiated
templates. */
if (!uses_template_parms (decl))
{
if (flag_new_abi)
DECL_ASSEMBLER_NAME (decl) = mangle_decl (decl);
else
DECL_ASSEMBLER_NAME (decl) = build_static_name (basetype,
declarator);
}
DECL_ASSEMBLER_NAME (decl) = mangle_decl (decl);
}
else
{
......@@ -9008,13 +8970,7 @@ grokvardecl (type, declarator, specbits_in, initialized, constp, in_namespace)
context = DECL_CONTEXT (decl);
if (declarator && context && current_lang_name != lang_name_c)
{
if (flag_new_abi)
DECL_ASSEMBLER_NAME (decl) = mangle_decl (decl);
else
DECL_ASSEMBLER_NAME (decl)
= build_static_name (context, declarator);
}
DECL_ASSEMBLER_NAME (decl) = mangle_decl (decl);
}
if (in_namespace)
......@@ -9079,7 +9035,6 @@ build_ptrmemfunc_type (type)
{
tree fields[4];
tree t;
tree u;
tree unqualified_variant = NULL_TREE;
if (type == error_mark_node)
......@@ -9104,30 +9059,10 @@ build_ptrmemfunc_type (type)
/* ... and not really an aggregate. */
SET_IS_AGGR_TYPE (t, 0);
if (!flag_new_abi)
{
u = make_aggr_type (UNION_TYPE);
SET_IS_AGGR_TYPE (u, 0);
fields[0] = build_decl (FIELD_DECL, pfn_identifier, type);
fields[1] = build_decl (FIELD_DECL, delta2_identifier,
delta_type_node);
finish_builtin_type (u, "__ptrmemfunc_type", fields, 1, ptr_type_node);
TYPE_NAME (u) = NULL_TREE;
fields[0] = build_decl (FIELD_DECL, delta_identifier,
delta_type_node);
fields[1] = build_decl (FIELD_DECL, index_identifier,
delta_type_node);
fields[2] = build_decl (FIELD_DECL, pfn_or_delta2_identifier, u);
finish_builtin_type (t, "__ptrmemfunc_type", fields, 2, ptr_type_node);
}
else
{
fields[0] = build_decl (FIELD_DECL, pfn_identifier, type);
fields[1] = build_decl (FIELD_DECL, delta_identifier,
delta_type_node);
finish_builtin_type (t, "__ptrmemfunc_type", fields, 1, ptr_type_node);
}
fields[0] = build_decl (FIELD_DECL, pfn_identifier, type);
fields[1] = build_decl (FIELD_DECL, delta_identifier,
delta_type_node);
finish_builtin_type (t, "__ptrmemfunc_type", fields, 1, ptr_type_node);
/* Zap out the name so that the back-end will give us the debugging
information for this anonymous RECORD_TYPE. */
......@@ -9399,17 +9334,15 @@ create_array_type_for_decl (name, type, size)
/* Check that it's OK to declare a function with the indicated TYPE.
SFK indicates the kind of special function (if any) that this
function is. CTYPE is the class of which this function is a
member. OPTYPE is the type given in a conversion operator
function is. OPTYPE is the type given in a conversion operator
declaration. Returns the actual return type of the function; that
may be different than TYPE if an error occurs, or for certain
special functions. */
static tree
check_special_function_return_type (sfk, type, ctype, optype)
check_special_function_return_type (sfk, type, optype)
special_function_kind sfk;
tree type;
tree ctype;
tree optype;
{
switch (sfk)
......@@ -9418,9 +9351,8 @@ check_special_function_return_type (sfk, type, ctype, optype)
if (type)
cp_error ("return type specification for constructor invalid");
/* In the old ABI, we return `this'; in the new ABI we don't
bother. */
type = flag_new_abi ? void_type_node : build_pointer_type (ctype);
/* In the new ABI constructors do not return a value. */
type = void_type_node;
break;
case sfk_destructor:
......@@ -10030,7 +9962,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (sfk != sfk_none)
type = check_special_function_return_type (sfk, type,
ctor_return_type,
ctor_return_type);
else if (type == NULL_TREE)
{
......@@ -11048,24 +10979,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
DECL_NAME (CLASSTYPE_TI_TEMPLATE (type))
= TYPE_IDENTIFIER (type);
if (flag_new_abi)
DECL_ASSEMBLER_NAME (decl) = mangle_type (type);
else
{
/* XXX Temporarily set the scope.
When returning, start_decl expects it as NULL_TREE,
and will then then set it using pushdecl. */
my_friendly_assert (DECL_CONTEXT (decl) == NULL_TREE, 980404);
if (current_class_type)
DECL_CONTEXT (decl) = current_class_type;
else
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
DECL_ASSEMBLER_NAME (decl) = DECL_NAME (decl);
DECL_ASSEMBLER_NAME (decl)
= get_identifier (build_overload_name (type, 1, 1));
DECL_CONTEXT (decl) = NULL_TREE;
}
DECL_ASSEMBLER_NAME (decl) = mangle_type (type);
/* FIXME remangle member functions; member functions of a
type with external linkage have external linkage. */
......@@ -13637,16 +13551,6 @@ start_function (declspecs, declarator, attrs, flags)
dtor_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
DECL_CONTEXT (dtor_label) = current_function_decl;
}
/* Under the old ABI we return `this' from constructors, so we make
ordinary `return' statements in constructors jump to CTOR_LABEL;
from there we return `this'. Under the new ABI, we don't bother
with any of this. By not setting CTOR_LABEL the remainder of the
machinery is automatically disabled. */
else if (!flag_new_abi && DECL_CONSTRUCTOR_P (decl1))
{
ctor_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
DECL_CONTEXT (ctor_label) = current_function_decl;
}
store_parm_decls (current_function_parms);
......
......@@ -415,10 +415,6 @@ int flag_new_for_scope = 1;
int flag_weak = 1;
/* Nonzero to enable experimental ABI changes. */
int flag_new_abi = 1;
/* Nonzero to use __cxa_atexit, rather than atexit, to register
destructors for local statics and global objects. */
......@@ -620,17 +616,6 @@ cxx_decode_option (argc, argv)
flag_external_templates = 1;
cp_deprecated ("-fexternal-templates");
}
else if (!strcmp (p, "new-abi"))
{
flag_new_abi = 1;
flag_do_squangling = 1;
flag_vtable_thunks = 1;
}
else if (!strcmp (p, "no-new-abi"))
{
flag_new_abi = 0;
flag_do_squangling = 0;
}
else if ((option_value
= skip_leading_substring (p, "template-depth-")))
max_tinst_depth
......@@ -995,7 +980,7 @@ maybe_retrofit_in_chrg (fn)
/* If this is a subobject constructor or destructor, our caller will
pass us a pointer to our VTT. */
if (flag_new_abi && TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
{
DECL_VTT_PARM (fn) = build_artificial_parm (vtt_parm_identifier,
vtt_parm_type);
......@@ -1081,12 +1066,7 @@ grokclassfn (ctype, function, flags, quals)
if (flags == DTOR_FLAG)
{
DECL_DESTRUCTOR_P (function) = 1;
if (flag_new_abi)
set_mangled_name_for_decl (function);
else
DECL_ASSEMBLER_NAME (function) = build_destructor_name (ctype);
set_mangled_name_for_decl (function);
TYPE_HAS_DESTRUCTOR (ctype) = 1;
}
else
......@@ -1560,11 +1540,7 @@ finish_static_data_member_decl (decl, init, asmspec_tree, flags)
if (!asmspec && current_class_type)
{
DECL_INITIAL (decl) = error_mark_node;
if (flag_new_abi)
DECL_ASSEMBLER_NAME (decl) = mangle_decl (decl);
else
DECL_ASSEMBLER_NAME (decl)
= build_static_name (current_class_type, DECL_NAME (decl));
DECL_ASSEMBLER_NAME (decl) = mangle_decl (decl);
}
if (! processing_template_decl)
{
......@@ -1699,13 +1675,7 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
name for this TYPE_DECL. */
DECL_ASSEMBLER_NAME (value) = DECL_NAME (value);
if (!uses_template_parms (value))
{
if (flag_new_abi)
DECL_ASSEMBLER_NAME (value) = mangle_type (TREE_TYPE (value));
else
DECL_ASSEMBLER_NAME (value) =
get_identifier (build_overload_name (TREE_TYPE (value), 1, 1));
}
DECL_ASSEMBLER_NAME (value) = mangle_type (TREE_TYPE (value));
if (processing_template_decl)
value = push_template_decl (value);
......@@ -1886,10 +1856,7 @@ grokoptypename (declspecs, declarator)
tree declspecs, declarator;
{
tree t = grokdeclarator (declarator, declspecs, TYPENAME, 0, NULL_TREE);
if (flag_new_abi)
return mangle_conv_op_name_for_type (t);
else
return build_typename_overload (t);
return mangle_conv_op_name_for_type (t);
}
/* When a function is declared with an initializer,
......@@ -2757,9 +2724,7 @@ import_export_decl (decl)
tree ctype = DECL_CONTEXT (decl);
import_export_class (ctype);
if (CLASSTYPE_INTERFACE_KNOWN (ctype)
&& (flag_new_abi
? (! DECL_THIS_INLINE (decl))
: (! DECL_ARTIFICIAL (decl) || DECL_VINDEX (decl))))
&& ! DECL_THIS_INLINE (decl))
{
DECL_NOT_REALLY_EXTERN (decl)
= ! (CLASSTYPE_INTERFACE_ONLY (ctype)
......@@ -2846,23 +2811,7 @@ get_guard (decl)
tree sname;
tree guard;
/* For a local variable, under the old ABI, we do not try to get a
unique mangled name for the DECL. */
if (!flag_new_abi && DECL_FUNCTION_SCOPE_P (decl))
{
guard = get_temp_name (integer_type_node);
cp_finish_decl (guard, NULL_TREE, NULL_TREE, 0);
return guard;
}
if (!flag_new_abi)
/* For struct X foo __attribute__((weak)), there is a counter
__snfoo. Since base is already an assembler name, sname should
be globally unique */
sname = get_id_2 ("__sn", DECL_ASSEMBLER_NAME (decl));
else
sname = mangle_guard_variable (decl);
sname = mangle_guard_variable (decl);
guard = IDENTIFIER_GLOBAL_VALUE (sname);
if (! guard)
{
......@@ -2870,11 +2819,7 @@ get_guard (decl)
/* Under the new ABI, we use a type that is big enough to
contain a mutex as well as an integer counter. */
if (flag_new_abi)
guard_type = long_long_integer_type_node;
else
guard_type = integer_type_node;
guard_type = long_long_integer_type_node;
guard = build_decl (VAR_DECL, sname, guard_type);
/* The guard should have the same linkage as what it guards. */
......@@ -2900,9 +2845,6 @@ static tree
get_guard_bits (guard)
tree guard;
{
if (!flag_new_abi)
return guard;
/* Under the new ABI, we only set the first byte of the guard,
in order to leave room for a mutex in the high-order bits. */
guard = build1 (ADDR_EXPR,
......@@ -3358,7 +3300,7 @@ start_static_initialization_or_destruction (decl, initp)
/* Under the new ABI, we have not already set the GUARD, so we must
do so now. */
if (guard && initp && flag_new_abi)
if (guard && initp)
finish_expr_stmt (set_guard (guard));
return guard_if_stmt;
......@@ -3724,10 +3666,7 @@ finish_file ()
finish_function doesn't clean things up, and we end
up with CURRENT_FUNCTION_DECL set. */
push_to_top_level ();
if (DECL_TINFO_FN_P (decl))
synthesize_tinfo_fn (decl);
else
synthesize_method (decl);
synthesize_method (decl);
pop_from_top_level ();
reconsider = 1;
}
......
......@@ -1963,7 +1963,7 @@ dump_expr (t, flags)
t = TYPE_METHOD_BASETYPE (t);
virtuals = TYPE_BINFO_VIRTUALS (TYPE_MAIN_VARIANT (t));
n = tree_low_cst (idx, 0) - first_vfun_index (t);
n = tree_low_cst (idx, 0);
/* Map vtable index back one, to allow for the null pointer to
member. */
......
......@@ -867,8 +867,6 @@ expand_throw (exp)
tree arg_types;
arg_types = void_list_node;
if (!flag_new_abi)
arg_types = tree_cons (NULL_TREE, integer_type_node, arg_types);
arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types);
cleanup_type = (build_pointer_type
(build_function_type (void_type_node, arg_types)));
......@@ -927,9 +925,7 @@ expand_throw (exp)
if (TYPE_HAS_DESTRUCTOR (TREE_TYPE (object)))
{
cleanup = lookup_fnfields (TYPE_BINFO (TREE_TYPE (object)),
(flag_new_abi
? complete_dtor_identifier
: dtor_identifier),
complete_dtor_identifier,
0);
cleanup = TREE_VALUE (cleanup);
mark_used (cleanup);
......
......@@ -56,18 +56,6 @@ cplus_expand_constant (cst)
{
/* Find the offset for the field. */
tree offset = byte_position (member);
if (flag_new_abi)
/* Under the new ABI, we use -1 to represent the NULL
pointer; non-NULL values simply contain the offset of
the data member. */
;
else
/* We offset all pointer to data members by 1 so that we
can distinguish between a null pointer to data member
and the first data member of a structure. */
offset = size_binop (PLUS_EXPR, offset, size_one_node);
cst = fold (build1 (NOP_EXPR, type, offset));
}
else
......@@ -75,7 +63,7 @@ cplus_expand_constant (cst)
tree delta, idx, pfn, delta2;
expand_ptrmemfunc_cst (cst, &delta, &idx, &pfn, &delta2);
cst = build_ptrmemfunc1 (type, delta, idx, pfn, delta2);
cst = build_ptrmemfunc1 (type, delta, pfn);
}
}
break;
......
......@@ -1954,14 +1954,6 @@ resolve_offset_ref (exp)
addr = convert_pointer_to (basetype, addr);
member = cp_convert (ptrdiff_type_node, member);
if (!flag_new_abi)
/* Pointer to data members are offset by one, so that a null
pointer with a real value of 0 is distinguishable from an
offset of the first member of a structure. */
member = cp_build_binary_op (MINUS_EXPR, member,
cp_convert (ptrdiff_type_node,
integer_one_node));
return build1 (INDIRECT_REF, type,
build (PLUS_EXPR, build_pointer_type (type),
addr, member));
......@@ -2224,20 +2216,17 @@ build_java_class_ref (type)
}
/* Mangle the class$ field, new and old ABI */
if (flag_new_abi)
{
tree field;
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
if (DECL_NAME (field) == CL_suffix)
{
name = mangle_decl (field);
break;
}
if (!field)
internal_error ("Can't find class$");
{
tree field;
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
if (DECL_NAME (field) == CL_suffix)
{
name = mangle_decl (field);
break;
}
if (!field)
internal_error ("Can't find class$");
}
else
name = build_static_name (type, CL_suffix);
class_decl = IDENTIFIER_GLOBAL_VALUE (name);
if (class_decl == NULL_TREE)
......@@ -2264,27 +2253,17 @@ get_cookie_size (type)
{
tree cookie_size;
if (flag_new_abi)
{
/* Under the new ABI, we need to allocate an additional max
(sizeof (size_t), alignof (true_type)) bytes. */
tree sizetype_size;
tree type_align;
sizetype_size = size_in_bytes (sizetype);
type_align = size_int (TYPE_ALIGN_UNIT (type));
if (INT_CST_LT_UNSIGNED (type_align, sizetype_size))
cookie_size = sizetype_size;
else
cookie_size = type_align;
}
/* Under the new ABI, we need to allocate an additional max
(sizeof (size_t), alignof (true_type)) bytes. */
tree sizetype_size;
tree type_align;
sizetype_size = size_in_bytes (sizetype);
type_align = size_int (TYPE_ALIGN_UNIT (type));
if (INT_CST_LT_UNSIGNED (type_align, sizetype_size))
cookie_size = sizetype_size;
else
{
if (TYPE_ALIGN (type) > TYPE_ALIGN (BI_header_type))
return size_int (TYPE_ALIGN_UNIT (type));
else
return size_in_bytes (BI_header_type);
}
cookie_size = type_align;
return cookie_size;
}
......@@ -2386,7 +2365,7 @@ build_new_1 (exp)
else if (placement && !TREE_CHAIN (placement)
&& same_type_p (TREE_TYPE (TREE_VALUE (placement)),
ptr_type_node))
use_cookie = (!flag_new_abi || !use_global_new);
use_cookie = !use_global_new;
/* Otherwise, we need the cookie. */
else
use_cookie = 1;
......@@ -2481,23 +2460,13 @@ build_new_1 (exp)
tree cookie;
/* Store the number of bytes allocated so that we can know how
many elements to destroy later. */
if (flag_new_abi)
{
/* Under the new ABI, we use the last sizeof (size_t) bytes
to store the number of elements. */
cookie = build (MINUS_EXPR, build_pointer_type (sizetype),
alloc_node, size_in_bytes (sizetype));
cookie = build_indirect_ref (cookie, NULL_PTR);
}
else
{
cookie = build (MINUS_EXPR, build_pointer_type (BI_header_type),
alloc_node, cookie_size);
cookie = build_indirect_ref (cookie, NULL_PTR);
cookie = build_component_ref (cookie, nelts_identifier,
NULL_TREE, 0);
}
many elements to destroy later. Under the new ABI, we use
the last sizeof (size_t) bytes to store the number of
elements. */
cookie = build (MINUS_EXPR, build_pointer_type (sizetype),
alloc_node, size_in_bytes (sizetype));
cookie = build_indirect_ref (cookie, NULL_PTR);
cookie_expr = build (MODIFY_EXPR, void_type_node, cookie, nelts);
TREE_SIDE_EFFECTS (cookie_expr) = 1;
}
......@@ -3412,24 +3381,11 @@ build_vec_delete (base, maxindex, auto_delete_vec, use_global_delete)
tree cookie_addr;
type = strip_array_types (TREE_TYPE (type));
if (flag_new_abi)
{
cookie_addr = build (MINUS_EXPR,
build_pointer_type (sizetype),
base,
TYPE_SIZE_UNIT (sizetype));
maxindex = build_indirect_ref (cookie_addr, NULL_PTR);
}
else
{
tree cookie;
cookie_addr = build (MINUS_EXPR, build_pointer_type (BI_header_type),
base, get_cookie_size (type));
cookie = build_indirect_ref (cookie_addr, NULL_PTR);
maxindex = build_component_ref (cookie, nelts_identifier,
NULL_TREE, 0);
}
cookie_addr = build (MINUS_EXPR,
build_pointer_type (sizetype),
base,
TYPE_SIZE_UNIT (sizetype));
maxindex = build_indirect_ref (cookie_addr, NULL_PTR);
}
else if (TREE_CODE (type) == ARRAY_TYPE)
{
......
......@@ -339,7 +339,7 @@ init_operators ()
: &operator_name_info[(int) CODE]); \
oni->identifier = identifier; \
oni->name = NAME; \
oni->mangled_name = flag_new_abi ? NEW_MANGLING : OLD_MANGLING;
oni->mangled_name = NEW_MANGLING;
#include "operators.def"
#undef DEF_OPERATOR
......
/* Perform optimizations on tree structure.
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Mark Michell (mark@codesourcery.com).
This file is part of GNU CC.
......@@ -914,10 +914,6 @@ maybe_clone_body (fn)
inline_data id;
tree clone;
/* We don't clone constructors and destructors under the old ABI. */
if (!flag_new_abi)
return 0;
/* We only clone constructors and destructors. */
if (!DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn)
&& !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn))
......
......@@ -4222,11 +4222,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
DECL_ASSEMBLER_NAME (type_decl) = DECL_NAME (type_decl);
if (!is_partial_instantiation)
{
if (flag_new_abi)
DECL_ASSEMBLER_NAME (type_decl) = mangle_decl (type_decl);
else
DECL_ASSEMBLER_NAME (type_decl)
= get_identifier (build_overload_name (t, 1, 1));
DECL_ASSEMBLER_NAME (type_decl) = mangle_decl (type_decl);
/* For backwards compatibility; code that uses
-fexternal-templates expects looking up a template to
......@@ -5817,14 +5813,9 @@ tsubst_decl (t, args, type)
/*entering_scope=*/1);
if (member && DECL_CONV_FN_P (r))
{
/* Type-conversion operator. Reconstruct the name, in
case it's the name of one of the template's parameters. */
if (flag_new_abi)
DECL_NAME (r) = mangle_conv_op_name_for_type (TREE_TYPE (type));
else
DECL_NAME (r) = build_typename_overload (TREE_TYPE (type));
}
/* Type-conversion operator. Reconstruct the name, in
case it's the name of one of the template's parameters. */
DECL_NAME (r) = mangle_conv_op_name_for_type (TREE_TYPE (type));
DECL_ARGUMENTS (r) = tsubst (DECL_ARGUMENTS (t), args,
/*complain=*/1, t);
......@@ -5860,12 +5851,7 @@ tsubst_decl (t, args, type)
/* Set the mangled name for R. */
if (DECL_DESTRUCTOR_P (t))
{
if (flag_new_abi)
set_mangled_name_for_decl (r);
else
DECL_ASSEMBLER_NAME (r) = build_destructor_name (ctx);
}
set_mangled_name_for_decl (r);
else
{
/* Instantiations of template functions must be mangled
......@@ -7223,10 +7209,7 @@ tsubst_copy (t, args, complain, in_decl)
if (IDENTIFIER_TYPENAME_P (t))
{
tree new_type = tsubst (TREE_TYPE (t), args, complain, in_decl);
if (flag_new_abi)
return mangle_conv_op_name_for_type (new_type);
else
return (build_typename_overload (new_type));
return mangle_conv_op_name_for_type (new_type);
}
else
return t;
......@@ -10321,90 +10304,11 @@ static void
set_mangled_name_for_template_decl (decl)
tree decl;
{
tree context = NULL_TREE;
tree fn_type;
tree ret_type;
tree parm_types;
tree tparms;
tree targs;
my_friendly_assert (TREE_CODE (decl) == FUNCTION_DECL, 0);
my_friendly_assert (DECL_TEMPLATE_INFO (decl) != NULL_TREE, 0);
/* Under the new ABI, we don't need special machinery. */
if (flag_new_abi)
{
set_mangled_name_for_decl (decl);
return;
}
/* The names of template functions must be mangled so as to indicate
what template is being specialized with what template arguments.
For example, each of the following three functions must get
different mangled names:
void f(int);
template <> void f<7>(int);
template <> void f<8>(int); */
targs = DECL_TI_ARGS (decl);
if (uses_template_parms (targs))
/* This DECL is for a partial instantiation. There's no need to
mangle the name of such an entity. */
return;
/* We now compute the PARMS and RET_TYPE to give to
build_decl_overload_real. The PARMS and RET_TYPE are the
parameter and return types of the template, after all but the
innermost template arguments have been substituted, not the
parameter and return types of the function DECL. For example,
given:
template <class T> T f(T);
both PARMS and RET_TYPE should be `T' even if DECL is `int f(int)'.
A more subtle example is:
template <class T> struct S { template <class U> void f(T, U); }
Here, if DECL is `void S<int>::f(int, double)', PARMS should be
{int, U}. Thus, the args that we want to subsitute into the
return and parameter type for the function are those in TARGS,
with the innermost level omitted. */
fn_type = get_mostly_instantiated_function_type (decl, &context, &tparms);
/* Now, get the innermost parameters and arguments, and figure out
the parameter and return types. */
tparms = INNERMOST_TEMPLATE_PARMS (tparms);
targs = INNERMOST_TEMPLATE_ARGS (targs);
ret_type = TREE_TYPE (fn_type);
parm_types = TYPE_ARG_TYPES (fn_type);
/* For a static member function, we generate a fake `this' pointer,
for the purposes of mangling. This indicates of which class the
function is a member. Because of:
[class.static]
There shall not be a static and a nonstatic member function
with the same name and the same parameter types
we don't have to worry that this will result in a clash with a
non-static member function. */
if (DECL_STATIC_FUNCTION_P (decl))
parm_types = hash_tree_chain (build_pointer_type (context), parm_types);
/* There should be the same number of template parameters as
template arguments. */
my_friendly_assert (TREE_VEC_LENGTH (tparms) == TREE_VEC_LENGTH (targs),
0);
/* Actually set the DECL_ASSEMBLER_NAME. */
DECL_ASSEMBLER_NAME (decl)
= build_decl_overload_real (decl, parm_types, ret_type,
tparms, targs,
DECL_FUNCTION_MEMBER_P (decl)
+ DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl));
set_mangled_name_for_decl (decl);
}
/* Return truthvalue if we're processing a template different from
......
/* Code to maintain a C++ template repository.
Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
Contributed by Jason Merrill (jason@cygnus.com)
This file is part of GNU CC.
......@@ -107,25 +107,6 @@ repo_get_id (t)
vtable = get_vtbl_decl_for_binfo (TYPE_BINFO (t));
/* If we don't have a primary vtable, try looking for a secondary
vtable. */
if (vtable == NULL_TREE && !flag_new_abi
&& TYPE_USES_VIRTUAL_BASECLASSES (t))
{
tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
for (i = 0; i < n_baselinks; ++i)
{
tree base_binfo = TREE_VEC_ELT (binfos, i);
if (TREE_VIA_VIRTUAL (base_binfo))
{
vtable = get_vtbl_decl_for_binfo (base_binfo);
if (vtable)
break;
}
}
}
t = vtable;
if (t == NULL_TREE)
return t;
......
......@@ -2507,8 +2507,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
*vbase_offsets = delta;
}
for (virtuals = BINFO_VIRTUALS (binfo),
n = first_vfun_index (BINFO_TYPE (binfo));
for (virtuals = BINFO_VIRTUALS (binfo), n = 0;
virtuals;
virtuals = TREE_CHAIN (virtuals), ++n)
{
......
......@@ -883,7 +883,7 @@ debug_binfo (elem)
fprintf (stderr, "no vtable decl yet\n");
fprintf (stderr, "virtuals:\n");
virtuals = BINFO_VIRTUALS (elem);
n = first_vfun_index (BINFO_TYPE (elem));
n = 0;
while (virtuals)
{
......@@ -2229,9 +2229,6 @@ cp_valid_lang_attribute (attr_name, attr_args, decl, type)
return 0;
}
if (!flag_new_abi)
/* The v3 ABI is already COM compliant; don't set this flag. */
CLASSTYPE_COM_INTERFACE (type) = 1;
return 1;
}
else if (is_attribute_p ("init_priority", attr_name))
......
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