4 #ifndef ILANG_ILA_AST_SORT_H__
5 #define ILANG_ILA_AST_SORT_H__
45 virtual bool is_bool()
const {
return false; }
47 virtual bool is_bv(
const int& width = 0)
const {
return false; }
49 virtual bool is_mem()
const {
return false; }
60 virtual z3::sort
GetZ3Sort(z3::context& ctx)
const = 0;
62 virtual z3::expr
GetZ3Expr(z3::context& ctx,
63 const std::string&
name)
const = 0;
69 return lhs->Equal(rhs);
73 virtual std::ostream&
Print(std::ostream& out)
const = 0;
101 z3::sort
GetZ3Sort(z3::context& ctx)
const;
103 z3::expr
GetZ3Expr(z3::context& ctx,
const std::string&
name)
const;
107 std::ostream&
Print(std::ostream& out)
const;
123 bool is_bv(
const int& width)
const {
124 return (width == 0) ?
true : (width == bit_width_);
131 z3::sort
GetZ3Sort(z3::context& ctx)
const;
133 z3::expr
GetZ3Expr(z3::context& ctx,
const std::string&
name)
const;
137 std::ostream&
Print(std::ostream& out)
const;
149 SortMem(
const int& addr_w,
const int& data_w);
165 z3::sort
GetZ3Sort(z3::context& ctx)
const;
167 z3::expr
GetZ3Expr(z3::context& ctx,
const std::string&
name)
const;
171 std::ostream&
Print(std::ostream& out)
const;
182 #endif // ILANG_ILA_AST_SORT_H__
AstUidSort uid() const
Return the unified ID of SortBool.
Definition: sort.h:95
bool is_bool() const
Return true since it is Boolean Sort.
Definition: sort.h:97
static SortPtr MakeMemSort(const int &addr_width, const int &data_width)
Create a memory (array) Sort.
virtual int data_width() const
Return the bit-width of the data (value).
std::ostream & Print(std::ostream &out) const
Print out to output stream.
AstUidSort
Unified ID for Sort.
Definition: sort.h:18
Sort::SortPtr SortPtr
Pointer type for storing/passing Sort.
Definition: sort.h:82
int data_width() const
Return the bit-width of data (value).
Definition: sort.h:163
z3::expr GetZ3Expr(z3::context &ctx, const std::string &name) const
Return a z3 variable of the Sort.
virtual bool is_bool() const
Return true if have Boolean sort.
Definition: sort.h:45
virtual int bit_width() const
Return the bit-width of bit-vector sort.
static SortPtr MakeBoolSort()
Create a Boolean Sort.
z3::sort GetZ3Sort(z3::context &ctx) const
Return the z3::sort of array.
~SortBool()
Default destructor.
virtual int addr_width() const
Return the bit-width of the address (index).
std::ostream & Print(std::ostream &out) const
Print out to output stream.
std::shared_ptr< Sort > SortPtr
Pointer type for storing/passing Sort.
Definition: sort.h:25
AstUidSort uid() const
Return the unified ID of SortBv.
Definition: sort.h:121
virtual std::ostream & Print(std::ostream &out) const =0
Print out to output stream.
AstUidSort uid() const
Return the unified ID of SortMem.
Definition: sort.h:155
bool Equal(const SortPtr rhs) const
Compare with another Sort.
virtual z3::expr GetZ3Expr(z3::context &ctx, const std::string &name) const =0
Return a z3 variable of the Sort.
bool is_bv(const int &width) const
Return true since it is bit-vector Sort.
Definition: sort.h:123
int bit_width() const
Return the bit-width.
Definition: sort.h:129
The class for the Abstract Syntax Tree. An Ast object can be an expression or function definition (in...
Definition: ast.h:20
int addr_width() const
Return the bit-width of address (index).
Definition: sort.h:161
z3::expr GetZ3Expr(z3::context &ctx, const std::string &name) const
Return a z3 variable of the Sort.
Sort()
Default constructor.
z3::sort GetZ3Sort(z3::context &ctx) const
Return the z3::sort of bit-vector.
SortBv(const int &width)
Default constructor.
virtual bool Equal(const SortPtr rhs) const =0
Compare two Sorts.
The class for sort (type for expr, and the range/domain of functions).
Definition: sort.h:22
bool Equal(const SortPtr rhs) const
Compare with another Sort.
The class of memory (array) Sort.
Definition: sort.h:145
~SortBv()
Default destructor.
~SortMem()
Default destructor.
SortBool()
Default constructor.
z3::expr GetZ3Expr(z3::context &ctx, const std::string &name) const
Return a z3 variable of the Sort.
virtual bool is_mem() const
Return true if have memory (array) sort.
Definition: sort.h:49
virtual AstUidSort uid() const =0
Return the unified ID of Sort.
std::ostream & Print(std::ostream &out) const
Print out to output stream.
The class of bit-vector Sort.
Definition: sort.h:111
friend std::ostream & operator<<(std::ostream &out, const SortPtr s)
Overload output stream operator.
Definition: sort.h:75
bool is_mem() const
Return true since it is memory (array) Sort.
Definition: sort.h:157
bool Equal(const SortPtr rhs) const
Compare with another Sort.
virtual ~Sort()
Virtual default destructor.
virtual z3::sort GetZ3Sort(z3::context &ctx) const =0
Return z3::sort of the Sort.
virtual bool is_bv(const int &width=0) const
Return true if have bit-vector sort.
Definition: sort.h:47
z3::sort GetZ3Sort(z3::context &ctx) const
Return the z3::sort of Boolean Sort.
The class of Boolean Sort.
Definition: sort.h:85
friend bool operator==(const SortPtr lhs, const SortPtr rhs)
Overlaod comparison.
Definition: sort.h:68
static SortPtr MakeBvSort(const int &bit_width)
Create a bit-vector Sort.
SortMem(const int &addr_w, const int &data_w)
Default constructor.
const Symbol & name() const
Get the symbol (name).