36#ifndef MUTABLE_POINTSTO_H_
37#define MUTABLE_POINTSTO_H_
48template <
typename Key,
typename KeySet,
typename Data,
typename DataSet>
52template <
typename Key,
typename KeySet,
typename Data,
typename DataSet>
77 virtual inline void clear()
override
90 assert(this->
rev &&
"MutablePTData::getRevPts: constructed without reverse PT support!");
132 for (
typename PtsMap::value_type &
ppt :
ptsMap)
ppt.second.checkAndRemap();
138 for (
typename PtsMap::value_type
ppt :
ptsMap)
140 const DataSet &pt =
ppt.second;
156 return ptd->getPTDTY() == PTDataTy::MutBase;
169 O <<
var <<
" ==> { ";
187 return d.test_and_set(e);
226template <
typename Key,
typename KeySet,
typename Data,
typename DataSet>
258 assert(this->
rev &&
"MutableDiffPTData::getRevPts: constructed without reverse PT support!");
290 for (
typename PtsMap::value_type &
ppt :
diffPtsMap)
ppt.second.checkAndRemap();
311 diff.intersectWithComplement(
all,
propa);
313 return !diff.empty();
342 return ptd->getPTDTY() == PTDataTy::MutDiff;
362template <
typename Key,
typename KeySet,
typename Data,
typename DataSet>
388 virtual inline void clear()
override
400 assert(this->
rev &&
"MutableDFPTData::getRevPts: constructed without reverse PT support!");
420 return (ptsMap.find(
var) != ptsMap.end());
429 return (ptsMap.find(
var) != ptsMap.end());
551 for (
typename PtsMap::value_type &
opt :
lopt.second)
opt.second.checkAndRemap();
556 for (
typename PtsMap::value_type &
opt :
lopt.second)
opt.second.checkAndRemap();
566 for (
typename PtsMap::value_type
vpt :
lptsmap.second)
574 for (
typename PtsMap::value_type
vpt :
lptm.second)
605 return d.test_and_set(e);
618 std::fstream
f(
"svfg_pts.data", std::ios_base::out);
633 f <<
"Loc:" <<
loc <<
" IN:{";
640 f <<
"Loc:" <<
loc <<
" OUT:{";
663 O <<
"<" <<
var <<
",{";
681template <
typename Key,
typename KeySet,
typename Data,
typename DataSet>
841 it->second.reset(
var);
848 return it->second.test(
var);
870 it->second.reset(
var);
877 return it->second.test(
var);
891template <
typename Key,
typename KeySet,
typename Data,
typename DataSet,
typename VersionedKey,
typename VersionedKeySet>
904 virtual inline void clear()
override
921 assert(this->
rev &&
"MutableVersionedPTData::getRevPts: constructed without reverse PT support!");
926 assert(this->
rev &&
"MutableVersionedPTData::getVersionedKeyRevPts: constructed without reverse PT support!");
999 SVFUtil::outs() <<
"== Address-taken points-to information\n";
1012 return ptd->getPTDTY() == PTDataTy::MutVersioned;
Map< LocID, PtsMap > DFPtsMap
Data-flow point-to map.
virtual bool updateATVPts(const Key &srcVar, LocID dstLoc, const Key &dstVar) override
Update address-taken variables OUT[dstLoc:dstVar] with points-to of top-level pointers.
virtual DataSet & getDFOutPtsSet(LocID loc, const Key &var) override
DFPTData< Key, KeySet, Data, DataSet > BaseDFPTData
const PtsMap & getDFInPtsMap(LocID loc)
virtual bool updateTLVPts(LocID srcLoc, const Key &srcVar, const Key &dstVar) override
Update points-to set of top-level pointers with IN[srcLoc:srcVar].
const PtsMap & getDFOutPtsMap(LocID loc)
virtual bool updateAllDFInFromIn(LocID srcLoc, const Key &srcVar, LocID dstLoc, const Key &dstVar) override
Union (IN[dstLoc::dstVar], IN[srcLoc:srcVar]. There is no flag check, unlike the above.
PTData< Key, KeySet, Data, DataSet > BasePTData
DFPtsMap::iterator DFPtsMapIter
BaseMutPTData::PtsMapConstIter PtsMapConstIter
virtual void clearAllDFOutUpdatedVar(LocID) override
virtual void clear() override
Clears all points-to sets as if nothing is stored.
virtual bool updateAllDFOutFromIn(LocID loc, const Key &singleton, bool strongUpdates) override
For each variable var in IN at loc, do updateDFOutFromIn(loc, var, loc, var).
static bool classof(const MutableDFPTData< Key, KeySet, Data, DataSet > *)
const DFPtsMap & getDFIn()
virtual bool updateAllDFInFromOut(LocID srcLoc, const Key &srcVar, LocID dstLoc, const Key &dstVar) override
Union (IN[dstLoc::dstVar], OUT[srcLoc:srcVar]. There is no flag check, unlike the above.
virtual bool updateDFInFromOut(LocID srcLoc, const Key &srcVar, LocID dstLoc, const Key &dstVar) override
Union (IN[dstLoc:dstVar], OUT[srcLoc:srcVar]).
bool unionPts(DataSet &dstDataSet, const DataSet &srcDataSet)
virtual void dumpPTData() override
virtual ~MutableDFPTData()
virtual const DataSet & getPts(const Key &var) override
Get points-to set of var.
virtual bool hasDFInSet(LocID loc) const override
const DFPtsMap & getDFOut()
virtual bool hasDFInSet(LocID loc, const Key &var) const override
virtual DataSet & getDFInPtsSet(LocID loc, const Key &var) override
virtual void clearFullPts(const Key &var) override
Fully clears the points-to set of var.
virtual Map< DataSet, unsigned > getAllPts(bool liveOnly) const override
virtual bool updateDFOutFromIn(LocID srcLoc, const Key &srcVar, LocID dstLoc, const Key &dstVar) override
Union (OUT[dstLoc:dstVar], IN[srcLoc:srcVar]).
virtual bool unionPts(const Key &dstKey, const DataSet &srcDataSet) override
Performs pts(dstVar) = pts(dstVar) U srcDataSet.
virtual bool addPts(const Key &dstKey, const Key &srcKey) override
bool addPts(DataSet &d, const Data &e)
DFPtsMap dfInPtsMap
Data-flow IN set.
virtual const PtsMap & getPtsMap() const
virtual bool updateDFInFromIn(LocID srcLoc, const Key &srcVar, LocID dstLoc, const Key &dstVar) override
virtual const KeySet & getRevPts(const Data &datum) override
Get reverse points-to set of a datum.
virtual bool hasDFOutSet(LocID loc) const override
static bool classof(const PTData< Key, KeySet, Data, DataSet > *ptd)
MutablePTData< Key, KeySet, Data, DataSet > mutPTData
MutablePTData< Key, KeySet, Data, DataSet > BaseMutPTData
virtual void remapAllPts(void) override
Remaps all points-to sets to use the current mapping.
DFPtsMap dfOutPtsMap
Data-flow OUT set.
virtual bool unionPts(const Key &dstKey, const Key &srcKey) override
Performs pts(dstVar) = pts(dstVar) U pts(srcVar).
DFPtsMap::const_iterator DFPtsMapconstIter
virtual void clearPts(const Key &var, const Data &element) override
Clears element from the points-to set of var.
BaseMutPTData::PtsMap PtsMap
BaseDFPTData::LocID LocID
virtual void dumpPts(const PtsMap &ptsSet, OutStream &O=SVFUtil::outs()) const
MutableDFPTData(bool reversePT=true, PTDataTy ty=BaseDFPTData::MutDataFlow)
Constructor.
BasePTData::PTDataTy PTDataTy
virtual bool hasDFOutSet(LocID loc, const Key &var) const override
DiffPTData implemented with points-to sets which are updated continuously.
virtual bool unionPts(const Key &dstKey, const Key &srcKey) override
Performs pts(dstVar) = pts(dstVar) U pts(srcVar).
DataSet & getPropaPts(Key &var)
Get propagated points to.
MutablePTData< Key, KeySet, Data, DataSet >::PtsMap PtsMap
static bool classof(const MutableDiffPTData< Key, KeySet, Data, DataSet > *)
virtual void updatePropaPtsMap(Key &src, Key &dst) override
virtual const PtsMap & getPtsMap() const
MutablePTData< Key, KeySet, Data, DataSet > mutPTData
Backing to implement the basic PTData methods. This allows us to avoid multiple-inheritance.
virtual void clearPropaPts(Key &var) override
Clear propagated points-to set of var.
~MutableDiffPTData() override=default
virtual Map< DataSet, unsigned > getAllPts(bool liveOnly) const override
PTData< Key, KeySet, Data, DataSet > BasePTData
virtual void clearPts(const Key &var, const Data &element) override
Clears element from the points-to set of var.
void clear() override
Clears all points-to sets as if nothing is stored.
virtual bool addPts(const Key &dstKey, const Data &element) override
Adds element to the points-to set associated with var.
virtual bool unionPts(const Key &dstKey, const DataSet &srcDataSet) override
Performs pts(dstVar) = pts(dstVar) U srcDataSet.
virtual void remapAllPts(void) override
Remaps all points-to sets to use the current mapping.
virtual void clearFullPts(const Key &var) override
Fully clears the points-to set of var.
virtual const DataSet & getPts(const Key &var) override
Get points-to set of var.
BasePTData::PTDataTy PTDataTy
PtsMap diffPtsMap
Diff points-to to be propagated.
DiffPTData< Key, KeySet, Data, DataSet > BaseDiffPTData
virtual const KeySet & getRevPts(const Data &datum) override
Get reverse points-to set of a datum.
virtual bool computeDiffPts(Key &var, const DataSet &all) override
PtsMap propaPtsMap
Points-to already propagated.
virtual void dumpPTData() override
Dump stored keys and points-to sets.
MutableDiffPTData(bool reversePT=true, PTDataTy ty=PTDataTy::Diff)
Constructor.
virtual const DataSet & getDiffPts(Key &var) override
Get diff points to.
static bool classof(const PTData< Key, KeySet, Data, DataSet > *ptd)
Incremental version of the mutable data-flow points-to data structure.
PTData< Key, KeySet, Data, DataSet > BasePTData
DataSet::iterator DataIter
virtual bool updateAllDFInFromOut(LocID srcLoc, const Key &srcVar, LocID dstLoc, const Key &dstVar) override
Union (IN[dstLoc::dstVar], OUT[srcLoc:srcVar]. There is no flag check, unlike the above.
void setVarDFInSetUpdated(LocID loc, const Key &var)
Handle address-taken variables whose IN pts changed.
const DataSet & getDFOutUpdatedVar(LocID loc)
Get all var which have new pts information in loc's OUT set.
virtual bool updateAllDFOutFromIn(LocID loc, const Key &singleton, bool strongUpdates) override
For each variable var in IN at loc, do updateDFOutFromIn(loc, var, loc, var).
DFPTData< Key, KeySet, Data, DataSet > BaseDFPTData
bool varHasNewDFOutPts(LocID loc, const Key &var)
Return TRUE if var has new pts in loc's OUT set.
MutableDFPTData< Key, KeySet, Data, DataSet > BaseMutDFPTData
BasePTData::PTDataTy PTDataTy
Map< LocID, DataSet > UpdatedVarMap
for propagating only newly added variable in IN/OUT set
BaseDFPTData::LocID LocID
virtual bool updateDFInFromIn(LocID srcLoc, const Key &srcVar, LocID dstLoc, const Key &dstVar) override
virtual bool updateTLVPts(LocID srcLoc, const Key &srcVar, const Key &dstVar) override
Update points-to set of top-level pointers with IN[srcLoc:srcVar].
void setVarDFOutSetUpdated(LocID loc, const Key &var)
Handle address-taken variables whose OUT pts changed.
static bool classof(const MutableIncDFPTData< Key, KeySet, Data, DataSet > *)
UpdatedVarMap::iterator UpdatedVarMapIter
const DataSet & getDFInUpdatedVar(LocID loc)
Get all var which have new pts information in loc's IN set.
void removeVarFromDFInUpdatedSet(LocID loc, const Key &var)
Remove var from loc's IN updated set.
MutablePTData< Key, KeySet, Data, DataSet > BaseMutPTData
MutableIncDFPTData(bool reversePT=true, PTDataTy ty=BasePTData::MutIncDataFlow)
Constructor.
virtual bool updateDFOutFromIn(LocID srcLoc, const Key &srcVar, LocID dstLoc, const Key &dstVar) override
Union (OUT[dstLoc:dstVar], IN[srcLoc:srcVar]).
static bool classof(const PTData< Key, KeySet, Data, DataSet > *ptd)
virtual bool updateATVPts(const Key &srcVar, LocID dstLoc, const Key &dstVar) override
Update address-taken variables OUT[dstLoc:dstVar] with points-to of top-level pointers.
UpdatedVarMap inUpdatedVarMap
void removeVarFromDFOutUpdatedSet(LocID loc, const Key &var)
Remove var from loc's OUT updated set.
virtual void clearAllDFOutUpdatedVar(LocID loc) override
virtual bool updateDFInFromOut(LocID srcLoc, const Key &srcVar, LocID dstLoc, const Key &dstVar) override
Union (IN[dstLoc:dstVar], OUT[srcLoc:srcVar]).
virtual bool updateAllDFInFromIn(LocID srcLoc, const Key &srcVar, LocID dstLoc, const Key &dstVar) override
Union (IN[dstLoc::dstVar], IN[srcLoc:srcVar]. There is no flag check, unlike the above.
virtual ~MutableIncDFPTData()
bool varHasNewDFInPts(LocID loc, const Key &var)
Return TRUE if var has new pts in loc's IN set.
UpdatedVarMap outUpdatedVarMap
UpdatedVarMap::const_iterator UpdatedVarconstIter
PTData implemented using points-to sets which are created once and updated continuously.
virtual const KeySet & getRevPts(const Data &datum) override
Get reverse points-to set of a datum.
virtual bool unionPts(const Key &dstKey, const Key &srcKey) override
Performs pts(dstVar) = pts(dstVar) U pts(srcVar).
virtual bool unionPts(const Key &dstKey, const DataSet &srcDataSet) override
Performs pts(dstVar) = pts(dstVar) U srcDataSet.
virtual void dumpPTData() override
Dump stored keys and points-to sets.
virtual void remapAllPts(void) override
Remaps all points-to sets to use the current mapping.
virtual void clearFullPts(const Key &var) override
Fully clears the points-to set of var.
void addSingleRevPts(KeySet &revData, const Key &tgr)
MutablePTData(bool reversePT=true, PTDataTy ty=PTDataTy::MutBase)
Constructor.
void clearSingleRevPts(KeySet &revSet, const Key &k)
static bool classof(const PTData< Key, KeySet, Data, DataSet > *ptd)
static bool classof(const MutablePTData< Key, KeySet, Data, DataSet > *)
virtual void clearPts(const Key &var, const Data &element) override
Clears element from the points-to set of var.
virtual Map< DataSet, unsigned > getAllPts(bool liveOnly) const override
Map< Data, KeySet > RevPtsMap
void clearRevPts(const DataSet &pts, const Key &k)
bool addPts(DataSet &d, const Data &e)
virtual const DataSet & getPts(const Key &var) override
Get points-to set of var.
BasePTData::PTDataTy PTDataTy
virtual bool addPts(const Key &dstKey, const Data &element) override
Adds element to the points-to set associated with var.
PTData< Key, KeySet, Data, DataSet > BasePTData
bool unionPts(DataSet &dstDataSet, const DataSet &srcDataSet)
virtual void clear() override
Clears all points-to sets as if nothing is stored.
PtsMap::iterator PtsMapIter
void addRevPts(const DataSet &ptsData, const Key &tgr)
virtual const PtsMap & getPtsMap() const
Return Points-to map.
Map< Key, DataSet > PtsMap
DataSet::iterator iterator
PtsMap::const_iterator PtsMapConstIter
virtual void dumpPts(const PtsMap &ptsSet, OutStream &O=SVFUtil::outs()) const
virtual bool addPts(const Key &k, const Data &element) override
Adds element to the points-to set associated with var.
MutablePTData< Key, KeySet, Data, DataSet > tlPTData
PTData for Keys (top-level pointers, generally).
virtual const DataSet & getPts(const Key &vk) override
Get points-to set of var.
virtual void clearPts(const VersionedKey &vk, const Data &element) override
PTData< Key, KeySet, Data, DataSet > BasePTData
MutablePTData< VersionedKey, VersionedKeySet, Data, DataSet > atPTData
PTData for VersionedKeys (address-taken objects, generally).
virtual bool unionPts(const VersionedKey &dstVar, const Key &srcVar) override
virtual bool unionPts(const VersionedKey &dstVar, const VersionedKey &srcVar) override
virtual const DataSet & getPts(const VersionedKey &vk) override
static bool classof(const PTData< Key, KeySet, Data, DataSet > *ptd)
static bool classof(const MutableVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet > *)
virtual void remapAllPts(void) override
Remaps all points-to sets to use the current mapping.
virtual Map< DataSet, unsigned > getAllPts(bool liveOnly) const override
virtual void dumpPTData() override
Dump stored keys and points-to sets.
virtual const VersionedKeySet & getVersionedKeyRevPts(const Data &datum) override
virtual bool unionPts(const Key &dstVar, const VersionedKey &srcVar) override
virtual void clearFullPts(const Key &k) override
Fully clears the points-to set of var.
VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet > BaseVersionedPTData
virtual bool unionPts(const Key &dstVar, const DataSet &srcDataSet) override
Performs pts(dstVar) = pts(dstVar) U srcDataSet.
virtual bool unionPts(const VersionedKey &dstVar, const DataSet &srcDataSet) override
virtual void clearFullPts(const VersionedKey &vk) override
virtual void clearPts(const Key &k, const Data &element) override
Clears element from the points-to set of var.
virtual void clear() override
Clears all points-to sets as if nothing is stored.
virtual const KeySet & getRevPts(const Data &datum) override
Get reverse points-to set of a datum.
MutableVersionedPTData(bool reversePT=true, PTDataTy ty=PTDataTy::MutVersioned)
virtual ~MutableVersionedPTData()
virtual bool unionPts(const Key &dstVar, const Key &srcVar) override
Performs pts(dstVar) = pts(dstVar) U pts(srcVar).
virtual bool addPts(const VersionedKey &vk, const Data &element) override
BasePTData::PTDataTy PTDataTy
bool rev
Whether we maintain reverse points-to sets or not.
PTDataTy
Types of a points-to data structures.
std::ostream & outs()
Overwrite llvm::outs()
void dumpSet(NodeBS To, OutStream &O=SVFUtil::outs())
Dump sparse bitvector set.
void removeKey(const Key &key, KeySet &keySet)
Removes an element from a Set/CondSet (or anything implementing ::erase).
void insertKey(const Key &key, KeySet &keySet)
Inserts an element into a Set/CondSet (with ::insert).
llvm::IRBuilder IRBuilder