Commit 88f63c77 by Richard Kenner

(clear_storage, expand_assignment, store_{expr,constructor}): Use ptr_mode…

(clear_storage, expand_assignment, store_{expr,constructor}): Use ptr_mode instead of Pmode in some places.

(clear_storage, expand_assignment, store_{expr,constructor}): Use ptr_mode
instead of Pmode in some places.
(expand_expr, expand_builtin): Likewise.
(push_block, store_expr): Convert size to Pmode.
(expand_expr, case ADDR_EXPR): Convert from Pmode to ptr_mode.

From-SVN: r9305
parent ea534b63
...@@ -1829,13 +1829,13 @@ clear_storage (object, size) ...@@ -1829,13 +1829,13 @@ clear_storage (object, size)
#ifdef TARGET_MEM_FUNCTIONS #ifdef TARGET_MEM_FUNCTIONS
emit_library_call (memset_libfunc, 0, emit_library_call (memset_libfunc, 0,
VOIDmode, 3, VOIDmode, 3,
XEXP (object, 0), Pmode, const0_rtx, Pmode, XEXP (object, 0), Pmode, const0_rtx, ptr_mode,
GEN_INT (size), Pmode); GEN_INT (size), ptr_mode);
#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), Pmode); GEN_INT (size), ptr_mode);
#endif #endif
} }
else else
...@@ -2018,6 +2018,8 @@ push_block (size, extra, below) ...@@ -2018,6 +2018,8 @@ push_block (size, extra, below)
int extra, below; int extra, below;
{ {
register rtx temp; register rtx temp;
size = convert_modes (Pmode, ptr_mode, size, 1);
if (CONSTANT_P (size)) if (CONSTANT_P (size))
anti_adjust_stack (plus_constant (size, extra)); anti_adjust_stack (plus_constant (size, extra));
else if (GET_CODE (size) == REG && extra == 0) else if (GET_CODE (size) == REG && extra == 0)
...@@ -2494,8 +2496,8 @@ expand_assignment (to, from, want_value, suggest_reg) ...@@ -2494,8 +2496,8 @@ expand_assignment (to, from, want_value, suggest_reg)
if (GET_CODE (to_rtx) != MEM) if (GET_CODE (to_rtx) != MEM)
abort (); abort ();
to_rtx = change_address (to_rtx, VOIDmode, to_rtx = change_address (to_rtx, VOIDmode,
gen_rtx (PLUS, Pmode, XEXP (to_rtx, 0), gen_rtx (PLUS, ptr_mode, XEXP (to_rtx, 0),
force_reg (Pmode, offset_rtx))); force_reg (ptr_mode, offset_rtx)));
/* If we have a variable offset, the known alignment /* If we have a variable offset, the known alignment
is only that of the innermost structure containing the field. is only that of the innermost structure containing the field.
(Actually, we could sometimes do better by using the (Actually, we could sometimes do better by using the
...@@ -2867,24 +2869,25 @@ store_expr (exp, target, want_value) ...@@ -2867,24 +2869,25 @@ store_expr (exp, target, want_value)
emit_block_move (target, temp, copy_size_rtx, emit_block_move (target, temp, copy_size_rtx,
TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT); TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
/* Figure out how much is left in TARGET /* Figure out how much is left in TARGET that we have to clear.
that we have to clear. */ Do all calculations in ptr_mode. */
addr = XEXP (target, 0);
addr = convert_modes (ptr_mode, Pmode, addr, 1);
if (GET_CODE (copy_size_rtx) == CONST_INT) if (GET_CODE (copy_size_rtx) == CONST_INT)
{ {
addr = plus_constant (XEXP (target, 0), addr = plus_constant (addr, TREE_STRING_LENGTH (exp));
TREE_STRING_LENGTH (exp));
size = plus_constant (size, - TREE_STRING_LENGTH (exp)); size = plus_constant (size, - TREE_STRING_LENGTH (exp));
} }
else else
{ {
enum machine_mode size_mode = Pmode; addr = force_reg (ptr_mode, addr);
addr = expand_binop (ptr_mode, add_optab, addr,
addr = force_reg (Pmode, XEXP (target, 0));
addr = expand_binop (size_mode, add_optab, addr,
copy_size_rtx, NULL_RTX, 0, copy_size_rtx, NULL_RTX, 0,
OPTAB_LIB_WIDEN); OPTAB_LIB_WIDEN);
size = expand_binop (size_mode, sub_optab, size, size = expand_binop (ptr_mode, sub_optab, size,
copy_size_rtx, NULL_RTX, 0, copy_size_rtx, NULL_RTX, 0,
OPTAB_LIB_WIDEN); OPTAB_LIB_WIDEN);
...@@ -2898,10 +2901,10 @@ store_expr (exp, target, want_value) ...@@ -2898,10 +2901,10 @@ store_expr (exp, target, want_value)
{ {
#ifdef TARGET_MEM_FUNCTIONS #ifdef TARGET_MEM_FUNCTIONS
emit_library_call (memset_libfunc, 0, VOIDmode, 3, addr, emit_library_call (memset_libfunc, 0, VOIDmode, 3, addr,
Pmode, const0_rtx, Pmode, size, Pmode); Pmode, const0_rtx, Pmode, size, ptr_mode);
#else #else
emit_library_call (bzero_libfunc, 0, VOIDmode, 2, emit_library_call (bzero_libfunc, 0, VOIDmode, 2,
addr, Pmode, size, Pmode); addr, Pmode, size, ptr_mode);
#endif #endif
} }
...@@ -3038,8 +3041,8 @@ store_constructor (exp, target) ...@@ -3038,8 +3041,8 @@ store_constructor (exp, target)
to_rtx to_rtx
= change_address (to_rtx, VOIDmode, = change_address (to_rtx, VOIDmode,
gen_rtx (PLUS, Pmode, XEXP (to_rtx, 0), gen_rtx (PLUS, ptr_mode, XEXP (to_rtx, 0),
force_reg (Pmode, offset_rtx))); force_reg (ptr_mode, offset_rtx)));
} }
store_field (to_rtx, bitsize, bitpos, mode, TREE_VALUE (elt), store_field (to_rtx, bitsize, bitpos, mode, TREE_VALUE (elt),
...@@ -4509,9 +4512,7 @@ expand_expr (exp, target, tmode, modifier) ...@@ -4509,9 +4512,7 @@ expand_expr (exp, target, tmode, modifier)
code, suitable for indexing, may be generated. */ code, suitable for indexing, may be generated. */
if (TREE_CODE (exp1) == SAVE_EXPR if (TREE_CODE (exp1) == SAVE_EXPR
&& SAVE_EXPR_RTL (exp1) == 0 && SAVE_EXPR_RTL (exp1) == 0
&& TREE_CODE (exp2 = TREE_OPERAND (exp1, 0)) != ERROR_MARK && TYPE_MODE (TREE_TYPE (exp1)) == ptr_mode)
&& TYPE_MODE (TREE_TYPE (exp1)) == Pmode
&& TYPE_MODE (TREE_TYPE (exp2)) == Pmode)
{ {
temp = expand_expr (TREE_OPERAND (exp1, 0), NULL_RTX, temp = expand_expr (TREE_OPERAND (exp1, 0), NULL_RTX,
VOIDmode, EXPAND_SUM); VOIDmode, EXPAND_SUM);
...@@ -4754,8 +4755,8 @@ expand_expr (exp, target, tmode, modifier) ...@@ -4754,8 +4755,8 @@ expand_expr (exp, target, tmode, modifier)
if (GET_CODE (op0) != MEM) if (GET_CODE (op0) != MEM)
abort (); abort ();
op0 = change_address (op0, VOIDmode, op0 = change_address (op0, VOIDmode,
gen_rtx (PLUS, Pmode, XEXP (op0, 0), gen_rtx (PLUS, ptr_mode, XEXP (op0, 0),
force_reg (Pmode, offset_rtx))); force_reg (ptr_mode, offset_rtx)));
/* If we have a variable offset, the known alignment /* If we have a variable offset, the known alignment
is only that of the innermost structure containing the field. is only that of the innermost structure containing the field.
(Actually, we could sometimes do better by using the (Actually, we could sometimes do better by using the
...@@ -5125,7 +5126,7 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5125,7 +5126,7 @@ expand_expr (exp, target, tmode, modifier)
TREE_OPERAND (TREE_OPERAND (exp, 0), 0) = t; TREE_OPERAND (TREE_OPERAND (exp, 0), 0) = t;
} }
/* If the result is to be Pmode and we are adding an integer to /* If the result is to be ptr_mode and we are adding an integer to
something, we might be forming a constant. So try to use something, we might be forming a constant. So try to use
plus_constant. If it produces a sum and we can't accept it, plus_constant. If it produces a sum and we can't accept it,
use force_operand. This allows P = &ARR[const] to generate use force_operand. This allows P = &ARR[const] to generate
...@@ -5134,7 +5135,7 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5134,7 +5135,7 @@ expand_expr (exp, target, tmode, modifier)
If this is an EXPAND_SUM call, always return the sum. */ If this is an EXPAND_SUM call, always return the sum. */
if (modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER if (modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER
|| mode == Pmode) || mode == ptr_mode)
{ {
if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST
&& GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
...@@ -5176,7 +5177,7 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5176,7 +5177,7 @@ expand_expr (exp, target, tmode, modifier)
And force_operand won't know whether to sign-extend or And force_operand won't know whether to sign-extend or
zero-extend. */ zero-extend. */
if ((modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER) if ((modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
|| mode != Pmode) || mode != ptr_mode)
goto binop; goto binop;
preexpand_calls (exp); preexpand_calls (exp);
...@@ -5300,7 +5301,7 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5300,7 +5301,7 @@ expand_expr (exp, target, tmode, modifier)
/* Attempt to return something suitable for generating an /* Attempt to return something suitable for generating an
indexed address, for machines that support that. */ indexed address, for machines that support that. */
if (modifier == EXPAND_SUM && mode == Pmode if (modifier == EXPAND_SUM && mode == ptr_mode
&& TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST && TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
&& GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT) && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
{ {
...@@ -6259,7 +6260,16 @@ expand_expr (exp, target, tmode, modifier) ...@@ -6259,7 +6260,16 @@ expand_expr (exp, target, tmode, modifier)
abort (); abort ();
if (modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER) if (modifier == EXPAND_SUM || modifier == EXPAND_INITIALIZER)
return XEXP (op0, 0); {
temp = XEXP (op0, 0);
#ifdef POINTERS_EXTEND_UNSIGNED
if (GET_MODE (temp) == Pmode && GET_MODE (temp) != mode
&& mode == ptr_mode)
temp = convert_modes (ptr_mode, Pmode, temp,
POINTERS_EXTEND_UNSIGNED);
#endif
return temp;
}
op0 = force_operand (XEXP (op0, 0), target); op0 = force_operand (XEXP (op0, 0), target);
} }
...@@ -6275,6 +6285,12 @@ expand_expr (exp, target, tmode, modifier) ...@@ -6275,6 +6285,12 @@ expand_expr (exp, target, tmode, modifier)
if (temp != 0) if (temp != 0)
update_temp_slot_address (temp, op0); update_temp_slot_address (temp, op0);
#ifdef POINTERS_EXTEND_UNSIGNED
if (GET_MODE (op0) == Pmode && GET_MODE (op0) != mode
&& mode == ptr_mode)
op0 = convert_modes (ptr_mode, Pmode, op0, POINTERS_EXTEND_UNSIGNED);
#endif
return op0; return op0;
case ENTRY_VALUE_EXPR: case ENTRY_VALUE_EXPR:
...@@ -7642,7 +7658,7 @@ expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -7642,7 +7658,7 @@ expand_builtin (exp, target, subtarget, mode, ignore)
result = gen_reg_rtx (insn_mode); result = gen_reg_rtx (insn_mode);
src_rtx = memory_address (BLKmode, src_rtx = memory_address (BLKmode,
expand_expr (src, NULL_RTX, Pmode, expand_expr (src, NULL_RTX, ptr_mode,
EXPAND_NORMAL)); EXPAND_NORMAL));
if (! (*insn_operand_predicate[(int)icode][1]) (src_rtx, Pmode)) if (! (*insn_operand_predicate[(int)icode][1]) (src_rtx, Pmode))
src_rtx = copy_to_mode_reg (Pmode, src_rtx); src_rtx = copy_to_mode_reg (Pmode, src_rtx);
...@@ -7726,14 +7742,14 @@ expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -7726,14 +7742,14 @@ expand_builtin (exp, target, subtarget, mode, ignore)
break; break;
} }
dest_rtx = expand_expr (dest, NULL_RTX, Pmode, EXPAND_NORMAL); dest_rtx = expand_expr (dest, NULL_RTX, ptr_mode, EXPAND_SUM);
dest_mem = gen_rtx (MEM, BLKmode, dest_mem = gen_rtx (MEM, BLKmode,
memory_address (BLKmode, dest_rtx)); memory_address (BLKmode, dest_rtx));
src_mem = gen_rtx (MEM, BLKmode, src_mem = gen_rtx (MEM, BLKmode,
memory_address (BLKmode, memory_address (BLKmode,
expand_expr (src, NULL_RTX, expand_expr (src, NULL_RTX,
Pmode, ptr_mode,
EXPAND_NORMAL))); EXPAND_SUM)));
/* Copy word part most expediently. */ /* Copy word part most expediently. */
emit_block_move (dest_mem, src_mem, emit_block_move (dest_mem, src_mem,
...@@ -7844,10 +7860,12 @@ expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -7844,10 +7860,12 @@ expand_builtin (exp, target, subtarget, mode, ignore)
emit_insn (gen_cmpstrsi (result, emit_insn (gen_cmpstrsi (result,
gen_rtx (MEM, BLKmode, gen_rtx (MEM, BLKmode,
expand_expr (arg1, NULL_RTX, Pmode, expand_expr (arg1, NULL_RTX,
ptr_mode,
EXPAND_NORMAL)), EXPAND_NORMAL)),
gen_rtx (MEM, BLKmode, gen_rtx (MEM, BLKmode,
expand_expr (arg2, NULL_RTX, Pmode, expand_expr (arg2, NULL_RTX,
ptr_mode,
EXPAND_NORMAL)), EXPAND_NORMAL)),
expand_expr (len, NULL_RTX, VOIDmode, 0), expand_expr (len, NULL_RTX, VOIDmode, 0),
GEN_INT (MIN (arg1_align, arg2_align)))); GEN_INT (MIN (arg1_align, arg2_align))));
......
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