[mn10300] hookize FUNCTION_ARG &co.

Nathan Froyd froydnj@codesourcery.com
Fri Oct 8 13:59:00 GMT 2010


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

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

	* config/mn10300/mn10300-protos.h (function_arg): Delete.
	* config/mn10300/mn10300.h (FUNCTION_ARG): Delete.
	(FUNCTION_ARG_ADVANCE): Delete.
	* config/mn10300/mn10300.c (function_arg): Rename to...
	(mn10300_function_arg): ...this.  Make static.  Take a const_tree
	and a bool.
	(mn10300_function_arg_advance): New function.
	(TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define.
---
 gcc/config/mn10300/mn10300-protos.h |    5 -----
 gcc/config/mn10300/mn10300.c        |   27 ++++++++++++++++++++++++---
 gcc/config/mn10300/mn10300.h        |   25 -------------------------
 3 files changed, 24 insertions(+), 33 deletions(-)

diff --git a/gcc/config/mn10300/mn10300-protos.h b/gcc/config/mn10300/mn10300-protos.h
index 02a7942..6300ca6 100644
--- a/gcc/config/mn10300/mn10300-protos.h
+++ b/gcc/config/mn10300/mn10300-protos.h
@@ -41,11 +41,6 @@ extern bool mn10300_wide_const_load_uses_clr (rtx operands[2]);
 extern bool mn10300_function_value_regno_p (const unsigned int);
 #endif /* RTX_CODE */
 
-#ifdef TREE_CODE
-extern struct rtx_def *function_arg (CUMULATIVE_ARGS *,
-				     enum machine_mode, tree, int);
-#endif /* TREE_CODE */
-
 extern void expand_prologue (void);
 extern void expand_epilogue (void);
 extern int initial_offset (int, int);
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index 47e5293..d3d359e 100644
--- a/gcc/config/mn10300/mn10300.c
+++ b/gcc/config/mn10300/mn10300.c
@@ -83,6 +83,10 @@ static bool mn10300_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
 				       const_tree, bool);
 static int mn10300_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
 				      tree, bool);
+static rtx mn10300_function_arg (CUMULATIVE_ARGS *, enum machine_mode,
+				 const_tree, bool);
+static void mn10300_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
+					  const_tree, bool);
 static unsigned int mn10300_case_values_threshold (void);
 static void mn10300_encode_section_info (tree, rtx, int);
 static void mn10300_asm_trampoline_template (FILE *);
@@ -132,6 +136,10 @@ static bool mn10300_can_output_mi_thunk (const_tree, HOST_WIDE_INT, HOST_WIDE_IN
 #define TARGET_CALLEE_COPIES hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true
 #undef TARGET_ARG_PARTIAL_BYTES
 #define TARGET_ARG_PARTIAL_BYTES mn10300_arg_partial_bytes
+#undef TARGET_FUNCTION_ARG
+#define TARGET_FUNCTION_ARG mn10300_function_arg
+#undef TARGET_FUNCTION_ARG_ADVANCE
+#define TARGET_FUNCTION_ARG_ADVANCE mn10300_function_arg_advance
 
 #undef TARGET_EXPAND_BUILTIN_SAVEREGS
 #define TARGET_EXPAND_BUILTIN_SAVEREGS mn10300_builtin_saveregs
@@ -1559,9 +1567,9 @@ mn10300_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
 /* Return an RTX to represent where a value with mode MODE will be returned
    from a function.  If the result is NULL_RTX, the argument is pushed.  */
 
-rtx
-function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
-	      tree type, int named ATTRIBUTE_UNUSED)
+static rtx
+mn10300_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+		      const_tree type, bool named ATTRIBUTE_UNUSED)
 {
   rtx result = NULL_RTX;
   int size, align;
@@ -1606,6 +1614,19 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
   return result;
 }
 
+/* Update the data in CUM to advance over an argument
+   of mode MODE and data type TYPE.
+   (TYPE is null for libcalls where that information may not be available.)  */
+
+static void
+mn10300_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+			      const_tree type, bool named ATTRIBUTE_UNUSED)
+{
+  cum->nbytes += (mode != BLKmode
+		  ? (GET_MODE_SIZE (mode) + 3) & ~3
+		  : (int_size_in_bytes (type) + 3) & ~3);
+}
+
 /* Return the number of bytes of registers to use for an argument passed
    partially in registers and partially in memory.  */
 
diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h
index 26990ad..1de5e0e 100644
--- a/gcc/config/mn10300/mn10300.h
+++ b/gcc/config/mn10300/mn10300.h
@@ -528,31 +528,6 @@ struct cum_arg {int nbytes; };
 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
  ((CUM).nbytes = 0)
 
-/* Update the data in CUM to advance over an argument
-   of mode MODE and data type TYPE.
-   (TYPE is null for libcalls where that information may not be available.)  */
-
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)	\
- ((CUM).nbytes += ((MODE) != BLKmode			\
-	           ? (GET_MODE_SIZE (MODE) + 3) & ~3	\
-	           : (int_size_in_bytes (TYPE) + 3) & ~3))
-
-/* Define where to put the arguments to a function.
-   Value is zero to push the argument on the stack,
-   or a hard register in which to store the argument.
-
-   MODE is the argument's machine mode.
-   TYPE is the data type of the argument (as a tree).
-    This is null for libcalls where that information may
-    not be available.
-   CUM is a variable of type CUMULATIVE_ARGS which gives info about
-    the preceding args and about the function being called.
-   NAMED is nonzero if this argument is a named parameter
-    (otherwise it is an extra parameter matching an ellipsis).  */
-
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-  function_arg (&CUM, MODE, TYPE, NAMED)
-
 #define FUNCTION_VALUE_REGNO_P(N)  mn10300_function_value_regno_p (N)
 
 #define DEFAULT_PCC_STRUCT_RETURN 0
-- 
1.7.0.4



More information about the Gcc-patches mailing list