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 199/236] Introduce rtx_insn_list subclass of rtx_def


gcc/
	* coretypes.h (class rtx_insn_list): Add forward declaration.
	* rtl.h (class rtx_insn_list): New subclass of rtx_def
	(is_a_helper <rtx_insn_list *>::test): New.
	(rtx_insn_list::next): New.
	(rtx_insn_list::insn): New.
	(gen_rtx_INSN_LIST): Add prototype.
	* emit-rtl.c (gen_rtx_INSN_LIST): New.
	* gengenrtl.c (special_rtx): Add INSN_LIST.
---
 gcc/coretypes.h |  1 +
 gcc/emit-rtl.c  |  7 +++++++
 gcc/gengenrtl.c |  3 ++-
 gcc/rtl.h       | 45 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 17dc0e6..574d378 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -60,6 +60,7 @@ typedef const struct rtx_def *const_rtx;
    hierarchy, along with the relevant invariant.
    Where possible, keep this list in the same order as in rtl.def.  */
 class rtx_def;
+  class rtx_insn_list;           /* GET_CODE (X) == INSN_LIST */
   class rtx_insn;
     class rtx_real_insn;         /* INSN_P (X) */
       class rtx_debug_insn;      /* DEBUG_INSN_P (X) */
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index a343895..fef4faa 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -404,6 +404,13 @@ gen_raw_REG (enum machine_mode mode, int regno)
    functions do the raw handling.  If you add to this list, modify
    special_rtx in gengenrtl.c as well.  */
 
+rtx_insn_list *
+gen_rtx_INSN_LIST (enum machine_mode mode, rtx insn, rtx insn_list)
+{
+  return as_a <rtx_insn_list *> (gen_rtx_fmt_ue (INSN_LIST, mode, insn,
+						 insn_list));
+}
+
 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 550efb8..cd29341 100644
--- a/gcc/gengenrtl.c
+++ b/gcc/gengenrtl.c
@@ -123,7 +123,8 @@ special_format (const char *fmt)
 static int
 special_rtx (int idx)
 {
-  return (strcmp (defs[idx].enumname, "CONST_INT") == 0
+  return (strcmp (defs[idx].enumname, "INSN_LIST") == 0
+	  || strcmp (defs[idx].enumname, "CONST_INT") == 0
 	  || strcmp (defs[idx].enumname, "REG") == 0
 	  || strcmp (defs[idx].enumname, "SUBREG") == 0
 	  || strcmp (defs[idx].enumname, "MEM") == 0
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 9069ea7..1440897 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -402,6 +402,35 @@ struct GTY((desc("0"), tag("0"),
   } GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u;
 };
 
+class GTY(()) rtx_insn_list : public rtx_def
+{
+  /* No extra fields, but adds invariant: (GET_CODE (X) == INSN_LIST).
+
+     This is an instance of:
+
+       DEF_RTL_EXPR(INSN_LIST, "insn_list", "ue", RTX_EXTRA)
+
+     i.e. a node for constructing singly-linked lists of rtx_insn *, where
+     the list is "external" to the insn (as opposed to the doubly-linked
+     list embedded within rtx_insn itself).  */
+
+public:
+  /* Get next in list.  */
+  rtx_insn_list *next () const;
+
+  /* Get at the underlying instruction.  */
+  rtx_insn *insn () const;
+
+};
+
+template <>
+template <>
+inline bool
+is_a_helper <rtx_insn_list *>::test (rtx rt)
+{
+  return rt->code == INSN_LIST;
+}
+
 class GTY(()) rtx_insn : public rtx_def
 {
   /* No extra fields, but adds the invariant:
@@ -1187,6 +1216,21 @@ extern void rtl_check_failed_flag (const char *, const_rtx, const char *,
 
 #define XC2EXP(RTX, N, C1, C2)      (RTL_CHECKC2 (RTX, N, C1, C2).rt_rtx)
 
+
+/* Methods of rtx_insn_list.  */
+
+inline rtx_insn_list *rtx_insn_list::next () const
+{
+  rtx tmp = XEXP (this, 1);
+  return as_a_nullable <rtx_insn_list *> (tmp);
+}
+
+inline rtx_insn *rtx_insn_list::insn () const
+{
+  rtx tmp = XEXP (this, 0);
+  return as_a_nullable <rtx_insn *> (tmp);
+}
+
 /* ACCESS MACROS for particular fields of insns.  */
 
 /* Holds a unique number for each insn.
@@ -2925,6 +2969,7 @@ get_mem_attrs (const_rtx x)
    generation functions included above do the raw handling.  If you
    add to this list, modify special_rtx in gengenrtl.c as well.  */
 
+extern rtx_insn_list *gen_rtx_INSN_LIST (enum machine_mode, rtx, rtx);
 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


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