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
This commit is contained in:
Richard Sandiford 2019-09-10 18:56:59 +00:00 committed by Richard Sandiford
parent a365fa0636
commit 2e3d041b13
10 changed files with 29 additions and 20 deletions

View File

@ -1,3 +1,19 @@
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.

View File

@ -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;

View File

@ -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))

View File

@ -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))

View File

@ -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);

View File

@ -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));
}

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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