Go to the documentation of this file.
23 if(expr.
id()==ID_symbol ||
24 expr.
id()==ID_nondet_symbol)
30 if(map_entry_opt.has_value())
42 exprt skeleton = expr;
57 if(type.
id()==ID_bool)
74 if(type.
id()==ID_array)
81 const typet &subtype = array_type.element_type();
84 if(sub_width_opt.has_value() && *sub_width_opt > 0)
88 std::size_t sub_width = *sub_width_opt;
91 op.reserve(width/sub_width);
93 for(std::size_t new_offset=0;
95 new_offset+=sub_width)
99 from_integer(new_offset / sub_width, array_type.index_type())};
100 op.push_back(
bv_get_rec(index, bv, offset + new_offset));
112 else if(type.
id() == ID_struct || type.
id() == ID_struct_tag)
115 type.
id() == ID_struct
118 std::size_t new_offset=0;
120 op.reserve(components.size());
122 for(
const auto &c : components)
124 const typet &subtype = c.type();
127 op.push_back(
bv_get_rec(member, bv, offset + new_offset));
134 else if(type.
id() == ID_union || type.
id() == ID_union_tag)
137 type.
id() == ID_union
141 if(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 const typet &element_type = vector_type.element_type();
165 if(element_width != 0 && width % element_width == 0)
167 std::size_t size = width / element_width;
171 for(std::size_t i=0; i<size; i++)
178 return std::move(value);
181 else if(type.
id()==ID_complex)
189 width == sub_width * 2,
190 "complex type has two elements of equal bit width");
205 for(std::size_t bit_nr=offset; bit_nr<offset+width; bit_nr++)
224 if(type.
id()==ID_string)
235 else if(type.
id() == ID_empty)
262 width, [&value](
size_t i) {
return value[value.size() - i - 1] ==
'1'; });
273 skeleton.
type() = type;
279 if(expr.
type().
id()==ID_bool)
283 bv_cachet::const_iterator it=
bv_cache.find(expr);
302 const auto size_opt = numeric_cast<mp_integer>(size);
303 if(size_opt.has_value() && *size_opt >= 0)
304 size_mpint = *size_opt;
309 typedef std::map<mp_integer, exprt> valuest;
313 if(opt_num.has_value())
319 index_mapt::const_iterator it=
index_map.find(number);
323 for(index_sett::const_iterator it1=
325 it1!=index_set.end();
335 const auto index_mpint = numeric_cast<mp_integer>(index_value);
337 if(index_mpint.has_value())
340 values[*index_mpint] =
343 values[*index_mpint] = value;
351 if(values.size() != size_mpint)
355 result.
operands().reserve(values.size()*2);
357 for(valuest::const_iterator it=values.begin();
368 result=
exprt(ID_array, type);
371 std::size_t size_int = numeric_cast_v<std::size_t>(size_mpint);
376 for(valuest::iterator it=values.begin();
379 if(it->first>=0 && it->first<size_mpint)
380 result.
operands()[numeric_cast_v<std::size_t>(it->first)].swap(
395 for(std::size_t bit_nr=offset; bit_nr<offset+width; bit_nr++)
397 assert(bit_nr<bv.size());
403 default: assert(
false);
const union_tag_typet & to_union_tag_type(const typet &type)
Cast a typet to a union_tag_typet.
#define UNREACHABLE
This should be used to mark dead code.
const componentst & components() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
bool is_unbounded_array(const typet &type) const override
virtual exprt bv_get_rec(const exprt &expr, const bvt &bv, std::size_t offset) const
#define CHECK_RETURN(CONDITION)
The type of an expression, extends irept.
std::vector< literalt > bvt
const mp_integer string2integer(const std::string &n, unsigned base)
Real part of the expression describing a complex number.
Union constructor from single element.
bvtypet get_bvtype(const typet &type)
Base class for all expressions.
std::vector< componentt > componentst
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
Vector constructor from list of elements.
const complex_typet & to_complex_type(const typet &type)
Cast a typet to a complex_typet.
optionalt< number_type > get_number(const T &a) const
virtual optionalt< std::size_t > get_width_opt(const typet &type) const
const irep_idt & get(const irep_idt &name) const
Struct constructor from list of elements.
const exprt & size() const
typet & type()
Return the type of the expression.
size_type find_number(const_iterator it) const
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
virtual std::size_t boolbv_width(const typet &type) const
#define PRECONDITION(CONDITION)
operandst & operands()=delete
remove all operand methods
exprt get(const exprt &expr) const override
Return expr with variables replaced by values from satisfying assignment if available.
exprt simplify_expr(exprt src, const namespacet &ns)
std::set< exprt > index_sett
const std::string & get_string(const irep_idt &name) const
exprt bv_get_cache(const exprt &expr) const
const irep_idt & id() const
Union constructor to support unions without any member (a GCC/Clang feature).
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
std::vector< exprt > operandst
Complex constructor from a pair of numbers.
The Boolean constant false.
mp_integer get_value(const bvt &bv)
virtual exprt bv_get_unbounded_array(const exprt &) const
optionalt< std::reference_wrapper< const map_entryt > > get_map_entry(const irep_idt &identifier) const
Extract member of struct or union.
virtual tvt l_get(literalt a) const =0
exprt bv_get(const bvt &bv, const typet &type) const
numberingt< irep_idt > string_numbering
const mp_integer binary2integer(const std::string &n, bool is_signed)
convert binary string representation to mp_integer
Imaginary part of the expression describing a complex number.
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
void add_to_operands(const exprt &expr)
Add the given argument to the end of exprt's operands.
const typet & subtype() const
const vector_typet & to_vector_type(const typet &type)
Cast a typet to a vector_typet.
Array constructor from a list of index-element pairs Operands are index/value pairs,...
union_find< exprt, irep_hash > arrays
tv_enumt get_value() const
The Boolean constant true.
A constant literal expression.
void reserve_operands(operandst::size_type n)
Array constructor from list of elements.
exprt get(const exprt &expr) const override
Return expr with variables replaced by values from satisfying assignment if available.
const std::string integer2string(const mp_integer &n, unsigned base)