aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/hyperscan/src/nfagraph/ng_dominators.cpp
diff options
context:
space:
mode:
authorIvan Blinkov <ivan@blinkov.ru>2022-02-10 16:47:10 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:10 +0300
commit1aeb9a455974457866f78722ad98114bafc84e8a (patch)
treee4340eaf1668684d83a0a58c36947c5def5350ad /contrib/libs/hyperscan/src/nfagraph/ng_dominators.cpp
parentbd5ef432f5cfb1e18851381329d94665a4c22470 (diff)
downloadydb-1aeb9a455974457866f78722ad98114bafc84e8a.tar.gz
Restoring authorship annotation for Ivan Blinkov <ivan@blinkov.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/hyperscan/src/nfagraph/ng_dominators.cpp')
-rw-r--r--contrib/libs/hyperscan/src/nfagraph/ng_dominators.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/contrib/libs/hyperscan/src/nfagraph/ng_dominators.cpp b/contrib/libs/hyperscan/src/nfagraph/ng_dominators.cpp
index d6a064d12f..157784700e 100644
--- a/contrib/libs/hyperscan/src/nfagraph/ng_dominators.cpp
+++ b/contrib/libs/hyperscan/src/nfagraph/ng_dominators.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2017, 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:
@@ -38,7 +38,7 @@
#include "ng_util.h"
#include <boost-patched/graph/dominator_tree.hpp> // locally patched version
-#include <boost-patched/graph/reverse_graph.hpp>
+#include <boost-patched/graph/reverse_graph.hpp>
using namespace std;
using boost::make_assoc_property_map;
@@ -47,47 +47,47 @@ using boost::make_iterator_property_map;
namespace ue2 {
template <class Graph>
-unordered_map<NFAVertex, NFAVertex> calcDominators(const Graph &g,
- typename Graph::vertex_descriptor source) {
- using Vertex = typename Graph::vertex_descriptor;
+unordered_map<NFAVertex, NFAVertex> calcDominators(const Graph &g,
+ typename Graph::vertex_descriptor source) {
+ using Vertex = typename Graph::vertex_descriptor;
const size_t num_verts = num_vertices(g);
auto index_map = get(&NFAGraphVertexProps::index, g);
vector<size_t> dfnum(num_verts, 0);
- vector<Vertex> parents(num_verts, Graph::null_vertex());
+ vector<Vertex> parents(num_verts, Graph::null_vertex());
auto dfnum_map = make_iterator_property_map(dfnum.begin(), index_map);
auto parent_map = make_iterator_property_map(parents.begin(), index_map);
- vector<Vertex> vertices_by_dfnum(num_verts, Graph::null_vertex());
+ vector<Vertex> vertices_by_dfnum(num_verts, Graph::null_vertex());
// Output map.
- vector<Vertex> doms(num_verts, Graph::null_vertex());
- auto dom_map = make_iterator_property_map(doms.begin(), index_map);
+ vector<Vertex> doms(num_verts, Graph::null_vertex());
+ auto dom_map = make_iterator_property_map(doms.begin(), index_map);
boost_ue2::lengauer_tarjan_dominator_tree(g, source, index_map, dfnum_map,
parent_map, vertices_by_dfnum,
dom_map);
- /* Translate back to an NFAVertex map */
- unordered_map<NFAVertex, NFAVertex> doms2;
- doms2.reserve(num_verts);
- for (auto v : vertices_range(g)) {
- auto dom_of_v = doms[g[v].index];
- if (dom_of_v) {
- doms2.emplace(v, dom_of_v);
- }
- }
- return doms2;
+ /* Translate back to an NFAVertex map */
+ unordered_map<NFAVertex, NFAVertex> doms2;
+ doms2.reserve(num_verts);
+ for (auto v : vertices_range(g)) {
+ auto dom_of_v = doms[g[v].index];
+ if (dom_of_v) {
+ doms2.emplace(v, dom_of_v);
+ }
+ }
+ return doms2;
}
-unordered_map<NFAVertex, NFAVertex> findDominators(const NGHolder &g) {
+unordered_map<NFAVertex, NFAVertex> findDominators(const NGHolder &g) {
assert(hasCorrectlyNumberedVertices(g));
- return calcDominators(g, g.start);
+ return calcDominators(g, g.start);
}
-unordered_map<NFAVertex, NFAVertex> findPostDominators(const NGHolder &g) {
+unordered_map<NFAVertex, NFAVertex> findPostDominators(const NGHolder &g) {
assert(hasCorrectlyNumberedVertices(g));
- return calcDominators(boost::reverse_graph<NGHolder, const NGHolder &>(g),
+ return calcDominators(boost::reverse_graph<NGHolder, const NGHolder &>(g),
g.acceptEod);
}