public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [IA64] Hookize  MEMORY_MOVE_COST
@ 2010-06-28 21:52 Anatoly Sokolov
  2010-06-29  7:14 ` Richard Henderson
  2010-06-29 17:26 ` Richard Henderson
  0 siblings, 2 replies; 6+ messages in thread
From: Anatoly Sokolov @ 2010-06-28 21:52 UTC (permalink / raw)
  To: gcc-patches; +Cc: Steve Ellcey

 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 @@
 \f
 /* 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [IA64] Hookize  MEMORY_MOVE_COST
  2010-06-28 21:52 [IA64] Hookize MEMORY_MOVE_COST Anatoly Sokolov
@ 2010-06-29  7:14 ` Richard Henderson
  2010-06-29  9:26   ` Anatoly Sokolov
  2010-06-29 17:26 ` Richard Henderson
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2010-06-29  7:14 UTC (permalink / raw)
  To: Anatoly Sokolov; +Cc: gcc-patches, Steve Ellcey

On 06/28/2010 01:42 PM, Anatoly Sokolov wrote:
>  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"

What bit of reload.h is being used here?


r~

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [IA64] Hookize  MEMORY_MOVE_COST
  2010-06-29  7:14 ` Richard Henderson
@ 2010-06-29  9:26   ` Anatoly Sokolov
  2010-06-29 17:24     ` Richard Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Anatoly Sokolov @ 2010-06-29  9:26 UTC (permalink / raw)
  To: Richard Henderson; +Cc: gcc-patches, Steve Ellcey

Hi.

From: "Richard Henderson" <rth@redhat.com>
To: "Anatoly Sokolov" <aesok@post.ru>
Sent: Tuesday, June 29, 2010 4:14 AM


> On 06/28/2010 01:42 PM, Anatoly Sokolov wrote:


>> 
>> 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"
> 
> What bit of reload.h is being used here?
> 

  The memory_move_cost function declared in reload.h.

Anatoly.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [IA64] Hookize  MEMORY_MOVE_COST
  2010-06-29  9:26   ` Anatoly Sokolov
@ 2010-06-29 17:24     ` Richard Henderson
  2010-06-29 20:47       ` Anatoly Sokolov
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2010-06-29 17:24 UTC (permalink / raw)
  To: Anatoly Sokolov; +Cc: gcc-patches, Steve Ellcey

On 06/29/2010 12:00 AM, Anatoly Sokolov wrote:
>> What bit of reload.h is being used here?
>>
> 
>  The memory_move_cost function declared in reload.h.

... which is not called by ia64_memory_move_cost,
so I ask again.


r~

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [IA64] Hookize  MEMORY_MOVE_COST
  2010-06-28 21:52 [IA64] Hookize MEMORY_MOVE_COST Anatoly Sokolov
  2010-06-29  7:14 ` Richard Henderson
@ 2010-06-29 17:26 ` Richard Henderson
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2010-06-29 17:26 UTC (permalink / raw)
  To: Anatoly Sokolov; +Cc: gcc-patches, Steve Ellcey

On 06/28/2010 01:42 PM, Anatoly Sokolov wrote:
>  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.

Patch is ok.


r~

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [IA64] Hookize  MEMORY_MOVE_COST
  2010-06-29 17:24     ` Richard Henderson
@ 2010-06-29 20:47       ` Anatoly Sokolov
  0 siblings, 0 replies; 6+ messages in thread
From: Anatoly Sokolov @ 2010-06-29 20:47 UTC (permalink / raw)
  To: Richard Henderson; +Cc: gcc-patches, Steve Ellcey


Hi.

From: "Richard Henderson" <rth@redhat.com>
To: "Anatoly Sokolov" <aesok@post.ru>
Sent: Tuesday, June 29, 2010 7:22 PM

> On 06/29/2010 12:00 AM, Anatoly Sokolov wrote:
>>> What bit of reload.h is being used here?
>>>
>>
>>  The memory_move_cost function declared in reload.h.
>
> ... which is not called by ia64_memory_move_cost,
> so I ask again.
>

I wish split the back end interface from middle end interface. If the back 
end
interface is once again will be changed, for example be implemented as
C++ class and TARGET_MEMORY_MOVE_COST target hooks changed to virtual 
function,
only memory_move_cost function should be changed, all code which uses it 
will
stay unchanged.

Anatoly. 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-06-29 19:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-28 21:52 [IA64] Hookize MEMORY_MOVE_COST Anatoly Sokolov
2010-06-29  7:14 ` Richard Henderson
2010-06-29  9:26   ` Anatoly Sokolov
2010-06-29 17:24     ` Richard Henderson
2010-06-29 20:47       ` Anatoly Sokolov
2010-06-29 17:26 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).