GCC Code Coverage Report
Directory: . Exec Total Coverage
File: build-coverage/src/options/bv_options.cpp Lines: 93 245 38.0 %
Date: 2021-05-22 Branches: 23 100 23.0 %

Line Exec Source
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/bv_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
template <> options::bitvectorAig__option_t::type& Options::ref(
29
    options::bitvectorAig__option_t)
30
{
31
    return bv().bitvectorAig;
32
}
33
2453
template <> const options::bitvectorAig__option_t::type& Options::operator[](
34
    options::bitvectorAig__option_t) const
35
{
36
2453
  return bv().bitvectorAig;
37
}
38
template <> bool Options::wasSetByUser(options::bitvectorAig__option_t) const
39
{
40
  return bv().bitvectorAig__setByUser__;
41
}
42
template <> options::bitblastMode__option_t::type& Options::ref(
43
    options::bitblastMode__option_t)
44
{
45
    return bv().bitblastMode;
46
}
47
1659704
template <> const options::bitblastMode__option_t::type& Options::operator[](
48
    options::bitblastMode__option_t) const
49
{
50
1659704
  return bv().bitblastMode;
51
}
52
8
template <> bool Options::wasSetByUser(options::bitblastMode__option_t) const
53
{
54
8
  return bv().bitblastMode__setByUser__;
55
}
56
template <> options::bitwiseEq__option_t::type& Options::ref(
57
    options::bitwiseEq__option_t)
58
{
59
    return bv().bitwiseEq;
60
}
61
315684
template <> const options::bitwiseEq__option_t::type& Options::operator[](
62
    options::bitwiseEq__option_t) const
63
{
64
315684
  return bv().bitwiseEq;
65
}
66
template <> bool Options::wasSetByUser(options::bitwiseEq__option_t) const
67
{
68
  return bv().bitwiseEq__setByUser__;
69
}
70
template <> options::boolToBitvector__option_t::type& Options::ref(
71
    options::boolToBitvector__option_t)
72
{
73
    return bv().boolToBitvector;
74
}
75
39559
template <> const options::boolToBitvector__option_t::type& Options::operator[](
76
    options::boolToBitvector__option_t) const
77
{
78
39559
  return bv().boolToBitvector;
79
}
80
template <> bool Options::wasSetByUser(options::boolToBitvector__option_t) const
81
{
82
  return bv().boolToBitvector__setByUser__;
83
}
84
2049
template <> options::bvAbstraction__option_t::type& Options::ref(
85
    options::bvAbstraction__option_t)
86
{
87
2049
    return bv().bvAbstraction;
88
}
89
1988699
template <> const options::bvAbstraction__option_t::type& Options::operator[](
90
    options::bvAbstraction__option_t) const
91
{
92
1988699
  return bv().bvAbstraction;
93
}
94
template <> bool Options::wasSetByUser(options::bvAbstraction__option_t) const
95
{
96
  return bv().bvAbstraction__setByUser__;
97
}
98
template <> options::bitvectorAigSimplifications__option_t::type& Options::ref(
99
    options::bitvectorAigSimplifications__option_t)
100
{
101
    return bv().bitvectorAigSimplifications;
102
}
103
template <> const options::bitvectorAigSimplifications__option_t::type& Options::operator[](
104
    options::bitvectorAigSimplifications__option_t) const
105
{
106
  return bv().bitvectorAigSimplifications;
107
}
108
9461
template <> bool Options::wasSetByUser(options::bitvectorAigSimplifications__option_t) const
109
{
110
9461
  return bv().bitvectorAigSimplifications__setByUser__;
111
}
112
template <> options::bvAlgExtf__option_t::type& Options::ref(
113
    options::bvAlgExtf__option_t)
114
{
115
    return bv().bvAlgExtf;
116
}
117
127
template <> const options::bvAlgExtf__option_t::type& Options::operator[](
118
    options::bvAlgExtf__option_t) const
119
{
120
127
  return bv().bvAlgExtf;
121
}
122
template <> bool Options::wasSetByUser(options::bvAlgExtf__option_t) const
123
{
124
  return bv().bvAlgExtf__setByUser__;
125
}
126
template <> options::bitvectorAlgebraicBudget__option_t::type& Options::ref(
127
    options::bitvectorAlgebraicBudget__option_t)
128
{
129
    return bv().bitvectorAlgebraicBudget;
130
}
131
template <> const options::bitvectorAlgebraicBudget__option_t::type& Options::operator[](
132
    options::bitvectorAlgebraicBudget__option_t) const
133
{
134
  return bv().bitvectorAlgebraicBudget;
135
}
136
9461
template <> bool Options::wasSetByUser(options::bitvectorAlgebraicBudget__option_t) const
137
{
138
9461
  return bv().bitvectorAlgebraicBudget__setByUser__;
139
}
140
template <> options::bitvectorAlgebraicSolver__option_t::type& Options::ref(
141
    options::bitvectorAlgebraicSolver__option_t)
142
{
143
    return bv().bitvectorAlgebraicSolver;
144
}
145
9406
template <> const options::bitvectorAlgebraicSolver__option_t::type& Options::operator[](
146
    options::bitvectorAlgebraicSolver__option_t) const
147
{
148
9406
  return bv().bitvectorAlgebraicSolver;
149
}
150
template <> bool Options::wasSetByUser(options::bitvectorAlgebraicSolver__option_t) const
151
{
152
  return bv().bitvectorAlgebraicSolver__setByUser__;
153
}
154
template <> options::bvAssertInput__option_t::type& Options::ref(
155
    options::bvAssertInput__option_t)
156
{
157
    return bv().bvAssertInput;
158
}
159
template <> const options::bvAssertInput__option_t::type& Options::operator[](
160
    options::bvAssertInput__option_t) const
161
{
162
  return bv().bvAssertInput;
163
}
164
template <> bool Options::wasSetByUser(options::bvAssertInput__option_t) const
165
{
166
  return bv().bvAssertInput__setByUser__;
167
}
168
4202
template <> options::bvEagerExplanations__option_t::type& Options::ref(
169
    options::bvEagerExplanations__option_t)
170
{
171
4202
    return bv().bvEagerExplanations;
172
}
173
2379321
template <> const options::bvEagerExplanations__option_t::type& Options::operator[](
174
    options::bvEagerExplanations__option_t) const
175
{
176
2379321
  return bv().bvEagerExplanations;
177
}
178
9460
template <> bool Options::wasSetByUser(options::bvEagerExplanations__option_t) const
179
{
180
9460
  return bv().bvEagerExplanations__setByUser__;
181
}
182
template <> options::bitvectorEqualitySolver__option_t::type& Options::ref(
183
    options::bitvectorEqualitySolver__option_t)
184
{
185
    return bv().bitvectorEqualitySolver;
186
}
187
18866
template <> const options::bitvectorEqualitySolver__option_t::type& Options::operator[](
188
    options::bitvectorEqualitySolver__option_t) const
189
{
190
18866
  return bv().bitvectorEqualitySolver;
191
}
192
template <> bool Options::wasSetByUser(options::bitvectorEqualitySolver__option_t) const
193
{
194
  return bv().bitvectorEqualitySolver__setByUser__;
195
}
196
template <> options::bvExtractArithRewrite__option_t::type& Options::ref(
197
    options::bvExtractArithRewrite__option_t)
198
{
199
    return bv().bvExtractArithRewrite;
200
}
201
139735
template <> const options::bvExtractArithRewrite__option_t::type& Options::operator[](
202
    options::bvExtractArithRewrite__option_t) const
203
{
204
139735
  return bv().bvExtractArithRewrite;
205
}
206
template <> bool Options::wasSetByUser(options::bvExtractArithRewrite__option_t) const
207
{
208
  return bv().bvExtractArithRewrite__setByUser__;
209
}
210
template <> options::bvGaussElim__option_t::type& Options::ref(
211
    options::bvGaussElim__option_t)
212
{
213
    return bv().bvGaussElim;
214
}
215
12887
template <> const options::bvGaussElim__option_t::type& Options::operator[](
216
    options::bvGaussElim__option_t) const
217
{
218
12887
  return bv().bvGaussElim;
219
}
220
template <> bool Options::wasSetByUser(options::bvGaussElim__option_t) const
221
{
222
  return bv().bvGaussElim__setByUser__;
223
}
224
template <> options::bitvectorInequalitySolver__option_t::type& Options::ref(
225
    options::bitvectorInequalitySolver__option_t)
226
{
227
    return bv().bitvectorInequalitySolver;
228
}
229
9406
template <> const options::bitvectorInequalitySolver__option_t::type& Options::operator[](
230
    options::bitvectorInequalitySolver__option_t) const
231
{
232
9406
  return bv().bitvectorInequalitySolver;
233
}
234
template <> bool Options::wasSetByUser(options::bitvectorInequalitySolver__option_t) const
235
{
236
  return bv().bitvectorInequalitySolver__setByUser__;
237
}
238
template <> options::bvIntroducePow2__option_t::type& Options::ref(
239
    options::bvIntroducePow2__option_t)
240
{
241
    return bv().bvIntroducePow2;
242
}
243
15299
template <> const options::bvIntroducePow2__option_t::type& Options::operator[](
244
    options::bvIntroducePow2__option_t) const
245
{
246
15299
  return bv().bvIntroducePow2;
247
}
248
template <> bool Options::wasSetByUser(options::bvIntroducePow2__option_t) const
249
{
250
  return bv().bvIntroducePow2__setByUser__;
251
}
252
15
template <> options::bvLazyReduceExtf__option_t::type& Options::ref(
253
    options::bvLazyReduceExtf__option_t)
254
{
255
15
    return bv().bvLazyReduceExtf;
256
}
257
57
template <> const options::bvLazyReduceExtf__option_t::type& Options::operator[](
258
    options::bvLazyReduceExtf__option_t) const
259
{
260
57
  return bv().bvLazyReduceExtf;
261
}
262
template <> bool Options::wasSetByUser(options::bvLazyReduceExtf__option_t) const
263
{
264
  return bv().bvLazyReduceExtf__setByUser__;
265
}
266
17
template <> options::bvLazyRewriteExtf__option_t::type& Options::ref(
267
    options::bvLazyRewriteExtf__option_t)
268
{
269
17
    return bv().bvLazyRewriteExtf;
270
}
271
1200
template <> const options::bvLazyRewriteExtf__option_t::type& Options::operator[](
272
    options::bvLazyRewriteExtf__option_t) const
273
{
274
1200
  return bv().bvLazyRewriteExtf;
275
}
276
2
template <> bool Options::wasSetByUser(options::bvLazyRewriteExtf__option_t) const
277
{
278
2
  return bv().bvLazyRewriteExtf__setByUser__;
279
}
280
template <> options::bvNumFunc__option_t::type& Options::ref(
281
    options::bvNumFunc__option_t)
282
{
283
    return bv().bvNumFunc;
284
}
285
template <> const options::bvNumFunc__option_t::type& Options::operator[](
286
    options::bvNumFunc__option_t) const
287
{
288
  return bv().bvNumFunc;
289
}
290
template <> bool Options::wasSetByUser(options::bvNumFunc__option_t) const
291
{
292
  return bv().bvNumFunc__setByUser__;
293
}
294
template <> options::bvPrintConstsAsIndexedSymbols__option_t::type& Options::ref(
295
    options::bvPrintConstsAsIndexedSymbols__option_t)
296
{
297
    return bv().bvPrintConstsAsIndexedSymbols;
298
}
299
202
template <> const options::bvPrintConstsAsIndexedSymbols__option_t::type& Options::operator[](
300
    options::bvPrintConstsAsIndexedSymbols__option_t) const
301
{
302
202
  return bv().bvPrintConstsAsIndexedSymbols;
303
}
304
template <> bool Options::wasSetByUser(options::bvPrintConstsAsIndexedSymbols__option_t) const
305
{
306
  return bv().bvPrintConstsAsIndexedSymbols__setByUser__;
307
}
308
template <> options::bitvectorPropagate__option_t::type& Options::ref(
309
    options::bitvectorPropagate__option_t)
310
{
311
    return bv().bitvectorPropagate;
312
}
313
9406
template <> const options::bitvectorPropagate__option_t::type& Options::operator[](
314
    options::bitvectorPropagate__option_t) const
315
{
316
9406
  return bv().bitvectorPropagate;
317
}
318
template <> bool Options::wasSetByUser(options::bitvectorPropagate__option_t) const
319
{
320
  return bv().bitvectorPropagate__setByUser__;
321
}
322
template <> options::bitvectorQuickXplain__option_t::type& Options::ref(
323
    options::bitvectorQuickXplain__option_t)
324
{
325
    return bv().bitvectorQuickXplain;
326
}
327
23815
template <> const options::bitvectorQuickXplain__option_t::type& Options::operator[](
328
    options::bitvectorQuickXplain__option_t) const
329
{
330
23815
  return bv().bitvectorQuickXplain;
331
}
332
template <> bool Options::wasSetByUser(options::bitvectorQuickXplain__option_t) const
333
{
334
  return bv().bitvectorQuickXplain__setByUser__;
335
}
336
template <> options::bvSatSolver__option_t::type& Options::ref(
337
    options::bvSatSolver__option_t)
338
{
339
    return bv().bvSatSolver;
340
}
341
31
template <> const options::bvSatSolver__option_t::type& Options::operator[](
342
    options::bvSatSolver__option_t) const
343
{
344
31
  return bv().bvSatSolver;
345
}
346
template <> bool Options::wasSetByUser(options::bvSatSolver__option_t) const
347
{
348
  return bv().bvSatSolver__setByUser__;
349
}
350
template <> options::skolemizeArguments__option_t::type& Options::ref(
351
    options::skolemizeArguments__option_t)
352
{
353
    return bv().skolemizeArguments;
354
}
355
4
template <> const options::skolemizeArguments__option_t::type& Options::operator[](
356
    options::skolemizeArguments__option_t) const
357
{
358
4
  return bv().skolemizeArguments;
359
}
360
template <> bool Options::wasSetByUser(options::skolemizeArguments__option_t) const
361
{
362
  return bv().skolemizeArguments__setByUser__;
363
}
364
template <> options::bvSolver__option_t::type& Options::ref(
365
    options::bvSolver__option_t)
366
{
367
    return bv().bvSolver;
368
}
369
41459
template <> const options::bvSolver__option_t::type& Options::operator[](
370
    options::bvSolver__option_t) const
371
{
372
41459
  return bv().bvSolver;
373
}
374
template <> bool Options::wasSetByUser(options::bvSolver__option_t) const
375
{
376
  return bv().bvSolver__setByUser__;
377
}
378
235
template <> options::bitvectorToBool__option_t::type& Options::ref(
379
    options::bitvectorToBool__option_t)
380
{
381
235
    return bv().bitvectorToBool;
382
}
383
15299
template <> const options::bitvectorToBool__option_t::type& Options::operator[](
384
    options::bitvectorToBool__option_t) const
385
{
386
15299
  return bv().bitvectorToBool;
387
}
388
76
template <> bool Options::wasSetByUser(options::bitvectorToBool__option_t) const
389
{
390
76
  return bv().bitvectorToBool__setByUser__;
391
}
392
393
namespace options {
394
395
thread_local struct bitvectorAig__option_t bitvectorAig;
396
thread_local struct bitblastMode__option_t bitblastMode;
397
thread_local struct bitwiseEq__option_t bitwiseEq;
398
thread_local struct boolToBitvector__option_t boolToBitvector;
399
thread_local struct bvAbstraction__option_t bvAbstraction;
400
thread_local struct bitvectorAigSimplifications__option_t bitvectorAigSimplifications;
401
thread_local struct bvAlgExtf__option_t bvAlgExtf;
402
thread_local struct bitvectorAlgebraicBudget__option_t bitvectorAlgebraicBudget;
403
thread_local struct bitvectorAlgebraicSolver__option_t bitvectorAlgebraicSolver;
404
thread_local struct bvAssertInput__option_t bvAssertInput;
405
thread_local struct bvEagerExplanations__option_t bvEagerExplanations;
406
thread_local struct bitvectorEqualitySolver__option_t bitvectorEqualitySolver;
407
thread_local struct bvExtractArithRewrite__option_t bvExtractArithRewrite;
408
thread_local struct bvGaussElim__option_t bvGaussElim;
409
thread_local struct bitvectorInequalitySolver__option_t bitvectorInequalitySolver;
410
thread_local struct bvIntroducePow2__option_t bvIntroducePow2;
411
thread_local struct bvLazyReduceExtf__option_t bvLazyReduceExtf;
412
thread_local struct bvLazyRewriteExtf__option_t bvLazyRewriteExtf;
413
thread_local struct bvNumFunc__option_t bvNumFunc;
414
thread_local struct bvPrintConstsAsIndexedSymbols__option_t bvPrintConstsAsIndexedSymbols;
415
thread_local struct bitvectorPropagate__option_t bitvectorPropagate;
416
thread_local struct bitvectorQuickXplain__option_t bitvectorQuickXplain;
417
thread_local struct bvSatSolver__option_t bvSatSolver;
418
thread_local struct skolemizeArguments__option_t skolemizeArguments;
419
thread_local struct bvSolver__option_t bvSolver;
420
thread_local struct bitvectorToBool__option_t bitvectorToBool;
421
422
423
std::ostream& operator<<(std::ostream& os, BitblastMode mode)
424
{
425
  switch(mode) {
426
    case BitblastMode::LAZY:
427
      return os << "BitblastMode::LAZY";
428
    case BitblastMode::EAGER:
429
      return os << "BitblastMode::EAGER";
430
    default:
431
      Unreachable();
432
  }
433
  return os;
434
}
435
436
38
BitblastMode stringToBitblastMode(const std::string& optarg)
437
{
438
38
  if (optarg == "lazy")
439
  {
440
2
    return BitblastMode::LAZY;
441
  }
442
36
  else if (optarg == "eager")
443
  {
444
36
    return BitblastMode::EAGER;
445
  }
446
  else if (optarg == "help")
447
  {
448
    std::cerr << "Bit-blasting modes.\n"
449
         "Available modes for --bitblast are:\n"
450
         "+ lazy (default)\n"
451
         "  Separate boolean structure and term reasoning between the core SAT solver and\n"
452
         "  the bit-vector SAT solver.\n"
453
         "+ eager\n"
454
         "  Bitblast eagerly to bit-vector SAT solver.\n";
455
    std::exit(1);
456
  }
457
  throw OptionException(std::string("unknown option for --bitblast: `") +
458
                        optarg + "'.  Try --bitblast=help.");
459
}
460
461
std::ostream& operator<<(std::ostream& os, BoolToBVMode mode)
462
{
463
  switch(mode) {
464
    case BoolToBVMode::ALL:
465
      return os << "BoolToBVMode::ALL";
466
    case BoolToBVMode::ITE:
467
      return os << "BoolToBVMode::ITE";
468
    case BoolToBVMode::OFF:
469
      return os << "BoolToBVMode::OFF";
470
    default:
471
      Unreachable();
472
  }
473
  return os;
474
}
475
476
12
BoolToBVMode stringToBoolToBVMode(const std::string& optarg)
477
{
478
12
  if (optarg == "all")
479
  {
480
8
    return BoolToBVMode::ALL;
481
  }
482
4
  else if (optarg == "ite")
483
  {
484
4
    return BoolToBVMode::ITE;
485
  }
486
  else if (optarg == "off")
487
  {
488
    return BoolToBVMode::OFF;
489
  }
490
  else if (optarg == "help")
491
  {
492
    std::cerr << "BoolToBV preprocessing pass modes.\n"
493
         "Available modes for --bool-to-bv are:\n"
494
         "+ all\n"
495
         "  Force all booleans to be bit-vectors of width one except at the top level.\n"
496
         "  Most aggressive mode.\n"
497
         "+ ite\n"
498
         "  Try to turn ITEs into BITVECTOR_ITE when possible. It can fail per-formula if\n"
499
         "  not all sub-formulas can be turned to bit-vectors.\n"
500
         "+ off (default)\n"
501
         "  Don't push any booleans to width one bit-vectors.\n";
502
    std::exit(1);
503
  }
504
  throw OptionException(std::string("unknown option for --bool-to-bv: `") +
505
                        optarg + "'.  Try --bool-to-bv=help.");
506
}
507
508
std::ostream& operator<<(std::ostream& os, SatSolverMode mode)
509
{
510
  switch(mode) {
511
    case SatSolverMode::KISSAT:
512
      return os << "SatSolverMode::KISSAT";
513
    case SatSolverMode::MINISAT:
514
      return os << "SatSolverMode::MINISAT";
515
    case SatSolverMode::CRYPTOMINISAT:
516
      return os << "SatSolverMode::CRYPTOMINISAT";
517
    case SatSolverMode::CADICAL:
518
      return os << "SatSolverMode::CADICAL";
519
    default:
520
      Unreachable();
521
  }
522
  return os;
523
}
524
525
18
SatSolverMode stringToSatSolverMode(const std::string& optarg)
526
{
527
18
  if (optarg == "kissat")
528
  {
529
    return SatSolverMode::KISSAT;
530
  }
531
18
  else if (optarg == "minisat")
532
  {
533
2
    return SatSolverMode::MINISAT;
534
  }
535
16
  else if (optarg == "cryptominisat")
536
  {
537
10
    return SatSolverMode::CRYPTOMINISAT;
538
  }
539
6
  else if (optarg == "cadical")
540
  {
541
4
    return SatSolverMode::CADICAL;
542
  }
543
2
  else if (optarg == "help")
544
  {
545
    std::cerr << "SAT solver for bit-blasting backend.\n"
546
         "Available modes for --bv-sat-solver are:\n"
547
         "+ kissat\n"
548
         "+ minisat (default)\n"
549
         "+ cryptominisat\n"
550
         "+ cadical\n";
551
    std::exit(1);
552
  }
553
4
  throw OptionException(std::string("unknown option for --bv-sat-solver: `") +
554
6
                        optarg + "'.  Try --bv-sat-solver=help.");
555
}
556
557
std::ostream& operator<<(std::ostream& os, BVSolver mode)
558
{
559
  switch(mode) {
560
    case BVSolver::LAZY:
561
      return os << "BVSolver::LAZY";
562
    case BVSolver::BITBLAST:
563
      return os << "BVSolver::BITBLAST";
564
    case BVSolver::SIMPLE:
565
      return os << "BVSolver::SIMPLE";
566
    default:
567
      Unreachable();
568
  }
569
  return os;
570
}
571
572
14
BVSolver stringToBVSolver(const std::string& optarg)
573
{
574
14
  if (optarg == "lazy")
575
  {
576
    return BVSolver::LAZY;
577
  }
578
14
  else if (optarg == "bitblast")
579
  {
580
    return BVSolver::BITBLAST;
581
  }
582
14
  else if (optarg == "simple")
583
  {
584
14
    return BVSolver::SIMPLE;
585
  }
586
  else if (optarg == "help")
587
  {
588
    std::cerr << "Bit-vector solvers.\n"
589
         "Available modes for --bv-solver are:\n"
590
         "+ lazy (default)\n"
591
         "  Enables the lazy BV solver infrastructure.\n"
592
         "+ bitblast\n"
593
         "  Enables bitblasting solver.\n"
594
         "+ simple\n"
595
         "  Enables simple bitblasting solver with proof support.\n";
596
    std::exit(1);
597
  }
598
  throw OptionException(std::string("unknown option for --bv-solver: `") +
599
                        optarg + "'.  Try --bv-solver=help.");
600
}
601
602
603
}  // namespace options
604
28194
}  // namespace cvc5
605
// clang-format on