Message ID | 1589468303-7890-2-git-send-email-christophe.lyon@linaro.org |
---|---|
State | New |
Headers | show |
Series | [1/2] arm: Factorize several occurrences of the same code into reg_needs_saving_p | expand |
> static bool reg_needs_saving_p (unsigned reg) > { > unsigned long func_type = arm_current_func_type (); Ah ok , you needed it here. Ramana
On Thu, 14 May 2020 at 17:58, Ramana Radhakrishnan <ramana.gcc@googlemail.com> wrote: > > > static bool reg_needs_saving_p (unsigned reg) > > { > > unsigned long func_type = arm_current_func_type (); > > Ah ok , you needed it here. Yes sorry. Is this patch (2/2) OK? Thanks, Christophe > > Ramana
On Fri, May 15, 2020 at 7:36 AM Christophe Lyon <christophe.lyon@linaro.org> wrote: > > On Thu, 14 May 2020 at 17:58, Ramana Radhakrishnan > <ramana.gcc@googlemail.com> wrote: > > > > > static bool reg_needs_saving_p (unsigned reg) > > > { > > > unsigned long func_type = arm_current_func_type (); > > > > Ah ok , you needed it here. > > Yes sorry. > Is this patch (2/2) OK? > This looks ok to me as long as there are no regressions and you rejig the hunks between 1/2 and 2/2 regards Ramana > Thanks, > > Christophe > > > > > Ramana
On Fri, 15 May 2020 at 11:38, Ramana Radhakrishnan <ramana.gcc@googlemail.com> wrote: > > On Fri, May 15, 2020 at 7:36 AM Christophe Lyon > <christophe.lyon@linaro.org> wrote: > > > > On Thu, 14 May 2020 at 17:58, Ramana Radhakrishnan > > <ramana.gcc@googlemail.com> wrote: > > > > > > > static bool reg_needs_saving_p (unsigned reg) > > > > { > > > > unsigned long func_type = arm_current_func_type (); > > > > > > Ah ok , you needed it here. > > > > Yes sorry. > > Is this patch (2/2) OK? > > > > This looks ok to me as long as there are no regressions and you rejig > the hunks between 1/2 and 2/2 > Ok, thanks! > regards > Ramana > > > Thanks, > > > > Christophe > > > > > > > > Ramana
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 694c1bb..0107f50 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -4188,16 +4188,29 @@ arm_trampoline_adjust_address (rtx addr) return addr; } -/* Return 1 if REG needs to be saved. */ +/* Return 1 if REG needs to be saved. For interrupt handlers, this + includes call-clobbered registers too. If this is a leaf function + we can just examine the registers used by the RTL, but otherwise we + have to assume that whatever function is called might clobber + anything, and so we have to save all the call-clobbered registers + as well. */ static bool reg_needs_saving_p (unsigned reg) { unsigned long func_type = arm_current_func_type (); - if (!df_regs_ever_live_p (reg) - || call_used_or_fixed_reg_p (reg)) - return false; + if (IS_INTERRUPT (func_type)) + if (df_regs_ever_live_p (reg) + /* Save call-clobbered core registers. */ + || (! crtl->is_leaf && call_used_or_fixed_reg_p (reg) && reg < FIRST_VFP_REGNUM)) + return true; + else + return false; else - return true; + if (!df_regs_ever_live_p (reg) + || call_used_or_fixed_reg_p (reg)) + return false; + else + return true; } /* Return 1 if it is possible to return using a single instruction. @@ -20685,8 +20698,7 @@ arm_compute_save_reg0_reg12_mask (void) max_reg = 12; for (reg = 0; reg <= max_reg; reg++) - if (df_regs_ever_live_p (reg) - || (! crtl->is_leaf && call_used_or_fixed_reg_p (reg))) + if (reg_needs_saving_p (reg)) save_reg_mask |= (1 << reg); /* Also save the pic base register if necessary. */