This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
sh-elf: PR target/15886
- From: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- To: gcc at gcc dot gnu dot org
- Cc: joern dot rennecke at superh dot com, aoliva at redhat dot com
- Date: Fri, 11 Jun 2004 09:00:00 +0900 (JST)
- Subject: sh-elf: PR target/15886
Hi,
I could reduce the testcase of PR target/15886 to
register int r8 asm ("r8");
register int r9 asm ("r9");
register int r10 asm ("r10");
register int r11 asm ("r11");
register int r12 asm ("r12");
register int r13 asm ("r13");
void test (void)
{
void *temp;
int *arg[4];
dummy ();
temp = __builtin_return_address (0);
arg[0] = 0;
arg[1] = temp;
foo (arg);
}
The mainline and 3.4 sh-elf gcc assembles it to
mov.l r14,@-r15
sts.l pr,@-r15
add #-16,r15
mov r15,r14
sts pr,r1
mov.l .L2,r0
jsr @r0
mov.l r1,@r14
mov #0,r1
mov.l r1,@r14
mov.l r1,@(4,r14)
mov.l .L3,r0
jsr @r0
mov r14,r4
add #16,r14
mov r14,r15
lds.l @r15+,pr
rts
with -O1.
It seems that pr register is saved to a register allocated in
stack and reload prefers @r14 for that register, while @r14
is allocated for arg[0]. I've found that reg_equiv_memory_loc[i]
for that register is set to @r14 in allocate_initial_values
with ALLOCATE_INITIAL_VALUE macro and sh defines it like as
#define ALLOCATE_INITIAL_VALUE(hard_reg) \
(REGNO (hard_reg) == (TARGET_SHMEDIA ? PR_MEDIA_REG : PR_REG) \
? (current_function_is_leaf \
&& ! sh_pr_n_sets () \
&& ! (TARGET_SHCOMPACT \
&& ((current_function_args_info.call_cookie \
& ~ CALL_COOKIE_RET_TRAMP (1)) \
|| current_function_has_nonlocal_label)) \
? (hard_reg) \
: gen_rtx_MEM (Pmode, TARGET_SH5 \
? (plus_constant (arg_pointer_rtx, \
TARGET_SHMEDIA64 ? -8 : -4)) \
: frame_pointer_rtx)) \
: NULL_RTX)
This looks odd for TARGET_SH1. pr is saved at the address pointed
by frame_pointer_rtx + frame size for TARGET_SH1, but it seems that
the final frame size can't be known here because allocate_initial_values
is called in regalloc phase.
Is it wrong to just return NULL_RTX for that case?
Regards,
kaz