Commit 4c08eef0 by Richard Kenner

(clear_storage): SIZE is now rtx, not int.

(store_constructor): Call clear_storage with rtx.
(get_inner_reference): Convert index to precision of sizetype, not
POINTER_SIZE.
(expand_expr, case ARRAY_REF): Likewise.

From-SVN: r10529
parent c16b611e
...@@ -1833,7 +1833,7 @@ use_regs (call_fusage, regno, nregs) ...@@ -1833,7 +1833,7 @@ use_regs (call_fusage, regno, nregs)
void void
clear_storage (object, size) clear_storage (object, size)
rtx object; rtx object;
int size; rtx size;
{ {
if (GET_MODE (object) == BLKmode) if (GET_MODE (object) == BLKmode)
{ {
...@@ -1841,12 +1841,16 @@ clear_storage (object, size) ...@@ -1841,12 +1841,16 @@ clear_storage (object, size)
emit_library_call (memset_libfunc, 0, emit_library_call (memset_libfunc, 0,
VOIDmode, 3, VOIDmode, 3,
XEXP (object, 0), Pmode, const0_rtx, ptr_mode, XEXP (object, 0), Pmode, const0_rtx, ptr_mode,
GEN_INT (size), ptr_mode); convert_to_mode (TYPE_MODE (sizetype),
size, TREE_UNSIGNED (sizetype)),
TYPE_MODE (sizetype));
#else #else
emit_library_call (bzero_libfunc, 0, emit_library_call (bzero_libfunc, 0,
VOIDmode, 2, VOIDmode, 2,
XEXP (object, 0), Pmode, XEXP (object, 0), Pmode,
GEN_INT (size), ptr_mode); convert_to_mode (TYPE_MODE (sizetype),
size, TREE_UNSIGNED (sizetype)),
TYPE_MODE (sizetype));
#endif #endif
} }
else else
...@@ -3002,7 +3006,7 @@ store_constructor (exp, target) ...@@ -3002,7 +3006,7 @@ store_constructor (exp, target)
clear the whole structure first. */ clear the whole structure first. */
else if (list_length (CONSTRUCTOR_ELTS (exp)) else if (list_length (CONSTRUCTOR_ELTS (exp))
!= list_length (TYPE_FIELDS (type))) != list_length (TYPE_FIELDS (type)))
clear_storage (target, int_size_in_bytes (type)); clear_storage (target, expr_size (exp));
else else
/* Inform later passes that the old value is dead. */ /* Inform later passes that the old value is dead. */
emit_insn (gen_rtx (CLOBBER, VOIDmode, target)); emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
...@@ -3088,7 +3092,7 @@ store_constructor (exp, target) ...@@ -3088,7 +3092,7 @@ store_constructor (exp, target)
if (list_length (CONSTRUCTOR_ELTS (exp)) < maxelt - minelt + 1 if (list_length (CONSTRUCTOR_ELTS (exp)) < maxelt - minelt + 1
|| (GET_CODE (target) == REG && TREE_STATIC (exp))) || (GET_CODE (target) == REG && TREE_STATIC (exp)))
clear_storage (target, int_size_in_bytes (type)); clear_storage (target, expr_size (exp));
else else
/* Inform later passes that the old value is dead. */ /* Inform later passes that the old value is dead. */
emit_insn (gen_rtx (CLOBBER, VOIDmode, target)); emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
...@@ -3170,12 +3174,12 @@ store_constructor (exp, target) ...@@ -3170,12 +3174,12 @@ store_constructor (exp, target)
/* Check for all zeros. */ /* Check for all zeros. */
if (CONSTRUCTOR_ELTS (exp) == NULL_TREE) if (CONSTRUCTOR_ELTS (exp) == NULL_TREE)
{ {
clear_storage (target, nbytes); clear_storage (target, expr_size (exp));
return; return;
} }
if (nbytes < 0) if (nbytes < 0)
abort(); abort ();
domain_min = convert (sizetype, TYPE_MIN_VALUE (domain)); domain_min = convert (sizetype, TYPE_MIN_VALUE (domain));
domain_max = convert (sizetype, TYPE_MAX_VALUE (domain)); domain_max = convert (sizetype, TYPE_MAX_VALUE (domain));
...@@ -3292,7 +3296,7 @@ store_constructor (exp, target) ...@@ -3292,7 +3296,7 @@ store_constructor (exp, target)
if (need_to_clear_first if (need_to_clear_first
&& endb - startb != nbytes * BITS_PER_UNIT) && endb - startb != nbytes * BITS_PER_UNIT)
clear_storage (target, nbytes); clear_storage (target, expr_size (exp));
need_to_clear_first = 0; need_to_clear_first = 0;
emit_library_call (memset_libfunc, 0, emit_library_call (memset_libfunc, 0,
VOIDmode, 3, VOIDmode, 3,
...@@ -3307,7 +3311,7 @@ store_constructor (exp, target) ...@@ -3307,7 +3311,7 @@ store_constructor (exp, target)
{ {
if (need_to_clear_first) if (need_to_clear_first)
{ {
clear_storage (target, nbytes); clear_storage (target, expr_size (exp));
need_to_clear_first = 0; need_to_clear_first = 0;
} }
emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__setbits"), emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__setbits"),
...@@ -3615,9 +3619,10 @@ get_inner_reference (exp, pbitsize, pbitpos, poffset, pmode, ...@@ -3615,9 +3619,10 @@ get_inner_reference (exp, pbitsize, pbitpos, poffset, pmode,
if (! integer_zerop (low_bound)) if (! integer_zerop (low_bound))
index = fold (build (MINUS_EXPR, index_type, index, low_bound)); index = fold (build (MINUS_EXPR, index_type, index, low_bound));
if (TYPE_PRECISION (index_type) != POINTER_SIZE) if (TYPE_PRECISION (index_type) != TYPE_PRECISION (sizetype))
{ {
index = convert (type_for_size (POINTER_SIZE, 0), index); index = convert (type_for_size (TYPE_PRECISION (sizetype), 0),
index);
index_type = TREE_TYPE (index); index_type = TREE_TYPE (index);
} }
...@@ -4633,10 +4638,11 @@ expand_expr (exp, target, tmode, modifier) ...@@ -4633,10 +4638,11 @@ expand_expr (exp, target, tmode, modifier)
tree elt; tree elt;
tree size = size_in_bytes (type); tree size = size_in_bytes (type);
/* Convert the integer argument to a type the same size as a /* Convert the integer argument to a type the same size as sizetype
pointer so the multiply won't overflow spuriously. */ so the multiply won't overflow spuriously. */
if (TYPE_PRECISION (index_type) != POINTER_SIZE) if (TYPE_PRECISION (index_type) != TYPE_PRECISION (sizetype))
index = convert (type_for_size (POINTER_SIZE, 0), index); index = convert (type_for_size (TYPE_PRECISION (sizetype), 0),
index);
if (TREE_CODE (size) != INTEGER_CST if (TREE_CODE (size) != INTEGER_CST
&& contains_placeholder_p (size)) && contains_placeholder_p (size))
......
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