Skip to content

Commit f6c38d9

Browse files
authored
Merge pull request #934 from diffblue/prop_handles
BMC: return property handles/literals
2 parents a2cd909 + 4700fa7 commit f6c38d9

File tree

8 files changed

+19
-26
lines changed

8 files changed

+19
-26
lines changed

src/ebmc/bdd_engine.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ void bdd_enginet::compute_counterexample(
409409
auto netlist_property = netlist.properties.find(property.identifier);
410410
CHECK_RETURN(netlist_property != netlist.properties.end());
411411

412-
::unwind_property(
413-
netlist_property->second, bmc_map, property.timeframe_literals);
412+
property.timeframe_literals =
413+
::unwind_property(netlist_property->second, bmc_map);
414414

415415
// we need the propertyt to fail in one of the timeframes
416416
bvt clause=property.timeframe_literals;

src/ebmc/bmc.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,8 @@ property_checker_resultt bmc(
230230
continue;
231231
}
232232

233-
::property(
234-
property.normalized_expr,
235-
property.timeframe_handles,
236-
message_handler,
237-
solver,
238-
bound + 1,
239-
ns);
233+
property.timeframe_handles = ::property(
234+
property.normalized_expr, message_handler, solver, bound + 1, ns);
240235

241236
// If it's an assumption, then add it as constraint.
242237
if(property.is_assumed())

src/ebmc/cegar/bmc_cegar.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void bmc_cegart::unwind(
7878
for(auto &property_it : netlist.properties)
7979
{
8080
auto &prop_bv = prop_bv_map[property_it.first];
81-
unwind_property(property_it.second, bmc_map, prop_bv);
81+
prop_bv = unwind_property(property_it.second, bmc_map);
8282

8383
disjuncts.push_back(!solver.land(prop_bv));
8484
}

src/ebmc/property_checker.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ property_checker_resultt bit_level_bmc(
257257
auto netlist_property = netlist.properties.find(property.identifier);
258258
CHECK_RETURN(netlist_property != netlist.properties.end());
259259

260-
::unwind_property(
261-
netlist_property->second, bmc_map, property.timeframe_literals);
260+
property.timeframe_literals =
261+
::unwind_property(netlist_property->second, bmc_map);
262262

263263
if(property.is_assumed())
264264
{

src/trans-netlist/unwind_netlist.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -141,21 +141,22 @@ Function: unwind_property
141141
142142
\*******************************************************************/
143143

144-
void unwind_property(
144+
bvt unwind_property(
145145
const netlistt::propertyt &property,
146-
const bmc_mapt &bmc_map,
147-
bvt &prop_bv)
146+
const bmc_mapt &bmc_map)
148147
{
149148
PRECONDITION(std::holds_alternative<netlistt::Gpt>(property));
150149
auto property_node = std::get<netlistt::Gpt>(property).p;
151150

152-
prop_bv.resize(bmc_map.timeframe_map.size());
151+
bvt prop_bv{bmc_map.timeframe_map.size()};
153152

154153
for(std::size_t t = 0; t < bmc_map.timeframe_map.size(); t++)
155154
{
156155
literalt l=bmc_map.translate(t, property_node);
157156
prop_bv[t]=l;
158157
}
158+
159+
return prop_bv;
159160
}
160161

161162
/*******************************************************************\

src/trans-netlist/unwind_netlist.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ void unwind(
3636
bool netlist_bmc_supports_property(const class exprt &);
3737

3838
// unwind a netlist property
39-
void unwind_property(
40-
const netlistt::propertyt &,
41-
const bmc_mapt &,
42-
bvt &prop_bv);
39+
bvt unwind_property(const netlistt::propertyt &, const bmc_mapt &);
4340

4441
#endif

src/trans-word-level/property.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -682,9 +682,8 @@ Function: property
682682
683683
\*******************************************************************/
684684

685-
void property(
685+
exprt::operandst property(
686686
const exprt &property_expr,
687-
exprt::operandst &prop_handles,
688687
message_handlert &message_handler,
689688
decision_proceduret &solver,
690689
std::size_t no_timeframes,
@@ -696,8 +695,8 @@ void property(
696695
auto obligations = property_obligations(property_expr, no_timeframes);
697696

698697
// Map obligations onto timeframes.
699-
prop_handles.clear();
700-
prop_handles.resize(no_timeframes, true_exprt());
698+
exprt::operandst prop_handles{no_timeframes, true_exprt()};
699+
701700
for(auto &obligation_it : obligations.map)
702701
{
703702
auto t = obligation_it.first;
@@ -706,4 +705,6 @@ void property(
706705
auto t_int = numeric_cast_v<std::size_t>(t);
707706
prop_handles[t_int] = solver.handle(conjunction(obligation_it.second));
708707
}
708+
709+
return prop_handles;
709710
}

src/trans-word-level/property.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ Author: Daniel Kroening, [email protected]
1616

1717
#include <solvers/decision_procedure.h>
1818

19-
void property(
19+
exprt::operandst property(
2020
const exprt &property_expr,
21-
exprt::operandst &prop_handles,
2221
message_handlert &,
2322
decision_proceduret &solver,
2423
std::size_t no_timeframes,

0 commit comments

Comments
 (0)