about summary refs log tree commit diff homepage
path: root/lib/Basic/ConstructSolverChain.cpp
blob: 5979055188b02eba78bc951a18991c86ff80460c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//===-- ConstructSolverChain.cpp ------------------------------------------------*- C++ -*-===//
//
//                     The KLEE Symbolic Virtual Machine
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

/*
 * This file groups declarations that are common to both KLEE and Kleaver.
 */
#include "klee/Common.h"
#include "klee/CommandLine.h"
#include "llvm/Support/raw_ostream.h"

namespace klee
{
        Solver *constructSolverChain(Solver *coreSolver,
                                     std::string querySMT2LogPath,
                                     std::string baseSolverQuerySMT2LogPath,
                                     std::string queryPCLogPath,
                                     std::string baseSolverQueryPCLogPath)
	{
	  Solver *solver = coreSolver;

	  if (optionIsSet(queryLoggingOptions, SOLVER_PC))
	  {
		solver = createPCLoggingSolver(solver,
					       baseSolverQueryPCLogPath,
					       MinQueryTimeToLog);
		llvm::errs() << "Logging queries that reach solver in .pc format to "
			  << baseSolverQueryPCLogPath.c_str() << "\n";
	  }

	  if (optionIsSet(queryLoggingOptions, SOLVER_SMTLIB))
	  {
		solver = createSMTLIBLoggingSolver(solver,
						   baseSolverQuerySMT2LogPath,
						   MinQueryTimeToLog);
		llvm::errs() << "Logging queries that reach solver in .smt2 format to "
			  << baseSolverQuerySMT2LogPath.c_str() << "\n";
	  }

	  if (UseFastCexSolver)
		solver = createFastCexSolver(solver);

	  if (UseCexCache)
		solver = createCexCachingSolver(solver);

	  if (UseCache)
		solver = createCachingSolver(solver);

	  if (UseIndependentSolver)
		solver = createIndependentSolver(solver);

	  if (DebugValidateSolver)
		solver = createValidatingSolver(solver, coreSolver);

	  if (optionIsSet(queryLoggingOptions, ALL_PC))
	  {
		solver = createPCLoggingSolver(solver,
					       queryPCLogPath,
					       MinQueryTimeToLog);
		llvm::errs() << "Logging all queries in .pc format to "
			  << queryPCLogPath.c_str() << "\n";
	  }

	  if (optionIsSet(queryLoggingOptions, ALL_SMTLIB))
	  {
		solver = createSMTLIBLoggingSolver(solver,querySMT2LogPath,
						   MinQueryTimeToLog);
		llvm::errs() << "Logging all queries in .smt2 format to "
			  << querySMT2LogPath.c_str() << "\n";
	  }

	  return solver;
	}

}