+2004-08-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * 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 <rth@redhat.com>
Andrew Pinski <apinski@apple.com>
+2004-08-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * ada/utils.c (gnat_init_decl_processing): Adjust
+ build_common_tree_nodes call.
+
2004-08-20 Nathan Sidwell <nathan@codesourcery.com>
* utils2.c (build_allocator): Use build_int_cst for negative
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
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 ();
+2004-08-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp/decl.c (cxx_init_decl_processing): Adjust
+ build_common_tree_nodes call.
+
2004-08-24 Nathan Sidwell <nathan@codesourcery.com>
PR c++/16889
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 ();
{
/* 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;
}
+2004-08-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * fortran/f95-lang.c (gfc_init_decl_processing): Adjust
+ build_common_tree_nodes call.
+
2004-08-24 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
* trans-types.c: Spelling and formatting fixes.
* symbol.c (gfc_add_common): Disable checks to work around other more
fundamental inadequacies.
-2004-05-22 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
+2004-05-22 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
* trans-decl.c (gfc_get_extern_function_decl): Set DECL_IS_PURE
only for functions.
* decl.c (variable_decl): Always apply default initializer.
-2004-05-08 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
+2004-05-08 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/15206
* trans-intrinsic.c (gfc_conv_intrinsic_rrspacing): Fixed to
Remove "set DEVELOPMENT".
(Compiling GFORTRAN): Remove.
-2004-05-09 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
+2004-05-09 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
* array.c (match_subscript, match_array_ref): Add comments
explaining argument 'init'.
* primary.c (match_digits, match_integer_constant): Add comment
explaining signflag.
-2004-05-01 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
+2004-05-01 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
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 <tobias.schlueter@physik.uni-muenchen.de>
+2004-05-01 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/13940
* match.c (match_data_constant): Handle case where
gfc_find_symbol sets sym to NULL
-2004-04-28 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
+2004-04-28 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
* Make-lang.in (f95-lang.o, trans-intrinsic.o): Add missing
dependency on mathbuiltins.def
* gfortranspec.c: Do not include multilib.h.
-2004-04-24 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
+2004-04-24 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
* trans-intrinsic.c: Fix comment, this is not trans-expr.c. Add
2004 to copyright years.
/* 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);
+2004-08-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * java/decl.c (java_init_decl_processing): Adjust
+ initialize_sizetypes call.
+
2004-08-23 Nathan Sidwell <nathan@codesourcery.com>
* jv-scan.c (fancy_abort): Add.
properly initialize `finished_label'. Don't emit gotos for empty
try statements.
-2000-03-19 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+2000-03-19 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* except.c (emit_handlers): Clear catch_clauses_last.
TREE_TYPE (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));
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;
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;
}
/* 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)
/* 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];
&& 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
value to enable integer types to be created. */
void
-initialize_sizetypes (void)
+initialize_sizetypes (bool signed_p)
{
tree t = make_node (INTEGER_TYPE);
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);
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)
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;
}
\f
/* TYPE is an integral type, i.e., an INTEGRAL_TYPE, ENUMERAL_TYPE,
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;
{
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;
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);
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);
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);
+2004-08-24 Nathan Sidwell <nathan@codesourcery.com>
+
+ * treelang/treetree.c (treelang_init_decl_processing): Adjust
+ build_common_tree_nodes call.
+
2004-08-14 Nathan Sidwell <nathan@codesourcery.com>
* treetree.c (tree_code_get_integer_value): Use build_int_cst.
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 */