cprover
Loading...
Searching...
No Matches
field_sensitivity.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Field-sensitive SSA
4
5Author: Michael Tautschnig
6
7\*******************************************************************/
8
9#ifndef CPROVER_GOTO_SYMEX_FIELD_SENSITIVITY_H
10#define CPROVER_GOTO_SYMEX_FIELD_SENSITIVITY_H
11
12#include <util/ssa_expr.h>
13
15class namespacet;
17class symex_targett;
18class value_sett;
19
21{
22public:
24 : exprt(ID_field_sensitive_ssa, ssa.type(), std::move(fields))
25 {
26 add(ID_expression, ssa);
27 }
28
30 {
31 return static_cast<const ssa_exprt &>(find(ID_expression));
32 }
33};
34
35template <>
37{
38 return base.id() == ID_field_sensitive_ssa;
39}
40
41inline const field_sensitive_ssa_exprt &
43{
44 PRECONDITION(expr.id() == ID_field_sensitive_ssa);
45 const field_sensitive_ssa_exprt &ret =
46 static_cast<const field_sensitive_ssa_exprt &>(expr);
47 return ret;
48}
49
51{
52 PRECONDITION(expr.id() == ID_field_sensitive_ssa);
54 static_cast<field_sensitive_ssa_exprt &>(expr);
55 return ret;
56}
57
119{
120public:
126 std::size_t max_array_size,
127 bool should_simplify,
128 const irep_idt &language_mode)
129 : max_field_sensitivity_array_size(max_array_size),
132 {
133 }
134
147 const namespacet &ns,
148 goto_symex_statet &state,
149 const ssa_exprt &lhs,
150 const exprt &rhs,
151 symex_targett &target,
152 bool allow_pointer_unsoundness) const;
153
167 [[nodiscard]] exprt
168 apply(const namespacet &ns, goto_symex_statet &state, exprt expr, bool write)
169 const;
171 [[nodiscard]] exprt apply(
172 const namespacet &ns,
173 goto_symex_statet &state,
174 ssa_exprt expr,
175 bool write) const;
176
189 [[nodiscard]] exprt get_fields(
190 const namespacet &ns,
191 goto_symex_statet &state,
192 const ssa_exprt &ssa_expr,
193 bool disjoined_fields_only) const;
194
204 [[nodiscard]] bool
205 is_divisible(const ssa_exprt &expr, bool disjoined_fields_only) const;
206
207private:
209
210 const bool should_simplify;
212
214 const namespacet &ns,
215 goto_symex_statet &state,
216 const exprt &lhs_fs,
217 const exprt &ssa_rhs,
218 symex_targett &target,
219 bool allow_pointer_unsoundness) const;
220
221 [[nodiscard]] exprt simplify_opt(
222 exprt e,
223 const value_sett &value_set,
224 const namespacet &ns) const;
225
227 [[nodiscard]] exprt apply_byte_extract(
228 const namespacet &ns,
229 goto_symex_statet &state,
230 const byte_extract_exprt &expr,
231 bool write) const;
232};
233
234#endif // CPROVER_GOTO_SYMEX_FIELD_SENSITIVITY_H
Expression of type type extracted from some object op starting at position offset (given in number of...
Base class for all expressions.
Definition expr.h:57
std::vector< exprt > operandst
Definition expr.h:59
exprt()
Definition expr.h:62
typet & type()
Return the type of the expression.
Definition expr.h:85
field_sensitive_ssa_exprt(const ssa_exprt &ssa, exprt::operandst &&fields)
const ssa_exprt & get_object_ssa() const
exprt simplify_opt(exprt e, const value_sett &value_set, const namespacet &ns) const
exprt apply_byte_extract(const namespacet &ns, goto_symex_statet &state, const byte_extract_exprt &expr, bool write) const
Turn an expression expr into a field-sensitive SSA expression.
const std::size_t max_field_sensitivity_array_size
field_sensitivityt(std::size_t max_array_size, bool should_simplify, const irep_idt &language_mode)
exprt get_fields(const namespacet &ns, goto_symex_statet &state, const ssa_exprt &ssa_expr, bool disjoined_fields_only) const
Compute an expression representing the individual components of a field-sensitive SSA representation ...
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) const
Assign to the individual fields lhs_fs of a non-expanded symbol lhs.
exprt apply(const namespacet &ns, goto_symex_statet &state, exprt expr, bool write) const
Turn an expression expr into a field-sensitive SSA expression.
void field_assignments(const namespacet &ns, goto_symex_statet &state, const ssa_exprt &lhs, const exprt &rhs, symex_targett &target, bool allow_pointer_unsoundness) const
Assign to the individual fields of a non-expanded symbol lhs.
const irep_idt & language_mode
bool is_divisible(const ssa_exprt &expr, bool disjoined_fields_only) const
Determine whether expr would translate to an atomic SSA expression (returns false) or a composite obj...
Central data structure: state.
const irept & find(const irep_idt &name) const
Definition irep.cpp:93
const irep_idt & id() const
Definition irep.h:388
irept & add(const irep_idt &name)
Definition irep.cpp:103
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
Expression providing an SSA-renamed symbol of expressions.
Definition ssa_expr.h:17
The interface of the target container for symbolic execution to record its symbolic steps into.
State type in value_set_domaint, used in value-set analysis and goto-symex.
Definition value_set.h:43
bool can_cast_expr< field_sensitive_ssa_exprt >(const exprt &base)
const field_sensitive_ssa_exprt & to_field_sensitive_ssa_expr(const exprt &expr)
STL namespace.
#define PRECONDITION(CONDITION)
Definition invariant.h:463
dstringt irep_idt