36 op_type.
id()==ID_struct)
40 while(operands.size()>1)
42 exprt &op1=operands[operands.size()-2];
43 exprt &op2=operands[operands.size()-1];
45 if(op1.
get(ID_component_name)==component_name)
58 operands.resize(operands.size()-2);
72 else if(op_type.
id()==ID_union)
76 if(with_expr.
where().
get(ID_component_name)==component_name)
88 else if(op.
id()==ID_update)
91 op_type.
id()==ID_struct)
97 if(designator.size()==1 &&
98 designator.front().id()==ID_member_designator)
100 if(designator.front().get(ID_component_name)==component_name)
113 else if(op_type.
id()==ID_struct)
127 else if(op.
id()==ID_struct ||
128 op.
id()==ID_constant)
130 if(op_type.
id()==ID_struct)
144 else if(op.
id()==ID_byte_extract_little_endian ||
145 op.
id()==ID_byte_extract_big_endian)
147 if(op_type.
id()==ID_struct)
165 if(!offset_int.has_value())
168 const exprt &struct_offset=op.
op1();
180 else if(op_type.
id() == ID_union)
185 if(byte_extract_expr.offset().is_zero())
190 if(subtype == byte_extract_expr.op().type())
192 exprt tmp = byte_extract_expr.op();
200 else if(op.
id()==ID_union && op_type.
id()==ID_union)
213 if(target_size.has_value())
215 mp_integer target_bits = target_size.value() * 8;
218 if(bits.has_value() &&
221 std::string bits_cut =
222 std::string(*bits, 0, numeric_cast_v<std::size_t>(target_bits));
234 else if(op.
id() == ID_typecast)
249 if(op_type.
id() == ID_struct)
253 if(requested_offset.has_value())
256 op.
op0(), *requested_offset, expr.
type(),
ns);
265 equivalent_member.
id() != ID_byte_extract_little_endian &&
266 equivalent_member.
id() != ID_byte_extract_big_endian &&
269 expr = equivalent_member;
276 else if(op.
id()==ID_if)
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
bool type_eq(const typet &type1, const typet &type2, const namespacet &ns)
Check types for equality at the top level.
The type of an expression, extends irept.
bool simplify_member(exprt &expr)
const typet & component_type(const irep_idt &component_name) const
bool simplify_node(exprt &expr)
Operator to update elements in structs and arrays.
bool base_type_eq(const typet &type1, const typet &type2, const namespacet &ns)
Check types for equality across all levels of hierarchy.
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
exprt::operandst & designator()
The trinary if-then-else operator.
typet & type()
Return the type of the expression.
Structure type, corresponds to C style structs.
Extract member of struct or union.
const exprt & compound() const
const irep_idt & id() const
Expression classes for byte-level operators.
exprt get_subexpression_at_offset(const exprt &expr, const mp_integer &offset_bytes, const typet &target_type_raw, const namespacet &ns)
const update_exprt & to_update_expr(const exprt &expr)
Cast an exprt to an update_exprt.
optionalt< mp_integer > pointer_offset_size(const typet &type, const namespacet &ns)
Compute the size of a type in bytes, rounding up to full bytes.
nonstd::optional< T > optionalt
API to expression classes.
const irep_idt & get(const irep_namet &name) const
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
The plus expression Associativity is not specified.
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
exprt bits2expr(const std::string &bits, const typet &type, bool little_endian)
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
bool has_component(const irep_idt &component_name) const
std::vector< exprt > operandst
optionalt< mp_integer > member_offset(const struct_typet &type, const irep_idt &member, const namespacet &ns)
const with_exprt & to_with_expr(const exprt &expr)
Cast an exprt to a with_exprt.
bool simplify_rec(exprt &expr)
Base class for all expressions.
std::size_t component_number(const irep_idt &component_name) const
Return the sequence number of the component with given name.
const union_exprt & to_union_expr(const exprt &expr)
Cast an exprt to a union_exprt.
Operator to update elements in structs and arrays.
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
irep_idt get_component_name() const
optionalt< std::string > expr2bits(const exprt &, bool little_endian)
const byte_extract_exprt & to_byte_extract_expr(const exprt &expr)
const componentt & get_component(const irep_idt &component_name) const
Get the reference to a component with given name.