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

PTData backed by a PersistentPointsToCache. More...

#include <PersistentPointsToDS.h>

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

Public Types

typedef PTData< Key, KeySet, Data, DataSet > BasePTData
 
typedef BasePTData::PTDataTy PTDataTy
 
typedef Map< Key, PointsToIDKeyToIDMap
 
typedef Map< Data, KeySetRevPtsMap
 
- 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

 PersistentPTData (PersistentPointsToCache< DataSet > &cache, bool reversePT=true, PTDataTy ty=PTDataTy::PersBase)
 Constructor.
 
 ~PersistentPTData () 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 &srcData) override
 Performs pts(dstVar) = pts(dstVar) U srcDataSet.
 
void dumpPTData () override
 Dump stored keys and points-to sets.
 
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.
 
Map< DataSet, unsignedgetAllPts (bool liveOnly) const override
 
- 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 PersistentPTData< Key, KeySet, Data, DataSet > *)
 
static bool classof (const PTData< Key, KeySet, Data, DataSet > *ptd)
 

Protected Attributes

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

Private Member Functions

bool unionPtsFromId (const Key &dstKey, PointsToID srcId)
 
void clearSingleRevPts (KeySet &revSet, const Key &k)
 
void clearRevPts (const DataSet &pts, const Key &k)
 

Friends

template<typename K , typename KS , typename D , typename DS , typename VK , typename VKS >
class PersistentVersionedPTData
 
class PersistentDFPTData< Key, KeySet, Data, DataSet >
 
class PersistentIncDFPTData< Key, KeySet, Data, DataSet >
 

Detailed Description

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

PTData backed by a PersistentPointsToCache.

Definition at line 34 of file PersistentPointsToDS.h.

Member Typedef Documentation

◆ BasePTData

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

Definition at line 41 of file PersistentPointsToDS.h.

◆ KeyToIDMap

template<typename Key , typename KeySet , typename Data , typename DataSet >
typedef Map<Key, PointsToID> SVF::PersistentPTData< Key, KeySet, Data, DataSet >::KeyToIDMap

Definition at line 44 of file PersistentPointsToDS.h.

◆ PTDataTy

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

Definition at line 42 of file PersistentPointsToDS.h.

◆ RevPtsMap

template<typename Key , typename KeySet , typename Data , typename DataSet >
typedef Map<Data, KeySet> SVF::PersistentPTData< Key, KeySet, Data, DataSet >::RevPtsMap

Definition at line 45 of file PersistentPointsToDS.h.

Constructor & Destructor Documentation

◆ PersistentPTData()

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

Constructor.

Definition at line 48 of file PersistentPointsToDS.h.

PersistentPointsToCache< DataSet > & ptCache
PTData< Key, KeySet, Data, DataSet > BasePTData
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ ~PersistentPTData()

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

Member Function Documentation

◆ addPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
bool SVF::PersistentPTData< 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 71 of file PersistentPointsToDS.h.

72 {
73 DataSet srcPts;
74 srcPts.set(element);
77 }
bool unionPtsFromId(const Key &dstKey, PointsToID srcId)
PointsToID emplacePts(const Data &pts)
unsigned PointsToID
Definition GeneralType.h:63

◆ classof() [1/2]

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

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

Definition at line 140 of file PersistentPointsToDS.h.

141 {
142 return true;
143 }

◆ classof() [2/2]

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

Definition at line 145 of file PersistentPointsToDS.h.

146 {
147 return ptd->getPTDTY() == PTDataTy::PersBase;
148 }

◆ clear()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::PersistentPTData< 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 53 of file PersistentPointsToDS.h.

54 {
55 ptsMap.clear();
56 revPtsMap.clear();
57 }

◆ clearFullPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::PersistentPTData< 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 109 of file PersistentPointsToDS.h.

110 {
113 }
const DataSet & getPts(const Key &var) override
Get points-to set of var.
void clearRevPts(const DataSet &pts, const Key &k)
static PointsToID emptyPointsToId(void)

◆ clearPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::PersistentPTData< 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 95 of file PersistentPointsToDS.h.

96 {
97 DataSet toRemoveData;
102 if (varId != complementId)
103 {
106 }
107 }
void clearSingleRevPts(KeySet &revSet, const Key &k)
PointsToID complementPts(PointsToID lhs, PointsToID rhs)
Relatively complements lhs and rhs (lhs \ rhs) and returns it's ID.

◆ clearRevPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::PersistentPTData< Key, KeySet, Data, DataSet >::clearRevPts ( const DataSet &  pts,
const Key k 
)
inlineprivate

Definition at line 184 of file PersistentPointsToDS.h.

185 {
186 if (this->rev)
187 {
188 for (const Data &d : pts) clearSingleRevPts(revPtsMap[d], k);
189 }
190 }
bool rev
Whether we maintain reverse points-to sets or not.

◆ clearSingleRevPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::PersistentPTData< Key, KeySet, Data, DataSet >::clearSingleRevPts ( KeySet revSet,
const Key k 
)
inlineprivate

Definition at line 176 of file PersistentPointsToDS.h.

177 {
178 if (this->rev)
179 {
181 }
182 }
void removeKey(const Key &key, KeySet &keySet)
Removes an element from a Set/CondSet (or anything implementing ::erase).
Definition SVFUtil.h:252

◆ dumpPTData()

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

Dump stored keys and points-to sets.

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

Definition at line 91 of file PersistentPointsToDS.h.

92 {
93 }

◆ getAllPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
Map< DataSet, unsigned > SVF::PersistentPTData< 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 120 of file PersistentPointsToDS.h.

121 {
123 if (liveOnly)
124 {
125 for (const typename KeyToIDMap::value_type &ki : ptsMap)
126 {
127 ++allPts[ptCache.getActualPts(ki.second)];
128 }
129 }
130 else
131 {
133 }
134
135 return allPts;
136 }
Map< Data, unsigned > getAllPts(void)
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::PersistentPTData< 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 59 of file PersistentPointsToDS.h.

60 {
61 PointsToID id = ptsMap[var];
62 return ptCache.getActualPts(id);
63 }

◆ getRevPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
const KeySet & SVF::PersistentPTData< 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 65 of file PersistentPointsToDS.h.

66 {
67 assert(this->rev && "PersistentPTData::getRevPts: constructed without reverse PT support!");
68 return revPtsMap[data];
69 }

◆ remapAllPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::PersistentPTData< 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 115 of file PersistentPointsToDS.h.

116 {
118 }
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::PersistentPTData< 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 85 of file PersistentPointsToDS.h.

◆ unionPts() [2/2]

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

◆ unionPtsFromId()

template<typename Key , typename KeySet , typename Data , typename DataSet >
bool SVF::PersistentPTData< Key, KeySet, Data, DataSet >::unionPtsFromId ( const Key dstKey,
PointsToID  srcId 
)
inlineprivate

Internal unionPts since other methods follow the same pattern. Renamed because PointsToID and Key may be the same type...

Definition at line 154 of file PersistentPointsToDS.h.

155 {
158
159 bool changed = newDstId != dstId;
160 if (changed)
161 {
163
164 // Reverse points-to only needs to be handled when dst's
165 // points-to set has changed (i.e., do it the first time only).
166 if (this->rev)
167 {
168 const DataSet &srcPts = ptCache.getActualPts(srcId);
169 for (const Data &d : srcPts) SVFUtil::insertKey(dstKey, revPtsMap[d]);
170 }
171 }
172
173 return changed;
174 }
PointsToID unionPts(PointsToID lhs, PointsToID rhs)
Unions lhs and rhs and returns their union's ID.
void insertKey(const Key &key, KeySet &keySet)
Inserts an element into a Set/CondSet (with ::insert).
Definition SVFUtil.h:239

Friends And Related Symbol Documentation

◆ PersistentDFPTData< Key, KeySet, Data, DataSet >

template<typename Key , typename KeySet , typename Data , typename DataSet >
friend class PersistentDFPTData< Key, KeySet, Data, DataSet >
friend

Definition at line 37 of file PersistentPointsToDS.h.

◆ PersistentIncDFPTData< Key, KeySet, Data, DataSet >

template<typename Key , typename KeySet , typename Data , typename DataSet >
friend class PersistentIncDFPTData< Key, KeySet, Data, DataSet >
friend

Definition at line 37 of file PersistentPointsToDS.h.

◆ PersistentVersionedPTData

Definition at line 37 of file PersistentPointsToDS.h.

Member Data Documentation

◆ ptCache

template<typename Key , typename KeySet , typename Data , typename DataSet >
PersistentPointsToCache<DataSet>& SVF::PersistentPTData< Key, KeySet, Data, DataSet >::ptCache
protected

Definition at line 193 of file PersistentPointsToDS.h.

◆ ptsMap

template<typename Key , typename KeySet , typename Data , typename DataSet >
KeyToIDMap SVF::PersistentPTData< Key, KeySet, Data, DataSet >::ptsMap
protected

Definition at line 194 of file PersistentPointsToDS.h.

◆ revPtsMap

template<typename Key , typename KeySet , typename Data , typename DataSet >
RevPtsMap SVF::PersistentPTData< Key, KeySet, Data, DataSet >::revPtsMap
protected

Definition at line 195 of file PersistentPointsToDS.h.


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