diff mbox

[018/236] Strengthen return types of various {next|prev}_*insn from rtx to rtx_insn *

Message ID 1407345815-14551-19-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm Aug. 6, 2014, 5:19 p.m. UTC
These should all eventually require an rtx_insn * as an argument,
but we'll save that for a later patch.

gcc/
	* rtl.h (previous_insn): Strengthen return type from rtx to
	rtx_insn *.
	(next_insn): Likewise.
	(prev_nonnote_insn): Likewise.
	(prev_nonnote_insn_bb): Likewise.
	(next_nonnote_insn): Likewise.
	(next_nonnote_insn_bb): Likewise.
	(prev_nondebug_insn): Likewise.
	(next_nondebug_insn): Likewise.
	(prev_nonnote_nondebug_insn): Likewise.
	(next_nonnote_nondebug_insn): Likewise.
	(prev_real_insn): Likewise.
	(next_real_insn): Likewise.
	(prev_active_insn): Likewise.
	(next_active_insn): Likewise.

	* emit-rtl.c (next_insn): Strengthen return type from rtx to
	rtx_insn *, adding a checked cast.
	(previous_insn): Likewise.
	(next_nonnote_insn): Likewise.
	(next_nonnote_insn_bb): Likewise.
	(prev_nonnote_insn): Likewise.
	(prev_nonnote_insn_bb): Likewise.
	(next_nondebug_insn): Likewise.
	(prev_nondebug_insn): Likewise.
	(next_nonnote_nondebug_insn): Likewise.
	(prev_nonnote_nondebug_insn): Likewise.
	(next_real_insn): Likewise.
	(prev_real_insn): Likewise.
	(next_active_insn): Likewise.
	(prev_active_insn): Likewise.

	* config/sh/sh-protos.h (sh_find_set_of_reg): Convert function ptr
	param "stepfunc" so that it returns an rtx_insn * rather than an
	rtx, to track the change to prev_nonnote_insn_bb, which is the
	only function this is called with.
	* config/sh/sh.c (sh_find_set_of_reg): Likewise.
---
 gcc/config/sh/sh-protos.h |  2 +-
 gcc/config/sh/sh.c        |  2 +-
 gcc/emit-rtl.c            | 60 +++++++++++++++++++++++------------------------
 gcc/rtl.h                 | 28 +++++++++++-----------
 4 files changed, 46 insertions(+), 46 deletions(-)

Comments

Jeff Law Aug. 12, 2014, 9:59 p.m. UTC | #1
On 08/06/14 11:19, David Malcolm wrote:
> These should all eventually require an rtx_insn * as an argument,
> but we'll save that for a later patch.
>
> gcc/
> 	* rtl.h (previous_insn): Strengthen return type from rtx to
> 	rtx_insn *.
> 	(next_insn): Likewise.
> 	(prev_nonnote_insn): Likewise.
> 	(prev_nonnote_insn_bb): Likewise.
> 	(next_nonnote_insn): Likewise.
> 	(next_nonnote_insn_bb): Likewise.
> 	(prev_nondebug_insn): Likewise.
> 	(next_nondebug_insn): Likewise.
> 	(prev_nonnote_nondebug_insn): Likewise.
> 	(next_nonnote_nondebug_insn): Likewise.
> 	(prev_real_insn): Likewise.
> 	(next_real_insn): Likewise.
> 	(prev_active_insn): Likewise.
> 	(next_active_insn): Likewise.
>
> 	* emit-rtl.c (next_insn): Strengthen return type from rtx to
> 	rtx_insn *, adding a checked cast.
> 	(previous_insn): Likewise.
> 	(next_nonnote_insn): Likewise.
> 	(next_nonnote_insn_bb): Likewise.
> 	(prev_nonnote_insn): Likewise.
> 	(prev_nonnote_insn_bb): Likewise.
> 	(next_nondebug_insn): Likewise.
> 	(prev_nondebug_insn): Likewise.
> 	(next_nonnote_nondebug_insn): Likewise.
> 	(prev_nonnote_nondebug_insn): Likewise.
> 	(next_real_insn): Likewise.
> 	(prev_real_insn): Likewise.
> 	(next_active_insn): Likewise.
> 	(prev_active_insn): Likewise.
>
> 	* config/sh/sh-protos.h (sh_find_set_of_reg): Convert function ptr
> 	param "stepfunc" so that it returns an rtx_insn * rather than an
> 	rtx, to track the change to prev_nonnote_insn_bb, which is the
> 	only function this is called with.
> 	* config/sh/sh.c (sh_find_set_of_reg): Likewise.
OK.

Jeff
diff mbox

Patch

diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h
index 685cd23..cec324c 100644
--- a/gcc/config/sh/sh-protos.h
+++ b/gcc/config/sh/sh-protos.h
@@ -181,7 +181,7 @@  struct set_of_reg
   rtx set_src;
 };
 
-extern set_of_reg sh_find_set_of_reg (rtx reg, rtx insn, rtx(*stepfunc)(rtx));
+extern set_of_reg sh_find_set_of_reg (rtx reg, rtx insn, rtx_insn *(*stepfunc)(rtx));
 extern bool sh_is_logical_t_store_expr (rtx op, rtx insn);
 extern rtx sh_try_omit_signzero_extend (rtx extended_op, rtx insn);
 #endif /* RTX_CODE */
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index a5118c6..a21625f 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -13478,7 +13478,7 @@  sh_find_equiv_gbr_addr (rtx insn, rtx mem)
    'prev_nonnote_insn_bb'.  When the insn is found, try to extract the rtx
    of the reg set.  */
 set_of_reg
-sh_find_set_of_reg (rtx reg, rtx insn, rtx(*stepfunc)(rtx))
+sh_find_set_of_reg (rtx reg, rtx insn, rtx_insn *(*stepfunc)(rtx))
 {
   set_of_reg result;
   result.insn = insn;
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 729e0cc..c51b7d8 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3166,7 +3166,7 @@  get_max_insn_count (void)
 /* Return the next insn.  If it is a SEQUENCE, return the first insn
    of the sequence.  */
 
-rtx
+rtx_insn *
 next_insn (rtx insn)
 {
   if (insn)
@@ -3177,13 +3177,13 @@  next_insn (rtx insn)
 	insn = XVECEXP (PATTERN (insn), 0, 0);
     }
 
-  return insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Return the previous insn.  If it is a SEQUENCE, return the last insn
    of the sequence.  */
 
-rtx
+rtx_insn *
 previous_insn (rtx insn)
 {
   if (insn)
@@ -3194,13 +3194,13 @@  previous_insn (rtx insn)
 	insn = XVECEXP (PATTERN (insn), 0, XVECLEN (PATTERN (insn), 0) - 1);
     }
 
-  return insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Return the next insn after INSN that is not a NOTE.  This routine does not
    look inside SEQUENCEs.  */
 
-rtx
+rtx_insn *
 next_nonnote_insn (rtx insn)
 {
   while (insn)
@@ -3210,14 +3210,14 @@  next_nonnote_insn (rtx insn)
 	break;
     }
 
-  return insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Return the next insn after INSN that is not a NOTE, but stop the
    search before we enter another basic block.  This routine does not
    look inside SEQUENCEs.  */
 
-rtx
+rtx_insn *
 next_nonnote_insn_bb (rtx insn)
 {
   while (insn)
@@ -3226,16 +3226,16 @@  next_nonnote_insn_bb (rtx insn)
       if (insn == 0 || !NOTE_P (insn))
 	break;
       if (NOTE_INSN_BASIC_BLOCK_P (insn))
-	return NULL_RTX;
+	return NULL;
     }
 
-  return insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Return the previous insn before INSN that is not a NOTE.  This routine does
    not look inside SEQUENCEs.  */
 
-rtx
+rtx_insn *
 prev_nonnote_insn (rtx insn)
 {
   while (insn)
@@ -3245,14 +3245,14 @@  prev_nonnote_insn (rtx insn)
 	break;
     }
 
-  return insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Return the previous insn before INSN that is not a NOTE, but stop
    the search before we enter another basic block.  This routine does
    not look inside SEQUENCEs.  */
 
-rtx
+rtx_insn *
 prev_nonnote_insn_bb (rtx insn)
 {
   while (insn)
@@ -3261,16 +3261,16 @@  prev_nonnote_insn_bb (rtx insn)
       if (insn == 0 || !NOTE_P (insn))
 	break;
       if (NOTE_INSN_BASIC_BLOCK_P (insn))
-	return NULL_RTX;
+	return NULL;
     }
 
-  return insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Return the next insn after INSN that is not a DEBUG_INSN.  This
    routine does not look inside SEQUENCEs.  */
 
-rtx
+rtx_insn *
 next_nondebug_insn (rtx insn)
 {
   while (insn)
@@ -3280,13 +3280,13 @@  next_nondebug_insn (rtx insn)
 	break;
     }
 
-  return insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Return the previous insn before INSN that is not a DEBUG_INSN.
    This routine does not look inside SEQUENCEs.  */
 
-rtx
+rtx_insn *
 prev_nondebug_insn (rtx insn)
 {
   while (insn)
@@ -3296,13 +3296,13 @@  prev_nondebug_insn (rtx insn)
 	break;
     }
 
-  return insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Return the next insn after INSN that is not a NOTE nor DEBUG_INSN.
    This routine does not look inside SEQUENCEs.  */
 
-rtx
+rtx_insn *
 next_nonnote_nondebug_insn (rtx insn)
 {
   while (insn)
@@ -3312,13 +3312,13 @@  next_nonnote_nondebug_insn (rtx insn)
 	break;
     }
 
-  return insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Return the previous insn before INSN that is not a NOTE nor DEBUG_INSN.
    This routine does not look inside SEQUENCEs.  */
 
-rtx
+rtx_insn *
 prev_nonnote_nondebug_insn (rtx insn)
 {
   while (insn)
@@ -3328,14 +3328,14 @@  prev_nonnote_nondebug_insn (rtx insn)
 	break;
     }
 
-  return insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Return the next INSN, CALL_INSN or JUMP_INSN after INSN;
    or 0, if there is none.  This routine does not look inside
    SEQUENCEs.  */
 
-rtx
+rtx_insn *
 next_real_insn (rtx insn)
 {
   while (insn)
@@ -3345,14 +3345,14 @@  next_real_insn (rtx insn)
 	break;
     }
 
-  return insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Return the last INSN, CALL_INSN or JUMP_INSN before INSN;
    or 0, if there is none.  This routine does not look inside
    SEQUENCEs.  */
 
-rtx
+rtx_insn *
 prev_real_insn (rtx insn)
 {
   while (insn)
@@ -3362,7 +3362,7 @@  prev_real_insn (rtx insn)
 	break;
     }
 
-  return insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Return the last CALL_INSN in the current list, or 0 if there is none.
@@ -3396,7 +3396,7 @@  active_insn_p (const_rtx insn)
 		      && GET_CODE (PATTERN (insn)) != CLOBBER))));
 }
 
-rtx
+rtx_insn *
 next_active_insn (rtx insn)
 {
   while (insn)
@@ -3406,14 +3406,14 @@  next_active_insn (rtx insn)
 	break;
     }
 
-  return insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 /* Find the last insn before INSN that really does something.  This routine
    does not look inside SEQUENCEs.  After reload this also skips over
    standalone USE and CLOBBER insn.  */
 
-rtx
+rtx_insn *
 prev_active_insn (rtx insn)
 {
   while (insn)
@@ -3423,7 +3423,7 @@  prev_active_insn (rtx insn)
 	break;
     }
 
-  return insn;
+  return as_a_nullable <rtx_insn *> (insn);
 }
 
 #ifdef HAVE_cc0
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 31df60f..049f01e 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2395,20 +2395,20 @@  extern rtx emit_use (rtx);
 extern rtx make_insn_raw (rtx);
 extern void add_function_usage_to (rtx, rtx);
 extern rtx last_call_insn (void);
-extern rtx previous_insn (rtx);
-extern rtx next_insn (rtx);
-extern rtx prev_nonnote_insn (rtx);
-extern rtx prev_nonnote_insn_bb (rtx);
-extern rtx next_nonnote_insn (rtx);
-extern rtx next_nonnote_insn_bb (rtx);
-extern rtx prev_nondebug_insn (rtx);
-extern rtx next_nondebug_insn (rtx);
-extern rtx prev_nonnote_nondebug_insn (rtx);
-extern rtx next_nonnote_nondebug_insn (rtx);
-extern rtx prev_real_insn (rtx);
-extern rtx next_real_insn (rtx);
-extern rtx prev_active_insn (rtx);
-extern rtx next_active_insn (rtx);
+extern rtx_insn *previous_insn (rtx);
+extern rtx_insn *next_insn (rtx);
+extern rtx_insn *prev_nonnote_insn (rtx);
+extern rtx_insn *prev_nonnote_insn_bb (rtx);
+extern rtx_insn *next_nonnote_insn (rtx);
+extern rtx_insn *next_nonnote_insn_bb (rtx);
+extern rtx_insn *prev_nondebug_insn (rtx);
+extern rtx_insn *next_nondebug_insn (rtx);
+extern rtx_insn *prev_nonnote_nondebug_insn (rtx);
+extern rtx_insn *next_nonnote_nondebug_insn (rtx);
+extern rtx_insn *prev_real_insn (rtx);
+extern rtx_insn *next_real_insn (rtx);
+extern rtx_insn *prev_active_insn (rtx);
+extern rtx_insn *next_active_insn (rtx);
 extern int active_insn_p (const_rtx);
 extern rtx next_cc0_user (rtx);
 extern rtx prev_cc0_setter (rtx);