mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-17 01:41:51 +03:00
Merge branch 'develop' into wip-isildur-g-cppcheck66
This commit is contained in:
@@ -193,9 +193,6 @@ void reduceGraph(NGHolder &g, som_type som, bool utf8,
|
||||
|
||||
if (!som) {
|
||||
mergeCyclicDotStars(g);
|
||||
}
|
||||
|
||||
if (!som) {
|
||||
removeSiblingsOfStartDotStar(g);
|
||||
}
|
||||
}
|
||||
@@ -292,7 +289,7 @@ bool addComponent(NG &ng, NGHolder &g, const ExpressionInfo &expr,
|
||||
|
||||
// Returns true if all components have been added.
|
||||
static
|
||||
bool processComponents(NG &ng, ExpressionInfo &expr,
|
||||
bool processComponents(NG &ng, const ExpressionInfo &expr,
|
||||
deque<unique_ptr<NGHolder>> &g_comp,
|
||||
const som_type som) {
|
||||
const u32 num_components = g_comp.size();
|
||||
|
||||
@@ -165,9 +165,9 @@ void reformAnchoredRepeatsComponent(NGHolder &g,
|
||||
return;
|
||||
}
|
||||
|
||||
NFAVertex dotV = NGHolder::null_vertex();
|
||||
|
||||
set<NFAVertex> otherV;
|
||||
dotV = findReformable(g, compAnchoredStarts, otherV);
|
||||
NFAVertex dotV = findReformable(g, compAnchoredStarts, otherV);
|
||||
if (dotV == NGHolder::null_vertex()) {
|
||||
DEBUG_PRINTF("no candidate reformable dot found.\n");
|
||||
return;
|
||||
@@ -257,7 +257,7 @@ void reformAnchoredRepeatsComponent(NGHolder &g,
|
||||
|
||||
static
|
||||
void reformUnanchoredRepeatsComponent(NGHolder &g,
|
||||
set<NFAVertex> &compAnchoredStarts,
|
||||
const set<NFAVertex> &compAnchoredStarts,
|
||||
set<NFAVertex> &compUnanchoredStarts,
|
||||
set<NFAVertex> &dead,
|
||||
depth *startBegin, depth *startEnd) {
|
||||
@@ -268,9 +268,9 @@ void reformUnanchoredRepeatsComponent(NGHolder &g,
|
||||
}
|
||||
|
||||
while (true) {
|
||||
NFAVertex dotV = NGHolder::null_vertex();
|
||||
|
||||
set<NFAVertex> otherV;
|
||||
dotV = findReformable(g, compUnanchoredStarts, otherV);
|
||||
NFAVertex dotV = findReformable(g, compUnanchoredStarts, otherV);
|
||||
if (dotV == NGHolder::null_vertex()) {
|
||||
DEBUG_PRINTF("no candidate reformable dot found.\n");
|
||||
return;
|
||||
@@ -555,7 +555,7 @@ void collapseVariableRepeats(NGHolder &g, depth *startBegin, depth *startEnd) {
|
||||
}
|
||||
|
||||
static
|
||||
void addDotsBetween(NGHolder &g, NFAVertex lhs, vector<NFAVertex> &rhs,
|
||||
void addDotsBetween(NGHolder &g, NFAVertex lhs, const vector<NFAVertex> &rhs,
|
||||
depth min_repeat, depth max_repeat) {
|
||||
const bool unbounded = max_repeat.is_infinite();
|
||||
if (unbounded) {
|
||||
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
return id;
|
||||
}
|
||||
|
||||
void append(WorkQueue &other) {
|
||||
void append(const WorkQueue &other) {
|
||||
for (const auto &e : other) {
|
||||
push(e);
|
||||
}
|
||||
@@ -193,7 +193,7 @@ private:
|
||||
}
|
||||
|
||||
static
|
||||
bool outIsIrreducible(NFAVertex &v, const NGHolder &g) {
|
||||
bool outIsIrreducible(const NFAVertex &v, const NGHolder &g) {
|
||||
unsigned nonSpecialVertices = 0;
|
||||
for (auto w : adjacent_vertices_range(v, g)) {
|
||||
if (!is_special(w, g) && w != v) {
|
||||
@@ -204,7 +204,7 @@ bool outIsIrreducible(NFAVertex &v, const NGHolder &g) {
|
||||
}
|
||||
|
||||
static
|
||||
bool inIsIrreducible(NFAVertex &v, const NGHolder &g) {
|
||||
bool inIsIrreducible(const NFAVertex &v, const NGHolder &g) {
|
||||
unsigned nonSpecialVertices = 0;
|
||||
for (auto u : inv_adjacent_vertices_range(v, g)) {
|
||||
if (!is_special(u, g) && u != v) {
|
||||
|
||||
@@ -430,7 +430,7 @@ NFAVertex findSingleCyclic(const NGHolder &g) {
|
||||
}
|
||||
|
||||
static
|
||||
bool hasOffsetAdjust(const ReportManager &rm, NGHolder &g,
|
||||
bool hasOffsetAdjust(const ReportManager &rm, const NGHolder &g,
|
||||
int *adjust) {
|
||||
const auto &reports = all_reports(g);
|
||||
if (reports.empty()) {
|
||||
|
||||
@@ -582,7 +582,7 @@ private:
|
||||
|
||||
// set up all reports
|
||||
bool clone = false;
|
||||
for (auto &pair : reports_to_vertices) {
|
||||
for (const auto &pair : reports_to_vertices) {
|
||||
const auto &reports = pair.first;
|
||||
const auto &svertices = pair.second;
|
||||
|
||||
|
||||
@@ -513,12 +513,12 @@ static
|
||||
bool doHaig(const NGHolder &g, som_type som,
|
||||
const vector<vector<CharReach>> &triggers, bool unordered_som,
|
||||
raw_som_dfa *rdfa) {
|
||||
u32 state_limit = HAIG_FINAL_DFA_STATE_LIMIT; /* haig never backs down from
|
||||
a fight */
|
||||
using StateSet = typename Auto::StateSet;
|
||||
vector<StateSet> nfa_state_map;
|
||||
Auto n(g, som, triggers, unordered_som);
|
||||
try {
|
||||
u32 state_limit = HAIG_FINAL_DFA_STATE_LIMIT; /* haig never backs down from
|
||||
a fight */
|
||||
if (!determinise(n, rdfa->states, state_limit, &nfa_state_map)) {
|
||||
DEBUG_PRINTF("state limit exceeded\n");
|
||||
return false;
|
||||
|
||||
@@ -321,7 +321,7 @@ struct DAccelScheme {
|
||||
bool cd_a = buildDvermMask(a.double_byte);
|
||||
bool cd_b = buildDvermMask(b.double_byte);
|
||||
if (cd_a != cd_b) {
|
||||
return cd_a > cd_b;
|
||||
return cd_a;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -811,11 +811,9 @@ depth_done:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Second option: a two-byte shufti (i.e. less than eight 2-byte
|
||||
// literals)
|
||||
if (depth > 1) {
|
||||
for (unsigned int i = 0; i < (depth - 1); i++) {
|
||||
if (depthReach[i].count() * depthReach[i+1].count()
|
||||
<= DOUBLE_SHUFTI_LIMIT) {
|
||||
|
||||
@@ -98,7 +98,7 @@ void addToString(string &s, const NGHolder &g, NFAVertex v) {
|
||||
}
|
||||
|
||||
static
|
||||
bool splitOffLiteral(NG &ng, NGHolder &g, NFAVertex v, const bool anchored,
|
||||
bool splitOffLiteral(NG &ng, const NGHolder &g, NFAVertex v, const bool anchored,
|
||||
set<NFAVertex> &dead) {
|
||||
DEBUG_PRINTF("examine vertex %zu\n", g[v].index);
|
||||
bool nocase = false, casefixed = false;
|
||||
|
||||
@@ -241,7 +241,7 @@ u32 allowedSquashDistance(const CharReach &cr, u32 min_width, const NGHolder &g,
|
||||
/** Gives a stronger puff trigger when the trigger is connected to a wide
|
||||
* cyclic state (aside from sds) */
|
||||
static
|
||||
void improveHead(NGHolder &g, NFAVertex *a, vector<NFAVertex> *nodes) {
|
||||
void improveHead(const NGHolder &g, NFAVertex *a, vector<NFAVertex> *nodes) {
|
||||
DEBUG_PRINTF("attempting to improve puff trigger\n");
|
||||
assert(!nodes->empty());
|
||||
const CharReach &puff_cr = g[nodes->back()].char_reach;
|
||||
@@ -260,7 +260,7 @@ void improveHead(NGHolder &g, NFAVertex *a, vector<NFAVertex> *nodes) {
|
||||
}
|
||||
|
||||
static
|
||||
void constructPuff(NGHolder &g, const NFAVertex a, const NFAVertex puffv,
|
||||
void constructPuff(const NGHolder &g, const NFAVertex a, const NFAVertex puffv,
|
||||
const CharReach &cr, const ReportID report, u32 width,
|
||||
bool fixed_depth, bool unbounded, bool auto_restart,
|
||||
RoseBuild &rose, ReportManager &rm,
|
||||
|
||||
@@ -323,7 +323,7 @@ bool doUselessMergePass(NGHolder &g, som_type som, VertexInfoMap &infoMap,
|
||||
|
||||
bool changed = false;
|
||||
for (auto v : vertices_range(g)) {
|
||||
VertexInfo &info = infoMap[v];
|
||||
const VertexInfo &info = infoMap[v];
|
||||
|
||||
if (info.isRemoved) {
|
||||
continue;
|
||||
@@ -439,7 +439,7 @@ bool doUselessMergePass(NGHolder &g, som_type som, VertexInfoMap &infoMap,
|
||||
continue; // Conservatively skip anything with nonzero tops.
|
||||
}
|
||||
|
||||
CharReach &otherReach = g[t].char_reach;
|
||||
const CharReach &otherReach = g[t].char_reach;
|
||||
if (currReach.isSubsetOf(otherReach)) {
|
||||
DEBUG_PRINTF("removing redundant vertex %zu (keeping %zu)\n",
|
||||
g[v].index, g[t].index);
|
||||
@@ -636,12 +636,12 @@ bool reversePathReachSubset(const NFAEdge &e, const NFAVertex &dom,
|
||||
|
||||
NFAVertex start = source(e, g);
|
||||
using RevGraph = boost::reverse_graph<NGHolder, const NGHolder &>;
|
||||
map<RevGraph::vertex_descriptor, boost::default_color_type> vertexColor;
|
||||
|
||||
// Walk the graph backwards from v, examining each node. We fail (return
|
||||
// false) if we encounter a node with reach NOT a subset of domReach, and
|
||||
// we stop searching at dom.
|
||||
try {
|
||||
map<RevGraph::vertex_descriptor, boost::default_color_type> vertexColor;
|
||||
depth_first_visit(RevGraph(g), start,
|
||||
ReachSubsetVisitor(domReach),
|
||||
make_assoc_property_map(vertexColor),
|
||||
@@ -664,12 +664,12 @@ bool forwardPathReachSubset(const NFAEdge &e, const NFAVertex &dom,
|
||||
}
|
||||
|
||||
NFAVertex start = target(e, g);
|
||||
map<NFAVertex, boost::default_color_type> vertexColor;
|
||||
|
||||
// Walk the graph forward from v, examining each node. We fail (return
|
||||
// false) if we encounter a node with reach NOT a subset of domReach, and
|
||||
// we stop searching at dom.
|
||||
try {
|
||||
map<NFAVertex, boost::default_color_type> vertexColor;
|
||||
depth_first_visit(g, start, ReachSubsetVisitor(domReach),
|
||||
make_assoc_property_map(vertexColor),
|
||||
VertexIs<NGHolder, NFAVertex>(dom));
|
||||
@@ -745,7 +745,7 @@ u32 findCyclic(const NGHolder &g, vector<bool> &cyclic) {
|
||||
}
|
||||
|
||||
static
|
||||
void findCyclicDom(NGHolder &g, vector<bool> &cyclic,
|
||||
void findCyclicDom(const NGHolder &g, vector<bool> &cyclic,
|
||||
set<NFAEdge> &dead, som_type som) {
|
||||
auto dominators = findDominators(g);
|
||||
|
||||
@@ -789,7 +789,7 @@ void findCyclicDom(NGHolder &g, vector<bool> &cyclic,
|
||||
}
|
||||
|
||||
static
|
||||
void findCyclicPostDom(NGHolder &g, vector<bool> &cyclic,
|
||||
void findCyclicPostDom(const NGHolder &g, vector<bool> &cyclic,
|
||||
set<NFAEdge> &dead) {
|
||||
auto postdominators = findPostDominators(g);
|
||||
|
||||
|
||||
@@ -1874,7 +1874,7 @@ void buildFeeder(NGHolder &g, const BoundedRepeatData &rd,
|
||||
* offset.
|
||||
*/
|
||||
static
|
||||
bool improveLeadingRepeat(NGHolder &g, BoundedRepeatData &rd,
|
||||
bool improveLeadingRepeat(NGHolder &g, const BoundedRepeatData &rd,
|
||||
unordered_set<NFAVertex> &created,
|
||||
const vector<BoundedRepeatData> &all_repeats) {
|
||||
assert(edge(g.startDs, g.startDs, g).second);
|
||||
@@ -1944,7 +1944,7 @@ bool improveLeadingRepeat(NGHolder &g, BoundedRepeatData &rd,
|
||||
}
|
||||
|
||||
static
|
||||
vector<NFAVertex> makeOwnStraw(NGHolder &g, BoundedRepeatData &rd,
|
||||
vector<NFAVertex> makeOwnStraw(NGHolder &g, const BoundedRepeatData &rd,
|
||||
const vector<NFAVertex> &straw) {
|
||||
// Straw runs from startDs to our pos trigger.
|
||||
assert(!straw.empty());
|
||||
|
||||
@@ -1177,7 +1177,7 @@ void expandGraph(NGHolder &g, unordered_map<NFAVertex, u32> ®ions,
|
||||
}
|
||||
|
||||
static
|
||||
bool doTreePlanningIntl(NGHolder &g,
|
||||
bool doTreePlanningIntl(const NGHolder &g,
|
||||
const unordered_map<NFAVertex, u32> ®ions,
|
||||
const map<u32, region_info> &info,
|
||||
map<u32, region_info>::const_iterator picked, u32 bad_region,
|
||||
@@ -1292,8 +1292,8 @@ bool doTreePlanningIntl(NGHolder &g,
|
||||
DEBUG_PRINTF("add mapped reporters for region %u\n", it->first);
|
||||
addMappedReporterVertices(it->second, g, copy_to_orig,
|
||||
plan.back().reporters);
|
||||
} while (it->second.optional && it != info.rend() &&
|
||||
(++it)->first > furthest->first);
|
||||
} while (it != info.rend() && it->second.optional &&
|
||||
(++it)->first > furthest->first);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1551,7 +1551,7 @@ bool doSomPlanning(NGHolder &g, bool stuck_in,
|
||||
DEBUG_PRINTF("region %u contributes reporters to last plan\n",
|
||||
it->first);
|
||||
addReporterVertices(it->second, g, plan.back().reporters);
|
||||
} while (it->second.optional && it != info.rend() &&
|
||||
} while (it != info.rend() && it->second.optional &&
|
||||
(++it)->first > furthest->first);
|
||||
|
||||
DEBUG_PRINTF("done!\n");
|
||||
@@ -1855,7 +1855,7 @@ bool doSomRevNfa(NG &ng, NGHolder &g, const CompileContext &cc) {
|
||||
}
|
||||
|
||||
static
|
||||
u32 doSomRevNfaPrefix(NG &ng, const ExpressionInfo &expr, NGHolder &g,
|
||||
u32 doSomRevNfaPrefix(NG &ng, const ExpressionInfo &expr, const NGHolder &g,
|
||||
const CompileContext &cc) {
|
||||
depth maxWidth = findMaxWidth(g);
|
||||
|
||||
@@ -2011,7 +2011,7 @@ void setReportOnHaigPrefix(RoseBuild &rose, NGHolder &h) {
|
||||
}
|
||||
|
||||
static
|
||||
bool tryHaig(RoseBuild &rose, NGHolder &g,
|
||||
bool tryHaig(RoseBuild &rose, const NGHolder &g,
|
||||
const unordered_map<NFAVertex, u32> ®ions,
|
||||
som_type som, u32 somPrecision,
|
||||
map<u32, region_info>::const_iterator picked,
|
||||
@@ -2442,7 +2442,7 @@ void makeReportsSomPass(ReportManager &rm, NGHolder &g) {
|
||||
}
|
||||
|
||||
static
|
||||
bool doLitHaigSom(NG &ng, NGHolder &g, som_type som) {
|
||||
bool doLitHaigSom(NG &ng, const NGHolder &g, som_type som) {
|
||||
ue2_literal lit;
|
||||
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
|
||||
if (!rhs) {
|
||||
@@ -2659,7 +2659,7 @@ bool doHaigLitHaigSom(NG &ng, NGHolder &g,
|
||||
}
|
||||
|
||||
static
|
||||
bool doMultiLitHaigSom(NG &ng, NGHolder &g, som_type som) {
|
||||
bool doMultiLitHaigSom(NG &ng, const NGHolder &g, som_type som) {
|
||||
set<ue2_literal> lits;
|
||||
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
|
||||
if (!ng.cc.grey.allowLitHaig) {
|
||||
|
||||
@@ -112,7 +112,7 @@ bool forkVertex(NFAVertex v, NGHolder &g, vector<DepthMinMax> &depths,
|
||||
}
|
||||
*numNewVertices += predGroups.size();
|
||||
|
||||
for (auto &group : predGroups) {
|
||||
for (const auto &group : predGroups) {
|
||||
const depth &predDepth = group.first;
|
||||
const vector<NFAEdge> &gspreds = group.second;
|
||||
|
||||
|
||||
@@ -267,18 +267,6 @@ bool somMayGoBackwards(NFAVertex u, const NGHolder &g,
|
||||
boost::depth_first_search(c_g, visitor(backEdgeVisitor)
|
||||
.root_vertex(c_g.start));
|
||||
|
||||
for (const auto &e : be) {
|
||||
NFAVertex s = source(e, c_g);
|
||||
NFAVertex t = target(e, c_g);
|
||||
DEBUG_PRINTF("back edge %zu %zu\n", c_g[s].index, c_g[t].index);
|
||||
if (s != t) {
|
||||
assert(0);
|
||||
DEBUG_PRINTF("eek big cycle\n");
|
||||
rv = true; /* big cycle -> eek */
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("checking acyclic+selfloop graph\n");
|
||||
|
||||
rv = !firstMatchIsFirst(c_g);
|
||||
|
||||
@@ -589,7 +589,7 @@ void getHighlanderReporters(const NGHolder &g, const NFAVertex accept,
|
||||
|
||||
verts.insert(v);
|
||||
next_vertex:
|
||||
continue;
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -454,8 +454,8 @@ void buildNfaMergeQueue(const vector<NGHolder *> &cluster,
|
||||
}
|
||||
}
|
||||
|
||||
NGHolder &g_i = *(cluster[ci]);
|
||||
NGHolder &g_j = *(cluster[cj]);
|
||||
const NGHolder &g_i = *(cluster[ci]);
|
||||
const NGHolder &g_j = *(cluster[cj]);
|
||||
|
||||
if (!compatibleStarts(g_i, g_j)) {
|
||||
continue;
|
||||
|
||||
@@ -314,7 +314,7 @@ void duplicateReport(NGHolder &g, ReportID r_old, ReportID r_new);
|
||||
|
||||
/** Construct a reversed copy of an arbitrary NGHolder, mapping starts to
|
||||
* accepts. */
|
||||
void reverseHolder(const NGHolder &g, NGHolder &out);
|
||||
void reverseHolder(const NGHolder &g_in, NGHolder &g);
|
||||
|
||||
/** \brief Returns the delay or ~0U if the graph cannot match with
|
||||
* the trailing literal. */
|
||||
|
||||
@@ -348,10 +348,9 @@ void getSimpleRoseLiterals(const NGHolder &g, bool seeking_anchored,
|
||||
|
||||
map<NFAVertex, u64a> scores;
|
||||
map<NFAVertex, unique_ptr<VertLitInfo>> lit_info;
|
||||
set<ue2_literal> s;
|
||||
|
||||
for (auto v : a_dom) {
|
||||
s = getLiteralSet(g, v, true); /* RHS will take responsibility for any
|
||||
set<ue2_literal> s = getLiteralSet(g, v, true); /* RHS will take responsibility for any
|
||||
revisits to the target vertex */
|
||||
|
||||
if (s.empty()) {
|
||||
@@ -688,7 +687,7 @@ unique_ptr<VertLitInfo> findBestSplit(const NGHolder &g,
|
||||
}
|
||||
|
||||
if (seeking_transient) {
|
||||
for (auto &a : lits) {
|
||||
for (const auto &a : lits) {
|
||||
a->creates_transient
|
||||
= createsTransientLHS(g, a->vv, *depths, cc.grey);
|
||||
}
|
||||
@@ -697,7 +696,7 @@ unique_ptr<VertLitInfo> findBestSplit(const NGHolder &g,
|
||||
if (last_chance) {
|
||||
const size_t num_verts = num_vertices(g);
|
||||
auto color_map = make_small_color_map(g);
|
||||
for (auto &a : lits) {
|
||||
for (const auto &a : lits) {
|
||||
size_t num_reachable = count_reachable(g, a->vv, color_map);
|
||||
double ratio = (double)num_reachable / (double)num_verts;
|
||||
a->split_ratio = ratio > 0.5 ? 1 - ratio : ratio;
|
||||
@@ -1172,7 +1171,7 @@ bool splitRoseEdge(const NGHolder &base_graph, RoseInGraph &vg,
|
||||
#define MAX_LEN_2_LITERALS_PER_CUT 3
|
||||
|
||||
static
|
||||
bool checkValidNetflowLits(NGHolder &h, const vector<u64a> &scores,
|
||||
bool checkValidNetflowLits(const NGHolder &h, const vector<u64a> &scores,
|
||||
const map<NFAEdge, set<ue2_literal>> &cut_lits,
|
||||
u32 min_allowed_length) {
|
||||
DEBUG_PRINTF("cut width %zu; min allowed %u\n", cut_lits.size(),
|
||||
@@ -1209,7 +1208,7 @@ bool checkValidNetflowLits(NGHolder &h, const vector<u64a> &scores,
|
||||
}
|
||||
|
||||
static
|
||||
void splitEdgesByCut(NGHolder &h, RoseInGraph &vg,
|
||||
void splitEdgesByCut(const NGHolder &h, RoseInGraph &vg,
|
||||
const vector<RoseInEdge> &to_cut,
|
||||
const vector<NFAEdge> &cut,
|
||||
const map<NFAEdge, set<ue2_literal>> &cut_lits) {
|
||||
@@ -1805,7 +1804,7 @@ void removeRedundantLiterals(RoseInGraph &g, const CompileContext &cc) {
|
||||
}
|
||||
|
||||
static
|
||||
RoseInVertex getStart(RoseInGraph &vg) {
|
||||
RoseInVertex getStart(const RoseInGraph &vg) {
|
||||
for (RoseInVertex v : vertices_range(vg)) {
|
||||
if (vg[v].type == RIV_START || vg[v].type == RIV_ANCHORED_START) {
|
||||
return v;
|
||||
@@ -1870,7 +1869,7 @@ unique_ptr<NGHolder> make_chain(u32 count) {
|
||||
#define SHORT_TRIGGER_LEN 16
|
||||
|
||||
static
|
||||
bool makeTransientFromLongLiteral(NGHolder &h, RoseInGraph &vg,
|
||||
bool makeTransientFromLongLiteral(const NGHolder &h, RoseInGraph &vg,
|
||||
const vector<RoseInEdge> &ee,
|
||||
const CompileContext &cc) {
|
||||
/* check max width and literal lengths to see if possible */
|
||||
@@ -2150,7 +2149,7 @@ void findBetterPrefixes(RoseInGraph &vg, const CompileContext &cc) {
|
||||
#define MAX_EXTRACT_STRONG_LITERAL_GRAPHS 10
|
||||
|
||||
static
|
||||
bool extractStrongLiteral(NGHolder &h, RoseInGraph &vg,
|
||||
bool extractStrongLiteral(const NGHolder &h, RoseInGraph &vg,
|
||||
const vector<RoseInEdge> &ee,
|
||||
const CompileContext &cc) {
|
||||
DEBUG_PRINTF("looking for string literal\n");
|
||||
@@ -2805,7 +2804,7 @@ bool tryForEarlyDfa(const NGHolder &h, const CompileContext &cc) {
|
||||
}
|
||||
|
||||
static
|
||||
vector<vector<CharReach>> getDfaTriggers(RoseInGraph &vg,
|
||||
vector<vector<CharReach>> getDfaTriggers(const RoseInGraph &vg,
|
||||
const vector<RoseInEdge> &edges,
|
||||
bool *single_trigger) {
|
||||
vector<vector<CharReach>> triggers;
|
||||
@@ -2868,7 +2867,6 @@ static
|
||||
bool splitForImplementability(RoseInGraph &vg, NGHolder &h,
|
||||
const vector<RoseInEdge> &edges,
|
||||
const CompileContext &cc) {
|
||||
vector<pair<ue2_literal, u32>> succ_lits;
|
||||
DEBUG_PRINTF("trying to split %s with %zu vertices on %zu edges\n",
|
||||
to_string(h.kind).c_str(), num_vertices(h), edges.size());
|
||||
|
||||
@@ -2877,6 +2875,7 @@ bool splitForImplementability(RoseInGraph &vg, NGHolder &h,
|
||||
}
|
||||
|
||||
if (!generates_callbacks(h)) {
|
||||
vector<pair<ue2_literal, u32>> succ_lits;
|
||||
for (const auto &e : edges) {
|
||||
const auto &lit = vg[target(e, vg)].s;
|
||||
u32 delay = vg[e].graph_lag;
|
||||
@@ -2889,8 +2888,8 @@ bool splitForImplementability(RoseInGraph &vg, NGHolder &h,
|
||||
}
|
||||
|
||||
unique_ptr<VertLitInfo> split;
|
||||
bool last_chance = true;
|
||||
if (h.kind == NFA_PREFIX) {
|
||||
bool last_chance = true;
|
||||
auto depths = calcDepths(h);
|
||||
|
||||
split = findBestPrefixSplit(h, depths, vg, edges, last_chance, cc);
|
||||
@@ -2927,7 +2926,7 @@ bool ensureImplementable(RoseBuild &rose, RoseInGraph &vg, bool allow_changes,
|
||||
vector<RoseInEdge>> edges_by_graph;
|
||||
for (const RoseInEdge &ve : edges_range(vg)) {
|
||||
if (vg[ve].graph && !vg[ve].dfa) {
|
||||
auto &h = vg[ve].graph;
|
||||
const auto &h = vg[ve].graph;
|
||||
edges_by_graph[h].emplace_back(ve);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user