diff mbox series

[17/32] Remove global call sets: gcse.c

Message ID mpth85iwsug.fsf@arm.com
State New
Headers show
Series Support multiple ABIs in the same translation unit | expand

Commit Message

Richard Sandiford Sept. 11, 2019, 7:11 p.m. UTC
This is another case in which we can conservatively treat partial
kills as full kills.  Again this is in principle 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/
	* gcse.c: Include function-abi.h.
	(compute_hash_table_work): Use call_insn_abi to get the ABI of
	the call insn target.  Invalidate partially call-clobbered
	registers as well as fully call-clobbered ones.

Comments

Richard Sandiford Sept. 25, 2019, 4:04 p.m. UTC | #1
Richard Sandiford <richard.sandiford@arm.com> writes:
> This is another case in which we can conservatively treat partial
> kills as full kills.  Again this is in principle a bug fix for
> TARGET_HARD_REGNO_CALL_PART_CLOBBERED targets, but in practice
> it probably doesn't make a difference.

Similary to the combine patch, I've updated this to avoid the
short "abi" name and use a temporary HARD_REG_SET instead.

Richard


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

gcc/
	* gcse.c: Include function-abi.h.
	(compute_hash_table_work): Use insn_callee_abi to get the ABI of
	the call insn target.  Invalidate partially call-clobbered
	registers as well as fully call-clobbered ones.

Index: gcc/gcse.c
===================================================================
--- gcc/gcse.c	2019-09-25 17:03:07.000000000 +0100
+++ gcc/gcse.c	2019-09-25 17:03:07.427363103 +0100
@@ -160,6 +160,7 @@ Software Foundation; either version 3, o
 #include "dbgcnt.h"
 #include "gcse.h"
 #include "gcse-common.h"
+#include "function-abi.h"
 
 /* We support GCSE via Partial Redundancy Elimination.  PRE optimizations
    are a superset of those done by classic GCSE.
@@ -1528,8 +1529,13 @@ compute_hash_table_work (struct gcse_has
 	  if (CALL_P (insn))
 	    {
 	      hard_reg_set_iterator hrsi;
-	      EXECUTE_IF_SET_IN_HARD_REG_SET (regs_invalidated_by_call,
-					      0, regno, hrsi)
+
+	      /* We don't track modes of hard registers, so we need
+		 to be conservative and assume that partial kills
+		 are full kills.  */
+	      HARD_REG_SET callee_clobbers
+		= insn_callee_abi (insn).full_and_partial_reg_clobbers ();
+	      EXECUTE_IF_SET_IN_HARD_REG_SET (callee_clobbers, 0, regno, hrsi)
 		record_last_reg_set_info (insn, regno);
 
 	      if (! RTL_CONST_OR_PURE_CALL_P (insn)
Jeff Law Sept. 29, 2019, 9:10 p.m. UTC | #2
On 9/11/19 1:11 PM, Richard Sandiford wrote:
> This is another case in which we can conservatively treat partial
> kills as full kills.  Again this is in principle 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/
> 	* gcse.c: Include function-abi.h.
> 	(compute_hash_table_work): Use call_insn_abi to get the ABI of
> 	the call insn target.  Invalidate partially call-clobbered
> 	registers as well as fully call-clobbered ones.
> 
OK
jeff
diff mbox series

Patch

Index: gcc/gcse.c
===================================================================
--- gcc/gcse.c	2019-09-09 18:58:51.468270740 +0100
+++ gcc/gcse.c	2019-09-11 19:48:23.453846664 +0100
@@ -160,6 +160,7 @@  Software Foundation; either version 3, o
 #include "dbgcnt.h"
 #include "gcse.h"
 #include "gcse-common.h"
+#include "function-abi.h"
 
 /* We support GCSE via Partial Redundancy Elimination.  PRE optimizations
    are a superset of those done by classic GCSE.
@@ -1527,9 +1528,14 @@  compute_hash_table_work (struct gcse_has
 
 	  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, regno, hrsi)
+
+	      /* We don't track modes of hard registers, so we need
+		 to be conservative and assume that partial kills
+		 are full kills.  */
+	      const_hard_reg_set clob = abi.full_and_partial_reg_clobbers ();
+	      EXECUTE_IF_SET_IN_HARD_REG_SET (clob, 0, regno, hrsi)
 		record_last_reg_set_info (insn, regno);
 
 	      if (! RTL_CONST_OR_PURE_CALL_P (insn)