souffle  2.0.2-371-g6315b36
PartitionBodyLiterals.h
Go to the documentation of this file.
1 /*
2  * Souffle - A Datalog Compiler
3  * Copyright (c) 2018, The Souffle Developers. 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 PartitionBodyLiterals.h
12  *
13  * Transformation pass to move literals into new clauses
14  * if they are independent of remaining literals.
15  * E.g. a(x) :- b(x), c(y), d(y), e(z). is transformed into:
16  * - a(x) :- b(x), newrel1(), newrel2().
17  * - newrel1() :- c(y), d(y).
18  * - newrel2() :- e(z).
19  *
20  ***********************************************************************/
21 
22 #pragma once
23 
24 #include "ast/TranslationUnit.h"
26 #include <string>
27 
28 namespace souffle::ast::transform {
29 
30 /**
31  * Transformation pass to move literals into new clauses
32  * if they are independent of remaining literals.
33  * E.g. a(x) :- b(x), c(y), d(y), e(z). is transformed into:
34  * - a(x) :- b(x), newrel1(), newrel2().
35  * - newrel1() :- c(y), d(y).
36  * - newrel2() :- e(z).
37  */
38 class PartitionBodyLiteralsTransformer : public Transformer {
39 public:
40  std::string getName() const override {
41  return "PartitionBodyLiteralsTransformer";
42  }
43 
44  PartitionBodyLiteralsTransformer* clone() const override {
45  return new PartitionBodyLiteralsTransformer();
46  }
47 
48 private:
49  bool transform(TranslationUnit& translationUnit) override;
50 };
51 
52 } // namespace souffle::ast::transform
TranslationUnit.h
Transformer.h
souffle::ast::transform::PartitionBodyLiteralsTransformer::transform
bool transform(TranslationUnit &translationUnit) override
Definition: PartitionBodyLiterals.cpp:41
souffle::ast::TranslationUnit
Translation unit class for the translation pipeline.
Definition: TranslationUnit.h:51
souffle::ast::transform
Definition: Program.h:45
souffle::ast::transform::PartitionBodyLiteralsTransformer::clone
PartitionBodyLiteralsTransformer * clone() const override
Definition: PartitionBodyLiterals.h:66
souffle::ast::transform::PartitionBodyLiteralsTransformer::getName
std::string getName() const override
Definition: PartitionBodyLiterals.h:62