]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
genemit.c (gen_insn): Print file:lineno comment before function.
authorRichard Henderson <rth@gcc.gnu.org>
Thu, 23 May 2002 21:32:14 +0000 (14:32 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 23 May 2002 21:32:14 +0000 (14:32 -0700)
        * genemit.c (gen_insn): Print file:lineno comment before function.
        (main): likewise.
        * gensupport.c (struct queue_elem): Add filename member.
        (queue_pattern): Initialize it; update all callers.
        (process_include): Don't free filename.
        (read_md_rtx): Set read_rtx_filename.

From-SVN: r53811

gcc/ChangeLog
gcc/genemit.c
gcc/gensupport.c

index 41f17dec1f09d1428c0dc5764cdf2a84523326d6..7eef475a7ae36ec6d9ee1b3dff03f8d0f07fa097 100644 (file)
@@ -1,6 +1,15 @@
+2002-05-23  Richard Henderson  <rth@redhat.com>
+
+       * genemit.c (gen_insn): Print file:lineno comment before function.
+       (main): likewise.
+       * gensupport.c (struct queue_elem): Add filename member.
+       (queue_pattern): Initialize it; update all callers.
+       (process_include): Don't free filename.
+       (read_md_rtx): Set read_rtx_filename.
+
 2002-05-23  Hans Boehm  <Hans_Boehm@hp.com>
-       * config/ia64/linux.h (IA64_GATE_AREA_END): Adjust for 64K
-       pages.
+
+       * config/ia64/linux.h (IA64_GATE_AREA_END): Adjust for 64K pages.
 
 2002-05-23  Richard Henderson  <rth@redhat.com>
 
index 5a7f32ae2da8a2acb04a0dbc0914bf76784663f2..302bda1e2140d73bc5a385d51486afcb7d11873d 100644 (file)
@@ -59,7 +59,7 @@ static void max_operand_1             PARAMS ((rtx));
 static int max_operand_vec             PARAMS ((rtx, int));
 static void print_code                 PARAMS ((RTX_CODE));
 static void gen_exp                    PARAMS ((rtx, enum rtx_code, char *));
-static void gen_insn                   PARAMS ((rtx));
+static void gen_insn                   PARAMS ((rtx, int));
 static void gen_expand                 PARAMS ((rtx));
 static void gen_split                  PARAMS ((rtx));
 static void output_add_clobbers                PARAMS ((void));
@@ -297,8 +297,9 @@ gen_exp (x, subroutine_type, used)
 /* Generate the `gen_...' function for a DEFINE_INSN.  */
 
 static void
-gen_insn (insn)
+gen_insn (insn, lineno)
      rtx insn;
+     int lineno;
 {
   int operands;
   int i;
@@ -383,6 +384,8 @@ gen_insn (insn)
   if (XSTR (insn, 0)[0] == 0 || XSTR (insn, 0)[0] == '*')
     return;
 
+  printf ("/* %s:%d */\n", read_rtx_filename, lineno);
+
   /* Find out how many operands this function has,
      and also whether any of them have register constraints.  */
   register_constraints = 0;
@@ -838,7 +841,7 @@ from the machine description file `md'.  */\n\n");
   printf ("#include \"toplev.h\"\n");
   printf ("#include \"ggc.h\"\n\n");
   printf ("#define FAIL return (end_sequence (), _val)\n");
-  printf ("#define DONE return (_val = gen_sequence (), end_sequence (), _val)\n");
+  printf ("#define DONE return (_val = gen_sequence (), end_sequence (), _val)\n\n");
 
   /* Read the machine description.  */
 
@@ -852,25 +855,28 @@ from the machine description file `md'.  */\n\n");
 
       switch (GET_CODE (desc))
        {
-         case DEFINE_INSN:
-             gen_insn (desc);
-             break;
-
-         case DEFINE_EXPAND:
-             gen_expand (desc);
-             break;
-
-         case DEFINE_SPLIT:
-             gen_split (desc);
-             break;
-
-         case DEFINE_PEEPHOLE2:
-             gen_split (desc);
-             break;
-
-         default:
-             break;
-        }
+       case DEFINE_INSN:
+         gen_insn (desc, line_no);
+         break;
+
+       case DEFINE_EXPAND:
+         printf ("/* %s:%d */\n", read_rtx_filename, line_no);
+         gen_expand (desc);
+         break;
+
+       case DEFINE_SPLIT:
+         printf ("/* %s:%d */\n", read_rtx_filename, line_no);
+         gen_split (desc);
+         break;
+
+       case DEFINE_PEEPHOLE2:
+         printf ("/* %s:%d */\n", read_rtx_filename, line_no);
+         gen_split (desc);
+         break;
+
+       default:
+         break;
+       }
       ++insn_index_number;
     }
 
index 8b52eaecab8374c4243f6fe204e2fb52425924dc..251cce995a5ab0316ff256cc6f6c77beb35f0ff6 100644 (file)
@@ -50,6 +50,7 @@ static char *base_dir = NULL;
 struct queue_elem
 {
   rtx data;
+  const char *filename;
   int lineno;
   struct queue_elem *next;
 };
@@ -63,7 +64,8 @@ static struct queue_elem **define_cond_exec_tail = &define_cond_exec_queue;
 static struct queue_elem *other_queue;
 static struct queue_elem **other_tail = &other_queue;
 
-static void queue_pattern PARAMS ((rtx, struct queue_elem ***, int));
+static void queue_pattern PARAMS ((rtx, struct queue_elem ***,
+                                  const char *, int));
 
 /* Current maximum length of directory names in the search path
    for include files.  (Altered as we get more of them.)  */
@@ -131,13 +133,15 @@ gen_rtx_CONST_INT (mode, arg)
 /* Queue PATTERN on LIST_TAIL.  */
 
 static void
-queue_pattern (pattern, list_tail, lineno)
+queue_pattern (pattern, list_tail, filename, lineno)
      rtx pattern;
      struct queue_elem ***list_tail;
+     const char *filename;
      int lineno;
 {
   struct queue_elem *e = (struct queue_elem *) xmalloc (sizeof (*e));
   e->data = pattern;
+  e->filename = filename;
   e->lineno = lineno;
   e->next = NULL;
   **list_tail = e;
@@ -248,11 +252,13 @@ process_include (desc, lineno)
       process_rtx (desc, lineno);
     }
 
+  /* Do not free pathname.  It is attached to the various rtx queue
+     elements.  */
+
   read_rtx_filename = old_filename;
   read_rtx_lineno = old_lineno;
 
   fclose (input_file);
-  free (pathname);
 }
 
 /* Process a top level rtx in some way, queueing as appropriate.  */
@@ -265,15 +271,15 @@ process_rtx (desc, lineno)
   switch (GET_CODE (desc))
     {
     case DEFINE_INSN:
-      queue_pattern (desc, &define_insn_tail, lineno);
+      queue_pattern (desc, &define_insn_tail, read_rtx_filename, lineno);
       break;
 
     case DEFINE_COND_EXEC:
-      queue_pattern (desc, &define_cond_exec_tail, lineno);
+      queue_pattern (desc, &define_cond_exec_tail, read_rtx_filename, lineno);
       break;
 
     case DEFINE_ATTR:
-      queue_pattern (desc, &define_attr_tail, lineno);
+      queue_pattern (desc, &define_attr_tail, read_rtx_filename, lineno);
       break;
 
     case INCLUDE:
@@ -324,13 +330,13 @@ process_rtx (desc, lineno)
        XVEC (desc, 4) = attr;
 
        /* Queue them.  */
-       queue_pattern (desc, &define_insn_tail, lineno);
-       queue_pattern (split, &other_tail, lineno);
+       queue_pattern (desc, &define_insn_tail, read_rtx_filename, lineno);
+       queue_pattern (split, &other_tail, read_rtx_filename, lineno);
        break;
       }
 
     default:
-      queue_pattern (desc, &other_tail, lineno);
+      queue_pattern (desc, &other_tail, read_rtx_filename, lineno);
       break;
     }
 }
@@ -850,7 +856,8 @@ process_one_cond_exec (ce_elem)
         patterns into the define_insn chain just after their generator
         is something we'll have to experiment with.  */
 
-      queue_pattern (insn, &other_tail, insn_elem->lineno);
+      queue_pattern (insn, &other_tail, insn_elem->filename,
+                    insn_elem->lineno);
     }
 }
 
@@ -1011,6 +1018,7 @@ read_md_rtx (lineno, seqnr)
   elem = *queue;
   *queue = elem->next;
   desc = elem->data;
+  read_rtx_filename = elem->filename;
   *lineno = elem->lineno;
   *seqnr = sequence_num;