diff mbox

[03/11] make find_reg_equal_equiv_note take rtx_insn *

Message ID 20161114080934.19056-4-tbsaunde+gcc@tbsaunde.org
State New
Headers show

Commit Message

tbsaunde+gcc@tbsaunde.org Nov. 14, 2016, 8:09 a.m. UTC
From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2016-11-14  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* cse.c (count_reg_usage): Adjust.
	* rtl.h: Adjust prototypes.
	* rtlanal.c (find_reg_equal_equiv_note): Change argument type to
rtx_insn *.
---
 gcc/cse.c     | 63 +++++++++++++++++++++++++++++++----------------------------
 gcc/rtl.h     |  2 +-
 gcc/rtlanal.c |  2 +-
 3 files changed, 35 insertions(+), 32 deletions(-)
diff mbox

Patch

diff --git a/gcc/cse.c b/gcc/cse.c
index 11b8fbe..a2d8b4f 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -6824,37 +6824,40 @@  count_reg_usage (rtx x, int *counts, rtx dest, int incr)
     case CALL_INSN:
     case INSN:
     case JUMP_INSN:
-      /* We expect dest to be NULL_RTX here.  If the insn may throw,
-	 or if it cannot be deleted due to side-effects, mark this fact
-	 by setting DEST to pc_rtx.  */
-      if ((!cfun->can_delete_dead_exceptions && !insn_nothrow_p (x))
-	  || side_effects_p (PATTERN (x)))
-	dest = pc_rtx;
-      if (code == CALL_INSN)
-	count_reg_usage (CALL_INSN_FUNCTION_USAGE (x), counts, dest, incr);
-      count_reg_usage (PATTERN (x), counts, dest, incr);
-
-      /* Things used in a REG_EQUAL note aren't dead since loop may try to
-	 use them.  */
-
-      note = find_reg_equal_equiv_note (x);
-      if (note)
-	{
-	  rtx eqv = XEXP (note, 0);
+      {
+	rtx_insn *insn = as_a<rtx_insn *> (x);
+	/* We expect dest to be NULL_RTX here.  If the insn may throw,
+	   or if it cannot be deleted due to side-effects, mark this fact
+	   by setting DEST to pc_rtx.  */
+	if ((!cfun->can_delete_dead_exceptions && !insn_nothrow_p (x))
+	    || side_effects_p (PATTERN (x)))
+	  dest = pc_rtx;
+	if (code == CALL_INSN)
+	  count_reg_usage (CALL_INSN_FUNCTION_USAGE (x), counts, dest, incr);
+	count_reg_usage (PATTERN (x), counts, dest, incr);
+
+	/* Things used in a REG_EQUAL note aren't dead since loop may try to
+	   use them.  */
+
+	note = find_reg_equal_equiv_note (insn);
+	if (note)
+	  {
+	    rtx eqv = XEXP (note, 0);
 
-	  if (GET_CODE (eqv) == EXPR_LIST)
-	  /* This REG_EQUAL note describes the result of a function call.
-	     Process all the arguments.  */
-	    do
-	      {
-		count_reg_usage (XEXP (eqv, 0), counts, dest, incr);
-		eqv = XEXP (eqv, 1);
-	      }
-	    while (eqv && GET_CODE (eqv) == EXPR_LIST);
-	  else
-	    count_reg_usage (eqv, counts, dest, incr);
-	}
-      return;
+	    if (GET_CODE (eqv) == EXPR_LIST)
+	      /* This REG_EQUAL note describes the result of a function call.
+		 Process all the arguments.  */
+	      do
+		{
+		  count_reg_usage (XEXP (eqv, 0), counts, dest, incr);
+		  eqv = XEXP (eqv, 1);
+		}
+	      while (eqv && GET_CODE (eqv) == EXPR_LIST);
+	    else
+	      count_reg_usage (eqv, counts, dest, incr);
+	  }
+	return;
+      }
 
     case EXPR_LIST:
       if (REG_NOTE_KIND (x) == REG_EQUAL
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 7a44e3b..dc308f2 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3011,7 +3011,7 @@  extern int dead_or_set_p (const_rtx, const_rtx);
 extern int dead_or_set_regno_p (const_rtx, unsigned int);
 extern rtx find_reg_note (const_rtx, enum reg_note, const_rtx);
 extern rtx find_regno_note (const_rtx, enum reg_note, unsigned int);
-extern rtx find_reg_equal_equiv_note (const_rtx);
+extern rtx find_reg_equal_equiv_note (const rtx_insn *);
 extern rtx find_constant_src (const rtx_insn *);
 extern int find_reg_fusage (const_rtx, enum rtx_code, const_rtx);
 extern int find_regno_fusage (const_rtx, enum rtx_code, unsigned int);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 4617e8e..7a89c03 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -2113,7 +2113,7 @@  find_regno_note (const_rtx insn, enum reg_note kind, unsigned int regno)
    has such a note.  */
 
 rtx
-find_reg_equal_equiv_note (const_rtx insn)
+find_reg_equal_equiv_note (const rtx_insn *insn)
 {
   rtx link;