1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Mathias Preiner, Aina Niemetz |
4 |
|
* |
5 |
|
* This file is part of the cvc5 project. |
6 |
|
* |
7 |
|
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS |
8 |
|
* in the top-level source directory and their institutional affiliations. |
9 |
|
* All rights reserved. See the file COPYING in the top-level source |
10 |
|
* directory for licensing information. |
11 |
|
* **************************************************************************** |
12 |
|
* |
13 |
|
* Option template for option modules. |
14 |
|
* |
15 |
|
* For each <module>_options.toml configuration file, mkoptions.py |
16 |
|
* expands this template and generates a <module>_options.cpp file. |
17 |
|
*/ |
18 |
|
#include "options/theory_options.h" |
19 |
|
|
20 |
|
#include <iostream> |
21 |
|
|
22 |
|
#include "base/check.h" |
23 |
|
#include "options/option_exception.h" |
24 |
|
|
25 |
|
// clang-format off |
26 |
|
namespace cvc5 { |
27 |
|
|
28 |
2 |
template <> options::assignFunctionValues__option_t::type& Options::ref( |
29 |
|
options::assignFunctionValues__option_t) |
30 |
|
{ |
31 |
2 |
return theory().assignFunctionValues; |
32 |
|
} |
33 |
28498 |
template <> const options::assignFunctionValues__option_t::type& Options::operator[]( |
34 |
|
options::assignFunctionValues__option_t) const |
35 |
|
{ |
36 |
28498 |
return theory().assignFunctionValues; |
37 |
|
} |
38 |
|
template <> bool Options::wasSetByUser(options::assignFunctionValues__option_t) const |
39 |
|
{ |
40 |
|
return theory().assignFunctionValues__setByUser__; |
41 |
|
} |
42 |
|
template <> options::condenseFunctionValues__option_t::type& Options::ref( |
43 |
|
options::condenseFunctionValues__option_t) |
44 |
|
{ |
45 |
|
return theory().condenseFunctionValues; |
46 |
|
} |
47 |
228763 |
template <> const options::condenseFunctionValues__option_t::type& Options::operator[]( |
48 |
|
options::condenseFunctionValues__option_t) const |
49 |
|
{ |
50 |
228763 |
return theory().condenseFunctionValues; |
51 |
|
} |
52 |
|
template <> bool Options::wasSetByUser(options::condenseFunctionValues__option_t) const |
53 |
|
{ |
54 |
|
return theory().condenseFunctionValues__setByUser__; |
55 |
|
} |
56 |
|
template <> options::eeMode__option_t::type& Options::ref( |
57 |
|
options::eeMode__option_t) |
58 |
|
{ |
59 |
|
return theory().eeMode; |
60 |
|
} |
61 |
8954 |
template <> const options::eeMode__option_t::type& Options::operator[]( |
62 |
|
options::eeMode__option_t) const |
63 |
|
{ |
64 |
8954 |
return theory().eeMode; |
65 |
|
} |
66 |
|
template <> bool Options::wasSetByUser(options::eeMode__option_t) const |
67 |
|
{ |
68 |
|
return theory().eeMode__setByUser__; |
69 |
|
} |
70 |
20 |
template <> options::relevanceFilter__option_t::type& Options::ref( |
71 |
|
options::relevanceFilter__option_t) |
72 |
|
{ |
73 |
20 |
return theory().relevanceFilter; |
74 |
|
} |
75 |
8977 |
template <> const options::relevanceFilter__option_t::type& Options::operator[]( |
76 |
|
options::relevanceFilter__option_t) const |
77 |
|
{ |
78 |
8977 |
return theory().relevanceFilter; |
79 |
|
} |
80 |
20 |
template <> bool Options::wasSetByUser(options::relevanceFilter__option_t) const |
81 |
|
{ |
82 |
20 |
return theory().relevanceFilter__setByUser__; |
83 |
|
} |
84 |
|
template <> options::tcMode__option_t::type& Options::ref( |
85 |
|
options::tcMode__option_t) |
86 |
|
{ |
87 |
|
return theory().tcMode; |
88 |
|
} |
89 |
8954 |
template <> const options::tcMode__option_t::type& Options::operator[]( |
90 |
|
options::tcMode__option_t) const |
91 |
|
{ |
92 |
8954 |
return theory().tcMode; |
93 |
|
} |
94 |
|
template <> bool Options::wasSetByUser(options::tcMode__option_t) const |
95 |
|
{ |
96 |
|
return theory().tcMode__setByUser__; |
97 |
|
} |
98 |
1699 |
template <> options::theoryOfMode__option_t::type& Options::ref( |
99 |
|
options::theoryOfMode__option_t) |
100 |
|
{ |
101 |
1699 |
return theory().theoryOfMode; |
102 |
|
} |
103 |
154631676 |
template <> const options::theoryOfMode__option_t::type& Options::operator[]( |
104 |
|
options::theoryOfMode__option_t) const |
105 |
|
{ |
106 |
154631676 |
return theory().theoryOfMode; |
107 |
|
} |
108 |
8954 |
template <> bool Options::wasSetByUser(options::theoryOfMode__option_t) const |
109 |
|
{ |
110 |
8954 |
return theory().theoryOfMode__setByUser__; |
111 |
|
} |
112 |
|
|
113 |
|
namespace options { |
114 |
|
|
115 |
|
thread_local struct assignFunctionValues__option_t assignFunctionValues; |
116 |
|
thread_local struct condenseFunctionValues__option_t condenseFunctionValues; |
117 |
|
thread_local struct eeMode__option_t eeMode; |
118 |
|
thread_local struct relevanceFilter__option_t relevanceFilter; |
119 |
|
thread_local struct tcMode__option_t tcMode; |
120 |
|
thread_local struct theoryOfMode__option_t theoryOfMode; |
121 |
|
|
122 |
|
|
123 |
|
std::ostream& operator<<(std::ostream& os, EqEngineMode mode) |
124 |
|
{ |
125 |
|
switch(mode) { |
126 |
|
case EqEngineMode::DISTRIBUTED: |
127 |
|
return os << "EqEngineMode::DISTRIBUTED"; |
128 |
|
default: |
129 |
|
Unreachable(); |
130 |
|
} |
131 |
|
return os; |
132 |
|
} |
133 |
|
|
134 |
|
EqEngineMode stringToEqEngineMode(const std::string& optarg) |
135 |
|
{ |
136 |
|
if (optarg == "distributed") |
137 |
|
{ |
138 |
|
return EqEngineMode::DISTRIBUTED; |
139 |
|
} |
140 |
|
else if (optarg == "help") |
141 |
|
{ |
142 |
|
std::cerr << "Defines mode for managing equalities across theory solvers.\n" |
143 |
|
"Available modes for --ee-mode are:\n" |
144 |
|
"+ distributed (default)\n" |
145 |
|
" Each theory maintains its own equality engine.\n"; |
146 |
|
std::exit(1); |
147 |
|
} |
148 |
|
throw OptionException(std::string("unknown option for --ee-mode: `") + |
149 |
|
optarg + "'. Try --ee-mode=help."); |
150 |
|
} |
151 |
|
|
152 |
|
std::ostream& operator<<(std::ostream& os, TcMode mode) |
153 |
|
{ |
154 |
|
switch(mode) { |
155 |
|
case TcMode::CARE_GRAPH: |
156 |
|
return os << "TcMode::CARE_GRAPH"; |
157 |
|
default: |
158 |
|
Unreachable(); |
159 |
|
} |
160 |
|
return os; |
161 |
|
} |
162 |
|
|
163 |
|
TcMode stringToTcMode(const std::string& optarg) |
164 |
|
{ |
165 |
|
if (optarg == "care-graph") |
166 |
|
{ |
167 |
|
return TcMode::CARE_GRAPH; |
168 |
|
} |
169 |
|
else if (optarg == "help") |
170 |
|
{ |
171 |
|
std::cerr << "Defines mode for theory combination.\n" |
172 |
|
"Available modes for --tc-mode are:\n" |
173 |
|
"+ care-graph (default)\n" |
174 |
|
" Use care graphs for theory combination.\n"; |
175 |
|
std::exit(1); |
176 |
|
} |
177 |
|
throw OptionException(std::string("unknown option for --tc-mode: `") + |
178 |
|
optarg + "'. Try --tc-mode=help."); |
179 |
|
} |
180 |
|
|
181 |
|
std::ostream& operator<<(std::ostream& os, TheoryOfMode mode) |
182 |
|
{ |
183 |
|
switch(mode) { |
184 |
|
case TheoryOfMode::THEORY_OF_TYPE_BASED: |
185 |
|
return os << "TheoryOfMode::THEORY_OF_TYPE_BASED"; |
186 |
|
case TheoryOfMode::THEORY_OF_TERM_BASED: |
187 |
|
return os << "TheoryOfMode::THEORY_OF_TERM_BASED"; |
188 |
|
default: |
189 |
|
Unreachable(); |
190 |
|
} |
191 |
|
return os; |
192 |
|
} |
193 |
|
|
194 |
5 |
TheoryOfMode stringToTheoryOfMode(const std::string& optarg) |
195 |
|
{ |
196 |
5 |
if (optarg == "type") |
197 |
|
{ |
198 |
3 |
return TheoryOfMode::THEORY_OF_TYPE_BASED; |
199 |
|
} |
200 |
2 |
else if (optarg == "term") |
201 |
|
{ |
202 |
2 |
return TheoryOfMode::THEORY_OF_TERM_BASED; |
203 |
|
} |
204 |
|
else if (optarg == "help") |
205 |
|
{ |
206 |
|
std::cerr << "Defines how we associate theories with terms.\n" |
207 |
|
"Available modes for --theoryof-mode are:\n" |
208 |
|
"+ type (default)\n" |
209 |
|
" Type variables, constants and equalities by type.\n" |
210 |
|
"+ term\n" |
211 |
|
" Type variables as uninterpreted, type constants by theory, equalities by the\n" |
212 |
|
" parametric theory.\n"; |
213 |
|
std::exit(1); |
214 |
|
} |
215 |
|
throw OptionException(std::string("unknown option for --theoryof-mode: `") + |
216 |
|
optarg + "'. Try --theoryof-mode=help."); |
217 |
|
} |
218 |
|
|
219 |
|
|
220 |
|
} // namespace options |
221 |
27735 |
} // namespace cvc5 |
222 |
|
// clang-format on |