Commit 21d05694 by DJ Delorie Committed by Kaz Kojima

sh.c (output_stack_adjust): Add new argument frame_p.

	* 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.	

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


Co-Authored-By: Kaz Kojima <kkojima@gcc.gnu.org>

From-SVN: r151735
parent 41b7d417
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> 2009-09-15 Adam Nemet <anemet@caviumnetworks.com>
PR bootstrap/41349 PR bootstrap/41349
......
...@@ -177,7 +177,7 @@ static rtx find_barrier (int, rtx, rtx); ...@@ -177,7 +177,7 @@ static rtx find_barrier (int, rtx, rtx);
static int noncall_uses_reg (rtx, rtx, rtx *); static int noncall_uses_reg (rtx, rtx, rtx *);
static rtx gen_block_redirect (rtx, int, int); static rtx gen_block_redirect (rtx, int, int);
static void sh_reorg (void); 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 frame_insn (rtx);
static rtx push (int); static rtx push (int);
static void pop (int); static void pop (int);
...@@ -6037,9 +6037,9 @@ output_jump_label_table (void) ...@@ -6037,9 +6037,9 @@ output_jump_label_table (void)
static void static void
output_stack_adjust (int size, rtx reg, int epilogue_p, 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) if (size)
{ {
HOST_WIDE_INT align = STACK_BOUNDARY / BITS_PER_UNIT; HOST_WIDE_INT align = STACK_BOUNDARY / BITS_PER_UNIT;
...@@ -6701,9 +6701,10 @@ sh_expand_prologue (void) ...@@ -6701,9 +6701,10 @@ sh_expand_prologue (void)
&& (NPARM_REGS(SImode) && (NPARM_REGS(SImode)
> crtl->args.info.arg_count[(int) SH_ARG_INT])) > crtl->args.info.arg_count[(int) SH_ARG_INT]))
pretend_args = 0; pretend_args = 0;
/* Dwarf2 module doesn't expect frame related insns here. */
output_stack_adjust (-pretend_args output_stack_adjust (-pretend_args
- crtl->args.info.stack_regs * 8, - 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) if (TARGET_SHCOMPACT && flag_pic && crtl->args.info.call_cookie)
/* We're going to use the PIC register to load the address of the /* We're going to use the PIC register to load the address of the
...@@ -6834,7 +6835,7 @@ sh_expand_prologue (void) ...@@ -6834,7 +6835,7 @@ sh_expand_prologue (void)
offset_base = d + d_rounding; offset_base = d + d_rounding;
output_stack_adjust (-(save_size + d_rounding), stack_pointer_rtx, output_stack_adjust (-(save_size + d_rounding), stack_pointer_rtx,
0, NULL); 0, NULL, true);
sh5_schedule_saves (&live_regs_mask, &schedule, offset_base); sh5_schedule_saves (&live_regs_mask, &schedule, offset_base);
tmp_pnt = schedule.temps; tmp_pnt = schedule.temps;
...@@ -7009,7 +7010,7 @@ sh_expand_prologue (void) ...@@ -7009,7 +7010,7 @@ sh_expand_prologue (void)
target_flags = save_flags; target_flags = save_flags;
output_stack_adjust (-rounded_frame_size (d) + d_rounding, output_stack_adjust (-rounded_frame_size (d) + d_rounding,
stack_pointer_rtx, 0, NULL); stack_pointer_rtx, 0, NULL, true);
if (frame_pointer_needed) if (frame_pointer_needed)
frame_insn (GEN_MOV (hard_frame_pointer_rtx, stack_pointer_rtx)); frame_insn (GEN_MOV (hard_frame_pointer_rtx, stack_pointer_rtx));
...@@ -7074,7 +7075,7 @@ sh_expand_epilogue (bool sibcall_p) ...@@ -7074,7 +7075,7 @@ sh_expand_epilogue (bool sibcall_p)
See PR/18032 and PR/40313. */ See PR/18032 and PR/40313. */
emit_insn (gen_blockage ()); emit_insn (gen_blockage ());
output_stack_adjust (frame_size, hard_frame_pointer_rtx, e, 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 /* We must avoid moving the stack pointer adjustment past code
which reads from the local frame, else an interrupt could which reads from the local frame, else an interrupt could
...@@ -7090,7 +7091,8 @@ sh_expand_epilogue (bool sibcall_p) ...@@ -7090,7 +7091,8 @@ sh_expand_epilogue (bool sibcall_p)
occur after the SP adjustment and clobber data in the local occur after the SP adjustment and clobber data in the local
frame. */ frame. */
emit_insn (gen_blockage ()); 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 ()) if (SHMEDIA_REGS_STACK_ADJUST ())
...@@ -7277,7 +7279,7 @@ sh_expand_epilogue (bool sibcall_p) ...@@ -7277,7 +7279,7 @@ sh_expand_epilogue (bool sibcall_p)
output_stack_adjust (crtl->args.pretend_args_size output_stack_adjust (crtl->args.pretend_args_size
+ save_size + d_rounding + save_size + d_rounding
+ crtl->args.info.stack_regs * 8, + crtl->args.info.stack_regs * 8,
stack_pointer_rtx, e, NULL); stack_pointer_rtx, e, NULL, false);
if (crtl->calls_eh_return) if (crtl->calls_eh_return)
emit_insn (GEN_ADD3 (stack_pointer_rtx, stack_pointer_rtx, emit_insn (GEN_ADD3 (stack_pointer_rtx, stack_pointer_rtx,
......
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> 2009-09-15 Nathan Froyd <froydnj@codesourcery.com>
Jakub Jelinek <jakub@redhat.com> Jakub Jelinek <jakub@redhat.com>
......
/* 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++;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment