]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
mn10200.c (mn10200_va_arg): New.
authorRichard Henderson <rth@cygnus.com>
Wed, 28 Jul 1999 18:21:02 +0000 (11:21 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 28 Jul 1999 18:21:02 +0000 (11:21 -0700)
        * mn10200.c (mn10200_va_arg): New.
        * mn10200.h (EXPAND_BUILTIN_VA_ARG): New.

From-SVN: r28315

gcc/ChangeLog
gcc/config/mn10200/mn10200.c
gcc/config/mn10200/mn10200.h

index eb5c409b58aa7a1aecaf29ad182f544e87d00c3d..37c69fcc7a4738c7fddb54a954fb6cd84e607224 100644 (file)
@@ -1,3 +1,8 @@
+Wed Jul 28 11:20:19 1999  Richard Henderson  <rth@cygnus.com>
+
+       * mn10200.c (mn10200_va_arg): New.
+       * mn10200.h (EXPAND_BUILTIN_VA_ARG): New.
+
 Wed Jul 28 11:19:06 1999  Richard Henderson  <rth@cygnus.com>
 
        * builtins.c (std_expand_builtin_va_arg): Use int_size_in_bytes
index 5435f773c8daf84c1e414687388365df54ba1366..6e91b8e6418ac8c7549fed9a6f236067c764baef 100644 (file)
@@ -1436,6 +1436,43 @@ function_arg_partial_nregs (cum, mode, type, named)
   return (nregs * UNITS_PER_WORD - cum->nbytes) / UNITS_PER_WORD;
 }
 
+rtx
+mn10200_va_arg (valist, type)
+     tree valist, type;
+{
+  HOST_WIDE_INT align, rsize;
+  tree t, ptr, pptr;
+
+  /* Compute the rounded size of the type.  */
+  align = PARM_BOUNDARY / BITS_PER_UNIT;
+  rsize = (((int_size_in_bytes (type) + align - 1) / align) * align);
+
+  t = build (POSTINCREMENT_EXPR, TREE_TYPE (valist), valist, 
+            build_int_2 ((rsize > 8 ? 4 : rsize), 0));
+  TREE_SIDE_EFFECTS (t) = 1;
+
+  ptr = build_pointer_type (type);
+
+  /* "Large" types are passed by reference.  */
+  if (rsize > 8)
+    {
+      pptr = build_pointer_type (ptr);
+      t = build1 (NOP_EXPR, pptr, t);
+      TREE_SIDE_EFFECTS (t) = 1;
+
+      t = build1 (INDIRECT_REF, ptr, t);
+      TREE_SIDE_EFFECTS (t) = 1;
+    }
+  else
+    {
+      t = build1 (NOP_EXPR, ptr, t);
+      TREE_SIDE_EFFECTS (t) = 1;
+    }
+
+  /* Calculate!  */
+  return expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL);
+}
+
 char *
 output_tst (operand, insn)
      rtx operand, insn;
index fcf1058e0a47930dd6501054a40ed53c5c46e739..c044c16cab059044d33756dc0ee9366b796c4a4e 100644 (file)
@@ -508,6 +508,10 @@ extern struct rtx_def *function_arg();
 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
   function_arg (&CUM, MODE, TYPE, NAMED)
 
+/* Implement `va_arg'.  */
+extern struct rtx_def *mn10200_va_arg();
+#define EXPAND_BUILTIN_VA_ARG(valist, type) \
+  mn10200_va_arg (valist, type)
 \f
 /* For "large" items, we pass them by invisible reference, and the
    callee is responsible for copying the data item if it might be