summaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1998-04-04 17:46:06 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1998-04-04 17:46:06 +0000
commita32bb500e498405b7f24fd901252cf0d772657f9 (patch)
tree732571c84a2af807ac7242046fc7cc2b2ae49b19 /gcc/stor-layout.c
parent10c2bede9fb9ec9527eca1c341604167abd2d2f9 (diff)
downloadgcc-a32bb500e498405b7f24fd901252cf0d772657f9.tar.gz
* tree.h (sizetype_tab[2], sbitsizetype, ubitsizetype): Merge all
of these into a single struct, with additional [us]sizetype entries. * stor-layout.c (set_sizetype): Initialize [us]sizetype. * fold-const.c (size_int_wide): Don't rely on sizetype_tab being an array. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@18994 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 8aaf2f692f2..365826d1727 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -32,10 +32,9 @@ Boston, MA 02111-1307, USA. */
#define CEIL(x,y) (((x) + (y) - 1) / (y))
/* Data type for the expressions representing sizes of data types.
- It is the first integer type laid out.
- In C, this is int. */
+ It is the first integer type laid out. */
-tree sizetype_tab[2], sbitsizetype, ubitsizetype;
+struct sizetype_tab sizetype_tab;
/* An integer constant with value 0 whose type is sizetype. */
@@ -1103,14 +1102,14 @@ make_unsigned_type (precision)
return type;
}
-/* Set sizetype to TYPE, and initialize *bitsizetype accordingly.
+/* Set sizetype to TYPE, and initialize *sizetype accordingly.
Also update the type of any standard type's sizes made so far. */
void
set_sizetype (type)
tree type;
{
- int precision = TYPE_PRECISION (type);
+ int oprecision = TYPE_PRECISION (type), precision;
sizetype = type;
@@ -1124,18 +1123,32 @@ set_sizetype (type)
if (! bitsizetype)
bitsizetype = make_node (INTEGER_TYPE);
- precision += BITS_PER_UNIT_LOG + 1;
+ 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;
TYPE_PRECISION (bitsizetype) = precision;
- (TREE_UNSIGNED (type) ? fixup_unsigned_type : fixup_signed_type)
- (bitsizetype);
+ if (TREE_UNSIGNED (type))
+ fixup_unsigned_type (bitsizetype);
+ else
+ fixup_signed_type (bitsizetype);
layout_type (bitsizetype);
- sbitsizetype = make_signed_type (precision);
- ubitsizetype = make_unsigned_type (precision);
+ if (TREE_UNSIGNED (type))
+ {
+ usizetype = sizetype;
+ ubitsizetype = bitsizetype;
+ ssizetype = make_signed_type (oprecision);
+ sbitsizetype = make_signed_type (precision);
+ }
+ else
+ {
+ ssizetype = sizetype;
+ sbitsizetype = bitsizetype;
+ usizetype = make_unsigned_type (oprecision);
+ ubitsizetype = make_unsigned_type (precision);
+ }
}
/* Set the extreme values of TYPE based on its precision in bits,