c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1.
* c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * dwarf2out.c (add_data_member_location_attribute): Check for TREE_BINFO. * tree.c (tree_node_kinds): Add "binfos". (binfo_lang_slots): New. (make_node_stat): Add TREE_BINFO. (make_tree_binfo_stat): New. (tree_node_structure): Add TREE_BINFO. * tree.def (TREE_BINFO): New. * tree.h (REC_OR_UNION_CHECK): Rename to ... (RECORD_OR_UNION_CHECK): ... here. (NOT_RECORD_OR_UNION_CHECK): New. (TRE_VIA_VIRTUAL): Allow TREE_LIST or TREE_BINFO. (TYPE_FIELDS, TYPE_METHODS, TYPE_VFIELD): Adjust for RECORD_OR_UNION_CHECK. (TYPE_BINFO): Use RECORD_OR_UNION_CHECK. (TYPE_LANG_SLOT_1): New. (BINFO_TYPE, BINFO_OFFSET, BINFO_VTABLE, BINFO_VIRTUALS, BINFO_BASETYPES, TYPE_BINFO_BASETYPES, BINFO_VPTR_FIELD, BINFO_BASEACCESSES, BINFO_INHERITANCE_CHAIN): Adjust. (BINFO_ELTS): Remove. (BINFO_LANG_SLOT): New. (struct tree_binfo): New. (binfo_lang_slots): Declare. (enum tree_node_structure_enum): Add TS_BINFO. (union tree_node): Add binfo. (make_tree_binfo_stat): Declare. (make_tree_binfo): New. (enum tree_node_kind): Add binfo_kind. * cp/call.c (enforce_access): Expect TREE_BINFO. * cp/class.c (binfo_ctor_vtable): Check TREE_BINFO. * cp/cp-tree.h (RECORD_OR_UNION_TYPE_CHECK): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Adjust. (BINFO_LANG_ELTS): Remove. (BINFO_LANG_SLOTS): New. (TYPE_RAISES_EXCEPTIONS, ENUM_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1. (CLASSTYPE_TEMPLATE_INFO): Adjust. * cp/pt.c (tsubst): Split TREE_BINFO case from TREE_VEC case. * cp/search.c (lookup_member): Check TREE_BINFO. * cp/semantics.c (perform_or_defer_access_check): Likewise. (check_accessibility_of_qualified_id): Check deferred_access_no_check. * cp/tree.c (make_binfo): Use make_tree_binfo. * java/class.c (make_class): Use make_tree_binfo. (set_super_info, add_interface_do): Likewise. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Expect a BINFO. * objc/objc-act.c (start_class, objc_declare_protocols, start_protocols): Use TYPE_LANG_SLOT_1. * objc/objc-act.h (CLASS_BINFO_ELTS, PROTOCOL_BINFO_ELTS): Rename to ... (CLASS_LANG_SLOT_ELTS, PROTOCOL_LANG_SLOT_ELTS): ... here. (CLASS_IVARS, CLASS_RAW_IVARS, CLASS_STATIC_TEMPLATE, CLASS_CATEGORY_LIST, CLASS_PROTOCOL_LIST, CLASS_OWN_IVARS, PROTOCOL_LIST, PROTOCOL_FORWARD_DECL): Use TYPE_LANG_SLOT_1. From-SVN: r84110
This commit is contained in:
parent
acf8677f4e
commit
95b4aca6a3
@ -1,3 +1,44 @@
|
||||
2004-07-05 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1.
|
||||
* dwarf2out.c (add_data_member_location_attribute): Check for
|
||||
TREE_BINFO.
|
||||
* tree.c (tree_node_kinds): Add "binfos".
|
||||
(binfo_lang_slots): New.
|
||||
(make_node_stat): Add TREE_BINFO.
|
||||
(make_tree_binfo_stat): New.
|
||||
(tree_node_structure): Add TREE_BINFO.
|
||||
* tree.def (TREE_BINFO): New.
|
||||
* tree.h (REC_OR_UNION_CHECK): Rename to ...
|
||||
(RECORD_OR_UNION_CHECK): ... here.
|
||||
(NOT_RECORD_OR_UNION_CHECK): New.
|
||||
(TRE_VIA_VIRTUAL): Allow TREE_LIST or TREE_BINFO.
|
||||
(TYPE_FIELDS, TYPE_METHODS, TYPE_VFIELD): Adjust for
|
||||
RECORD_OR_UNION_CHECK.
|
||||
(TYPE_BINFO): Use RECORD_OR_UNION_CHECK.
|
||||
(TYPE_LANG_SLOT_1): New.
|
||||
(BINFO_TYPE, BINFO_OFFSET, BINFO_VTABLE, BINFO_VIRTUALS,
|
||||
BINFO_BASETYPES, TYPE_BINFO_BASETYPES, BINFO_VPTR_FIELD,
|
||||
BINFO_BASEACCESSES, BINFO_INHERITANCE_CHAIN): Adjust.
|
||||
(BINFO_ELTS): Remove.
|
||||
(BINFO_LANG_SLOT): New.
|
||||
(struct tree_binfo): New.
|
||||
(binfo_lang_slots): Declare.
|
||||
(enum tree_node_structure_enum): Add TS_BINFO.
|
||||
(union tree_node): Add binfo.
|
||||
(make_tree_binfo_stat): Declare.
|
||||
(make_tree_binfo): New.
|
||||
(enum tree_node_kind): Add binfo_kind.
|
||||
|
||||
* objc/objc-act.c (start_class, objc_declare_protocols,
|
||||
start_protocols): Use TYPE_LANG_SLOT_1.
|
||||
* objc/objc-act.h (CLASS_BINFO_ELTS, PROTOCOL_BINFO_ELTS): Rename
|
||||
to ...
|
||||
(CLASS_LANG_SLOT_ELTS, PROTOCOL_LANG_SLOT_ELTS): ... here.
|
||||
(CLASS_IVARS, CLASS_RAW_IVARS, CLASS_STATIC_TEMPLATE,
|
||||
CLASS_CATEGORY_LIST, CLASS_PROTOCOL_LIST, CLASS_OWN_IVARS,
|
||||
PROTOCOL_LIST, PROTOCOL_FORWARD_DECL): Use TYPE_LANG_SLOT_1.
|
||||
|
||||
2004-07-05 Steven Bosscher <stevenb@suse.de>
|
||||
|
||||
* rtl.h (struct rtx_def): Remove the integrated flag.
|
||||
|
@ -114,7 +114,7 @@ struct lang_type GTY(())
|
||||
/* For FUNCTION_TYPE, a hidden list of types of arguments. The same as
|
||||
TYPE_ARG_TYPES for functions with prototypes, but created for functions
|
||||
without prototypes. */
|
||||
#define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_BINFO (NODE)
|
||||
#define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_LANG_SLOT_1 (NODE)
|
||||
|
||||
/* Save and restore the variables in this file and elsewhere
|
||||
that keep track of the progress of compilation of the current function.
|
||||
|
@ -1,3 +1,21 @@
|
||||
2004-07-05 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* call.c (enforce_access): Expect TREE_BINFO.
|
||||
* class.c (binfo_ctor_vtable): Check TREE_BINFO.
|
||||
* cp-tree.h (RECORD_OR_UNION_TYPE_CHECK): Remove.
|
||||
(BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF):
|
||||
Adjust.
|
||||
(BINFO_LANG_ELTS): Remove.
|
||||
(BINFO_LANG_SLOTS): New.
|
||||
(TYPE_RAISES_EXCEPTIONS, ENUM_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1.
|
||||
(CLASSTYPE_TEMPLATE_INFO): Adjust.
|
||||
* pt.c (tsubst): Split TREE_BINFO case from TREE_VEC case.
|
||||
* search.c (lookup_member): Check TREE_BINFO.
|
||||
* semantics.c (perform_or_defer_access_check): Likewise.
|
||||
(check_accessibility_of_qualified_id): Check
|
||||
deferred_access_no_check.
|
||||
* tree.c (make_binfo): Use make_tree_binfo.
|
||||
|
||||
2004-07-04 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* method.c (implicitly_declare_fn): Set linkage of generated
|
||||
|
@ -4049,7 +4049,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
|
||||
bool
|
||||
enforce_access (tree basetype_path, tree decl)
|
||||
{
|
||||
my_friendly_assert (TREE_CODE (basetype_path) == TREE_VEC, 20030624);
|
||||
my_friendly_assert (TREE_CODE (basetype_path) == TREE_BINFO, 20030624);
|
||||
|
||||
if (!accessible_p (basetype_path, decl))
|
||||
{
|
||||
|
@ -6873,7 +6873,7 @@ binfo_ctor_vtable (tree binfo)
|
||||
vt = BINFO_VTABLE (binfo);
|
||||
if (TREE_CODE (vt) == TREE_LIST)
|
||||
vt = TREE_VALUE (vt);
|
||||
if (TREE_CODE (vt) == TREE_VEC)
|
||||
if (TREE_CODE (vt) == TREE_BINFO)
|
||||
binfo = vt;
|
||||
else
|
||||
break;
|
||||
|
@ -119,7 +119,7 @@ struct diagnostic_context;
|
||||
forth as a substitute for the mark bits provided in `lang_type'.
|
||||
At present, only the six low-order bits are used.
|
||||
|
||||
TYPE_BINFO
|
||||
TYPE_LANG_SLOT_1
|
||||
For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO.
|
||||
For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS
|
||||
|
||||
@ -169,9 +169,6 @@ struct diagnostic_context;
|
||||
#define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \
|
||||
TREE_CHECK4(NODE,VAR_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL)
|
||||
|
||||
#define RECORD_OR_UNION_TYPE_CHECK(NODE) \
|
||||
TREE_CHECK2(NODE,RECORD_TYPE,UNION_TYPE)
|
||||
|
||||
#define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \
|
||||
TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM)
|
||||
|
||||
@ -1436,21 +1433,21 @@ struct lang_type GTY(())
|
||||
|
||||
/* The index in the VTT where this subobject's sub-VTT can be found.
|
||||
NULL_TREE if there is no sub-VTT. */
|
||||
#define BINFO_SUBVTT_INDEX(NODE) TREE_VEC_ELT (NODE, BINFO_ELTS + 0)
|
||||
#define BINFO_SUBVTT_INDEX(NODE) BINFO_LANG_SLOT(NODE, 0)
|
||||
|
||||
/* The index in the VTT where the vptr for this subobject can be
|
||||
found. NULL_TREE if there is no secondary vptr in the VTT. */
|
||||
#define BINFO_VPTR_INDEX(NODE) TREE_VEC_ELT (NODE, BINFO_ELTS + 1)
|
||||
#define BINFO_VPTR_INDEX(NODE) BINFO_LANG_SLOT(NODE, 1)
|
||||
|
||||
/* The binfo of which NODE is a primary base. (This is different from
|
||||
BINFO_INHERITANCE_CHAIN for virtual base because a virtual base is
|
||||
sometimes a primary base for a class for which it is not an
|
||||
immediate base.) */
|
||||
#define BINFO_PRIMARY_BASE_OF(NODE) TREE_VEC_ELT (NODE, BINFO_ELTS + 2)
|
||||
#define BINFO_PRIMARY_BASE_OF(NODE) BINFO_LANG_SLOT(NODE, 2)
|
||||
|
||||
/* C++ binfos have 3 additional entries. */
|
||||
|
||||
#define BINFO_LANG_ELTS (BINFO_ELTS + 3)
|
||||
#define BINFO_LANG_SLOTS (3)
|
||||
|
||||
/* Nonzero if this binfo is for a dependent base - one that should not
|
||||
be searched. */
|
||||
@ -1528,7 +1525,7 @@ struct lang_type GTY(())
|
||||
this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE
|
||||
will be NULL_TREE to indicate a throw specification of `()', or
|
||||
no exceptions allowed. */
|
||||
#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_BINFO (NODE)
|
||||
#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_LANG_SLOT_1 (NODE)
|
||||
|
||||
/* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */
|
||||
#define TYPE_NOTHROW_P(NODE) \
|
||||
@ -2087,13 +2084,14 @@ struct lang_decl GTY(())
|
||||
|
||||
/* Template information for a RECORD_TYPE or UNION_TYPE. */
|
||||
#define CLASSTYPE_TEMPLATE_INFO(NODE) \
|
||||
(LANG_TYPE_CLASS_CHECK (RECORD_OR_UNION_TYPE_CHECK (NODE))->template_info)
|
||||
(LANG_TYPE_CLASS_CHECK (RECORD_OR_UNION_CHECK (NODE))->template_info)
|
||||
|
||||
/* Template information for an ENUMERAL_TYPE. Although an enumeration may
|
||||
not be a primary template, it may be declared within the scope of a
|
||||
primary template and the enumeration constants may depend on
|
||||
non-type template parameters. */
|
||||
#define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (ENUMERAL_TYPE_CHECK (NODE)))
|
||||
#define ENUM_TEMPLATE_INFO(NODE) \
|
||||
(TYPE_LANG_SLOT_1 (ENUMERAL_TYPE_CHECK (NODE)))
|
||||
|
||||
/* Template information for a template template parameter. */
|
||||
#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) \
|
||||
|
41
gcc/cp/pt.c
41
gcc/cp/pt.c
@ -6877,29 +6877,30 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
|
||||
return t;
|
||||
return hash_tree_cons (purpose, value, chain);
|
||||
}
|
||||
case TREE_VEC:
|
||||
if (type != NULL_TREE)
|
||||
|
||||
case TREE_BINFO:
|
||||
/* A binfo node. We always need to make a copy, of the node
|
||||
itself and of its BINFO_BASETYPES. */
|
||||
my_friendly_assert (type, 20040628);
|
||||
|
||||
t = copy_node (t);
|
||||
|
||||
/* Make sure type isn't a typedef copy. */
|
||||
type = BINFO_TYPE (TYPE_BINFO (type));
|
||||
|
||||
TREE_TYPE (t) = complete_type (type);
|
||||
if (IS_AGGR_TYPE (type))
|
||||
{
|
||||
/* A binfo node. We always need to make a copy, of the node
|
||||
itself and of its BINFO_BASETYPES. */
|
||||
|
||||
t = copy_node (t);
|
||||
|
||||
/* Make sure type isn't a typedef copy. */
|
||||
type = BINFO_TYPE (TYPE_BINFO (type));
|
||||
|
||||
TREE_TYPE (t) = complete_type (type);
|
||||
if (IS_AGGR_TYPE (type))
|
||||
{
|
||||
BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (type);
|
||||
BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (type);
|
||||
if (TYPE_BINFO_BASETYPES (type) != NULL_TREE)
|
||||
BINFO_BASETYPES (t) = copy_node (TYPE_BINFO_BASETYPES (type));
|
||||
}
|
||||
return t;
|
||||
BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (type);
|
||||
BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (type);
|
||||
if (TYPE_BINFO_BASETYPES (type) != NULL_TREE)
|
||||
BINFO_BASETYPES (t) = copy_node (TYPE_BINFO_BASETYPES (type));
|
||||
}
|
||||
return t;
|
||||
|
||||
/* Otherwise, a vector of template arguments. */
|
||||
case TREE_VEC:
|
||||
/* A vector of template arguments. */
|
||||
my_friendly_assert (!type, 20040628);
|
||||
return tsubst_template_args (t, args, complain, in_decl);
|
||||
|
||||
case POINTER_TYPE:
|
||||
|
@ -1248,7 +1248,7 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type)
|
||||
|
||||
my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 20030624);
|
||||
|
||||
if (TREE_CODE (xbasetype) == TREE_VEC)
|
||||
if (TREE_CODE (xbasetype) == TREE_BINFO)
|
||||
{
|
||||
type = BINFO_TYPE (xbasetype);
|
||||
basetype_path = xbasetype;
|
||||
|
@ -306,7 +306,7 @@ perform_or_defer_access_check (tree binfo, tree decl)
|
||||
if (deferred_access_no_check)
|
||||
return;
|
||||
|
||||
my_friendly_assert (TREE_CODE (binfo) == TREE_VEC, 20030623);
|
||||
my_friendly_assert (TREE_CODE (binfo) == TREE_BINFO, 20030623);
|
||||
|
||||
ptr = VEC_last (deferred_access, deferred_access_stack);
|
||||
|
||||
@ -1338,6 +1338,10 @@ check_accessibility_of_qualified_id (tree decl,
|
||||
tree scope;
|
||||
tree qualifying_type = NULL_TREE;
|
||||
|
||||
/* If we're not checking, return imediately. */
|
||||
if (deferred_access_no_check)
|
||||
return;
|
||||
|
||||
/* Determine the SCOPE of DECL. */
|
||||
scope = context_for_name_lookup (decl);
|
||||
/* If the SCOPE is not a type, then DECL is not a member. */
|
||||
|
@ -771,10 +771,10 @@ hash_chainon (tree list1, tree list2)
|
||||
tree
|
||||
make_binfo (tree offset, tree binfo, tree vtable, tree virtuals)
|
||||
{
|
||||
tree new_binfo = make_tree_vec (BINFO_LANG_ELTS);
|
||||
tree new_binfo = make_tree_binfo (BINFO_LANG_SLOTS);
|
||||
tree type;
|
||||
|
||||
if (TREE_CODE (binfo) == TREE_VEC)
|
||||
if (TREE_CODE (binfo) == TREE_BINFO)
|
||||
{
|
||||
type = BINFO_TYPE (binfo);
|
||||
BINFO_DEPENDENT_BASE_P (new_binfo) = BINFO_DEPENDENT_BASE_P (binfo);
|
||||
|
@ -9468,7 +9468,7 @@ add_data_member_location_attribute (dw_die_ref die, tree decl)
|
||||
HOST_WIDE_INT offset;
|
||||
dw_loc_descr_ref loc_descr = 0;
|
||||
|
||||
if (TREE_CODE (decl) == TREE_VEC)
|
||||
if (TREE_CODE (decl) == TREE_BINFO)
|
||||
{
|
||||
/* We're working on the TAG_inheritance for a base class. */
|
||||
if (TREE_VIA_VIRTUAL (decl) && is_cxx ())
|
||||
|
@ -1,3 +1,9 @@
|
||||
2004-07-05 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* class.c (make_class): Use make_tree_binfo.
|
||||
(set_super_info, add_interface_do): Likewise.
|
||||
* java-tree.h (CLASS_HAS_SUPER_FLAG): Expect a BINFO.
|
||||
|
||||
2004-07-04 Ranjit Mathew <rmathew@hotmail.com>
|
||||
|
||||
* verify.c: Correct array element access formatting thinko.
|
||||
@ -8161,7 +8167,7 @@
|
||||
properly initialize `finished_label'. Don't emit gotos for empty
|
||||
try statements.
|
||||
|
||||
2000-03-19 Martin v. Löwis <loewis@informatik.hu-berlin.de>
|
||||
2000-03-19 Martin v. Löwis <loewis@informatik.hu-berlin.de>
|
||||
|
||||
* except.c (emit_handlers): Clear catch_clauses_last.
|
||||
|
||||
|
@ -318,7 +318,7 @@ make_class (void)
|
||||
{
|
||||
tree type;
|
||||
type = make_node (RECORD_TYPE);
|
||||
TYPE_BINFO (type) = make_tree_vec (BINFO_ELTS);
|
||||
TYPE_BINFO (type) = make_tree_binfo (0);
|
||||
MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type);
|
||||
|
||||
return type;
|
||||
@ -480,7 +480,7 @@ set_super_info (int access_flags, tree this_class,
|
||||
TYPE_BINFO_BASETYPES (this_class) = make_tree_vec (total_supers);
|
||||
if (super_class)
|
||||
{
|
||||
tree super_binfo = make_tree_vec (BINFO_ELTS);
|
||||
tree super_binfo = make_tree_binfo (0);
|
||||
BINFO_TYPE (super_binfo) = super_class;
|
||||
BINFO_OFFSET (super_binfo) = integer_zero_node;
|
||||
TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (this_class)), 0)
|
||||
@ -612,7 +612,7 @@ common_enclosing_context_p (tree type1, tree type2)
|
||||
static void
|
||||
add_interface_do (tree basetype_vec, tree interface_class, int i)
|
||||
{
|
||||
tree interface_binfo = make_tree_vec (BINFO_ELTS);
|
||||
tree interface_binfo = make_tree_binfo (0);
|
||||
BINFO_TYPE (interface_binfo) = interface_class;
|
||||
BINFO_OFFSET (interface_binfo) = integer_zero_node;
|
||||
BINFO_VPTR_FIELD (interface_binfo) = integer_zero_node;
|
||||
|
@ -48,7 +48,7 @@ struct JCF;
|
||||
SUPPRESS_UNREACHABLE_ERROR (for other _EXPR nodes)
|
||||
ANONYMOUS_CLASS_P (in RECORD_TYPE)
|
||||
ARG_FINAL_P (in TREE_LIST)
|
||||
1: CLASS_HAS_SUPER_FLAG (in TREE_VEC).
|
||||
1: CLASS_HAS_SUPER_FLAG (in TREE_BINFO).
|
||||
IS_A_CLASSFILE_NAME (in IDENTIFIER_NODE)
|
||||
COMPOUND_ASSIGN_P (in EXPR (binop_*))
|
||||
LOCAL_CLASS_P (in RECORD_TYPE)
|
||||
@ -122,7 +122,7 @@ struct JCF;
|
||||
|
||||
/* True if the class whose TYPE_BINFO this is has a superclass.
|
||||
(True of all classes except Object.) */
|
||||
#define CLASS_HAS_SUPER_FLAG(BINFO) TREE_LANG_FLAG_1 (TREE_VEC_CHECK (BINFO))
|
||||
#define CLASS_HAS_SUPER_FLAG(BINFO) TREE_LANG_FLAG_1 (TREE_BINFO_CHECK (BINFO))
|
||||
#define CLASS_HAS_SUPER(TYPE) CLASS_HAS_SUPER_FLAG (TYPE_BINFO (TYPE))
|
||||
|
||||
/* Return the supertype of class TYPE, or NULL_TREE is it has none. */
|
||||
|
@ -6761,7 +6761,7 @@ start_class (enum tree_code code, tree class_name, tree super_name,
|
||||
}
|
||||
|
||||
class = make_node (code);
|
||||
TYPE_BINFO (class) = make_tree_vec (CLASS_BINFO_ELTS);
|
||||
TYPE_LANG_SLOT_1 (class) = make_tree_vec (CLASS_LANG_SLOT_ELTS);
|
||||
|
||||
CLASS_NAME (class) = class_name;
|
||||
CLASS_SUPER_NAME (class) = super_name;
|
||||
@ -7050,7 +7050,8 @@ objc_declare_protocols (tree names)
|
||||
{
|
||||
tree protocol = make_node (PROTOCOL_INTERFACE_TYPE);
|
||||
|
||||
TYPE_BINFO (protocol) = make_tree_vec (2);
|
||||
TYPE_LANG_SLOT_1 (protocol)
|
||||
= make_tree_vec (PROTOCOL_LANG_SLOT_ELTS);
|
||||
PROTOCOL_NAME (protocol) = name;
|
||||
PROTOCOL_LIST (protocol) = NULL_TREE;
|
||||
add_protocol (protocol);
|
||||
@ -7081,7 +7082,7 @@ start_protocol (enum tree_code code, tree name, tree list)
|
||||
if (!protocol)
|
||||
{
|
||||
protocol = make_node (code);
|
||||
TYPE_BINFO (protocol) = make_tree_vec (2);
|
||||
TYPE_LANG_SLOT_1 (protocol) = make_tree_vec (PROTOCOL_LANG_SLOT_ELTS);
|
||||
|
||||
PROTOCOL_NAME (protocol) = name;
|
||||
PROTOCOL_LIST (protocol) = lookup_and_install_protocols (list);
|
||||
|
@ -82,8 +82,8 @@ tree build_encode_expr (tree);
|
||||
|
||||
/* Objective-C structures */
|
||||
|
||||
#define CLASS_BINFO_ELTS 6
|
||||
#define PROTOCOL_BINFO_ELTS 2
|
||||
#define CLASS_LANG_SLOT_ELTS 6
|
||||
#define PROTOCOL_LANG_SLOT_ELTS 2
|
||||
|
||||
/* KEYWORD_DECL */
|
||||
#define KEYWORD_KEY_NAME(DECL) ((DECL)->decl.name)
|
||||
@ -101,19 +101,19 @@ tree build_encode_expr (tree);
|
||||
PROTOCOL_INTERFACE_TYPE */
|
||||
#define CLASS_NAME(CLASS) ((CLASS)->type.name)
|
||||
#define CLASS_SUPER_NAME(CLASS) (TYPE_CHECK (CLASS)->type.context)
|
||||
#define CLASS_IVARS(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 0)
|
||||
#define CLASS_RAW_IVARS(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 1)
|
||||
#define CLASS_IVARS(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 0)
|
||||
#define CLASS_RAW_IVARS(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 1)
|
||||
#define CLASS_NST_METHODS(CLASS) ((CLASS)->type.minval)
|
||||
#define CLASS_CLS_METHODS(CLASS) ((CLASS)->type.maxval)
|
||||
#define CLASS_STATIC_TEMPLATE(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 2)
|
||||
#define CLASS_CATEGORY_LIST(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 3)
|
||||
#define CLASS_PROTOCOL_LIST(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 4)
|
||||
#define CLASS_OWN_IVARS(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 5)
|
||||
#define CLASS_STATIC_TEMPLATE(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 2)
|
||||
#define CLASS_CATEGORY_LIST(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 3)
|
||||
#define CLASS_PROTOCOL_LIST(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 4)
|
||||
#define CLASS_OWN_IVARS(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 5)
|
||||
#define PROTOCOL_NAME(CLASS) ((CLASS)->type.name)
|
||||
#define PROTOCOL_LIST(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 0)
|
||||
#define PROTOCOL_LIST(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 0)
|
||||
#define PROTOCOL_NST_METHODS(CLASS) ((CLASS)->type.minval)
|
||||
#define PROTOCOL_CLS_METHODS(CLASS) ((CLASS)->type.maxval)
|
||||
#define PROTOCOL_FORWARD_DECL(CLASS) TREE_VEC_ELT (TYPE_BINFO (CLASS), 1)
|
||||
#define PROTOCOL_FORWARD_DECL(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 1)
|
||||
#define PROTOCOL_DEFINED(CLASS) TREE_USED (CLASS)
|
||||
/* We need to distinguish TYPE_PROTOCOL_LISTs from TYPE_CONTEXTs, both of which
|
||||
are stored in the same accessor slot. */
|
||||
|
40
gcc/tree.c
40
gcc/tree.c
@ -71,6 +71,7 @@ static const char * const tree_node_kind_names[] = {
|
||||
"perm_tree_lists",
|
||||
"temp_tree_lists",
|
||||
"vecs",
|
||||
"binfos",
|
||||
"phi_nodes",
|
||||
"ssa names",
|
||||
"random kinds",
|
||||
@ -93,6 +94,9 @@ struct type_hash GTY(())
|
||||
tree type;
|
||||
};
|
||||
|
||||
/* Additional language-dependent binfo slots. */
|
||||
unsigned binfo_lang_slots;
|
||||
|
||||
/* Initial size of the hash table (rounded to next prime). */
|
||||
#define TYPE_HASH_INITIAL_SIZE 1000
|
||||
|
||||
@ -267,6 +271,8 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
|
||||
kind = id_kind;
|
||||
else if (code == TREE_VEC)
|
||||
kind = vec_kind;
|
||||
else if (code == TREE_BINFO)
|
||||
kind = binfo_kind;
|
||||
else if (code == PHI_NODE)
|
||||
kind = phi_kind;
|
||||
else if (code == SSA_NAME)
|
||||
@ -573,6 +579,39 @@ build_complex (tree type, tree real, tree imag)
|
||||
return t;
|
||||
}
|
||||
|
||||
/* Build a BINFO with LEN language slots. */
|
||||
|
||||
tree
|
||||
make_tree_binfo_stat (unsigned lang_slots MEM_STAT_DECL)
|
||||
{
|
||||
tree t;
|
||||
static unsigned length;
|
||||
|
||||
if (!length)
|
||||
{
|
||||
length = (offsetof (struct tree_binfo, lang_slots)
|
||||
+ (sizeof (((struct tree_binfo *)0)->lang_slots[0])
|
||||
* lang_slots));
|
||||
binfo_lang_slots = lang_slots;
|
||||
}
|
||||
else if (binfo_lang_slots != lang_slots)
|
||||
abort ();
|
||||
|
||||
#ifdef GATHER_STATISTICS
|
||||
tree_node_counts[(int) binfo_kind]++;
|
||||
tree_node_sizes[(int) binfo_kind] += length;
|
||||
#endif
|
||||
|
||||
t = ggc_alloc_zone_stat (length, tree_zone PASS_MEM_STAT);
|
||||
|
||||
memset (t, 0, length);
|
||||
|
||||
TREE_SET_CODE (t, TREE_BINFO);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
/* Build a newly constructed TREE_VEC node of length LEN. */
|
||||
|
||||
tree
|
||||
@ -1493,6 +1532,7 @@ tree_node_structure (tree t)
|
||||
case PLACEHOLDER_EXPR: return TS_COMMON;
|
||||
case STATEMENT_LIST: return TS_STATEMENT_LIST;
|
||||
case BLOCK: return TS_BLOCK;
|
||||
case TREE_BINFO: return TS_BINFO;
|
||||
case VALUE_HANDLE: return TS_VALUE_HANDLE;
|
||||
|
||||
default:
|
||||
|
@ -903,6 +903,10 @@ DEFTREECODE (STATEMENT_LIST, "statement_list", 'x', 0)
|
||||
the same value, they will be assigned the same value handle. */
|
||||
DEFTREECODE (VALUE_HANDLE, "value_handle", 'x', 0)
|
||||
|
||||
/* Base class information. Holds information about a class as a
|
||||
baseclass of itself or another class. */
|
||||
DEFTREECODE (TREE_BINFO, "tree_binfo", 'x', 0)
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode:c
|
||||
|
71
gcc/tree.h
71
gcc/tree.h
@ -203,7 +203,7 @@ struct tree_common GTY(())
|
||||
TREE_STATIC in
|
||||
VAR_DECL, FUNCTION_DECL, CONSTRUCTOR, ADDR_EXPR
|
||||
TREE_VIA_VIRTUAL in
|
||||
TREE_LIST or TREE_VEC
|
||||
TREE_LIST or TREE_BINFO
|
||||
TREE_CONSTANT_OVERFLOW in
|
||||
INTEGER_CST, REAL_CST, COMPLEX_CST, VECTOR_CST
|
||||
TREE_SYMBOL_REFERENCED in
|
||||
@ -558,8 +558,10 @@ extern void tree_operand_check_failed (int, enum tree_code,
|
||||
#define SET_OR_ARRAY_CHECK(T) \
|
||||
TREE_CHECK2 (T, ARRAY_TYPE, SET_TYPE)
|
||||
|
||||
#define REC_OR_UNION_CHECK(T) \
|
||||
#define RECORD_OR_UNION_CHECK(T) \
|
||||
TREE_CHECK3 (T, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE)
|
||||
#define NOT_RECORD_OR_UNION_CHECK(T) \
|
||||
TREE_NOT_CHECK3 (T, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE)
|
||||
|
||||
#define NUMERICAL_TYPE_CHECK(T) \
|
||||
TREE_CHECK5 (T, INTEGER_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, \
|
||||
@ -736,10 +738,10 @@ extern void tree_operand_check_failed (int, enum tree_code,
|
||||
implicitly and should not lead to any sort of warning. */
|
||||
#define TREE_NO_WARNING(NODE) ((NODE)->common.nowarning_flag)
|
||||
|
||||
/* Nonzero for a TREE_LIST or TREE_VEC node means that the derivation
|
||||
/* Nonzero for a TREE_LIST or TREE_BINFO node means that the derivation
|
||||
chain is via a `virtual' declaration. */
|
||||
#define TREE_VIA_VIRTUAL(NODE) \
|
||||
(TREE_CHECK2 (NODE, TREE_LIST, TREE_VEC)->common.static_flag)
|
||||
(TREE_CHECK2 (NODE, TREE_LIST, TREE_BINFO)->common.static_flag)
|
||||
|
||||
/* In an INTEGER_CST, REAL_CST, COMPLEX_CST, or VECTOR_CST this means
|
||||
there was an overflow in folding. This is distinct from
|
||||
@ -1366,9 +1368,9 @@ struct tree_block GTY(())
|
||||
#define TYPE_ORIG_SIZE_TYPE(NODE) (INTEGER_TYPE_CHECK (NODE)->type.values)
|
||||
#define TYPE_VALUES(NODE) (ENUMERAL_TYPE_CHECK (NODE)->type.values)
|
||||
#define TYPE_DOMAIN(NODE) (SET_OR_ARRAY_CHECK (NODE)->type.values)
|
||||
#define TYPE_FIELDS(NODE) (REC_OR_UNION_CHECK (NODE)->type.values)
|
||||
#define TYPE_METHODS(NODE) (REC_OR_UNION_CHECK (NODE)->type.maxval)
|
||||
#define TYPE_VFIELD(NODE) (REC_OR_UNION_CHECK (NODE)->type.minval)
|
||||
#define TYPE_FIELDS(NODE) (RECORD_OR_UNION_CHECK (NODE)->type.values)
|
||||
#define TYPE_METHODS(NODE) (RECORD_OR_UNION_CHECK (NODE)->type.maxval)
|
||||
#define TYPE_VFIELD(NODE) (RECORD_OR_UNION_CHECK (NODE)->type.minval)
|
||||
#define TYPE_ARG_TYPES(NODE) (FUNC_OR_METHOD_CHECK (NODE)->type.values)
|
||||
#define TYPE_METHOD_BASETYPE(NODE) (FUNC_OR_METHOD_CHECK (NODE)->type.maxval)
|
||||
#define TYPE_OFFSET_BASETYPE(NODE) (OFFSET_TYPE_CHECK (NODE)->type.maxval)
|
||||
@ -1393,10 +1395,12 @@ struct tree_block GTY(())
|
||||
structure containing an array. */
|
||||
#define TYPE_DEBUG_REPRESENTATION_TYPE(NODE) (VECTOR_TYPE_CHECK (NODE)->type.values)
|
||||
|
||||
/* For aggregate types, information about this type, as a base type
|
||||
for itself. Used in a language-dependent way for types that are
|
||||
neither a RECORD_TYPE, QUAL_UNION_TYPE, nor a UNION_TYPE. */
|
||||
#define TYPE_BINFO(NODE) (TYPE_CHECK (NODE)->type.binfo)
|
||||
/* For record and union types, information about this type, as a base type
|
||||
for itself. */
|
||||
#define TYPE_BINFO(NODE) (RECORD_OR_UNION_CHECK(NODE)->type.binfo)
|
||||
|
||||
/* For non record and union types, used in a language-dependent way. */
|
||||
#define TYPE_LANG_SLOT_1(NODE) (NOT_RECORD_OR_UNION_CHECK(NODE)->type.binfo)
|
||||
|
||||
/* The (language-specific) typed-based alias set for this type.
|
||||
Objects whose TYPE_ALIAS_SETs are different cannot alias each
|
||||
@ -1594,7 +1598,7 @@ struct tree_type GTY(())
|
||||
of D acting as a basetype for C by looking at C's binfo's basetypes. */
|
||||
|
||||
/* The actual data type node being inherited in this basetype. */
|
||||
#define BINFO_TYPE(NODE) TREE_TYPE (NODE)
|
||||
#define BINFO_TYPE(NODE) TREE_TYPE (TREE_BINFO_CHECK(NODE))
|
||||
|
||||
/* The offset where this basetype appears in its containing type.
|
||||
BINFO_OFFSET slot holds the offset (in bytes)
|
||||
@ -1602,7 +1606,7 @@ struct tree_type GTY(())
|
||||
object that is allocated on behalf of this `type'.
|
||||
This is always 0 except when there is multiple inheritance. */
|
||||
|
||||
#define BINFO_OFFSET(NODE) TREE_VEC_ELT ((NODE), 1)
|
||||
#define BINFO_OFFSET(NODE) (TREE_BINFO_CHECK(NODE)->binfo.offset)
|
||||
#define TYPE_BINFO_OFFSET(NODE) BINFO_OFFSET (TYPE_BINFO (NODE))
|
||||
#define BINFO_OFFSET_ZEROP(NODE) (integer_zerop (BINFO_OFFSET (NODE)))
|
||||
|
||||
@ -1610,13 +1614,13 @@ struct tree_type GTY(())
|
||||
function tables provide a mechanism for run-time method dispatching.
|
||||
The entries of a virtual function table are language-dependent. */
|
||||
|
||||
#define BINFO_VTABLE(NODE) TREE_VEC_ELT ((NODE), 2)
|
||||
#define BINFO_VTABLE(NODE) (TREE_BINFO_CHECK(NODE)->binfo.vtable)
|
||||
#define TYPE_BINFO_VTABLE(NODE) BINFO_VTABLE (TYPE_BINFO (NODE))
|
||||
|
||||
/* The virtual functions in the virtual function table. This is
|
||||
a TREE_LIST that is used as an initial approximation for building
|
||||
a virtual function table for this basetype. */
|
||||
#define BINFO_VIRTUALS(NODE) TREE_VEC_ELT ((NODE), 3)
|
||||
#define BINFO_VIRTUALS(NODE) (TREE_BINFO_CHECK(NODE)->binfo.virtuals)
|
||||
#define TYPE_BINFO_VIRTUALS(NODE) BINFO_VIRTUALS (TYPE_BINFO (NODE))
|
||||
|
||||
/* A vector of binfos for the direct basetypes inherited by this
|
||||
@ -1630,8 +1634,8 @@ struct tree_type GTY(())
|
||||
base types at the end of this TREE_VEC (instead of using
|
||||
another TREE_VEC). This would simplify the calculation
|
||||
of how many basetypes a given type had. */
|
||||
#define BINFO_BASETYPES(NODE) TREE_VEC_ELT ((NODE), 4)
|
||||
#define TYPE_BINFO_BASETYPES(NODE) TREE_VEC_ELT (TYPE_BINFO (NODE), 4)
|
||||
#define BINFO_BASETYPES(NODE) (TREE_BINFO_CHECK(NODE)->binfo.base_types)
|
||||
#define TYPE_BINFO_BASETYPES(NODE) BINFO_BASETYPES (TYPE_BINFO (NODE))
|
||||
|
||||
/* The number of basetypes for NODE. */
|
||||
#define BINFO_N_BASETYPES(NODE) \
|
||||
@ -1647,18 +1651,18 @@ struct tree_type GTY(())
|
||||
base. The actual contents are language-dependent. In the C++
|
||||
front-end this field is an INTEGER_CST giving an offset into the
|
||||
vtable where the offset to the virtual base can be found. */
|
||||
#define BINFO_VPTR_FIELD(NODE) TREE_VEC_ELT (NODE, 5)
|
||||
#define BINFO_VPTR_FIELD(NODE) (TREE_BINFO_CHECK(NODE)->binfo.vptr_field)
|
||||
|
||||
/* Indicates the accesses this binfo has to its bases. The values are
|
||||
access_public_node, access_protected_node or access_private_node.
|
||||
If this array is not present, public access is implied. */
|
||||
#define BINFO_BASEACCESSES(NODE) TREE_VEC_ELT ((NODE), 6)
|
||||
#define BINFO_BASEACCESSES(NODE) (TREE_BINFO_CHECK(NODE)->binfo.base_accesses)
|
||||
#define BINFO_BASEACCESS(NODE,N) TREE_VEC_ELT (BINFO_BASEACCESSES(NODE), (N))
|
||||
|
||||
/* Number of language independent elements in a binfo. Languages may
|
||||
add additional trailing elements. */
|
||||
|
||||
#define BINFO_ELTS 7
|
||||
#define BINFO_LANG_SLOT(NODE,N) (TREE_BINFO_CHECK(NODE)->binfo.lang_slots[N])
|
||||
|
||||
/* Slot used to build a chain that represents a use of inheritance.
|
||||
For example, if X is derived from Y, and Y is derived from Z,
|
||||
@ -1671,7 +1675,25 @@ struct tree_type GTY(())
|
||||
consing new space pointing to binfo nodes).
|
||||
It is up to the language-dependent front-ends to maintain
|
||||
this information as necessary. */
|
||||
#define BINFO_INHERITANCE_CHAIN(NODE) TREE_VEC_ELT ((NODE), 0)
|
||||
#define BINFO_INHERITANCE_CHAIN(NODE) \
|
||||
(TREE_BINFO_CHECK(NODE)->binfo.inheritance)
|
||||
|
||||
struct tree_binfo GTY (())
|
||||
{
|
||||
struct tree_common common;
|
||||
|
||||
tree offset;
|
||||
tree vtable;
|
||||
tree virtuals;
|
||||
tree base_types;
|
||||
tree vptr_field;
|
||||
tree base_accesses;
|
||||
tree inheritance;
|
||||
|
||||
tree GTY ((length ("binfo_lang_slots"))) lang_slots[1];
|
||||
};
|
||||
extern GTY (()) unsigned binfo_lang_slots;
|
||||
|
||||
|
||||
/* Define fields and accessors for nodes representing declared names. */
|
||||
|
||||
@ -2313,6 +2335,7 @@ enum tree_node_structure_enum {
|
||||
TS_SSA_NAME,
|
||||
TS_PHI_NODE,
|
||||
TS_BLOCK,
|
||||
TS_BINFO,
|
||||
TS_STATEMENT_LIST,
|
||||
TS_VALUE_HANDLE,
|
||||
LAST_TS_ENUM
|
||||
@ -2340,6 +2363,7 @@ union tree_node GTY ((ptr_alias (union lang_tree_node),
|
||||
struct tree_ssa_name GTY ((tag ("TS_SSA_NAME"))) ssa_name;
|
||||
struct tree_phi_node GTY ((tag ("TS_PHI_NODE"))) phi;
|
||||
struct tree_block GTY ((tag ("TS_BLOCK"))) block;
|
||||
struct tree_binfo GTY ((tag ("TS_BINFO"))) binfo;
|
||||
struct tree_statement_list GTY ((tag ("TS_STATEMENT_LIST"))) stmt_list;
|
||||
struct tree_value_handle GTY ((tag ("TS_VALUE_HANDLE"))) value_handle;
|
||||
};
|
||||
@ -2587,6 +2611,10 @@ extern tree copy_node_stat (tree MEM_STAT_DECL);
|
||||
|
||||
extern tree copy_list (tree);
|
||||
|
||||
/* Make a BINFO. */
|
||||
extern tree make_tree_binfo_stat (unsigned MEM_STAT_DECL);
|
||||
#define make_tree_binfo(t) make_tree_binfo_stat (t MEM_STAT_INFO)
|
||||
|
||||
/* Make a TREE_VEC. */
|
||||
|
||||
extern tree make_tree_vec_stat (int MEM_STAT_DECL);
|
||||
@ -3727,6 +3755,7 @@ typedef enum
|
||||
perm_list_kind,
|
||||
temp_list_kind,
|
||||
vec_kind,
|
||||
binfo_kind,
|
||||
phi_kind,
|
||||
ssa_name_kind,
|
||||
x_kind,
|
||||
|
Loading…
Reference in New Issue
Block a user