souffle  2.0.2-371-g6315b36
RedundantRelations.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 RedundantRelations.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 "ast/analysis/Analysis.h"
22 #include <set>
23 #include <string>
24 
25 namespace souffle::ast {
26 class TranslationUnit;
27 class Relation;
28 
29 namespace analysis {
30 class PrecedenceGraphAnalysis;
31 
32 /**
33  * Analysis pass identifying relations which do not contribute to the computation
34  * of the output relations.
35  */
36 class RedundantRelationsAnalysis : public Analysis {
37 public:
38  static constexpr const char* name = "redundant-relations";
39 
41 
42  void run(const TranslationUnit& translationUnit) override;
43 
44  void print(std::ostream& os) const override;
45 
46  const std::set<const Relation*>& getRedundantRelations() const {
47  return redundantRelations;
48  }
49 
50 private:
52 
53  std::set<const Relation*> redundantRelations;
54 };
55 
56 } // namespace analysis
57 } // namespace souffle::ast
souffle::ast::analysis::Analysis::Analysis
Analysis(std::string identifier)
Definition: Analysis.h:40
souffle::ast::analysis::RedundantRelationsAnalysis::precedenceGraph
PrecedenceGraphAnalysis * precedenceGraph
Definition: RedundantRelations.h:59
souffle::ast::analysis::RedundantRelationsAnalysis::run
void run(const TranslationUnit &translationUnit) override
run analysis for a Ast translation unit
Definition: RedundantRelations.cpp:41
souffle::ast::analysis::RedundantRelationsAnalysis::redundantRelations
std::set< const Relation * > redundantRelations
Definition: RedundantRelations.h:61
souffle::ast::analysis::RedundantRelationsAnalysis::name
static constexpr const char * name
Definition: RedundantRelations.h:46
souffle::ast::analysis::RedundantRelationsAnalysis::RedundantRelationsAnalysis
RedundantRelationsAnalysis()
Definition: RedundantRelations.h:48
souffle::ast::analysis::RedundantRelationsAnalysis::getRedundantRelations
const std::set< const Relation * > & getRedundantRelations() const
Definition: RedundantRelations.h:54
souffle::ast::analysis::PrecedenceGraphAnalysis
Analysis pass computing the precedence graph of the relations of the datalog progam.
Definition: PrecedenceGraph.h:43
souffle::ast
Definition: Aggregator.h:35
souffle::ast::analysis::RedundantRelationsAnalysis::print
void print(std::ostream &os) const override
print the analysis result in HTML format
Definition: RedundantRelations.cpp:83
Analysis.h