25 else if(std::next(from) == to)
28 return from->condition();
36 if(to->is_end_function())
40 return to->call_lhs();
55 fixedpoint(function_id, goto_program, goto_functions);
65 <<
"//// Function: " << gf_entry.first <<
"\n////\n\n";
67 output(gf_entry.first, gf_entry.second.body, out);
114 while(!working_set.empty())
118 if(
visit(function_id, l, working_set, goto_program, goto_functions))
135 std::cout <<
"Visiting: " << l->function <<
" " <<
136 l->location_number <<
'\n';
152 if(l->is_function_call())
166 if(changed || !
seen(to_l))
194 const goto_functionst::function_mapt::const_iterator f_it,
200 if(!goto_function.body_available())
206 l_call->call_lhs().type(), l_call->source_location())));
207 r->location_number=0;
210 t->location_number=1;
216 state.
transform(
ns, calling_function, l_call, f_it->first,
r);
218 new_data = state.
transform(
ns, f_it->first,
r, f_it->first, t) || new_data;
221 state.
transform(
ns, f_it->first, t, calling_function, l_next) || new_data;
227 !goto_function.body.instructions.empty(),
"body must be present");
233 locationt l_begin=goto_function.body.instructions.begin();
237 state.
transform(
ns, calling_function, l_call, f_it->first, l_begin);
251 fixedpoint(f_it->first, goto_function.body, goto_functions);
258 locationt l_end=--goto_function.body.instructions.end();
260 DATA_INVARIANT(l_end->is_end_function(),
"must be end of function");
266 state.
transform(
ns, f_it->first, l_end, calling_function, l_next) ||
276 const exprt &
function,
281 bool new_data =
false;
283 if(
function.
id()==ID_symbol)
295 goto_functionst::function_mapt::const_iterator it=
299 throw "failed to find function "+
id2string(identifier);
302 calling_function, l_call, goto_functions, it, arguments, state);
306 else if(
function.
id()==ID_if)
321 if_expr.false_case(),
327 else if(
function.
id()==ID_dereference)
335 for(
const auto &v : values)
337 if(v.id()==ID_object_descriptor)
342 goto_functionst::function_mapt::const_iterator it=
359 else if(
function.
id() == ID_null_object)
363 else if(
function.
id()==ID_member ||
function.
id()==ID_index)
367 else if(
function.
id()==
"builtin-function")
373 throw "unexpected function_call argument: "+
374 function.id_string();
389 fixedpoint(gf_entry.first, gf_entry.second.body, goto_functions);
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
exprt get_guard(locationt from, locationt to) const
virtual void output(const namespacet &, std::ostream &) const
exprt get_return_lhs(locationt to) const
virtual bool transform(const namespacet &ns, const irep_idt &function_from, locationt from, const irep_idt &function_to, locationt to)=0
goto_programt::const_targett locationt
functions_donet functions_done
std::map< locationt, unsigned, goto_programt::target_less_than > statistics
virtual void output(const goto_functionst &goto_functions, std::ostream &out)
std::priority_queue< locationt, std::vector< locationt >, goto_programt::target_less_than > working_sett
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
locationt get_next(working_sett &working_set)
recursion_sett recursion_set
std::set< locationt, goto_programt::target_less_than > seen_locations
bool fixedpoint(const irep_idt &function_id, const goto_programt &goto_program, const goto_functionst &goto_functions)
virtual statet & get_state()=0
bool seen(const locationt &l)
bool visit(const irep_idt &function_id, locationt l, working_sett &working_set, const goto_programt &goto_program, const goto_functionst &goto_functions)
virtual void update(const goto_programt &goto_program)
flow_insensitive_abstract_domain_baset::expr_sett expr_sett
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)
goto_programt::const_targett locationt
virtual void initialize(const goto_programt &)
void put_in_working_set(working_sett &working_set, locationt l)
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)
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.
static instructiont make_set_return_value(exprt return_value, const source_locationt &l=source_locationt::nil())
static instructiont make_end_function(const source_locationt &l=source_locationt::nil())
instructionst::iterator targett
std::list< Target > get_successors(Target target) const
Get control-flow successors of a given instruction.
targett add(instructiont &&instruction)
Adds a given instruction at the end.
const irep_idt & get(const irep_idt &name) const
Split an expression into a base object and a (byte) offset.
A side_effect_exprt that returns a non-deterministically chosen value.
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.
Flow Insensitive Static Analysis.
const irept & get_nil_irep()
const std::string & id2string(const irep_idt &d)
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.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define PRECONDITION(CONDITION)
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.