souffle
2.0.2-371-g6315b36
ast
transform
RemoveRelationCopies.h
Go to the documentation of this file.
1
/*
2
* Souffle - A Datalog Compiler
3
* Copyright (c) 2015, 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 RemoveRelationCopies.h
12
*
13
***********************************************************************/
14
15
#pragma once
16
17
#include "
ast/TranslationUnit.h
"
18
#include "
ast/transform/Transformer.h
"
19
#include <string>
20
21
namespace
souffle::ast::transform
{
22
23
/**
24
* Transformation pass to replaces copy of relations by their origin.
25
* For instance, if a relation r is defined by
26
*
27
* r(X,Y) :- s(X,Y)
28
*
29
* and no other clause, all occurrences of r will be replaced by s.
30
*/
31
class
RemoveRelationCopiesTransformer :
public
Transformer {
32
public
:
33
std::string
getName
()
const override
{
34
return
"RemoveRelationCopiesTransformer"
;
35
}
36
37
/**
38
* Replaces copies of relations by their origin in the given program.
39
*
40
* @param program the program to be processed
41
* @return whether the program was modified
42
*/
43
static
bool
removeRelationCopies
(
TranslationUnit
& translationUnit);
44
45
RemoveRelationCopiesTransformer
*
clone
()
const override
{
46
return
new
RemoveRelationCopiesTransformer
();
47
}
48
49
private
:
50
bool
transform
(
TranslationUnit
& translationUnit)
override
{
51
return
removeRelationCopies
(translationUnit);
52
}
53
};
54
55
}
// namespace souffle::ast::transform
TranslationUnit.h
souffle::ast::transform::RemoveRelationCopiesTransformer
Transformation pass to replaces copy of relations by their origin.
Definition:
RemoveRelationCopies.h:35
souffle::ast::transform::RemoveRelationCopiesTransformer::clone
RemoveRelationCopiesTransformer * clone() const override
Definition:
RemoveRelationCopies.h:53
Transformer.h
souffle::ast::TranslationUnit
Translation unit class for the translation pipeline.
Definition:
TranslationUnit.h:51
souffle::ast::transform
Definition:
Program.h:45
souffle::ast::transform::RemoveRelationCopiesTransformer::transform
bool transform(TranslationUnit &translationUnit) override
Definition:
RemoveRelationCopies.h:58
souffle::ast::transform::RemoveRelationCopiesTransformer::getName
std::string getName() const override
Definition:
RemoveRelationCopies.h:41
souffle::ast::transform::RemoveRelationCopiesTransformer::removeRelationCopies
static bool removeRelationCopies(TranslationUnit &translationUnit)
Replaces copies of relations by their origin in the given program.
Definition:
RemoveRelationCopies.cpp:42
Generated by
1.8.17