Commit 561c9153 by Richard Henderson Committed by Richard Henderson

reload.c (copy_replacements_1): New.

        * reload.c (copy_replacements_1): New.
        (copy_replacements): Use it to recurse through the rtx.

From-SVN: r50552
parent a10e3b42
2002-03-10 Richard Henderson <rth@redhat.com> 2002-03-10 Richard Henderson <rth@redhat.com>
* reload.c (copy_replacements_1): New.
(copy_replacements): Use it to recurse through the rtx.
2002-03-10 Richard Henderson <rth@redhat.com>
* loop.c (strength_reduce): Compute number of iterations as * loop.c (strength_reduce): Compute number of iterations as
unsigned HOST_WIDE_INT. unsigned HOST_WIDE_INT.
......
...@@ -266,8 +266,9 @@ static int find_reloads_address_1 PARAMS ((enum machine_mode, rtx, int, rtx *, ...@@ -266,8 +266,9 @@ static int find_reloads_address_1 PARAMS ((enum machine_mode, rtx, int, rtx *,
static void find_reloads_address_part PARAMS ((rtx, rtx *, enum reg_class, static void find_reloads_address_part PARAMS ((rtx, rtx *, enum reg_class,
enum machine_mode, int, enum machine_mode, int,
enum reload_type, int)); enum reload_type, int));
static rtx find_reloads_subreg_address PARAMS ((rtx, int, int, enum reload_type, static rtx find_reloads_subreg_address PARAMS ((rtx, int, int,
int, rtx)); enum reload_type, int, rtx));
static void copy_replacements_1 PARAMS ((rtx *, rtx *, int));
static int find_inc_amount PARAMS ((rtx, rtx)); static int find_inc_amount PARAMS ((rtx, rtx));
#ifdef HAVE_SECONDARY_RELOADS #ifdef HAVE_SECONDARY_RELOADS
...@@ -5888,46 +5889,67 @@ subst_reloads (insn) ...@@ -5888,46 +5889,67 @@ subst_reloads (insn)
} }
} }
/* Make a copy of any replacements being done into X and move those copies /* Make a copy of any replacements being done into X and move those
to locations in Y, a copy of X. We only look at the highest level of copies to locations in Y, a copy of X. */
the RTL. */
void void
copy_replacements (x, y) copy_replacements (x, y)
rtx x; rtx x, y;
rtx y;
{ {
int i, j;
enum rtx_code code = GET_CODE (x);
const char *fmt = GET_RTX_FORMAT (code);
struct replacement *r;
/* We can't support X being a SUBREG because we might then need to know its /* We can't support X being a SUBREG because we might then need to know its
location if something inside it was replaced. */ location if something inside it was replaced. */
if (code == SUBREG) if (GET_CODE (x) == SUBREG)
abort (); abort ();
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) copy_replacements_1 (&x, &y, n_replacements);
if (fmt[i] == 'e') }
for (j = 0; j < n_replacements; j++)
static void
copy_replacements_1 (px, py, orig_replacements)
rtx *px;
rtx *py;
int orig_replacements;
{
int i, j;
rtx x, y;
struct replacement *r;
enum rtx_code code;
const char *fmt;
for (j = 0; j < orig_replacements; j++)
{
if (replacements[j].subreg_loc == px)
{ {
if (replacements[j].subreg_loc == &XEXP (x, i)) r = &replacements[n_replacements++];
{ r->where = replacements[j].where;
r = &replacements[n_replacements++]; r->subreg_loc = py;
r->where = replacements[j].where; r->what = replacements[j].what;
r->subreg_loc = &XEXP (y, i); r->mode = replacements[j].mode;
r->what = replacements[j].what;
r->mode = replacements[j].mode;
}
else if (replacements[j].where == &XEXP (x, i))
{
r = &replacements[n_replacements++];
r->where = &XEXP (y, i);
r->subreg_loc = 0;
r->what = replacements[j].what;
r->mode = replacements[j].mode;
}
} }
else if (replacements[j].where == px)
{
r = &replacements[n_replacements++];
r->where = py;
r->subreg_loc = 0;
r->what = replacements[j].what;
r->mode = replacements[j].mode;
}
}
x = *px;
y = *py;
code = GET_CODE (x);
fmt = GET_RTX_FORMAT (code);
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{
if (fmt[i] == 'e')
copy_replacements_1 (&XEXP (x, i), &XEXP (y, i), orig_replacements);
else if (fmt[i] == 'E')
for (j = XVECLEN (x, i); --j >= 0; )
copy_replacements_1 (&XVECEXP (x, i, j), &XVECEXP (y, i, j),
orig_replacements);
}
} }
/* Change any replacements being done to *X to be done to *Y */ /* Change any replacements being done to *X to be done to *Y */
......
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