20#include "llvm/ADT/ArrayRef.h"
21#include "llvm/ADT/StringMap.h"
22#include "llvm/Support/CommandLine.h"
29 "\nTime format used by KLEE's options\n"
31 " Time spans can be specified in two ways:\n"
32 " 1. As positive real numbers representing seconds, e.g. '10', '3.5' "
33 "but not 'INF', 'NaN', '1e3', '-4.5s'\n"
34 " 2. As a sequence of natural numbers with specified units, e.g. "
35 "'1h10min' (= '70min'), '5min10s' but not '3.5min', '8S'\n"
36 " The following units are supported: h, min, s, ms, us, ns.\n");
38cl::OptionCategory
SolvingCat(
"Constraint solving options",
39 "These options impact constraint solving.");
42 "use-fast-cex-solver", cl::init(
false),
43 cl::desc(
"Enable an experimental range-based solver (default=false)"),
47 cl::desc(
"Use the counterexample cache (default=true)"),
51 cl::desc(
"Use the branch cache (default=true)"),
56 cl::desc(
"Use constraint independence (default=true)"),
60 "debug-validate-solver", cl::init(
false),
61 cl::desc(
"Crosscheck the results of the solver chain above the core solver "
62 "with the results of the core solver (default=false)"),
66 "min-query-time-to-log",
67 cl::desc(
"Set time threshold for queries logged in files. "
68 "Only queries longer than threshold will be logged. (default=0s)"),
73 cl::desc(
"Log queries that timed out. (default=true)."),
78 cl::desc(
"Maximum amount of time for a single SMT query (default=0s (off)). "
79 "Enables --use-forked-solver"),
84 cl::desc(
"Run the core SMT solver in a forked process (default=true)"),
88 "solver-optimize-divides",
89 cl::desc(
"Optimize constant divides into add/shift/multiplies before "
90 "passing them to the core SMT solver (default=false)"),
95 cl::desc(
"Log queries to a file. Multiple options can be specified "
96 "separated by a comma. By default nothing is logged."),
99 "All queries in .kquery (KQuery) format"),
101 "All queries in .smt2 (SMT-LIBv2) format"),
104 "All queries reaching the solver in .kquery (KQuery) format"),
107 "All queries reaching the solver in .smt2 (SMT-LIBv2) format")),
111 "debug-assignment-validating-solver", cl::init(
false),
112 cl::desc(
"Debug the correctness of generated assignments (default=false)"),
117 StringMap<cl::Option *> &map = cl::getRegisteredOptions();
119 for (
auto &elem : map) {
120#if LLVM_VERSION_CODE >= LLVM_VERSION(9, 0)
121 for (
auto &cat : elem.second->Categories) {
124 auto &cat = elem.second->Category;
126 if (cat == &Category) {
127 elem.second->setHiddenFlag(cl::Hidden);
135#ifdef METASMT_DEFAULT_BACKEND_IS_BTOR
136#define METASMT_DEFAULT_BACKEND_STR "(default = btor)."
137#define METASMT_DEFAULT_BACKEND METASMT_BACKEND_BOOLECTOR
138#elif METASMT_DEFAULT_BACKEND_IS_Z3
139#define METASMT_DEFAULT_BACKEND_STR "(default = z3)."
140#define METASMT_DEFAULT_BACKEND METASMT_BACKEND_Z3
141#elif METASMT_DEFAULT_BACKEND_IS_CVC4
142#define METASMT_DEFAULT_BACKEND_STR "(default = cvc4)."
143#define METASMT_DEFAULT_BACKEND METASMT_BACKEND_CVC4
144#elif METASMT_DEFAULT_BACKEND_IS_YICES2
145#define METASMT_DEFAULT_BACKEND_STR "(default = yices2)."
146#define METASMT_DEFAULT_BACKEND METASMT_BACKEND_YICES2
148#define METASMT_DEFAULT_BACKEND_STR "(default = stp)."
149#define METASMT_DEFAULT_BACKEND METASMT_BACKEND_STP
152cl::opt<klee::MetaSMTBackendType>
153MetaSMTBackend(
"metasmt-backend",
154 cl::desc(
"Specify the MetaSMT solver backend type " METASMT_DEFAULT_BACKEND_STR),
155 cl::values(clEnumValN(METASMT_BACKEND_STP,
"stp",
"Use metaSMT with STP"),
156 clEnumValN(METASMT_BACKEND_Z3,
"z3",
"Use metaSMT with Z3"),
157 clEnumValN(METASMT_BACKEND_BOOLECTOR,
"btor",
158 "Use metaSMT with Boolector"),
159 clEnumValN(METASMT_BACKEND_CVC4,
"cvc4",
"Use metaSMT with CVC4"),
160 clEnumValN(METASMT_BACKEND_YICES2,
"yices2",
"Use metaSMT with Yices2")),
161 cl::init(METASMT_DEFAULT_BACKEND),
164#undef METASMT_DEFAULT_BACKEND
165#undef METASMT_DEFAULT_BACKEND_STR
171#define STP_IS_DEFAULT_STR " (default)"
172#define METASMT_IS_DEFAULT_STR ""
173#define Z3_IS_DEFAULT_STR ""
174#define DEFAULT_CORE_SOLVER STP_SOLVER
176#define STP_IS_DEFAULT_STR ""
177#define METASMT_IS_DEFAULT_STR ""
178#define Z3_IS_DEFAULT_STR " (default)"
179#define DEFAULT_CORE_SOLVER Z3_SOLVER
181#define STP_IS_DEFAULT_STR ""
182#define METASMT_IS_DEFAULT_STR " (default)"
183#define Z3_IS_DEFAULT_STR ""
184#define DEFAULT_CORE_SOLVER METASMT_SOLVER
185#define Z3_IS_DEFAULT_STR ""
187#error "Unsupported solver configuration"
191 "solver-backend", cl::desc(
"Specifiy the core solver backend to use"),
192 cl::values(clEnumValN(
STP_SOLVER,
"stp",
"STP" STP_IS_DEFAULT_STR),
194 "metaSMT" METASMT_IS_DEFAULT_STR),
196 clEnumValN(
Z3_SOLVER,
"z3",
"Z3" Z3_IS_DEFAULT_STR)),
197 cl::init(DEFAULT_CORE_SOLVER), cl::cat(
SolvingCat));
200 "debug-crosscheck-core-solver",
202 "Specifiy a solver to use for crosschecking the results of the core solver"),
203 cl::values(clEnumValN(
STP_SOLVER,
"stp",
"STP"),
207 clEnumValN(
NO_SOLVER,
"none",
"Do not crosscheck (default)")),
211#undef STP_IS_DEFAULT_STR
212#undef METASMT_IS_DEFAULT_STR
213#undef Z3_IS_DEFAULT_STR
214#undef DEFAULT_CORE_SOLVER
static void HideOptions(llvm::cl::OptionCategory &Category)
Hide all options in the specified category.
llvm::cl::opt< CoreSolverType > CoreSolverToUse
cl::extrahelp TimeFormatInfo("\nTime format used by KLEE's options\n" "\n" " Time spans can be specified in two ways:\n" " 1. As positive real numbers representing seconds, e.g. '10', '3.5' " "but not 'INF', 'NaN', '1e3', '-4.5s'\n" " 2. As a sequence of natural numbers with specified units, e.g. " "'1h10min' (= '70min'), '5min10s' but not '3.5min', '8S'\n" " The following units are supported: h, min, s, ms, us, ns.\n")
llvm::cl::opt< bool > UseFastCexSolver
llvm::cl::opt< bool > LogTimedOutQueries
llvm::cl::opt< std::string > MaxCoreSolverTime
llvm::cl::opt< bool > DebugValidateSolver
llvm::cl::opt< std::string > MinQueryTimeToLog
@ SOLVER_SMTLIB
Log queries passed to solver in .smt2 (SMT-LIBv2) format.
@ SOLVER_KQUERY
Log queries passed to solver in .kquery (KQuery) format.
@ ALL_SMTLIB
Log all queries .smt2 (SMT-LIBv2) format.
@ ALL_KQUERY
Log all queries in .kquery (KQuery) format.
llvm::cl::opt< CoreSolverType > DebugCrossCheckCoreSolverWith
llvm::cl::opt< bool > UseAssignmentValidatingSolver
llvm::cl::opt< bool > UseIndependentSolver
llvm::cl::OptionCategory SolvingCat
llvm::cl::opt< bool > UseCexCache
llvm::cl::opt< bool > UseForkedCoreSolver
llvm::cl::opt< bool > CoreSolverOptimizeDivides
llvm::cl::bits< QueryLoggingSolverType > QueryLoggingOptions
llvm::cl::opt< bool > UseBranchCache