souffle
2.0.2-371-g6315b36
|
Analysis pass computing the strongly connected component (SCC) graph for the datalog program. More...
#include <SCCGraph.h>
Public Member Functions | |
std::set< const Relation * > | getExternalNonOutputPredecessorRelations (const size_t scc) const |
Get all external non-output predecessor relations of a given SCC. More... | |
std::set< const Relation * > | getExternalOutputPredecessorRelations (const size_t scc) const |
Get all external output predecessor relations of a given SCC. More... | |
std::set< const Relation * > | getExternalPredecessorRelations (const size_t scc) const |
Get all external predecessor relations of a given SCC. More... | |
std::set< const Relation * > | getInternalInputRelations (const size_t scc) const |
Get all internal input relations of a given SCC. More... | |
std::set< const Relation * > | getInternalNonOutputRelationsWithExternalSuccessors (const size_t scc) const |
Get all internal non-output relations of a given SCC with external successors. More... | |
std::set< const Relation * > | getInternalOutputRelations (const size_t scc) const |
Get all internal output relations of a given SCC. More... | |
const std::set< const Relation * > & | getInternalRelations (const size_t scc) const |
Get all internal relations of a given SCC. More... | |
std::set< const Relation * > | getInternalRelationsWithExternalSuccessors (const size_t scc) const |
Get all internal relations of a given SCC with external successors. More... | |
size_t | getNumberOfSCCs () const |
Get the number of SCCs in the graph. More... | |
std::set< size_t > | getPredecessorSCCs (const Relation *relation) const |
Get all SCCs containing a predecessor of a given relation. More... | |
const std::set< size_t > & | getPredecessorSCCs (const size_t scc) const |
Get all predecessor SCCs of a given SCC. More... | |
size_t | getSCC (const Relation *rel) const |
Get the SCC of the given relation. More... | |
std::set< size_t > | getSuccessorSCCs (const Relation *relation) const |
Get all SCCs containing a successor of a given relation. More... | |
const std::set< size_t > & | getSuccessorSCCs (const size_t scc) const |
Get all successor SCCs of a given SCC. More... | |
bool | isRecursive (const size_t scc) const |
Return if the given SCC is recursive. More... | |
void | print (std::ostream &os) const override |
Print the SCC graph. More... | |
void | run (const TranslationUnit &translationUnit) override |
run analysis for a Ast translation unit More... | |
SCCGraphAnalysis () | |
Public Member Functions inherited from souffle::ast::analysis::Analysis | |
Analysis (std::string identifier) | |
virtual const std::string & | getName () const |
get name of the analysis More... | |
virtual | ~Analysis ()=default |
Static Public Attributes | |
static constexpr const char * | name = "scc-graph" |
Private Member Functions | |
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. More... | |
Private Attributes | |
IOTypeAnalysis * | ioType = nullptr |
PrecedenceGraphAnalysis * | precedenceGraph = nullptr |
std::vector< std::set< size_t > > | predecessors |
Predecessor set for the SCC graph. More... | |
std::map< const Relation *, size_t > | relationToScc |
Map from node number to SCC number. More... | |
std::vector< std::set< const Relation * > > | sccToRelation |
Relations contained in a SCC. More... | |
std::vector< std::set< size_t > > | successors |
Adjacency lists for the SCC graph. More... | |
Additional Inherited Members | |
Protected Attributes inherited from souffle::ast::analysis::Analysis | |
const std::string | identifier |
Analysis pass computing the strongly connected component (SCC) graph for the datalog program.
Definition at line 50 of file SCCGraph.h.
|
inline |
Definition at line 54 of file SCCGraph.h.
References rel(), and relationToScc.
|
inline |
Get all external non-output predecessor relations of a given SCC.
Definition at line 123 of file SCCGraph.h.
|
inline |
Get all external output predecessor relations of a given SCC.
Definition at line 110 of file SCCGraph.h.
|
inline |
Get all external predecessor relations of a given SCC.
Definition at line 136 of file SCCGraph.h.
|
inline |
|
inline |
Get all internal non-output relations of a given SCC with external successors.
Definition at line 174 of file SCCGraph.h.
|
inline |
|
inline |
Get all internal relations of a given SCC.
Definition at line 105 of file SCCGraph.h.
References ioType, souffle::ast::analysis::IOTypeAnalysis::isOutput(), and relationToScc.
|
inline |
Get all internal relations of a given SCC with external successors.
Definition at line 160 of file SCCGraph.h.
|
inline |
Get the number of SCCs in the graph.
Definition at line 59 of file SCCGraph.h.
References successors.
|
inline |
Get all SCCs containing a predecessor of a given relation.
Definition at line 92 of file SCCGraph.h.
|
inline |
Get all predecessor SCCs of a given SCC.
Definition at line 74 of file SCCGraph.h.
References relationToScc.
Referenced by souffle::ast::analysis::TopologicallySortedSCCGraphAnalysis::run(), and souffle::ast::analysis::TopologicallySortedSCCGraphAnalysis::topologicalOrderingCost().
|
inline |
Get the SCC of the given relation.
Definition at line 64 of file SCCGraph.h.
References predecessors.
|
inline |
|
inline |
Get all successor SCCs of a given SCC.
Definition at line 69 of file SCCGraph.h.
References relation, and relationToScc.
Referenced by souffle::ast::analysis::TopologicallySortedSCCGraphAnalysis::run(), and souffle::ast::analysis::TopologicallySortedSCCGraphAnalysis::topologicalOrderingCost().
|
inline |
Return if the given SCC is recursive.
Definition at line 201 of file SCCGraph.h.
Referenced by souffle::ast::analysis::RelationScheduleAnalysis::run().
|
overridevirtual |
Print the SCC graph.
Reimplemented from souffle::ast::analysis::Analysis.
Definition at line 124 of file SCCGraph.cpp.
References rel().
|
overridevirtual |
run analysis for a Ast translation unit
Implements souffle::ast::analysis::Analysis.
Definition at line 44 of file SCCGraph.cpp.
References relation, and relationToScc.
|
private |
|
private |
Definition at line 234 of file SCCGraph.h.
Referenced by getInternalRelations().
|
staticconstexpr |
Definition at line 52 of file SCCGraph.h.
|
private |
Definition at line 216 of file SCCGraph.h.
|
private |
Predecessor set for the SCC graph.
Definition at line 225 of file SCCGraph.h.
Referenced by getSCC().
|
private |
Map from node number to SCC number.
Definition at line 219 of file SCCGraph.h.
Referenced by getInternalRelations(), getPredecessorSCCs(), getSuccessorSCCs(), run(), and SCCGraphAnalysis().
|
private |
Relations contained in a SCC.
Definition at line 228 of file SCCGraph.h.
|
private |
Adjacency lists for the SCC graph.
Definition at line 222 of file SCCGraph.h.
Referenced by getNumberOfSCCs().