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

#include <PersistentPointsToDS.h>

Inheritance diagram for SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >:
SVF::VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet > SVF::PTData< Key, KeySet, Data, DataSet >

Public Types

typedef PTData< Key, KeySet, Data, DataSet > BasePTData
 
typedef VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySetBaseVersionedPTData
 
typedef BasePTData::PTDataTy PTDataTy
 
typedef PersistentPTData< Key, KeySet, Data, DataSet >::KeyToIDMap KeyToIDMap
 
typedef PersistentPTData< VersionedKey, VersionedKeySet, Data, DataSet >::KeyToIDMap VersionedKeyToIDMap
 
- Public Types inherited from SVF::VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >
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

 PersistentVersionedPTData (PersistentPointsToCache< DataSet > &cache, bool reversePT=true, PTDataTy ty=PTDataTy::PersVersioned)
 
 ~PersistentVersionedPTData () override=default
 
void clear () override
 Clears all points-to sets as if nothing is stored.
 
const DataSet & getPts (const Key &vk) override
 Get points-to set of var.
 
const DataSet & getPts (const VersionedKey &vk) override
 
const KeySetgetRevPts (const Data &data) override
 Get reverse points-to set of a datum.
 
const VersionedKeySetgetVersionedKeyRevPts (const Data &data) override
 
bool addPts (const Key &k, const Data &element) override
 Adds element to the points-to set associated with var.
 
bool addPts (const VersionedKey &vk, const Data &element) override
 
bool unionPts (const Key &dstVar, const Key &srcVar) override
 Performs pts(dstVar) = pts(dstVar) U pts(srcVar).
 
bool unionPts (const VersionedKey &dstVar, const VersionedKey &srcVar) override
 
bool unionPts (const VersionedKey &dstVar, const Key &srcVar) override
 
bool unionPts (const Key &dstVar, const VersionedKey &srcVar) override
 
bool unionPts (const Key &dstVar, const DataSet &srcDataSet) override
 Performs pts(dstVar) = pts(dstVar) U srcDataSet.
 
bool unionPts (const VersionedKey &dstVar, const DataSet &srcDataSet) override
 
void clearPts (const Key &k, const Data &element) override
 Clears element from the points-to set of var.
 
void clearPts (const VersionedKey &vk, const Data &element) override
 
void clearFullPts (const Key &k) override
 Fully clears the points-to set of var.
 
void clearFullPts (const VersionedKey &vk) override
 
void remapAllPts () override
 Remaps all points-to sets to use the current mapping.
 
Map< DataSet, unsignedgetAllPts (bool liveOnly) const override
 
void dumpPTData () override
 Dump stored keys and points-to sets.
 
- Public Member Functions inherited from SVF::VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >
 VersionedPTData (bool reversePT=true, PTDataTy ty=PTDataTy::Versioned)
 
virtual ~VersionedPTData ()
 
- 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 PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet > *)
 
static bool classof (const PTData< Key, KeySet, Data, DataSet > *ptd)
 
- Static Public Member Functions inherited from SVF::VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >
static bool classof (const VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet > *)
 
static bool classof (const PTData< Key, KeySet, Data, DataSet > *ptd)
 

Private Attributes

PersistentPTData< Key, KeySet, Data, DataSet > tlPTData
 PTData for Keys (top-level pointers, generally).
 
PersistentPTData< VersionedKey, VersionedKeySet, Data, DataSet > atPTData
 PTData for VersionedKeys (address-taken objects, generally).
 

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, typename VersionedKey, typename VersionedKeySet>
class SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >

VersionedPTData implemented with persistent points-to sets (Data). Implemented as a wrapper around two PersistentPTDatas: one for Keys, one for VersionedKeys. They are constructed with the same PersistentPointsToCache.

Definition at line 805 of file PersistentPointsToDS.h.

Member Typedef Documentation

◆ BasePTData

Definition at line 808 of file PersistentPointsToDS.h.

◆ BaseVersionedPTData

Definition at line 809 of file PersistentPointsToDS.h.

◆ KeyToIDMap

Definition at line 812 of file PersistentPointsToDS.h.

◆ PTDataTy

Definition at line 810 of file PersistentPointsToDS.h.

◆ VersionedKeyToIDMap

Definition at line 813 of file PersistentPointsToDS.h.

Constructor & Destructor Documentation

◆ PersistentVersionedPTData()

SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::PersistentVersionedPTData ( PersistentPointsToCache< DataSet > &  cache,
bool  reversePT = true,
PTDataTy  ty = PTDataTy::PersVersioned 
)
inlineexplicit

Definition at line 815 of file PersistentPointsToDS.h.

PersistentPTData< Key, KeySet, Data, DataSet > tlPTData
PTData for Keys (top-level pointers, generally).
PersistentPTData< VersionedKey, VersionedKeySet, Data, DataSet > atPTData
PTData for VersionedKeys (address-taken objects, generally).
VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet > BaseVersionedPTData
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ ~PersistentVersionedPTData()

Member Function Documentation

◆ addPts() [1/2]

bool SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::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 846 of file PersistentPointsToDS.h.

847 {
848 return tlPTData.addPts(k, element);
849 }

◆ addPts() [2/2]

Implements SVF::VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >.

Definition at line 850 of file PersistentPointsToDS.h.

851 {
852 return atPTData.addPts(vk, element);
853 }
bool addPts(const Key &dstKey, const Data &element) override
Adds element to the points-to set associated with var.

◆ classof() [1/2]

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

Definition at line 936 of file PersistentPointsToDS.h.

937 {
938 return true;
939 }

◆ classof() [2/2]

Definition at line 941 of file PersistentPointsToDS.h.

942 {
943 return ptd->getPTDTY() == PTDataTy::PersVersioned;
944 }

◆ clear()

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

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

Definition at line 820 of file PersistentPointsToDS.h.

821 {
822 tlPTData.clear();
823 atPTData.clear();
824 }
void clear() override
Clears all points-to sets as if nothing is stored.

◆ clearFullPts() [1/2]

void SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::clearFullPts ( const Key var)
inlineoverridevirtual

Fully clears the points-to set of var.

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

Definition at line 889 of file PersistentPointsToDS.h.

890 {
891 tlPTData.clearFullPts(k);
892 }

◆ clearFullPts() [2/2]

Implements SVF::VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >.

Definition at line 893 of file PersistentPointsToDS.h.

894 {
896 }
void clearFullPts(const Key &var) override
Fully clears the points-to set of var.

◆ clearPts() [1/2]

void SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::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 880 of file PersistentPointsToDS.h.

881 {
882 tlPTData.clearPts(k, element);
883 }

◆ clearPts() [2/2]

void SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::clearPts ( const VersionedKey vk,
const Data element 
)
inlineoverridevirtual

Implements SVF::VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >.

Definition at line 884 of file PersistentPointsToDS.h.

885 {
887 }
void clearPts(const Key &var, const Data &element) override
Clears element from the points-to set of var.

◆ dumpPTData()

void SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::dumpPTData ( )
inlineoverridevirtual

Dump stored keys and points-to sets.

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

Definition at line 926 of file PersistentPointsToDS.h.

927 {
928 SVFUtil::outs() << "== Top-level points-to information\n";
929 tlPTData.dumpPTData();
930 SVFUtil::outs() << "== Address-taken points-to information\n";
932 }
void dumpPTData() override
Dump stored keys and points-to sets.
std::ostream & outs()
Overwrite llvm::outs()
Definition SVFUtil.h:50

◆ getAllPts()

Map< DataSet, unsigned > SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::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 904 of file PersistentPointsToDS.h.

905 {
906 // Explicitly pass in true because if we call it with false,
907 // we will double up on the cache, since it is shared with atPTData.
908 // if liveOnly == false, we will handle it in the if below.
909 Map<DataSet, unsigned> allPts = tlPTData.getAllPts(true);
910 SVFUtil::mergePtsOccMaps<DataSet>(allPts, atPTData.getAllPts(true));
911
912 if (!liveOnly)
913 {
914 // Subtract 1 from each counted points-to set because the live points-to
915 // sets have already been inserted and accounted for how often they occur.
916 // They will each occur one more time in the cache.
917 // In essence, we want the ptCache.getAllPts() to just add the unused, non-GC'd
918 // points-to sets to allPts.
919 for (typename Map<DataSet, unsigned>::value_type &pto : allPts) pto.second -= 1;
920 SVFUtil::mergePtsOccMaps<DataSet>(allPts, tlPTData.ptCache.getAllPts());
921 }
922
923 return allPts;
924 }
Map< DataSet, unsigned > getAllPts(bool liveOnly) const override

◆ getPts() [1/2]

const DataSet & SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::getPts ( const Key var)
inlineoverridevirtual

Get points-to set of var.

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

Definition at line 826 of file PersistentPointsToDS.h.

827 {
828 return tlPTData.getPts(vk);
829 }

◆ getPts() [2/2]

Implements SVF::VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >.

Definition at line 830 of file PersistentPointsToDS.h.

831 {
832 return atPTData.getPts(vk);
833 }
const DataSet & getPts(const Key &var) override
Get points-to set of var.

◆ getRevPts()

Get reverse points-to set of a datum.

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

Definition at line 835 of file PersistentPointsToDS.h.

836 {
837 assert(this->rev && "PersistentVersionedPTData::getRevPts: constructed without reverse PT support!");
838 return tlPTData.getRevPts(data);
839 }
bool rev
Whether we maintain reverse points-to sets or not.

◆ getVersionedKeyRevPts()

const VersionedKeySet & SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::getVersionedKeyRevPts ( const Data data)
inlineoverridevirtual

Implements SVF::VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >.

Definition at line 840 of file PersistentPointsToDS.h.

841 {
842 assert(this->rev && "PersistentVersionedPTData::getVersionedKeyRevPts: constructed without reverse PT support!");
843 return atPTData.getRevPts(data);
844 }
const KeySet & getRevPts(const Data &data) override
Get reverse points-to set of a datum.

◆ remapAllPts()

void SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::remapAllPts ( )
inlineoverridevirtual

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

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

Definition at line 898 of file PersistentPointsToDS.h.

899 {
900 // tlPTData and atPTData use the same cache.
901 tlPTData.remapAllPts();
902 }

◆ unionPts() [1/6]

bool SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::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 871 of file PersistentPointsToDS.h.

872 {
873 return tlPTData.unionPts(dstVar, srcDataSet);
874 }

◆ unionPts() [2/6]

bool SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::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 855 of file PersistentPointsToDS.h.

856 {
857 return tlPTData.unionPts(dstVar, srcVar);
858 }

◆ unionPts() [3/6]

bool SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::unionPts ( const Key dstVar,
const VersionedKey srcVar 
)
inlineoverridevirtual

◆ unionPts() [4/6]

bool SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::unionPts ( const VersionedKey dstVar,
const DataSet &  srcDataSet 
)
inlineoverridevirtual

Implements SVF::VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >.

Definition at line 875 of file PersistentPointsToDS.h.

876 {
878 }
bool unionPts(const Key &dstKey, const Key &srcKey) override
Performs pts(dstVar) = pts(dstVar) U pts(srcVar).

◆ unionPts() [5/6]

bool SVF::PersistentVersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >::unionPts ( const VersionedKey dstVar,
const Key srcVar 
)
inlineoverridevirtual

Implements SVF::VersionedPTData< Key, KeySet, Data, DataSet, VersionedKey, VersionedKeySet >.

Definition at line 863 of file PersistentPointsToDS.h.

864 {
866 }
bool unionPtsFromId(const Key &dstKey, PointsToID srcId)

◆ unionPts() [6/6]

Member Data Documentation

◆ atPTData

PTData for VersionedKeys (address-taken objects, generally).

Definition at line 951 of file PersistentPointsToDS.h.

◆ tlPTData

PTData for Keys (top-level pointers, generally).

Definition at line 949 of file PersistentPointsToDS.h.


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