* 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
+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.
/* 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.
+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
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))
{
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;
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
#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)
/* 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. */
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) \
/* 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) \
return t;
return hash_tree_cons (purpose, value, chain);
}
- case TREE_VEC:
- if (type != NULL_TREE)
- {
- /* 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));
+
+ 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);
- 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;
+ /* 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;
- /* 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:
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;
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);
{
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);
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);
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 ())
+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.
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.
{
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;
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)
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;
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)
/* 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. */
}
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;
{
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);
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);
/* 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)
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. */
"perm_tree_lists",
"temp_tree_lists",
"vecs",
+ "binfos",
"phi_nodes",
"ssa names",
"random kinds",
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
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)
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
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:
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
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
#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, \
CHAR_TYPE, REAL_TYPE)
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
#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)
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
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)
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)))
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
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) \
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,
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;
+
\f
/* Define fields and accessors for nodes representing declared names. */
TS_SSA_NAME,
TS_PHI_NODE,
TS_BLOCK,
+ TS_BINFO,
TS_STATEMENT_LIST,
TS_VALUE_HANDLE,
LAST_TS_ENUM
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;
};
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);
perm_list_kind,
temp_list_kind,
vec_kind,
+ binfo_kind,
phi_kind,
ssa_name_kind,
x_kind,