diff mbox

[arm] hookize FUNCTION_ARG &co.

Message ID 20100831164357.GA16898@codesourcery.com
State New
Headers show

Commit Message

Nathan Froyd Aug. 31, 2010, 4:43 p.m. UTC
This patch hookizes FUNCTION_ARG and related macros for the arm
backend.  There's the almost-standard assortment of const-ization hunks
scattered throughout.

Tested on arm-eabi, no new non-format related errors.  I plan to commit
this as obvious after waiting a week for comments.

-Nathan

	* config/arm/arm-protos.h (arm_function_arg_advance): Delete.
	(arm_function_arg): Delete.
	(arm_needs_doubleword_align): Take a const_tree.
	* config/arm/arm.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete.
	* config/arm/arm.c (aapcs_select_call_coproc): Take a const_tree.
	(aapcs_layout_arg, arm_needs_doubleword_align): Likewise.
	(arm_function_arg): Make static.  Take a const_tree and a bool.
	(arm_function_arg_advance): Likewise.
	(TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define.

Comments

Richard Earnshaw Aug. 31, 2010, 4:53 p.m. UTC | #1
On Tue, 2010-08-31 at 09:43 -0700, Nathan Froyd wrote:
> This patch hookizes FUNCTION_ARG and related macros for the arm
> backend.  There's the almost-standard assortment of const-ization hunks
> scattered throughout.
> 
> Tested on arm-eabi, no new non-format related errors.  I plan to commit
> this as obvious after waiting a week for comments.
> 
> -Nathan
> 
> 	* config/arm/arm-protos.h (arm_function_arg_advance): Delete.
> 	(arm_function_arg): Delete.
> 	(arm_needs_doubleword_align): Take a const_tree.
> 	* config/arm/arm.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete.
> 	* config/arm/arm.c (aapcs_select_call_coproc): Take a const_tree.
> 	(aapcs_layout_arg, arm_needs_doubleword_align): Likewise.
> 	(arm_function_arg): Make static.  Take a const_tree and a bool.
> 	(arm_function_arg_advance): Likewise.
> 	(TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define.

This is OK, provided it's been checked for warnings (or I'll have the
native bootstrap people on my back again...).

R.
diff mbox

Patch

diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
index cd29ef1..79c11e2 100644
--- a/gcc/config/arm/arm-protos.h
+++ b/gcc/config/arm/arm-protos.h
@@ -153,13 +153,10 @@  extern unsigned int arm_sync_loop_insns (rtx , rtx *);
 extern bool arm_output_addr_const_extra (FILE *, rtx);
 
 #if defined TREE_CODE
-extern rtx arm_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
-extern void arm_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
-				      tree, bool);
 extern void arm_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree);
 extern bool arm_pad_arg_upward (enum machine_mode, const_tree);
 extern bool arm_pad_reg_upward (enum machine_mode, tree, int);
-extern bool arm_needs_doubleword_align (enum machine_mode, tree);
+extern bool arm_needs_doubleword_align (enum machine_mode, const_tree);
 #endif
 extern int arm_apply_result_size (void);
 extern rtx aapcs_libcall_value (enum machine_mode);
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 5ed16a8..203404f 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -164,6 +164,10 @@  static void emit_constant_insn (rtx cond, rtx pattern);
 static rtx emit_set_insn (rtx, rtx);
 static int arm_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
 				  tree, bool);
+static rtx arm_function_arg (CUMULATIVE_ARGS *, enum machine_mode,
+			     const_tree, bool);
+static void arm_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
+				      const_tree, bool);
 static rtx aapcs_allocate_return_reg (enum machine_mode, const_tree,
 				      const_tree);
 static int aapcs_select_return_coproc (const_tree, const_tree);
@@ -377,6 +381,10 @@  static const struct attribute_spec arm_attribute_table[] =
 #define TARGET_PASS_BY_REFERENCE arm_pass_by_reference
 #undef TARGET_ARG_PARTIAL_BYTES
 #define TARGET_ARG_PARTIAL_BYTES arm_arg_partial_bytes
+#undef TARGET_FUNCTION_ARG
+#define TARGET_FUNCTION_ARG arm_function_arg
+#undef TARGET_FUNCTION_ARG_ADVANCE
+#define TARGET_FUNCTION_ARG_ADVANCE arm_function_arg_advance
 
 #undef  TARGET_SETUP_INCOMING_VARARGS
 #define TARGET_SETUP_INCOMING_VARARGS arm_setup_incoming_varargs
@@ -4181,7 +4189,7 @@  static struct
 
 static int
 aapcs_select_call_coproc (CUMULATIVE_ARGS *pcum, enum machine_mode mode, 
-			  tree type)
+			  const_tree type)
 {
   int i;
 
@@ -4293,7 +4301,7 @@  aapcs_libcall_value (enum machine_mode mode)
    numbers referred to here are those in the AAPCS.  */
 static void
 aapcs_layout_arg (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
-		  tree type, int named)
+		  const_tree type, bool named)
 {
   int nregs, nregs2;
   int ncrn;
@@ -4458,7 +4466,7 @@  arm_init_cumulative_args (CUMULATIVE_ARGS *pcum, tree fntype,
 
 /* Return true if mode/type need doubleword alignment.  */
 bool
-arm_needs_doubleword_align (enum machine_mode mode, tree type)
+arm_needs_doubleword_align (enum machine_mode mode, const_tree type)
 {
   return (GET_MODE_ALIGNMENT (mode) > PARM_BOUNDARY
 	  || (type && TYPE_ALIGN (type) > PARM_BOUNDARY));
@@ -4476,11 +4484,17 @@  arm_needs_doubleword_align (enum machine_mode mode, tree type)
    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).  */
+    (otherwise it is an extra parameter matching an ellipsis).
 
-rtx
+   On the ARM, normally the first 16 bytes are passed in registers r0-r3; all
+   other arguments are passed on the stack.  If (NAMED == 0) (which happens
+   only in assign_parms, since TARGET_SETUP_INCOMING_VARARGS is
+   defined), say it is passed in the stack (function_prologue will
+   indeed make it pass in the stack if necessary).  */
+
+static rtx
 arm_function_arg (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
-		  tree type, int named)
+		  const_tree type, bool named)
 {
   int nregs;
 
@@ -4553,9 +4567,13 @@  arm_arg_partial_bytes (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
   return 0;
 }
 
-void
+/* Update the data in PCUM 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
 arm_function_arg_advance (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
-			  tree type, bool named)
+			  const_tree type, bool named)
 {
   if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
     {
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 9730417..5b66510 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1737,27 +1737,6 @@  typedef struct
   MACHMODE aapcs_vfp_rmode;
 } CUMULATIVE_ARGS;
 
-/* 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).
-
-   On the ARM, normally the first 16 bytes are passed in registers r0-r3; all
-   other arguments are passed on the stack.  If (NAMED == 0) (which happens
-   only in assign_parms, since TARGET_SETUP_INCOMING_VARARGS is
-   defined), say it is passed in the stack (function_prologue will
-   indeed make it pass in the stack if necessary).  */
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-  arm_function_arg (&(CUM), (MODE), (TYPE), (NAMED))
-
 #define FUNCTION_ARG_PADDING(MODE, TYPE) \
   (arm_pad_arg_upward (MODE, TYPE) ? upward : downward)
 
@@ -1776,12 +1755,6 @@  typedef struct
 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
   arm_init_cumulative_args (&(CUM), (FNTYPE), (LIBNAME), (FNDECL))
 
-/* 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)	\
-  arm_function_arg_advance (&(CUM), (MODE), (TYPE), (NAMED))
-
 /* If defined, a C expression that gives the alignment boundary, in bits, of an
    argument with the specified mode and type.  If it is not defined,
    `PARM_BOUNDARY' is used for all arguments.  */