27 std::ostream &out)
const 31 if(f_it->second.body_available())
34 out <<
"//// Function: " << f_it->first <<
"\n";
38 output(ns, f_it->second.body, f_it->first, out);
47 std::ostream &out)
const 51 out <<
"**** " << i_it->location_number <<
" " 52 << i_it->source_location <<
"\n";
74 if(f_it->second.body_available())
101 location[
"locationNumber"]=
103 location[
"sourceLocation"]=
105 location[
"abstractState"] =
109 std::ostringstream out;
126 xmlt program(
"program");
130 xmlt function(
"function");
132 function.set_attribute(
134 f_it->second.body_available() ?
"true" :
"false");
136 if(f_it->second.body_available())
138 function.new_element(
output_xml(ns, f_it->second.body, f_it->first));
165 i_it->source_location.as_string());
170 std::ostringstream out;
177 return function_body;
184 goto_functionst::function_mapt::const_iterator
226 working_sett::iterator i=working_set.begin();
228 working_set.erase(i);
248 while(!working_set.empty())
276 std::unique_ptr<statet> tmp_state(
279 statet &new_values=*tmp_state;
281 bool have_new_values=
false;
283 if(l->is_function_call() &&
295 have_new_values=
true;
302 new_values.
transform(l, to_l, *
this, ns);
304 if(
merge(new_values, l, to_l))
305 have_new_values=
true;
321 const goto_functionst::function_mapt::const_iterator f_it,
333 if(!goto_function.body_available())
337 tmp_state->
transform(l_call, l_return, *
this, ns);
339 return merge(*tmp_state, l_call, l_return);
342 assert(!goto_function.body.instructions.empty());
348 locationt l_begin=goto_function.body.instructions.begin();
354 tmp_state->
transform(l_call, l_begin, *
this, ns);
359 if(
merge(*tmp_state, l_call, l_begin))
364 fixedpoint(goto_function.body, goto_functions, ns);
371 locationt l_end=--goto_function.body.instructions.end();
372 assert(l_end->is_end_function());
377 if(end_state.is_bottom())
381 tmp_state->
transform(l_end, l_return, *
this, ns);
384 return merge(*tmp_state, l_end, l_return);
390 const exprt &
function,
400 function.
id() == ID_symbol,
401 "Function pointers and indirect calls must be removed before analysis.");
407 goto_functionst::function_mapt::const_iterator it =
412 "Function " +
id2string(identifier) +
"not in function map");
424 goto_functionst::function_mapt::const_iterator
428 fixedpoint(f_it->second.body, goto_functions, ns);
448 thread_wlt thread_wl;
453 if(is_threaded(t_it))
455 thread_wl.push_back(std::make_pair(&(it->second.body), t_it));
458 it->second.body.instructions.end();
467 bool new_shared=
true;
472 for(
const auto &wl_pair : thread_wl)
478 merge(begin_state, sh_target, wl_pair.second);
480 while(!working_set.empty())
484 visit(l, working_set, *(wl_pair.first), goto_functions, ns);
489 if(l->is_end_function())
490 new_shared|=
merge_shared(shared_state, l, sh_target, ns);
virtual statet & get_state(locationt l)=0
Over-approximate Concurrency for Threaded Goto Programs.
virtual void make_bottom()=0
no states
const std::string & id2string(const irep_idt &d)
void put_in_working_set(working_sett &working_set, locationt l)
goto_programt::const_targett locationt
const irep_idt & get_identifier() const
virtual bool merge(const statet &src, locationt from, locationt to)=0
function_mapt function_map
virtual std::unique_ptr< statet > abstract_state_before(locationt l) const =0
Accessing individual domains at particular locations (without needing to know what kind of domain or ...
virtual jsont output_json(const namespacet &ns, const goto_functionst &goto_functions) const
Output the domains for the whole program as JSON.
virtual void transform(locationt from, locationt to, ai_baset &ai, const namespacet &ns)=0
how function calls are treated: a) there is an edge from each call site to the function head b) there...
std::map< unsigned, locationt > working_sett
virtual void output(const namespacet &ns, const goto_functionst &goto_functions, std::ostream &out) const
jsont & push_back(const jsont &json)
The interface offered by a domain, allows code to manipulate domains without knowing their exact type...
bool do_function_call_rec(locationt l_call, locationt l_return, const exprt &function, const exprt::operandst &arguments, const goto_functionst &goto_functions, const namespacet &ns)
bool do_function_call(locationt l_call, locationt l_return, const goto_functionst &goto_functions, const goto_functionst::function_mapt::const_iterator f_it, const exprt::operandst &arguments, const namespacet &ns)
instructionst instructions
The list of instructions in the goto program.
API to expression classes.
void set_attribute(const std::string &attribute, unsigned value)
instructionst::const_iterator const_targett
std::list< Target > get_successors(Target target) const
::goto_functiont goto_functiont
void entry_state(const goto_programt &)
#define PRECONDITION(CONDITION)
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast a generic exprt to a symbol_exprt.
virtual bool merge_shared(const statet &src, locationt from, locationt to, const namespacet &ns)=0
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
xmlt & new_element(const std::string &name)
void sequential_fixedpoint(const goto_functionst &goto_functions, const namespacet &ns)
std::vector< exprt > operandst
A generic container class for the GOTO intermediate representation of one function.
bool fixedpoint(const goto_programt &goto_program, const goto_functionst &goto_functions, const namespacet &ns)
bool visit(locationt l, working_sett &working_set, const goto_programt &goto_program, const goto_functionst &goto_functions, const namespacet &ns)
virtual std::unique_ptr< statet > make_temporary_state(const statet &s)=0
static irep_idt entry_point()
std::ostream & output_instruction(const namespacet &ns, const irep_idt &identifier, std::ostream &out, const instructionst::value_type &it) const
Output a single instruction.
targett add_instruction()
Adds an instruction at the end.
Base class for all expressions.
locationt get_next(working_sett &working_set)
std::string to_string(const string_constraintt &expr)
Used for debug printing.
bool empty() const
Is the program empty?
virtual void initialize(const goto_programt &)
goto_programt & goto_program
void concurrent_fixedpoint(const goto_functionst &goto_functions, const namespacet &ns)
virtual xmlt output_xml(const namespacet &ns, const goto_functionst &goto_functions) const
Output the domains for the whole program as XML.
#define DATA_INVARIANT(CONDITION, REASON)
#define forall_goto_functions(it, functions)
#define forall_goto_program_instructions(it, program)
const code_function_callt & to_code_function_call(const codet &code)