]> gcc.gnu.org Git - gcc.git/commitdiff
rtl.c (read_rtx): Provide suitable names for unnamed define_insn and define_insn_and_...
authorDJ Delorie <dj@redhat.com>
Thu, 16 Nov 2000 15:19:01 +0000 (10:19 -0500)
committerDJ Delorie <dj@gcc.gnu.org>
Thu, 16 Nov 2000 15:19:01 +0000 (10:19 -0500)
* rtl.c (read_rtx): Provide suitable names for unnamed
define_insn and define_insn_and_split patterns, based on file
and line numbers.

From-SVN: r37499

gcc/ChangeLog
gcc/rtl.c

index 473cd0d83cb10211b0c6053b275a19a659098fe6..7f1cea548edb59e856c724fbeb75bdbc8594b75d 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-16  DJ Delorie  <dj@redhat.com>
+
+       * rtl.c (read_rtx): Provide suitable names for unnamed
+       define_insn and define_insn_and_split patterns, based on file
+       and line numbers.
+
 2000-11-15  Neil Booth  <neilb@earthling.net>
 
         * cpplib.c (start_directive, end_directive): New functions.
index bb986e998b9cf8917d4398d4538f104692c12fd7..1ad5b3c4b8208d6c0edc4b75fee85285bd7cf50e 100644 (file)
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -1038,6 +1038,7 @@ read_rtx (infile)
        {
          int saw_paren = 0;
          register char *stringbuf;
+         int saw_anything = 0;
 
          c = read_skip_spaces (infile);
          if (c == '(')
@@ -1070,6 +1071,28 @@ read_rtx (infile)
                break;
 
              obstack_1grow (&rtl_obstack, c);
+             saw_anything = 1;
+           }
+
+         /* For insn patterns, we want to provide a default name
+            based on the file and line, like "*foo.md:12", if the
+            given name is blank.  These are only for define_insn and
+            define_insn_and_split, to aid debugging.  */
+         if (!saw_anything
+             && i == 0
+             && (GET_CODE (return_rtx) == DEFINE_INSN
+                 || GET_CODE (return_rtx) == DEFINE_INSN_AND_SPLIT))
+           {
+             char line_name[20];
+             const char *fn = (read_rtx_filename ? read_rtx_filename : "rtx");
+             char *slash;
+             for (slash = fn; *slash; slash ++)
+               if (*slash == '/' || *slash == '\\' || *slash == ':')
+                 fn = slash + 1;
+             obstack_1grow (&rtl_obstack, '*');
+             obstack_grow (&rtl_obstack, fn, strlen (fn));
+             sprintf (line_name, ":%d", read_rtx_lineno);
+             obstack_grow (&rtl_obstack, line_name, strlen (line_name));
            }
 
          obstack_1grow (&rtl_obstack, 0);
This page took 0.072753 seconds and 5 git commands to generate.