]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
pa.c (hppa_builtin_saveregs): Use get_varargs_alias_set and tag the spill mems.
authorRichard Henderson <rth@cygnus.com>
Wed, 28 Jul 1999 18:24:29 +0000 (11:24 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 28 Jul 1999 18:24:29 +0000 (11:24 -0700)
        * pa.c (hppa_builtin_saveregs):  Use get_varargs_alias_set
        and tag the spill mems.
        (hppa_va_start): New.
        (hppa_va_arg): New.
        * pa.h (EXPAND_BUILTIN_VA_START): New.
        (EXPAND_BUILTIN_VA_ARG): New.

From-SVN: r28317

gcc/ChangeLog
gcc/config/pa/pa.c
gcc/config/pa/pa.h

index a25c1a065a41c0d61e60ec1f13c5ecd82bd6195a..7dad4a763a7115394dfaaae78f9d03e580391c41 100644 (file)
@@ -1,3 +1,12 @@
+Wed Jul 28 11:23:48 1999  Richard Henderson  <rth@cygnus.com>
+
+       * pa.c (hppa_builtin_saveregs):  Use get_varargs_alias_set
+       and tag the spill mems.
+       (hppa_va_start): New.
+       (hppa_va_arg): New.
+       * pa.h (EXPAND_BUILTIN_VA_START): New.
+       (EXPAND_BUILTIN_VA_ARG): New.
+
 Wed Jul 28 11:22:21 1999  Richard Henderson  <rth@cygnus.com>
 
        * mn10300.c (mn10300_builtin_saveregs): Use get_varargs_alias_set
index 33efebca79baf1aca6895f4cfb88ea9be8b4f1e2..92c5dae1f6910fbaff17eda396a826ce0c6e76e5 100644 (file)
@@ -4283,6 +4283,7 @@ hppa_builtin_saveregs ()
   dest = gen_rtx_MEM (BLKmode,
                      plus_constant (current_function_internal_arg_pointer,
                                     -16));
+  MEM_ALIAS_SET (dest) = get_varargs_alias_set ();
   move_block_from_reg (23, dest, 4, 4 * UNITS_PER_WORD);
 
   /* move_block_from_reg will emit code to store the argument registers
@@ -4308,6 +4309,73 @@ hppa_builtin_saveregs ()
                                    offset, 0, 0, OPTAB_LIB_WIDEN));
 }
 
+void
+hppa_va_start (stdarg_p, valist, nextarg)
+     int stdarg_p;
+     tree valist;
+     rtx nextarg;
+{
+  nextarg = expand_builtin_saveregs ();
+  std_expand_builtin_va_start (stdarg_p, valist, nextarg);
+}
+
+rtx
+hppa_va_arg (valist, type)
+     tree valist, type;
+{
+  HOST_WIDE_INT align, size, ofs;
+  tree t, ptr, pptr;
+
+  /* Compute the rounded size of the type.  */
+  align = PARM_BOUNDARY / BITS_PER_UNIT;
+  size = int_size_in_bytes (type);
+
+  ptr = build_pointer_type (type);
+
+  /* "Large" types are passed by reference.  */
+  if (size > 8)
+    {
+      t = build (PREDECREMENT_EXPR, TREE_TYPE (valist), valist, 
+                build_int_2 (POINTER_SIZE / BITS_PER_UNIT, 0));
+      TREE_SIDE_EFFECTS (t) = 1;
+
+      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 = build (PLUS_EXPR, TREE_TYPE (valist), valist,
+                build_int_2 (-size, -1));
+
+      /* ??? Copied from va-pa.h, but we probably don't need to align
+        to word size, since we generate and preserve that invariant.  */
+      t = build (BIT_AND_EXPR, TREE_TYPE (valist), t,
+                build_int_2 ((size > 4 ? -8 : -4), -1));
+
+      t = build (MODIFY_EXPR, TREE_TYPE (valist), valist, t);
+      TREE_SIDE_EFFECTS (t) = 1;
+      
+      ofs = (8 - size) % 4;
+      if (ofs)
+       {
+         t = build (PLUS_EXPR, TREE_TYPE (valist), t, build_int_2 (ofs, 0));
+         TREE_SIDE_EFFECTS (t) = 1;
+       }
+
+      t = build1 (NOP_EXPR, ptr, t);
+      TREE_SIDE_EFFECTS (t) = 1;
+    }
+
+  /* Calculate!  */
+  return expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL);
+}
+
+
+
 /* This routine handles all the normal conditional branch sequences we
    might need to generate.  It handles compare immediate vs compare
    register, nullification of delay slots, varying length branches,
index ce2e555d197a789ede50516eb2ec2e86785521b6..612993ec5efa993da8c8ada3eec705fd25c59ec3 100644 (file)
@@ -1219,6 +1219,17 @@ extern union tree_node *current_function_decl;
 extern struct rtx_def *hppa_builtin_saveregs ();
 #define EXPAND_BUILTIN_SAVEREGS() hppa_builtin_saveregs ()
 
+/* Implement `va_start' for varargs and stdarg.  */
+
+extern void hppa_va_start();
+#define EXPAND_BUILTIN_VA_START(stdarg, valist, nextarg) \
+  hppa_va_start (stdarg, valist, nextarg)
+
+/* Implement `va_arg'.  */
+
+extern struct rtx_def *hppa_va_arg();
+#define EXPAND_BUILTIN_VA_ARG(valist, type) \
+  hppa_va_arg (valist, type)
 \f
 /* Addressing modes, and classification of registers for them.