diff mbox

[04/11] make recog () take a rtx_insn *

Message ID 20161114080934.19056-5-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>

	* config/v850/v850.c (expand_prologue): Adjust.
	(expand_epilogue): Likewise.
	* expr.c (init_expr_target): Likewise.
	* genrecog.c (print_subroutine): Always make the argument type
	rtx_insn *.
	* recog.h: Adjust prototype.
---
 gcc/config/v850/v850.c | 4 ++--
 gcc/expr.c             | 4 ++--
 gcc/genrecog.c         | 8 +-------
 gcc/recog.h            | 2 +-
 4 files changed, 6 insertions(+), 12 deletions(-)

Comments

Richard Sandiford Nov. 14, 2016, 8:24 p.m. UTC | #1
Thanks for doing this.

tbsaunde+gcc@tbsaunde.org writes:
> diff --git a/gcc/genrecog.c b/gcc/genrecog.c
> index a8e8c22..aa7f629 100644
> --- a/gcc/genrecog.c
> +++ b/gcc/genrecog.c
> @@ -5102,8 +5102,7 @@ print_subroutine (output_state *os, state *s, int proc_id)
>    /* For now, the top-level "recog" takes a plain "rtx", and performs a
>       checked cast to "rtx_insn *" for use throughout the rest of the
>       function and the code it calls.  */
> -  const char *insn_param
> -    = proc_id > 0 ? "rtx_insn *insn" : "rtx uncast_insn";
> +  const char *insn_param = "rtx_insn *insn";

The comment is no longer true after the patch.  We might as well just
get rid of the variable now that it's equal to a constant string of
almost the same length as the variable name.

Richard
diff mbox

Patch

diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c
index 91e182f..c27bb6d 100644
--- a/gcc/config/v850/v850.c
+++ b/gcc/config/v850/v850.c
@@ -1741,7 +1741,7 @@  expand_prologue (void)
 
 	  v850_all_frame_related (save_all);
 
-	  code = recog (save_all, NULL_RTX, NULL);
+	  code = recog (save_all, NULL, NULL);
 	  if (code >= 0)
 	    {
 	      rtx insn = emit_insn (save_all);
@@ -1887,7 +1887,7 @@  expand_epilogue (void)
 	      offset -= 4;
 	    }
 
-	  code = recog (restore_all, NULL_RTX, NULL);
+	  code = recog (restore_all, NULL, NULL);
 	  
 	  if (code >= 0)
 	    {
diff --git a/gcc/expr.c b/gcc/expr.c
index 0b0946d..5d19699 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -109,7 +109,7 @@  static HOST_WIDE_INT int_expr_size (tree);
 void
 init_expr_target (void)
 {
-  rtx insn, pat;
+  rtx pat;
   machine_mode mode;
   int num_clobbers;
   rtx mem, mem1;
@@ -125,7 +125,7 @@  init_expr_target (void)
      useless RTL allocations.  */
   reg = gen_rtx_REG (word_mode, LAST_VIRTUAL_REGISTER + 1);
 
-  insn = rtx_alloc (INSN);
+  rtx_insn *insn = as_a<rtx_insn *> (rtx_alloc (INSN));
   pat = gen_rtx_SET (NULL_RTX, NULL_RTX);
   PATTERN (insn) = pat;
 
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index a8e8c22..aa7f629 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -5102,8 +5102,7 @@  print_subroutine (output_state *os, state *s, int proc_id)
   /* For now, the top-level "recog" takes a plain "rtx", and performs a
      checked cast to "rtx_insn *" for use throughout the rest of the
      function and the code it calls.  */
-  const char *insn_param
-    = proc_id > 0 ? "rtx_insn *insn" : "rtx uncast_insn";
+  const char *insn_param = "rtx_insn *insn";
   printf ("\n");
   switch (os->type)
     {
@@ -5142,11 +5141,6 @@  print_subroutine (output_state *os, state *s, int proc_id)
   if (proc_id == 0)
     {
       printf ("  recog_data.insn = NULL;\n");
-      if (os->type == RECOG)
-	{
-	  printf ("  rtx_insn *insn ATTRIBUTE_UNUSED;\n");
-	  printf ("  insn = safe_as_a <rtx_insn *> (uncast_insn);\n");
-	}
     }
   print_state (os, s, 2, true);
   printf ("}\n");
diff --git a/gcc/recog.h b/gcc/recog.h
index 3a59af8..9f6c42c 100644
--- a/gcc/recog.h
+++ b/gcc/recog.h
@@ -124,7 +124,7 @@  extern int offsettable_address_addr_space_p (int, machine_mode, rtx,
 					  ADDR_SPACE_GENERIC)
 extern bool mode_dependent_address_p (rtx, addr_space_t);
 
-extern int recog (rtx, rtx, int *);
+extern int recog (rtx, rtx_insn *, int *);
 #ifndef GENERATOR_FILE
 static inline int recog_memoized (rtx_insn *insn);
 #endif