mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
Do equivalency removal before violet's implementablity check.
This is helpful as removing/restoring literals may introduce redundancy in the graphs. Also improve the implementation by caching known good holders.
This commit is contained in:
parent
aa6025012b
commit
68c8845d15
@ -1759,7 +1759,6 @@ void removeRedundantLiteralsFromInfixes(RoseInGraph &g,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void removeRedundantLiterals(RoseInGraph &g, const CompileContext &cc) {
|
void removeRedundantLiterals(RoseInGraph &g, const CompileContext &cc) {
|
||||||
removeRedundantLiteralsFromPrefixes(g, cc);
|
removeRedundantLiteralsFromPrefixes(g, cc);
|
||||||
@ -2886,6 +2885,7 @@ bool ensureImplementable(RoseBuild &rose, RoseInGraph &vg, bool allow_changes,
|
|||||||
bool changed = false;
|
bool changed = false;
|
||||||
bool need_to_recalc = false;
|
bool need_to_recalc = false;
|
||||||
u32 added_count = 0;
|
u32 added_count = 0;
|
||||||
|
unordered_set<NGHolder *> good; /* known to be implementable */
|
||||||
do {
|
do {
|
||||||
changed = false;
|
changed = false;
|
||||||
DEBUG_PRINTF("added %u\n", added_count);
|
DEBUG_PRINTF("added %u\n", added_count);
|
||||||
@ -2901,13 +2901,19 @@ bool ensureImplementable(RoseBuild &rose, RoseInGraph &vg, bool allow_changes,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (NGHolder *h : graphs) {
|
for (NGHolder *h : graphs) {
|
||||||
|
if (contains(good, h)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
reduceGraphEquivalences(*h, cc);
|
||||||
if (isImplementableNFA(*h, &rm, cc)) {
|
if (isImplementableNFA(*h, &rm, cc)) {
|
||||||
|
good.insert(h);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tryForEarlyDfa(*h, cc)
|
if (tryForEarlyDfa(*h, cc)
|
||||||
&& doEarlyDfa(rose, vg, *h, edges_by_graph[h], final_chance, rm,
|
&& doEarlyDfa(rose, vg, *h, edges_by_graph[h], final_chance, rm,
|
||||||
cc)) {
|
cc)) {
|
||||||
|
good.insert(h);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2923,6 +2929,7 @@ bool ensureImplementable(RoseBuild &rose, RoseInGraph &vg, bool allow_changes,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
|
good.insert(h);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user