37static std::optional<std::size_t>
81static std::unordered_map<irep_idt, exprt>
84 std::unordered_map<irep_idt, exprt> pairs;
92 "operand is expected to be the name of a member");
97 "every name is expected to be followed by a paired value");
110 const auto components =
114 if(update != updates.end())
115 return update->second;
156 "Union must be at least as wide as its component.");
171 return component.get_name() == name;
175 "Definition of struct type should include named component.");
181 return std::accumulate(
196 const auto &compound_type =
member_expr.compound().type();
206 ?
ns.get().follow_tag(
229 std::optional<exprt> update;
242 "Updates in struct encoding are expected to be a change of state.");
243 current = std::move(*update);
272 "Structs are expected to be encoded into bit vectors.");
290 "Unions are expected to be encoded into bit vectors.");
292 const auto &components = definition.
components();
293 if(components.empty())
API to expression classes for bitvectors.
Pre-defined bitvector types.
bool can_cast_type< union_tag_typet >(const typet &type)
Check whether a reference to a typet is a union_tag_typet.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Fixed-width bit-vector without numerical interpretation.
Concatenation of bit-vector operands.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Union constructor to support unions without any member (a GCC/Clang feature).
Base class for all expressions.
std::vector< exprt > operandst
typet & type()
Return the type of the expression.
const irept & find(const irep_idt &name) const
const irep_idt & get(const irep_idt &name) const
Extract member of struct or union.
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
This expression serves as a placeholder for the bits which have non deterministic value in a larger b...
Encodes struct types/values into non-struct expressions/types.
std::unique_ptr< boolbv_widtht > boolbv_width
std::reference_wrapper< const namespacet > ns
typet encode(typet type) const
exprt decode(const exprt &encoded, const struct_tag_typet &original_type) const
Reconstructs a struct expression of the original_type using the data from the bit vector encoded expr...
exprt encode_member(const member_exprt &member_expr) const
The member expression selects the value of a field from a struct or union.
struct_encodingt(const namespacet &ns)
Struct constructor from list of elements.
A struct tag type, i.e., struct_typet with an identifier.
Structure type, corresponds to C style structs.
const componentst & components() const
Semantic type conversion.
static exprt conditional_cast(const exprt &expr, const typet &type)
The type of an expression, extends irept.
Union constructor from single element.
A union tag type, i.e., union_typet with an identifier.
Operator to update elements in structs and arrays.
Expressions for use in incremental SMT2 decision procedure.
Ranges: pair of begin and end iterators, which can be initialized from containers,...
ranget< iteratort > make_range(iteratort begin, iteratort end)
exprt simplify_expr(exprt src, const namespacet &ns)
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
#define POSTCONDITION(CONDITION)
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
static exprt empty_encoding()
Empty structs and unions are encoded as a zero byte.
static exprt encode(const with_exprt &with, const namespacet &ns)
static std::size_t count_trailing_bit_width(const struct_typet &type, const irep_idt name, const boolbv_widtht &boolbv_width)
static std::unordered_map< irep_idt, exprt > extricate_updates(const with_exprt &struct_expr)
Extracts the component/field names and new values from a with_exprt which expresses a new struct valu...
static std::optional< std::size_t > needs_width(const typet &type, const boolbv_widtht &boolbv_width)
If the given type needs re-encoding as a bit-vector then this function.