mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-20 02:47:11 +03:00
noExplicitConstructor
This commit is contained in:
@@ -131,7 +131,7 @@ RoseVertex createVertex(RoseBuildImpl *build, const RoseVertex parent,
|
||||
/* fill in report information */
|
||||
g[v].reports.insert(reports.begin(), reports.end());
|
||||
|
||||
RoseEdge e = add_edge(parent, v, g);
|
||||
RoseEdge e = add_edge(parent, v, g).first;
|
||||
DEBUG_PRINTF("adding edge (%u, %u) to parent\n", minBound, maxBound);
|
||||
|
||||
g[e].minBound = minBound;
|
||||
@@ -161,7 +161,7 @@ RoseVertex createAnchoredVertex(RoseBuildImpl *build, u32 literalId,
|
||||
DEBUG_PRINTF("created anchored vertex %zu with lit id %u\n", g[v].index,
|
||||
literalId);
|
||||
|
||||
RoseEdge e = add_edge(build->anchored_root, v, g);
|
||||
RoseEdge e = add_edge(build->anchored_root, v, g).first;
|
||||
g[e].minBound = min_offset;
|
||||
g[e].maxBound = max_offset;
|
||||
|
||||
@@ -307,7 +307,7 @@ void createVertices(RoseBuildImpl *tbi,
|
||||
|
||||
RoseVertex p = pv.first;
|
||||
|
||||
RoseEdge e = add_edge(p, w, g);
|
||||
RoseEdge e = add_edge(p, w, g).first;
|
||||
DEBUG_PRINTF("adding edge (%u,%u) to parent\n", edge_props.minBound,
|
||||
edge_props.maxBound);
|
||||
g[e].minBound = edge_props.minBound;
|
||||
@@ -345,7 +345,7 @@ void createVertices(RoseBuildImpl *tbi,
|
||||
|
||||
for (const auto &pv : parents) {
|
||||
const RoseInEdgeProps &edge_props = bd.ig[pv.second];
|
||||
RoseEdge e = add_edge(pv.first, g_v, tbi->g);
|
||||
RoseEdge e = add_edge(pv.first, g_v, tbi->g).first;
|
||||
g[e].minBound = edge_props.minBound;
|
||||
g[e].maxBound = edge_props.maxBound;
|
||||
g[e].history = selectHistory(*tbi, bd, pv.second, e);
|
||||
@@ -698,7 +698,7 @@ void makeEodEventLeftfix(RoseBuildImpl &build, RoseVertex u,
|
||||
g[v].left.graph = eod_leftfix;
|
||||
g[v].left.leftfix_report = report_mapping.second;
|
||||
g[v].left.lag = 0;
|
||||
RoseEdge e1 = add_edge(u, v, g);
|
||||
RoseEdge e1 = add_edge(u, v, g).first;
|
||||
g[e1].minBound = 0;
|
||||
g[e1].maxBound = ROSE_BOUND_INF;
|
||||
g[v].min_offset = add_rose_depth(g[u].min_offset,
|
||||
@@ -718,7 +718,7 @@ void makeEodEventLeftfix(RoseBuildImpl &build, RoseVertex u,
|
||||
g[w].reports = report_mapping.first;
|
||||
g[w].min_offset = g[v].min_offset;
|
||||
g[w].max_offset = g[v].max_offset;
|
||||
RoseEdge e = add_edge(v, w, g);
|
||||
RoseEdge e = add_edge(v, w, g).first;
|
||||
g[e].minBound = 0;
|
||||
g[e].maxBound = 0;
|
||||
/* No need to set history as the event is only delivered at the last
|
||||
@@ -794,7 +794,7 @@ void doRoseAcceptVertex(RoseBuildImpl *tbi,
|
||||
g[w].reports = ig[iv].reports;
|
||||
g[w].min_offset = g[u].min_offset;
|
||||
g[w].max_offset = g[u].max_offset;
|
||||
RoseEdge e = add_edge(u, w, g);
|
||||
RoseEdge e = add_edge(u, w, g).first;
|
||||
g[e].minBound = 0;
|
||||
g[e].maxBound = 0;
|
||||
g[e].history = ROSE_ROLE_HISTORY_LAST_BYTE;
|
||||
@@ -1719,7 +1719,7 @@ bool addEodOutfix(RoseBuildImpl &build, const NGHolder &h) {
|
||||
g[v].left.graph = eod_leftfix;
|
||||
g[v].left.leftfix_report = report_mapping.second;
|
||||
g[v].left.lag = 0;
|
||||
RoseEdge e1 = add_edge(build.anchored_root, v, g);
|
||||
RoseEdge e1 = add_edge(build.anchored_root, v, g).first;
|
||||
g[e1].minBound = 0;
|
||||
g[e1].maxBound = ROSE_BOUND_INF;
|
||||
g[v].min_offset = findMinWidth(*eod_leftfix);
|
||||
@@ -1737,7 +1737,7 @@ bool addEodOutfix(RoseBuildImpl &build, const NGHolder &h) {
|
||||
g[w].reports = report_mapping.first;
|
||||
g[w].min_offset = g[v].min_offset;
|
||||
g[w].max_offset = g[v].max_offset;
|
||||
RoseEdge e = add_edge(v, w, g);
|
||||
RoseEdge e = add_edge(v, w, g).first;
|
||||
g[e].minBound = 0;
|
||||
g[e].maxBound = 0;
|
||||
g[e].history = ROSE_ROLE_HISTORY_NONE;
|
||||
|
||||
@@ -540,7 +540,7 @@ void addTransientMask(RoseBuildImpl &build, const vector<CharReach> &mask,
|
||||
g[v].left.leftfix_report = mask_report;
|
||||
} else {
|
||||
// Make sure our edge bounds are correct.
|
||||
RoseEdge e = edge(parent, v, g);
|
||||
RoseEdge e = edge(parent, v, g).first;
|
||||
g[e].minBound = 0;
|
||||
g[e].maxBound = anchored ? 0 : ROSE_BOUND_INF;
|
||||
g[e].history = anchored ? ROSE_ROLE_HISTORY_ANCH
|
||||
@@ -552,7 +552,7 @@ void addTransientMask(RoseBuildImpl &build, const vector<CharReach> &mask,
|
||||
g[v].max_offset = v_max_offset;
|
||||
|
||||
if (eod) {
|
||||
RoseEdge e = add_edge(v, eod_v, g);
|
||||
RoseEdge e = add_edge(v, eod_v, g).first;
|
||||
g[e].minBound = 0;
|
||||
g[e].maxBound = 0;
|
||||
g[e].history = ROSE_ROLE_HISTORY_LAST_BYTE;
|
||||
@@ -582,7 +582,7 @@ unique_ptr<NGHolder> buildMaskRhs(const flat_set<ReportID> &reports,
|
||||
succ = u;
|
||||
}
|
||||
|
||||
NFAEdge e = add_edge(h.start, succ, h);
|
||||
NFAEdge e = add_edge(h.start, succ, h).first;
|
||||
h[e].tops.insert(DEFAULT_TOP);
|
||||
|
||||
return rhs;
|
||||
|
||||
@@ -873,7 +873,7 @@ buildAnchoredMatcher(RoseBuildImpl &build, const vector<LitFragment> &fragments,
|
||||
|
||||
if (dfas.empty()) {
|
||||
DEBUG_PRINTF("empty\n");
|
||||
return nullptr;
|
||||
return bytecode_ptr<anchored_matcher_info>(nullptr);
|
||||
}
|
||||
|
||||
for (auto &rdfa : dfas) {
|
||||
|
||||
@@ -1054,7 +1054,7 @@ left_id updateLeftfixWithEager(RoseGraph &g, const eager_info &ei,
|
||||
DEBUG_PRINTF("added %u literal chars back, new lag %u\n", lag_adjust,
|
||||
g[v].left.lag);
|
||||
}
|
||||
left_id leftfix = g[succs[0]].left;
|
||||
left_id leftfix = left_id(left_id(g[succs[0]].left));
|
||||
|
||||
if (leftfix.graph()) {
|
||||
assert(leftfix.graph()->kind == NFA_PREFIX
|
||||
@@ -1593,7 +1593,7 @@ void findSuffixTriggers(const RoseBuildImpl &tbi,
|
||||
continue;
|
||||
}
|
||||
PredTopPair ptp(v, g[v].suffix.top);
|
||||
(*suffixTriggers)[g[v].suffix].insert(ptp);
|
||||
(*suffixTriggers)[suffix_id(g[v].suffix)].insert(ptp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1613,7 +1613,7 @@ public:
|
||||
explicit OutfixBuilder(const RoseBuildImpl &build_in) : build(build_in) {}
|
||||
|
||||
bytecode_ptr<NFA> operator()(boost::blank&) const {
|
||||
return nullptr;
|
||||
return bytecode_ptr<NFA>(nullptr);
|
||||
};
|
||||
|
||||
bytecode_ptr<NFA> operator()(unique_ptr<raw_dfa> &rdfa) const {
|
||||
@@ -1660,7 +1660,7 @@ public:
|
||||
bytecode_ptr<NFA> operator()(UNUSED const MpvProto &mpv) const {
|
||||
// MPV construction handled separately.
|
||||
assert(mpv.puffettes.empty());
|
||||
return nullptr;
|
||||
return bytecode_ptr<NFA>(nullptr);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -2304,12 +2304,12 @@ bool anyEndfixMpvTriggers(const RoseBuildImpl &build) {
|
||||
if (!g[v].suffix) {
|
||||
continue;
|
||||
}
|
||||
if (contains(done, g[v].suffix)) {
|
||||
if (contains(done, suffix_id(g[v].suffix))) {
|
||||
continue; /* already done */
|
||||
}
|
||||
done.insert(g[v].suffix);
|
||||
done.insert(suffix_id(g[v].suffix));
|
||||
|
||||
if (hasMpvTrigger(all_reports(g[v].suffix), build.rm)) {
|
||||
if (hasMpvTrigger(all_reports(suffix_id(g[v].suffix)), build.rm)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2369,7 +2369,7 @@ void recordResources(RoseResources &resources, const RoseBuildImpl &build,
|
||||
resources.has_eod = true;
|
||||
break;
|
||||
}
|
||||
if (g[v].suffix && has_eod_accepts(g[v].suffix)) {
|
||||
if (g[v].suffix && has_eod_accepts(suffix_id(g[v].suffix))) {
|
||||
resources.has_eod = true;
|
||||
break;
|
||||
}
|
||||
@@ -2454,7 +2454,7 @@ bool hasEodAnchors(const RoseBuildImpl &build, const build_context &bc,
|
||||
DEBUG_PRINTF("literally report eod\n");
|
||||
return true;
|
||||
}
|
||||
if (g[v].suffix && has_eod_accepts(g[v].suffix)) {
|
||||
if (g[v].suffix && has_eod_accepts(suffix_id(g[v].suffix))) {
|
||||
DEBUG_PRINTF("eod suffix\n");
|
||||
return true;
|
||||
}
|
||||
@@ -2529,7 +2529,7 @@ void writeNfaInfo(const RoseBuildImpl &build, build_context &bc,
|
||||
if (!g[v].suffix) {
|
||||
continue;
|
||||
}
|
||||
u32 qi = bc.suffixes.at(g[v].suffix);
|
||||
u32 qi = bc.suffixes.at(suffix_id(g[v].suffix));
|
||||
assert(qi < infos.size());
|
||||
if (build.isInETable(v)) {
|
||||
infos.at(qi).eod = 1;
|
||||
@@ -3185,7 +3185,7 @@ set<ReportID> findEngineReports(const RoseBuildImpl &build) {
|
||||
const auto &g = build.g;
|
||||
for (auto v : vertices_range(g)) {
|
||||
if (g[v].suffix) {
|
||||
insert(&reports, all_reports(g[v].suffix));
|
||||
insert(&reports, all_reports(suffix_id(g[v].suffix)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3641,7 +3641,7 @@ bytecode_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
|
||||
prepMpv(*this, bc, &historyRequired, &mpv_as_outfix);
|
||||
proto.outfixBeginQueue = qif.allocated_count();
|
||||
if (!prepOutfixes(*this, bc, &historyRequired)) {
|
||||
return nullptr;
|
||||
return bytecode_ptr<RoseEngine>(nullptr);
|
||||
}
|
||||
proto.outfixEndQueue = qif.allocated_count();
|
||||
proto.leftfixBeginQueue = proto.outfixEndQueue;
|
||||
@@ -3652,7 +3652,7 @@ bytecode_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
|
||||
/* Note: buildNfas may reduce the lag for vertices that have prefixes */
|
||||
if (!buildNfas(*this, bc, qif, &no_retrigger_queues, &eager_queues,
|
||||
&proto.leftfixBeginQueue)) {
|
||||
return nullptr;
|
||||
return bytecode_ptr<RoseEngine>(nullptr);
|
||||
}
|
||||
u32 eodNfaIterOffset = buildEodNfaIterator(bc, proto.leftfixBeginQueue);
|
||||
buildCountingMiracles(bc);
|
||||
|
||||
@@ -252,11 +252,11 @@ bool unmakeCastles(RoseBuildImpl &tbi) {
|
||||
for (auto v : vertices_range(g)) {
|
||||
const LeftEngInfo &left = g[v].left;
|
||||
if (left.castle && left.castle->repeats.size() > 1) {
|
||||
left_castles[left].emplace_back(v);
|
||||
left_castles[left_id(left)].emplace_back(v);
|
||||
}
|
||||
const RoseSuffixInfo &suffix = g[v].suffix;
|
||||
if (suffix.castle && suffix.castle->repeats.size() > 1) {
|
||||
suffix_castles[suffix].emplace_back(v);
|
||||
suffix_castles[suffix_id(suffix)].emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -811,7 +811,7 @@ void RoseBuildImpl::findTransientLeftfixes(void) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const left_id &left(g[v].left);
|
||||
const left_id &left(left_id(g[v].left));
|
||||
|
||||
if (::ue2::isAnchored(left) && !isInETable(v)) {
|
||||
/* etable prefixes currently MUST be transient as we do not know
|
||||
@@ -863,7 +863,7 @@ map<left_id, vector<RoseVertex>> findLeftSucc(const RoseBuildImpl &build) {
|
||||
for (auto v : vertices_range(build.g)) {
|
||||
if (build.g[v].left) {
|
||||
const LeftEngInfo &lei = build.g[v].left;
|
||||
leftfixes[lei].emplace_back(v);
|
||||
leftfixes[left_id(lei)].emplace_back(v);
|
||||
}
|
||||
}
|
||||
return leftfixes;
|
||||
@@ -1250,7 +1250,7 @@ void buildRoseSquashMasks(RoseBuildImpl &tbi) {
|
||||
if (!info.delayed_ids.empty()
|
||||
|| !all_of_in(info.vertices,
|
||||
[&](RoseVertex v) {
|
||||
return left == tbi.g[v].left; })) {
|
||||
return left == left_id(tbi.g[v].left); })) {
|
||||
DEBUG_PRINTF("group %llu is unsquashable\n", info.group_mask);
|
||||
unsquashable |= info.group_mask;
|
||||
}
|
||||
@@ -1393,7 +1393,7 @@ void addSmallBlockLiteral(RoseBuildImpl &tbi, const simple_anchored_info &sai,
|
||||
g[v].max_offset = sai.max_bound + sai.literal.length();
|
||||
lit_info.vertices.insert(v);
|
||||
|
||||
RoseEdge e = add_edge(anchored_root, v, g);
|
||||
RoseEdge e = add_edge(anchored_root, v, g).first;
|
||||
g[e].minBound = sai.min_bound;
|
||||
g[e].maxBound = sai.max_bound;
|
||||
}
|
||||
@@ -1417,7 +1417,7 @@ void addSmallBlockLiteral(RoseBuildImpl &tbi, const ue2_literal &lit,
|
||||
g[v].literals.insert(lit_id);
|
||||
g[v].reports = reports;
|
||||
|
||||
RoseEdge e = add_edge(tbi.root, v, g);
|
||||
RoseEdge e = add_edge(tbi.root, v, g).first;
|
||||
g[e].minBound = 0;
|
||||
g[e].maxBound = ROSE_BOUND_INF;
|
||||
g[v].min_offset = 1;
|
||||
|
||||
@@ -99,7 +99,7 @@ unique_ptr<NGHolder> makeFloodProneSuffix(const ue2_literal &s, size_t len,
|
||||
NFAVertex u = h->start;
|
||||
for (auto it = s.begin() + s.length() - len; it != s.end(); ++it) {
|
||||
NFAVertex v = addHolderVertex(*it, *h);
|
||||
NFAEdge e = add_edge(u, v, *h);
|
||||
NFAEdge e = add_edge(u, v, *h).first;
|
||||
if (u == h->start) {
|
||||
(*h)[e].tops.insert(DEFAULT_TOP);
|
||||
}
|
||||
@@ -410,7 +410,7 @@ bool handleStartPrefixCliche(const NGHolder &h, RoseGraph &g, RoseVertex v,
|
||||
assert(g[e_old].maxBound >= bound_max);
|
||||
setEdgeBounds(g, e_old, bound_min, bound_max);
|
||||
} else {
|
||||
RoseEdge e_new = add_edge(ar, v, g);
|
||||
RoseEdge e_new = add_edge(ar, v, g).first;
|
||||
setEdgeBounds(g, e_new, bound_min, bound_max);
|
||||
to_delete->emplace_back(e_old);
|
||||
}
|
||||
@@ -606,7 +606,7 @@ bool handleMixedPrefixCliche(const NGHolder &h, RoseGraph &g, RoseVertex v,
|
||||
if (source(e_old, g) == ar) {
|
||||
setEdgeBounds(g, e_old, ri.repeatMin + width, ri.repeatMax + width);
|
||||
} else {
|
||||
RoseEdge e_new = add_edge(ar, v, g);
|
||||
RoseEdge e_new = add_edge(ar, v, g).first;
|
||||
setEdgeBounds(g, e_new, ri.repeatMin + width, ri.repeatMax + width);
|
||||
to_delete->emplace_back(e_old);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ RoseDedupeAuxImpl::RoseDedupeAuxImpl(const RoseBuildImpl &build_in)
|
||||
// Several vertices may share a suffix, so we collect the set of
|
||||
// suffixes first to avoid repeating work.
|
||||
if (g[v].suffix) {
|
||||
suffixes.insert(g[v].suffix);
|
||||
suffixes.insert(suffix_id(g[v].suffix));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ static
|
||||
bool eligibleForAlwaysOnGroup(const RoseBuildImpl &build, u32 id) {
|
||||
auto eligble = [&](RoseVertex v) {
|
||||
return build.isRootSuccessor(v)
|
||||
&& (!build.g[v].left || !isAnchored(build.g[v].left));
|
||||
&& (!build.g[v].left || !isAnchored(left_id(build.g[v].left)));
|
||||
};
|
||||
|
||||
if (any_of_in(build.literal_info[id].vertices, eligble)) {
|
||||
@@ -208,7 +208,7 @@ void allocateGroupForEvent(RoseBuildImpl &build, u32 group_always_on,
|
||||
|
||||
bool new_group = !groupCount[group_always_on];
|
||||
for (RoseVertex v : info.vertices) {
|
||||
if (build.g[v].left && !isAnchored(build.g[v].left)) {
|
||||
if (build.g[v].left && !isAnchored(left_id(build.g[v].left))) {
|
||||
new_group = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class SmallWriteBuild;
|
||||
class SomSlotManager;
|
||||
|
||||
struct suffix_id {
|
||||
suffix_id(const RoseSuffixInfo &in)
|
||||
explicit suffix_id(const RoseSuffixInfo &in)
|
||||
: g(in.graph.get()), c(in.castle.get()), d(in.rdfa.get()),
|
||||
h(in.haig.get()), t(in.tamarama.get()),
|
||||
dfa_min_width(in.dfa_min_width),
|
||||
@@ -181,7 +181,7 @@ depth findMaxWidth(const suffix_id &s, u32 top);
|
||||
|
||||
/** \brief represents an engine to the left of a rose role */
|
||||
struct left_id {
|
||||
left_id(const LeftEngInfo &in)
|
||||
explicit left_id(const LeftEngInfo &in)
|
||||
: g(in.graph.get()), c(in.castle.get()), d(in.dfa.get()),
|
||||
h(in.haig.get()), dfa_min_width(in.dfa_min_width),
|
||||
dfa_max_width(in.dfa_max_width) {
|
||||
|
||||
@@ -2319,7 +2319,7 @@ class RoseInstrSetCombination
|
||||
public:
|
||||
u32 ckey;
|
||||
|
||||
RoseInstrSetCombination(u32 ckey_in) : ckey(ckey_in) {}
|
||||
explicit RoseInstrSetCombination(u32 ckey_in) : ckey(ckey_in) {}
|
||||
|
||||
bool operator==(const RoseInstrSetCombination &ri) const {
|
||||
return ckey == ri.ckey;
|
||||
@@ -2361,7 +2361,7 @@ class RoseInstrSetExhaust
|
||||
public:
|
||||
u32 ekey;
|
||||
|
||||
RoseInstrSetExhaust(u32 ekey_in) : ekey(ekey_in) {}
|
||||
explicit RoseInstrSetExhaust(u32 ekey_in) : ekey(ekey_in) {}
|
||||
|
||||
bool operator==(const RoseInstrSetExhaust &ri) const {
|
||||
return ekey == ri.ekey;
|
||||
|
||||
@@ -280,13 +280,13 @@ void findForwardReach(const RoseGraph &g, const RoseVertex v,
|
||||
return;
|
||||
}
|
||||
rose_look.emplace_back(map<s32, CharReach>());
|
||||
getRoseForwardReach(g[t].left, g[e].rose_top, rose_look.back());
|
||||
getRoseForwardReach(left_id(g[t].left), g[e].rose_top, rose_look.back());
|
||||
}
|
||||
|
||||
if (g[v].suffix) {
|
||||
DEBUG_PRINTF("suffix engine\n");
|
||||
rose_look.emplace_back(map<s32, CharReach>());
|
||||
getSuffixForwardReach(g[v].suffix, g[v].suffix.top, rose_look.back());
|
||||
getSuffixForwardReach(suffix_id(g[v].suffix), g[v].suffix.top, rose_look.back());
|
||||
}
|
||||
|
||||
combineForwardMasks(rose_look, look);
|
||||
|
||||
@@ -477,10 +477,10 @@ bool isNoRunsVertex(const RoseBuildImpl &build, RoseVertex u) {
|
||||
DEBUG_PRINTF("u=%zu is not a root role\n", g[u].index);
|
||||
return false;
|
||||
}
|
||||
auto edge_result = edge(build.root, u, g);
|
||||
RoseEdge e = edge_result.first;
|
||||
|
||||
RoseEdge e = edge(build.root, u, g);
|
||||
|
||||
if (!e) {
|
||||
if (!edge_result.second) {
|
||||
DEBUG_PRINTF("u=%zu is not a root role\n", g[u].index);
|
||||
return false;
|
||||
}
|
||||
@@ -635,7 +635,7 @@ u64a literalMinReportOffset(const RoseBuildImpl &build,
|
||||
}
|
||||
|
||||
if (g[v].suffix) {
|
||||
depth suffix_width = findMinWidth(g[v].suffix, g[v].suffix.top);
|
||||
depth suffix_width = findMinWidth(suffix_id(g[v].suffix), g[v].suffix.top);
|
||||
assert(suffix_width.is_reachable());
|
||||
DEBUG_PRINTF("suffix with width %s\n", suffix_width.str().c_str());
|
||||
min_offset = min(min_offset, vert_offset + suffix_width);
|
||||
@@ -886,7 +886,7 @@ void buildAccel(const RoseBuildImpl &build,
|
||||
bytecode_ptr<HWLM>
|
||||
buildHWLMMatcher(const RoseBuildImpl &build, const LitProto *litProto) {
|
||||
if (!litProto) {
|
||||
return nullptr;
|
||||
return bytecode_ptr<HWLM>(nullptr);
|
||||
}
|
||||
auto hwlm = hwlmBuild(*litProto->hwlmProto, build.cc,
|
||||
build.getInitialGroups());
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace {
|
||||
/** Key used to group sets of leftfixes by the dedupeLeftfixes path. */
|
||||
struct RoseGroup {
|
||||
RoseGroup(const RoseBuildImpl &build, RoseVertex v)
|
||||
: left_hash(hashLeftfix(build.g[v].left)),
|
||||
: left_hash(hashLeftfix(left_id(build.g[v].left))),
|
||||
lag(build.g[v].left.lag), eod_table(build.isInETable(v)) {
|
||||
const RoseGraph &g = build.g;
|
||||
assert(in_degree(v, g) == 1);
|
||||
@@ -262,8 +262,8 @@ bool dedupeLeftfixes(RoseBuildImpl &tbi) {
|
||||
// Scan the rest of the list for dupes.
|
||||
for (auto kt = std::next(jt); kt != jte; ++kt) {
|
||||
if (g[v].left == g[*kt].left
|
||||
|| !is_equal(g[v].left, g[v].left.leftfix_report,
|
||||
g[*kt].left, g[*kt].left.leftfix_report)) {
|
||||
|| !is_equal(left_id(g[v].left), g[v].left.leftfix_report,
|
||||
left_id(g[*kt].left), g[*kt].left.leftfix_report)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -547,8 +547,8 @@ bool checkPrefix(const rose_literal_id &ul, const u32 ulag,
|
||||
static
|
||||
bool hasSameEngineType(const RoseVertexProps &u_prop,
|
||||
const RoseVertexProps &v_prop) {
|
||||
const left_id u_left = u_prop.left;
|
||||
const left_id v_left = v_prop.left;
|
||||
const left_id u_left = left_id(u_prop.left);
|
||||
const left_id v_left = left_id(v_prop.left);
|
||||
|
||||
return !u_left.haig() == !v_left.haig()
|
||||
&& !u_left.dfa() == !v_left.dfa()
|
||||
@@ -1346,7 +1346,7 @@ insertion_ordered_map<left_id, vector<RoseVertex>> get_eng_verts(const RoseGraph
|
||||
continue;
|
||||
}
|
||||
assert(contains(all_reports(left), left.leftfix_report));
|
||||
eng_verts[left].emplace_back(v);
|
||||
eng_verts[left_id(left)].emplace_back(v);
|
||||
}
|
||||
|
||||
return eng_verts;
|
||||
@@ -2033,7 +2033,7 @@ void mergeCastleLeftfixes(RoseBuildImpl &build) {
|
||||
continue;
|
||||
}
|
||||
|
||||
eng_verts[g[v].left].emplace_back(v);
|
||||
eng_verts[left_id(g[v].left)].emplace_back(v);
|
||||
}
|
||||
|
||||
map<CharReach, vector<left_id>> by_reach;
|
||||
@@ -2198,7 +2198,7 @@ void mergeAcyclicSuffixes(RoseBuildImpl &tbi) {
|
||||
continue;
|
||||
}
|
||||
|
||||
suffixes.insert(g[v].suffix, v);
|
||||
suffixes.insert(suffix_id(g[v].suffix), v);
|
||||
}
|
||||
|
||||
deque<SuffixBouquet> suff_groups;
|
||||
@@ -2260,7 +2260,7 @@ void mergeSmallSuffixes(RoseBuildImpl &tbi) {
|
||||
continue;
|
||||
}
|
||||
|
||||
suffixes.insert(g[v].suffix, v);
|
||||
suffixes.insert(suffix_id(g[v].suffix), v);
|
||||
}
|
||||
|
||||
deque<SuffixBouquet> suff_groups;
|
||||
|
||||
@@ -1919,7 +1919,7 @@ void makeRoleSuffix(const RoseBuildImpl &build,
|
||||
return;
|
||||
}
|
||||
assert(contains(suffixes, g[v].suffix));
|
||||
u32 queue = suffixes.at(g[v].suffix);
|
||||
u32 queue = suffixes.at(suffix_id(g[v].suffix));
|
||||
u32 event;
|
||||
assert(contains(engine_info_by_queue, queue));
|
||||
const auto eng_info = engine_info_by_queue.at(queue);
|
||||
@@ -2178,7 +2178,7 @@ void makeGroupSquashInstruction(const RoseBuildImpl &build, u32 lit_id,
|
||||
|
||||
namespace {
|
||||
struct ProgKey {
|
||||
ProgKey(const RoseProgram &p) : prog(&p) {}
|
||||
explicit ProgKey(const RoseProgram &p) : prog(&p) {}
|
||||
|
||||
bool operator==(const ProgKey &b) const {
|
||||
return RoseProgramEquivalence()(*prog, *b.prog);
|
||||
@@ -2200,7 +2200,7 @@ RoseProgram assembleProgramBlocks(vector<RoseProgram> &&blocks_in) {
|
||||
|
||||
ue2_unordered_set<ProgKey> seen;
|
||||
for (auto &block : blocks_in) {
|
||||
if (contains(seen, block)) {
|
||||
if (contains(seen, ProgKey(block))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,13 +159,13 @@ private:
|
||||
};
|
||||
|
||||
struct RoseAliasingInfo {
|
||||
RoseAliasingInfo(const RoseBuildImpl &build) {
|
||||
explicit RoseAliasingInfo(const RoseBuildImpl &build) {
|
||||
const auto &g = build.g;
|
||||
|
||||
// Populate reverse leftfix map.
|
||||
for (auto v : vertices_range(g)) {
|
||||
if (g[v].left) {
|
||||
rev_leftfix[g[v].left].insert(v);
|
||||
rev_leftfix[left_id(g[v].left)].insert(v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,8 +259,10 @@ bool samePredecessors(RoseVertex a, RoseVertex b, const RoseGraph &g) {
|
||||
}
|
||||
|
||||
for (const auto &e_a : in_edges_range(a, g)) {
|
||||
RoseEdge e = edge(source(e_a, g), b, g);
|
||||
if (!e || g[e].rose_top != g[e_a].rose_top) {
|
||||
auto edge_result = edge(source(e_a, g), b, g);
|
||||
RoseEdge e = edge_result.first;
|
||||
|
||||
if (!edge_result.second || g[e].rose_top != g[e_a].rose_top) {
|
||||
DEBUG_PRINTF("bad tops\n");
|
||||
return false;
|
||||
}
|
||||
@@ -274,7 +276,9 @@ static
|
||||
bool hasCommonSuccWithBadBounds(RoseVertex a, RoseVertex b,
|
||||
const RoseGraph &g) {
|
||||
for (const auto &e_a : out_edges_range(a, g)) {
|
||||
if (RoseEdge e = edge(b, target(e_a, g), g)) {
|
||||
auto edge_result = edge(b, target(e_a, g), g);
|
||||
RoseEdge e = edge_result.first;
|
||||
if (edge_result.second) {
|
||||
if (g[e_a].maxBound < g[e].minBound
|
||||
|| g[e].maxBound < g[e_a].minBound) {
|
||||
return true;
|
||||
@@ -293,7 +297,9 @@ static
|
||||
bool hasCommonPredWithBadBounds(RoseVertex a, RoseVertex b,
|
||||
const RoseGraph &g) {
|
||||
for (const auto &e_a : in_edges_range(a, g)) {
|
||||
if (RoseEdge e = edge(source(e_a, g), b, g)) {
|
||||
auto edge_result = edge(source(e_a, g), b, g);
|
||||
RoseEdge e = edge_result.first;
|
||||
if (edge_result.second) {
|
||||
if (g[e_a].maxBound < g[e].minBound
|
||||
|| g[e].maxBound < g[e_a].minBound) {
|
||||
return true;
|
||||
@@ -700,7 +706,9 @@ bool hasCommonPredWithDiffRoses(RoseVertex a, RoseVertex b,
|
||||
const bool equal_roses = hasEqualLeftfixes(a, b, g);
|
||||
|
||||
for (const auto &e_a : in_edges_range(a, g)) {
|
||||
if (RoseEdge e = edge(source(e_a, g), b, g)) {
|
||||
auto edge_result = edge(source(e_a, g), b, g);
|
||||
RoseEdge e = edge_result.first;
|
||||
if (edge_result.second) {
|
||||
DEBUG_PRINTF("common pred, e_r=%d r_t %u,%u\n",
|
||||
(int)equal_roses, g[e].rose_top, g[e_a].rose_top);
|
||||
if (!equal_roses) {
|
||||
@@ -908,8 +916,8 @@ bool mergeSameCastle(RoseBuildImpl &build, RoseVertex a, RoseVertex b,
|
||||
}
|
||||
|
||||
assert(contains(rai.rev_leftfix[b_left], b));
|
||||
rai.rev_leftfix[b_left].erase(b);
|
||||
rai.rev_leftfix[a_left].insert(b);
|
||||
rai.rev_leftfix[left_id(b_left)].erase(b);
|
||||
rai.rev_leftfix[left_id(a_left)].insert(b);
|
||||
|
||||
a_left.leftfix_report = new_report;
|
||||
b_left.leftfix_report = new_report;
|
||||
@@ -918,7 +926,7 @@ bool mergeSameCastle(RoseBuildImpl &build, RoseVertex a, RoseVertex b,
|
||||
updateEdgeTops(g, a, a_top_map);
|
||||
updateEdgeTops(g, b, b_top_map);
|
||||
|
||||
pruneUnusedTops(castle, g, rai.rev_leftfix[a_left]);
|
||||
pruneUnusedTops(castle, g, rai.rev_leftfix[left_id(a_left)]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1026,9 +1034,9 @@ bool attemptRoseCastleMerge(RoseBuildImpl &build, bool preds_same, RoseVertex a,
|
||||
b_left.castle = new_castle;
|
||||
|
||||
assert(a_left == b_left);
|
||||
rai.rev_leftfix[a_left].insert(a);
|
||||
rai.rev_leftfix[a_left].insert(b);
|
||||
pruneUnusedTops(*new_castle, g, rai.rev_leftfix[a_left]);
|
||||
rai.rev_leftfix[left_id(a_left)].insert(a);
|
||||
rai.rev_leftfix[left_id(a_left)].insert(b);
|
||||
pruneUnusedTops(*new_castle, g, rai.rev_leftfix[left_id(a_left)]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1079,7 +1087,9 @@ bool attemptRoseCastleMerge(RoseBuildImpl &build, bool preds_same, RoseVertex a,
|
||||
// We should be protected from merging common preds with tops leading
|
||||
// to completely different repeats by earlier checks, but just in
|
||||
// case...
|
||||
if (RoseEdge a_edge = edge(source(e, g), a, g)) {
|
||||
auto edge_result = edge(source(e, g), a, g);
|
||||
RoseEdge a_edge = edge_result.first;
|
||||
if (edge_result.second) {
|
||||
u32 a_top = g[a_edge].rose_top;
|
||||
const PureRepeat &a_pr = m_castle->repeats[a_top]; // new report
|
||||
if (pr != a_pr) {
|
||||
@@ -1112,9 +1122,9 @@ bool attemptRoseCastleMerge(RoseBuildImpl &build, bool preds_same, RoseVertex a,
|
||||
b_left.leftfix_report = new_report;
|
||||
|
||||
assert(a_left == b_left);
|
||||
rai.rev_leftfix[a_left].insert(a);
|
||||
rai.rev_leftfix[a_left].insert(b);
|
||||
pruneUnusedTops(*m_castle, g, rai.rev_leftfix[a_left]);
|
||||
rai.rev_leftfix[left_id(a_left)].insert(a);
|
||||
rai.rev_leftfix[left_id(a_left)].insert(b);
|
||||
pruneUnusedTops(*m_castle, g, rai.rev_leftfix[left_id(a_left)]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1237,9 +1247,9 @@ bool attemptRoseGraphMerge(RoseBuildImpl &build, bool preds_same, RoseVertex a,
|
||||
a_left.graph = new_graph;
|
||||
b_left.graph = new_graph;
|
||||
|
||||
rai.rev_leftfix[a_left].insert(a);
|
||||
rai.rev_leftfix[a_left].insert(b);
|
||||
pruneUnusedTops(*new_graph, g, rai.rev_leftfix[a_left]);
|
||||
rai.rev_leftfix[left_id(a_left)].insert(a);
|
||||
rai.rev_leftfix[left_id(a_left)].insert(b);
|
||||
pruneUnusedTops(*new_graph, g, rai.rev_leftfix[left_id(a_left)]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1258,7 +1268,7 @@ bool attemptRoseGraphMerge(RoseBuildImpl &build, bool preds_same, RoseVertex a,
|
||||
DEBUG_PRINTF("attempting merge of roses on vertices %zu and %zu\n",
|
||||
g[a].index, g[b].index);
|
||||
|
||||
set<RoseVertex> &b_verts = rai.rev_leftfix[b_left];
|
||||
set<RoseVertex> &b_verts = rai.rev_leftfix[left_id(b_left)];
|
||||
set<RoseVertex> aa;
|
||||
aa.insert(a);
|
||||
|
||||
@@ -2136,7 +2146,9 @@ void mergeDupeLeaves(RoseBuildImpl &build) {
|
||||
for (const auto &e : in_edges_range(v, g)) {
|
||||
RoseVertex u = source(e, g);
|
||||
DEBUG_PRINTF("u index=%zu\n", g[u].index);
|
||||
if (RoseEdge et = edge(u, t, g)) {
|
||||
auto edge_result = edge(u, t, g);
|
||||
RoseEdge et = edge_result.first;
|
||||
if (edge_result.second) {
|
||||
if (g[et].minBound <= g[e].minBound
|
||||
&& g[et].maxBound >= g[e].maxBound) {
|
||||
DEBUG_PRINTF("remove more constrained edge\n");
|
||||
|
||||
@@ -95,7 +95,7 @@ u32 findMinWidth(const RoseBuildImpl &tbi, enum rose_literal_table table) {
|
||||
}
|
||||
|
||||
if (g[v].suffix) {
|
||||
depth suffix_width = findMinWidth(g[v].suffix, g[v].suffix.top);
|
||||
depth suffix_width = findMinWidth(suffix_id(g[v].suffix), g[v].suffix.top);
|
||||
assert(suffix_width.is_reachable());
|
||||
DEBUG_PRINTF("%zu has suffix with top %u (width %s), can fire "
|
||||
"report at %u\n",
|
||||
@@ -145,10 +145,10 @@ u32 findMaxBAWidth(const RoseBuildImpl &tbi) {
|
||||
u64a w = g[v].max_offset;
|
||||
|
||||
if (g[v].suffix) {
|
||||
if (has_non_eod_accepts(g[v].suffix)) {
|
||||
if (has_non_eod_accepts(suffix_id(g[v].suffix))) {
|
||||
return ROSE_BOUND_INF;
|
||||
}
|
||||
depth suffix_width = findMaxWidth(g[v].suffix, g[v].suffix.top);
|
||||
depth suffix_width = findMaxWidth(suffix_id(g[v].suffix), g[v].suffix.top);
|
||||
DEBUG_PRINTF("suffix max width for top %u is %s\n", g[v].suffix.top,
|
||||
suffix_width.str().c_str());
|
||||
assert(suffix_width.is_reachable());
|
||||
@@ -222,11 +222,11 @@ u32 findMaxBAWidth(const RoseBuildImpl &tbi, enum rose_literal_table table) {
|
||||
accept_eod node */
|
||||
|
||||
if (g[v].suffix) {
|
||||
if (has_non_eod_accepts(g[v].suffix)) {
|
||||
if (has_non_eod_accepts(suffix_id(g[v].suffix))) {
|
||||
DEBUG_PRINTF("has accept\n");
|
||||
return ROSE_BOUND_INF;
|
||||
}
|
||||
depth suffix_width = findMaxWidth(g[v].suffix);
|
||||
depth suffix_width = findMaxWidth(suffix_id(g[v].suffix));
|
||||
DEBUG_PRINTF("suffix max width %s\n", suffix_width.str().c_str());
|
||||
assert(suffix_width.is_reachable());
|
||||
if (!suffix_width.is_finite()) {
|
||||
|
||||
Reference in New Issue
Block a user