souffle  2.0.2-371-g6315b36
RemoveRedundantSums.h
Go to the documentation of this file.
1 /*
2  * Souffle - A Datalog Compiler
3  * Copyright (c) 2019, 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 RemoveRedundantSums.h
12  *
13  ***********************************************************************/
14 
15 #pragma once
16 
17 #include "ast/TranslationUnit.h"
19 #include <string>
20 
21 namespace souffle::ast::transform {
22 
23 /**
24  * Transformation pass to remove expressions of the form
25  * sum k : { ... } and replace them with
26  * k * count : { ... }
27  * where k is a constant.
28  */
29 class RemoveRedundantSumsTransformer : public Transformer {
30 public:
31  std::string getName() const override {
32  return "RemoveRedundantSumsTransformer";
33  }
34 
35  RemoveRedundantSumsTransformer* clone() const override {
36  return new RemoveRedundantSumsTransformer();
37  }
38 
39 private:
40  bool transform(TranslationUnit& translationUnit) override;
41 };
42 
43 } // namespace souffle::ast::transform
TranslationUnit.h
souffle::ast::transform::RemoveRedundantSumsTransformer::transform
bool transform(TranslationUnit &translationUnit) override
Definition: RemoveRedundantSums.cpp:38
souffle::ast::transform::RemoveRedundantSumsTransformer::getName
std::string getName() const override
Definition: RemoveRedundantSums.h:39
Transformer.h
souffle::ast::transform::RemoveRedundantSumsTransformer
Transformation pass to remove expressions of the form sum k : { ...
Definition: RemoveRedundantSums.h:33
souffle::ast::transform::RemoveRedundantSumsTransformer::clone
RemoveRedundantSumsTransformer * clone() const override
Definition: RemoveRedundantSums.h:43
souffle::ast::TranslationUnit
Translation unit class for the translation pipeline.
Definition: TranslationUnit.h:51
souffle::ast::transform
Definition: Program.h:45