cris.c (TARGET_SETUP_INCOMING_VARARGS): New.
authorKazu Hirata <kazu@cs.umass.edu>
Mon, 26 Jan 2004 15:54:45 +0000 (15:54 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Mon, 26 Jan 2004 15:54:45 +0000 (15:54 +0000)
* 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

gcc/ChangeLog
gcc/config/cris/cris.c
gcc/config/cris/cris.h

index 753aaee2c5299e02347c24647a7e7683247b91bf..7dbfb88854f4e4d88e9fe22c302ddb5443a32ec3 100644 (file)
@@ -1,3 +1,9 @@
+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.
index 77d421d11fd84b1a29b02ee26161f6eab91256fb..1d5f16815347cf0800bdbd74dd11e8640ef0c1e5 100644 (file)
@@ -94,6 +94,9 @@ static struct machine_function * cris_init_machine_status (void);
 
 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 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION;
 #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.  */
@@ -3194,6 +3200,25 @@ cris_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
   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
 /* Various small functions to replace macros.  Only called from a
    debugger.  They might collide with gcc functions or system functions,
index be529a952ef914e2506fabb25a3dcf6abcc05d1f..34fb6f9f73053dbd16c1470838b8444dd5b4fdea 100644 (file)
@@ -1022,28 +1022,6 @@ struct cum_args {int regs;};
 
 /* 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) \