souffle  2.0.2-371-g6315b36
PrecedenceGraph.h
Go to the documentation of this file.
1 /*
2  * Souffle - A Datalog Compiler
3  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved
4  * Licensed under the Universal Permissive License v 1.0 as shown at:
5  * - https://opensource.org/licenses/UPL
6  * - <souffle root>/licenses/SOUFFLE-UPL.txt
7  */
8 
9 /************************************************************************
10  *
11  * @file PrecedenceGraph.h
12  *
13  * Defines the class to build the precedence graph,
14  * compute strongly connected components of the precedence graph, and
15  * build the strongly connected component graph.
16  *
17  ***********************************************************************/
18 
19 #pragma once
20 
21 #include "GraphUtils.h"
22 #include "ast/Relation.h"
23 #include "ast/analysis/Analysis.h"
24 #include <string>
25 
26 namespace souffle::ast {
27 
28 class TranslationUnit;
29 
30 namespace analysis {
31 
32 /**
33  * Analysis pass computing the precedence graph of the relations of the datalog progam.
34  */
35 class PrecedenceGraphAnalysis : public Analysis {
36 public:
37  static constexpr const char* name = "precedence-graph";
38 
40 
41  void run(const TranslationUnit& translationUnit) override;
42 
43  /** Output precedence graph in graphviz format to a given stream */
44  void print(std::ostream& os) const override;
45 
47  return backingGraph;
48  }
49 
50 private:
51  /** Adjacency list of precedence graph (determined by the dependencies of the relations) */
53 };
54 
55 } // namespace analysis
56 } // namespace souffle::ast
souffle::ast::analysis::Analysis::Analysis
Analysis(std::string identifier)
Definition: Analysis.h:40
souffle::ast::analysis::PrecedenceGraphAnalysis::graph
const Graph< const Relation *, NameComparison > & graph() const
Definition: PrecedenceGraph.h:54
Relation.h
souffle::Graph
A simple graph structure for graph-based operations.
Definition: GraphUtils.h:40
GraphUtils.h
souffle::ast::analysis::PrecedenceGraphAnalysis::name
static constexpr const char * name
Definition: PrecedenceGraph.h:45
souffle::ast::analysis::PrecedenceGraphAnalysis::backingGraph
Graph< const Relation *, NameComparison > backingGraph
Adjacency list of precedence graph (determined by the dependencies of the relations)
Definition: PrecedenceGraph.h:60
souffle::ast::analysis::PrecedenceGraphAnalysis::run
void run(const TranslationUnit &translationUnit) override
run analysis for a Ast translation unit
Definition: PrecedenceGraph.cpp:45
souffle::ast::analysis::PrecedenceGraphAnalysis::PrecedenceGraphAnalysis
PrecedenceGraphAnalysis()
Definition: PrecedenceGraph.h:47
souffle::ast
Definition: Aggregator.h:35
Analysis.h
souffle::ast::analysis::PrecedenceGraphAnalysis::print
void print(std::ostream &os) const override
Output precedence graph in graphviz format to a given stream.
Definition: PrecedenceGraph.cpp:63