30#ifndef INCLUDE_MEMORYMODEL_POINTERANALYSISIMPL_H_
31#define INCLUDE_MEMORYMODEL_POINTERANALYSISIMPL_H_
90 return ptD->getPts(
id);
107 ptD->clearFullPts(
id);
119 return ptD->unionPts(
id,
ptd);
123 return ptD->addPts(
id,
ptd);
167 assert(
false &&
"Virtual function not implemented!");
174 assert(diff &&
"BVDataPTAImpl::getDiffPTDataTy: not a DiffPTDataTy!");
181 assert(
df &&
"BVDataPTAImpl::getDFPTDataTy: not a DFPTDataTy!");
188 assert(
mdf &&
"BVDataPTAImpl::getMutDFPTDataTy: not a MutDFPTDataTy!");
195 assert(
v &&
"BVDataPTAImpl::getVersionedPTDataTy: not a VersionedPTDataTy!");
212 std::unique_ptr<PTDataTy>
ptD;
262 assert(
false &&
"no points-to data available");
294 assert(
mut &&
"BVDataPTAImpl::getMutPTDataTy: not a MutPTDataTy!");
300 return SVFUtil::isa<MutPTDataTy>(
ptD);
305 if (
MutPTDataTy *
m = SVFUtil::dyn_cast<MutPTDataTy>(
ptD))
return m->getPtsMap();
306 assert(
false &&
"CondPTAImpl::getPtsMap: not a PTData with a PtsMap!");
314 return ptD->getPts(
id);
378 return ptD->unionPts(
id,
ptd);
383 return ptD->addPts(
id,
ptd);
445 for(
typename MutPTDataTy::PtsMap::const_iterator
it = ptsMap.begin(),
eit=ptsMap.end();
it!=
eit; ++
it)
457 assert(
false &&
"CondPTAImpl::NormalizePointsTo: could not normalize points-to sets");
487 assert(
normalized &&
"Pts of all context-var have to be merged/normalized. Want to use getPts(CVar cvar)??");
493 assert(
normalized &&
"Pts of all context-vars have to be merged/normalized. Want to use getPts(CVar cvar)??");
499 assert(
normalized &&
"Pts of all context-var have to be merged/normalized. Want to use getPts(CVar cvar)??");
565 if (this->
getPAG()->isValidTopLevelPtr(node))
567 if (SVFUtil::isa<DummyObjVar>(node))
571 else if (!SVFUtil::isa<DummyValVar>(node))
VersionedPTDataTy * getVersionedPTDataTy() const
PersistentDiffPTData< NodeID, NodeSet, NodeID, PointsTo > PersDiffPTDataTy
virtual void normalizePointsTo()
AliasResult alias(const SVFValue *V1, const SVFValue *V2) override
Interface expose to users of our pointer analysis, given Value infos.
virtual void writeToFile(const std::string &filename)
Interface for analysis result storage on filesystem.
virtual bool readFromFile(const std::string &filename)
PersistentIncDFPTData< NodeID, NodeSet, NodeID, PointsTo > PersIncDFPTDataTy
virtual void writeObjVarToFile(const std::string &filename)
const NodeSet & getRevPts(NodeID nodeId) override
virtual void clearAllPts()
Clear all data.
virtual void clearPts(NodeID id, NodeID element)
Remove element from the points-to set of id.
~BVDataPTAImpl() override=default
Destructor.
virtual void readAndSetObjFieldSensitivity(std::ifstream &f, const std::string &delimiterStr)
DiffPTDataTy * getDiffPTDataTy() const
MutablePTData< NodeID, NodeSet, NodeID, PointsTo > MutPTDataTy
DFPTData< NodeID, NodeSet, NodeID, PointsTo > DFPTDataTy
virtual void writeGepObjVarMapToFile(std::fstream &f)
void finalize() override
Finalization of pointer analysis, and normalize points-to information to Bit Vector representation.
MutableIncDFPTData< NodeID, NodeSet, NodeID, PointsTo > MutIncDFPTDataTy
static bool classof(const PointerAnalysis *pta)
virtual void writePtsResultToFile(std::fstream &f)
PersistentDFPTData< NodeID, NodeSet, NodeID, PointsTo > PersDFPTDataTy
virtual void expandFIObjs(const PointsTo &pts, PointsTo &expandedPts)
Expand FI objects.
void dumpAllPts() override
void remapPointsToSets(void)
Remap all points-to sets to use the current mapping.
MutableVersionedPTData< NodeID, NodeSet, NodeID, PointsTo, VersionedVar, Set< VersionedVar > > MutVersionedPTDataTy
MutDFPTDataTy * getMutDFPTDataTy() const
VersionedPTData< NodeID, NodeSet, NodeID, PointsTo, VersionedVar, Set< VersionedVar > > VersionedPTDataTy
virtual void onTheFlyThreadCallGraphSolve(const CallSiteToFunPtrMap &callsites, CallEdgeMap &newForkEdges)
On the fly thread call graph construction respecting forksite.
PersistentPointsToCache< PointsTo > ptCache
virtual void onTheFlyCallGraphSolve(const CallSiteToFunPtrMap &callsites, CallEdgeMap &newEdges)
On the fly call graph construction.
virtual bool updateCallGraph(const CallSiteToFunPtrMap &)
Update callgraph. This should be implemented by its subclass.
std::unique_ptr< PTDataTy > ptD
Points-to data.
DFPTDataTy * getDFPTDataTy() const
DiffPTData< NodeID, NodeSet, NodeID, PointsTo > DiffPTDataTy
MutableDFPTData< NodeID, NodeSet, NodeID, PointsTo > MutDFPTDataTy
PersistentPointsToCache< PointsTo > & getPtCache()
MutableDiffPTData< NodeID, NodeSet, NodeID, PointsTo > MutDiffPTDataTy
void dumpCPts() override
dump and debug, print out conditional pts
PTData< NodeID, NodeSet, NodeID, PointsTo > PTDataTy
void dumpTopLevelPtsTo() override
virtual bool unionPts(NodeID id, NodeID ptd)
PTBackingType
How the PTData used is implemented.
const PointsTo & getPts(NodeID id) override
PersistentVersionedPTData< NodeID, NodeSet, NodeID, PointsTo, VersionedVar, Set< VersionedVar > > PersVersionedPTDataTy
PersistentPTData< NodeID, NodeSet, NodeID, PointsTo > PersPTDataTy
virtual bool unionPts(NodeID id, const PointsTo &target)
virtual void readPtsResultFromFile(std::ifstream &f)
PTDataTy * getPTDataTy() const
Get points-to data structure.
virtual bool addPts(NodeID id, NodeID ptd)
virtual void readGepObjVarMapFromFile(std::ifstream &f)
virtual void clearFullPts(NodeID id)
Clear points-to set of id.
virtual ~CondPTAImpl()
Destructor.
virtual bool addPts(CVar id, CVar ptd)
MutPTDataTy * getMutPTDataTy() const
virtual AliasResult alias(const SVFValue *V1, const SVFValue *V2)
Interface expose to users of our pointer analysis, given Value infos.
virtual bool unionPts(CVar id, const CPtSet &target)
PtrToNSMap objToNSRevPtsMap
Normal points-to representation (without conditions)
PTDataTy * getPTDataTy() const
Get points-to data.
PtrToBVPtsMap ptrToBVPtsMap
Normal points-to representation (without conditions)
bool containConstantNode(const CPtSet &cpts)
Test constant node for cpts.
bool mustAlias(const CVar &var1, const CVar &var2)
Internal interface to be used for conditional points-to set queries.
CondStdSet< CVar > CPtSet
virtual const CPtSet & getCondPointsTo(NodeID ptr)
Given a pointer return its conditional points-to.
virtual bool unionPts(CVar id, CVar ptd)
Map< NodeID, CPtSet > PtrToCPtsMap
virtual const Set< CVar > & getRevPts(CVar nodeId)
bool hasPtsMap(void) const
bool contains(const CPtSet &cpts1, const CPtSet &cpts2)
void destroy()
Release memory.
CondPTAImpl(SVFIR *pag, PointerAnalysis::PTATY type)
map a pointer to its conditional points-to set
PtrToCPtsMap ptrToCPtsMap
Conditional points-to representation (with conditions)
virtual bool isCondCompatible(const Cond &cxt1, const Cond &cxt2, bool singleton) const =0
Whether two conditions are compatible (to be implemented by child class)
PTData< CVar, Set< CVar >, CVar, CPtSet > PTDataTy
bool isSameVar(const CVar &var1, const CVar &var2) const
Whether two pointers/objects are the same one by considering their conditions.
void dumpTopLevelPtsTo()
Dump points-to information of top-level pointers.
Map< NodeID, NodeSet > PtrToNSMap
map a pointer to its BitVector points-to representation
void expandFIObjs(const CPtSet &cpts, CPtSet &expandedCpts)
Expand all fields of an aggregate in all points-to sets.
bool containBlackHoleNode(const CPtSet &cpts)
Test blk node for cpts.
virtual AliasResult alias(const CPtSet &pts1, const CPtSet &pts2)
Interface expose to users of our pointer analysis, given two conditional points-to sets.
virtual PointsTo getBVPointsTo(const CPtSet &cpts) const
Given a conditional pts return its bit vector points-to.
virtual NodeSet & getRevPts(NodeID obj)
Given an object return all pointers points to this object.
virtual void finalize()
Finalization of pointer analysis, and normalize points-to information to Bit Vector representation.
virtual void dumpCPts()
Print out conditional pts.
virtual void normalizePointsTo()
Normalize points-to information to BitVector/conditional representation.
bool normalized
Normalized flag.
Map< NodeID, PointsTo > PtrToBVPtsMap
virtual AliasResult alias(NodeID node1, NodeID node2)
Interface expose to users of our pointer analysis, given two pointers.
virtual AliasResult alias(const CVar &var1, const CVar &var2)
Interface expose to users of our pointer analysis, given conditional variables.
bool overlap(const CPtSet &cpts1, const CPtSet &cpts2) const
Whether cpts1 and cpts2 have overlap points-to targets.
virtual void clearPts()
Clear all data.
virtual PointsTo & getPts(NodeID ptr)
Given a pointer return its bit vector points-to.
static bool classof(const PointerAnalysis *pta)
virtual const CPtSet & getPts(CVar id)
const MutPTDataTy::PtsMap & getPtsMap() const
MutablePTData< CVar, Set< CVar >, CVar, CPtSet > MutPTDataTy
PTDataTy * ptD
Points-to data.
OrderedSet< Element >::const_iterator const_iterator
iterator begin()
Iterators.
NodeType * getGNode(NodeID id) const
Get a node.
NodeID getBlackHoleNode() const
NodeID getValueNode(const SVFValue *V)
NodeID getConstantNode() const
Map< Key, DataSet > PtsMap
PTATY
Pointer analysis type list.
@ Cxt_DDA
context sensitive DDA
@ PathS_DDA
Guarded value-flow DDA.
bool isLocalVarInRecursiveFun(NodeID id) const
Whether a local variable is in function recursions.
virtual void finalize()
Finalization of a pointer analysis, including checking alias correctness.
OrderedMap< const CallICFGNode *, FunctionSet > CallEdgeMap
PTAImplTy ptaImplTy
PTA implementation type.
OrderedNodeSet & getAllValidPtrs()
Get all Valid Pointers for resolution.
@ BVDataImpl
Represents BVDataPTAImpl.
@ CondImpl
Represents CondPTAImpl.
PTAImplTy getImplTy() const
Return implementation type of the pointer analysis.
PTATY getAnalysisTy() const
Type of pointer analysis.
SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap
bool isHeapMemObj(NodeID id) const
Whether this object is heap or array.
void set(u32_t n)
Inserts n in the set.
NodeID getId() const
Get ID.
NodeBS & getAllFieldsObjVars(const MemObj *obj)
Get all fields of an object.
NodeID getBaseObjVar(NodeID id) const
Base and Offset methods for Value and Object node.
const std::string & getName() const
const SVFValue * getValue() const
Get/has methods of the components.
std::ostream & outs()
Overwrite llvm::outs()
llvm::IRBuilder IRBuilder