41 return *
this == other;
50 h ^= hf(t.first) + 0x9e3779b9 + (h << 6) + (h >> 2);
55 h2 ^= hf(t.first) + 0x9e3779b9 + (h2 << 6) + (h2 >> 2);
58 return pairH({h, h2});
69 if (it->second.isInterval() && other.
_varToAbsVal.at(key).isInterval())
70 it->second.getInterval().widen_with(other.
_varToAbsVal.at(key).getInterval());
76 if (it->second.isInterval() && other.
_addrToAbsVal.at(key).isInterval())
77 it->second.getInterval().widen_with(other.
_addrToAbsVal.at(key).getInterval());
89 if (it->second.isInterval() && other.
_varToAbsVal.at(key).isInterval())
90 it->second.getInterval().narrow_with(other.
_varToAbsVal.at(key).getInterval());
96 if (it->second.isInterval() && other.
_addrToAbsVal.at(key).isInterval())
97 it->second.getInterval().narrow_with(other.
_addrToAbsVal.at(key).getInterval());
108 auto key = it->first;
112 oit->second.join_with(it->second);
121 auto key = it->first;
125 oit->second.join_with(it->second);
140 auto key = it->first;
144 oit->second.meet_with(it->second);
149 auto key = it->first;
153 oit->second.meet_with(it->second);
159 std::inserter(intersection, intersection.begin()));
177 s64_t numeral = consInt->getSExtValue();
182 (*this)[varId] =
IntervalValue(consFP->getFPValue(), consFP->getFPValue());
212 u32_t fieldWidth = 20;
215 std::sort(varToAbsValVec.begin(), varToAbsValVec.end(), [](
const auto &
a,
const auto &
b)
217 return a.first < b.first;
219 for (
const auto &
item: varToAbsValVec)
221 SVFUtil::outs() << std::left << std::setw(fieldWidth) << (
"Var" + std::to_string(
item.first));
222 if (
item.second.isInterval())
226 else if (
item.second.isAddr())
230 for (
const auto& addr:
item.second.getAddrs())
233 if (i <
item.second.getAddrs().size())
251 std::sort(addrToAbsValVec.begin(), addrToAbsValVec.end(), [](
const auto &
a,
const auto &
b)
253 return a.first < b.first;
256 for (
const auto&
item: addrToAbsValVec)
258 std::ostringstream oss;
260 SVFUtil::outs() << std::left << std::setw(fieldWidth) << oss.str();
261 if (
item.second.isInterval())
265 else if (
item.second.isAddr())
269 for (
const auto& addr:
item.second.getAddrs())
272 if (i <
item.second.getAddrs().size())
288 SVFUtil::outs() <<
"-----------------------------------------\n";
293 u32_t varIntervals = 0, varAddrs = 0, varBottom = 0;
296 if (
item.second.isInterval()) ++varIntervals;
297 else if (
item.second.isAddr()) ++varAddrs;
300 u32_t addrIntervals = 0, addrAddrs = 0, addrBottom = 0;
303 if (
item.second.isInterval()) ++addrIntervals;
304 else if (
item.second.isAddr()) ++addrAddrs;
307 std::ostringstream oss;
308 oss <<
"AbstractState {\n"
309 <<
" VarToAbsVal: " <<
_varToAbsVal.size() <<
" entries ("
310 << varIntervals <<
" intervals, " << varAddrs <<
" addresses, " << varBottom <<
" bottom)\n"
312 << addrIntervals <<
" intervals, " << addrAddrs <<
" addresses, " << addrBottom <<
" bottom)\n"
321 if (lhs.size() != rhs.size())
return false;
322 for (
const auto &
item: lhs)
324 auto it = rhs.find(
item.first);
327 if (!
item.second.equals(it->second))
335 if (rhs.empty())
return true;
336 for (
const auto &
item: rhs)
338 auto it = lhs.find(
item.first);
339 if (it == lhs.end())
return false;
340 if (!it->second.getInterval().contain(
341 item.second.getInterval()))
const AddrToAbsValMap & getLocToVal() const
get loc2val map
const VarToAbsValMap & getVarToVal() const
get var2val map
std::string toString() const
void printAbstractState() const
void joinWith(const AbstractState &other)
domain join with other, important! other widen this.
bool eqVarToValMap(const VarToAbsValMap &lhs, const VarToAbsValMap &rhs) const
bool equals(const AbstractState &other) const
bool geqVarToValMap(const VarToAbsValMap &lhs, const VarToAbsValMap &rhs) const
VarToAbsValMap _varToAbsVal
Map a variable (symbol) to its abstract value.
Set< NodeID > _freedAddrs
void initObjVar(const ObjVar *objVar)
AddrToAbsValMap _addrToAbsVal
Map a memory address to its stored abstract value.
static u32_t getVirtualMemAddress(u32_t idx)
The physical address starts with 0x7f...... + idx.
AbstractState narrowing(const AbstractState &other)
domain narrow with other, and return the narrowed domain
AbstractState()
default constructor
Map< u32_t, AbstractValue > VarToAbsValMap
void meetWith(const AbstractState &other)
domain meet with other, important! other widen this.
AbstractState widening(const AbstractState &other)
domain widen with other, and return the widened domain
bool isConstDataOrConstGlobal() const
bool isConstantStruct() const
bool isConstantArray() const
static IntervalValue top()
Create the IntervalValue [-inf, +inf].
const BaseObjVar * getBaseObject(NodeID id) const
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
NodeID getId() const
Get ID.
LLVM_NODISCARD bool isa(const Y &Val)
std::ostream & outs()
Overwrite llvm::outs().
LLVM_NODISCARD std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > dyn_cast(const Y &Val)
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
provide extra hash function for std::pair handling