[10/32] Remove global call sets: combine.c

Richard Sandiford richard.sandiford@arm.com
Wed Sep 11 19:08:00 GMT 2019


There shouldn't be many cases in which a useful hard register is
live across a call before RA, so we might as well keep things simple
and invalidate partially-clobbered registers here, in case the values
they hold leak into the call-clobbered part.  In principle this is
a bug fix for TARGET_HARD_REGNO_CALL_PART_CLOBBERED targets,
but in practice it probably doesn't make a difference.


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

gcc/
	* combine.c: Include function-abi.h.
	(record_dead_and_set_regs): Use call_insn_abi to get the ABI
	of call insns.  Invalidate partially-clobbered registers as
	well as fully-clobbered ones.

Index: gcc/combine.c
===================================================================
--- gcc/combine.c	2019-09-09 18:58:51.448270881 +0100
+++ gcc/combine.c	2019-09-11 19:47:57.062032638 +0100
@@ -105,6 +105,7 @@ Software Foundation; either version 3, o
 #include "valtrack.h"
 #include "rtl-iter.h"
 #include "print-rtl.h"
+#include "function-abi.h"
 
 /* Number of attempts to combine instructions in this function.  */
 
@@ -13464,11 +13465,21 @@ record_dead_and_set_regs (rtx_insn *insn
 
   if (CALL_P (insn))
     {
+      function_abi abi = call_insn_abi (insn);
       hard_reg_set_iterator hrsi;
-      EXECUTE_IF_SET_IN_HARD_REG_SET (regs_invalidated_by_call, 0, i, hrsi)
+      EXECUTE_IF_SET_IN_HARD_REG_SET (abi.full_and_partial_reg_clobbers (),
+				      0, i, hrsi)
 	{
 	  reg_stat_type *rsp;
 
+	  /* ??? We could try to preserve some information from the last
+	     set of register I if the call doesn't actually clobber
+	     (reg:last_set_mode I), which might be true for ABIs with
+	     partial clobbers.  However, it would be difficult to
+	     update last_set_nonzero_bits and last_sign_bit_copies
+	     to account for the part of I that actually was clobbered.
+	     It wouldn't help much anyway, since we rarely see this
+	     situation before RA.  */
 	  rsp = &reg_stat[i];
 	  rsp->last_set_invalid = 1;
 	  rsp->last_set = insn;



More information about the Gcc-patches mailing list