Patchwork [h8300] Hookize FUNCTION_VALUE, LIBCALL_VALUE and FUNCTION_VALUE_REGNO_P

login
register
mail settings
Submitter Anatoly Sokolov
Date March 27, 2011, 8:07 p.m.
Message ID <5710086968.20110328000727@post.ru>
Download mbox | patch
Permalink /patch/88522/
State New
Headers show

Comments

Anatoly Sokolov - March 27, 2011, 8:07 p.m.
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


Anatoly.
Jeff Law - March 28, 2011, 2:33 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/27/11 14:07, Anatoly Sokolov wrote:
> 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
Ok.  Please install.

Thanks,
jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNkJxMAAoJEBRtltQi2kC7e5oH/jgU4PJeayoxR1tHTy/BVHpP
ZLW8RRw41eMKkDJ/+CBbahogosTBCYFiT13C1HM7g8h/zXICN8HT56YK1IDU8ZW3
hmaXYpTmecv31nBcoI/lFwtEhP0+bYzr/jbOL65dkklU+gGSS/PbqY82ejFgppfW
6U4K1sBE/dS322VMNLgYG6rKlnsz1EaX4MmV9m65zQf1U6r42HmC5Or7qsGlUYva
y2T2ZgvelXGWkKh1uhxJ0SJcdG1nozFHbPCk+0XmYoZlHFuXHvLFplSJ6KncRdCT
WvExwOVVEXpgqhZqhV6dnoGzopx6RAym8eh01n5bWhPHhQ+sB26UyWSs/QabYvw=
=ZBQi
-----END PGP SIGNATURE-----

Patch

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.  */