Skip to content

Commit e5f4c93

Browse files
committed
Make IPASIR support compile
Hardness support was added to minisat2 only, and 89641a2 failed to update the IPASIR interface. Also cleanup the list of phony targets in the top-level Makefile, and ensure that linking of the memory analyzer succeeds even in presence of LIBS set on the make command line. Fixes: diffblue#5345
1 parent bf62883 commit e5f4c93

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

src/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,4 @@ cadical-download:
163163
doc :
164164
doxygen
165165

166-
.PHONY: ipasir-build minisat2-download glucose-download
166+
.PHONY: minisat2-download cudd-download glucose-download cadical-download

src/memory-analyzer/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ SRC = \
77

88
INCLUDES= -I ..
99

10-
LIBS = \
10+
OBJ += \
1111
../ansi-c/ansi-c$(LIBEXT) \
1212
../goto-programs/goto-programs$(LIBEXT) \
1313
../linking/linking$(LIBEXT) \
1414
../util/util$(LIBEXT) \
1515
../big-int/big-int$(LIBEXT) \
1616
../langapi/langapi$(LIBEXT)
1717

18+
LIBS =
1819

1920
CLEANFILES = memory-analyzer$(EXEEXT)
2021

src/solvers/sat/satcheck_ipasir.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ void satcheck_ipasirt::lcnf(const bvt &bv)
9090
}
9191
ipasir_add(solver, 0); // terminate clause
9292

93+
with_solver_hardness(
94+
[&bv](solver_hardnesst &hardness) { hardness.register_clause(bv); });
95+
9396
clause_counter++;
9497
}
9598

@@ -158,8 +161,8 @@ void satcheck_ipasirt::set_assignment(literalt a, bool value)
158161
INVARIANT(false, "method not supported");
159162
}
160163

161-
satcheck_ipasirt::satcheck_ipasirt()
162-
: solver(nullptr)
164+
satcheck_ipasirt::satcheck_ipasirt(message_handlert &message_handler)
165+
: cnf_solvert(message_handler), solver(nullptr)
163166
{
164167
INVARIANT(!solver, "there cannot be a solver already");
165168
solver=ipasir_init();

src/solvers/sat/satcheck_ipasir.h

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ instructions.
1414

1515
#include "cnf.h"
1616

17+
#include <solvers/hardness_collector.h>
18+
1719
/// Interface for generic SAT solver interface IPASIR
18-
class satcheck_ipasirt:public cnf_solvert
20+
class satcheck_ipasirt : public cnf_solvert, public hardness_collectort
1921
{
2022
public:
21-
satcheck_ipasirt();
23+
satcheck_ipasirt(message_handlert &message_handler);
2224
virtual ~satcheck_ipasirt() override;
2325

2426
/// This method returns the description produced by the linked SAT solver
@@ -44,12 +46,28 @@ class satcheck_ipasirt:public cnf_solvert
4446
return true;
4547
}
4648

49+
void
50+
with_solver_hardness(std::function<void(solver_hardnesst &)> handler) override
51+
{
52+
if(solver_hardness.has_value())
53+
{
54+
handler(solver_hardness.value());
55+
}
56+
}
57+
58+
void enable_hardness_collection() override
59+
{
60+
solver_hardness = solver_hardnesst{};
61+
}
62+
4763
protected:
4864
resultt do_prop_solve() override;
4965

5066
void *solver;
5167

5268
bvt assumptions;
69+
70+
optionalt<solver_hardnesst> solver_hardness;
5371
};
5472

5573
#endif // CPROVER_SOLVERS_SAT_SATCHECK_IPASIR_H

0 commit comments

Comments
 (0)