From: Richard Kenner Date: Tue, 29 Feb 2000 02:34:48 +0000 (+0000) Subject: * Eliminate DECL_FIELD_SIZE. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9df2c88cf7ee9be1a279bf7e1fc032b77d9bb56f;p=gcc.git * Eliminate DECL_FIELD_SIZE. * builtins.c (built_in_class_names, built_in_names): New variables. * c-decl.c (finish_struct): Set specified size in DECL_SIZE. * expr.c (expand_expr, case COMPONENT_REF): Get field size from DECL_SIZE, not DECL_FIELD_SIZE. * print-tree.c (print_node): Remove code that prints extra blank lines in some cases. Properly handle inline and builtin function cases. * stor-layout.c (layout_decl): Get specified size from DEC_SIZE. * tree.h (built_in_class_named, built_in_names): New declarations. (union tree_decl): Rename internal unions to u1 and u2 and change some of their components. Add new field built_in_class. (DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE): Reflect above changes. (DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise. (DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted. * objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE. (encode_field_decl): Likewise; also remove obsolete test for bitfield. * ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name. * ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE. * ch/typeck.c (make_chill_struct_type): Likewise. (apply_decl_field_layout): General cleanup. Set DECL_SIZE instead of DECL_FIELD_SIZE. * cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear DECL_FIELD_SIZE. (check_bitfield_decl, check_field_decls): Set DECL_SIZE, not DECL_FIELD_SIZE. * cp/rtti.c (expand_class_desc): Likewise. * cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name. (THUNK_VCALL_OFFSET): Likewise. (THUNK_DELTA): Reflect changes in ../tree.h. * java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h. (DECL_BIT_INDEX): Use underlying representation. * java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise. From-SVN: r32249 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b5dd91be01b..5e983504387 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +Mon Feb 28 21:07:59 2000 Richard Kenner + + * Eliminate DECL_FIELD_SIZE. + * builtins.c (built_in_class_names, built_in_names): New variables. + * c-decl.c (finish_struct): Set specified size in DECL_SIZE. + * expr.c (expand_expr, case COMPONENT_REF): Get field size from + DECL_SIZE, not DECL_FIELD_SIZE. + * print-tree.c (print_node): Remove code that prints extra blank + lines in some cases. + Properly handle inline and builtin function cases. + * stor-layout.c (layout_decl): Get specified size from DEC_SIZE. + * tree.h (built_in_class_named, built_in_names): New declarations. + (union tree_decl): Rename internal unions to u1 and u2 and change + some of their components. + Add new field built_in_class. + (DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE): + Reflect above changes. + (DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise. + (DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted. + * objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE. + (encode_field_decl): Likewise; also remove obsolete test for bitfield. + 2000-02-28 Dmitri Makarov * extend.texi: Document ARM's support for long/short calls. diff --git a/gcc/builtins.c b/gcc/builtins.c index e32d0bddc0b..c77d51c496d 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -56,6 +56,30 @@ Boston, MA 02111-1307, USA. */ #define PAD_VARARGS_DOWN BYTES_BIG_ENDIAN #endif +/* Define the names of the builtin function types and codes. */ +char *built_in_class_names[4] + = {"NOT_BUILT_IN", "BUILT_IN_FRONTEND", "BUILT_IN_MD", "BUILT_IN_NORMAL"}; + +char *built_in_names[(int) END_BUILTINS] = +{"BUILT_IN_ALLOCA", "BUILT_IN_ABS", "BUILT_IN_FABS", "BUILT_IN_LABS", + "BUILT_IN_FFS", "BUILT_IN_DIV", "BUILT_IN_LDIV", "BUILT_IN_FFLOOR", + "BUILT_IN_FCEIL", "BUILT_IN_FMOD", "BUILT_IN_FREM", "BUILT_IN_MEMCPY", + "BUILT_IN_MEMCMP", "BUILT_IN_MEMSET", "BUILT_IN_STRCPY", "BUILT_IN_STRCMP", + "BUILT_IN_STRLEN", "BUILT_IN_FSQRT", "BUILT_IN_SIN", "BUILT_IN_COS", + "BUILT_IN_GETEXP", "BUILT_IN_GETMAN", "BUILT_IN_SAVEREGS", + "BUILT_IN_CLASSIFY_TYPE", "BUILT_IN_NEXT_ARG", "BUILT_IN_ARGS_INFO", + "BUILT_IN_CONSTANT_P", "BUILT_IN_FRAME_ADDRESS", "BUILT_IN_RETURN_ADDRESS", + "BUILT_IN_AGGREGATE_INCOMING_ADDRESS", "BUILT_IN_APPLY_ARGS", + "BUILT_IN_APPLY", "BUILT_IN_RETURN", "BUILT_IN_SETJMP", "BUILT_IN_LONGJMP", + "BUILT_IN_TRAP", "BUILT_IN_ISGREATER", "BUILT_IN_ISGREATEREQUAL", + "BUILT_IN_ISLESS", "BUILT_IN_ISLESSEQUAL", "BUILT_IN_ISLESSGREATER", + "BUILT_IN_ISUNORDERED", "BUILT_IN_UNWIND_INIT", "BUILT_IN_DWARF_CFA", + "BUILT_IN_DWARF_FP_REGNUM", "BUILT_IN_INIT_DWARF_REG_SIZES", + "BUILT_IN_FROB_RETURN_ADDR", "BUILT_IN_EXTRACT_RETURN_ADDR", + "BUILT_IN_EH_RETURN", "BUILT_IN_VARARGS_START", "BUILT_IN_STDARG_START", + "BUILT_IN_VA_END", "BUILT_IN_VA_COPY", "BUILT_IN_NEW", "BUILT_IN_VEC_NEW", + "BUILT_IN_DELETE", "BUILT_IN_VEC_DELETE" }; + tree (*lang_type_promotes_to) PARAMS ((tree)); static int get_pointer_alignment PARAMS ((tree, unsigned)); @@ -85,7 +109,8 @@ static rtx expand_builtin_strcmp PARAMS ((tree, rtx)); static rtx expand_builtin_memcpy PARAMS ((tree)); static rtx expand_builtin_strcpy PARAMS ((tree)); static rtx expand_builtin_memset PARAMS ((tree)); -static rtx expand_builtin_strlen PARAMS ((tree, rtx, enum machine_mode)); +static rtx expand_builtin_strlen PARAMS ((tree, rtx, + enum machine_mode)); static rtx expand_builtin_alloca PARAMS ((tree, rtx)); static rtx expand_builtin_ffs PARAMS ((tree, rtx, rtx)); static rtx expand_builtin_frame_address PARAMS ((tree)); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 8308fc7e171..24c7c248a16 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5117,9 +5117,7 @@ finish_struct (t, fieldlist, attributes) } /* Install struct as DECL_CONTEXT of each field decl. - Also process specified field sizes. - Set DECL_FIELD_SIZE to the specified size, or 0 if none specified. - The specified size is found in the DECL_INITIAL. + Also process specified field sizes,m which is found in the DECL_INITIAL. Store 0 there, except for ": 0" fields (so we can find them and delete them, below). */ @@ -5127,7 +5125,6 @@ finish_struct (t, fieldlist, attributes) { DECL_CONTEXT (x) = t; DECL_PACKED (x) |= TYPE_PACKED (t); - DECL_FIELD_SIZE (x) = 0; /* If any field is const, the structure type is pseudo-const. */ if (TREE_READONLY (x)) @@ -5166,7 +5163,8 @@ finish_struct (t, fieldlist, attributes) constant_expression_warning (DECL_INITIAL (x)); else { - error_with_decl (x, "bit-field `%s' width not an integer constant"); + error_with_decl (x, + "bit-field `%s' width not an integer constant"); DECL_INITIAL (x) = NULL; } } @@ -5179,6 +5177,7 @@ finish_struct (t, fieldlist, attributes) error_with_decl (x, "bit-field `%s' has invalid type"); DECL_INITIAL (x) = NULL; } + if (DECL_INITIAL (x) && pedantic && TYPE_MAIN_VARIANT (TREE_TYPE (x)) != integer_type_node && TYPE_MAIN_VARIANT (TREE_TYPE (x)) != unsigned_type_node @@ -5191,20 +5190,19 @@ finish_struct (t, fieldlist, attributes) /* Detect and ignore out of range field width. */ if (DECL_INITIAL (x)) { - unsigned HOST_WIDE_INT width = TREE_INT_CST_LOW (DECL_INITIAL (x)); - if (tree_int_cst_sgn (DECL_INITIAL (x)) < 0) { DECL_INITIAL (x) = NULL; error_with_decl (x, "negative width in bit-field `%s'"); } else if (TREE_INT_CST_HIGH (DECL_INITIAL (x)) != 0 - || width > TYPE_PRECISION (TREE_TYPE (x))) + || (TREE_INT_CST_LOW (DECL_INITIAL (x)) + > TYPE_PRECISION (TREE_TYPE (x)))) { DECL_INITIAL (x) = NULL; pedwarn_with_decl (x, "width of `%s' exceeds its type"); } - else if (width == 0 && DECL_NAME (x) != 0) + else if (integer_zerop (DECL_INITIAL (x)) && DECL_NAME (x) != 0) { error_with_decl (x, "zero width for bit-field `%s'"); DECL_INITIAL (x) = NULL; @@ -5223,7 +5221,7 @@ finish_struct (t, fieldlist, attributes) TREE_UNSIGNED (TREE_TYPE (x))))) warning_with_decl (x, "`%s' is narrower than values of its type"); - DECL_FIELD_SIZE (x) = width; + DECL_SIZE (x) = bitsize_int (width); DECL_BIT_FIELD (x) = DECL_C_BIT_FIELD (x) = 1; DECL_INITIAL (x) = NULL; @@ -5243,7 +5241,8 @@ finish_struct (t, fieldlist, attributes) else if (TREE_TYPE (x) != error_mark_node) { unsigned int min_align = (DECL_PACKED (x) ? BITS_PER_UNIT - : TYPE_ALIGN (TREE_TYPE (x))); + : TYPE_ALIGN (TREE_TYPE (x))); + /* Non-bit-fields are aligned for their type, except packed fields which require only BITS_PER_UNIT alignment. */ DECL_ALIGN (x) = MAX (DECL_ALIGN (x), min_align); diff --git a/gcc/ch/ChangeLog b/gcc/ch/ChangeLog index 35df1bade91..e8cfee4e918 100644 --- a/gcc/ch/ChangeLog +++ b/gcc/ch/ChangeLog @@ -1,3 +1,11 @@ +Mon Feb 28 08:12:26 2000 Richard Kenner + + * ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name. + * decl.c (finish_struct): Don't clear DECL_FIELD_SIZE. + * typeck.c (make_chill_struct_type): Likewise. + (apply_decl_field_layout): General cleanup. + Set DECL_SIZE instead of DECL_FIELD_SIZE. + Sun Feb 27 16:40:33 2000 Richard Kenner * actions.c (chill_convert_for_assignment): Don't use size_binop diff --git a/gcc/ch/ch-tree.h b/gcc/ch/ch-tree.h index 6e3008c40a9..3aa74155421 100644 --- a/gcc/ch/ch-tree.h +++ b/gcc/ch/ch-tree.h @@ -88,7 +88,7 @@ extern int action_nesting_level; #define ELSE_VARIANT_NAME ridpointers[(int) RID_ELSE] /* For a LABEL_DECL: action_nesting_level of its target. */ -#define DECL_ACTION_NESTING_LEVEL(NODE) ((NODE)->decl.saved_insns.i) +#define DECL_ACTION_NESTING_LEVEL(NODE) ((NODE)->decl.u2.i) #define DECL_OLD_PREFIX(DECL) ((DECL)->decl.initial) #define DECL_NEW_PREFIX(DECL) ((DECL)->decl.result) diff --git a/gcc/ch/decl.c b/gcc/ch/decl.c index ffda9abeabf..559587ba5eb 100644 --- a/gcc/ch/decl.c +++ b/gcc/ch/decl.c @@ -4337,18 +4337,9 @@ finish_struct (t, fieldlist) { register tree x; - /* Install struct as DECL_CONTEXT of each field decl. - Also process specified field sizes. - Set DECL_FIELD_SIZE to the specified size, or 0 if none specified. - The specified size is found in the DECL_INITIAL. - Store 0 there, except for ": 0" fields (so we can find them - and delete them, below). */ - + /* Install struct as DECL_CONTEXT of each field decl. */ for (x = fieldlist; x; x = TREE_CHAIN (x)) - { - DECL_CONTEXT (x) = t; - DECL_FIELD_SIZE (x) = 0; - } + DECL_CONTEXT (x) = t; TYPE_FIELDS (t) = fieldlist; diff --git a/gcc/ch/typeck.c b/gcc/ch/typeck.c index 8c74896b52a..2fe1af418f4 100644 --- a/gcc/ch/typeck.c +++ b/gcc/ch/typeck.c @@ -2992,16 +2992,12 @@ make_chill_struct_type (fieldlist) tree fieldlist; { tree t, x; - if (TREE_UNION_ELEM (fieldlist)) - t = make_node (UNION_TYPE); - else - t = make_node (RECORD_TYPE); + + t = make_node (TREE_UNION_ELEM (fieldlist) ? UNION_TYPE : RECORD_TYPE); + /* Install struct as DECL_CONTEXT of each field decl. */ for (x = fieldlist; x; x = TREE_CHAIN (x)) - { - DECL_CONTEXT (x) = t; - DECL_FIELD_SIZE (x) = 0; - } + DECL_CONTEXT (x) = t; /* Delete all duplicate fields from the fieldlist */ for (x = fieldlist; x && TREE_CHAIN (x);) @@ -3033,31 +3029,35 @@ make_chill_struct_type (fieldlist) return t; } -/* decl is a FIELD_DECL. - DECL_INIT (decl) is (NULL_TREE, integer_one_node, integer_zero_node, tree_list), - meaning (default, pack, nopack, POS (...) ). +/* DECL is a FIELD_DECL. + DECL_INIT (decl) is + (NULL_TREE, integer_one_node, integer_zero_node, tree_list) + meaning + (default, pack, nopack, POS (...) ). + The return value is a boolean: 1 if POS specified, 0 if not */ + static int apply_chill_field_layout (decl, next_struct_offset) tree decl; - int* next_struct_offset; + int *next_struct_offset; { - tree layout, type, temp, what; - int word = 0, wordsize, start_bit, offset, length, natural_length; + tree layout = DECL_INITIAL (decl); + tree type = TREE_TYPE (decl); + tree temp, what; + HOST_WIDE_INT word = 0; + HOST_WIDE_INT wordsize, start_bit, offset, length, natural_length; int pos_error = 0; - int is_discrete; + int is_discrete = discrete_type_p (type); - type = TREE_TYPE (decl); - is_discrete = discrete_type_p (type); if (is_discrete) - natural_length = get_type_precision (TYPE_MIN_VALUE (type), TYPE_MAX_VALUE (type)); + natural_length + = get_type_precision (TYPE_MIN_VALUE (type), TYPE_MAX_VALUE (type)); else natural_length = TREE_INT_CST_LOW (TYPE_SIZE (type)); - layout = DECL_INITIAL (decl); if (layout == integer_zero_node) /* NOPACK */ { - DECL_PACKED (decl) = 0; *next_struct_offset += natural_length; return 0; /* not POS */ } @@ -3065,14 +3065,14 @@ apply_chill_field_layout (decl, next_struct_offset) if (layout == integer_one_node) /* PACK */ { if (is_discrete) - DECL_BIT_FIELD (decl) = 1; - else { - DECL_BIT_FIELD (decl) = 0; - DECL_ALIGN (decl) = BITS_PER_UNIT; + DECL_BIT_FIELD (decl) = 1; + DECL_SIZE (decl) = bitsize_int (natural_length); } + else + DECL_ALIGN (decl) = BITS_PER_UNIT; + DECL_PACKED (decl) = 1; - DECL_FIELD_SIZE (decl) = natural_length; *next_struct_offset += natural_length; return 0; /* not POS */ } @@ -3090,7 +3090,7 @@ apply_chill_field_layout (decl, next_struct_offset) else { word = TREE_INT_CST_LOW (TREE_PURPOSE (temp)); - if (word < 0) + if (tree_int_cst_sgn (TREE_PURPOSE (temp)) < 0) { error ("Starting word in POS must be >= 0"); word = 0; @@ -3114,7 +3114,7 @@ apply_chill_field_layout (decl, next_struct_offset) else { start_bit = TREE_INT_CST_LOW (TREE_PURPOSE (temp)); - if (start_bit < 0) + if (tree_int_cst_sgn (TREE_PURPOSE (temp)) < 0) { error ("Starting bit in POS must be >= 0"); start_bit = *next_struct_offset - offset; @@ -3142,7 +3142,7 @@ apply_chill_field_layout (decl, next_struct_offset) else { length = TREE_INT_CST_LOW (TREE_VALUE (temp)); - if (length <= 0) + if (tree_int_cst_sgn (TREE_VALUE (temp)) < 0) { error ("Length in POS must be > 0"); length = natural_length; @@ -3159,7 +3159,8 @@ apply_chill_field_layout (decl, next_struct_offset) } else { - int end_bit = TREE_INT_CST_LOW (TREE_VALUE (temp)); + HOST_WIDE_INT end_bit = TREE_INT_CST_LOW (TREE_VALUE (temp)); + if (end_bit < start_bit) { error ("End bit in POS must be >= the start bit"); @@ -3174,6 +3175,7 @@ apply_chill_field_layout (decl, next_struct_offset) length = end_bit - start_bit + 1; } } + if (length != natural_length && ! pos_error) { sorry ("The length specified on POS must be the natural length of the field type"); @@ -3189,7 +3191,10 @@ apply_chill_field_layout (decl, next_struct_offset) DECL_PACKED (decl) = 1; DECL_BIT_FIELD (decl) = is_discrete; - DECL_FIELD_SIZE (decl) = length; + + if (is_discrete) + DECL_SIZE (decl) = bitsize_int (length); + *next_struct_offset += natural_length; return 1; /* was POS */ @@ -3209,12 +3214,7 @@ layout_chill_struct_type (t) old_momentary = suspend_momentary (); - /* Process specified field sizes. - Set DECL_FIELD_SIZE to the specified size, or 0 if none specified. - The specified size is found in the DECL_INITIAL. - Store 0 there, except for ": 0" fields (so we can find them - and delete them, below). */ - + /* Process specified field sizes. */ next_struct_offset = 0; for (x = fieldlist; x; x = TREE_CHAIN (x)) { diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5c750f2fe46..afe076b52ca 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +Mon Feb 28 08:15:23 2000 Richard Kenner + + * class.c (build_vtbl_or_vbase_field, check_methods): Don't clear + DECL_FIELD_SIZE. + (check_bitfield_decl, check_field_decls): Set DECL_SIZE, not + DECL_FIELD_SIZE. + * rtti.c (expand_class_desc): Likewise. + * cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name. + (THUNK_VCALL_OFFSET): Likewise. + (THUNK_DELTA): Reflect changes in ../tree.h. + 2000-02-28 Jason Merrill * search.c (protected_accessible_p): Also allow the access if diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 5b0ab16ac64..6f412903d61 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -3676,7 +3676,7 @@ check_bitfield_decl (field) if (DECL_INITIAL (field)) { DECL_INITIAL (field) = NULL_TREE; - DECL_FIELD_SIZE (field) = width; + DECL_SIZE (field) = bitsize_int (width); DECL_BIT_FIELD (field) = 1; if (width == 0) @@ -3921,7 +3921,6 @@ check_field_decls (t, access_decls, empty_p, continue; DECL_SAVED_INSNS (x) = 0; - DECL_FIELD_SIZE (x) = 0; /* When this goes into scope, it will be a non-local reference. */ DECL_NONLOCAL (x) = 1; @@ -4079,7 +4078,6 @@ build_vtbl_or_vbase_field (name, assembler_name, type, class_type, fcontext, DECL_FIELD_CONTEXT (field) = class_type; DECL_FCONTEXT (field) = fcontext; DECL_SAVED_INSNS (field) = 0; - DECL_FIELD_SIZE (field) = 0; DECL_ALIGN (field) = TYPE_ALIGN (type); /* Return it. */ @@ -4279,13 +4277,7 @@ check_methods (t) if (IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (x))) continue; - /* Do both of these, even though they're in the same union; - if the insn `r' member and the size `i' member are - different sizes, as on the alpha, the larger of the two - will end up with garbage in it. */ DECL_SAVED_INSNS (x) = 0; - DECL_FIELD_SIZE (x) = 0; - check_for_override (x, t); if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x)) cp_error_at ("initializer specified for non-virtual method `%D'", x); diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index c1ae4d283f9..4af1704f6c8 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -112,10 +112,7 @@ Boston, MA 02111-1307, USA. */ For a TEMPLATE_TEMPLATE_PARM, this is TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. - DECL_SAVED_INSNS/DECL_FIELD_SIZE - For a static VAR_DECL, this is DECL_INIT_PRIORITY. - - BINFO_VIRTUALS + BINFO_VIRTUALS For a binfo, this is a TREE_LIST. The BV_DELTA of each node gives the amount by which to adjust the `this' pointer when calling the function. If the method is an overriden version of a @@ -2058,9 +2055,9 @@ struct lang_decl /* In a non-local VAR_DECL with static storage duration, this is the initialization priority. If this value is zero, the NODE will be initialized at the DEFAULT_INIT_PRIORITY. */ -#define DECL_INIT_PRIORITY(NODE) (DECL_FIELD_SIZE (VAR_DECL_CHECK (NODE))) +#define DECL_INIT_PRIORITY(NODE) (VAR_DECL_CHECK (NODE)->decl.u2.i) -/* In a TREE_LIST concatenating using directives, indicate indirekt +/* In a TREE_LIST concatenating using directives, indicate indirect directives */ #define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->common.lang_flag_0) @@ -2866,13 +2863,13 @@ extern int flag_new_for_scope; /* An integer indicating how many bytes should be subtracted from the `this' pointer when this function is called. */ -#define THUNK_DELTA(DECL) ((DECL)->decl.frame_size.i) +#define THUNK_DELTA(DECL) (DECL_CHECK (DECL)->decl.u1.i) /* An integer indicating how many bytes should be subtracted from the vtable for the `this' pointer to find the vcall offset. (The vptr is always located at offset zero from the f `this' pointer.) If zero, then there is no vcall offset. */ -#define THUNK_VCALL_OFFSET(DECL) (DECL_FIELD_SIZE (DECL)) +#define THUNK_VCALL_OFFSET(DECL) (DECL_CHECK (DECL)->decl.u2.i) /* DECL_NEEDED_P holds of a declaration when we need to emit its definition. This is true when the back-end tells us that diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index cd830819b98..9caa9c8b7b2 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -963,18 +963,16 @@ expand_class_desc (tdecl, type) (FIELD_DECL, NULL_TREE, flag_new_abi ? intSI_type_node : unsigned_intSI_type_node); DECL_BIT_FIELD (fields[1]) = 1; - DECL_FIELD_SIZE (fields[1]) = 29; + DECL_SIZE (fields[1]) = bitsize_int (29); - fields [2] = build_lang_decl - (FIELD_DECL, NULL_TREE, boolean_type_node); + fields [2] = build_lang_decl (FIELD_DECL, NULL_TREE, boolean_type_node); DECL_BIT_FIELD (fields[2]) = 1; - DECL_FIELD_SIZE (fields[2]) = 1; + DECL_SIZE (fields[2]) = bitsize_int (1); /* Actually enum access */ - fields [3] = build_lang_decl - (FIELD_DECL, NULL_TREE, integer_type_node); + fields [3] = build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node); DECL_BIT_FIELD (fields[3]) = 1; - DECL_FIELD_SIZE (fields[3]) = 2; + DECL_SIZE (fields[3]) = bitsize_int (2); finish_builtin_type (base_desc_type_node, "__base_info", fields, 3, ptr_type_node); diff --git a/gcc/expr.c b/gcc/expr.c index 4d1bdd2beac..4d777f9802b 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -6572,7 +6572,8 @@ expand_expr (exp, target, tmode, modifier) op0 = expand_expr (TREE_VALUE (elt), target, tmode, modifier); if (DECL_BIT_FIELD (TREE_PURPOSE (elt))) { - int bitsize = DECL_FIELD_SIZE (TREE_PURPOSE (elt)); + HOST_WIDE_INT bitsize + = TREE_INT_CST_LOW (DECL_SIZE (TREE_PURPOSE (elt))); if (TREE_UNSIGNED (TREE_TYPE (TREE_PURPOSE (elt)))) { diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 31b6090b709..8b512a3e0a3 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +Mon Feb 28 08:20:42 2000 Richard Kenner + + * java-tree.h (LABEL_PC): Relect name changes in ../tree.h. + (DECL_BIT_INDEX): Use underlying representation. + * parse.h (DECL_INHERITED_SOURCE_LINE): Likewise. + Sun Feb 27 16:40:33 2000 Richard Kenner * expr.c (build_java_ret): Pass proper type to size_binop. diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index 0699461d166..5cfd53379e7 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -402,7 +402,7 @@ struct lang_identifier #define LABEL_PENDING_CHAIN(NODE) DECL_RESULT(NODE) /* In a LABEL_DECL, the corresponding bytecode program counter. */ -#define LABEL_PC(NODE) ((NODE)->decl.saved_insns.i) +#define LABEL_PC(NODE) ((NODE)->decl.u2.i) /* Used during verification to mark the label has "changed". (See JVM Spec). */ #define LABEL_CHANGED(NODE) DECL_LANG_FLAG_6(NODE) @@ -440,7 +440,7 @@ struct lang_identifier /* For a local VAR_DECL, holds the index into a words bitstring that specifies if this decl is definitively assigned. A DECL_BIT_INDEX of -1 means we no longer care. */ -#define DECL_BIT_INDEX(DECL) DECL_FIELD_SIZE(DECL) +#define DECL_BIT_INDEX(DECL) (DECL_CHECK (DECL)->decl.u2.i) /* DECL_LANG_SPECIFIC for FUNCTION_DECLs. */ struct lang_decl diff --git a/gcc/java/parse.h b/gcc/java/parse.h index 41cb0e94c64..ddc8fc19044 100644 --- a/gcc/java/parse.h +++ b/gcc/java/parse.h @@ -593,7 +593,7 @@ typedef struct _jdeplist { /* Macro for the xreferencer */ #define DECL_END_SOURCE_LINE(DECL) DECL_FRAME_SIZE (DECL) -#define DECL_INHERITED_SOURCE_LINE(DECL) DECL_FIELD_SIZE (DECL) +#define DECL_INHERITED_SOURCE_LINE(DECL) (DECL_CHECK (DECL)->decl.u2.i) /* Parser context data structure. */ struct parser_ctxt { diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index de165774912..71da53a331b 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -2468,14 +2468,9 @@ objc_copy_list (list, head) /* The following statement fixes a bug when inheriting instance variables that are declared to be bitfields. finish_struct - expects to find the width of the bitfield in DECL_INITIAL, - which it nulls out after processing the decl of the super - class...rather than change the way finish_struct works (which - is risky), I create the situation it expects...s.naroff - (7/23/89). */ - + expects to find the width of the bitfield in DECL_INITIAL. */ if (DECL_BIT_FIELD (tail) && DECL_INITIAL (tail) == 0) - DECL_INITIAL (tail) = build_int_2 (DECL_FIELD_SIZE (tail), 0); + DECL_INITIAL (tail) = DECL_SIZE (tail); newlist = chainon (newlist, tail); list = TREE_CHAIN (list); @@ -6870,25 +6865,16 @@ encode_field_decl (field_decl, curtype, format) if (flag_next_runtime) { if (DECL_BIT_FIELD (field_decl)) - encode_bitfield (DECL_FIELD_SIZE (field_decl)); - else if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST - && DECL_FIELD_SIZE (field_decl) - && TYPE_MODE (type) > DECL_MODE (field_decl)) - encode_bitfield (DECL_FIELD_SIZE (field_decl)); + encode_bitfield (TREE_INT_CST_LOW (DECL_SIZE (field_decl))); else encode_type (TREE_TYPE (field_decl), curtype, format); } else { - if (DECL_BIT_FIELD (field_decl) - || (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST - && DECL_FIELD_SIZE (field_decl) - && TYPE_MODE (type) > DECL_MODE (field_decl))) - { - encode_complete_bitfield (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field_decl)), - DECL_BIT_FIELD_TYPE (field_decl), - DECL_FIELD_SIZE (field_decl)); - } + if (DECL_BIT_FIELD (field_decl)) + encode_complete_bitfield (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field_decl)), + DECL_BIT_FIELD_TYPE (field_decl), + TREE_INT_CST_LOW (DECL_SIZE (field_decl))); else encode_type (TREE_TYPE (field_decl), curtype, format); } diff --git a/gcc/print-tree.c b/gcc/print-tree.c index 3bef9146c74..1001efb0526 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -269,8 +269,10 @@ print_node (file, prefix, node, indent) indent_to (file, indent + 3); if (!ggc_p) - print_obstack_name ((char *) node, file, ""); - indent_to (file, indent + 3); + { + print_obstack_name ((char *) node, file, ""); + indent_to (file, indent + 3); + } } /* If a permanent object is in the wrong obstack, or the reverse, warn. */ @@ -399,19 +401,31 @@ print_node (file, prefix, node, indent) print_node (file, "size", DECL_SIZE (node), indent + 4); print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4); - indent_to (file, indent + 3); + if (TREE_CODE (node) != FUNCTION_DECL + || DECL_INLINE (node) || DECL_BUILT_IN (node)) + indent_to (file, indent + 3); + if (TREE_CODE (node) != FUNCTION_DECL) fprintf (file, " align %d", DECL_ALIGN (node)); else if (DECL_INLINE (node)) - fprintf (file, " frame_size %d", DECL_FRAME_SIZE (node)); + { + fprintf (file, " frame_size "); + fprintf (file, HOST_WIDE_INT_PRINT_DEC, DECL_FRAME_SIZE (node)); + } else if (DECL_BUILT_IN (node)) - fprintf (file, " built-in code %d", DECL_FUNCTION_CODE (node)); - if (TREE_CODE (node) == FIELD_DECL) - print_node (file, "bitpos", DECL_FIELD_BITPOS (node), indent + 4); + fprintf (file, " built-in %s:%s", + built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)], + built_in_names[(int) DECL_FUNCTION_CODE (node)]); + if (DECL_POINTER_ALIAS_SET_KNOWN_P (node)) fprintf (file, " alias set %d", DECL_POINTER_ALIAS_SET (node)); + + if (TREE_CODE (node) == FIELD_DECL) + print_node (file, "bitpos", DECL_FIELD_BITPOS (node), indent + 4); + print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4); - print_node_brief (file, "machine_attributes", DECL_MACHINE_ATTRIBUTES (node), indent + 4); + print_node_brief (file, "machine_attributes", + DECL_MACHINE_ATTRIBUTES (node), indent + 4); print_node_brief (file, "abstract_origin", DECL_ABSTRACT_ORIGIN (node), indent + 4); diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index b86a42290cc..83a220abdf8 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -265,13 +265,20 @@ layout_decl (decl, known_align) { register tree type = TREE_TYPE (decl); register enum tree_code code = TREE_CODE (decl); - int spec_size = DECL_FIELD_SIZE (decl); + HOST_WIDE_INT spec_size = 0; if (code == CONST_DECL) return; - - if (code != VAR_DECL && code != PARM_DECL && code != RESULT_DECL - && code != FIELD_DECL && code != TYPE_DECL) + else if (code == FIELD_DECL) + { + if (DECL_SIZE (decl) != 0) + { + spec_size = TREE_INT_CST_LOW (DECL_SIZE (decl)); + DECL_SIZE (decl) = 0; + } + } + else if (code != VAR_DECL && code != PARM_DECL && code != RESULT_DECL + && code != TYPE_DECL) abort (); if (type == error_mark_node) diff --git a/gcc/tree.h b/gcc/tree.h index c472e307685..76b807229dd 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -67,8 +67,8 @@ extern int tree_code_length[MAX_TREE_CODES]; extern const char *tree_code_name[MAX_TREE_CODES]; -/* Classify which part of the compiler has defined a given builtin - function. */ +/* Classify which part of the compiler has defined a given builtin function. + Note that we assume below that this is no more than two bits. */ enum built_in_class { NOT_BUILT_IN = 0, @@ -76,6 +76,10 @@ enum built_in_class BUILT_IN_MD, BUILT_IN_NORMAL }; + +/* Names for the above. */ +extern char *built_in_class_names[4]; + /* Codes that identify the various built in functions so that expand_call can identify them quickly. */ @@ -149,6 +153,9 @@ enum built_in_function /* Upper bound on non-language-specific builtins. */ END_BUILTINS }; + +/* Names for the above. */ +extern char *built_in_names[(int) END_BUILTINS]; /* The definition of tree nodes fills the next several pages. */ @@ -951,7 +958,7 @@ struct tree_type unsigned char precision; #ifdef ONLY_INT_FIELDS - int mode : 8; + unsigned int mode : 8; #else enum machine_mode mode : 8; #endif @@ -1146,7 +1153,7 @@ struct tree_type /* Likewise for the size in bytes. */ #define DECL_SIZE_UNIT(NODE) (DECL_CHECK (NODE)->decl.size_unit) /* Holds the alignment required for the datum. */ -#define DECL_ALIGN(NODE) (DECL_CHECK (NODE)->decl.frame_size.u) +#define DECL_ALIGN(NODE) (DECL_CHECK (NODE)->decl.u1.u) /* Holds the machine mode corresponding to the declaration of a variable or field. Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a FIELD_DECL. */ @@ -1162,18 +1169,15 @@ struct tree_type #define DECL_LIVE_RANGE_RTL(NODE) (DECL_CHECK (NODE)->decl.live_range_rtl) /* For PARM_DECL, holds an RTL for the stack slot or register where the data was actually passed. */ -#define DECL_INCOMING_RTL(NODE) (DECL_CHECK (NODE)->decl.saved_insns.r) +#define DECL_INCOMING_RTL(NODE) (DECL_CHECK (NODE)->decl.u2.r) /* For FUNCTION_DECL, if it is inline, holds the saved insn chain. */ -#define DECL_SAVED_INSNS(NODE) (DECL_CHECK (NODE)->decl.saved_insns.f) +#define DECL_SAVED_INSNS(NODE) (DECL_CHECK (NODE)->decl.u2.f) /* For FUNCTION_DECL, if it is inline, holds the size of the stack frame, as an integer. */ -#define DECL_FRAME_SIZE(NODE) (DECL_CHECK (NODE)->decl.frame_size.i) +#define DECL_FRAME_SIZE(NODE) (DECL_CHECK (NODE)->decl.u1.i) /* For FUNCTION_DECL, if it is built-in, this identifies which built-in operation it is. */ -#define DECL_FUNCTION_CODE(NODE) (DECL_CHECK (NODE)->decl.frame_size.f.code) -#define DECL_SET_FUNCTION_CODE(NODE,VAL) (DECL_CHECK (NODE)->decl.frame_size.f.code = (VAL)) -/* For a FIELD_DECL, holds the size of the member as an integer. */ -#define DECL_FIELD_SIZE(NODE) (DECL_CHECK (NODE)->decl.saved_insns.i) +#define DECL_FUNCTION_CODE(NODE) (DECL_CHECK (NODE)->decl.u1.f) /* The DECL_VINDEX is used for FUNCTION_DECLS in two different ways. Before the struct containing the FUNCTION_DECL is laid out, @@ -1297,7 +1301,7 @@ struct tree_type /* In a FUNCTION_DECL, nonzero means a built in function. */ #define DECL_BUILT_IN(NODE) (DECL_BUILT_IN_CLASS (NODE) != NOT_BUILT_IN) /* For a builtin function, identify which part of the compiler defined it. */ -#define DECL_BUILT_IN_CLASS(NODE) (DECL_CHECK (NODE)->decl.frame_size.f.bclass) +#define DECL_BUILT_IN_CLASS(NODE) (DECL_CHECK (NODE)->decl.built_in_class) /* In a VAR_DECL that's static, nonzero if the space is in the text section. */ @@ -1410,6 +1414,18 @@ struct tree_decl unsigned artificial_flag : 1; unsigned weak_flag : 1; + unsigned non_addr_const_p : 1; + unsigned no_instrument_function_entry_exit : 1; + unsigned no_check_memory_usage : 1; + unsigned comdat_flag : 1; + unsigned malloc_flag : 1; + unsigned no_limit_stack : 1; +#ifdef ONLY_INT_FIELDS + unsigned int built_in_class : 2; +#else + enum built_in_class built_in_class : 2; +#endif + unsigned lang_flag_0 : 1; unsigned lang_flag_1 : 1; unsigned lang_flag_2 : 1; @@ -1419,25 +1435,14 @@ struct tree_decl unsigned lang_flag_6 : 1; unsigned lang_flag_7 : 1; - unsigned non_addr_const_p : 1; - unsigned no_instrument_function_entry_exit : 1; - unsigned no_check_memory_usage : 1; - unsigned comdat_flag : 1; - unsigned malloc_flag : 1; - unsigned no_limit_stack : 1; - /* For a FUNCTION_DECL, if inline, this is the size of frame needed. If built-in, this is the code for which built-in function. For other kinds of decls, this is DECL_ALIGN. */ union { - int i; + HOST_WIDE_INT i; unsigned int u; - struct - { - unsigned int code:24; - unsigned int bclass:8; - } f; - } frame_size; + enum built_in_function f; + } u1; union tree_node *size_unit; union tree_node *name; @@ -1449,17 +1454,20 @@ struct tree_decl union tree_node *assembler_name; union tree_node *section_name; union tree_node *machine_attributes; - struct rtx_def *rtl; /* acts as link to register transfer language - (rtl) info */ + struct rtx_def *rtl; /* RTL representation for object. */ struct rtx_def *live_range_rtl; - /* For FUNCTION_DECLs: points to insn that constitutes its definition - on the permanent obstack. For FIELD_DECL, this is DECL_FIELD_SIZE. */ + /* In FUNCTION_DECL, if it is inline, holds the saved insn chain. + In PARM_DECL, holds an RTL for the stack slot + of register where the data was actually passed. + Used by Chill and Java in LABEL_DECL and by C++ and Java in VAR_DECL. */ union { struct function *f; struct rtx_def *r; - HOST_WIDE_INT i; - } saved_insns; + union tree_node *t; + int i; + } u2; + union tree_node *vindex; int pointer_alias_set; /* Points to a structure whose details depend on the language in use. */