20 expr.
id() ==
"no-overflow-plus" || expr.
id() ==
"no-overflow-minus");
38 "operator " + expr.
id_string() +
" takes at least one operand");
42 op0.
type() == type,
"add/sub with mixed types:\n" + expr.
pretty());
47 expr.
id()==
"no-overflow-minus");
50 expr.
id()==
"no-overflow-minus");
60 for(exprt::operandst::const_iterator
61 it=operands.begin()+1;
62 it!=operands.end(); it++)
65 it->type() == type,
"add/sub with mixed types:\n" + expr.
pretty());
75 sub_width != 0,
"complex elements shall have nonzero bit width");
78 "total complex bit width shall be a multiple of the element bit width");
83 for(std::size_t i=0; i<size; i++)
88 for(std::size_t j=0; j<
tmp_op.size(); j++)
90 const std::size_t index = i *
sub_width + j;
91 INVARIANT(index < op.size(),
"bit index shall be within bounds");
100 const std::size_t index = i *
sub_width + j;
101 INVARIANT(index < bv.size(),
"bit index shall be within bounds");
117 "applying the add/sub operation shall not change the bitwidth");
119 for(std::size_t j=0; j<
tmp_result.size(); j++)
121 const std::size_t index = i *
sub_width + j;
122 INVARIANT(index < bv.size(),
"bit index shall be within bounds");
169 "saturating add/sub with mixed types:\n" + expr.
pretty());
192 "total complex bit width shall be a multiple of the element bit width");
196 for(std::size_t i = 0; i < size; i++)
201 for(std::size_t j = 0; j <
tmp_op.size(); j++)
203 const std::size_t index = i *
sub_width + j;
204 INVARIANT(index < op.size(),
"bit index shall be within bounds");
211 for(std::size_t j = 0; j <
tmp_result.size(); j++)
213 const std::size_t index = i *
sub_width + j;
214 INVARIANT(index < bv.size(),
"bit index shall be within bounds");
222 "applying the add/sub operation shall not change the bitwidth");
224 for(std::size_t j = 0; j <
tmp_result.size(); j++)
226 const std::size_t index = i *
sub_width + j;
227 INVARIANT(index < bv.size(),
"bit index shall be within bounds");
Pre-defined bitvector types.
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_typet.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
A base class for binary expressions.
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...
virtual bvt convert_add_sub(const exprt &expr)
virtual bvt convert_saturating_add_sub(const binary_exprt &expr)
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
bvt add_sub_no_overflow(const bvt &op0, const bvt &op1, bool subtract, representationt rep)
static bvt build_constant(const mp_integer &i, std::size_t width)
bvt add_sub(const bvt &op0, const bvt &op1, bool subtract)
bvt saturating_add_sub(const bvt &op0, const bvt &op1, bool subtract, representationt rep)
Base class for all expressions.
std::vector< exprt > operandst
typet & type()
Return the type of the expression.
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
const std::string & id_string() const
const irep_idt & id() const
The type of an expression, extends irept.
std::vector< literalt > bvt
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define PRECONDITION(CONDITION)
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
const multi_ary_exprt & to_multi_ary_expr(const exprt &expr)
Cast an exprt to a multi_ary_exprt.
const range_typet & to_range_type(const typet &type)
Cast a typet to a range_typet.
const type_with_subtypet & to_type_with_subtype(const typet &type)