21 if(expr.
id()==ID_symbol ||
22 expr.
id()==ID_nondet_symbol)
28 if(map_entry_opt.has_value())
48 const typet &type)
const
52 assert(bv.size()>=offset+width);
54 if(type.
id()==ID_bool)
70 if(type.
id()==ID_array)
81 op.reserve(width/sub_width);
83 for(std::size_t new_offset=0;
85 new_offset+=sub_width)
89 op.push_back(
bv_get_rec(index, bv, offset + new_offset, subtype));
101 else if(type.
id()==ID_struct_tag)
105 result.
type() = type;
108 else if(type.
id()==ID_union_tag)
112 result.
type() = type;
115 else if(type.
id()==ID_struct)
119 std::size_t new_offset=0;
121 op.reserve(components.size());
123 for(
const auto &c : components)
125 const typet &subtype = c.type();
128 op.push_back(
bv_get_rec(member, bv, offset + new_offset, subtype));
132 new_offset+=sub_width;
137 else if(type.
id()==ID_union)
142 assert(!components.empty());
145 std::size_t component_nr=0;
147 const typet &subtype = components[component_nr].type();
150 expr, components[component_nr].get_name(), subtype};
152 components[component_nr].get_name(),
156 else if(type.
id()==ID_vector)
161 if(sub_width!=0 && width%sub_width==0)
163 std::size_t size=width/sub_width;
167 for(std::size_t i=0; i<size; i++)
171 bv_get_rec(index, bv, i * sub_width, subtype));
174 return std::move(value);
177 else if(type.
id()==ID_complex)
182 if(sub_width!=0 && width==sub_width*2)
197 for(std::size_t bit_nr=offset; bit_nr<offset+width; bit_nr++)
216 if(type.
id()==ID_string)
227 else if(type.
id() == ID_empty)
254 width, [&value](
size_t i) {
return value[value.size() - i - 1] ==
'1'; });
269 if(expr.
type().
id()==ID_bool)
273 bv_cachet::const_iterator it=
bv_cache.find(expr);
292 const auto size_opt = numeric_cast<mp_integer>(size);
293 if(size_opt.has_value() && *size_opt >= 0)
294 size_mpint = *size_opt;
299 typedef std::map<mp_integer, exprt> valuest;
303 if(opt_num.has_value())
309 index_mapt::const_iterator it=
index_map.find(number);
313 for(index_sett::const_iterator it1=
315 it1!=index_set.end();
325 const auto index_mpint = numeric_cast<mp_integer>(index_value);
327 if(index_mpint.has_value())
330 values[*index_mpint] =
exprt(ID_unknown, type.
subtype());
332 values[*index_mpint] = value;
340 if(values.size() != size_mpint)
344 result.
operands().reserve(values.size()*2);
346 for(valuest::const_iterator it=values.begin();
357 result=
exprt(ID_array, type);
360 std::size_t size_int = numeric_cast_v<std::size_t>(size_mpint);
365 for(valuest::iterator it=values.begin();
368 if(it->first>=0 && it->first<size_mpint)
369 result.
operands()[numeric_cast_v<std::size_t>(it->first)].swap(
384 for(std::size_t bit_nr=offset; bit_nr<offset+width; bit_nr++)
386 assert(bit_nr<bv.size());
392 default: assert(
false);
bvtypet get_bvtype(const typet &type)
bitvector_typet index_type()
const union_tag_typet & to_union_tag_type(const typet &type)
Cast a typet to a union_tag_typet.
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
Array constructor from list of elements.
Array constructor from a list of index-element pairs Operands are index/value pairs,...
const exprt & size() const
union_find< exprt, irep_hash > arrays
std::set< exprt > index_sett
optionalt< std::reference_wrapper< const map_entryt > > get_map_entry(const irep_idt &identifier) const
bool is_unbounded_array(const typet &type) const override
exprt bv_get(const bvt &bv, const typet &type) const
numberingt< irep_idt > string_numbering
virtual exprt bv_get_unbounded_array(const exprt &) const
exprt get(const exprt &expr) const override
Return expr with variables replaced by values from satisfying assignment if available.
exprt bv_get_cache(const exprt &expr) const
virtual std::size_t boolbv_width(const typet &type) const
virtual exprt bv_get_rec(const exprt &expr, const bvt &bv, std::size_t offset, const typet &type) const
mp_integer get_value(const bvt &bv)
Complex constructor from a pair of numbers.
Imaginary part of the expression describing a complex number.
Real part of the expression describing a complex number.
A constant literal expression.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
std::vector< exprt > operandst
void copy_to_operands(const exprt &expr)
Copy the given argument to the end of exprt's operands.
void reserve_operands(operandst::size_type n)
typet & type()
Return the type of the expression.
The Boolean constant false.
const std::string & get_string(const irep_namet &name) const
const irep_idt & id() const
const irep_idt & get(const irep_namet &name) const
Extract member of struct or union.
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
exprt get(const exprt &expr) const override
Return expr with variables replaced by values from satisfying assignment if available.
virtual tvt l_get(literalt a) const =0
Struct constructor from list of elements.
Structure type, corresponds to C style structs.
const componentst & components() const
std::vector< componentt > componentst
The Boolean constant true.
tv_enumt get_value() const
The type of an expression, extends irept.
const typet & subtype() const
Union constructor from single element.
optionalt< number_type > get_number(const T &a) const
size_type find_number(const_iterator it) const
Vector constructor from list of elements.
std::vector< literalt > bvt
const mp_integer binary2integer(const std::string &n, bool is_signed)
convert binary string representation to mp_integer
const mp_integer string2integer(const std::string &n, unsigned base)
const std::string integer2string(const mp_integer &n, unsigned base)
exprt simplify_expr(exprt src, const namespacet &ns)
#define CHECK_RETURN(CONDITION)
#define UNREACHABLE
This should be used to mark dead code.
#define PRECONDITION(CONDITION)
API to expression classes.
const vector_typet & to_vector_type(const typet &type)
Cast a typet to a vector_typet.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
const complex_typet & to_complex_type(const typet &type)
Cast a typet to a complex_typet.
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.