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());
67 fixedpoint(function_identifier, goto_program, goto_functions);
72 std::ostream &out)
const
76 if(gf_entry.second.body_available())
79 out <<
"//// Function: " << gf_entry.first <<
"\n";
83 output(gf_entry.second.body, gf_entry.first, out);
91 std::ostream &out)
const
95 out <<
"**** " << i_it->location_number <<
" "
96 << i_it->source_location <<
"\n";
125 update(gf_entry.second.body);
153 assert(!working_set.empty());
155 working_sett::iterator i=working_set.begin();
157 working_set.erase(i);
163 const irep_idt &function_identifier,
178 while(!working_set.empty())
182 if(
visit(function_identifier, l, working_set, goto_program, goto_functions))
190 const irep_idt &function_identifier,
207 std::unique_ptr<statet> tmp_state(
210 statet &new_values=*tmp_state;
212 if(l->is_function_call())
229 ns, function_identifier, l, function_identifier, to_l);
233 bool have_new_values=
234 merge(other, new_values, to_l);
239 if(have_new_values || !other.
seen)
251 const goto_functionst::function_mapt::const_iterator f_it,
257 if(!goto_function.body_available())
260 assert(!goto_function.body.instructions.empty());
264 locationt l_begin=goto_function.body.instructions.begin();
268 tmp_state->transform(
ns, calling_function, l_call, f_it->first, l_begin);
275 if(
merge(begin_state, *tmp_state, l_begin))
290 fixedpoint(f_it->first, goto_function.body, goto_functions);
296 locationt l_end=--goto_function.body.instructions.end();
298 assert(l_end->is_end_function());
303 std::unique_ptr<statet> tmp_state(
305 tmp_state->transform(
ns, f_it->first, l_end, calling_function, l_return);
310 merge(new_state, *tmp_state, l_return);
316 ns, calling_function, l_call, calling_function, l_return);
324 const exprt &
function,
333 if(
function.
id()==ID_symbol)
345 goto_functionst::function_mapt::const_iterator it=
349 throw "failed to find function "+
id2string(identifier);
362 else if(
function.
id()==ID_if)
364 if(
function.operands().size()!=3)
365 throw "if takes three arguments";
387 merge(new_state, *n2, l_return);
389 else if(
function.
id()==ID_dereference)
392 std::list<exprt> values;
398 for(
const auto &value : values)
400 if(value.id()==ID_object_descriptor)
412 merge(new_state, *n2, l_return);
416 else if(
function.
id() == ID_null_object ||
417 function.
id() == ID_integer_address)
421 else if(
function.
id()==ID_member ||
function.
id()==ID_index)
425 else if(
function.
id()==
"builtin-function")
431 throw "unexpected function_call argument: "+
432 function.id_string();
444 fixedpoint(gf_entry.first, gf_entry.second.body, goto_functions);
466 const irep_idt &_function_identifier,
469 : function_identifier(_function_identifier),
470 goto_program(&_goto_program),
480 typedef std::list<wl_entryt> thread_wlt;
481 thread_wlt thread_wl;
487 if(is_threaded(t_it))
490 wl_entryt(gf_entry.first, gf_entry.second.body, t_it));
493 gf_entry.second.body.instructions.end();
504 bool new_shared=
true;
509 for(
const auto &thread : thread_wl)
515 merge(begin_state, shared_state, thread.location);
517 while(!working_set.empty())
522 thread.function_identifier,
525 *thread.goto_program,
531 if(l->is_end_function())
534 new_shared|=
merge_shared(shared_state, end_state, sh_target);
codet representation of a function call statement.
virtual void output(const namespacet &, std::ostream &) const
virtual void transform(const namespacet &ns, const irep_idt &function_from, locationt from, const irep_idt &function_to, locationt to)=0
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
std::vector< exprt > operandst
A collection of goto functions.
function_mapt function_map
::goto_functiont goto_functiont
A generic container class for the GOTO intermediate representation of one function.
instructionst instructions
The list of instructions in the goto program.
instructionst::const_iterator const_targett
targett add_instruction()
Adds an instruction at the end.
std::ostream & output_instruction(const namespacet &ns, const irep_idt &identifier, std::ostream &out, const instructionst::value_type &instruction) const
Output a single instruction.
std::list< Target > get_successors(Target target) const
Get control-flow successors of a given instruction.
Split an expression into a base object and a (byte) offset.
void generate_states(const goto_functionst &goto_functions)
void do_function_call(const irep_idt &calling_function, locationt l_call, locationt l_return, const goto_functionst &goto_functions, const goto_functionst::function_mapt::const_iterator f_it, const exprt::operandst &arguments, statet &new_state)
locationt get_next(working_sett &working_set)
virtual bool has_location(locationt l) const =0
bool visit(const irep_idt &function_identifier, locationt l, working_sett &working_set, const goto_programt &goto_program, const goto_functionst &goto_functions)
virtual std::unique_ptr< statet > make_temporary_state(statet &s)=0
bool fixedpoint(const irep_idt &function_identifier, const goto_programt &goto_program, const goto_functionst &goto_functions)
virtual void get_reference_set(locationt l, const exprt &expr, std::list< exprt > &dest)=0
void put_in_working_set(working_sett &working_set, locationt l)
void sequential_fixedpoint(const goto_functionst &goto_functions)
void concurrent_fixedpoint(const goto_functionst &goto_functions)
virtual void operator()(const irep_idt &function_identifier, const goto_programt &goto_program)
static exprt get_return_lhs(locationt to)
virtual void generate_state(locationt l)=0
virtual void update(const goto_programt &goto_program)
void do_function_call_rec(const irep_idt &calling_function, locationt l_call, locationt l_return, const exprt &function, const exprt::operandst &arguments, statet &new_state, const goto_functionst &goto_functions)
static exprt get_guard(locationt from, locationt to)
functions_donet functions_done
virtual void initialize(const goto_programt &goto_program)
std::map< unsigned, locationt > working_sett
goto_programt::const_targett locationt
virtual bool merge_shared(statet &a, const statet &b, locationt to)=0
virtual bool merge(statet &a, const statet &b, locationt to)=0
virtual void output(const goto_functionst &goto_functions, std::ostream &out) const
recursion_sett recursion_set
virtual statet & get_state(locationt l)=0
const irep_idt & get_identifier() const
The Boolean constant true.
exprt boolean_negate(const exprt &src)
negate a Boolean expression, possibly removing a not_exprt, and swapping false and true
Deprecated expression utility functions.
#define forall_goto_program_instructions(it, program)
const irept & get_nil_irep()
const std::string & id2string(const irep_idt &d)
Over-approximate Concurrency for Threaded Goto Programs.
API to expression classes for Pointers.
const object_descriptor_exprt & to_object_descriptor_expr(const exprt &expr)
Cast an exprt to an object_descriptor_exprt.
const code_function_callt & to_code_function_call(const codet &code)
API to expression classes.
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.