12 #define USE_DEPRECATED_STATIC_ANALYSIS_H
30 else if(std::next(from) == to)
33 return from->get_condition();
42 if(to->is_end_function())
46 assert(to->is_function_call());
66 fixedpoint(function_identifier, goto_program, goto_functions);
71 std::ostream &out)
const
75 if(gf_entry.second.body_available())
78 out <<
"//// Function: " << gf_entry.first <<
"\n";
82 output(gf_entry.second.body, gf_entry.first, out);
90 std::ostream &out)
const
94 out <<
"**** " << i_it->location_number <<
" "
95 << i_it->source_location <<
"\n";
124 update(gf_entry.second.body);
152 assert(!working_set.empty());
154 working_sett::iterator i=working_set.begin();
156 working_set.erase(i);
162 const irep_idt &function_identifier,
177 while(!working_set.empty())
181 if(
visit(function_identifier, l, working_set, goto_program, goto_functions))
189 const irep_idt &function_identifier,
206 std::unique_ptr<statet> tmp_state(
209 statet &new_values=*tmp_state;
211 if(l->is_function_call())
227 ns, function_identifier, l, function_identifier, to_l);
231 bool have_new_values=
232 merge(other, new_values, to_l);
237 if(have_new_values || !other.
seen)
249 const goto_functionst::function_mapt::const_iterator f_it,
255 if(!goto_function.body_available())
258 assert(!goto_function.body.instructions.empty());
262 locationt l_begin=goto_function.body.instructions.begin();
266 tmp_state->
transform(
ns, calling_function, l_call, f_it->first, l_begin);
273 if(
merge(begin_state, *tmp_state, l_begin))
288 fixedpoint(f_it->first, goto_function.body, goto_functions);
294 locationt l_end=--goto_function.body.instructions.end();
296 assert(l_end->is_end_function());
301 std::unique_ptr<statet> tmp_state(
303 tmp_state->
transform(
ns, f_it->first, l_end, calling_function, l_return);
308 merge(new_state, *tmp_state, l_return);
314 ns, calling_function, l_call, calling_function, l_return);
322 const exprt &
function,
331 if(
function.
id()==ID_symbol)
343 goto_functionst::function_mapt::const_iterator it=
347 throw "failed to find function "+
id2string(identifier);
360 else if(
function.
id()==ID_if)
362 if(
function.operands().size()!=3)
363 throw "if takes three arguments";
385 merge(new_state, *n2, l_return);
387 else if(
function.
id()==ID_dereference)
390 std::list<exprt> values;
396 for(
const auto &value : values)
398 if(value.id()==ID_object_descriptor)
410 merge(new_state, *n2, l_return);
414 else if(
function.
id() == ID_null_object ||
415 function.
id() == ID_integer_address)
419 else if(
function.
id()==ID_member ||
function.
id()==ID_index)
423 else if(
function.
id()==
"builtin-function")
429 throw "unexpected function_call argument: "+
430 function.id_string();
442 fixedpoint(gf_entry.first, gf_entry.second.body, goto_functions);
464 const irep_idt &_function_identifier,
467 : function_identifier(_function_identifier),
468 goto_program(&_goto_program),
478 typedef std::list<wl_entryt> thread_wlt;
479 thread_wlt thread_wl;
485 if(is_threaded(t_it))
488 wl_entryt(gf_entry.first, gf_entry.second.body, t_it));
491 gf_entry.second.body.instructions.end();
502 bool new_shared=
true;
507 for(
const auto &thread : thread_wl)
513 merge(begin_state, shared_state, thread.location);
515 while(!working_set.empty())
520 thread.function_identifier,
523 *thread.goto_program,
529 if(l->is_end_function())
532 new_shared|=
merge_shared(shared_state, end_state, sh_target);