OSDN Git Service

* config/mep/mep.c (mep_expand_builtin_saveregs): Make sure 64-bit
authordj <dj@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 27 Jul 2009 20:31:04 +0000 (20:31 +0000)
committerdj <dj@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 27 Jul 2009 20:31:04 +0000 (20:31 +0000)
types are dword-aligned.
(mep_expand_va_start): Likewise.

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

gcc/ChangeLog
gcc/config/mep/mep.c

index f3f0cdb..a20aed1 100644 (file)
@@ -1,3 +1,9 @@
+2009-07-27  DJ Delorie  <dj@redhat.com>
+
+       * config/mep/mep.c (mep_expand_builtin_saveregs): Make sure 64-bit
+       types are dword-aligned.
+       (mep_expand_va_start): Likewise.
+
 2009-07-27  Olivier Hainque  <hainque@adacore.com>
             Douglas B Rupp  <rupp@gnat.com>
 
index a5869ca..e237c47 100644 (file)
@@ -3530,15 +3530,23 @@ mep_expand_builtin_saveregs (void)
   rtx regbuf;
 
   ns = cfun->machine->arg_regs_to_save;
-  bufsize = ns * (TARGET_IVC2 ? 12 : 4);
-  regbuf = assign_stack_local (SImode, bufsize, 32);
+  if (TARGET_IVC2)
+    {
+      bufsize = 8 * ((ns + 1) / 2) + 8 * ns;
+      regbuf = assign_stack_local (SImode, bufsize, 64);
+    }
+  else
+    {
+      bufsize = ns * 4;
+      regbuf = assign_stack_local (SImode, bufsize, 32);
+    }
 
   move_block_from_reg (5-ns, regbuf, ns);
 
   if (TARGET_IVC2)
     {
       rtx tmp = gen_rtx_MEM (DImode, XEXP (regbuf, 0));
-      int ofs = 4 * ns;
+      int ofs = 8 * ((ns+1)/2);
 
       for (i=0; i<ns; i++)
        {
@@ -3627,7 +3635,9 @@ mep_expand_va_start (tree valist, rtx nextarg)
   TREE_SIDE_EFFECTS (t) = 1;
   expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
 
-  /* va_list.next_cop = va_list.next_gp_limit; */
+  u = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, u,
+                  size_int (8 * ((ns+1)/2)));
+  /* va_list.next_cop = ROUND_UP(va_list.next_gp_limit,8); */
   t = build2 (MODIFY_EXPR, ptr_type_node, next_cop, u);
   TREE_SIDE_EFFECTS (t) = 1;
   expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);