OSDN Git Service

* config/ia64/ia64.c: Fix a comment typo.
[pf3gnuchains/gcc-fork.git] / gcc / genoutput.c
index 9e27b27..b371e04 100644 (file)
@@ -1,6 +1,6 @@
 /* Generate code from to output assembler insns as recognized from rtl.
    Copyright (C) 1987, 1988, 1992, 1994, 1995, 1997, 1998, 1999, 2000, 2002,
-   2003, 2004 Free Software Foundation, Inc.
+   2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -160,6 +160,7 @@ struct data
   const char *template;
   int code_number;
   int index_number;
+  const char *filename;
   int lineno;
   int n_operands;              /* Number of operands this insn recognizes */
   int n_dups;                  /* Number times match_dup appears in pattern */
@@ -291,6 +292,7 @@ output_insn_data (void)
 
   for (d = idata; d; d = d->next)
     {
+      printf ("  /* %s:%d */\n", d->filename, d->lineno);
       printf ("  {\n");
 
       if (d->name)
@@ -377,7 +379,7 @@ output_insn_data (void)
          printf ("#endif\n");
          break;
        default:
-         abort ();
+         gcc_unreachable ();
        }
 
       if (d->name && d->name[0] != '*')
@@ -666,7 +668,7 @@ process_template (struct data *d, const char *template)
       printf ("output_%d (rtx *operands ATTRIBUTE_UNUSED, rtx insn ATTRIBUTE_UNUSED)\n",
              d->code_number);
       puts ("{");
-
+      print_rtx_ptr_loc (template);
       puts (template + 1);
       puts ("}");
     }
@@ -682,11 +684,22 @@ process_template (struct data *d, const char *template)
 
       for (i = 0, cp = &template[1]; *cp; )
        {
+         const char *ep, *sp;
+
          while (ISSPACE (*cp))
            cp++;
 
          printf ("  \"");
-         while (!IS_VSPACE (*cp) && *cp != '\0')
+
+         for (ep = sp = cp; !IS_VSPACE (*ep) && *ep != '\0'; ++ep)
+           if (!ISSPACE (*ep))
+             sp = ep + 1;
+
+         if (sp != ep)
+           message_with_line (d->lineno,
+                              "trailing whitespace in output template");
+
+         while (cp < sp)
            {
              putchar (*cp);
              cp++;
@@ -812,6 +825,7 @@ gen_insn (rtx insn, int lineno)
 
   d->code_number = next_code_number;
   d->index_number = next_index_number;
+  d->filename = read_rtx_filename;
   d->lineno = lineno;
   if (XSTR (insn, 0)[0])
     d->name = XSTR (insn, 0);
@@ -853,6 +867,7 @@ gen_peephole (rtx peep, int lineno)
 
   d->code_number = next_code_number;
   d->index_number = next_index_number;
+  d->filename = read_rtx_filename;
   d->lineno = lineno;
   d->name = 0;
 
@@ -891,6 +906,7 @@ gen_expand (rtx insn, int lineno)
 
   d->code_number = next_code_number;
   d->index_number = next_index_number;
+  d->filename = read_rtx_filename;
   d->lineno = lineno;
   if (XSTR (insn, 0)[0])
     d->name = XSTR (insn, 0);
@@ -934,6 +950,7 @@ gen_split (rtx split, int lineno)
 
   d->code_number = next_code_number;
   d->index_number = next_index_number;
+  d->filename = read_rtx_filename;
   d->lineno = lineno;
   d->name = 0;
 
@@ -971,9 +988,6 @@ main (int argc, char **argv)
 
   progname = "genoutput";
 
-  if (argc <= 1)
-    fatal ("no input file name");
-
   if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
     return (FATAL_EXIT_CODE);
 
@@ -1062,8 +1076,7 @@ check_constraint_len (void)
 
   for (p = ",#*+=&%!1234567890"; *p; p++)
     for (d = -9; d < 9; d++)
-      if (constraint_len (p, d) != d)
-       abort ();
+      gcc_assert (constraint_len (p, d) == d);
 }
 
 static int
@@ -1071,8 +1084,7 @@ constraint_len (const char *p, int genoutput_default_constraint_len)
 {
   /* Check that we still match defaults.h .  First we do a generation-time
      check that fails if the value is not the expected one...  */
-  if (DEFAULT_CONSTRAINT_LEN (*p, p) != 1)
-    abort ();
+  gcc_assert (DEFAULT_CONSTRAINT_LEN (*p, p) == 1);
   /* And now a compile-time check that should give a diagnostic if the
      definition doesn't exactly match.  */
 #define DEFAULT_CONSTRAINT_LEN(C,STR) 1