re PR debug/66691 (ICE on valid code at -O3 with -g enabled in simplify_subreg, at...
[gcc.git] / gcc / genpeep.c
index a8afadbc809e3149ea472bf091d85f347265beb9..b914e85f863af46c4059408495dcf4c6385118a5 100644 (file)
@@ -1,5 +1,5 @@
 /* Generate code from machine description to perform peephole optimizations.
-   Copyright (C) 1987-2014 Free Software Foundation, Inc.
+   Copyright (C) 1987-2015 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -276,6 +276,12 @@ match_rtx (rtx x, struct link *path, int fail_label)
          printf ("  if (XINT (x, %d) != %d) goto L%d;\n",
                  i, XINT (x, i), fail_label);
        }
+      else if (fmt[i] == 'r')
+       {
+         gcc_assert (i == 0);
+         printf ("  if (REGNO (x) != %d) goto L%d;\n",
+                 REGNO (x), fail_label);
+       }
       else if (fmt[i] == 'w')
        {
          /* Make sure that at run time `x' is the RTX we want to test.  */
@@ -359,6 +365,15 @@ from the machine description file `md'.  */\n\n");
   printf ("#include \"coretypes.h\"\n");
   printf ("#include \"tm.h\"\n");
   printf ("#include \"insn-config.h\"\n");
+  printf ("#include \"hash-set.h\"\n");
+  printf ("#include \"machmode.h\"\n");
+  printf ("#include \"vec.h\"\n");
+  printf ("#include \"double-int.h\"\n");
+  printf ("#include \"input.h\"\n");
+  printf ("#include \"alias.h\"\n");
+  printf ("#include \"symtab.h\"\n");
+  printf ("#include \"wide-int.h\"\n");
+  printf ("#include \"inchash.h\"\n");
   printf ("#include \"tree.h\"\n");
   printf ("#include \"varasm.h\"\n");
   printf ("#include \"stor-layout.h\"\n");
@@ -374,12 +389,12 @@ from the machine description file `md'.  */\n\n");
   printf ("#include \"flags.h\"\n");
   printf ("#include \"tm-constrs.h\"\n\n");
 
-  printf ("#ifdef HAVE_peephole\n");
   printf ("extern rtx peep_operand[];\n\n");
   printf ("#define operands peep_operand\n\n");
 
-  printf ("rtx\npeephole (rtx ins1)\n{\n");
-  printf ("  rtx insn ATTRIBUTE_UNUSED, x ATTRIBUTE_UNUSED, pat ATTRIBUTE_UNUSED;\n\n");
+  printf ("rtx_insn *\npeephole (rtx_insn *ins1)\n{\n");
+  printf ("  rtx_insn *insn ATTRIBUTE_UNUSED;\n");
+  printf ("  rtx x ATTRIBUTE_UNUSED, pat ATTRIBUTE_UNUSED;\n\n");
 
   /* Early out: no peepholes for insns followed by barriers.  */
   printf ("  if (NEXT_INSN (ins1)\n");
@@ -407,7 +422,6 @@ from the machine description file `md'.  */\n\n");
     max_opno = 1;
 
   printf ("rtx peep_operand[%d];\n", max_opno + 1);
-  printf ("#endif\n");
 
   fflush (stdout);
   return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);