32 locationt from{trace_from->current_location()};
33 locationt to{trace_to->current_location()};
36 std::cout <<
"Transform from/to:\n";
37 std::cout << from->location_number <<
" --> " << to->location_number <<
'\n';
41 switch(instruction.
type())
49 ->write_location_context(from);
66 ->write_location_context(from);
79 if(next != from->get_target())
81 if(to == from->get_target())
144 throw "the SET_RETURN_VALUE instructions should be removed first";
150 throw "threading not supported";
154 throw "exceptions not handled";
165 throw "unrecognised instruction type";
189 return result->to_predicate(expr);
198 if(exprs.size() == 1)
201 auto predicates = std::vector<exprt>{};
205 std::back_inserter(predicates),
206 [
this, &ns](
const exprt &expr) { return to_predicate(expr, ns); });
227 std::cout <<
"Merging from/to:\n "
228 << from->current_location()->location_number <<
" --> "
229 << to->current_location()->location_number <<
'\n';
246 exprt c = res->to_constant();
250 bool no_simplification =
true;
258 return no_simplification;
262 bool condition_changed = (condition != c);
264 return !condition_changed;
286 const exprt &
function = from->call_function();
290 if(
function.
id() == ID_symbol)
297 from->call_arguments();
299 if(to->location_number == next->location_number)
314 for(
const exprt &called_arg : called_arguments)
317 called_arg.type().id() == ID_pointer &&
328 pointer_value->write(
345 if(symbol.second.is_static_lifetime)
350 symbol.second.type, ns,
true,
false),
364 code_typet::parameterst::const_iterator parameter_it =
365 declaration_parameters.begin();
367 for(
const exprt &called_arg : called_arguments)
369 if(parameter_it == declaration_parameters.end())
372 code_type.
has_ellipsis(),
"Only case for insufficient args");
384 parameter_it->get_identifier(), called_arg.type());
392 parameter_it == declaration_parameters.end(),
393 "Number of arguments should match parameters");
406 static const std::set<irep_idt> ignored_internal_function = {
415 return ignored_internal_function.find(function_id) !=
416 ignored_internal_function.cend();
430 const std::vector<irep_idt> &modified_symbol_names =
434 std::vector<symbol_exprt> modified_symbols;
435 modified_symbols.reserve(modified_symbol_names.size());
437 modified_symbol_names.begin(),
438 modified_symbol_names.end(),
439 std::back_inserter(modified_symbols),
440 [&ns](
const irep_idt &
id) { return ns.lookup(id).symbol_expr(); });
442 for(
const auto &symbol : modified_symbols)
460 variable_sensitivity_domaint::gather_statistics(
const namespacet &ns)
const
sharing_ptrt< class abstract_objectt > abstract_object_pointert
static abstract_object_pointert transform(const exprt &expr, const std::vector< abstract_object_pointert > &operands, const abstract_environmentt &environment, const namespacet &ns)
virtual bool assume(const exprt &expr, const namespacet &ns)
Reduces the domain based on a condition.
void output(std::ostream &out, const class ai_baset &ai, const namespacet &ns) const
Print out all the values in the abstract object map.
bool is_bottom() const
Gets whether the domain is bottom.
exprt to_predicate() const
Gives a boolean condition that is true for all values represented by the environment.
void make_top()
Set the domain to top (i.e. everything)
virtual abstract_object_pointert eval(const exprt &expr, const namespacet &ns) const
These three are really the heart of the method.
void erase(const symbol_exprt &expr)
Delete a symbol from the map.
static std::vector< abstract_environmentt::map_keyt > modified_symbols(const abstract_environmentt &first, const abstract_environmentt &second)
For our implementation of variable sensitivity domains, we need to be able to efficiently find symbol...
bool verify() const
Check the structural invariants are maintained.
virtual void havoc(const std::string &havoc_string)
This should be used as a default case / everything else has failed The string is so that I can easily...
abstract_object_statisticst gather_statistics(const namespacet &ns) const
virtual bool merge(const abstract_environmentt &env, const goto_programt::const_targett &merge_location, widen_modet widen_mode)
Computes the join between "this" and "b".
void make_bottom()
Set the domain to top (i.e. no possible states / unreachable)
bool is_top() const
Gets whether the domain is top.
virtual abstract_object_pointert abstract_object_factory(const typet &type, const namespacet &ns, bool top, bool bottom) const
Look at the configuration for the sensitivity and create an appropriate abstract_object.
virtual bool assign(const exprt &expr, const abstract_object_pointert &value, const namespacet &ns)
Assign a value to an expression.
This is the basic interface of the abstract interpreter with default implementations of the core func...
The interface offered by a domain, allows code to manipulate domains without knowing their exact type...
ai_history_baset::trace_ptrt trace_ptrt
goto_programt::const_targett locationt
exprt::operandst argumentst
std::vector< parametert > parameterst
bool has_ellipsis() const
const parameterst & parameters() const
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
typet & type()
Return the type of the expression.
The Boolean constant false.
This class represents an instruction in the GOTO intermediate representation.
const exprt & condition() const
Get the condition of gotos, assume, assert.
const exprt & assign_rhs() const
Get the rhs of the assignment for ASSIGN.
const symbol_exprt & dead_symbol() const
Get the symbol for DEAD.
const symbol_exprt & decl_symbol() const
Get the declared symbol for DECL.
const exprt & assign_lhs() const
Get the lhs of the assignment for ASSIGN.
goto_program_instruction_typet type() const
What kind of instruction?
bool get_bool(const irep_idt &name) const
const irep_idt & id() const
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
const symbol_table_baset & get_symbol_table() const
Return first symbol table registered with the namespace.
const typet & base_type() const
The type of the data what we point to.
Expression to hold a symbol (variable)
const irep_idt & get_identifier() const
const symbolst & symbols
Read-only field, used to look up symbols given their names.
typet type
Type of symbol.
bool ai_simplify(exprt &condition, const namespacet &ns) const override
Use the information in the domain to simplify the expression with respect to the current location.
exprt to_predicate() const override
Gives a Boolean condition that is true for all values represented by the domain.
void make_bottom() override
Sets the domain to bottom (no states / unreachable).
void output(std::ostream &out, const ai_baset &ai, const namespacet &ns) const override
Basic text output of the abstract domain.
void make_top() override
Sets the domain to top (all states).
void transform(const irep_idt &function_from, trace_ptrt trace_from, const irep_idt &function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) override
Compute the abstract transformer for a single instruction.
abstract_environmentt abstract_state
virtual void merge_three_way_function_return(const ai_domain_baset &function_start, const ai_domain_baset &function_end, const namespacet &ns)
Merges just the things that have changes between "function_start" and "function_end" into "this".
bool is_bottom() const override
Find out if the domain is currently unreachable.
void transform_function_call(locationt from, locationt to, ai_baset &ai, const namespacet &ns)
Used by variable_sensitivity_domaint::transform to handle FUNCTION_CALL transforms.
virtual bool merge(const variable_sensitivity_domaint &b, trace_ptrt from, trace_ptrt to)
Computes the join between "this" and "b".
flow_sensitivityt flow_sensitivity
void assume(exprt expr, namespacet ns)
bool is_top() const override
Is the domain completely top at this state.
bool ignore_function_call_transform(const irep_idt &function_id) const
Used to specify which CPROVER internal functions should be skipped over when doing function call tran...
API to expression classes for Pointers.
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
#define CHECK_RETURN(CONDITION)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define PRECONDITION(CONDITION)
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
There are different ways of handling arrays, structures, unions and pointers.