public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [FRV] Hookize REGISTER_MOVE_COST and MEMORY_MOVE_COST
@ 2010-09-08 19:40 Anatoly Sokolov
  2010-09-08 21:09 ` Richard Henderson
  2010-09-09  9:22 ` Nick Clifton
  0 siblings, 2 replies; 3+ messages in thread
From: Anatoly Sokolov @ 2010-09-08 19:40 UTC (permalink / raw)
  To: gcc-patches; +Cc: nickc

   Hi.

  This patch removes obsolete REGISTER_MOVE_COST and MEMORY_MOVE_COST
macros from the FRV back end in the GCC and introduces equivalent
TARGET_MEMORY_MOVE_COST target hook. Since REGISTER_MOVE_COST is defined as
default value 2 the default version of the TARGET_REGISTER_MOVE_COST is used.

  Regression tested on frv-unknown-elf.

  OK to install?

        * config/frv/frv.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove.
        * config/frv/frv-protos.h (frv_register_move_cost): Remove.
        * config/frv/frv.c (frv_register_move_cost): Make static. Change
        arguments type to reg_class_t.
        (frv_memory_move_cost): New.
        (TARGET_REGISTER_MOVE_COSTS, TARGET_MEMORY_MOVE_COSTS): Define.


Index: gcc/config/frv/frv.h
===================================================================
--- gcc/config/frv/frv.h        (revision 164019)
+++ gcc/config/frv/frv.h        (working copy)
@@ -1946,31 +1946,6 @@
 \f
 /* Describing Relative Costs of Operations.  */
 
-/* A C expression for the cost of moving data from a register in class FROM to
-   one in class TO.  The classes are expressed using the enumeration values
-   such as `GENERAL_REGS'.  A value of 4 is the default; other values are
-   interpreted relative to that.
-
-   It is not required that the cost always equal 2 when FROM is the same as TO;
-   on some machines it is expensive to move between registers if they are not
-   general registers.
-
-   If reload sees an insn consisting of a single `set' between two hard
-   registers, and if `REGISTER_MOVE_COST' applied to their classes returns a
-   value of 2, reload does not check to ensure that the constraints of the insn
-   are met.  Setting a cost of other than 2 will allow reload to verify that
-   the constraints are met.  You should do this if the `movM' pattern's
-   constraints do not allow such copying.  */
-#define REGISTER_MOVE_COST(MODE, FROM, TO) frv_register_move_cost (FROM, TO)
-
-/* A C expression for the cost of moving data of mode M between a register and
-   memory.  A value of 2 is the default; this cost is relative to those in
-   `REGISTER_MOVE_COST'.
-
-   If moving between registers and memory is more expensive than between two
-   registers, you should define this macro to express the relative cost.  */
-#define MEMORY_MOVE_COST(M,C,I) 4
-
 /* A C expression for the cost of a branch instruction.  A value of 1 is the
    default; other values are interpreted relative to that.  */
 #define BRANCH_COST(speed_p, predictable_p) frv_branch_cost_int
Index: gcc/config/frv/frv-protos.h
===================================================================
--- gcc/config/frv/frv-protos.h	(revision 164019)
+++ gcc/config/frv/frv-protos.h	(working copy)
@@ -111,7 +111,6 @@
 #endif	/* RTX_CODE */
 
 extern int direct_return_p             (void);
-extern int frv_register_move_cost      (enum reg_class, enum reg_class);
 extern int frv_issue_rate              (void);
 extern int frv_acc_group               (rtx);
 
Index: gcc/config/frv/frv.c
===================================================================
--- gcc/config/frv/frv.c        (revision 164019)
+++ gcc/config/frv/frv.c        (working copy)
@@ -371,6 +371,9 @@
 static rtx frv_expand_builtin_saveregs         (void);
 static void frv_expand_builtin_va_start                (tree, rtx);
 static bool frv_rtx_costs                      (rtx, int, int, int*, bool);
+static int frv_register_move_cost              (reg_class_t, reg_class_t);
+static int frv_memory_move_cost                        (enum machine_mode,
+                                                reg_class_t, bool);
 static void frv_asm_out_constructor            (rtx, int);
 static void frv_asm_out_destructor             (rtx, int);
 static bool frv_function_symbol_referenced_p   (rtx);
@@ -432,6 +435,10 @@
 #define TARGET_INIT_LIBFUNCS frv_init_libfuncs
 #undef TARGET_IN_SMALL_DATA_P
 #define TARGET_IN_SMALL_DATA_P frv_in_small_data_p
+#undef TARGET_REGISTER_MOVE_COSTS
+#define TARGET_REGISTER_MOVE_COSTS frv_register_move_costs
+#undef TARGET_MEMORY_MOVE_COSTS
+#define TARGET_MEMORY_MOVE_COSTS frv_memory_move_costs
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS frv_rtx_costs
 #undef TARGET_ASM_CONSTRUCTOR
@@ -6908,28 +6915,15 @@
     }
 }
 \f
-/* A C expression for the cost of moving data from a register in class FROM to
-   one in class TO.  The classes are expressed using the enumeration values
-   such as `GENERAL_REGS'.  A value of 4 is the default; other values are
-   interpreted relative to that.
 
-   It is not required that the cost always equal 2 when FROM is the same as TO;
-   on some machines it is expensive to move between registers if they are not
-   general registers.
+/* Worker function for TARGET_REGISTER_MOVE_COST.  */
 
-   If reload sees an insn consisting of a single `set' between two hard
-   registers, and if `REGISTER_MOVE_COST' applied to their classes returns a
-   value of 2, reload does not check to ensure that the constraints of the insn
-   are met.  Setting a cost of other than 2 will allow reload to verify that
-   the constraints are met.  You should do this if the `movM' pattern's
-   constraints do not allow such copying.  */
-
 #define HIGH_COST 40
 #define MEDIUM_COST 3
 #define LOW_COST 1
 
-int
-frv_register_move_cost (enum reg_class from, enum reg_class to)
+static int
+frv_register_move_cost (reg_class_t from, reg_class_t to)
 {
   switch (from)
     {
@@ -7012,6 +7006,17 @@
 
   return HIGH_COST;
 }
+
+/* Worker function for TARGET_MEMORY_MOVE_COST.  */
+
+static int
+frv_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
+                      reg_class_t rclass ATTRIBUTE_UNUSED,
+                      bool in ATTRIBUTE_UNUSED)
+{
+  return 4;
+}
+
 \f
 /* Implementation of TARGET_ASM_INTEGER.  In the FRV case we need to
    use ".picptr" to generate safe relocations for PIC code.  We also


Anatoly.

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

* Re: [FRV] Hookize REGISTER_MOVE_COST and MEMORY_MOVE_COST
  2010-09-08 19:40 [FRV] Hookize REGISTER_MOVE_COST and MEMORY_MOVE_COST Anatoly Sokolov
@ 2010-09-08 21:09 ` Richard Henderson
  2010-09-09  9:22 ` Nick Clifton
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2010-09-08 21:09 UTC (permalink / raw)
  To: Anatoly Sokolov; +Cc: gcc-patches, nickc

On 09/08/2010 12:25 PM, Anatoly Sokolov wrote:
>         * config/frv/frv.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove.
>         * config/frv/frv-protos.h (frv_register_move_cost): Remove.
>         * config/frv/frv.c (frv_register_move_cost): Make static. Change
>         arguments type to reg_class_t.
>         (frv_memory_move_cost): New.
>         (TARGET_REGISTER_MOVE_COSTS, TARGET_MEMORY_MOVE_COSTS): Define.

Ok.


r~

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

* Re: [FRV] Hookize REGISTER_MOVE_COST and MEMORY_MOVE_COST
  2010-09-08 19:40 [FRV] Hookize REGISTER_MOVE_COST and MEMORY_MOVE_COST Anatoly Sokolov
  2010-09-08 21:09 ` Richard Henderson
@ 2010-09-09  9:22 ` Nick Clifton
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Clifton @ 2010-09-09  9:22 UTC (permalink / raw)
  To: Anatoly Sokolov; +Cc: gcc-patches

Hi Anatoly,

>          * config/frv/frv.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove.
>          * config/frv/frv-protos.h (frv_register_move_cost): Remove.
>          * config/frv/frv.c (frv_register_move_cost): Make static. Change
>          arguments type to reg_class_t.
>          (frv_memory_move_cost): New.
>          (TARGET_REGISTER_MOVE_COSTS, TARGET_MEMORY_MOVE_COSTS): Define.

Approved - please apply.

Cheers
   Nick

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

end of thread, other threads:[~2010-09-09  9:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-08 19:40 [FRV] Hookize REGISTER_MOVE_COST and MEMORY_MOVE_COST Anatoly Sokolov
2010-09-08 21:09 ` Richard Henderson
2010-09-09  9:22 ` Nick Clifton

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).