souffle
2.0.2-371-g6315b36
|
Convert (Scan/If)/(IndexScan/If) operaitons to (Choice)/(IndexChoice) operations. More...
#include <ChoiceConversion.h>
Public Member Functions | |
bool | convertScans (Program &program) |
Apply choice-conversion to the whole program. More... | |
std::string | getName () const override |
@Brief get name of the transformer More... | |
Own< Operation > | rewriteIndexScan (const IndexScan *indexScan) |
Rewrite IndexScan operations. More... | |
Own< Operation > | rewriteScan (const Scan *scan) |
Rewrite Scan operations. More... | |
Public Member Functions inherited from souffle::ram::transform::Transformer | |
bool | apply (TranslationUnit &translationUnit) |
@Brief apply the transformer to a translation unit @Param translationUnit that will be transformed. More... | |
virtual | ~Transformer ()=default |
Protected Member Functions | |
bool | transform (TranslationUnit &translationUnit) override |
@Brief transform the translation unit / used by apply @Param translationUnit that will be transformed. More... | |
Protected Attributes | |
analysis::LevelAnalysis * | rla {nullptr} |
Convert (Scan/If)/(IndexScan/If) operaitons to (Choice)/(IndexChoice) operations.
If there exists Scan/IndexScan operations in the RAM, and the variables are used in a subsequent Filter operation but no subsequent operation in the tree (up until and including the Project), the operations are rewritten to Choice/IndexChoice operations.
For example,
will be rewritten to
Definition at line 65 of file ChoiceConversion.h.
bool souffle::ram::transform::ChoiceConversionTransformer::convertScans | ( | Program & | program | ) |
Apply choice-conversion to the whole program.
RAM | program |
Search for queries and rewrite their Scan/IndexScan and If operations if possible.
Definition at line 116 of file ChoiceConversion.cpp.
References rewriteScan().
|
inlineoverridevirtual |
@Brief get name of the transformer
Implements souffle::ram::transform::Transformer.
Definition at line 67 of file ChoiceConversion.h.
Own< Operation > souffle::ram::transform::ChoiceConversionTransformer::rewriteIndexScan | ( | const IndexScan * | indexScan | ) |
Rewrite IndexScan operations.
An | index operation |
Rewrites IndexScan/If pair to an IndexChoice operation if value is not used in a consecutive RAM operation
Definition at line 68 of file ChoiceConversion.cpp.
References souffle::filter(), souffle::ram::analysis::LevelAnalysis::getLevel(), souffle::ram::TupleElement::getTupleId(), rla, and souffle::ram::visitDepthFirst().
Own< Operation > souffle::ram::transform::ChoiceConversionTransformer::rewriteScan | ( | const Scan * | scan | ) |
Rewrite Scan operations.
A | scan operation |
Rewrites Scan/If pair to a Choice operation if value is not used in a consecutive RAM operation
Definition at line 36 of file ChoiceConversion.cpp.
References souffle::filter(), souffle::ram::analysis::LevelAnalysis::getLevel(), souffle::ram::TupleOperation::getTupleId(), souffle::ram::TupleElement::getTupleId(), rla, and souffle::ram::visitDepthFirst().
Referenced by convertScans().
|
inlineoverrideprotectedvirtual |
@Brief transform the translation unit / used by apply @Param translationUnit that will be transformed.
@Return flag reporting whether the RAM program has changed
Implements souffle::ram::transform::Transformer.
Definition at line 102 of file ChoiceConversion.h.
|
protected |
Definition at line 101 of file ChoiceConversion.h.
Referenced by rewriteIndexScan(), and rewriteScan().