This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[IA64] Hookize MEMORY_MOVE_COST


 Hello.

  This patch removes obsolete MEMORY_MOVE_COST macro from IA64 back end in
the GCC and introduces equivalent TARGET_MEMORY_MOVE_COST target hooks.

  ?Bootstrapped and regression tested on ia64-unknown-linux-gnu.

  OK to install?

        * config/ia64/ia64.h (MEMORY_MOVE_COST): Remove macro.
        * config/ia64/t-ia64 (ia64.o): Depend on reload.h.
        * config/ia64/ia64.c Include reload.h.
        (ia64_memory_move_cost): New function.
        (TARGET_MEMORY_MOVE_COST): Define.
        (ia64_register_move_cost): Replace MEMORY_MOVE_COST with
        memory_move_cost.


Index: gcc/config/ia64/ia64.c
===================================================================
--- gcc/config/ia64/ia64.c      (revision 161470)
+++ gcc/config/ia64/ia64.c      (working copy)
@@ -59,6 +59,7 @@
 #include "dbgcnt.h"
 #include "tm-constrs.h"
 #include "sel-sched.h"
+#include "reload.h"
 
 /* This is used for communication between ASM_OUTPUT_LABEL and
    ASM_OUTPUT_LABELREF.  */
@@ -212,6 +213,8 @@
 static bool ia64_function_value_regno_p (const unsigned int);
 static int ia64_register_move_cost (enum machine_mode, enum reg_class,
                                     enum reg_class);
+static int ia64_memory_move_cost (enum machine_mode mode, enum reg_class,
+                                 bool);
 static bool ia64_rtx_costs (rtx, int, int, int *, bool);
 static int ia64_unspec_may_trap_p (const_rtx, unsigned);
 static void fix_range (const char *);
@@ -458,6 +461,8 @@
 
 #undef TARGET_REGISTER_MOVE_COST
 #define TARGET_REGISTER_MOVE_COST ia64_register_move_cost
+#undef TARGET_MEMORY_MOVE_COST
+#define TARGET_MEMORY_MOVE_COST ia64_memory_move_cost
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS ia64_rtx_costs
 #undef TARGET_ADDRESS_COST
@@ -5226,12 +5231,12 @@
 
   /* Moving from FR<->GR in XFmode must be more expensive than 2,
      so that we get secondary memory reloads.  Between FR_REGS,
-     we have to make this at least as expensive as MEMORY_MOVE_COST
+     we have to make this at least as expensive as memory_move_cost
      to avoid spectacularly poor register class preferencing.  */
   if (mode == XFmode || mode == RFmode)
     {
       if (to != GR_REGS || from != GR_REGS)
-        return MEMORY_MOVE_COST (mode, to, 0);
+        return memory_move_cost (mode, to, false);
       else
        return 3;
     }
@@ -5244,20 +5249,20 @@
        return 3;
       /* Moving between PR and anything but GR is impossible.  */
       if (from != GR_REGS)
-       return MEMORY_MOVE_COST (mode, to, 0);
+       return memory_move_cost (mode, to, false);
       break;
 
     case BR_REGS:
       /* Moving between BR and anything but GR is impossible.  */
       if (from != GR_REGS && from != GR_AND_BR_REGS)
-       return MEMORY_MOVE_COST (mode, to, 0);
+       return memory_move_cost (mode, to, false);
       break;
 
     case AR_I_REGS:
     case AR_M_REGS:
       /* Moving between AR and anything but GR is impossible.  */
       if (from != GR_REGS)
-       return MEMORY_MOVE_COST (mode, to, 0);
+       return memory_move_cost (mode, to, false);
       break;
 
     case GR_REGS:
@@ -5275,6 +5280,23 @@
   return 2;
 }
 
+/* Calculate the cost of moving data of MODE from a register to or from
+   memory.  */
+
+static int
+ia64_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
+                      enum reg_class rclass,
+                      bool in ATTRIBUTE_UNUSED)
+{
+  if (rclass == GENERAL_REGS
+      || rclass == FR_REGS
+      || rclass == FP_REGS
+      || rclass == GR_AND_FR_REGS)
+    return 4;
+  else
+    return 10;
+}
+
 /* Implement PREFERRED_RELOAD_CLASS.  Place additional restrictions on RCLASS
    to use when copying X into that class.  */
 
Index: gcc/config/ia64/ia64.h
===================================================================
--- gcc/config/ia64/ia64.h      (revision 161470)
+++ gcc/config/ia64/ia64.h      (working copy)
@@ -1310,12 +1310,6 @@
 
 /* Describing Relative Costs of Operations */
 
-/* A C expression for the cost of moving data of mode M between a
-   register and memory.  */
-#define MEMORY_MOVE_COST(MODE,CLASS,IN) \
-  ((CLASS) == GENERAL_REGS || (CLASS) == FR_REGS || (CLASS) == FP_REGS \
-   || (CLASS) == GR_AND_FR_REGS ? 4 : 10)
-
 /* A C expression for the cost of a branch instruction.  A value of 1 is the
    default; other values are interpreted relative to that.  Used by the
    if-conversion code as max instruction count.  */
Index: gcc/config/ia64/t-ia64
===================================================================
--- gcc/config/ia64/t-ia64      (revision 161470)
+++ gcc/config/ia64/t-ia64      (working copy)
@@ -53,4 +53,4 @@
 # genattrtab generates very long string literals.
 insn-attrtab.o-warn = -Wno-error
 
-ia64.o: debug.h $(PARAMS_H) sel-sched.h
+ia64.o: debug.h $(PARAMS_H) sel-sched.h reload.h


Anatoly.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]