@@ -62,11 +62,13 @@ void csvsa_function_contextt::csvsa_visit(locationt l)
62
62
{
63
63
// Function returns are special-- if anything changed,
64
64
// queue all of this context's callsites' successors:
65
- const auto &end_state = (*this )[l];
66
- std::unique_ptr<const value_set_domaint> end_state_without_locals;
65
+ auto &end_state = (*this )[l];
66
+ end_state.set_seen ();
67
+
68
+ std::unique_ptr<const domaint> end_state_without_locals;
67
69
for (const auto &caller : callers)
68
70
{
69
- const value_set_domaint *export_state;
71
+ const domaint *export_state;
70
72
// Remove locals only on an edge that leaves a recursive part
71
73
// of the program:
72
74
if (recursive_status == RECURSIVE_CHILD)
@@ -120,7 +122,7 @@ void csvsa_function_contextt::csvsa_visit(locationt l)
120
122
121
123
void csvsa_function_contextt::merge_call_return_state (
122
124
locationt call_loc,
123
- const value_set_domaint &callee_state)
125
+ const domaint &callee_state)
124
126
{
125
127
value_sett callee_values = callee_state.value_set ;
126
128
@@ -203,9 +205,12 @@ bool csvsa_function_contextt::assign_formal_parameters(
203
205
if (param_id.empty ())
204
206
continue ;
205
207
auto findit = entry_state_vs.values .find (param_id);
208
+ bool should_track_parameter = csvsa_should_track_value (param);
206
209
INVARIANT (
207
- findit != entry_state_vs.values .end (),
208
- " all parameters should have been assigned to by now" );
210
+ (findit != entry_state_vs.values .end ()) == should_track_parameter,
211
+ " (only) pointer-typed parameters should have been assigned to by now" );
212
+ if (!should_track_parameter)
213
+ continue ;
209
214
if (findit->second .object_map .read ().size () != *sizes_before_iter)
210
215
return true ;
211
216
++sizes_before_iter;
@@ -266,14 +271,14 @@ void csvsa_function_contextt::read_function_arguments(
266
271
}
267
272
}
268
273
269
- std::unique_ptr<const value_set_domaint >
270
- csvsa_function_contextt::cleanup_locals (const value_set_domaint &last_state)
274
+ std::unique_ptr<const csvsa_function_contextt::domaint >
275
+ csvsa_function_contextt::cleanup_locals (const domaint &last_state)
271
276
{
272
277
// Remove local variables, formal parameters etc from this function's
273
278
// final state.
274
279
// Shouldn't do this if this is a recursive function, as our locals
275
280
// will inherit values via a (mutually) recursive call:
276
- std::unique_ptr<value_set_domaint > tmp_state (static_cast <value_set_domaint *>(
281
+ std::unique_ptr<domaint > tmp_state (static_cast <domaint *>(
277
282
make_temporary_state (last_state).release ()));
278
283
std::vector<irep_idt> to_erase;
279
284
for (const auto &kv : last_state.value_set .values )
@@ -689,10 +694,11 @@ void csvsa_function_contextt::print_tree(
689
694
}
690
695
}
691
696
692
- std::unique_ptr<context_sensitive_value_set_analysis_drivert>
697
+ static std::unique_ptr<context_sensitive_value_set_analysis_drivert>
693
698
csvsa_load_and_analyze_functions (
694
699
lazy_goto_modelt &lazy_model,
695
- message_handlert &msg)
700
+ message_handlert &msg,
701
+ bool use_sparse_domains)
696
702
{
697
703
get_goto_programt get_function_from_lazy_model =
698
704
[&lazy_model](const irep_idt &name) -> const goto_programt & {
@@ -701,14 +707,32 @@ csvsa_load_and_analyze_functions(
701
707
702
708
std::unique_ptr<context_sensitive_value_set_analysis_drivert> driver =
703
709
util_make_unique<context_sensitive_value_set_analysis_drivert>(
704
- lazy_model.symbol_table , get_function_from_lazy_model);
710
+ lazy_model.symbol_table ,
711
+ get_function_from_lazy_model,
712
+ use_sparse_domains);
705
713
driver->set_message_handler (msg);
706
714
707
715
(*driver)(goto_functionst::entry_point ());
708
716
709
717
return driver;
710
718
}
711
719
720
+ std::unique_ptr<context_sensitive_value_set_analysis_drivert>
721
+ csvsa_load_and_analyze_functions (
722
+ lazy_goto_modelt &lazy_model,
723
+ message_handlert &msg)
724
+ {
725
+ return csvsa_load_and_analyze_functions (lazy_model, msg, true );
726
+ }
727
+
728
+ std::unique_ptr<context_sensitive_value_set_analysis_drivert>
729
+ csvsa_load_and_analyze_functions_without_sparse_domains (
730
+ lazy_goto_modelt &lazy_model,
731
+ message_handlert &msg)
732
+ {
733
+ return csvsa_load_and_analyze_functions (lazy_model, msg, false );
734
+ }
735
+
712
736
bool context_sensitive_value_set_analysis_drivert
713
737
::compare_working_set_entriest::operator ()(
714
738
const working_set_entryt &a, const working_set_entryt &b)
0 commit comments