17const char *Solver::validity_to_str(
Validity v) {
19 default:
return "Unknown";
20 case True:
return "True";
21 case False:
return "False";
54 result = CE->isTrue() ? true :
false;
93 result = cast<ConstantExpr>(tmp);
99 const std::vector<const Array*> &objects,
100 std::vector< std::vector<unsigned char> > &values) {
119 assert(0 &&
"computeValidity failed");
122 min = max = 1;
break;
124 min = max = 0;
break;
126 min = 0, max = 1;
break;
128 }
else if (
ConstantExpr *CE = dyn_cast<ConstantExpr>(e)) {
129 min = max = CE->getZExtValue();
132 uint64_t lo=0, hi=width, mid, bits=0;
134 mid = lo + (hi - lo)/2;
138 EqExpr::create(LShrExpr::create(e,
144 assert(success &&
"FIXME: Unhandled solver failure");
166 assert(success &&
"FIXME: Unhandled solver failure");
175 mid = lo + (hi - lo)/2;
183 assert(success &&
"FIXME: Unhandled solver failure");
199 mid = lo + (hi - lo)/2;
207 assert(success &&
"FIXME: Unhandled solver failure");
225 llvm::errs() <<
"Constraints [\n";
229 llvm::errs() <<
"]\n";
230 llvm::errs() <<
"Query [\n";
232 llvm::errs() <<
"]\n";
static ref< ConstantExpr > create(uint64_t v, Width w)
virtual Width getWidth() const =0
unsigned Width
The type of an expression is simply its width, in bits.
void dump() const
dump - Print the expression to stderr.
virtual void setCoreSolverTimeout(time::Span timeout)
virtual bool computeTruth(const Query &query, bool &isValid)=0
virtual bool computeInitialValues(const Query &query, const std::vector< const Array * > &objects, std::vector< std::vector< unsigned char > > &values, bool &hasSolution)=0
virtual bool computeValue(const Query &query, ref< Expr > &result)=0
virtual char * getConstraintLog(const Query &query)
virtual bool computeValidity(const Query &query, Solver::Validity &result)
bool evaluate(const Query &, Validity &result)
bool mayBeTrue(const Query &, bool &result)
bool mustBeTrue(const Query &, bool &result)
bool getValue(const Query &, ref< ConstantExpr > &result)
bool mayBeFalse(const Query &, bool &result)
bool getInitialValues(const Query &, const std::vector< const Array * > &objects, std::vector< std::vector< unsigned char > > &result)
bool mustBeFalse(const Query &, bool &result)
virtual void setCoreSolverTimeout(time::Span timeout)
virtual std::pair< ref< Expr >, ref< Expr > > getRange(const Query &)
virtual char * getConstraintLog(const Query &query)
uint64_t maxValueOfNBits(unsigned N)
Query withExpr(ref< Expr > _expr) const
withExpr - Return a copy of the query with the given expression.
const ConstraintSet & constraints
void dump() const
Dump query.
Query negateExpr() const
negateExpr - Return a copy of the query with the expression negated.