OSDN Git Service

PR target/12598
authorhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Oct 2003 14:07:57 +0000 (14:07 +0000)
committerhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Oct 2003 14:07:57 +0000 (14:07 +0000)
* config/cris/cris.md (define_split "*mov_sidesi_biap_mem"+1)
(define_splits "*mov_sidesi_mem"+1, "casesi"+9, +10, +11, +12):
Use cris_mem_op and replace_equiv_address, not gen_rtx_MEM.
("call", "call_value", define_split "*mov_sidesi_mem"+19, +20)
(define_split "*mov_sidesi_mem"+21, +22, +23, +24, +25, +26, +27)
(define_split "*mov_sidesi_mem"+28, +29, +30): Use
replace_equiv_address, not gen_rtx_MEM.
* config/cris/cris.c (cris_mem_op): New match_operator function.
* config/cris/cris.h (PREDICATE_CODES): Add cris_mem_op.

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

gcc/ChangeLog
gcc/config/cris/cris.c
gcc/config/cris/cris.h
gcc/config/cris/cris.md

index 55da6ee..376a23d 100644 (file)
@@ -1,3 +1,16 @@
+2003-10-15  Hans-Peter Nilsson  <hp@axis.com>
+
+       PR target/12598
+       * config/cris/cris.md (define_split "*mov_sidesi_biap_mem"+1)
+       (define_splits "*mov_sidesi_mem"+1, "casesi"+9, +10, +11, +12):
+       Use cris_mem_op and replace_equiv_address, not gen_rtx_MEM.
+       ("call", "call_value", define_split "*mov_sidesi_mem"+19, +20)
+       (define_split "*mov_sidesi_mem"+21, +22, +23, +24, +25, +26, +27)
+       (define_split "*mov_sidesi_mem"+28, +29, +30): Use
+       replace_equiv_address, not gen_rtx_MEM.
+       * config/cris/cris.c (cris_mem_op): New match_operator function.
+       * config/cris/cris.h (PREDICATE_CODES): Add cris_mem_op.
+
 2003-10-15  Bernardo Innocenti <bernie@develer.com>
 
        * config/m68k/m68k.h (MASK_SEP_DATA, TARGET_SEP_DATA,
index 2114f41..79b194b 100644 (file)
@@ -374,6 +374,19 @@ cris_plus_or_bound_operator (rtx x, enum machine_mode mode)
     (GET_MODE (x) == mode && (code == UMIN || code == PLUS));
 }
 
+/* Used as an operator to get a handle on a already-known-valid MEM rtx:es
+   (no need to validate the address), where some address expression parts
+   have their own match_operand.  */
+
+int
+cris_mem_op (rtx x, enum machine_mode mode)
+{
+  if (mode == VOIDmode)
+    mode = GET_MODE (x);
+
+  return GET_MODE (x) == mode && GET_CODE (x) == MEM;
+}
+
 /* Since with -fPIC, not all symbols are valid PIC symbols or indeed
    general_operands, we have to have a predicate that matches it for the
    "movsi" expander.  */
@@ -1962,8 +1975,8 @@ cris_notice_update_cc (rtx exp, rtx insn)
                     value1=rz and value2=[rx] */
                  cc_status.value1 = XEXP (XVECEXP (exp, 0, 0), 0);
                  cc_status.value2
-                   = gen_rtx_MEM (GET_MODE (XEXP (XVECEXP (exp, 0, 0), 0)),
-                                  XEXP (XVECEXP (exp, 0, 1), 0));
+                   = replace_equiv_address (XEXP (XVECEXP (exp, 0, 0), 1),
+                                            XEXP (XVECEXP (exp, 0, 1), 0));
                  cc_status.flags = 0;
 
                  /* Huh?  A side-effect cannot change the destination
index 0dc57f4..288be19 100644 (file)
@@ -1613,6 +1613,8 @@ call_ ## FUNC (void)                                              \
   {ZERO_EXTEND, SIGN_EXTEND}},                         \
  {"cris_plus_or_bound_operator",                       \
   {PLUS, UMIN}},                                       \
+ {"cris_mem_op",                                       \
+  {MEM}},                                              \
  {"cris_bdap_operand",                                 \
   {SUBREG, REG, LABEL_REF, SYMBOL_REF, MEM, CONST_INT, \
    CONST_DOUBLE, CONST, SIGN_EXTEND}},                 \
index 6be28ea..ea347fd 100644 (file)
 
 (define_split
   [(parallel
-    [(set (mem (plus:SI
-               (mult:SI (match_operand:SI 0 "register_operand" "")
-                        (match_operand:SI 1 "const_int_operand" ""))
-               (match_operand:SI 2 "register_operand" "")))
+    [(set (match_operator
+          6 "cris_mem_op"
+          [(plus:SI
+            (mult:SI (match_operand:SI 0 "register_operand" "")
+                     (match_operand:SI 1 "const_int_operand" ""))
+            (match_operand:SI 2 "register_operand" ""))])
          (match_operand 3 "register_operand" ""))
      (set (match_operand:SI 4 "register_operand" "")
          (plus:SI (mult:SI (match_dup 0)
                          (match_dup 1))
                 (match_dup 4)))]
   "operands[5]
-     = gen_rtx_MEM (GET_MODE (operands[3]),
-                   gen_rtx_PLUS (SImode,
-                                 gen_rtx_MULT (SImode,
-                                               operands[0], operands[1]),
-                                 operands[2]));")
+     = replace_equiv_address (operands[6],
+                             gen_rtx_PLUS (SImode,
+                                           gen_rtx_MULT (SImode,
+                                                         operands[0],
+                                                         operands[1]),
+                                           operands[2]));")
 \f
 ;; move.s rx,[ry=rz+i]
 ;; FIXME: These could have anonymous mode for operand 2.
 
 (define_split
   [(parallel
-    [(set (mem (plus:SI
-               (match_operand:SI 0 "cris_bdap_operand" "")
-               (match_operand:SI 1 "cris_bdap_operand" "")))
+    [(set (match_operator
+          4 "cris_mem_op"
+          [(plus:SI
+            (match_operand:SI 0 "cris_bdap_operand" "")
+            (match_operand:SI 1 "cris_bdap_operand" ""))])
          (match_operand 2 "register_operand" ""))
      (set (match_operand:SI 3 "register_operand" "")
          (plus:SI (match_dup 0) (match_dup 1)))])]
   [(set (match_dup 4) (match_dup 2))
    (set (match_dup 3) (match_dup 0))
    (set (match_dup 3) (plus:SI (match_dup 3) (match_dup 1)))]
-  "operands[4]
-     = gen_rtx_MEM (GET_MODE (operands[2]),
-                   gen_rtx_PLUS (SImode, operands[0], operands[1]));")
+  "")
 \f
 ;; Clear memory side-effect patterns.  It is hard to get to the mode if
 ;; the MEM was anonymous, so there will be one for each mode.
          else
            abort ();
 
-         operands[0] = gen_rtx_MEM (GET_MODE (operands[0]), op0);
+         operands[0] = replace_equiv_address (operands[0], op0);
        }
     }
 }")
          else
            abort ();
 
-         operands[1] = gen_rtx_MEM (GET_MODE (operands[1]), op1);
+         operands[1] = replace_equiv_address (operands[1], op1);
        }
     }
 }")
 (define_split
   [(parallel
     [(set (match_operand 0 "register_operand" "")
-          (mem (plus:SI
-                (mult:SI (match_operand:SI 1 "register_operand" "")
-                         (match_operand:SI 2 "const_int_operand" ""))
-                (match_operand:SI 3 "register_operand" ""))))
+         (match_operator
+          6 "cris_mem_op"
+          [(plus:SI
+            (mult:SI (match_operand:SI 1 "register_operand" "")
+                     (match_operand:SI 2 "const_int_operand" ""))
+            (match_operand:SI 3 "register_operand" ""))]))
      (set (match_operand:SI 4 "register_operand" "")
           (plus:SI (mult:SI (match_dup 1)
                             (match_dup 2))
   [(set (match_dup 4) (plus:SI (mult:SI (match_dup 1) (match_dup 2))
                                (match_dup 3)))
    (set (match_dup 0) (match_dup 5))]
-  "operands[5] = gen_rtx_MEM (GET_MODE (operands[0]), operands[3]);")
+  "operands[5] = replace_equiv_address (operands[6], operands[3]);")
 
 ;; move.S1 [rx=rx+i],ry
 
 (define_split
   [(parallel
     [(set (match_operand 0 "register_operand" "")
-          (mem
-           (plus:SI (match_operand:SI 1 "cris_bdap_operand" "")
-                    (match_operand:SI 2 "cris_bdap_operand" ""))))
+         (match_operator
+          5 "cris_mem_op"
+          [(plus:SI (match_operand:SI 1 "cris_bdap_operand" "")
+                    (match_operand:SI 2 "cris_bdap_operand" ""))]))
      (set (match_operand:SI 3 "register_operand" "")
           (plus:SI (match_dup 1)
                    (match_dup 2)))])]
     || rtx_equal_p (operands[3], operands[2]))"
   [(set (match_dup 3) (plus:SI (match_dup 1) (match_dup 2)))
    (set (match_dup 0) (match_dup 4))]
-  "operands[4] = gen_rtx_MEM (GET_MODE (operands[0]), operands[3]);")
+  "operands[4] = replace_equiv_address (operands[5], operands[3]);")
 
 ;; move.S1 ry,[rx=rx+rz.S2]
 
 (define_split
   [(parallel
-    [(set (mem (plus:SI
-                (mult:SI (match_operand:SI 0 "register_operand" "")
-                         (match_operand:SI 1 "const_int_operand" ""))
-                (match_operand:SI 2 "register_operand" "")))
-          (match_operand 3 "register_operand" ""))
+    [(set (match_operator
+          6 "cris_mem_op"
+          [(plus:SI
+            (mult:SI (match_operand:SI 0 "register_operand" "")
+                     (match_operand:SI 1 "const_int_operand" ""))
+            (match_operand:SI 2 "register_operand" ""))])
+         (match_operand 3 "register_operand" ""))
      (set (match_operand:SI 4 "register_operand" "")
           (plus:SI (mult:SI (match_dup 0)
                             (match_dup 1))
   [(set (match_dup 4) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
                                (match_dup 2)))
    (set (match_dup 5) (match_dup 3))]
-  "operands[5] = gen_rtx_MEM (GET_MODE (operands[3]), operands[4]);")
+  "operands[5] = replace_equiv_address (operands[6], operands[4]);")
 
 ;; move.S1 ry,[rx=rx+i]
 
 (define_split
   [(parallel
-    [(set (mem
-          (plus:SI (match_operand:SI 0 "cris_bdap_operand" "")
-                   (match_operand:SI 1 "cris_bdap_operand" "")))
-          (match_operand 2 "register_operand" ""))
+    [(set (match_operator
+          6 "cris_mem_op"
+          [(plus:SI (match_operand:SI 0 "cris_bdap_operand" "")
+                    (match_operand:SI 1 "cris_bdap_operand" ""))])
+         (match_operand 2 "register_operand" ""))
      (set (match_operand:SI 3 "register_operand" "")
           (plus:SI (match_dup 0)
                   (match_dup 1)))])]
     || rtx_equal_p (operands[3], operands[1]))"
   [(set (match_dup 3) (plus:SI (match_dup 0) (match_dup 1)))
    (set (match_dup 5) (match_dup 2))]
-  "operands[5] = gen_rtx_MEM (GET_MODE (operands[2]), operands[3]);")
+  "operands[5] = replace_equiv_address (operands[6], operands[3]);")
 
 ;; clear.d [rx=rx+rz.S2]
 
   [(set (match_dup 4) (plus:SI (mult:SI (match_dup 1) (match_dup 2))
                                (match_dup 3)))
    (set (match_dup 0) (match_op_dup 5 [(match_dup 6)]))]
-  "operands[6] = gen_rtx_MEM (GET_MODE (XEXP (operands[5],0)),
-                          operands[4]);")
+  "operands[6] = replace_equiv_address (XEXP (operands[5], 0), operands[4]);")
 
 ;; mov(s|u).S1 [rx=rx+i],ry
 
     || rtx_equal_p (operands[2], operands[3]))"
   [(set (match_dup 3) (plus:SI (match_dup 1) (match_dup 2)))
    (set (match_dup 0) (match_op_dup 4 [(match_dup 5)]))]
-  "operands[5] = gen_rtx_MEM (GET_MODE (XEXP (operands[4], 0)),
-                         operands[3]);")
+  "operands[5] = replace_equiv_address (XEXP (operands[4], 0), operands[3]);")
 
 ;; op.S1 [rx=rx+i],ry
 
     || rtx_equal_p (operands[4], operands[3]))"
   [(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
    (set (match_dup 0) (match_op_dup 5 [(match_dup 1) (match_dup 6)]))]
-  "operands[6] = gen_rtx_MEM (GET_MODE (operands[0]), operands[4]);")
+  "operands[6] = replace_equiv_address (XEXP (operands[5], 1), operands[4]);")
 
 ;; op.S1 [rx=rx+rz.S2],ry
 
   [(set (match_dup 5) (plus:SI (mult:SI (match_dup 2) (match_dup 3))
                                (match_dup 4)))
    (set (match_dup 0) (match_op_dup 6 [(match_dup 1) (match_dup 7)]))]
-  "operands[7] = gen_rtx_MEM (GET_MODE (operands[0]), operands[5]);")
+  "operands[7] = replace_equiv_address (XEXP (operands[6], 1), operands[5]);")
 
 ;; op.S1 [rx=rx+rz.S2],ry (swapped)
 
   [(set (match_dup 5) (plus:SI (mult:SI (match_dup 2) (match_dup 3))
                               (match_dup 4)))
    (set (match_dup 0) (match_op_dup 6 [(match_dup 7) (match_dup 1)]))]
-  "operands[7] = gen_rtx_MEM (GET_MODE (operands[0]), operands[5]);")
+  "operands[7] = replace_equiv_address (XEXP (operands[6], 0), operands[5]);")
 
 ;; op.S1 [rx=rx+i],ry (swapped)
 
     || rtx_equal_p (operands[4], operands[3]))"
   [(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
    (set (match_dup 0) (match_op_dup 5 [(match_dup 6) (match_dup 1)]))]
-  "operands[6] = gen_rtx_MEM (GET_MODE (operands[0]), operands[4]);")
+  "operands[6] = replace_equiv_address (XEXP (operands[5], 0), operands[4]);")
 
 ;; op(s|u).S1 [rx=rx+rz.S2],ry
 
                               (match_dup 4)))
    (set (match_dup 0) (match_op_dup 6 [(match_dup 1) (match_dup 8)]))]
   "operands[8] = gen_rtx (GET_CODE (operands[7]), GET_MODE (operands[7]),
-                         gen_rtx_MEM (GET_MODE (XEXP (operands[7], 0)),
-                                  operands[5]));")
+                         replace_equiv_address (XEXP (operands[7], 0),
+                                                operands[5]));")
 
 ;; op(s|u).S1 [rx=rx+i],ry
 
   [(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
    (set (match_dup 0) (match_op_dup 5 [(match_dup 1) (match_dup 7)]))]
   "operands[7] = gen_rtx (GET_CODE (operands[6]), GET_MODE (operands[6]),
-                          gen_rtx_MEM (GET_MODE (XEXP (operands[6], 0)),
-                                   operands[4]));")
+                         replace_equiv_address (XEXP (operands[6], 0),
+                                                operands[4]));")
 
 ;; op(s|u).S1 [rx=rx+rz.S2],ry (swapped, plus or bound)
 
                               (match_dup 4)))
    (set (match_dup 0) (match_op_dup 6 [(match_dup 8) (match_dup 1)]))]
   "operands[8] = gen_rtx (GET_CODE (operands[6]), GET_MODE (operands[6]),
-                         gen_rtx_MEM (GET_MODE (XEXP (operands[6], 0)),
-                                  operands[5]));")
+                         replace_equiv_address (XEXP (operands[6], 0),
+                                                operands[5]));")
 
 ;; op(s|u).S1 [rx=rx+i],ry (swapped, plus or bound)
 
   [(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
    (set (match_dup 0) (match_op_dup 6 [(match_dup 7) (match_dup 1)]))]
   "operands[7] = gen_rtx (GET_CODE (operands[5]), GET_MODE (operands[5]),
-                         gen_rtx_MEM (GET_MODE (XEXP (operands[5], 0)),
-                                  operands[4]));")
+                         replace_equiv_address (XEXP (operands[5], 0),
+                                                operands[4]));")
 \f
 ;; Splits for addressing prefixes that have no side-effects, so we can
 ;; fill a delay slot.  Never split if we lose something, though.
   [(set (match_dup 2) (match_dup 4))
    (set (match_dup 0) (match_dup 3))]
   "operands[2] = gen_rtx_REG (Pmode, REGNO (operands[0]));
-   operands[3] = gen_rtx_MEM (GET_MODE (operands[0]), operands[2]);
+   operands[3] = replace_equiv_address (operands[1], operands[2]);
    operands[4] = XEXP (operands[1], 0);")
 
 ;; As the above, but MOVS and MOVU.
   [(set (match_dup 2) (match_dup 5))
    (set (match_dup 0) (match_op_dup 4 [(match_dup 3)]))]
   "operands[2] = gen_rtx_REG (Pmode, REGNO (operands[0]));
-   operands[3] = gen_rtx_MEM (GET_MODE (XEXP (operands[4], 0)), operands[2]);
+   operands[3] = replace_equiv_address (XEXP (operands[4], 0), operands[2]);
    operands[5] = XEXP (operands[1], 0);")
 \f
 ;; Various peephole optimizations.