souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
37 precedenceGraph = translationUnit.getAnalysis<PrecedenceGraphAnalysis>();
38 ioType = translationUnit.getAnalysis<IOTypeAnalysis>();
45 Program& program = translationUnit.getProgram();
49 std::stack<const Relation*>
S;
50 std::stack<const Relation*> P;
51 std::map<const Relation*, size_t> preOrder;
56 if (preOrder[
relation] == (
size_t)-1) {
68 assert(scc_u < numSCCs &&
"Wrong range");
69 assert(scc_v < numSCCs &&
"Wrong range");
87 void SCCGraphAnalysis::scR(
const Relation* w, std::map<const Relation*, size_t>& preOrder,
size_t& counter,
88 std::stack<const Relation*>&
S, std::stack<const Relation*>& P,
size_t& numSCCs) {
89 preOrder[w] = counter++;
93 if (preOrder[t] == (
size_t)-1) {
94 scR(t, preOrder, counter,
S, P, numSCCs);
96 while (preOrder[P.top()] > preOrder[t]) {
118 std::stringstream
ss;
120 ss <<
"digraph {" << std::endl;
123 ss <<
"\t" <<
name <<
"_" << scc <<
"[label = \"";
125 [](std::ostream& out,
const Relation*
rel) { out <<
rel->getQualifiedName(); });
126 ss <<
"\" ];" << std::endl;
130 ss <<
"\t" <<
name <<
"_" << scc <<
" -> " <<
name <<
"_" << succ <<
";" << std::endl;
void run(const TranslationUnit &translationUnit) override
run analysis for a Ast translation unit
void print(std::ostream &os) const override
Print the SCC graph.
Defines a relation with a name, attributes, qualifiers, and internal representation.
const Graph< const Relation *, NameComparison > & graph() const
void scR(const Relation *relation, std::map< const Relation *, size_t > &preOrder, size_t &counter, std::stack< const Relation * > &S, std::stack< const Relation * > &P, size_t &numSCCs)
Recursive scR method for computing SCC.
std::vector< Own< Relation > > relations
std::vector< std::set< size_t > > predecessors
Predecessor set for the SCC graph.
PrecedenceGraphAnalysis * precedenceGraph
void printHTMLGraph(std::ostream &out, const std::string &dotSpec, const std::string &id)
virtual const std::string & getName() const
get name of the analysis
std::vector< std::set< size_t > > successors
Adjacency lists for the SCC graph.
The program class consists of relations, clauses and types.
Object-oriented wrapper class for Souffle's templatized relations.
detail::joined_sequence< Iter, Printer > join(const Iter &a, const Iter &b, const std::string &sep, const Printer &p)
Creates an object to be forwarded to some output stream for printing sequences of elements interspers...
static constexpr const char * name
std::vector< std::set< const Relation * > > sccToRelation
Relations contained in a SCC.
size_t getNumberOfSCCs() const
Get the number of SCCs in the graph.
std::vector< Relation * > getRelations() const
Return relations.
static MainConfig & config()
std::map< const Relation *, size_t > relationToScc
Map from node number to SCC number.
const std::set< size_t > & getSuccessorSCCs(const size_t scc) const
Get all successor SCCs of a given SCC.
void rel(size_t limit, bool showLimit=true)
const std::set< const Relation * > & getInternalRelations(const size_t scc) const
Get all internal relations of a given SCC.
class souffle::profile::Tui ss