Fix i960 varargs/stdarg build failures.
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 28 Oct 1999 17:14:59 +0000 (17:14 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 28 Oct 1999 17:14:59 +0000 (17:14 +0000)
* config/i960/i960.c (i960_va_start): New locals base, num.
Use INDIRECT_REF instead of ARRAY_REF on valist.
(i960_va_arg): Use INDIRECT_REF instead of ARRAY_REF on valist.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30244 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i960/i960.c

index b1aca2e..d4f2b4e 100644 (file)
@@ -1,3 +1,9 @@
+Thu Oct 28 10:02:00 1999  Jim Wilson  <wilson@cygnus.com>
+
+       * config/i960/i960.c (i960_va_start): New locals base, num.
+       Use INDIRECT_REF instead of ARRAY_REF on valist.
+       (i960_va_arg): Use INDIRECT_REF instead of ARRAY_REF on valist.
+
 Thu Oct 28 09:45:48 1999  Mark Mitchell  <mark@codesourcery.com>
 
        * gcse.c (delete_null_pointer_checks): Fix typo in previous change.
index fa98ad4..2dd17ae 100644 (file)
@@ -2652,18 +2652,23 @@ i960_va_start (stdarg_p, valist, nextarg)
      tree valist;
      rtx nextarg ATTRIBUTE_UNUSED;
 {
-  tree d, s, t;
+  tree s, t, base, num;
+
+  /* The array type always decays to a pointer before we get here, so we
+     can't use ARRAY_REF.  */
+  base = build1 (INDIRECT_REF, unsigned_type_node, valist);
+  num = build1 (INDIRECT_REF, unsigned_type_node,
+               build (PLUS_EXPR, unsigned_type_node, valist,
+                      TYPE_SIZE_UNIT (TREE_TYPE (valist))));
 
   s = make_tree (unsigned_type_node, arg_pointer_rtx);
-  d = build (ARRAY_REF, unsigned_type_node, valist, size_zero_node);
-  t = build (MODIFY_EXPR, unsigned_type_node, d, s);
+  t = build (MODIFY_EXPR, unsigned_type_node, base, s);
   TREE_SIDE_EFFECTS (t) = 1;
   expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
 
   s = build_int_2 ((current_function_args_info.ca_nregparms
                    + current_function_args_info.ca_nstackparms) * 4, 0);
-  d = build (ARRAY_REF, unsigned_type_node, valist, size_one_node);
-  t = build (MODIFY_EXPR, unsigned_type_node, d, s);
+  t = build (MODIFY_EXPR, unsigned_type_node, num, s);
   TREE_SIDE_EFFECTS (t) = 1;
   expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
 }
@@ -2678,8 +2683,12 @@ i960_va_arg (valist, type)
   tree base, num, pad, next, this, t1, t2, int48;
   rtx addr_rtx;
 
-  base = build (ARRAY_REF, unsigned_type_node, valist, size_zero_node);
-  num = build (ARRAY_REF, unsigned_type_node, valist, size_one_node);
+  /* The array type always decays to a pointer before we get here, so we
+     can't use ARRAY_REF.  */
+  base = build1 (INDIRECT_REF, unsigned_type_node, valist);
+  num = build1 (INDIRECT_REF, unsigned_type_node,
+               build (PLUS_EXPR, unsigned_type_node, valist,
+                      TYPE_SIZE_UNIT (TREE_TYPE (valist))));
 
   /* Round up sizeof(type) to a word.  */
   siz = (int_size_in_bytes (type) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD;