From: Nathan Sidwell Date: Tue, 24 Aug 2004 16:39:43 +0000 (+0000) Subject: c-decl.c (c_init_decl_processing): Adjust build_common_tree_nodes call. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8c1d6d62a680bf67cb921c550662306b4cb3a67b;p=gcc.git c-decl.c (c_init_decl_processing): Adjust build_common_tree_nodes call. * c-decl.c (c_init_decl_processing): Adjust build_common_tree_nodes call. * expmed.c (const_mult_add_overflow_p): Use build_distinct_type_copy. * stor-layout.c (early_type_list): Remove. (layout_type): Don't append to early_type_list. (initialize_sizetypes): Add signed_p argument. (set_sizetype): Overwrite the stub type nodes directly. * tree.c (copy_node_stat): Clear a type's value cache here ... (build_distinct_type): ... not here. (build_common_tree_nodes): Add signed_sizetype argument. Adjust. * tree.h (initialize_sizetypes): Add signed_p argument. (build_common_tree_nodes): Likewise. * ada/utils.c (gnat_init_decl_processing): Adjust build_common_tree_nodes call. * cp/decl.c (cxx_init_decl_processing): Adjust build_common_tree_nodes call. * fortran/f95-lang.c (gfc_init_decl_processing): Adjust build_common_tree_nodes call. * java/decl.c (java_init_decl_processing): Adjust initialize_sizetypes call. * objc/objc-act.c (get_static_reference): Use build_variant_type_copy. (get_protocol_reference): Likewise. * objc/objc-act.h (TREE_STATIC_TEMPLATE): Use TREE_PRIVATE. * treelang/treetree.c (treelang_init_decl_processing): Adjust build_common_tree_nodes call. From-SVN: r86493 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7d711fa5273..fa822696d77 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2004-08-24 Nathan Sidwell + + * c-decl.c (c_init_decl_processing): Adjust + build_common_tree_nodes call. + * expmed.c (const_mult_add_overflow_p): Use + build_distinct_type_copy. + * stor-layout.c (early_type_list): Remove. + (layout_type): Don't append to early_type_list. + (initialize_sizetypes): Add signed_p argument. + (set_sizetype): Overwrite the stub type nodes directly. + * tree.c (copy_node_stat): Clear a type's value cache here ... + (build_distinct_type): ... not here. + (build_common_tree_nodes): Add signed_sizetype argument. Adjust. + * tree.h (initialize_sizetypes): Add signed_p argument. + (build_common_tree_nodes): Likewise. + + * objc/objc-act.c (get_static_reference): Use + build_variant_type_copy. + (get_protocol_reference): Likewise. + * objc/objc-act.h (TREE_STATIC_TEMPLATE): Use TREE_PRIVATE. + 2004-08-24 Richard Henderson Andrew Pinski diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6ea32826406..dc3dd9a26f9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2004-08-24 Nathan Sidwell + + * ada/utils.c (gnat_init_decl_processing): Adjust + build_common_tree_nodes call. + 2004-08-20 Nathan Sidwell * utils2.c (build_allocator): Use build_int_cst for negative diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index ff57b9adee2..f0440f7eef8 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -381,7 +381,7 @@ gnat_init_decl_processing (void) free_binding_level = 0; gnat_pushlevel (); - build_common_tree_nodes (0); + build_common_tree_nodes (false, false); /* In Ada, we use a signed type for SIZETYPE. Use the signed type corresponding to the size of Pmode. In most cases when ptr_mode and diff --git a/gcc/c-decl.c b/gcc/c-decl.c index ccf2cb7ec70..ffa4747d02a 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2421,7 +2421,7 @@ c_init_decl_processing (void) input_location.line = 0; #endif - build_common_tree_nodes (flag_signed_char); + build_common_tree_nodes (flag_signed_char, false); c_common_nodes_and_builtins (); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cc0a9618942..faebdc08cf4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2004-08-24 Nathan Sidwell + + * cp/decl.c (cxx_init_decl_processing): Adjust + build_common_tree_nodes call. + 2004-08-24 Nathan Sidwell PR c++/16889 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d9a74492c1b..0ae7d7136fe 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2903,7 +2903,7 @@ cxx_init_decl_processing (void) tree void_ftype; tree void_ftype_ptr; - build_common_tree_nodes (flag_signed_char); + build_common_tree_nodes (flag_signed_char, false); /* Create all the identifiers we need. */ initialize_predefined_identifiers (); diff --git a/gcc/expmed.c b/gcc/expmed.c index bb24504d27c..dd79390f9e8 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -4564,13 +4564,7 @@ const_mult_add_overflow_p (rtx x, rtx mult, rtx add, { /* FIXME:It would be nice if we could step directly from this type to its sizetype equivalent. */ - mult_type = copy_node (type); - if (TYPE_CACHED_VALUES_P (mult_type)) - { - /* Clear any set of cached values it has. */ - TYPE_CACHED_VALUES_P (mult_type) = 0; - TYPE_CACHED_VALUES (mult_type) = NULL_TREE; - } + mult_type = build_distinct_type_copy (type); TYPE_IS_SIZETYPE (mult_type) = 1; } diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b6ce788b35b..29f50695c4a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2004-08-24 Nathan Sidwell + + * fortran/f95-lang.c (gfc_init_decl_processing): Adjust + build_common_tree_nodes call. + 2004-08-24 Tobias Schlueter * trans-types.c: Spelling and formatting fixes. @@ -1148,7 +1153,7 @@ * symbol.c (gfc_add_common): Disable checks to work around other more fundamental inadequacies. -2004-05-22 Tobias Schlüter +2004-05-22 Tobias Schlüter * trans-decl.c (gfc_get_extern_function_decl): Set DECL_IS_PURE only for functions. @@ -1356,7 +1361,7 @@ * decl.c (variable_decl): Always apply default initializer. -2004-05-08 Tobias Schlüter +2004-05-08 Tobias Schlüter PR fortran/15206 * trans-intrinsic.c (gfc_conv_intrinsic_rrspacing): Fixed to @@ -1430,7 +1435,7 @@ Remove "set DEVELOPMENT". (Compiling GFORTRAN): Remove. -2004-05-09 Tobias Schlüter +2004-05-09 Tobias Schlüter * array.c (match_subscript, match_array_ref): Add comments explaining argument 'init'. @@ -1440,20 +1445,20 @@ * primary.c (match_digits, match_integer_constant): Add comment explaining signflag. -2004-05-01 Tobias Schlüter +2004-05-01 Tobias Schlüter PR fortran/13940 * primary.c: Include system.h and flags.h, needed for pedantic. (match_boz_constant): Allow "x" for hexadecimal constants, warn if pedantic is set. -2004-05-01 Tobias Schlüter +2004-05-01 Tobias Schlüter PR fortran/13940 * match.c (match_data_constant): Handle case where gfc_find_symbol sets sym to NULL -2004-04-28 Tobias Schlüter +2004-04-28 Tobias Schlüter * Make-lang.in (f95-lang.o, trans-intrinsic.o): Add missing dependency on mathbuiltins.def @@ -1467,7 +1472,7 @@ * gfortranspec.c: Do not include multilib.h. -2004-04-24 Tobias Schlüter +2004-04-24 Tobias Schlüter * trans-intrinsic.c: Fix comment, this is not trans-expr.c. Add 2004 to copyright years. diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index aee5c9594a4..d5b58ce9fd3 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -571,7 +571,7 @@ gfc_init_decl_processing (void) /* Build common tree nodes. char_type_node is unsigned because we only use it for actual characters, not for INTEGER(1). Also, we want double_type_node to actually have double precision. */ - build_common_tree_nodes (0); + build_common_tree_nodes (false, false); set_sizetype (long_unsigned_type_node); build_common_tree_nodes_2 (0); diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 0e7bb8b4b0a..dd6274c4cb9 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2004-08-24 Nathan Sidwell + + * java/decl.c (java_init_decl_processing): Adjust + initialize_sizetypes call. + 2004-08-23 Nathan Sidwell * jv-scan.c (fancy_abort): Add. @@ -8596,7 +8601,7 @@ properly initialize `finished_label'. Don't emit gotos for empty try statements. -2000-03-19 Martin v. Löwis +2000-03-19 Martin v. Löwis * except.c (emit_handlers): Clear catch_clauses_last. diff --git a/gcc/java/decl.c b/gcc/java/decl.c index d6bce487f05..93dfcd70537 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -554,7 +554,7 @@ java_init_decl_processing (void) TREE_TYPE (error_mark_node) = error_mark_node; /* Create sizetype first - needed for other types. */ - initialize_sizetypes (); + initialize_sizetypes (false); byte_type_node = make_signed_type (8); pushdecl (build_decl (TYPE_DECL, get_identifier ("byte"), byte_type_node)); diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index cab25f407f3..92e52283c89 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -958,25 +958,11 @@ get_static_reference (tree interface, tree protocols) if (protocols) { - tree t, m = TYPE_MAIN_VARIANT (type); - - t = copy_node (type); - - /* Add this type to the chain of variants of TYPE. */ - TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m); - TYPE_NEXT_VARIANT (m) = t; - + type = build_variant_type_copy (type); + /* Look up protocols and install in lang specific list. Note that the protocol list can have a different lifetime than T! */ - SET_TYPE_PROTOCOL_LIST (t, lookup_and_install_protocols (protocols)); - - /* This forces a new pointer type to be created later - (in build_pointer_type)...so that the new template - we just created will actually be used...what a hack! */ - if (TYPE_POINTER_TO (t)) - TYPE_POINTER_TO (t) = NULL_TREE; - - type = t; + SET_TYPE_PROTOCOL_LIST (type, lookup_and_install_protocols (protocols)); } return type; @@ -1008,24 +994,10 @@ get_protocol_reference (tree protocols) if (protocols) { - tree t, m = TYPE_MAIN_VARIANT (type); - - t = copy_node (type); - - /* Add this type to the chain of variants of TYPE. */ - TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m); - TYPE_NEXT_VARIANT (m) = t; + type = build_variant_type_copy (type); /* Look up protocols...and install in lang specific list */ - SET_TYPE_PROTOCOL_LIST (t, lookup_and_install_protocols (protocols)); - - /* This forces a new pointer type to be created later - (in build_pointer_type)...so that the new template - we just created will actually be used...what a hack! */ - if (TYPE_POINTER_TO (t)) - TYPE_POINTER_TO (t) = NULL_TREE; - - type = t; + SET_TYPE_PROTOCOL_LIST (type, lookup_and_install_protocols (protocols)); } return type; } diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h index eb324b9c520..75507aef7af 100644 --- a/gcc/objc/objc-act.h +++ b/gcc/objc/objc-act.h @@ -125,7 +125,7 @@ tree build_encode_expr (tree); /* Set by `continue_class' and checked by `objc_is_public'. */ -#define TREE_STATIC_TEMPLATE(record_type) (TREE_PUBLIC (record_type)) +#define TREE_STATIC_TEMPLATE(record_type) (TREE_PRIVATE (record_type)) #define TYPED_OBJECT(type) \ (TREE_CODE (type) == RECORD_TYPE && TREE_STATIC_TEMPLATE (type)) #define OBJC_TYPE_NAME(type) TYPE_NAME(type) diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index acbba553547..3b04dc724e6 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -40,10 +40,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA /* Set to one when set_sizetype has been called. */ static int sizetype_set; -/* List of types created before set_sizetype has been called. We do not - make this a GGC root since we want these nodes to be reclaimed. */ -static tree early_type_list; - /* Data type for the expressions representing sizes of data types. It is the first integer type laid out. */ tree sizetype_tab[(int) TYPE_KIND_LAST]; @@ -1812,11 +1808,6 @@ layout_type (tree type) && TREE_CODE (type) != QUAL_UNION_TYPE) finalize_type_size (type); - /* If this type is created before sizetype has been permanently set, - record it so set_sizetype can fix it up. */ - if (! sizetype_set) - early_type_list = tree_cons (NULL_TREE, type, early_type_list); - /* If an alias set has been set for this aggregate when it was incomplete, force it into alias set 0. This is too conservative, but we cannot call record_component_aliases @@ -1856,7 +1847,7 @@ make_unsigned_type (int precision) value to enable integer types to be created. */ void -initialize_sizetypes (void) +initialize_sizetypes (bool signed_p) { tree t = make_node (INTEGER_TYPE); @@ -1864,9 +1855,9 @@ initialize_sizetypes (void) TYPE_ALIGN (t) = GET_MODE_ALIGNMENT (SImode); TYPE_USER_ALIGN (t) = 0; TYPE_IS_SIZETYPE (t) = 1; + TYPE_UNSIGNED (t) = !signed_p; TYPE_SIZE (t) = build_int_cst (t, GET_MODE_BITSIZE (SImode), 0); TYPE_SIZE_UNIT (t) = build_int_cst (t, GET_MODE_SIZE (SImode), 0); - TYPE_UNSIGNED (t) = 1; TYPE_PRECISION (t) = GET_MODE_BITSIZE (SImode); TYPE_MIN_VALUE (t) = build_int_cst (t, 0, 0); @@ -1874,16 +1865,15 @@ initialize_sizetypes (void) larger than any size value we'd want to be storing. */ TYPE_MAX_VALUE (t) = build_int_cst (t, 1000, 0); - /* These two must be different nodes because of the caching done in - size_int_wide. */ sizetype = t; - bitsizetype = copy_node (t); - TYPE_CACHED_VALUES (bitsizetype) = NULL_TREE; - TYPE_CACHED_VALUES_P (bitsizetype) = 0; + bitsizetype = build_distinct_type_copy (t); } -/* Set sizetype to TYPE, and initialize *sizetype accordingly. - Also update the type of any standard type's sizes made so far. */ +/* Make sizetype a version of TYPE, and initialize *sizetype + accordingly. We do this by overwriting the stub sizetype and + bitsizetype nodes created by initialize_sizetypes. This makes sure + that (a) anything stubby about them no longer exists, (b) any + INTEGER_CSTs created with such a type, remain valid. */ void set_sizetype (tree type) @@ -1895,67 +1885,52 @@ set_sizetype (tree type) precision. */ int precision = MIN (oprecision + BITS_PER_UNIT_LOG + 1, 2 * HOST_BITS_PER_WIDE_INT); - unsigned int i; tree t; if (sizetype_set) abort (); + if (TYPE_UNSIGNED (type) != TYPE_UNSIGNED (sizetype)) + abort (); - /* Make copies of nodes since we'll be setting TYPE_IS_SIZETYPE. */ - sizetype = copy_node (type); - TYPE_CACHED_VALUES (sizetype) = make_tree_vec (INTEGER_SHARE_LIMIT); - TYPE_CACHED_VALUES_P (sizetype) = 1; - TREE_TYPE (TYPE_CACHED_VALUES (sizetype)) = type; - TYPE_IS_SIZETYPE (sizetype) = 1; - bitsizetype = make_node (INTEGER_TYPE); - TYPE_NAME (bitsizetype) = TYPE_NAME (type); - TYPE_PRECISION (bitsizetype) = precision; - TYPE_IS_SIZETYPE (bitsizetype) = 1; - - if (TYPE_UNSIGNED (type)) - fixup_unsigned_type (bitsizetype); - else - fixup_signed_type (bitsizetype); - - layout_type (bitsizetype); - + t = build_distinct_type_copy (type); + /* We do want to use sizetype's cache, as we will be replacing that + type. */ + TYPE_CACHED_VALUES (t) = TYPE_CACHED_VALUES (sizetype); + TYPE_CACHED_VALUES_P (t) = TYPE_CACHED_VALUES_P (sizetype); + TREE_TYPE (TYPE_CACHED_VALUES (t)) = type; + TYPE_UID (t) = TYPE_UID (sizetype); + TYPE_IS_SIZETYPE (t) = 1; + + /* Replace our original stub sizetype. */ + memcpy (sizetype, t, tree_size (sizetype)); + TYPE_MAIN_VARIANT (sizetype) = sizetype; + + t = make_node (INTEGER_TYPE); + TYPE_NAME (t) = get_identifier ("bit_size_type"); + /* We do want to use bitsizetype's cache, as we will be replacing that + type. */ + TYPE_CACHED_VALUES (t) = TYPE_CACHED_VALUES (bitsizetype); + TYPE_CACHED_VALUES_P (t) = TYPE_CACHED_VALUES_P (bitsizetype); + TYPE_PRECISION (t) = precision; + TYPE_UID (t) = TYPE_UID (bitsizetype); + TYPE_IS_SIZETYPE (t) = 1; + /* Replace our original stub bitsizetype. */ + memcpy (bitsizetype, t, tree_size (bitsizetype)); + if (TYPE_UNSIGNED (type)) { - ssizetype = copy_node (make_signed_type (oprecision)); - sbitsizetype = copy_node (make_signed_type (precision)); + fixup_unsigned_type (bitsizetype); + ssizetype = build_distinct_type_copy (make_signed_type (oprecision)); + TYPE_IS_SIZETYPE (ssizetype) = 1; + sbitsizetype = build_distinct_type_copy (make_signed_type (precision)); + TYPE_IS_SIZETYPE (sbitsizetype) = 1; } else { + fixup_signed_type (bitsizetype); ssizetype = sizetype; sbitsizetype = bitsizetype; } - - TYPE_NAME (bitsizetype) = get_identifier ("bit_size_type"); - - /* Show is a sizetype, is a main type, and has no pointers to it. */ - for (i = 0; i < ARRAY_SIZE (sizetype_tab); i++) - { - TYPE_IS_SIZETYPE (sizetype_tab[i]) = 1; - TYPE_MAIN_VARIANT (sizetype_tab[i]) = sizetype_tab[i]; - TYPE_NEXT_VARIANT (sizetype_tab[i]) = 0; - TYPE_POINTER_TO (sizetype_tab[i]) = 0; - TYPE_REFERENCE_TO (sizetype_tab[i]) = 0; - } - - /* Go down each of the types we already made and set the proper type - for the sizes in them. */ - for (t = early_type_list; t != 0; t = TREE_CHAIN (t)) - { - if (TREE_CODE (TREE_VALUE (t)) != INTEGER_TYPE - && TREE_CODE (TREE_VALUE (t)) != BOOLEAN_TYPE) - abort (); - - TREE_TYPE (TYPE_SIZE (TREE_VALUE (t))) = bitsizetype; - TREE_TYPE (TYPE_SIZE_UNIT (TREE_VALUE (t))) = sizetype; - } - - early_type_list = 0; - sizetype_set = 1; } /* TYPE is an integral type, i.e., an INTEGRAL_TYPE, ENUMERAL_TYPE, diff --git a/gcc/tree.c b/gcc/tree.c index e2cf0c0ad88..12aa391d8e8 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -392,6 +392,13 @@ copy_node_stat (tree node MEM_STAT_DECL) but the optimizer should catch that. */ TYPE_SYMTAB_POINTER (t) = 0; TYPE_SYMTAB_ADDRESS (t) = 0; + + /* Do not copy the values cache. */ + if (TYPE_CACHED_VALUES_P(t)) + { + TYPE_CACHED_VALUES_P (t) = 0; + TYPE_CACHED_VALUES (t) = NULL_TREE; + } } return t; @@ -3141,15 +3148,6 @@ build_distinct_type_copy (tree type) { tree t = copy_node (type); - if (TYPE_CACHED_VALUES_P(t)) - { - /* Do not copy the values cache. */ - if (TREE_CODE (t) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t)) - abort (); - TYPE_CACHED_VALUES_P (t) = 0; - TYPE_CACHED_VALUES (t) = NULL_TREE; - } - TYPE_POINTER_TO (t) = 0; TYPE_REFERENCE_TO (t) = 0; @@ -5374,12 +5372,12 @@ make_or_reuse_type (unsigned size, int unsignedp) this function to select one of the types as sizetype. */ void -build_common_tree_nodes (int signed_char) +build_common_tree_nodes (bool signed_char, bool signed_sizetype) { error_mark_node = make_node (ERROR_MARK); TREE_TYPE (error_mark_node) = error_mark_node; - initialize_sizetypes (); + initialize_sizetypes (signed_sizetype); /* Define both `signed char' and `unsigned char'. */ signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE); diff --git a/gcc/tree.h b/gcc/tree.h index e0df473f32b..8d916efbe5f 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2770,7 +2770,7 @@ extern tree build_empty_stmt (void); extern tree make_signed_type (int); extern tree make_unsigned_type (int); -extern void initialize_sizetypes (void); +extern void initialize_sizetypes (bool); extern void set_sizetype (tree); extern void fixup_unsigned_type (tree); extern tree build_pointer_type_for_mode (tree, enum machine_mode, bool); @@ -3499,7 +3499,7 @@ extern int real_onep (tree); extern int real_twop (tree); extern int real_minus_onep (tree); extern void init_ttree (void); -extern void build_common_tree_nodes (int); +extern void build_common_tree_nodes (bool, bool); extern void build_common_tree_nodes_2 (int); extern tree build_nonstandard_integer_type (unsigned HOST_WIDE_INT, int); extern tree build_range_type (tree, tree, tree); diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog index 950a33524e8..b6d89cb263e 100644 --- a/gcc/treelang/ChangeLog +++ b/gcc/treelang/ChangeLog @@ -1,3 +1,8 @@ +2004-08-24 Nathan Sidwell + + * treelang/treetree.c (treelang_init_decl_processing): Adjust + build_common_tree_nodes call. + 2004-08-14 Nathan Sidwell * treetree.c (tree_code_get_integer_value): Use build_int_cst. diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c index a2bdc0070a8..b55c6d1d057 100644 --- a/gcc/treelang/treetree.c +++ b/gcc/treelang/treetree.c @@ -1179,7 +1179,7 @@ treelang_init_decl_processing (void) pushlevel (0); /* make the binding_level structure for global names */ global_binding_level = current_binding_level; - build_common_tree_nodes (flag_signed_char); + build_common_tree_nodes (flag_signed_char, false); /* set standard type names */