10#ifndef KLEE_EXPRRANGEEVALUATOR_H
11#define KLEE_EXPRRANGEEVALUATOR_H
76 for (
const UpdateNode *un = ul.
head.get(); un; un = un->next.get()) {
77 T ui = evaluate(un->index);
79 if (ui.mustEqual(index)) {
80 return res.set_union(evaluate(un->value));
81 }
else if (ui.mayEqual(index)) {
82 res = res.set_union(evaluate(un->value));
83 if (res.isFullRange(8)) {
89 return res.set_union(getInitialReadRange(*ul.
root, index));
96 return T(cast<ConstantExpr>(e));
102 const ReadExpr *re = cast<ReadExpr>(e);
103 T index = evaluate(re->
index);
107 return evalRead(re->
updates, index);
112 T cond = evaluate(se->
cond);
114 if (cond.mustEqual(1)) {
116 }
else if (cond.mustEqual(0)) {
128 res = res.concat(evaluate(ep->
getKid(i)),8);
137 return evaluate(be->
left).add(evaluate(be->
right), width);
142 return evaluate(be->
left).sub(evaluate(be->
right), width);
147 return evaluate(be->
left).mul(evaluate(be->
right), width);
152 return evaluate(be->
left).udiv(evaluate(be->
right), width);
157 return evaluate(be->
left).sdiv(evaluate(be->
right), width);
162 return evaluate(be->
left).urem(evaluate(be->
right), width);
167 return evaluate(be->
left).srem(evaluate(be->
right), width);
174 return evaluate(be->
left).binaryAnd(evaluate(be->
right));
178 return evaluate(be->
left).binaryOr(evaluate(be->
right));
182 return evaluate(be->
left).binaryXor(evaluate(be->
right));
207 T left = evaluate(be->
left);
208 T right = evaluate(be->
right);
210 if (left.mustEqual(right)) {
212 }
else if (!left.mayEqual(right)) {
220 T left = evaluate(be->
left);
221 T right = evaluate(be->
right);
223 if (left.max() < right.min()) {
225 }
else if (left.min() >= right.max()) {
232 T left = evaluate(be->
left);
233 T right = evaluate(be->
right);
235 if (left.max() <= right.min()) {
237 }
else if (left.min() > right.max()) {
244 T left = evaluate(be->
left);
245 T right = evaluate(be->
right);
248 if (left.maxSigned(bits) < right.minSigned(bits)) {
250 }
else if (left.minSigned(bits) >= right.maxSigned(bits)) {
257 T left = evaluate(be->
left);
258 T right = evaluate(be->
right);
261 if (left.maxSigned(bits) <= right.minSigned(bits)) {
263 }
else if (left.minSigned(bits) > right.maxSigned(bits)) {
274 assert(0 &&
"invalid expressions (uncanonicalized)");
T evaluate(const ref< Expr > &e)
T evalRead(const UpdateList &ul, T index)
virtual T getInitialReadRange(const Array &os, T index)=0
virtual ~ExprRangeEvaluator()
Class representing symbolic expressions.
virtual Kind getKind() const =0
virtual Width getWidth() const =0
virtual unsigned getNumKids() const =0
@ Sge
Not used in canonical form.
@ Ne
Not used in canonical form.
@ Ugt
Not used in canonical form.
@ Sgt
Not used in canonical form.
@ Uge
Not used in canonical form.
virtual ref< Expr > getKid(unsigned i) const =0
Class representing a one byte read from an array.
Class representing an if-then-else expression.
Class representing a complete list of updates into an array.
ref< UpdateNode > head
pointer to the most recent update node
Class representing a byte update of an array.
uint64_t maxValueOfNBits(unsigned N)