24 error() <<
"with takes at least three operands" <<
eom;
31 error() <<
"with takes an odd number of operands" <<
eom;
51 error() <<
"unexpected operand 0 width" <<
eom;
56 prev_bv.resize(width);
60 for(std::size_t op_no=1; op_no<ops.size(); op_no+=2)
84 next_bv.resize(prev_bv.size());
86 if(type.
id()==ID_array)
88 else if(type.
id()==ID_bv ||
89 type.
id()==ID_unsignedbv ||
90 type.
id()==ID_signedbv)
92 else if(type.
id()==ID_struct)
95 else if(type.
id()==ID_union)
97 else if(type.
id()==ID_symbol)
101 error() <<
"unexpected with type: " << type.
id();
116 error() <<
"convert_with_array called for unbounded array" <<
eom;
127 error() <<
"convert_with_array expects constant array size" <<
eom;
133 if(size*op2_bv.size()!=prev_bv.size())
136 error() <<
"convert_with_array: unexpected operand 2 width" <<
eom;
147 if(op1_value>=0 && op1_value<size)
151 for(std::size_t j=0; j<op2_bv.size(); j++)
152 next_bv[offset+j]=op2_bv[j];
168 for(std::size_t j=0; j<op2_bv.size(); j++)
170 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];
271 if(next_bv.size()<op2_bv.size())
274 error() <<
"convert_with_union: unexpected operand op2 width" <<
eom;
280 for(std::size_t i=0; i<op2_bv.size(); i++)
281 next_bv[i]=op2_bv[i];
291 for(std::size_t i=0; i<op2_bv.size(); i++)
292 next_bv[map_u.
map_bit(i)]=op2_bv[map_op2.map_bit(i)];
The type of an expression.
struct configt::ansi_ct ansi_c
virtual bvt convert_with(const exprt &expr)
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)
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
virtual const bvt & convert_bv(const exprt &expr)
void convert_with_union(const union_typet &type, const exprt &op2, const bvt &prev_bv, bvt &next_bv)
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
const typet & follow(const typet &) const
const struct_typet & to_struct_type(const typet &type)
Cast a generic typet to a struct_typet.
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
Map bytes according to the configured endianness.
void convert_with_bv(const exprt &op1, const exprt &op2, const bvt &prev_bv, bvt &next_bv)
std::vector< exprt > operandst
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)
const array_typet & to_array_type(const typet &type)
Cast a generic typet to an array_typet.
Base class for all expressions.
const union_typet & to_union_type(const typet &type)
Cast a generic typet to a union_typet.
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