diff mbox series

[5/5,ARC] Refactor deprecated macros.

Message ID 20190306102005.15413-6-claziss@gmail.com
State New
Headers show
Series Fix failing tests and use newer macros. | expand

Commit Message

Claudiu Zissulescu March 6, 2019, 10:20 a.m. UTC
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/arc-protos.h (arc_register_move_cost): Remove.
	* config/arc/arc.c (arc_register_move_cost): Re-purpose it to
	implement target hook.
	(arc_memory_move_cost): New function.
	(TARGET_REGISTER_MOVE_COST): Define.
	(TARGET_MEMORY_MOVE_COST): Likewise.
	* config/arc/arc.h (REGISTER_MOVE_COST): Remove.
	(MEMORY_MOVE_COST): Likewise.
---
 gcc/config/arc/arc-protos.h |  2 --
 gcc/config/arc/arc.c        | 26 ++++++++++++++++++++++++--
 gcc/config/arc/arc.h        | 11 -----------
 3 files changed, 24 insertions(+), 15 deletions(-)

Comments

Andrew Burgess March 16, 2019, 11:40 a.m. UTC | #1
* Claudiu Zissulescu <claziss@gmail.com> [2019-03-06 12:20:05 +0200]:

> xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>
> 
> 	* config/arc/arc-protos.h (arc_register_move_cost): Remove.
> 	* config/arc/arc.c (arc_register_move_cost): Re-purpose it to
> 	implement target hook.
> 	(arc_memory_move_cost): New function.
> 	(TARGET_REGISTER_MOVE_COST): Define.
> 	(TARGET_MEMORY_MOVE_COST): Likewise.
> 	* config/arc/arc.h (REGISTER_MOVE_COST): Remove.
> 	(MEMORY_MOVE_COST): Likewise.

This is fine.

Thanks,
Andrew
> ---
>  gcc/config/arc/arc-protos.h |  2 --
>  gcc/config/arc/arc.c        | 26 ++++++++++++++++++++++++--
>  gcc/config/arc/arc.h        | 11 -----------
>  3 files changed, 24 insertions(+), 15 deletions(-)
> 
> diff --git a/gcc/config/arc/arc-protos.h b/gcc/config/arc/arc-protos.h
> index 8f0f197f14a..ac0de6b2874 100644
> --- a/gcc/config/arc/arc-protos.h
> +++ b/gcc/config/arc/arc-protos.h
> @@ -68,8 +68,6 @@ extern bool arc_is_shortcall_p (rtx);
>  extern bool valid_brcc_with_delay_p (rtx *);
>  extern bool arc_ccfsm_cond_exec_p (void);
>  struct secondary_reload_info;
> -extern int arc_register_move_cost (machine_mode, enum reg_class,
> -				   enum reg_class);
>  extern rtx disi_highpart (rtx);
>  extern int arc_adjust_insn_length (rtx_insn *, int, bool);
>  extern int arc_corereg_hazard (rtx, rtx);
> diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> index a3a013e90e1..50977704c45 100644
> --- a/gcc/config/arc/arc.c
> +++ b/gcc/config/arc/arc.c
> @@ -8686,9 +8686,11 @@ arc_preserve_reload_p (rtx in)
>  	  && !((INTVAL (XEXP (in, 1)) & 511)));
>  }
>  
> -int
> +/* Implement TARGET_REGISTER_MOVE_COST.  */
> +
> +static int
>  arc_register_move_cost (machine_mode,
> -			enum reg_class from_class, enum reg_class to_class)
> +			reg_class_t from_class, reg_class_t to_class)
>  {
>    /* Force an attempt to 'mov Dy,Dx' to spill.  */
>    if ((TARGET_ARC700 || TARGET_EM) && TARGET_DPFP
> @@ -11428,6 +11430,20 @@ arc_adjust_reg_alloc_order (void)
>      memcpy (reg_alloc_order, size_alloc_order, sizeof (size_alloc_order));
>  }
>  
> +/* Implement TARGET_MEMORY_MOVE_COST.  */
> +
> +static int
> +arc_memory_move_cost (machine_mode mode,
> +		      reg_class_t rclass ATTRIBUTE_UNUSED,
> +		      bool in ATTRIBUTE_UNUSED)
> +{
> +  if ((GET_MODE_SIZE (mode) <= UNITS_PER_WORD)
> +      || ((GET_MODE_SIZE (mode) <= UNITS_PER_WORD * 2) && TARGET_LL64))
> +    return 6;
> +
> +  return (2 * GET_MODE_SIZE (mode));
> +}
> +
>  #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
>  #define TARGET_USE_ANCHORS_FOR_SYMBOL_P arc_use_anchors_for_symbol_p
>  
> @@ -11443,6 +11459,12 @@ arc_adjust_reg_alloc_order (void)
>  #undef TARGET_HAVE_SPECULATION_SAFE_VALUE
>  #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
>  
> +#undef TARGET_REGISTER_MOVE_COST
> +#define TARGET_REGISTER_MOVE_COST arc_register_move_cost
> +
> +#undef TARGET_MEMORY_MOVE_COST
> +#define TARGET_MEMORY_MOVE_COST arc_memory_move_cost
> +
>  struct gcc_target targetm = TARGET_INITIALIZER;
>  
>  #include "gt-arc.h"
> diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
> index 90420a9d474..46ca2dde413 100644
> --- a/gcc/config/arc/arc.h
> +++ b/gcc/config/arc/arc.h
> @@ -925,17 +925,6 @@ arc_select_cc_mode (OP, X, Y)
>  
>  /* Costs.  */
>  
> -/* Compute extra cost of moving data between one register class
> -   and another.  */
> -#define REGISTER_MOVE_COST(MODE, CLASS, TO_CLASS) \
> -   arc_register_move_cost ((MODE), (CLASS), (TO_CLASS))
> -
> -/* Compute the cost of moving data between registers and memory.  */
> -/* Memory is 3 times as expensive as registers.
> -   ??? Is that the right way to look at it?  */
> -#define MEMORY_MOVE_COST(MODE,CLASS,IN) \
> -(GET_MODE_SIZE (MODE) <= UNITS_PER_WORD ? 6 : 12)
> -
>  /* The cost of a branch insn.  */
>  /* ??? What's the right value here?  Branches are certainly more
>     expensive than reg->reg moves.  */
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/gcc/config/arc/arc-protos.h b/gcc/config/arc/arc-protos.h
index 8f0f197f14a..ac0de6b2874 100644
--- a/gcc/config/arc/arc-protos.h
+++ b/gcc/config/arc/arc-protos.h
@@ -68,8 +68,6 @@  extern bool arc_is_shortcall_p (rtx);
 extern bool valid_brcc_with_delay_p (rtx *);
 extern bool arc_ccfsm_cond_exec_p (void);
 struct secondary_reload_info;
-extern int arc_register_move_cost (machine_mode, enum reg_class,
-				   enum reg_class);
 extern rtx disi_highpart (rtx);
 extern int arc_adjust_insn_length (rtx_insn *, int, bool);
 extern int arc_corereg_hazard (rtx, rtx);
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index a3a013e90e1..50977704c45 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -8686,9 +8686,11 @@  arc_preserve_reload_p (rtx in)
 	  && !((INTVAL (XEXP (in, 1)) & 511)));
 }
 
-int
+/* Implement TARGET_REGISTER_MOVE_COST.  */
+
+static int
 arc_register_move_cost (machine_mode,
-			enum reg_class from_class, enum reg_class to_class)
+			reg_class_t from_class, reg_class_t to_class)
 {
   /* Force an attempt to 'mov Dy,Dx' to spill.  */
   if ((TARGET_ARC700 || TARGET_EM) && TARGET_DPFP
@@ -11428,6 +11430,20 @@  arc_adjust_reg_alloc_order (void)
     memcpy (reg_alloc_order, size_alloc_order, sizeof (size_alloc_order));
 }
 
+/* Implement TARGET_MEMORY_MOVE_COST.  */
+
+static int
+arc_memory_move_cost (machine_mode mode,
+		      reg_class_t rclass ATTRIBUTE_UNUSED,
+		      bool in ATTRIBUTE_UNUSED)
+{
+  if ((GET_MODE_SIZE (mode) <= UNITS_PER_WORD)
+      || ((GET_MODE_SIZE (mode) <= UNITS_PER_WORD * 2) && TARGET_LL64))
+    return 6;
+
+  return (2 * GET_MODE_SIZE (mode));
+}
+
 #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
 #define TARGET_USE_ANCHORS_FOR_SYMBOL_P arc_use_anchors_for_symbol_p
 
@@ -11443,6 +11459,12 @@  arc_adjust_reg_alloc_order (void)
 #undef TARGET_HAVE_SPECULATION_SAFE_VALUE
 #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
 
+#undef TARGET_REGISTER_MOVE_COST
+#define TARGET_REGISTER_MOVE_COST arc_register_move_cost
+
+#undef TARGET_MEMORY_MOVE_COST
+#define TARGET_MEMORY_MOVE_COST arc_memory_move_cost
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-arc.h"
diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index 90420a9d474..46ca2dde413 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -925,17 +925,6 @@  arc_select_cc_mode (OP, X, Y)
 
 /* Costs.  */
 
-/* Compute extra cost of moving data between one register class
-   and another.  */
-#define REGISTER_MOVE_COST(MODE, CLASS, TO_CLASS) \
-   arc_register_move_cost ((MODE), (CLASS), (TO_CLASS))
-
-/* Compute the cost of moving data between registers and memory.  */
-/* Memory is 3 times as expensive as registers.
-   ??? Is that the right way to look at it?  */
-#define MEMORY_MOVE_COST(MODE,CLASS,IN) \
-(GET_MODE_SIZE (MODE) <= UNITS_PER_WORD ? 6 : 12)
-
 /* The cost of a branch insn.  */
 /* ??? What's the right value here?  Branches are certainly more
    expensive than reg->reg moves.  */