mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-23 21:31:54 +08:00
system.c (IN_RANGE): Use plain unsigned, not unsigned HOST_WIDE_INT.
* system.c (IN_RANGE): Use plain unsigned, not unsigned HOST_WIDE_INT. * tree.def (VOID_TYPE, INTEGER_TYPE, REAL_TYPE, COMPLEX_TYPE, VECTOR_TYPE, OFFSET_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, CHAR_TYPE, POINTER_TYPE, REFERENCE_TYPE, METHOD_TYPE, FUNCTION_TYPE, FILE_TYPE, ARRAY_TYPE, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE): Reorder for better code efficiency. (CONST_DECL, TYPE_DECL, VAR_DECL, FIELD_DECL, PARM_DECL): Likewise. (INDIRECT_REF, ALIGN_INDIRECT_REF, MISALIGNED_INDIRECT_REF): Likewise. * tree.h (INDIRECT_REF_P): Reorder checks for better optimization. (IS_EXPR_CODE_CLASS): Use IN_RANGE. (INTEGRAL_TYPE_P, FLOAT_TYPE_P): Reorder checks for better optimization. * cp/cp-tree.def (TEMPLATE_TYPE_PARM, BOUND_TEMPLATE_TEMPLATE_PARM, TYPE_OF_TYPE, TYPENAME_TYPE): Reorder for better code efficiency. * cp/cp-tree.h (CLASS_TYPE_P): Short circuit IS_AGGR_TYPE check. (CAN_HAVE_FULL_LANG_DECL_P): Reorder for better optimization. (INTEGRAL_CODE_P, CP_INTEGRAL_TYPE_P, INTEGRAL_OR_ENUMERATION_TYPE_P, SCALAR_TYPE_P, CP_AGGREGATE_TYPE_P, TYPE_PTROB_P, TYPE_REF_OBJ_P, TYPE_PTROBV_P): Likewise. From-SVN: r92463
This commit is contained in:
parent
1763d00076
commit
38b3627d6f
@ -1,3 +1,19 @@
|
||||
2004-12-21 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* system.c (IN_RANGE): Use plain unsigned, not unsigned
|
||||
HOST_WIDE_INT.
|
||||
* tree.def (VOID_TYPE, INTEGER_TYPE, REAL_TYPE, COMPLEX_TYPE,
|
||||
VECTOR_TYPE, OFFSET_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, CHAR_TYPE,
|
||||
POINTER_TYPE, REFERENCE_TYPE, METHOD_TYPE, FUNCTION_TYPE,
|
||||
FILE_TYPE, ARRAY_TYPE, RECORD_TYPE, UNION_TYPE,
|
||||
QUAL_UNION_TYPE): Reorder for better code efficiency.
|
||||
(CONST_DECL, TYPE_DECL, VAR_DECL, FIELD_DECL, PARM_DECL): Likewise.
|
||||
(INDIRECT_REF, ALIGN_INDIRECT_REF, MISALIGNED_INDIRECT_REF): Likewise.
|
||||
* tree.h (INDIRECT_REF_P): Reorder checks for better optimization.
|
||||
(IS_EXPR_CODE_CLASS): Use IN_RANGE.
|
||||
(INTEGRAL_TYPE_P, FLOAT_TYPE_P): Reorder checks for better
|
||||
optimization.
|
||||
|
||||
2004-12-21 David O'Brien <obrien@FreeBSD.org>
|
||||
|
||||
* config/freebsd-spec.h: Use KSE pthread lib for -pthread.
|
||||
|
@ -1,5 +1,15 @@
|
||||
2004-12-21 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* cp-tree.def (TEMPLATE_TYPE_PARM,
|
||||
BOUND_TEMPLATE_TEMPLATE_PARM, TYPE_OF_TYPE, TYPENAME_TYPE): Reorder
|
||||
for better code efficiency.
|
||||
* cp-tree.h (CLASS_TYPE_P): Short circuit IS_AGGR_TYPE check.
|
||||
(CAN_HAVE_FULL_LANG_DECL_P): Reorder for better optimization.
|
||||
(INTEGRAL_CODE_P, CP_INTEGRAL_TYPE_P,
|
||||
INTEGRAL_OR_ENUMERATION_TYPE_P, SCALAR_TYPE_P,
|
||||
CP_AGGREGATE_TYPE_P, TYPE_PTROB_P, TYPE_REF_OBJ_P,
|
||||
TYPE_PTROBV_P): Likewise.
|
||||
|
||||
PR c++/18975
|
||||
* method.c (do_build_copy_constructor): Refactor. Don't const
|
||||
qualify a mutable field.
|
||||
|
@ -159,10 +159,6 @@ DEFTREECODE (TEMPLATE_DECL, "template_decl", tcc_declaration, 0)
|
||||
worrying about instantiating things. */
|
||||
DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", tcc_exceptional, 0)
|
||||
|
||||
/* Index into a template parameter list. This parameter must be a type.
|
||||
The type.value field will be a TEMPLATE_PARM_INDEX. */
|
||||
DEFTREECODE (TEMPLATE_TYPE_PARM, "template_type_parm", tcc_type, 0)
|
||||
|
||||
/* Index into a template parameter list for template template parameters.
|
||||
This parameter must be a type. The TYPE_FIELDS value will be a
|
||||
TEMPLATE_PARM_INDEX.
|
||||
@ -172,12 +168,14 @@ DEFTREECODE (TEMPLATE_TYPE_PARM, "template_type_parm", tcc_type, 0)
|
||||
and TYPE_NAME is a TEMPLATE_DECL. */
|
||||
DEFTREECODE (TEMPLATE_TEMPLATE_PARM, "template_template_parm", tcc_type, 0)
|
||||
|
||||
/* Like TEMPLATE_TEMPLATE_PARM it is used with bound template arguments
|
||||
like TT<int>.
|
||||
In this case, TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO contains the
|
||||
template name and its bound arguments. TYPE_NAME is a TYPE_DECL. */
|
||||
DEFTREECODE (BOUND_TEMPLATE_TEMPLATE_PARM, "bound_template_template_parm",
|
||||
tcc_type, 0)
|
||||
/* The ordering of the following codes is optimized for the checking
|
||||
macros in tree.h. Changing the order will degrade the speed of the
|
||||
compiler. TEMPLATE_TYPE_PARM, TYPENAME_TYPE, TYPEOF_TYPE,
|
||||
BOUND_TEMPLATE_TEMPLATE_PARM. */
|
||||
|
||||
/* Index into a template parameter list. This parameter must be a type.
|
||||
The type.value field will be a TEMPLATE_PARM_INDEX. */
|
||||
DEFTREECODE (TEMPLATE_TYPE_PARM, "template_type_parm", tcc_type, 0)
|
||||
|
||||
/* A type designated by `typename T::t'. TYPE_CONTEXT is `T',
|
||||
TYPE_NAME is an IDENTIFIER_NODE for `t'. If the type was named via
|
||||
@ -185,15 +183,22 @@ DEFTREECODE (BOUND_TEMPLATE_TEMPLATE_PARM, "bound_template_template_parm",
|
||||
TREE_TYPE is always NULL. */
|
||||
DEFTREECODE (TYPENAME_TYPE, "typename_type", tcc_type, 0)
|
||||
|
||||
/* A type designated by `__typeof (expr)'. TYPEOF_TYPE_EXPR is the
|
||||
expression in question. */
|
||||
DEFTREECODE (TYPEOF_TYPE, "typeof_type", tcc_type, 0)
|
||||
|
||||
/* Like TEMPLATE_TEMPLATE_PARM it is used with bound template arguments
|
||||
like TT<int>.
|
||||
In this case, TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO contains the
|
||||
template name and its bound arguments. TYPE_NAME is a TYPE_DECL. */
|
||||
DEFTREECODE (BOUND_TEMPLATE_TEMPLATE_PARM, "bound_template_template_parm",
|
||||
tcc_type, 0)
|
||||
|
||||
/* For template template argument of the form `T::template C'.
|
||||
TYPE_CONTEXT is `T', the template parameter dependent object.
|
||||
TYPE_NAME is an IDENTIFIER_NODE for `C', the member class template. */
|
||||
DEFTREECODE (UNBOUND_CLASS_TEMPLATE, "unbound_class_template", tcc_type, 0)
|
||||
|
||||
/* A type designated by `__typeof (expr)'. TYPEOF_TYPE_EXPR is the
|
||||
expression in question. */
|
||||
DEFTREECODE (TYPEOF_TYPE, "typeof_type", tcc_type, 0)
|
||||
|
||||
/* A using declaration. DECL_INITIAL contains the specified scope.
|
||||
This is not an alias, but is later expanded into multiple aliases.
|
||||
The decl will have a NULL_TYPE iff the scope is a dependent scope,
|
||||
|
@ -865,7 +865,8 @@ enum languages { lang_c, lang_cplusplus, lang_java };
|
||||
for template type parameters, typename types, and instantiated
|
||||
template template parameters. Despite its name,
|
||||
this macro has nothing to do with the definition of aggregate given
|
||||
in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. */
|
||||
in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. Keep
|
||||
these checks in ascending code order. */
|
||||
#define IS_AGGR_TYPE(T) \
|
||||
(TREE_CODE (T) == TEMPLATE_TYPE_PARM \
|
||||
|| TREE_CODE (T) == TYPENAME_TYPE \
|
||||
@ -881,9 +882,11 @@ enum languages { lang_c, lang_cplusplus, lang_java };
|
||||
/* Nonzero if T is a class type. Zero for template type parameters,
|
||||
typename types, and so forth. */
|
||||
#define CLASS_TYPE_P(T) \
|
||||
(IS_AGGR_TYPE_CODE (TREE_CODE (T)) && IS_AGGR_TYPE (T))
|
||||
(IS_AGGR_TYPE_CODE (TREE_CODE (T)) && TYPE_LANG_FLAG_5 (T))
|
||||
|
||||
#define IS_AGGR_TYPE_CODE(T) ((T) == RECORD_TYPE || (T) == UNION_TYPE)
|
||||
/* Keep these checks in ascending code order. */
|
||||
#define IS_AGGR_TYPE_CODE(T) \
|
||||
((T) == RECORD_TYPE || (T) == UNION_TYPE)
|
||||
#define TAGGED_TYPE_P(T) \
|
||||
(CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE)
|
||||
#define IS_OVERLOAD_TYPE(T) TAGGED_TYPE_P (T)
|
||||
@ -1485,11 +1488,12 @@ struct lang_type GTY(())
|
||||
/* If a DECL has DECL_LANG_SPECIFIC, it is either a lang_decl_flags or
|
||||
a lang_decl (which has lang_decl_flags as its initial prefix).
|
||||
This macro is nonzero for tree nodes whose DECL_LANG_SPECIFIC is
|
||||
the full lang_decl, and not just lang_decl_flags. */
|
||||
#define CAN_HAVE_FULL_LANG_DECL_P(NODE) \
|
||||
(!(TREE_CODE (NODE) == VAR_DECL \
|
||||
|| TREE_CODE (NODE) == CONST_DECL \
|
||||
|| TREE_CODE (NODE) == FIELD_DECL \
|
||||
the full lang_decl, and not just lang_decl_flags. Keep these
|
||||
checks in ascending code order. */
|
||||
#define CAN_HAVE_FULL_LANG_DECL_P(NODE) \
|
||||
(!(TREE_CODE (NODE) == FIELD_DECL \
|
||||
|| TREE_CODE (NODE) == VAR_DECL \
|
||||
|| TREE_CODE (NODE) == CONST_DECL \
|
||||
|| TREE_CODE (NODE) == USING_DECL))
|
||||
|
||||
struct lang_decl_flags GTY(())
|
||||
@ -2315,8 +2319,12 @@ struct lang_decl GTY(())
|
||||
#define DECL_EXTERNAL_LINKAGE_P(DECL) \
|
||||
(decl_linkage (DECL) == lk_external)
|
||||
|
||||
#define INTEGRAL_CODE_P(CODE) \
|
||||
((CODE) == INTEGER_TYPE || (CODE) == ENUMERAL_TYPE || (CODE) == BOOLEAN_TYPE)
|
||||
/* Keep these codes in ascending code order. CHAR_TYPE is used here
|
||||
to completely fill the range. */
|
||||
|
||||
#define INTEGRAL_CODE_P(CODE) \
|
||||
((CODE) == ENUMERAL_TYPE || (CODE) == BOOLEAN_TYPE \
|
||||
|| (CODE) == CHAR_TYPE || (CODE) == INTEGER_TYPE)
|
||||
|
||||
/* [basic.fundamental]
|
||||
|
||||
@ -2324,31 +2332,37 @@ struct lang_decl GTY(())
|
||||
are collectively called integral types.
|
||||
|
||||
Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
|
||||
types as well, which is incorrect in C++. */
|
||||
types as well, which is incorrect in C++. Keep these checks in
|
||||
ascending code order. CHAR_TYPE is added to complete the interval of
|
||||
values. */
|
||||
#define CP_INTEGRAL_TYPE_P(TYPE) \
|
||||
(TREE_CODE (TYPE) == BOOLEAN_TYPE \
|
||||
|| TREE_CODE (TYPE) == CHAR_TYPE \
|
||||
|| TREE_CODE (TYPE) == INTEGER_TYPE)
|
||||
|
||||
/* Returns true if TYPE is an integral or enumeration name. */
|
||||
/* Returns true if TYPE is an integral or enumeration name. Keep
|
||||
these checks in ascending code order. */
|
||||
#define INTEGRAL_OR_ENUMERATION_TYPE_P(TYPE) \
|
||||
(CP_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == ENUMERAL_TYPE)
|
||||
(TREE_CODE (TYPE) == ENUMERAL_TYPE || CP_INTEGRAL_TYPE_P (TYPE))
|
||||
|
||||
/* [basic.fundamental]
|
||||
|
||||
Integral and floating types are collectively called arithmetic
|
||||
types. */
|
||||
types. Keep these checks in ascending code order. */
|
||||
#define ARITHMETIC_TYPE_P(TYPE) \
|
||||
(CP_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == REAL_TYPE)
|
||||
|
||||
/* [basic.types]
|
||||
|
||||
Arithmetic types, enumeration types, pointer types, and
|
||||
pointer-to-member types, are collectively called scalar types. */
|
||||
pointer-to-member types, are collectively called scalar types.
|
||||
Keep these checks in ascending code order. */
|
||||
#define SCALAR_TYPE_P(TYPE) \
|
||||
(ARITHMETIC_TYPE_P (TYPE) \
|
||||
(TYPE_PTRMEM_P (TYPE) \
|
||||
|| TREE_CODE (TYPE) == ENUMERAL_TYPE \
|
||||
|| ARITHMETIC_TYPE_P (TYPE) \
|
||||
|| TYPE_PTR_P (TYPE) \
|
||||
|| TYPE_PTR_TO_MEMBER_P (TYPE))
|
||||
|| TYPE_PTRMEMFUNC_P (TYPE))
|
||||
|
||||
/* [dcl.init.aggr]
|
||||
|
||||
@ -2356,12 +2370,12 @@ struct lang_decl GTY(())
|
||||
constructors, no private or protected non-static data members, no
|
||||
base classes, and no virtual functions.
|
||||
|
||||
As an extension, we also treat vectors as aggregates. */
|
||||
#define CP_AGGREGATE_TYPE_P(TYPE) \
|
||||
(TREE_CODE (TYPE) == ARRAY_TYPE \
|
||||
|| TREE_CODE (TYPE) == VECTOR_TYPE \
|
||||
|| (CLASS_TYPE_P (TYPE) \
|
||||
&& !CLASSTYPE_NON_AGGREGATE (TYPE)))
|
||||
As an extension, we also treat vectors as aggregates. Keep these
|
||||
checks in ascending code order. */
|
||||
#define CP_AGGREGATE_TYPE_P(TYPE) \
|
||||
(TREE_CODE (TYPE) == VECTOR_TYPE \
|
||||
||TREE_CODE (TYPE) == ARRAY_TYPE \
|
||||
|| (CLASS_TYPE_P (TYPE) && !CLASSTYPE_NON_AGGREGATE (TYPE)))
|
||||
|
||||
/* Nonzero for a class type means that the class type has a
|
||||
user-declared constructor. */
|
||||
@ -2442,21 +2456,26 @@ struct lang_decl GTY(())
|
||||
/* Returns true if NODE is a pointer. */
|
||||
#define TYPE_PTR_P(NODE) \
|
||||
(TREE_CODE (NODE) == POINTER_TYPE)
|
||||
/* Returns true if NODE is a pointer to an object. */
|
||||
#define TYPE_PTROB_P(NODE) \
|
||||
(TYPE_PTR_P (NODE) \
|
||||
&& TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE \
|
||||
&& TREE_CODE (TREE_TYPE (NODE)) != METHOD_TYPE \
|
||||
&& TREE_CODE (TREE_TYPE (NODE)) != VOID_TYPE)
|
||||
/* Returns true if NODE is a reference to an object. */
|
||||
#define TYPE_REF_OBJ_P(NODE) \
|
||||
(TREE_CODE (NODE) == REFERENCE_TYPE \
|
||||
&& TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE \
|
||||
&& TREE_CODE (TREE_TYPE (NODE)) != METHOD_TYPE \
|
||||
&& TREE_CODE (TREE_TYPE (NODE)) != VOID_TYPE)
|
||||
/* Returns true if NODE is a pointer to an object, or a pointer to void. */
|
||||
#define TYPE_PTROBV_P(NODE) \
|
||||
(TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE)
|
||||
/* Returns true if NODE is a pointer to an object. Keep these checks
|
||||
in ascending tree code order. */
|
||||
#define TYPE_PTROB_P(NODE) \
|
||||
(TYPE_PTR_P (NODE) \
|
||||
&& !(TREE_CODE (TREE_TYPE (NODE)) == VOID_TYPE \
|
||||
|| TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE \
|
||||
|| TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE))
|
||||
/* Returns true if NODE is a reference to an object. Keep these checks
|
||||
in ascending tree code order. */
|
||||
#define TYPE_REF_OBJ_P(NODE) \
|
||||
(TREE_CODE (NODE) == REFERENCE_TYPE \
|
||||
&& !(TREE_CODE (TREE_TYPE (NODE)) == VOID_TYPE \
|
||||
|| TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE \
|
||||
|| TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE))
|
||||
/* Returns true if NODE is a pointer to an object, or a pointer to
|
||||
void. Keep these checks in ascending tree code order. */
|
||||
#define TYPE_PTROBV_P(NODE) \
|
||||
(TYPE_PTR_P (NODE) \
|
||||
&& !(TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE \
|
||||
|| TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE))
|
||||
/* Returns true if NODE is a pointer to function. */
|
||||
#define TYPE_PTRFN_P(NODE) \
|
||||
(TREE_CODE (NODE) == POINTER_TYPE \
|
||||
@ -2680,7 +2699,8 @@ struct lang_decl GTY(())
|
||||
This list is not used for static variable templates. */
|
||||
#define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE (NODE)
|
||||
|
||||
/* Nonzero for a DECL which is actually a template parameter. */
|
||||
/* Nonzero for a DECL which is actually a template parameter. Keep
|
||||
these checks in ascending tree code order. */
|
||||
#define DECL_TEMPLATE_PARM_P(NODE) \
|
||||
(DECL_LANG_FLAG_0 (NODE) \
|
||||
&& (TREE_CODE (NODE) == CONST_DECL \
|
||||
|
@ -179,7 +179,7 @@ extern int errno;
|
||||
UPPER. However the bounds themselves can be either positive or
|
||||
negative. */
|
||||
#define IN_RANGE(VALUE, LOWER, UPPER) \
|
||||
((unsigned HOST_WIDE_INT) ((VALUE) - (LOWER)) <= ((UPPER) - (LOWER)))
|
||||
((unsigned)((VALUE) - (LOWER)) <= ((UPPER) - (LOWER)))
|
||||
|
||||
/* Infrastructure for defining missing _MAX and _MIN macros. Note that
|
||||
macros defined with these cannot be used in #if. */
|
||||
|
141
gcc/tree.def
141
gcc/tree.def
@ -28,7 +28,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
different structures, and the size is determined by the tree_union
|
||||
member structure; the 4th element should be zero. Languages that
|
||||
define language-specific tcc_exceptional or tcc_constant codes must
|
||||
define the tree_size langhook to say how big they are. */
|
||||
define the tree_size langhook to say how big they are.
|
||||
|
||||
These tree codes have been sorted so that the macros in tree.h that
|
||||
check for various tree codes are optimized into range checks. This
|
||||
gives a measureable performance improvement. When adding a new
|
||||
code, consider its placement in relation to the other codes. */
|
||||
|
||||
/* Any erroneous construct is parsed into a node of this type.
|
||||
This type of node is accepted without complaint in all contexts
|
||||
@ -118,8 +123,36 @@ DEFTREECODE (BLOCK, "block", tcc_exceptional, 0)
|
||||
ENUMERAL_TYPE, RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE nodes;
|
||||
see below. */
|
||||
|
||||
DEFTREECODE (VOID_TYPE, "void_type", tcc_type, 0)
|
||||
/* The void type in C */
|
||||
/* The ordering of the following codes is optimized for the checking
|
||||
macros in tree.h. Changing the order will degrade the speed of the
|
||||
compiler. OFFSET_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, CHAR_TYPE,
|
||||
INTEGER_TYPE, REAL_TYPE, POINTER_TYPE. */
|
||||
|
||||
/* An offset is a pointer relative to an object.
|
||||
The TREE_TYPE field is the type of the object at the offset.
|
||||
The TYPE_OFFSET_BASETYPE points to the node for the type of object
|
||||
that the offset is relative to. */
|
||||
DEFTREECODE (OFFSET_TYPE, "offset_type", tcc_type, 0)
|
||||
|
||||
/* C enums. The type node looks just like an INTEGER_TYPE node.
|
||||
The symbols for the values of the enum type are defined by
|
||||
CONST_DECL nodes, but the type does not point to them;
|
||||
however, the TYPE_VALUES is a list in which each element's TREE_PURPOSE
|
||||
is a name and the TREE_VALUE is the value (an INTEGER_CST node). */
|
||||
/* A forward reference `enum foo' when no enum named foo is defined yet
|
||||
has zero (a null pointer) in its TYPE_SIZE. The tag name is in
|
||||
the TYPE_NAME field. If the type is later defined, the normal
|
||||
fields are filled in.
|
||||
RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE forward refs are
|
||||
treated similarly. */
|
||||
DEFTREECODE (ENUMERAL_TYPE, "enumeral_type", tcc_type, 0)
|
||||
|
||||
/* Boolean type (true or false are the only values). Looks like an
|
||||
INTEGRAL_TYPE. */
|
||||
DEFTREECODE (BOOLEAN_TYPE, "boolean_type", tcc_type, 0)
|
||||
|
||||
/* CHAR in Java; not used in C. Looks like an INTEGRAL_TYPE. */
|
||||
DEFTREECODE (CHAR_TYPE, "char_type", tcc_type, 0)
|
||||
|
||||
/* Integer types in all languages, including char in C.
|
||||
Also used for sub-ranges of other discrete types.
|
||||
@ -135,6 +168,23 @@ DEFTREECODE (INTEGER_TYPE, "integer_type", tcc_type, 0)
|
||||
by machine mode and by the TYPE_SIZE and the TYPE_PRECISION. */
|
||||
DEFTREECODE (REAL_TYPE, "real_type", tcc_type, 0)
|
||||
|
||||
/* The ordering of the following codes is optimized for the checking
|
||||
macros in tree.h. Changing the order will degrade the speed of the
|
||||
compiler. POINTER_TYPE, REFERENCE_TYPE. Note that this range
|
||||
overlaps the previous range of ordered types. */
|
||||
|
||||
/* All pointer-to-x types have code POINTER_TYPE.
|
||||
The TREE_TYPE points to the node for the type pointed to. */
|
||||
DEFTREECODE (POINTER_TYPE, "pointer_type", tcc_type, 0)
|
||||
|
||||
/* A reference is like a pointer except that it is coerced
|
||||
automatically to the value it points to. Used in C++. */
|
||||
DEFTREECODE (REFERENCE_TYPE, "reference_type", tcc_type, 0)
|
||||
|
||||
/* The ordering of the following codes is optimized for the checking
|
||||
macros in tree.h. Changing the order will degrade the speed of the
|
||||
compiler. COMPLEX_TYPE, VECTOR_TYPE, ARRAY_TYPE. */
|
||||
|
||||
/* Complex number types. The TREE_TYPE field is the data type
|
||||
of the real and imaginary parts. */
|
||||
DEFTREECODE (COMPLEX_TYPE, "complex_type", tcc_type, 0)
|
||||
@ -144,51 +194,11 @@ DEFTREECODE (COMPLEX_TYPE, "complex_type", tcc_type, 0)
|
||||
the vector. */
|
||||
DEFTREECODE (VECTOR_TYPE, "vector_type", tcc_type, 0)
|
||||
|
||||
/* C enums. The type node looks just like an INTEGER_TYPE node.
|
||||
The symbols for the values of the enum type are defined by
|
||||
CONST_DECL nodes, but the type does not point to them;
|
||||
however, the TYPE_VALUES is a list in which each element's TREE_PURPOSE
|
||||
is a name and the TREE_VALUE is the value (an INTEGER_CST node). */
|
||||
/* A forward reference `enum foo' when no enum named foo is defined yet
|
||||
has zero (a null pointer) in its TYPE_SIZE. The tag name is in
|
||||
the TYPE_NAME field. If the type is later defined, the normal
|
||||
fields are filled in.
|
||||
RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE forward refs are
|
||||
treated similarly. */
|
||||
DEFTREECODE (ENUMERAL_TYPE, "enumeral_type", tcc_type, 0)
|
||||
|
||||
/* Pascal's boolean type (true or false are the only values);
|
||||
no special fields needed. */
|
||||
DEFTREECODE (BOOLEAN_TYPE, "boolean_type", tcc_type, 0)
|
||||
|
||||
/* CHAR in Pascal; not used in C.
|
||||
No special fields needed. */
|
||||
DEFTREECODE (CHAR_TYPE, "char_type", tcc_type, 0)
|
||||
|
||||
/* All pointer-to-x types have code POINTER_TYPE.
|
||||
The TREE_TYPE points to the node for the type pointed to. */
|
||||
DEFTREECODE (POINTER_TYPE, "pointer_type", tcc_type, 0)
|
||||
|
||||
/* An offset is a pointer relative to an object.
|
||||
The TREE_TYPE field is the type of the object at the offset.
|
||||
The TYPE_OFFSET_BASETYPE points to the node for the type of object
|
||||
that the offset is relative to. */
|
||||
DEFTREECODE (OFFSET_TYPE, "offset_type", tcc_type, 0)
|
||||
|
||||
/* A reference is like a pointer except that it is coerced
|
||||
automatically to the value it points to. Used in C++. */
|
||||
DEFTREECODE (REFERENCE_TYPE, "reference_type", tcc_type, 0)
|
||||
|
||||
/* METHOD_TYPE is the type of a function which takes an extra first
|
||||
argument for "self", which is not present in the declared argument list.
|
||||
The TREE_TYPE is the return type of the method. The TYPE_METHOD_BASETYPE
|
||||
is the type of "self". TYPE_ARG_TYPES is the real argument list, which
|
||||
includes the hidden argument for "self". */
|
||||
DEFTREECODE (METHOD_TYPE, "method_type", tcc_type, 0)
|
||||
|
||||
/* Used for Pascal; details not determined right now. */
|
||||
DEFTREECODE (FILE_TYPE, "file_type", tcc_type, 0)
|
||||
|
||||
/* The ordering of the following codes is optimized for the checking
|
||||
macros in tree.h. Changing the order will degrade the speed of the
|
||||
compiler. ARRAY_TYPE, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE.
|
||||
Note that this range overlaps the previous range. */
|
||||
|
||||
/* Types of arrays. Special fields:
|
||||
TREE_TYPE Type of an array element.
|
||||
TYPE_DOMAIN Type to index by.
|
||||
@ -222,6 +232,13 @@ DEFTREECODE (UNION_TYPE, "union_type", tcc_type, 0) /* C union type */
|
||||
the union. */
|
||||
DEFTREECODE (QUAL_UNION_TYPE, "qual_union_type", tcc_type, 0)
|
||||
|
||||
/* The ordering of the following codes is optimized for the checking
|
||||
macros in tree.h. Changing the order will degrade the speed of the
|
||||
compiler. VOID_TYPE, FUNCTION_TYPE, METHOD_TYPE. */
|
||||
|
||||
/* The void type in C */
|
||||
DEFTREECODE (VOID_TYPE, "void_type", tcc_type, 0)
|
||||
|
||||
/* Type of functions. Special fields:
|
||||
TREE_TYPE type of value returned.
|
||||
TYPE_ARG_TYPES list of types of arguments expected.
|
||||
@ -230,6 +247,16 @@ DEFTREECODE (QUAL_UNION_TYPE, "qual_union_type", tcc_type, 0)
|
||||
have code FUNCTION_TYPE also, but then TREE_TYPE is zero or void type. */
|
||||
DEFTREECODE (FUNCTION_TYPE, "function_type", tcc_type, 0)
|
||||
|
||||
/* METHOD_TYPE is the type of a function which takes an extra first
|
||||
argument for "self", which is not present in the declared argument list.
|
||||
The TREE_TYPE is the return type of the method. The TYPE_METHOD_BASETYPE
|
||||
is the type of "self". TYPE_ARG_TYPES is the real argument list, which
|
||||
includes the hidden argument for "self". */
|
||||
DEFTREECODE (METHOD_TYPE, "method_type", tcc_type, 0)
|
||||
|
||||
/* Used for Pascal; details not determined right now. */
|
||||
DEFTREECODE (FILE_TYPE, "file_type", tcc_type, 0)
|
||||
|
||||
/* This is a language-specific kind of type.
|
||||
Its meaning is defined by the language front end.
|
||||
layout_type does not know how to lay this out,
|
||||
@ -323,12 +350,16 @@ DEFTREECODE (STRING_CST, "string_cst", tcc_constant, 0)
|
||||
|
||||
DEFTREECODE (FUNCTION_DECL, "function_decl", tcc_declaration, 0)
|
||||
DEFTREECODE (LABEL_DECL, "label_decl", tcc_declaration, 0)
|
||||
DEFTREECODE (CONST_DECL, "const_decl", tcc_declaration, 0)
|
||||
DEFTREECODE (TYPE_DECL, "type_decl", tcc_declaration, 0)
|
||||
DEFTREECODE (VAR_DECL, "var_decl", tcc_declaration, 0)
|
||||
DEFTREECODE (PARM_DECL, "parm_decl", tcc_declaration, 0)
|
||||
DEFTREECODE (RESULT_DECL, "result_decl", tcc_declaration, 0)
|
||||
/* The ordering of the following codes is optimized for the checking
|
||||
macros in tree.h. Changing the order will degrade the speed of the
|
||||
compiler. FIELD_DECL, VAR_DECL, CONST_DECL, PARM_DECL,
|
||||
TYPE_DECL. */
|
||||
DEFTREECODE (FIELD_DECL, "field_decl", tcc_declaration, 0)
|
||||
DEFTREECODE (VAR_DECL, "var_decl", tcc_declaration, 0)
|
||||
DEFTREECODE (CONST_DECL, "const_decl", tcc_declaration, 0)
|
||||
DEFTREECODE (PARM_DECL, "parm_decl", tcc_declaration, 0)
|
||||
DEFTREECODE (TYPE_DECL, "type_decl", tcc_declaration, 0)
|
||||
DEFTREECODE (RESULT_DECL, "result_decl", tcc_declaration, 0)
|
||||
|
||||
/* A namespace declaration. Namespaces appear in DECL_CONTEXT of other
|
||||
_DECLs, providing a hierarchy of names. */
|
||||
@ -357,6 +388,10 @@ DEFTREECODE (COMPONENT_REF, "component_ref", tcc_reference, 3)
|
||||
BIT_FIELD_REF_UNSIGNED says which. */
|
||||
DEFTREECODE (BIT_FIELD_REF, "bit_field_ref", tcc_reference, 3)
|
||||
|
||||
/* The ordering of the following codes is optimized for the checking
|
||||
macros in tree.h. Changing the order will degrade the speed of the
|
||||
compiler. INDIRECT_REF, ALIGN_INDIRECT_REF, MISALIGNED_INDIRECT_REF. */
|
||||
|
||||
/* C unary `*' or Pascal `^'. One operand, an expression for a pointer. */
|
||||
DEFTREECODE (INDIRECT_REF, "indirect_ref", tcc_reference, 1)
|
||||
|
||||
|
36
gcc/tree.h
36
gcc/tree.h
@ -51,6 +51,7 @@ enum tree_code {
|
||||
enum tree_code_class {
|
||||
tcc_exceptional, /* An exceptional code (fits no category). */
|
||||
tcc_constant, /* A constant. */
|
||||
/* Order of tcc_type and tcc_declaration is important. */
|
||||
tcc_type, /* A type object code. */
|
||||
tcc_declaration, /* A declaration (also serving as variable refs). */
|
||||
tcc_reference, /* A reference to storage. */
|
||||
@ -96,11 +97,12 @@ extern const enum tree_code_class tree_code_type[];
|
||||
#define DECL_P(CODE)\
|
||||
(TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_declaration)
|
||||
|
||||
/* Nonzero if CODE represents a INDIRECT_REF. */
|
||||
/* Nonzero if CODE represents a INDIRECT_REF. Keep these checks in
|
||||
ascending code order. */
|
||||
#define INDIRECT_REF_P(CODE)\
|
||||
(TREE_CODE (CODE) == INDIRECT_REF \
|
||||
|| TREE_CODE (CODE) == MISALIGNED_INDIRECT_REF \
|
||||
|| TREE_CODE (CODE) == ALIGN_INDIRECT_REF)
|
||||
|| TREE_CODE (CODE) == ALIGN_INDIRECT_REF \
|
||||
|| TREE_CODE (CODE) == MISALIGNED_INDIRECT_REF)
|
||||
|
||||
/* Nonzero if CODE represents a reference. */
|
||||
|
||||
@ -145,7 +147,7 @@ extern const enum tree_code_class tree_code_type[];
|
||||
expression. */
|
||||
|
||||
#define IS_EXPR_CODE_CLASS(CLASS)\
|
||||
(((CLASS) >= tcc_reference) && ((CLASS) <= tcc_expression))
|
||||
(IN_RANGE (CLASS, tcc_reference, tcc_expression))
|
||||
|
||||
/* Returns nonzero iff NODE is an expression of some kind. */
|
||||
|
||||
@ -737,11 +739,14 @@ extern void tree_operand_check_failed (int, enum tree_code,
|
||||
EXP = TREE_OPERAND (EXP, 0)
|
||||
|
||||
/* Nonzero if TYPE represents an integral type. Note that we do not
|
||||
include COMPLEX types here. */
|
||||
include COMPLEX types here. Keep these checks in ascending code
|
||||
order. */
|
||||
|
||||
#define INTEGRAL_TYPE_P(TYPE) \
|
||||
(TREE_CODE (TYPE) == INTEGER_TYPE || TREE_CODE (TYPE) == ENUMERAL_TYPE \
|
||||
|| TREE_CODE (TYPE) == BOOLEAN_TYPE || TREE_CODE (TYPE) == CHAR_TYPE)
|
||||
(TREE_CODE (TYPE) == ENUMERAL_TYPE \
|
||||
|| TREE_CODE (TYPE) == BOOLEAN_TYPE \
|
||||
|| TREE_CODE (TYPE) == CHAR_TYPE \
|
||||
|| TREE_CODE (TYPE) == INTEGER_TYPE)
|
||||
|
||||
/* Nonzero if TYPE represents a scalar floating-point type. */
|
||||
|
||||
@ -760,20 +765,25 @@ extern void tree_operand_check_failed (int, enum tree_code,
|
||||
&& TREE_CODE (TREE_TYPE (TYPE)) == REAL_TYPE)
|
||||
|
||||
/* Nonzero if TYPE represents a floating-point type, including complex
|
||||
and vector floating-point types. */
|
||||
and vector floating-point types. The vector and complex check does
|
||||
not use the previous two macros to enable early folding. */
|
||||
|
||||
#define FLOAT_TYPE_P(TYPE) \
|
||||
(SCALAR_FLOAT_TYPE_P (TYPE) || COMPLEX_FLOAT_TYPE_P (TYPE) \
|
||||
|| VECTOR_FLOAT_TYPE_P (TYPE))
|
||||
#define FLOAT_TYPE_P(TYPE) \
|
||||
(SCALAR_FLOAT_TYPE_P (TYPE) \
|
||||
|| ((TREE_CODE (TYPE) == COMPLEX_TYPE \
|
||||
|| TREE_CODE (TYPE) == VECTOR_TYPE) \
|
||||
&& SCALAR_FLOAT_TYPE_P (TREE_TYPE (TYPE))))
|
||||
|
||||
/* Nonzero if TYPE represents an aggregate (multi-component) type. */
|
||||
/* Nonzero if TYPE represents an aggregate (multi-component) type.
|
||||
Keep these checks in ascending code order. */
|
||||
|
||||
#define AGGREGATE_TYPE_P(TYPE) \
|
||||
(TREE_CODE (TYPE) == ARRAY_TYPE || TREE_CODE (TYPE) == RECORD_TYPE \
|
||||
|| TREE_CODE (TYPE) == UNION_TYPE || TREE_CODE (TYPE) == QUAL_UNION_TYPE)
|
||||
|
||||
/* Nonzero if TYPE represents a pointer or reference type.
|
||||
(It should be renamed to INDIRECT_TYPE_P.) */
|
||||
(It should be renamed to INDIRECT_TYPE_P.) Keep these checks in
|
||||
ascending code order. */
|
||||
|
||||
#define POINTER_TYPE_P(TYPE) \
|
||||
(TREE_CODE (TYPE) == POINTER_TYPE || TREE_CODE (TYPE) == REFERENCE_TYPE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user