ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
pointer_logic.h
Go to the documentation of this file.
1#ifndef CPROVER_POINTER_LOGIC_H
2#define CPROVER_POINTER_LOGIC_H
3
4#include <util/irep/expr.h>
5#include <irep2/irep2.h>
8
10{
11public:
12 // this numbers the objects
13 typedef std::unordered_map<expr2tc, unsigned int, irep2_hash> objectst;
15 typedef std::vector<expr2tc> obj_lookupt;
17 unsigned int obj_num_offset;
18
19 struct pointert
20 {
21 unsigned object;
23
24 pointert() = default;
25
26 pointert(unsigned _obj, const BigInt &_off) : object(_obj), offset(_off)
27 {
28 }
29 };
30
31 // converts an (object,offset) pair to an expression
32 expr2tc pointer_expr(const pointert &pointer, const type2tc &type) const;
33
34 // converts an (object,0) pair to an expression
35 expr2tc pointer_expr(unsigned object, const type2tc &type) const;
36
37 ~pointer_logict() = default;
39
40 unsigned add_object(const expr2tc &expr);
41
42 // number of NULL object
43 unsigned get_null_object() const
44 {
45 return null_object;
46 }
47
48 // number of INVALID object
49 unsigned get_invalid_object() const
50 {
51 return invalid_object;
52 }
53
55 {
56 return objects.size() - 1 + ++obj_num_offset;
57 }
58
59protected:
61
62 expr2tc pointer_expr(const BigInt &offset, const expr2t &object) const;
63
65 const BigInt &offset,
66 const type2tc &pointer_type,
67 const expr2tc &src) const;
68};
69
70#endif
typet pointer_type()
Definition c_types.cpp:288
Definition bigint.hh:58
Base class for all expressions.
Definition irep2.h:725
pointer_logict()
Definition pointer_logic.cpp:139
expr2tc object_rec(const BigInt &offset, const type2tc &pointer_type, const expr2tc &src) const
Definition pointer_logic.cpp:70
~pointer_logict()=default
std::unordered_map< expr2tc, unsigned int, irep2_hash > objectst
Definition pointer_logic.h:13
unsigned get_invalid_object() const
Definition pointer_logic.h:49
objectst objects
Definition pointer_logic.h:14
unsigned invalid_object
Definition pointer_logic.h:60
unsigned get_null_object() const
Definition pointer_logic.h:43
expr2tc pointer_expr(const BigInt &offset, const expr2t &object) const
unsigned get_free_obj_num()
Definition pointer_logic.h:54
obj_lookupt lookup
Definition pointer_logic.h:16
expr2tc pointer_expr(const pointert &pointer, const type2tc &type) const
Definition pointer_logic.cpp:44
unsigned int obj_num_offset
Definition pointer_logic.h:17
std::vector< expr2tc > obj_lookupt
Definition pointer_logic.h:15
unsigned add_object(const expr2tc &expr)
Definition pointer_logic.cpp:11
unsigned null_object
Definition pointer_logic.h:60
Classes and definitions for non-stringy internal representation.
irep_container< type2t > type2tc
Definition irep2.h:430
irep_container< expr2t > expr2tc
Definition irep2.h:431
unsigned object
Definition pointer_logic.h:21
BigInt offset
Definition pointer_logic.h:22
pointert(unsigned _obj, const BigInt &_off)
Definition pointer_logic.h:26