Hello.

  This patch removes obsolete FUNCTION_VALUE, LIBCALL_VALUE and
FUNCTION_VALUE_REGNO_P macros from H8300 back end in the GCC and introduces
equivalent TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE and
TARGET_FUNCTION_VALUE_REGNO_P target hooks.

  Regression tested on h8300-unknown-elf with no new failure.

  OK to install? 

        * config/h8300/h8300.h (FUNCTION_VALUE_REGNO_P, FUNCTION_VALUE,
        LIBCALL_VALUE): Remove macros.
        * config/h8300/h8300.c (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE,
        TARGET_FUNCTION_VALUE_REGNO_P): Define.
        (h8300_function_value, h8300_libcall_value,
        h8300_function_value_regno_p): New functions

Index: gcc/config/h8300/h8300.c
===================================================================
--- gcc/config/h8300/h8300.c    (revision 171345)
+++ gcc/config/h8300/h8300.c    (working copy)
@@ -5860,6 +5860,38 @@
   set_optab_libfunc (umod_optab, HImode, "__umodhi3");
 }
 
+/* Worker function for TARGET_FUNCTION_VALUE.
+
+   On the H8 the return value is in R0/R1.  */
+
+static rtx
+h8300_function_value (const_tree ret_type,
+                     const_tree fn_decl_or_type ATTRIBUTE_UNUSED,
+                     bool outgoing ATTRIBUTE_UNUSED)
+{
+  return gen_rtx_REG (TYPE_MODE (ret_type), R0_REG);
+}
+
+/* Worker function for TARGET_LIBCALL_VALUE.
+
+   On the H8 the return value is in R0/R1.  */
+
+static rtx
+h8300_libcall_value (enum machine_mode mode, const_rtx fun ATTRIBUTE_UNUSED)
+{
+  return gen_rtx_REG (mode, R0_REG);
+}
+
+/* Worker function for TARGET_FUNCTION_VALUE_REGNO_P.
+
+   On the H8, R0 is the only register thus used.  */
+
+static bool
+h8300_function_value_regno_p (const unsigned int regno)
+{
+  return (regno == R0_REG);
+}
+
 /* Worker function for TARGET_RETURN_IN_MEMORY.  */
 
 static bool
@@ -5946,6 +5978,15 @@
 #undef TARGET_INIT_LIBFUNCS
 #define TARGET_INIT_LIBFUNCS h8300_init_libfuncs
 
+#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE h8300_function_value
+
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE h8300_libcall_value
+
+#undef TARGET_FUNCTION_VALUE_REGNO_P
+#define TARGET_FUNCTION_VALUE_REGNO_P h8300_function_value_regno_p
+
 #undef TARGET_RETURN_IN_MEMORY
 #define TARGET_RETURN_IN_MEMORY h8300_return_in_memory
 
Index: gcc/config/h8300/h8300.h
===================================================================
--- gcc/config/h8300/h8300.h    (revision 171345)
+++ gcc/config/h8300/h8300.h    (working copy)
@@ -527,29 +527,6 @@
 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)           \
   ((OFFSET) = h8300_initial_elimination_offset ((FROM), (TO)))
 
-/* Define how to find the value returned by a function.
-   VALTYPE is the data type of the value (as a tree).
-   If the precise function being called is known, FUNC is its FUNCTION_DECL;
-   otherwise, FUNC is 0.
-
-   On the H8 the return value is in R0/R1.  */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
-  gen_rtx_REG (TYPE_MODE (VALTYPE), R0_REG)
-
-/* Define how to find the value returned by a library function
-   assuming the value has mode MODE.  */
-
-/* On the H8 the return value is in R0/R1.  */
-
-#define LIBCALL_VALUE(MODE) \
-  gen_rtx_REG (MODE, R0_REG)
-
-/* 1 if N is a possible register number for a function value.
-   On the H8, R0 is the only register thus used.  */
-
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == R0_REG)
-
 /* Define this if PCC uses the nonreentrant convention for returning
    structure and union values.  */
 

Anatoly.

Reply via email to