Commit 558d352a by Kazu Hirata Committed by Kazu Hirata

cris.c (TARGET_SETUP_INCOMING_VARARGS): New.

	* config/cris/cris.c (TARGET_SETUP_INCOMING_VARARGS): New.
	(cris_setup_incoming_varargs): Likewise.
	* config/cris/cris.h (SETUP_INCOMING_VARARGS): Remove.

From-SVN: r76640
parent 044701ce
2004-01-26 Kazu Hirata <kazu@cs.umass.edu> 2004-01-26 Kazu Hirata <kazu@cs.umass.edu>
* config/cris/cris.c (TARGET_SETUP_INCOMING_VARARGS): New.
(cris_setup_incoming_varargs): Likewise.
* config/cris/cris.h (SETUP_INCOMING_VARARGS): Remove.
2004-01-26 Kazu Hirata <kazu@cs.umass.edu>
* config/ns32k/ns32k.c (TARGET_STRUCT_VALUE_RTX): New. * config/ns32k/ns32k.c (TARGET_STRUCT_VALUE_RTX): New.
(ns32k_struct_value_rtx): Likewise. (ns32k_struct_value_rtx): Likewise.
* config/ns32k/ns32k.h (STRUCT_VALUE_REGNUM): Rename to * config/ns32k/ns32k.h (STRUCT_VALUE_REGNUM): Rename to
......
...@@ -94,6 +94,9 @@ static struct machine_function * cris_init_machine_status (void); ...@@ -94,6 +94,9 @@ static struct machine_function * cris_init_machine_status (void);
static rtx cris_struct_value_rtx (tree, int); static rtx cris_struct_value_rtx (tree, int);
static void cris_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
tree type, int *, int);
static int cris_initial_frame_pointer_offset (void); static int cris_initial_frame_pointer_offset (void);
static int saved_regs_mentioned (rtx); static int saved_regs_mentioned (rtx);
...@@ -184,6 +187,9 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION; ...@@ -184,6 +187,9 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION;
#undef TARGET_STRUCT_VALUE_RTX #undef TARGET_STRUCT_VALUE_RTX
#define TARGET_STRUCT_VALUE_RTX cris_struct_value_rtx #define TARGET_STRUCT_VALUE_RTX cris_struct_value_rtx
#undef TARGET_SETUP_INCOMING_VARARGS
#define TARGET_SETUP_INCOMING_VARARGS cris_setup_incoming_varargs
struct gcc_target targetm = TARGET_INITIALIZER; struct gcc_target targetm = TARGET_INITIALIZER;
/* Predicate functions. */ /* Predicate functions. */
...@@ -3194,6 +3200,25 @@ cris_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED, ...@@ -3194,6 +3200,25 @@ cris_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
return gen_rtx_REG (Pmode, CRIS_STRUCT_VALUE_REGNUM); return gen_rtx_REG (Pmode, CRIS_STRUCT_VALUE_REGNUM);
} }
/* Worker function for TARGET_SETUP_INCOMING_VARARGS. */
static void
cris_setup_incoming_varargs (CUMULATIVE_ARGS *ca,
enum machine_mode mode ATTRIBUTE_UNUSED,
tree type ATTRIBUTE_UNUSED,
int *pretend_arg_size,
int second_time)
{
if (ca->regs < CRIS_MAX_ARGS_IN_REGS)
*pretend_arg_size = (CRIS_MAX_ARGS_IN_REGS - ca->regs) * 4;
if (TARGET_PDEBUG)
{
fprintf (asm_out_file,
"\n; VA:: ANSI: %d args before, anon @ #%d, %dtime\n",
ca->regs, *pretend_arg_size, second_time);
}
}
#if 0 #if 0
/* Various small functions to replace macros. Only called from a /* Various small functions to replace macros. Only called from a
debugger. They might collide with gcc functions or system functions, debugger. They might collide with gcc functions or system functions,
......
...@@ -1022,28 +1022,6 @@ struct cum_args {int regs;}; ...@@ -1022,28 +1022,6 @@ struct cum_args {int regs;};
/* Node: Varargs */ /* Node: Varargs */
/* We save the register number of the first anonymous argument in
first_vararg_reg, and take care of this in the function prologue.
This behavior is used by at least one more port (the ARM?), but
may be unsafe when compiling nested functions. (With varargs? Hairy.)
Note that nested-functions is a GNU C extension.
FIXME: We can actually put the size in PRETEND and deduce the number
of registers from it in the prologue and epilogue. */
#define SETUP_INCOMING_VARARGS(ARGSSF, MODE, TYPE, PRETEND, SECOND) \
do \
{ \
if ((ARGSSF).regs < (CRIS_MAX_ARGS_IN_REGS)) \
(PRETEND) = ((CRIS_MAX_ARGS_IN_REGS) - (ARGSSF).regs) * 4; \
if (TARGET_PDEBUG) \
{ \
fprintf (asm_out_file, \
"\n; VA:: ANSI: %d args before, anon @ #%d, %dtime\n", \
(ARGSSF).regs, PRETEND, SECOND); \
} \
} \
while (0)
/* FIXME: This and other EXPAND_BUILTIN_VA_... target macros are not /* FIXME: This and other EXPAND_BUILTIN_VA_... target macros are not
documented, although used by several targets. */ documented, although used by several targets. */
#define EXPAND_BUILTIN_VA_ARG(VALIST, TYPE) \ #define EXPAND_BUILTIN_VA_ARG(VALIST, TYPE) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment