diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2016-01-07 12:00:25 +0000 |
---|---|---|
committer | Dan Liew <daniel.liew@imperial.ac.uk> | 2016-01-12 11:40:39 +0000 |
commit | e81f5ceed580d4d267e3c857b47637d6bd065499 (patch) | |
tree | eb9f3b74b036a59edd1164bc68e9e00d5156936d /lib/Core | |
parent | 9da07ca0ccc58286f8247bc2e7d7745abfa0cc54 (diff) | |
download | klee-e81f5ceed580d4d267e3c857b47637d6bd065499.tar.gz |
Refactor setting the core solver (i.e. STP, MetaSMT or DummySolver) by providing
a ``createCoreSolver()`` function. The solver used is set by the new ``--solver-backend`` command line argument. The default is STP. This change necessitated refactoring the MetaSMT stuff. That clearly didn't belong in the Executor! The MetaSMT command line option is now ``--metasmt-backend`` as this only picks the MetaSMT backend. In order to use MetaSMT ``--solver-backend=metasmt`` needs to be passed. Note I don't have MetaSMT built on my development machine so I don't know if the MetaSMT stuff even compiles...
Diffstat (limited to 'lib/Core')
-rw-r--r-- | lib/Core/Executor.cpp | 78 |
1 files changed, 12 insertions, 66 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index 9211f485..854754b0 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -107,29 +107,6 @@ using namespace llvm; using namespace klee; -#ifdef SUPPORT_METASMT - -#include <metaSMT/frontend/Array.hpp> -#include <metaSMT/backend/Z3_Backend.hpp> -#include <metaSMT/backend/Boolector.hpp> -#include <metaSMT/backend/MiniSAT.hpp> -#include <metaSMT/DirectSolver_Context.hpp> -#include <metaSMT/support/run_algorithm.hpp> -#include <metaSMT/API/Stack.hpp> -#include <metaSMT/API/Group.hpp> - -#define Expr VCExpr -#define Type VCType -#define STP STP_Backend -#include <metaSMT/backend/STP.hpp> -#undef Expr -#undef Type -#undef STP - -using namespace metaSMT; -using namespace metaSMT::solver; - -#endif /* SUPPORT_METASMT */ @@ -293,50 +270,19 @@ Executor::Executor(const InterpreterOptions &opts, : std::max(MaxCoreSolverTime,MaxInstructionTime)) { if (coreSolverTimeout) UseForkedCoreSolver = true; - - Solver *coreSolver = NULL; - -#ifdef SUPPORT_METASMT - if (UseMetaSMT != METASMT_BACKEND_NONE) { - - std::string backend; - - switch (UseMetaSMT) { - case METASMT_BACKEND_STP: - backend = "STP"; - coreSolver = new MetaSMTSolver< DirectSolver_Context < STP_Backend > >(UseForkedCoreSolver, CoreSolverOptimizeDivides); - break; - case METASMT_BACKEND_Z3: - backend = "Z3"; - coreSolver = new MetaSMTSolver< DirectSolver_Context < Z3_Backend > >(UseForkedCoreSolver, CoreSolverOptimizeDivides); - break; - case METASMT_BACKEND_BOOLECTOR: - backend = "Boolector"; - coreSolver = new MetaSMTSolver< DirectSolver_Context < Boolector > >(UseForkedCoreSolver, CoreSolverOptimizeDivides); - break; - default: - assert(false); - break; - }; - llvm::errs() << "Starting MetaSMTSolver(" << backend << ") ...\n"; - } - else { - coreSolver = new STPSolver(UseForkedCoreSolver, CoreSolverOptimizeDivides); - } -#else - coreSolver = new STPSolver(UseForkedCoreSolver, CoreSolverOptimizeDivides); -#endif /* SUPPORT_METASMT */ - - - Solver *solver = - constructSolverChain(coreSolver, - interpreterHandler->getOutputFilename(ALL_QUERIES_SMT2_FILE_NAME), - interpreterHandler->getOutputFilename(SOLVER_QUERIES_SMT2_FILE_NAME), - interpreterHandler->getOutputFilename(ALL_QUERIES_PC_FILE_NAME), - interpreterHandler->getOutputFilename(SOLVER_QUERIES_PC_FILE_NAME)); - - this->solver = new TimingSolver(solver, EqualitySubstitution); + Solver *coreSolver = klee::createCoreSolver(CoreSolverToUse); + if (!coreSolver) { + llvm::errs() << "Failed to create core solver\n"; + exit(1); + } + Solver *solver = constructSolverChain( + coreSolver, + interpreterHandler->getOutputFilename(ALL_QUERIES_SMT2_FILE_NAME), + interpreterHandler->getOutputFilename(SOLVER_QUERIES_SMT2_FILE_NAME), + interpreterHandler->getOutputFilename(ALL_QUERIES_PC_FILE_NAME), + interpreterHandler->getOutputFilename(SOLVER_QUERIES_PC_FILE_NAME)); + this->solver = new TimingSolver(solver, EqualitySubstitution); memory = new MemoryManager(&arrayCache); } |