souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
38 template <
typename PropertySpace>
39 struct ConstraintAnalysisVar :
public Variable<const Argument*, PropertySpace> {
44 void print(std::ostream& out)
const override {
45 out <<
"var(" << *(this->
id) <<
")";
57 template <
typename AnalysisVar>
60 using value_type =
typename AnalysisVar::property_space::value_type;
81 if (debugOutput !=
nullptr) {
82 *debugOutput <<
"Clause: " << clause <<
"\n";
83 *debugOutput <<
"Problem:\n" <<
constraints <<
"\n";
84 *debugOutput <<
"Solution:\n" <<
assignment <<
"\n";
100 AnalysisVar
getVar(
const Argument& arg) {
102 if (var ==
nullptr) {
104 return AnalysisVar(arg);
108 auto res =
variables.insert({var->getName(), AnalysisVar(var)}).first;
A base class for ConstraintAnalysis collecting constraints for an analysis by visiting every node of ...
ConstraintAnalysisVar(const Argument *arg)
The generic base type of all AstVisitors realizing the dispatching of visitor calls.
AnalysisVar getVar(const Argument &arg)
A utility function mapping an Argument to its associated analysis variable.
Assignment< AnalysisVar > assignment
Intermediate representation of a horn clause.
A variable to be utilized within constraints to be handled by the constraint solver.
An abstract class for arguments.
const Argument * id
the underlying value giving this variable its identity
std::map< std::string, AnalysisVar > variables
A map mapping variables to unique instances to facilitate the unification of variables.
void addConstraint(const constraint_type &constraint)
Adds another constraint to the internally maintained list of constraints.
std::map< const Argument *, value_type > solution_type
Variable(const Argument * id)
void visitDepthFirstPreOrder(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-...
virtual void collectConstraints(const Clause &clause)
solution_type analyse(const Clause &clause, std::ostream *debugOutput=nullptr)
Runs this constraint analysis on the given clause.
typename AnalysisVar::property_space::value_type value_type
void print(std::ostream &out) const override
adds print support
std::shared_ptr< Constraint< AnalysisVar > > constraint_type
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-...
Problem< AnalysisVar > constraints
The list of constraints making underlying this analysis.
void add(const constraint_ptr &constraint)
Adds another constraint to the internally maintained list of constraints.
Assignment< Var > solve() const
Computes a solution (minimum fixpoint) for the contained list of constraints.