svf-lib 1.0.993 → 1.0.994

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 (71) hide show
  1. package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
  2. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  3. package/SVF-osx/include/CFL/CFGNormalizer.h +6 -3
  4. package/SVF-osx/include/CFL/CFLAlias.h +26 -15
  5. package/SVF-osx/include/CFL/CFLGrammar.h +30 -16
  6. package/SVF-osx/include/CFL/CFLSolver.h +9 -5
  7. package/SVF-osx/include/CFL/GrammarBuilder.h +10 -7
  8. package/SVF-osx/include/CUDD/cudd.h +20 -11
  9. package/SVF-osx/include/CUDD/cuddInt.h +48 -31
  10. package/SVF-osx/include/CUDD/epd.h +35 -29
  11. package/SVF-osx/include/CUDD/mtr.h +4 -3
  12. package/SVF-osx/include/CUDD/st.h +7 -4
  13. package/SVF-osx/include/CUDD/util.h +6 -6
  14. package/SVF-osx/include/FastCluster/fastcluster.h +13 -12
  15. package/SVF-osx/include/Graphs/CFLGraph.h +16 -10
  16. package/SVF-osx/include/Graphs/CHG.h +2 -2
  17. package/SVF-osx/include/Graphs/ConsG.h +2 -1
  18. package/SVF-osx/include/Graphs/GenericGraph.h +3 -3
  19. package/SVF-osx/include/Graphs/ICFG.h +2 -2
  20. package/SVF-osx/include/Graphs/ICFGEdge.h +16 -9
  21. package/SVF-osx/include/Graphs/ICFGNode.h +2 -2
  22. package/SVF-osx/include/Graphs/IRGraph.h +10 -6
  23. package/SVF-osx/include/Graphs/PTACallGraph.h +1 -1
  24. package/SVF-osx/include/Graphs/SVFG.h +4 -3
  25. package/SVF-osx/include/Graphs/SVFGNode.h +14 -8
  26. package/SVF-osx/include/Graphs/ThreadCallGraph.h +4 -2
  27. package/SVF-osx/include/Graphs/VFG.h +45 -39
  28. package/SVF-osx/include/Graphs/VFGNode.h +8 -4
  29. package/SVF-osx/include/MSSA/MemSSA.h +1 -1
  30. package/SVF-osx/include/MTA/FSMPTA.h +55 -44
  31. package/SVF-osx/include/MTA/LockAnalysis.h +11 -9
  32. package/SVF-osx/include/MTA/LockResultValidator.h +64 -54
  33. package/SVF-osx/include/MTA/MHP.h +17 -13
  34. package/SVF-osx/include/MTA/MTAResultValidator.h +24 -20
  35. package/SVF-osx/include/MTA/PCG.h +9 -7
  36. package/SVF-osx/include/MTA/TCT.h +27 -22
  37. package/SVF-osx/include/MemoryModel/LocationSet.h +5 -3
  38. package/SVF-osx/include/MemoryModel/PersistentPointsToCache.h +28 -13
  39. package/SVF-osx/include/MemoryModel/PersistentPointsToDS.h +2 -2
  40. package/SVF-osx/include/MemoryModel/PointerAnalysis.h +5 -4
  41. package/SVF-osx/include/MemoryModel/PointsTo.h +8 -2
  42. package/SVF-osx/include/MemoryModel/SVFIR.h +6 -5
  43. package/SVF-osx/include/MemoryModel/SVFStatements.h +65 -45
  44. package/SVF-osx/include/MemoryModel/SVFVariables.h +6 -5
  45. package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +18 -15
  46. package/SVF-osx/include/SABER/PathCondAllocator.h +14 -7
  47. package/SVF-osx/include/SABER/ProgSlice.h +2 -1
  48. package/SVF-osx/include/SABER/SaberSVFGBuilder.h +1 -1
  49. package/SVF-osx/include/SABER/SrcSnkDDA.h +8 -4
  50. package/SVF-osx/include/SVF-FE/CHGBuilder.h +4 -2
  51. package/SVF-osx/include/SVF-FE/DataFlowUtil.h +10 -9
  52. package/SVF-osx/include/SVF-FE/IRAnnotator.h +8 -8
  53. package/SVF-osx/include/SVF-FE/LLVMModule.h +13 -12
  54. package/SVF-osx/include/SVF-FE/LLVMUtil.h +4 -4
  55. package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +13 -9
  56. package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +3 -2
  57. package/SVF-osx/include/Util/BDDExpr.h +32 -16
  58. package/SVF-osx/include/Util/BasicTypes.h +77 -25
  59. package/SVF-osx/include/Util/CoreBitVector.h +2 -1
  60. package/SVF-osx/include/Util/CxtStmt.h +37 -27
  61. package/SVF-osx/include/Util/ExeState.h +42 -22
  62. package/SVF-osx/include/Util/ExtAPI.h +1 -1
  63. package/SVF-osx/include/Util/NodeIDAllocator.h +7 -4
  64. package/SVF-osx/include/Util/Options.h +3 -3
  65. package/SVF-osx/include/Util/SVFBasicTypes.h +49 -40
  66. package/SVF-osx/include/Util/SVFModule.h +5 -5
  67. package/SVF-osx/include/Util/SVFUtil.h +12 -9
  68. package/SVF-osx/include/Util/Z3Expr.h +191 -144
  69. package/SVF-osx/include/WPA/Andersen.h +11 -11
  70. package/SVF-osx/include/WPA/VersionedFlowSensitive.h +4 -1
  71. package/package.json +1 -1
@@ -281,28 +281,33 @@ public:
281
281
  return false;
282
282
  }
283
283
 
284
- /// Return all the VFGNodes of a function
285
- ///@{
286
- inline VFGNodeSet& getVFGNodes(const SVFFunction *fun) {
287
- return funToVFGNodesMap[fun];
288
- }
289
- inline bool hasVFGNodes(const SVFFunction *fun) const {
290
- return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
291
- }
292
- inline bool VFGNodes(const SVFFunction *fun) const {
293
- return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
294
- }
295
- inline VFGNodeSet::const_iterator getVFGNodeBegin(const SVFFunction *fun) const {
296
- FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
297
- assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
298
- return it->second.begin();
299
- }
300
- inline VFGNodeSet::const_iterator getVFGNodeEnd(const SVFFunction *fun) const {
301
- FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
302
- assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
303
- return it->second.end();
304
- }
305
- ///@}
284
+ /// Return all the VFGNodes of a function
285
+ ///@{
286
+ inline VFGNodeSet& getVFGNodes(const SVFFunction *fun)
287
+ {
288
+ return funToVFGNodesMap[fun];
289
+ }
290
+ inline bool hasVFGNodes(const SVFFunction *fun) const
291
+ {
292
+ return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
293
+ }
294
+ inline bool VFGNodes(const SVFFunction *fun) const
295
+ {
296
+ return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
297
+ }
298
+ inline VFGNodeSet::const_iterator getVFGNodeBegin(const SVFFunction *fun) const
299
+ {
300
+ FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
301
+ assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
302
+ return it->second.begin();
303
+ }
304
+ inline VFGNodeSet::const_iterator getVFGNodeEnd(const SVFFunction *fun) const
305
+ {
306
+ FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
307
+ assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
308
+ return it->second.end();
309
+ }
310
+ ///@}
306
311
  /// Add control-flow edges for top level pointers
307
312
  //@{
308
313
  VFGEdge* addIntraDirectVFEdge(NodeID srcId, NodeID dstId);
@@ -462,9 +467,9 @@ protected:
462
467
  icfgNode->addVFGNode(vfgNode);
463
468
 
464
469
  if(const SVFFunction* fun = icfgNode->getFun())
465
- funToVFGNodesMap[fun].insert(vfgNode);
470
+ funToVFGNodesMap[fun].insert(vfgNode);
466
471
  else
467
- globalVFGNodes.insert(vfgNode);
472
+ globalVFGNodes.insert(vfgNode);
468
473
  }
469
474
 
470
475
  /// Add a VFG node for program statement
@@ -545,20 +550,21 @@ protected:
545
550
  /// Otherwise, we need to handle formalRet using <PAGNodeID,CallSiteID> pair to find FormalRetVFG node same as handling actual parameters
546
551
  inline void addFormalRetVFGNode(const PAGNode* uniqueFunRet, const SVFFunction* fun, RetPESet& retPEs)
547
552
  {
548
- FormalRetVFGNode *sNode = new FormalRetVFGNode(totalVFGNode++, uniqueFunRet, fun);
549
- addVFGNode(sNode, pag->getICFG()->getFunExitICFGNode(fun));
550
- for (RetPESet::const_iterator it = retPEs.begin(), eit = retPEs.end(); it != eit; ++it)
551
- sNode->addRetPE(*it);
552
-
553
- PAGNodeToFormalRetMap[uniqueFunRet] = sNode;
554
- /// if this uniqueFunRet is a phi node, which means it will receive values from multiple return instructions of fun
555
- /// we will set this phi node's def later
556
- /// Ideally, every function uniqueFunRet should be a PhiNode (SVFIRBuilder.cpp), unless it does not have ret instruction
557
- if (!pag->isPhiNode(uniqueFunRet)){
558
- std::string warn = fun->getName();
559
- SVFUtil::writeWrnMsg(warn + " does not have any ret instruction!");
560
- setDef(uniqueFunRet, sNode);
561
- }
553
+ FormalRetVFGNode *sNode = new FormalRetVFGNode(totalVFGNode++, uniqueFunRet, fun);
554
+ addVFGNode(sNode, pag->getICFG()->getFunExitICFGNode(fun));
555
+ for (RetPESet::const_iterator it = retPEs.begin(), eit = retPEs.end(); it != eit; ++it)
556
+ sNode->addRetPE(*it);
557
+
558
+ PAGNodeToFormalRetMap[uniqueFunRet] = sNode;
559
+ /// if this uniqueFunRet is a phi node, which means it will receive values from multiple return instructions of fun
560
+ /// we will set this phi node's def later
561
+ /// Ideally, every function uniqueFunRet should be a PhiNode (SVFIRBuilder.cpp), unless it does not have ret instruction
562
+ if (!pag->isPhiNode(uniqueFunRet))
563
+ {
564
+ std::string warn = fun->getName();
565
+ SVFUtil::writeWrnMsg(warn + " does not have any ret instruction!");
566
+ setDef(uniqueFunRet, sNode);
567
+ }
562
568
  }
563
569
  /// Add a callsite Receive VFG node
564
570
  inline void addActualRetVFGNode(const PAGNode* ret,const CallICFGNode* cs)
@@ -619,7 +625,7 @@ protected:
619
625
  setDef(edge->getRes(),sNode);
620
626
  PAGNodeToUnaryOPVFGNodeMap[edge->getRes()] = sNode;
621
627
  }
622
- /// Add a BranchVFGNode
628
+ /// Add a BranchVFGNode
623
629
  inline void addBranchVFGNode(const BranchStmt* edge)
624
630
  {
625
631
  BranchVFGNode* sNode = new BranchVFGNode(totalVFGNode++, edge);
@@ -563,18 +563,22 @@ public:
563
563
  //@}
564
564
 
565
565
  /// Return the branch statement
566
- const BranchStmt* getBranchStmt() const{
566
+ const BranchStmt* getBranchStmt() const
567
+ {
567
568
  return brstmt;
568
569
  }
569
570
  /// Successors of this branch statement
570
571
  ///@{
571
- u32_t getNumSuccessors() const{
572
+ u32_t getNumSuccessors() const
573
+ {
572
574
  return brstmt->getNumSuccessors();
573
575
  }
574
- const BranchStmt::SuccAndCondPairVec& getSuccessors() const{
576
+ const BranchStmt::SuccAndCondPairVec& getSuccessors() const
577
+ {
575
578
  return brstmt->getSuccessors();
576
579
  }
577
- const ICFGNode* getSuccessor (u32_t i) const{
580
+ const ICFGNode* getSuccessor (u32_t i) const
581
+ {
578
582
  return brstmt->getSuccessor(i);
579
583
  }
580
584
  ///@}
@@ -343,7 +343,7 @@ public:
343
343
  inline bool hasCHI(const PAGEdge* inst) const
344
344
  {
345
345
  if (const StoreStmt* store = SVFUtil::dyn_cast<StoreStmt>(
346
- inst))
346
+ inst))
347
347
  {
348
348
  assert(0 != store2ChiSetMap.count(store)
349
349
  && "not associated with mem region!");
@@ -22,40 +22,48 @@ class MHP;
22
22
  class LockAnalysis;
23
23
 
24
24
 
25
- class SVFGNodeLockSpan {
25
+ class SVFGNodeLockSpan
26
+ {
26
27
  public:
27
- SVFGNodeLockSpan(const StmtSVFGNode* SVFGnode, LockAnalysis::LockSpan lockspan) :
28
- SVFGNode(SVFGnode), lockSpan(lockspan) {}
29
- virtual ~SVFGNodeLockSpan() {}
30
-
31
- inline bool operator< (const SVFGNodeLockSpan& rhs) const {
32
- if (SVFGNode != rhs.getSVFGNode())
33
- return SVFGNode < rhs.getSVFGNode();
34
- return lockSpan.size() < rhs.getLockSpan().size();
35
- }
36
- inline SVFGNodeLockSpan& operator= (const SVFGNodeLockSpan& rhs) {
37
- if(*this != rhs) {
38
- SVFGNode = rhs.getSVFGNode();
39
- lockSpan = rhs.getLockSpan();
40
- }
41
- return *this;
42
- }
43
- inline bool operator== (const SVFGNodeLockSpan& rhs) const {
44
- return (SVFGNode == rhs.getSVFGNode() && lockSpan == rhs.getLockSpan());
45
- }
46
- inline bool operator!= (const SVFGNodeLockSpan& rhs) const {
47
- return !(*this == rhs);
48
- }
49
- inline const StmtSVFGNode* getSVFGNode() const {
50
- return SVFGNode;
51
- }
52
- inline const LockAnalysis::LockSpan getLockSpan() const {
53
- return lockSpan;
54
- }
28
+ SVFGNodeLockSpan(const StmtSVFGNode* SVFGnode, LockAnalysis::LockSpan lockspan) :
29
+ SVFGNode(SVFGnode), lockSpan(lockspan) {}
30
+ virtual ~SVFGNodeLockSpan() {}
31
+
32
+ inline bool operator< (const SVFGNodeLockSpan& rhs) const
33
+ {
34
+ if (SVFGNode != rhs.getSVFGNode())
35
+ return SVFGNode < rhs.getSVFGNode();
36
+ return lockSpan.size() < rhs.getLockSpan().size();
37
+ }
38
+ inline SVFGNodeLockSpan& operator= (const SVFGNodeLockSpan& rhs)
39
+ {
40
+ if(*this != rhs)
41
+ {
42
+ SVFGNode = rhs.getSVFGNode();
43
+ lockSpan = rhs.getLockSpan();
44
+ }
45
+ return *this;
46
+ }
47
+ inline bool operator== (const SVFGNodeLockSpan& rhs) const
48
+ {
49
+ return (SVFGNode == rhs.getSVFGNode() && lockSpan == rhs.getLockSpan());
50
+ }
51
+ inline bool operator!= (const SVFGNodeLockSpan& rhs) const
52
+ {
53
+ return !(*this == rhs);
54
+ }
55
+ inline const StmtSVFGNode* getSVFGNode() const
56
+ {
57
+ return SVFGNode;
58
+ }
59
+ inline const LockAnalysis::LockSpan getLockSpan() const
60
+ {
61
+ return lockSpan;
62
+ }
55
63
  private:
56
- const StmtSVFGNode* SVFGNode;
57
- LockAnalysis::LockSpan lockSpan;
58
- };
64
+ const StmtSVFGNode* SVFGNode;
65
+ LockAnalysis::LockSpan lockSpan;
66
+ };
59
67
 
60
68
  /*!
61
69
  * SVFG builder for DDA
@@ -73,7 +81,7 @@ public:
73
81
  typedef Set<const Instruction*> InstSet;
74
82
  typedef std::pair<NodeID,NodeID> NodeIDPair;
75
83
  typedef Map<SVFGNodeLockSpan, bool> PairToBoolMap;
76
-
84
+
77
85
  /// Constructor
78
86
  MTASVFGBuilder(MHP* m, LockAnalysis* la) : SVFGBuilder(), mhp(m), lockana(la)
79
87
  {
@@ -183,11 +191,12 @@ public:
183
191
 
184
192
  /// Initialize analysis
185
193
  void initialize(SVFModule* module);
186
-
187
- inline SVFIR* getPAG() {
188
- return mhp->getTCT()->getPTA()->getPAG();
189
- }
190
-
194
+
195
+ inline SVFIR* getPAG()
196
+ {
197
+ return mhp->getTCT()->getPTA()->getPAG();
198
+ }
199
+
191
200
  /// Create signle instance of flow-sensitive pointer analysis
192
201
  static FSMPTA* createFSMPTA(SVFModule* module, MHP* m, LockAnalysis* la)
193
202
  {
@@ -222,12 +231,14 @@ private:
222
231
 
223
232
  } // End namespace SVF
224
233
 
225
- template <> struct std::hash<SVF::SVFGNodeLockSpan> {
226
- size_t operator()(const SVF::SVFGNodeLockSpan &cs) const {
227
- std::hash<SVF::StmtSVFGNode* >h;
228
- SVF::StmtSVFGNode* node = const_cast<SVF::StmtSVFGNode* > (cs.getSVFGNode());
229
- return h(node);
230
- }
234
+ template <> struct std::hash<SVF::SVFGNodeLockSpan>
235
+ {
236
+ size_t operator()(const SVF::SVFGNodeLockSpan &cs) const
237
+ {
238
+ std::hash<SVF::StmtSVFGNode* >h;
239
+ SVF::StmtSVFGNode* node = const_cast<SVF::StmtSVFGNode* > (cs.getSVFGNode());
240
+ return h(node);
241
+ }
231
242
  };
232
243
 
233
244
  #endif /* FSPTANALYSIS_H_ */
@@ -224,10 +224,11 @@ public:
224
224
  }
225
225
  return find;
226
226
  }
227
-
228
- CxtStmtToCxtLockSet getCSTCLS() {
229
- return cxtStmtToCxtLockSet;
230
- }
227
+
228
+ CxtStmtToCxtLockSet getCSTCLS()
229
+ {
230
+ return cxtStmtToCxtLockSet;
231
+ }
231
232
  /// Touch this context statement
232
233
  inline void touchCxtStmt(CxtStmt& cts)
233
234
  {
@@ -297,11 +298,12 @@ public:
297
298
  }
298
299
  /// Print locks and spans
299
300
  void printLocks(const CxtStmt& cts);
300
-
301
- /// Get tct
302
- TCT* getTCT() {
303
- return tct;
304
- }
301
+
302
+ /// Get tct
303
+ TCT* getTCT()
304
+ {
305
+ return tct;
306
+ }
305
307
  private:
306
308
  /// Handle fork
307
309
  void handleFork(const CxtStmt& cts);
@@ -13,53 +13,61 @@
13
13
 
14
14
  /* Validate the result of lock analysis */
15
15
 
16
- namespace SVF {
17
- class LockResultValidator {
16
+ namespace SVF
17
+ {
18
+ class LockResultValidator
19
+ {
18
20
  public:
19
- typedef Set<std::string> CxtLockSetStr;
20
- typedef Map<const Instruction*, CxtLockSetStr> CxtStmtToCxtLockS;
21
-
22
- typedef unsigned LOCK_FLAG;
23
-
24
- LockResultValidator(LockAnalysis* la) : _la(la) {
25
- _mod = _la->getTCT()->getSVFModule();
26
- }
27
-
28
- ~LockResultValidator() {}
29
-
30
- void analyze();
31
-
32
- inline SVFModule* getModule() const {
33
- return _mod;
34
- }
21
+ typedef Set<std::string> CxtLockSetStr;
22
+ typedef Map<const Instruction*, CxtLockSetStr> CxtStmtToCxtLockS;
23
+
24
+ typedef unsigned LOCK_FLAG;
25
+
26
+ LockResultValidator(LockAnalysis* la) : _la(la)
27
+ {
28
+ _mod = _la->getTCT()->getSVFModule();
29
+ }
30
+
31
+ ~LockResultValidator() {}
32
+
33
+ void analyze();
34
+
35
+ inline SVFModule* getModule() const
36
+ {
37
+ return _mod;
38
+ }
35
39
  private:
36
- // Get CallICFGNode
37
- inline CallICFGNode* getCBN(const Instruction* inst) {
38
- return _la->getTCT()->getCallICFGNode(inst);
39
- }
40
- const Instruction *getPreviousMemoryAccessInst( const Instruction *I) {
40
+ // Get CallICFGNode
41
+ inline CallICFGNode* getCBN(const Instruction* inst)
42
+ {
43
+ return _la->getTCT()->getCallICFGNode(inst);
44
+ }
45
+ const Instruction *getPreviousMemoryAccessInst( const Instruction *I)
46
+ {
41
47
  I = I->getPrevNode();
42
48
  while (I)
43
49
  {
44
50
  if (SVFUtil::isa<LoadInst>(I) || SVFUtil::isa<StoreInst>(I))
45
51
  return I;
46
52
  SVFFunction* callee = nullptr;
47
-
48
- if(SVFUtil::isa<CallInst> (I)) {
49
- PTACallGraph::FunctionSet callees;
50
- _la->getTCT()->getThreadCallGraph()->getCallees(getCBN(I), callees);
51
-
52
- for(PTACallGraph::FunctionSet::const_iterator cit = callees.begin(),
53
- ecit = callees.end(); cit!=ecit; cit++)
54
- {
55
- if(*cit != nullptr) {
56
- callee = const_cast<SVFFunction*> (*cit);
57
- break;
58
- }
59
-
60
- }
53
+
54
+ if(SVFUtil::isa<CallInst> (I))
55
+ {
56
+ PTACallGraph::FunctionSet callees;
57
+ _la->getTCT()->getThreadCallGraph()->getCallees(getCBN(I), callees);
58
+
59
+ for(PTACallGraph::FunctionSet::const_iterator cit = callees.begin(),
60
+ ecit = callees.end(); cit!=ecit; cit++)
61
+ {
62
+ if(*cit != nullptr)
63
+ {
64
+ callee = const_cast<SVFFunction*> (*cit);
65
+ break;
66
+ }
67
+
68
+ }
61
69
  }
62
-
70
+
63
71
  if (callee)
64
72
  {
65
73
  if (ExtAPI::EFT_L_A0__A0R_A1R == ExtAPI::getExtAPI()->get_type(callee)
@@ -70,39 +78,41 @@ private:
70
78
  }
71
79
  return nullptr;
72
80
  }
73
-
74
- inline bool inFilter(std::string name) {
75
- return filterFun.find(name) != filterFun.end();
81
+
82
+ inline bool inFilter(std::string name)
83
+ {
84
+ return filterFun.find(name) != filterFun.end();
76
85
  }
77
-
78
- inline bool match(std::string lockName, CxtLockSetStr LS) {
79
- return LS.find(lockName) != LS.end();
86
+
87
+ inline bool match(std::string lockName, CxtLockSetStr LS)
88
+ {
89
+ return LS.find(lockName) != LS.end();
80
90
  }
81
-
91
+
82
92
  Set<std::string> &split(const std::string &s, char delim, Set<std::string> &elems);
83
93
  Set<std::string> split(const std::string &s, char delim);
84
-
94
+
85
95
  std::string getOutput(const char* scenario, LOCK_FLAG analysisRes);
86
-
96
+
87
97
  Set<std::string> getStringArg(const Instruction* inst, unsigned int arg_num);
88
-
98
+
89
99
  bool collectLockTargets();
90
100
  LOCK_FLAG validateStmtInLock();
91
-
101
+
92
102
  CxtStmtToCxtLockS instToCxtLockSet;
93
103
  LockAnalysis::CxtStmtToCxtLockSet cxtStmtToCxtLockSet;
94
104
  LockAnalysis::CxtLockSet cxtLockSet;
95
-
105
+
96
106
  LockAnalysis* _la;
97
107
  SVFModule* _mod;
98
-
108
+
99
109
  static const LOCK_FLAG LOCK_TRUE = 0x01;
100
110
  static const LOCK_FLAG LOCK_IMPRECISE = 0x02;
101
111
  static const LOCK_FLAG LOCK_UNSOUND = 0x04;
102
-
112
+
103
113
  static constexpr char const *LOCK = "LOCK";
104
-
114
+
105
115
  Set<std::string> filterFun = {"LOCK", "INTERLEV_ACCESS", "PAUSE", "CXT_THREAD", "TCT_ACCESS"};
106
- };
116
+ };
107
117
  } // End namespace SVF
108
118
  #endif /* LOCKRESULTVALIDATOR_H_ */
@@ -60,11 +60,12 @@ public:
60
60
  {
61
61
  return tct;
62
62
  }
63
-
64
- // Get CallICFGNode
65
- inline CallICFGNode* getCBN(const Instruction* inst) {
66
- return tct->getCallICFGNode(inst);
67
- }
63
+
64
+ // Get CallICFGNode
65
+ inline CallICFGNode* getCBN(const Instruction* inst)
66
+ {
67
+ return tct->getCallICFGNode(inst);
68
+ }
68
69
 
69
70
  /// Whether the function is connected from main function in thread call graph
70
71
  bool isConnectedfromMain(const Function* fun);
@@ -115,11 +116,12 @@ public:
115
116
  void printInterleaving();
116
117
 
117
118
  private:
118
-
119
- inline const PTACallGraph::FunctionSet& getCallee(const Instruction* inst, PTACallGraph::FunctionSet& callees) {
119
+
120
+ inline const PTACallGraph::FunctionSet& getCallee(const Instruction* inst, PTACallGraph::FunctionSet& callees)
121
+ {
120
122
  tcg->getCallees(getCBN(inst), callees);
121
123
  return callees;
122
- }
124
+ }
123
125
  /// Update non-candidate functions' interleaving.
124
126
  /// Copy interleaving threads of the entry inst to other insts.
125
127
  void updateNonCandidateFunInterleaving();
@@ -380,9 +382,10 @@ private:
380
382
  return tct->getPTA()->alias(getForkedThread(forkSite), getJoinedThread(joinSite)) && isSameSCEV(forkSite,joinSite);
381
383
  }
382
384
  // Get CallICFGNode
383
- inline CallICFGNode* getCBN(const Instruction* inst) {
384
- return tct->getCallICFGNode(inst);
385
- }
385
+ inline CallICFGNode* getCBN(const Instruction* inst)
386
+ {
387
+ return tct->getCallICFGNode(inst);
388
+ }
386
389
  /// Mark thread flags for cxtStmt
387
390
  //@{
388
391
  /// Get the flag for a cxtStmt
@@ -485,10 +488,11 @@ private:
485
488
  {
486
489
  return getTCG()->getThreadAPI()->getJoinedThread(call);
487
490
  }
488
- inline const PTACallGraph::FunctionSet& getCallee(const Instruction* inst, PTACallGraph::FunctionSet& callees) {
491
+ inline const PTACallGraph::FunctionSet& getCallee(const Instruction* inst, PTACallGraph::FunctionSet& callees)
492
+ {
489
493
  getTCG()->getCallees(getCBN(inst), callees);
490
494
  return callees;
491
- }
495
+ }
492
496
  /// ThreadCallGraph
493
497
  inline ThreadCallGraph* getTCG() const
494
498
  {
@@ -14,9 +14,10 @@
14
14
  * Validate the result of context-sensitive analysis, including context-sensitive
15
15
  * thread detection and thread interleaving.
16
16
  */
17
- namespace SVF{
18
- typedef unsigned NodeID;
19
-
17
+ namespace SVF
18
+ {
19
+ typedef unsigned NodeID;
20
+
20
21
  class MTAResultValidator
21
22
  {
22
23
 
@@ -36,9 +37,10 @@ public:
36
37
 
37
38
  // Analysis
38
39
  void analyze();
39
- inline SVFModule* getModule() const {
40
- return mod;
41
- }
40
+ inline SVFModule* getModule() const
41
+ {
42
+ return mod;
43
+ }
42
44
  protected:
43
45
 
44
46
  /*
@@ -132,12 +134,12 @@ private:
132
134
  ThreadAPI* tdAPI;
133
135
  ThreadCallGraph* tcg;
134
136
  MHP* mhp;
135
- vthdToCxtMap vthdToCxt;
136
- vthdTorthdMap vthdTorthd;
137
- rthdTovthdMap rthdTovthd;
138
- csnumToInst csnumToInstMap;
139
- rthdToChildrenMap rthdToChildren;
140
- SVFModule* mod;
137
+ vthdToCxtMap vthdToCxt;
138
+ vthdTorthdMap vthdTorthd;
139
+ rthdTovthdMap rthdTovthd;
140
+ csnumToInst csnumToInstMap;
141
+ rthdToChildrenMap rthdToChildren;
142
+ SVFModule* mod;
141
143
  /// Constant INTERLEV_FLAG values
142
144
  //@{
143
145
  static const INTERLEV_FLAG INTERLEV_TRUE = 0x01;
@@ -274,13 +276,15 @@ protected:
274
276
  // Collect call sites of all RC_ACCESS function calls.
275
277
  std::vector<const CallInst*> csInsts;
276
278
  const Function *F = nullptr;
277
- for(auto it = M->llvmFunBegin(); it != M->llvmFunEnd(); it++){
278
- const std::string fName = (*it)->getName().str();
279
- if(fName.find(RC_ACCESS) != std::string::npos) {
280
- F = (*it);
281
- break;
282
- }
283
- }
279
+ for(auto it = M->llvmFunBegin(); it != M->llvmFunEnd(); it++)
280
+ {
281
+ const std::string fName = (*it)->getName().str();
282
+ if(fName.find(RC_ACCESS) != std::string::npos)
283
+ {
284
+ F = (*it);
285
+ break;
286
+ }
287
+ }
284
288
  if (!F) return;
285
289
 
286
290
  for (Value::const_use_iterator it = F->use_begin(), ie =
@@ -409,7 +413,7 @@ private:
409
413
  {
410
414
  if (SVFUtil::isa<LoadInst>(I) || SVFUtil::isa<StoreInst>(I))
411
415
  return I;
412
-
416
+
413
417
  if (const SVFFunction *callee = SVFUtil::getCallee(I))
414
418
  {
415
419
  if (ExtAPI::EFT_L_A0__A0R_A1R == ExtAPI::getExtAPI()->get_type(callee)
@@ -122,13 +122,15 @@ public:
122
122
  virtual ~PCG()
123
123
  {
124
124
  }
125
-
126
- CallICFGNode* getCallICFGNode(const Instruction* inst) {
127
- return pta->getICFG()->getCallICFGNode(inst);
128
- }
129
- const SVFFunction* getSVFFun(const Function* fun) const {
130
- return LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(fun);
131
- }
125
+
126
+ CallICFGNode* getCallICFGNode(const Instruction* inst)
127
+ {
128
+ return pta->getICFG()->getCallICFGNode(inst);
129
+ }
130
+ const SVFFunction* getSVFFun(const Function* fun) const
131
+ {
132
+ return LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(fun);
133
+ }
132
134
  /// Interface to query whether two function may happen-in-parallel
133
135
  virtual bool mayHappenInParallel(const Instruction* i1, const Instruction* i2) const;
134
136
  bool mayHappenInParallelBetweenFunctions(const Function* fun1, const Function* fun2) const;