svf-lib 1.0.744 → 1.0.748

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/SVF-linux/Release-build/lib/libSvf.a +0 -0
  2. package/SVF-linux/include/DDA/ContextDDA.h +1 -1
  3. package/SVF-linux/include/DDA/FlowDDA.h +1 -1
  4. package/SVF-linux/include/Graphs/ConsG.h +10 -10
  5. package/SVF-linux/include/Graphs/ICFGNode.h +3 -3
  6. package/SVF-linux/include/Graphs/IRGraph.h +7 -7
  7. package/SVF-linux/include/Graphs/VFG.h +4 -4
  8. package/SVF-linux/include/MSSA/MemRegion.h +3 -3
  9. package/SVF-linux/include/MSSA/MemSSA.h +1 -1
  10. package/SVF-linux/include/MemoryModel/PointerAnalysis.h +8 -8
  11. package/SVF-linux/include/MemoryModel/PointerAnalysisImpl.h +2 -2
  12. package/SVF-linux/include/MemoryModel/SVFIR.h +66 -67
  13. package/SVF-linux/include/MemoryModel/SVFStatements.h +30 -25
  14. package/SVF-linux/include/MemoryModel/SVFVariables.h +32 -32
  15. package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +15 -15
  16. package/SVF-linux/include/Util/IRAnnotator.h +1 -1
  17. package/SVF-linux/include/Util/TypeBasedHeapCloning.h +2 -2
  18. package/SVF-linux/include/WPA/Andersen.h +1 -1
  19. package/SVF-linux/include/WPA/FlowSensitiveTBHC.h +1 -1
  20. package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
  21. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  22. package/SVF-osx/include/DDA/ContextDDA.h +1 -1
  23. package/SVF-osx/include/DDA/FlowDDA.h +1 -1
  24. package/SVF-osx/include/Graphs/ConsG.h +10 -10
  25. package/SVF-osx/include/Graphs/ICFGNode.h +3 -3
  26. package/SVF-osx/include/Graphs/IRGraph.h +7 -7
  27. package/SVF-osx/include/Graphs/VFG.h +4 -4
  28. package/SVF-osx/include/MSSA/MemRegion.h +3 -3
  29. package/SVF-osx/include/MSSA/MemSSA.h +1 -1
  30. package/SVF-osx/include/MemoryModel/PointerAnalysis.h +8 -8
  31. package/SVF-osx/include/MemoryModel/PointerAnalysisImpl.h +2 -2
  32. package/SVF-osx/include/MemoryModel/SVFIR.h +66 -67
  33. package/SVF-osx/include/MemoryModel/SVFStatements.h +30 -25
  34. package/SVF-osx/include/MemoryModel/SVFVariables.h +32 -32
  35. package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +15 -15
  36. package/SVF-osx/include/Util/IRAnnotator.h +1 -1
  37. package/SVF-osx/include/Util/TypeBasedHeapCloning.h +2 -2
  38. package/SVF-osx/include/WPA/Andersen.h +1 -1
  39. package/SVF-osx/include/WPA/FlowSensitiveTBHC.h +1 -1
  40. package/package.json +1 -1
@@ -48,12 +48,12 @@ typedef SVFStmt PAGEdge;
48
48
  class IRGraph : public GenericGraph<SVFVar,SVFStmt>
49
49
  {
50
50
  public:
51
- typedef Set<const SVFStmt*> PAGEdgeSet;
52
- typedef Map<const Value*,PAGEdgeSet> ValueToEdgeMap;
51
+ typedef Set<const SVFStmt*> SVFStmtSet;
52
+ typedef Map<const Value*,SVFStmtSet> ValueToEdgeMap;
53
53
 
54
54
  protected:
55
- SVFStmt::PAGKindToEdgeSetMapTy PAGEdgeKindToSetMap; // < SVFIR edge map containing all PAGEdges
56
- SVFStmt::PAGKindToEdgeSetMapTy PTAPAGEdgeKindToSetMap; // < SVFIR edge map containing only pointer-related edges, i.e, both RHS and RHS are of pointer type
55
+ SVFStmt::KindToSVFStmtMapTy KindToSVFStmtSetMap; // < SVFIR edge map containing all PAGEdges
56
+ SVFStmt::KindToSVFStmtMapTy KindToPTASVFStmtSetMap; // < SVFIR edge map containing only pointer-related edges, i.e, both RHS and RHS are of pointer type
57
57
  bool fromFile; ///< Whether the SVFIR is built according to user specified data from a txt file
58
58
  NodeID nodeNumAfterPAGBuild; // initial node number after building SVFIR, excluding later added nodes, e.g., gepobj nodes
59
59
  u32_t totalPTAPAGEdge;
@@ -80,7 +80,7 @@ protected:
80
80
  /// Map a value to a set of edges
81
81
  inline void mapValueToEdge(const Value *V, SVFStmt *edge)
82
82
  {
83
- auto inserted = valueToEdgeMap.emplace(V, PAGEdgeSet{edge});
83
+ auto inserted = valueToEdgeMap.emplace(V, SVFStmtSet{edge});
84
84
  if (!inserted.second) {
85
85
  inserted.first->second.emplace(edge);
86
86
  }
@@ -94,7 +94,7 @@ public:
94
94
  IRGraph(bool buildFromFile): fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0){
95
95
  symInfo = SymbolTableInfo::SymbolInfo();
96
96
  // insert dummy value if a correct value cannot be found
97
- valueToEdgeMap[nullptr] = PAGEdgeSet();
97
+ valueToEdgeMap[nullptr] = SVFStmtSet();
98
98
  }
99
99
 
100
100
  virtual ~IRGraph();
@@ -105,7 +105,7 @@ public:
105
105
  return fromFile;
106
106
  }
107
107
  /// Get all SVFIR Edges that corresponds to an LLVM value
108
- inline const PAGEdgeSet& getValueEdges(const Value *V)
108
+ inline const SVFStmtSet& getValueEdges(const Value *V)
109
109
  {
110
110
  auto it = valueToEdgeMap.find(V);
111
111
  if (it == valueToEdgeMap.end()) {
@@ -79,7 +79,7 @@ public:
79
79
  typedef VFGEdge::VFGEdgeSetTy::iterator VFGNodeIter;
80
80
  typedef VFGNodeIDToNodeMapTy::iterator iterator;
81
81
  typedef VFGNodeIDToNodeMapTy::const_iterator const_iterator;
82
- typedef SVFIR::PAGEdgeSet PAGEdgeSet;
82
+ typedef SVFIR::SVFStmtSet SVFStmtSet;
83
83
  typedef Set<const VFGNode*> GlobalVFGNodeSet;
84
84
  typedef Set<const PAGNode*> PAGNodeSet;
85
85
 
@@ -427,12 +427,12 @@ protected:
427
427
  void addVFGNodes();
428
428
 
429
429
  /// Get PAGEdge set
430
- virtual inline PAGEdge::PAGEdgeSetTy& getPAGEdgeSet(PAGEdge::PEDGEK kind)
430
+ virtual inline PAGEdge::SVFStmtSetTy& getPAGEdgeSet(PAGEdge::PEDGEK kind)
431
431
  {
432
432
  if (isPtrOnlySVFG())
433
- return pag->getPTAEdgeSet(kind);
433
+ return pag->getPTASVFStmtSet(kind);
434
434
  else
435
- return pag->getEdgeSet(kind);
435
+ return pag->getSVFStmtSet(kind);
436
436
  }
437
437
 
438
438
  virtual inline bool isInterestedPAGNode(const PAGNode* node) const
@@ -169,7 +169,7 @@ public:
169
169
  typedef Map<NodeID, NodeBS> NodeToPTSSMap;
170
170
 
171
171
  /// SVFIR edge list
172
- typedef SVFIR::PAGEdgeList PAGEdgeList;
172
+ typedef SVFIR::SVFStmtList SVFStmtList;
173
173
  /// Call Graph SCC
174
174
  typedef SCCDetection<PTACallGraph*> SCC;
175
175
 
@@ -466,9 +466,9 @@ public:
466
466
  }
467
467
  //@}
468
468
  /// Whether this instruction has SVFIR Edge
469
- bool hasPAGEdgeList(const Instruction* inst);
469
+ bool hasSVFStmtList(const Instruction* inst);
470
470
  /// Given an instruction, get all its the PAGEdge (statement) in sequence
471
- PAGEdgeList& getPAGEdgesFromInst(const Instruction* inst);
471
+ SVFStmtList& getPAGEdgesFromInst(const Instruction* inst);
472
472
 
473
473
  /// getModRefInfo APIs
474
474
  //@{
@@ -94,7 +94,7 @@ public:
94
94
  typedef Map<const MemRegion*, MRVERSION> MemRegToCounterMap;
95
95
 
96
96
  /// SVFIR edge list
97
- typedef SVFIR::PAGEdgeList PAGEdgeList;
97
+ typedef SVFIR::SVFStmtList SVFStmtList;
98
98
 
99
99
  /// Statistics
100
100
  //@{
@@ -346,21 +346,21 @@ public:
346
346
  {
347
347
  return (SVFUtil::isa<FIObjVar>(pag->getGNode(id)));
348
348
  }
349
- inline NodeID getBaseObjNode(NodeID id)
349
+ inline NodeID getBaseObjVar(NodeID id)
350
350
  {
351
- return pag->getBaseObjNode(id);
351
+ return pag->getBaseObjVar(id);
352
352
  }
353
- inline NodeID getFIObjNode(NodeID id)
353
+ inline NodeID getFIObjVar(NodeID id)
354
354
  {
355
- return pag->getFIObjNode(id);
355
+ return pag->getFIObjVar(id);
356
356
  }
357
- inline NodeID getGepObjNode(NodeID id, const LocationSet& ls)
357
+ inline NodeID getGepObjVar(NodeID id, const LocationSet& ls)
358
358
  {
359
- return pag->getGepObjNode(id,ls);
359
+ return pag->getGepObjVar(id,ls);
360
360
  }
361
- virtual inline const NodeBS& getAllFieldsObjNode(NodeID id)
361
+ virtual inline const NodeBS& getAllFieldsObjVars(NodeID id)
362
362
  {
363
- return pag->getAllFieldsObjNode(id);
363
+ return pag->getAllFieldsObjVars(id);
364
364
  }
365
365
  inline void setObjFieldInsensitive(NodeID id)
366
366
  {
@@ -352,9 +352,9 @@ public:
352
352
  expandedCpts = cpts;;
353
353
  for(typename CPtSet::const_iterator cit = cpts.begin(), ecit=cpts.end(); cit!=ecit; ++cit)
354
354
  {
355
- if(pag->getBaseObjNode(cit->get_id())==cit->get_id())
355
+ if(pag->getBaseObjVar(cit->get_id())==cit->get_id())
356
356
  {
357
- NodeBS& fields = pag->getAllFieldsObjNode(cit->get_id());
357
+ NodeBS& fields = pag->getAllFieldsObjVars(cit->get_id());
358
358
  for(NodeBS::iterator it = fields.begin(), eit = fields.end(); it!=eit; ++it)
359
359
  {
360
360
  CVar cvar(cit->get_cond(),*it);
@@ -53,33 +53,32 @@ public:
53
53
  typedef OrderedMap<const CallBlockNode*,NodeID> CallSiteToFunPtrMap;
54
54
  typedef Map<NodeID,CallSiteSet> FunPtrToCallSitesMap;
55
55
  typedef Map<NodeID,NodeBS> MemObjToFieldsMap;
56
- typedef std::vector<const SVFStmt*> PAGEdgeList;
57
- typedef std::vector<const SVFVar*> PAGNodeList;
58
- typedef std::vector<const CopyStmt*> CopyPEList;
56
+ typedef std::vector<const SVFStmt*> SVFStmtList;
57
+ typedef std::vector<const SVFVar*> SVFVarList;
59
58
  typedef Map<const SVFVar*,PhiStmt*> PHINodeMap;
60
- typedef Map<const SVFFunction*,PAGNodeList> FunToArgsListMap;
61
- typedef Map<const CallBlockNode*,PAGNodeList> CSToArgsListMap;
59
+ typedef Map<const SVFFunction*,SVFVarList> FunToArgsListMap;
60
+ typedef Map<const CallBlockNode*,SVFVarList> CSToArgsListMap;
62
61
  typedef Map<const RetBlockNode*,const SVFVar*> CSToRetMap;
63
62
  typedef Map<const SVFFunction*,const SVFVar*> FunToRetMap;
64
- typedef Map<const SVFFunction*,PAGEdgeSet> FunToPAGEdgeSetMap;
65
- typedef Map<const ICFGNode*,PAGEdgeList> Inst2PAGEdgesMap;
63
+ typedef Map<const SVFFunction*,SVFStmtSet> FunToPAGEdgeSetMap;
64
+ typedef Map<const ICFGNode*,SVFStmtList> ICFGNode2SVFStmtsMap;
66
65
  typedef Map<NodeID, NodeID> NodeToNodeMap;
67
66
  typedef std::pair<NodeID, Size_t> NodeOffset;
68
67
  typedef std::pair<NodeID, LocationSet> NodeLocationSet;
69
68
  typedef Map<NodeOffset,NodeID> NodeOffsetMap;
70
69
  typedef Map<NodeLocationSet,NodeID> NodeLocationSetMap;
71
- typedef Map<const Value*, NodeLocationSetMap> GepValPNMap;
70
+ typedef Map<const Value*, NodeLocationSetMap> GepValueVarMap;
72
71
  typedef Map<NodePair,NodeID> NodePairSetMap;
73
72
 
74
73
  private:
75
74
  /// ValueNodes - This map indicates the Node that a particular Value* is
76
75
  /// represented by. This contains entries for all pointers.
77
- Inst2PAGEdgesMap inst2PAGEdgesMap; ///< Map a instruction to its PAGEdges
78
- Inst2PAGEdgesMap inst2PTAPAGEdgesMap; ///< Map a instruction to its PointerAnalysis related PAGEdges
79
- GepValPNMap GepValNodeMap; ///< Map a pair<base,off> to a gep value node id
80
- NodeLocationSetMap GepObjNodeMap; ///< Map a pair<base,off> to a gep obj node id
76
+ ICFGNode2SVFStmtsMap icfgNode2SVFStmtsMap; ///< Map an ICFGNode to its SVFStmts
77
+ ICFGNode2SVFStmtsMap icfgNode2PTASVFStmtsMap; ///< Map an ICFGNode to its PointerAnalysis related SVFStmts
78
+ GepValueVarMap GepValObjMap; ///< Map a pair<base,off> to a gep value node id
79
+ NodeLocationSetMap GepObjVarMap; ///< Map a pair<base,off> to a gep obj node id
81
80
  MemObjToFieldsMap memToFieldsMap; ///< Map a mem object id to all its fields
82
- PAGEdgeSet globPAGEdgesSet; ///< Global PAGEdges without control flow information
81
+ SVFStmtSet globSVFStmtSet; ///< Global PAGEdges without control flow information
83
82
  PHINodeMap phiNodeMap; ///< A set of phi copy edges
84
83
  FunToArgsListMap funArgsListMap; ///< Map a function to a list of all its formal parameters
85
84
  CSToArgsListMap callSiteArgsListMap; ///< Map a callsite to a list of all its actual parameters
@@ -124,10 +123,10 @@ public:
124
123
  {
125
124
  return memToFieldsMap;
126
125
  }
127
- /// Return GepObjNodeMap
126
+ /// Return GepObjVarMap
128
127
  inline NodeLocationSetMap& getGepObjNodeMap()
129
128
  {
130
- return GepObjNodeMap;
129
+ return GepObjVarMap;
131
130
  }
132
131
  /// Return ICFG
133
132
  inline ICFG* getICFG()
@@ -160,46 +159,46 @@ public:
160
159
  /// Get/set methods to get SVFStmts based on their kinds and ICFGNodes
161
160
  //@{
162
161
  /// Get edges set according to its kind
163
- inline SVFStmt::PAGEdgeSetTy& getEdgeSet(SVFStmt::PEDGEK kind)
162
+ inline SVFStmt::SVFStmtSetTy& getSVFStmtSet(SVFStmt::PEDGEK kind)
164
163
  {
165
- return PAGEdgeKindToSetMap[kind];
164
+ return KindToSVFStmtSetMap[kind];
166
165
  }
167
166
  /// Get PTA edges set according to its kind
168
- inline SVFStmt::PAGEdgeSetTy& getPTAEdgeSet(SVFStmt::PEDGEK kind)
167
+ inline SVFStmt::SVFStmtSetTy& getPTASVFStmtSet(SVFStmt::PEDGEK kind)
169
168
  {
170
- return PTAPAGEdgeKindToSetMap[kind];
169
+ return KindToPTASVFStmtSetMap[kind];
171
170
  }
172
171
  /// Whether this instruction has SVFIR Edge
173
- inline bool hasPAGEdgeList(const ICFGNode* inst) const
172
+ inline bool hasSVFStmtList(const ICFGNode* inst) const
174
173
  {
175
- return inst2PAGEdgesMap.find(inst)!=inst2PAGEdgesMap.end();
174
+ return icfgNode2SVFStmtsMap.find(inst)!=icfgNode2SVFStmtsMap.end();
176
175
  }
177
- inline bool hasPTAPAGEdgeList(const ICFGNode* inst) const
176
+ inline bool hasPTASVFStmtList(const ICFGNode* inst) const
178
177
  {
179
- return inst2PTAPAGEdgesMap.find(inst)!=inst2PTAPAGEdgesMap.end();
178
+ return icfgNode2PTASVFStmtsMap.find(inst)!=icfgNode2PTASVFStmtsMap.end();
180
179
  }
181
180
  /// Given an instruction, get all its PAGEdges
182
- inline PAGEdgeList& getInstPAGEdgeList(const ICFGNode* inst)
181
+ inline SVFStmtList& getSVFStmtList(const ICFGNode* inst)
183
182
  {
184
- return inst2PAGEdgesMap[inst];
183
+ return icfgNode2SVFStmtsMap[inst];
185
184
  }
186
185
  /// Given an instruction, get all its PTA PAGEdges
187
- inline PAGEdgeList& getInstPTAPAGEdgeList(const ICFGNode* inst)
186
+ inline SVFStmtList& getPTASVFStmtList(const ICFGNode* inst)
188
187
  {
189
- return inst2PTAPAGEdgesMap[inst];
188
+ return icfgNode2PTASVFStmtsMap[inst];
190
189
  }
191
190
  /// Add a SVFStmt into instruction map
192
- inline void addToInstPAGEdgeList(ICFGNode* inst, SVFStmt* edge)
191
+ inline void addToSVFStmtList(ICFGNode* inst, SVFStmt* edge)
193
192
  {
194
193
  edge->setICFGNode(inst);
195
- inst2PAGEdgesMap[inst].push_back(edge);
194
+ icfgNode2SVFStmtsMap[inst].push_back(edge);
196
195
  if (edge->isPTAEdge())
197
- inst2PTAPAGEdgesMap[inst].push_back(edge);
196
+ icfgNode2PTASVFStmtsMap[inst].push_back(edge);
198
197
  }
199
198
  /// Get global PAGEdges (not in a procedure)
200
- inline PAGEdgeSet& getGlobalPAGEdgeSet()
199
+ inline SVFStmtSet& getGlobalSVFStmtSet()
201
200
  {
202
- return globPAGEdgesSet;
201
+ return globSVFStmtSet;
203
202
  }
204
203
  /// Get all callsites
205
204
  inline const CallSiteSet& getCallSiteSet() const
@@ -223,7 +222,7 @@ public:
223
222
  return funArgsListMap;
224
223
  }
225
224
  /// Get function arguments list
226
- inline const PAGNodeList& getFunArgsList(const SVFFunction* func) const
225
+ inline const SVFVarList& getFunArgsList(const SVFFunction* func) const
227
226
  {
228
227
  FunToArgsListMap::const_iterator it = funArgsListMap.find(func);
229
228
  assert(it != funArgsListMap.end() && "this function doesn't have arguments");
@@ -240,7 +239,7 @@ public:
240
239
  return callSiteArgsListMap;
241
240
  }
242
241
  /// Get callsite argument list
243
- inline const PAGNodeList& getCallSiteArgsList(const CallBlockNode* cs) const
242
+ inline const SVFVarList& getCallSiteArgsList(const CallBlockNode* cs) const
244
243
  {
245
244
  CSToArgsListMap::const_iterator it = callSiteArgsListMap.find(cs);
246
245
  assert(it != callSiteArgsListMap.end() && "this call site doesn't have arguments");
@@ -284,19 +283,19 @@ public:
284
283
  //@{
285
284
  inline Size_t getFieldValNodeNum() const
286
285
  {
287
- return GepValNodeMap.size();
286
+ return GepValObjMap.size();
288
287
  }
289
288
  inline Size_t getFieldObjNodeNum() const
290
289
  {
291
- return GepObjNodeMap.size();
290
+ return GepObjVarMap.size();
292
291
  }
293
292
  //@}
294
293
 
295
294
  /// Due to constaint expression, curInst is used to distinguish different instructions (e.g., memorycpy) when creating GepValVar.
296
- inline NodeID getGepValNode(const Value* curInst, NodeID base, const LocationSet& ls) const
295
+ inline NodeID getGepValVar(const Value* curInst, NodeID base, const LocationSet& ls) const
297
296
  {
298
- GepValPNMap::const_iterator iter = GepValNodeMap.find(curInst);
299
- if(iter==GepValNodeMap.end()){
297
+ GepValueVarMap::const_iterator iter = GepValObjMap.find(curInst);
298
+ if(iter==GepValObjMap.end()){
300
299
  return UINT_MAX;
301
300
  }
302
301
  else{
@@ -344,8 +343,8 @@ public:
344
343
  inline SVFStmt* getIntraPAGEdge(SVFVar* src, SVFVar* dst, SVFStmt::PEDGEK kind)
345
344
  {
346
345
  SVFStmt edge(src,dst,kind);
347
- const SVFStmt::PAGEdgeSetTy& edgeSet = getEdgeSet(kind);
348
- SVFStmt::PAGEdgeSetTy::const_iterator it = edgeSet.find(&edge);
346
+ const SVFStmt::SVFStmtSetTy& edgeSet = getSVFStmtSet(kind);
347
+ SVFStmt::SVFStmtSetTy::const_iterator it = edgeSet.find(&edge);
349
348
  assert(it != edgeSet.end() && "can not find pag edge");
350
349
  return (*it);
351
350
  }
@@ -370,21 +369,21 @@ public:
370
369
  //@}
371
370
 
372
371
  /// Get a field SVFIR Object node according to base mem obj and offset
373
- NodeID getGepObjNode(const MemObj* obj, const LocationSet& ls);
372
+ NodeID getGepObjVar(const MemObj* obj, const LocationSet& ls);
374
373
  /// Get a field obj SVFIR node according to a mem obj and a given offset
375
- NodeID getGepObjNode(NodeID id, const LocationSet& ls) ;
374
+ NodeID getGepObjVar(NodeID id, const LocationSet& ls) ;
376
375
  /// Get a field-insensitive obj SVFIR node according to a mem obj
377
376
  //@{
378
- inline NodeID getFIObjNode(const MemObj* obj) const
377
+ inline NodeID getFIObjVar(const MemObj* obj) const
379
378
  {
380
379
  return obj->getId();
381
380
  }
382
- inline NodeID getFIObjNode(NodeID id) const
381
+ inline NodeID getFIObjVar(NodeID id) const
383
382
  {
384
383
  SVFVar* node = pag->getGNode(id);
385
384
  assert(SVFUtil::isa<ObjVar>(node) && "need an object node");
386
385
  ObjVar* obj = SVFUtil::cast<ObjVar>(node);
387
- return getFIObjNode(obj->getMemObj());
386
+ return getFIObjVar(obj->getMemObj());
388
387
  }
389
388
  //@}
390
389
 
@@ -438,9 +437,9 @@ public:
438
437
  /// Base and Offset methods for Value and Object node
439
438
  //@{
440
439
  /// Get a base pointer node given a field pointer
441
- NodeID getBaseValNode(NodeID nodeId);
440
+ NodeID getBaseValVar(NodeID nodeId);
442
441
  LocationSet getLocationSetFromBaseNode(NodeID nodeId);
443
- inline NodeID getBaseObjNode(NodeID id) const
442
+ inline NodeID getBaseObjVar(NodeID id) const
444
443
  {
445
444
  return getBaseObj(id)->getId();
446
445
  }
@@ -455,8 +454,8 @@ public:
455
454
 
456
455
  /// Get all fields of an object
457
456
  //@{
458
- NodeBS& getAllFieldsObjNode(const MemObj* obj);
459
- NodeBS& getAllFieldsObjNode(NodeID id);
457
+ NodeBS& getAllFieldsObjVars(const MemObj* obj);
458
+ NodeBS& getAllFieldsObjVars(NodeID id);
460
459
  NodeBS getFieldsAfterCollapse(NodeID id);
461
460
  //@}
462
461
  inline NodeID addDummyValNode()
@@ -481,12 +480,12 @@ private:
481
480
 
482
481
  /// Map a SVFStatement type to a set of corresponding SVF statements
483
482
  inline void addToStmt2TypeMap(SVFStmt* edge) {
484
- bool added = PAGEdgeKindToSetMap[edge->getEdgeKind()].insert(edge).second;
483
+ bool added = KindToSVFStmtSetMap[edge->getEdgeKind()].insert(edge).second;
485
484
  assert(added && "duplicated edge, not added!!!");
486
485
  if (edge->isPTAEdge())
487
486
  {
488
487
  totalPTAPAGEdge++;
489
- PTAPAGEdgeKindToSetMap[edge->getEdgeKind()].insert(edge);
488
+ KindToPTASVFStmtSetMap[edge->getEdgeKind()].insert(edge);
490
489
  }
491
490
  }
492
491
  /// Get/set method for function/callsite arguments and returns
@@ -553,9 +552,9 @@ private:
553
552
  return addNode(node,i);
554
553
  }
555
554
 
556
- /// Add a temp field value node, this method can only invoked by getGepValNode
555
+ /// Add a temp field value node, this method can only invoked by getGepValVar
557
556
  NodeID addGepValNode(const Value* curInst,const Value* val, const LocationSet& ls, NodeID i, const Type *type, u32_t fieldidx);
558
- /// Add a field obj node, this method can only invoked by getGepObjNode
557
+ /// Add a field obj node, this method can only invoked by getGepObjVar
559
558
  NodeID addGepObjNode(const MemObj* obj, const LocationSet& ls);
560
559
  /// Add a field-insensitive node, this method can only invoked by getFIGepObjNode
561
560
  NodeID addFIObjNode(const MemObj* obj);
@@ -616,7 +615,7 @@ private:
616
615
  /// Add global PAGEdges (not in a procedure)
617
616
  inline void addGlobalPAGEdge(const SVFStmt* edge)
618
617
  {
619
- globPAGEdgesSet.insert(edge);
618
+ globSVFStmtSet.insert(edge);
620
619
  }
621
620
  /// Add callsites
622
621
  inline void addCallSite(const CallBlockNode* call)
@@ -626,33 +625,33 @@ private:
626
625
  /// Add an edge into SVFIR
627
626
  //@{
628
627
  /// Add Address edge
629
- AddrStmt* addAddrPE(NodeID src, NodeID dst);
628
+ AddrStmt* addAddrStmt(NodeID src, NodeID dst);
630
629
  /// Add Copy edge
631
- CopyStmt* addCopyPE(NodeID src, NodeID dst);
630
+ CopyStmt* addCopyStmt(NodeID src, NodeID dst);
632
631
  /// Add phi node information
633
- PhiStmt* addPhiNode(NodeID res, NodeID opnd);
632
+ PhiStmt* addPhiStmt(NodeID res, NodeID opnd);
634
633
  /// Add Copy edge
635
- CmpStmt* addCmpPE(NodeID op1, NodeID op2, NodeID dst, u32_t opcode);
634
+ CmpStmt* addCmpStmt(NodeID op1, NodeID op2, NodeID dst, u32_t predict);
636
635
  /// Add Copy edge
637
- BinaryOPStmt* addBinaryOPPE(NodeID op1, NodeID op2, NodeID dst, u32_t opcode);
636
+ BinaryOPStmt* addBinaryOPStmt(NodeID op1, NodeID op2, NodeID dst, u32_t opcode);
638
637
  /// Add Unary edge
639
- UnaryOPStmt* addUnaryOPPE(NodeID src, NodeID dst, u32_t opcode);
638
+ UnaryOPStmt* addUnaryOPStmt(NodeID src, NodeID dst, u32_t opcode);
640
639
  /// Add BranchStmt
641
640
  BranchStmt* addBranchStmt(NodeID br, NodeID cond, std::vector<const ICFGNode*> succs);
642
641
  /// Add Load edge
643
- LoadStmt* addLoadPE(NodeID src, NodeID dst);
642
+ LoadStmt* addLoadStmt(NodeID src, NodeID dst);
644
643
  /// Add Store edge
645
- StoreStmt* addStorePE(NodeID src, NodeID dst, const IntraBlockNode* val);
644
+ StoreStmt* addStoreStmt(NodeID src, NodeID dst, const IntraBlockNode* val);
646
645
  /// Add Call edge
647
646
  CallPE* addCallPE(NodeID src, NodeID dst, const CallBlockNode* cs);
648
647
  /// Add Return edge
649
648
  RetPE* addRetPE(NodeID src, NodeID dst, const CallBlockNode* cs);
650
649
  /// Add Gep edge
651
- GepStmt* addGepPE(NodeID src, NodeID dst, const LocationSet& ls, bool constGep);
650
+ GepStmt* addGepStmt(NodeID src, NodeID dst, const LocationSet& ls, bool constGep);
652
651
  /// Add Offset(Gep) edge
653
- NormalGepStmt* addNormalGepPE(NodeID src, NodeID dst, const LocationSet& ls);
652
+ NormalGepStmt* addNormalGepStmt(NodeID src, NodeID dst, const LocationSet& ls);
654
653
  /// Add Variant(Gep) edge
655
- VariantGepStmt* addVariantGepPE(NodeID src, NodeID dst);
654
+ VariantGepStmt* addVariantGepStmt(NodeID src, NodeID dst);
656
655
  /// Add Thread fork edge for parameter passing
657
656
  TDForkPE* addThreadForkPE(NodeID src, NodeID dst, const CallBlockNode* cs);
658
657
  /// Add Thread join edge for parameter passing
@@ -660,7 +659,7 @@ private:
660
659
  //@}
661
660
 
662
661
  /// Set a pointer points-to black hole (e.g. int2ptr)
663
- SVFStmt* addBlackHoleAddrPE(NodeID node);
662
+ SVFStmt* addBlackHoleAddrStmt(NodeID node);
664
663
  };
665
664
 
666
665
  typedef SVFIR PAG;
@@ -41,15 +41,15 @@ namespace SVF
41
41
  class SVFVar;
42
42
 
43
43
  /*
44
- * SVFIR edge between nodes
44
+ * SVFIR program statements (PAGEdges)
45
45
  */
46
46
  typedef GenericEdge<SVFVar> GenericPAGEdgeTy;
47
47
  class SVFStmt : public GenericPAGEdgeTy
48
48
  {
49
49
 
50
50
  public:
51
- /// Thirteen kinds of SVFIR edges
52
- /// Gep represents offset edge for field sensitivity
51
+ /// Types of SVFIR statements
52
+ /// Gep represents (base + offset) for field sensitivity
53
53
  /// ThreadFork/ThreadJoin is to model parameter passings between thread spawners and spawnees.
54
54
  enum PEDGEK
55
55
  {
@@ -175,9 +175,10 @@ public:
175
175
  }
176
176
  //@}
177
177
 
178
- typedef GenericNode<SVFVar,SVFStmt>::GEdgeSetTy PAGEdgeSetTy;
179
- typedef Map<EdgeID, PAGEdgeSetTy> PAGEdgeToSetMapTy;
180
- typedef PAGEdgeToSetMapTy PAGKindToEdgeSetMapTy;
178
+ typedef GenericNode<SVFVar,SVFStmt>::GEdgeSetTy SVFStmtSetTy;
179
+ typedef Map<EdgeID, SVFStmtSetTy> PAGEdgeToSetMapTy;
180
+ typedef PAGEdgeToSetMapTy KindToSVFStmtMapTy;
181
+ typedef SVFStmtSetTy PAGEdgeSetTy;
181
182
 
182
183
  private:
183
184
  typedef Map<const ICFGNode*, u32_t> Inst2LabelMap;
@@ -191,7 +192,7 @@ private:
191
192
 
192
193
 
193
194
  /*!
194
- * Copy edge
195
+ * Address statement (memory allocations)
195
196
  */
196
197
  class AddrStmt: public SVFStmt
197
198
  {
@@ -226,7 +227,7 @@ public:
226
227
 
227
228
 
228
229
  /*!
229
- * Copy edge
230
+ * Copy statements (simple assignment and casting)
230
231
  */
231
232
  class CopyStmt: public SVFStmt
232
233
  {
@@ -259,6 +260,9 @@ public:
259
260
  virtual const std::string toString() const override;
260
261
  };
261
262
 
263
+ /*
264
+ * Program statements with multiple operands including BinaryOPStmt, CmpStmt and PhiStmt
265
+ */
262
266
  class MultiOpndStmt : public SVFStmt{
263
267
  public:
264
268
  typedef std::vector<SVFVar*> OPVars;
@@ -323,7 +327,8 @@ public:
323
327
  };
324
328
 
325
329
  /*!
326
- * Phi instruction edge
330
+ * Phi statement (e.g., p = phi(q,r) which receives values from variables q and r from different paths)
331
+ * it is typically at a joint point of the control-flow graph
327
332
  */
328
333
  class PhiStmt: public MultiOpndStmt
329
334
  {
@@ -369,7 +374,7 @@ public:
369
374
 
370
375
 
371
376
  /*!
372
- * Compare instruction edge
377
+ * Comparison statement
373
378
  */
374
379
  class CmpStmt: public MultiOpndStmt
375
380
  {
@@ -382,7 +387,7 @@ private:
382
387
  SVFVar* getSrcID(); ///< place holder, use getOpVarID(pos) instead
383
388
  SVFVar* getDstID(); ///< place holder, use getResID() instead
384
389
 
385
- u32_t opcode;
390
+ u32_t predicate;
386
391
  public:
387
392
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
388
393
  //@{
@@ -405,13 +410,13 @@ public:
405
410
  //@}
406
411
 
407
412
  /// constructor
408
- CmpStmt(SVFVar* s, const OPVars& opnds, u32_t oc) : MultiOpndStmt(s,opnds,SVFStmt::Cmp), opcode(oc)
413
+ CmpStmt(SVFVar* s, const OPVars& opnds, u32_t pre) : MultiOpndStmt(s,opnds,SVFStmt::Cmp), predicate(pre)
409
414
  {
410
415
  }
411
416
 
412
- u32_t getOpcode() const
417
+ u32_t getPredicate() const
413
418
  {
414
- return opcode;
419
+ return predicate;
415
420
  }
416
421
 
417
422
  virtual const std::string toString() const override;
@@ -419,7 +424,7 @@ public:
419
424
 
420
425
 
421
426
  /*!
422
- * Binary instruction edge
427
+ * Binary statement
423
428
  */
424
429
  class BinaryOPStmt: public MultiOpndStmt
425
430
  {
@@ -469,7 +474,7 @@ public:
469
474
  };
470
475
 
471
476
  /*!
472
- * Unary instruction edge
477
+ * Unary statement
473
478
  */
474
479
  class UnaryOPStmt: public SVFStmt
475
480
  {
@@ -586,7 +591,7 @@ public:
586
591
  };
587
592
 
588
593
  /*!
589
- * Store edge
594
+ * Store statement
590
595
  */
591
596
  class StoreStmt: public SVFStmt
592
597
  {
@@ -623,7 +628,7 @@ public:
623
628
 
624
629
 
625
630
  /*!
626
- * Load edge
631
+ * Load statement
627
632
  */
628
633
  class LoadStmt: public SVFStmt
629
634
  {
@@ -659,7 +664,7 @@ public:
659
664
 
660
665
 
661
666
  /*!
662
- * Gep edge
667
+ * Gep statement for field access and pointer arithmetic
663
668
  */
664
669
  class GepStmt: public SVFStmt
665
670
  {
@@ -699,7 +704,7 @@ protected:
699
704
 
700
705
 
701
706
  /*!
702
- * Gep edge with a fixed offset
707
+ * Gep statement with a fixed offset
703
708
  */
704
709
  class NormalGepStmt : public GepStmt
705
710
  {
@@ -749,7 +754,7 @@ public:
749
754
  };
750
755
 
751
756
  /*!
752
- * Gep edge with a variant offset
757
+ * Gep statement with a variant offset
753
758
  */
754
759
  class VariantGepStmt : public GepStmt
755
760
  {
@@ -788,7 +793,7 @@ public:
788
793
 
789
794
 
790
795
  /*!
791
- * Call edge
796
+ * Call
792
797
  */
793
798
  class CallPE: public SVFStmt
794
799
  {
@@ -840,7 +845,7 @@ public:
840
845
 
841
846
 
842
847
  /*!
843
- * Return edge
848
+ * Return
844
849
  */
845
850
  class RetPE: public SVFStmt
846
851
  {
@@ -892,7 +897,7 @@ public:
892
897
 
893
898
 
894
899
  /*!
895
- * Thread Fork Edge
900
+ * Thread Fork
896
901
  */
897
902
  class TDForkPE: public CallPE
898
903
  {
@@ -930,7 +935,7 @@ public:
930
935
 
931
936
 
932
937
  /*!
933
- * Thread Join Edge
938
+ * Thread Join
934
939
  */
935
940
  class TDJoinPE: public RetPE
936
941
  {