From a7ed00da0403250b2a2c3536cad7a0e1fa6d7729 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu@cs.umass.edu>
Date: Thu, 29 Jan 2004 02:06:02 +0000
Subject: [PATCH] m32r-protos.h: Remove the prototype for
 m32r_setup_incoming_varargs.

	* config/m32r/m32r-protos.h: Remove the prototype for
	m32r_setup_incoming_varargs.
	* config/m32r/m32r.c (TARGET_PROMOTE_PROTOTYPES): New.
	(TARGET_STRUCT_VALUE_RTX): Likewise.
	(TARGET_RETURN_IN_MEMORY): Likewise.
	(TARGET_SETUP_INCOMING_VARARGS): Likewise.
	(m32r_return_in_memory): New.
	(m32r_setup_incoming_varargs): Make it static.
	* config/m32r/m32r.h: Remove #undef of
	ASM_OUTPUT_EXTERNAL_LIBCALL.  Remove the commented-out
	definitions of PROMOTE_FUNCTION_ARGS and
	PROMOTE_FUNCTION_RETURN.
	(PROMOTE_PROTOTYPES): Remove.
	(RETURN_IN_MEMORY): Likewise.
	(STRUCT_VALUE): Likewise.

From-SVN: r76834
---
 gcc/ChangeLog                 | 18 ++++++++++++
 gcc/config/m32r/m32r-protos.h |  4 +--
 gcc/config/m32r/m32r.c        | 26 +++++++++++++++--
 gcc/config/m32r/m32r.h        | 54 -----------------------------------
 4 files changed, 44 insertions(+), 58 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e49812ab305c..6cdcc3611f13 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,21 @@
+2004-01-28  Kazu Hirata  <kazu@cs.umass.edu>
+
+	* config/m32r/m32r-protos.h: Remove the prototype for
+	m32r_setup_incoming_varargs.
+	* config/m32r/m32r.c (TARGET_PROMOTE_PROTOTYPES): New.
+	(TARGET_STRUCT_VALUE_RTX): Likewise.
+	(TARGET_RETURN_IN_MEMORY): Likewise.
+	(TARGET_SETUP_INCOMING_VARARGS): Likewise.
+	(m32r_return_in_memory): New.
+	(m32r_setup_incoming_varargs): Make it static.
+	* config/m32r/m32r.h: Remove #undef of
+	ASM_OUTPUT_EXTERNAL_LIBCALL.  Remove the commented-out
+	definitions of PROMOTE_FUNCTION_ARGS and
+	PROMOTE_FUNCTION_RETURN.
+	(PROMOTE_PROTOTYPES): Remove.
+	(RETURN_IN_MEMORY): Likewise.
+	(STRUCT_VALUE): Likewise.
+
 2004-01-28  Kazu Hirata  <kazu@cs.umass.edu>
 
 	* config/m68k/m68k.c (TARGET_PROMOTE_PROTOTYPES): New.
diff --git a/gcc/config/m32r/m32r-protos.h b/gcc/config/m32r/m32r-protos.h
index 01bbd6d58357..97247d63143d 100644
--- a/gcc/config/m32r/m32r-protos.h
+++ b/gcc/config/m32r/m32r-protos.h
@@ -1,5 +1,6 @@
 /* Prototypes for m32r.c functions used in the md file & elsewhere.
-   Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+   Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -36,7 +37,6 @@ extern void   m32r_load_pic_register (void);
 extern enum m32r_function_type m32r_compute_function_type (tree);
 
 #ifdef HAVE_MACHINE_MODES
-extern void   m32r_setup_incoming_varargs (CUMULATIVE_ARGS *, Mmode, tree, int *, int);
 extern int    function_arg_partial_nregs (CUMULATIVE_ARGS *, Mmode, tree, int);
 #endif
 #endif /* TREE_CODE */
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c
index ce9abebc2c88..932c54eef781 100644
--- a/gcc/config/m32r/m32r.c
+++ b/gcc/config/m32r/m32r.c
@@ -1,5 +1,5 @@
 /* Subroutines used for code generation on the Renesas M32R cpu.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
 
    This file is part of GCC.
@@ -101,6 +101,9 @@ static int    m32r_issue_rate (void);
 
 static void m32r_encode_section_info (tree, rtx, int);
 static bool m32r_in_small_data_p (tree);
+static bool m32r_return_in_memory (tree, tree);
+static void m32r_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
+					 tree, int *, int);
 static void init_idents (void);
 static bool m32r_rtx_costs (rtx, int, int, int *);
 
@@ -144,6 +147,17 @@ static bool m32r_rtx_costs (rtx, int, int, int *);
 #undef  TARGET_ADDRESS_COST
 #define TARGET_ADDRESS_COST hook_int_rtx_0
 
+#undef  TARGET_PROMOTE_PROTOTYPES
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+
+#undef  TARGET_STRUCT_VALUE_RTX
+#define TARGET_STRUCT_VALUE_RTX hook_rtx_tree_int_null
+#undef  TARGET_RETURN_IN_MEMORY
+#define TARGET_RETURN_IN_MEMORY m32r_return_in_memory
+
+#undef  TARGET_SETUP_INCOMING_VARARGS
+#define TARGET_SETUP_INCOMING_VARARGS m32r_setup_incoming_varargs
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Called by OVERRIDE_OPTIONS to initialize various things.  */
@@ -1348,6 +1362,14 @@ function_arg_partial_nregs (CUMULATIVE_ARGS *cum, enum machine_mode mode,
   return ret;
 }
 
+/* Worker function for TARGET_RETURN_IN_MEMORY.  */
+
+static bool
+m32r_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+{
+  return m32r_pass_by_reference (type);
+}
+
 /* Do any needed setup for a variadic function.  For the M32R, we must
    create a register parameter block, and then copy any anonymous arguments
    in registers to memory.
@@ -1355,7 +1377,7 @@ function_arg_partial_nregs (CUMULATIVE_ARGS *cum, enum machine_mode mode,
    CUM has not been updated for the last named argument which has type TYPE
    and mode MODE, and we rely on this fact.  */
 
-void
+static void
 m32r_setup_incoming_varargs (CUMULATIVE_ARGS *cum, enum machine_mode mode,
 			     tree type, int *pretend_size, int no_rtl)
 {
diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h
index 0cd80b206a89..6f4f5c91097d 100644
--- a/gcc/config/m32r/m32r.h
+++ b/gcc/config/m32r/m32r.h
@@ -30,7 +30,6 @@
 #undef PTRDIFF_TYPE
 #undef WCHAR_TYPE
 #undef WCHAR_TYPE_SIZE
-#undef ASM_OUTPUT_EXTERNAL_LIBCALL
 #undef TARGET_VERSION
 #undef CPP_SPEC
 #undef ASM_SPEC
@@ -500,15 +499,6 @@ extern enum m32r_sdata m32r_sdata;
       (MODE) = SImode;				\
     }
 
-/* Define this macro if the promotion described by `PROMOTE_MODE'
-   should also be done for outgoing function arguments.  */
-/*#define PROMOTE_FUNCTION_ARGS*/
-
-/* Likewise, if the function return value is promoted.
-   If defined, FUNCTION_VALUE must perform the same promotions done by
-   PROMOTE_MODE.  */
-/*#define PROMOTE_FUNCTION_RETURN*/
-
 /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
 #define PARM_BOUNDARY 32
 
@@ -1023,9 +1013,6 @@ extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
 
 /* Function argument passing.  */
 
-/* When a prototype says `char' or `short', really pass an `int'.  */
-#define PROMOTE_PROTOTYPES 1
-
 /* If defined, the maximum amount of space required for outgoing
    arguments will be computed and placed into the variable
    `current_function_outgoing_args_size'.  No space will be pushed
@@ -1150,36 +1137,6 @@ extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
    ? PARM_BOUNDARY : 2 * PARM_BOUNDARY)
 #endif
 
-/* This macro offers an alternative
-   to using `__builtin_saveregs' and defining the macro
-   `EXPAND_BUILTIN_SAVEREGS'.  Use it to store the anonymous register
-   arguments into the stack so that all the arguments appear to have
-   been passed consecutively on the stack.  Once this is done, you
-   can use the standard implementation of varargs that works for
-   machines that pass all their arguments on the stack.
-
-   The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure,
-   containing the values that obtain after processing of the named
-   arguments.  The arguments MODE and TYPE describe the last named
-   argument--its machine mode and its data type as a tree node.
-
-   The macro implementation should do two things: first, push onto the
-   stack all the argument registers *not* used for the named
-   arguments, and second, store the size of the data thus pushed into
-   the `int'-valued variable whose name is supplied as the argument
-   PRETEND_SIZE.  The value that you store here will serve as
-   additional offset for setting up the stack frame.
-
-   If the argument NO_RTL is nonzero, it means that the
-   arguments of the function are being analyzed for the second time.
-   This happens for an inline function, which is not actually
-   compiled until the end of the source file.  The macro
-   `SETUP_INCOMING_VARARGS' should not generate any instructions in
-   this case.  */
-
-#define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_SIZE, NO_RTL) \
-  m32r_setup_incoming_varargs (& ARGS_SO_FAR, MODE, TYPE, & PRETEND_SIZE, NO_RTL)
-
 /* Implement `va_arg'.  */
 #define EXPAND_BUILTIN_VA_ARG(valist, type) \
   m32r_va_arg (valist, type)
@@ -1201,19 +1158,8 @@ extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
 /* ??? What about r1 in DI/DF values.  */
 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
 
-/* A C expression which can inhibit the returning of certain function
-   values in registers, based on the type of value.  A nonzero value says
-   to return the function value in memory, just as large structures are
-   always returned.  Here TYPE will be a C expression of type `tree',
-   representing the data type of the value.  */
-#define RETURN_IN_MEMORY(TYPE) m32r_pass_by_reference (TYPE)
-
 /* Tell GCC to use RETURN_IN_MEMORY.  */
 #define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* Register in which address to store a structure value
-   is passed to a function, or 0 to use `invisible' first argument.  */
-#define STRUCT_VALUE 0
 
 /* Function entry and exit.  */
 
-- 
GitLab