[patch] cris: Hookize SETUP_INCOMING_VARARGS.
Kazu Hirata
kazu@cs.umass.edu
Sun Jan 25 05:23:00 GMT 2004
Hi,
Attached is a patch to hookize SETUP_INCOMING_VARARGS, which I forgot
to take care of last time.
Built cc1 of cris-elf. OK to apply?
Kazu Hirata
2004-01-24 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.
Index: cris.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/cris/cris.c,v
retrieving revision 1.48
diff -u -r1.48 cris.c
--- cris.c 24 Jan 2004 22:27:20 -0000 1.48
+++ cris.c 25 Jan 2004 04:53:01 -0000
@@ -94,6 +94,9 @@
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 saved_regs_mentioned (rtx);
@@ -184,6 +187,9 @@
#undef TARGET_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;
/* Predicate functions. */
@@ -3192,6 +3198,34 @@
int incoming ATTRIBUTE_UNUSED)
{
return gen_rtx_REG (Pmode, CRIS_STRUCT_VALUE_REGNUM);
+}
+
+/* Worker function for TARGET_SETUP_INCOMING_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_arg_size and deduce
+ the number of registers from it in the prologue and epilogue. */
+
+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
Index: cris.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/cris/cris.h,v
retrieving revision 1.61
diff -u -r1.61 cris.h
--- cris.h 24 Jan 2004 22:27:20 -0000 1.61
+++ cris.h 25 Jan 2004 04:53:02 -0000
@@ -1022,28 +1022,6 @@
/* 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
documented, although used by several targets. */
#define EXPAND_BUILTIN_VA_ARG(VALIST, TYPE) \
More information about the Gcc-patches
mailing list