Skip to content

Commit e6e8137

Browse files
committed
Add an option in goto-synthesizer to not unwind tranformed loops
1 parent 89df5e9 commit e6e8137

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

doc/man/goto-synthesizer.1

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ program transformation for the synthesized contracts, and then writes the
1717
resulting program as GOTO binary on disk.
1818
.SH OPTIONS
1919
.TP
20+
\fB\-loop\-contracts\-no\-unwind\fR
21+
Do not unwind transformed loops after applying the synthesized loop contracts.
22+
.TP
2023
\fB\-\-dump\-loop\-contracts
2124
Dump the synthesized loop contracts as JSON.
2225
.TP

src/goto-synthesizer/cegis_verifier.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ optionalt<cext> cegis_verifiert::verify()
610610

611611
// Apply loop contracts we annotated.
612612
code_contractst cont(goto_model, log);
613+
cont.unwind_transformed_loops = false;
613614
cont.apply_loop_contracts();
614615
original_loop_number_map = cont.get_original_loop_number_map();
615616
loop_havoc_set = cont.get_loop_havoc_set();

src/goto-synthesizer/goto_synthesizer_parse_options.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ int goto_synthesizer_parse_optionst::doit()
110110
cmdline.get_values("nondet-static-exclude").begin(),
111111
cmdline.get_values("nondet-static-exclude").end());
112112
code_contractst contracts(goto_model, log);
113+
contracts.unwind_transformed_loops =
114+
!cmdline.isset(FLAG_LOOP_CONTRACTS_NO_UNWIND);
113115
contracts.apply_loop_contracts(to_exclude_from_nondet_static);
114116

115117
// recalculate numbers, etc.
@@ -183,6 +185,7 @@ void goto_synthesizer_parse_optionst::help()
183185
"\n"
184186
"Main options:\n"
185187
HELP_DUMP_LOOP_CONTRACTS
188+
HELP_LOOP_CONTRACTS_NO_UNWIND
186189
"\n"
187190
"Other options:\n"
188191
" --version show version and exit\n"

src/goto-synthesizer/goto_synthesizer_parse_options.h

+3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ Author: Qinheping Hu
1313

1414
#include <goto-programs/goto_model.h>
1515

16+
#include <goto-instrument/contracts/contracts.h>
17+
1618
#include "dump_loop_contracts.h"
1719

1820
// clang-format off
1921
#define GOTO_SYNTHESIZER_OPTIONS \
2022
OPT_DUMP_LOOP_CONTRACTS \
23+
"(" FLAG_LOOP_CONTRACTS_NO_UNWIND ")" \
2124
"(verbosity):(version)(xml-ui)(json-ui)" \
2225
// empty last line
2326

0 commit comments

Comments
 (0)