A patch for genautomata

Vladimir Makarov vmakarov@redhat.com
Tue Jun 18 09:24:00 GMT 2002


The following patch mainly switches on generation of automata
description for debugging.  I've committed it into main line.

Vlad

2002-06-18  Vladimir Makarov  <vmakarov@redhat.com>

        * rtl.def (DEFINE_AUTOMATON): Add description of new options
        `time' and `v'.  Fix incorrect description of option `w'.

        * doc/md.texi: Ditto.

        * genautomata.c (TIME_OPTION, V_OPTION): New macros.
        (gen_automata_option): Process the new options.
        (transform_2, transform_3): Initialize some variables.
        (initiate_automaton_gen): Use the new macros.
-------------- next part --------------
Index: rtl.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.def,v
retrieving revision 1.56
diff -c -p -r1.56 rtl.def
*** rtl.def	2 Jun 2002 21:09:43 -0000	1.56
--- rtl.def	18 Jun 2002 16:03:47 -0000
*************** DEF_RTL_EXPR(DEFINE_AUTOMATON, "define_a
*** 419,426 ****
       is only worth to do when we are going to query CPU functional
       unit reservations in an automaton state.
  
!    o "w" which means generation of file describing the result
!      automaton.  The file can be used for the description verification.
  
     o "ndfa" which makes nondeterministic finite state automata.  */
  DEF_RTL_EXPR(AUTOMATA_OPTION, "automata_option", "s", 'x')
--- 419,433 ----
       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.
!   
!    o "v" which means generation of file describing the result
!      automata.  The file has suffix `.dfa' and can be used for the
!      description verification and debugging.
! 
!    o "w" which means generation of warning instead of error for
!      non-critical errors.
  
     o "ndfa" which makes nondeterministic finite state automata.  */
  DEF_RTL_EXPR(AUTOMATA_OPTION, "automata_option", "s", 'x')
Index: genautomata.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/genautomata.c,v
retrieving revision 1.15
diff -c -p -r1.15 genautomata.c
*** genautomata.c	9 Jun 2002 02:12:20 -0000	1.15
--- genautomata.c	18 Jun 2002 16:03:47 -0000
*************** static struct obstack irp;
*** 638,643 ****
--- 638,647 ----
  
  #define NO_MINIMIZATION_OPTION "-no-minimization"
  
+ #define TIME_OPTION "-time"
+ 
+ #define V_OPTION "-v"
+ 
  #define W_OPTION "-w"
  
  #define NDFA_OPTION "-ndfa"
*************** gen_automata_option (def)
*** 1639,1644 ****
--- 1643,1652 ----
  {
    if (strcmp ((char *) XSTR (def, 0), NO_MINIMIZATION_OPTION + 1) == 0)
      no_minimization_flag = 1;
+   else if (strcmp ((char *) XSTR (def, 0), TIME_OPTION + 1) == 0)
+     time_flag = 1;
+   else if (strcmp ((char *) XSTR (def, 0), V_OPTION + 1) == 0)
+     v_flag = 1;
    else if (strcmp ((char *) XSTR (def, 0), W_OPTION + 1) == 0)
      w_flag = 1;
    else if (strcmp ((char *) XSTR (def, 0), NDFA_OPTION + 1) == 0)
*************** transform_2 (regexp)
*** 4507,4515 ****
  {
    if (regexp->mode == rm_sequence)
      {
!       regexp_t sequence;
        regexp_t result;
!       int sequence_index;
        int i, j;
  
        for (i = 0; i < regexp->regexp.sequence.regexps_num; i++)
--- 4515,4523 ----
  {
    if (regexp->mode == rm_sequence)
      {
!       regexp_t sequence = NULL;
        regexp_t result;
!       int sequence_index = 0;
        int i, j;
  
        for (i = 0; i < regexp->regexp.sequence.regexps_num; i++)
*************** transform_2 (regexp)
*** 4552,4560 ****
      }
    else if (regexp->mode == rm_allof)
      {
!       regexp_t allof;
        regexp_t result;
!       int allof_index;
        int i, j;
  
        for (i = 0; i < regexp->regexp.allof.regexps_num; i++)
--- 4560,4568 ----
      }
    else if (regexp->mode == rm_allof)
      {
!       regexp_t allof = NULL;
        regexp_t result;
!       int allof_index = 0;
        int i, j;
  
        for (i = 0; i < regexp->regexp.allof.regexps_num; i++)
*************** transform_2 (regexp)
*** 4596,4604 ****
      }
    else if (regexp->mode == rm_oneof)
      {
!       regexp_t oneof;
        regexp_t result;
!       int oneof_index;
        int i, j;
  
        for (i = 0; i < regexp->regexp.oneof.regexps_num; i++)
--- 4604,4612 ----
      }
    else if (regexp->mode == rm_oneof)
      {
!       regexp_t oneof = NULL;
        regexp_t result;
!       int oneof_index = 0;
        int i, j;
  
        for (i = 0; i < regexp->regexp.oneof.regexps_num; i++)
*************** transform_3 (regexp)
*** 4652,4659 ****
  {
    if (regexp->mode == rm_sequence)
      {
!       regexp_t oneof;
!       int oneof_index;
        regexp_t result;
        regexp_t sequence;
        int i, j;
--- 4660,4667 ----
  {
    if (regexp->mode == rm_sequence)
      {
!       regexp_t oneof = NULL;
!       int oneof_index = 0;
        regexp_t result;
        regexp_t sequence;
        int i, j;
*************** transform_3 (regexp)
*** 4701,4710 ****
      }
    else if (regexp->mode == rm_allof)
      {
!       regexp_t oneof, seq;
!       int oneof_index, max_seq_length, allof_length;
        regexp_t result;
!       regexp_t allof, allof_op;
        int i, j;
  
        for (i = 0; i < regexp->regexp.allof.regexps_num; i++)
--- 4709,4718 ----
      }
    else if (regexp->mode == rm_allof)
      {
!       regexp_t oneof = NULL, seq;
!       int oneof_index = 0, max_seq_length, allof_length;
        regexp_t result;
!       regexp_t allof = NULL, allof_op;
        int i, j;
  
        for (i = 0; i < regexp->regexp.allof.regexps_num; i++)
*************** initiate_automaton_gen (argc, argv)
*** 9157,9165 ****
    for (i = 2; i < argc; i++)
      if (strcmp (argv [i], NO_MINIMIZATION_OPTION) == 0)
        no_minimization_flag = 1;
!     else if (strcmp (argv [i], "-time") == 0)
        time_flag = 1;
!     else if (strcmp (argv [i], "-v") == 0)
        v_flag = 1;
      else if (strcmp (argv [i], W_OPTION) == 0)
        w_flag = 1;
--- 9165,9173 ----
    for (i = 2; i < argc; i++)
      if (strcmp (argv [i], NO_MINIMIZATION_OPTION) == 0)
        no_minimization_flag = 1;
!     else if (strcmp (argv [i], TIME_OPTION) == 0)
        time_flag = 1;
!     else if (strcmp (argv [i], V_OPTION) == 0)
        v_flag = 1;
      else if (strcmp (argv [i], W_OPTION) == 0)
        w_flag = 1;
Index: doc/md.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/md.texi,v
retrieving revision 1.41
diff -c -p -r1.41 md.texi
*** doc/md.texi	30 May 2002 01:05:05 -0000	1.41
--- doc/md.texi	18 Jun 2002 16:03:48 -0000
*************** only worth to do when we are going to qu
*** 5596,5603 ****
  reservations in an automaton state.
  
  @item
! @dfn{w} means a generation of the file describing the result
! automaton.  The file can be used to verify the description.
  
  @item
  @dfn{ndfa} makes nondeterministic finite state automata.  This affects
--- 5596,5612 ----
  reservations in an automaton state.
  
  @item
! @dfn{time} means printing additional time statistics about
! generation of automata.
! 
! @item
! @dfn{v} means a generation of the file describing the result automata.
! The file has suffix @samp{.dfa} and can be used for the description
! verification and debugging.
! 
! @item
! @dfn{w} means a generation of warning instead of error for
! non-critical errors.
  
  @item
  @dfn{ndfa} makes nondeterministic finite state automata.  This affects


More information about the Gcc-patches mailing list