[7/9] Remove redundant fixed_regs tests
diff mbox series

Message ID mptk1ag2jsb.fsf@arm.com
State New
Headers show
Series
  • Reduce the amount of global ABI state
Related show

Commit Message

Richard Sandiford Sept. 10, 2019, 4:33 p.m. UTC
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.

Comments

Jeff Law Sept. 10, 2019, 6:35 p.m. UTC | #1
On 9/10/19 10:33 AM, Richard Sandiford wrote:
> 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.
> 
OK
jeff

Patch
diff mbox series

Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c	2019-09-10 17:22:54.018354355 +0100
+++ gcc/config/alpha/alpha.c	2019-09-10 17:23:00.786307258 +0100
@@ -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;
 
Index: gcc/config/bpf/bpf.c
===================================================================
--- gcc/config/bpf/bpf.c	2019-09-10 17:22:54.026354301 +0100
+++ gcc/config/bpf/bpf.c	2019-09-10 17:23:00.786307258 +0100
@@ -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))
Index: gcc/config/c6x/c6x.c
===================================================================
--- gcc/config/c6x/c6x.c	2019-09-10 17:22:54.030354272 +0100
+++ gcc/config/c6x/c6x.c	2019-09-10 17:23:00.786307258 +0100
@@ -2532,8 +2532,7 @@  must_reload_pic_reg_p (void)
 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))
Index: gcc/config/ft32/ft32.c
===================================================================
--- gcc/config/ft32/ft32.c	2019-09-10 17:22:54.042354189 +0100
+++ gcc/config/ft32/ft32.c	2019-09-10 17:23:00.786307258 +0100
@@ -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);
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	2019-09-10 17:22:54.046354161 +0100
+++ gcc/config/i386/i386.c	2019-09-10 17:23:00.794307202 +0100
@@ -5666,7 +5666,6 @@  ix86_save_reg (unsigned int regno, bool
 
   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));
 }
 
Index: gcc/config/moxie/moxie.c
===================================================================
--- gcc/config/moxie/moxie.c	2019-09-10 17:22:54.054354104 +0100
+++ gcc/config/moxie/moxie.c	2019-09-10 17:23:00.794307202 +0100
@@ -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);
Index: gcc/config/tilegx/tilegx.c
===================================================================
--- gcc/config/tilegx/tilegx.c	2019-09-10 17:22:54.090353853 +0100
+++ gcc/config/tilegx/tilegx.c	2019-09-10 17:23:00.794307202 +0100
@@ -3660,7 +3660,7 @@  tilegx_builtin_decl (unsigned code, bool
 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;
 
Index: gcc/config/tilepro/tilepro.c
===================================================================
--- gcc/config/tilepro/tilepro.c	2019-09-10 17:22:54.090353853 +0100
+++ gcc/config/tilepro/tilepro.c	2019-09-10 17:23:00.794307202 +0100
@@ -3202,7 +3202,7 @@  tilepro_builtin_decl (unsigned code, boo
 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;
 
Index: gcc/config/xtensa/xtensa.c
===================================================================
--- gcc/config/xtensa/xtensa.c	2019-09-10 17:22:54.090353853 +0100
+++ gcc/config/xtensa/xtensa.c	2019-09-10 17:23:00.794307202 +0100
@@ -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