33 "unexpected operand 0 width",
37 prev_bv.resize(width);
41 for(std::size_t op_no=1; op_no<ops.size(); op_no+=2)
60 next_bv.resize(prev_bv.size());
62 if(type.
id()==ID_array)
64 else if(type.
id()==ID_bv ||
65 type.
id()==ID_unsignedbv ||
66 type.
id()==ID_signedbv)
68 else if(type.
id()==ID_struct)
71 else if(type.
id() == ID_struct_tag)
74 else if(type.
id()==ID_union)
76 else if(type.
id() == ID_union_tag)
94 "convert_with_array called for unbounded array",
99 const auto size = numeric_cast<mp_integer>(array_size);
103 "convert_with_array expects constant array size",
109 *size * op2_bv.size() == prev_bv.size(),
110 "convert_with_array: unexpected operand 2 width",
114 if(
const auto op1_value = numeric_cast<mp_integer>(op1))
119 if(*op1_value >= 0 && *op1_value < *size)
121 const std::size_t offset =
122 numeric_cast_v<std::size_t>(*op1_value * op2_bv.size());
124 for(std::size_t j=0; j<op2_bv.size(); j++)
125 next_bv[offset+j]=op2_bv[j];
139 const std::size_t offset = numeric_cast_v<std::size_t>(i * op2_bv.size());
141 for(std::size_t j=0; j<op2_bv.size(); j++)
143 prop.
lselect(eq_lit, op2_bv[j], prev_bv[offset+j]);
155 if(
const auto op1_value = numeric_cast<mp_integer>(op1))
159 if(*op1_value < next_bv.size())
160 next_bv[numeric_cast_v<std::size_t>(*op1_value)] = l;
167 for(std::size_t i=0; i<prev_bv.size(); i++)
188 const irep_idt &component_name=op1.
get(ID_component_name);
192 std::size_t offset=0;
194 for(
const auto &c : components)
196 const typet &subtype = c.type();
200 if(c.get_name() == component_name)
203 subtype == op2.
type(),
204 "with/struct: component '" +
id2string(component_name) +
205 "' type does not match",
210 sub_width == op2_bv.size(),
211 "convert_with_struct: unexpected operand op2 width",
214 for(std::size_t i=0; i<sub_width; i++)
215 next_bv[offset+i]=op2_bv[i];
235 next_bv.size() >= op2_bv.size(),
236 "convert_with_union: unexpected operand op2 width",
241 for(std::size_t i=0; i<op2_bv.size(); i++)
242 next_bv[i]=op2_bv[i];
252 for(std::size_t i=0; i<op2_bv.size(); i++)
const exprt & size() const
virtual bvt convert_with(const with_exprt &expr)
void convert_with_bv(const exprt &op1, const exprt &op2, const bvt &prev_bv, bvt &next_bv)
bool is_unbounded_array(const typet &type) const override
virtual const bvt & convert_bv(const exprt &expr, const optionalt< std::size_t > expected_width=nullopt)
Convert expression to vector of literalts, using an internal cache to speed up conversion if availabl...
void conversion_failed(const exprt &expr, bvt &bv)
void convert_with_struct(const struct_typet &type, const exprt &op1, const exprt &op2, const bvt &prev_bv, bvt &next_bv)
void convert_with_union(const union_typet &type, const exprt &op2, const bvt &prev_bv, bvt &next_bv)
virtual endianness_mapt endianness_map(const typet &type, bool little_endian) const
virtual std::size_t boolbv_width(const typet &type) const
void convert_with_array(const array_typet &type, const exprt &op1, const exprt &op2, const bvt &prev_bv, bvt &next_bv)
struct configt::ansi_ct ansi_c
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Maps a big-endian offset to a little-endian offset.
size_t map_bit(size_t bit) const
Base class for all expressions.
std::vector< exprt > operandst
typet & type()
Return the type of the expression.
const irep_idt & id() const
const irep_idt & get(const irep_namet &name) const
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
literalt convert(const exprt &expr) override
Convert a Boolean expression and return the corresponding literal.
virtual literalt lselect(literalt a, literalt b, literalt c)=0
Structure type, corresponds to C style structs.
const componentst & components() const
std::vector< componentt > componentst
The type of an expression, extends irept.
const typet & subtype() const
Operator to update elements in structs and arrays.
const std::string & id2string(const irep_idt &d)
std::vector< literalt > bvt
#define DATA_INVARIANT_WITH_DIAGNOSTICS(CONDITION, REASON,...)
API to expression classes.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const union_tag_typet & to_union_tag_type(const typet &type)
Cast a typet to a union_tag_typet.
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.