r110126@banpei: zack | 2006-01-22 14:47:42 -0800
authorZack Weinberg <zackw@panix.com>
Mon, 23 Jan 2006 15:15:42 +0000 (15:15 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Mon, 23 Jan 2006 15:15:42 +0000 (15:15 +0000)
 r110126@banpei:  zack | 2006-01-22 14:47:42 -0800
  * genautomata.c (process_state_longest_path, max_dfa_issue_rate)
  (output_dfa_max_issue_rate, locked_states_num): Delete.
  (struct automaton): Add locked_states field.
  (output_dead_lock_vect): Save number of locked states in
  automaton->locked_states.  If it is zero, don't print anything.
  (output_max_insn_queue_index_def): Define max_insn_queue_index const.
  (output_internal_dead_lock_func): Only test the dead_lock_vect
  for automata that have locked states.
  (output_statistics): Always print the number of locked states for
  each automaton.  Calculate total number of locked states here.
  (write_automata): Don't call output_dfa_max_issue_rate.
  * genattrtab.c: Define length_unit_log as a const variable.
  * genattr.c: Don't emit MAX_DFA_ISSUE_RATE.  Declare
  max_insn_queue_index const.
  * final.c (length_unit_log): Declare const.
  * doc/tm.texi: Remove all references to MAX_DFA_ISSUE_RATE.

From-SVN: r110122

gcc/ChangeLog
gcc/doc/tm.texi
gcc/final.c
gcc/genattr.c
gcc/genattrtab.c
gcc/genautomata.c

index 3224426..1de67c4 100644 (file)
@@ -1,5 +1,24 @@
 2006-01-22  Zack Weinberg  <zackw@panix.com>
 
+       * genautomata.c (process_state_longest_path, max_dfa_issue_rate)
+       (output_dfa_max_issue_rate, locked_states_num): Delete.
+       (struct automaton): Add locked_states field.
+       (output_dead_lock_vect): Save number of locked states in
+       automaton->locked_states.  If it is zero, don't print anything.
+       (output_max_insn_queue_index_def): Define max_insn_queue_index const.
+       (output_internal_dead_lock_func): Only test the dead_lock_vect
+       for automata that have locked states.
+       (output_statistics): Always print the number of locked states for
+       each automaton.  Calculate total number of locked states here.
+       (write_automata): Don't call output_dfa_max_issue_rate.
+       * genattrtab.c: Define length_unit_log as a const variable.
+       * genattr.c: Don't emit MAX_DFA_ISSUE_RATE.  Declare
+       max_insn_queue_index const.
+       * final.c (length_unit_log): Declare const.
+       * doc/tm.texi: Remove all references to MAX_DFA_ISSUE_RATE.
+
+2006-01-22  Zack Weinberg  <zackw@panix.com>
+
        * genautomata.c:  Include vec.h, not varray.h.
        Delete vla_ptr_t, all of the VLA_PTR_ macros, and all of the
        VLA_HWINT_ macros.  Change vla_hwint_t to a typedef for
index 5fb0fa1..7bd8522 100644 (file)
@@ -5695,9 +5695,6 @@ hooks @samp{TARGET_SCHED_REORDER} and @samp{TARGET_SCHED_REORDER2}).
 This value must be constant over the entire compilation.  If you need
 it to vary depending on what the instructions are, you must use
 @samp{TARGET_SCHED_VARIABLE_ISSUE}.
-
-You could define this hook to return the value of the macro
-@code{MAX_DFA_ISSUE_RATE}.
 @end deftypefn
 
 @deftypefn {Target Hook} int TARGET_SCHED_VARIABLE_ISSUE (FILE *@var{file}, int @var{verbose}, rtx @var{insn}, int @var{more})
@@ -5907,17 +5904,6 @@ closer to one another---i.e., closer than the dependence distance;  however,
 not in cases of "costly dependences", which this hooks allows to define.
 @end deftypefn
 
-Macros in the following table are generated by the program
-@file{genattr} and can be useful for writing the hooks.
-
-@defmac MAX_DFA_ISSUE_RATE
-The macro definition is generated in the automaton based pipeline
-description interface.  Its value is calculated from the automaton
-based pipeline description and is equal to maximal number of all insns
-described in constructions @samp{define_insn_reservation} which can be
-issued on the same processor cycle.
-@end defmac
-
 @node Sections
 @section Dividing the Output into Sections (Texts, Data, @dots{})
 @c the above section title is WAY too long.  maybe cut the part between
index b25876a..82fa431 100644 (file)
@@ -138,7 +138,7 @@ static const char *last_filename;
 /* Whether to force emission of a line note before the next insn.  */
 static bool force_source_line = false;
   
-extern int length_unit_log; /* This is defined in insn-attrtab.c.  */
+extern const int length_unit_log; /* This is defined in insn-attrtab.c.  */
 
 /* Nonzero while outputting an `asm' with operands.
    This means that inconsistencies are the user's fault, so don't die.
index 7d6d50f..03a00c5 100644 (file)
@@ -174,13 +174,6 @@ main (int argc, char **argv)
       printf ("#define CPU_UNITS_QUERY 0\n");
       printf ("#endif\n\n");
       /* Interface itself: */
-      printf ("extern int max_dfa_issue_rate;\n\n");
-      printf ("/* The following macro value is calculated from the\n");
-      printf ("   automaton based pipeline description and is equal to\n");
-      printf ("   maximal number of all insns described in constructions\n");
-      printf ("   `define_insn_reservation' which can be issued on the\n");
-      printf ("   same processor cycle. */\n");
-      printf ("#define MAX_DFA_ISSUE_RATE max_dfa_issue_rate\n\n");
       printf ("/* Insn latency time defined in define_insn_reservation. */\n");
       printf ("extern int insn_default_latency (rtx);\n\n");
       printf ("/* Return nonzero if there is a bypass for given insn\n");
@@ -198,7 +191,7 @@ main (int argc, char **argv)
       printf ("#endif\n\n");
       printf ("/* Maximal possible number of insns waiting results being\n");
       printf ("   produced by insns whose execution is not finished. */\n");
-      printf ("extern int max_insn_queue_index;\n\n");
+      printf ("extern const int max_insn_queue_index;\n\n");
       printf ("/* Pointer to data describing current state of DFA.  */\n");
       printf ("typedef void *state_t;\n\n");
       printf ("/* Size of the data in bytes.  */\n");
index 41dda6b..287c69b 100644 (file)
@@ -1690,7 +1690,7 @@ write_length_unit_log (void)
       for (length_unit_log = 0; length_or & 1; length_or >>= 1)
        length_unit_log++;
     }
-  printf ("int length_unit_log = %u;\n", length_unit_log);
+  printf ("const int length_unit_log = %u;\n", length_unit_log);
 }
 
 /* Take a COND expression and see if any of the conditions in it can be
index 987d1e7..38a1718 100644 (file)
@@ -414,8 +414,6 @@ static void finish_regexp_representation     (void);
 
 static void output_range_type            (FILE *, long int, long int);
 static int longest_path_length           (state_t);
-static void process_state_longest_path_length (state_t);
-static void output_dfa_max_issue_rate    (void);
 static void output_chip_member_name      (FILE *, automaton_t);
 static void output_temp_chip_member_name (FILE *, automaton_t);
 static void output_translate_vect_name   (FILE *, automaton_t);
@@ -1155,6 +1153,8 @@ struct automaton
      8) elements in one vector element.  So the compression factor can
      be 1 (no compression), 2, 4, 8.  */
   int min_issue_delay_table_compression_factor;
+  /* Total number of locked states in this automaton.  */
+  int locked_states;
 };
 
 /* The following is the element of the list of automata.  */
@@ -7015,47 +7015,6 @@ longest_path_length (state_t state)
   return result;
 }
 
-/* The following variable value is value of the corresponding global
-   variable in the automaton based pipeline interface.  */
-
-static int max_dfa_issue_rate;
-
-/* The following function processes the longest path length staring
-   from STATE to find MAX_DFA_ISSUE_RATE.  */
-
-static void
-process_state_longest_path_length (state_t state)
-{
-  int value;
-
-  value = longest_path_length (state);
-  if (value > max_dfa_issue_rate)
-    max_dfa_issue_rate = value;
-}
-
-/* The following macro value is name of the corresponding global
-   variable in the automaton based pipeline interface.  */
-
-#define MAX_DFA_ISSUE_RATE_VAR_NAME "max_dfa_issue_rate"
-
-/* The following function calculates value of the corresponding
-   global variable and outputs its declaration.  */
-
-static void
-output_dfa_max_issue_rate (void)
-{
-  automaton_t automaton;
-
-  gcc_assert (UNDEFINED_LONGEST_PATH_LENGTH != ON_THE_PATH && ON_THE_PATH < 0);
-  max_dfa_issue_rate = 0;
-  for (automaton = description->first_automaton;
-       automaton != NULL;
-       automaton = automaton->next_automaton)
-    pass_states (automaton, process_state_longest_path_length);
-  fprintf (output_file, "\nint %s = %d;\n",
-          MAX_DFA_ISSUE_RATE_VAR_NAME, max_dfa_issue_rate);
-}
-
 /* The function outputs all initialization values of VECT.  */
 static void
 output_vect (vla_hwint_t vect)
@@ -7977,12 +7936,6 @@ output_min_issue_delay_table (automaton_t automaton)
   VEC_free (vect_el_t,heap, compressed_min_issue_delay_vect);
 }
 
-#ifndef NDEBUG
-/* Number of states which contains transition only by advancing cpu
-   cycle.  */
-static int locked_states_num;
-#endif
-
 /* Form and output vector representing the locked states of
    AUTOMATON.  */
 static void
@@ -7995,6 +7948,7 @@ output_dead_lock_vect (automaton_t automaton)
   /* Create vect of pointers to states ordered by num of
      transitions from the state (state with the maximum num is the
      first).  */
+  automaton->locked_states = 0;
   output_states_vect = 0;
   pass_states (automaton, add_states_vect_el);
 
@@ -8005,16 +7959,19 @@ output_dead_lock_vect (automaton_t automaton)
       state_t s = VEC_index (state_t, output_states_vect, i);
       arc = first_out_arc (s);
       gcc_assert (arc);
-      VEC_replace (vect_el_t, dead_lock_vect, s->order_state_num,
-                  (next_out_arc (arc) == NULL
-                   && (arc->insn->insn_reserv_decl
-                       == DECL_INSN_RESERV (advance_cycle_insn_decl))
-                   ? 1 : 0));
-#ifndef NDEBUG
-      if (VEC_index (vect_el_t,dead_lock_vect, s->order_state_num))
-        locked_states_num++;
-#endif
+      if (next_out_arc (arc) == NULL
+         && (arc->insn->insn_reserv_decl
+             == DECL_INSN_RESERV (advance_cycle_insn_decl)))
+       {
+         VEC_replace (vect_el_t, dead_lock_vect, s->order_state_num, 1);
+         automaton->locked_states++;
+       }
+      else
+       VEC_replace (vect_el_t, dead_lock_vect, s->order_state_num, 0);
     }
+  if (automaton->locked_states == 0)
+    return;
+
   fprintf (output_file, "/* Vector for locked state flags.  */\n");
   fprintf (output_file, "static const ");
   output_range_type (output_file, 0, 1);
@@ -8085,9 +8042,6 @@ output_tables (void)
 {
   automaton_t automaton;
 
-#ifndef NDEBUG
-  locked_states_num = 0;
-#endif
   initiate_min_issue_delay_pass_states ();
   for (automaton = description->first_automaton;
        automaton != NULL;
@@ -8139,10 +8093,10 @@ output_max_insn_queue_index_def (void)
   for (i = 0; (1 << i) <= max; i++)
     ;
   gcc_assert (i >= 0);
-  fprintf (output_file, "\nint max_insn_queue_index = %d;\n\n", (1 << i) - 1);
+  fprintf (output_file, "\nconst int max_insn_queue_index = %d;\n\n",
+          (1 << i) - 1);
 }
 
-
 /* The function outputs switch cases for insn reservations using
    function *output_automata_list_code.  */
 static void
@@ -8575,19 +8529,20 @@ output_internal_dead_lock_func (void)
 {
   automaton_t automaton;
 
-  fprintf (output_file, "static int\n%s (struct %s *%s)\n",
+  fprintf (output_file, "static int\n%s (struct %s *ARG_UNUSED (%s))\n",
           INTERNAL_DEAD_LOCK_FUNC_NAME, CHIP_NAME, CHIP_PARAMETER_NAME);
   fprintf (output_file, "{\n");
   for (automaton = description->first_automaton;
        automaton != NULL;
        automaton = automaton->next_automaton)
-    {
-      fprintf (output_file, "  if (");
-      output_dead_lock_vect_name (output_file, automaton);
-      fprintf (output_file, " [%s->", CHIP_PARAMETER_NAME);
-      output_chip_member_name (output_file, automaton);
-      fprintf (output_file, "])\n    return 1/* TRUE */;\n");
-    }
+    if (automaton->locked_states)
+      {
+       fprintf (output_file, "  if (");
+       output_dead_lock_vect_name (output_file, automaton);
+       fprintf (output_file, " [%s->", CHIP_PARAMETER_NAME);
+       output_chip_member_name (output_file, automaton);
+       fprintf (output_file, "])\n    return 1/* TRUE */;\n");
+      }
   fprintf (output_file, "  return 0/* FALSE */;\n}\n\n");
 }
 
@@ -9314,6 +9269,7 @@ output_statistics (FILE *f)
   int state_alts_comb_vect_els = 0;
   int state_alts_full_vect_els = 0;
   int min_issue_delay_vect_els = 0;
+  int locked_states = 0;
 #endif
 
   for (automaton = description->first_automaton;
@@ -9336,6 +9292,7 @@ output_statistics (FILE *f)
        }
       fprintf (f, "    %5d all insns      %5d insn equivalence classes\n",
               description->insns_num, automaton->insn_equiv_classes_num);
+      fprintf (f, "    %d locked states\n", automaton->locked_states);
 #ifndef NDEBUG
       fprintf
        (f, "%5ld transition comb vector els, %5ld trans table els: %s\n",
@@ -9363,6 +9320,8 @@ output_statistics (FILE *f)
         += VEC_length (vect_el_t, automaton->state_alts_table->full_vect);
       min_issue_delay_vect_els
        += states_num * automaton->insn_equiv_classes_num;
+      locked_states
+       += automaton->locked_states;
 #endif
     }
 #ifndef NDEBUG
@@ -9376,7 +9335,7 @@ output_statistics (FILE *f)
     (f, "%5d all state alts comb vector els, %5d all state alts table els\n",
      state_alts_comb_vect_els, state_alts_full_vect_els);
   fprintf (f, "%5d all min delay table els\n", min_issue_delay_vect_els);
-  fprintf (f, "%5d locked states num\n", locked_states_num);
+  fprintf (f, "%5d all locked states\n", locked_states);
 #endif
 }
 
@@ -9865,7 +9824,6 @@ write_automata (void)
   output_time = create_ticker ();
   if (progress_flag)
     fprintf (stderr, "Forming and outputting automata tables...");
-  output_dfa_max_issue_rate ();
   output_tables ();
   if (progress_flag)
     {