From: Richard Sandiford Date: Tue, 10 Sep 2019 18:56:59 +0000 (+0000) Subject: Remove redundant fixed_regs tests X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2e3d041b1328f123e60244df9e78f9c30e73462c;p=gcc.git Remove redundant fixed_regs tests This patch removes redundant fixed_regs tests in things like: !fixed_regs[i] && !call_used_or_fixed_reg_p (i) 2019-09-10 Richard Sandiford gcc/ * config/alpha/alpha.c (alpha_compute_frame_layout): Remove redundant fixed_regs test. * config/bpf/bpf.c (bpf_compute_frame_layout, bpf_expand_prologue) (bpf_expand_epilogue): Likewise. * config/c6x/c6x.c (c6x_save_reg): Likewise. * config/ft32/ft32.c (ft32_expand_prologue): Likewise. (ft32_expand_epilogue): Likewise. * config/i386/i386.c (ix86_save_reg): Likewise. * config/moxie/moxie.c (moxie_expand_prologue): Likewise. (moxie_expand_epilogue): Likewise. * config/tilegx/tilegx.c (need_to_save_reg): Likewise. * config/tilepro/tilepro.c (need_to_save_reg): Likewise. * config/xtensa/xtensa.c (xtensa_call_save_reg): Likewise. From-SVN: r275603 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 099652b4e3c..86aa6768897 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2019-09-10 Richard Sandiford + + * config/alpha/alpha.c (alpha_compute_frame_layout): Remove redundant + fixed_regs test. + * config/bpf/bpf.c (bpf_compute_frame_layout, bpf_expand_prologue) + (bpf_expand_epilogue): Likewise. + * config/c6x/c6x.c (c6x_save_reg): Likewise. + * config/ft32/ft32.c (ft32_expand_prologue): Likewise. + (ft32_expand_epilogue): Likewise. + * config/i386/i386.c (ix86_save_reg): Likewise. + * config/moxie/moxie.c (moxie_expand_prologue): Likewise. + (moxie_expand_epilogue): Likewise. + * config/tilegx/tilegx.c (need_to_save_reg): Likewise. + * config/tilepro/tilepro.c (need_to_save_reg): Likewise. + * config/xtensa/xtensa.c (xtensa_call_save_reg): Likewise. + 2019-09-10 Richard Sandiford * hard-reg-set.h (call_used_or_fixed_reg_p): New macro. diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 5c07b9530fd..f01305b3c1a 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -7225,7 +7225,7 @@ alpha_compute_frame_layout (void) /* One for every register we have to save. */ for (unsigned i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (! fixed_regs[i] && ! call_used_or_fixed_reg_p (i) + if (! call_used_or_fixed_reg_p (i) && df_regs_ever_live_p (i) && i != REG_RA) sa_mask |= HOST_WIDE_INT_1U << i; diff --git a/gcc/config/bpf/bpf.c b/gcc/config/bpf/bpf.c index 6e57b0066b0..0fe80ce58ac 100644 --- a/gcc/config/bpf/bpf.c +++ b/gcc/config/bpf/bpf.c @@ -271,8 +271,7 @@ bpf_compute_frame_layout (void) the current function. There is no need to round up, since the registers are all 8 bytes wide. */ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - if ((!fixed_regs[regno] - && df_regs_ever_live_p (regno) + if ((df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) || (cfun->calls_alloca && regno == STACK_POINTER_REGNUM)) @@ -312,8 +311,7 @@ bpf_expand_prologue (void) right after the local variables. */ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) { - if ((!fixed_regs[regno] - && df_regs_ever_live_p (regno) + if ((df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) || (cfun->calls_alloca && regno == STACK_POINTER_REGNUM)) @@ -372,8 +370,7 @@ bpf_expand_epilogue (void) /* Restore callee-saved hard registes from the stack. */ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) { - if ((!fixed_regs[regno] - && df_regs_ever_live_p (regno) + if ((df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) || (cfun->calls_alloca && regno == STACK_POINTER_REGNUM)) diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index 7d1c2f7516e..e593273bbf5 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -2532,8 +2532,7 @@ static int c6x_save_reg (unsigned int regno) { return ((df_regs_ever_live_p (regno) - && !call_used_or_fixed_reg_p (regno) - && !fixed_regs[regno]) + && !call_used_or_fixed_reg_p (regno)) || (regno == RETURN_ADDR_REGNO && (df_regs_ever_live_p (regno) || !crtl->is_leaf)) diff --git a/gcc/config/ft32/ft32.c b/gcc/config/ft32/ft32.c index 3361df13249..840882f6344 100644 --- a/gcc/config/ft32/ft32.c +++ b/gcc/config/ft32/ft32.c @@ -475,7 +475,7 @@ ft32_expand_prologue (void) { for (regno = FIRST_PSEUDO_REGISTER; regno-- > 0;) { - if (!fixed_regs[regno] && !call_used_or_fixed_reg_p (regno) + if (!call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno)) { rtx preg = gen_rtx_REG (Pmode, regno); @@ -488,7 +488,7 @@ ft32_expand_prologue (void) { for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) { - if (!fixed_regs[regno] && df_regs_ever_live_p (regno) + if (df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) { insn = emit_insn (gen_movsi_push (gen_rtx_REG (Pmode, regno))); @@ -554,7 +554,7 @@ ft32_expand_epilogue (void) { for (regno = FIRST_PSEUDO_REGISTER; regno-- > 0;) { - if (!fixed_regs[regno] && !call_used_or_fixed_reg_p (regno) + if (!call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno)) { rtx preg = gen_rtx_REG (Pmode, regno); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 7525b9d2a43..9a87413ee1e 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -5666,7 +5666,6 @@ ix86_save_reg (unsigned int regno, bool maybe_eh_return, bool ignore_outlined) return (df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno) - && !fixed_regs[regno] && (regno != HARD_FRAME_POINTER_REGNUM || !frame_pointer_needed)); } diff --git a/gcc/config/moxie/moxie.c b/gcc/config/moxie/moxie.c index aa5948ea467..fa4ed3ff40d 100644 --- a/gcc/config/moxie/moxie.c +++ b/gcc/config/moxie/moxie.c @@ -288,8 +288,7 @@ moxie_expand_prologue (void) /* Save callee-saved registers. */ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) { - if (!fixed_regs[regno] - && df_regs_ever_live_p (regno) + if (df_regs_ever_live_p (regno) && !call_used_or_fixed_reg_p (regno)) { insn = emit_insn (gen_movsi_push (gen_rtx_REG (Pmode, regno))); @@ -351,7 +350,7 @@ moxie_expand_epilogue (void) emit_insn (gen_addsi3 (reg, reg, hard_frame_pointer_rtx)); } for (regno = FIRST_PSEUDO_REGISTER; regno-- > 0; ) - if (!fixed_regs[regno] && !call_used_or_fixed_reg_p (regno) + if (!call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno)) { rtx preg = gen_rtx_REG (Pmode, regno); diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c index 66a0ba51ff1..f2ea9bb9b0f 100644 --- a/gcc/config/tilegx/tilegx.c +++ b/gcc/config/tilegx/tilegx.c @@ -3660,7 +3660,7 @@ tilegx_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED) static bool need_to_save_reg (unsigned int regno) { - if (!fixed_regs[regno] && !call_used_or_fixed_reg_p (regno) + if (!call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno)) return true; diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c index ff014280ee8..a1d59b19a5e 100644 --- a/gcc/config/tilepro/tilepro.c +++ b/gcc/config/tilepro/tilepro.c @@ -3202,7 +3202,7 @@ tilepro_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED) static bool need_to_save_reg (unsigned int regno) { - if (!fixed_regs[regno] && !call_used_or_fixed_reg_p (regno) + if (!call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno)) return true; diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 822c2159783..3c129fdca1d 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -2686,8 +2686,7 @@ xtensa_call_save_reg(int regno) if (crtl->calls_eh_return && regno >= 2 && regno < 4) return true; - return !fixed_regs[regno] && !call_used_or_fixed_reg_p (regno) && - df_regs_ever_live_p (regno); + return !call_used_or_fixed_reg_p (regno) && df_regs_ever_live_p (regno); } /* Return the bytes needed to compute the frame pointer from the current