49 std::size_t function_calls;
59 m.
warning() <<
"**** WARNING: This simplification is currently known to be "
60 "unsound for input programs which include recursion. Do not "
61 "use it if soundness is important for your use case."
72 exprt cond = i_it->condition();
81 i_it->condition_nonconst() = cond;
84 else if(i_it->is_assume())
86 exprt cond = i_it->condition();
95 i_it->condition_nonconst() = cond;
98 else if(i_it->is_goto())
100 exprt cond = i_it->condition();
109 i_it->condition_nonconst() = cond;
112 else if(i_it->is_assign())
120 i_it->assign_lhs_nonconst(), ns);
123 i_it->assign_rhs_nonconst(), ns);
125 if(unchanged_lhs && unchanged_rhs)
126 unmodified.assigns++;
128 simplified.assigns++;
130 else if(i_it->is_function_call())
133 auto call_function =
as_const(*i_it).call_function();
134 auto call_arguments =
as_const(*i_it).call_arguments();
139 for(
auto &o : call_arguments)
143 unmodified.function_calls++;
146 simplified.function_calls++;
147 i_it->call_function() = std::move(call_function);
148 i_it->call_arguments() = std::move(call_arguments);
157 m.
status() <<
"Simplified: "
158 <<
" assert: " << simplified.asserts
159 <<
", assume: " << simplified.assumes
160 <<
", goto: " << simplified.gotos
161 <<
", assigns: " << simplified.assigns
162 <<
", function calls: " << simplified.function_calls
165 <<
" assert: " << unmodified.asserts
166 <<
", assume: " << unmodified.assumes
167 <<
", goto: " << unmodified.gotos
168 <<
", assigns: " << unmodified.assigns
169 <<
", function calls: " << unmodified.function_calls
const T & as_const(T &value)
Return a reference to the same object but ensures the type is const.
This is the basic interface of the abstract interpreter with default implementations of the core func...
virtual cstate_ptrt abstract_state_before(locationt l) const
Get a copy of the abstract state before the given instruction, without needing to know what kind of d...
Base class for all expressions.
function_mapt function_map
symbol_tablet symbol_table
Symbol table.
goto_functionst goto_functions
GOTO functions.
Class that provides messages with a built-in verbosity 'level'.
mstreamt & warning() const
mstreamt & status() const
mstreamt & progress() const
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
const symbol_table_baset & get_symbol_table() const
Return first symbol table registered with the namespace.
bool get_bool_option(const std::string &option) const
#define Forall_goto_program_instructions(it, program)
void restore_returns(goto_modelt &goto_model)
restores return statements
Replace function returns by assignments to global variables.
void remove_skip(goto_programt &goto_program, goto_programt::targett begin, goto_programt::targett end)
remove unnecessary skip statements
void remove_unreachable(goto_programt &goto_program)
remove unreachable code
bool static_simplifier(goto_modelt &goto_model, const ai_baset &ai, const optionst &options, message_handlert &message_handler, std::ostream &out)
Simplifies the program using the information in the abstract domain.
static void write_goto_binary(std::ostream &out, const symbol_table_baset &symbol_table, const goto_functionst &goto_functions, irep_serializationt &irepconverter)
Writes a goto program to disc, using goto binary format.