This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[MOXIE] Hookize FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE, LIBCALL_VALUE and FUNCTION_VALUE_REGNO_P


Hi.

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

  Regression tested moxie-unknown-elf.

  OK to install?

        * config/moxie/moxie.h (FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE,
        LIBCALL_VALUE, FUNCTION_VALUE_REGNO_P): Remove macros.
        * config/moxie/moxie-protos.h (moxie_function_value): Remove.
        * config/moxie/moxie.c (moxie_function_value): Make static.
        (moxie_libcall_value, moxie_function_value_regno_p): New functions.
        (TARGET_LIBCALL_VALUE, TARGET_FUNCTION_VALUE_REGNO_P): Define.

        
Index: gcc/config/moxie/moxie.c
===================================================================
--- gcc/config/moxie/moxie.c    (revision 159891)
+++ gcc/config/moxie/moxie.c    (working copy)
@@ -70,7 +70,7 @@
 
    We always return values in register $r0 for moxie.  */
 
-rtx
+static rtx
 moxie_function_value (const_tree valtype, 
                      const_tree fntype_or_decl ATTRIBUTE_UNUSED,
                      bool outgoing ATTRIBUTE_UNUSED)
@@ -78,6 +78,27 @@
   return gen_rtx_REG (TYPE_MODE (valtype), MOXIE_R0);
 }
 
+/* Define how to find the value returned by a library function.
+
+   We always return values in register $r0 for moxie.  */
+
+static rtx
+moxie_libcall_value (enum machine_mode mode,
+                     const_rtx fun ATTRIBUTE_UNUSED)
+{
+  return gen_rtx_REG (mode, MOXIE_R0);
+}
+
+/* Handle TARGET_FUNCTION_VALUE_REGNO_P.
+
+   We always return values in register $r0 for moxie.  */
+
+static bool
+moxie_function_value_regno_p (const unsigned int regno)
+{
+  return (regno == MOXIE_R0);
+}
+
 /* Emit an error message when we're in an asm, and a fatal error for
    "normal" insns.  Formatted output isn't easily implemented, since we
    use output_operand_lossage to output the actual message and handle the
@@ -530,6 +551,10 @@
    node node representing a data type.  */
 #undef TARGET_FUNCTION_VALUE
 #define TARGET_FUNCTION_VALUE moxie_function_value
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE moxie_libcall_value
+#undef TARGET_FUNCTION_VALUE_REGNO_P
+#define TARGET_FUNCTION_VALUE_REGNO_P moxie_function_value_regno_p
 
 #undef TARGET_FRAME_POINTER_REQUIRED
 #define TARGET_FRAME_POINTER_REQUIRED hook_bool_void_true
Index: gcc/config/moxie/moxie.h
===================================================================
--- gcc/config/moxie/moxie.h    (revision 159891)
+++ gcc/config/moxie/moxie.h    (working copy)
@@ -268,18 +268,6 @@
 
 /* How Scalar Function Values Are Returned */
 
-/* These macros are deprecated, but we still need them for now since
-   the version of gcc we're using doesn't fully support
-   TARGET_FUNCTION_VALUE.  */
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
-  moxie_function_value (VALTYPE, FUNC, 0)
-#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
-  moxie_function_value (VALTYPE, FUNC, 1)
-
-/* A C expression to create an RTX representing the place where a
-   library function returns a value of mode MODE.  */
-#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, 2)
-
 /* STACK AND CALLING */
 
 /* Define this macro if pushing a word onto the stack moves the stack
@@ -429,10 +417,6 @@
    register in which function arguments are sometimes passed.  */
 #define FUNCTION_ARG_REGNO_P(r) (r >= MOXIE_R0 && r <= MOXIE_R5)
 
-/* A C expression that is nonzero if REGNO is the number of a hard
-   register in which the values of called function may come back.  */
-#define FUNCTION_VALUE_REGNO_P(r) (r == MOXIE_R0)
-
 /* A macro whose definition is the name of the class to which a valid
    base register must belong.  A base register is one used in an
    address which is the register value plus a displacement.  */
Index: gcc/config/moxie/moxie-protos.h
===================================================================
--- gcc/config/moxie/moxie-protos.h     (revision 159891)
+++ gcc/config/moxie/moxie-protos.h     (working copy)
@@ -21,8 +21,6 @@
 extern void  moxie_expand_prologue (void);
 extern void  moxie_expand_epilogue (void);
 extern int   moxie_initial_elimination_offset (int, int);
-extern rtx   moxie_function_value (const_tree, const_tree, 
-                                  bool ATTRIBUTE_UNUSED);
 extern void  moxie_print_operand (FILE *, rtx, int);
 extern void  moxie_print_operand_address (FILE *, rtx);
 #ifdef RTX_CODE


Anatoly.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]