26 const typet &array_op_type = array.
type();
30 if(array_op_type.
id()==ID_array)
51 final_array.
id() == ID_symbol || final_array.
id() == ID_nondet_symbol)
55 final_array.
get(ID_identifier),
57 array_width_opt.value_or(0));
71 if(array.
id() == ID_symbol || array.
id() == ID_nondet_symbol)
75 array.
get(ID_identifier), array_type, array_width_opt.value_or(0));
93 auto maybe_index_value = numeric_cast<mp_integer>(index);
94 if(maybe_index_value.has_value())
104 #define UNIFORM_ARRAY_HACK
105 #ifdef UNIFORM_ARRAY_HACK
106 bool is_uniform = array.
id() == ID_array_of;
110 is_uniform = array.
operands().size() <= 1 ||
114 [&array](
const exprt &expr) {
115 return expr == to_multi_ary_expr(array).op0();
121 static int uniform_array_counter;
123 const std::string identifier =
CPROVER_PREFIX "internal_uniform_array_" +
141 and_exprt range_condition(std::move(lower_bound), std::move(upper_bound));
143 std::move(range_condition), std::move(value_equality));
153 #define ACTUAL_ARRAY_HACK
154 #ifdef ACTUAL_ARRAY_HACK
159 #ifdef CONSTANT_ARRAY_HACK
164 static int actual_array_counter;
166 const std::string identifier =
CPROVER_PREFIX "internal_actual_array_" +
174 #ifdef COMPACT_EQUAL_CONST
179 exprt::operandst::const_iterator it = array.
operands().begin();
185 "this loop iterates over the array, so `it` shouldn't be increased "
186 "past the array's end");
208 const bvt &array_bv =
209 convert_bv(array, numeric_cast_v<std::size_t>(array_size * width));
221 #ifdef COMPACT_EQUAL_CONST
226 equal_bv.resize(width);
232 for(std::size_t j=0; j<width; j++)
234 bv[j], array_bv[numeric_cast_v<std::size_t>(offset + j)]);
245 #ifdef COMPACT_EQUAL_CONST
253 "non-positive array sizes are forbidden in goto programs");
262 for(std::size_t j=0; j<width; j++)
264 literalt l = array_bv[numeric_cast_v<std::size_t>(offset + j)];
314 std::size_t offset_int = numeric_cast_v<std::size_t>(offset);
315 return bvt(tmp.begin() + offset_int, tmp.begin() + offset_int + width);
317 else if(array.
id() == ID_member || array.
id() == ID_index)
325 const auto subtype_bytes_opt =
340 array.
id() == ID_byte_extract_big_endian ||
341 array.
id() == ID_byte_extract_little_endian)
345 const auto subtype_bytes_opt =
352 byte_extract_expr.
offset(),
354 index * (*subtype_bytes_opt), byte_extract_expr.
offset().
type())},
bool has_byte_operator(const exprt &src)
Return true iff src or one of its operands contain a byte extract or byte update expression.
byte_extract_exprt make_byte_extract(const exprt &_op, const exprt &_offset, const typet &_type)
Construct a byte_extract_exprt with endianness and byte width matching the current configuration.
Expression classes for byte-level operators.
exprt lower_byte_operators(const exprt &src, const namespacet &ns)
Rewrite an expression possibly containing byte-extract or -update expressions to more fundamental ope...
const byte_extract_exprt & to_byte_extract_expr(const exprt &expr)
const typet & element_type() const
The type of the elements of the array.
const exprt & size() const
void record_array_index(const index_exprt &expr)
A base class for relations, i.e., binary predicates whose two operands have the same type.
const bvt & get_literals(const irep_idt &identifier, const typet &type, std::size_t width)
virtual std::optional< std::size_t > get_width_opt(const typet &type) const
virtual bvt convert_index(const exprt &array, const mp_integer &index)
index operator with constant index
virtual const bvt & convert_bv(const exprt &expr, const std::optional< std::size_t > expected_width={})
Convert expression to vector of literalts, using an internal cache to speed up conversion if availabl...
bool is_unbounded_array(const typet &type) const override
bvt conversion_failed(const exprt &expr)
Print that the expression of x has failed conversion, then return a vector of x's width.
virtual std::size_t boolbv_width(const typet &type) const
Base class for all expressions.
bool has_operands() const
Return true if there is at least one operand.
typet & type()
Return the type of the expression.
bool is_constant() const
Return whether the expression is a constant.
const irep_idt & get(const irep_idt &name) const
const irep_idt & id() const
Split an expression into a base object and a (byte) offset.
void build(const exprt &expr, const namespacet &ns)
Given an expression expr, attempt to find the underlying object it represents by skipping over type c...
static const exprt & root_object(const exprt &expr)
The plus expression Associativity is not specified.
literalt convert(const exprt &expr) override
Convert a Boolean expression and return the corresponding literal.
void l_set_to_true(literalt a)
virtual literalt land(literalt a, literalt b)=0
virtual literalt limplies(literalt a, literalt b)=0
virtual literalt lselect(literalt a, literalt b, literalt c)=0
virtual bvt new_variables(std::size_t width)
generates a bitvector of given width with new variables
virtual literalt lequal(literalt a, literalt b)=0
virtual bool has_set_to() const
Expression to hold a symbol (variable)
The type of an expression, extends irept.
static exprt implication(exprt lhs, exprt rhs)
std::vector< literalt > bvt
API to expression classes for Pointers.
std::optional< mp_integer > pointer_offset_size(const typet &type, const namespacet &ns)
Compute the size of a type in bytes, rounding up to full bytes.
exprt simplify_expr(exprt src, const namespacet &ns)
#define CHECK_RETURN(CONDITION)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
API to expression classes.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
const multi_ary_exprt & to_multi_ary_expr(const exprt &expr)
Cast an exprt to a multi_ary_exprt.
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.