37using namespace SVFUtil;
41 return *
this ==
other;
50 h ^=
hf(t.first) + 0x9e3779b9 + (
h << 6) + (
h >> 2);
55 h2 ^=
hf(t.first) + 0x9e3779b9 + (
h2 << 6) + (
h2 >> 2);
65 for (
auto it =
es._varToAbsVal.begin();
it !=
es._varToAbsVal.end(); ++
it)
69 if (
it->second.isInterval() &&
other._varToAbsVal.at(
key).isInterval())
70 it->second.getInterval().widen_with(
other._varToAbsVal.at(
key).getInterval());
72 for (
auto it =
es._addrToAbsVal.begin();
it !=
es._addrToAbsVal.end(); ++
it)
75 if (
other._addrToAbsVal.find(
key) !=
other._addrToAbsVal.end())
76 if (
it->second.isInterval() &&
other._addrToAbsVal.at(
key).isInterval())
77 it->second.getInterval().widen_with(
other._addrToAbsVal.at(
key).getInterval());
85 for (
auto it =
es._varToAbsVal.begin();
it !=
es._varToAbsVal.end(); ++
it)
89 if (
it->second.isInterval() &&
other._varToAbsVal.at(
key).isInterval())
90 it->second.getInterval().narrow_with(
other._varToAbsVal.at(
key).getInterval());
92 for (
auto it =
es._addrToAbsVal.begin();
it !=
es._addrToAbsVal.end(); ++
it)
95 if (
other._addrToAbsVal.find(
key) !=
other._addrToAbsVal.end())
96 if (
it->second.isInterval() &&
other._addrToAbsVal.at(
key).isInterval())
97 it->second.getInterval().narrow_with(
other._addrToAbsVal.at(
key).getInterval());
111 for (
auto it =
other._varToAbsVal.begin();
it !=
other._varToAbsVal.end(); ++
it)
113 auto key =
it->first;
117 oit->second.join_with(
it->second);
125 for (
auto it =
other._addrToAbsVal.begin();
it !=
other._addrToAbsVal.end(); ++
it)
127 auto key =
it->first;
131 oit->second.join_with(
it->second);
144 for (
auto it =
other._varToAbsVal.begin();
it !=
other._varToAbsVal.end(); ++
it)
146 auto key =
it->first;
150 oit->second.meet_with(
it->second);
153 for (
auto it =
other._addrToAbsVal.begin();
it !=
other._addrToAbsVal.end(); ++
it)
155 auto key =
it->first;
159 oit->second.meet_with(
it->second);
164 other._freedAddrs.begin(),
other._freedAddrs.end(),
179 if (
obj->isConstDataOrConstGlobal() ||
obj->isConstantArray() ||
obj->isConstantStruct())
190 else if (SVFUtil::isa<ConstNullPtrObjVar>(
objVar))
194 else if (SVFUtil::isa<GlobalObjVar>(
objVar))
198 else if (
obj->isConstantArray() ||
obj->isConstantStruct())
223 return a.first < b.first;
228 if (
item.second.isInterval())
232 else if (
item.second.isAddr())
236 for (
const auto&
addr:
item.second.getAddrs())
239 if (
i <
item.second.getAddrs().size())
259 return a.first < b.first;
264 std::ostringstream
oss;
267 if (
item.second.isInterval())
271 else if (
item.second.isAddr())
275 for (
const auto&
addr:
item.second.getAddrs())
278 if (
i <
item.second.getAddrs().size())
294 SVFUtil::outs() <<
"-----------------------------------------\n";
313 std::ostringstream
oss;
314 oss <<
"AbstractState {\n"
315 <<
" VarToAbsVal: " <<
_varToAbsVal.size() <<
" entries ("
327 if (
lhs.size() !=
rhs.size())
return false;
333 if (!
item.second.equals(
it->second))
341 if (
rhs.empty())
return true;
345 if (
it ==
lhs.end())
return false;
346 if (!
it->second.getInterval().contain(
347 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
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
static IntervalValue top()
Create the IntervalValue [-inf, +inf].
static const OptionMap< u32_t > AESparsity
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.
std::ostream & outs()
Overwrite llvm::outs()
llvm::IRBuilder IRBuilder