29 if(expr.
id()==ID_dereference &&
32 if(expr.
op0().
id()==ID_typecast &&
56 if(expr.
id()==ID_index)
94 else if(expr.
id()==ID_member)
104 if(op_type.
id()==ID_struct)
131 else if(expr.
id()==ID_dereference)
136 else if(expr.
id()==ID_if)
183 if(
object.
id()==ID_index)
201 else if(
object.
id()==ID_dereference)
204 assert(
object.operands().size()==1);
220 if(ptr.
id()==ID_if && ptr.
operands().size()==3)
231 if(ptr.
type().
id()!=ID_pointer)
234 if(ptr.
id()==ID_address_of)
247 else if(ptr.
id()==ID_typecast)
254 if(op_type.
id()==ID_pointer)
265 else if(op_type.
id()==ID_signedbv ||
266 op_type.
id()==ID_unsignedbv)
286 if(tmp.
id()==ID_plus && tmp.
operands().size()==2)
288 if(tmp.
op0().
id()==ID_typecast &&
290 tmp.
op0().
op0().
id()==ID_address_of)
293 if(type!=expr.
type())
299 else if(tmp.
op1().
id()==ID_typecast &&
301 tmp.
op1().
op0().
id()==ID_address_of)
304 if(type!=expr.
type())
314 else if(ptr.
id()==ID_plus)
319 for(
const auto &op : ptr.
operands())
321 if(op.type().id()==ID_pointer)
322 ptr_expr.push_back(op);
323 else if(!op.is_zero())
332 int_expr.push_back(tmp);
336 if(ptr_expr.size()!=1 || int_expr.empty())
339 typet pointer_sub_type=ptr_expr.front().type().
subtype();
340 if(pointer_sub_type.
id()==ID_empty)
355 if(int_expr.size()==1)
356 sum=int_expr.front();
378 else if(ptr.
id()==ID_constant &&
379 ptr.
get(ID_value)==ID_NULL)
393 assert(expr.
type().
id()==ID_bool);
395 assert(expr.
id()==ID_equal || expr.
id()==ID_notequal);
398 if(tmp0.id()==ID_typecast)
400 if(tmp0.op0().id()==ID_index &&
404 if(tmp1.
id()==ID_typecast)
406 if(tmp1.
op0().
id()==ID_index &&
409 assert(tmp0.id()==ID_address_of);
410 assert(tmp1.
id()==ID_address_of);
412 if(tmp0.operands().size()!=1)
417 if(tmp0.op0().id()==ID_symbol &&
418 tmp1.
op0().
id()==ID_symbol)
421 tmp0.
op0().
get(ID_identifier)==
422 tmp1.
op0().
get(ID_identifier);
434 assert(expr.
type().
id()==ID_bool);
436 assert(expr.
id()==ID_equal || expr.
id()==ID_notequal);
440 assert(it->id()==ID_pointer_object);
441 assert(it->operands().size()==1);
444 if(op.id()==ID_address_of)
446 if(op.operands().size()!=1 ||
447 (op.op0().id()!=ID_symbol &&
448 op.op0().id()!=ID_dynamic_object &&
449 op.op0().id()!=ID_string_constant))
452 else if(op.id()!=ID_constant ||
453 op.get(ID_value)!=ID_NULL)
478 exprt p_o_false=expr;
516 if(op.
id()==ID_constant && op.
get(ID_value)==ID_NULL)
523 if(op.
id()==ID_address_of && op.
operands().size()==1)
525 if(op.
op0().
id()==ID_symbol)
533 else if(op.
op0().
id()==ID_string_constant)
538 else if(op.
op0().
id()==ID_array)
561 if(op.
id()==ID_constant && op.
get(ID_value)==ID_NULL)
568 if(op.
id()==ID_address_of)
582 if(a.
id()==ID_address_of && b.
id()==ID_address_of &&
586 if(a.
id()==ID_constant && b.
id()==ID_constant &&
587 a.
get(ID_value)==ID_NULL && b.
get(ID_value)==ID_NULL)
590 if(a.
id()==ID_constant && b.
id()==ID_address_of &&
591 a.
get(ID_value)==ID_NULL)
594 if(b.
id()==ID_constant && a.
id()==ID_address_of &&
595 b.
get(ID_value)==ID_NULL)
606 if(a.
id()==ID_symbol && b.
id()==ID_symbol)
608 if(a.
get(ID_identifier)==b.
get(ID_identifier))
611 else if(a.
id()==ID_index && b.
id()==ID_index)
616 else if(a.
id()==ID_member && b.
id()==ID_member)
637 if(op.
id()==ID_address_of && op.
operands().size()==1)
639 if(op.
op0().
id()==ID_symbol)
650 if(size.
type()!=type)
660 else if(op.
op0().
id()==ID_string_constant)
The type of an expression.
exprt size_of_expr(const typet &type, const namespacet &ns)
const typet & follow(const typet &src) const
struct configt::ansi_ct ansi_c
const std::string & id2string(const irep_idt &d)
pointer_typet pointer_type(const typet &subtype)
bool simplify_pointer_object(exprt &expr)
bool simplify_node(exprt &expr)
static tvt objects_equal_address_of(const exprt &a, const exprt &b)
Deprecated expression utility functions.
bool simplify_dynamic_object(exprt &expr)
exprt good_pointer_def(const exprt &pointer, const namespacet &ns)
mp_integer member_offset(const struct_typet &type, const irep_idt &member, const namespacet &ns)
const member_exprt & to_member_expr(const exprt &expr)
Cast a generic exprt to a member_exprt.
void move_to_operands(exprt &expr)
static bool is_dereference_integer_object(const exprt &expr, mp_integer &address)
bool simplify_inequality_pointer_object(exprt &expr)
The trinary if-then-else operator.
bool simplify_address_of_arg(exprt &expr)
void make_bool(bool value)
mp_integer pointer_offset_size(const typet &type, const namespacet &ns)
const index_exprt & to_index_expr(const exprt &expr)
Cast a generic exprt to an index_exprt.
bool simplify_if(if_exprt &expr)
const irep_idt & id() const
bool simplify_good_pointer(exprt &expr)
bool simplify_object(exprt &expr)
A generic base class for binary expressions.
const if_exprt & to_if_expr(const exprt &expr)
Cast a generic exprt to an if_exprt.
Operator to dereference a pointer.
bool simplify_address_of(exprt &expr)
API to expression classes.
bool simplify_pointer_offset(exprt &expr)
const irep_idt & get(const irep_namet &name) const
#define forall_operands(it, expr)
bitvector_typet index_type()
Operator to return the address of an object.
Various predicates over pointers in programs.
The boolean constant false.
std::vector< exprt > operandst
bool has_prefix(const std::string &s, const std::string &prefix)
const struct_typet & to_struct_type(const typet &type)
Cast a generic typet to a struct_typet.
mp_integer compute_pointer_offset(const exprt &expr, const namespacet &ns)
static tvt objects_equal(const exprt &a, const exprt &b)
bool simplify_rec(exprt &expr)
if_exprt lift_if(const exprt &src, std::size_t operand_number)
lift up an if_exprt one level
Base class for all expressions.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast a generic exprt to a symbol_exprt.
exprt pointer_offset(const exprt &pointer)
irep_idt get_component_name() const
bool simplify_inequality_address_of(exprt &expr)
const constant_exprt & to_constant_expr(const exprt &expr)
Cast a generic exprt to a constant_exprt.
const typet & subtype() const
bool simplify_invalid_pointer(exprt &expr)
bool simplify_object_size(exprt &expr)
void make_typecast(const typet &_type)
bitvector_typet char_type()