54 if(type_id==ID_integer || type_id==ID_natural)
58 else if(type_id==ID_rational)
66 type_id == ID_unsignedbv || type_id == ID_signedbv ||
67 type_id == ID_c_bool || type_id == ID_c_bit_field)
71 else if(type_id==ID_fixedbv)
76 else if(type_id==ID_floatbv)
81 else if(type_id==ID_pointer)
103 if(type_id==ID_integer || type_id==ID_natural)
110 else if(type_id==ID_rational)
115 return rat_value.
is_one();
118 type_id == ID_unsignedbv || type_id == ID_signedbv ||
119 type_id == ID_c_bool || type_id == ID_c_bit_field)
127 else if(type_id==ID_fixedbv)
132 else if(type_id==ID_floatbv)
164 template <
typename T>
170 bool operands_pushed;
171 explicit stack_entryt(T *_e) : e(_e), operands_pushed(
false)
176 std::stack<stack_entryt> stack;
178 stack.emplace(_expr);
180 while(!stack.empty())
182 auto &top = stack.top();
183 if(top.operands_pushed)
191 top.operands_pushed =
true;
192 for(
auto &op : top.e->operands())
208 template <
typename T>
211 std::stack<T *> stack;
215 while(!stack.empty())
217 T &expr = *stack.top();
222 for(
auto &op : expr.operands())
Pre-defined bitvector types.
const bitvector_typet & to_bitvector_type(const typet &type)
Cast a typet to a bitvector_typet.
std::size_t get_width() const
A constant literal expression.
bool value_is_zero_string() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
const source_locationt & find_source_location() const
Get a source_locationt from the expression or from its operands (non-recursively).
bool is_one() const
Return whether the expression is a constant representing 1.
bool is_true() const
Return whether the expression is a constant representing true.
depth_iteratort depth_end()
const_depth_iteratort depth_cend() const
const_unique_depth_iteratort unique_depth_end() const
bool is_boolean() const
Return whether the expression represents a Boolean.
depth_iteratort depth_begin()
const source_locationt & source_location() const
const_unique_depth_iteratort unique_depth_cend() const
void visit(class expr_visitort &visitor)
These are pre-order traversal visitors, i.e., the visitor is executed on a node before its children h...
bool is_false() const
Return whether the expression is a constant representing false.
bool is_zero() const
Return whether the expression is a constant representing 0.
void visit_pre(std::function< void(exprt &)>)
typet & type()
Return the type of the expression.
bool is_constant() const
Return whether the expression is a constant.
const_depth_iteratort depth_cbegin() const
void visit_post(std::function< void(exprt &)>)
These are post-order traversal visitors, i.e., the visitor is executed on a node after its children h...
const_unique_depth_iteratort unique_depth_cbegin() const
const_unique_depth_iteratort unique_depth_begin() const
const irep_idt & get(const irep_idt &name) const
const std::string & id_string() const
const irep_idt & id() const
static const source_locationt & nil()
void visit_post_template(std::function< void(T &)> visitor, T *_expr)
static void visit_pre_template(std::function< void(T &)> visitor, T *_expr)
Forward depth-first search iterators These iterators' copy operations are expensive,...
bool is_null_pointer(const constant_exprt &expr)
Returns true if expr has a pointer type and a value NULL; it also returns true when expr has value ze...
Deprecated expression utility functions.
const std::string & id2string(const irep_idt &d)
const mp_integer string2integer(const std::string &n, unsigned base)
#define CHECK_RETURN(CONDITION)
API to expression classes.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.