47 if (expr.
getExpr().num_args() == 0)
50 const std::string &exprStr = expr.
to_string();
51 res.insert(std::stoi(exprStr.substr(1, exprStr.size() - 1)));
55 const z3::expr &e = expr.
getExpr().arg(i);
70 res.insert(r.begin(), r.end());
71 assert(!r.empty() &&
"symbol not init?");
72 if (r.size() == 1 && eq(expr,
toZ3Expr(*r.begin())))
76 for (
const auto &
id: r)
95 for (
const auto &
id: vars)
138 if (lhs.size() != rhs.size())
return false;
139 for (
const auto &
item: lhs)
141 auto it = rhs.find(
item.first);
143 if (it == rhs.end() || !eq(
item.second, it->second))
151 if (lhs.size() != rhs.size())
return lhs.size() < rhs.size();
152 for (
const auto &
item: lhs)
154 auto it = rhs.find(
item.first);
159 if (!eq(
item.second, it->second))
160 return item.second.id() < it->second.id();
172 assert(loc.
is_numeral() &&
"location must be numeral");
185 assert(loc.
is_numeral() &&
"location must be numeral");
189 assert(
getInternalID(objId) == objId &&
"SVFVar idx overflow > 0x7f000000?");
198 std::cout.flags(std::ios::left);
199 std::cout <<
"-----------Var and Value-----------\n";
202 std::stringstream exprName;
203 exprName <<
"Var" <<
item.first;
204 std::cout << std::setw(25) << exprName.str();
208 std::cout <<
"\t Value: " << std::hex <<
"0x" <<
z3Expr2NumValue(sim) <<
"\n";
212 std::cout <<
"\t Value: " << std::dec << sim <<
"\n";
215 std::cout <<
"-----------------------------------------\n";
bool lessThanVarToValMap(const VarToValMap &lhs, const VarToValMap &rhs) const
void extractSubVars(const Z3Expr &expr, Set< u32_t > &res)
Extract sub SVFVar IDs of a Z3Expr.
void printExprValues()
Print values of all expressions.
void store(const Z3Expr &loc, const Z3Expr &value)
Store value to location.
RelExeState & operator=(const RelExeState &rhs)
const AddrToValMap & getLocToVal() const
virtual Z3Expr toZ3Expr(u32_t varId) const
Return Z3 expression lazily based on SVFVar ID.
Z3Expr & load(const Z3Expr &loc)
Load value at location.
bool eqVarToValMap(const VarToValMap &lhs, const VarToValMap &rhs) const
const VarToValMap & getVarToVal() const
static u32_t getInternalID(u32_t idx)
Return the internal index if idx is an address otherwise return the value of idx.
Z3Expr buildRelZ3Expr(u32_t cmp, s32_t succ, Set< u32_t > &vars, Set< u32_t > &initVars)
Build relational Z3Expr.
bool operator==(const RelExeState &rhs) const
Overloading Operator==.
bool operator<(const RelExeState &rhs) const
Overloading Operator==.
static s32_t z3Expr2NumValue(const Z3Expr &e)
Return int value from an expression if it is a numeral, otherwise return an approximate value.
static bool isVirtualMemAddress(u32_t val)
Check bit value of val start with 0x7F000000, filter by 0xFF000000.
virtual Z3Expr & getZ3Expr(u32_t varId)
Return Z3 expression eagerly based on SVFVar ID.
void extractCmpVars(const Z3Expr &expr, Set< u32_t > &res)
Extract all related SVFVar IDs based on compare expr.
Map< u32_t, Z3Expr > VarToValMap
const z3::expr & getExpr() const
const std::string to_string() const
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set