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]

[crx] hookize FUNCTION_ARG &co.


The patch below hookizes FUNCTION_ARG and related macros for the crx
backend.  A small change for const-correctness, nothing unusual.

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

	* config/crx/crx-protos.h (crx_function_arg): Delete.
	(crx_function_arg_advance): Delete.
	* config/crx/crx.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete.
	* config/crx/crx.c (crx_function_arg): Make static.  Take a
	const_tree and a bool.
	(crx_function_arg_advance): Make static.  Take a const_tree and
	a bool.
	(enough_regs_for_param): Take a const_tree.
	(TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define.
---
 gcc/config/crx/crx-protos.h |    2 --
 gcc/config/crx/crx.c        |   30 ++++++++++++++++++++++--------
 gcc/config/crx/crx.h        |    6 ------
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/gcc/config/crx/crx-protos.h b/gcc/config/crx/crx-protos.h
index b35051d..208616d 100644
--- a/gcc/config/crx/crx-protos.h
+++ b/gcc/config/crx/crx-protos.h
@@ -32,10 +32,8 @@ extern enum reg_class crx_secondary_reload_class (enum reg_class, enum machine_m
 /* Passing function arguments.  */
 extern int crx_function_arg_regno_p (int);
 #ifdef TREE_CODE
-extern void crx_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
 #ifdef RTX_CODE
 extern void crx_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx);
-extern rtx crx_function_arg (struct cumulative_args *, enum machine_mode, tree, int);
 #endif /* RTX_CODE */
 #endif /* TREE_CODE */
 
diff --git a/gcc/config/crx/crx.c b/gcc/config/crx/crx.c
index 8ae552f..83e56b1 100644
--- a/gcc/config/crx/crx.c
+++ b/gcc/config/crx/crx.c
@@ -131,6 +131,10 @@ static int crx_address_cost (rtx, bool);
 static bool crx_legitimate_address_p (enum machine_mode, rtx, bool);
 static bool crx_can_eliminate (const int, const int);
 static void crx_option_optimization (int, int);
+static rtx crx_function_arg (CUMULATIVE_ARGS *, enum machine_mode,
+			     const_tree, bool);
+static void crx_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
+				      const_tree, bool);
 
 /*****************************************************************************/
 /* RTL VALIDITY								     */
@@ -156,6 +160,16 @@ static void crx_option_optimization (int, int);
 #define	TARGET_RETURN_IN_MEMORY		crx_return_in_memory
 
 /*****************************************************************************/
+/* PASSING FUNCTION ARGUMENTS						     */
+/*****************************************************************************/
+
+#undef  TARGET_FUNCTION_ARG
+#define TARGET_FUNCTION_ARG		crx_function_arg
+
+#undef  TARGET_FUNCTION_ARG_ADVANCE
+#define TARGET_FUNCTION_ARG_ADVANCE	crx_function_arg_advance
+
+/*****************************************************************************/
 /* RELATIVE COSTS OF OPERATIONS						     */
 /*****************************************************************************/
 
@@ -421,7 +435,7 @@ crx_hard_regno_mode_ok (int regno, enum machine_mode mode)
  * the number of registers needed else 0.  */
 
 static int
-enough_regs_for_param (CUMULATIVE_ARGS * cum, tree type,
+enough_regs_for_param (CUMULATIVE_ARGS * cum, const_tree type,
 		       enum machine_mode mode)
 {
   int type_size;
@@ -444,11 +458,11 @@ enough_regs_for_param (CUMULATIVE_ARGS * cum, tree type,
   return 0;
 }
 
-/* Implements the macro FUNCTION_ARG defined in crx.h.  */
+/* Implements TARGET_FUNCTION_ARG.  */
 
-rtx
-crx_function_arg (CUMULATIVE_ARGS * cum, enum machine_mode mode, tree type,
-	      int named ATTRIBUTE_UNUSED)
+static rtx
+crx_function_arg (CUMULATIVE_ARGS * cum, enum machine_mode mode,
+		  const_tree type, bool named ATTRIBUTE_UNUSED)
 {
   last_parm_in_reg = 0;
 
@@ -512,11 +526,11 @@ crx_init_cumulative_args (CUMULATIVE_ARGS * cum, tree fntype,
     }
 }
 
-/* Implements the macro FUNCTION_ARG_ADVANCE defined in crx.h.  */
+/* Implements the TARGET_FUNCTION_ARG_ADVANCE.  */
 
-void
+static void
 crx_function_arg_advance (CUMULATIVE_ARGS * cum, enum machine_mode mode,
-		      tree type, int named ATTRIBUTE_UNUSED)
+			  const_tree type, bool named ATTRIBUTE_UNUSED)
 {
   /* l holds the number of registers required */
   int l = GET_MODE_BITSIZE (mode) / BITS_PER_WORD;
diff --git a/gcc/config/crx/crx.h b/gcc/config/crx/crx.h
index d4bf274..7bc93e2 100644
--- a/gcc/config/crx/crx.h
+++ b/gcc/config/crx/crx.h
@@ -305,9 +305,6 @@ enum reg_class
 
 #define PUSH_ROUNDING(BYTES) (((BYTES) + 3) & ~3)
 
-#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
-  ((rtx) crx_function_arg(&(CUM), (MODE), (TYPE), (NAMED)))
-
 #ifndef CUMULATIVE_ARGS
 struct cumulative_args
 {
@@ -323,9 +320,6 @@ struct cumulative_args
 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
   crx_init_cumulative_args(&(CUM), (FNTYPE), (LIBNAME))
 
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
-  crx_function_arg_advance(&(CUM), (MODE), (TYPE), (NAMED))
-
 #define FUNCTION_ARG_REGNO_P(REGNO)  crx_function_arg_regno_p(REGNO)
 
 /*****************************************************************************/
-- 
1.7.0.4


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