23 error() <<
"with takes at least three operands" <<
eom;
30 error() <<
"with takes an odd number of operands" <<
eom;
50 error() <<
"unexpected operand 0 width" <<
eom;
55 prev_bv.resize(width);
59 for(std::size_t op_no=1; op_no<ops.size(); op_no+=2)
83 next_bv.resize(prev_bv.size());
85 if(type.
id()==ID_array)
87 else if(type.
id()==ID_bv ||
88 type.
id()==ID_unsignedbv ||
89 type.
id()==ID_signedbv)
91 else if(type.
id()==ID_struct)
94 else if(type.
id()==ID_union)
96 else if(type.
id()==ID_symbol)
100 error() <<
"unexpected with type: " << type.
id();
115 error() <<
"convert_with_array called for unbounded array" <<
eom;
126 error() <<
"convert_with_array expects constant array size" <<
eom;
132 if(size*op2_bv.size()!=prev_bv.size())
135 error() <<
"convert_with_array: unexpected operand 2 width" <<
eom;
146 if(op1_value>=0 && op1_value<size)
150 for(std::size_t j=0; j<op2_bv.size(); j++)
151 next_bv[offset+j]=op2_bv[j];
167 for(std::size_t j=0; j<op2_bv.size(); j++)
169 prop.
lselect(eq_lit, op2_bv[j], prev_bv[offset+j]);
187 if(op1_value<next_bv.size())
195 for(std::size_t i=0; i<prev_bv.size(); i++)
216 const irep_idt &component_name=op1.
get(ID_component_name);
220 std::size_t offset=0;
222 for(struct_typet::componentst::const_iterator
223 it=components.begin();
224 it!=components.end();
227 const typet &subtype=it->type();
231 if(it->get_name()==component_name)
236 error() <<
"with/struct: component `" << component_name
237 <<
"' type does not match: " 238 << subtype.
pretty() <<
" vs. " 243 if(sub_width!=op2_bv.size())
246 error() <<
"convert_with_struct: unexpected operand op2 width" 251 for(std::size_t i=0; i<sub_width; i++)
252 next_bv[offset+i]=op2_bv[i];
272 if(next_bv.size()<op2_bv.size())
275 error() <<
"convert_with_union: unexpected operand op2 width" <<
eom;
281 for(std::size_t i=0; i<op2_bv.size(); i++)
282 next_bv[i]=op2_bv[i];
292 for(std::size_t i=0; i<op2_bv.size(); i++)
293 next_bv[map_u.
map_bit(i)]=op2_bv[map_op2.map_bit(i)];
The type of an expression.
const typet & follow(const typet &src) const
struct configt::ansi_ct ansi_c
virtual bvt convert_with(const exprt &expr)
Maps a big-endian offset to a little-endian offset.
virtual literalt convert(const exprt &expr) override
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
void convert_with_array(const array_typet &type, const exprt &op1, const exprt &op2, const bvt &prev_bv, bvt &next_bv)
bool base_type_eq(const typet &type1, const typet &type2, const namespacet &ns)
const union_typet & to_union_type(const typet &type)
Cast a generic typet to a union_typet.
boolbv_widtht boolbv_width
bool is_unbounded_array(const typet &type) const override
std::vector< componentt > componentst
const componentst & components() const
static mstreamt & eom(mstreamt &m)
const irep_idt & id() const
const array_typet & to_array_type(const typet &type)
Cast a generic typet to an array_typet.
void convert_with_union(const union_typet &type, const exprt &op1, const exprt &op2, const bvt &prev_bv, bvt &next_bv)
virtual const bvt & convert_bv(const exprt &expr)
const source_locationt & find_source_location() const
source_locationt source_location
API to expression classes.
void conversion_failed(const exprt &expr, bvt &bv)
const irep_idt & get(const irep_namet &name) const
const exprt & size() const
std::vector< exprt > operandst
const struct_typet & to_struct_type(const typet &type)
Cast a generic typet to a struct_typet.
const source_locationt & source_location() const
void convert_with_struct(const struct_typet &type, const exprt &op1, const exprt &op2, const bvt &prev_bv, bvt &next_bv)
unsigned integer2unsigned(const mp_integer &n)
void convert_with_bv(const typet &type, const exprt &op1, const exprt &op2, const bvt &prev_bv, bvt &next_bv)
Base class for all expressions.
size_t map_bit(size_t bit) const
virtual literalt lselect(literalt a, literalt b, literalt c)=0
std::size_t integer2size_t(const mp_integer &n)
const typet & subtype() const
std::vector< literalt > bvt