souffle
2.0.2-371-g6315b36
|
Make indexable operations to indexed operations. More...
#include <MakeIndex.h>
Public Types | |
using | ExpressionPair = std::pair< Own< Expression >, Own< Expression > > |
Get expression of RAM element access. More... | |
Public Member Functions | |
Own< Condition > | constructPattern (const std::vector< std::string > &attributeTypes, RamPattern &queryPattern, bool &indexable, VecOwn< Condition > conditionList, int identifier) |
ExpressionPair | getExpressionPair (const Constraint *binRelOp, size_t &element, int identifier) |
ExpressionPair | getLowerUpperExpression (Condition *c, size_t &element, int level) |
std::string | getName () const override |
@Brief get name of the transformer More... | |
bool | makeIndex (Program &program) |
Make indexable RAM operation indexed. More... | |
Own< Operation > | rewriteAggregate (const Aggregate *agg) |
Rewrite an aggregate operation to an indexed aggregate operation. More... | |
Own< Operation > | rewriteIndexScan (const IndexScan *iscan) |
Rewrite an index scan operation to an amended index scan operation. More... | |
Own< Operation > | rewriteScan (const Scan *scan) |
Rewrite a scan operation to an indexed scan operation. 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::RelationAnalysis * | relAnalysis {nullptr} |
analysis::LevelAnalysis * | rla {nullptr} |
Make indexable operations to indexed operations.
The transformer assumes that the RAM has been levelled before. The conditions that could be used for an index must be located immediately after the scan or aggregate operation.
will be rewritten to
Definition at line 68 of file MakeIndex.h.
using souffle::ram::transform::MakeIndexTransformer::ExpressionPair = std::pair<Own<Expression>, Own<Expression> > |
Get expression of RAM element access.
Equivalence | constraints of the format t1.x = <expression> or <expression> = t1.x |
Element | that was accessed, e.g., for t1.x this would be the index of attribute x. |
Tuple | identifier |
The method retrieves expression the expression of an equivalence constraint of the format t1.x = <expr> or <expr> = t1.x
Definition at line 84 of file MakeIndex.h.
Own< Condition > souffle::ram::transform::MakeIndexTransformer::constructPattern | ( | const std::vector< std::string > & | attributeTypes, |
RamPattern & | queryPattern, | ||
bool & | indexable, | ||
VecOwn< Condition > | conditionList, | ||
int | identifier | ||
) |
AttributeTypes | to indicate type of each attribute in the relation |
Query | pattern that is to be constructed |
Flag | to indicate whether operation is indexable |
A | list of conditions that will be transformed to query patterns |
Tuple | identifier of the indexable operation |
Definition at line 121 of file MakeIndex.cpp.
ExpressionPair souffle::ram::transform::MakeIndexTransformer::getExpressionPair | ( | const Constraint * | binRelOp, |
size_t & | element, | ||
int | identifier | ||
) |
Definition at line 48 of file MakeIndex.cpp.
References souffle::clone(), souffle::ram::analysis::LevelAnalysis::getLevel(), souffle::identifier(), lhs, rhs, and rla.
ExpressionPair souffle::ram::transform::MakeIndexTransformer::getLowerUpperExpression | ( | Condition * | c, |
size_t & | element, | ||
int | level | ||
) |
Definition at line 92 of file MakeIndex.cpp.
|
inlineoverridevirtual |
@Brief get name of the transformer
Implements souffle::ram::transform::Transformer.
Definition at line 70 of file MakeIndex.h.
bool souffle::ram::transform::MakeIndexTransformer::makeIndex | ( | Program & | program | ) |
Make indexable RAM operation indexed.
RAM | program that is transformed |
Definition at line 361 of file MakeIndex.cpp.
References souffle::INFO, souffle::ram::analysis::RelationAnalysis::lookup(), rel(), relAnalysis, and rewriteScan().
Own< Operation > souffle::ram::transform::MakeIndexTransformer::rewriteAggregate | ( | const Aggregate * | agg | ) |
Rewrite an aggregate operation to an indexed aggregate operation.
Aggregate | operation that is potentially rewritten to an indexed version |
Definition at line 286 of file MakeIndex.cpp.
Own< Operation > souffle::ram::transform::MakeIndexTransformer::rewriteIndexScan | ( | const IndexScan * | iscan | ) |
Rewrite an index scan operation to an amended index scan operation.
An | IndexScan that can be amended with new index values |
Definition at line 333 of file MakeIndex.cpp.
Rewrite a scan operation to an indexed scan operation.
Definition at line 308 of file MakeIndex.cpp.
Referenced by makeIndex().
|
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 134 of file MakeIndex.h.
|
protected |
Definition at line 140 of file MakeIndex.h.
Referenced by makeIndex().
|
protected |
Definition at line 132 of file MakeIndex.h.
Referenced by getExpressionPair().