+ Include dependency graph for lower_byte_operators.cpp:
Go to the source code of this file.
Convert a bitvector-typed expression bitvector_expr to an expression of type target_type.
Map bit boundaries according to endianness.
changes the width of the given bitvector type
Convert a bitvector-typed expression bitvector_expr to a struct-typed expression.
Convert a bitvector-typed expression bitvector_expr to a union-typed expression.
Convert a bitvector-typed expression bitvector_expr to an array-typed expression.
Convert a bitvector-typed expression bitvector_expr to a vector-typed expression.
Convert a bitvector-typed expression bitvector_expr to a complex-typed expression.
Rewrite an object into its individual bytes.
Build the individual bytes to be used in an update.
Rewrite an array or vector into its individual bytes when no maximum number of bytes is known.
Rewrite an array or vector into its individual bytes.
Extract bytes from a sequence of bitvector-typed elements.
Rewrite a struct-typed expression into its individual bytes.
Rewrite a byte extraction of an array/vector-typed result to byte extraction of the individual components that make up an
array_exprt or
vector_exprt.
Rewrite a byte extraction of a complex-typed result to byte extraction of the individual components that make up a
complex_exprt.
rewrite byte extraction from an array to byte extraction from a concatenation of array index expressions
Apply a byte update src using the byte array value_as_byte_array as update value.
Apply a byte update src to an array/vector of bytes using the byte-array typed expression value_as_byte_array as update value.
Apply a byte update src to an array/vector of bytes using the byte array value_as_byte_array as update value.
Apply a byte update src to an array/vector typed operand, using the byte array value_as_byte_array as update value, which has non-constant size.
Apply a byte update src to an array/vector typed operand, using the byte array value_as_byte_array as update value, when either the size of each element or the overall array/vector size is not constant.
Byte update a struct/array/vector element.
Apply a byte update src to an array/vector typed operand using the byte array value_as_byte_array as update value.
Apply a byte update src to a struct typed operand using the byte array value_as_byte_array as update value.
Apply a byte update src to a union typed operand using the byte array value_as_byte_array as update value.
Rewrite a byte update expression to more fundamental operations.
Rewrite an expression possibly containing byte-extract or -update expressions to more fundamental operations.
Function Documentation
◆ adjust_width()
◆ bv_to_array_expr()
◆ bv_to_complex_expr()
◆ bv_to_expr()
Convert a bitvector-typed expression bitvector_expr to an expression of type target_type.
If target_type is a bitvector type this may be a no-op or a typecast. For composite types such as structs, the bitvectors corresponding to the individual members are extracted and then a compound expression is built from those extracted members. When the size of a component isn't constant we fall back to computing its size based on the width of bitvector_expr.
- Parameters
-
bitvector_expr Bitvector-typed expression to extract from.
target_type Type of the expression to build.
ns Namespace to resolve tag types.
endianness_map Endianness map.
- Returns
- Expression of type
target_type constructed from sequences of bits from bitvector_expr.
Definition at line 330 of file lower_byte_operators.cpp.
◆ bv_to_struct_expr()
◆ bv_to_union_expr()
◆ bv_to_vector_expr()
◆ instantiate_byte_array()
std::size_t
lower_bound,
std::size_t
upper_bound,
const std::size_t
bits_per_byte,
)
static
Build the individual bytes to be used in an update.
- Parameters
-
src Source expression of array or vector type
lower_bound First index into src to be included in the result
upper_bound First index into src to be excluded from the result
bits_per_byte number of bits that make up a byte
ns Namespace
- Returns
- Sequence of bytes.
Definition at line 424 of file lower_byte_operators.cpp.
◆ lower_byte_extract()
rewrite byte extraction from an array to byte extraction from a concatenation of array index expressions
Rewrite a byte extract expression to more fundamental operations.
Definition at line 1242 of file lower_byte_operators.cpp.
◆ lower_byte_extract_array_vector()
Rewrite a byte extraction of an array/vector-typed result to byte extraction of the individual components that make up an array_exprt or vector_exprt.
- Parameters
-
src Original byte extract expression
unpacked Byte extraction with root operand expanded into array (via
unpack_rec)
subtype Array/vector element type
element_bits bit width of array/vector elements
ns Namespace
- Returns
- An array or vector expression.
Definition at line 1129 of file lower_byte_operators.cpp.
◆ lower_byte_extract_complex()
Rewrite a byte extraction of a complex-typed result to byte extraction of the individual components that make up a complex_exprt.
- Parameters
-
src Original byte extract expression
unpacked Byte extraction with root operand expanded into array (via
unpack_rec)
ns Namespace
- Returns
- An expression if the subtype size is known, else
nullopt so that a fall-back to more generic code can be used.
Definition at line 1210 of file lower_byte_operators.cpp.
◆ lower_byte_operators()
Rewrite an expression possibly containing byte-extract or -update expressions to more fundamental operations.
- Parameters
-
src Input expression
ns Namespace
- Returns
- Semantically equivalent expression that does not contain any byte_extract_exprt or byte_update_exprt.
Definition at line 2665 of file lower_byte_operators.cpp.
◆ lower_byte_update() [1/2]
const std::optional<
exprt > &
non_const_update_bound,
)
static
Apply a byte update src using the byte array value_as_byte_array as update value.
- Parameters
-
src Original byte-update expression
value_as_byte_array Update value as an array of bytes
non_const_update_bound If set, (symbolically) constrain updates such as to at most update non_const_update_bound elements
ns Namespace
- Returns
- Expression reflecting all updates.
Definition at line 2343 of file lower_byte_operators.cpp.
◆ lower_byte_update() [2/2]
◆ lower_byte_update_array_vector()
const std::optional<
exprt > &
non_const_update_bound,
)
static
Apply a byte update src to an array/vector typed operand using the byte array value_as_byte_array as update value.
- Parameters
-
src Original byte-update expression
subtype Array/vector element type
subtype_bits Bit width of subtype
value_as_byte_array Update value as an array of bytes
non_const_update_bound If set, (symbolically) constrain updates such as to at most update non_const_update_bound elements
ns Namespace
- Returns
- Array/vector expression reflecting all updates.
Definition at line 2123 of file lower_byte_operators.cpp.
◆ lower_byte_update_array_vector_non_const()
const std::optional<
exprt > &
non_const_update_bound,
)
static
Apply a byte update src to an array/vector typed operand, using the byte array value_as_byte_array as update value, when either the size of each element or the overall array/vector size is not constant.
- Parameters
-
src Original byte-update expression
subtype Array/vector element type
value_as_byte_array Update value as an array of bytes
non_const_update_bound If set, (symbolically) constrain updates such as to at most update non_const_update_bound elements
ns Namespace
- Returns
- Array/vector expression reflecting all updates.
Definition at line 1798 of file lower_byte_operators.cpp.
◆ lower_byte_update_array_vector_unbounded()
Apply a byte update src to an array/vector typed operand, using the byte array value_as_byte_array as update value, which has non-constant size.
- Parameters
-
src Original byte-update expression
subtype Array/vector element type
subtype_size Size (in bytes) of subtype
value_as_byte_array Update value as an array of bytes
non_const_update_bound Constrain updates such as to at most update non_const_update_bound elements
initial_bytes Number of bytes from value_as_byte_array to use to update the array/vector element at first_index
first_index Lowest index into the target array/vector of the update
first_update_value Combined value of partially old and updated bytes to use at first_index
ns Namespace
- Returns
- Array comprehension reflecting all updates.
Definition at line 1658 of file lower_byte_operators.cpp.
◆ lower_byte_update_byte_array_vector()
const std::optional<
exprt > &
non_const_update_bound,
)
static
Apply a byte update src to an array/vector of bytes using the byte array value_as_byte_array as update value.
- Parameters
-
src Original byte-update expression
subtype Array/vector element type
value_as_byte_array Update value as an array of bytes
non_const_update_bound If set, (symbolically) constrain updates such as to at most update non_const_update_bound elements
ns Namespace
- Returns
- Array/vector expression reflecting all updates.
Definition at line 1585 of file lower_byte_operators.cpp.
◆ lower_byte_update_byte_array_vector_non_const()
Apply a byte update src to an array/vector of bytes using the byte-array typed expression value_as_byte_array as update value.
- Parameters
-
src Original byte-update expression
subtype Array/vector element type
value_as_byte_array Update value as an array of bytes
non_const_update_bound Constrain updates such as to at most update non_const_update_bound elements
ns Namespace
- Returns
- Array comprehension reflecting all updates.
Definition at line 1516 of file lower_byte_operators.cpp.
◆ lower_byte_update_single_element()
const std::optional<
exprt > &
non_const_update_bound,
)
static
Byte update a struct/array/vector element.
- Parameters
-
src Original byte-update expression
offset_bits Offset in src expressed as bits
element_to_update struct/array/vector element
subtype_bits Bit width of element_to_update
bits_already_set Number of bits in the original target object that have been updated already
value_as_byte_array Update value as an array of bytes
non_const_update_bound If set, (symbolically) constrain updates such as to at most update non_const_update_bound elements
ns Namespace
- Returns
- Array/vector expression reflecting all updates.
Definition at line 1948 of file lower_byte_operators.cpp.
◆ lower_byte_update_struct()
const std::optional<
exprt > &
non_const_update_bound,
)
static
Apply a byte update src to a struct typed operand using the byte array value_as_byte_array as update value.
- Parameters
-
src Original byte-update expression
struct_type Type of the operand
value_as_byte_array Update value as an array of bytes
non_const_update_bound If set, (symbolically) constrain updates such as to at most update non_const_update_bound elements
ns Namespace
- Returns
- Struct expression reflecting all updates.
Definition at line 2207 of file lower_byte_operators.cpp.
◆ lower_byte_update_union()
const std::optional<
exprt > &
non_const_update_bound,
)
static
Apply a byte update src to a union typed operand using the byte array value_as_byte_array as update value.
- Parameters
-
src Original byte-update expression
union_type Type of the operand
value_as_byte_array Update value as an array of bytes
non_const_update_bound If set, (symbolically) constrain updates such as to at most update non_const_update_bound elements
ns Namespace
- Returns
- Union expression reflecting all updates.
Definition at line 2311 of file lower_byte_operators.cpp.
◆ map_bounds()
std::size_t
lower_bound,
std::size_t
upper_bound
)
static
◆ process_bit_fields()
std::size_t
total_bits,
const std::size_t
bits_per_byte,
)
static
Extract bytes from a sequence of bitvector-typed elements.
- Parameters
-
bit_fields operands to concatenate
total_bits total bit width of operands
[out] dest target to append unpacked bytes to
little_endian true, iff assumed endianness is little-endian
offset_bytes if set, bytes prior to this offset will be filled with nil values
max_bytes if set, use as upper bound of the number of bytes to unpack
bits_per_byte number of bits that make up a byte
ns namespace for type lookups
Definition at line 665 of file lower_byte_operators.cpp.
◆ unpack_array_vector()
const std::size_t
bits_per_byte,
)
static
Rewrite an array or vector into its individual bytes.
- Parameters
-
src array/vector to unpack
src_size number of elements in src, if the array/vector size is constant; if the array/vector size is not constant (and this argument thus not set), max_bytes needs to be a known constant value to build an array expression, else we fall back to building an array comprehension
element_bits bit width of array/vector elements
little_endian true, iff assumed endianness is little-endian
offset_bytes if set, bytes prior to this offset will be filled with nil values
max_bytes if set, use as upper bound of the number of bytes to unpack
bits_per_byte number of bits that make up a byte
ns namespace for type lookups
- Returns
- Array expression holding unpacked elements or array comprehension
Definition at line 550 of file lower_byte_operators.cpp.
◆ unpack_array_vector_no_known_bounds()
std::size_t
el_bytes,
const std::size_t
bits_per_byte,
)
static
Rewrite an array or vector into its individual bytes when no maximum number of bytes is known.
- Parameters
-
src array/vector to unpack
el_bytes byte width of array/vector elements
little_endian true, iff assumed endianness is little-endian
bits_per_byte number of bits that make up a byte
ns namespace for type lookups
- Returns
- Array expression holding unpacked elements or array comprehension
Definition at line 468 of file lower_byte_operators.cpp.
◆ unpack_complex()
const std::size_t
bits_per_byte,
)
static
Rewrite a complex_exprt into its individual bytes.
- Parameters
-
src complex-typed expression to unpack
little_endian true, iff assumed endianness is little-endian
bits_per_byte number of bits that make up a byte
ns namespace for type lookups
- Returns
- array_exprt holding unpacked elements
Definition at line 856 of file lower_byte_operators.cpp.
◆ unpack_rec()
const std::size_t
bits_per_byte,
)
static
Rewrite an object into its individual bytes.
- Parameters
-
src object to unpack
little_endian true, iff assumed endianness is little-endian
offset_bytes if set, bytes prior to this offset will be filled with nil values
max_bytes if set, use as upper bound of the number of bytes to unpack
bits_per_byte number of bits that make up a byte
ns namespace for type lookups
unpack_byte_array if true, return unmodified src iff it is an
- Returns
- array of bytes in the sequence found in memory
Definition at line 910 of file lower_byte_operators.cpp.
◆ unpack_struct()
const std::size_t
bits_per_byte,
)
static
Rewrite a struct-typed expression into its individual bytes.
- Parameters
-
src struct-typed expression to unpack
little_endian true, iff assumed endianness is little-endian
offset_bytes if set, bytes prior to this offset will be filled with nil values
max_bytes if set, use as upper bound of the number of bytes to unpack
bits_per_byte number of bits that make up a byte
ns namespace for type lookups
- Returns
- array_exprt holding unpacked elements
Definition at line 703 of file lower_byte_operators.cpp.