Pass "insn" as an rtx_insn within generated get_attr_ fns in insn-attrtab.c
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 21 Aug 2014 10:13:22 +0000 (10:13 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Thu, 21 Aug 2014 10:13:22 +0000 (10:13 +0000)
2014-08-21  David Malcolm  <dmalcolm@redhat.com>

* genattrtab.c (write_attr_get): Within the generated get_attr_
functions, rename param "insn" to "uncast_insn" and reintroduce
"insn" as an local rtx_insn * using a checked cast, so that "insn"
is an rtx_insn * within insn-attrtab.c

From-SVN: r214265

gcc/ChangeLog
gcc/genattrtab.c

index 840c79f..b7b4f10 100644 (file)
@@ -1,5 +1,12 @@
 2014-08-21  David Malcolm  <dmalcolm@redhat.com>
 
+       * genattrtab.c (write_attr_get): Within the generated get_attr_
+       functions, rename param "insn" to "uncast_insn" and reintroduce
+       "insn" as an local rtx_insn * using a checked cast, so that "insn"
+       is an rtx_insn * within insn-attrtab.c
+
+2014-08-21  David Malcolm  <dmalcolm@redhat.com>
+
        * output.h (peephole): Strengthen return type from rtx to
        rtx_insn *.
        * rtl.h (delete_for_peephole): Likewise for both params.
index 9db2ade..49c7872 100644 (file)
@@ -4027,9 +4027,9 @@ write_attr_get (FILE *outf, struct attr_desc *attr)
   /* If the attribute name starts with a star, the remainder is the name of
      the subroutine to use, instead of `get_attr_...'.  */
   if (attr->name[0] == '*')
-    fprintf (outf, "%s (rtx insn ATTRIBUTE_UNUSED)\n", &attr->name[1]);
+    fprintf (outf, "%s (rtx uncast_insn ATTRIBUTE_UNUSED)\n", &attr->name[1]);
   else if (attr->is_const == 0)
-    fprintf (outf, "get_attr_%s (rtx insn ATTRIBUTE_UNUSED)\n", attr->name);
+    fprintf (outf, "get_attr_%s (rtx uncast_insn ATTRIBUTE_UNUSED)\n", attr->name);
   else
     {
       fprintf (outf, "get_attr_%s (void)\n", attr->name);
@@ -4050,6 +4050,9 @@ write_attr_get (FILE *outf, struct attr_desc *attr)
 
   fprintf (outf, "{\n");
 
+  if (attr->name[0] == '*' || attr->is_const == 0)
+    fprintf (outf, "  rtx_insn *insn = as_a <rtx_insn *> (uncast_insn);\n");
+
   /* Find attributes that are worth caching in the conditions.  */
   cached_attr_count = 0;
   attrs_seen_more_than_once = 0;