This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [itanium-sched-branch] Quering NDFA and minimization of automaton with quried units [patch]


  To implement insn scheduling and template generation for Itanium, I
need to query NDFA states.  The following patch implements this.  It
also permits to query minimized automata (which is important to
descrease size of automaton describing such complex processor as
Itanium).  The patch also impoves diganostic output.

Vlad

2002-09-20  Vladimir Makarov  <vmakarov@redhat.com>

        * rtl.def (DEFINE_QUERY_CPU_UNIT, AUTOMATA_OPTION): Change
        comments about queried units and the minimization.
        
        * doc/md.texi: Ditto.
        
        * genautomata.c (create_composed_state): Return nonzero if the
new
        state has been created.
        (first_cycle_unit_presence): New function.
        (state_is_differed): Add new parameter.  Use the new function.
        Take queried units into account.
        (partition_equiv_class): Pass additional parameter to
        `state_is_differed'.
        (merge_states): Process composed states too.
        (build_automaton, create_automata, output_min_issue_delay_table,
        output_tables, output_statistics): Output more information.
        (output_reserved_units_table): Use function
        `first_cycle_unit_presence'.
        (output_tables): Output table of queried units even if the
        minimizationis is switched on.
        (write_automata): Output code for querying units even if the
        minimizationis is switched on.
        
Index: rtl.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.def,v
retrieving revision 1.59.10.1
diff -c -p -r1.59.10.1 rtl.def
*** rtl.def     19 Sep 2002 21:54:57 -0000      1.59.10.1
--- rtl.def     20 Sep 2002 19:01:25 -0000
*************** DEF_RTL_EXPR(ADDRESS, "address", "e", 'm
*** 358,366 ****
  DEF_RTL_EXPR(DEFINE_CPU_UNIT, "define_cpu_unit", "sS", 'x')
  
  /* (define_query_cpu_unit string [string]) describes cpu functional
!    units analogously to define_cpu_unit.  If we use automaton without
!    minimization, the reservation of such units can be queried for
!    automaton state.  */
  DEF_RTL_EXPR(DEFINE_QUERY_CPU_UNIT, "define_query_cpu_unit", "sS",
'x')
  
  /* (exclusion_set string string) means that each CPU functional unit
--- 358,365 ----
  DEF_RTL_EXPR(DEFINE_CPU_UNIT, "define_cpu_unit", "sS", 'x')
  
  /* (define_query_cpu_unit string [string]) describes cpu functional
!    units analogously to define_cpu_unit.  The reservation of such
!    units can be queried for automaton state.  */
  DEF_RTL_EXPR(DEFINE_QUERY_CPU_UNIT, "define_query_cpu_unit", "sS",
'x')
  
  /* (exclusion_set string string) means that each CPU functional unit
*************** DEF_RTL_EXPR(DEFINE_AUTOMATON, "define_a
*** 442,449 ****
     automata.  Currently there are the following options:
  
     o "no-minimization" which makes no minimization of automata.  This
!      is only worth to do when we are going to query CPU functional
!      unit reservations in an automaton state.
  
     o "time" which means printing additional time statistics about
        generation of automata.
--- 441,448 ----
     automata.  Currently there are the following options:
  
     o "no-minimization" which makes no minimization of automata.  This
!      is only worth to do when we are debugging the description and
!      need to look more accurately at reservations of states.
  
     o "time" which means printing additional time statistics about
        generation of automata.
Index: genautomata.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/genautomata.c,v
retrieving revision 1.24.8.2
diff -c -p -r1.24.8.2 genautomata.c
*** genautomata.c       19 Sep 2002 21:54:58 -0000      1.24.8.2
--- genautomata.c       20 Sep 2002 19:01:25 -0000
*************** static void form_ainsn_with_same_reservs
*** 376,382 ****
  
  static void make_automaton           PARAMS ((automaton_t));
  static void form_arcs_marked_by_insn PARAMS ((state_t));
! static void create_composed_state    PARAMS ((state_t, arc_t,
vla_ptr_t *));
  static void NDFA_to_DFA              PARAMS ((automaton_t));
  static void pass_state_graph         PARAMS ((state_t, void (*)
(state_t)));
  static void pass_states              PARAMS ((automaton_t,
--- 376,382 ----
  
  static void make_automaton           PARAMS ((automaton_t));
  static void form_arcs_marked_by_insn PARAMS ((state_t));
! static int create_composed_state     PARAMS ((state_t, arc_t,
vla_ptr_t *));
  static void NDFA_to_DFA              PARAMS ((automaton_t));
  static void pass_state_graph         PARAMS ((state_t, void (*)
(state_t)));
  static void pass_states              PARAMS ((automaton_t,
*************** static int set_out_arc_insns_equiv_num P
*** 387,393 ****
  static void clear_arc_insns_equiv_num  PARAMS ((state_t));
  static void copy_equiv_class           PARAMS ((vla_ptr_t *to,
                                                const vla_ptr_t *from));
! static int state_is_differed           PARAMS ((state_t, int, int));
  static state_t init_equiv_class        PARAMS ((state_t *states,
int));
  static int partition_equiv_class       PARAMS ((state_t *, int,
                                                vla_ptr_t *, int *));
--- 387,394 ----
  static void clear_arc_insns_equiv_num  PARAMS ((state_t));
  static void copy_equiv_class           PARAMS ((vla_ptr_t *to,
                                                const vla_ptr_t *from));
! static int first_cycle_unit_presence   PARAMS ((state_t, int));
! static int state_is_differed           PARAMS ((state_t, state_t, int,
int));
  static state_t init_equiv_class        PARAMS ((state_t *states,
int));
  static int partition_equiv_class       PARAMS ((state_t *, int,
                                                vla_ptr_t *, int *));
*************** struct state
*** 1074,1084 ****
    char it_was_placed_in_stack_for_NDFA_forming;
    /* The following field is used to form DFA.  */
    char it_was_placed_in_stack_for_DFA_forming;
!   /* The following field is used to transform NDFA to DFA.  The field
!      value is not NULL if the state is a compound state.  In this case
!      the value of field `unit_sets_list' is NULL.  All states in the
!      list are in the hash table.  The list is formed through field
!      `next_sorted_alt_state'.  */
    alt_state_t component_states;
    /* The following field is used for passing graph of states.  */
    int pass_num;
--- 1075,1086 ----
    char it_was_placed_in_stack_for_NDFA_forming;
    /* The following field is used to form DFA.  */
    char it_was_placed_in_stack_for_DFA_forming;
!   /* The following field is used to transform NDFA to DFA and DFA
!      minimization.  The field value is not NULL if the state is a
!      compound state.  In this case the value of field `unit_sets_list'
!      is NULL.  All states in the list are in the hash table.  The list
!      is formed through field `next_sorted_alt_state'.  We should
!      support only one level of nesting state.  */
    alt_state_t component_states;
    /* The following field is used for passing graph of states.  */
    int pass_num;
*************** output_cycle_reservs (f, reservs, start_
*** 3965,3971 ****
      fprintf (f, NOTHING_NAME);
    if (repetition_num <= 0)
      abort ();
!   if (reserved_units_num > 1)
      fprintf (f, ")");
    if (repetition_num != 1)
      fprintf (f, "*%d", repetition_num);
--- 3967,3973 ----
      fprintf (f, NOTHING_NAME);
    if (repetition_num <= 0)
      abort ();
!   if (repetition_num != 1 && reserved_units_num > 1)
      fprintf (f, ")");
    if (repetition_num != 1)
      fprintf (f, "*%d", repetition_num);
*************** check_unit_distributions_to_automata ()
*** 5450,5455 ****
--- 5452,5458 ----
    int i;
  
    form_the_same_automaton_unit_lists ();
+   fprintf (stderr, "Check unit distributions to automata...");
    for (i = 0; i < description->decls_num; i++)
      {
        decl = description->decls [i];
*************** check_unit_distributions_to_automata ()
*** 5468,5473 ****
--- 5471,5477 ----
                }
        }
      }
+   fprintf (stderr, "done\n");
  }
  
  
*************** make_automaton (automaton)
*** 5685,5690 ****
--- 5689,5695 ----
    ainsn_t advance_cycle_ainsn;
    arc_t added_arc;
    vla_ptr_t state_stack;
+   int states_n;
  
    VLA_PTR_CREATE (state_stack, 150, "state stack");
    /* Create the start state (empty state).  */
*************** make_automaton (automaton)
*** 5692,5697 ****
--- 5697,5703 ----
    automaton->start_state = start_state;
    start_state->it_was_placed_in_stack_for_NDFA_forming = 1;
    VLA_PTR_ADD (state_stack, start_state);
+   states_n = 1;
    while (VLA_PTR_LENGTH (state_stack) != 0)
      {
        state = VLA_PTR (state_stack, VLA_PTR_LENGTH (state_stack) - 1);
*************** make_automaton (automaton)
*** 5721,5726 ****
--- 5727,5735 ----
                             
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, "*");
                            }
                        added_arc = add_arc (state, state2, ainsn, 1);
                        if (!ndfa_flag)
*************** make_automaton (automaton)
*** 5749,5754 ****
--- 5758,5766 ----
          {
            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 (advance_cycle_ainsn == NULL)
        abort ();
*************** form_arcs_marked_by_insn (state)
*** 5785,5799 ****
  /* The function creates composed state (see comments for IR) from
     ORIGINAL_STATE and list of arcs ARCS_MARKED_BY_INSN marked by the
     same insn.  If the composed state is not in STATE_STACK yet, it is
!    popped to STATE_STACK.  */
! static void
  create_composed_state (original_state, arcs_marked_by_insn,
state_stack)
       state_t original_state;
       arc_t arcs_marked_by_insn;
       vla_ptr_t *state_stack;
  {
    state_t state;
!   alt_state_t curr_alt_state;
    alt_state_t new_alt_state;
    arc_t curr_arc;
    arc_t next_arc;
--- 5797,5811 ----
  /* The function creates composed state (see comments for IR) from
     ORIGINAL_STATE and list of arcs ARCS_MARKED_BY_INSN marked by the
     same insn.  If the composed state is not in STATE_STACK yet, it is
!    pushed into STATE_STACK.  */
! static int
  create_composed_state (original_state, arcs_marked_by_insn,
state_stack)
       state_t original_state;
       arc_t arcs_marked_by_insn;
       vla_ptr_t *state_stack;
  {
    state_t state;
!   alt_state_t alt_state, curr_alt_state;
    alt_state_t new_alt_state;
    arc_t curr_arc;
    arc_t next_arc;
*************** create_composed_state (original_state, a
*** 5801,5809 ****
    state_t temp_state;
    alt_state_t canonical_alt_states_list;
    int alts_number;
  
    if (arcs_marked_by_insn == NULL)
!     return;
    if (arcs_marked_by_insn->next_arc_marked_by_insn == NULL)
      state = arcs_marked_by_insn->to_state;
    else
--- 5813,5822 ----
    state_t temp_state;
    alt_state_t canonical_alt_states_list;
    int alts_number;
+   int new_state_p = 0;
  
    if (arcs_marked_by_insn == NULL)
!     return new_state_p;
    if (arcs_marked_by_insn->next_arc_marked_by_insn == NULL)
      state = arcs_marked_by_insn->to_state;
    else
*************** create_composed_state (original_state, a
*** 5816,5829 ****
        for (curr_arc = arcs_marked_by_insn;
             curr_arc != NULL;
             curr_arc = curr_arc->next_arc_marked_by_insn)
!         {
!           new_alt_state = get_free_alt_state ();
!           new_alt_state->next_alt_state = curr_alt_state;
!           new_alt_state->state = curr_arc->to_state;
!         if (curr_arc->to_state->component_states != NULL)
!           abort ();
!           curr_alt_state = new_alt_state;
!         }
        /* There are not identical sets in the alt state list.  */
        canonical_alt_states_list = uniq_sort_alt_states
(curr_alt_state);
        if (canonical_alt_states_list->next_sorted_alt_state == NULL)
--- 5829,5853 ----
        for (curr_arc = arcs_marked_by_insn;
             curr_arc != NULL;
             curr_arc = curr_arc->next_arc_marked_by_insn)
!       if (curr_arc->to_state->component_states == NULL)
!         {
!           new_alt_state = get_free_alt_state ();
!           new_alt_state->next_alt_state = curr_alt_state;
!           new_alt_state->state = curr_arc->to_state;
!           curr_alt_state = new_alt_state;
!         }
!       else
!         for (alt_state = curr_arc->to_state->component_states;
!              alt_state != NULL;
!              alt_state = alt_state->next_sorted_alt_state)
!           {
!             new_alt_state = get_free_alt_state ();
!             new_alt_state->next_alt_state = curr_alt_state;
!             new_alt_state->state = alt_state->state;
!             if (alt_state->state->component_states != NULL)
!               abort ();
!             curr_alt_state = new_alt_state;
!           }
        /* There are not identical sets in the alt state list.  */
        canonical_alt_states_list = uniq_sort_alt_states
(curr_alt_state);
        if (canonical_alt_states_list->next_sorted_alt_state == NULL)
*************** create_composed_state (original_state, a
*** 5847,5852 ****
--- 5871,5877 ----
              {
                if (state->it_was_placed_in_stack_for_DFA_forming)
                abort ();
+             new_state_p = 1;
                for (curr_alt_state = state->component_states;
                     curr_alt_state != NULL;
                     curr_alt_state =
curr_alt_state->next_sorted_alt_state)
*************** create_composed_state (original_state, a
*** 5873,5878 ****
--- 5898,5904 ----
        state->it_was_placed_in_stack_for_DFA_forming = 1;
        VLA_PTR_ADD (*state_stack, state);
      }
+   return new_state_p;
  }
  
  /* The function transformes nondeterminstic AUTOMATON into
*************** NDFA_to_DFA (automaton)
*** 5886,5897 ****
--- 5912,5925 ----
    decl_t decl;
    vla_ptr_t state_stack;
    int i;
+   int states_n;
  
    VLA_PTR_CREATE (state_stack, 150, "state stack");
    /* Create the start state (empty state).  */
    start_state = automaton->start_state;
    start_state->it_was_placed_in_stack_for_DFA_forming = 1;
    VLA_PTR_ADD (state_stack, start_state);
+   states_n = 1;
    while (VLA_PTR_LENGTH (state_stack) != 0)
      {
        state = VLA_PTR (state_stack, VLA_PTR_LENGTH (state_stack) - 1);
*************** NDFA_to_DFA (automaton)
*** 5899,5909 ****
        form_arcs_marked_by_insn (state);
        for (i = 0; i < description->decls_num; i++)
        {
!         decl = description->decls [i];
!         if (decl->mode == dm_insn_reserv)
!           create_composed_state
!               (state, DECL_INSN_RESERV (decl)->arcs_marked_by_insn,
!              &state_stack);
        }
      }
    VLA_PTR_DELETE (state_stack);
--- 5927,5941 ----
        form_arcs_marked_by_insn (state);
        for (i = 0; i < description->decls_num; i++)
        {
!         if (decl->mode == dm_insn_reserv
!             && create_composed_state
!                (state, DECL_INSN_RESERV (decl)->arcs_marked_by_insn,
!                 &state_stack))
!           {
!             states_n++;
!             if (states_n % 100 == 0)
!               fprintf (stderr, "*");
!           }
        }
      }
    VLA_PTR_DELETE (state_stack);
*************** copy_equiv_class (to, from)
*** 6025,6043 ****
      VLA_PTR_ADD (*to, *class_ptr);
  }
  
  /* The function returns nonzero value if STATE is not equivalent to
!    another state from the same current partition on equivalence
!    classes Another state has ORIGINAL_STATE_OUT_ARCS_NUM number of
     output arcs.  Iteration of making equivalence partition is defined
     by ODD_ITERATION_FLAG.  */
  static int
! state_is_differed (state, original_state_out_arcs_num,
odd_iteration_flag)
!      state_t state;
!      int original_state_out_arcs_num;
       int odd_iteration_flag;
  {
    arc_t arc;
    int state_out_arcs_num;
  
    state_out_arcs_num = 0;
    for (arc = first_out_arc (state); arc != NULL; arc = next_out_arc
(arc))
--- 6057,6095 ----
      VLA_PTR_ADD (*to, *class_ptr);
  }
  
+ /* The following function returns TRUE if STATE reserves the unit with
+    UNIT_NUM on the first cycle.  */
+ static int
+ first_cycle_unit_presence (state, unit_num)
+      state_t state;
+      int unit_num;
+ {
+   int presence_p;
+ 
+   if (state->component_states == NULL)
+     presence_p = 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;
+ }
+ 
  /* The function returns nonzero value if STATE is not equivalent to
!    ANOTHER_STATE from the same current partition on equivalence
!    classes.  Another state has ANOTHER_STATE_OUT_ARCS_NUM number of
     output arcs.  Iteration of making equivalence partition is defined
     by ODD_ITERATION_FLAG.  */
  static int
! state_is_differed (state, another_state, another_state_out_arcs_num,
!                  odd_iteration_flag)
!      state_t state, another_state;
!      int another_state_out_arcs_num;
       int odd_iteration_flag;
  {
    arc_t arc;
    int state_out_arcs_num;
+   int i, presence1_p, presence2_p;
  
    state_out_arcs_num = 0;
    for (arc = first_out_arc (state); arc != NULL; arc = next_out_arc
(arc))
*************** state_is_differed (state, original_state
*** 6050,6056 ****
          || (arc->insn->insn_reserv_decl->state_alts !=
arc->state_alts))
          return 1;
      }
!   return state_out_arcs_num != original_state_out_arcs_num;
  }
  
  /* The function makes initial partition of STATES on equivalent
--- 6102,6120 ----
          || (arc->insn->insn_reserv_decl->state_alts !=
arc->state_alts))
          return 1;
      }
!   if (state_out_arcs_num != another_state_out_arcs_num)
!     return 1;
!   /* Now we are looking at the states with the point of view of query
!      units.  */
!   for (i = 0; i < description->units_num; i++)
!     if (units_array [i]->query_p)
!       {
!       presence1_p = first_cycle_unit_presence (state, i);
!       presence2_p = first_cycle_unit_presence (another_state, i);
!       if ((presence1_p && !presence2_p) || (!presence1_p &&
presence2_p))
!         return 1;
!       }
!   return 0;
  }
  
  /* The function makes initial partition of STATES on equivalent
*************** partition_equiv_class (equiv_class_ptr, 
*** 6115,6121 ****
               curr_state = next_state)
            {
              next_state = curr_state->next_equiv_class_state;
!             if (state_is_differed (curr_state, out_arcs_num,
                                     odd_iteration_flag))
                {
                  /* Remove curr state from the class equivalence.  */
--- 6179,6185 ----
               curr_state = next_state)
            {
              next_state = curr_state->next_equiv_class_state;
!             if (state_is_differed (curr_state, first_state,
out_arcs_num,
                                     odd_iteration_flag))
                {
                  /* Remove curr state from the class equivalence.  */
*************** merge_states (automaton, equiv_classes)
*** 6201,6207 ****
    state_t new_state;
    state_t first_class_state;
    alt_state_t alt_states;
!   alt_state_t new_alt_state;
    arc_t curr_arc;
    arc_t next_arc;
  
--- 6265,6271 ----
    state_t new_state;
    state_t first_class_state;
    alt_state_t alt_states;
!   alt_state_t alt_state, new_alt_state;
    arc_t curr_arc;
    arc_t next_arc;
  
*************** merge_states (automaton, equiv_classes)
*** 6222,6233 ****
               curr_state = curr_state->next_equiv_class_state)
            {
              curr_state->equiv_class_state = new_state;
!             new_alt_state = get_free_alt_state ();
!             new_alt_state->state = curr_state;
!             new_alt_state->next_sorted_alt_state = alt_states;
!             alt_states = new_alt_state;
            }
!         new_state->component_states = alt_states;
        }
      else
        (*equiv_class_ptr)->equiv_class_state = *equiv_class_ptr;
--- 6286,6312 ----
               curr_state = curr_state->next_equiv_class_state)
            {
              curr_state->equiv_class_state = new_state;
!           if (curr_state->component_states == NULL)
!             {
!               new_alt_state = get_free_alt_state ();
!               new_alt_state->state = curr_state;
!               new_alt_state->next_alt_state = alt_states;
!               alt_states = new_alt_state;
!             }
!           else
!             for (alt_state = curr_state->component_states;
!                  alt_state != NULL;
!                  alt_state = alt_state->next_sorted_alt_state)
!               {
!                 new_alt_state = get_free_alt_state ();
!                 new_alt_state->state = alt_state->state;
!                 new_alt_state->next_alt_state = alt_states;
!                 alt_states = new_alt_state;
!               }
            }
!       /* Its is important that alt states were sorted before and
!            after merging to have the same quering results.  */
!         new_state->component_states = uniq_sort_alt_states
(alt_states);
        }
      else
        (*equiv_class_ptr)->equiv_class_state = *equiv_class_ptr;
*************** build_automaton (automaton)
*** 6345,6357 ****
--- 6424,6448 ----
    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);
    make_automaton (automaton);
+   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);
    NDFA_to_DFA (automaton);
+   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;
*************** build_automaton (automaton)
*** 6359,6365 ****
--- 6450,6462 ----
    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);
        minimize_DFA (automaton);
+       fprintf (stderr, "done\n");
        ticker_off (&minimize_time);
        count_states_and_arcs (automaton, &states_num, &arcs_num);
        automaton->minimal_DFA_states_num = states_num;
*************** create_automata ()
*** 6792,6809 ****
         curr_automaton = curr_automaton->next_automaton)
      {
        if (curr_automaton->corresponding_automaton_decl == NULL)
!       fprintf (stderr, "Create anonymous automaton ...");
        else
!       fprintf (stderr, "Create automaton `%s'...",
                 curr_automaton->corresponding_automaton_decl->name);
        create_alt_states (curr_automaton);
        form_ainsn_with_same_reservs (curr_automaton);
        build_automaton (curr_automaton);
        enumerate_states (curr_automaton);
        ticker_on (&equiv_time);
        set_insn_equiv_classes (curr_automaton);
        ticker_off (&equiv_time);
-       fprintf (stderr, "done\n");
      }
  }
  
--- 6889,6906 ----
         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);
        create_alt_states (curr_automaton);
        form_ainsn_with_same_reservs (curr_automaton);
+       fprintf (stderr, "done\n");
        build_automaton (curr_automaton);
        enumerate_states (curr_automaton);
        ticker_on (&equiv_time);
        set_insn_equiv_classes (curr_automaton);
        ticker_off (&equiv_time);
      }
  }
  
*************** output_state_alts_table (automaton)
*** 7793,7799 ****
     value for an ainsn and state.  */
  static int curr_state_pass_num;
  
- 
  /* This recursive function passes states to find minimal issue delay
     value for AINSN.  The state being visited is STATE.  The function
     returns minimal issue delay value for AINSN in STATE or -1 if we
--- 7890,7895 ----
*************** output_min_issue_delay_table (automaton)
*** 7908,7914 ****
                       + ainsn->insn_equiv_class_num) = min_delay;
          }
        }
!   fprintf (output_file, "/* Vector of min issue delay of insns.*/\n");
    fprintf (output_file, "static const ");
    output_range_type (output_file, 0, automaton->max_min_delay);
    fprintf (output_file, " ");
--- 8004,8010 ----
                       + ainsn->insn_equiv_class_num) = min_delay;
          }
        }
!   fprintf (output_file, "/* Vector of min issue delay of insns. 
*/\n");
    fprintf (output_file, "static const ");
    output_range_type (output_file, 0, automaton->max_min_delay);
    fprintf (output_file, " ");
*************** output_reserved_units_table (automaton)
*** 8029,8042 ****
         curr_state_ptr++)
      {
        for (i = 0; i < description->units_num; i++)
!       if (units_array [i]->query_p)
!         {
!           if (test_unit_reserv ((*curr_state_ptr)->reservs, 0, i))
!             VLA_HWINT (reserved_units_table,
!                        (*curr_state_ptr)->order_state_num *
state_byte_size
!                        + units_array [i]->query_num / 8)
!               += (1 << (units_array [i]->query_num % 8));
!         }
      }
    fprintf (output_file, "/* Vector for reserved units of states. 
*/\n");
    fprintf (output_file, "static const ");
--- 8125,8136 ----
         curr_state_ptr++)
      {
        for (i = 0; i < description->units_num; i++)
!       if (units_array [i]->query_p
!           && first_cycle_unit_presence (*curr_state_ptr, i))
!         VLA_HWINT (reserved_units_table,
!                    (*curr_state_ptr)->order_state_num *
state_byte_size
!                    + units_array [i]->query_num / 8)
!           += (1 << (units_array [i]->query_num % 8));
      }
    fprintf (output_file, "/* Vector for reserved units of states. 
*/\n");
    fprintf (output_file, "static const ");
*************** output_tables ()
*** 8074,8086 ****
               AUTOMATON_STATE_ALTS_MACRO_NAME);
        output_min_issue_delay_table (automaton);
        output_dead_lock_vect (automaton);
!       if (no_minimization_flag)
!       {
!         fprintf (output_file, "\n#if %s\n\n",
CPU_UNITS_QUERY_MACRO_NAME);
!         output_reserved_units_table (automaton);
!         fprintf (output_file, "\n#endif /* #if %s */\n\n",
!                  CPU_UNITS_QUERY_MACRO_NAME);
!       }
      }
    fprintf (output_file, "\n#define %s %d\n\n",
ADVANCE_CYCLE_VALUE_NAME,
             DECL_INSN_RESERV (advance_cycle_insn_decl)->insn_num);
--- 8168,8177 ----
               AUTOMATON_STATE_ALTS_MACRO_NAME);
        output_min_issue_delay_table (automaton);
        output_dead_lock_vect (automaton);
!       fprintf (output_file, "\n#if %s\n\n",
CPU_UNITS_QUERY_MACRO_NAME);
!       output_reserved_units_table (automaton);
!       fprintf (output_file, "\n#endif /* #if %s */\n\n",
!              CPU_UNITS_QUERY_MACRO_NAME);
      }
    fprintf (output_file, "\n#define %s %d\n\n",
ADVANCE_CYCLE_VALUE_NAME,
             DECL_INSN_RESERV (advance_cycle_insn_decl)->insn_num);
*************** output_unit_set_el_list (list)
*** 8936,8942 ****
    for (el = list; el != NULL; el = el->next_unit_set_el)
      {
        if (el != list)
!       fprintf (output_description_file, ",");
        fprintf (output_description_file, "%s", el->unit_decl->name);
      }
  }
--- 9027,9033 ----
    for (el = list; el != NULL; el = el->next_unit_set_el)
      {
        if (el != list)
!       fprintf (output_description_file, ", ");
        fprintf (output_description_file, "%s", el->unit_decl->name);
      }
  }
*************** output_statistics (f)
*** 9254,9259 ****
--- 9345,9351 ----
       FILE *f;
  {
    automaton_t automaton;
+   int states_num;
  #ifndef NDEBUG
    int transition_comb_vect_els = 0;
    int transition_full_vect_els = 0;
*************** output_statistics (f)
*** 9272,9281 ****
               automaton->NDFA_states_num, automaton->NDFA_arcs_num);
        fprintf (f, "    %5d DFA states,           %5d DFA arcs\n",
               automaton->DFA_states_num, automaton->DFA_arcs_num);
        if (!no_minimization_flag)
!       fprintf (f, "    %5d minimal DFA states,   %5d minimal DFA
arcs\n",
!                automaton->minimal_DFA_states_num,
!                automaton->minimal_DFA_arcs_num);
        fprintf (f, "    %5d all insns      %5d insn equivalence
classes\n",
               description->insns_num,
automaton->insn_equiv_classes_num);
  #ifndef NDEBUG
--- 9364,9377 ----
               automaton->NDFA_states_num, automaton->NDFA_arcs_num);
        fprintf (f, "    %5d DFA states,           %5d DFA arcs\n",
               automaton->DFA_states_num, automaton->DFA_arcs_num);
+       states_num = automaton->DFA_states_num;
        if (!no_minimization_flag)
!       {
!         fprintf (f, "    %5d minimal DFA states,   %5d minimal DFA
arcs\n",
!                  automaton->minimal_DFA_states_num,
!                  automaton->minimal_DFA_arcs_num);
!         states_num = automaton->minimal_DFA_states_num;
!       }
        fprintf (f, "    %5d all insns      %5d insn equivalence
classes\n",
               description->insns_num,
automaton->insn_equiv_classes_num);
  #ifndef NDEBUG
*************** output_statistics (f)
*** 9293,9299 ****
            ? "use comb vect" : "use simple vect"));
        fprintf
          (f, "%5ld min delay table els, compression factor %d\n",
!          (long) automaton->DFA_states_num *
automaton->insn_equiv_classes_num,
         automaton->min_issue_delay_table_compression_factor);
        transition_comb_vect_els
        += VLA_HWINT_LENGTH (automaton->trans_table->comb_vect);
--- 9389,9395 ----
            ? "use comb vect" : "use simple vect"));
        fprintf
          (f, "%5ld min delay table els, compression factor %d\n",
!          (long) states_num * automaton->insn_equiv_classes_num,
         automaton->min_issue_delay_table_compression_factor);
        transition_comb_vect_els
        += VLA_HWINT_LENGTH (automaton->trans_table->comb_vect);
*************** output_statistics (f)
*** 9304,9310 ****
        state_alts_full_vect_els
          += VLA_HWINT_LENGTH (automaton->state_alts_table->full_vect);
        min_issue_delay_vect_els
!         += automaton->DFA_states_num *
automaton->insn_equiv_classes_num;
  #endif
      }
  #ifndef NDEBUG
--- 9400,9406 ----
        state_alts_full_vect_els
          += VLA_HWINT_LENGTH (automaton->state_alts_table->full_vect);
        min_issue_delay_vect_els
!       += states_num * automaton->insn_equiv_classes_num;
  #endif
      }
  #ifndef NDEBUG
*************** write_automata ()
*** 9842,9855 ****
    output_internal_insn_latency_func ();
    output_insn_latency_func ();
    output_print_reservation_func ();
!   if (no_minimization_flag)
!     {
!       fprintf (output_file, "\n#if %s\n\n",
CPU_UNITS_QUERY_MACRO_NAME);
!       output_get_cpu_unit_code_func ();
!       output_cpu_unit_reservation_p ();
!       fprintf (output_file, "\n#endif /* #if %s */\n\n",
!              CPU_UNITS_QUERY_MACRO_NAME);
!     }
    output_dfa_clean_insn_cache_func ();
    output_dfa_start_func ();
    output_dfa_finish_func ();
--- 9938,9949 ----
    output_internal_insn_latency_func ();
    output_insn_latency_func ();
    output_print_reservation_func ();
!   /* Output function get_cpu_unit_code.  */
!   fprintf (output_file, "\n#if %s\n\n", CPU_UNITS_QUERY_MACRO_NAME);
!   output_get_cpu_unit_code_func ();
!   output_cpu_unit_reservation_p ();
!   fprintf (output_file, "\n#endif /* #if %s */\n\n",
!          CPU_UNITS_QUERY_MACRO_NAME);
    output_dfa_clean_insn_cache_func ();
    output_dfa_start_func ();
    output_dfa_finish_func ();
Index: doc/md.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/md.texi,v
retrieving revision 1.49.4.1
diff -c -p -r1.49.4.1 md.texi
*** doc/md.texi 19 Sep 2002 21:55:00 -0000      1.49.4.1
--- doc/md.texi 20 Sep 2002 19:01:26 -0000
*************** construction @code{define_automaton}.  Y
*** 5485,5497 ****
  @findex define_query_cpu_unit
  @cindex querying function unit reservations
  The following construction describes CPU functional units analogously
! to @code{define_cpu_unit}.  If we use automata without their
! minimization, the reservation of such units can be queried for an
! automaton state.  The instruction scheduler never queries reservation
! of functional units for given automaton state.  So as a rule, you
! don't need this construction.  This construction could be used for
! future code generation goals (e.g. to generate @acronym{VLIW} insn
! templates).
  
  @smallexample
  (define_query_cpu_unit @var{unit-names} [@var{automaton-name}])
--- 5485,5496 ----
  @findex define_query_cpu_unit
  @cindex querying function unit reservations
  The following construction describes CPU functional units analogously
! to @code{define_cpu_unit}.  The reservation of such units can be
! queried for an automaton state.  The instruction scheduler never
! queries reservation of functional units for given automaton state.  So
! as a rule, you don't need this construction.  This construction could
! be used for future code generation goals (e.g. to generate
! @acronym{VLIW} insn templates).
  
  @smallexample
  (define_query_cpu_unit @var{unit-names} [@var{automaton-name}])
*************** code.  Currently there are the following
*** 5729,5736 ****
  @itemize @bullet
  @item
  @dfn{no-minimization} makes no minimization of the automaton.  This is
! only worth to do when we are going to query CPU functional unit
! reservations in an automaton state.
  
  @item
  @dfn{time} means printing additional time statistics about
--- 5728,5735 ----
  @itemize @bullet
  @item
  @dfn{no-minimization} makes no minimization of the automaton.  This is
! only worth to do when we are debugging the description and need to
! look more accurately at reservations of states.
  
  @item
  @dfn{time} means printing additional time statistics about


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]