Static Value-Flow Analysis
PointerAnalysisImpl.h
Go to the documentation of this file.
1 //===- PointerAnalysisImpl.h -- Pointer analysis implementation--------------------//
2 //
3 // SVF: Static Value-Flow Analysis
4 //
5 // Copyright (C) <2013-> <Yulei Sui>
6 //
7 
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU Affero General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU Affero General Public License for more details.
17 
18 // You should have received a copy of the GNU Affero General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 //
21 //===----------------------------------------------------------------------===//
22 
23 /*
24  * PointerAnalysis.h
25  *
26  * Created on: Nov 12, 2013
27  * Author: Yulei Sui
28  */
29 
30 #ifndef INCLUDE_MEMORYMODEL_POINTERANALYSISIMPL_H_
31 #define INCLUDE_MEMORYMODEL_POINTERANALYSISIMPL_H_
32 
33 #include <Graphs/ConsG.h>
35 
36 namespace SVF
37 {
38 
43 {
44 
45 public:
50 
56 
62 
65  {
68  };
69 
71  BVDataPTAImpl(SVFIR* pag, PointerAnalysis::PTATY type, bool alias_check = true);
72 
74  ~BVDataPTAImpl() override = default;
75 
77  {
78  return ptCache;
79  }
80 
81  static inline bool classof(const PointerAnalysis *pta)
82  {
83  return pta->getImplTy() == BVDataImpl;
84  }
85 
88  inline const PointsTo& getPts(NodeID id) override
89  {
90  return ptD->getPts(id);
91  }
92  inline const NodeSet& getRevPts(NodeID nodeId) override
93  {
94  return ptD->getRevPts(nodeId);
95  }
97 
99  virtual inline void clearPts(NodeID id, NodeID element)
100  {
101  ptD->clearPts(id, element);
102  }
103 
105  virtual inline void clearFullPts(NodeID id)
106  {
107  ptD->clearFullPts(id);
108  }
109 
112 
113  virtual inline bool unionPts(NodeID id, const PointsTo& target)
114  {
115  return ptD->unionPts(id, target);
116  }
117  virtual inline bool unionPts(NodeID id, NodeID ptd)
118  {
119  return ptD->unionPts(id,ptd);
120  }
121  virtual inline bool addPts(NodeID id, NodeID ptd)
122  {
123  return ptD->addPts(id,ptd);
124  }
126 
128  virtual inline void clearAllPts()
129  {
130  ptD->clear();
131  }
132 
134  virtual void expandFIObjs(const PointsTo& pts, PointsTo& expandedPts);
136  virtual void expandFIObjs(const NodeBS& pts, NodeBS& expandedPts);
137 
139  void remapPointsToSets(void);
140 
142 
143  virtual void writeToFile(const std::string& filename);
144  virtual void writeObjVarToFile(const std::string& filename);
145  virtual void writePtsResultToFile(std::fstream& f);
146  virtual void writeGepObjVarMapToFile(std::fstream& f);
147  virtual bool readFromFile(const std::string& filename);
148  virtual void readPtsResultFromFile(std::ifstream& f);
149  virtual void readGepObjVarMapFromFile(std::ifstream& f);
150  virtual void readAndSetObjFieldSensitivity(std::ifstream& f, const std::string& delimiterStr);
152 
153 protected:
155  inline PTDataTy* getPTDataTy() const
156  {
157  return ptD.get();
158  }
159 
160 
162  void finalize() override;
163 
165  virtual inline bool updateCallGraph(const CallSiteToFunPtrMap&)
166  {
167  assert(false && "Virtual function not implemented!");
168  return false;
169  }
170 
172  {
173  DiffPTDataTy* diff = SVFUtil::dyn_cast<DiffPTDataTy>(ptD.get());
174  assert(diff && "BVDataPTAImpl::getDiffPTDataTy: not a DiffPTDataTy!");
175  return diff;
176  }
177 
178  inline DFPTDataTy* getDFPTDataTy() const
179  {
180  DFPTDataTy* df = SVFUtil::dyn_cast<DFPTDataTy>(ptD.get());
181  assert(df && "BVDataPTAImpl::getDFPTDataTy: not a DFPTDataTy!");
182  return df;
183  }
184 
186  {
187  MutDFPTDataTy* mdf = SVFUtil::dyn_cast<MutDFPTDataTy>(ptD.get());
188  assert(mdf && "BVDataPTAImpl::getMutDFPTDataTy: not a MutDFPTDataTy!");
189  return mdf;
190  }
191 
193  {
194  VersionedPTDataTy* v = SVFUtil::dyn_cast<VersionedPTDataTy>(ptD.get());
195  assert(v && "BVDataPTAImpl::getVersionedPTDataTy: not a VersionedPTDataTy!");
196  return v;
197  }
198 
200  virtual void onTheFlyCallGraphSolve(const CallSiteToFunPtrMap& callsites, CallEdgeMap& newEdges);
201 
203  virtual void onTheFlyThreadCallGraphSolve(const CallSiteToFunPtrMap& callsites,
204  CallEdgeMap& newForkEdges);
205 
208  virtual void normalizePointsTo();
209 
210 private:
212  std::unique_ptr<PTDataTy> ptD;
213 
215 
216 public:
218  AliasResult alias(const SVFValue* V1,
219  const SVFValue* V2) override;
220 
222  AliasResult alias(NodeID node1, NodeID node2) override;
223 
225  virtual AliasResult alias(const PointsTo& pts1, const PointsTo& pts2);
226 
228 
229  void dumpCPts() override
230  {
231  ptD->dumpPTData();
232  }
233 
234  void dumpTopLevelPtsTo() override;
235 
236  void dumpAllPts() override;
238 };
239 
243 template<class Cond>
245 {
246 
247 public:
255 
258  {
259  if (type == PathS_DDA || type == Cxt_DDA)
260  ptD = new MutPTDataTy();
261  else
262  assert(false && "no points-to data available");
263 
265  }
266 
268  virtual ~CondPTAImpl()
269  {
270  destroy();
271  }
272 
273  static inline bool classof(const PointerAnalysis *pta)
274  {
275  return pta->getImplTy() == CondImpl;
276  }
277 
279  inline void destroy()
280  {
281  delete ptD;
282  ptD = nullptr;
283  }
284 
286  inline PTDataTy* getPTDataTy() const
287  {
288  return ptD;
289  }
290 
291  inline MutPTDataTy* getMutPTDataTy() const
292  {
293  MutPTDataTy* mut = SVFUtil::dyn_cast<MutPTDataTy>(ptD);
294  assert(mut && "BVDataPTAImpl::getMutPTDataTy: not a MutPTDataTy!");
295  return mut;
296  }
297 
298  inline bool hasPtsMap(void) const
299  {
300  return SVFUtil::isa<MutPTDataTy>(ptD);
301  }
302 
303  inline const typename MutPTDataTy::PtsMap& getPtsMap() const
304  {
305  if (MutPTDataTy *m = SVFUtil::dyn_cast<MutPTDataTy>(ptD)) return m->getPtsMap();
306  assert(false && "CondPTAImpl::getPtsMap: not a PTData with a PtsMap!");
307  exit(1);
308  }
309 
312  virtual inline const CPtSet& getPts(CVar id)
313  {
314  return ptD->getPts(id);
315  }
316  virtual inline const Set<CVar>& getRevPts(CVar nodeId)
317  {
318  return ptD->getRevPts(nodeId);
319  }
321 
323  virtual inline void clearPts()
324  {
325  ptD->clear();
326  }
327 
329  bool overlap(const CPtSet& cpts1, const CPtSet& cpts2) const
330  {
331  for (typename CPtSet::const_iterator it1 = cpts1.begin(); it1 != cpts1.end(); ++it1)
332  {
333  for (typename CPtSet::const_iterator it2 = cpts2.begin(); it2 != cpts2.end(); ++it2)
334  {
335  if(isSameVar(*it1,*it2))
336  return true;
337  }
338  }
339  return false;
340  }
341 
343  void expandFIObjs(const CPtSet& cpts, CPtSet& expandedCpts)
344  {
345  expandedCpts = cpts;;
346  for(typename CPtSet::const_iterator cit = cpts.begin(), ecit=cpts.end(); cit!=ecit; ++cit)
347  {
348  if(pag->getBaseObjVar(cit->get_id())==cit->get_id())
349  {
350  NodeBS& fields = pag->getAllFieldsObjVars(cit->get_id());
351  for(NodeBS::iterator it = fields.begin(), eit = fields.end(); it!=eit; ++it)
352  {
353  CVar cvar(cit->get_cond(),*it);
354  expandedCpts.set(cvar);
355  }
356  }
357  }
358  }
359 
360 protected:
361 
363  virtual void finalize()
364  {
367  }
370 
371  virtual inline bool unionPts(CVar id, const CPtSet& target)
372  {
373  return ptD->unionPts(id, target);
374  }
375 
376  virtual inline bool unionPts(CVar id, CVar ptd)
377  {
378  return ptD->unionPts(id,ptd);
379  }
380 
381  virtual inline bool addPts(CVar id, CVar ptd)
382  {
383  return ptD->addPts(id,ptd);
384  }
386 
388 
389  inline bool mustAlias(const CVar& var1, const CVar& var2)
390  {
391  if(isSameVar(var1,var2))
392  return true;
393 
394  bool singleton = !(isHeapMemObj(var1.get_id()) || isLocalVarInRecursiveFun(var1.get_id()));
395  if(isCondCompatible(var1.get_cond(),var2.get_cond(),singleton) == false)
396  return false;
397 
398  const CPtSet& cpts1 = getPts(var1);
399  const CPtSet& cpts2 = getPts(var2);
400  return (contains(cpts1,cpts2) && contains(cpts2,cpts1));
401  }
402 
403  // Whether cpts1 contains all points-to targets of pts2
404  bool contains(const CPtSet& cpts1, const CPtSet& cpts2)
405  {
406  if (cpts1.empty() || cpts2.empty())
407  return false;
408 
409  for (typename CPtSet::const_iterator it2 = cpts2.begin(); it2 != cpts2.end(); ++it2)
410  {
411  bool hasObj = false;
412  for (typename CPtSet::const_iterator it1 = cpts1.begin(); it1 != cpts1.end(); ++it1)
413  {
414  if(isSameVar(*it1,*it2))
415  {
416  hasObj = true;
417  break;
418  }
419  }
420  if(hasObj == false)
421  return false;
422  }
423  return true;
424  }
425 
427  bool isSameVar(const CVar& var1, const CVar& var2) const
428  {
429  if(var1.get_id() != var2.get_id())
430  return false;
431 
433  bool singleton = !(isHeapMemObj(var1.get_id()) || isLocalVarInRecursiveFun(var1.get_id()));
434  return isCondCompatible(var1.get_cond(),var2.get_cond(),singleton);
435  }
437 
439  virtual void normalizePointsTo()
440  {
441  normalized = true;
442  if (hasPtsMap())
443  {
444  const typename MutPTDataTy::PtsMap& ptsMap = getPtsMap();
445  for(typename MutPTDataTy::PtsMap::const_iterator it = ptsMap.begin(), eit=ptsMap.end(); it!=eit; ++it)
446  {
447  for(typename CPtSet::const_iterator cit = it->second.begin(), ecit=it->second.end(); cit!=ecit; ++cit)
448  {
449  ptrToBVPtsMap[(it->first).get_id()].set(cit->get_id());
450  objToNSRevPtsMap[cit->get_id()].insert((it->first).get_id());
451  ptrToCPtsMap[(it->first).get_id()].set(*cit);
452  }
453  }
454  }
455  else
456  {
457  assert(false && "CondPTAImpl::NormalizePointsTo: could not normalize points-to sets");
458  }
459  }
470 public:
472  virtual void dumpCPts()
473  {
474  ptD->dumpPTData();
475  }
477  virtual inline PointsTo getBVPointsTo(const CPtSet& cpts) const
478  {
479  PointsTo pts;
480  for(typename CPtSet::const_iterator cit = cpts.begin(), ecit=cpts.end(); cit!=ecit; ++cit)
481  pts.set(cit->get_id());
482  return pts;
483  }
485  virtual inline PointsTo& getPts(NodeID ptr)
486  {
487  assert(normalized && "Pts of all context-var have to be merged/normalized. Want to use getPts(CVar cvar)??");
488  return ptrToBVPtsMap[ptr];
489  }
491  virtual inline const CPtSet& getCondPointsTo(NodeID ptr)
492  {
493  assert(normalized && "Pts of all context-vars have to be merged/normalized. Want to use getPts(CVar cvar)??");
494  return ptrToCPtsMap[ptr];
495  }
497  virtual inline NodeSet& getRevPts(NodeID obj)
498  {
499  assert(normalized && "Pts of all context-var have to be merged/normalized. Want to use getPts(CVar cvar)??");
500  return objToNSRevPtsMap[obj];
501  }
502 
504  virtual inline AliasResult alias(const SVFValue* V1, const SVFValue* V2)
505  {
506  return alias(pag->getValueNode(V1),pag->getValueNode(V2));
507  }
509  virtual inline AliasResult alias(NodeID node1, NodeID node2)
510  {
511  return alias(getCondPointsTo(node1),getCondPointsTo(node2));
512  }
514  virtual AliasResult alias(const CVar& var1, const CVar& var2)
515  {
516  return alias(getPts(var1),getPts(var2));
517  }
519  virtual inline AliasResult alias(const CPtSet& pts1, const CPtSet& pts2)
520  {
521  CPtSet cpts1;
522  expandFIObjs(pts1,cpts1);
523  CPtSet cpts2;
524  expandFIObjs(pts2,cpts2);
525  if (containBlackHoleNode(cpts1) || containBlackHoleNode(cpts2))
526  return AliasResult::MayAlias;
527  else if(this->getAnalysisTy()==PathS_DDA && contains(cpts1,cpts2) && contains(cpts2,cpts1))
528  {
529  return AliasResult::MustAlias;
530  }
531  else if(overlap(cpts1,cpts2))
532  return AliasResult::MayAlias;
533  else
534  return AliasResult::NoAlias;
535  }
537  inline bool containBlackHoleNode(const CPtSet& cpts)
538  {
539  for(typename CPtSet::const_iterator cit = cpts.begin(), ecit=cpts.end(); cit!=ecit; ++cit)
540  {
541  if(cit->get_id() == pag->getBlackHoleNode())
542  return true;
543  }
544  return false;
545  }
547  inline bool containConstantNode(const CPtSet& cpts)
548  {
549  for(typename CPtSet::const_iterator cit = cpts.begin(), ecit=cpts.end(); cit!=ecit; ++cit)
550  {
551  if(cit->get_id() == pag->getConstantNode())
552  return true;
553  }
554  return false;
555  }
557  virtual bool isCondCompatible(const Cond& cxt1, const Cond& cxt2, bool singleton) const = 0;
558 
561  {
562  for (OrderedNodeSet::iterator nIter = this->getAllValidPtrs().begin(); nIter != this->getAllValidPtrs().end(); ++nIter)
563  {
564  const PAGNode* node = this->getPAG()->getGNode(*nIter);
565  if (this->getPAG()->isValidTopLevelPtr(node))
566  {
567  if (SVFUtil::isa<DummyObjVar>(node))
568  {
569  SVFUtil::outs() << "##<Blackhole or constant> id:" << node->getId();
570  }
571  else if (!SVFUtil::isa<DummyValVar>(node))
572  {
573  SVFUtil::outs() << "##<" << node->getValue()->getName() << "> ";
574  //SVFUtil::outs() << "Source Loc: " << SVFUtil::getSourceLoc(node->getValue());
575  }
576 
577  const PointsTo& pts = getPts(node->getId());
578  SVFUtil::outs() << "\nNodeID " << node->getId() << " ";
579  if (pts.empty())
580  {
581  SVFUtil::outs() << "\t\tPointsTo: {empty}\n\n";
582  }
583  else
584  {
585  SVFUtil::outs() << "\t\tPointsTo: { ";
586  for (PointsTo::iterator it = pts.begin(), eit = pts.end(); it != eit; ++it)
587  SVFUtil::outs() << *it << " ";
588  SVFUtil::outs() << "}\n\n";
589  }
590  }
591  }
592 
593  SVFUtil::outs().flush();
594  }
595 };
596 
597 } // End namespace SVF
598 
599 #endif /* INCLUDE_MEMORYMODEL_POINTERANALYSISIMPL_H_ */
newitem type
Definition: cJSON.cpp:2739
#define false
Definition: cJSON.cpp:70
const char *const string
Definition: cJSON.h:172
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)
virtual void clearAllPts()
Clear all data.
VersionedPTDataTy * getVersionedPTDataTy() const
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)
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
DFPTDataTy * getDFPTDataTy() const
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
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.
const NodeSet & getRevPts(NodeID nodeId) override
virtual bool updateCallGraph(const CallSiteToFunPtrMap &)
Update callgraph. This should be implemented by its subclass.
BVDataPTAImpl(SVFIR *pag, PointerAnalysis::PTATY type, bool alias_check=true)
Constructor.
std::unique_ptr< PTDataTy > ptD
Points-to data.
DiffPTDataTy * getDiffPTDataTy() const
DiffPTData< NodeID, NodeSet, NodeID, PointsTo > DiffPTDataTy
MutableDFPTData< NodeID, NodeSet, NodeID, PointsTo > MutDFPTDataTy
MutableDiffPTData< NodeID, NodeSet, NodeID, PointsTo > MutDiffPTDataTy
const PointsTo & getPts(NodeID id) override
MutDFPTDataTy * getMutDFPTDataTy() const
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.
PersistentVersionedPTData< NodeID, NodeSet, NodeID, PointsTo, VersionedVar, Set< VersionedVar > > PersVersionedPTDataTy
PersistentPTData< NodeID, NodeSet, NodeID, PointsTo > PersPTDataTy
virtual bool unionPts(NodeID id, const PointsTo &target)
PTDataTy * getPTDataTy() const
Get points-to data structure.
virtual void readPtsResultFromFile(std::ifstream &f)
virtual bool addPts(NodeID id, NodeID ptd)
PersistentPointsToCache< PointsTo > & getPtCache()
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)
virtual PointsTo & getPts(NodeID ptr)
Given a pointer return its bit vector points-to.
virtual const Set< CVar > & getRevPts(CVar nodeId)
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)
PtrToBVPtsMap ptrToBVPtsMap
Normal points-to representation (without conditions)
PTDataTy * getPTDataTy() const
Get points-to data.
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
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 const CPtSet & getPts(CVar id)
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.
const MutPTDataTy::PtsMap & getPtsMap() const
virtual void finalize()
Finalization of pointer analysis, and normalize points-to information to Bit Vector representation.
virtual void dumpCPts()
Print out conditional pts.
virtual NodeSet & getRevPts(NodeID obj)
Given an object return all pointers points to this object.
virtual void normalizePointsTo()
Normalize points-to information to BitVector/conditional representation.
bool normalized
Normalized flag.
MutPTDataTy * getMutPTDataTy() const
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.
static bool classof(const PointerAnalysis *pta)
MutablePTData< CVar, Set< CVar >, CVar, CPtSet > MutPTDataTy
CondVar< Cond > CVar
PTDataTy * ptD
Points-to data.
bool empty() const
Set size.
OrderedSet< Element >::const_iterator const_iterator
iterator end()
iterator begin()
Iterators.
void set(const Element &var)
Add the element into set.
NodeID get_id() const
const Cond & get_cond() const
NodeType * getGNode(NodeID id) const
Get a node.
Definition: GenericGraph.h:653
NodeID getBlackHoleNode() const
Definition: IRGraph.h:161
NodeID getValueNode(const SVFValue *V)
Definition: IRGraph.h:137
NodeID getConstantNode() const
Definition: IRGraph.h:165
DiffPTData implemented with points-to sets which are updated continuously.
Incremental version of the mutable data-flow points-to data structure.
PTData implemented using points-to sets which are created once and updated continuously.
Map< Key, DataSet > PtsMap
virtual void dumpPTData()=0
Dump stored keys and points-to sets.
virtual const DataSet & getPts(const Key &var)=0
Get points-to set of var.
virtual const KeySet & getRevPts(const Data &datum)=0
Get reverse points-to set of a datum.
virtual bool addPts(const Key &var, const Data &element)=0
Adds element to the points-to set associated with var.
virtual void clear()=0
Clears all points-to sets as if nothing is stored.
virtual bool unionPts(const Key &dstVar, const Key &srcVar)=0
Performs pts(dstVar) = pts(dstVar) U pts(srcVar).
DFPTData backed by a PersistentPointsToCache.
DiffPTData implemented with a persistent points-to backing.
Incremental version of the persistent data-flow points-to data structure.
PTData backed by a PersistentPointsToCache.
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.
SVFIR * getPAG() const
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
static SVFIR * pag
SVFIR.
bool isHeapMemObj(NodeID id) const
Whether this object is heap or array.
bool empty() const
Returns true if set is empty.
Definition: PointsTo.cpp:98
const_iterator end() const
Definition: PointsTo.h:132
void set(u32_t n)
Inserts n in the set.
Definition: PointsTo.cpp:157
const_iterator begin() const
Definition: PointsTo.h:128
NodeID getId() const
Get ID.
Definition: GenericGraph.h:260
NodeBS & getAllFieldsObjVars(const MemObj *obj)
Get all fields of an object.
Definition: SVFIR.cpp:477
NodeID getBaseObjVar(NodeID id) const
Base and Offset methods for Value and Object node.
Definition: SVFIR.h:455
const std::string & getName() const
Definition: SVFValue.h:243
const SVFValue * getValue() const
Get/has methods of the components.
Definition: SVFVariables.h:83
iterator end() const
iterator begin() const
std::ostream & outs()
Overwrite llvm::outs()
Definition: SVFUtil.h:50
for isBitcode
Definition: BasicTypes.h:68
Set< NodeID > NodeSet
Definition: GeneralType.h:113
u32_t NodeID
Definition: GeneralType.h:55
AliasResult
Definition: SVFType.h:527
@ MustAlias
Definition: SVFType.h:530
@ MayAlias
Definition: SVFType.h:529
@ NoAlias
Definition: SVFType.h:528
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
Definition: GeneralType.h:101
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
Definition: GeneralType.h:96