diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 33f2df97aa0..994ce27b677 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,33 @@ +Fri Sep 10 10:32:32 1999 Bernd Schmidt + + * c-common.c (c_common_nodes_and_builtins): Don't build + va_list_type_node. + * c-common.h (enum c_tree_index and related accesor macros): Remove + everything now declared in tree.h. + * c-decl.c (CHAR_TYPE_SIZE, SHORT_TYPE_SIZE, INT_TYPE_SIZE, + LONG_TYPE_SIZE, LONG_LONG_TYPE_SIZE, WCHAR_UNSIGNED, FLOAT_TYPE_SIZE, + DOUBLE_TYPE_SIZE, LONG_DOUBLE_TYPE_SIZE): Don't provide defaults. + (error_mark_node, void_type_node, char_type_node, integer_type_node, + unsigned_type_node, ptr_type_node, va_list_type_node, + integer_zero_node, null_pointer_node, integer_one_node): Delete. + (init_decl_processing): Call build_common_tree_nodes and + build_common_tree_nodes_2 instead of building their nodes here. + Don't add roots for these nodes. + * stor-layout.c (size_zero_node, size_one_node): Delete. + (set_sizetype): Make a new node for bitsizetype each time. + * tree.c (global_trees): New variable. + (init_obstacks): Add a gc root for it. + (CHAR_TYPE_SIZE, SHORT_TYPE_SIZE, INT_TYPE_SIZE, + LONG_TYPE_SIZE, LONG_LONG_TYPE_SIZE, FLOAT_TYPE_SIZE, + DOUBLE_TYPE_SIZE, LONG_DOUBLE_TYPE_SIZE): Provide defaults. + (build_common_tree_nodes): New function. + (fix_sizetype): New function. + (build_common_tree_nodes_2): New function. + * tree.h (enum tree_index): New. + (global_trees): Declare. + Add accessor macros for all nodes now moved to global_trees. + Delete their declarations. + Thu Sep 9 20:15:46 1999 Richard Henderson * c-decl.c (finish_function): When processing a nested function, diff --git a/gcc/c-common.c b/gcc/c-common.c index 9dc881a1724..cd2baab58ce 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -3482,11 +3482,6 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins) tree va_list_ptr_type_node; tree va_list_arg_type_node; -#ifdef BUILD_VA_LIST_TYPE - BUILD_VA_LIST_TYPE(va_list_type_node); -#else - va_list_type_node = ptr_type_node; -#endif pushdecl (build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"), va_list_type_node)); diff --git a/gcc/c-common.h b/gcc/c-common.h index 7514092b5eb..d41677008b0 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -22,50 +22,18 @@ Boston, MA 02111-1307, USA. */ enum c_tree_index { - CTI_INTQI_TYPE, - CTI_INTHI_TYPE, - CTI_INTSI_TYPE, - CTI_INTDI_TYPE, - CTI_INTTI_TYPE, - - CTI_UINTQI_TYPE, - CTI_UINTHI_TYPE, - CTI_UINTSI_TYPE, - CTI_UINTDI_TYPE, - CTI_UINTTI_TYPE, - - CTI_SIGNED_CHAR_TYPE, - CTI_UNSIGNED_CHAR_TYPE, CTI_WCHAR_TYPE, CTI_SIGNED_WCHAR_TYPE, CTI_UNSIGNED_WCHAR_TYPE, - CTI_SHORT_INTEGER_TYPE, - CTI_SHORT_UNSIGNED_TYPE, - CTI_LONG_INTEGER_TYPE, - CTI_LONG_UNSIGNED_TYPE, - CTI_LONG_LONG_INTEGER_TYPE, - CTI_LONG_LONG_UNSIGNED_TYPE, CTI_WIDEST_INT_LIT_TYPE, CTI_WIDEST_UINT_LIT_TYPE, - CTI_COMPLEX_INTEGER_TYPE, - CTI_COMPLEX_FLOAT_TYPE, - CTI_COMPLEX_DOUBLE_TYPE, - CTI_COMPLEX_LONG_DOUBLE_TYPE, - - CTI_FLOAT_TYPE, - CTI_DOUBLE_TYPE, - CTI_LONG_DOUBLE_TYPE, - CTI_CHAR_ARRAY_TYPE, CTI_WCHAR_ARRAY_TYPE, CTI_INT_ARRAY_TYPE, CTI_STRING_TYPE, CTI_CONST_STRING_TYPE, - CTI_CONST_PTR_TYPE, - CTI_PTRDIFF_TYPE, - CTI_BOOLEAN_TYPE, CTI_BOOLEAN_TRUE, CTI_BOOLEAN_FALSE, @@ -82,52 +50,16 @@ enum c_tree_index extern tree c_global_trees[CTI_MAX]; -#define intQI_type_node c_global_trees[CTI_INTQI_TYPE] -#define intHI_type_node c_global_trees[CTI_INTHI_TYPE] -#define intSI_type_node c_global_trees[CTI_INTSI_TYPE] -#define intDI_type_node c_global_trees[CTI_INTDI_TYPE] -#if HOST_BITS_PER_WIDE_INT >= 64 -#define intTI_type_node c_global_trees[CTI_INTTI_TYPE] -#endif - -#define unsigned_intQI_type_node c_global_trees[CTI_UINTQI_TYPE] -#define unsigned_intHI_type_node c_global_trees[CTI_UINTHI_TYPE] -#define unsigned_intSI_type_node c_global_trees[CTI_UINTSI_TYPE] -#define unsigned_intDI_type_node c_global_trees[CTI_UINTDI_TYPE] -#if HOST_BITS_PER_WIDE_INT >= 64 -#define unsigned_intTI_type_node c_global_trees[CTI_UINTTI_TYPE] -#endif - -#define signed_char_type_node c_global_trees[CTI_SIGNED_CHAR_TYPE] -#define unsigned_char_type_node c_global_trees[CTI_UNSIGNED_CHAR_TYPE] #define wchar_type_node c_global_trees[CTI_WCHAR_TYPE] #define signed_wchar_type_node c_global_trees[CTI_SIGNED_WCHAR_TYPE] #define unsigned_wchar_type_node c_global_trees[CTI_UNSIGNED_WCHAR_TYPE] -#define short_integer_type_node c_global_trees[CTI_SHORT_INTEGER_TYPE] -#define short_unsigned_type_node c_global_trees[CTI_SHORT_UNSIGNED_TYPE] -#define long_integer_type_node c_global_trees[CTI_LONG_INTEGER_TYPE] -#define long_unsigned_type_node c_global_trees[CTI_LONG_UNSIGNED_TYPE] -#define long_long_integer_type_node c_global_trees[CTI_LONG_LONG_INTEGER_TYPE] -#define long_long_unsigned_type_node c_global_trees[CTI_LONG_LONG_UNSIGNED_TYPE] #define widest_integer_literal_type_node c_global_trees[CTI_WIDEST_INT_LIT_TYPE] #define widest_unsigned_literal_type_node c_global_trees[CTI_WIDEST_UINT_LIT_TYPE] -#define float_type_node c_global_trees[CTI_FLOAT_TYPE] -#define double_type_node c_global_trees[CTI_DOUBLE_TYPE] -#define long_double_type_node c_global_trees[CTI_LONG_DOUBLE_TYPE] - -#define complex_integer_type_node c_global_trees[CTI_COMPLEX_INTEGER_TYPE] -#define complex_float_type_node c_global_trees[CTI_COMPLEX_FLOAT_TYPE] -#define complex_double_type_node c_global_trees[CTI_COMPLEX_DOUBLE_TYPE] -#define complex_long_double_type_node c_global_trees[CTI_COMPLEX_LONG_DOUBLE_TYPE] - #define boolean_type_node c_global_trees[CTI_BOOLEAN_TYPE] #define boolean_true_node c_global_trees[CTI_BOOLEAN_TRUE] #define boolean_false_node c_global_trees[CTI_BOOLEAN_FALSE] -#define const_ptr_type_node c_global_trees[CTI_CONST_PTR_TYPE] -#define ptrdiff_type_node c_global_trees[CTI_PTRDIFF_TYPE] - #define char_array_type_node c_global_trees[CTI_CHAR_ARRAY_TYPE] #define wchar_array_type_node c_global_trees[CTI_WCHAR_ARRAY_TYPE] #define int_array_type_node c_global_trees[CTI_INT_ARRAY_TYPE] diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 33c004252ff..f018d85b681 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -52,42 +52,6 @@ enum decl_context BITFIELD, /* Likewise but with specified width */ TYPENAME}; /* Typename (inside cast or sizeof) */ -#ifndef CHAR_TYPE_SIZE -#define CHAR_TYPE_SIZE BITS_PER_UNIT -#endif - -#ifndef SHORT_TYPE_SIZE -#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2)) -#endif - -#ifndef INT_TYPE_SIZE -#define INT_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef LONG_TYPE_SIZE -#define LONG_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef LONG_LONG_TYPE_SIZE -#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2) -#endif - -#ifndef WCHAR_UNSIGNED -#define WCHAR_UNSIGNED 0 -#endif - -#ifndef FLOAT_TYPE_SIZE -#define FLOAT_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef DOUBLE_TYPE_SIZE -#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) -#endif - -#ifndef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) -#endif - /* We let tm.h override the types used here, to handle trivial differences such as the choice of unsigned int or long unsigned int for size_t. When machines start needing nontrivial differences in the size type, @@ -109,38 +73,6 @@ enum decl_context /* Don't do GC. */ int ggc_p = 0; -/* a node which has tree code ERROR_MARK, and whose type is itself. - All erroneous expressions are replaced with this node. All functions - that accept nodes as arguments should avoid generating error messages - if this node is one of the arguments, since it is undesirable to get - multiple error messages from one error in the input. */ - -tree error_mark_node; - -/* These can't be part of the above array, since they are declared - individually in tree.h, and used by the debug output routines. */ - -tree void_type_node; -tree char_type_node; -tree integer_type_node; -tree unsigned_type_node; - -/* These can't be part of the above array, since they are declared - individially in tree.h and used by the target routines. */ - -tree ptr_type_node; -tree va_list_type_node; - -/* Two expressions that are constants with value zero. - The first is of type `int', the second of type `void *'. */ - -tree integer_zero_node; -tree null_pointer_node; - -/* A node for the integer constant 1. */ - -tree integer_one_node; - /* Nonzero if we have seen an invalid cross reference to a struct, union, or enum, but not yet printed the message. */ @@ -2975,49 +2907,45 @@ init_decl_processing () pushlevel (0); /* make the binding_level structure for global names */ global_binding_level = current_binding_level; - /* Define `int' and `char' first so that dbx will output them first. */ + build_common_tree_nodes (flag_signed_char); - integer_type_node = make_signed_type (INT_TYPE_SIZE); + /* Define `int' and `char' first so that dbx will output them first. */ pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_INT], integer_type_node)); - - /* Define `char', which is like either `signed char' or `unsigned char' - but not the same as either. */ - - char_type_node - = (flag_signed_char - ? make_signed_type (CHAR_TYPE_SIZE) - : make_unsigned_type (CHAR_TYPE_SIZE)); pushdecl (build_decl (TYPE_DECL, get_identifier ("char"), char_type_node)); - - long_integer_type_node = make_signed_type (LONG_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("long int"), long_integer_type_node)); - - unsigned_type_node = make_unsigned_type (INT_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned int"), unsigned_type_node)); - - long_unsigned_type_node = make_unsigned_type (LONG_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("long unsigned int"), long_unsigned_type_node)); - - long_long_integer_type_node = make_signed_type (LONG_LONG_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("long long int"), long_long_integer_type_node)); - - long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("long long unsigned int"), long_long_unsigned_type_node)); - - short_integer_type_node = make_signed_type (SHORT_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("short int"), short_integer_type_node)); - - short_unsigned_type_node = make_unsigned_type (SHORT_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("short unsigned int"), short_unsigned_type_node)); + pushdecl (build_decl (TYPE_DECL, get_identifier ("signed char"), + signed_char_type_node)); + pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned char"), + unsigned_char_type_node)); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node)); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node)); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node)); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node)); +#if HOST_BITS_PER_WIDE_INT >= 64 + pushdecl (build_decl (TYPE_DECL, NULL_TREE, intTI_type_node)); +#endif + pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node)); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node)); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node)); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node)); +#if HOST_BITS_PER_WIDE_INT >= 64 + pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intTI_type_node)); +#endif /* `unsigned long' is the standard type for sizeof. Traditionally, use a signed type. @@ -3028,109 +2956,32 @@ init_decl_processing () if (flag_traditional && TREE_UNSIGNED (sizetype)) set_sizetype (signed_type (sizetype)); - ptrdiff_type_node - = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE))); - - error_mark_node = make_node (ERROR_MARK); - TREE_TYPE (error_mark_node) = error_mark_node; - - /* Define both `signed char' and `unsigned char'. */ - signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("signed char"), - signed_char_type_node)); - - unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned char"), - unsigned_char_type_node)); - /* Create the widest literal types. */ widest_integer_literal_type_node = make_signed_type (HOST_BITS_PER_WIDE_INT * 2); + widest_unsigned_literal_type_node = make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2); pushdecl (build_decl (TYPE_DECL, NULL_TREE, widest_integer_literal_type_node)); - - widest_unsigned_literal_type_node = make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2); pushdecl (build_decl (TYPE_DECL, NULL_TREE, widest_unsigned_literal_type_node)); - /* Now all the integer mode types. */ - intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node)); + build_common_tree_nodes_2 (flag_short_double); - intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node)); - - intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node)); - - intDI_type_node = make_signed_type (GET_MODE_BITSIZE (DImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node)); - -#if HOST_BITS_PER_WIDE_INT >= 64 - intTI_type_node = make_signed_type (GET_MODE_BITSIZE (TImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intTI_type_node)); -#endif - - unsigned_intQI_type_node = make_unsigned_type (GET_MODE_BITSIZE (QImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node)); - - unsigned_intHI_type_node = make_unsigned_type (GET_MODE_BITSIZE (HImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node)); - - unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node)); - - unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node)); - -#if HOST_BITS_PER_WIDE_INT >= 64 - unsigned_intTI_type_node = make_unsigned_type (GET_MODE_BITSIZE (TImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intTI_type_node)); -#endif - - float_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE; pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_FLOAT], float_type_node)); - layout_type (float_type_node); - - double_type_node = make_node (REAL_TYPE); - if (flag_short_double) - TYPE_PRECISION (double_type_node) = FLOAT_TYPE_SIZE; - else - TYPE_PRECISION (double_type_node) = DOUBLE_TYPE_SIZE; pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_DOUBLE], double_type_node)); - layout_type (double_type_node); - - long_double_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE; pushdecl (build_decl (TYPE_DECL, get_identifier ("long double"), long_double_type_node)); - layout_type (long_double_type_node); - - complex_integer_type_node = make_node (COMPLEX_TYPE); pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"), complex_integer_type_node)); - TREE_TYPE (complex_integer_type_node) = integer_type_node; - layout_type (complex_integer_type_node); - - complex_float_type_node = make_node (COMPLEX_TYPE); pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"), complex_float_type_node)); - TREE_TYPE (complex_float_type_node) = float_type_node; - layout_type (complex_float_type_node); - - complex_double_type_node = make_node (COMPLEX_TYPE); pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"), complex_double_type_node)); - TREE_TYPE (complex_double_type_node) = double_type_node; - layout_type (complex_double_type_node); - - complex_long_double_type_node = make_node (COMPLEX_TYPE); pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"), complex_long_double_type_node)); - TREE_TYPE (complex_long_double_type_node) = long_double_type_node; - layout_type (complex_long_double_type_node); + pushdecl (build_decl (TYPE_DECL, + ridpointers[(int) RID_VOID], void_type_node)); wchar_type_node = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (WCHAR_TYPE))); @@ -3138,32 +2989,10 @@ init_decl_processing () signed_wchar_type_node = signed_type (wchar_type_node); unsigned_wchar_type_node = unsigned_type (wchar_type_node); - integer_zero_node = build_int_2 (0, 0); - TREE_TYPE (integer_zero_node) = integer_type_node; - integer_one_node = build_int_2 (1, 0); - TREE_TYPE (integer_one_node) = integer_type_node; - boolean_type_node = integer_type_node; boolean_true_node = integer_one_node; boolean_false_node = integer_zero_node; - size_zero_node = build_int_2 (0, 0); - TREE_TYPE (size_zero_node) = sizetype; - size_one_node = build_int_2 (1, 0); - TREE_TYPE (size_one_node) = sizetype; - - void_type_node = make_node (VOID_TYPE); - pushdecl (build_decl (TYPE_DECL, - ridpointers[(int) RID_VOID], void_type_node)); - layout_type (void_type_node); /* Uses integer_zero_node */ - /* We are not going to have real types in C with less than byte alignment, - so we might as well not have any types that claim to have it. */ - TYPE_ALIGN (void_type_node) = BITS_PER_UNIT; - - null_pointer_node = build_int_2 (0, 0); - TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node); - layout_type (TREE_TYPE (null_pointer_node)); - string_type_node = build_pointer_type (char_type_node); const_string_type_node = build_pointer_type (build_type_variant (char_type_node, 1, 0)); @@ -3191,10 +3020,8 @@ init_decl_processing () default_function_type = build_function_type (integer_type_node, NULL_TREE); - - ptr_type_node = build_pointer_type (void_type_node); - const_ptr_type_node - = build_pointer_type (build_type_variant (void_type_node, 1, 0)); + ptrdiff_type_node + = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE))); c_common_nodes_and_builtins (0, flag_no_builtin, flag_no_nonansi_builtin); @@ -3254,19 +3081,7 @@ init_decl_processing () ggc_add_tree_root (c_global_trees, CTI_MAX); ggc_add_tree_root (¤t_function_decl, 1); - ggc_add_tree_root (&error_mark_node, 1); - ggc_add_tree_root (&ptr_type_node, 1); - ggc_add_tree_root (&va_list_type_node, 1); - ggc_add_tree_root (&void_type_node, 1); - ggc_add_tree_root (&char_type_node, 1); - ggc_add_tree_root (&integer_type_node, 1); - ggc_add_tree_root (&unsigned_type_node, 1); - ggc_add_tree_root (&integer_one_node, 1); - ggc_add_tree_root (&integer_zero_node, 1); ggc_add_tree_root (&named_labels, 1); - ggc_add_tree_root (&null_pointer_node, 1); - ggc_add_tree_root (&size_one_node, 1); - ggc_add_tree_root (&size_zero_node, 1); ggc_add_tree_root (&shadowed_labels, 1); ggc_add_root (¤t_binding_level, 1, sizeof current_binding_level, mark_binding_level); diff --git a/gcc/ch/ChangeLog b/gcc/ch/ChangeLog index 7e4582f81d9..2790e5e78a1 100644 --- a/gcc/ch/ChangeLog +++ b/gcc/ch/ChangeLog @@ -1,3 +1,14 @@ +Fri Sep 10 10:32:32 1999 Bernd Schmidt + + * ch-tree.h: Delete declarations for all tree nodes now moved to + global_trees. + * expr.c: Likewise. + * typeck.c: Likewise. + * decl.c: Delete their definitions. + (init_decl_processing): Call build_common_tree_nodes and + build_common_tree_nodes_2 instead of building their nodes here. + Use set_sizetype instead of assigning sizetype. + Tue Sep 7 15:59:56 1999 Dave Brolley * parse.h: Undefine DELAY if it's defined. diff --git a/gcc/ch/ch-tree.h b/gcc/ch/ch-tree.h index 51a25652a0a..7cc37874710 100644 --- a/gcc/ch/ch-tree.h +++ b/gcc/ch/ch-tree.h @@ -474,9 +474,6 @@ extern tree signed_boolean_type_node; extern tree string_one_type_node; extern tree bitstring_one_type_node, bit_zero_node, bit_one_node; -extern tree float_type_node, double_type_node; -extern tree void_type_node, ptr_type_node, const_ptr_type_node; - /* a VOID_TYPE node, packaged in a TREE_LIST. */ extern tree void_list_node; @@ -636,15 +633,7 @@ extern char *get_directive_line PROTO((FILE *)); extern tree shorten_compare PROTO((tree *, tree *, tree *, enum tree_code *)); /* in c-decl.c */ -extern tree short_integer_type_node, integer_type_node; -extern tree long_integer_type_node, long_long_integer_type_node; -extern tree short_unsigned_type_node, unsigned_type_node; -extern tree long_unsigned_type_node, long_long_unsigned_type_node; -extern tree ptrdiff_type_node; -extern tree unsigned_char_type_node, signed_char_type_node, char_type_node; extern tree wchar_type_node, signed_wchar_type_node, unsigned_wchar_type_node; -extern tree float_type_node, double_type_node, long_double_type_node; -extern tree void_type_node, ptr_type_node, const_ptr_type_node; extern tree default_function_type; extern tree double_ftype_double, double_ftype_double_double; extern tree int_ftype_int, long_ftype_long; diff --git a/gcc/ch/decl.c b/gcc/ch/decl.c index 880478a4fe7..ec7086f7525 100644 --- a/gcc/ch/decl.c +++ b/gcc/ch/decl.c @@ -324,71 +324,12 @@ enum decl_context #define WCHAR_TYPE "int" #endif -/* a node which has tree code ERROR_MARK, and whose type is itself. - All erroneous expressions are replaced with this node. All functions - that accept nodes as arguments should avoid generating error messages - if this node is one of the arguments, since it is undesirable to get - multiple error messages from one error in the input. */ - -tree error_mark_node; - -/* INTEGER_TYPE and REAL_TYPE nodes for the standard data types */ - -tree short_integer_type_node; -tree integer_type_node; -tree long_integer_type_node; -tree long_long_integer_type_node; - -tree short_unsigned_type_node; -tree unsigned_type_node; -tree long_unsigned_type_node; -tree long_long_unsigned_type_node; - -tree ptrdiff_type_node; - -tree unsigned_char_type_node; -tree signed_char_type_node; -tree char_type_node; tree wchar_type_node; tree signed_wchar_type_node; tree unsigned_wchar_type_node; -tree float_type_node; -tree double_type_node; -tree long_double_type_node; - -tree complex_integer_type_node; -tree complex_float_type_node; -tree complex_double_type_node; -tree complex_long_double_type_node; - -tree intQI_type_node; -tree intHI_type_node; -tree intSI_type_node; -tree intDI_type_node; -#if HOST_BITS_PER_WIDE_INT >= 64 -tree intTI_type_node; -#endif - -tree unsigned_intQI_type_node; -tree unsigned_intHI_type_node; -tree unsigned_intSI_type_node; -tree unsigned_intDI_type_node; -#if HOST_BITS_PER_WIDE_INT >= 64 -tree unsigned_intTI_type_node; -#endif - -/* a VOID_TYPE node. */ - -tree void_type_node; tree void_list_node; -/* Nodes for types `void *' and `const void *'. */ -tree ptr_type_node, const_ptr_type_node; - -/* __builtin_va_list; not used by chill, but referenced in target files. */ -tree va_list_type_node; - /* type of initializer structure, which points to a module's module-level code, and to the next such structure. */ @@ -401,34 +342,8 @@ tree chill_predefined_function_type; tree default_function_type; -#if 0 -/* function types `double (double)' and `double (double, double)', etc. */ - -tree double_ftype_double, double_ftype_double_double; -tree int_ftype_int, long_ftype_long; - -/* Function type `void (void *, void *, int)' and similar ones */ - -tree void_ftype_ptr_ptr_int, int_ftype_ptr_ptr_int, void_ftype_ptr_int_int; - -/* Function type `char *(char *, char *)' and similar ones */ -tree string_ftype_ptr_ptr, int_ftype_string_string; - -/* Function type `int (const void *, const void *, size_t)' */ -tree int_ftype_cptr_cptr_sizet; -#endif - const char **boolean_code_name; -/* Two expressions that are constants with value zero. - The first is of type `int', the second of type `void *'. */ - -tree integer_zero_node; -tree null_pointer_node; - -/* A node for the integer constant 1. */ -tree integer_one_node; - /* A node for the integer constant -1. */ tree integer_minus_one_node; @@ -3501,124 +3416,46 @@ init_decl_processing () var_length_id = get_identifier (VAR_LENGTH); var_data_id = get_identifier (VAR_DATA); - /* This is the *C* int type. */ - integer_type_node = make_signed_type (INT_TYPE_SIZE); + build_common_tree_nodes (1); if (CHILL_INT_IS_SHORT) long_integer_type_node = integer_type_node; else long_integer_type_node = make_signed_type (LONG_TYPE_SIZE); - unsigned_type_node = make_unsigned_type (INT_TYPE_SIZE); - long_unsigned_type_node = make_unsigned_type (LONG_TYPE_SIZE); - long_long_integer_type_node = make_signed_type (LONG_LONG_TYPE_SIZE); - long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE); - /* `unsigned long' is the standard type for sizeof. Note that stddef.h uses `unsigned long', and this must agree, even of long and int are the same size. */ #ifndef SIZE_TYPE - sizetype = long_unsigned_type_node; + set_sizetype (long_unsigned_type_node); #else { const char *size_type_c_name = SIZE_TYPE; if (strncmp (size_type_c_name, "long long ", 10) == 0) - sizetype = long_long_unsigned_type_node; + set_sizetype (long_long_unsigned_type_node); else if (strncmp (size_type_c_name, "long ", 5) == 0) - sizetype = long_unsigned_type_node; + set_sizetype (long_unsigned_type_node); else - sizetype = unsigned_type_node; + set_sizetype (unsigned_type_node); } #endif - TREE_TYPE (TYPE_SIZE (integer_type_node)) = sizetype; - TREE_TYPE (TYPE_SIZE (unsigned_type_node)) = sizetype; - TREE_TYPE (TYPE_SIZE (long_unsigned_type_node)) = sizetype; - TREE_TYPE (TYPE_SIZE (long_integer_type_node)) = sizetype; - TREE_TYPE (TYPE_SIZE (long_long_integer_type_node)) = sizetype; - TREE_TYPE (TYPE_SIZE (long_long_unsigned_type_node)) = sizetype; - - error_mark_node = make_node (ERROR_MARK); - TREE_TYPE (error_mark_node) = error_mark_node; - - short_integer_type_node = make_signed_type (SHORT_TYPE_SIZE); - short_unsigned_type_node = make_unsigned_type (SHORT_TYPE_SIZE); - signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE); - unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE); - intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode)); - intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode)); - intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode)); - intDI_type_node = make_signed_type (GET_MODE_BITSIZE (DImode)); -#if HOST_BITS_PER_WIDE_INT >= 64 - intTI_type_node = make_signed_type (GET_MODE_BITSIZE (TImode)); -#endif - unsigned_intQI_type_node = make_unsigned_type (GET_MODE_BITSIZE (QImode)); - unsigned_intHI_type_node = make_unsigned_type (GET_MODE_BITSIZE (HImode)); - unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode)); - unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode)); -#if HOST_BITS_PER_WIDE_INT >= 64 - unsigned_intTI_type_node = make_unsigned_type (GET_MODE_BITSIZE (TImode)); -#endif - - float_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE; pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_FLOAT], float_type_node)); - layout_type (float_type_node); - - double_type_node = make_node (REAL_TYPE); - if (flag_short_double) - TYPE_PRECISION (double_type_node) = FLOAT_TYPE_SIZE; - else - TYPE_PRECISION (double_type_node) = DOUBLE_TYPE_SIZE; pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_DOUBLE], double_type_node)); - layout_type (double_type_node); - long_double_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE; - layout_type (long_double_type_node); - - complex_integer_type_node = make_node (COMPLEX_TYPE); - TREE_TYPE (complex_integer_type_node) = integer_type_node; - layout_type (complex_integer_type_node); - - complex_float_type_node = make_node (COMPLEX_TYPE); - TREE_TYPE (complex_float_type_node) = float_type_node; - layout_type (complex_float_type_node); - - complex_double_type_node = make_node (COMPLEX_TYPE); - TREE_TYPE (complex_double_type_node) = double_type_node; - layout_type (complex_double_type_node); - - complex_long_double_type_node = make_node (COMPLEX_TYPE); - TREE_TYPE (complex_long_double_type_node) = long_double_type_node; - layout_type (complex_long_double_type_node); - - integer_zero_node = build_int_2 (0, 0); - TREE_TYPE (integer_zero_node) = integer_type_node; - integer_one_node = build_int_2 (1, 0); - TREE_TYPE (integer_one_node) = integer_type_node; integer_minus_one_node = build_int_2 (-1, -1); TREE_TYPE (integer_minus_one_node) = integer_type_node; - size_zero_node = build_int_2 (0, 0); - TREE_TYPE (size_zero_node) = sizetype; - size_one_node = build_int_2 (1, 0); - TREE_TYPE (size_one_node) = sizetype; + build_common_tree_nodes_2 (flag_short_double); - void_type_node = make_node (VOID_TYPE); pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_VOID], void_type_node)); - layout_type (void_type_node); /* Uses integer_zero_node */ /* We are not going to have real types in C with less than byte alignment, so we might as well not have any types that claim to have it. */ TYPE_ALIGN (void_type_node) = BITS_PER_UNIT; - null_pointer_node = build_int_2 (0, 0); - TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node); - layout_type (TREE_TYPE (null_pointer_node)); - /* This is for wide string constants. */ wchar_type_node = short_unsigned_type_node; wchar_type_size = TYPE_PRECISION (wchar_type_node); @@ -3662,9 +3499,6 @@ init_decl_processing () bit_one_node = build (CONSTRUCTOR, bitstring_one_type_node, NULL_TREE, build_tree_list (NULL_TREE, integer_zero_node)); - char_type_node = make_node (CHAR_TYPE); - TYPE_PRECISION (char_type_node) = CHAR_TYPE_SIZE; - fixup_unsigned_type (char_type_node); pushdecl (build_decl (TYPE_DECL, ridpointers[(int)RID_CHAR], char_type_node)); @@ -3695,7 +3529,7 @@ init_decl_processing () pushdecl (build_decl (TYPE_DECL, ridpointers[(int)RID_LONG], long_integer_type_node)); - sizetype = long_integer_type_node; + set_sizetype (long_integer_type_node); #if 0 ptrdiff_type_node = TREE_TYPE (IDENTIFIER_LOCAL_VALUE (get_identifier (PTRDIFF_TYPE))); diff --git a/gcc/ch/expr.c b/gcc/ch/expr.c index 5781e38c19b..b919fde8ddb 100644 --- a/gcc/ch/expr.c +++ b/gcc/ch/expr.c @@ -34,7 +34,6 @@ Boston, MA 02111-1307, USA. */ extern char **boolean_code_name; extern int flag_old_strings; -extern tree long_unsigned_type_node; extern int ignore_case; extern int special_UC; diff --git a/gcc/ch/typeck.c b/gcc/ch/typeck.c index f4d8d80d971..a1bc17b5cd4 100644 --- a/gcc/ch/typeck.c +++ b/gcc/ch/typeck.c @@ -38,22 +38,6 @@ Boston, MA 02111-1307, USA. */ #include "lex.h" #include "toplev.h" -extern tree intQI_type_node; -extern tree intHI_type_node; -extern tree intSI_type_node; -extern tree intDI_type_node; -#if HOST_BITS_PER_WIDE_INT >= 64 -extern tree intTI_type_node; -#endif - -extern tree unsigned_intQI_type_node; -extern tree unsigned_intHI_type_node; -extern tree unsigned_intSI_type_node; -extern tree unsigned_intDI_type_node; -#if HOST_BITS_PER_WIDE_INT >= 64 -extern tree unsigned_intTI_type_node; -#endif - /* forward declarations */ static int chill_l_equivalent PROTO((tree, tree, struct mode_chain*)); static tree extract_constant_from_buffer PROTO((tree, const unsigned char *, int)); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b242b3e67b1..8f7aaf65405 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +Fri Sep 10 10:32:32 1999 Bernd Schmidt + + * cp-tree.h: Delete declarations for all tree nodes now moved to + global_trees. + * decl.c: Delete their definitions. + (SHORT_TYPE_SIZE, INT_TYPE_SIZE, LONG_TYPE_SIZE, LONG_LONG_TYPE_SIZE, + FLOAT_TYPE_SIZE, DOUBLE_TYPE_SIZE, LONG_DOUBLE_TYPE_SIZE): Don't + provide defaults. + (init_decl_processing): Call build_common_tree_nodes and + build_common_tree_nodes_2 instead of building their nodes here. + Don't add gc roots for them. + 1999-09-10 Mark Mitchell * cp-tree.h (language_function): Rename expanding_p to diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 74ef7af849e..d40fe7533ea 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -743,7 +743,6 @@ extern tree global_namespace; extern tree ridpointers[]; extern tree ansi_opname[]; extern tree ansi_assopname[]; -extern tree null_pointer_node; /* Nonzero means `$' can be in an identifier. */ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 273f455f4db..ee680230b1e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -69,40 +69,12 @@ int ggc_p = 1; struct obstack decl_obstack; static struct stack_level *decl_stack; -#ifndef CHAR_TYPE_SIZE -#define CHAR_TYPE_SIZE BITS_PER_UNIT -#endif - -#ifndef SHORT_TYPE_SIZE -#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2)) -#endif - -#ifndef INT_TYPE_SIZE -#define INT_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef LONG_TYPE_SIZE -#define LONG_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef LONG_LONG_TYPE_SIZE -#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2) -#endif - #ifndef WCHAR_UNSIGNED #define WCHAR_UNSIGNED 0 #endif -#ifndef FLOAT_TYPE_SIZE -#define FLOAT_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef DOUBLE_TYPE_SIZE -#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) -#endif - -#ifndef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) +#ifndef CHAR_TYPE_SIZE +#define CHAR_TYPE_SIZE BITS_PER_UNIT #endif #ifndef BOOL_TYPE_SIZE @@ -212,14 +184,6 @@ static void destroy_local_static PROTO((tree)); static void indent PROTO((void)); #endif -/* A node which has tree code ERROR_MARK, and whose type is itself. - All erroneous expressions are replaced with this node. All functions - that accept nodes as arguments should avoid generating error messages - if this node is one of the arguments, since it is undesirable to get - multiple error messages from one error in the input. */ - -tree error_mark_node; - /* Erroneous argument lists can use this *IFF* they do not modify it. */ tree error_mark_list; @@ -283,21 +247,6 @@ tree error_mark_list; tree cp_global_trees[CPTI_MAX]; -/* These can't be part of the above array, since they are declared - individually in tree.h, and used by the debug output routines. */ - -tree void_type_node; -tree char_type_node; -tree integer_type_node; -tree unsigned_type_node; - -/* These can't be part of the above array, since they are declared - individially in tree.h and used by the target routines. */ - -tree ptr_type_node; -tree va_list_type_node; -tree null_pointer_node; - /* Indicates that there is a type value in some namespace, although that is not necessarily in scope at the moment. */ @@ -351,13 +300,9 @@ tree static_aggregates; /* -- end of C++ */ -/* An expression of type `int' for the constant zero. */ +/* A node for the integer constants 2, and 3. */ -tree integer_zero_node; - -/* A node for the integer constants 1, 2, and 3. */ - -tree integer_one_node, integer_two_node, integer_three_node; +tree integer_two_node, integer_three_node; /* While defining an enum type, this is 1 plus the last enumerator constant value. */ @@ -6091,10 +6036,9 @@ init_decl_processing () gcc_obstack_init (&decl_obstack); - /* Must lay these out before anything else gets laid out. */ - error_mark_node = make_node (ERROR_MARK); + build_common_tree_nodes (flag_signed_char); + TREE_PERMANENT (error_mark_node) = 1; - TREE_TYPE (error_mark_node) = error_mark_node; error_mark_list = build_tree_list (error_mark_node, error_mark_node); TREE_TYPE (error_mark_list) = error_mark_node; @@ -6116,62 +6060,37 @@ init_decl_processing () pfn_or_delta2_identifier = get_identifier ("__pfn_or_delta2"); /* Define `int' and `char' first so that dbx will output them first. */ - - integer_type_node = make_signed_type (INT_TYPE_SIZE); record_builtin_type (RID_INT, NULL_PTR, integer_type_node); - - /* Define `char', which is like either `signed char' or `unsigned char' - but not the same as either. */ - - char_type_node - = (flag_signed_char - ? make_signed_type (CHAR_TYPE_SIZE) - : make_unsigned_type (CHAR_TYPE_SIZE)); record_builtin_type (RID_CHAR, "char", char_type_node); /* `signed' is the same as `int' */ record_builtin_type (RID_SIGNED, NULL_PTR, integer_type_node); - - long_integer_type_node = make_signed_type (LONG_TYPE_SIZE); record_builtin_type (RID_LONG, "long int", long_integer_type_node); - - unsigned_type_node = make_unsigned_type (INT_TYPE_SIZE); record_builtin_type (RID_UNSIGNED, "unsigned int", unsigned_type_node); - - long_unsigned_type_node = make_unsigned_type (LONG_TYPE_SIZE); record_builtin_type (RID_MAX, "long unsigned int", long_unsigned_type_node); record_builtin_type (RID_MAX, "unsigned long", long_unsigned_type_node); - - long_long_integer_type_node = make_signed_type (LONG_LONG_TYPE_SIZE); record_builtin_type (RID_MAX, "long long int", long_long_integer_type_node); - - long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE); record_builtin_type (RID_MAX, "long long unsigned int", long_long_unsigned_type_node); record_builtin_type (RID_MAX, "long long unsigned", long_long_unsigned_type_node); - - short_integer_type_node = make_signed_type (SHORT_TYPE_SIZE); record_builtin_type (RID_SHORT, "short int", short_integer_type_node); - short_unsigned_type_node = make_unsigned_type (SHORT_TYPE_SIZE); record_builtin_type (RID_MAX, "short unsigned int", short_unsigned_type_node); record_builtin_type (RID_MAX, "unsigned short", short_unsigned_type_node); + ptrdiff_type_node + = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE))); + + /* Define both `signed char' and `unsigned char'. */ + record_builtin_type (RID_MAX, "signed char", signed_char_type_node); + record_builtin_type (RID_MAX, "unsigned char", unsigned_char_type_node); + /* `unsigned long' is the standard type for sizeof. Note that stddef.h uses `unsigned long', and this must agree, even if long and int are the same size. */ set_sizetype (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE)))); - ptrdiff_type_node - = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE))); - - /* Define both `signed char' and `unsigned char'. */ - signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE); - record_builtin_type (RID_MAX, "signed char", signed_char_type_node); - unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE); - record_builtin_type (RID_MAX, "unsigned char", unsigned_char_type_node); - /* Create the widest literal types. */ widest_integer_literal_type_node = make_signed_type (HOST_BITS_PER_WIDE_INT * 2); pushdecl (build_decl (TYPE_DECL, NULL_TREE, @@ -6182,72 +6101,22 @@ init_decl_processing () widest_unsigned_literal_type_node)); /* These are types that type_for_size and type_for_mode use. */ - intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode)); pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node)); - intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode)); pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node)); - intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode)); pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node)); - intDI_type_node = make_signed_type (GET_MODE_BITSIZE (DImode)); pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node)); #if HOST_BITS_PER_WIDE_INT >= 64 - intTI_type_node = make_signed_type (GET_MODE_BITSIZE (TImode)); pushdecl (build_decl (TYPE_DECL, get_identifier ("__int128_t"), intTI_type_node)); #endif - unsigned_intQI_type_node = make_unsigned_type (GET_MODE_BITSIZE (QImode)); pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node)); - unsigned_intHI_type_node = make_unsigned_type (GET_MODE_BITSIZE (HImode)); pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node)); - unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode)); pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node)); - unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode)); pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node)); #if HOST_BITS_PER_WIDE_INT >= 64 - unsigned_intTI_type_node = make_unsigned_type (GET_MODE_BITSIZE (TImode)); pushdecl (build_decl (TYPE_DECL, get_identifier ("__uint128_t"), unsigned_intTI_type_node)); #endif - float_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE; - record_builtin_type (RID_FLOAT, NULL_PTR, float_type_node); - layout_type (float_type_node); - - double_type_node = make_node (REAL_TYPE); - if (flag_short_double) - TYPE_PRECISION (double_type_node) = FLOAT_TYPE_SIZE; - else - TYPE_PRECISION (double_type_node) = DOUBLE_TYPE_SIZE; - record_builtin_type (RID_DOUBLE, NULL_PTR, double_type_node); - layout_type (double_type_node); - - long_double_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE; - record_builtin_type (RID_MAX, "long double", long_double_type_node); - layout_type (long_double_type_node); - - complex_integer_type_node = make_node (COMPLEX_TYPE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"), - complex_integer_type_node)); - TREE_TYPE (complex_integer_type_node) = integer_type_node; - layout_type (complex_integer_type_node); - - complex_float_type_node = make_node (COMPLEX_TYPE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"), - complex_float_type_node)); - TREE_TYPE (complex_float_type_node) = float_type_node; - layout_type (complex_float_type_node); - - complex_double_type_node = make_node (COMPLEX_TYPE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"), - complex_double_type_node)); - TREE_TYPE (complex_double_type_node) = double_type_node; - layout_type (complex_double_type_node); - - complex_long_double_type_node = make_node (COMPLEX_TYPE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"), - complex_long_double_type_node)); - TREE_TYPE (complex_long_double_type_node) = long_double_type_node; - layout_type (complex_long_double_type_node); + build_common_tree_nodes_2 (flag_short_double); java_byte_type_node = record_builtin_java_type ("__java_byte", 8); java_short_type_node = record_builtin_java_type ("__java_short", 16); @@ -6258,10 +6127,6 @@ init_decl_processing () java_char_type_node = record_builtin_java_type ("__java_char", -16); java_boolean_type_node = record_builtin_java_type ("__java_boolean", -1); - integer_zero_node = build_int_2 (0, 0); - TREE_TYPE (integer_zero_node) = integer_type_node; - integer_one_node = build_int_2 (1, 0); - TREE_TYPE (integer_one_node) = integer_type_node; integer_two_node = build_int_2 (2, 0); TREE_TYPE (integer_two_node) = integer_type_node; integer_three_node = build_int_2 (3, 0); @@ -6278,23 +6143,25 @@ init_decl_processing () boolean_true_node = build_int_2 (1, 0); TREE_TYPE (boolean_true_node) = boolean_type_node; - /* These are needed by stor-layout.c. */ - size_zero_node = size_int (0); - size_one_node = size_int (1); + signed_size_zero_node = build_int_2 (0, 0); record_builtin_type (RID_FLOAT, NULL_PTR, float_type_node); + record_builtin_type (RID_DOUBLE, NULL_PTR, double_type_node); + record_builtin_type (RID_MAX, "long double", long_double_type_node); + + pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"), + complex_integer_type_node)); + pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"), + complex_float_type_node)); + pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"), + complex_double_type_node)); + pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"), + complex_long_double_type_node)); - signed_size_zero_node = build_int_2 (0, 0); TREE_TYPE (signed_size_zero_node) = make_signed_type (TYPE_PRECISION (sizetype)); - void_type_node = make_node (VOID_TYPE); record_builtin_type (RID_VOID, NULL_PTR, void_type_node); - layout_type (void_type_node); /* Uses integer_zero_node. */ void_list_node = build_tree_list (NULL_TREE, void_type_node); TREE_PARMLIST (void_list_node) = 1; - null_pointer_node = build_int_2 (0, 0); - TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node); - layout_type (TREE_TYPE (null_pointer_node)); - /* Used for expressions that do nothing, but are not errors. */ void_zero_node = build_int_2 (0, 0); TREE_TYPE (void_zero_node) = void_type_node; @@ -6497,21 +6364,11 @@ init_decl_processing () /* Add GC roots for all of our global variables. */ ggc_add_tree_root (c_global_trees, sizeof c_global_trees / sizeof(tree)); ggc_add_tree_root (cp_global_trees, sizeof cp_global_trees / sizeof(tree)); - ggc_add_tree_root (&char_type_node, 1); - ggc_add_tree_root (&error_mark_node, 1); - ggc_add_tree_root (&integer_type_node, 1); ggc_add_tree_root (&integer_three_node, 1); ggc_add_tree_root (&integer_two_node, 1); - ggc_add_tree_root (&integer_one_node, 1); - ggc_add_tree_root (&integer_zero_node, 1); ggc_add_tree_root (&signed_size_zero_node, 1); ggc_add_tree_root (&size_one_node, 1); ggc_add_tree_root (&size_zero_node, 1); - ggc_add_tree_root (&unsigned_type_node, 1); - ggc_add_tree_root (&ptr_type_node, 1); - ggc_add_tree_root (&null_pointer_node, 1); - ggc_add_tree_root (&va_list_type_node, 1); - ggc_add_tree_root (&void_type_node, 1); ggc_add_root (&global_binding_level, 1, sizeof global_binding_level, mark_binding_level); ggc_add_root (&scope_chain, 1, sizeof scope_chain, &mark_saved_scope); diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index f0936b3fe19..5382d9a4b44 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,12 @@ +Fri Sep 10 10:32:32 1999 Bernd Schmidt + + * com.h: Delete declarations for all tree nodes now moved to + global_trees. + * com.c: Delete their definitions. + (ffecom_init_0): Call build_common_tree_nodes and + build_common_tree_nodes_2 instead of building their nodes here. + Override their decisions for complex nodes. + Sat Sep 4 13:46:27 1999 Mark Mitchell * Make-lang.in (f771): Depend on ggc-callbacks.o. diff --git a/gcc/f/com.c b/gcc/f/com.c index c57d94abc94..316288e9257 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -219,17 +219,7 @@ typedef struct { unsigned :16, :16, :16; } vms_ino_t; define. Here are the definitions, which in the C front end are found in the file c-decl.c. */ -tree integer_zero_node; -tree integer_one_node; -tree null_pointer_node; -tree error_mark_node; -tree void_type_node; -tree integer_type_node; -tree unsigned_type_node; -tree char_type_node; tree current_function_decl; -tree ptr_type_node; -tree va_list_type_node; /* ~~gcc/tree.h *should* declare this, because toplev.c and dwarfout.c reference it. */ @@ -246,25 +236,6 @@ FILE *finput; "static") are those that ste.c and such might use (directly or by using com macros that reference them in their definitions). */ -static tree short_integer_type_node; -tree long_integer_type_node; -static tree long_long_integer_type_node; - -static tree short_unsigned_type_node; -static tree long_unsigned_type_node; -static tree long_long_unsigned_type_node; - -static tree unsigned_char_type_node; -static tree signed_char_type_node; - -static tree float_type_node; -static tree double_type_node; -static tree complex_float_type_node; -tree complex_double_type_node; -static tree long_double_type_node; -static tree complex_integer_type_node; -static tree complex_long_double_type_node; - tree string_type_node; static tree double_ftype_double; @@ -11699,41 +11670,25 @@ ffecom_init_0 () global_binding_level = current_binding_level; current_binding_level->prep_state = 2; - /* Define `int' and `char' first so that dbx will output them first. */ + build_common_tree_nodes (1); - integer_type_node = make_signed_type (INT_TYPE_SIZE); + /* Define `int' and `char' first so that dbx will output them first. */ pushdecl (build_decl (TYPE_DECL, get_identifier ("int"), integer_type_node)); - - char_type_node = make_unsigned_type (CHAR_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("char"), char_type_node)); - - long_integer_type_node = make_signed_type (LONG_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("long int"), long_integer_type_node)); - - unsigned_type_node = make_unsigned_type (INT_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned int"), unsigned_type_node)); - - long_unsigned_type_node = make_unsigned_type (LONG_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("long unsigned int"), long_unsigned_type_node)); - - long_long_integer_type_node = make_signed_type (LONG_LONG_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("long long int"), long_long_integer_type_node)); - - long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("long long unsigned int"), long_long_unsigned_type_node)); - - short_integer_type_node = make_signed_type (SHORT_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("short int"), short_integer_type_node)); - - short_unsigned_type_node = make_unsigned_type (SHORT_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("short unsigned int"), short_unsigned_type_node)); @@ -11745,76 +11700,44 @@ ffecom_init_0 () ffecom_typesize_pointer_ = TREE_INT_CST_LOW (TYPE_SIZE (sizetype)) / BITS_PER_UNIT; - error_mark_node = make_node (ERROR_MARK); - TREE_TYPE (error_mark_node) = error_mark_node; + build_common_tree_nodes_2 (0); /* Define both `signed char' and `unsigned char'. */ - signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("signed char"), signed_char_type_node)); - unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE); pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned char"), unsigned_char_type_node)); - float_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE; - layout_type (float_type_node); pushdecl (build_decl (TYPE_DECL, get_identifier ("float"), float_type_node)); - - double_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (double_type_node) = DOUBLE_TYPE_SIZE; - layout_type (double_type_node); pushdecl (build_decl (TYPE_DECL, get_identifier ("double"), double_type_node)); - - long_double_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE; - layout_type (long_double_type_node); pushdecl (build_decl (TYPE_DECL, get_identifier ("long double"), long_double_type_node)); + /* For now, override what build_common_tree_nodes has done. */ complex_integer_type_node = ffecom_make_complex_type_ (integer_type_node); + complex_float_type_node = ffecom_make_complex_type_ (float_type_node); + complex_double_type_node = ffecom_make_complex_type_ (double_type_node); + complex_long_double_type_node + = ffecom_make_complex_type_ (long_double_type_node); + pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"), complex_integer_type_node)); - - complex_float_type_node = ffecom_make_complex_type_ (float_type_node); pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"), complex_float_type_node)); - - complex_double_type_node = ffecom_make_complex_type_ (double_type_node); pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"), complex_double_type_node)); - - complex_long_double_type_node = ffecom_make_complex_type_ (long_double_type_node); pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"), complex_long_double_type_node)); - integer_zero_node = build_int_2 (0, 0); - TREE_TYPE (integer_zero_node) = integer_type_node; - integer_one_node = build_int_2 (1, 0); - TREE_TYPE (integer_one_node) = integer_type_node; - - size_zero_node = build_int_2 (0, 0); - TREE_TYPE (size_zero_node) = sizetype; - size_one_node = build_int_2 (1, 0); - TREE_TYPE (size_one_node) = sizetype; - - void_type_node = make_node (VOID_TYPE); pushdecl (build_decl (TYPE_DECL, get_identifier ("void"), void_type_node)); - layout_type (void_type_node); /* Uses integer_zero_node */ /* We are not going to have real types in C with less than byte alignment, so we might as well not have any types that claim to have it. */ TYPE_ALIGN (void_type_node) = BITS_PER_UNIT; - ptr_type_node = build_pointer_type (void_type_node); - - null_pointer_node = build_int_2 (0, 0); - TREE_TYPE (null_pointer_node) = ptr_type_node; - layout_type (TREE_TYPE (null_pointer_node)); - string_type_node = build_pointer_type (char_type_node); ffecom_tree_fun_type_void diff --git a/gcc/f/com.h b/gcc/f/com.h index baa29533288..b5e77149c0d 100644 --- a/gcc/f/com.h +++ b/gcc/f/com.h @@ -238,8 +238,6 @@ struct _ffecom_symbol_ /* Global objects accessed by users of this module. */ #if FFECOM_targetCURRENT == FFECOM_targetGCC -extern tree long_integer_type_node; -extern tree complex_double_type_node; extern tree string_type_node; extern tree ffecom_integer_type_node; extern tree ffecom_integer_zero_node; diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 956dc38ba45..981a3df10f1 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +Fri Sep 10 10:32:32 1999 Bernd Schmidt + + * java-tree.h: Delete declarations for all tree nodes now moved to + global_trees. + * decl.c: Delete their definitions. + 1999-09-04 Mark Mitchell * Make-lang.in (jc1): Depend on ggc-callbacks.o. diff --git a/gcc/java/decl.c b/gcc/java/decl.c index 6905caec93e..443fa9dd19e 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -252,9 +252,6 @@ static int keep_next_if_subblocks; or 0 if between functions. */ tree current_function_decl; -/* The type node for the ordinary character type. */ -tree char_type_node; - tree object_type_node; tree unqualified_object_id_node; tree object_ptr_type_node; @@ -268,17 +265,8 @@ int predef_filenames_size; tree boolean_type_node; -tree float_type_node; -tree double_type_node; - -/* a VOID_TYPE node. */ - -tree void_type_node; -tree ptr_type_node; tree return_address_type_node; -tree integer_type_node; - tree byte_type_node; tree short_type_node; tree int_type_node; @@ -319,19 +307,8 @@ tree one_elt_array_domain_type; tree access_flags_type_node; tree class_dtable_decl; -/* a node which has tree code ERROR_MARK, and whose type is itself. - All erroneous expressions are replaced with this node. All functions - that accept nodes as arguments should avoid generating error messages - if this node is one of the arguments, since it is undesirable to get - multiple error messages from one error in the input. */ - -tree error_mark_node; - -/* Two expressions that are constants with value zero. - The first is of type `int', the second of type `void *'. - Other of type `long', `float' and `double' follow. */ -tree integer_zero_node; -tree null_pointer_node; +/* Expressions that are constants with value zero, of types + `long', `float' and `double'. */ tree long_zero_node; tree float_zero_node; tree double_zero_node; @@ -374,9 +351,6 @@ tree soft_irem_node; tree soft_ldiv_node; tree soft_lrem_node; -/* __builtin_va_list; unused by java, but referenced by target files. */ -tree va_list_type_node; - /* Build (and pushdecl) a "promoted type" for all standard types shorter than int. */ @@ -406,7 +380,7 @@ push_promoted_type (name, actual_type) } /* Nodes for integer constants. */ -tree integer_one_node, integer_two_node, integer_four_node; +tree integer_two_node, integer_four_node; tree integer_negative_one_node; /* Return a definition for a builtin function named NAME and whose data type diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index 83b6398d94f..c13f0955fc5 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -196,9 +196,6 @@ extern tree unsigned_int_type_node; extern tree unsigned_long_type_node; extern tree boolean_type_node; -extern tree char_type_node; -extern tree float_type_node; -extern tree double_type_node; extern tree object_type_node; extern tree unqualified_object_id_node; @@ -233,8 +230,6 @@ extern tree this_identifier_node; /* "this" */ extern tree super_identifier_node; /* "super" */ extern tree continue_identifier_node; /* "continue" */ extern tree one_elt_array_domain_type; -extern tree void_type_node; -extern tree ptr_type_node; /* The type of the return address of a subroutine. */ extern tree return_address_type_node; diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 7c94f401538..9f32de43ef8 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -37,14 +37,6 @@ Boston, MA 02111-1307, USA. */ struct sizetype_tab sizetype_tab; -/* An integer constant with value 0 whose type is sizetype. */ - -tree size_zero_node; - -/* An integer constant with value 1 whose type is sizetype. */ - -tree size_one_node; - /* If nonzero, this is an upper limit on alignment of structure fields. The value is measured in bits. */ int maximum_field_alignment; @@ -1220,22 +1212,15 @@ set_sizetype (type) sizetype = type; /* The *bitsizetype types use a precision that avoids overflows when - calculating signed sizes / offsets in bits. - - We are allocating bitsizetype once and change it in place when - we decide later that we want to change it. This way, we avoid the - hassle of changing all the TYPE_SIZE (TREE_TYPE (sometype)) - individually in each front end. */ - if (! bitsizetype) - bitsizetype = make_node (INTEGER_TYPE); - if (TYPE_NAME (sizetype) && ! TYPE_NAME (bitsizetype)) - TYPE_NAME (bitsizetype) = TYPE_NAME (sizetype); - + calculating signed sizes / offsets in bits. */ precision = oprecision + BITS_PER_UNIT_LOG + 1; /* However, when cross-compiling from a 32 bit to a 64 bit host, we are limited to 64 bit precision. */ if (precision > 2 * HOST_BITS_PER_WIDE_INT) precision = 2 * HOST_BITS_PER_WIDE_INT; + + bitsizetype = make_node (INTEGER_TYPE); + TYPE_NAME (bitsizetype) = TYPE_NAME (type); TYPE_PRECISION (bitsizetype) = precision; if (TREE_UNSIGNED (type)) fixup_unsigned_type (bitsizetype); @@ -1257,6 +1242,7 @@ set_sizetype (type) usizetype = make_unsigned_type (oprecision); ubitsizetype = make_unsigned_type (precision); } + TYPE_NAME (bitsizetype) = TYPE_NAME (sizetype); ggc_add_tree_root ((tree*) &sizetype_tab, sizeof(sizetype_tab)/sizeof(tree)); } diff --git a/gcc/tree.c b/gcc/tree.c index a1ad924816b..16d3f4df43f 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -279,6 +279,8 @@ void gcc_obstack_init (); void (*lang_unsave_expr_now) PROTO((tree)); +tree global_trees[TI_MAX]; + /* Init the principal obstacks. */ void @@ -311,6 +313,7 @@ init_obstacks () ggc_add_root (type_hash_table, TYPE_HASH_SIZE, sizeof(struct type_hash *), mark_type_hash); + ggc_add_tree_root (global_trees, TI_MAX); } void @@ -5069,3 +5072,185 @@ new_alias_set () else return 0; } + +#ifndef CHAR_TYPE_SIZE +#define CHAR_TYPE_SIZE BITS_PER_UNIT +#endif + +#ifndef SHORT_TYPE_SIZE +#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2)) +#endif + +#ifndef INT_TYPE_SIZE +#define INT_TYPE_SIZE BITS_PER_WORD +#endif + +#ifndef LONG_TYPE_SIZE +#define LONG_TYPE_SIZE BITS_PER_WORD +#endif + +#ifndef LONG_LONG_TYPE_SIZE +#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2) +#endif + +#ifndef FLOAT_TYPE_SIZE +#define FLOAT_TYPE_SIZE BITS_PER_WORD +#endif + +#ifndef DOUBLE_TYPE_SIZE +#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) +#endif + +#ifndef LONG_DOUBLE_TYPE_SIZE +#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) +#endif + +/* Create nodes for all integer types (and error_mark_node) using the sizes + of C datatypes. The caller should call set_sizetype soon after calling + this function to select one of the types as sizetype. */ + +void +build_common_tree_nodes (signed_char) + int signed_char; +{ + error_mark_node = make_node (ERROR_MARK); + TREE_TYPE (error_mark_node) = error_mark_node; + + /* Define both `signed char' and `unsigned char'. */ + signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE); + unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE); + + /* Define `char', which is like either `signed char' or `unsigned char' + but not the same as either. */ + char_type_node + = (signed_char + ? make_signed_type (CHAR_TYPE_SIZE) + : make_unsigned_type (CHAR_TYPE_SIZE)); + + short_integer_type_node = make_signed_type (SHORT_TYPE_SIZE); + short_unsigned_type_node = make_unsigned_type (SHORT_TYPE_SIZE); + integer_type_node = make_signed_type (INT_TYPE_SIZE); + /* Define an unsigned integer first. make_unsigned_type and make_signed_type + both call set_sizetype for the first type that we create, and we want this + to be large enough to hold the sizes of various types until we switch to + the real sizetype. */ + unsigned_type_node = make_unsigned_type (INT_TYPE_SIZE); + long_integer_type_node = make_signed_type (LONG_TYPE_SIZE); + long_unsigned_type_node = make_unsigned_type (LONG_TYPE_SIZE); + long_long_integer_type_node = make_signed_type (LONG_LONG_TYPE_SIZE); + long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE); + + intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode)); + intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode)); + intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode)); + intDI_type_node = make_signed_type (GET_MODE_BITSIZE (DImode)); + intTI_type_node = make_signed_type (GET_MODE_BITSIZE (TImode)); + + unsigned_intQI_type_node = make_unsigned_type (GET_MODE_BITSIZE (QImode)); + unsigned_intHI_type_node = make_unsigned_type (GET_MODE_BITSIZE (HImode)); + unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode)); + unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode)); + unsigned_intTI_type_node = make_unsigned_type (GET_MODE_BITSIZE (TImode)); +} + +/* For type TYPE, fill in the proper type for TYPE_SIZE and + TYPE_SIZE_UNIT. */ +static void +fix_sizetype (type) + tree type; +{ + TREE_TYPE (TYPE_SIZE (type)) = sizetype; + TREE_TYPE (TYPE_SIZE_UNIT (type)) = bitsizetype; +} + +/* Call this function after calling build_common_tree_nodes and set_sizetype. + It will fix the previously made nodes to have proper references to + sizetype, and it will create several other common tree nodes. */ +void +build_common_tree_nodes_2 (short_double) + int short_double; +{ + fix_sizetype (signed_char_type_node); + fix_sizetype (unsigned_char_type_node); + fix_sizetype (char_type_node); + fix_sizetype (short_integer_type_node); + fix_sizetype (short_unsigned_type_node); + fix_sizetype (integer_type_node); + fix_sizetype (unsigned_type_node); + fix_sizetype (long_unsigned_type_node); + fix_sizetype (long_integer_type_node); + fix_sizetype (long_long_integer_type_node); + fix_sizetype (long_long_unsigned_type_node); + + fix_sizetype (intQI_type_node); + fix_sizetype (intHI_type_node); + fix_sizetype (intSI_type_node); + fix_sizetype (intDI_type_node); + fix_sizetype (intTI_type_node); + fix_sizetype (unsigned_intQI_type_node); + fix_sizetype (unsigned_intHI_type_node); + fix_sizetype (unsigned_intSI_type_node); + fix_sizetype (unsigned_intDI_type_node); + fix_sizetype (unsigned_intTI_type_node); + + integer_zero_node = build_int_2 (0, 0); + TREE_TYPE (integer_zero_node) = integer_type_node; + integer_one_node = build_int_2 (1, 0); + TREE_TYPE (integer_one_node) = integer_type_node; + + size_zero_node = build_int_2 (0, 0); + TREE_TYPE (size_zero_node) = sizetype; + size_one_node = build_int_2 (1, 0); + TREE_TYPE (size_one_node) = sizetype; + + void_type_node = make_node (VOID_TYPE); + layout_type (void_type_node); /* Uses size_zero_node */ + /* We are not going to have real types in C with less than byte alignment, + so we might as well not have any types that claim to have it. */ + TYPE_ALIGN (void_type_node) = BITS_PER_UNIT; + + null_pointer_node = build_int_2 (0, 0); + TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node); + layout_type (TREE_TYPE (null_pointer_node)); + + ptr_type_node = build_pointer_type (void_type_node); + const_ptr_type_node + = build_pointer_type (build_type_variant (void_type_node, 1, 0)); + + float_type_node = make_node (REAL_TYPE); + TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE; + layout_type (float_type_node); + + double_type_node = make_node (REAL_TYPE); + if (short_double) + TYPE_PRECISION (double_type_node) = FLOAT_TYPE_SIZE; + else + TYPE_PRECISION (double_type_node) = DOUBLE_TYPE_SIZE; + layout_type (double_type_node); + + long_double_type_node = make_node (REAL_TYPE); + TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE; + layout_type (long_double_type_node); + + complex_integer_type_node = make_node (COMPLEX_TYPE); + TREE_TYPE (complex_integer_type_node) = integer_type_node; + layout_type (complex_integer_type_node); + + complex_float_type_node = make_node (COMPLEX_TYPE); + TREE_TYPE (complex_float_type_node) = float_type_node; + layout_type (complex_float_type_node); + + complex_double_type_node = make_node (COMPLEX_TYPE); + TREE_TYPE (complex_double_type_node) = double_type_node; + layout_type (complex_double_type_node); + + complex_long_double_type_node = make_node (COMPLEX_TYPE); + TREE_TYPE (complex_long_double_type_node) = long_double_type_node; + layout_type (complex_long_double_type_node); + +#ifdef BUILD_VA_LIST_TYPE + BUILD_VA_LIST_TYPE(va_list_type_node); +#else + va_list_type_node = ptr_type_node; +#endif +} diff --git a/gcc/tree.h b/gcc/tree.h index e1e04792dac..6df6e63cc09 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1418,6 +1418,109 @@ union tree_node struct tree_block block; }; +/* Standard named or nameless data types of the C compiler. */ + +enum tree_index +{ + TI_ERROR_MARK, + TI_INTQI_TYPE, + TI_INTHI_TYPE, + TI_INTSI_TYPE, + TI_INTDI_TYPE, + TI_INTTI_TYPE, + + TI_UINTQI_TYPE, + TI_UINTHI_TYPE, + TI_UINTSI_TYPE, + TI_UINTDI_TYPE, + TI_UINTTI_TYPE, + + TI_CHAR_TYPE, + TI_SIGNED_CHAR_TYPE, + TI_UNSIGNED_CHAR_TYPE, + TI_INTEGER_TYPE, + TI_UNSIGNED_TYPE, + TI_SHORT_INTEGER_TYPE, + TI_SHORT_UNSIGNED_TYPE, + TI_LONG_INTEGER_TYPE, + TI_LONG_UNSIGNED_TYPE, + TI_LONG_LONG_INTEGER_TYPE, + TI_LONG_LONG_UNSIGNED_TYPE, + + TI_INTEGER_ZERO, + TI_INTEGER_ONE, + TI_NULL_POINTER, + + TI_SIZE_ZERO, + TI_SIZE_ONE, + + TI_COMPLEX_INTEGER_TYPE, + TI_COMPLEX_FLOAT_TYPE, + TI_COMPLEX_DOUBLE_TYPE, + TI_COMPLEX_LONG_DOUBLE_TYPE, + + TI_FLOAT_TYPE, + TI_DOUBLE_TYPE, + TI_LONG_DOUBLE_TYPE, + + TI_VOID_TYPE, + TI_PTR_TYPE, + TI_CONST_PTR_TYPE, + TI_PTRDIFF_TYPE, + TI_VA_LIST_TYPE, + + TI_MAX +}; + +extern tree global_trees[TI_MAX]; + +#define error_mark_node global_trees[TI_ERROR_MARK] + +#define intQI_type_node global_trees[TI_INTQI_TYPE] +#define intHI_type_node global_trees[TI_INTHI_TYPE] +#define intSI_type_node global_trees[TI_INTSI_TYPE] +#define intDI_type_node global_trees[TI_INTDI_TYPE] +#define intTI_type_node global_trees[TI_INTTI_TYPE] + +#define unsigned_intQI_type_node global_trees[TI_UINTQI_TYPE] +#define unsigned_intHI_type_node global_trees[TI_UINTHI_TYPE] +#define unsigned_intSI_type_node global_trees[TI_UINTSI_TYPE] +#define unsigned_intDI_type_node global_trees[TI_UINTDI_TYPE] +#define unsigned_intTI_type_node global_trees[TI_UINTTI_TYPE] + +#define char_type_node global_trees[TI_CHAR_TYPE] +#define signed_char_type_node global_trees[TI_SIGNED_CHAR_TYPE] +#define unsigned_char_type_node global_trees[TI_UNSIGNED_CHAR_TYPE] +#define short_integer_type_node global_trees[TI_SHORT_INTEGER_TYPE] +#define short_unsigned_type_node global_trees[TI_SHORT_UNSIGNED_TYPE] +#define integer_type_node global_trees[TI_INTEGER_TYPE] +#define unsigned_type_node global_trees[TI_UNSIGNED_TYPE] +#define long_integer_type_node global_trees[TI_LONG_INTEGER_TYPE] +#define long_unsigned_type_node global_trees[TI_LONG_UNSIGNED_TYPE] +#define long_long_integer_type_node global_trees[TI_LONG_LONG_INTEGER_TYPE] +#define long_long_unsigned_type_node global_trees[TI_LONG_LONG_UNSIGNED_TYPE] + +#define integer_zero_node global_trees[TI_INTEGER_ZERO] +#define integer_one_node global_trees[TI_INTEGER_ONE] +#define size_zero_node global_trees[TI_SIZE_ZERO] +#define size_one_node global_trees[TI_SIZE_ONE] +#define null_pointer_node global_trees[TI_NULL_POINTER] + +#define float_type_node global_trees[TI_FLOAT_TYPE] +#define double_type_node global_trees[TI_DOUBLE_TYPE] +#define long_double_type_node global_trees[TI_LONG_DOUBLE_TYPE] + +#define complex_integer_type_node global_trees[TI_COMPLEX_INTEGER_TYPE] +#define complex_float_type_node global_trees[TI_COMPLEX_FLOAT_TYPE] +#define complex_double_type_node global_trees[TI_COMPLEX_DOUBLE_TYPE] +#define complex_long_double_type_node global_trees[TI_COMPLEX_LONG_DOUBLE_TYPE] + +#define void_type_node global_trees[TI_VOID_TYPE] +#define ptr_type_node global_trees[TI_PTR_TYPE] +#define const_ptr_type_node global_trees[TI_CONST_PTR_TYPE] +#define ptrdiff_type_node global_trees[TI_PTRDIFF_TYPE] +#define va_list_type_node global_trees[TI_VA_LIST_TYPE] + #define NULL_TREE (tree) NULL /* The following functions accept a wide integer argument. Rather than @@ -1859,41 +1962,6 @@ extern int real_zerop PROTO((tree)); /* Declare commonly used variables for tree structure. */ -/* An integer constant with value 0 */ -extern tree integer_zero_node; - -/* An integer constant with value 1 */ -extern tree integer_one_node; - -/* An integer constant with value 0 whose type is sizetype. */ -extern tree size_zero_node; - -/* An integer constant with value 1 whose type is sizetype. */ -extern tree size_one_node; - -/* A constant of type pointer-to-int and value 0 */ -extern tree null_pointer_node; - -/* A node of type ERROR_MARK. */ -extern tree error_mark_node; - -/* The type node for the void type. */ -extern tree void_type_node; - -/* The type node for the ordinary (signed) integer type. */ -extern tree integer_type_node; - -/* The type node for the unsigned integer type. */ -extern tree unsigned_type_node; - -/* The type node for the ordinary character type. */ -extern tree char_type_node; - -extern tree ptr_type_node; - -/* Type `va_list'. Used by va_start, va_arg, etc. */ -extern tree va_list_type_node; - /* Points to the name of the input file from which the current input being parsed originally came (before it went into cpp). */ extern char *input_filename;