souffle  2.0.2-371-g6315b36
Namespaces | Data Structures | Typedefs | Enumerations | Functions
souffle::ram Namespace Reference

Namespaces

 analysis
 
 detail
 
 test
 
 transform
 

Data Structures

class  AbstractAggregate
 Abstract class for aggregation. More...
 
class  AbstractChoice
 Abstract class for a choice operation. More...
 
class  AbstractConditional
 Abstract conditional statement. More...
 
class  AbstractExistenceCheck
 Abstract existence check for a tuple in a relation. More...
 
class  AbstractLog
 Abstract class for logging. More...
 
class  AbstractOperator
 Abstract class for an operator/functor. More...
 
class  AbstractParallel
 Abstract class for parallel operation. More...
 
class  Aggregate
 Aggregation function applied on some relation. More...
 
class  AutoIncrement
 Increment a counter and return its value. More...
 
class  BinRelationStatement
 Abstract class for a binary relation. More...
 
class  Break
 Breaks out of the loop if a condition holds. More...
 
class  Call
 Call a subroutine. More...
 
class  Choice
 Find a tuple in a relation such that a given condition holds. More...
 
class  Clear
 Delete tuples of a relation. More...
 
class  Condition
 Abstract class for conditions and boolean values in RAM. More...
 
class  Conjunction
 A conjunction of conditions. More...
 
class  Constant
 Represents a Ram Constant. More...
 
class  Constraint
 Evaluates a binary constraint with respect to two Expressions. More...
 
class  DebugInfo
 Debug statement. More...
 
class  EmptinessCheck
 Emptiness check for a relation. More...
 
class  ExistenceCheck
 Existence check for a tuple(-pattern) in a relation. More...
 
class  Exit
 Exit statement for a loop. More...
 
class  Expression
 Abstract class for describing scalar values in RAM. More...
 
class  Extend
 Extend equivalence relation. More...
 
class  False
 
class  Filter
 Checks whether a given condition holds. More...
 
class  FloatConstant
 Represents a float constant. More...
 
class  IndexAggregate
 Indexed aggregation on a relation. The index allows us to iterate over a restricted range. More...
 
class  IndexChoice
 Use an index to find a tuple in a relation such that a given condition holds. More...
 
class  IndexOperation
 
class  IndexScan
 Search for tuples of a relation matching a criteria. More...
 
class  IntrinsicOperator
 Operator that represents an intrinsic (built-in) functor. More...
 
class  IO
 I/O statement for a relation. More...
 
class  LambdaNodeMapper
 A special NodeMapper wrapping a lambda conducting node transformations. More...
 
class  ListStatement
 Abstract class for a list of RAM statements. More...
 
class  LogRelationTimer
 Execution time logger for a statement. More...
 
class  LogSize
 Log relation size and a logging message. More...
 
class  LogTimer
 Execution time logger for a statement. More...
 
class  Loop
 Execute statement until statement terminates loop via an exit statement. More...
 
class  Negation
 Negates a given condition. More...
 
class  NestedIntrinsicOperator
 Effectively identical to IntrinsicOperator, except it can produce multiple results. More...
 
class  NestedOperation
 Abstract class for a nesting operations in a loop-nest. More...
 
class  Node
 Node is a superclass for all RAM IR classes. More...
 
class  NodeMapper
 An abstract class for manipulating RAM Nodes by substitution. More...
 
class  Operation
 Abstract class for a relational algebra operation. More...
 
class  PackRecord
 Packs a record's arguments into a reference. More...
 
class  Parallel
 Parallel block of statements. More...
 
class  ParallelAggregate
 Parallel Aggregation function applied on some relation. More...
 
class  ParallelChoice
 Find a tuple in a relation such that a given condition holds in parallel. More...
 
class  ParallelIndexAggregate
 Aggregate over values of a relation using an index in parallel. More...
 
class  ParallelIndexChoice
 Use an index to find a tuple in a relation such that a given condition holds in parallel. More...
 
class  ParallelIndexScan
 Search for tuples of a relation matching a criteria. More...
 
class  ParallelScan
 Iterate all tuples of a relation in parallel. More...
 
class  Program
 RAM program relation declaration and functions. More...
 
class  Project
 Project a result into the target relation. More...
 
class  ProvenanceExistenceCheck
 Provenance Existence check for a relation. More...
 
class  Query
 A relational algebra query. More...
 
struct  ram_visitor_tag
 A tag type required for the is_ram_visitor type trait to identify RamVisitors. More...
 
class  Relation
 An abstract class for performing indexed operations. More...
 
class  RelationOperation
 Abstract class for operations on relations. More...
 
class  RelationSize
 Returns the numbers of tuples in a relation. More...
 
class  RelationStatement
 RAM Statements with a single relation. More...
 
class  Scan
 Iterate all tuples of a relation. More...
 
class  Sequence
 Sequence of RAM statements. More...
 
class  SignedConstant
 Represents a signed constant. More...
 
class  Statement
 Abstract class for RAM statements. More...
 
class  SubroutineArgument
 Access argument of a subroutine. More...
 
class  SubroutineReturn
 A statement for returning from a ram subroutine. More...
 
class  Swap
 Swap operation with respect to two relations. More...
 
class  TestAutoIndex
 
class  TranslationUnit
 Translating a RAM program. More...
 
class  True
 False value condition. More...
 
class  TupleElement
 Access element from the current tuple in a tuple environment. More...
 
class  TupleOperation
 Abstract class for relation searches and lookups. More...
 
class  UndefValue
 An undefined expression. More...
 
class  UnpackRecord
 Record lookup. More...
 
class  UnsignedConstant
 Represents a unsigned constant. More...
 
class  UserDefinedOperator
 Operator that represents an extrinsic (user-defined) functor. More...
 
struct  Visitor
 The generic base type of all RamVisitors realizing the dispatching of visitor calls. More...
 

Typedefs

using Nodes = MinIndexSelection::SearchSet
 
using RamBound = VecOwn< Expression >
 Pattern type for lower/upper bound. More...
 
using RamPattern = std::pair< RamBound, RamBound >
 

Enumerations

enum  NestedIntrinsicOp { NestedIntrinsicOp::RANGE, NestedIntrinsicOp::URANGE, NestedIntrinsicOp::FRANGE }
 

Functions

std::vector< const ram::Condition * > findConjunctiveTerms (const ram::Condition *condition)
 store terms of a conjunction in an array of pointers without cloning More...
 
bool isTrue (const Condition *cond)
 Determines if a condition represents true. More...
 
bool isUndefValue (const Expression *expr)
 Determines if an expression represents an undefined value. More...
 
template<typename Lambda >
LambdaNodeMapper< Lambda > makeLambdaRamMapper (const Lambda &lambda)
 Creates a node mapper based on a corresponding lambda expression. More...
 
std::ostream & operator<< (std::ostream &os, NestedIntrinsicOp e)
 
SearchSignature setBits (size_t arity, uint64_t mask)
 
 TEST (Matching, StaticTest_1)
 
 TEST (Matching, StaticTest_2)
 
 TEST (Matching, TestOver64BitSignature)
 
 TEST (Tuple, Assign)
 
 TEST (Tuple, Basic)
 
 TEST (Tuple, Compare)
 
 TEST (Tuple, CompareSpeed)
 
Own< ConditiontoCondition (const VecOwn< Condition > &conds)
 Convert list of conditions to a conjunction. More...
 
VecOwn< ConditiontoConjunctionList (const Condition *condition)
 Convert terms of a conjunction to a list. More...
 
template<typename Lambda , typename R = typename lambda_traits<Lambda>::result_type, typename N = typename lambda_traits<Lambda>::arg0_type>
std::enable_if<!detail::is_ram_visitor< Lambda >::value, void >::type visitDepthFirst (const Node &root, const Lambda &fun)
 A utility function visiting all nodes within the RAM fragment rooted by the given node recursively in a depth-first pre-order fashion applying the given function to each encountered node. More...
 
template<typename R , typename N >
void visitDepthFirst (const Node &root, const std::function< R(const N &)> &fun)
 A utility function visiting all nodes within the RAM fragment rooted by the given node recursively in a depth-first pre-order fashion applying the given function to each encountered node. More...
 
template<typename R , typename... Ps, typename... Args>
void visitDepthFirst (const Node &root, Visitor< R, Ps... > &visitor, Args &... args)
 A utility function visiting all nodes within the RAM fragments rooted by the given node recursively in a depth-first pre-order fashion applying the given visitor to each encountered node. More...
 
template<typename R , typename... Ps, typename... Args>
void visitDepthFirstPreOrder (const Node &root, Visitor< R, Ps... > &visitor, Args &... args)
 A utility function visiting all nodes within the RAM fragment rooted by the given node recursively in a depth-first pre-order fashion applying the given visitor to each encountered node. More...
 

Typedef Documentation

◆ Nodes

Definition at line 42 of file matching_test.cpp.

◆ RamBound

Pattern type for lower/upper bound.

Definition at line 41 of file IndexOperation.h.

◆ RamPattern

Definition at line 42 of file IndexOperation.h.

Enumeration Type Documentation

◆ NestedIntrinsicOp

Enumerator
RANGE 
URANGE 
FRANGE 

Definition at line 38 of file NestedIntrinsicOperator.h.

40  {
41  switch (e) {
42  case NestedIntrinsicOp::RANGE: return os << "RANGE";

Function Documentation

◆ findConjunctiveTerms()

std::vector<const ram::Condition*> souffle::ram::findConjunctiveTerms ( const ram::Condition condition)
inline

store terms of a conjunction in an array of pointers without cloning

Convert a condition of the format C1 /\ C2 /\ ... /\ Cn to a list {C1, C2, ..., Cn}.

Definition at line 102 of file Utils.h.

104  {
105  conditionsToProcess.push(&ramConj->getLHS());
106  conditionsToProcess.push(&ramConj->getRHS());
107  } else {
108  conditionList.emplace_back(condition);
109  }
110  }
111  }
112  return conditionList;
113 }
114 
115 } // namespace souffle::ram

Referenced by souffle::interpreter::NodeGenerator::visitQuery().

◆ isTrue()

bool souffle::ram::isTrue ( const Condition cond)
inline

Determines if a condition represents true.

Definition at line 45 of file Utils.h.

49  {C1, C2, ..., Cn}.

◆ isUndefValue()

bool souffle::ram::isUndefValue ( const Expression expr)
inline

Determines if an expression represents an undefined value.

Definition at line 40 of file Utils.h.

51  {

Referenced by souffle::synthesiser::Synthesiser::emitCode(), and souffle::ram::analysis::IndexAnalysis::getSearchSignature().

◆ makeLambdaRamMapper()

template<typename Lambda >
LambdaNodeMapper<Lambda> souffle::ram::makeLambdaRamMapper ( const Lambda &  lambda)

Creates a node mapper based on a corresponding lambda expression.

Definition at line 67 of file LambdaNodeMapper.h.

Referenced by souffle::ram::transform::HoistAggregateTransformer::hoistAggregate(), and souffle::ram::transform::ParallelTransformer::parallelizeOperations().

◆ operator<<()

std::ostream& souffle::ram::operator<< ( std::ostream &  os,
NestedIntrinsicOp  e 
)
inline

Definition at line 44 of file NestedIntrinsicOperator.h.

44  : return os << "FRANGE";
45  default: fatal("invalid Operation");
46  }
47 }
48 
49 /**
50  * @class NestedIntrinsicOperator
51  * @brief Effectively identical to `IntrinsicOperator`, except it can produce multiple results.

◆ setBits()

SearchSignature souffle::ram::setBits ( size_t  arity,
uint64_t  mask 
)

Definition at line 44 of file matching_test.cpp.

49  {
50  TestAutoIndex order;
51  Nodes nodes;
52  size_t arity = 5;
53 

Referenced by TEST().

◆ TEST() [1/7]

souffle::ram::TEST ( Matching  ,
StaticTest_1   
)

Definition at line 55 of file matching_test.cpp.

55  : patterns) {
56  SearchSignature search = setBits(arity, pattern);
57  order.addSearch(search);
58  nodes.insert(search);
59  }
60 
61  order.solve();
62  int num = order.getNumMatchings();
63 
64  EXPECT_EQ(num, 5);
65 }
66 
67 TEST(Matching, StaticTest_2) {
68  TestAutoIndex order;
69  Nodes nodes;
70 
71  size_t arity = 7;

References setBits().

Here is the call graph for this function:

◆ TEST() [2/7]

souffle::ram::TEST ( Matching  ,
StaticTest_2   
)

Definition at line 73 of file matching_test.cpp.

73  {7, 11, 23, 32, 33, 39, 49, 53, 104, 121};
74  for (auto pattern : patterns) {
75  SearchSignature search = setBits(arity, pattern);
76  order.addSearch(search);
77  nodes.insert(search);
78  }
79 
80  order.solve();
81  int num = order.getNumMatchings();
82 
83  EXPECT_EQ(num, 5);
84 }
85 
86 TEST(Matching, TestOver64BitSignature) {
87  TestAutoIndex order;
88  Nodes nodes;
89 
90  size_t arity = 100;

◆ TEST() [3/7]

souffle::ram::TEST ( Matching  ,
TestOver64BitSignature   
)

Definition at line 92 of file matching_test.cpp.

◆ TEST() [4/7]

souffle::ram::TEST ( Tuple  ,
Assign   
)

Definition at line 52 of file compiled_tuple_test.cpp.

57  {
58  Tuple<int, 2> t1 = {{1, 2}};
59  Tuple<int, 2> t2 = {{2, 1}};
60 
61  EXPECT_LT(t1, t2);
62 }
63 
64 TEST(Tuple, CompareSpeed) {
65  // was used to evaluate various implementations of the == operator
66 
67  Tuple<int, 2> t1 = {{1, 2}};

◆ TEST() [5/7]

souffle::ram::TEST ( Tuple  ,
Basic   
)

Definition at line 40 of file compiled_tuple_test.cpp.

40  {
41  Tuple<int, 3> t1 = {{1, 2, 3}};
42  Tuple<int, 3> t2 = {{3, 2, 1}};
43 
44  Tuple<int, 3> t3 = t1;
45 
46  EXPECT_NE(t1, t2);
47  EXPECT_EQ(t1, t3);
48  EXPECT_NE(t2, t3);
49 
50  t3 = t2;

References EXPECT_EQ, and EXPECT_NE.

◆ TEST() [6/7]

souffle::ram::TEST ( Tuple  ,
Compare   
)

Definition at line 69 of file compiled_tuple_test.cpp.

71  {
72  res += !(t1 == t2);
73  if (res & 0x10000000llu) break;
74  }

◆ TEST() [7/7]

souffle::ram::TEST ( Tuple  ,
CompareSpeed   
)

Definition at line 76 of file compiled_tuple_test.cpp.

◆ toCondition()

Own<Condition> souffle::ram::toCondition ( const VecOwn< Condition > &  conds)
inline

Convert list of conditions to a conjunction.

Parameters
Alist of RAM conditions
ARAM condition

Convert a list {C1, C2, ..., Cn} to a condition of the format C1 /\ C2 /\ ... /\ Cn.

Definition at line 84 of file Utils.h.

Referenced by souffle::ram::transform::CollapseFiltersTransformer::collapseFilters(), souffle::ram::transform::EliminateDuplicatesTransformer::eliminateDuplicates(), and souffle::ram::transform::ReorderConditionsTransformer::reorderConditions().

◆ toConjunctionList()

VecOwn<Condition> souffle::ram::toConjunctionList ( const Condition condition)
inline

Convert terms of a conjunction to a list.

Parameters
condsA RAM condition
Returns
A list of RAM conditions

Convert a condition of the format C1 /\ C2 /\ ... /\ Cn to a list {C1, C2, ..., Cn}.

Definition at line 57 of file Utils.h.

59  {
60  conditionsToProcess.push(&ramConj->getLHS());
61  conditionsToProcess.push(&ramConj->getRHS());
62  } else {
63  conditionList.emplace_back(condition->clone());
64  }
65  }
66  }
67  return conditionList;
68 }
69 
70 /**
71  * @brief Convert list of conditions to a conjunction
72  * @param A list of RAM conditions
73  * @param A RAM condition
74  *

Referenced by souffle::ram::transform::EliminateDuplicatesTransformer::eliminateDuplicates(), souffle::ram::transform::ExpandFilterTransformer::expandFilters(), and souffle::ram::transform::ReorderConditionsTransformer::reorderConditions().

◆ visitDepthFirst() [1/3]

template<typename Lambda , typename R = typename lambda_traits<Lambda>::result_type, typename N = typename lambda_traits<Lambda>::arg0_type>
std::enable_if<!detail::is_ram_visitor<Lambda>::value, void>::type souffle::ram::visitDepthFirst ( const Node root,
const Lambda &  fun 
)

A utility function visiting all nodes within the RAM fragment rooted by the given node recursively in a depth-first pre-order fashion applying the given function to each encountered node.

Parameters
rootthe root of the RAM fragment to be visited
funthe function to be applied
argsa list of extra parameters to be forwarded to the visitor

Definition at line 427 of file Visitor.h.

◆ visitDepthFirst() [2/3]

template<typename R , typename N >
void souffle::ram::visitDepthFirst ( const Node root,
const std::function< R(const N &)> &  fun 
)

A utility function visiting all nodes within the RAM fragment rooted by the given node recursively in a depth-first pre-order fashion applying the given function to each encountered node.

Parameters
rootthe root of the RAM fragment to be visited
funthe function to be applied
argsa list of extra parameters to be forwarded to the visitor

Definition at line 411 of file Visitor.h.

References visitDepthFirst().

Here is the call graph for this function:

◆ visitDepthFirst() [3/3]

template<typename R , typename... Ps, typename... Args>
void souffle::ram::visitDepthFirst ( const Node root,
Visitor< R, Ps... > &  visitor,
Args &...  args 
)

A utility function visiting all nodes within the RAM fragments rooted by the given node recursively in a depth-first pre-order fashion applying the given visitor to each encountered node.

Parameters
rootthe root of the RAM fragments to be visited
visitorthe visitor to be applied on each node
argsa list of extra parameters to be forwarded to the visitor

Definition at line 357 of file Visitor.h.

361  : public Visitor<void> {

Referenced by souffle::ram::analysis::RelationAnalysis::lookup(), souffle::ram::transform::ChoiceConversionTransformer::rewriteIndexScan(), souffle::ram::transform::ChoiceConversionTransformer::rewriteScan(), and visitDepthFirst().

◆ visitDepthFirstPreOrder()

template<typename R , typename... Ps, typename... Args>
void souffle::ram::visitDepthFirstPreOrder ( const Node root,
Visitor< R, Ps... > &  visitor,
Args &...  args 
)

A utility function visiting all nodes within the RAM fragment rooted by the given node recursively in a depth-first pre-order fashion applying the given visitor to each encountered node.

Parameters
rootthe root of the RAM fragment to be visited
visitorthe visitor to be applied on each node
argsa list of extra parameters to be forwarded to the visitor

Definition at line 338 of file Visitor.h.

350  {

Referenced by souffle::ram::Visitor< Own< Node > >::visitNode().

EXPECT_EQ
#define EXPECT_EQ(a, b)
Definition: test.h:191
e
l j a showGridBackground &&c b raw series this eventEmitter e
Definition: htmlJsChartistMin.h:15
souffle::ram::Nodes
MinIndexSelection::SearchSet Nodes
Definition: matching_test.cpp:42
souffle::ram::setBits
SearchSignature setBits(size_t arity, uint64_t mask)
Definition: matching_test.cpp:44
souffle::ram::TEST
TEST(Matching, TestOver64BitSignature)
Definition: matching_test.cpp:92
souffle::ram::TEST
TEST(Tuple, CompareSpeed)
Definition: compiled_tuple_test.cpp:76
EXPECT_LT
#define EXPECT_LT(a, b)
Definition: test.h:199
souffle::Tuple
std::array< A, N > Tuple
Definition: RamTypes.h:36
EXPECT_NE
#define EXPECT_NE(a, b)
Definition: test.h:195
souffle::fatal
void fatal(const char *format, const Args &... args)
Definition: MiscUtil.h:198