[22/32] Remove global call sets: postreload.c
diff mbox series

Message ID mptv9tyve5k.fsf@arm.com
State New
Headers show
Series
  • Support multiple ABIs in the same translation unit
Related show

Commit Message

Richard Sandiford Sept. 11, 2019, 7:14 p.m. UTC
The "|= fixed_regs" in reload_combine isn't necessary, since the
set is only used to determine which values have changed (rather than,
for example, which registers are available for use).

In reload_cse_move2add we can be accurate about which registers
are still available.  BLKmode indicates a continuation of the
previous register, and since clobbers_reg_p handles multi-register
values, it's enough to skip over BLKmode entries and just test the
start register.


2019-09-11  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* postreload.c (reload_combine_recognize_pattern): Use crtl->abi
	when deciding whether a register is free for use after RA.
	(reload_combine): Remove unnecessary use of fixed_reg_set.
	(reload_cse_move2add): Use call_insn_abi to get the ABI of the
	call insn target.  Use reg_mode when testing whether a register
	is no longer available.

Patch
diff mbox series

Index: gcc/postreload.c
===================================================================
--- gcc/postreload.c	2019-09-11 19:47:24.418262673 +0100
+++ gcc/postreload.c	2019-09-11 19:48:41.905716645 +0100
@@ -1136,7 +1136,8 @@  reload_combine_recognize_pattern (rtx_in
 	      if (TEST_HARD_REG_BIT (reg_class_contents[INDEX_REG_CLASS], i)
 		  && reg_state[i].use_index == RELOAD_COMBINE_MAX_USES
 		  && reg_state[i].store_ruid <= reg_state[regno].use_ruid
-		  && (call_used_or_fixed_reg_p (i) || df_regs_ever_live_p (i))
+		  && (crtl->abi->clobbers_full_reg_p (i)
+		      || df_regs_ever_live_p (i))
 		  && (!frame_pointer_needed || i != HARD_FRAME_POINTER_REGNUM)
 		  && !fixed_regs[i] && !global_regs[i]
 		  && hard_regno_nregs (i, GET_MODE (reg)) == 1
@@ -1332,9 +1333,6 @@  reload_combine (void)
 	{
 	  rtx link;
 	  HARD_REG_SET used_regs = call_insn_abi (insn).full_reg_clobbers ();
-	  /* ??? This preserves traditional behavior; it might not be
-	     needed.  */
-	  used_regs |= fixed_reg_set;
 
 	  for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
 	    if (TEST_HARD_REG_BIT (used_regs, r))
@@ -2126,12 +2124,13 @@  reload_cse_move2add (rtx_insn *first)
 	 unknown values.  */
       if (CALL_P (insn))
 	{
+	  function_abi abi = call_insn_abi (insn);
 	  for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--)
-	    {
-	      if (call_used_or_fixed_reg_p (i))
-		/* Reset the information about this register.  */
-		reg_mode[i] = VOIDmode;
-	    }
+	    if (reg_mode[i] != VOIDmode
+		&& reg_mode[i] != BLKmode
+		&& abi.clobbers_reg_p (reg_mode[i], i))
+	      /* Reset the information about this register.  */
+	      reg_mode[i] = VOIDmode;
 	}
     }
   return changed;