svf-lib 1.0.1819 → 1.0.1821

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 (121) hide show
  1. package/SVF-linux/Release-build/svf/libSvfCore.a +0 -0
  2. package/SVF-linux/svf/include/AbstractExecution/CFBasicBlockGWTO.h +83 -0
  3. package/SVF-linux/svf/include/AbstractExecution/ICFGWTO.h +78 -0
  4. package/SVF-linux/svf/include/DDA/DDAPass.h +2 -2
  5. package/SVF-linux/svf/include/DDA/DDAVFSolver.h +2 -2
  6. package/SVF-linux/svf/include/Graphs/SCC.h +354 -0
  7. package/SVF-linux/svf/include/Graphs/SVFGStat.h +1 -1
  8. package/SVF-linux/svf/include/Graphs/WTO.h +859 -0
  9. package/SVF-linux/svf/include/MSSA/MemRegion.h +3 -3
  10. package/SVF-linux/svf/include/MTA/TCT.h +2 -2
  11. package/SVF-linux/svf/include/MemoryModel/PointerAnalysis.h +5 -5
  12. package/SVF-linux/svf/include/WPA/CSC.h +3 -3
  13. package/SVF-osx/Release-build/svf/libSvfCore.a +0 -0
  14. package/SVF-osx/Release-build/svf-llvm/libSvfLLVM.a +0 -0
  15. package/SVF-osx/svf/include/AbstractExecution/BoundedZ3Expr.h +2 -0
  16. package/SVF-osx/svf/include/AbstractExecution/CFBasicBlockGWTO.h +83 -0
  17. package/SVF-osx/svf/include/AbstractExecution/ConsExeState.h +8 -0
  18. package/SVF-osx/svf/include/AbstractExecution/ExeState.h +8 -0
  19. package/SVF-osx/svf/include/AbstractExecution/ICFGWTO.h +78 -0
  20. package/SVF-osx/svf/include/AbstractExecution/IntervalExeState.h +7 -0
  21. package/SVF-osx/svf/include/AbstractExecution/IntervalValue.h +3 -0
  22. package/SVF-osx/svf/include/AbstractExecution/NumericLiteral.h +2 -0
  23. package/SVF-osx/svf/include/AbstractExecution/RelExeState.h +1 -0
  24. package/SVF-osx/svf/include/AbstractExecution/RelationSolver.h +1 -0
  25. package/SVF-osx/svf/include/AbstractExecution/SVFIR2ConsExeState.h +1 -0
  26. package/SVF-osx/svf/include/AbstractExecution/SVFIR2ItvExeState.h +4 -0
  27. package/SVF-osx/svf/include/AbstractExecution/SingleAbsValue.h +2 -0
  28. package/SVF-osx/svf/include/AbstractExecution/SymState.h +4 -0
  29. package/SVF-osx/svf/include/CFL/CFGrammar.h +4 -0
  30. package/SVF-osx/svf/include/CFL/CFLAlias.h +1 -0
  31. package/SVF-osx/svf/include/CFL/CFLGraphBuilder.h +1 -0
  32. package/SVF-osx/svf/include/CFL/CFLStat.h +1 -0
  33. package/SVF-osx/svf/include/CFL/CFLVF.h +1 -0
  34. package/SVF-osx/svf/include/DDA/ContextDDA.h +1 -0
  35. package/SVF-osx/svf/include/DDA/DDAClient.h +5 -0
  36. package/SVF-osx/svf/include/DDA/DDAPass.h +3 -2
  37. package/SVF-osx/svf/include/DDA/DDAVFSolver.h +2 -2
  38. package/SVF-osx/svf/include/FastCluster/fastcluster.h +1 -0
  39. package/SVF-osx/svf/include/Graphs/CDG.h +3 -0
  40. package/SVF-osx/svf/include/Graphs/CFBasicBlockG.h +3 -0
  41. package/SVF-osx/svf/include/Graphs/CFLGraph.h +1 -0
  42. package/SVF-osx/svf/include/Graphs/CHG.h +4 -2
  43. package/SVF-osx/svf/include/Graphs/ConsGEdge.h +5 -0
  44. package/SVF-osx/svf/include/Graphs/ConsGNode.h +1 -0
  45. package/SVF-osx/svf/include/Graphs/DOTGraphTraits.h +1 -0
  46. package/SVF-osx/svf/include/Graphs/GenericGraph.h +1 -0
  47. package/SVF-osx/svf/include/Graphs/GraphPrinter.h +3 -0
  48. package/SVF-osx/svf/include/Graphs/GraphTraits.h +2 -2
  49. package/SVF-osx/svf/include/Graphs/ICFG.h +1 -0
  50. package/SVF-osx/svf/include/Graphs/ICFGNode.h +3 -0
  51. package/SVF-osx/svf/include/Graphs/ICFGStat.h +2 -0
  52. package/SVF-osx/svf/include/Graphs/IRGraph.h +1 -0
  53. package/SVF-osx/svf/include/Graphs/PTACallGraph.h +3 -0
  54. package/SVF-osx/svf/include/Graphs/SCC.h +354 -0
  55. package/SVF-osx/svf/include/Graphs/SVFG.h +2 -0
  56. package/SVF-osx/svf/include/Graphs/SVFGEdge.h +1 -0
  57. package/SVF-osx/svf/include/Graphs/SVFGNode.h +7 -0
  58. package/SVF-osx/svf/include/Graphs/SVFGOPT.h +3 -0
  59. package/SVF-osx/svf/include/Graphs/SVFGStat.h +3 -1
  60. package/SVF-osx/svf/include/Graphs/ThreadCallGraph.h +3 -0
  61. package/SVF-osx/svf/include/Graphs/VFG.h +2 -0
  62. package/SVF-osx/svf/include/Graphs/VFGEdge.h +3 -0
  63. package/SVF-osx/svf/include/Graphs/VFGNode.h +8 -0
  64. package/SVF-osx/svf/include/Graphs/WTO.h +859 -0
  65. package/SVF-osx/svf/include/MSSA/MSSAMuChi.h +4 -0
  66. package/SVF-osx/svf/include/MSSA/MemPartition.h +1 -0
  67. package/SVF-osx/svf/include/MSSA/MemRegion.h +4 -3
  68. package/SVF-osx/svf/include/MSSA/MemSSA.h +1 -0
  69. package/SVF-osx/svf/include/MTA/FSMPTA.h +6 -0
  70. package/SVF-osx/svf/include/MTA/LockAnalysis.h +5 -0
  71. package/SVF-osx/svf/include/MTA/MHP.h +3 -0
  72. package/SVF-osx/svf/include/MTA/MTA.h +1 -0
  73. package/SVF-osx/svf/include/MTA/MTAResultValidator.h +2 -0
  74. package/SVF-osx/svf/include/MTA/TCT.h +3 -2
  75. package/SVF-osx/svf/include/MemoryModel/AbstractPointsToDS.h +2 -0
  76. package/SVF-osx/svf/include/MemoryModel/AccessPath.h +5 -0
  77. package/SVF-osx/svf/include/MemoryModel/ConditionalPT.h +5 -0
  78. package/SVF-osx/svf/include/MemoryModel/PersistentPointsToDS.h +1 -0
  79. package/SVF-osx/svf/include/MemoryModel/PointerAnalysis.h +6 -5
  80. package/SVF-osx/svf/include/MemoryModel/PointerAnalysisImpl.h +1 -0
  81. package/SVF-osx/svf/include/MemoryModel/PointsTo.h +1 -0
  82. package/SVF-osx/svf/include/SABER/DoubleFreeChecker.h +1 -0
  83. package/SVF-osx/svf/include/SABER/ProgSlice.h +1 -0
  84. package/SVF-osx/svf/include/SABER/SaberCondAllocator.h +4 -0
  85. package/SVF-osx/svf/include/SABER/SaberSVFGBuilder.h +1 -0
  86. package/SVF-osx/svf/include/SVFIR/SVFIR.h +2 -0
  87. package/SVF-osx/svf/include/SVFIR/SVFStatements.h +2 -0
  88. package/SVF-osx/svf/include/SVFIR/SVFType.h +2 -0
  89. package/SVF-osx/svf/include/SVFIR/SVFValue.h +3 -0
  90. package/SVF-osx/svf/include/SVFIR/SVFVariables.h +5 -0
  91. package/SVF-osx/svf/include/SVFIR/SymbolTableInfo.h +5 -0
  92. package/SVF-osx/svf/include/Util/CDGBuilder.h +8 -0
  93. package/SVF-osx/svf/include/Util/CallGraphBuilder.h +2 -0
  94. package/SVF-osx/svf/include/Util/Casting.h +2 -1
  95. package/SVF-osx/svf/include/Util/CommandLine.h +1 -0
  96. package/SVF-osx/svf/include/Util/CxtStmt.h +4 -0
  97. package/SVF-osx/svf/include/Util/DPItem.h +2 -0
  98. package/SVF-osx/svf/include/Util/NodeIDAllocator.h +2 -2
  99. package/SVF-osx/svf/include/Util/PTAStat.h +1 -0
  100. package/SVF-osx/svf/include/Util/SVFBugReport.h +1 -0
  101. package/SVF-osx/svf/include/Util/SVFStat.h +1 -0
  102. package/SVF-osx/svf/include/Util/SVFUtil.h +1 -0
  103. package/SVF-osx/svf/include/Util/ThreadAPI.h +1 -0
  104. package/SVF-osx/svf/include/Util/WorkList.h +1 -0
  105. package/SVF-osx/svf/include/Util/Z3Expr.h +4 -0
  106. package/SVF-osx/svf/include/Util/iterator.h +2 -2
  107. package/SVF-osx/svf/include/WPA/Andersen.h +6 -0
  108. package/SVF-osx/svf/include/WPA/AndersenPWC.h +3 -0
  109. package/SVF-osx/svf/include/WPA/CSC.h +3 -3
  110. package/SVF-osx/svf/include/WPA/WPAFSSolver.h +5 -0
  111. package/SVF-osx/svf/include/WPA/WPAPass.h +2 -0
  112. package/SVF-osx/svf/include/WPA/WPASolver.h +2 -0
  113. package/SVF-osx/svf/include/WPA/WPAStat.h +1 -0
  114. package/SVF-osx/svf-llvm/include/SVF-LLVM/BreakConstantExpr.h +1 -0
  115. package/SVF-osx/svf-llvm/include/SVF-LLVM/DCHG.h +1 -0
  116. package/SVF-osx/svf-llvm/include/SVF-LLVM/GEPTypeBridgeIterator.h +3 -0
  117. package/SVF-osx/svf-llvm/include/SVF-LLVM/LLVMModule.h +1 -0
  118. package/SVF-osx/svf-llvm/include/SVF-LLVM/LLVMUtil.h +1 -0
  119. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +1 -0
  120. package/SVF-osx/svf-llvm/include/SVF-LLVM/SymbolTableBuilder.h +1 -0
  121. package/package.json +1 -1
@@ -79,6 +79,7 @@ public:
79
79
  }
80
80
  //@}
81
81
 
82
+
82
83
  private:
83
84
  Set<BranchCondition> brConditions;
84
85
  };
@@ -113,6 +114,7 @@ public:
113
114
  return _icfgNode;
114
115
  }
115
116
 
117
+
116
118
  private:
117
119
  const ICFGNode *_icfgNode;
118
120
  };
@@ -140,6 +142,7 @@ private:
140
142
 
141
143
  }
142
144
 
145
+
143
146
  public:
144
147
  /// Singleton design here to make sure we only have one instance during any analysis
145
148
  //@{
@@ -376,6 +376,7 @@ public:
376
376
  return hasGNode(id);
377
377
  }
378
378
 
379
+
379
380
  bool hasCFBasicBlockEdge(CFBasicBlockNode *src, CFBasicBlockNode *dst, ICFGEdge *icfgEdge)
380
381
  {
381
382
  CFBasicBlockEdge edge(src, dst, icfgEdge);
@@ -435,6 +436,7 @@ public:
435
436
  _totalCFBasicBlockNode--;
436
437
  }
437
438
 
439
+
438
440
  /// Remove node from nodeID
439
441
  inline bool removeCFBBNode(NodeID id)
440
442
  {
@@ -466,6 +468,7 @@ public:
466
468
 
467
469
  }
468
470
 
471
+
469
472
  namespace SVF
470
473
  {
471
474
  /* !
@@ -71,6 +71,7 @@ public:
71
71
  }
72
72
  };
73
73
 
74
+
74
75
  typedef GenericNode<CFLNode,CFLEdge> GenericCFLNodeTy;
75
76
  class CFLNode: public GenericCFLNodeTy
76
77
  {
@@ -73,6 +73,7 @@ protected:
73
73
  CHGKind kind;
74
74
  };
75
75
 
76
+
76
77
  typedef GenericEdge<CHNode> GenericCHEdgeTy;
77
78
  class CHEdge: public GenericCHEdgeTy
78
79
  {
@@ -313,6 +314,7 @@ public:
313
314
  return chg->getKind() == Standard;
314
315
  }
315
316
 
317
+
316
318
  private:
317
319
  SVFModule* svfMod;
318
320
  u32_t classNum;
@@ -348,8 +350,8 @@ struct GenericGraphTraits<SVF::CHNode*>
348
350
  /// for inverse traversal.
349
351
  template <>
350
352
  struct GenericGraphTraits<Inverse<SVF::CHNode*>>
351
- : public GenericGraphTraits<
352
- Inverse<SVF::GenericNode<SVF::CHNode, SVF::CHEdge>*>>
353
+ : public GenericGraphTraits<
354
+ Inverse<SVF::GenericNode<SVF::CHNode, SVF::CHEdge>*>>
353
355
  {
354
356
  };
355
357
 
@@ -86,6 +86,7 @@ public:
86
86
 
87
87
  };
88
88
 
89
+
89
90
  /*!
90
91
  * Copy edge
91
92
  */
@@ -116,6 +117,7 @@ public:
116
117
  AddrCGEdge(ConstraintNode* s, ConstraintNode* d, EdgeID id);
117
118
  };
118
119
 
120
+
119
121
  /*!
120
122
  * Copy edge
121
123
  */
@@ -148,6 +150,7 @@ public:
148
150
  }
149
151
  };
150
152
 
153
+
151
154
  /*!
152
155
  * Store edge
153
156
  */
@@ -181,6 +184,7 @@ public:
181
184
  }
182
185
  };
183
186
 
187
+
184
188
  /*!
185
189
  * Load edge
186
190
  */
@@ -214,6 +218,7 @@ public:
214
218
  }
215
219
  };
216
220
 
221
+
217
222
  /*!
218
223
  * Gep edge
219
224
  */
@@ -383,6 +383,7 @@ public:
383
383
  }
384
384
  //@}
385
385
 
386
+
386
387
  };
387
388
 
388
389
  } // End namespace SVF
@@ -172,6 +172,7 @@ public:
172
172
  static void addCustomGraphFeatures(const GraphType &, GraphWriter &) {}
173
173
  };
174
174
 
175
+
175
176
  /// DOTGraphTraits - Template class that can be specialized to customize how
176
177
  /// graphs are converted to 'dot' graphs. When specializing, you may inherit
177
178
  /// from DefaultDOTGraphTraits if you don't need to override everything.
@@ -133,6 +133,7 @@ protected:
133
133
  static constexpr u64_t EdgeKindMask = (~0ULL) >> (64 - EdgeKindMaskBits);
134
134
  };
135
135
 
136
+
136
137
  /*!
137
138
  * Generic node on the graph as base class
138
139
  */
@@ -20,6 +20,7 @@
20
20
  //
21
21
  //===----------------------------------------------------------------------===//
22
22
 
23
+
23
24
  /*
24
25
  * GraphPrinter.h
25
26
  *
@@ -105,4 +106,6 @@ public:
105
106
 
106
107
  } // End namespace llvm
107
108
 
109
+
110
+
108
111
  #endif /* INCLUDE_GRAPHS_GRAPHPRINTER_H_ */
@@ -115,7 +115,7 @@ nodes(const GraphType &G)
115
115
  }
116
116
  template <class GraphType>
117
117
  iter_range<typename GenericGraphTraits<Inverse<GraphType>>::nodes_iterator>
118
- inverse_nodes(const GraphType &G)
118
+ inverse_nodes(const GraphType &G)
119
119
  {
120
120
  return make_range(GenericGraphTraits<Inverse<GraphType>>::nodes_begin(G),
121
121
  GenericGraphTraits<Inverse<GraphType>>::nodes_end(G));
@@ -131,7 +131,7 @@ children(const typename GenericGraphTraits<GraphType>::NodeRef &G)
131
131
 
132
132
  template <class GraphType>
133
133
  iter_range<typename GenericGraphTraits<Inverse<GraphType>>::ChildIteratorType>
134
- inverse_children(const typename GenericGraphTraits<GraphType>::NodeRef &G)
134
+ inverse_children(const typename GenericGraphTraits<GraphType>::NodeRef &G)
135
135
  {
136
136
  return make_range(GenericGraphTraits<Inverse<GraphType>>::child_begin(G),
137
137
  GenericGraphTraits<Inverse<GraphType>>::child_end(G));
@@ -76,6 +76,7 @@ private:
76
76
  GlobalICFGNode* globalBlockNode; ///< unique basic block for all globals
77
77
  ICFGNodeToSVFLoopVec icfgNodeToSVFLoopVec; ///< map ICFG node to the SVF loops where it resides
78
78
 
79
+
79
80
  public:
80
81
  /// Constructor
81
82
  ICFG();
@@ -94,6 +94,7 @@ public:
94
94
  return bb;
95
95
  }
96
96
 
97
+
97
98
  /// Overloading operator << for dumping ICFG node ID
98
99
  //@{
99
100
  friend OutStream &operator<<(OutStream &o, const ICFGNode &node)
@@ -253,6 +254,7 @@ public:
253
254
  //@}
254
255
  };
255
256
 
257
+
256
258
  /*!
257
259
  * Function entry ICFGNode containing a set of FormalParmVFGNodes of a function
258
260
  */
@@ -478,6 +480,7 @@ public:
478
480
  virtual const std::string toString() const;
479
481
  };
480
482
 
483
+
481
484
  /*!
482
485
  * Return ICFGNode containing (at most one) ActualRetVFGNode at a callsite
483
486
  */
@@ -123,6 +123,7 @@ public:
123
123
  else if (SVFUtil::isa<FunExitICFGNode>(node))
124
124
  numOfExitNodes++;
125
125
 
126
+
126
127
  ICFGEdge::ICFGEdgeSetTy::iterator edgeIt =
127
128
  it->second->OutEdgeBegin();
128
129
  ICFGEdge::ICFGEdgeSetTy::iterator edgeEit =
@@ -160,3 +161,4 @@ public:
160
161
  } // End namespace SVF
161
162
 
162
163
  #endif /* INCLUDE_UTIL_ICFGSTAT_H_ */
164
+
@@ -27,6 +27,7 @@
27
27
  * Author: Yulei Sui
28
28
  */
29
29
 
30
+
30
31
  #ifndef IRGRAPH_H_
31
32
  #define IRGRAPH_H_
32
33
 
@@ -41,6 +41,7 @@ namespace SVF
41
41
  class PTACallGraphNode;
42
42
  class SVFModule;
43
43
 
44
+
44
45
  /*
45
46
  * Call Graph edge representing a calling relation between two functions
46
47
  * Multiple calls from function A to B are merged into one call edge
@@ -57,6 +58,7 @@ public:
57
58
  CallRetEdge,TDForkEdge,TDJoinEdge,HareParForEdge
58
59
  };
59
60
 
61
+
60
62
  private:
61
63
  CallInstSet directCalls;
62
64
  CallInstSet indirectCalls;
@@ -196,6 +198,7 @@ public:
196
198
  /// Return TRUE if this function can be reached from main.
197
199
  bool isReachableFromProgEntry() const;
198
200
 
201
+
199
202
  /// Overloading operator << for dumping ICFG node ID
200
203
  //@{
201
204
  friend OutStream& operator<< (OutStream &o, const PTACallGraphNode &node)
@@ -0,0 +1,354 @@
1
+ //===- SCC.h -- SCC detection algorithm---------------------------------------//
2
+ //
3
+ // SVF: Static Value-Flow Analysis
4
+ //
5
+ // Copyright (C) <2013-2017> <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
+ * SCC.h
25
+ *
26
+ * Esko Nuutila and Eljas Soisalon-Soininen, "On finding the
27
+ * strongly connected components in a directed graph".
28
+ * Inf. Process. Letters, 49(1):9-14, 1994.
29
+ *
30
+ * The implementation is derived from the pseudo code in the following paper:
31
+ * Pereira and Berlin, "Wave Propagation and Deep Propagation for Pointer Analysis",
32
+ * CGO 2009, 126-135, 2009.
33
+ *
34
+ * And influenced by implementation from Open64 compiler
35
+ *
36
+ * Created on: Jul 12, 2013
37
+ * Author: yusui
38
+ */
39
+
40
+ #ifndef SCC_H_
41
+ #define SCC_H_
42
+
43
+ #include "SVFIR/SVFValue.h" // for NodeBS
44
+ #include <limits.h>
45
+ #include <stack>
46
+ #include <map>
47
+
48
+ namespace SVF
49
+ {
50
+
51
+ class GNodeSCCInfo;
52
+
53
+ template<class GraphType>
54
+ class SCCDetection
55
+ {
56
+
57
+ private:
58
+ ///Define the GTraits and node iterator for printing
59
+ typedef SVF::GenericGraphTraits<GraphType> GTraits;
60
+ typedef typename GTraits::NodeRef GNODE;
61
+ typedef typename GTraits::nodes_iterator node_iterator;
62
+ typedef typename GTraits::ChildIteratorType child_iterator;
63
+ typedef unsigned NodeID ;
64
+
65
+ public:
66
+ typedef std::stack<NodeID> GNodeStack;
67
+
68
+ class GNodeSCCInfo
69
+ {
70
+ public:
71
+ GNodeSCCInfo() : _visited(false), _inSCC(false), _rep(UINT_MAX) {}
72
+
73
+ inline bool visited(void) const
74
+ {
75
+ return _visited;
76
+ }
77
+ inline void visited(bool v)
78
+ {
79
+ _visited = v;
80
+ }
81
+ inline bool inSCC(void) const
82
+ {
83
+ return _inSCC;
84
+ }
85
+ inline void inSCC(bool v)
86
+ {
87
+ _inSCC = v;
88
+ }
89
+ inline NodeID rep(void)const
90
+ {
91
+ return _rep;
92
+ }
93
+ inline void rep(NodeID n)
94
+ {
95
+ _rep = n;
96
+ }
97
+ inline void addSubNodes(NodeID n)
98
+ {
99
+ _subNodes.set(n);
100
+ }
101
+ inline NodeBS& subNodes()
102
+ {
103
+ return _subNodes;
104
+ }
105
+ inline const NodeBS& subNodes() const
106
+ {
107
+ return _subNodes;
108
+ }
109
+ private:
110
+ bool _visited;
111
+ bool _inSCC;
112
+ NodeID _rep;
113
+ NodeBS _subNodes; /// nodes in the scc represented by this node
114
+ };
115
+
116
+ typedef Map<NodeID,GNodeSCCInfo > GNODESCCInfoMap;
117
+ typedef Map<NodeID, NodeID> NodeToNodeMap;
118
+
119
+ SCCDetection(const GraphType &GT)
120
+ : _graph(GT),
121
+ _I(0)
122
+ {}
123
+
124
+
125
+ // Return a handle to the stack of nodes in topological
126
+ // order. This will be used to seed the initial solution
127
+ // and improve efficiency.
128
+ inline GNodeStack &topoNodeStack()
129
+ {
130
+ return _T;
131
+ }
132
+
133
+ const inline GNODESCCInfoMap &GNodeSCCInfo() const
134
+ {
135
+ return _NodeSCCAuxInfo;
136
+ }
137
+
138
+ /// get the rep node if not found return itself
139
+ inline NodeID repNode(NodeID n) const
140
+ {
141
+ typename GNODESCCInfoMap::const_iterator it = _NodeSCCAuxInfo.find(n);
142
+ assert(it!=_NodeSCCAuxInfo.end() && "scc rep not found");
143
+ NodeID rep = it->second.rep();
144
+ return rep!= UINT_MAX ? rep : n ;
145
+ }
146
+
147
+
148
+ /// whether the node is in a cycle
149
+ inline bool isInCycle(NodeID n) const
150
+ {
151
+ NodeID rep = repNode(n);
152
+ // multi-node cycle
153
+ if (subNodes(rep).count() > 1)
154
+ {
155
+ return true;
156
+ }
157
+ // self-cycle
158
+ else
159
+ {
160
+ child_iterator EI = GTraits::direct_child_begin(Node(rep));
161
+ child_iterator EE = GTraits::direct_child_end(Node(rep));
162
+ for (; EI != EE; ++EI)
163
+ {
164
+ NodeID w = Node_Index(*EI);
165
+ if(w==rep)
166
+ return true;
167
+ }
168
+ return false;
169
+ }
170
+ }
171
+
172
+ /// get all subnodes in one scc, if size is empty insert itself into the set
173
+ inline const NodeBS& subNodes(NodeID n) const
174
+ {
175
+ typename GNODESCCInfoMap::const_iterator it = _NodeSCCAuxInfo.find(n);
176
+ assert(it!=_NodeSCCAuxInfo.end() && "scc rep not found");
177
+ return it->second.subNodes();
178
+ }
179
+
180
+ /// get all repNodeID
181
+ inline const NodeBS &getRepNodes() const
182
+ {
183
+ return repNodes;
184
+ }
185
+
186
+ const inline GraphType & graph()
187
+ {
188
+ return _graph;
189
+ }
190
+ private:
191
+
192
+ GNODESCCInfoMap _NodeSCCAuxInfo;
193
+
194
+ const GraphType & _graph;
195
+ NodeID _I;
196
+ NodeToNodeMap _D;
197
+ GNodeStack _SS;
198
+ GNodeStack _T;
199
+ NodeBS repNodes;
200
+
201
+ inline bool visited(NodeID n)
202
+ {
203
+ return _NodeSCCAuxInfo[n].visited();
204
+ }
205
+ inline bool inSCC(NodeID n)
206
+ {
207
+ return _NodeSCCAuxInfo[n].inSCC();
208
+ }
209
+
210
+ inline void setVisited(NodeID n,bool v)
211
+ {
212
+ _NodeSCCAuxInfo[n].visited(v);
213
+ }
214
+ inline void setInSCC(NodeID n,bool v)
215
+ {
216
+ _NodeSCCAuxInfo[n].inSCC(v);
217
+ }
218
+ inline void rep(NodeID n, NodeID r)
219
+ {
220
+ _NodeSCCAuxInfo[n].rep(r);
221
+ _NodeSCCAuxInfo[r].addSubNodes(n);
222
+ if (n != r)
223
+ {
224
+ _NodeSCCAuxInfo[n].subNodes().clear();
225
+ repNodes.reset(n);
226
+ repNodes.set(r);
227
+ }
228
+ }
229
+
230
+ inline NodeID rep(NodeID n)
231
+ {
232
+ return _NodeSCCAuxInfo[n].rep();
233
+ }
234
+ inline bool isInSCC(NodeID n)
235
+ {
236
+ return _NodeSCCAuxInfo[n].inSCC();
237
+ }
238
+
239
+ inline GNODE Node(NodeID id) const
240
+ {
241
+ return GTraits::getNode(_graph, id);
242
+ }
243
+
244
+ inline NodeID Node_Index(GNODE node) const
245
+ {
246
+ return GTraits::getNodeID(node);
247
+ }
248
+
249
+ void visit(NodeID v)
250
+ {
251
+ // SVFUtil::outs() << "visit GNODE: " << Node_Index(v)<< "\n";
252
+ _I += 1;
253
+ _D[v] = _I;
254
+ this->rep(v,v);
255
+ this->setVisited(v,true);
256
+
257
+ child_iterator EI = GTraits::direct_child_begin(Node(v));
258
+ child_iterator EE = GTraits::direct_child_end(Node(v));
259
+
260
+ for (; EI != EE; ++EI)
261
+ {
262
+ NodeID w = Node_Index(*EI);
263
+
264
+ if (!this->visited(w))
265
+ visit(w);
266
+ if (!this->inSCC(w))
267
+ {
268
+ NodeID rep;
269
+ rep = _D[this->rep(v)] < _D[this->rep(w)] ?
270
+ this->rep(v) : this->rep(w);
271
+ this->rep(v,rep);
272
+ }
273
+ }
274
+ if (this->rep(v) == v)
275
+ {
276
+ this->setInSCC(v,true);
277
+ while (!_SS.empty())
278
+ {
279
+ NodeID w = _SS.top();
280
+ if (_D[w] <= _D[v])
281
+ break;
282
+ else
283
+ {
284
+ _SS.pop();
285
+ this->setInSCC(w,true);
286
+ this->rep(w,v);
287
+ }
288
+ }
289
+ _T.push(v);
290
+ }
291
+ else
292
+ _SS.push(v);
293
+ }
294
+
295
+ void clear()
296
+ {
297
+ _NodeSCCAuxInfo.clear();
298
+ _I = 0;
299
+ _D.clear();
300
+ repNodes.clear();
301
+ while(!_SS.empty())
302
+ _SS.pop();
303
+ while(!_T.empty())
304
+ _T.pop();
305
+ }
306
+ public:
307
+
308
+ void find(void)
309
+ {
310
+ // Visit each unvisited root node. A root node is defined
311
+ // to be a node that has no incoming copy/skew edges
312
+ clear();
313
+ node_iterator I = GTraits::nodes_begin(_graph);
314
+ node_iterator E = GTraits::nodes_end(_graph);
315
+ for (; I != E; ++I)
316
+ {
317
+ NodeID node = Node_Index(*I);
318
+ if (!this->visited(node))
319
+ {
320
+ // We skip any nodes that have a representative other than
321
+ // themselves. Such nodes occur as a result of merging
322
+ // nodes either through unifying an ACC or other node
323
+ // merging optimizations. Any such node should have no
324
+ // outgoing edges and therefore should no longer be a member
325
+ // of an SCC.
326
+ if (this->rep(node) == UINT_MAX || this->rep(node) == node)
327
+ visit(node);
328
+ else
329
+ this->visited(node);
330
+ }
331
+ }
332
+ }
333
+
334
+ void find(NodeSet &candidates)
335
+ {
336
+ // This function is reloaded to only visit candidate NODES
337
+ clear();
338
+ for (NodeID node : candidates)
339
+ {
340
+ if (!this->visited(node))
341
+ {
342
+ if (this->rep(node) == UINT_MAX || this->rep(node) == node)
343
+ visit(node);
344
+ else
345
+ this->visited(node);
346
+ }
347
+ }
348
+ }
349
+
350
+ };
351
+
352
+ } // End namespace SVF
353
+
354
+ #endif /* SCC_H_ */
@@ -57,6 +57,7 @@ typedef PHIVFGNode PHISVFGNode;
57
57
  typedef IntraPHIVFGNode IntraPHISVFGNode;
58
58
  typedef InterPHIVFGNode InterPHISVFGNode;
59
59
 
60
+
60
61
  /*!
61
62
  * Sparse value flow graph
62
63
  * Each node stands for a definition, each edge stands for value flow relations
@@ -345,6 +346,7 @@ protected:
345
346
  }
346
347
  //@}
347
348
 
349
+
348
350
  /// Given a PAGNode, set/get its def SVFG node (definition of top level pointers)
349
351
  //@{
350
352
  inline void setDef(const PAGNode* pagNode, const SVFGNode* node)
@@ -198,6 +198,7 @@ public:
198
198
  virtual const std::string toString() const;
199
199
  };
200
200
 
201
+
201
202
  /*!
202
203
  * MHP SVFG edge representing indirect value-flows between
203
204
  * two memory access may-happen-in-parallel in multithreaded program
@@ -131,6 +131,7 @@ public:
131
131
  virtual const std::string toString() const;
132
132
  };
133
133
 
134
+
134
135
  /*
135
136
  * SVFG Node stands for return mu node (address-taken variables)
136
137
  */
@@ -172,6 +173,7 @@ public:
172
173
  virtual const std::string toString() const;
173
174
  };
174
175
 
176
+
175
177
  /*
176
178
  * SVFG Node stands for callsite mu node (address-taken variables)
177
179
  */
@@ -200,6 +202,7 @@ public:
200
202
  return ver;
201
203
  }
202
204
 
205
+
203
206
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
204
207
  //@{
205
208
  static inline bool classof(const ActualINSVFGNode *)
@@ -219,6 +222,7 @@ public:
219
222
  virtual const std::string toString() const;
220
223
  };
221
224
 
225
+
222
226
  /*
223
227
  * SVFG Node stands for callsite chi node (address-taken variables)
224
228
  */
@@ -265,6 +269,7 @@ public:
265
269
  virtual const std::string toString() const;
266
270
  };
267
271
 
272
+
268
273
  /*
269
274
  * SVFG Node stands for a memory ssa phi node or formalIn or ActualOut
270
275
  */
@@ -392,6 +397,7 @@ public:
392
397
  virtual const std::string toString() const;
393
398
  };
394
399
 
400
+
395
401
  /*
396
402
  * Inter MSSA PHI (formalIN/ActualOUT)
397
403
  */
@@ -501,6 +507,7 @@ private:
501
507
  const Version version;
502
508
  };
503
509
 
510
+
504
511
  } // End namespace SVF
505
512
 
506
513
  #endif /* INCLUDE_MSSA_SVFGNODE_H_ */