aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2007-01-08 22:53:20 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2007-01-08 22:53:20 +0000
commit2ac7cbb53296e6006d7c113d81175dd455fd570b (patch)
treec7ad9e6d3d7b86c201aaecf9a0017fb8badea1c3 /gcc/fold-const.c
parent1c61ff294690d6ce7c9e958f62ab48a441943844 (diff)
downloadgcc-2ac7cbb53296e6006d7c113d81175dd455fd570b.zip
gcc-2ac7cbb53296e6006d7c113d81175dd455fd570b.tar.gz
gcc-2ac7cbb53296e6006d7c113d81175dd455fd570b.tar.bz2
tree.h (build_int_cst_wide_type): Export.
2007-01-08 Richard Guenther <rguenther@suse.de> * tree.h (build_int_cst_wide_type): Export. * tree.c (build_int_cst_wide_type): New function. (build_int_cst_wide): Fix comment. * builtins.c (fold_builtin_object_size): Use build_int_cst to build -1 or 0 of the correct type. Use fit_double_type to check for overflow. * fold-const.c (optimize_bit_field_compare): Use build_int_cst_type to build the mask. (decode_field_reference): Likewise. (all_ones_mask_p): Likewise. (native_interpret_int): Use build_int_cst_wide_type. (fold_binary): Use build_int_cst_type to build an all-ones value. * stor-layout.c (set_sizetype): Use build_int_cst_wide_type. java/ * lex.c (do_java_lex): Use build_int_cst_wide_type. * jcf-parse.c (get_constant): Likewise. cp/ * cvt.c (cp_convert_to_pointer): Use build_int_cst_type. ada/ * cuintp.c (build_cst_from_int): Use built_int_cst_type. * trans.c (gnat_to_gnu): Likewise. From-SVN: r120596
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index d082ed3..d88c01b 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3478,9 +3478,7 @@ optimize_bit_field_compare (enum tree_code code, tree compare_type,
lbitpos = nbitsize - lbitsize - lbitpos;
/* Make the mask to be used against the extracted field. */
- mask = build_int_cst (unsigned_type, -1);
- mask = force_fit_type (mask, 0, false, false);
- mask = fold_convert (unsigned_type, mask);
+ mask = build_int_cst_type (unsigned_type, -1);
mask = const_binop (LSHIFT_EXPR, mask, size_int (nbitsize - lbitsize), 0);
mask = const_binop (RSHIFT_EXPR, mask,
size_int (nbitsize - lbitsize - lbitpos), 0);
@@ -3638,8 +3636,7 @@ decode_field_reference (tree exp, HOST_WIDE_INT *pbitsize,
unsigned_type = lang_hooks.types.type_for_size (*pbitsize, 1);
precision = TYPE_PRECISION (unsigned_type);
- mask = build_int_cst (unsigned_type, -1);
- mask = force_fit_type (mask, 0, false, false);
+ mask = build_int_cst_type (unsigned_type, -1);
mask = const_binop (LSHIFT_EXPR, mask, size_int (precision - *pbitsize), 0);
mask = const_binop (RSHIFT_EXPR, mask, size_int (precision - *pbitsize), 0);
@@ -3664,8 +3661,7 @@ all_ones_mask_p (tree mask, int size)
unsigned int precision = TYPE_PRECISION (type);
tree tmask;
- tmask = build_int_cst (lang_hooks.types.signed_type (type), -1);
- tmask = force_fit_type (tmask, 0, false, false);
+ tmask = build_int_cst_type (lang_hooks.types.signed_type (type), -1);
return
tree_int_cst_equal (mask,
@@ -7113,8 +7109,7 @@ native_interpret_int (tree type, unsigned char *ptr, int len)
<< (bitpos - HOST_BITS_PER_WIDE_INT);
}
- return force_fit_type (build_int_cst_wide (type, lo, hi),
- 0, false, false);
+ return build_int_cst_wide_type (type, lo, hi);
}
@@ -8802,8 +8797,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
&& operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0)
&& !TYPE_TRAP_SIGNED (type))
{
- t1 = build_int_cst (type, -1);
- t1 = force_fit_type (t1, 0, false, false);
+ t1 = build_int_cst_type (type, -1);
return omit_one_operand (type, t1, arg1);
}
@@ -8812,8 +8806,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
&& operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0)
&& !TYPE_TRAP_SIGNED (type))
{
- t1 = build_int_cst (type, -1);
- t1 = force_fit_type (t1, 0, false, false);
+ t1 = build_int_cst_type (type, -1);
return omit_one_operand (type, t1, arg0);
}
@@ -9601,8 +9594,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
if (TREE_CODE (arg0) == BIT_NOT_EXPR
&& operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0))
{
- t1 = build_int_cst (type, -1);
- t1 = force_fit_type (t1, 0, false, false);
+ t1 = build_int_cst_type (type, -1);
return omit_one_operand (type, t1, arg1);
}
@@ -9610,8 +9602,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
if (TREE_CODE (arg1) == BIT_NOT_EXPR
&& operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0))
{
- t1 = build_int_cst (type, -1);
- t1 = force_fit_type (t1, 0, false, false);
+ t1 = build_int_cst_type (type, -1);
return omit_one_operand (type, t1, arg0);
}
@@ -9717,8 +9708,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
if (TREE_CODE (arg0) == BIT_NOT_EXPR
&& operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0))
{
- t1 = build_int_cst (type, -1);
- t1 = force_fit_type (t1, 0, false, false);
+ t1 = build_int_cst_type (type, -1);
return omit_one_operand (type, t1, arg1);
}
@@ -9726,8 +9716,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
if (TREE_CODE (arg1) == BIT_NOT_EXPR
&& operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0))
{
- t1 = build_int_cst (type, -1);
- t1 = force_fit_type (t1, 0, false, false);
+ t1 = build_int_cst_type (type, -1);
return omit_one_operand (type, t1, arg0);
}