souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions
souffle::ast2ram::ProvenanceClauseTranslator Class Reference

#include <ProvenanceClauseTranslator.h>

Inheritance diagram for souffle::ast2ram::ProvenanceClauseTranslator:
Inheritance graph
Collaboration diagram for souffle::ast2ram::ProvenanceClauseTranslator:
Collaboration graph

Public Member Functions

 ProvenanceClauseTranslator (AstToRamTranslator &translator)
 
- Public Member Functions inherited from souffle::ast2ram::ClauseTranslator
 ClauseTranslator (AstToRamTranslator &translator)
 
Own< ram::StatementtranslateClause (const ast::Clause &clause, const ast::Clause &originalClause, const int version=0)
 generate RAM code for a clause More...
 

Protected Member Functions

Own< ram::ConditioncreateCondition (const ast::Clause &originalClause) override
 
Own< ram::OperationcreateOperation (const ast::Clause &clause) override
 
- Protected Member Functions inherited from souffle::ast2ram::ClauseTranslator
Own< ram::OperationfilterByConstraints (size_t level, const std::vector< ast::Argument * > &args, Own< ram::Operation > op, bool constrainByFunctors=true)
 apply constraint filters to a given operation More...
 

Additional Inherited Members

- Protected Attributes inherited from souffle::ast2ram::ClauseTranslator
int level = 0
 
AstToRamTranslatortranslator
 
Own< ValueIndexvalueIndex = mk<ValueIndex>()
 

Detailed Description

Definition at line 34 of file ProvenanceClauseTranslator.h.

Constructor & Destructor Documentation

◆ ProvenanceClauseTranslator()

souffle::ast2ram::ProvenanceClauseTranslator::ProvenanceClauseTranslator ( AstToRamTranslator translator)
inline

Definition at line 36 of file ProvenanceClauseTranslator.h.

Member Function Documentation

◆ createCondition()

Own< ram::Condition > souffle::ast2ram::ProvenanceClauseTranslator::createCondition ( const ast::Clause originalClause)
overrideprotectedvirtual

Reimplemented from souffle::ast2ram::ClauseTranslator.

Definition at line 37 of file ProvenanceClauseTranslator.cpp.

39  : clause.getBodyLiterals()) {

◆ createOperation()

Own< ram::Operation > souffle::ast2ram::ProvenanceClauseTranslator::createOperation ( const ast::Clause clause)
overrideprotectedvirtual

Reimplemented from souffle::ast2ram::ClauseTranslator.

Definition at line 41 of file ProvenanceClauseTranslator.cpp.

41  : atom->getArguments()) {
42  values.push_back(translator.translateValue(arg, *valueIndex));
43  }
44  } else if (auto neg = dynamic_cast<ast::ProvenanceNegation*>(lit)) {
45  size_t auxiliaryArity = translator.getEvaluationArity(neg->getAtom());
46  for (size_t i = 0; i < neg->getAtom()->getArguments().size() - auxiliaryArity; ++i) {
47  auto arg = neg->getAtom()->getArguments()[i];
48  values.push_back(translator.translateValue(arg, *valueIndex));
49  }
50  for (size_t i = 0; i < auxiliaryArity; ++i) {
51  values.push_back(mk<ram::SignedConstant>(-1));
52  }
53  } else if (auto neg = dynamic_cast<ast::Negation*>(lit)) {
54  for (ast::Argument* arg : neg->getAtom()->getArguments()) {
55  values.push_back(translator.translateValue(arg, *valueIndex));
56  }
57  } else if (auto con = dynamic_cast<ast::BinaryConstraint*>(lit)) {
58  values.push_back(translator.translateValue(con->getLHS(), *valueIndex));
59  values.push_back(translator.translateValue(con->getRHS(), *valueIndex));
60  }
61  }
62 
63  return mk<ram::SubroutineReturn>(std::move(values));
64 }
65 
66 } // namespace souffle::ast2ram

References souffle::ast2ram::AstToRamTranslator::translateValue(), souffle::ast2ram::ClauseTranslator::translator, and souffle::ast2ram::ClauseTranslator::valueIndex.

Here is the call graph for this function:

The documentation for this class was generated from the following files:
souffle::ast2ram::ClauseTranslator::ClauseTranslator
ClauseTranslator(AstToRamTranslator &translator)
Definition: ClauseTranslator.h:43
souffle::ast2ram::ClauseTranslator::translator
AstToRamTranslator & translator
Definition: ClauseTranslator.h:49
souffle::ast2ram::AstToRamTranslator::getEvaluationArity
size_t getEvaluationArity(const ast::Atom *atom) const
determine the auxiliary for relations
Definition: AstToRamTranslator.cpp:154
i
size_t i
Definition: json11.h:663
souffle::ast2ram::AstToRamTranslator::translateValue
Own< ram::Expression > translateValue(const ast::Argument *arg, const ValueIndex &index)
translate an AST argument to a RAM value
Definition: AstToRamTranslator.cpp:236
souffle::ast2ram::ClauseTranslator::valueIndex
Own< ValueIndex > valueIndex
Definition: ClauseTranslator.h:52