sh-protos.h (sh_pr_n_sets): Declare.
* sh-protos.h (sh_pr_n_sets): Declare. * sh.c (calc_live_regs): If the initial value for PR has been copied, look at the copy to determine if PR needs to be saved. sh_pr_n_sets: New function. * sh.h (RETURN_ADDR_RTX): Use get_hard_reg_initial_val. (ALLOCATE_INITIAL_VALUE): Define. * sh.c (initial_elimination_offset): Fix RETURN_ADDRESS_POINTER_REGNUM case. From-SVN: r45717
This commit is contained in:
parent
385b6e2d89
commit
3007d592bf
|
@ -1,3 +1,15 @@
|
|||
Fri Sep 21 01:49:41 2001 J"orn Rennecke <amylaar@redhat.com>
|
||||
|
||||
* sh-protos.h (sh_pr_n_sets): Declare.
|
||||
* sh.c (calc_live_regs): If the initial value for PR has been copied,
|
||||
look at the copy to determine if PR needs to be saved.
|
||||
sh_pr_n_sets: New function.
|
||||
* sh.h (RETURN_ADDR_RTX): Use get_hard_reg_initial_val.
|
||||
(ALLOCATE_INITIAL_VALUE): Define.
|
||||
|
||||
* sh.c (initial_elimination_offset):
|
||||
Fix RETURN_ADDRESS_POINTER_REGNUM case.
|
||||
|
||||
Fri Sep 21 01:13:56 2001 J"orn Rennecke <amylaar@redhat.com>
|
||||
|
||||
* integrate.c (allocate_initial_values): New function.
|
||||
|
|
|
@ -119,6 +119,7 @@ extern void sh_expand_epilogue PARAMS ((void));
|
|||
extern int sh_need_epilogue PARAMS ((void));
|
||||
extern int initial_elimination_offset PARAMS ((int, int));
|
||||
extern int fldi_ok PARAMS ((void));
|
||||
extern int sh_pr_n_sets PARAMS ((void));
|
||||
|
||||
#ifdef HARD_CONST
|
||||
extern void fpscr_set_from_mem PARAMS ((int, HARD_REG_SET));
|
||||
|
|
|
@ -3959,6 +3959,8 @@ calc_live_regs (count_ptr, live_regs_mask2)
|
|||
int live_regs_mask = 0;
|
||||
int count;
|
||||
int interrupt_handler;
|
||||
rtx pr_initial;
|
||||
int pr_live;
|
||||
|
||||
if ((lookup_attribute
|
||||
("interrupt_handler",
|
||||
|
@ -3979,14 +3981,20 @@ calc_live_regs (count_ptr, live_regs_mask2)
|
|||
target_flags &= ~FPU_SINGLE_BIT;
|
||||
break;
|
||||
}
|
||||
pr_initial = has_hard_reg_initial_val (Pmode, PR_REG);
|
||||
pr_live = (pr_initial
|
||||
? REGNO (pr_initial) != PR_REG
|
||||
: regs_ever_live[PR_REG]);
|
||||
for (count = 0, reg = FIRST_PSEUDO_REGISTER - 1; reg >= 0; reg--)
|
||||
{
|
||||
if ((interrupt_handler && ! pragma_trapa)
|
||||
if (reg == PR_REG
|
||||
? pr_live
|
||||
: (interrupt_handler && ! pragma_trapa)
|
||||
? (/* Need to save all the regs ever live. */
|
||||
(regs_ever_live[reg]
|
||||
|| (call_used_regs[reg]
|
||||
&& (! fixed_regs[reg] || reg == MACH_REG || reg == MACL_REG)
|
||||
&& regs_ever_live[PR_REG]))
|
||||
&& pr_live))
|
||||
&& reg != STACK_POINTER_REGNUM && reg != ARG_POINTER_REGNUM
|
||||
&& reg != RETURN_ADDRESS_POINTER_REGNUM
|
||||
&& reg != T_REG && reg != GBR_REG && reg != FPSCR_REG)
|
||||
|
@ -4598,7 +4606,7 @@ initial_elimination_offset (from, to)
|
|||
|
||||
if (from == RETURN_ADDRESS_POINTER_REGNUM
|
||||
&& (to == FRAME_POINTER_REGNUM || to == STACK_POINTER_REGNUM))
|
||||
return UNITS_PER_WORD + total_auto_space;
|
||||
return total_auto_space;
|
||||
|
||||
abort ();
|
||||
}
|
||||
|
@ -5638,3 +5646,13 @@ sh_adjust_cost (insn, link, dep_insn, cost)
|
|||
|
||||
return cost;
|
||||
}
|
||||
|
||||
/* For use by ALLOCATE_INITIAL_VALUE. Note that sh.md contains some
|
||||
'special function' patterns (type sfunc) that clobber pr, but that
|
||||
do not look like function calls to leaf_function_p. Hence we must
|
||||
do this extra check. */
|
||||
int
|
||||
sh_pr_n_sets ()
|
||||
{
|
||||
return REG_N_SETS (PR_REG);
|
||||
}
|
||||
|
|
|
@ -1293,7 +1293,7 @@ extern int current_function_anonymous_args;
|
|||
|
||||
#define RETURN_ADDR_RTX(COUNT, FRAME) \
|
||||
(((COUNT) == 0) \
|
||||
? gen_rtx_MEM (Pmode, gen_rtx_REG (Pmode, RETURN_ADDRESS_POINTER_REGNUM)) \
|
||||
? get_hard_reg_initial_val (Pmode, PR_REG) \
|
||||
: (rtx) 0)
|
||||
|
||||
/* Generate necessary RTL for __builtin_saveregs(). */
|
||||
|
@ -2369,4 +2369,11 @@ extern struct rtx_def *fpscr_rtx;
|
|||
1: .long " USER_LABEL_PREFIX #func " - 0b\n\
|
||||
2:")
|
||||
|
||||
#define ALLOCATE_INITIAL_VALUE(hard_reg) \
|
||||
(REGNO (hard_reg) == PR_REG \
|
||||
? (current_function_is_leaf && ! sh_pr_n_sets () \
|
||||
? (hard_reg) \
|
||||
: gen_rtx_MEM (Pmode, arg_pointer_rtx)) \
|
||||
: NULL_RTX)
|
||||
|
||||
#endif /* ! GCC_SH_H */
|
||||
|
|
Loading…
Reference in New Issue