c-common.c (c_common_nodes_and_builtins): Make sizetype_endlink reference the language-equivalent of sizetype.

* c-common.c (c_common_nodes_and_builtins): Make sizetype_endlink
	reference the language-equivalent of sizetype.
	* c-typeck.c (comptypes): Treat sizetype like its language equivalent.
	* fold-const.c (size_binop, size_diffop): Put back checks.
	* gcse.c (dump_hash_table): Fix minor error in last change.
	* stor-layout.c (set_sizetype): Set TYPE_DOMAIN of sizetype.
	Clear TYPE_{NEXT,MAIN}_VARIANT and TYPE_{POINTER,REFERENCE}_to of
	all sizetypes.
	* cp/typeck.c (comptypes): Treat sizetype like its language equivalent.

From-SVN: r32291
This commit is contained in:
Richard Kenner 2000-03-02 18:29:56 +00:00 committed by Richard Kenner
parent 42f602d842
commit 21318741bb
8 changed files with 55 additions and 23 deletions

View File

@ -1,3 +1,14 @@
Thu Mar 2 13:29:46 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* c-common.c (c_common_nodes_and_builtins): Make sizetype_endlink
reference the language-equivalent of sizetype.
* c-typeck.c (comptypes): Treat sizetype like its language equivalent.
* fold-const.c (size_binop, size_diffop): Put back checks.
* gcse.c (dump_hash_table): Fix minor error in last change.
* stor-layout.c (set_sizetype): Set TYPE_DOMAIN of sizetype.
Clear TYPE_{NEXT,MAIN}_VARIANT and TYPE_{POINTER,REFERENCE}_to of
all sizetypes.
Thu Mar 2 12:48:45 MET 2000 Jan Hubicka <jh@suse.cz>
* calls.c (expand_call) Do not attempt to combine stack adjustments

View File

@ -3547,7 +3547,7 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
ptr_ftype = build_function_type (ptr_type_node, NULL_TREE);
ptr_ftype_unsigned = build_function_type (ptr_type_node, unsigned_endlink);
sizetype_endlink = tree_cons (NULL_TREE, sizetype, endlink);
sizetype_endlink = tree_cons (NULL_TREE, TYPE_DOMAIN (sizetype), endlink);
/* We realloc here because sizetype could be int or unsigned. S'ok. */
ptr_ftype_sizetype = build_function_type (ptr_type_node, sizetype_endlink);

View File

@ -436,6 +436,16 @@ comptypes (type1, type2)
|| TREE_CODE (t1) == ERROR_MARK || TREE_CODE (t2) == ERROR_MARK)
return 1;
/* If either type is the internal version of sizetype, return the
language version. */
if (TREE_CODE (t1) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t1)
&& TYPE_DOMAIN (t1) != 0)
t1 = TYPE_DOMAIN (t1);
if (TREE_CODE (t2) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t2)
&& TYPE_DOMAIN (t2) != 0)
t2 = TYPE_DOMAIN (t2);
/* Treat an enum type as the integer type of the same width and
signedness. */

View File

@ -1,3 +1,7 @@
Thu Mar 2 13:32:01 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* typeck.c (comptypes): Treat sizetype like its language equivalent.
2000-03-01 Bernd Schmidt <bernds@cygnus.co.uk>
* typeck.c (maybe_warn_about_returning_address_of_local): Reorganize

View File

@ -934,17 +934,15 @@ comptypes (t1, t2, strict)
if (t2 == error_mark_node)
return 0;
/* If this is a strict comparison with a sizetype, the actual types
won't be the same (since we need to set TYPE_IS_SIZETYPE, so verify
if they are both the same size and signedness. */
if (strict == COMPARE_STRICT
&& TREE_CODE (t2) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t2)
&& TREE_CODE (t1) == INTEGER_TYPE
&& TREE_UNSIGNED (t1) == TREE_UNSIGNED (t2)
&& TYPE_MODE (t1) == TYPE_MODE (t2)
&& TYPE_MIN_VALUE (t1) == TYPE_MIN_VALUE (t2)
&& TYPE_MAX_VALUE (t1) == TYPE_MAX_VALUE (t2))
return 1;
/* If either type is the internal version of sizetype, return the
language version. */
if (TREE_CODE (t1) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t1)
&& TYPE_DOMAIN (t1) != 0)
t1 = TYPE_DOMAIN (t1);
if (TREE_CODE (t2) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t2)
&& TYPE_DOMAIN (t2) != 0)
t2 = TYPE_DOMAIN (t2);
if (strict & COMPARE_RELAXED)
{

View File

@ -1868,8 +1868,8 @@ size_binop (code, arg0, arg1)
{
tree type = TREE_TYPE (arg0);
if (TREE_CODE (type) != INTEGER_TYPE
|| TREE_CODE (TREE_TYPE (arg1)) != INTEGER_TYPE)
if (TREE_CODE (type) != INTEGER_TYPE || ! TYPE_IS_SIZETYPE (type)
|| type != TREE_TYPE (arg1))
abort ();
/* Handle the special case of two integer constants faster. */
@ -1905,8 +1905,8 @@ size_diffop (arg0, arg1)
tree type = TREE_TYPE (arg0);
tree ctype;
if (TREE_CODE (type) != INTEGER_TYPE
|| TREE_CODE (TREE_TYPE (arg1)) != INTEGER_TYPE)
if (TREE_CODE (type) != INTEGER_TYPE || ! TYPE_IS_SIZETYPE (type)
|| type != TREE_TYPE (arg1))
abort ();
/* If the type is already signed, just do the simple thing. */

View File

@ -2009,12 +2009,13 @@ dump_hash_table (file, name, table, table_size, total_size)
name, table_size, total_size);
for (i = 0; i < total_size; i++)
{
fprintf (file, "Index %d (hash value %d)\n ",
expr->bitmap_index, hash_val[i]);
print_rtl (file, flat_table[i]->expr);
fprintf (file, "\n");
}
if (flat_table[i] != 0)
{
fprintf (file, "Index %d (hash value %d)\n ",
expr->bitmap_index, hash_val[i]);
print_rtl (file, flat_table[i]->expr);
fprintf (file, "\n");
}
fprintf (file, "\n");

View File

@ -1402,6 +1402,7 @@ set_sizetype (type)
/* Make copies of nodes since we'll be setting TYPE_IS_SIZETYPE. */
sizetype = copy_node (type);
TYPE_DOMAIN (sizetype) = type;
bitsizetype = make_node (INTEGER_TYPE);
TYPE_NAME (bitsizetype) = TYPE_NAME (type);
TYPE_PRECISION (bitsizetype) = precision;
@ -1430,8 +1431,15 @@ set_sizetype (type)
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 < sizeof sizetype_tab / sizeof sizetype_tab[0]; i++)
TYPE_IS_SIZETYPE (sizetype_tab[i]) = 1;
{
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;
}
ggc_add_tree_root ((tree *) &sizetype_tab,
sizeof sizetype_tab / sizeof (tree));