This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 06/10] Use rtx_insn more within peep2


gcc/
	* recog.c (peep2_attempt): Strengthen return type from rtx to
	rtx_insn *.
	(peep2_update_life): Likewise for params "last", "prev", removing
	a checked cast made redundant by this.
	(peephole2_optimize): Likewise for local "last".
---
 gcc/recog.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/recog.c b/gcc/recog.c
index 469dfe6..d07a57a 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -3160,7 +3160,7 @@ peep2_reinit_state (regset live)
    replacing them with ATTEMPT.  Returns the last insn emitted, or NULL
    if the replacement is rejected.  */
 
-static rtx
+static rtx_insn *
 peep2_attempt (basic_block bb, rtx uncast_insn, int match_len, rtx_insn *attempt)
 {
   rtx_insn *insn = safe_as_a <rtx_insn *> (uncast_insn);
@@ -3396,7 +3396,8 @@ peep2_attempt (basic_block bb, rtx uncast_insn, int match_len, rtx_insn *attempt
    matched, and which now need to be replaced in the buffer.  */
 
 static void
-peep2_update_life (basic_block bb, int match_len, rtx last, rtx prev)
+peep2_update_life (basic_block bb, int match_len, rtx_insn *last,
+		   rtx_insn *prev)
 {
   int i = peep2_buf_position (peep2_current + match_len + 1);
   rtx_insn *x;
@@ -3408,7 +3409,7 @@ peep2_update_life (basic_block bb, int match_len, rtx last, rtx prev)
   gcc_assert (peep2_current_count >= match_len + 1);
   peep2_current_count -= match_len + 1;
 
-  x = as_a <rtx_insn *> (last);
+  x = last;
   do
     {
       if (INSN_P (x))
@@ -3538,7 +3539,7 @@ peephole2_optimize (void)
 		      peephole2_insns (PATTERN (head), head, &match_len));
 	  if (attempt != NULL)
 	    {
-	      rtx last = peep2_attempt (bb, head, match_len, attempt);
+	      rtx_insn *last = peep2_attempt (bb, head, match_len, attempt);
 	      if (last)
 		{
 		  peep2_update_life (bb, match_len, last, PREV_INSN (attempt));
-- 
1.8.5.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]