(convert_memory_address): No longer static.
New arg, TO_MODE. Do something special for SYMBOL_REF, LABEL_REF, and CONST. (memory_address): Add extra arg to call to convert_memory_address. From-SVN: r9328
This commit is contained in:
parent
0aac88f627
commit
498b529f11
42
gcc/explow.c
42
gcc/explow.c
|
@ -30,7 +30,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "insn-codes.h"
|
#include "insn-codes.h"
|
||||||
|
|
||||||
static rtx break_out_memory_refs PROTO((rtx));
|
static rtx break_out_memory_refs PROTO((rtx));
|
||||||
static rtx convert_memory_address PROTO((rtx));
|
|
||||||
|
|
||||||
/* Return an rtx for the sum of X and the integer C.
|
/* Return an rtx for the sum of X and the integer C.
|
||||||
|
|
||||||
|
@ -294,31 +293,46 @@ break_out_memory_refs (x)
|
||||||
#ifdef POINTERS_EXTEND_UNSIGNED
|
#ifdef POINTERS_EXTEND_UNSIGNED
|
||||||
|
|
||||||
/* Given X, a memory address in ptr_mode, convert it to an address
|
/* Given X, a memory address in ptr_mode, convert it to an address
|
||||||
in Pmode. We take advantage of the fact that pointers are not
|
in Pmode, or vice versa (TO_MODE says which way). We take advantage of
|
||||||
allowed to overflow by commuting arithmetic operations over
|
the fact that pointers are not allowed to overflow by commuting arithmetic
|
||||||
conversions so that address arithmetic insns can be used. */
|
operations over conversions so that address arithmetic insns can be
|
||||||
|
used. */
|
||||||
|
|
||||||
static rtx
|
rtx
|
||||||
convert_memory_address (x)
|
convert_memory_address (to_mode, x)
|
||||||
|
enum machine_mode to_mode;
|
||||||
rtx x;
|
rtx x;
|
||||||
{
|
{
|
||||||
|
rtx temp;
|
||||||
|
|
||||||
switch (GET_CODE (x))
|
switch (GET_CODE (x))
|
||||||
{
|
{
|
||||||
case CONST_INT:
|
case CONST_INT:
|
||||||
case CONST_DOUBLE:
|
case CONST_DOUBLE:
|
||||||
case LABEL_REF:
|
|
||||||
case SYMBOL_REF:
|
|
||||||
case CONST:
|
|
||||||
return x;
|
return x;
|
||||||
|
|
||||||
|
case LABEL_REF:
|
||||||
|
return gen_rtx (LABEL_REF, to_mode, XEXP (x, 0));
|
||||||
|
|
||||||
|
case SYMBOL_REF:
|
||||||
|
temp = gen_rtx (SYMBOL_REF, to_mode, XSTR (x, 0));
|
||||||
|
SYMBOL_REF_FLAG (temp) = SYMBOL_REF_FLAG (x);
|
||||||
|
return temp;
|
||||||
|
|
||||||
case PLUS:
|
case PLUS:
|
||||||
case MULT:
|
case MULT:
|
||||||
return gen_rtx (GET_CODE (x), Pmode,
|
return gen_rtx (GET_CODE (x), to_mode,
|
||||||
convert_memory_address (XEXP (x, 0)),
|
convert_memory_address (to_mode, XEXP (x, 0)),
|
||||||
convert_memory_address (XEXP (x, 1)));
|
convert_memory_address (to_mode, XEXP (x, 1)));
|
||||||
|
|
||||||
|
case CONST:
|
||||||
|
return gen_rtx (CONST, to_mode,
|
||||||
|
convert_memory_address (to_mode, XEXP (x, 0)));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return convert_modes (Pmode, ptr_mode, x, POINTERS_EXTEND_UNSIGNED);
|
return convert_modes (to_mode,
|
||||||
|
to_mode == ptr_mode ? Pmode : ptr_mode,
|
||||||
|
x, POINTERS_EXTEND_UNSIGNED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -375,7 +389,7 @@ memory_address (mode, x)
|
||||||
|
|
||||||
#ifdef POINTERS_EXTEND_UNSIGNED
|
#ifdef POINTERS_EXTEND_UNSIGNED
|
||||||
if (GET_MODE (x) == ptr_mode)
|
if (GET_MODE (x) == ptr_mode)
|
||||||
x = convert_memory_address (x);
|
x = convert_memory_address (Pmode, x);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* By passing constant addresses thru registers
|
/* By passing constant addresses thru registers
|
||||||
|
|
Loading…
Reference in New Issue