aboutsummaryrefslogtreecommitdiff
path: root/gcc/explow.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-04-07 12:35:25 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-04-07 12:35:25 -0400
commit498b529f119b92d970cfa2ad781611338ee405c1 (patch)
tree2555f7631dc8f2c8423d9ea237481fdf1444f4d8 /gcc/explow.c
parent0aac88f627d0c52b0db0eed139fcffd940f73f90 (diff)
downloadgcc-498b529f119b92d970cfa2ad781611338ee405c1.zip
gcc-498b529f119b92d970cfa2ad781611338ee405c1.tar.gz
gcc-498b529f119b92d970cfa2ad781611338ee405c1.tar.bz2
(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
Diffstat (limited to 'gcc/explow.c')
-rw-r--r--gcc/explow.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/gcc/explow.c b/gcc/explow.c
index ac73f4b..52cb0e9 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -30,7 +30,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "insn-codes.h"
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.
@@ -294,31 +293,46 @@ break_out_memory_refs (x)
#ifdef POINTERS_EXTEND_UNSIGNED
/* 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
- allowed to overflow by commuting arithmetic operations over
- conversions so that address arithmetic insns can be used. */
+ in Pmode, or vice versa (TO_MODE says which way). We take advantage of
+ the fact that pointers are not allowed to overflow by commuting arithmetic
+ operations over conversions so that address arithmetic insns can be
+ used. */
-static rtx
-convert_memory_address (x)
+rtx
+convert_memory_address (to_mode, x)
+ enum machine_mode to_mode;
rtx x;
{
+ rtx temp;
+
switch (GET_CODE (x))
{
case CONST_INT:
case CONST_DOUBLE:
+ return x;
+
case LABEL_REF:
+ return gen_rtx (LABEL_REF, to_mode, XEXP (x, 0));
+
case SYMBOL_REF:
- case CONST:
- return x;
+ temp = gen_rtx (SYMBOL_REF, to_mode, XSTR (x, 0));
+ SYMBOL_REF_FLAG (temp) = SYMBOL_REF_FLAG (x);
+ return temp;
case PLUS:
case MULT:
- return gen_rtx (GET_CODE (x), Pmode,
- convert_memory_address (XEXP (x, 0)),
- convert_memory_address (XEXP (x, 1)));
+ return gen_rtx (GET_CODE (x), to_mode,
+ convert_memory_address (to_mode, XEXP (x, 0)),
+ 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:
- 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
@@ -375,7 +389,7 @@ memory_address (mode, x)
#ifdef POINTERS_EXTEND_UNSIGNED
if (GET_MODE (x) == ptr_mode)
- x = convert_memory_address (x);
+ x = convert_memory_address (Pmode, x);
#endif
/* By passing constant addresses thru registers