Go to the documentation of this file.
18 #define ENABLE_ARRAY_FIELD_SENSITIVITY
27 return std::move(ssa_expr);
41 if(expr.
id() != ID_address_of)
44 *it =
apply(ns, state, std::move(*it), write);
52 !write && expr.
id() == ID_member &&
57 #ifdef ENABLE_ARRAY_FIELD_SENSITIVITY
59 !write && expr.
id() == ID_index &&
64 #endif // ENABLE_ARRAY_FIELD_SENSITIVITY
65 else if(expr.
id() == ID_member)
86 return state.
rename(std::move(tmp), ns).get();
88 return std::move(tmp);
91 #ifdef ENABLE_ARRAY_FIELD_SENSITIVITY
92 else if(expr.
id() == ID_index)
103 index.
index().
id() == ID_constant)
110 l2_index.simplify(ns);
120 if(array_from_symbol_table !=
nullptr)
125 l2_size.
id() == ID_constant &&
129 if(l2_index.get().id() == ID_constant)
139 return state.
rename(std::move(tmp), ns).get();
141 return std::move(tmp);
146 exprt expanded_array =
153 #endif // ENABLE_ARRAY_FIELD_SENSITIVITY
162 if(ssa_expr.
type().
id() == ID_struct || ssa_expr.
type().
id() == ID_struct_tag)
168 fields.reserve(components.size());
172 for(
const auto &comp : components)
188 #ifdef ENABLE_ARRAY_FIELD_SENSITIVITY
190 ssa_expr.
type().
id() == ID_array &&
193 const mp_integer mp_array_size = numeric_cast_v<mp_integer>(
199 const std::size_t array_size = numeric_cast_v<std::size_t>(mp_array_size);
202 elements.reserve(array_size);
206 for(std::size_t i = 0; i < array_size; ++i)
218 elements.push_back(
get_fields(ns, state, tmp));
223 #endif // ENABLE_ARRAY_FIELD_SENSITIVITY
234 bool allow_pointer_unsoundness)
236 const exprt lhs_fs =
apply(ns, state, lhs,
false);
243 ns, state, lhs_fs, rhs, target, allow_pointer_unsoundness);
262 const exprt &ssa_rhs,
264 bool allow_pointer_unsoundness)
275 allow_pointer_unsoundness)
289 ssa_rhs.
type().
id() == ID_struct || ssa_rhs.
type().
id() == ID_struct_tag)
295 components.empty() ||
298 exprt::operandst::const_iterator fs_it = lhs_fs.
operands().begin();
299 for(
const auto &comp : components)
301 const exprt member_rhs =
303 const exprt &member_lhs = *fs_it;
306 ns, state, member_lhs, member_rhs, target, allow_pointer_unsoundness);
310 #ifdef ENABLE_ARRAY_FIELD_SENSITIVITY
311 else if(
const auto &type = type_try_dynamic_cast<array_typet>(ssa_rhs.
type()))
313 const std::size_t array_size =
320 exprt::operandst::const_iterator fs_it = lhs_fs.
operands().begin();
321 for(std::size_t i = 0; i < array_size; ++i)
325 const exprt &index_lhs = *fs_it;
328 ns, state, index_lhs, index_rhs, target, allow_pointer_unsoundness);
332 #endif // ENABLE_ARRAY_FIELD_SENSITIVITY
339 exprt::operandst::const_iterator fs_it = lhs_fs.
operands().begin();
343 ns, state, *fs_it, op, target, allow_pointer_unsoundness);
355 if(expr.
type().
id() == ID_struct || expr.
type().
id() == ID_struct_tag)
358 #ifdef ENABLE_ARRAY_FIELD_SENSITIVITY
360 expr.
type().
id() == ID_array &&
#define UNREACHABLE
This should be used to mark dead code.
const componentst & components() const
#define Forall_operands(it, expr)
renamedt< ssa_exprt, L2 > assignment(ssa_exprt lhs, const exprt &rhs, const namespacet &ns, bool rhs_is_simplified, bool record_value, bool allow_pointer_unsoundness=false)
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
typet type
Type of symbol.
Central data structure: state.
const bool should_simplify
Base class for all expressions.
std::vector< componentt > componentst
symex_targett::sourcet source
exprt apply(const namespacet &ns, goto_symex_statet &state, exprt expr, bool write) const
Turn an expression expr into a field-sensitive SSA expression.
const std::size_t max_field_sensitivity_array_size
const exprt & get_original_expr() const
bool run_apply
whether or not to invoke field_sensitivityt::apply
const irep_idt & get(const irep_idt &name) const
Struct constructor from list of elements.
Expression providing an SSA-renamed symbol of expressions.
const exprt & size() const
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
typet & type()
Return the type of the expression.
bool is_ssa_expr(const exprt &expr)
virtual void assignment(const exprt &guard, const ssa_exprt &ssa_lhs, const exprt &ssa_full_lhs, const exprt &original_full_lhs, const exprt &ssa_rhs, const sourcet &source, assignment_typet assignment_type)=0
Write to a local variable.
bool has_operands() const
Return true if there is at least one operand.
const ssa_exprt & to_ssa_expr(const exprt &expr)
Cast a generic exprt to an ssa_exprt.
const exprt & struct_op() const
#define PRECONDITION(CONDITION)
const irep_idt & get_identifier() const
renamedt< exprt, level > rename(exprt expr, const namespacet &ns)
Rewrites symbol expressions in exprt, applying a suffix to each symbol reflecting its most recent ver...
void set_expression(exprt expr)
Replace the underlying, original expression by expr while maintaining SSA indices.
bool simplify(exprt &expr, const namespacet &ns)
exprt simplify_expr(exprt src, const namespacet &ns)
const irep_idt get_level_2() const
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const irep_idt & id() const
std::vector< exprt > operandst
Extract member of struct or union.
const symbol_table_baset & get_symbol_table() const
Return first symbol table registered with the namespace.
Structure type, corresponds to C style structs.
bool is_divisible(const ssa_exprt &expr) const
Determine whether expr would translate to an atomic SSA expression (returns false) or a composite obj...
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
void field_assignments(const namespacet &ns, goto_symex_statet &state, const ssa_exprt &lhs, const exprt &rhs, symex_targett &target, bool allow_pointer_unsoundness)
Assign to the individual fields of a non-expanded symbol lhs.
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
const symbolt * lookup(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
exprt get_fields(const namespacet &ns, goto_symex_statet &state, const ssa_exprt &ssa_expr) const
Compute an expression representing the individual components of a field-sensitive SSA representation ...
exprt simplify_opt(exprt e, const namespacet &ns) const
void field_assignments_rec(const namespacet &ns, goto_symex_statet &state, const exprt &lhs_fs, const exprt &ssa_rhs, symex_targett &target, bool allow_pointer_unsoundness)
Assign to the individual fields lhs_fs of a non-expanded symbol lhs.
typet index_type() const
The type of the index expressions into any instance of this type.
Array constructor from list of elements.
The interface of the target container for symbolic execution to record its symbolic steps into.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.