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_ARG &co.


The patch below hookizes FUNCTION_ARG and related macros for the moxie
backend.  Nothing special here.

Tested by inspection with cross to moxie-elf.  I plan to commit this
under the obvious rule after waiting a week for comments/approval.

	* config/moxie/moxie-protos.h (moxie_function_arg): Delete.
	* config/moxie/moxie.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete.
	(MOXIE_FUNCTION_ARG_SIZE): Move to...
	* config/moxie/moxie.c (MOXIE_FUNCTION_ARG_SIZE): ...here.
	(moxie_function_arg): Make static.  Take a const_tree and a bool.
	(moxie_function_arg_advance): New function.
	(TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define.
---
 gcc/config/moxie/moxie-protos.h |    4 ----
 gcc/config/moxie/moxie.c        |   28 +++++++++++++++++++++++-----
 gcc/config/moxie/moxie.h        |   13 -------------
 3 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/gcc/config/moxie/moxie-protos.h b/gcc/config/moxie/moxie-protos.h
index 3c1027b..7d939f5 100644
--- a/gcc/config/moxie/moxie-protos.h
+++ b/gcc/config/moxie/moxie-protos.h
@@ -23,7 +23,3 @@ extern void  moxie_expand_epilogue (void);
 extern int   moxie_initial_elimination_offset (int, int);
 extern void  moxie_print_operand (FILE *, rtx, int);
 extern void  moxie_print_operand_address (FILE *, rtx);
-#ifdef RTX_CODE
-extern rtx   moxie_function_arg (CUMULATIVE_ARGS, 
-				 enum machine_mode, tree, int);
-#endif /* RTX_CODE */
diff --git a/gcc/config/moxie/moxie.c b/gcc/config/moxie/moxie.c
index cd2fb88..d2a6b66 100644
--- a/gcc/config/moxie/moxie.c
+++ b/gcc/config/moxie/moxie.c
@@ -409,16 +409,30 @@ moxie_fixed_condition_code_regs (unsigned int *p1, unsigned int *p2)
 /* Return the next register to be used to hold a function argument or
    NULL_RTX if there's no more space.  */
 
-rtx
-moxie_function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode,
-		    tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED)
+static rtx
+moxie_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+		    const_tree type ATTRIBUTE_UNUSED,
+		    bool named ATTRIBUTE_UNUSED)
 {
-  if (cum < 8)
-    return gen_rtx_REG (mode, cum);
+  if (*cum < 8)
+    return gen_rtx_REG (mode, *cum);
   else 
     return NULL_RTX;
 }
 
+#define MOXIE_FUNCTION_ARG_SIZE(MODE, TYPE)	\
+  ((MODE) != BLKmode ? GET_MODE_SIZE (MODE)	\
+   : (unsigned) int_size_in_bytes (TYPE))
+
+static void
+moxie_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+			    const_tree type, bool named ATTRIBUTE_UNUSED)
+{
+  *cum = (*cum < MOXIE_R6
+	  ? *cum + ((3 + MOXIE_FUNCTION_ARG_SIZE (mode, type)) / 4)
+	  : *cum);
+}
+
 /* Return non-zero if the function argument described by TYPE is to be
    passed by reference.  */
 
@@ -539,6 +553,10 @@ moxie_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
 #define TARGET_PASS_BY_REFERENCE        moxie_pass_by_reference
 #undef  TARGET_ARG_PARTIAL_BYTES
 #define TARGET_ARG_PARTIAL_BYTES        moxie_arg_partial_bytes
+#undef  TARGET_FUNCTION_ARG
+#define TARGET_FUNCTION_ARG		moxie_function_arg
+#undef  TARGET_FUNCTION_ARG_ADVANCE
+#define TARGET_FUNCTION_ARG_ADVANCE	moxie_function_arg_advance
 
 
 #undef  TARGET_SETUP_INCOMING_VARARGS
diff --git a/gcc/config/moxie/moxie.h b/gcc/config/moxie/moxie.h
index 1445202..04e535a 100644
--- a/gcc/config/moxie/moxie.h
+++ b/gcc/config/moxie/moxie.h
@@ -236,11 +236,6 @@ enum reg_class
 
 /* Passing Arguments in Registers */
 
-/* A C expression that controls whether a function argument is passed
-   in a register, and which register.  */
-#define FUNCTION_ARG(CUM,MODE,TYPE,NAMED) \
-  moxie_function_arg(CUM,MODE,TYPE,NAMED)
-
 /* A C type for declaring a variable that is used as the first
    argument of `FUNCTION_ARG' and other related values.  */
 #define CUMULATIVE_ARGS unsigned int
@@ -258,14 +253,6 @@ enum reg_class
 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,FNDECL,N_NAMED_ARGS) \
   (CUM = MOXIE_R0)
 
-#define MOXIE_FUNCTION_ARG_SIZE(MODE, TYPE)	\
-  ((MODE) != BLKmode ? GET_MODE_SIZE (MODE)	\
-   : (unsigned) int_size_in_bytes (TYPE))
-
-#define FUNCTION_ARG_ADVANCE(CUM,MODE,TYPE,NAMED) \
-  (CUM = (CUM < MOXIE_R6 ?                        \
-          CUM + ((3 + MOXIE_FUNCTION_ARG_SIZE(MODE,TYPE))/4) : CUM ))
-
 /* How Scalar Function Values Are Returned */
 
 /* STACK AND CALLING */
-- 
1.7.0.4


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