#include <Expr.h>

Classes | |
| struct | CreateArg |
Public Types | |
| enum | Kind { InvalidKind = -1, Constant = 0, NotOptimized, Read = NotOptimized+2, Select, Concat, Extract, ZExt, SExt, Add, Sub, Mul, UDiv, SDiv, URem, SRem, And, Or, Xor, Shl, LShr, AShr, Eq, Ne, Ult, Ule, Ugt, Uge, Slt, Sle, Sgt, Sge, LastKind = Sge, CastKindFirst = ZExt, CastKindLast = SExt, BinaryKindFirst = Add, BinaryKindLast = Sge, CmpKindFirst = Eq, CmpKindLast = Sge } |
| typedef unsigned | Width |
| The type of an expression is simply its width, in bits. | |
Public Member Functions | |
| Expr () | |
| virtual | ~Expr () |
| virtual Kind | getKind () const =0 |
| virtual Width | getWidth () const =0 |
| virtual unsigned | getNumKids () const =0 |
| virtual ref< Expr > | getKid (unsigned i) const =0 |
| virtual void | print (std::ostream &os) const |
| virtual unsigned | hash () const |
| Returns the pre-computed hash of the current expression. | |
| virtual unsigned | computeHash () |
| int | compare (const Expr &b) const |
| Returns 0 iff b is structuraly equivalent to *this. | |
| virtual int | compareContents (const Expr &b) const |
| virtual ref< Expr > | rebuild (ref< Expr > kids[]) const =0 |
| bool | isZero () const |
| isZero - Is this a constant zero. | |
| bool | isTrue () const |
| isTrue - Is this the true expression. | |
| bool | isFalse () const |
| isFalse - Is this the false expression. | |
Static Public Member Functions | |
| static void | printKind (std::ostream &os, Kind k) |
| static void | printWidth (std::ostream &os, Expr::Width w) |
| static Width | getWidthForLLVMType (const llvm::Type *type) |
| static unsigned | getMinBytesForWidth (Width w) |
| returns the smallest number of bytes in which the given width fits | |
| static ref< Expr > | createCoerceToPointerType (ref< Expr > e) |
| static ref< Expr > | createNot (ref< Expr > e) |
| static ref< Expr > | createImplies (ref< Expr > hyp, ref< Expr > conc) |
| static ref< Expr > | createIsZero (ref< Expr > e) |
| static ref< Expr > | createTempRead (const Array *array, Expr::Width w) |
| static ref< Expr > | createPointer (uint64_t v) |
| static ref< Expr > | createFromKind (Kind k, std::vector< CreateArg > args) |
| static bool | isValidKidWidth (unsigned kid, Width w) |
| static bool | needsResultType () |
| static bool | classof (const Expr *) |
Public Attributes | |
| unsigned | refCount |
Static Public Attributes | |
| static unsigned | count = 0 |
| static const unsigned | MAGIC_HASH_CONSTANT = 39 |
| static const Width | InvalidWidth = 0 |
| static const Width | Bool = 1 |
| static const Width | Int8 = 8 |
| static const Width | Int16 = 16 |
| static const Width | Int32 = 32 |
| static const Width | Int64 = 64 |
Protected Attributes | |
| unsigned | hashValue |
Expression canonicalization: we define certain rules for canonicalization rules for Exprs in order to simplify code that pattern matches Exprs (since the number of forms are reduced), to open up further chances for optimization, and to increase similarity for caching and other purposes.
The general rules are:
(false == ?) Ne, Ugt, Uge, Sgt, Sge are not used And, Or, Xor, Eq, as well as SExt, ZExt, Select and NotOptimized. == false).
add(-c, ?).
Steps required for adding an expr:
Todo: Shouldn't bool Xor just be written as not equal?
Definition at line 85 of file Expr.h.
| typedef unsigned klee::Expr::Width |
| enum klee::Expr::Kind |
| virtual klee::Expr::~Expr | ( | ) | [inline, virtual] |
| static bool klee::Expr::classof | ( | const Expr * | ) | [inline, static] |
Reimplemented in klee::ConstantExpr, klee::BinaryExpr, klee::CmpExpr, klee::NotOptimizedExpr, klee::ReadExpr, klee::SelectExpr, klee::ConcatExpr, klee::ExtractExpr, and klee::CastExpr.
| int Expr::compare | ( | const Expr & | b | ) | const |
Returns 0 iff b is structuraly equivalent to *this.
Definition at line 87 of file Expr.cpp.
References compareContents(), getKid(), getKind(), getNumKids(), and hashValue.
Referenced by klee::operator<(), and klee::operator==().


| virtual int klee::Expr::compareContents | ( | const Expr & | b | ) | const [inline, virtual] |
Reimplemented in klee::ConstantExpr, klee::ReadExpr, klee::ExtractExpr, and klee::CastExpr.
Definition at line 192 of file Expr.h.
Referenced by compare().

| unsigned Expr::computeHash | ( | ) | [virtual] |
(Re)computes the hash of the current expression. Returns the hash value.
Reimplemented in klee::ConstantExpr, klee::ReadExpr, klee::ExtractExpr, and klee::CastExpr.
Definition at line 154 of file Expr.cpp.
References getKid(), getKind(), getNumKids(), hashValue, and MAGIC_HASH_CONSTANT.

Definition at line 310 of file Expr.cpp.
References kMachinePointerType.
Referenced by klee::Executor::bindInstructionConstants(), klee::Executor::evalConstantExpr(), and klee::Executor::executeInstruction().

Definition at line 192 of file Expr.cpp.
References Add, And, AShr, BINARY_EXPR_CASE, CAST_EXPR_CASE, Concat, Constant, klee::ConcatExpr::create(), klee::SelectExpr::create(), klee::NotOptimizedExpr::create(), Eq, Extract, LShr, Mul, Ne, NotOptimized, Or, Read, SDiv, Select, SExt, Sge, Sgt, Shl, Sle, Slt, SRem, Sub, UDiv, Uge, Ugt, Ule, Ult, URem, Xor, and ZExt.

Definition at line 302 of file Expr.cpp.
References createNot().

Definition at line 306 of file Expr.cpp.
References klee::ConstantExpr::create().
Referenced by createNot(), and klee::Executor::executeFree().


Definition at line 314 of file Expr.cpp.
References createIsZero().
Referenced by klee::SelectExpr::create(), createImplies(), EqExpr_createPartialR(), klee::Executor::executeInstruction(), klee::Executor::fork(), klee::Executor::getSymbolicSolution(), LShrExpr_create(), klee::TimingSolver::mustBeFalse(), klee::Query::negateExpr(), and ShlExpr_create().


Definition at line 318 of file Expr.cpp.
References klee::ConstantExpr::create(), and kMachinePointerType.
Referenced by klee::Executor::bindInstructionConstants(), klee::Executor::evalConstantExpr(), klee::Executor::executeFree(), klee::Executor::executeInstruction(), and klee::Executor::initializeGlobals().


| ref< Expr > Expr::createTempRead | ( | const Array * | array, | |
| Expr::Width | w | |||
| ) | [static] |
Create a little endian read of the given type at offset 0 of the given object.
Definition at line 40 of file Expr.cpp.
References klee::ConstantExpr::alloc(), Bool, klee::ConcatExpr::create(), klee::ReadExpr::create(), klee::ConcatExpr::create4(), klee::ConcatExpr::create8(), Int16, Int32, Int64, Int8, and kMachinePointerType.
Referenced by klee::Executor::replaceReadWithSymbolic().


Implemented in klee::ConstantExpr, klee::BinaryExpr, klee::NotOptimizedExpr, klee::ReadExpr, klee::SelectExpr, klee::ConcatExpr, klee::ExtractExpr, and klee::CastExpr.
Referenced by AddExpr_create(), AddExpr_createPartialR(), compare(), computeHash(), klee::ExprRangeEvaluator< T >::evaluate(), klee::findReads(), PPrinter::hasSimpleKids(), PPrinter::isSimple(), PPrinter::printExpr(), PPrinter::scan1(), SubExpr_create(), SubExpr_createPartialR(), and klee::ExprVisitor::visitActual().

| virtual Kind klee::Expr::getKind | ( | ) | const [pure virtual] |
Implemented in klee::ConstantExpr, klee::NotOptimizedExpr, klee::ReadExpr, klee::SelectExpr, klee::ConcatExpr, and klee::ExtractExpr.
Referenced by AddExpr_create(), AddExpr_createPartialR(), klee::CastExpr::classof(), klee::ExtractExpr::classof(), klee::ConcatExpr::classof(), klee::SelectExpr::classof(), klee::ReadExpr::classof(), klee::NotOptimizedExpr::classof(), klee::CmpExpr::classof(), klee::BinaryExpr::classof(), klee::ConstantExpr::classof(), compare(), computeHash(), EqExpr_createPartialR(), SubExpr_create(), SubExpr_createPartialR(), and klee::ExprVisitor::visitActual().

| static unsigned klee::Expr::getMinBytesForWidth | ( | Width | w | ) | [inline, static] |
returns the smallest number of bytes in which the given width fits
Definition at line 216 of file Expr.h.
Referenced by klee::Executor::executeMemoryOperation(), and klee::Executor::replaceReadWithSymbolic().

| virtual unsigned klee::Expr::getNumKids | ( | ) | const [pure virtual] |
Implemented in klee::ConstantExpr, klee::BinaryExpr, klee::NotOptimizedExpr, klee::ReadExpr, klee::SelectExpr, klee::ConcatExpr, klee::ExtractExpr, and klee::CastExpr.
Referenced by compare(), computeHash(), klee::ExprRangeEvaluator< T >::evaluate(), klee::findReads(), PPrinter::hasSimpleKids(), PPrinter::isSimple(), PPrinter::printExpr(), PPrinter::scan1(), and klee::ExprVisitor::visitActual().

| virtual Width klee::Expr::getWidth | ( | ) | const [pure virtual] |
Implemented in klee::ConstantExpr, klee::CmpExpr, klee::NotOptimizedExpr, klee::ReadExpr, klee::SelectExpr, klee::ConcatExpr, klee::ExtractExpr, and klee::CastExpr.
Referenced by _getImpliedValue(), AddExpr_create(), CexData::forceExprToRange(), MulExpr_create(), and SubExpr_create().

| Expr::Width Expr::getWidthForLLVMType | ( | const llvm::Type * | type | ) | [static] |
Definition at line 279 of file Expr.cpp.
References Int32, Int64, and kMachinePointerType.
Referenced by klee::Executor::evalConstantExpr(), klee::Executor::executeInstruction(), and klee::Executor::executeMemoryOperation().

| virtual unsigned klee::Expr::hash | ( | ) | const [inline, virtual] |
| bool klee::Expr::isFalse | ( | ) | const [inline] |
| bool klee::Expr::isTrue | ( | ) | const [inline] |
| static bool klee::Expr::isValidKidWidth | ( | unsigned | kid, | |
| Width | w | |||
| ) | [inline, static] |
| bool klee::Expr::isZero | ( | ) | const [inline] |
| static bool klee::Expr::needsResultType | ( | ) | [inline, static] |
| void Expr::print | ( | std::ostream & | os | ) | const [virtual] |
Definition at line 322 of file Expr.cpp.
References klee::ExprPPrinter::printSingleExpr().
Referenced by klee::operator<<().


| void Expr::printKind | ( | std::ostream & | os, | |
| Kind | k | |||
| ) | [static] |
Definition at line 108 of file Expr.cpp.
References Add, And, AShr, Concat, Constant, Eq, Extract, LShr, Mul, Ne, NotOptimized, Or, Read, SDiv, Select, SExt, Sge, Sgt, Shl, Sle, Slt, SRem, Sub, UDiv, Uge, Ugt, Ule, Ult, URem, X, Xor, and ZExt.
Referenced by klee::operator<<().

| void Expr::printWidth | ( | std::ostream & | os, | |
| Expr::Width | w | |||
| ) | [static] |
Implemented in klee::ConstantExpr, klee::NotOptimizedExpr, klee::ReadExpr, klee::SelectExpr, klee::ConcatExpr, and klee::ExtractExpr.
Referenced by klee::ExprEvaluator::protectedDivOperation(), and klee::ExprVisitor::visitActual().

const Width klee::Expr::Bool = 1 [static] |
Definition at line 94 of file Expr.h.
Referenced by klee::Executor::addConstraint(), AddExpr_create(), AddExpr_createPartialR(), AShrExpr_create(), klee::SelectExpr::create(), createTempRead(), EqExpr_create(), EqExpr_createPartialR(), klee::Solver::evaluate(), klee::Executor::executeInstruction(), klee::ConstantExpr::fromMemory(), klee::MemoryObject::getBoundsCheckOffset(), klee::Executor::getConstraintLog(), klee::TimingSolver::getInitialValues(), klee::Executor::getSymbolicSolution(), klee::CmpExpr::getWidth(), isFalse(), isTrue(), klee::SelectExpr::isValidKidWidth(), LShrExpr_create(), klee::ExecutionState::merge(), MulExpr_create(), MulExpr_createPartialR(), klee::Solver::mustBeTrue(), klee::ExprPPrinter::printConstraints(), printWidth(), klee::ObjectState::read(), klee::ObjectState::read1(), SDivExpr_create(), ShlExpr_create(), klee::ConstraintManager::simplifyExpr(), SRemExpr_create(), SubExpr_create(), SubExpr_createPartialR(), klee::ConstantExpr::toMemory(), TryConstArrayOpt(), UDivExpr_create(), URemExpr_create(), klee::Query::withFalse(), klee::ObjectState::write(), and XorExpr_createPartialR().
unsigned Expr::count = 0 [static] |
unsigned klee::Expr::hashValue [protected] |
Definition at line 169 of file Expr.h.
Referenced by compare(), klee::ReadExpr::computeHash(), klee::ExtractExpr::computeHash(), klee::CastExpr::computeHash(), klee::ConstantExpr::computeHash(), computeHash(), and hash().
const Width klee::Expr::Int16 = 16 [static] |
Definition at line 96 of file Expr.h.
Referenced by createTempRead(), klee::ConstantExpr::fromMemory(), klee::STPBuilder::getTempVar(), printWidth(), klee::ObjectState::read(), klee::ConstantExpr::toMemory(), and klee::ObjectState::write().
const Width klee::Expr::Int32 = 32 [static] |
Definition at line 97 of file Expr.h.
Referenced by createTempRead(), klee::ExprEvaluator::evalRead(), klee::Assignment::evaluate(), klee::Executor::executeAlloc(), klee::ConstantExpr::fromMemory(), klee::STPBuilder::getTempVar(), getWidthForLLVMType(), klee::SeedInfo::patchSeed(), printWidth(), klee::ObjectState::read(), klee::ConstantExpr::toMemory(), and klee::ObjectState::write().
const Width klee::Expr::Int64 = 64 [static] |
Definition at line 98 of file Expr.h.
Referenced by createTempRead(), klee::ConstantExpr::fromMemory(), klee::STPBuilder::getTempVar(), getWidthForLLVMType(), printWidth(), klee::ObjectState::read(), klee::ConstantExpr::toMemory(), and klee::ObjectState::write().
const Width klee::Expr::Int8 = 8 [static] |
Definition at line 95 of file Expr.h.
Referenced by createTempRead(), klee::ExprRangeEvaluator< T >::evaluate(), klee::Assignment::evaluate(), klee::ObjectState::flushRangeForRead(), klee::ObjectState::flushRangeForWrite(), klee::ConstantExpr::fromMemory(), klee::STPBuilder::getTempVar(), klee::ReadExpr::getWidth(), klee::SeedInfo::patchSeed(), printWidth(), klee::ObjectState::read(), klee::ObjectState::read8(), klee::ConstantExpr::toMemory(), klee::UpdateNode::UpdateNode(), klee::ObjectState::write(), and klee::ObjectState::write1().
const Width klee::Expr::InvalidWidth = 0 [static] |
const unsigned klee::Expr::MAGIC_HASH_CONSTANT = 39 [static] |
Definition at line 88 of file Expr.h.
Referenced by klee::ReadExpr::computeHash(), klee::ExtractExpr::computeHash(), klee::CastExpr::computeHash(), klee::ConstantExpr::computeHash(), computeHash(), and klee::UpdateList::hash().
| unsigned klee::Expr::refCount |
1.5.8