Commit 858c3c8c by Ian Lance Taylor

Add support for REG[NO]_MODE_OK_FOR_BASE_P

From-SVN: r13492
parent 8026ebba
...@@ -103,6 +103,14 @@ a register with any other reload. */ ...@@ -103,6 +103,14 @@ a register with any other reload. */
#ifndef REGISTER_MOVE_COST #ifndef REGISTER_MOVE_COST
#define REGISTER_MOVE_COST(x, y) 2 #define REGISTER_MOVE_COST(x, y) 2
#endif #endif
#ifndef REGNO_MODE_OK_FOR_BASE_P
#define REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) REGNO_OK_FOR_BASE_P (REGNO)
#endif
#ifndef REG_MODE_OK_FOR_BASE_P
#define REG_MODE_OK_FOR_BASE_P(REGNO, MODE) REG_OK_FOR_BASE_P (REGNO)
#endif
/* The variables set up by `find_reloads' are: /* The variables set up by `find_reloads' are:
...@@ -311,8 +319,8 @@ static int find_reloads_address PROTO((enum machine_mode, rtx *, rtx, rtx *, ...@@ -311,8 +319,8 @@ static int find_reloads_address PROTO((enum machine_mode, rtx *, rtx, rtx *,
int, enum reload_type, int)); int, enum reload_type, int));
static rtx subst_reg_equivs PROTO((rtx)); static rtx subst_reg_equivs PROTO((rtx));
static rtx subst_indexed_address PROTO((rtx)); static rtx subst_indexed_address PROTO((rtx));
static int find_reloads_address_1 PROTO((rtx, int, rtx *, int, static int find_reloads_address_1 PROTO((enum machine_mode, rtx, int, rtx *,
enum reload_type,int)); int, enum reload_type,int));
static void find_reloads_address_part PROTO((rtx, rtx *, enum reg_class, static void find_reloads_address_part PROTO((rtx, rtx *, enum reg_class,
enum machine_mode, int, enum machine_mode, int,
enum reload_type, int)); enum reload_type, int));
...@@ -4233,7 +4241,8 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels) ...@@ -4233,7 +4241,8 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels)
hard register that is valid as a base register and which is not the hard register that is valid as a base register and which is not the
subject of a CLOBBER in this insn. */ subject of a CLOBBER in this insn. */
else if (regno < FIRST_PSEUDO_REGISTER && REGNO_OK_FOR_BASE_P (regno) else if (regno < FIRST_PSEUDO_REGISTER
&& REGNO_MODE_OK_FOR_BASE_P (regno, mode)
&& ! regno_clobbered_p (regno, this_insn)) && ! regno_clobbered_p (regno, this_insn))
return 0; return 0;
...@@ -4324,7 +4333,7 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels) ...@@ -4324,7 +4333,7 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels)
else if (GET_CODE (ad) == PLUS else if (GET_CODE (ad) == PLUS
&& GET_CODE (XEXP (ad, 0)) == REG && GET_CODE (XEXP (ad, 0)) == REG
&& REGNO (XEXP (ad, 0)) < FIRST_PSEUDO_REGISTER && REGNO (XEXP (ad, 0)) < FIRST_PSEUDO_REGISTER
&& REG_OK_FOR_BASE_P (XEXP (ad, 0)) && REG_MODE_OK_FOR_BASE_P (XEXP (ad, 0), mode)
&& GET_CODE (XEXP (ad, 1)) == CONST_INT) && GET_CODE (XEXP (ad, 1)) == CONST_INT)
{ {
/* Unshare the MEM rtx so we can safely alter it. */ /* Unshare the MEM rtx so we can safely alter it. */
...@@ -4401,7 +4410,8 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels) ...@@ -4401,7 +4410,8 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels)
XEXP (XEXP (ad, 0), 1)); XEXP (XEXP (ad, 0), 1));
find_reloads_address_part (XEXP (ad, 0), &XEXP (ad, 0), BASE_REG_CLASS, find_reloads_address_part (XEXP (ad, 0), &XEXP (ad, 0), BASE_REG_CLASS,
GET_MODE (ad), opnum, type, ind_levels); GET_MODE (ad), opnum, type, ind_levels);
find_reloads_address_1 (XEXP (ad, 1), 1, &XEXP (ad, 1), opnum, type, 0); find_reloads_address_1 (mode, XEXP (ad, 1), 1, &XEXP (ad, 1), opnum,
type, 0);
return 1; return 1;
} }
...@@ -4424,7 +4434,8 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels) ...@@ -4424,7 +4434,8 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels)
INTVAL (XEXP (ad, 1)))); INTVAL (XEXP (ad, 1))));
find_reloads_address_part (XEXP (ad, 1), &XEXP (ad, 1), BASE_REG_CLASS, find_reloads_address_part (XEXP (ad, 1), &XEXP (ad, 1), BASE_REG_CLASS,
GET_MODE (ad), opnum, type, ind_levels); GET_MODE (ad), opnum, type, ind_levels);
find_reloads_address_1 (XEXP (ad, 0), 1, &XEXP (ad, 0), opnum, type, 0); find_reloads_address_1 (mode, XEXP (ad, 0), 1, &XEXP (ad, 0), opnum,
type, 0);
return 1; return 1;
} }
...@@ -4470,7 +4481,7 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels) ...@@ -4470,7 +4481,7 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels)
return 1; return 1;
} }
return find_reloads_address_1 (ad, 0, loc, opnum, type, ind_levels); return find_reloads_address_1 (mode, ad, 0, loc, opnum, type, ind_levels);
} }
/* Find all pseudo regs appearing in AD /* Find all pseudo regs appearing in AD
...@@ -4633,9 +4644,11 @@ subst_indexed_address (addr) ...@@ -4633,9 +4644,11 @@ subst_indexed_address (addr)
return addr; return addr;
} }
/* Record the pseudo registers we must reload into hard registers /* Record the pseudo registers we must reload into hard registers in a
in a subexpression of a would-be memory address, X. subexpression of a would-be memory address, X referring to a value
(This function is not called if the address we find is strictly valid.) in mode MODE. (This function is not called if the address we find
is strictly valid.)
CONTEXT = 1 means we are considering regs as index regs, CONTEXT = 1 means we are considering regs as index regs,
= 0 means we are considering them as base regs. = 0 means we are considering them as base regs.
...@@ -4653,7 +4666,8 @@ subst_indexed_address (addr) ...@@ -4653,7 +4666,8 @@ subst_indexed_address (addr)
could have addressing modes that this does not handle right. */ could have addressing modes that this does not handle right. */
static int static int
find_reloads_address_1 (x, context, loc, opnum, type, ind_levels) find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels)
enum machine_mode mode;
rtx x; rtx x;
int context; int context;
rtx *loc; rtx *loc;
...@@ -4695,74 +4709,74 @@ find_reloads_address_1 (x, context, loc, opnum, type, ind_levels) ...@@ -4695,74 +4709,74 @@ find_reloads_address_1 (x, context, loc, opnum, type, ind_levels)
if (code0 == MULT || code0 == SIGN_EXTEND || code0 == TRUNCATE if (code0 == MULT || code0 == SIGN_EXTEND || code0 == TRUNCATE
|| code0 == ZERO_EXTEND || code1 == MEM) || code0 == ZERO_EXTEND || code1 == MEM)
{ {
find_reloads_address_1 (orig_op0, 1, &XEXP (x, 0), opnum, type, find_reloads_address_1 (mode, orig_op0, 1, &XEXP (x, 0), opnum,
ind_levels); type, ind_levels);
find_reloads_address_1 (orig_op1, 0, &XEXP (x, 1), opnum, type, find_reloads_address_1 (mode, orig_op1, 0, &XEXP (x, 1), opnum,
ind_levels); type, ind_levels);
} }
else if (code1 == MULT || code1 == SIGN_EXTEND || code1 == TRUNCATE else if (code1 == MULT || code1 == SIGN_EXTEND || code1 == TRUNCATE
|| code1 == ZERO_EXTEND || code0 == MEM) || code1 == ZERO_EXTEND || code0 == MEM)
{ {
find_reloads_address_1 (orig_op0, 0, &XEXP (x, 0), opnum, type, find_reloads_address_1 (mode, orig_op0, 0, &XEXP (x, 0), opnum,
ind_levels); type, ind_levels);
find_reloads_address_1 (orig_op1, 1, &XEXP (x, 1), opnum, type, find_reloads_address_1 (mode, orig_op1, 1, &XEXP (x, 1), opnum,
ind_levels); type, ind_levels);
} }
else if (code0 == CONST_INT || code0 == CONST else if (code0 == CONST_INT || code0 == CONST
|| code0 == SYMBOL_REF || code0 == LABEL_REF) || code0 == SYMBOL_REF || code0 == LABEL_REF)
find_reloads_address_1 (orig_op1, 0, &XEXP (x, 1), opnum, type, find_reloads_address_1 (mode, orig_op1, 0, &XEXP (x, 1), opnum,
ind_levels); type, ind_levels);
else if (code1 == CONST_INT || code1 == CONST else if (code1 == CONST_INT || code1 == CONST
|| code1 == SYMBOL_REF || code1 == LABEL_REF) || code1 == SYMBOL_REF || code1 == LABEL_REF)
find_reloads_address_1 (orig_op0, 0, &XEXP (x, 0), opnum, type, find_reloads_address_1 (mode, orig_op0, 0, &XEXP (x, 0), opnum,
ind_levels); type, ind_levels);
else if (code0 == REG && code1 == REG) else if (code0 == REG && code1 == REG)
{ {
if (REG_OK_FOR_INDEX_P (op0) if (REG_OK_FOR_INDEX_P (op0)
&& REG_OK_FOR_BASE_P (op1)) && REG_MODE_OK_FOR_BASE_P (op1, mode))
return 0; return 0;
else if (REG_OK_FOR_INDEX_P (op1) else if (REG_OK_FOR_INDEX_P (op1)
&& REG_OK_FOR_BASE_P (op0)) && REG_MODE_OK_FOR_BASE_P (op0, mode))
return 0; return 0;
else if (REG_OK_FOR_BASE_P (op1)) else if (REG_MODE_OK_FOR_BASE_P (op1, mode))
find_reloads_address_1 (orig_op0, 1, &XEXP (x, 0), opnum, type, find_reloads_address_1 (mode, orig_op0, 1, &XEXP (x, 0), opnum,
ind_levels); type, ind_levels);
else if (REG_OK_FOR_BASE_P (op0)) else if (REG_MODE_OK_FOR_BASE_P (op0, mode))
find_reloads_address_1 (orig_op1, 1, &XEXP (x, 1), opnum, type, find_reloads_address_1 (mode, orig_op1, 1, &XEXP (x, 1), opnum,
ind_levels); type, ind_levels);
else if (REG_OK_FOR_INDEX_P (op1)) else if (REG_OK_FOR_INDEX_P (op1))
find_reloads_address_1 (orig_op0, 0, &XEXP (x, 0), opnum, type, find_reloads_address_1 (mode, orig_op0, 0, &XEXP (x, 0), opnum,
ind_levels); type, ind_levels);
else if (REG_OK_FOR_INDEX_P (op0)) else if (REG_OK_FOR_INDEX_P (op0))
find_reloads_address_1 (orig_op1, 0, &XEXP (x, 1), opnum, type, find_reloads_address_1 (mode, orig_op1, 0, &XEXP (x, 1), opnum,
ind_levels); type, ind_levels);
else else
{ {
find_reloads_address_1 (orig_op0, 1, &XEXP (x, 0), opnum, type, find_reloads_address_1 (mode, orig_op0, 1, &XEXP (x, 0), opnum,
ind_levels); type, ind_levels);
find_reloads_address_1 (orig_op1, 0, &XEXP (x, 1), opnum, type, find_reloads_address_1 (mode, orig_op1, 0, &XEXP (x, 1), opnum,
ind_levels); type, ind_levels);
} }
} }
else if (code0 == REG) else if (code0 == REG)
{ {
find_reloads_address_1 (orig_op0, 1, &XEXP (x, 0), opnum, type, find_reloads_address_1 (mode, orig_op0, 1, &XEXP (x, 0), opnum,
ind_levels); type, ind_levels);
find_reloads_address_1 (orig_op1, 0, &XEXP (x, 1), opnum, type, find_reloads_address_1 (mode, orig_op1, 0, &XEXP (x, 1), opnum,
ind_levels); type, ind_levels);
} }
else if (code1 == REG) else if (code1 == REG)
{ {
find_reloads_address_1 (orig_op1, 1, &XEXP (x, 1), opnum, type, find_reloads_address_1 (mode, orig_op1, 1, &XEXP (x, 1), opnum,
ind_levels); type, ind_levels);
find_reloads_address_1 (orig_op0, 0, &XEXP (x, 0), opnum, type, find_reloads_address_1 (mode, orig_op0, 0, &XEXP (x, 0), opnum,
ind_levels); type, ind_levels);
} }
} }
...@@ -4811,7 +4825,7 @@ find_reloads_address_1 (x, context, loc, opnum, type, ind_levels) ...@@ -4811,7 +4825,7 @@ find_reloads_address_1 (x, context, loc, opnum, type, ind_levels)
regno = reg_renumber[regno]; regno = reg_renumber[regno];
if ((regno >= FIRST_PSEUDO_REGISTER if ((regno >= FIRST_PSEUDO_REGISTER
|| !(context ? REGNO_OK_FOR_INDEX_P (regno) || !(context ? REGNO_OK_FOR_INDEX_P (regno)
: REGNO_OK_FOR_BASE_P (regno)))) : REGNO_MODE_OK_FOR_BASE_P (regno, mode))))
{ {
register rtx link; register rtx link;
...@@ -4928,7 +4942,7 @@ find_reloads_address_1 (x, context, loc, opnum, type, ind_levels) ...@@ -4928,7 +4942,7 @@ find_reloads_address_1 (x, context, loc, opnum, type, ind_levels)
if ((regno >= FIRST_PSEUDO_REGISTER if ((regno >= FIRST_PSEUDO_REGISTER
|| !(context ? REGNO_OK_FOR_INDEX_P (regno) || !(context ? REGNO_OK_FOR_INDEX_P (regno)
: REGNO_OK_FOR_BASE_P (regno)))) : REGNO_MODE_OK_FOR_BASE_P (regno, mode))))
{ {
push_reload (x, NULL_RTX, loc, NULL_PTR, push_reload (x, NULL_RTX, loc, NULL_PTR,
context ? INDEX_REG_CLASS : BASE_REG_CLASS, context ? INDEX_REG_CLASS : BASE_REG_CLASS,
...@@ -4961,7 +4975,7 @@ find_reloads_address_1 (x, context, loc, opnum, type, ind_levels) ...@@ -4961,7 +4975,7 @@ find_reloads_address_1 (x, context, loc, opnum, type, ind_levels)
int regno = REGNO (SUBREG_REG (x)) + SUBREG_WORD (x); int regno = REGNO (SUBREG_REG (x)) + SUBREG_WORD (x);
if (! (context ? REGNO_OK_FOR_INDEX_P (regno) if (! (context ? REGNO_OK_FOR_INDEX_P (regno)
: REGNO_OK_FOR_BASE_P (regno))) : REGNO_MODE_OK_FOR_BASE_P (regno, mode)))
{ {
push_reload (x, NULL_RTX, loc, NULL_PTR, push_reload (x, NULL_RTX, loc, NULL_PTR,
context ? INDEX_REG_CLASS : BASE_REG_CLASS, context ? INDEX_REG_CLASS : BASE_REG_CLASS,
...@@ -4994,7 +5008,7 @@ find_reloads_address_1 (x, context, loc, opnum, type, ind_levels) ...@@ -4994,7 +5008,7 @@ find_reloads_address_1 (x, context, loc, opnum, type, ind_levels)
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{ {
if (fmt[i] == 'e') if (fmt[i] == 'e')
find_reloads_address_1 (XEXP (x, i), context, &XEXP (x, i), find_reloads_address_1 (mode, XEXP (x, i), context, &XEXP (x, i),
opnum, type, ind_levels); opnum, type, ind_levels);
} }
} }
......
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