svf-lib 1.0.2238 → 1.0.2239

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 (165) hide show
  1. package/SVF-linux-aarch64/Release-build/bin/ae +0 -0
  2. package/SVF-linux-aarch64/Release-build/bin/cfl +0 -0
  3. package/SVF-linux-aarch64/Release-build/bin/dvf +0 -0
  4. package/SVF-linux-aarch64/Release-build/bin/llvm2svf +0 -0
  5. package/SVF-linux-aarch64/Release-build/bin/mta +0 -0
  6. package/SVF-linux-aarch64/Release-build/bin/saber +0 -0
  7. package/SVF-linux-aarch64/Release-build/bin/svf-ex +0 -0
  8. package/SVF-linux-aarch64/Release-build/bin/wpa +0 -0
  9. package/SVF-linux-aarch64/Release-build/include/AE/Core/AbstractState.h +406 -0
  10. package/SVF-linux-aarch64/Release-build/include/AE/Core/AbstractValue.h +157 -0
  11. package/SVF-linux-aarch64/Release-build/include/AE/Core/AddressValue.h +232 -0
  12. package/SVF-linux-aarch64/Release-build/include/AE/Core/ICFGWTO.h +82 -0
  13. package/SVF-linux-aarch64/Release-build/include/AE/Core/IntervalValue.h +1055 -0
  14. package/SVF-linux-aarch64/Release-build/include/AE/Core/NumericValue.h +1292 -0
  15. package/SVF-linux-aarch64/Release-build/include/AE/Core/RelExeState.h +226 -0
  16. package/SVF-linux-aarch64/Release-build/include/AE/Core/RelationSolver.h +91 -0
  17. package/SVF-linux-aarch64/Release-build/include/AE/Svfexe/AEDetector.h +323 -0
  18. package/SVF-linux-aarch64/Release-build/include/AE/Svfexe/AbsExtAPI.h +140 -0
  19. package/SVF-linux-aarch64/Release-build/include/AE/Svfexe/AbstractInterpretation.h +350 -0
  20. package/SVF-linux-aarch64/Release-build/include/CFL/CFGNormalizer.h +84 -0
  21. package/SVF-linux-aarch64/Release-build/include/CFL/CFGrammar.h +468 -0
  22. package/SVF-linux-aarch64/Release-build/include/CFL/CFLAlias.h +168 -0
  23. package/SVF-linux-aarch64/Release-build/include/CFL/CFLBase.h +118 -0
  24. package/SVF-linux-aarch64/Release-build/include/CFL/CFLGramGraphChecker.h +74 -0
  25. package/SVF-linux-aarch64/Release-build/include/CFL/CFLGraphBuilder.h +166 -0
  26. package/SVF-linux-aarch64/Release-build/include/CFL/CFLSVFGBuilder.h +58 -0
  27. package/SVF-linux-aarch64/Release-build/include/CFL/CFLSolver.h +374 -0
  28. package/SVF-linux-aarch64/Release-build/include/CFL/CFLStat.h +67 -0
  29. package/SVF-linux-aarch64/Release-build/include/CFL/CFLVF.h +68 -0
  30. package/SVF-linux-aarch64/Release-build/include/CFL/GrammarBuilder.h +100 -0
  31. package/SVF-linux-aarch64/Release-build/include/CFL/grammar/PAGGrammar.txt +15 -0
  32. package/SVF-linux-aarch64/Release-build/include/CFL/grammar/PEGGrammar.txt +11 -0
  33. package/SVF-linux-aarch64/Release-build/include/CFL/grammar/VFGGrammar.txt +7 -0
  34. package/SVF-linux-aarch64/Release-build/include/DDA/ContextDDA.h +230 -0
  35. package/SVF-linux-aarch64/Release-build/include/DDA/DDAClient.h +163 -0
  36. package/SVF-linux-aarch64/Release-build/include/DDA/DDAPass.h +102 -0
  37. package/SVF-linux-aarch64/Release-build/include/DDA/DDAStat.h +121 -0
  38. package/SVF-linux-aarch64/Release-build/include/DDA/DDAVFSolver.h +794 -0
  39. package/SVF-linux-aarch64/Release-build/include/DDA/FlowDDA.h +178 -0
  40. package/SVF-linux-aarch64/Release-build/include/FastCluster/LICENSE.TXT +13 -0
  41. package/SVF-linux-aarch64/Release-build/include/FastCluster/fastcluster.h +80 -0
  42. package/SVF-linux-aarch64/Release-build/include/Graphs/BasicBlockG.h +318 -0
  43. package/SVF-linux-aarch64/Release-build/include/Graphs/CDG.h +482 -0
  44. package/SVF-linux-aarch64/Release-build/include/Graphs/CFLGraph.h +232 -0
  45. package/SVF-linux-aarch64/Release-build/include/Graphs/CHG.h +369 -0
  46. package/SVF-linux-aarch64/Release-build/include/Graphs/CallGraph.h +498 -0
  47. package/SVF-linux-aarch64/Release-build/include/Graphs/ConsG.h +402 -0
  48. package/SVF-linux-aarch64/Release-build/include/Graphs/ConsGEdge.h +355 -0
  49. package/SVF-linux-aarch64/Release-build/include/Graphs/ConsGNode.h +418 -0
  50. package/SVF-linux-aarch64/Release-build/include/Graphs/DOTGraphTraits.h +188 -0
  51. package/SVF-linux-aarch64/Release-build/include/Graphs/GenericGraph.h +628 -0
  52. package/SVF-linux-aarch64/Release-build/include/Graphs/GraphPrinter.h +111 -0
  53. package/SVF-linux-aarch64/Release-build/include/Graphs/GraphTraits.h +150 -0
  54. package/SVF-linux-aarch64/Release-build/include/Graphs/GraphWriter.h +380 -0
  55. package/SVF-linux-aarch64/Release-build/include/Graphs/ICFG.h +331 -0
  56. package/SVF-linux-aarch64/Release-build/include/Graphs/ICFGEdge.h +281 -0
  57. package/SVF-linux-aarch64/Release-build/include/Graphs/ICFGNode.h +669 -0
  58. package/SVF-linux-aarch64/Release-build/include/Graphs/ICFGStat.h +164 -0
  59. package/SVF-linux-aarch64/Release-build/include/Graphs/IRGraph.h +398 -0
  60. package/SVF-linux-aarch64/Release-build/include/Graphs/SCC.h +375 -0
  61. package/SVF-linux-aarch64/Release-build/include/Graphs/SVFG.h +491 -0
  62. package/SVF-linux-aarch64/Release-build/include/Graphs/SVFGEdge.h +237 -0
  63. package/SVF-linux-aarch64/Release-build/include/Graphs/SVFGNode.h +501 -0
  64. package/SVF-linux-aarch64/Release-build/include/Graphs/SVFGOPT.h +363 -0
  65. package/SVF-linux-aarch64/Release-build/include/Graphs/SVFGStat.h +273 -0
  66. package/SVF-linux-aarch64/Release-build/include/Graphs/ThreadCallGraph.h +400 -0
  67. package/SVF-linux-aarch64/Release-build/include/Graphs/VFG.h +664 -0
  68. package/SVF-linux-aarch64/Release-build/include/Graphs/VFGEdge.h +295 -0
  69. package/SVF-linux-aarch64/Release-build/include/Graphs/VFGNode.h +1266 -0
  70. package/SVF-linux-aarch64/Release-build/include/Graphs/WTO.h +872 -0
  71. package/SVF-linux-aarch64/Release-build/include/MSSA/MSSAMuChi.h +722 -0
  72. package/SVF-linux-aarch64/Release-build/include/MSSA/MemPartition.h +169 -0
  73. package/SVF-linux-aarch64/Release-build/include/MSSA/MemRegion.h +489 -0
  74. package/SVF-linux-aarch64/Release-build/include/MSSA/MemSSA.h +452 -0
  75. package/SVF-linux-aarch64/Release-build/include/MSSA/SVFGBuilder.h +98 -0
  76. package/SVF-linux-aarch64/Release-build/include/MTA/LockAnalysis.h +533 -0
  77. package/SVF-linux-aarch64/Release-build/include/MTA/MHP.h +546 -0
  78. package/SVF-linux-aarch64/Release-build/include/MTA/MTA.h +98 -0
  79. package/SVF-linux-aarch64/Release-build/include/MTA/MTAStat.h +73 -0
  80. package/SVF-linux-aarch64/Release-build/include/MTA/TCT.h +620 -0
  81. package/SVF-linux-aarch64/Release-build/include/MemoryModel/AbstractPointsToDS.h +316 -0
  82. package/SVF-linux-aarch64/Release-build/include/MemoryModel/AccessPath.h +194 -0
  83. package/SVF-linux-aarch64/Release-build/include/MemoryModel/ConditionalPT.h +878 -0
  84. package/SVF-linux-aarch64/Release-build/include/MemoryModel/MutablePointsToDS.h +1025 -0
  85. package/SVF-linux-aarch64/Release-build/include/MemoryModel/PersistentPointsToCache.h +463 -0
  86. package/SVF-linux-aarch64/Release-build/include/MemoryModel/PersistentPointsToDS.h +955 -0
  87. package/SVF-linux-aarch64/Release-build/include/MemoryModel/PointerAnalysis.h +429 -0
  88. package/SVF-linux-aarch64/Release-build/include/MemoryModel/PointerAnalysisImpl.h +602 -0
  89. package/SVF-linux-aarch64/Release-build/include/MemoryModel/PointsTo.h +255 -0
  90. package/SVF-linux-aarch64/Release-build/include/MemoryModel/SVFLoop.h +167 -0
  91. package/SVF-linux-aarch64/Release-build/include/SABER/DoubleFreeChecker.h +76 -0
  92. package/SVF-linux-aarch64/Release-build/include/SABER/FileChecker.h +80 -0
  93. package/SVF-linux-aarch64/Release-build/include/SABER/LeakChecker.h +122 -0
  94. package/SVF-linux-aarch64/Release-build/include/SABER/ProgSlice.h +327 -0
  95. package/SVF-linux-aarch64/Release-build/include/SABER/SaberCheckerAPI.h +151 -0
  96. package/SVF-linux-aarch64/Release-build/include/SABER/SaberCondAllocator.h +317 -0
  97. package/SVF-linux-aarch64/Release-build/include/SABER/SaberSVFGBuilder.h +114 -0
  98. package/SVF-linux-aarch64/Release-build/include/SABER/SrcSnkDDA.h +327 -0
  99. package/SVF-linux-aarch64/Release-build/include/SABER/SrcSnkSolver.h +186 -0
  100. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/BasicTypes.h +280 -0
  101. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/BreakConstantExpr.h +94 -0
  102. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/CHGBuilder.h +78 -0
  103. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/CppUtil.h +184 -0
  104. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/DCHG.h +477 -0
  105. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/GEPTypeBridgeIterator.h +183 -0
  106. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/ICFGBuilder.h +160 -0
  107. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/LLVMLoopAnalysis.h +60 -0
  108. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/LLVMModule.h +594 -0
  109. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/LLVMUtil.h +438 -0
  110. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/ObjTypeInference.h +130 -0
  111. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/SVFIRBuilder.h +520 -0
  112. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/SVFLLVMValue.h +387 -0
  113. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/SVFModule.h +186 -0
  114. package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/SymbolTableBuilder.h +132 -0
  115. package/SVF-linux-aarch64/Release-build/include/SVFIR/ObjTypeInfo.h +224 -0
  116. package/SVF-linux-aarch64/Release-build/include/SVFIR/PAGBuilderFromFile.h +80 -0
  117. package/SVF-linux-aarch64/Release-build/include/SVFIR/SVFIR.h +856 -0
  118. package/SVF-linux-aarch64/Release-build/include/SVFIR/SVFStatements.h +1328 -0
  119. package/SVF-linux-aarch64/Release-build/include/SVFIR/SVFType.h +578 -0
  120. package/SVF-linux-aarch64/Release-build/include/SVFIR/SVFValue.h +338 -0
  121. package/SVF-linux-aarch64/Release-build/include/SVFIR/SVFVariables.h +2204 -0
  122. package/SVF-linux-aarch64/Release-build/include/Util/Annotator.h +180 -0
  123. package/SVF-linux-aarch64/Release-build/include/Util/BitVector.h +55 -0
  124. package/SVF-linux-aarch64/Release-build/include/Util/CDGBuilder.h +107 -0
  125. package/SVF-linux-aarch64/Release-build/include/Util/CallGraphBuilder.h +62 -0
  126. package/SVF-linux-aarch64/Release-build/include/Util/Casting.h +426 -0
  127. package/SVF-linux-aarch64/Release-build/include/Util/CommandLine.h +530 -0
  128. package/SVF-linux-aarch64/Release-build/include/Util/CoreBitVector.h +214 -0
  129. package/SVF-linux-aarch64/Release-build/include/Util/CxtStmt.h +502 -0
  130. package/SVF-linux-aarch64/Release-build/include/Util/DPItem.h +618 -0
  131. package/SVF-linux-aarch64/Release-build/include/Util/ExtAPI.h +117 -0
  132. package/SVF-linux-aarch64/Release-build/include/Util/GeneralType.h +127 -0
  133. package/SVF-linux-aarch64/Release-build/include/Util/GraphReachSolver.h +186 -0
  134. package/SVF-linux-aarch64/Release-build/include/Util/NodeIDAllocator.h +203 -0
  135. package/SVF-linux-aarch64/Release-build/include/Util/Options.h +272 -0
  136. package/SVF-linux-aarch64/Release-build/include/Util/PTAStat.h +83 -0
  137. package/SVF-linux-aarch64/Release-build/include/Util/SVFBugReport.h +427 -0
  138. package/SVF-linux-aarch64/Release-build/include/Util/SVFLoopAndDomInfo.h +169 -0
  139. package/SVF-linux-aarch64/Release-build/include/Util/SVFStat.h +103 -0
  140. package/SVF-linux-aarch64/Release-build/include/Util/SVFUtil.h +478 -0
  141. package/SVF-linux-aarch64/Release-build/include/Util/SparseBitVector.h +1252 -0
  142. package/SVF-linux-aarch64/Release-build/include/Util/ThreadAPI.h +189 -0
  143. package/SVF-linux-aarch64/Release-build/include/Util/WorkList.h +317 -0
  144. package/SVF-linux-aarch64/Release-build/include/Util/Z3Expr.h +325 -0
  145. package/SVF-linux-aarch64/Release-build/include/Util/cJSON.h +300 -0
  146. package/SVF-linux-aarch64/Release-build/include/Util/config.h +26 -0
  147. package/SVF-linux-aarch64/Release-build/include/Util/iterator.h +407 -0
  148. package/SVF-linux-aarch64/Release-build/include/Util/iterator_range.h +76 -0
  149. package/SVF-linux-aarch64/Release-build/include/WPA/Andersen.h +435 -0
  150. package/SVF-linux-aarch64/Release-build/include/WPA/AndersenPWC.h +160 -0
  151. package/SVF-linux-aarch64/Release-build/include/WPA/CSC.h +95 -0
  152. package/SVF-linux-aarch64/Release-build/include/WPA/FlowSensitive.h +323 -0
  153. package/SVF-linux-aarch64/Release-build/include/WPA/Steensgaard.h +131 -0
  154. package/SVF-linux-aarch64/Release-build/include/WPA/TypeAnalysis.h +90 -0
  155. package/SVF-linux-aarch64/Release-build/include/WPA/VersionedFlowSensitive.h +295 -0
  156. package/SVF-linux-aarch64/Release-build/include/WPA/WPAFSSolver.h +246 -0
  157. package/SVF-linux-aarch64/Release-build/include/WPA/WPAPass.h +116 -0
  158. package/SVF-linux-aarch64/Release-build/include/WPA/WPASolver.h +205 -0
  159. package/SVF-linux-aarch64/Release-build/include/WPA/WPAStat.h +222 -0
  160. package/SVF-linux-aarch64/Release-build/lib/cmake/SVF/SVFConfig.cmake +58 -0
  161. package/SVF-linux-aarch64/Release-build/lib/cmake/SVF/SVFConfigVersion.cmake +43 -0
  162. package/SVF-linux-aarch64/Release-build/lib/extapi.bc +2449 -0
  163. package/SVF-linux-aarch64/Release-build/lib/libSvfCore.so +0 -0
  164. package/SVF-linux-aarch64/Release-build/lib/libSvfLLVM.so.16 +0 -0
  165. package/package.json +1 -1
@@ -0,0 +1,400 @@
1
+ //===- ThreadCallGraph.h -- Call graph considering thread fork/join-----------//
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
+ * ThreadCallGraph.h
25
+ *
26
+ * Created on: Jul 7, 2014
27
+ * Authors: Peng Di, Yulei Sui, Ding Ye
28
+ */
29
+
30
+ #ifndef RCG_H_
31
+ #define RCG_H_
32
+
33
+ #include "Graphs/CallGraph.h"
34
+
35
+ namespace SVF
36
+ {
37
+
38
+ class SVFModule;
39
+ class ThreadAPI;
40
+ class PointerAnalysis;
41
+ /*!
42
+ * PTA thread fork edge from fork site to the entry of a start routine function
43
+ */
44
+ class ThreadForkEdge: public CallGraphEdge
45
+ {
46
+
47
+ public:
48
+ /// Constructor
49
+ ThreadForkEdge(CallGraphNode* s, CallGraphNode* d, CallSiteID csId) :
50
+ CallGraphEdge(s, d, CallGraphEdge::TDForkEdge, csId)
51
+ {
52
+ }
53
+ /// Destructor
54
+ virtual ~ThreadForkEdge()
55
+ {
56
+ }
57
+
58
+ /// ClassOf
59
+ //@{
60
+ static inline bool classof(const ThreadForkEdge*)
61
+ {
62
+ return true;
63
+ }
64
+ static inline bool classof(const CallGraphEdge*edge)
65
+ {
66
+ return edge->getEdgeKind() == CallGraphEdge::TDForkEdge;
67
+ }
68
+ //@}
69
+
70
+ virtual const std::string toString() const;
71
+
72
+ typedef GenericNode<CallGraphNode, ThreadForkEdge>::GEdgeSetTy ForkEdgeSet;
73
+ };
74
+
75
+ /*!
76
+ * PTA thread join edge from the exit of a start routine function to a join point of the thread
77
+ */
78
+ class ThreadJoinEdge: public CallGraphEdge
79
+ {
80
+
81
+ public:
82
+ /// Constructor
83
+ ThreadJoinEdge(CallGraphNode* s, CallGraphNode* d, CallSiteID csId) :
84
+ CallGraphEdge(s, d, CallGraphEdge::TDJoinEdge, csId)
85
+ {
86
+ }
87
+ /// Destructor
88
+ virtual ~ThreadJoinEdge()
89
+ {
90
+ }
91
+
92
+ static inline bool classof(const ThreadJoinEdge*)
93
+ {
94
+ return true;
95
+ }
96
+ static inline bool classof(const CallGraphEdge*edge)
97
+ {
98
+ return edge->getEdgeKind() == CallGraphEdge::TDJoinEdge;
99
+ }
100
+
101
+ virtual const std::string toString() const;
102
+
103
+ typedef GenericNode<CallGraphNode, ThreadJoinEdge>::GEdgeSetTy JoinEdgeSet;
104
+ };
105
+
106
+ /*!
107
+ * hare_parallel_for edge from fork site to the entry of a start routine function
108
+ */
109
+ class HareParForEdge: public CallGraphEdge
110
+ {
111
+
112
+ public:
113
+ /// Constructor
114
+ HareParForEdge(CallGraphNode* s, CallGraphNode* d, CallSiteID csId) :
115
+ CallGraphEdge(s, d, CallGraphEdge::HareParForEdge, csId)
116
+ {
117
+ }
118
+ /// Destructor
119
+ virtual ~HareParForEdge()
120
+ {
121
+ }
122
+
123
+ /// ClassOf
124
+ //@{
125
+ static inline bool classof(const HareParForEdge*)
126
+ {
127
+ return true;
128
+ }
129
+ static inline bool classof(const CallGraphEdge*edge)
130
+ {
131
+ return edge->getEdgeKind() == CallGraphEdge::HareParForEdge;
132
+ }
133
+ //@}
134
+
135
+ typedef GenericNode<CallGraphNode, HareParForEdge>::GEdgeSetTy ParForEdgeSet;
136
+ };
137
+
138
+
139
+ /*!
140
+ * Thread sensitive call graph
141
+ */
142
+ class ThreadCallGraph: public CallGraph
143
+ {
144
+
145
+ public:
146
+ typedef Set<const CallICFGNode*> InstSet;
147
+ typedef InstSet CallSiteSet;
148
+ typedef Set<CallSiteSet*> CtxSet;
149
+ typedef ThreadForkEdge::ForkEdgeSet ForkEdgeSet;
150
+ typedef Map<const CallICFGNode*, ForkEdgeSet> CallInstToForkEdgesMap;
151
+ typedef ThreadJoinEdge::JoinEdgeSet JoinEdgeSet;
152
+ typedef Map<const CallICFGNode*, JoinEdgeSet> CallInstToJoinEdgesMap;
153
+ typedef HareParForEdge::ParForEdgeSet ParForEdgeSet;
154
+ typedef Map<const CallICFGNode*, ParForEdgeSet> CallInstToParForEdgesMap;
155
+
156
+ /// Constructor
157
+ ThreadCallGraph(const CallGraph& cg);
158
+
159
+ ThreadCallGraph(ThreadCallGraph& cg) = delete;
160
+
161
+ /// Destructor
162
+ virtual ~ThreadCallGraph()
163
+ {
164
+ }
165
+
166
+ /// ClassOf
167
+ //@{
168
+ static inline bool classof(const ThreadCallGraph *)
169
+ {
170
+ return true;
171
+ }
172
+ static inline bool classof(const CallGraph*g)
173
+ {
174
+ return g->getKind() == CallGraph::ThdCallGraph;
175
+ }
176
+ //@}
177
+
178
+ /// Update call graph using pointer results
179
+ void updateCallGraph(PointerAnalysis* pta);
180
+ /// Update join edge using pointer analysis results
181
+ void updateJoinEdge(PointerAnalysis* pta);
182
+
183
+
184
+ /// Get call graph edge via call instruction
185
+ //@{
186
+ /// whether this call instruction has a valid call graph edge
187
+ inline bool hasThreadForkEdge(const CallICFGNode* cs) const
188
+ {
189
+ return callinstToThreadForkEdgesMap.find(cs) !=
190
+ callinstToThreadForkEdgesMap.end();
191
+ }
192
+ inline ForkEdgeSet::const_iterator getForkEdgeBegin(const CallICFGNode* cs) const
193
+ {
194
+ CallInstToForkEdgesMap::const_iterator it = callinstToThreadForkEdgesMap.find(cs);
195
+ assert(it != callinstToThreadForkEdgesMap.end() && "call instruction not found");
196
+ return it->second.begin();
197
+ }
198
+ inline ForkEdgeSet::const_iterator getForkEdgeEnd(const CallICFGNode* cs) const
199
+ {
200
+ CallInstToForkEdgesMap::const_iterator it = callinstToThreadForkEdgesMap.find(cs);
201
+ assert(it != callinstToThreadForkEdgesMap.end() && "call instruction not found");
202
+ return it->second.end();
203
+ }
204
+
205
+ /// Get call graph edge via call instruction
206
+ //@{
207
+ /// whether this call instruction has a valid call graph edge
208
+ inline bool hasThreadJoinEdge(const CallICFGNode* cs) const
209
+ {
210
+ return callinstToThreadJoinEdgesMap.find(cs) != callinstToThreadJoinEdgesMap.end();
211
+ }
212
+ inline JoinEdgeSet::const_iterator getJoinEdgeBegin(const CallICFGNode* cs) const
213
+ {
214
+ CallInstToJoinEdgesMap::const_iterator it = callinstToThreadJoinEdgesMap.find(cs);
215
+ assert(it != callinstToThreadJoinEdgesMap.end() && "call instruction does not have a valid callee");
216
+ return it->second.begin();
217
+ }
218
+ inline JoinEdgeSet::const_iterator getJoinEdgeEnd(const CallICFGNode* cs) const
219
+ {
220
+ CallInstToJoinEdgesMap::const_iterator it = callinstToThreadJoinEdgesMap.find(cs);
221
+ assert(it != callinstToThreadJoinEdgesMap.end() && "call instruction does not have a valid callee");
222
+ return it->second.end();
223
+ }
224
+ inline void getJoinSites(const CallGraphNode* routine, InstSet& csSet)
225
+ {
226
+ for(CallInstToJoinEdgesMap::const_iterator it = callinstToThreadJoinEdgesMap.begin(), eit = callinstToThreadJoinEdgesMap.end(); it!=eit; ++it)
227
+ {
228
+ for(JoinEdgeSet::const_iterator jit = it->second.begin(), ejit = it->second.end(); jit!=ejit; ++jit)
229
+ {
230
+ if((*jit)->getDstNode() == routine)
231
+ {
232
+ csSet.insert(it->first);
233
+ }
234
+ }
235
+ }
236
+ }
237
+ //@}
238
+
239
+ /// Whether a callsite is a fork or join or hare_parallel_for
240
+ ///@{
241
+ inline bool isForksite(const CallICFGNode* csInst)
242
+ {
243
+ return forksites.find(csInst) != forksites.end();
244
+ }
245
+ inline bool isJoinsite(const CallICFGNode* csInst)
246
+ {
247
+ return joinsites.find(csInst) != joinsites.end();
248
+ }
249
+ inline bool isParForSite(const CallICFGNode* csInst)
250
+ {
251
+ return parForSites.find(csInst) != parForSites.end();
252
+ }
253
+ ///
254
+
255
+ /// Fork sites iterators
256
+ //@{
257
+ inline CallSiteSet::const_iterator forksitesBegin() const
258
+ {
259
+ return forksites.begin();
260
+ }
261
+ inline CallSiteSet::const_iterator forksitesEnd() const
262
+ {
263
+ return forksites.end();
264
+ }
265
+ //@}
266
+
267
+ /// Join sites iterators
268
+ //@{
269
+ inline CallSiteSet::const_iterator joinsitesBegin() const
270
+ {
271
+ return joinsites.begin();
272
+ }
273
+ inline CallSiteSet::const_iterator joinsitesEnd() const
274
+ {
275
+ return joinsites.end();
276
+ }
277
+ //@}
278
+
279
+ /// hare_parallel_for sites iterators
280
+ //@{
281
+ inline CallSiteSet::const_iterator parForSitesBegin() const
282
+ {
283
+ return parForSites.begin();
284
+ }
285
+ inline CallSiteSet::const_iterator parForSitesEnd() const
286
+ {
287
+ return parForSites.end();
288
+ }
289
+ //@}
290
+
291
+ /// Num of fork/join sites
292
+ //@{
293
+ inline u32_t getNumOfForksite() const
294
+ {
295
+ return forksites.size();
296
+ }
297
+ inline u32_t getNumOfJoinsite() const
298
+ {
299
+ return joinsites.size();
300
+ }
301
+ inline u32_t getNumOfParForSite() const
302
+ {
303
+ return parForSites.size();
304
+ }
305
+ //@}
306
+
307
+ /// Thread API
308
+ inline ThreadAPI* getThreadAPI() const
309
+ {
310
+ return tdAPI;
311
+ }
312
+
313
+ /// Add fork sites which directly or indirectly create a thread
314
+ //@{
315
+ inline bool addForksite(const CallICFGNode* cs)
316
+ {
317
+ callinstToThreadForkEdgesMap[cs];
318
+ return forksites.insert(cs).second;
319
+ }
320
+ inline bool addJoinsite(const CallICFGNode* cs)
321
+ {
322
+ callinstToThreadJoinEdgesMap[cs];
323
+ return joinsites.insert(cs).second;
324
+ }
325
+ inline bool addParForSite(const CallICFGNode* cs)
326
+ {
327
+ callinstToHareParForEdgesMap[cs];
328
+ return parForSites.insert(cs).second;
329
+ }
330
+ //@}
331
+
332
+ /// Add direct/indirect thread fork edges
333
+ //@{
334
+ bool addDirectForkEdge(const CallICFGNode* cs);
335
+ bool addIndirectForkEdge(const CallICFGNode* cs, const FunObjVar* callee);
336
+ //@}
337
+
338
+ /// Add thread join edges
339
+ //@{
340
+ void addDirectJoinEdge(const CallICFGNode* cs,const CallSiteSet& forksite);
341
+ //@}
342
+
343
+
344
+ /// map call instruction to its PTACallGraphEdge map
345
+ inline void addThreadForkEdgeSetMap(const CallICFGNode* cs, ThreadForkEdge* edge)
346
+ {
347
+ if(edge!=nullptr)
348
+ {
349
+ callinstToThreadForkEdgesMap[cs].insert(edge);
350
+ callinstToCallGraphEdgesMap[cs].insert(edge);
351
+ }
352
+ }
353
+
354
+ /// map call instruction to its PTACallGraphEdge map
355
+ inline void addThreadJoinEdgeSetMap(const CallICFGNode* cs, ThreadJoinEdge* edge)
356
+ {
357
+ if(edge!=nullptr)
358
+ {
359
+ callinstToThreadJoinEdgesMap[cs].insert(edge);
360
+ callinstToCallGraphEdgesMap[cs].insert(edge);
361
+ }
362
+ }
363
+
364
+ /// map call instruction to its PTACallGraphEdge map
365
+ inline void addHareParForEdgeSetMap(const CallICFGNode* cs, HareParForEdge* edge)
366
+ {
367
+ if(edge!=nullptr)
368
+ {
369
+ callinstToHareParForEdgesMap[cs].insert(edge);
370
+ callinstToCallGraphEdgesMap[cs].insert(edge);
371
+ }
372
+ }
373
+
374
+ /// has thread join edge
375
+ inline ThreadJoinEdge* hasThreadJoinEdge(const CallICFGNode* call, CallGraphNode* joinFunNode, CallGraphNode* threadRoutineFunNode, CallSiteID csId) const
376
+ {
377
+ ThreadJoinEdge joinEdge(joinFunNode,threadRoutineFunNode, csId);
378
+ CallInstToJoinEdgesMap::const_iterator it = callinstToThreadJoinEdgesMap.find(call);
379
+ if(it != callinstToThreadJoinEdgesMap.end())
380
+ {
381
+ JoinEdgeSet::const_iterator jit = it->second.find(&joinEdge);
382
+ if(jit!=it->second.end())
383
+ return *jit;
384
+ }
385
+ return nullptr;
386
+ }
387
+
388
+ private:
389
+ ThreadAPI* tdAPI; ///< Thread API
390
+ CallSiteSet forksites; ///< all thread fork sites
391
+ CallSiteSet joinsites; ///< all thread fork sites
392
+ CallSiteSet parForSites; ///< all parallel for sites
393
+ CallInstToForkEdgesMap callinstToThreadForkEdgesMap; ///< Map a call instruction to its corresponding fork edges
394
+ CallInstToJoinEdgesMap callinstToThreadJoinEdgesMap; ///< Map a call instruction to its corresponding join edges
395
+ CallInstToParForEdgesMap callinstToHareParForEdgesMap; ///< Map a call instruction to its corresponding hare_parallel_for edges
396
+ };
397
+
398
+ } // End namespace SVF
399
+
400
+ #endif /* RCG_H_ */