souffle
2.0.2-371-g6315b36
ram
transform
Transformer.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 Transformer.h
12
*
13
* Defines the interface for RAM transformation passes.
14
*
15
***********************************************************************/
16
17
#pragma once
18
19
#include "
ram/TranslationUnit.h
"
20
#include <string>
21
22
namespace
souffle::ram::transform
{
23
24
/**
25
* @Class Transformer
26
* @Brief abstract transformer class for a translation unit
27
*
28
* This is an abstract class to implement transformers. A
29
* transformer takes a translation unit and changes its
30
* state.
31
*
32
* Transformers can be composed using other transformers.
33
*
34
* For debugging purposes, a transformer has a name
35
* (this will show up in the debug report) and a
36
* protected method transform(), that performs the
37
* actual transformation.
38
*
39
* The method apply is used to call transform() and
40
* does the reporting of the debug information.
41
*
42
*/
43
44
class
Transformer {
45
public
:
46
virtual
~Transformer
() =
default
;
47
48
/**
49
* @Brief apply the transformer to a translation unit
50
* @Param translationUnit that will be transformed.
51
* @Return flag reporting whether the RAM program has changed
52
*/
53
bool
apply
(
TranslationUnit
& translationUnit);
54
55
/**
56
* @Brief get name of the transformer
57
*/
58
virtual
std::string
getName
()
const
= 0;
59
60
protected
:
61
/**
62
* @Brief transform the translation unit / used by apply
63
* @Param translationUnit that will be transformed.
64
* @Return flag reporting whether the RAM program has changed
65
*/
66
virtual
bool
transform
(
TranslationUnit
& translationUnit) = 0;
67
};
68
69
}
// namespace souffle::ram::transform
souffle::ram::transform
Definition:
ChoiceConversion.cpp:30
souffle::ram::transform::Transformer::transform
virtual bool transform(TranslationUnit &translationUnit)=0
@Brief transform the translation unit / used by apply @Param translationUnit that will be transformed...
souffle::ram::transform::Transformer::apply
bool apply(TranslationUnit &translationUnit)
@Brief apply the transformer to a translation unit @Param translationUnit that will be transformed.
Definition:
Transformer.cpp:39
souffle::ram::transform::Transformer::getName
virtual std::string getName() const =0
@Brief get name of the transformer
souffle::ram::TranslationUnit
Translating a RAM program.
Definition:
TranslationUnit.h:55
TranslationUnit.h
souffle::ram::transform::Transformer::~Transformer
virtual ~Transformer()=default
Generated by
1.8.17