diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-09-10 18:56:59 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-09-10 18:56:59 +0000 |
commit | 2e3d041b1328f123e60244df9e78f9c30e73462c (patch) | |
tree | 87b78fda6482711d37131af066629bcf30356d58 | |
parent | a365fa0636886aeda83e57b84d837cfba13597fe (diff) | |
download | gcc-2e3d041b1328f123e60244df9e78f9c30e73462c.zip gcc-2e3d041b1328f123e60244df9e78f9c30e73462c.tar.gz gcc-2e3d041b1328f123e60244df9e78f9c30e73462c.tar.bz2 |
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 <richard.sandiford@arm.com>
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
-rw-r--r-- | gcc/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/config/alpha/alpha.c | 2 | ||||
-rw-r--r-- | gcc/config/bpf/bpf.c | 9 | ||||
-rw-r--r-- | gcc/config/c6x/c6x.c | 3 | ||||
-rw-r--r-- | gcc/config/ft32/ft32.c | 6 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 1 | ||||
-rw-r--r-- | gcc/config/moxie/moxie.c | 5 | ||||
-rw-r--r-- | gcc/config/tilegx/tilegx.c | 2 | ||||
-rw-r--r-- | gcc/config/tilepro/tilepro.c | 2 | ||||
-rw-r--r-- | gcc/config/xtensa/xtensa.c | 3 |
10 files changed, 29 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 099652b..86aa676 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,21 @@ 2019-09-10 Richard Sandiford <richard.sandiford@arm.com> + * 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 <richard.sandiford@arm.com> + * hard-reg-set.h (call_used_or_fixed_reg_p): New macro. * cfgloopanal.c (init_set_costs): Use call_used_or_fixed_reg_p instead of testing call_used_regs directly. diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 5c07b95..f01305b 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 6e57b00..0fe80ce 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 7d1c2f7..e593273 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 3361df1..840882f 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 7525b9d..9a87413 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 aa5948e..fa4ed3f 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 66a0ba5..f2ea9bb 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 ff01428..a1d59b1 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 822c215..3c129fd 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 |