souffle  2.0.2-371-g6315b36
Generator.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 Generator.h
12  *
13  * Declares the Interpreter Generator class. The generator takes an entry
14  * of the RAM program and translate it into an executable Node representation
15  * with environment symbol binding in each node.
16  ***********************************************************************/
17 
18 #pragma once
19 
20 #include "Global.h"
21 #include "RelationTag.h"
22 #include "interpreter/Index.h"
23 #include "interpreter/Relation.h"
26 #include "ram/AbstractParallel.h"
27 #include "ram/Aggregate.h"
28 #include "ram/AutoIncrement.h"
29 #include "ram/Break.h"
30 #include "ram/Call.h"
31 #include "ram/Choice.h"
32 #include "ram/Clear.h"
33 #include "ram/Condition.h"
34 #include "ram/Conjunction.h"
35 #include "ram/Constant.h"
36 #include "ram/Constraint.h"
37 #include "ram/DebugInfo.h"
38 #include "ram/EmptinessCheck.h"
39 #include "ram/ExistenceCheck.h"
40 #include "ram/Exit.h"
41 #include "ram/Expression.h"
42 #include "ram/Extend.h"
43 #include "ram/False.h"
44 #include "ram/Filter.h"
45 #include "ram/IO.h"
46 #include "ram/IndexAggregate.h"
47 #include "ram/IndexChoice.h"
48 #include "ram/IndexOperation.h"
49 #include "ram/IndexScan.h"
50 #include "ram/IntrinsicOperator.h"
51 #include "ram/LogRelationTimer.h"
52 #include "ram/LogSize.h"
53 #include "ram/LogTimer.h"
54 #include "ram/Loop.h"
55 #include "ram/Negation.h"
57 #include "ram/NestedOperation.h"
58 #include "ram/Node.h"
59 #include "ram/Operation.h"
60 #include "ram/PackRecord.h"
61 #include "ram/Parallel.h"
62 #include "ram/ParallelAggregate.h"
63 #include "ram/ParallelChoice.h"
66 #include "ram/ParallelIndexScan.h"
67 #include "ram/ParallelScan.h"
68 #include "ram/Program.h"
69 #include "ram/Project.h"
71 #include "ram/Query.h"
72 #include "ram/Relation.h"
73 #include "ram/RelationSize.h"
74 #include "ram/Scan.h"
75 #include "ram/Sequence.h"
76 #include "ram/Statement.h"
77 #include "ram/SubroutineArgument.h"
78 #include "ram/SubroutineReturn.h"
79 #include "ram/Swap.h"
80 #include "ram/True.h"
81 #include "ram/TupleElement.h"
82 #include "ram/TupleOperation.h"
83 #include "ram/UndefValue.h"
84 #include "ram/UnpackRecord.h"
86 #include "ram/analysis/Index.h"
87 #include "ram/utility/Utils.h"
88 #include "ram/utility/Visitor.h"
89 #include "souffle/RamTypes.h"
92 #include <algorithm>
93 #include <array>
94 #include <cstddef>
95 #include <iterator>
96 #include <map>
97 #include <memory>
98 #include <queue>
99 #include <string>
100 #include <typeinfo>
101 #include <unordered_map>
102 #include <utility>
103 #include <vector>
104 
105 namespace souffle::interpreter {
106 class Engine;
107 /*
108  * @class NodeGenerator
109  * @brief Generate an executable Node tree based on the RAM tree.
110  * Each node contains run time information which is necessary for Engine to interpreter.
111  */
112 class NodeGenerator : public ram::Visitor<Own<Node>> {
113  using NodePtr = Own<Node>;
114  using NodePtrVec = std::vector<NodePtr>;
115  using RelationHandle = Own<RelationWrapper>;
116 
117 public:
118  NodeGenerator(Engine& engine);
119 
120  /**
121  * @brief Generate the tree based on given entry.
122  * Return a NodePtr to the root.
123  */
124  NodePtr generateTree(const ram::Node& root);
125 
126  NodePtr visitConstant(const ram::Constant& num) override;
127 
128  NodePtr visitTupleElement(const ram::TupleElement& access) override;
129 
130  NodePtr visitAutoIncrement(const ram::AutoIncrement& inc) override;
131 
133 
135 
137 
138  NodePtr visitPackRecord(const ram::PackRecord& pr) override;
139 
141 
142  NodePtr visitTrue(const ram::True& ltrue) override;
143 
144  NodePtr visitFalse(const ram::False& lfalse) override;
145 
146  NodePtr visitConjunction(const ram::Conjunction& conj) override;
147 
148  NodePtr visitNegation(const ram::Negation& neg) override;
149 
150  NodePtr visitEmptinessCheck(const ram::EmptinessCheck& emptiness) override;
151 
153 
154  NodePtr visitExistenceCheck(const ram::ExistenceCheck& exists) override;
155 
157 
158  NodePtr visitConstraint(const ram::Constraint& relOp) override;
159 
160  NodePtr visitNestedOperation(const ram::NestedOperation& nested) override;
161 
162  NodePtr visitTupleOperation(const ram::TupleOperation& search) override;
163 
164  NodePtr visitScan(const ram::Scan& scan) override;
165 
166  NodePtr visitParallelScan(const ram::ParallelScan& pScan) override;
167 
168  NodePtr visitIndexScan(const ram::IndexScan& iScan) override;
169 
170  NodePtr visitParallelIndexScan(const ram::ParallelIndexScan& piscan) override;
171 
172  NodePtr visitChoice(const ram::Choice& choice) override;
173 
174  NodePtr visitParallelChoice(const ram::ParallelChoice& pChoice) override;
175 
176  NodePtr visitIndexChoice(const ram::IndexChoice& iChoice) override;
177 
179 
180  NodePtr visitUnpackRecord(const ram::UnpackRecord& unpack) override;
181 
182  NodePtr visitAggregate(const ram::Aggregate& aggregate) override;
183 
184  NodePtr visitParallelAggregate(const ram::ParallelAggregate& pAggregate) override;
185 
186  NodePtr visitIndexAggregate(const ram::IndexAggregate& iAggregate) override;
187 
189 
190  NodePtr visitBreak(const ram::Break& breakOp) override;
191 
192  NodePtr visitFilter(const ram::Filter& filter) override;
193 
194  NodePtr visitProject(const ram::Project& project) override;
195 
197 
198  NodePtr visitSequence(const ram::Sequence& seq) override;
199 
200  NodePtr visitParallel(const ram::Parallel& parallel) override;
201 
202  NodePtr visitLoop(const ram::Loop& loop) override;
203 
204  NodePtr visitExit(const ram::Exit& exit) override;
205 
206  NodePtr visitCall(const ram::Call& call) override;
207 
208  NodePtr visitLogRelationTimer(const ram::LogRelationTimer& timer) override;
209 
210  NodePtr visitLogTimer(const ram::LogTimer& timer) override;
211 
212  NodePtr visitDebugInfo(const ram::DebugInfo& dbg) override;
213 
214  NodePtr visitClear(const ram::Clear& clear) override;
215 
216  NodePtr visitLogSize(const ram::LogSize& size) override;
217 
218  NodePtr visitIO(const ram::IO& io) override;
219 
220  NodePtr visitQuery(const ram::Query& query) override;
221 
222  NodePtr visitExtend(const ram::Extend& extend) override;
223 
224  NodePtr visitSwap(const ram::Swap& swap) override;
225 
226  NodePtr visitUndefValue(const ram::UndefValue&) override;
227 
228  NodePtr visitNode(const ram::Node& node) override;
229 
230 private:
231  /**
232  * @class OrderingContext
233  * @brief This class help generator reordering tuple access based on the index oder.
234  */
235  class OrderingContext {
236  public:
238 
239  /** @brief Bind tuple with a natural full order.
240  *
241  * This is usually used when an operation implicitly introduce a runtime tuple, such as UnpackRecord
242  * NestedIntrinsicOperator, and nested operation in Aggregate.
243  * */
244  void addNewTuple(size_t tupleId, size_t arity);
245 
246  /** @brief Bind tuple with the default order.
247  *
248  * This is usually used for tuples created by non-indexed operations. Such as Scan, Aggregate, Choice.
249  * */
250  template <class RamNode>
251  void addTupleWithDefaultOrder(size_t tupleId, const RamNode& node);
252 
253  /** @brief Bind tuple with the corresponding index order.
254  *
255  * This is usually used for tuples created by indexed operations. Such as IndexScan, IndexAggregate,
256  * IndexChoice.
257  * */
258  template <class RamNode>
259  void addTupleWithIndexOrder(size_t tupleId, const RamNode& node);
260 
261  /** @brief Map the decoded order of elementId based on current context */
262  size_t mapOrder(size_t tupleId, size_t elementId) const;
263 
264  private:
265  void insertOrder(size_t tupleId, const Order& order);
266  std::vector<Order> tupleOrders;
268  };
269 
270 private:
271  /** @brief Reset view allocation system, since view's life time is within each query. */
272  void newQueryBlock();
273 
274  /** @brief Get a valid relation id for encoding */
275  size_t getNewRelId();
276 
277  /** @brief Get a valid view id for encoding */
278  size_t getNextViewId();
279 
280  /** @brief Return operation index id from the result of indexAnalysis */
281  template <class RamNode>
282  size_t encodeIndexPos(RamNode& node);
283 
284  /** @brief Encode and return the View id of an operation. */
285  size_t encodeView(const ram::Node* node);
286 
287  /** @brief get arity of relation */
288  const ram::Relation& lookup(const std::string& relName);
289 
290  /** @brief get arity of relation */
291  size_t getArity(const std::string& relName);
292 
293  /** @brief Encode and create the relation, return the relation id */
294  size_t encodeRelation(const std::string& relName);
295 
296  /* @brief Get a relation instance from engine */
297  RelationHandle* getRelationHandle(const size_t idx);
298 
299  /**
300  * Return true if the given operation requires a view.
301  */
302  bool requireView(const ram::Node* node);
303 
304  /**
305  * @brief Return the associated relation of a operation which requires a view.
306  * This function assume the operation does requires a view.
307  */
308  const std::string& getViewRelation(const ram::Node* node);
309 
310  /**
311  * @brief Encode and return the super-instruction information about a index operation.
312  */
314 
315  /**
316  * @brief Encode and return the super-instruction information about an existence check operation
317  */
319 
320  /**
321  * @brief Encode and return the super-instruction information about a project operation
322  *
323  * No reordering needed for projection as project can have more then one target indexes and reordering can
324  * only be done during runtime.
325  */
327 
328  /** Environment encoding, store a mapping from ram::Node to its operation index id. */
329  std::unordered_map<const ram::Node*, size_t> indexTable;
330  /** Points to the current viewContext during the generation.
331  * It is used to passing viewContext between parent query and its nested parallel operation.
332  * As parallel operation requires its own view information. */
333  std::shared_ptr<ViewContext> parentQueryViewContext = nullptr;
334  /** Next available location to encode View */
335  size_t viewId = 0;
336  /** Next available location to encode a relation */
337  size_t relId = 0;
338  /** Environment encoding, store a mapping from ram::Node to its View id. */
339  std::unordered_map<const ram::Node*, size_t> viewTable;
340  /** Environment encoding, store a mapping from ram::Relation to its id */
341  std::unordered_map<std::string, size_t> relTable;
342  /** name / relation mapping */
343  std::unordered_map<std::string, const ram::Relation*> relationMap;
344  /** ordering context */
346  /** Reference to the engine instance */
347  Engine& engine;
348 };
349 } // namespace souffle::interpreter
Aggregate.h
souffle::ram::Break
Breaks out of the loop if a condition holds.
Definition: Break.h:49
souffle::interpreter::NodeGenerator::visitLogRelationTimer
NodePtr visitLogRelationTimer(const ram::LogRelationTimer &timer) override
Definition: Generator.cpp:384
souffle::ram::IndexOperation
Definition: IndexOperation.h:48
souffle::interpreter::NodeGenerator::OrderingContext::mapOrder
size_t mapOrder(size_t tupleId, size_t elementId) const
Map the decoded order of elementId based on current context.
Definition: Generator.cpp:735
souffle::interpreter::NodeGenerator::visitConstraint
NodePtr visitConstraint(const ram::Constraint &relOp) override
Definition: Generator.cpp:165
UserDefinedOperator.h
TCB_SPAN_NAMESPACE_NAME::detail::size
constexpr auto size(const C &c) -> decltype(c.size())
Definition: span.h:198
souffle::interpreter::NodeGenerator::visitParallelIndexAggregate
NodePtr visitParallelIndexAggregate(const ram::ParallelIndexAggregate &piAggregate) override
Definition: Generator.cpp:308
souffle::interpreter::NodeGenerator::visitExtend
NodePtr visitExtend(const ram::Extend &extend) override
Definition: Generator.cpp:463
Constant.h
souffle::ram::AutoIncrement
Increment a counter and return its value.
Definition: AutoIncrement.h:36
AbstractExistenceCheck.h
souffle::interpreter::NodeGenerator::visitIndexScan
NodePtr visitIndexScan(const ram::IndexScan &iScan) override
Definition: Generator.cpp:198
souffle::interpreter::NodeGenerator::relId
size_t relId
Next available location to encode a relation.
Definition: Generator.h:344
souffle::ram::UserDefinedOperator
Operator that represents an extrinsic (user-defined) functor.
Definition: UserDefinedOperator.h:43
PackRecord.h
souffle::interpreter::NodeGenerator::newQueryBlock
void newQueryBlock()
Reset view allocation system, since view's life time is within each query.
Definition: Generator.cpp:483
souffle::interpreter::NodeGenerator::getRelationHandle
RelationHandle * getRelationHandle(const size_t idx)
Definition: Generator.cpp:542
souffle::ram::ParallelIndexScan
Search for tuples of a relation matching a criteria.
Definition: ParallelIndexScan.h:58
souffle::interpreter::NodeGenerator::relationMap
std::unordered_map< std::string, const ram::Relation * > relationMap
name / relation mapping
Definition: Generator.h:350
NestedOperation.h
Constraint.h
Call.h
souffle::interpreter::NodeGenerator::visitParallelIndexChoice
NodePtr visitParallelIndexChoice(const ram::ParallelIndexChoice &piChoice) override
Definition: Generator.cpp:245
souffle::ram::UnpackRecord
Record lookup.
Definition: UnpackRecord.h:51
Index.h
souffle::interpreter::NodeGenerator::getArity
size_t getArity(const std::string &relName)
get arity of relation
Definition: Generator.cpp:526
souffle::ram::Swap
Swap operation with respect to two relations.
Definition: Swap.h:43
souffle::interpreter::NodeGenerator::visitScan
NodePtr visitScan(const ram::Scan &scan) override
Definition: Generator.cpp:180
souffle::ram::Query
A relational algebra query.
Definition: Query.h:50
Scan.h
souffle::interpreter::NodeGenerator::RelationHandle
Own< RelationWrapper > RelationHandle
Definition: Generator.h:122
Exit.h
souffle::interpreter::NodeGenerator::visitSubroutineReturn
NodePtr visitSubroutineReturn(const ram::SubroutineReturn &ret) override
Definition: Generator.cpp:340
Negation.h
souffle::ram::PackRecord
Packs a record's arguments into a reference.
Definition: PackRecord.h:42
Project.h
Clear.h
Relation.h
souffle::interpreter::NodeGenerator::visitQuery
NodePtr visitQuery(const ram::Query &query) override
Definition: Generator.cpp:417
souffle::interpreter::NodeGenerator::visitParallelAggregate
NodePtr visitParallelAggregate(const ram::ParallelAggregate &pAggregate) override
Definition: Generator.cpp:278
souffle::interpreter::NodeGenerator::visitParallelIndexScan
NodePtr visitParallelIndexScan(const ram::ParallelIndexScan &piscan) override
Definition: Generator.cpp:206
souffle::interpreter::NodeGenerator::visitSequence
NodePtr visitSequence(const ram::Sequence &seq) override
Definition: Generator.cpp:348
souffle::interpreter::NodeGenerator::visitAggregate
NodePtr visitAggregate(const ram::Aggregate &aggregate) override
Definition: Generator.cpp:263
souffle::interpreter::NodeGenerator::visitTupleOperation
NodePtr visitTupleOperation(const ram::TupleOperation &search) override
Definition: Generator.cpp:173
LogTimer.h
souffle::interpreter::NodeGenerator::visitProject
NodePtr visitProject(const ram::Project &project) override
Definition: Generator.cpp:332
souffle::ram::Loop
Execute statement until statement terminates loop via an exit statement.
Definition: Loop.h:48
souffle::interpreter::NodeGenerator::OrderingContext::addNewTuple
void addNewTuple(size_t tupleId, size_t arity)
Bind tuple with a natural full order.
Definition: Generator.cpp:713
souffle::interpreter::NodeGenerator::visitSwap
NodePtr visitSwap(const ram::Swap &swap) override
Definition: Generator.cpp:469
souffle::ram::Exit
Exit statement for a loop.
Definition: Exit.h:48
souffle::interpreter::NodeGenerator::visitBreak
NodePtr visitBreak(const ram::Break &breakOp) override
Definition: Generator.cpp:324
souffle::interpreter::NodeGenerator::relTable
std::unordered_map< std::string, size_t > relTable
Environment encoding, store a mapping from ram::Relation to its id.
Definition: Generator.h:348
souffle::ram::ParallelIndexChoice
Use an index to find a tuple in a relation such that a given condition holds in parallel.
Definition: ParallelIndexChoice.h:59
souffle::ram::Parallel
Parallel block of statements.
Definition: Parallel.h:49
souffle::ram::Extend
Extend equivalence relation.
Definition: Extend.h:41
souffle::ram::Call
Call a subroutine.
Definition: Call.h:42
souffle::interpreter::NodeGenerator::visitTrue
NodePtr visitTrue(const ram::True &ltrue) override
Definition: Generator.cpp:113
False.h
ParallelChoice.h
LogRelationTimer.h
souffle::interpreter::NodeGenerator::viewTable
std::unordered_map< const ram::Node *, size_t > viewTable
Environment encoding, store a mapping from ram::Node to its View id.
Definition: Generator.h:346
MiscUtil.h
souffle::interpreter::NodeGenerator::visitFalse
NodePtr visitFalse(const ram::False &lfalse) override
Definition: Generator.cpp:117
souffle::interpreter::NodeGenerator::indexTable
std::unordered_map< const ram::Node *, size_t > indexTable
Environment encoding, store a mapping from ram::Node to its operation index id.
Definition: Generator.h:336
Index.h
souffle::interpreter::NodeGenerator::visitExit
NodePtr visitExit(const ram::Exit &exit) override
Definition: Generator.cpp:369
souffle::interpreter::NodeGenerator::visitIndexAggregate
NodePtr visitIndexAggregate(const ram::IndexAggregate &iAggregate) override
Definition: Generator.cpp:294
souffle::interpreter::NodeGenerator::NodePtr
Own< Node > NodePtr
Definition: Generator.h:120
Filter.h
souffle::ram::LogTimer
Execution time logger for a statement.
Definition: LogTimer.h:55
SubroutineArgument.h
souffle::interpreter::NodeGenerator::OrderingContext::addTupleWithDefaultOrder
void addTupleWithDefaultOrder(size_t tupleId, const RamNode &node)
Bind tuple with the default order.
Definition: Generator.cpp:722
DebugInfo.h
EmptinessCheck.h
souffle::interpreter::NodeGenerator::getIndexSuperInstInfo
SuperInstruction getIndexSuperInstInfo(const ram::IndexOperation &ramIndex)
Encode and return the super-instruction information about a index operation.
Definition: Generator.cpp:565
Swap.h
souffle::ram::ExistenceCheck
Existence check for a tuple(-pattern) in a relation.
Definition: ExistenceCheck.h:49
True.h
souffle::ram::TupleElement
Access element from the current tuple in a tuple environment.
Definition: TupleElement.h:42
souffle::interpreter::NodeGenerator
Definition: Generator.h:119
souffle::interpreter::NodeGenerator::visitTupleElement
NodePtr visitTupleElement(const ram::TupleElement &access) override
Definition: Generator.cpp:62
TupleOperation.h
ParallelIndexScan.h
souffle::ram::False
Definition: False.h:38
Program.h
IndexAggregate.h
Global.h
souffle::interpreter::Order
An order to be enforced for storing tuples within indexes.
Definition: Index.h:48
souffle::interpreter::NodeGenerator::OrderingContext::tupleOrders
std::vector< Order > tupleOrders
Definition: Generator.h:273
souffle::interpreter::NodeGenerator::parentQueryViewContext
std::shared_ptr< ViewContext > parentQueryViewContext
Points to the current viewContext during the generation.
Definition: Generator.h:340
souffle::ram::Filter
Checks whether a given condition holds.
Definition: Filter.h:49
souffle::ram::Conjunction
A conjunction of conditions.
Definition: Conjunction.h:54
souffle::ram::ProvenanceExistenceCheck
Provenance Existence check for a relation.
Definition: ProvenanceExistenceCheck.h:42
souffle::interpreter
Definition: BrieIndex.cpp:22
souffle::interpreter::NodeGenerator::visitConstant
NodePtr visitConstant(const ram::Constant &num) override
Definition: Generator.cpp:58
souffle::interpreter::NodeGenerator::OrderingContext::generator
NodeGenerator & generator
Definition: Generator.h:274
souffle::interpreter::NodeGenerator::visitExistenceCheck
NodePtr visitExistenceCheck(const ram::ExistenceCheck &exists) override
Definition: Generator.cpp:143
souffle::ram::Node
Node is a superclass for all RAM IR classes.
Definition: Node.h:42
ProvenanceExistenceCheck.h
souffle::interpreter::NodeGenerator::getNewRelId
size_t getNewRelId()
Get a valid relation id for encoding.
Definition: Generator.cpp:488
IndexScan.h
Visitor.h
souffle::interpreter::NodeGenerator::visitSubroutineArgument
NodePtr visitSubroutineArgument(const ram::SubroutineArgument &arg) override
Definition: Generator.cpp:108
IndexChoice.h
souffle::interpreter::NodeGenerator::getExistenceSuperInstInfo
SuperInstruction getExistenceSuperInstInfo(const ram::AbstractExistenceCheck &abstractExist)
Encode and return the super-instruction information about an existence check operation.
Definition: Generator.cpp:634
souffle::ram::Project
Project a result into the target relation.
Definition: Project.h:50
souffle::filter
std::vector< A > filter(std::vector< A > xs, F &&f)
Filter a vector to include certain elements.
Definition: FunctionalUtil.h:155
souffle::interpreter::NodeGenerator::lookup
const ram::Relation & lookup(const std::string &relName)
get arity of relation
Definition: Generator.cpp:520
ContainerUtil.h
souffle::interpreter::NodeGenerator::OrderingContext::addTupleWithIndexOrder
void addTupleWithIndexOrder(size_t tupleId, const RamNode &node)
Bind tuple with the corresponding index order.
Definition: Generator.cpp:728
souffle::interpreter::NodeGenerator::visitIndexChoice
NodePtr visitIndexChoice(const ram::IndexChoice &iChoice) override
Definition: Generator.cpp:237
souffle::interpreter::NodeGenerator::visitPackRecord
NodePtr visitPackRecord(const ram::PackRecord &pr) override
Definition: Generator.cpp:100
souffle::interpreter::NodeGenerator::requireView
bool requireView(const ram::Node *node)
Return true if the given operation requires a view.
Definition: Generator.cpp:546
Choice.h
souffle::ram::Clear
Delete tuples of a relation.
Definition: Clear.h:50
RelationTag.h
souffle::ram::ParallelIndexAggregate
Aggregate over values of a relation using an index in parallel.
Definition: ParallelIndexAggregate.h:52
souffle::ram::Relation
An abstract class for performing indexed operations.
Definition: Relation.h:40
Relation.h
NestedIntrinsicOperator.h
souffle::interpreter::NodeGenerator::visitIntrinsicOperator
NodePtr visitIntrinsicOperator(const ram::IntrinsicOperator &op) override
Definition: Generator.cpp:73
souffle::ram::AbstractExistenceCheck
Abstract existence check for a tuple in a relation.
Definition: AbstractExistenceCheck.h:47
souffle::ram::NestedOperation
Abstract class for a nesting operations in a loop-nest.
Definition: NestedOperation.h:52
souffle::interpreter::NodeGenerator::NodeGenerator
NodeGenerator(Engine &engine)
Definition: Generator.cpp:30
souffle::interpreter::NodeGenerator::visitCall
NodePtr visitCall(const ram::Call &call) override
Definition: Generator.cpp:373
souffle::interpreter::NodeGenerator::visitConjunction
NodePtr visitConjunction(const ram::Conjunction &conj) override
Definition: Generator.cpp:121
souffle::ram::Aggregate
Aggregation function applied on some relation.
Definition: Aggregate.h:53
ParallelIndexChoice.h
souffle::interpreter::Engine
This class translate the RAM Program into executable format and interpreter it.
Definition: Engine.h:56
Condition.h
souffle::ram::ParallelAggregate
Parallel Aggregation function applied on some relation.
Definition: ParallelAggregate.h:53
souffle::interpreter::NodeGenerator::visitIO
NodePtr visitIO(const ram::IO &io) override
Definition: Generator.cpp:411
ParallelIndexAggregate.h
souffle::ram::IndexChoice
Use an index to find a tuple in a relation such that a given condition holds.
Definition: IndexChoice.h:58
souffle::ram::IndexAggregate
Indexed aggregation on a relation. The index allows us to iterate over a restricted range.
Definition: IndexAggregate.h:51
souffle::interpreter::NodeGenerator::visitNestedOperation
NodePtr visitNestedOperation(const ram::NestedOperation &nested) override
Definition: Generator.cpp:169
ExistenceCheck.h
UnpackRecord.h
souffle::interpreter::NodeGenerator::visitParallel
NodePtr visitParallel(const ram::Parallel &parallel) override
Definition: Generator.cpp:356
AutoIncrement.h
souffle::ram::ParallelScan
Iterate all tuples of a relation in parallel.
Definition: ParallelScan.h:52
Utils.h
souffle::ram::Constant
Represents a Ram Constant.
Definition: Constant.h:36
souffle::ram::EmptinessCheck
Emptiness check for a relation.
Definition: EmptinessCheck.h:53
souffle::ram::IO
I/O statement for a relation.
Definition: IO.h:42
IO.h
souffle::interpreter::NodeGenerator::visitUndefValue
NodePtr visitUndefValue(const ram::UndefValue &) override
Definition: Generator.cpp:475
souffle::interpreter::NodeGenerator::visitNode
NodePtr visitNode(const ram::Node &node) override
Definition: Generator.cpp:479
RelationSize.h
souffle::interpreter::NodeGenerator::encodeView
size_t encodeView(const ram::Node *node)
Encode and return the View id of an operation.
Definition: Generator.cpp:510
souffle::interpreter::NodeGenerator::visitUserDefinedOperator
NodePtr visitUserDefinedOperator(const ram::UserDefinedOperator &op) override
Definition: Generator.cpp:81
souffle::interpreter::NodeGenerator::visitLoop
NodePtr visitLoop(const ram::Loop &loop) override
Definition: Generator.cpp:365
ParallelScan.h
Break.h
souffle::interpreter::NodeGenerator::getNextViewId
size_t getNextViewId()
Get a valid view id for encoding.
Definition: Generator.cpp:492
souffle::interpreter::NodeGenerator::visitNegation
NodePtr visitNegation(const ram::Negation &neg) override
Definition: Generator.cpp:125
ParallelAggregate.h
souffle::ram::TupleOperation
Abstract class for relation searches and lookups.
Definition: TupleOperation.h:35
souffle::interpreter::NodeGenerator::NodePtrVec
std::vector< NodePtr > NodePtrVec
Definition: Generator.h:121
souffle::ram::DebugInfo
Debug statement.
Definition: DebugInfo.h:47
souffle::interpreter::NodeGenerator::OrderingContext
This class help generator reordering tuple access based on the index oder.
Definition: Generator.h:242
souffle::ram::Choice
Find a tuple in a relation such that a given condition holds.
Definition: Choice.h:59
souffle::ram::Scan
Iterate all tuples of a relation.
Definition: Scan.h:47
souffle::ram::IndexScan
Search for tuples of a relation matching a criteria.
Definition: IndexScan.h:52
souffle::ram::IntrinsicOperator
Operator that represents an intrinsic (built-in) functor.
Definition: IntrinsicOperator.h:42
souffle::interpreter::NodeGenerator::OrderingContext::insertOrder
void insertOrder(size_t tupleId, const Order &order)
Definition: Generator.cpp:739
souffle::interpreter::NodeGenerator::visitParallelChoice
NodePtr visitParallelChoice(const ram::ParallelChoice &pChoice) override
Definition: Generator.cpp:226
souffle::interpreter::NodeGenerator::visitAutoIncrement
NodePtr visitAutoIncrement(const ram::AutoIncrement &inc) override
Definition: Generator.cpp:69
souffle::interpreter::SuperInstruction
This class encodes information for a super-instruction, which is used to eliminate Number and TupleEl...
Definition: Node.h:281
IndexOperation.h
souffle::ram::Constraint
Evaluates a binary constraint with respect to two Expressions.
Definition: Constraint.h:55
AbstractParallel.h
TupleElement.h
souffle::ram::Negation
Negates a given condition.
Definition: Negation.h:49
souffle::interpreter::NodeGenerator::generateTree
NodePtr generateTree(const ram::Node &root)
Generate the tree based on given entry.
Definition: Generator.cpp:37
souffle::interpreter::NodeGenerator::OrderingContext::OrderingContext
OrderingContext(NodeGenerator &generator)
Definition: Generator.cpp:711
Node.h
souffle::interpreter::NodeGenerator::visitDebugInfo
NodePtr visitDebugInfo(const ram::DebugInfo &dbg) override
Definition: Generator.cpp:394
Operation.h
Query.h
souffle::interpreter::NodeGenerator::visitUnpackRecord
NodePtr visitUnpackRecord(const ram::UnpackRecord &unpack) override
Definition: Generator.cpp:257
souffle::interpreter::NodeGenerator::visitNestedIntrinsicOperator
NodePtr visitNestedIntrinsicOperator(const ram::NestedIntrinsicOperator &op) override
Definition: Generator.cpp:89
RamTypes.h
Sequence.h
souffle::interpreter::NodeGenerator::visitProvenanceExistenceCheck
NodePtr visitProvenanceExistenceCheck(const ram::ProvenanceExistenceCheck &provExists) override
Definition: Generator.cpp:158
souffle::interpreter::NodeGenerator::visitClear
NodePtr visitClear(const ram::Clear &clear) override
Definition: Generator.cpp:398
Statement.h
souffle::interpreter::NodeGenerator::encodeRelation
size_t encodeRelation(const std::string &relName)
Encode and create the relation, return the relation id.
Definition: Generator.cpp:531
souffle::interpreter::NodeGenerator::visitParallelScan
NodePtr visitParallelScan(const ram::ParallelScan &pScan) override
Definition: Generator.cpp:188
souffle::interpreter::NodeGenerator::visitLogSize
NodePtr visitLogSize(const ram::LogSize &size) override
Definition: Generator.cpp:405
souffle::ram::UndefValue
An undefined expression.
Definition: UndefValue.h:36
souffle::ram::NestedIntrinsicOperator
Effectively identical to IntrinsicOperator, except it can produce multiple results.
Definition: NestedIntrinsicOperator.h:62
SubroutineReturn.h
souffle::interpreter::NodeGenerator::visitLogTimer
NodePtr visitLogTimer(const ram::LogTimer &timer) override
Definition: Generator.cpp:390
Expression.h
UndefValue.h
souffle::interpreter::NodeGenerator::engine
Engine & engine
Reference to the engine instance.
Definition: Generator.h:354
Loop.h
souffle::ram::True
False value condition.
Definition: True.h:38
souffle::ram::SubroutineArgument
Access argument of a subroutine.
Definition: SubroutineArgument.h:40
souffle::interpreter::NodeGenerator::visitRelationSize
NodePtr visitRelationSize(const ram::RelationSize &size) override
Definition: Generator.cpp:136
souffle::ram::SubroutineReturn
A statement for returning from a ram subroutine.
Definition: SubroutineReturn.h:46
souffle::ram::RelationSize
Returns the numbers of tuples in a relation.
Definition: RelationSize.h:49
souffle::ram::LogSize
Log relation size and a logging message.
Definition: LogSize.h:38
souffle::interpreter::NodeGenerator::getViewRelation
const std::string & getViewRelation(const ram::Node *node)
Return the associated relation of a operation which requires a view.
Definition: Generator.cpp:555
souffle::interpreter::NodeGenerator::viewId
size_t viewId
Next available location to encode View.
Definition: Generator.h:342
souffle::ram::Sequence
Sequence of RAM statements.
Definition: Sequence.h:37
souffle::interpreter::NodeGenerator::visitChoice
NodePtr visitChoice(const ram::Choice &choice) override
Definition: Generator.cpp:218
souffle::interpreter::NodeGenerator::orderingContext
OrderingContext orderingContext
ordering context
Definition: Generator.h:352
LogSize.h
souffle::interpreter::NodeGenerator::visitFilter
NodePtr visitFilter(const ram::Filter &filter) override
Definition: Generator.cpp:328
IntrinsicOperator.h
souffle::ram::LogRelationTimer
Execution time logger for a statement.
Definition: LogRelationTimer.h:55
ViewContext.h
souffle::ram::ParallelChoice
Find a tuple in a relation such that a given condition holds in parallel.
Definition: ParallelChoice.h:51
souffle::interpreter::NodeGenerator::getProjectSuperInstInfo
SuperInstruction getProjectSuperInstInfo(const ram::Project &exist)
Encode and return the super-instruction information about a project operation.
Definition: Generator.cpp:681
Parallel.h
souffle::interpreter::NodeGenerator::encodeIndexPos
size_t encodeIndexPos(RamNode &node)
Return operation index id from the result of indexAnalysis.
Definition: Generator.cpp:497
souffle::interpreter::NodeGenerator::visitEmptinessCheck
NodePtr visitEmptinessCheck(const ram::EmptinessCheck &emptiness) override
Definition: Generator.cpp:129
Conjunction.h
Extend.h