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());
106 for (
auto it =
other._varToAbsVal.begin();
it !=
other._varToAbsVal.end(); ++
it)
108 auto key =
it->first;
112 oit->second.join_with(
it->second);
119 for (
auto it =
other._addrToAbsVal.begin();
it !=
other._addrToAbsVal.end(); ++
it)
121 auto key =
it->first;
125 oit->second.join_with(
it->second);
138 for (
auto it =
other._varToAbsVal.begin();
it !=
other._varToAbsVal.end(); ++
it)
140 auto key =
it->first;
144 oit->second.meet_with(
it->second);
147 for (
auto it =
other._addrToAbsVal.begin();
it !=
other._addrToAbsVal.end(); ++
it)
149 auto key =
it->first;
153 oit->second.meet_with(
it->second);
158 other._freedAddrs.begin(),
other._freedAddrs.end(),
173 if (
obj->isConstDataOrConstGlobal() ||
obj->isConstantArray() ||
obj->isConstantStruct())
184 else if (SVFUtil::isa<ConstNullPtrObjVar>(
objVar))
188 else if (SVFUtil::isa<GlobalObjVar>(
objVar))
192 else if (
obj->isConstantArray() ||
obj->isConstantStruct())
217 return a.first < b.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())
253 return a.first < b.first;
258 std::ostringstream
oss;
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";
307 std::ostringstream
oss;
308 oss <<
"AbstractState {\n"
309 <<
" VarToAbsVal: " <<
_varToAbsVal.size() <<
" entries ("
321 if (
lhs.size() !=
rhs.size())
return false;
327 if (!
item.second.equals(
it->second))
335 if (
rhs.empty())
return true;
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
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