Commit e12da141 by Bernd Schmidt Committed by Bernd Schmidt

genautomata.c (NO_COMB_OPTION): New macro.

	* genautomata.c (NO_COMB_OPTION): New macro.
	(no_comb_flag): New static variable.
	(gen_automata_option): Handle NO_COMB_OPTION.
	(comb_vect_p): False if no_comb_flag.
	(add_vect): Move computation of min/max values.  Return early if
	no_comb_flag.
	* doc/md.texi (automata_option): Document no-comb-vect.

From-SVN: r178295
parent 747de90b
2011-08-30 Bernd Schmidt <bernds@codesourcery.com>
* genautomata.c (NO_COMB_OPTION): New macro.
(no_comb_flag): New static variable.
(gen_automata_option): Handle NO_COMB_OPTION.
(comb_vect_p): False if no_comb_flag.
(add_vect): Move computation of min/max values. Return early if
no_comb_flag.
* doc/md.texi (automata_option): Document no-comb-vect.
2011-08-30 Christian Bruel <christian.bruel@st.com> 2011-08-30 Christian Bruel <christian.bruel@st.com>
* coverage.c (coverage_init): Check flag_branch_probabilities instead of * coverage.c (coverage_init): Check flag_branch_probabilities instead of
...@@ -7968,6 +7968,13 @@ verification and debugging. ...@@ -7968,6 +7968,13 @@ verification and debugging.
non-critical errors. non-critical errors.
@item @item
@dfn{no-comb-vect} prevents the automaton generator from generating
two data structures and comparing them for space efficiency. Using
a comb vector to represent transitions may be better, but it can be
very expensive to construct. This option is useful if the build
process spends an unacceptably long time in genautomata.
@item
@dfn{ndfa} makes nondeterministic finite state automata. This affects @dfn{ndfa} makes nondeterministic finite state automata. This affects
the treatment of operator @samp{|} in the regular expressions. The the treatment of operator @samp{|} in the regular expressions. The
usual treatment of the operator is to try the first alternative and, usual treatment of the operator is to try the first alternative and,
......
...@@ -253,6 +253,7 @@ static arc_t next_out_arc (arc_t); ...@@ -253,6 +253,7 @@ static arc_t next_out_arc (arc_t);
#define W_OPTION "-w" #define W_OPTION "-w"
#define NDFA_OPTION "-ndfa" #define NDFA_OPTION "-ndfa"
#define COLLAPSE_OPTION "-collapse-ndfa" #define COLLAPSE_OPTION "-collapse-ndfa"
#define NO_COMB_OPTION "-no-comb-vect"
#define PROGRESS_OPTION "-progress" #define PROGRESS_OPTION "-progress"
/* The following flags are set up by function `initiate_automaton_gen'. */ /* The following flags are set up by function `initiate_automaton_gen'. */
...@@ -268,6 +269,9 @@ static int collapse_flag; ...@@ -268,6 +269,9 @@ static int collapse_flag;
/* Do not make minimization of DFA (`-no-minimization'). */ /* Do not make minimization of DFA (`-no-minimization'). */
static int no_minimization_flag; static int no_minimization_flag;
/* Do not try to generate a comb vector (`-no-comb-vect'). */
static int no_comb_flag;
/* Value of this variable is number of automata being generated. The /* Value of this variable is number of automata being generated. The
actual number of automata may be less this value if there is not actual number of automata may be less this value if there is not
sufficient number of units. This value is defined by argument of sufficient number of units. This value is defined by argument of
...@@ -1539,6 +1543,8 @@ gen_automata_option (rtx def) ...@@ -1539,6 +1543,8 @@ gen_automata_option (rtx def)
ndfa_flag = 1; ndfa_flag = 1;
else if (strcmp (XSTR (def, 0), COLLAPSE_OPTION + 1) == 0) else if (strcmp (XSTR (def, 0), COLLAPSE_OPTION + 1) == 0)
collapse_flag = 1; collapse_flag = 1;
else if (strcmp (XSTR (def, 0), NO_COMB_OPTION + 1) == 0)
no_comb_flag = 1;
else if (strcmp (XSTR (def, 0), PROGRESS_OPTION + 1) == 0) else if (strcmp (XSTR (def, 0), PROGRESS_OPTION + 1) == 0)
progress_flag = 1; progress_flag = 1;
else else
...@@ -7251,6 +7257,8 @@ static int undefined_vect_el_value; ...@@ -7251,6 +7257,8 @@ static int undefined_vect_el_value;
static int static int
comb_vect_p (state_ainsn_table_t tab) comb_vect_p (state_ainsn_table_t tab)
{ {
if (no_comb_flag)
return false;
return (2 * VEC_length (vect_el_t, tab->full_vect) return (2 * VEC_length (vect_el_t, tab->full_vect)
> 5 * VEC_length (vect_el_t, tab->comb_vect)); > 5 * VEC_length (vect_el_t, tab->comb_vect));
} }
...@@ -7369,6 +7377,22 @@ add_vect (state_ainsn_table_t tab, int vect_num, vla_hwint_t vect) ...@@ -7369,6 +7377,22 @@ add_vect (state_ainsn_table_t tab, int vect_num, vla_hwint_t vect)
VEC_replace (vect_el_t, tab->full_vect, full_base + i, VEC_replace (vect_el_t, tab->full_vect, full_base + i,
VEC_index (vect_el_t, vect, i)); VEC_index (vect_el_t, vect, i));
} }
/* The comb_vect min/max values are also used for the full vector, so
compute them now. */
for (vect_index = 0; vect_index < vect_length; vect_index++)
if (VEC_index (vect_el_t, vect, vect_index) != undefined_vect_el_value)
{
vect_el_t x = VEC_index (vect_el_t, vect, vect_index);
gcc_assert (x >= 0);
if (tab->max_comb_vect_el_value < x)
tab->max_comb_vect_el_value = x;
if (tab->min_comb_vect_el_value > x)
tab->min_comb_vect_el_value = x;
}
if (no_comb_flag)
return;
/* Form comb vector in the table: */ /* Form comb vector in the table: */
gcc_assert (VEC_length (vect_el_t, tab->comb_vect) gcc_assert (VEC_length (vect_el_t, tab->comb_vect)
== VEC_length (vect_el_t, tab->check_vect)); == VEC_length (vect_el_t, tab->check_vect));
...@@ -7478,10 +7502,6 @@ add_vect (state_ainsn_table_t tab, int vect_num, vla_hwint_t vect) ...@@ -7478,10 +7502,6 @@ add_vect (state_ainsn_table_t tab, int vect_num, vla_hwint_t vect)
comb_vect_index + vect_index) comb_vect_index + vect_index)
== undefined_vect_el_value); == undefined_vect_el_value);
gcc_assert (x >= 0); gcc_assert (x >= 0);
if (tab->max_comb_vect_el_value < x)
tab->max_comb_vect_el_value = x;
if (tab->min_comb_vect_el_value > x)
tab->min_comb_vect_el_value = x;
VEC_replace (vect_el_t, tab->comb_vect, VEC_replace (vect_el_t, tab->comb_vect,
comb_vect_index + vect_index, x); comb_vect_index + vect_index, x);
VEC_replace (vect_el_t, tab->check_vect, VEC_replace (vect_el_t, tab->check_vect,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment