[PATCH 2/5] Handcode gen_rtx_INSN

David Malcolm dmalcolm@redhat.com
Mon Sep 8 21:24:00 GMT 2014


gcc/ChangeLog:
	* combine.c (try_combine): Eliminate checked cast on result of
	gen_rtx_INSN.
	* emit-rtl.c (gen_rtx_INSN): New function, improving over the prior
	autogenerated one by strengthening the return type and params 2 and 3
	from rtx to rtx_insn *, and by naming the params.
	* gengenrtl.c (special_rtx): Add INSN to those that are
	special-cased.
	* rtl.h (gen_rtx_INSN): New prototype.
---
 gcc/combine.c   |  7 +++----
 gcc/emit-rtl.c  | 11 +++++++++++
 gcc/gengenrtl.c |  1 +
 gcc/rtl.h       |  4 ++++
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index 60524b5..0ec7f85 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2772,10 +2772,9 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 	     never appear in the insn stream so giving it the same INSN_UID
 	     as I2 will not cause a problem.  */
 
-	  i1 = as_a <rtx_insn *> (
-		 gen_rtx_INSN (VOIDmode, NULL_RTX, i2, BLOCK_FOR_INSN (i2),
-			       XVECEXP (PATTERN (i2), 0, 1), INSN_LOCATION (i2),
-			       -1, NULL_RTX));
+	  i1 = gen_rtx_INSN (VOIDmode, NULL, i2, BLOCK_FOR_INSN (i2),
+			     XVECEXP (PATTERN (i2), 0, 1), INSN_LOCATION (i2),
+			     -1, NULL_RTX);
 	  INSN_UID (i1) = INSN_UID (i2);
 
 	  SUBST (PATTERN (i2), XVECEXP (PATTERN (i2), 0, 0));
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index e3df826..0acdd08 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -424,6 +424,17 @@ gen_rtx_INSN_LIST (enum machine_mode mode, rtx insn, rtx insn_list)
 						 insn_list));
 }
 
+rtx_insn *
+gen_rtx_INSN (enum machine_mode mode, rtx_insn *prev_insn, rtx_insn *next_insn,
+	      basic_block bb, rtx pattern, int location, int code,
+	      rtx reg_notes)
+{
+  return as_a <rtx_insn *> (gen_rtx_fmt_uuBeiie (INSN, mode,
+						 prev_insn, next_insn,
+						 bb, pattern, location, code,
+						 reg_notes));
+}
+
 rtx
 gen_rtx_CONST_INT (enum machine_mode mode ATTRIBUTE_UNUSED, HOST_WIDE_INT arg)
 {
diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c
index 885dd20..d3eca98 100644
--- a/gcc/gengenrtl.c
+++ b/gcc/gengenrtl.c
@@ -125,6 +125,7 @@ special_rtx (int idx)
 {
   return (strcmp (defs[idx].enumname, "EXPR_LIST") == 0
 	  || strcmp (defs[idx].enumname, "INSN_LIST") == 0
+	  || strcmp (defs[idx].enumname, "INSN") == 0
 	  || strcmp (defs[idx].enumname, "CONST_INT") == 0
 	  || strcmp (defs[idx].enumname, "REG") == 0
 	  || strcmp (defs[idx].enumname, "SUBREG") == 0
diff --git a/gcc/rtl.h b/gcc/rtl.h
index ddf89b0..fae3b5d 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3089,6 +3089,10 @@ get_mem_attrs (const_rtx x)
 
 extern rtx_expr_list *gen_rtx_EXPR_LIST (enum machine_mode, rtx, rtx);
 extern rtx_insn_list *gen_rtx_INSN_LIST (enum machine_mode, rtx, rtx);
+extern rtx_insn *
+gen_rtx_INSN (enum machine_mode mode, rtx_insn *prev_insn, rtx_insn *next_insn,
+	      basic_block bb, rtx pattern, int location, int code,
+	      rtx reg_notes);
 extern rtx gen_rtx_CONST_INT (enum machine_mode, HOST_WIDE_INT);
 extern rtx gen_rtx_CONST_VECTOR (enum machine_mode, rtvec);
 extern rtx gen_raw_REG (enum machine_mode, int);
-- 
1.8.5.3



More information about the Gcc-patches mailing list