aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2002-03-10 15:51:08 -0800
committerRichard Henderson <rth@gcc.gnu.org>2002-03-10 15:51:08 -0800
commit561c9153eb5c0824bc318f06dbdd4563d064e235 (patch)
tree5d4ad533c793ccb5a768c8588e16d5a647fe93e5
parenta10e3b428cf30d7a67e7f9d8872878dbbed0fbfa (diff)
downloadgcc-561c9153eb5c0824bc318f06dbdd4563d064e235.zip
gcc-561c9153eb5c0824bc318f06dbdd4563d064e235.tar.gz
gcc-561c9153eb5c0824bc318f06dbdd4563d064e235.tar.bz2
reload.c (copy_replacements_1): New.
* reload.c (copy_replacements_1): New. (copy_replacements): Use it to recurse through the rtx. From-SVN: r50552
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/reload.c86
2 files changed, 59 insertions, 32 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 378d3cc..fb929572 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
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
unsigned HOST_WIDE_INT.
diff --git a/gcc/reload.c b/gcc/reload.c
index 0e08aba..271ad65 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -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,
enum machine_mode, int,
enum reload_type, int));
-static rtx find_reloads_subreg_address PARAMS ((rtx, int, int, enum reload_type,
- int, rtx));
+static rtx find_reloads_subreg_address PARAMS ((rtx, int, int,
+ enum reload_type, int, rtx));
+static void copy_replacements_1 PARAMS ((rtx *, rtx *, int));
static int find_inc_amount PARAMS ((rtx, rtx));
#ifdef HAVE_SECONDARY_RELOADS
@@ -5888,46 +5889,67 @@ subst_reloads (insn)
}
}
-/* Make a copy of any replacements being done into X and move those copies
- to locations in Y, a copy of X. We only look at the highest level of
- the RTL. */
+/* Make a copy of any replacements being done into X and move those
+ copies to locations in Y, a copy of X. */
void
copy_replacements (x, y)
- rtx x;
- rtx y;
+ rtx x, 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
location if something inside it was replaced. */
- if (code == SUBREG)
+ if (GET_CODE (x) == SUBREG)
abort ();
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- if (fmt[i] == 'e')
- for (j = 0; j < n_replacements; j++)
+ copy_replacements_1 (&x, &y, n_replacements);
+}
+
+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->subreg_loc = &XEXP (y, i);
- 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;
- }
+ r = &replacements[n_replacements++];
+ r->where = replacements[j].where;
+ r->subreg_loc = py;
+ 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 */