public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [M32R] Remove FUNCTION_VALUE and LIBCALL_VALUE macros.
@ 2009-11-05 22:32 Anatoly Sokolov
  2009-11-23 21:39 ` PING " Anatoly Sokolov
  0 siblings, 1 reply; 2+ messages in thread
From: Anatoly Sokolov @ 2009-11-05 22:32 UTC (permalink / raw)
  To: gcc-patches

Hello.

  This patch removes obsolete FUNCTION_VALUE and LIBCALL_VALUE macros from
m32r back end in the GCC and introduces equivalent TARGET_FUNCTION_VALUE and
TARGET_LIBCALL_VALUE target hooks. Also this patch convert
FUNCTION_VALUE_REGNO_P macro to m32r_function_value_regno_p function, this
should simplify hookize FUNCTION_VALUE_REGNO_P macro in the future.

  Regression tested on m32r-unknown-elf.

        * config/m32r/m32r.c (m32r_function_value, m32r_libcall_value,
        m32r_function_value_regno_p): New functions.
        (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE): Declare.
        * config/m32r/m32r.h: (FUNCTION_VALUE, LIBCALL_VALUE): Remove.
        (FUNCTION_VALUE_REGNO_P): Redefine, use m32r_function_value_regno_p.
        * config/m32r/m32r-protos.h (m32r_function_value_regno_p): Declare.


  OK to install?


Index: gcc/config/m32r/m32r.c
===================================================================
--- gcc/config/m32r/m32r.c      (revision 153951)
+++ gcc/config/m32r/m32r.c      (working copy)
@@ -78,6 +78,8 @@
 
 static void m32r_encode_section_info (tree, rtx, int);
 static bool m32r_in_small_data_p (const_tree);
+static rtx m32r_function_value (const_tree, const_tree, bool);
+static rtx m32r_libcall_value (enum machine_mode, const_rtx);
 static bool m32r_return_in_memory (const_tree, const_tree);
 static void m32r_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
                                         tree, int *, int);
@@ -142,6 +144,10 @@
 
 #undef  TARGET_PROMOTE_PROTOTYPES
 #define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
+#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE m32r_function_value
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE m32r_libcall_value
 #undef  TARGET_RETURN_IN_MEMORY
 #define TARGET_RETURN_IN_MEMORY m32r_return_in_memory
 #undef  TARGET_SETUP_INCOMING_VARARGS
@@ -1157,6 +1163,34 @@
   return words * UNITS_PER_WORD;
 }
 
+/* Worker function for TARGET_FUNCTION_VALUE.  */
+
+static rtx
+m32r_function_value (const_tree valtype,
+                    const_tree fn_decl_or_type ATTRIBUTE_UNUSED,
+                    bool outgoing ATTRIBUTE_UNUSED)
+{
+  return gen_rtx_REG (TYPE_MODE (valtype), 0);
+}
+
+/* Worker function for TARGET_LIBCALL_VALUE.  */
+
+static rtx
+m32r_libcall_value (enum machine_mode mode,
+                   const_rtx fun ATTRIBUTE_UNUSED)
+{
+  return gen_rtx_REG (mode, 0);
+}
+
+/* Worker function for FUNCTION_VALUE_REGNO_P.  */
+/* ??? What about r1 in DI/DF values.  */
+
+bool
+m32r_function_value_regno_p (const unsigned int regno)
+{
+  return (regno == 0);
+}
+
 /* Worker function for TARGET_RETURN_IN_MEMORY.  */
 
 static bool
@@ -911,21 +911,8 @@
 \f
 /* Function results.  */
 
-/* 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.  */
-#define FUNCTION_VALUE(VALTYPE, FUNC) gen_rtx_REG (TYPE_MODE (VALTYPE), 0)
+#define FUNCTION_VALUE_REGNO_P(N) m32r_function_value_regno_p (N)
 
-/* Define how to find the value returned by a library function
-   assuming the value has mode MODE.  */
-#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, 0)
-
-/* 1 if N is a possible register number for a function value
-   as seen by the caller.  */
-/* ??? What about r1 in DI/DF values.  */
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
-
 /* Tell GCC to use TARGET_RETURN_IN_MEMORY.  */
 #define DEFAULT_PCC_STRUCT_RETURN 0
 \f
Index: gcc/config/m32r/m32r-protos.h
===================================================================
--- gcc/config/m32r/m32r-protos.h       (revision 153951)
+++ gcc/config/m32r/m32r-protos.h       (working copy)
@@ -51,6 +51,7 @@
 extern rtx    m32r_legitimize_pic_address (rtx, rtx);
 extern rtx    m32r_return_addr (int);
 extern rtx    m32r_function_symbol (const char *);
+extern bool   m32r_function_value_regno_p (const unsigned int);
 
 #ifdef HAVE_MACHINE_MODES
 extern int    call_operand (rtx, Mmode);


Anatoly.

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

* PING [M32R] Remove FUNCTION_VALUE and LIBCALL_VALUE macros.
  2009-11-05 22:32 [M32R] Remove FUNCTION_VALUE and LIBCALL_VALUE macros Anatoly Sokolov
@ 2009-11-23 21:39 ` Anatoly Sokolov
  0 siblings, 0 replies; 2+ messages in thread
From: Anatoly Sokolov @ 2009-11-23 21:39 UTC (permalink / raw)
  To: gcc-patches

Hello.

>       * config/m32r/m32r.c (m32r_function_value, m32r_libcall_value,
>       m32r_function_value_regno_p): New functions.
>       (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE): Declare.
>       * config/m32r/m32r.h: (FUNCTION_VALUE, LIBCALL_VALUE): Remove.
>       (FUNCTION_VALUE_REGNO_P): Redefine, use m32r_function_value_regno_p.
>       * config/m32r/m32r-protos.h (m32r_function_value_regno_p): Declare.

http://gcc.gnu.org/ml/gcc-patches/2009-11/msg00303.html

Anatoly.


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

end of thread, other threads:[~2009-11-23 21:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-05 22:32 [M32R] Remove FUNCTION_VALUE and LIBCALL_VALUE macros Anatoly Sokolov
2009-11-23 21:39 ` PING " Anatoly Sokolov

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