[MMIX] Hookize FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE, LIBCALL_VALUE and FUNCTION_VALUE_REGNO_P

Anatoly Sokolov aesok@post.ru
Wed May 12 20:09:00 GMT 2010


Hi.

  This patch removes obsolete FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE,
LIBCALL_VALUE and FUNCTION_VALUE_REGNO_P macros from MMIX 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 mmix-knuth-mmixware.    OK to install?



        * config/mmix/mmix.h (FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE,
        LIBCALL_VALUE, FUNCTION_VALUE_REGNO_P): Remove macros.
        * config/mmix/mmix.c (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE,
        TARGET_FUNCTION_VALUE_REGNO_P): Define.
        (mmix_function_outgoing_value): Rename to...
        (mmix_function_value): ...this. Make static. Add 'outgoing' argument.
        (mmix_function_value_regno_p): Make static.
        (mmix_libcall_value): New function.
        * config/mmix/mmix-protos.h (mmix_function_outgoing_value,
        mmix_function_value_regno_p): Remove declaration.


Index: gcc/config/mmix/mmix.h
===================================================================
--- gcc/config/mmix/mmix.h      (revision 159339)
+++ gcc/config/mmix/mmix.h      (working copy)
@@ -613,22 +613,6 @@
  mmix_function_arg_regno_p (REGNO, 0)
 
 
-/* Node: Register Arguments */
-
-#define FUNCTION_VALUE(VALTYPE, FUNC)  \
- gen_rtx_REG (TYPE_MODE (VALTYPE), MMIX_RETURN_VALUE_REGNUM)
-
-/* This needs to take care of the register hole for complex return values.  */
-#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC)  \
- mmix_function_outgoing_value (VALTYPE, FUNC)
-
-#define LIBCALL_VALUE(MODE) \
- gen_rtx_REG (MODE, MMIX_RETURN_VALUE_REGNUM)
-
-#define FUNCTION_VALUE_REGNO_P(REGNO) \
- mmix_function_value_regno_p (REGNO)
-
-
 /* Node: Caller Saves */
 /* (empty) */
 
Index: gcc/config/mmix/mmix-protos.h
===================================================================
--- gcc/config/mmix/mmix-protos.h       (revision 159339)
+++ gcc/config/mmix/mmix-protos.h       (working copy)
@@ -52,8 +52,6 @@
 extern int mmix_dbx_register_number (int);
 extern int mmix_use_simple_return (void);
 extern void mmix_make_decl_one_only (tree);
-extern rtx mmix_function_outgoing_value (const_tree, const_tree);
-extern int mmix_function_value_regno_p (int);
 extern int mmix_data_alignment (tree, int);
 extern int mmix_constant_alignment (tree, int);
 extern int mmix_local_alignment (tree, int);
Index: gcc/config/mmix/mmix.c
===================================================================
--- gcc/config/mmix/mmix.c      (revision 159339)
+++ gcc/config/mmix/mmix.c      (working copy)
@@ -138,6 +138,9 @@
 static enum machine_mode mmix_promote_function_mode (const_tree,
                                                     enum machine_mode,
                                                     int *, const_tree, int);
+static rtx mmix_function_value (const_tree, const_tree, bool);
+static rtx mmix_libcall_value (enum machine_mode, const_rtx);
+static bool mmix_function_value_regno_p (const unsigned int);
 static bool mmix_pass_by_reference (CUMULATIVE_ARGS *,
                                    enum machine_mode, const_tree, bool);
 static bool mmix_frame_pointer_required (void);
@@ -196,6 +199,12 @@
 #undef TARGET_PROMOTE_FUNCTION_MODE
 #define TARGET_PROMOTE_FUNCTION_MODE mmix_promote_function_mode
 
+#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE mmix_function_value
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE mmix_libcall_value
+#undef TARGET_FUNCTION_VALUE_REGNO_P
+#define TARGET_FUNCTION_VALUE_REGNO_P mmix_function_value_regno_p
 
 #undef TARGET_STRUCT_VALUE_RTX
 #define TARGET_STRUCT_VALUE_RTX mmix_struct_value_rtx
@@ -654,10 +663,12 @@
     && regno < first_arg_regnum + MMIX_MAX_ARGS_IN_REGS;
 }
 
-/* FUNCTION_OUTGOING_VALUE.  */
+/* Implements TARGET_FUNCTION_VALUE.  */
 
-rtx
-mmix_function_outgoing_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED)
+static rtx
+mmix_function_value (const_tree valtype,
+                    const_tree func ATTRIBUTE_UNUSED,
+                    bool outgoing)
 {
   enum machine_mode mode = TYPE_MODE (valtype);
   enum machine_mode cmode;
@@ -666,6 +677,9 @@
   int i;
   int nregs;
 
+  if (!outgoing)
+    return gen_rtx_REG (mode, MMIX_RETURN_VALUE_REGNUM);
+  
   /* Return values that fit in a register need no special handling.
      There's no register hole when parameters are passed in global
      registers.  */
@@ -717,11 +731,20 @@
   return gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nregs, vec));
 }
 
-/* FUNCTION_VALUE_REGNO_P.  */
+/* Implements TARGET_LIBCALL_VALUE.  */
 
-int
-mmix_function_value_regno_p (int regno)
+static rtx
+mmix_libcall_value (enum machine_mode mode,
+                   const_rtx fun ATTRIBUTE_UNUSED)
 {
+  return gen_rtx_REG (mode, MMIX_RETURN_VALUE_REGNUM);
+}
+
+/* Implements TARGET_FUNCTION_VALUE_REGNO_P.  */
+
+static bool
+mmix_function_value_regno_p (const unsigned int regno)
+{
   return regno == MMIX_RETURN_VALUE_REGNUM;
 }
 

Anatoly.




More information about the Gcc-patches mailing list