Go to the documentation of this file.
31 locationt from{trace_from->current_location()};
32 locationt to{trace_to->current_location()};
35 std::cout <<
"Transform from/to:\n";
36 std::cout << from->location_number <<
" --> " << to->location_number <<
'\n';
40 switch(instruction.
type())
48 ->write_location_context(from);
65 ->write_location_context(from);
78 if(next != from->get_target())
80 if(to == from->get_target())
143 throw "the SET_RETURN_VALUE instructions should be removed first";
149 throw "threading not supported";
153 throw "exceptions not handled";
164 throw "unrecognised instruction type";
188 return result->to_predicate(expr);
197 if(exprs.size() == 1)
200 auto predicates = std::vector<exprt>{};
204 std::back_inserter(predicates),
205 [
this, &ns](
const exprt &expr) { return to_predicate(expr, ns); });
231 std::cout <<
"Merging from/to:\n "
232 << from->current_location()->location_number <<
" --> "
233 << to->current_location()->location_number <<
'\n';
250 exprt c = res->to_constant();
254 bool no_simplification =
true;
262 return no_simplification;
266 bool condition_changed = (condition != c);
268 return !condition_changed;
297 const exprt &
function = from->call_function();
301 if(
function.
id() == ID_symbol)
308 from->call_arguments();
310 if(to->location_number == next->location_number)
325 for(
const exprt &called_arg : called_arguments)
328 called_arg.type().id() == ID_pointer &&
339 pointer_value->write(
356 if(symbol.second.is_static_lifetime)
361 symbol.second.type, ns,
true,
false),
375 code_typet::parameterst::const_iterator parameter_it =
376 declaration_parameters.begin();
378 for(
const exprt &called_arg : called_arguments)
380 if(parameter_it == declaration_parameters.end())
383 code_type.
has_ellipsis(),
"Only case for insufficient args");
395 parameter_it->get_identifier(), called_arg.type());
403 parameter_it == declaration_parameters.end(),
404 "Number of arguments should match parameters");
417 static const std::set<irep_idt> ignored_internal_function = {
426 return ignored_internal_function.find(function_id) !=
427 ignored_internal_function.cend();
445 const std::vector<irep_idt> &modified_symbol_names =
448 std::vector<symbol_exprt> modified_symbols;
449 modified_symbols.reserve(modified_symbol_names.size());
451 modified_symbol_names.begin(),
452 modified_symbol_names.end(),
453 std::back_inserter(modified_symbols),
454 [&ns](
const irep_idt &
id) { return ns.lookup(id).symbol_expr(); });
463 std::vector<symbol_exprt> modified_symbols,
467 for(
const auto &symbol : modified_symbols)
482 variable_sensitivity_domaint::gather_statistics(
const namespacet &ns)
const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
bool has_ellipsis() const
exprt to_predicate() const override
Gives a Boolean condition that is true for all values represented by the domain.
sharing_ptrt< class abstract_objectt > abstract_object_pointert
exprt to_predicate() const
Gives a boolean condition that is true for all values represented by the environment.
#define CHECK_RETURN(CONDITION)
std::vector< parametert > parameterst
static abstract_object_pointert transform(const exprt &expr, const std::vector< abstract_object_pointert > &operands, const abstract_environmentt &environment, const namespacet &ns)
typet type
Type of symbol.
bool is_bottom() const override
Find out if the domain is currently unreachable.
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...
virtual bool assign(const exprt &expr, const abstract_object_pointert &value, const namespacet &ns)
Assign a value to an expression.
bool verify() const
Check the structural invariants are maintained.
Base class for all expressions.
void output(std::ostream &out, const class ai_baset &ai, const namespacet &ns) const
Print out all the values in the abstract object map.
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...
Expression to hold a symbol (variable)
void make_top()
Set the domain to top (i.e. everything)
const symbol_exprt & decl_symbol() const
Get the declared symbol for DECL.
ai_history_baset::trace_ptrt trace_ptrt
std::vector< irep_idt > get_modified_symbols(const variable_sensitivity_domaint &other) const
Get symbols that have been modified since this domain and other.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
void make_bottom() override
Sets the domain to bottom (no states / unreachable).
typet & type()
Return the type of the expression.
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
bool is_top() const
Gets whether the domain is top.
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
goto_program_instruction_typet type() const
What kind of instruction?
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
const symbol_exprt & dead_symbol() const
Get the symbol for DEAD.
void apply_domain(std::vector< symbol_exprt > modified_symbols, const variable_sensitivity_domaint &target, const namespacet &ns)
Given a domain and some symbols, apply those symbols values to the current domain.
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.
#define PRECONDITION(CONDITION)
const irep_idt & get_identifier() const
void make_bottom()
Set the domain to top (i.e. no possible states / unreachable)
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".
virtual void merge_three_way_function_return(const ai_domain_baset &function_call, const ai_domain_baset &function_start, const ai_domain_baset &function_end, const namespacet &ns)
Perform a context aware merge of the changes that have been applied between function_start and the cu...
abstract_environmentt abstract_state
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
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.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
virtual abstract_object_pointert eval(const exprt &expr, const namespacet &ns) const
These three are really the heart of the method.
const irep_idt & id() const
std::vector< exprt > operandst
exprt::operandst argumentst
The Boolean constant false.
bool is_top() const override
Is the domain completely top at this state.
const exprt & assign_rhs() const
Get the rhs of the assignment for ASSIGN.
const parameterst & parameters() const
void output(std::ostream &out, const ai_baset &ai, const namespacet &ns) const override
Basic text output of the abstract domain.
goto_programt::const_targett locationt
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.
const symbol_table_baset & get_symbol_table() const
Return first symbol table registered with the namespace.
const exprt & assign_lhs() const
Get the lhs of the assignment for ASSIGN.
const symbolst & symbols
Read-only field, used to look up symbols given their names.
This is the basic interface of the abstract interpreter with default implementations of the core func...
const typet & base_type() const
The type of the data what we point to.
void make_entry() override
Set up a reasonable entry-point state.
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...
virtual bool merge(const variable_sensitivity_domaint &b, trace_ptrt from, trace_ptrt to)
Computes the join between "this" and "b".
const exprt & condition() const
Get the condition of gotos, assume, assert.
The interface offered by a domain, allows code to manipulate domains without knowing their exact type...
void assume(exprt expr, namespacet ns)
void make_top() override
Sets the domain to top (all states).
flow_sensitivityt flow_sensitivity
This class represents an instruction in the GOTO intermediate representation.
abstract_object_statisticst gather_statistics(const namespacet &ns) const
bool is_bottom() const
Gets whether the domain is bottom.
bool get_bool(const irep_idt &name) const
void erase(const symbol_exprt &expr)
Delete a symbol from the map.
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 assume(const exprt &expr, const namespacet &ns)
Reduces the domain based on a condition.