OSDN Git Service

* config/sh/sh.c (output_stack_adjust): Add new argument frame_p.
authorkkojima <kkojima@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 16 Sep 2009 01:12:16 +0000 (01:12 +0000)
committerkkojima <kkojima@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 16 Sep 2009 01:12:16 +0000 (01:12 +0000)
(sh_expand_prologue): Update calls to output_stack_adjust.
(sh_expand_epilogue): Likewise.

* gcc.target/sh/struct-arg-dw2.c: New test.

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

gcc/ChangeLog
gcc/config/sh/sh.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/sh/struct-arg-dw2.c [new file with mode: 0644]

index 584f174..8eca8ba 100644 (file)
@@ -1,3 +1,10 @@
+2009-09-16  DJ Delorie  <dj@redhat.com>
+           Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * config/sh/sh.c (output_stack_adjust): Add new argument frame_p.
+       (sh_expand_prologue): Update calls to output_stack_adjust.
+       (sh_expand_epilogue): Likewise. 
+
 2009-09-15  Adam Nemet  <anemet@caviumnetworks.com>
 
        PR bootstrap/41349
index ed8a698..d0f9932 100644 (file)
@@ -177,7 +177,7 @@ static rtx find_barrier (int, rtx, rtx);
 static int noncall_uses_reg (rtx, rtx, rtx *);
 static rtx gen_block_redirect (rtx, int, int);
 static void sh_reorg (void);
-static void output_stack_adjust (int, rtx, int, HARD_REG_SET *);
+static void output_stack_adjust (int, rtx, int, HARD_REG_SET *, bool);
 static rtx frame_insn (rtx);
 static rtx push (int);
 static void pop (int);
@@ -6037,9 +6037,9 @@ output_jump_label_table (void)
 
 static void
 output_stack_adjust (int size, rtx reg, int epilogue_p,
-                    HARD_REG_SET *live_regs_mask)
+                    HARD_REG_SET *live_regs_mask, bool frame_p)
 {
-  rtx (*emit_fn) (rtx) = epilogue_p ? &emit_insn : &frame_insn;
+  rtx (*emit_fn) (rtx) = frame_p ? &frame_insn : &emit_insn;
   if (size)
     {
       HOST_WIDE_INT align = STACK_BOUNDARY / BITS_PER_UNIT;
@@ -6701,9 +6701,10 @@ sh_expand_prologue (void)
       && (NPARM_REGS(SImode)
          > crtl->args.info.arg_count[(int) SH_ARG_INT]))
     pretend_args = 0;
+  /* Dwarf2 module doesn't expect frame related insns here.  */
   output_stack_adjust (-pretend_args
                       - crtl->args.info.stack_regs * 8,
-                      stack_pointer_rtx, 0, NULL);
+                      stack_pointer_rtx, 0, NULL, false);
 
   if (TARGET_SHCOMPACT && flag_pic && crtl->args.info.call_cookie)
     /* We're going to use the PIC register to load the address of the
@@ -6834,7 +6835,7 @@ sh_expand_prologue (void)
       offset_base = d + d_rounding;
 
       output_stack_adjust (-(save_size + d_rounding), stack_pointer_rtx,
-                          0, NULL);
+                          0, NULL, true);
 
       sh5_schedule_saves (&live_regs_mask, &schedule, offset_base);
       tmp_pnt = schedule.temps;
@@ -7009,7 +7010,7 @@ sh_expand_prologue (void)
   target_flags = save_flags;
 
   output_stack_adjust (-rounded_frame_size (d) + d_rounding,
-                      stack_pointer_rtx, 0, NULL);
+                      stack_pointer_rtx, 0, NULL, true);
 
   if (frame_pointer_needed)
     frame_insn (GEN_MOV (hard_frame_pointer_rtx, stack_pointer_rtx));
@@ -7074,7 +7075,7 @@ sh_expand_epilogue (bool sibcall_p)
         See PR/18032 and PR/40313.  */
       emit_insn (gen_blockage ());
       output_stack_adjust (frame_size, hard_frame_pointer_rtx, e,
-                          &live_regs_mask);
+                          &live_regs_mask, false);
 
       /* We must avoid moving the stack pointer adjustment past code
         which reads from the local frame, else an interrupt could
@@ -7090,7 +7091,8 @@ sh_expand_epilogue (bool sibcall_p)
         occur after the SP adjustment and clobber data in the local
         frame.  */
       emit_insn (gen_blockage ());
-      output_stack_adjust (frame_size, stack_pointer_rtx, e, &live_regs_mask);
+      output_stack_adjust (frame_size, stack_pointer_rtx, e,
+                          &live_regs_mask, false);
     }
 
   if (SHMEDIA_REGS_STACK_ADJUST ())
@@ -7277,7 +7279,7 @@ sh_expand_epilogue (bool sibcall_p)
   output_stack_adjust (crtl->args.pretend_args_size
                       + save_size + d_rounding
                       + crtl->args.info.stack_regs * 8,
-                      stack_pointer_rtx, e, NULL);
+                      stack_pointer_rtx, e, NULL, false);
 
   if (crtl->calls_eh_return)
     emit_insn (GEN_ADD3 (stack_pointer_rtx, stack_pointer_rtx,
index 794404d..1f8eb2e 100644 (file)
@@ -1,3 +1,8 @@
+2009-09-16  DJ Delorie  <dj@redhat.com>
+           Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * gcc.target/sh/struct-arg-dw2.c: New test.
+
 2009-09-15  Nathan Froyd  <froydnj@codesourcery.com>
            Jakub Jelinek  <jakub@redhat.com>
 
diff --git a/gcc/testsuite/gcc.target/sh/struct-arg-dw2.c b/gcc/testsuite/gcc.target/sh/struct-arg-dw2.c
new file mode 100644 (file)
index 0000000..effd13d
--- /dev/null
@@ -0,0 +1,26 @@
+/* Verify that we don't generate fame related insn against stack adjustment
+   for the object sent partially in registers. */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-g" } */
+/* { dg-final { scan-assembler-not "\t.cfi_def_cfa_offset 16" } } */
+
+typedef struct
+{
+  unsigned short A1;
+  unsigned short A2;
+} A_t;
+
+typedef struct
+{
+  A_t C13[10];
+} C_t;
+
+void
+Store (C_t Par)
+{
+  unsigned char *ptr;
+  unsigned int test;
+
+  ptr = (unsigned char*) 0x12345678;
+  ptr++;
+}