Commit 62164eb4 by J"orn Rennecke Committed by Joern Rennecke

sh.h (CONDITIONAL_REGISTER_USAGE): Don't exclude fixed registers from call_used_regs.

	* sh.h (CONDITIONAL_REGISTER_USAGE): Don't exclude fixed registers
	from call_used_regs.  Update call_really_used_regs.
	(CALL_REALLY_USED_REGISTERS): Define.
	* sh.c (output_stack_adjust, shmedia_target_regs_stack_space):
	Replace call_used_regs with call_really_used_regs.
	(calc_live_regs, sh_media_register_for_return): Likewise.
	(sh5_schedule_saves, sh_expand_prologue, reg_unused_after): Likewise.
	* sh.md (return_media): Likewise.

From-SVN: r86195
parent f9b0ac3b
2004-08-18 J"orn Rennecke <joern.rennecke@superh.com>
* sh.h (CONDITIONAL_REGISTER_USAGE): Don't exclude fixed registers
from call_used_regs. Update call_really_used_regs.
(CALL_REALLY_USED_REGISTERS): Define.
* sh.c (output_stack_adjust, shmedia_target_regs_stack_space):
Replace call_used_regs with call_really_used_regs.
(calc_live_regs, sh_media_register_for_return): Likewise.
(sh5_schedule_saves, sh_expand_prologue, reg_unused_after): Likewise.
* sh.md (return_media): Likewise.
2004-08-18 Andrew Pinski <apinski@apple.com> 2004-08-18 Andrew Pinski <apinski@apple.com>
* config/darwin.c (machopic_legitimize_pic_address): Only set MEM_READONLY_P * config/darwin.c (machopic_legitimize_pic_address): Only set MEM_READONLY_P
......
...@@ -4821,7 +4821,7 @@ output_stack_adjust (int size, rtx reg, int epilogue_p, ...@@ -4821,7 +4821,7 @@ output_stack_adjust (int size, rtx reg, int epilogue_p,
to handle this case, so just abort when we see it. */ to handle this case, so just abort when we see it. */
if (epilogue_p < 0 if (epilogue_p < 0
|| current_function_interrupt || current_function_interrupt
|| ! call_used_regs[temp] || fixed_regs[temp]) || ! call_really_used_regs[temp] || fixed_regs[temp])
temp = -1; temp = -1;
if (temp < 0 && ! current_function_interrupt if (temp < 0 && ! current_function_interrupt
&& (TARGET_SHMEDIA || epilogue_p >= 0)) && (TARGET_SHMEDIA || epilogue_p >= 0))
...@@ -5051,7 +5051,7 @@ shmedia_target_regs_stack_space (HARD_REG_SET *live_regs_mask) ...@@ -5051,7 +5051,7 @@ shmedia_target_regs_stack_space (HARD_REG_SET *live_regs_mask)
int interrupt_handler = sh_cfun_interrupt_handler_p (); int interrupt_handler = sh_cfun_interrupt_handler_p ();
for (reg = LAST_TARGET_REG; reg >= FIRST_TARGET_REG; reg--) for (reg = LAST_TARGET_REG; reg >= FIRST_TARGET_REG; reg--)
if ((! call_used_regs[reg] || interrupt_handler) if ((! call_really_used_regs[reg] || interrupt_handler)
&& ! TEST_HARD_REG_BIT (*live_regs_mask, reg)) && ! TEST_HARD_REG_BIT (*live_regs_mask, reg))
/* Leave space to save this target register on the stack, /* Leave space to save this target register on the stack,
in case target register allocation wants to use it. */ in case target register allocation wants to use it. */
...@@ -5111,7 +5111,8 @@ calc_live_regs (HARD_REG_SET *live_regs_mask) ...@@ -5111,7 +5111,8 @@ calc_live_regs (HARD_REG_SET *live_regs_mask)
else if ((TARGET_SH4 || TARGET_SH2A_DOUBLE) && TARGET_FMOVD && TARGET_FPU_SINGLE) else if ((TARGET_SH4 || TARGET_SH2A_DOUBLE) && TARGET_FMOVD && TARGET_FPU_SINGLE)
for (count = 0, reg = FIRST_FP_REG; reg <= LAST_FP_REG; reg += 2) for (count = 0, reg = FIRST_FP_REG; reg <= LAST_FP_REG; reg += 2)
if (regs_ever_live[reg] && regs_ever_live[reg+1] if (regs_ever_live[reg] && regs_ever_live[reg+1]
&& (! call_used_regs[reg] || (interrupt_handler && ! pragma_trapa)) && (! call_really_used_regs[reg]
|| (interrupt_handler && ! pragma_trapa))
&& ++count > 2) && ++count > 2)
{ {
target_flags &= ~FPU_SINGLE_BIT; target_flags &= ~FPU_SINGLE_BIT;
...@@ -5152,8 +5153,9 @@ calc_live_regs (HARD_REG_SET *live_regs_mask) ...@@ -5152,8 +5153,9 @@ calc_live_regs (HARD_REG_SET *live_regs_mask)
: (interrupt_handler && ! pragma_trapa) : (interrupt_handler && ! pragma_trapa)
? (/* Need to save all the regs ever live. */ ? (/* Need to save all the regs ever live. */
(regs_ever_live[reg] (regs_ever_live[reg]
|| (call_used_regs[reg] || (call_really_used_regs[reg]
&& (! fixed_regs[reg] || reg == MACH_REG || reg == MACL_REG) && (! fixed_regs[reg] || reg == MACH_REG || reg == MACL_REG
|| reg == PIC_OFFSET_TABLE_REGNUM)
&& has_call) && has_call)
|| (has_call && REGISTER_NATURAL_MODE (reg) == SImode || (has_call && REGISTER_NATURAL_MODE (reg) == SImode
&& (GENERAL_REGISTER_P (reg) || TARGET_REGISTER_P (reg)))) && (GENERAL_REGISTER_P (reg) || TARGET_REGISTER_P (reg))))
...@@ -5167,7 +5169,7 @@ calc_live_regs (HARD_REG_SET *live_regs_mask) ...@@ -5167,7 +5169,7 @@ calc_live_regs (HARD_REG_SET *live_regs_mask)
&& flag_pic && flag_pic
&& current_function_args_info.call_cookie && current_function_args_info.call_cookie
&& reg == (int) PIC_OFFSET_TABLE_REGNUM) && reg == (int) PIC_OFFSET_TABLE_REGNUM)
|| (regs_ever_live[reg] && ! call_used_regs[reg]) || (regs_ever_live[reg] && ! call_really_used_regs[reg])
|| (current_function_calls_eh_return || (current_function_calls_eh_return
&& (reg == (int) EH_RETURN_DATA_REGNO (0) && (reg == (int) EH_RETURN_DATA_REGNO (0)
|| reg == (int) EH_RETURN_DATA_REGNO (1) || reg == (int) EH_RETURN_DATA_REGNO (1)
...@@ -5207,7 +5209,7 @@ calc_live_regs (HARD_REG_SET *live_regs_mask) ...@@ -5207,7 +5209,7 @@ calc_live_regs (HARD_REG_SET *live_regs_mask)
&& TARGET_SAVE_ALL_TARGET_REGS && TARGET_SAVE_ALL_TARGET_REGS
&& shmedia_space_reserved_for_target_registers) && shmedia_space_reserved_for_target_registers)
for (reg = LAST_TARGET_REG; reg >= FIRST_TARGET_REG; reg--) for (reg = LAST_TARGET_REG; reg >= FIRST_TARGET_REG; reg--)
if ((! call_used_regs[reg] || interrupt_handler) if ((! call_really_used_regs[reg] || interrupt_handler)
&& ! TEST_HARD_REG_BIT (*live_regs_mask, reg)) && ! TEST_HARD_REG_BIT (*live_regs_mask, reg))
{ {
SET_HARD_REG_BIT (*live_regs_mask, reg); SET_HARD_REG_BIT (*live_regs_mask, reg);
...@@ -5262,7 +5264,7 @@ sh_media_register_for_return (void) ...@@ -5262,7 +5264,7 @@ sh_media_register_for_return (void)
tr0_used = flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM]; tr0_used = flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM];
for (regno = FIRST_TARGET_REG + tr0_used; regno <= LAST_TARGET_REG; regno++) for (regno = FIRST_TARGET_REG + tr0_used; regno <= LAST_TARGET_REG; regno++)
if (call_used_regs[regno] && ! regs_ever_live[regno]) if (call_really_used_regs[regno] && ! regs_ever_live[regno])
return regno; return regno;
return -1; return -1;
...@@ -5310,7 +5312,7 @@ sh5_schedule_saves (HARD_REG_SET *live_regs_mask, save_schedule *schedule, ...@@ -5310,7 +5312,7 @@ sh5_schedule_saves (HARD_REG_SET *live_regs_mask, save_schedule *schedule,
if (! current_function_interrupt) if (! current_function_interrupt)
for (i = FIRST_GENERAL_REG; tmpx < MAX_TEMPS && i <= LAST_GENERAL_REG; i++) for (i = FIRST_GENERAL_REG; tmpx < MAX_TEMPS && i <= LAST_GENERAL_REG; i++)
if (call_used_regs[i] && ! fixed_regs[i] && i != PR_MEDIA_REG if (call_really_used_regs[i] && ! fixed_regs[i] && i != PR_MEDIA_REG
&& ! FUNCTION_ARG_REGNO_P (i) && ! FUNCTION_ARG_REGNO_P (i)
&& i != FIRST_RET_REG && i != FIRST_RET_REG
&& ! (cfun->static_chain_decl != NULL && i == STATIC_CHAIN_REGNUM) && ! (cfun->static_chain_decl != NULL && i == STATIC_CHAIN_REGNUM)
...@@ -5510,7 +5512,7 @@ sh_expand_prologue (void) ...@@ -5510,7 +5512,7 @@ sh_expand_prologue (void)
save_entry *entry; save_entry *entry;
int *tmp_pnt; int *tmp_pnt;
if (call_used_regs[R0_REG] && ! fixed_regs[R0_REG] if (call_really_used_regs[R0_REG] && ! fixed_regs[R0_REG]
&& ! current_function_interrupt) && ! current_function_interrupt)
r0 = gen_rtx_REG (Pmode, R0_REG); r0 = gen_rtx_REG (Pmode, R0_REG);
...@@ -8005,7 +8007,7 @@ reg_unused_after (rtx reg, rtx insn) ...@@ -8005,7 +8007,7 @@ reg_unused_after (rtx reg, rtx insn)
if (set == 0 && reg_overlap_mentioned_p (reg, PATTERN (insn))) if (set == 0 && reg_overlap_mentioned_p (reg, PATTERN (insn)))
return 0; return 0;
if (code == CALL_INSN && call_used_regs[REGNO (reg)]) if (code == CALL_INSN && call_really_used_regs[REGNO (reg)])
return 1; return 1;
} }
return 1; return 1;
......
...@@ -106,8 +106,12 @@ do { \ ...@@ -106,8 +106,12 @@ do { \
fixed_regs[regno] = call_used_regs[regno] = 1; \ fixed_regs[regno] = call_used_regs[regno] = 1; \
/* R8 and R9 are call-clobbered on SH5, but not on earlier SH ABIs. */ \ /* R8 and R9 are call-clobbered on SH5, but not on earlier SH ABIs. */ \
if (TARGET_SH5) \ if (TARGET_SH5) \
call_used_regs[FIRST_GENERAL_REG + 8] \ { \
= call_used_regs[FIRST_GENERAL_REG + 9] = 1; \ call_used_regs[FIRST_GENERAL_REG + 8] \
= call_used_regs[FIRST_GENERAL_REG + 9] = 1; \
call_really_used_regs[FIRST_GENERAL_REG + 8] \
= call_really_used_regs[FIRST_GENERAL_REG + 9] = 1; \
} \
if (TARGET_SHMEDIA) \ if (TARGET_SHMEDIA) \
{ \ { \
regno_reg_class[FIRST_GENERAL_REG] = GENERAL_REGS; \ regno_reg_class[FIRST_GENERAL_REG] = GENERAL_REGS; \
...@@ -115,12 +119,15 @@ do { \ ...@@ -115,12 +119,15 @@ do { \
regno_reg_class[FIRST_FP_REG] = FP_REGS; \ regno_reg_class[FIRST_FP_REG] = FP_REGS; \
} \ } \
if (flag_pic) \ if (flag_pic) \
fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ { \
fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
} \
/* Renesas saves and restores mac registers on call. */ \ /* Renesas saves and restores mac registers on call. */ \
if (TARGET_HITACHI && ! TARGET_NOMACSAVE) \ if (TARGET_HITACHI && ! TARGET_NOMACSAVE) \
{ \ { \
call_used_regs[MACH_REG] = 0; \ call_really_used_regs[MACH_REG] = 0; \
call_used_regs[MACL_REG] = 0; \ call_really_used_regs[MACL_REG] = 0; \
} \ } \
for (regno = FIRST_FP_REG + (TARGET_LITTLE_ENDIAN != 0); \ for (regno = FIRST_FP_REG + (TARGET_LITTLE_ENDIAN != 0); \
regno <= LAST_FP_REG; regno += 2) \ regno <= LAST_FP_REG; regno += 2) \
...@@ -128,12 +135,12 @@ do { \ ...@@ -128,12 +135,12 @@ do { \
if (TARGET_SHMEDIA) \ if (TARGET_SHMEDIA) \
{ \ { \
for (regno = FIRST_TARGET_REG; regno <= LAST_TARGET_REG; regno ++)\ for (regno = FIRST_TARGET_REG; regno <= LAST_TARGET_REG; regno ++)\
if (! fixed_regs[regno] && call_used_regs[regno]) \ if (! fixed_regs[regno] && call_really_used_regs[regno]) \
SET_HARD_REG_BIT (reg_class_contents[SIBCALL_REGS], regno); \ SET_HARD_REG_BIT (reg_class_contents[SIBCALL_REGS], regno); \
} \ } \
else \ else \
for (regno = FIRST_GENERAL_REG; regno <= LAST_GENERAL_REG; regno++) \ for (regno = FIRST_GENERAL_REG; regno <= LAST_GENERAL_REG; regno++) \
if (! fixed_regs[regno] && call_used_regs[regno]) \ if (! fixed_regs[regno] && call_really_used_regs[regno]) \
SET_HARD_REG_BIT (reg_class_contents[SIBCALL_REGS], regno); \ SET_HARD_REG_BIT (reg_class_contents[SIBCALL_REGS], regno); \
} while (0) } while (0)
...@@ -1221,6 +1228,10 @@ extern char sh_additional_register_names[ADDREGNAMES_SIZE] \ ...@@ -1221,6 +1228,10 @@ extern char sh_additional_register_names[ADDREGNAMES_SIZE] \
1, \ 1, \
} }
/* CONDITIONAL_REGISTER_USAGE might want to make a register call-used, yet
fixed, like PIC_OFFSET_TABLE_REGNUM. */
#define CALL_REALLY_USED_REGISTERS CALL_USED_REGISTERS
/* Only the lower 32-bits of R10-R14 are guaranteed to be preserved /* Only the lower 32-bits of R10-R14 are guaranteed to be preserved
across SHcompact function calls. We can't tell whether a called across SHcompact function calls. We can't tell whether a called
function is SHmedia or SHcompact, so we assume it may be when function is SHmedia or SHcompact, so we assume it may be when
......
...@@ -7311,7 +7311,7 @@ mov.l\\t1f,r0\\n\\ ...@@ -7311,7 +7311,7 @@ mov.l\\t1f,r0\\n\\
{ {
rtx r18 = gen_rtx_REG (DImode, PR_MEDIA_REG); rtx r18 = gen_rtx_REG (DImode, PR_MEDIA_REG);
if (! call_used_regs[TR0_REG] || fixed_regs[TR0_REG]) if (! call_really_used_regs[TR0_REG] || fixed_regs[TR0_REG])
abort (); abort ();
tr_regno = TR0_REG; tr_regno = TR0_REG;
tr = gen_rtx_REG (DImode, tr_regno); tr = gen_rtx_REG (DImode, tr_regno);
......
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