Go to the documentation of this file.
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(f_it->second.body_available())
79 out <<
"//// Function: " << f_it->first <<
"\n";
83 output(f_it->second.body, f_it->first, out);
91 std::ostream &out)
const
95 out <<
"**** " << i_it->location_number <<
" "
96 << i_it->source_location <<
"\n";
125 update(f_it->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();
443 fixedpoint(it->first, it->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;
484 if(is_threaded(t_it))
486 thread_wl.push_back(wl_entryt(it->first, it->second.body, t_it));
489 it->second.body.instructions.end();
499 bool new_shared=
true;
504 for(
const auto &thread : thread_wl)
510 merge(begin_state, shared_state, thread.location);
512 while(!working_set.empty())
517 thread.function_identifier,
520 *thread.goto_program,
526 if(l->is_end_function())
529 new_shared|=
merge_shared(shared_state, end_state, sh_target);
void sequential_fixedpoint(const goto_functionst &goto_functions)
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
virtual void output(const goto_functionst &goto_functions, std::ostream &out) const
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)
virtual bool has_location(locationt l) const =0
virtual void generate_state(locationt l)=0
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
Split an expression into a base object and a (byte) offset.
std::map< unsigned, locationt > working_sett
virtual void transform(const namespacet &ns, const irep_idt &function_from, locationt from, const irep_idt &function_to, locationt to)=0
virtual void output(const namespacet &, std::ostream &) const
Base class for all expressions.
bool visit(const irep_idt &function_identifier, locationt l, working_sett &working_set, const goto_programt &goto_program, const goto_functionst &goto_functions)
functions_donet functions_done
std::list< Target > get_successors(Target target) const
Get control-flow successors of a given instruction.
virtual bool merge_shared(statet &a, const statet &b, locationt to)=0
function_mapt function_map
static exprt get_return_lhs(locationt to)
void put_in_working_set(working_sett &working_set, locationt l)
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)
targett add_instruction()
Adds an instruction at the end.
codet representation of a function call statement.
const std::string & id2string(const irep_idt &d)
void concurrent_fixedpoint(const goto_functionst &goto_functions)
std::ostream & output_instruction(const namespacet &ns, const irep_idt &identifier, std::ostream &out, const instructionst::value_type &instruction) const
Output a single instruction.
const irep_idt & get_identifier() const
exprt boolean_negate(const exprt &src)
negate a Boolean expression, possibly removing a not_exprt, and swapping false and true
Over-approximate Concurrency for Threaded Goto Programs.
virtual void operator()(const irep_idt &function_identifier, const goto_programt &goto_program)
const object_descriptor_exprt & to_object_descriptor_expr(const exprt &expr)
Cast an exprt to an object_descriptor_exprt.
virtual bool merge(statet &a, const statet &b, locationt to)=0
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const code_function_callt & to_code_function_call(const codet &code)
std::vector< exprt > operandst
virtual void get_reference_set(locationt l, const exprt &expr, std::list< exprt > &dest)=0
::goto_functiont goto_functiont
goto_programt::const_targett locationt
void generate_states(const goto_functionst &goto_functions)
instructionst instructions
The list of instructions in the goto program.
Deprecated expression utility functions.
A collection of goto functions.
A generic container class for the GOTO intermediate representation of one function.
#define forall_goto_functions(it, functions)
instructionst::const_iterator const_targett
const irept & get_nil_irep()
static exprt get_guard(locationt from, locationt to)
virtual std::unique_ptr< statet > make_temporary_state(statet &s)=0
The Boolean constant true.
API to expression classes.
virtual void update(const goto_programt &goto_program)
virtual statet & get_state(locationt l)=0
recursion_sett recursion_set
virtual void initialize(const goto_programt &goto_program)
#define forall_goto_program_instructions(it, program)
bool fixedpoint(const irep_idt &function_identifier, const goto_programt &goto_program, const goto_functionst &goto_functions)
locationt get_next(working_sett &working_set)