frv.h (LEGITIMIZE_ADDRESS): New.
authorAldy Hernandez <aldyh@redhat.com>
Tue, 5 Oct 2004 20:11:17 +0000 (20:11 +0000)
committerAldy Hernandez <aldyh@gcc.gnu.org>
Tue, 5 Oct 2004 20:11:17 +0000 (20:11 +0000)
* config/frv/frv.h (LEGITIMIZE_ADDRESS): New.

* config/frv/frv-protos.h (frv_legitimize_address): Protoize.
(frv_emit_move): Same.

* config/frv/frv.c (frv_emit_move): New.
(frv_legitimize_address): New.

* config/frv/frv.md ("movsi"): Call frv_emit_move.
("movqi"): Same.
("movhi"): Same.
("movdi"): Same.
("movsf"): Same.
("movdf"): Same.

From-SVN: r88574

gcc/ChangeLog
gcc/config/frv/frv-protos.h
gcc/config/frv/frv.c
gcc/config/frv/frv.h
gcc/config/frv/frv.md

index f3b9b84c2eb0f78c7391e02418072458689dc9aa..9c98af6618486e3e57ece09fc75f29a4130f48b2 100644 (file)
@@ -1,3 +1,20 @@
+2004-10-05  Aldy Hernandez  <aldyh@redhat.com>
+
+       * config/frv/frv.h (LEGITIMIZE_ADDRESS): New.
+
+       * config/frv/frv-protos.h (frv_legitimize_address): Protoize.
+       (frv_emit_move): Same.
+
+       * config/frv/frv.c (frv_emit_move): New.
+       (frv_legitimize_address): New.
+
+       * config/frv/frv.md ("movsi"): Call frv_emit_move.
+       ("movqi"): Same.
+       ("movhi"): Same.
+       ("movdi"): Same.
+       ("movsf"): Same.
+       ("movdf"): Same.
+
 2004-10-05  Joseph S. Myers  <jsm@polyomino.org.uk>
 
        * c-decl.c (declspecs_add_type): Don't pedwarn for _Complex in
index cf6c859d9a7cd448227b5ff0a36910eb94e855fb..d775260fbd09c9b1a4acbf45d9e7d2c0ed39c830 100644 (file)
@@ -68,6 +68,7 @@ extern int frv_initial_elimination_offset     (int, int);
 #ifdef RTX_CODE
 extern int frv_legitimate_address_p            (enum machine_mode, rtx,
                                                 int, int, int);
+extern rtx frv_legitimize_address              (rtx, rtx, enum machine_mode);
 extern rtx frv_find_base_term                  (rtx);
 
 #ifdef TREE_CODE
@@ -100,6 +101,7 @@ extern const char *frv_asm_output_opcode
 extern void frv_final_prescan_insn     (rtx, rtx *, int);
 extern void frv_print_operand          (FILE *, rtx, int);
 extern void frv_print_operand_address  (FILE *, rtx);
+extern void frv_emit_move              (enum machine_mode, rtx, rtx);
 extern int frv_emit_movsi              (rtx, rtx);
 extern const char *output_move_single  (rtx *, rtx);
 extern const char *output_move_double  (rtx *, rtx);
index 9862013ec45d16737f87201dbd503f714353dc44..b8d69615d8857a300edf78d7a32b8a603fdd00be 100644 (file)
@@ -3427,6 +3427,13 @@ frv_legitimate_address_p (enum machine_mode mode,
   return ret;
 }
 
+rtx
+frv_legitimize_address (rtx x ATTRIBUTE_UNUSED,
+                       rtx oldx ATTRIBUTE_UNUSED,
+                       enum machine_mode mode ATTRIBUTE_UNUSED)
+{
+  return NULL_RTX;
+}
 \f
 /* Test whether a local function descriptor is canonical, i.e.,
    whether we can use FUNCDESC_GOTOFF to compute the address of the
@@ -5342,6 +5349,35 @@ direct_return_p (void)
 }
 
 \f
+void
+frv_emit_move (enum machine_mode mode, rtx dest, rtx src)
+{
+  switch (mode)
+    {
+    case SImode:
+      if (frv_emit_movsi (dest, src))
+       return;
+      break;
+
+    case QImode:
+    case HImode:
+    case DImode:
+    case SFmode:
+    case DFmode:
+      if (!reload_in_progress
+         && !reload_completed
+         && !register_operand (dest, mode)
+         && !reg_or_0_operand (src, mode))
+       src = copy_to_mode_reg (mode, src);
+      break;
+
+    default:
+      abort ();
+    }
+
+  emit_insn (gen_rtx_SET (VOIDmode, dest, src));
+}
+
 /* Emit code to handle a MOVSI, adding in the small data register or pic
    register if needed to load up addresses.  Return TRUE if the appropriate
    instructions are emitted.  */
index 91acc3d09a3fe36f7aa1b6a6220ee49ca1759966..55fd007bae023bbd80f3f37930f3d547f4fe1d44 100644 (file)
@@ -2335,6 +2335,16 @@ __asm__("\n"                                                             \
    will reload one or both registers only if neither labeling works.  */
 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
 
+#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)         \
+do {                                                   \
+  rtx new_x = frv_legitimize_address (X, OLDX, MODE);  \
+  if (new_x)                                           \
+    {                                                  \
+      (X) = new_x;                                     \
+      goto WIN;                                        \
+    }                                                  \
+} while (0)
+
 #define FIND_BASE_TERM frv_find_base_term
 
 /* A C statement or compound statement with a conditional `goto LABEL;'
index a3f9453d0c1c5e4519870ac20f33f722587a958a..0cf88871455feab67df0069ddce9a3d274c8aad5 100644 (file)
   [(set (match_operand:QI 0 "general_operand" "")
        (match_operand:QI 1 "general_operand" ""))]
   ""
-  "
-{
-  if (!reload_in_progress
-      && !reload_completed
-      && !register_operand (operands[0], QImode)
-      && !reg_or_0_operand (operands[1], QImode))
-    operands[1] = copy_to_mode_reg (QImode, operands[1]);
-}")
+  "{ frv_emit_move (QImode, operands[0], operands[1]); DONE; }")
 
 (define_insn "*movqi_load"
   [(set (match_operand:QI 0 "register_operand" "=d,f")
   [(set (match_operand:HI 0 "general_operand" "")
        (match_operand:HI 1 "general_operand" ""))]
   ""
-  "
-{
-  if (!reload_in_progress
-      && !reload_completed
-      && !register_operand (operands[0], HImode)
-      && !reg_or_0_operand (operands[1], HImode))
-    operands[1] = copy_to_mode_reg (HImode, operands[1]);
-}")
+  "{ frv_emit_move (HImode, operands[0], operands[1]); DONE; }")
 
 (define_insn "*movhi_load"
   [(set (match_operand:HI 0 "register_operand" "=d,f")
   [(set (match_operand:SI 0 "move_destination_operand" "")
        (match_operand:SI 1 "move_source_operand" ""))]
   ""
-  "
-{
-  if (frv_emit_movsi (operands[0], operands[1]))
-    DONE;
-}")
+  "{ frv_emit_move (SImode, operands[0], operands[1]); DONE; }")
 
 ;; Note - it is best to only have one movsi pattern and to handle
 ;; all the various contingencies by the use of alternatives.  This
 ;; re-recognize them again after the substitution for memory.  So keep
 ;; a memory constraint available, just make sure reload won't be
 ;; tempted to use it.
-
+;;
+                  
+                  
 (define_insn "*movsi_load"
   [(set (match_operand:SI 0 "register_operand" "=d,f")
        (match_operand:SI 1 "frv_load_operand" "m,m"))]
   [(set (match_operand:DI 0 "nonimmediate_operand" "")
        (match_operand:DI 1 "general_operand" ""))]
   ""
-  "
-{
-  if (!reload_in_progress
-      && !reload_completed
-      && !register_operand (operands[0], DImode)
-      && !reg_or_0_operand (operands[1], DImode))
-    operands[1] = copy_to_mode_reg (DImode, operands[1]);
-}")
+  "{ frv_emit_move (DImode, operands[0], operands[1]); DONE; }")
 
 (define_insn "*movdi_double"
   [(set (match_operand:DI 0 "move_destination_operand" "=e,?h,??d,??f,R,?R,??m,??m,e,?h,??d,??f,?e,??d,?h,??f,R,m,e,??d,e,??d,?h,??f")
   [(set (match_operand:SF 0 "general_operand" "")
        (match_operand:SF 1 "general_operand" ""))]
   ""
-  "
-{
-  if (!reload_in_progress
-      && !reload_completed
-      && !register_operand (operands[0], SFmode)
-      && !reg_or_0_operand (operands[1], SFmode))
-    operands[1] = copy_to_mode_reg (SFmode, operands[1]);
-}")
+  "{ frv_emit_move (SFmode, operands[0], operands[1]); DONE; }")
 
 (define_split
   [(set (match_operand:SF 0 "integer_register_operand" "")
   [(set (match_operand:DF 0 "nonimmediate_operand" "")
        (match_operand:DF 1 "general_operand" ""))]
   ""
-  "
-{
-  if (!reload_in_progress
-      && !reload_completed
-      && !register_operand (operands[0], DFmode)
-      && !reg_or_0_operand (operands[1], DFmode))
-    operands[1] = copy_to_mode_reg (DFmode, operands[1]);
-}")
+  "{ frv_emit_move (DFmode, operands[0], operands[1]); DONE; }")
 
 (define_insn "*movdf_double"
   [(set (match_operand:DF 0 "move_destination_operand" "=h,?e,??f,??d,R,?R,??m,??m,h,?e,??f,??d,?h,??f,?e,??d,R,m,h,??f,e,??d,e,??d")