aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorPer Bothner <bothner@gcc.gnu.org>1993-03-03 12:35:27 -0800
committerPer Bothner <bothner@gcc.gnu.org>1993-03-03 12:35:27 -0800
commit742e43a2fac36dbe9640552002b1404dc094e5d9 (patch)
treefb9a1258971ad5cf440bfcc8e336363205d7b673 /gcc/tree.c
parentc8d6697caa95cb93f1105a904fbcf0bd8a3dc3ea (diff)
downloadgcc-742e43a2fac36dbe9640552002b1404dc094e5d9.zip
gcc-742e43a2fac36dbe9640552002b1404dc094e5d9.tar.gz
gcc-742e43a2fac36dbe9640552002b1404dc094e5d9.tar.bz2
Define and use new function build_range_type.
From-SVN: r3624
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 45b917d..8fe09a1 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2688,20 +2688,25 @@ build_index_type (maxval)
return itype;
}
-/* Just like build_index_type, but takes lowval and highval instead
- of just highval (maxval). */
+/* Create a range of some discrete type TYPE (an INTEGER_TYPE,
+ ENUMERAL_TYPE, BOOLEAN_TYPE, or VHAR_TYPE), with
+ low bound LOWVAL and high bound HIGHVAL.
+ if TYPE==NULL_TREE, sizetype is used. */
tree
-build_index_2_type (lowval,highval)
- tree lowval, highval;
+build_range_type (type, lowval, highval)
+ tree type, lowval, highval;
{
register tree itype = make_node (INTEGER_TYPE);
- TYPE_PRECISION (itype) = TYPE_PRECISION (sizetype);
- TYPE_MIN_VALUE (itype) = convert (sizetype, lowval);
- TYPE_MAX_VALUE (itype) = convert (sizetype, highval);
- TYPE_MODE (itype) = TYPE_MODE (sizetype);
- TYPE_SIZE (itype) = TYPE_SIZE (sizetype);
- TYPE_ALIGN (itype) = TYPE_ALIGN (sizetype);
+ TREE_TYPE (itype) = type;
+ if (type == NULL_TREE)
+ type = sizetype;
+ TYPE_PRECISION (itype) = TYPE_PRECISION (type);
+ TYPE_MIN_VALUE (itype) = convert (type, lowval);
+ TYPE_MAX_VALUE (itype) = convert (type, highval);
+ TYPE_MODE (itype) = TYPE_MODE (type);
+ TYPE_SIZE (itype) = TYPE_SIZE (type);
+ TYPE_ALIGN (itype) = TYPE_ALIGN (type);
if ((TREE_CODE (lowval) == INTEGER_CST)
&& (TREE_CODE (highval) == INTEGER_CST))
{
@@ -2714,6 +2719,16 @@ build_index_2_type (lowval,highval)
return itype;
}
+/* Just like build_index_type, but takes lowval and highval instead
+ of just highval (maxval). */
+
+tree
+build_index_2_type (lowval,highval)
+ tree lowval, highval;
+{
+ return build_range_type (NULL_TREE, lowval, highval);
+}
+
/* Return nonzero iff ITYPE1 and ITYPE2 are equal (in the LISP sense).
Needed because when index types are not hashed, equal index types
built at different times appear distinct, even though structurally,