32 exprt tmp(from->guard);
46 if(to->is_end_function())
50 assert(to->is_function_call());
79 out <<
"////\n" <<
"//// Function: " << f_it->first <<
"\n////\n\n";
81 output(f_it->second.body, f_it->first, out);
88 std::ostream &out)
const 97 assert(!working_set.empty());
127 while(!working_set.empty())
131 if(
visit(l, working_set, goto_program, goto_functions))
147 std::cout <<
"Visiting: " << l->function <<
" " <<
148 l->location_number <<
'\n';
164 if(l->is_function_call())
181 if(changed || !
seen(to_l))
208 const goto_functionst::function_mapt::const_iterator f_it,
226 r->function=f_it->first;
227 r->location_number=0;
230 t->code.set(ID_identifier, code.
function());
231 t->function=f_it->first;
232 t->location_number=1;
237 new_data = state.
transform(
ns, t, l_next) || new_data;
242 assert(!goto_function.
body.instructions.empty());
274 assert(l_end->is_end_function());
279 new_data = state.
transform(
ns, l_end, l_next) || new_data;
287 const exprt &
function,
292 bool new_data =
false;
294 if(
function.
id()==ID_symbol)
296 const irep_idt &identifier=
function.get(ID_identifier);
306 goto_functionst::function_mapt::const_iterator it=
310 throw "failed to find function "+
id2string(identifier);
322 else if(
function.
id()==ID_if)
324 if(
function.operands().size()!=3)
325 throw "if takes three arguments";
341 goto_functions) || new_data;
343 else if(
function.
id()==ID_dereference)
351 for(
const auto &v : values)
353 if(v.id()==ID_object_descriptor)
358 goto_functionst::function_mapt::const_iterator it=
369 goto_functions) || new_data;
374 else if(
function.
id()==
"NULL-object")
378 else if(
function.
id()==ID_member ||
function.id()==ID_index)
382 else if(
function.
id()==
"builtin-function")
388 throw "unexpected function_call argument: "+
389 function.id_string();
408 const goto_functionst::function_mapt::const_iterator it,
412 return fixedpoint(it->second.body, goto_functions);
const irept & get_nil_irep()
bool body_available() const
std::map< locationt, unsigned > statistics
targett add_instruction()
Adds an instruction at the end.
exprt get_guard(locationt from, locationt to) const
const std::string & id2string(const irep_idt &d)
virtual void get_reference_set(const exprt &expr, expr_sett &expr_set)=0
std::set< locationt > seen_locations
instructionst instructions
The list of instructions in the goto program.
virtual void operator()(const goto_programt &goto_program)
locationt get_next(working_sett &working_set)
functions_donet functions_done
virtual bool transform(const namespacet &ns, locationt from, locationt to)=0
bool visit(locationt l, working_sett &working_set, const goto_programt &goto_program, const goto_functionst &goto_functions)
virtual void update(const goto_programt &goto_program)
virtual void output(const namespacet &ns, std::ostream &out) const
virtual statet & get_state()=0
std::list< Target > get_successors(Target target) const
goto_programt::const_targett locationt
The boolean constant true.
flow_insensitive_abstract_domain_baset::expr_sett expr_sett
bool do_function_call(locationt l_call, const goto_functionst &goto_functions, const goto_functionst::function_mapt::const_iterator f_it, const exprt::operandst &arguments, statet &new_state)
API to expression classes.
const irep_idt & get(const irep_namet &name) const
A side effect that returns a non-deterministically chosen value.
split an expression into a base object and a (byte) offset
goto_programt::const_targett locationt
virtual void initialize(const goto_programt &goto_program)
function_mapt function_map
std::vector< exprt > operandst
const object_descriptor_exprt & to_object_descriptor_expr(const exprt &expr)
Cast a generic exprt to an object_descriptor_exprt.
A specialization of goto_program_templatet over goto programs in which instructions have codet type...
bool seen(const locationt &l)
Flow Insensitive Static Analysis.
exprt get_return_lhs(locationt to) const
Base class for all expressions.
const codet & to_code(const exprt &expr)
#define forall_goto_functions(it, functions)
bool fixedpoint(const goto_programt &goto_program, const goto_functionst &goto_functions)
virtual void output(const goto_functionst &goto_functions, std::ostream &out)
void put_in_working_set(working_sett &working_set, locationt l)
std::priority_queue< locationt > working_sett
const code_function_callt & to_code_function_call(const codet &code)
bool do_function_call_rec(locationt l_call, const exprt &function, const exprt::operandst &arguments, statet &new_state, const goto_functionst &goto_functions)
recursion_sett recursion_set
instructionst::iterator targett