diff options
author | Martin Nowack <m.nowack@imperial.ac.uk> | 2019-04-01 14:08:43 +0100 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2020-07-01 15:52:40 +0100 |
commit | 8a0f1af7500e10dadd97300f242424917d2e9902 (patch) | |
tree | 48d86b5a1dca9513e4bd1ba8a96441adc0be5169 /lib/Core/SpecialFunctionHandler.cpp | |
parent | da5d238b5a78b54f89728132d71cfa6f8be16d21 (diff) | |
download | klee-8a0f1af7500e10dadd97300f242424917d2e9902.tar.gz |
Use constraint sets and separate metadata for timing solver invocation
Decouple ExecutionState from TimingSolver Instead of providing an execution state to the timing solver use a set of constraints and an additional object for metadata. Fixes: * correct accounting of metadata to a specific state * accounting of all solver invocations (e.g. solver-getRange was not accounted) * allows to invoke the solver without a state (avoids costly copying of states/constraints)
Diffstat (limited to 'lib/Core/SpecialFunctionHandler.cpp')
-rw-r--r-- | lib/Core/SpecialFunctionHandler.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/lib/Core/SpecialFunctionHandler.cpp b/lib/Core/SpecialFunctionHandler.cpp index d6429883..57f059a4 100644 --- a/lib/Core/SpecialFunctionHandler.cpp +++ b/lib/Core/SpecialFunctionHandler.cpp @@ -249,7 +249,6 @@ SpecialFunctionHandler::readStringAtAddress(ExecutionState &state, Executor::TerminateReason::User); return ""; } - const MemoryObject *mo = op.first; const ObjectState *os = op.second; @@ -430,7 +429,8 @@ void SpecialFunctionHandler::handleMemalign(ExecutionState &state, } std::pair<ref<Expr>, ref<Expr>> alignmentRangeExpr = - executor.solver->getRange(state, arguments[0]); + executor.solver->getRange(state.constraints, arguments[0], + state.queryMetaData); ref<Expr> alignmentExpr = alignmentRangeExpr.first; auto alignmentConstExpr = dyn_cast<ConstantExpr>(alignmentExpr); @@ -464,7 +464,8 @@ void SpecialFunctionHandler::handleAssume(ExecutionState &state, e = NeExpr::create(e, ConstantExpr::create(0, e->getWidth())); bool res; - bool success __attribute__ ((unused)) = executor.solver->mustBeFalse(state, e, res); + bool success __attribute__((unused)) = executor.solver->mustBeFalse( + state.constraints, e, res, state.queryMetaData); assert(success && "FIXME: Unhandled solver failure"); if (res) { if (SilentKleeAssume) { @@ -579,19 +580,20 @@ void SpecialFunctionHandler::handlePrintRange(ExecutionState &state, if (!isa<ConstantExpr>(arguments[1])) { // FIXME: Pull into a unique value method? ref<ConstantExpr> value; - bool success __attribute__ ((unused)) = executor.solver->getValue(state, arguments[1], value); + bool success __attribute__((unused)) = executor.solver->getValue( + state.constraints, arguments[1], value, state.queryMetaData); assert(success && "FIXME: Unhandled solver failure"); bool res; - success = executor.solver->mustBeTrue(state, - EqExpr::create(arguments[1], value), - res); + success = executor.solver->mustBeTrue(state.constraints, + EqExpr::create(arguments[1], value), + res, state.queryMetaData); assert(success && "FIXME: Unhandled solver failure"); if (res) { llvm::errs() << " == " << value; } else { llvm::errs() << " ~= " << value; - std::pair< ref<Expr>, ref<Expr> > res = - executor.solver->getRange(state, arguments[1]); + std::pair<ref<Expr>, ref<Expr>> res = executor.solver->getRange( + state.constraints, arguments[1], state.queryMetaData); llvm::errs() << " (in [" << res.first << ", " << res.second <<"])"; } } @@ -812,12 +814,12 @@ void SpecialFunctionHandler::handleMakeSymbolic(ExecutionState &state, // FIXME: Type coercion should be done consistently somewhere. bool res; - bool success __attribute__ ((unused)) = - executor.solver->mustBeTrue(*s, - EqExpr::create(ZExtExpr::create(arguments[1], - Context::get().getPointerWidth()), - mo->getSizeExpr()), - res); + bool success __attribute__((unused)) = executor.solver->mustBeTrue( + s->constraints, + EqExpr::create( + ZExtExpr::create(arguments[1], Context::get().getPointerWidth()), + mo->getSizeExpr()), + res, s->queryMetaData); assert(success && "FIXME: Unhandled solver failure"); if (res) { |