| souffle
    2.0.2-371-g6315b36
    | 
 
 
 
Go to the documentation of this file.
   35 class TranslationUnit;
 
   42 class SCCGraphAnalysis : 
public Analysis {
 
   44     static constexpr 
const char* 
name = 
"scc-graph";
 
   48     void run(
const TranslationUnit& translationUnit) 
override;
 
   72         std::set<size_t> successorSccs;
 
   76             if (successorScc != scc) {
 
   77                 successorSccs.insert(successorScc);
 
   85         std::set<size_t> predecessorSccs;
 
   89             if (predecessorScc != scc) {
 
   90                 predecessorSccs.insert(predecessorScc);
 
   93         return predecessorSccs;
 
  103         std::set<const Relation*> externOutPreds;
 
  107                     externOutPreds.insert(predecessor);
 
  111         return externOutPreds;
 
  116         std::set<const Relation*> externNonOutPreds;
 
  120                     externNonOutPreds.insert(predecessor);
 
  124         return externNonOutPreds;
 
  129         std::set<const Relation*> externPreds;
 
  133                     externPreds.insert(predecessor);
 
  142         std::set<const Relation*> internOuts;
 
  153         std::set<const Relation*> internsWithExternSuccs;
 
  157                     internsWithExternSuccs.insert(
relation);
 
  162         return internsWithExternSuccs;
 
  167         std::set<const Relation*> internNonOutsWithExternSuccs;
 
  172                         internNonOutsWithExternSuccs.insert(
relation);
 
  178         return internNonOutsWithExternSuccs;
 
  183         std::set<const Relation*> internIns;
 
  194         const std::set<const Relation*>& sccRelations = 
sccToRelation.at(scc);
 
  195         if (sccRelations.size() == 1) {
 
  196             const Relation* singleRelation = *sccRelations.begin();
 
  205     void print(std::ostream& os) 
const override;
 
  223     void scR(
const Relation* 
relation, std::map<const Relation*, size_t>& preOrder, 
size_t& counter,
 
  224             std::stack<const Relation*>& 
S, std::stack<const Relation*>& P, 
size_t& numSCCs);
 
  
std::set< const Relation * > getExternalOutputPredecessorRelations(const size_t scc) const
Get all external output predecessor relations of a given SCC.
Analysis(std::string identifier)
std::set< const Relation * > getInternalNonOutputRelationsWithExternalSuccessors(const size_t scc) const
Get all internal non-output relations of a given SCC with external successors.
bool isOutput(const Relation *relation) const
void run(const TranslationUnit &translationUnit) override
run analysis for a Ast translation unit
size_t getSCC(const Relation *rel) const
Get the SCC of the given relation.
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< std::set< size_t > > predecessors
Predecessor set for the SCC graph.
PrecedenceGraphAnalysis * precedenceGraph
std::vector< std::set< size_t > > successors
Adjacency lists for the SCC graph.
std::set< const Relation * > getExternalNonOutputPredecessorRelations(const size_t scc) const
Get all external non-output predecessor relations of a given SCC.
std::set< const Relation * > getInternalInputRelations(const size_t scc) const
Get all internal input relations of a given SCC.
bool isRecursive(const size_t scc) const
Return if the given SCC is recursive.
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.
bool isInput(const Relation *relation) const
std::set< const Relation * > getInternalOutputRelations(const size_t scc) const
Get all internal output relations of a given SCC.
Analysis pass computing the precedence graph of the relations of the datalog progam.
std::map< const Relation *, size_t > relationToScc
Map from node number to SCC number.
std::set< const Relation * > getInternalRelationsWithExternalSuccessors(const size_t scc) const
Get all internal relations of a given SCC with external successors.
const std::set< size_t > & getSuccessorSCCs(const size_t scc) const
Get all successor SCCs of a given SCC.
const std::set< size_t > & getPredecessorSCCs(const size_t scc) const
Get all predecessor SCCs of a given SCC.
std::set< const Relation * > getExternalPredecessorRelations(const size_t scc) const
Get all external predecessor relations 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.