Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet > Class Template Reference

DiffPTData implemented with a persistent points-to backing. More...

#include <PersistentPointsToDS.h>

Inheritance diagram for SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >:
SVF::DiffPTData< Key, KeySet, Data, DataSet > SVF::PTData< Key, KeySet, Data, DataSet >

Public Types

typedef PTData< Key, KeySet, Data, DataSet > BasePTData
 
typedef DiffPTData< Key, KeySet, Data, DataSet > BaseDiffPTData
 
typedef PersistentPTData< Key, KeySet, Data, DataSet > BasePersPTData
 
typedef BasePTData::PTDataTy PTDataTy
 
typedef BasePersPTData::KeyToIDMap KeyToIDMap
 
typedef BasePersPTData::RevPtsMap RevPtsMap
 
- Public Types inherited from SVF::DiffPTData< Key, KeySet, Data, DataSet >
typedef PTData< Key, KeySet, Data, DataSet > BasePTData
 
typedef BasePTData::PTDataTy PTDataTy
 
- Public Types inherited from SVF::PTData< Key, KeySet, Data, DataSet >
enum  PTDataTy {
  Base , MutBase , Diff , MutDiff ,
  DataFlow , MutDataFlow , MutIncDataFlow , Versioned ,
  MutVersioned , PersBase , PersDiff , PersDataFlow ,
  PersIncDataFlow , PersVersioned
}
 Types of a points-to data structures. More...
 

Public Member Functions

 PersistentDiffPTData (PersistentPointsToCache< DataSet > &cache, bool reversePT=true, PTDataTy ty=PTDataTy::PersDiff)
 Constructor.
 
 ~PersistentDiffPTData () override=default
 
void clear () override
 Clears all points-to sets as if nothing is stored.
 
const DataSet & getPts (const Key &var) override
 Get points-to set of var.
 
const KeySetgetRevPts (const Data &data) override
 Get reverse points-to set of a datum.
 
bool addPts (const Key &dstKey, const Data &element) override
 Adds element to the points-to set associated with var.
 
bool unionPts (const Key &dstKey, const Key &srcKey) override
 Performs pts(dstVar) = pts(dstVar) U pts(srcVar).
 
bool unionPts (const Key &dstKey, const DataSet &srcDataSet) override
 Performs pts(dstVar) = pts(dstVar) U srcDataSet.
 
void clearPts (const Key &var, const Data &element) override
 Clears element from the points-to set of var.
 
void clearFullPts (const Key &var) override
 Fully clears the points-to set of var.
 
void remapAllPts () override
 Remaps all points-to sets to use the current mapping.
 
void dumpPTData () override
 Dump stored keys and points-to sets.
 
const DataSet & getDiffPts (Key &var) override
 Get diff points to.
 
bool computeDiffPts (Key &var, const DataSet &all) override
 
void updatePropaPtsMap (Key &src, Key &dst) override
 
void clearPropaPts (Key &var) override
 Clear propagated points-to set of var.
 
Map< DataSet, unsignedgetAllPts (bool liveOnly) const override
 
- Public Member Functions inherited from SVF::DiffPTData< Key, KeySet, Data, DataSet >
 DiffPTData (bool reversePT=true, PTDataTy ty=PTDataTy::Diff)
 
virtual ~DiffPTData ()
 
- Public Member Functions inherited from SVF::PTData< Key, KeySet, Data, DataSet >
 PTData (bool reversePT=true, PTDataTy ty=PTDataTy::Base)
 
virtual ~PTData ()
 
PTDataTy getPTDTY () const
 Get the type of points-to data structure that this is.
 

Static Public Member Functions

static bool classof (const PersistentDiffPTData< Key, KeySet, Data, DataSet > *)
 
static bool classof (const PTData< Key, KeySet, Data, DataSet > *ptd)
 
- Static Public Member Functions inherited from SVF::DiffPTData< Key, KeySet, Data, DataSet >
static bool classof (const DiffPTData< Key, KeySet, Data, DataSet > *)
 
static bool classof (const PTData< Key, KeySet, Data, DataSet > *ptd)
 

Private Attributes

PersistentPointsToCache< DataSet > & ptCache
 
PersistentPTData< Key, KeySet, Data, DataSet > persPTData
 Backing to implement basic PTData methods. Allows us to avoid multiple inheritance.
 
KeyToIDMap diffPtsMap
 Diff points-to to be propagated.
 
KeyToIDMap propaPtsMap
 Points-to already propagated.
 

Additional Inherited Members

- Protected Attributes inherited from SVF::PTData< Key, KeySet, Data, DataSet >
bool rev
 Whether we maintain reverse points-to sets or not.
 
PTDataTy ptdTy
 

Detailed Description

template<typename Key, typename KeySet, typename Data, typename DataSet>
class SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >

DiffPTData implemented with a persistent points-to backing.

Definition at line 200 of file PersistentPointsToDS.h.

Member Typedef Documentation

◆ BaseDiffPTData

template<typename Key , typename KeySet , typename Data , typename DataSet >
typedef DiffPTData<Key, KeySet, Data, DataSet> SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::BaseDiffPTData

Definition at line 204 of file PersistentPointsToDS.h.

◆ BasePersPTData

template<typename Key , typename KeySet , typename Data , typename DataSet >
typedef PersistentPTData<Key, KeySet, Data, DataSet> SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::BasePersPTData

Definition at line 205 of file PersistentPointsToDS.h.

◆ BasePTData

template<typename Key , typename KeySet , typename Data , typename DataSet >
typedef PTData<Key, KeySet, Data, DataSet> SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::BasePTData

Definition at line 203 of file PersistentPointsToDS.h.

◆ KeyToIDMap

Definition at line 208 of file PersistentPointsToDS.h.

◆ PTDataTy

template<typename Key , typename KeySet , typename Data , typename DataSet >
typedef BasePTData::PTDataTy SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::PTDataTy

Definition at line 206 of file PersistentPointsToDS.h.

◆ RevPtsMap

Definition at line 209 of file PersistentPointsToDS.h.

Constructor & Destructor Documentation

◆ PersistentDiffPTData()

template<typename Key , typename KeySet , typename Data , typename DataSet >
SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::PersistentDiffPTData ( PersistentPointsToCache< DataSet > &  cache,
bool  reversePT = true,
PTDataTy  ty = PTDataTy::PersDiff 
)
inlineexplicit

Constructor.

Definition at line 212 of file PersistentPointsToDS.h.

PersistentPTData< Key, KeySet, Data, DataSet > persPTData
Backing to implement basic PTData methods. Allows us to avoid multiple inheritance.
DiffPTData< Key, KeySet, Data, DataSet > BaseDiffPTData
PersistentPointsToCache< DataSet > & ptCache
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ ~PersistentDiffPTData()

template<typename Key , typename KeySet , typename Data , typename DataSet >
SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::~PersistentDiffPTData ( )
overridedefault

Member Function Documentation

◆ addPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
bool SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::addPts ( const Key var,
const Data element 
)
inlineoverridevirtual

Adds element to the points-to set associated with var.

Implements SVF::PTData< Key, KeySet, Data, DataSet >.

Definition at line 235 of file PersistentPointsToDS.h.

236 {
237 return persPTData.addPts(dstKey, element);
238 }

◆ classof() [1/2]

template<typename Key , typename KeySet , typename Data , typename DataSet >
static bool SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::classof ( const PersistentDiffPTData< Key, KeySet, Data, DataSet > *  )
inlinestatic

Methods to support type inquiry through isa, cast, and dyn_cast:

Definition at line 311 of file PersistentPointsToDS.h.

312 {
313 return true;
314 }

◆ classof() [2/2]

template<typename Key , typename KeySet , typename Data , typename DataSet >
static bool SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::classof ( const PTData< Key, KeySet, Data, DataSet > *  ptd)
inlinestatic

Definition at line 316 of file PersistentPointsToDS.h.

317 {
318 return ptd->getPTDTY() == PTDataTy::PersDiff;
319 }

◆ clear()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::clear ( )
inlineoverridevirtual

Clears all points-to sets as if nothing is stored.

Implements SVF::PTData< Key, KeySet, Data, DataSet >.

Definition at line 217 of file PersistentPointsToDS.h.

218 {
219 persPTData.clear();
220 diffPtsMap.clear();
221 propaPtsMap.clear();
222 }
KeyToIDMap propaPtsMap
Points-to already propagated.
KeyToIDMap diffPtsMap
Diff points-to to be propagated.

◆ clearFullPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::clearFullPts ( const Key var)
inlineoverridevirtual

Fully clears the points-to set of var.

Implements SVF::PTData< Key, KeySet, Data, DataSet >.

Definition at line 255 of file PersistentPointsToDS.h.

256 {
257 return persPTData.clearFullPts(var);
258 }

◆ clearPropaPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::clearPropaPts ( Key var)
inlineoverridevirtual

Clear propagated points-to set of var.

Implements SVF::DiffPTData< Key, KeySet, Data, DataSet >.

Definition at line 299 of file PersistentPointsToDS.h.

300 {
302 }
static PointsToID emptyPointsToId(void)

◆ clearPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::clearPts ( const Key var,
const Data element 
)
inlineoverridevirtual

Clears element from the points-to set of var.

Implements SVF::PTData< Key, KeySet, Data, DataSet >.

Definition at line 250 of file PersistentPointsToDS.h.

251 {
252 return persPTData.clearPts(var, element);
253 }

◆ computeDiffPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
bool SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::computeDiffPts ( Key var,
const DataSet &  all 
)
inlineoverridevirtual

Compute diff points to. Return TRUE if diff is not empty.

  1. calculate diff: diff = all - propa.
  2. update propagated pts: propa = all.

Implements SVF::DiffPTData< Key, KeySet, Data, DataSet >.

Definition at line 276 of file PersistentPointsToDS.h.

277 {
280 // Diff is made up of the entire points-to set minus what has been propagated.
283
284 // We've now propagated the entire thing.
286
287 // Whether diff is empty or not; just need to check against the ID since it
288 // is the only empty set.
289 return diffId != ptCache.emptyPointsToId();
290 }
PointsToID complementPts(PointsToID lhs, PointsToID rhs)
Relatively complements lhs and rhs (lhs \ rhs) and returns it's ID.
PointsToID emplacePts(const Data &pts)
unsigned PointsToID
Definition GeneralType.h:63

◆ dumpPTData()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::dumpPTData ( )
inlineoverridevirtual

Dump stored keys and points-to sets.

Implements SVF::PTData< Key, KeySet, Data, DataSet >.

Definition at line 265 of file PersistentPointsToDS.h.

266 {
267 // TODO.
268 }

◆ getAllPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
Map< DataSet, unsigned > SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::getAllPts ( bool  liveOnly) const
inlineoverridevirtual

Returns a mapping of points-to sets to the number of times they are stored. liveOnly indicates whether to include only points-to sets which correspond to a variable (matters when dealing with non-GC persistent PT).

Implements SVF::PTData< Key, KeySet, Data, DataSet >.

Definition at line 304 of file PersistentPointsToDS.h.

305 {
306 return persPTData.getAllPts(liveOnly);
307 }

◆ getDiffPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
const DataSet & SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::getDiffPts ( Key var)
inlineoverridevirtual

Get diff points to.

Implements SVF::DiffPTData< Key, KeySet, Data, DataSet >.

Definition at line 270 of file PersistentPointsToDS.h.

271 {
273 return ptCache.getActualPts(id);
274 }
const Data & getActualPts(PointsToID id) const
Returns the points-to set which id represents. id must be stored in the cache.

◆ getPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
const DataSet & SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::getPts ( const Key var)
inlineoverridevirtual

Get points-to set of var.

Implements SVF::PTData< Key, KeySet, Data, DataSet >.

Definition at line 224 of file PersistentPointsToDS.h.

225 {
226 return persPTData.getPts(var);
227 }

◆ getRevPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
const KeySet & SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::getRevPts ( const Data datum)
inlineoverridevirtual

Get reverse points-to set of a datum.

Implements SVF::PTData< Key, KeySet, Data, DataSet >.

Definition at line 229 of file PersistentPointsToDS.h.

230 {
231 assert(this->rev && "PersistentDiffPTData::getRevPts: constructed without reverse PT support!");
232 return persPTData.getRevPts(data);
233 }
bool rev
Whether we maintain reverse points-to sets or not.

◆ remapAllPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::remapAllPts ( )
inlineoverridevirtual

Remaps all points-to sets to use the current mapping.

Implements SVF::PTData< Key, KeySet, Data, DataSet >.

Definition at line 260 of file PersistentPointsToDS.h.

261 {
263 }
void remapAllPts(void)
Remaps all points-to sets stored in the cache to the current mapping.

◆ unionPts() [1/2]

template<typename Key , typename KeySet , typename Data , typename DataSet >
bool SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::unionPts ( const Key dstVar,
const DataSet &  srcDataSet 
)
inlineoverridevirtual

Performs pts(dstVar) = pts(dstVar) U srcDataSet.

Implements SVF::PTData< Key, KeySet, Data, DataSet >.

Definition at line 245 of file PersistentPointsToDS.h.

246 {
247 return persPTData.unionPts(dstKey, srcDataSet);
248 }

◆ unionPts() [2/2]

template<typename Key , typename KeySet , typename Data , typename DataSet >
bool SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::unionPts ( const Key dstVar,
const Key srcVar 
)
inlineoverridevirtual

Performs pts(dstVar) = pts(dstVar) U pts(srcVar).

Implements SVF::PTData< Key, KeySet, Data, DataSet >.

Definition at line 240 of file PersistentPointsToDS.h.

241 {
242 return persPTData.unionPts(dstKey, srcKey);
243 }

◆ updatePropaPtsMap()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::updatePropaPtsMap ( Key src,
Key dst 
)
inlineoverridevirtual

Update dst's propagated points-to set with src's. The final result is the intersection of these two sets.

Implements SVF::DiffPTData< Key, KeySet, Data, DataSet >.

Definition at line 292 of file PersistentPointsToDS.h.

293 {
297 }
PointsToID intersectPts(PointsToID lhs, PointsToID rhs)
Intersects lhs and rhs (lhs AND rhs) and returns the intersection's ID.

Member Data Documentation

◆ diffPtsMap

template<typename Key , typename KeySet , typename Data , typename DataSet >
KeyToIDMap SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::diffPtsMap
private

Diff points-to to be propagated.

Definition at line 327 of file PersistentPointsToDS.h.

◆ persPTData

template<typename Key , typename KeySet , typename Data , typename DataSet >
PersistentPTData<Key, KeySet, Data, DataSet> SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::persPTData
private

Backing to implement basic PTData methods. Allows us to avoid multiple inheritance.

Definition at line 325 of file PersistentPointsToDS.h.

◆ propaPtsMap

template<typename Key , typename KeySet , typename Data , typename DataSet >
KeyToIDMap SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::propaPtsMap
private

Points-to already propagated.

Definition at line 329 of file PersistentPointsToDS.h.

◆ ptCache

template<typename Key , typename KeySet , typename Data , typename DataSet >
PersistentPointsToCache<DataSet>& SVF::PersistentDiffPTData< Key, KeySet, Data, DataSet >::ptCache
private

Definition at line 323 of file PersistentPointsToDS.h.


The documentation for this class was generated from the following file: