Commit 3967bc2d by Roger Sayle Committed by Roger Sayle

builtins.c (fold_builtin_sprintf): Use fold_convert instead of convert in the middle-end.


	* builtins.c (fold_builtin_sprintf): Use fold_convert instead of
	convert in the middle-end.
	* expr.c (store_expr, store_constructor, get_inner_reference,
	expand_expr_real_1, string_constant, try_casesi, try_tablejump):
	Likewise.
	* tree.c (build_range_type): Likewise.

From-SVN: r112670
parent b52be2c8
2006-04-04 Roger Sayle <roger@eyesopen.com>
* builtins.c (fold_builtin_sprintf): Use fold_convert instead of
convert in the middle-end.
* expr.c (store_expr, store_constructor, get_inner_reference,
expand_expr_real_1, string_constant, try_casesi, try_tablejump):
Likewise.
* tree.c (build_range_type): Likewise.
2006-04-04 Tom Tromey <tromey@redhat.com> 2006-04-04 Tom Tromey <tromey@redhat.com>
* doc/install.texi (Prerequisites): Mention jar. * doc/install.texi (Prerequisites): Mention jar.
......
...@@ -9657,7 +9657,7 @@ fold_builtin_sprintf (tree arglist, int ignored) ...@@ -9657,7 +9657,7 @@ fold_builtin_sprintf (tree arglist, int ignored)
if (call && retval) if (call && retval)
{ {
retval = convert retval = fold_convert
(TREE_TYPE (TREE_TYPE (implicit_built_in_decls[BUILT_IN_SPRINTF])), (TREE_TYPE (TREE_TYPE (implicit_built_in_decls[BUILT_IN_SPRINTF])),
retval); retval);
return build2 (COMPOUND_EXPR, TREE_TYPE (retval), call, retval); return build2 (COMPOUND_EXPR, TREE_TYPE (retval), call, retval);
......
...@@ -4288,14 +4288,14 @@ store_expr (tree exp, rtx target, int call_param_p) ...@@ -4288,14 +4288,14 @@ store_expr (tree exp, rtx target, int call_param_p)
{ {
if (TYPE_UNSIGNED (TREE_TYPE (exp)) if (TYPE_UNSIGNED (TREE_TYPE (exp))
!= SUBREG_PROMOTED_UNSIGNED_P (target)) != SUBREG_PROMOTED_UNSIGNED_P (target))
exp = convert exp = fold_convert
(lang_hooks.types.signed_or_unsigned_type (lang_hooks.types.signed_or_unsigned_type
(SUBREG_PROMOTED_UNSIGNED_P (target), TREE_TYPE (exp)), exp); (SUBREG_PROMOTED_UNSIGNED_P (target), TREE_TYPE (exp)), exp);
exp = convert (lang_hooks.types.type_for_mode exp = fold_convert (lang_hooks.types.type_for_mode
(GET_MODE (SUBREG_REG (target)), (GET_MODE (SUBREG_REG (target)),
SUBREG_PROMOTED_UNSIGNED_P (target)), SUBREG_PROMOTED_UNSIGNED_P (target)),
exp); exp);
inner_target = SUBREG_REG (target); inner_target = SUBREG_REG (target);
} }
...@@ -4963,13 +4963,13 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) ...@@ -4963,13 +4963,13 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
{ {
type = lang_hooks.types.type_for_size type = lang_hooks.types.type_for_size
(BITS_PER_WORD, TYPE_UNSIGNED (type)); (BITS_PER_WORD, TYPE_UNSIGNED (type));
value = convert (type, value); value = fold_convert (type, value);
} }
if (BYTES_BIG_ENDIAN) if (BYTES_BIG_ENDIAN)
value value
= fold_build2 (LSHIFT_EXPR, type, value, = fold_build2 (LSHIFT_EXPR, type, value,
build_int_cst (NULL_TREE, build_int_cst (type,
BITS_PER_WORD - bitsize)); BITS_PER_WORD - bitsize));
bitsize = BITS_PER_WORD; bitsize = BITS_PER_WORD;
mode = word_mode; mode = word_mode;
...@@ -5167,13 +5167,17 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) ...@@ -5167,13 +5167,17 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
emit_label (loop_start); emit_label (loop_start);
/* Assign value to element index. */ /* Assign value to element index. */
position position =
= convert (ssizetype, fold_convert (ssizetype,
fold_build2 (MINUS_EXPR, TREE_TYPE (index), fold_build2 (MINUS_EXPR,
index, TYPE_MIN_VALUE (domain))); TREE_TYPE (index),
position = size_binop (MULT_EXPR, position, index,
convert (ssizetype, TYPE_MIN_VALUE (domain)));
TYPE_SIZE_UNIT (elttype)));
position =
size_binop (MULT_EXPR, position,
fold_convert (ssizetype,
TYPE_SIZE_UNIT (elttype)));
pos_rtx = expand_normal (position); pos_rtx = expand_normal (position);
xtarget = offset_address (target, pos_rtx, xtarget = offset_address (target, pos_rtx,
...@@ -5217,9 +5221,10 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) ...@@ -5217,9 +5221,10 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
index, index,
TYPE_MIN_VALUE (domain))); TYPE_MIN_VALUE (domain)));
position = size_binop (MULT_EXPR, index, position =
convert (ssizetype, size_binop (MULT_EXPR, index,
TYPE_SIZE_UNIT (elttype))); fold_convert (ssizetype,
TYPE_SIZE_UNIT (elttype)));
xtarget = offset_address (target, xtarget = offset_address (target,
expand_normal (position), expand_normal (position),
highest_pow2_factor (position)); highest_pow2_factor (position));
...@@ -5672,7 +5677,7 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, ...@@ -5672,7 +5677,7 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
offset = size_binop (PLUS_EXPR, offset, offset = size_binop (PLUS_EXPR, offset,
size_binop (MULT_EXPR, size_binop (MULT_EXPR,
convert (sizetype, index), fold_convert (sizetype, index),
unit_size)); unit_size));
} }
break; break;
...@@ -5711,7 +5716,8 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, ...@@ -5711,7 +5716,8 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
/* If OFFSET is constant, see if we can return the whole thing as a /* If OFFSET is constant, see if we can return the whole thing as a
constant bit position. Otherwise, split it up. */ constant bit position. Otherwise, split it up. */
if (host_integerp (offset, 0) if (host_integerp (offset, 0)
&& 0 != (tem = size_binop (MULT_EXPR, convert (bitsizetype, offset), && 0 != (tem = size_binop (MULT_EXPR,
fold_convert (bitsizetype, offset),
bitsize_unit_node)) bitsize_unit_node))
&& 0 != (tem = size_binop (PLUS_EXPR, tem, bit_offset)) && 0 != (tem = size_binop (PLUS_EXPR, tem, bit_offset))
&& host_integerp (tem, 0)) && host_integerp (tem, 0))
...@@ -8500,14 +8506,11 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, ...@@ -8500,14 +8506,11 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
&& integer_onep (DECL_SIZE (TREE_OPERAND (TREE_OPERAND (rhs, 1), 1)))) && integer_onep (DECL_SIZE (TREE_OPERAND (TREE_OPERAND (rhs, 1), 1))))
{ {
rtx label = gen_label_rtx (); rtx label = gen_label_rtx ();
int value = TREE_CODE (rhs) == BIT_IOR_EXPR;
do_jump (TREE_OPERAND (rhs, 1), do_jump (TREE_OPERAND (rhs, 1),
TREE_CODE (rhs) == BIT_IOR_EXPR ? label : 0, value ? label : 0,
TREE_CODE (rhs) == BIT_AND_EXPR ? label : 0); value ? 0 : label);
expand_assignment (lhs, convert (TREE_TYPE (rhs), expand_assignment (lhs, build_int_cst (TREE_TYPE (rhs), value));
(TREE_CODE (rhs) == BIT_IOR_EXPR
? integer_one_node
: integer_zero_node)));
do_pending_stack_adjust (); do_pending_stack_adjust ();
emit_label (label); emit_label (label);
return const0_rtx; return const0_rtx;
...@@ -8827,7 +8830,7 @@ string_constant (tree arg, tree *ptr_offset) ...@@ -8827,7 +8830,7 @@ string_constant (tree arg, tree *ptr_offset)
if (TREE_CODE (array) == STRING_CST) if (TREE_CODE (array) == STRING_CST)
{ {
*ptr_offset = convert (sizetype, offset); *ptr_offset = fold_convert (sizetype, offset);
return array; return array;
} }
else if (TREE_CODE (array) == VAR_DECL) else if (TREE_CODE (array) == VAR_DECL)
...@@ -8854,7 +8857,7 @@ string_constant (tree arg, tree *ptr_offset) ...@@ -8854,7 +8857,7 @@ string_constant (tree arg, tree *ptr_offset)
/* If variable is bigger than the string literal, OFFSET must be constant /* If variable is bigger than the string literal, OFFSET must be constant
and inside of the bounds of the string literal. */ and inside of the bounds of the string literal. */
offset = convert (sizetype, offset); offset = fold_convert (sizetype, offset);
if (compare_tree_int (DECL_SIZE_UNIT (array), length) > 0 if (compare_tree_int (DECL_SIZE_UNIT (array), length) > 0
&& (! host_integerp (offset, 1) && (! host_integerp (offset, 1)
|| compare_tree_int (offset, length) >= 0)) || compare_tree_int (offset, length) >= 0))
...@@ -9166,9 +9169,8 @@ try_casesi (tree index_type, tree index_expr, tree minval, tree range, ...@@ -9166,9 +9169,8 @@ try_casesi (tree index_type, tree index_expr, tree minval, tree range,
{ {
if (TYPE_MODE (index_type) != index_mode) if (TYPE_MODE (index_type) != index_mode)
{ {
index_expr = convert (lang_hooks.types.type_for_size index_type = lang_hooks.types.type_for_size (index_bits, 0);
(index_bits, 0), index_expr); index_expr = fold_convert (index_type, index_expr);
index_type = TREE_TYPE (index_expr);
} }
index = expand_normal (index_expr); index = expand_normal (index_expr);
...@@ -9294,8 +9296,8 @@ try_tablejump (tree index_type, tree index_expr, tree minval, tree range, ...@@ -9294,8 +9296,8 @@ try_tablejump (tree index_type, tree index_expr, tree minval, tree range,
return 0; return 0;
index_expr = fold_build2 (MINUS_EXPR, index_type, index_expr = fold_build2 (MINUS_EXPR, index_type,
convert (index_type, index_expr), fold_convert (index_type, index_expr),
convert (index_type, minval)); fold_convert (index_type, minval));
index = expand_normal (index_expr); index = expand_normal (index_expr);
do_pending_stack_adjust (); do_pending_stack_adjust ();
......
...@@ -5021,8 +5021,8 @@ build_range_type (tree type, tree lowval, tree highval) ...@@ -5021,8 +5021,8 @@ build_range_type (tree type, tree lowval, tree highval)
if (type == NULL_TREE) if (type == NULL_TREE)
type = sizetype; type = sizetype;
TYPE_MIN_VALUE (itype) = convert (type, lowval); TYPE_MIN_VALUE (itype) = fold_convert (type, lowval);
TYPE_MAX_VALUE (itype) = highval ? convert (type, highval) : NULL; TYPE_MAX_VALUE (itype) = highval ? fold_convert (type, highval) : NULL;
TYPE_PRECISION (itype) = TYPE_PRECISION (type); TYPE_PRECISION (itype) = TYPE_PRECISION (type);
TYPE_MODE (itype) = TYPE_MODE (type); TYPE_MODE (itype) = TYPE_MODE (type);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment