OSDN Git Service

Out-of-date comments noticed while looking at PR 169.
[pf3gnuchains/gcc-fork.git] / gcc / genautomata.c
index 826da68..88f7a91 100644 (file)
@@ -1,5 +1,5 @@
 /* Pipeline hazard description translator.
-   Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
    Written by Vladimir Makarov <vmakarov@redhat.com>
 
@@ -658,6 +658,8 @@ static struct obstack irp;
 
 #define NDFA_OPTION "-ndfa"
 
+#define PROGRESS_OPTION "-progress"
+
 /* The following flags are set up by function `initiate_automaton_gen'.  */
 
 /* Make automata with nondeterministic reservation by insns (`-ndfa').  */
@@ -680,6 +682,10 @@ static int time_flag;
    result automaton and statistics information (`-v').  */
 static int v_flag;
 
+/* Flag of output of a progress bar showing how many states were
+   generated so far for automaton being processed (`-progress').  */
+static int progress_flag;
+
 /* Flag of generating warning instead of error for non-critical errors
    (`-w').  */
 static int w_flag;
@@ -1203,7 +1209,7 @@ struct ainsn
   ainsn_t next_equiv_class_insn;
   /* The following field value is nonzero if the insn declaration is
      the first insn declaration with given equivalence number.  */
-  char first_ainsn_with_given_equialence_num;
+  char first_ainsn_with_given_equivalence_num;
   /* The following field is number of class of equivalence of insns.
      It is necessary because many insns may be equivalent with the
      point of view of pipeline hazards.  */
@@ -1616,7 +1622,7 @@ n_sep_els (char *s, int sep, int par_flag)
    elements in the string and number of elements through els_num.
    Take parentheses into account if PAREN_P has nonzero value.  The
    function also inserts the end marker NULL at the end of vector.
-   Return 0 for the null string, -1 if parantheses are not balanced.  */
+   Return 0 for the null string, -1 if parentheses are not balanced.  */
 static char **
 get_str_vect (char *str, int *els_num, int sep, int paren_p)
 {
@@ -1922,16 +1928,18 @@ gen_automaton (rtx def)
 void
 gen_automata_option (rtx def)
 {
-  if (strcmp ((char *) XSTR (def, 0), NO_MINIMIZATION_OPTION + 1) == 0)
+  if (strcmp (XSTR (def, 0), NO_MINIMIZATION_OPTION + 1) == 0)
     no_minimization_flag = 1;
-  else if (strcmp ((char *) XSTR (def, 0), TIME_OPTION + 1) == 0)
+  else if (strcmp (XSTR (def, 0), TIME_OPTION + 1) == 0)
     time_flag = 1;
-  else if (strcmp ((char *) XSTR (def, 0), V_OPTION + 1) == 0)
+  else if (strcmp (XSTR (def, 0), V_OPTION + 1) == 0)
     v_flag = 1;
-  else if (strcmp ((char *) XSTR (def, 0), W_OPTION + 1) == 0)
+  else if (strcmp (XSTR (def, 0), W_OPTION + 1) == 0)
     w_flag = 1;
-  else if (strcmp ((char *) XSTR (def, 0), NDFA_OPTION + 1) == 0)
+  else if (strcmp (XSTR (def, 0), NDFA_OPTION + 1) == 0)
     ndfa_flag = 1;
+  else if (strcmp (XSTR (def, 0), PROGRESS_OPTION + 1) == 0)
+    progress_flag = 1;
   else
     fatal ("invalid option `%s' in automata_option", XSTR (def, 0));
 }
@@ -5265,8 +5273,8 @@ transform_insn_regexps (void)
 
   transform_time = create_ticker ();
   add_advance_cycle_insn_decl ();
-  fprintf (stderr, "Reservation transformation...");
-  fflush (stderr);
+  if (progress_flag)
+    fprintf (stderr, "Reservation transformation...");
   for (i = 0; i < description->decls_num; i++)
     {
       decl = description->decls [i];
@@ -5275,9 +5283,9 @@ transform_insn_regexps (void)
          = transform_regexp (copy_insn_regexp
                              (DECL_INSN_RESERV (decl)->regexp));
     }
-  fprintf (stderr, "done\n");
+  if (progress_flag)
+    fprintf (stderr, "done\n");
   ticker_off (&transform_time);
-  fflush (stderr);
 }
 
 \f
@@ -5443,7 +5451,8 @@ check_unit_distributions_to_automata (void)
   decl_t decl;
   int i;
 
-  fprintf (stderr, "Check unit distributions to automata...");
+  if (progress_flag)
+    fprintf (stderr, "Check unit distributions to automata...");
   annotation_message_reported_p = FALSE;
   for (i = 0; i < description->decls_num; i++)
     {
@@ -5453,7 +5462,8 @@ check_unit_distributions_to_automata (void)
          (DECL_INSN_RESERV (decl)->name,
           DECL_INSN_RESERV (decl)->transformed_regexp);
     }
-  fprintf (stderr, "done\n");
+  if (progress_flag)
+    fprintf (stderr, "done\n");
 }
 
 \f
@@ -5732,8 +5742,8 @@ make_automaton (automaton_t automaton)
                              = 1;
                             VLA_PTR_ADD (state_stack, state2);
                            states_n++;
-                           if (states_n % 100 == 0)
-                             fprintf (stderr, "*");
+                           if (progress_flag && states_n % 100 == 0)
+                             fprintf (stderr, ".");
                           }
                        added_arc = add_arc (state, state2, ainsn, 1);
                        if (!ndfa_flag)
@@ -5763,8 +5773,8 @@ make_automaton (automaton_t automaton)
           state2->it_was_placed_in_stack_for_NDFA_forming = 1;
           VLA_PTR_ADD (state_stack, state2);
          states_n++;
-         if (states_n % 100 == 0)
-           fprintf (stderr, "*");
+         if (progress_flag && states_n % 100 == 0)
+           fprintf (stderr, ".");
         }
       if (advance_cycle_ainsn == NULL)
        abort ();
@@ -5934,8 +5944,8 @@ NDFA_to_DFA (automaton_t automaton)
                  &state_stack))
            {
              states_n++;
-             if (states_n % 100 == 0)
-               fprintf (stderr, "*");
+             if (progress_flag && states_n % 100 == 0)
+               fprintf (stderr, ".");
            }
        }
     }
@@ -6282,7 +6292,7 @@ merge_states (automaton_t automaton, vla_ptr_t *equiv_classes)
                }
           }
        /* Its is important that alt states were sorted before and
-           after merging to have the same quering results.  */
+           after merging to have the same querying results.  */
         new_state->component_states = uniq_sort_alt_states (alt_states);
       }
     else
@@ -6395,25 +6405,35 @@ build_automaton (automaton_t automaton)
   int arcs_num;
 
   ticker_on (&NDFA_time);
-  if (automaton->corresponding_automaton_decl == NULL)
-    fprintf (stderr, "Create anonymous automaton (1 star is 100 new states):");
-  else
-    fprintf (stderr, "Create automaton `%s' (1 star is 100 new states):",
-            automaton->corresponding_automaton_decl->name);
+  if (progress_flag)
+    {
+      if (automaton->corresponding_automaton_decl == NULL)
+       fprintf (stderr, "Create anonymous automaton");
+      else
+       fprintf (stderr, "Create automaton `%s'",
+                automaton->corresponding_automaton_decl->name);
+      fprintf (stderr, " (1 dot is 100 new states):");
+    }
   make_automaton (automaton);
-  fprintf (stderr, " done\n");
+  if (progress_flag)
+    fprintf (stderr, " done\n");
   ticker_off (&NDFA_time);
   count_states_and_arcs (automaton, &states_num, &arcs_num);
   automaton->NDFA_states_num = states_num;
   automaton->NDFA_arcs_num = arcs_num;
   ticker_on (&NDFA_to_DFA_time);
-  if (automaton->corresponding_automaton_decl == NULL)
-    fprintf (stderr, "Make anonymous DFA (1 star is 100 new states):");
-  else
-    fprintf (stderr, "Make DFA `%s' (1 star is 100 new states):",
-            automaton->corresponding_automaton_decl->name);
+  if (progress_flag)
+    {
+      if (automaton->corresponding_automaton_decl == NULL)
+       fprintf (stderr, "Make anonymous DFA");
+      else
+       fprintf (stderr, "Make DFA `%s'",
+                automaton->corresponding_automaton_decl->name);
+      fprintf (stderr, " (1 dot is 100 new states):");
+    }
   NDFA_to_DFA (automaton);
-  fprintf (stderr, " done\n");
+  if (progress_flag)
+    fprintf (stderr, " done\n");
   ticker_off (&NDFA_to_DFA_time);
   count_states_and_arcs (automaton, &states_num, &arcs_num);
   automaton->DFA_states_num = states_num;
@@ -6421,13 +6441,17 @@ build_automaton (automaton_t automaton)
   if (!no_minimization_flag)
     {
       ticker_on (&minimize_time);
-      if (automaton->corresponding_automaton_decl == NULL)
-       fprintf (stderr, "Minimize anonymous DFA...");
-      else
-       fprintf (stderr, "Minimize DFA `%s'...",
-                automaton->corresponding_automaton_decl->name);
+      if (progress_flag)
+       {
+         if (automaton->corresponding_automaton_decl == NULL)
+           fprintf (stderr, "Minimize anonymous DFA...");
+         else
+           fprintf (stderr, "Minimize DFA `%s'...",
+                    automaton->corresponding_automaton_decl->name);
+       }
       minimize_DFA (automaton);
-      fprintf (stderr, "done\n");
+      if (progress_flag)
+       fprintf (stderr, "done\n");
       ticker_off (&minimize_time);
       count_states_and_arcs (automaton, &states_num, &arcs_num);
       automaton->minimal_DFA_states_num = states_num;
@@ -6586,7 +6610,7 @@ set_insn_equiv_classes (automaton_t automaton)
         first_insn = ainsn;
         if (!first_insn->first_insn_with_same_reservs)
          abort ();
-        first_insn->first_ainsn_with_given_equialence_num = 1;
+        first_insn->first_ainsn_with_given_equivalence_num = 1;
         curr_insn = first_insn;
         do
           {
@@ -6851,14 +6875,18 @@ create_automata (void)
        curr_automaton != NULL;
        curr_automaton = curr_automaton->next_automaton)
     {
-      if (curr_automaton->corresponding_automaton_decl == NULL)
-       fprintf (stderr, "Prepare anonymous automaton creation ... ");
-      else
-       fprintf (stderr, "Prepare automaton `%s' creation...",
-                curr_automaton->corresponding_automaton_decl->name);
+      if (progress_flag)
+       {
+         if (curr_automaton->corresponding_automaton_decl == NULL)
+           fprintf (stderr, "Prepare anonymous automaton creation ... ");
+         else
+           fprintf (stderr, "Prepare automaton `%s' creation...",
+                    curr_automaton->corresponding_automaton_decl->name);
+       }
       create_alt_states (curr_automaton);
       form_ainsn_with_same_reservs (curr_automaton);
-      fprintf (stderr, "done\n");
+      if (progress_flag)
+       fprintf (stderr, "done\n");
       build_automaton (curr_automaton);
       enumerate_states (curr_automaton);
       ticker_on (&equiv_time);
@@ -7645,7 +7673,7 @@ out_state_arcs_num (state_t state)
     {
       if (arc->insn == NULL)
        abort ();
-      if (arc->insn->first_ainsn_with_given_equialence_num)
+      if (arc->insn->first_ainsn_with_given_equivalence_num)
         result++;
     }
   return result;
@@ -7728,7 +7756,7 @@ output_trans_table (automaton_t automaton)
         {
           if (arc->insn == NULL)
            abort ();
-          if (arc->insn->first_ainsn_with_given_equialence_num)
+          if (arc->insn->first_ainsn_with_given_equivalence_num)
             add_vect_el (&transition_vect, arc->insn,
                          arc->to_state->order_state_num);
         }
@@ -7777,7 +7805,7 @@ output_state_alts_table (automaton_t automaton)
         {
           if (arc->insn == NULL)
            abort ();
-          if (arc->insn->first_ainsn_with_given_equialence_num)
+          if (arc->insn->first_ainsn_with_given_equivalence_num)
             add_vect_el (&state_alts_vect, arc->insn, arc->state_alts);
         }
       add_vect (automaton->state_alts_table, (*state_ptr)->order_state_num,
@@ -7886,7 +7914,7 @@ output_min_issue_delay_table (automaton_t automaton)
     VLA_HWINT (min_issue_delay_vect, i) = 0;
   automaton->max_min_delay = 0;
   for (ainsn = automaton->ainsn_list; ainsn != NULL; ainsn = ainsn->next_ainsn)
-    if (ainsn->first_ainsn_with_given_equialence_num)
+    if (ainsn->first_ainsn_with_given_equivalence_num)
       {
        for (state_ptr = VLA_PTR_BEGIN (output_states_vect);
             state_ptr <= (state_t *) VLA_PTR_LAST (output_states_vect);
@@ -7911,7 +7939,7 @@ output_min_issue_delay_table (automaton_t automaton)
   fprintf (output_file, " ");
   output_min_issue_delay_vect_name (output_file, automaton);
   fprintf (output_file, "[] ATTRIBUTE_UNUSED = {\n");
-  /* Compress the vector */
+  /* Compress the vector */
   if (automaton->max_min_delay < 2)
     automaton->min_issue_delay_table_compression_factor = 8;
   else if (automaton->max_min_delay < 4)
@@ -8207,13 +8235,10 @@ output_automata_list_min_issue_delay_code (automata_list_el_t automata_list)
 static void
 output_internal_min_issue_delay_func (void)
 {
-  fprintf (output_file, "static int %s (int, struct %s *);\n",
-          INTERNAL_MIN_ISSUE_DELAY_FUNC_NAME, CHIP_NAME);
   fprintf (output_file,
-          "static int\n%s (%s, %s)\n\tint %s;\n\tstruct %s *%s  ATTRIBUTE_UNUSED;\n",
+          "static int\n%s (int %s, struct %s *%s ATTRIBUTE_UNUSED)\n",
           INTERNAL_MIN_ISSUE_DELAY_FUNC_NAME, INTERNAL_INSN_CODE_NAME,
-          CHIP_PARAMETER_NAME, INTERNAL_INSN_CODE_NAME, CHIP_NAME,
-          CHIP_PARAMETER_NAME);
+          CHIP_NAME, CHIP_PARAMETER_NAME);
   fprintf (output_file, "{\n  int %s ATTRIBUTE_UNUSED;\n  int %s = -1;\n",
           TEMPORARY_VARIABLE_NAME, RESULT_VARIABLE_NAME);
   fprintf (output_file, "\n  switch (%s)\n    {\n", INTERNAL_INSN_CODE_NAME);
@@ -8323,12 +8348,9 @@ output_automata_list_transition_code (automata_list_el_t automata_list)
 static void
 output_internal_trans_func (void)
 {
-  fprintf (output_file, "static int %s (int, struct %s *);\n",
-          INTERNAL_TRANSITION_FUNC_NAME, CHIP_NAME);
   fprintf (output_file,
-          "static int\n%s (%s, %s)\n\tint %s;\n\tstruct %s *%s  ATTRIBUTE_UNUSED;\n",
+          "static int\n%s (int %s, struct %s *%s ATTRIBUTE_UNUSED)\n",
           INTERNAL_TRANSITION_FUNC_NAME, INTERNAL_INSN_CODE_NAME,
-          CHIP_PARAMETER_NAME, INTERNAL_INSN_CODE_NAME,
           CHIP_NAME, CHIP_PARAMETER_NAME);
   fprintf (output_file, "{\n  int %s ATTRIBUTE_UNUSED;\n", TEMPORARY_VARIABLE_NAME);
   fprintf (output_file, "\n  switch (%s)\n    {\n", INTERNAL_INSN_CODE_NAME);
@@ -8373,10 +8395,9 @@ output_dfa_insn_code_func (void)
   /* Emacs c-mode gets really confused if there's a { or } in column 0
      inside a string, so don't do that.  */
   fprintf (output_file, "\
-static void dfa_insn_code_enlarge (int);\n\
 static void\n\
-dfa_insn_code_enlarge (uid)\n\
-     int uid;\n{\n\
+dfa_insn_code_enlarge (int uid)\n\
+{\n\
   int i = %s;\n\
   %s = 2 * uid;\n\
   %s = xrealloc (%s,\n\
@@ -8390,15 +8411,12 @@ dfa_insn_code_enlarge (uid)\n\
           DFA_INSN_CODES_LENGTH_VARIABLE_NAME,
           DFA_INSN_CODES_VARIABLE_NAME);
   fprintf (output_file, "\
-static inline int %s (rtx);\n\
-static inline int\n%s (%s)\n\
-    rtx %s;\n{\n\
- int uid = INSN_UID (%s);\n\
- int %s;\n\n",
-          DFA_INSN_CODE_FUNC_NAME, DFA_INSN_CODE_FUNC_NAME,
-          INSN_PARAMETER_NAME, INSN_PARAMETER_NAME,
-          INSN_PARAMETER_NAME,
-          INTERNAL_INSN_CODE_NAME);
+static inline int\n%s (rtx %s)\n\
+{\n\
+  int uid = INSN_UID (%s);\n\
+  int %s;\n\n",
+          DFA_INSN_CODE_FUNC_NAME, INSN_PARAMETER_NAME,
+          INSN_PARAMETER_NAME, INTERNAL_INSN_CODE_NAME);
 
   fprintf (output_file,
           "  if (uid >= %s)\n    dfa_insn_code_enlarge (uid);\n\n",
@@ -8422,9 +8440,9 @@ static inline int\n%s (%s)\n\
 static void
 output_trans_func (void)
 {
-  fprintf (output_file, "int\n%s (%s, %s)\n\t%s %s;\n\trtx %s;\n",
-          TRANSITION_FUNC_NAME, STATE_NAME, INSN_PARAMETER_NAME,
-          STATE_TYPE_NAME, STATE_NAME, INSN_PARAMETER_NAME);
+  fprintf (output_file, "int\n%s (%s %s, rtx %s)\n",
+          TRANSITION_FUNC_NAME, STATE_TYPE_NAME, STATE_NAME,
+          INSN_PARAMETER_NAME);
   fprintf (output_file, "{\n  int %s;\n", INTERNAL_INSN_CODE_NAME);
   output_internal_insn_code_evaluation (INSN_PARAMETER_NAME,
                                        INTERNAL_INSN_CODE_NAME, -1);
@@ -8497,13 +8515,10 @@ output_automata_list_state_alts_code (automata_list_el_t automata_list)
 static void
 output_internal_state_alts_func (void)
 {
-  fprintf (output_file, "static int %s (int, struct %s *);\n",
-          INTERNAL_STATE_ALTS_FUNC_NAME, CHIP_NAME);
   fprintf (output_file,
-          "static int\n%s (%s, %s)\n\tint %s;\n\tstruct %s *%s;\n",
+          "static int\n%s (int %s, struct %s *%s)\n",
           INTERNAL_STATE_ALTS_FUNC_NAME, INTERNAL_INSN_CODE_NAME,
-          CHIP_PARAMETER_NAME, INTERNAL_INSN_CODE_NAME, CHIP_NAME,
-          CHIP_PARAMETER_NAME);
+          CHIP_NAME, CHIP_PARAMETER_NAME);
   fprintf (output_file, "{\n  int %s;\n", RESULT_VARIABLE_NAME);
   fprintf (output_file, "\n  switch (%s)\n    {\n", INTERNAL_INSN_CODE_NAME);
   output_insn_code_cases (output_automata_list_state_alts_code);
@@ -8532,9 +8547,9 @@ output_state_alts_func (void)
 static void
 output_min_issue_delay_func (void)
 {
-  fprintf (output_file, "int\n%s (%s, %s)\n\t%s %s;\n\trtx %s;\n",
-          MIN_ISSUE_DELAY_FUNC_NAME, STATE_NAME, INSN_PARAMETER_NAME,
-          STATE_TYPE_NAME, STATE_NAME, INSN_PARAMETER_NAME);
+  fprintf (output_file, "int\n%s (%s %s, rtx %s)\n",
+          MIN_ISSUE_DELAY_FUNC_NAME, STATE_TYPE_NAME, STATE_NAME,
+          INSN_PARAMETER_NAME);
   fprintf (output_file, "{\n  int %s;\n", INTERNAL_INSN_CODE_NAME);
   fprintf (output_file, "\n  if (%s != 0)\n    {\n", INSN_PARAMETER_NAME);
   fprintf (output_file, "      %s = %s (%s);\n", INTERNAL_INSN_CODE_NAME,
@@ -8555,11 +8570,8 @@ output_internal_dead_lock_func (void)
 {
   automaton_t automaton;
 
-  fprintf (output_file, "static int %s (struct %s *);\n",
-          INTERNAL_DEAD_LOCK_FUNC_NAME, CHIP_NAME);
-  fprintf (output_file, "static int\n%s (%s)\n\tstruct %s *%s;\n",
-          INTERNAL_DEAD_LOCK_FUNC_NAME, CHIP_PARAMETER_NAME, CHIP_NAME,
-          CHIP_PARAMETER_NAME);
+  fprintf (output_file, "static int\n%s (struct %s *%s)\n",
+          INTERNAL_DEAD_LOCK_FUNC_NAME, CHIP_NAME, CHIP_PARAMETER_NAME);
   fprintf (output_file, "{\n");
   for (automaton = description->first_automaton;
        automaton != NULL;
@@ -8578,8 +8590,8 @@ output_internal_dead_lock_func (void)
 static void
 output_dead_lock_func (void)
 {
-  fprintf (output_file, "int\n%s (%s)\n\t%s %s;\n",
-          DEAD_LOCK_FUNC_NAME, STATE_NAME, STATE_TYPE_NAME, STATE_NAME);
+  fprintf (output_file, "int\n%s (%s %s)\n",
+          DEAD_LOCK_FUNC_NAME, STATE_TYPE_NAME, STATE_NAME);
   fprintf (output_file, "{\n  return %s (%s);\n}\n\n",
           INTERNAL_DEAD_LOCK_FUNC_NAME, STATE_NAME);
 }
@@ -8588,11 +8600,8 @@ output_dead_lock_func (void)
 static void
 output_internal_reset_func (void)
 {
-  fprintf (output_file, "static void %s (struct %s *);\n",
-          INTERNAL_RESET_FUNC_NAME, CHIP_NAME);
-  fprintf (output_file, "static void\n%s (%s)\n\tstruct %s *%s;\n",
-          INTERNAL_RESET_FUNC_NAME, CHIP_PARAMETER_NAME,
-          CHIP_NAME, CHIP_PARAMETER_NAME);
+  fprintf (output_file, "static inline void\n%s (struct %s *%s)\n",
+          INTERNAL_RESET_FUNC_NAME, CHIP_NAME, CHIP_PARAMETER_NAME);
   fprintf (output_file, "{\n  memset (%s, 0, sizeof (struct %s));\n}\n\n",
           CHIP_PARAMETER_NAME, CHIP_NAME);
 }
@@ -8601,7 +8610,7 @@ output_internal_reset_func (void)
 static void
 output_size_func (void)
 {
-  fprintf (output_file, "int\n%s ()\n", SIZE_FUNC_NAME);
+  fprintf (output_file, "int\n%s (void)\n", SIZE_FUNC_NAME);
   fprintf (output_file, "{\n  return sizeof (struct %s);\n}\n\n", CHIP_NAME);
 }
 
@@ -8609,8 +8618,8 @@ output_size_func (void)
 static void
 output_reset_func (void)
 {
-  fprintf (output_file, "void\n%s (%s)\n\t %s %s;\n",
-          RESET_FUNC_NAME, STATE_NAME, STATE_TYPE_NAME, STATE_NAME);
+  fprintf (output_file, "void\n%s (%s %s)\n",
+          RESET_FUNC_NAME, STATE_TYPE_NAME, STATE_NAME);
   fprintf (output_file, "{\n  %s (%s);\n}\n\n", INTERNAL_RESET_FUNC_NAME,
           STATE_NAME);
 }
@@ -8620,11 +8629,9 @@ static void
 output_min_insn_conflict_delay_func (void)
 {
   fprintf (output_file,
-          "int\n%s (%s, %s, %s)\n\t%s %s;\n\trtx %s;\n\trtx %s;\n",
-          MIN_INSN_CONFLICT_DELAY_FUNC_NAME,
-          STATE_NAME, INSN_PARAMETER_NAME, INSN2_PARAMETER_NAME,
-          STATE_TYPE_NAME, STATE_NAME,
-          INSN_PARAMETER_NAME, INSN2_PARAMETER_NAME);
+          "int\n%s (%s %s, rtx %s, rtx %s)\n",
+          MIN_INSN_CONFLICT_DELAY_FUNC_NAME, STATE_TYPE_NAME,
+          STATE_NAME, INSN_PARAMETER_NAME, INSN2_PARAMETER_NAME);
   fprintf (output_file, "{\n  struct %s %s;\n  int %s, %s;\n",
           CHIP_NAME, CHIP_NAME, INTERNAL_INSN_CODE_NAME,
           INTERNAL_INSN2_CODE_NAME);
@@ -8659,24 +8666,17 @@ output_internal_insn_latency_func (void)
       {
        decl = description->decls[i];
        if (DECL_INSN_RESERV (decl)->default_latency > UCHAR_MAX
-           && tabletype[0] != 'i')  /* don't shrink it */
+           && tabletype[0] != 'i')  /* Don't shrink it.  */
          tabletype = "unsigned short";
        if (DECL_INSN_RESERV (decl)->default_latency > USHRT_MAX)
          tabletype = "int";
       }
 
-  fprintf (output_file, "static int %s (int, int, rtx, rtx);\n",
-          INTERNAL_INSN_LATENCY_FUNC_NAME);
-  fprintf (output_file, "static int\n%s (%s, %s, %s, %s)",
+  fprintf (output_file, "static int\n%s (int %s ATTRIBUTE_UNUSED,\n\tint %s ATTRIBUTE_UNUSED,\n\trtx %s ATTRIBUTE_UNUSED,\n\trtx %s ATTRIBUTE_UNUSED)\n",
           INTERNAL_INSN_LATENCY_FUNC_NAME, INTERNAL_INSN_CODE_NAME,
           INTERNAL_INSN2_CODE_NAME, INSN_PARAMETER_NAME,
           INSN2_PARAMETER_NAME);
-  fprintf (output_file,
-          "\n\tint %s ATTRIBUTE_UNUSED;\n\tint %s ATTRIBUTE_UNUSED;\n",
-          INTERNAL_INSN_CODE_NAME, INTERNAL_INSN2_CODE_NAME);
-  fprintf (output_file,
-          "\trtx %s ATTRIBUTE_UNUSED;\n\trtx %s ATTRIBUTE_UNUSED;\n{\n",
-          INSN_PARAMETER_NAME, INSN2_PARAMETER_NAME);
+  fprintf (output_file, "{\n");
 
   if (DECL_INSN_RESERV (advance_cycle_insn_decl)->insn_num == 0)
     {
@@ -8751,9 +8751,8 @@ output_internal_insn_latency_func (void)
 static void
 output_insn_latency_func (void)
 {
-  fprintf (output_file, "int\n%s (%s, %s)\n\trtx %s;\n\trtx %s;\n",
-          INSN_LATENCY_FUNC_NAME, INSN_PARAMETER_NAME, INSN2_PARAMETER_NAME,
-          INSN_PARAMETER_NAME, INSN2_PARAMETER_NAME);
+  fprintf (output_file, "int\n%s (rtx %s, rtx %s)\n",
+          INSN_LATENCY_FUNC_NAME, INSN_PARAMETER_NAME, INSN2_PARAMETER_NAME);
   fprintf (output_file, "{\n  int %s, %s;\n",
           INTERNAL_INSN_CODE_NAME, INTERNAL_INSN2_CODE_NAME);
   output_internal_insn_code_evaluation (INSN_PARAMETER_NAME,
@@ -8774,9 +8773,8 @@ output_print_reservation_func (void)
   int i, j;
 
   fprintf (output_file,
-          "void\n%s (%s, %s)\n\tFILE *%s;\n\trtx %s ATTRIBUTE_UNUSED;\n{\n",
+          "void\n%s (FILE *%s, rtx %s ATTRIBUTE_UNUSED)\n{\n",
            PRINT_RESERVATION_FUNC_NAME, FILE_PARAMETER_NAME,
-           INSN_PARAMETER_NAME, FILE_PARAMETER_NAME,
            INSN_PARAMETER_NAME);
 
   if (DECL_INSN_RESERV (advance_cycle_insn_decl)->insn_num == 0)
@@ -8872,8 +8870,7 @@ output_get_cpu_unit_code_func (void)
           LOW_VARIABLE_NAME, MIDDLE_VARIABLE_NAME, HIGH_VARIABLE_NAME);
   fprintf (output_file, "  static struct %s %s [] =\n    {\n",
           NAME_CODE_STRUCT_NAME, NAME_CODE_TABLE_NAME);
-  units = (unit_decl_t *) xmalloc (sizeof (unit_decl_t)
-                                  * description->units_num);
+  units = xmalloc (sizeof (unit_decl_t) * description->units_num);
   memcpy (units, units_array, sizeof (unit_decl_t) * description->units_num);
   qsort (units, description->units_num, sizeof (unit_decl_t), units_cmp);
   for (i = 0; i < description->units_num; i++)
@@ -8941,7 +8938,7 @@ static void
 output_dfa_clean_insn_cache_func (void)
 {
   fprintf (output_file,
-          "void\n%s ()\n{\n  int %s;\n\n",
+          "void\n%s (void)\n{\n  int %s;\n\n",
           DFA_CLEAN_INSN_CACHE_FUNC_NAME, I_VARIABLE_NAME);
   fprintf (output_file,
           "  for (%s = 0; %s < %s; %s++)\n    %s [%s] = -1;\n}\n\n",
@@ -8955,9 +8952,9 @@ static void
 output_dfa_start_func (void)
 {
   fprintf (output_file,
-          "void\n%s ()\n{\n  %s = get_max_uid ();\n",
+          "void\n%s (void)\n{\n  %s = get_max_uid ();\n",
           DFA_START_FUNC_NAME, DFA_INSN_CODES_LENGTH_VARIABLE_NAME);
-  fprintf (output_file, "  %s = (int *) xmalloc (%s * sizeof (int));\n",
+  fprintf (output_file, "  %s = xmalloc (%s * sizeof (int));\n",
           DFA_INSN_CODES_VARIABLE_NAME, DFA_INSN_CODES_LENGTH_VARIABLE_NAME);
   fprintf (output_file, "  %s ();\n}\n\n", DFA_CLEAN_INSN_CACHE_FUNC_NAME);
 }
@@ -8966,7 +8963,7 @@ output_dfa_start_func (void)
 static void
 output_dfa_finish_func (void)
 {
-  fprintf (output_file, "void\n%s ()\n{\n  free (%s);\n}\n\n",
+  fprintf (output_file, "void\n%s (void)\n{\n  free (%s);\n}\n\n",
           DFA_FINISH_FUNC_NAME, DFA_INSN_CODES_VARIABLE_NAME);
 }
 
@@ -9120,7 +9117,7 @@ output_automaton_units (automaton_t automaton)
   int there_is_an_automaton_unit;
   int i;
 
-  fprintf (output_description_file, "\n  Coresponding units:\n");
+  fprintf (output_description_file, "\n  Corresponding units:\n");
   fprintf (output_description_file, "    ");
   curr_line_length = 4;
   there_is_an_automaton_unit = 0;
@@ -9467,7 +9464,7 @@ make_insn_alts_attr (void)
   make_internal_attr (attr_printf (sizeof ("*")
                                   + strlen (INSN_ALTS_FUNC_NAME) + 1,
                                   "*%s", INSN_ALTS_FUNC_NAME),
-                     condexp, 0);
+                     condexp, ATTR_NONE);
 }
 
 \f
@@ -9504,7 +9501,7 @@ make_internal_dfa_insn_code_attr (void)
     (attr_printf (sizeof ("*")
                  + strlen (INTERNAL_DFA_INSN_CODE_FUNC_NAME) + 1,
                  "*%s", INTERNAL_DFA_INSN_CODE_FUNC_NAME),
-     condexp, 0);
+     condexp, ATTR_STATIC);
 }
 
 \f
@@ -9538,7 +9535,7 @@ make_default_insn_latency_attr (void)
   make_internal_attr (attr_printf (sizeof ("*")
                                   + strlen (INSN_DEFAULT_LATENCY_FUNC_NAME)
                                   + 1, "*%s", INSN_DEFAULT_LATENCY_FUNC_NAME),
-                     condexp, 0);
+                     condexp, ATTR_NONE);
 }
 
 \f
@@ -9587,7 +9584,7 @@ make_bypass_attr (void)
   make_internal_attr (attr_printf (sizeof ("*")
                                   + strlen (BYPASS_P_FUNC_NAME) + 1,
                                   "*%s", BYPASS_P_FUNC_NAME),
-                     result_rtx, 0);
+                     result_rtx, ATTR_NONE);
 }
 
 \f
@@ -9646,6 +9643,7 @@ initiate_automaton_gen (int argc, char **argv)
   time_flag = 0;
   v_flag = 0;
   w_flag = 0;
+  progress_flag = 0;
   for (i = 2; i < argc; i++)
     if (strcmp (argv [i], NO_MINIMIZATION_OPTION) == 0)
       no_minimization_flag = 1;
@@ -9657,6 +9655,8 @@ initiate_automaton_gen (int argc, char **argv)
       w_flag = 1;
     else if (strcmp (argv [i], NDFA_OPTION) == 0)
       ndfa_flag = 1;
+    else if (strcmp (argv [i], PROGRESS_OPTION) == 0)
+      progress_flag = 1;
     else if (strcmp (argv [i], "-split") == 0)
       {
        if (i + 1 >= argc)
@@ -9827,10 +9827,11 @@ expand_automata (void)
     }
   all_time = create_ticker ();
   check_time = create_ticker ();
-  fprintf (stderr, "Check description...");
-  fflush (stderr);
+  if (progress_flag)
+    fprintf (stderr, "Check description...");
   check_all_description ();
-  fprintf (stderr, "done\n");
+  if (progress_flag)
+    fprintf (stderr, "done\n");
   ticker_off (&check_time);
   generation_time = create_ticker ();
   if (!have_error)
@@ -9846,18 +9847,19 @@ expand_automata (void)
   if (!have_error)
     {
       form_important_insn_automata_lists ();
-      fprintf (stderr, "Generation of attributes...");
-      fflush (stderr);
+      if (progress_flag)
+       fprintf (stderr, "Generation of attributes...");
       make_internal_dfa_insn_code_attr ();
       make_insn_alts_attr ();
       make_default_insn_latency_attr ();
       make_bypass_attr ();
-      fprintf (stderr, "done\n");
+      if (progress_flag)
+       fprintf (stderr, "done\n");
     }
   ticker_off (&generation_time);
   ticker_off (&all_time);
-  fprintf (stderr, "All other genattrtab stuff...");
-  fflush (stderr);
+  if (progress_flag)
+    fprintf (stderr, "All other genattrtab stuff...");
 }
 
 /* The following is top level function to output PHR and to finish
@@ -9865,18 +9867,21 @@ expand_automata (void)
 void
 write_automata (void)
 {
-  fprintf (stderr, "done\n");
+  if (progress_flag)
+    fprintf (stderr, "done\n");
   if (have_error)
     fatal ("Errors in DFA description");
   ticker_on (&all_time);
   output_time = create_ticker ();
-  fprintf (stderr, "Forming and outputting automata tables...");
-  fflush (stderr);
+  if (progress_flag)
+    fprintf (stderr, "Forming and outputting automata tables...");
   output_dfa_max_issue_rate ();
   output_tables ();
-  fprintf (stderr, "done\n");
-  fprintf (stderr, "Output functions to work with automata...");
-  fflush (stderr);
+  if (progress_flag)
+    {
+      fprintf (stderr, "done\n");
+      fprintf (stderr, "Output functions to work with automata...");
+    }
   output_chip_definitions ();
   output_max_insn_queue_index_def ();
   output_internal_min_issue_delay_func ();
@@ -9911,7 +9916,8 @@ write_automata (void)
   output_dfa_clean_insn_cache_func ();
   output_dfa_start_func ();
   output_dfa_finish_func ();
-  fprintf (stderr, "done\n");
+  if (progress_flag)
+    fprintf (stderr, "done\n");
   if (v_flag)
     {
       output_description_file = fopen (output_description_file_name, "w");
@@ -9920,11 +9926,12 @@ write_automata (void)
          perror (output_description_file_name);
          exit (FATAL_EXIT_CODE);
        }
-      fprintf (stderr, "Output automata description...");
-      fflush (stderr);
+      if (progress_flag)
+       fprintf (stderr, "Output automata description...");
       output_description ();
       output_automaton_descriptions ();
-      fprintf (stderr, "done\n");
+      if (progress_flag)
+       fprintf (stderr, "done\n");
       output_statistics (output_description_file);
     }
   output_statistics (stderr);