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

PTData implemented using points-to sets which are created once and updated continuously. More...

#include <MutablePointsToDS.h>

Inheritance diagram for SVF::MutablePTData< 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, DataSet > PtsMap
 
typedef Map< Data, KeySetRevPtsMap
 
typedef PtsMap::iterator PtsMapIter
 
typedef PtsMap::const_iterator PtsMapConstIter
 
typedef DataSet::iterator iterator
 
- 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

 MutablePTData (bool reversePT=true, PTDataTy ty=PTDataTy::MutBase)
 Constructor.
 
virtual ~MutablePTData ()
 
virtual const PtsMapgetPtsMap () const
 Return Points-to map.
 
virtual void clear () override
 Clears all points-to sets as if nothing is stored.
 
virtual const DataSet & getPts (const Key &var) override
 Get points-to set of var.
 
virtual const KeySetgetRevPts (const Data &datum) override
 Get reverse points-to set of a datum.
 
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 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 clearPts (const Key &var, const Data &element) override
 Clears element from the points-to set of var.
 
virtual void clearFullPts (const Key &var) override
 Fully clears the points-to set of var.
 
virtual void remapAllPts (void) override
 Remaps all points-to sets to use the current mapping.
 
virtual 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 MutablePTData< Key, KeySet, Data, DataSet > *)
 
static bool classof (const PTData< Key, KeySet, Data, DataSet > *ptd)
 

Protected Member Functions

virtual void dumpPts (const PtsMap &ptsSet, OutStream &O=SVFUtil::outs()) const
 

Protected Attributes

PtsMap 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 unionPts (DataSet &dstDataSet, const DataSet &srcDataSet)
 
bool addPts (DataSet &d, const Data &e)
 
void addSingleRevPts (KeySet &revData, const Key &tgr)
 
void addRevPts (const DataSet &ptsData, const Key &tgr)
 
void clearSingleRevPts (KeySet &revSet, const Key &k)
 
void clearRevPts (const DataSet &pts, const Key &k)
 

Friends

class MutableDFPTData< Key, KeySet, Data, DataSet >
 

Detailed Description

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

PTData implemented using points-to sets which are created once and updated continuously.

Definition at line 53 of file MutablePointsToDS.h.

Member Typedef Documentation

◆ BasePTData

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

Definition at line 57 of file MutablePointsToDS.h.

◆ iterator

template<typename Key , typename KeySet , typename Data , typename DataSet >
typedef DataSet::iterator SVF::MutablePTData< Key, KeySet, Data, DataSet >::iterator

Definition at line 64 of file MutablePointsToDS.h.

◆ PTDataTy

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

Definition at line 58 of file MutablePointsToDS.h.

◆ PtsMap

template<typename Key , typename KeySet , typename Data , typename DataSet >
typedef Map<Key, DataSet> SVF::MutablePTData< Key, KeySet, Data, DataSet >::PtsMap

Definition at line 60 of file MutablePointsToDS.h.

◆ PtsMapConstIter

template<typename Key , typename KeySet , typename Data , typename DataSet >
typedef PtsMap::const_iterator SVF::MutablePTData< Key, KeySet, Data, DataSet >::PtsMapConstIter

Definition at line 63 of file MutablePointsToDS.h.

◆ PtsMapIter

template<typename Key , typename KeySet , typename Data , typename DataSet >
typedef PtsMap::iterator SVF::MutablePTData< Key, KeySet, Data, DataSet >::PtsMapIter

Definition at line 62 of file MutablePointsToDS.h.

◆ RevPtsMap

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

Definition at line 61 of file MutablePointsToDS.h.

Constructor & Destructor Documentation

◆ MutablePTData()

template<typename Key , typename KeySet , typename Data , typename DataSet >
SVF::MutablePTData< Key, KeySet, Data, DataSet >::MutablePTData ( bool  reversePT = true,
PTDataTy  ty = PTDataTy::MutBase 
)
inline

Constructor.

Definition at line 67 of file MutablePointsToDS.h.

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

◆ ~MutablePTData()

template<typename Key , typename KeySet , typename Data , typename DataSet >
virtual SVF::MutablePTData< Key, KeySet, Data, DataSet >::~MutablePTData ( )
inlinevirtual

Definition at line 69 of file MutablePointsToDS.h.

69{ }

Member Function Documentation

◆ addPts() [1/2]

template<typename Key , typename KeySet , typename Data , typename DataSet >
virtual bool SVF::MutablePTData< 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 94 of file MutablePointsToDS.h.

95 {
97 return addPts(ptsMap[dstKey], element);
98 }
void addSingleRevPts(KeySet &revData, const Key &tgr)
virtual bool addPts(const Key &dstKey, const Data &element) override
Adds element to the points-to set associated with var.

◆ addPts() [2/2]

template<typename Key , typename KeySet , typename Data , typename DataSet >
bool SVF::MutablePTData< Key, KeySet, Data, DataSet >::addPts ( DataSet &  d,
const Data e 
)
inlineprivate

Definition at line 185 of file MutablePointsToDS.h.

186 {
187 return d.test_and_set(e);
188 }

◆ addRevPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::MutablePTData< Key, KeySet, Data, DataSet >::addRevPts ( const DataSet &  ptsData,
const Key tgr 
)
inlineprivate

Definition at line 196 of file MutablePointsToDS.h.

197 {
198 if (this->rev)
199 {
200 for(iterator it = ptsData.begin(), eit = ptsData.end(); it!=eit; ++it)
202 }
203 }
DataSet::iterator iterator
bool rev
Whether we maintain reverse points-to sets or not.

◆ addSingleRevPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
void SVF::MutablePTData< Key, KeySet, Data, DataSet >::addSingleRevPts ( KeySet revData,
const Key tgr 
)
inlineprivate

Definition at line 189 of file MutablePointsToDS.h.

190 {
191 if (this->rev)
192 {
194 }
195 }
void insertKey(const Key &key, KeySet &keySet)
Inserts an element into a Set/CondSet (with ::insert).
Definition SVFUtil.h:239

◆ classof() [1/2]

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

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

Definition at line 149 of file MutablePointsToDS.h.

150 {
151 return true;
152 }

◆ classof() [2/2]

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

Definition at line 154 of file MutablePointsToDS.h.

155 {
156 return ptd->getPTDTY() == PTDataTy::MutBase;
157 }

◆ clear()

template<typename Key , typename KeySet , typename Data , typename DataSet >
virtual void SVF::MutablePTData< 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 77 of file MutablePointsToDS.h.

78 {
79 ptsMap.clear();
80 revPtsMap.clear();
81 }

◆ clearFullPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
virtual void SVF::MutablePTData< 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 123 of file MutablePointsToDS.h.

124 {
125 DataSet &pts = ptsMap[var];
127 pts.clear();
128 }
void clearRevPts(const DataSet &pts, const Key &k)

◆ clearPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
virtual void SVF::MutablePTData< 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 117 of file MutablePointsToDS.h.

118 {
120 ptsMap[var].reset(element);
121 }
void clearSingleRevPts(KeySet &revSet, const Key &k)

◆ clearRevPts()

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

Definition at line 211 of file MutablePointsToDS.h.

212 {
213 if (this->rev)
214 {
215 for (const Data &d : pts) clearSingleRevPts(revPtsMap[d], k);
216 }
217 }

◆ clearSingleRevPts()

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

Definition at line 204 of file MutablePointsToDS.h.

205 {
206 if (this->rev)
207 {
209 }
210 }
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 >
virtual void SVF::MutablePTData< Key, KeySet, Data, DataSet >::dumpPTData ( )
inlineoverridevirtual

Dump stored keys and points-to sets.

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

Definition at line 112 of file MutablePointsToDS.h.

113 {
115 }
virtual void dumpPts(const PtsMap &ptsSet, OutStream &O=SVFUtil::outs()) const

◆ dumpPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
virtual void SVF::MutablePTData< Key, KeySet, Data, DataSet >::dumpPts ( const PtsMap ptsSet,
OutStream O = SVFUtil::outs() 
) const
inlineprotectedvirtual

Definition at line 161 of file MutablePointsToDS.h.

162 {
163 for (PtsMapConstIter nodeIt = ptsSet.begin(); nodeIt != ptsSet.end(); nodeIt++)
164 {
165 const Key& var = nodeIt->first;
166 const DataSet & pts = nodeIt->second;
167 if (pts.empty())
168 continue;
169 O << var << " ==> { ";
170 for(typename DataSet::iterator cit = pts.begin(), ecit=pts.end(); cit!=ecit; ++cit)
171 {
172 O << *cit << " ";
173 }
174 O << "}\n";
175 }
176 }
PtsMap::const_iterator PtsMapConstIter

◆ getAllPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
virtual Map< DataSet, unsigned > SVF::MutablePTData< 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 135 of file MutablePointsToDS.h.

136 {
138 for (typename PtsMap::value_type ppt : ptsMap)
139 {
140 const DataSet &pt = ppt.second;
141 ++allPts[pt];
142 }
143
144 return allPts;
145 }

◆ getPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
virtual const DataSet & SVF::MutablePTData< 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 83 of file MutablePointsToDS.h.

84 {
85 return ptsMap[var];
86 }

◆ getPtsMap()

template<typename Key , typename KeySet , typename Data , typename DataSet >
virtual const PtsMap & SVF::MutablePTData< Key, KeySet, Data, DataSet >::getPtsMap ( ) const
inlinevirtual

Return Points-to map.

Definition at line 72 of file MutablePointsToDS.h.

73 {
74 return ptsMap;
75 }

◆ getRevPts()

template<typename Key , typename KeySet , typename Data , typename DataSet >
virtual const KeySet & SVF::MutablePTData< 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 88 of file MutablePointsToDS.h.

89 {
90 assert(this->rev && "MutablePTData::getRevPts: constructed without reverse PT support!");
91 return revPtsMap[datum];
92 }

◆ remapAllPts()

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

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

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

Definition at line 130 of file MutablePointsToDS.h.

131 {
132 for (typename PtsMap::value_type &ppt : ptsMap) ppt.second.checkAndRemap();
133 }

◆ unionPts() [1/3]

template<typename Key , typename KeySet , typename Data , typename DataSet >
virtual bool SVF::MutablePTData< 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 106 of file MutablePointsToDS.h.

107 {
110 }
virtual bool unionPts(const Key &dstKey, const Key &srcKey) override
Performs pts(dstVar) = pts(dstVar) U pts(srcVar).
void addRevPts(const DataSet &ptsData, const Key &tgr)

◆ unionPts() [2/3]

template<typename Key , typename KeySet , typename Data , typename DataSet >
virtual bool SVF::MutablePTData< 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 100 of file MutablePointsToDS.h.

101 {
104 }
virtual const DataSet & getPts(const Key &var) override
Get points-to set of var.

◆ unionPts() [3/3]

template<typename Key , typename KeySet , typename Data , typename DataSet >
bool SVF::MutablePTData< Key, KeySet, Data, DataSet >::unionPts ( DataSet &  dstDataSet,
const DataSet &  srcDataSet 
)
inlineprivate

Internal union/add points-to helper methods.

Definition at line 181 of file MutablePointsToDS.h.

182 {
183 return dstDataSet |= srcDataSet;
184 }

Friends And Related Symbol Documentation

◆ MutableDFPTData< Key, KeySet, Data, DataSet >

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

Definition at line 1 of file MutablePointsToDS.h.

Member Data Documentation

◆ ptsMap

template<typename Key , typename KeySet , typename Data , typename DataSet >
PtsMap SVF::MutablePTData< Key, KeySet, Data, DataSet >::ptsMap
protected

Definition at line 221 of file MutablePointsToDS.h.

◆ revPtsMap

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

Definition at line 222 of file MutablePointsToDS.h.


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