return constructLBR(proto, triggers, cc, rm);
}
-/** \brief True if graph \p g could be turned into an LBR engine. */
-bool isLBR(const NGHolder &g, const Grey &grey) {
- if (!grey.allowLbr) {
- return false;
- }
-
- PureRepeat repeat;
- if (!isPureRepeat(g, repeat)) {
- DEBUG_PRINTF("not pure bounded repeat\n");
- return false;
- }
-
- if (repeat.reports.size() != 1) {
- DEBUG_PRINTF("too many reports\n");
- return false;
- }
-
- return true;
-}
-
} // namespace ue2
const std::vector<std::vector<CharReach>> &triggers,
const CompileContext &cc, const ReportManager &rm);
-/** \brief True if graph \p g could be turned into an LBR engine. */
-bool isLBR(const NGHolder &g, const Grey &grey);
-
} // namespace ue2
#endif // NG_LBR_H
/** \brief Max DFA states in a merged DFA. */
static const size_t DFA_MERGE_MAX_STATES = 8000;
-/** \brief An LBR must have at least this many vertices to be protected from
- * merging with other graphs. */
-static const size_t LARGE_LBR_MIN_VERTICES = 32;
-
/** \brief In block mode, merge two prefixes even if they don't have identical
* literal sets if they have fewer than this many states and the merged graph
* is also small. */
: SMALL_ROSE_THRESHOLD_BLOCK;
}
-static
-bool isLargeLBR(const NGHolder &g, const Grey &grey) {
- if (num_vertices(g) < LARGE_LBR_MIN_VERTICES) {
- return false;
- }
- return isLBR(g, grey);
-}
-
namespace {
struct DupeLeafKey {
explicit DupeLeafKey(const RoseVertexProps &litv)
continue;
}
+ if (leftfix.graph()) {
+ /* we should not have merged yet */
+ assert(!is_triggered(*leftfix.graph())
+ || onlyOneTop(*leftfix.graph()));
+ }
+
roseGrouping[DedupeLeftKey(tbi, v)].insert(leftfix, v);
}
continue;
}
- // Don't merge cases that will become LBRs or haigs.
- if (isLargeLBR(h, tbi.cc.grey)) {
- continue;
- }
-
// Small roses only.
if (num_vertices(h) > small_rose_threshold(tbi.cc)) {
continue;
continue;
}
- if (isLargeLBR(*h, tbi.cc.grey)) {
- DEBUG_PRINTF("not considering LBR suffix for merge\n");
- continue;
- }
-
suffixes.insert(g[v].suffix, v);
}
continue;
}
- if (isLargeLBR(*h, tbi.cc.grey)) {
- DEBUG_PRINTF("not considering LBR suffix for merge\n");
- continue;
- }
-
suffixes.insert(g[v].suffix, v);
}