OSDN Git Service

2005-10-13 Andrew Pinski <pinskia@physics.uc.edu>
[pf3gnuchains/gcc-fork.git] / gcc / genautomata.c
index 64dde93..e39d327 100644 (file)
@@ -1,5 +1,6 @@
 /* Pipeline hazard description translator.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+   Free Software Foundation, Inc.
 
    Written by Vladimir Makarov <vmakarov@redhat.com>
 
@@ -17,8 +18,8 @@ for more details.
 
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.  */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
 
 /* References:
 
@@ -1356,7 +1357,8 @@ struct state_ainsn_table
 
 static const char *decl_name (enum decl_mode);
 static void decl_mode_check_failed (enum decl_mode, const char *,
-                                   const char *, int, const char *);
+                                   const char *, int, const char *)
+     ATTRIBUTE_NORETURN;
 
 /* Return string representation of declaration mode MODE.  */
 static const char *
@@ -1444,7 +1446,7 @@ decl_mode_check_failed (enum decl_mode mode, const char *expected_mode_str,
 static const char *regexp_name (enum regexp_mode);
 static void regexp_mode_check_failed (enum regexp_mode, const char *,
                                      const char *, int,
-                                     const char *);
+                                     const char *) ATTRIBUTE_NORETURN;
 
 
 /* Return string representation of regexp mode MODE.  */
@@ -2723,7 +2725,7 @@ add_presence_absence (unit_set_el_t dest_list,
                        }
                      else
                        warning
-                         ("unit `%s' excludes and requires presence of `%s'",
+                         (0, "unit `%s' excludes and requires presence of `%s'",
                           dst->unit_decl->name, unit->name);
                    }
                }
@@ -2743,7 +2745,7 @@ add_presence_absence (unit_set_el_t dest_list,
                      }
                    else
                      warning
-                       ("unit `%s' requires absence and presence of `%s'",
+                       (0, "unit `%s' requires absence and presence of `%s'",
                         dst->unit_decl->name, unit->name);
                  }
            if (no_error_flag)
@@ -2825,7 +2827,7 @@ process_decls (void)
                error ("repeated declaration of automaton `%s'",
                       DECL_AUTOMATON (decl)->name);
              else
-               warning ("repeated declaration of automaton `%s'",
+               warning (0, "repeated declaration of automaton `%s'",
                         DECL_AUTOMATON (decl)->name);
            }
        }
@@ -2945,7 +2947,7 @@ process_decls (void)
                           DECL_BYPASS (decl)->in_insn_name);
                      else
                        warning
-                         ("the same bypass `%s - %s' is already defined",
+                         (0, "the same bypass `%s - %s' is already defined",
                           DECL_BYPASS (decl)->out_insn_name,
                           DECL_BYPASS (decl)->in_insn_name);
                    }
@@ -3055,7 +3057,7 @@ check_automaton_usage (void)
          if (!w_flag)
            error ("automaton `%s' is not used", DECL_AUTOMATON (decl)->name);
          else
-           warning ("automaton `%s' is not used",
+           warning (0, "automaton `%s' is not used",
                     DECL_AUTOMATON (decl)->name);
        }
     }
@@ -3169,14 +3171,14 @@ check_usage (void)
          if (!w_flag)
            error ("unit `%s' is not used", DECL_UNIT (decl)->name);
          else
-           warning ("unit `%s' is not used", DECL_UNIT (decl)->name);
+           warning (0, "unit `%s' is not used", DECL_UNIT (decl)->name);
        }
       else if (decl->mode == dm_reserv && !DECL_RESERV (decl)->reserv_is_used)
        {
          if (!w_flag)
            error ("reservation `%s' is not used", DECL_RESERV (decl)->name);
          else
-           warning ("reservation `%s' is not used", DECL_RESERV (decl)->name);
+           warning (0, "reservation `%s' is not used", DECL_RESERV (decl)->name);
        }
     }
 }
@@ -6119,15 +6121,19 @@ copy_equiv_class (vla_ptr_t *to, const vla_ptr_t *from)
 static int
 first_cycle_unit_presence (state_t state, int unit_num)
 {
-  int presence_p;
+  alt_state_t alt_state;
 
   if (state->component_states == NULL)
-    presence_p = test_unit_reserv (state->reservs, 0, unit_num);
+    return test_unit_reserv (state->reservs, 0, unit_num);
   else
-    presence_p
-      = test_unit_reserv (state->component_states->state->reservs,
-                         0, unit_num);
-  return presence_p;
+    {
+      for (alt_state = state->component_states;
+          alt_state != NULL;
+          alt_state = alt_state->next_sorted_alt_state)
+       if (test_unit_reserv (alt_state->state->reservs, 0, unit_num))
+         return true;
+    }
+  return false;
 }
 
 /* The function returns nonzero value if STATE is not equivalent to
@@ -7626,7 +7632,7 @@ output_state_ainsn_table (state_ainsn_table_t tab, char *table_name,
 }
 
 /* The following function adds vector with length VECT_LENGTH and
-   elements pointed by VECT to table TAB as its line with number
+   elements pointed to by VECT to table TAB as its line with number
    VECT_NUM.  */
 static void
 add_vect (state_ainsn_table_t tab, int vect_num, vect_el_t *vect,
@@ -8969,9 +8975,8 @@ output_get_cpu_unit_code_func (void)
   int i;
   unit_decl_t *units;
 
-  fprintf (output_file, "int\n%s (%s)\n\tconst char *%s;\n",
-          GET_CPU_UNIT_CODE_FUNC_NAME, CPU_UNIT_NAME_PARAMETER_NAME,
-          CPU_UNIT_NAME_PARAMETER_NAME);
+  fprintf (output_file, "int\n%s (const char *%s)\n",
+          GET_CPU_UNIT_CODE_FUNC_NAME, CPU_UNIT_NAME_PARAMETER_NAME);
   fprintf (output_file, "{\n  struct %s {const char *%s; int %s;};\n",
           NAME_CODE_STRUCT_NAME, NAME_MEMBER_NAME, CODE_MEMBER_NAME);
   fprintf (output_file, "  int %s, %s, %s, %s;\n", CMP_VARIABLE_NAME,
@@ -9018,9 +9023,9 @@ output_cpu_unit_reservation_p (void)
 {
   automaton_t automaton;
 
-  fprintf (output_file, "int\n%s (%s, %s)\n\t%s %s;\n\tint %s;\n",
-          CPU_UNIT_RESERVATION_P_FUNC_NAME, STATE_NAME,
-          CPU_CODE_PARAMETER_NAME, STATE_TYPE_NAME, STATE_NAME,
+  fprintf (output_file, "int\n%s (%s %s, int %s)\n",
+          CPU_UNIT_RESERVATION_P_FUNC_NAME,
+          STATE_TYPE_NAME, STATE_NAME,
           CPU_CODE_PARAMETER_NAME);
   fprintf (output_file, "{\n  gcc_assert (%s >= 0 && %s < %d);\n",
           CPU_CODE_PARAMETER_NAME, CPU_CODE_PARAMETER_NAME,
@@ -9814,7 +9819,7 @@ check_automata_insn_issues (void)
                           reserv_ainsn->insn_reserv_decl->name);
                  else
                    warning
-                     ("Automaton `%s': Insn `%s' will never be issued",
+                     (0, "Automaton `%s': Insn `%s' will never be issued",
                       automaton->corresponding_automaton_decl->name,
                       reserv_ainsn->insn_reserv_decl->name);
                }
@@ -9824,7 +9829,7 @@ check_automata_insn_issues (void)
                    error ("Insn `%s' will never be issued",
                           reserv_ainsn->insn_reserv_decl->name);
                  else
-                   warning ("Insn `%s' will never be issued",
+                   warning (0, "Insn `%s' will never be issued",
                             reserv_ainsn->insn_reserv_decl->name);
                }
          }