#include <BindingStore.h>
Definition at line 38 of file BindingStore.h.
◆ ConjBindingSet
◆ DisjBindingSet
◆ BindingStore()
souffle::ast::BindingStore::BindingStore |
( |
const Clause * |
clause | ) |
|
◆ addBindingDependency()
void souffle::ast::BindingStore::addBindingDependency |
( |
std::string |
variable, |
|
|
ConjBindingSet |
dependency |
|
) |
| |
|
inlineprivate |
Add a new conjunction of variables as a potential binder for a given variable.
The variable is considered bound if all variables in the conjunction are bound.
Definition at line 94 of file BindingStore.h.
◆ bindVariableStrongly()
void souffle::ast::BindingStore::bindVariableStrongly |
( |
std::string |
varName | ) |
|
|
inline |
Mark the given variable as strongly bound.
Strongly bound variables can be used to bind functor arguments. This is the usual case, e.g. body atom appearances
Definition at line 54 of file BindingStore.h.
◆ bindVariableWeakly()
void souffle::ast::BindingStore::bindVariableWeakly |
( |
std::string |
varName | ) |
|
|
inline |
◆ generateBindingDependencies()
void souffle::ast::BindingStore::generateBindingDependencies |
( |
const Clause * |
clause | ) |
|
|
private |
Generate all binding dependencies implied by the constraints within a given clause.
Definition at line 47 of file BindingStore.cpp.
52 : relevantEqConstraints) {
60 const auto* var =
dynamic_cast<const Variable*
>(
lhs);
61 if (var ==
nullptr)
return;
◆ isBound() [1/2]
bool souffle::ast::BindingStore::isBound |
( |
const Argument * |
arg | ) |
const |
Check if an argument is bound.
Definition at line 149 of file BindingStore.cpp.
161 for (
const auto* arg : atom->getArguments()) {
◆ isBound() [2/2]
bool souffle::ast::BindingStore::isBound |
( |
std::string |
varName | ) |
const |
|
inline |
◆ numBoundArguments()
size_t souffle::ast::BindingStore::numBoundArguments |
( |
const Atom * |
atom | ) |
const |
Counts the number of bound arguments in the given atom.
Definition at line 166 of file BindingStore.cpp.
◆ processEqualityBindings()
void souffle::ast::BindingStore::processEqualityBindings |
( |
const Argument * |
lhs, |
|
|
const Argument * |
rhs |
|
) |
| |
|
private |
Add binding dependencies formed on lhs by a <lhs> = <rhs> equality constraint.
Definition at line 65 of file BindingStore.cpp.
65 { depSet.insert(subVar.getName()); });
69 if (
const auto* rec =
dynamic_cast<const RecordInit*
>(
rhs)) {
70 for (
const auto* arg : rec->getArguments()) {
71 const auto* subVar =
dynamic_cast<const Variable*
>(arg);
72 assert(subVar !=
nullptr &&
"expected args to be variables");
81 for (
const auto& var : origDependency) {
◆ reduceDependencies()
bool souffle::ast::BindingStore::reduceDependencies |
( |
| ) |
|
|
private |
Reduce the full set of dependencies for all tracked variables, binding whatever needs to be bound.
Definition at line 109 of file BindingStore.cpp.
117 if (newDependencies.empty() || newDependencies.size() < dependencies.size()) {
120 variablesToBind.insert(headVar);
123 newVariableDependencies[headVar] = newDependencies;
124 changed |= (newDependencies != dependencies);
128 for (
auto var : variablesToBind) {
143 if (
const auto* var =
dynamic_cast<const Variable*
>(arg)) {
144 return isBound(var->getName());
145 }
else if (
const auto* term =
dynamic_cast<const Term*
>(arg)) {
146 for (
const auto* subArg : term->getArguments()) {
◆ reduceDependency() [1/2]
Reduce a conjunctive set of dependencies based on the current bound variable set.
Definition at line 85 of file BindingStore.cpp.
93 for (
const auto& dep : origDependency) {
95 if (!newDep.empty()) {
◆ reduceDependency() [2/2]
Reduce a disjunctive set of variable dependencies based on the current bound variable set.
Definition at line 97 of file BindingStore.cpp.
103 bool changed =
false;
104 std::map<std::string, BindingStore::DisjBindingSet> newVariableDependencies;
105 std::set<std::string> variablesToBind;
◆ stronglyBoundVariables
std::set<std::string> souffle::ast::BindingStore::stronglyBoundVariables {} |
|
private |
◆ variableDependencies
std::map<std::string, DisjBindingSet> souffle::ast::BindingStore::variableDependencies {} |
|
private |
◆ weaklyBoundVariables
std::set<std::string> souffle::ast::BindingStore::weaklyBoundVariables {} |
|
private |
The documentation for this class was generated from the following files:
void visitDepthFirst(const Node &root, Visitor< R, Ps... > &visitor, Args &... args)
A utility function visiting all nodes within the ast rooted by the given node recursively in a depth-...