Go to the documentation of this file.
27 else if(std::next(from) == to)
30 return from->get_condition();
38 if(to->is_end_function())
57 fixedpoint(function_id, goto_program, goto_functions);
66 out <<
"////\n" <<
"//// Function: " << f_it->first <<
"\n////\n\n";
68 output(f_it->first, f_it->second.body, out);
84 assert(!working_set.empty());
115 while(!working_set.empty())
119 if(
visit(function_id, l, working_set, goto_program, goto_functions))
136 std::cout <<
"Visiting: " << l->function <<
" " <<
137 l->location_number <<
'\n';
153 if(l->is_function_call())
169 if(changed || !
seen(to_l))
197 const goto_functionst::function_mapt::const_iterator f_it,
203 if(!goto_function.body_available())
211 r->location_number=0;
214 t->location_number=1;
220 state.
transform(
ns, calling_function, l_call, f_it->first,
r);
222 new_data = state.
transform(
ns, f_it->first,
r, f_it->first, t) || new_data;
225 state.
transform(
ns, f_it->first, t, calling_function, l_next) || new_data;
230 assert(!goto_function.body.instructions.empty());
236 locationt l_begin=goto_function.body.instructions.begin();
240 state.
transform(
ns, calling_function, l_call, f_it->first, l_begin);
254 fixedpoint(f_it->first, goto_function.body, goto_functions);
261 locationt l_end=--goto_function.body.instructions.end();
263 assert(l_end->is_end_function());
269 state.
transform(
ns, f_it->first, l_end, calling_function, l_next) ||
279 const exprt &
function,
284 bool new_data =
false;
286 if(
function.
id()==ID_symbol)
298 goto_functionst::function_mapt::const_iterator it=
302 throw "failed to find function "+
id2string(identifier);
305 calling_function, l_call, goto_functions, it, arguments, state);
309 else if(
function.
id()==ID_if)
324 if_expr.false_case(),
330 else if(
function.
id()==ID_dereference)
338 for(
const auto &v : values)
340 if(v.id()==ID_object_descriptor)
345 goto_functionst::function_mapt::const_iterator it=
362 else if(
function.
id() == ID_null_object)
366 else if(
function.
id()==ID_member ||
function.
id()==ID_index)
370 else if(
function.
id()==
"builtin-function")
376 throw "unexpected function_call argument: "+
377 function.id_string();
396 const goto_functionst::function_mapt::const_iterator it,
400 return fixedpoint(it->first, it->second.body, goto_functions);
virtual void update(const goto_programt &goto_program)
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
virtual statet & get_state()=0
bool visit(const irep_idt &function_id, locationt l, working_sett &working_set, const goto_programt &goto_program, const goto_functionst &goto_functions)
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.
static instructiont make_end_function(const source_locationt &l=source_locationt::nil())
targett add(instructiont &&instruction)
Adds a given instruction at the end.
Base class for all expressions.
recursion_sett recursion_set
std::list< Target > get_successors(Target target) const
Get control-flow successors of a given instruction.
function_mapt function_map
std::priority_queue< locationt > working_sett
exprt get_return_lhs(locationt to) const
virtual void initialize(const goto_programt &)
std::set< locationt > seen_locations
virtual void output(const namespacet &, std::ostream &) const
typet & type()
Return the type of the expression.
codet representation of a function call statement.
bool do_function_call_rec(const irep_idt &calling_function, locationt l_call, const exprt &function, const exprt::operandst &arguments, statet &new_state, const goto_functionst &goto_functions)
bool fixedpoint(const irep_idt &function_id, const goto_programt &goto_program, const goto_functionst &goto_functions)
virtual void operator()(const irep_idt &function_id, const goto_programt &goto_program)
virtual void get_reference_set(const exprt &expr, expr_sett &expr_set)=0
goto_programt::const_targett locationt
functions_donet functions_done
const std::string & id2string(const irep_idt &d)
const source_locationt & source_location() const
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
const object_descriptor_exprt & to_object_descriptor_expr(const exprt &expr)
Cast an exprt to an object_descriptor_exprt.
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)
void put_in_working_set(working_sett &working_set, locationt l)
std::vector< exprt > operandst
Flow Insensitive Static Analysis.
static instructiont make_return(const source_locationt &l=source_locationt::nil())
virtual void output(const goto_functionst &goto_functions, std::ostream &out)
A side_effect_exprt that returns a non-deterministically chosen value.
::goto_functiont goto_functiont
bool do_function_call(const irep_idt &calling_function, locationt l_call, const goto_functionst &goto_functions, const goto_functionst::function_mapt::const_iterator f_it, const exprt::operandst &arguments, statet &new_state)
instructionst instructions
The list of instructions in the goto program.
Deprecated expression utility functions.
std::map< locationt, unsigned > statistics
exprt get_guard(locationt from, locationt to) const
A collection of goto functions.
goto_programt::const_targett locationt
codet representation of a "return from a function" statement.
const irep_idt & get(const irep_namet &name) const
virtual bool transform(const namespacet &ns, const irep_idt &function_from, locationt from, const irep_idt &function_to, locationt to)=0
flow_insensitive_abstract_domain_baset::expr_sett expr_sett
A generic container class for the GOTO intermediate representation of one function.
#define forall_goto_functions(it, functions)
const irept & get_nil_irep()
The Boolean constant true.
bool seen(const locationt &l)
locationt get_next(working_sett &working_set)
API to expression classes.
instructionst::iterator targett