summaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index a6b17da494b..1582d7b595f 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -420,18 +420,22 @@ copy_list (tree list)
}
-/* Return a newly constructed INTEGER_CST node whose constant value
- is specified by the two ints LOW and HI.
- The TREE_TYPE is set to `int'. */
+/* Create an INT_CST node of TYPE and value HI:LOW. If TYPE is NULL,
+ integer_type_node is used. */
tree
-build_int_2 (unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi)
+build_int_cst (tree type, unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi)
{
- tree t = make_node (INTEGER_CST);
+ tree t;
+
+ if (!type)
+ type = integer_type_node;
+
+ t = make_node (INTEGER_CST);
TREE_INT_CST_LOW (t) = low;
TREE_INT_CST_HIGH (t) = hi;
- TREE_TYPE (t) = integer_type_node;
+ TREE_TYPE (t) = type;
return t;
}
@@ -5256,7 +5260,7 @@ make_vector_type (tree innertype, int nunits, enum machine_mode mode)
layout_type (t);
{
- tree index = build_int_2 (nunits - 1, 0);
+ tree index = build_int_cst (NULL_TREE, nunits - 1, 0);
tree array = build_array_type (innertype, build_index_type (index));
tree rt = make_node (RECORD_TYPE);
@@ -5333,8 +5337,7 @@ build_common_tree_nodes (int signed_char)
boolean_type_node before calling build_common_tree_nodes_2. */
boolean_type_node = make_unsigned_type (BOOL_TYPE_SIZE);
TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE);
- TYPE_MAX_VALUE (boolean_type_node) = build_int_2 (1, 0);
- TREE_TYPE (TYPE_MAX_VALUE (boolean_type_node)) = boolean_type_node;
+ TYPE_MAX_VALUE (boolean_type_node) = build_int_cst (boolean_type_node, 1, 0);
TYPE_PRECISION (boolean_type_node) = 1;
/* Fill in the rest of the sized types. Reuse existing type nodes
@@ -5363,9 +5366,9 @@ void
build_common_tree_nodes_2 (int short_double)
{
/* Define these next since types below may used them. */
- integer_zero_node = build_int_2 (0, 0);
- integer_one_node = build_int_2 (1, 0);
- integer_minus_one_node = build_int_2 (-1, -1);
+ integer_zero_node = build_int_cst (NULL_TREE, 0, 0);
+ integer_one_node = build_int_cst (NULL_TREE, 1, 0);
+ integer_minus_one_node = build_int_cst (NULL_TREE, -1, -1);
size_zero_node = size_int (0);
size_one_node = size_int (1);
@@ -5384,8 +5387,8 @@ build_common_tree_nodes_2 (int short_double)
TYPE_ALIGN (void_type_node) = BITS_PER_UNIT;
TYPE_USER_ALIGN (void_type_node) = 0;
- null_pointer_node = build_int_2 (0, 0);
- TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node);
+ null_pointer_node = build_int_cst (build_pointer_type (void_type_node),
+ 0, 0);
layout_type (TREE_TYPE (null_pointer_node));
ptr_type_node = build_pointer_type (void_type_node);