36using namespace SVFUtil;
40 return *
this ==
other;
49 h ^=
hf(t.first) + 0x9e3779b9 + (
h << 6) + (
h >> 2);
54 h2 ^=
hf(t.first) + 0x9e3779b9 + (
h2 << 6) + (
h2 >> 2);
64 for (
auto it =
es._varToAbsVal.begin();
it !=
es._varToAbsVal.end(); ++
it)
68 if (
it->second.isInterval() &&
other._varToAbsVal.at(
key).isInterval())
69 it->second.getInterval().widen_with(
other._varToAbsVal.at(
key).getInterval());
71 for (
auto it =
es._addrToAbsVal.begin();
it !=
es._addrToAbsVal.end(); ++
it)
74 if (
other._addrToAbsVal.find(
key) !=
other._addrToAbsVal.end())
75 if (
it->second.isInterval() &&
other._addrToAbsVal.at(
key).isInterval())
76 it->second.getInterval().widen_with(
other._addrToAbsVal.at(
key).getInterval());
84 for (
auto it =
es._varToAbsVal.begin();
it !=
es._varToAbsVal.end(); ++
it)
88 if (
it->second.isInterval() &&
other._varToAbsVal.at(
key).isInterval())
89 it->second.getInterval().narrow_with(
other._varToAbsVal.at(
key).getInterval());
91 for (
auto it =
es._addrToAbsVal.begin();
it !=
es._addrToAbsVal.end(); ++
it)
94 if (
other._addrToAbsVal.find(
key) !=
other._addrToAbsVal.end())
95 if (
it->second.isInterval() &&
other._addrToAbsVal.at(
key).isInterval())
96 it->second.getInterval().narrow_with(
other._addrToAbsVal.at(
key).getInterval());
105 for (
auto it =
other._varToAbsVal.begin();
it !=
other._varToAbsVal.end(); ++
it)
107 auto key =
it->first;
111 oit->second.join_with(
it->second);
118 for (
auto it =
other._addrToAbsVal.begin();
it !=
other._addrToAbsVal.end(); ++
it)
120 auto key =
it->first;
124 oit->second.join_with(
it->second);
137 for (
auto it =
other._varToAbsVal.begin();
it !=
other._varToAbsVal.end(); ++
it)
139 auto key =
it->first;
143 oit->second.meet_with(
it->second);
146 for (
auto it =
other._addrToAbsVal.begin();
it !=
other._addrToAbsVal.end(); ++
it)
148 auto key =
it->first;
152 oit->second.meet_with(
it->second);
157 other._freedAddrs.begin(),
other._freedAddrs.end(),
172 if (
obj->isConstDataOrConstGlobal() ||
obj->isConstantArray() ||
obj->isConstantStruct())
183 else if (SVFUtil::isa<ConstNullPtrObjVar>(
objVar))
187 else if (SVFUtil::isa<GlobalObjVar>(
objVar))
191 else if (
obj->isConstantArray() ||
obj->isConstantStruct())
216 return a.first < b.first;
221 if (
item.second.isInterval())
225 else if (
item.second.isAddr())
229 for (
const auto&
addr:
item.second.getAddrs())
232 if (
i <
item.second.getAddrs().size())
252 return a.first < b.first;
257 std::ostringstream
oss;
260 if (
item.second.isInterval())
264 else if (
item.second.isAddr())
268 for (
const auto&
addr:
item.second.getAddrs())
271 if (
i <
item.second.getAddrs().size())
287 SVFUtil::outs() <<
"-----------------------------------------\n";
306 std::ostringstream
oss;
307 oss <<
"AbstractState {\n"
308 <<
" VarToAbsVal: " <<
_varToAbsVal.size() <<
" entries ("
320 if (
lhs.size() !=
rhs.size())
return false;
326 if (!
item.second.equals(
it->second))
334 if (
rhs.empty())
return true;
338 if (
it ==
lhs.end())
return false;
339 if (!
it->second.getInterval().contain(
340 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].
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