Skip to content

Commit c2685f6

Browse files
committed
Refactor smt2 decision procedure to separate lowering
So that multiple lowering transformations can be added and maintained in a single location in a single order.
1 parent a19b7b3 commit c2685f6

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ void smt2_incremental_decision_proceduret::ensure_handle_for_expr_defined(
268268
return;
269269
}
270270

271-
const exprt lowered_expr = lower_byte_operators(in_expr, ns);
271+
const exprt lowered_expr = lower(in_expr);
272272

273273
define_dependent_functions(lowered_expr);
274274
smt_define_function_commandt function{
@@ -514,7 +514,7 @@ void smt2_incremental_decision_proceduret::set_to(
514514
const exprt &in_expr,
515515
bool value)
516516
{
517-
const exprt lowered_expr = lower_byte_operators(in_expr, ns);
517+
const exprt lowered_expr = lower(in_expr);
518518
PRECONDITION(can_cast_type<bool_typet>(lowered_expr.type()));
519519
log.conditional_output(log.debug(), [&](messaget::mstreamt &debug) {
520520
debug << "`set_to` (" << std::string{value ? "true" : "false"} << ") -\n "
@@ -587,6 +587,11 @@ void smt2_incremental_decision_proceduret::define_object_properties()
587587
}
588588
}
589589

590+
exprt smt2_incremental_decision_proceduret::lower(exprt expression)
591+
{
592+
return lower_byte_operators(expression, ns);
593+
}
594+
590595
decision_proceduret::resultt smt2_incremental_decision_proceduret::dec_solve()
591596
{
592597
++number_of_solver_calls;

src/solvers/smt2_incremental/smt2_incremental_decision_procedure.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ class smt2_incremental_decision_proceduret final
9393
/// Sends the solver the definitions of the object sizes and dynamic memory
9494
/// statuses.
9595
void define_object_properties();
96+
/// Performs a combination of transformations which reduces the set of
97+
/// possible expression forms by expressing these in terms of the remaining
98+
/// language features.
99+
exprt lower(exprt expression);
96100

97101
/// Namespace for looking up the expressions which symbol_exprts relate to.
98102
/// This includes the symbols defined outside of the decision procedure but

0 commit comments

Comments
 (0)