Patchwork [SCORE] Hookize REGISTER_MOVE_COST and MEMORY_MOVE_COST

login
register
mail settings
Submitter Anatoly Sokolov
Date Dec. 23, 2011, 7:08 p.m.
Message ID <1752689113.20111223230833@post.ru>
Download mbox | patch
Permalink /patch/133138/
State New
Headers show

Comments

Anatoly Sokolov - Dec. 23, 2011, 7:08 p.m.
Hi.

  This patch removes obsolete REGISTER_MOVE_COST macro from the SCORE back 
end in the GCC and introduces equivalent TARGET_MEMORY_MOVE_COST target hook.
The MEMORY_MOVE_COST macros is removed and default implementation of the 
TARGET_MEMORY_MOVE_COST target hook is used.

  Untested.

  OK to install?

        * config/score/score.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove.
        * config/score/score-protos.h (score_register_move_cost): Remove.       
        * config/score/score.c (TARGET_REGISTER_MOVE_COST): Define.
        (score_register_move_cost): Make static. Change arguments type from
        enum reg_class to reg_class_t.
        


Anatoly.
Richard Henderson - Dec. 23, 2011, 7:43 p.m.
On 12/23/2011 11:08 AM, Anatoly Sokolov wrote:
>         * config/score/score.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove.
>         * config/score/score-protos.h (score_register_move_cost): Remove.       
>         * config/score/score.c (TARGET_REGISTER_MOVE_COST): Define.
>         (score_register_move_cost): Make static. Change arguments type from
>         enum reg_class to reg_class_t.

Ok.


r~
Liqin Chen - Dec. 26, 2011, 8:18 a.m.
On Fri, 2011-12-23 at 23:08 +0400, Anatoly Sokolov wrote:
>         * config/score/score.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove.
>         * config/score/score-protos.h (score_register_move_cost): Remove.       
>         * config/score/score.c (TARGET_REGISTER_MOVE_COST): Define.
>         (score_register_move_cost): Make static. Change arguments type from
>         enum reg_class to reg_class_t.

It's OK to update, Thanks.

--liqin

Patch

Index: gcc/config/score/score.h
===================================================================
--- gcc/config/score/score.h    (revision 182660)
+++ gcc/config/score/score.h    (working copy)
@@ -601,14 +601,6 @@  typedef struct score_args
 #define REVERSIBLE_CC_MODE(MODE)        1
 
 /* Describing Relative Costs of Operations  */
-/* Compute extra cost of moving data between one register class and another.  */
-#define REGISTER_MOVE_COST(MODE, FROM, TO) \
-  score_register_move_cost (MODE, FROM, TO)
-
-/* Moves to and from memory are quite expensive */
-#define MEMORY_MOVE_COST(MODE, CLASS, TO_P) \
-  (4 + memory_move_secondary_cost ((MODE), (CLASS), (TO_P)))
-
 /* Try to generate sequences that don't involve branches.  */
 #define BRANCH_COST(speed_p, predictable_p) 2
 
Index: gcc/config/score/score-protos.h
===================================================================
--- gcc/config/score/score-protos.h     (revision 182660)
+++ gcc/config/score/score-protos.h     (working copy)
@@ -42,8 +42,6 @@  extern bool score_block_move (rtx* ops);
 extern int score_address_cost (rtx addr, bool speed);
 extern int score_address_p (enum machine_mode mode, rtx x, int strict);
 extern int score_reg_class (int regno);
-extern int score_register_move_cost (enum machine_mode mode, enum reg_class to,
-                                     enum reg_class from);
 extern int score_hard_regno_mode_ok (unsigned int, enum machine_mode);
 extern int score_const_ok_for_letter_p (HOST_WIDE_INT value, char c);
 extern int score_extra_constraint (rtx op, char c);
Index: gcc/config/score/score.c
===================================================================
--- gcc/config/score/score.c    (revision 182660)
+++ gcc/config/score/score.c    (working copy)
@@ -187,6 +187,9 @@  struct extern_list *extern_head = 0;
 #undef TARGET_TRAMPOLINE_INIT
 #define TARGET_TRAMPOLINE_INIT         score_trampoline_init
 
+#undef TARGET_REGISTER_MOVE_COST
+#define TARGET_REGISTER_MOVE_COST      score_register_move_cost
+
 /* Return true if SYMBOL is a SYMBOL_REF and OFFSET + SYMBOL points
    to the same object as SYMBOL.  */
 static int
@@ -998,11 +1001,13 @@  score_legitimate_address_p (enum machine
   return score_classify_address (&addr, mode, x, strict);
 }
 
-/* Return a number assessing the cost of moving a register in class
+/* Implement TARGET_REGISTER_MOVE_COST.
+
+   Return a number assessing the cost of moving a register in class
    FROM to class TO. */
-int
+static int
 score_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
-                          enum reg_class from, enum reg_class to)
+                          reg_class_t from, reg_class_t to)
 {
   if (GR_REG_CLASS_P (from))
     {