}
bool requiresDedupe(const CastleProto &proto,
- const ue2::flat_set<ReportID> &reports) {
+ const flat_set<ReportID> &reports) {
for (const auto &report : reports) {
auto it = proto.report_map.find(report);
if (it == end(proto.report_map)) {
struct GoughSSAVar : noncopyable {
GoughSSAVar(void) : seen(false), slot(INVALID_SLOT) {}
virtual ~GoughSSAVar();
- const ue2::flat_set<GoughSSAVar *> &get_inputs() const {
+ const flat_set<GoughSSAVar *> &get_inputs() const {
return inputs;
}
- const ue2::flat_set<GoughSSAVarWithInputs *> &get_outputs() const {
+ const flat_set<GoughSSAVarWithInputs *> &get_outputs() const {
return outputs;
}
virtual void replace_input(GoughSSAVar *old_v, GoughSSAVar *new_v) = 0;
clear_outputs();
}
protected:
- ue2::flat_set<GoughSSAVar *> inputs;
- ue2::flat_set<GoughSSAVarWithInputs *> outputs;
+ flat_set<GoughSSAVar *> inputs;
+ flat_set<GoughSSAVarWithInputs *> outputs;
friend struct GoughSSAVarWithInputs;
friend struct GoughSSAVarMin;
friend struct GoughSSAVarJoin;
void add_input(GoughSSAVar *v, GoughEdge prev);
- const ue2::flat_set<GoughEdge> &get_edges_for_input(GoughSSAVar *input)
- const;
- const std::map<GoughSSAVar *, ue2::flat_set<GoughEdge> > &get_input_map()
- const;
+ const flat_set<GoughEdge> &get_edges_for_input(GoughSSAVar *input) const;
+ const std::map<GoughSSAVar *, flat_set<GoughEdge>> &get_input_map() const;
protected:
void remove_input_raw(GoughSSAVar *v) override;
private:
- std::map<GoughSSAVar *, ue2::flat_set<GoughEdge>> input_map;
+ std::map<GoughSSAVar *, flat_set<GoughEdge>> input_map;
};
struct gough_accel_state_info {
/*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
static
bool findMask(const NGHolder &g, vector<CharReach> *mask, bool *anchored,
- ue2::flat_set<ReportID> *reports) {
+ flat_set<ReportID> *reports) {
DEBUG_PRINTF("looking for a mask pattern\n");
set<NFAVertex> s_succ;
insert(&s_succ, adjacent_vertices(g.start, g));
return false;
}
- ue2::flat_set<ReportID> reports;
+ flat_set<ReportID> reports;
bool anchored = false;
vector<CharReach> mask;
/** \brief For graphs that will be implemented as multi-top engines, this
* specifies the top events. Only used on edges from the start vertex. */
- ue2::flat_set<u32> tops;
+ flat_set<u32> tops;
/** \brief Flags associated with assertions. */
u32 assert_flags = 0;
return false;
}
- ue2::flat_set<std::pair<u8, u8> > double_byte;
+ flat_set<pair<u8, u8>> double_byte;
CharReach double_cr;
u32 double_offset = 0;
};
void findAccelFriends(const NGHolder &g, NFAVertex v,
const std::map<NFAVertex, BoundedRepeatSummary> &br_cyclic,
- u32 offset,
- ue2::flat_set<NFAVertex> *friends);
+ u32 offset, flat_set<NFAVertex> *friends);
#define DOUBLE_SHUFTI_LIMIT 20
/*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
}
vector<CharReach> mask;
- ue2::flat_set<ReportID> reports;
+ flat_set<ReportID> reports;
bool is_anchored;
bool is_eod;
};
vector<CharReach> trigger;
- ue2::flat_set<NFAVertex> curr, next;
+ flat_set<NFAVertex> curr, next;
insert(&curr, inv_adjacent_vertices(v, g));
if (contains(curr, g.start)) {
#ifndef NDEBUG
// So we can assert that the number of tops hasn't changed at the end of
// this analysis.
- const ue2::flat_set<u32> allTops = getTops(g);
+ const flat_set<u32> allTops = getTops(g);
#endif
// Later on, we're (a little bit) dependent on depth information for
static
bool checkLongMixedSensitivityLiterals(
- const map<sls_literal, ue2::flat_set<ReportID>> &literals) {
+ const map<sls_literal, flat_set<ReportID>> &literals) {
const size_t len = MAX_MASK2_WIDTH;
for (const sls_literal &lit : literals | map_keys) {
static
bool findLiterals(const NGHolder &g,
- map<sls_literal, ue2::flat_set<ReportID>> *literals) {
+ map<sls_literal, flat_set<ReportID>> *literals) {
vector<NFAVertex> order = getTopoOrdering(g);
vector<set<sls_literal>> built(num_vertices(g));
}
static
-size_t min_period(const map<sls_literal, ue2::flat_set<ReportID>> &literals) {
+size_t min_period(const map<sls_literal, flat_set<ReportID>> &literals) {
size_t rv = SIZE_MAX;
for (const sls_literal &lit : literals | map_keys) {
DEBUG_PRINTF("looking for literals\n");
- map<sls_literal, ue2::flat_set<ReportID>> literals;
+ map<sls_literal, flat_set<ReportID>> literals;
if (!findLiterals(g, &literals)) {
DEBUG_PRINTF(":(\n");
return false;
const vector<CharReach> escapes_vec(1, escapes);
const vector<CharReach> notescapes_vec(1, ~escapes);
- ue2::flat_set<NFAVertex> states;
+ flat_set<NFAVertex> states;
/* turn on all states past the prefix */
DEBUG_PRINTF("region %u is cutover\n", region);
for (auto v : vertices_range(g)) {
states = execute_graph(g, escapes_vec, states);
/* flood with any number of not escapes */
- ue2::flat_set<NFAVertex> prev_states;
+ flat_set<NFAVertex> prev_states;
while (prev_states != states) {
prev_states = states;
states = execute_graph(g, notescapes_vec, states);
/* find input starts to use for when we are running the prefix through as
* when the escape character arrives we may be in matching the prefix
* already */
- ue2::flat_set<NFAVertex> prefix_start_states;
+ flat_set<NFAVertex> prefix_start_states;
for (auto v : vertices_range(prefix)) {
if (v != prefix.accept && v != prefix.acceptEod
/* and as we have already made it past the prefix once */
}
}
-ue2::flat_set<u32> getTops(const NGHolder &h) {
- ue2::flat_set<u32> tops;
+flat_set<u32> getTops(const NGHolder &h) {
+ flat_set<u32> tops;
for (const auto &e : out_edges_range(h.start, h)) {
insert(&tops, h[e].tops);
}
unsigned groupIndex = 1;
// Set storing group names that are currently in use.
- ue2::flat_set<string> groupNames;
+ flat_set<string> groupNames;
// Root sequence.
unique_ptr<ComponentSequence> rootSeq = ue2::make_unique<ComponentSequence>();
ReferenceVisitor::~ReferenceVisitor() {}
void checkReferences(const Component &root, unsigned int groupIndices,
- const ue2::flat_set<std::string> &groupNames) {
+ const flat_set<std::string> &groupNames) {
ReferenceVisitor vis(groupIndices, groupNames);
root.accept(vis);
}
RoseVertex createVertex(RoseBuildImpl *build, const RoseVertex parent,
u32 minBound, u32 maxBound, u32 literalId,
size_t literalLength,
- const ue2::flat_set<ReportID> &reports) {
+ const flat_set<ReportID> &reports) {
assert(parent != RoseGraph::null_vertex());
RoseGraph &g = build->g;
}
void RoseBuildImpl::add(bool anchored, bool eod, const ue2_literal &lit,
- const ue2::flat_set<ReportID> &reports) {
+ const flat_set<ReportID> &reports) {
assert(!reports.empty());
if (cc.grey.floodAsPuffette && !anchored && !eod && is_flood(lit) &&
/*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
#include "rose_graph.h"
#include "ue2common.h"
-
-#include <set>
+#include "util/flat_containers.h"
namespace ue2 {
RoseVertex createVertex(RoseBuildImpl *build, const RoseVertex parent,
u32 minBound, u32 maxBound, u32 literalId,
size_t literalLength,
- const ue2::flat_set<ReportID> &reports);
+ const flat_set<ReportID> &reports);
} // namespace ue2
-#endif
+#endif // ROSE_BUILD_ADD_INTERNAL_H
static
bool maskIsNeeded(const ue2_literal &lit, const NGHolder &g) {
- ue2::flat_set<NFAVertex> curr = {g.accept};
- ue2::flat_set<NFAVertex> next;
+ flat_set<NFAVertex> curr = {g.accept};
+ flat_set<NFAVertex> next;
for (auto it = lit.rbegin(), ite = lit.rend(); it != ite; ++it) {
const CharReach &cr = *it;
static
void addTransientMask(RoseBuildImpl &build, const vector<CharReach> &mask,
- const ue2::flat_set<ReportID> &reports, bool anchored,
+ const flat_set<ReportID> &reports, bool anchored,
bool eod) {
vector<ue2_literal> lits;
u32 lit_minBound; /* minBound of each literal in lit */
ENSURE_AT_LEAST(&build.ematcher_region_size, mask.size());
}
- const ue2::flat_set<ReportID> no_reports;
+ const flat_set<ReportID> no_reports;
for (const auto &lit : lits) {
u32 lit_id = build.getLiteralId(lit, msk, cmp, delay, table);
}
static
-unique_ptr<NGHolder> buildMaskRhs(const ue2::flat_set<ReportID> &reports,
+unique_ptr<NGHolder> buildMaskRhs(const flat_set<ReportID> &reports,
const vector<CharReach> &mask,
u32 suffix_len) {
assert(suffix_len);
}
static
-void doAddMask(RoseBuildImpl &tbi, bool anchored,
- const vector<CharReach> &mask, const ue2_literal &lit,
- u32 prefix_len, u32 suffix_len,
- const ue2::flat_set<ReportID> &reports) {
+void doAddMask(RoseBuildImpl &tbi, bool anchored, const vector<CharReach> &mask,
+ const ue2_literal &lit, u32 prefix_len, u32 suffix_len,
+ const flat_set<ReportID> &reports) {
/* Note: bounds are relative to literal start */
RoseInGraph ig;
RoseInVertex s = add_vertex(RoseInVertexProps::makeStart(anchored), ig);
}
bool RoseBuildImpl::add(bool anchored, const vector<CharReach> &mask,
- const ue2::flat_set<ReportID> &reports) {
+ const flat_set<ReportID> &reports) {
if (validateTransientMask(mask, anchored, false, cc.grey)) {
bool eod = false;
addTransientMask(*this, mask, reports, anchored, eod);
}
bool RoseBuildImpl::validateMask(const vector<CharReach> &mask,
- UNUSED const ue2::flat_set<ReportID> &reports,
+ UNUSED const flat_set<ReportID> &reports,
bool anchored, bool eod) const {
return validateTransientMask(mask, anchored, eod, cc.grey);
}
static
unique_ptr<NGHolder> makeAnchoredGraph(const vector<CharReach> &mask,
- const ue2::flat_set<ReportID> &reports,
+ const flat_set<ReportID> &reports,
bool eod) {
auto gp = ue2::make_unique<NGHolder>();
NGHolder &g = *gp;
static
bool addAnchoredMask(RoseBuildImpl &build, const vector<CharReach> &mask,
- const ue2::flat_set<ReportID> &reports, bool eod) {
+ const flat_set<ReportID> &reports, bool eod) {
if (!build.cc.grey.allowAnchoredAcyclic) {
return false;
}
}
void RoseBuildImpl::addMask(const vector<CharReach> &mask,
- const ue2::flat_set<ReportID> &reports,
- bool anchored, bool eod) {
+ const flat_set<ReportID> &reports, bool anchored,
+ bool eod) {
if (anchored && addAnchoredMask(*this, mask, reports, eod)) {
DEBUG_PRINTF("added mask as anchored acyclic graph\n");
return;
assert(left.graph());
const NGHolder &h = *left.graph();
- ue2::flat_set<NFAVertex> all_states;
+ flat_set<NFAVertex> all_states;
insert(&all_states, vertices(h));
assert(out_degree(h.startDs, h) == 1); /* triggered don't use sds */
DEBUG_PRINTF("removing sds\n");
all_states.erase(h.startDs);
- ue2::flat_set<NFAVertex> states;
+ flat_set<NFAVertex> states;
/* check each pred literal to see if they all kill previous graph
* state */
namespace ue2 {
static
-bool requiresDedupe(const NGHolder &h, const ue2::flat_set<ReportID> &reports,
+bool requiresDedupe(const NGHolder &h, const flat_set<ReportID> &reports,
const Grey &grey) {
/* TODO: tighten */
NFAVertex seen_vert = NGHolder::null_vertex();
public:
explicit RoseDedupeAuxImpl(const RoseBuildImpl &build_in);
bool requiresDedupeSupport(
- const ue2::flat_set<ReportID> &reports) const override;
+ const flat_set<ReportID> &reports) const override;
private:
- bool hasSafeMultiReports(const ue2::flat_set<ReportID> &reports) const;
+ bool hasSafeMultiReports(const flat_set<ReportID> &reports) const;
const RoseBuildImpl &build;
map<ReportID, set<RoseVertex>> vert_map; //!< ordinary literals
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ue2common.h"
-
#include "rose_build_exclusive.h"
+
+#include "ue2common.h"
#include "rose_build_merge.h"
#include "nfa/castlecompile.h"
#include "nfagraph/ng_execute.h"
#include "util/clique.h"
#include "util/compile_context.h"
#include "util/container.h"
+#include "util/flat_containers.h"
#include "util/graph.h"
#include "util/make_unique.h"
lower_bound = ~0U;
}
- ue2::flat_set<NFAVertex> states;
+ flat_set<NFAVertex> states;
for (const auto &v : vertices_range(h)) {
if (h[v].index >= lower_bound || h[v].index < 2) {
states.insert(v);
}
static
-u32 findUnusedTop(const ue2::flat_set<u32> &tops) {
+u32 findUnusedTop(const flat_set<u32> &tops) {
u32 i = 0;
while (contains(tops, i)) {
i++;
static
bool setDistinctTops(NGHolder &h1, const NGHolder &h2,
map<u32, u32> &top_mapping) {
- ue2::flat_set<u32> tops1 = getTops(h1), tops2 = getTops(h2);
+ flat_set<u32> tops1 = getTops(h1), tops2 = getTops(h2);
DEBUG_PRINTF("before: h1 has %zu tops, h2 has %zu tops\n", tops1.size(),
tops2.size());
}
template <class Graph>
-ue2::flat_set<typename Graph::vertex_descriptor>
+flat_set<typename Graph::vertex_descriptor>
find_vertices_in_cycles(const Graph &g) {
using vertex_descriptor = typename Graph::vertex_descriptor;
comps[e.second].push_back(e.first);
}
- ue2::flat_set<vertex_descriptor> rv;
+ flat_set<vertex_descriptor> rv;
for (const auto &comp : comps | boost::adaptors::map_values) {
/* every vertex in a strongly connected component is reachable from
* If the set was not split (due to there being no overlap with splitter or
* being a complete subset), INVALID_SUBSET is returned.
*/
- size_t split(size_t subset_index,
- const typename ue2::flat_set<T> &splitter) {
+ size_t split(size_t subset_index, const flat_set<T> &splitter) {
assert(!splitter.empty());
if (splitter.empty()) {
return INVALID_SUBSET;
/**
* Returns all subsets which have a member in keys.
*/
- void find_overlapping(const typename ue2::flat_set<T> &keys,
+ void find_overlapping(const flat_set<T> &keys,
std::vector<size_t> *containing) const {
boost::dynamic_bitset<> seen(subsets.size()); // all zero by default.
void ReportManager::assignDkeys(const RoseBuild *rose) {
DEBUG_PRINTF("assigning...\n");
- map<u32, ue2::flat_set<ReportID>> ext_to_int;
+ map<u32, flat_set<ReportID>> ext_to_int;
for (u32 i = 0; i < reportIds.size(); i++) {
const Report &ir = reportIds[i];