16#include "llvm/IR/Function.h"
17#include "llvm/Support/CommandLine.h"
24llvm::cl::opt<bool> RewriteEqualities(
26 llvm::cl::desc(
"Rewrite existing constraints when an equality with a "
27 "constant is added (default=true)"),
73bool ConstraintManager::rewriteConstraints(
ExprVisitor &visitor) {
78 for (
auto &ce : old) {
95 if (isa<ConstantExpr>(e))
98 std::map< ref<Expr>,
ref<Expr> > equalities;
101 if (
const EqExpr *ee = dyn_cast<EqExpr>(constraint)) {
102 if (isa<ConstantExpr>(ee->left)) {
103 equalities.insert(std::make_pair(ee->right,
123 assert(cast<ConstantExpr>(e)->isTrue() &&
124 "attempt to add invalid (false) constraint");
136 if (RewriteEqualities) {
143 if (isa<ConstantExpr>(be->
left)) {
164 : constraints(_constraints) {}
Action visitExprPost(const Expr &e) override
ExprReplaceVisitor2(const std::map< ref< Expr >, ref< Expr > > &_replacements)
const std::map< ref< Expr >, ref< Expr > > & replacements
Action visitExprPost(const Expr &e) override
ExprReplaceVisitor(const ref< Expr > &_src, const ref< Expr > &_dst)
Action visitExpr(const Expr &e) override
static ref< ConstantExpr > alloc(const llvm::APInt &v)
void addConstraintInternal(const ref< Expr > &constraint)
Add constraint to the set of constraints.
bool rewriteConstraints(ExprVisitor &visitor)
ConstraintSet & constraints
void addConstraint(const ref< Expr > &constraint)
static ref< Expr > simplifyExpr(const ConstraintSet &constraints, const ref< Expr > &expr)
ConstraintManager(ConstraintSet &constraints)
const_iterator constraint_iterator
constraints_ty constraints
void push_back(const ref< Expr > &e)
constraint_iterator end() const
constraint_iterator begin() const
size_t size() const noexcept
static Action changeTo(const ref< Expr > &expr)
static Action doChildren()
ref< Expr > visit(const ref< Expr > &e)
Class representing symbolic expressions.
virtual Kind getKind() const =0
llvm::cl::OptionCategory SolvingCat