OSDN Git Service

* cse.c (validate_canon_reg): New function, split out from...
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Jul 2004 19:33:10 +0000 (19:33 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Jul 2004 19:33:10 +0000 (19:33 +0000)
(canon_reg): ...here.  Use validate_canon_reg for both 'e' and 'E'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85270 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cse.c

index 7341996..9e3f1b8 100644 (file)
@@ -1,3 +1,8 @@
+2004-07-28  Richard Sandiford  <rsandifo@redhat.com>
+
+       * cse.c (validate_canon_reg): New function, split out from...
+       (canon_reg): ...here.  Use validate_canon_reg for both 'e' and 'E'.
+
 2004-07-28  Diego Novillo  <dnovillo@redhat.com>
 
        * tree-ssa-alias.c (maybe_create_global_var): Don't just
index 3d08ff0..6880787 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -2626,6 +2626,29 @@ cse_rtx_varies_p (rtx x, int from_alias)
   return rtx_varies_p (x, from_alias);
 }
 \f
+/* Subroutine of canon_reg.  Pass *XLOC through canon_reg, and validate
+   the result if necessary.  INSN is as for canon_reg.  */
+
+static void
+validate_canon_reg (rtx *xloc, rtx insn)
+{
+  rtx new = canon_reg (*xloc, insn);
+  int insn_code;
+
+  /* If replacing pseudo with hard reg or vice versa, ensure the
+     insn remains valid.  Likewise if the insn has MATCH_DUPs.  */
+  if (insn != 0 && new != 0
+      && REG_P (new) && REG_P (*xloc)
+      && (((REGNO (new) < FIRST_PSEUDO_REGISTER)
+          != (REGNO (*xloc) < FIRST_PSEUDO_REGISTER))
+         || GET_MODE (new) != GET_MODE (*xloc)
+         || (insn_code = recog_memoized (insn)) < 0
+         || insn_data[insn_code].n_dups > 0))
+    validate_change (insn, xloc, new, 1);
+  else
+    *xloc = new;
+}
+
 /* Canonicalize an expression:
    replace each register reference inside it
    with the "oldest" equivalent register.
@@ -2695,25 +2718,10 @@ canon_reg (rtx x, rtx insn)
       int j;
 
       if (fmt[i] == 'e')
-       {
-         rtx new = canon_reg (XEXP (x, i), insn);
-         int insn_code;
-
-         /* If replacing pseudo with hard reg or vice versa, ensure the
-            insn remains valid.  Likewise if the insn has MATCH_DUPs.  */
-         if (insn != 0 && new != 0
-             && REG_P (new) && REG_P (XEXP (x, i))
-             && (((REGNO (new) < FIRST_PSEUDO_REGISTER)
-                  != (REGNO (XEXP (x, i)) < FIRST_PSEUDO_REGISTER))
-                 || (insn_code = recog_memoized (insn)) < 0
-                 || insn_data[insn_code].n_dups > 0))
-           validate_change (insn, &XEXP (x, i), new, 1);
-         else
-           XEXP (x, i) = new;
-       }
+       validate_canon_reg (&XEXP (x, i), insn);
       else if (fmt[i] == 'E')
        for (j = 0; j < XVECLEN (x, i); j++)
-         XVECEXP (x, i, j) = canon_reg (XVECEXP (x, i, j), insn);
+         validate_canon_reg (&XVECEXP (x, i, j), insn);
     }
 
   return x;