svf-lib 1.0.1376 → 1.0.1377

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 (292) hide show
  1. package/SVF-osx/Release-build/svf-llvm/libSvfLLVM.a +0 -0
  2. package/package.json +1 -1
  3. package/SVF-linux/svf/include/include/AbstractExecution/AbstractValue.h +0 -79
  4. package/SVF-linux/svf/include/include/AbstractExecution/AddressValue.h +0 -210
  5. package/SVF-linux/svf/include/include/AbstractExecution/ExeState.h +0 -223
  6. package/SVF-linux/svf/include/include/AbstractExecution/IntervalExeState.h +0 -425
  7. package/SVF-linux/svf/include/include/AbstractExecution/IntervalValue.h +0 -868
  8. package/SVF-linux/svf/include/include/AbstractExecution/NumericLiteral.h +0 -406
  9. package/SVF-linux/svf/include/include/AbstractExecution/RelExeState.h +0 -225
  10. package/SVF-linux/svf/include/include/AbstractExecution/RelationSolver.h +0 -68
  11. package/SVF-linux/svf/include/include/AbstractExecution/SVFIR2ItvExeState.h +0 -186
  12. package/SVF-linux/svf/include/include/AbstractExecution/WTO.h +0 -845
  13. package/SVF-linux/svf/include/include/CFL/CFGNormalizer.h +0 -84
  14. package/SVF-linux/svf/include/include/CFL/CFLAlias.h +0 -176
  15. package/SVF-linux/svf/include/include/CFL/CFLBase.h +0 -115
  16. package/SVF-linux/svf/include/include/CFL/CFLData.h +0 -316
  17. package/SVF-linux/svf/include/include/CFL/CFLDataBuilder.h +0 -91
  18. package/SVF-linux/svf/include/include/CFL/CFLGramGraphChecker.h +0 -74
  19. package/SVF-linux/svf/include/include/CFL/CFLGrammar.h +0 -468
  20. package/SVF-linux/svf/include/include/CFL/CFLGrammar.txt +0 -15
  21. package/SVF-linux/svf/include/include/CFL/CFLGraphBuilder.h +0 -193
  22. package/SVF-linux/svf/include/include/CFL/CFLSolver.h +0 -136
  23. package/SVF-linux/svf/include/include/CFL/CFLStat.h +0 -67
  24. package/SVF-linux/svf/include/include/CFL/CFLVF.h +0 -65
  25. package/SVF-linux/svf/include/include/CFL/GrammarBuilder.h +0 -100
  26. package/SVF-linux/svf/include/include/CFL/PEGGrammar.txt +0 -11
  27. package/SVF-linux/svf/include/include/CFL/VFG.txt +0 -7
  28. package/SVF-linux/svf/include/include/DDA/ContextDDA.h +0 -230
  29. package/SVF-linux/svf/include/include/DDA/DDAClient.h +0 -168
  30. package/SVF-linux/svf/include/include/DDA/DDAPass.h +0 -99
  31. package/SVF-linux/svf/include/include/DDA/DDAStat.h +0 -138
  32. package/SVF-linux/svf/include/include/DDA/DDAVFSolver.h +0 -789
  33. package/SVF-linux/svf/include/include/DDA/FlowDDA.h +0 -178
  34. package/SVF-linux/svf/include/include/FastCluster/LICENSE.TXT +0 -13
  35. package/SVF-linux/svf/include/include/FastCluster/fastcluster.h +0 -80
  36. package/SVF-linux/svf/include/include/Graphs/CFLGraph.h +0 -215
  37. package/SVF-linux/svf/include/include/Graphs/CHG.h +0 -351
  38. package/SVF-linux/svf/include/include/Graphs/ConsG.h +0 -408
  39. package/SVF-linux/svf/include/include/Graphs/ConsGEdge.h +0 -353
  40. package/SVF-linux/svf/include/include/Graphs/ConsGNode.h +0 -391
  41. package/SVF-linux/svf/include/include/Graphs/DOTGraphTraits.h +0 -188
  42. package/SVF-linux/svf/include/include/Graphs/GenericGraph.h +0 -620
  43. package/SVF-linux/svf/include/include/Graphs/GraphPrinter.h +0 -111
  44. package/SVF-linux/svf/include/include/Graphs/GraphTraits.h +0 -150
  45. package/SVF-linux/svf/include/include/Graphs/GraphWriter.h +0 -380
  46. package/SVF-linux/svf/include/include/Graphs/ICFG.h +0 -331
  47. package/SVF-linux/svf/include/include/Graphs/ICFGEdge.h +0 -264
  48. package/SVF-linux/svf/include/include/Graphs/ICFGNode.h +0 -523
  49. package/SVF-linux/svf/include/include/Graphs/ICFGStat.h +0 -164
  50. package/SVF-linux/svf/include/include/Graphs/IRGraph.h +0 -243
  51. package/SVF-linux/svf/include/include/Graphs/PTACallGraph.h +0 -471
  52. package/SVF-linux/svf/include/include/Graphs/SVFG.h +0 -490
  53. package/SVF-linux/svf/include/include/Graphs/SVFGEdge.h +0 -237
  54. package/SVF-linux/svf/include/include/Graphs/SVFGNode.h +0 -513
  55. package/SVF-linux/svf/include/include/Graphs/SVFGOPT.h +0 -362
  56. package/SVF-linux/svf/include/include/Graphs/SVFGStat.h +0 -273
  57. package/SVF-linux/svf/include/include/Graphs/ThreadCallGraph.h +0 -422
  58. package/SVF-linux/svf/include/include/Graphs/VFG.h +0 -664
  59. package/SVF-linux/svf/include/include/Graphs/VFGEdge.h +0 -295
  60. package/SVF-linux/svf/include/include/Graphs/VFGNode.h +0 -1197
  61. package/SVF-linux/svf/include/include/MSSA/MSSAMuChi.h +0 -722
  62. package/SVF-linux/svf/include/include/MSSA/MemPartition.h +0 -169
  63. package/SVF-linux/svf/include/include/MSSA/MemRegion.h +0 -491
  64. package/SVF-linux/svf/include/include/MSSA/MemSSA.h +0 -452
  65. package/SVF-linux/svf/include/include/MSSA/SVFGBuilder.h +0 -98
  66. package/SVF-linux/svf/include/include/MTA/FSMPTA.h +0 -270
  67. package/SVF-linux/svf/include/include/MTA/LockAnalysis.h +0 -517
  68. package/SVF-linux/svf/include/include/MTA/MHP.h +0 -565
  69. package/SVF-linux/svf/include/include/MTA/MTA.h +0 -101
  70. package/SVF-linux/svf/include/include/MTA/MTAResultValidator.h +0 -448
  71. package/SVF-linux/svf/include/include/MTA/MTAStat.h +0 -74
  72. package/SVF-linux/svf/include/include/MTA/PCG.h +0 -229
  73. package/SVF-linux/svf/include/include/MTA/TCT.h +0 -599
  74. package/SVF-linux/svf/include/include/MemoryModel/AbstractPointsToDS.h +0 -316
  75. package/SVF-linux/svf/include/include/MemoryModel/ConditionalPT.h +0 -878
  76. package/SVF-linux/svf/include/include/MemoryModel/LocationSet.h +0 -148
  77. package/SVF-linux/svf/include/include/MemoryModel/MutablePointsToDS.h +0 -1025
  78. package/SVF-linux/svf/include/include/MemoryModel/PersistentPointsToCache.h +0 -463
  79. package/SVF-linux/svf/include/include/MemoryModel/PersistentPointsToDS.h +0 -955
  80. package/SVF-linux/svf/include/include/MemoryModel/PointerAnalysis.h +0 -452
  81. package/SVF-linux/svf/include/include/MemoryModel/PointerAnalysisImpl.h +0 -590
  82. package/SVF-linux/svf/include/include/MemoryModel/PointsTo.h +0 -255
  83. package/SVF-linux/svf/include/include/MemoryModel/SVFLoop.h +0 -164
  84. package/SVF-linux/svf/include/include/SABER/DoubleFreeChecker.h +0 -76
  85. package/SVF-linux/svf/include/include/SABER/FileChecker.h +0 -82
  86. package/SVF-linux/svf/include/include/SABER/LeakChecker.h +0 -124
  87. package/SVF-linux/svf/include/include/SABER/ProgSlice.h +0 -313
  88. package/SVF-linux/svf/include/include/SABER/SaberCheckerAPI.h +0 -166
  89. package/SVF-linux/svf/include/include/SABER/SaberCondAllocator.h +0 -310
  90. package/SVF-linux/svf/include/include/SABER/SaberSVFGBuilder.h +0 -104
  91. package/SVF-linux/svf/include/include/SABER/SrcSnkDDA.h +0 -321
  92. package/SVF-linux/svf/include/include/SABER/SrcSnkSolver.h +0 -186
  93. package/SVF-linux/svf/include/include/SVFIR/PAGBuilderFromFile.h +0 -80
  94. package/SVF-linux/svf/include/include/SVFIR/SVFIR.h +0 -659
  95. package/SVF-linux/svf/include/include/SVFIR/SVFModule.h +0 -233
  96. package/SVF-linux/svf/include/include/SVFIR/SVFStatements.h +0 -1136
  97. package/SVF-linux/svf/include/include/SVFIR/SVFType.h +0 -527
  98. package/SVF-linux/svf/include/include/SVFIR/SVFValue.h +0 -1120
  99. package/SVF-linux/svf/include/include/SVFIR/SVFVariables.h +0 -721
  100. package/SVF-linux/svf/include/include/SVFIR/SymbolTableInfo.h +0 -597
  101. package/SVF-linux/svf/include/include/Util/Annotator.h +0 -180
  102. package/SVF-linux/svf/include/include/Util/BitVector.h +0 -55
  103. package/SVF-linux/svf/include/include/Util/CallGraphBuilder.h +0 -74
  104. package/SVF-linux/svf/include/include/Util/Casting.h +0 -426
  105. package/SVF-linux/svf/include/include/Util/CommandLine.h +0 -530
  106. package/SVF-linux/svf/include/include/Util/CoreBitVector.h +0 -214
  107. package/SVF-linux/svf/include/include/Util/CppUtil.h +0 -81
  108. package/SVF-linux/svf/include/include/Util/CxtStmt.h +0 -501
  109. package/SVF-linux/svf/include/include/Util/DPItem.h +0 -618
  110. package/SVF-linux/svf/include/include/Util/ExtAPI.h +0 -339
  111. package/SVF-linux/svf/include/include/Util/ExtAPI.json +0 -5707
  112. package/SVF-linux/svf/include/include/Util/GraphReachSolver.h +0 -186
  113. package/SVF-linux/svf/include/include/Util/NodeIDAllocator.h +0 -194
  114. package/SVF-linux/svf/include/include/Util/Options.h +0 -266
  115. package/SVF-linux/svf/include/include/Util/PTAStat.h +0 -65
  116. package/SVF-linux/svf/include/include/Util/SCC.h +0 -354
  117. package/SVF-linux/svf/include/include/Util/SVFStat.h +0 -100
  118. package/SVF-linux/svf/include/include/Util/SVFUtil.h +0 -660
  119. package/SVF-linux/svf/include/include/Util/SparseBitVector.h +0 -1202
  120. package/SVF-linux/svf/include/include/Util/ThreadAPI.h +0 -330
  121. package/SVF-linux/svf/include/include/Util/WorkList.h +0 -317
  122. package/SVF-linux/svf/include/include/Util/Z3Expr.h +0 -318
  123. package/SVF-linux/svf/include/include/Util/cJSON.h +0 -300
  124. package/SVF-linux/svf/include/include/Util/iterator.h +0 -407
  125. package/SVF-linux/svf/include/include/Util/iterator_range.h +0 -76
  126. package/SVF-linux/svf/include/include/WPA/Andersen.h +0 -416
  127. package/SVF-linux/svf/include/include/WPA/AndersenPWC.h +0 -160
  128. package/SVF-linux/svf/include/include/WPA/CSC.h +0 -95
  129. package/SVF-linux/svf/include/include/WPA/FlowSensitive.h +0 -317
  130. package/SVF-linux/svf/include/include/WPA/Steensgaard.h +0 -126
  131. package/SVF-linux/svf/include/include/WPA/TypeAnalysis.h +0 -83
  132. package/SVF-linux/svf/include/include/WPA/VersionedFlowSensitive.h +0 -287
  133. package/SVF-linux/svf/include/include/WPA/WPAFSSolver.h +0 -254
  134. package/SVF-linux/svf/include/include/WPA/WPAPass.h +0 -119
  135. package/SVF-linux/svf/include/include/WPA/WPASolver.h +0 -205
  136. package/SVF-linux/svf/include/include/WPA/WPAStat.h +0 -222
  137. package/SVF-linux/svf-llvm/include/SVF-LLVM/SVF-LLVM/BasicTypes.h +0 -250
  138. package/SVF-linux/svf-llvm/include/SVF-LLVM/SVF-LLVM/BreakConstantExpr.h +0 -94
  139. package/SVF-linux/svf-llvm/include/SVF-LLVM/SVF-LLVM/CHGBuilder.h +0 -73
  140. package/SVF-linux/svf-llvm/include/SVF-LLVM/SVF-LLVM/DCHG.h +0 -484
  141. package/SVF-linux/svf-llvm/include/SVF-LLVM/SVF-LLVM/GEPTypeBridgeIterator.h +0 -183
  142. package/SVF-linux/svf-llvm/include/SVF-LLVM/SVF-LLVM/ICFGBuilder.h +0 -106
  143. package/SVF-linux/svf-llvm/include/SVF-LLVM/SVF-LLVM/LLVMLoopAnalysis.h +0 -61
  144. package/SVF-linux/svf-llvm/include/SVF-LLVM/SVF-LLVM/LLVMModule.h +0 -360
  145. package/SVF-linux/svf-llvm/include/SVF-LLVM/SVF-LLVM/LLVMUtil.h +0 -466
  146. package/SVF-linux/svf-llvm/include/SVF-LLVM/SVF-LLVM/SVFIRBuilder.h +0 -417
  147. package/SVF-linux/svf-llvm/include/SVF-LLVM/SVF-LLVM/SymbolTableBuilder.h +0 -110
  148. package/SVF-osx/svf/include/include/AbstractExecution/AbstractValue.h +0 -79
  149. package/SVF-osx/svf/include/include/AbstractExecution/AddressValue.h +0 -210
  150. package/SVF-osx/svf/include/include/AbstractExecution/ExeState.h +0 -223
  151. package/SVF-osx/svf/include/include/AbstractExecution/IntervalExeState.h +0 -425
  152. package/SVF-osx/svf/include/include/AbstractExecution/IntervalValue.h +0 -868
  153. package/SVF-osx/svf/include/include/AbstractExecution/NumericLiteral.h +0 -406
  154. package/SVF-osx/svf/include/include/AbstractExecution/RelExeState.h +0 -225
  155. package/SVF-osx/svf/include/include/AbstractExecution/RelationSolver.h +0 -68
  156. package/SVF-osx/svf/include/include/AbstractExecution/SVFIR2ItvExeState.h +0 -186
  157. package/SVF-osx/svf/include/include/AbstractExecution/WTO.h +0 -845
  158. package/SVF-osx/svf/include/include/CFL/CFGNormalizer.h +0 -84
  159. package/SVF-osx/svf/include/include/CFL/CFLAlias.h +0 -176
  160. package/SVF-osx/svf/include/include/CFL/CFLBase.h +0 -115
  161. package/SVF-osx/svf/include/include/CFL/CFLData.h +0 -316
  162. package/SVF-osx/svf/include/include/CFL/CFLDataBuilder.h +0 -91
  163. package/SVF-osx/svf/include/include/CFL/CFLGramGraphChecker.h +0 -74
  164. package/SVF-osx/svf/include/include/CFL/CFLGrammar.h +0 -468
  165. package/SVF-osx/svf/include/include/CFL/CFLGrammar.txt +0 -15
  166. package/SVF-osx/svf/include/include/CFL/CFLGraphBuilder.h +0 -193
  167. package/SVF-osx/svf/include/include/CFL/CFLSolver.h +0 -136
  168. package/SVF-osx/svf/include/include/CFL/CFLStat.h +0 -67
  169. package/SVF-osx/svf/include/include/CFL/CFLVF.h +0 -65
  170. package/SVF-osx/svf/include/include/CFL/GrammarBuilder.h +0 -100
  171. package/SVF-osx/svf/include/include/CFL/PEGGrammar.txt +0 -11
  172. package/SVF-osx/svf/include/include/CFL/VFG.txt +0 -7
  173. package/SVF-osx/svf/include/include/DDA/ContextDDA.h +0 -230
  174. package/SVF-osx/svf/include/include/DDA/DDAClient.h +0 -168
  175. package/SVF-osx/svf/include/include/DDA/DDAPass.h +0 -99
  176. package/SVF-osx/svf/include/include/DDA/DDAStat.h +0 -138
  177. package/SVF-osx/svf/include/include/DDA/DDAVFSolver.h +0 -789
  178. package/SVF-osx/svf/include/include/DDA/FlowDDA.h +0 -178
  179. package/SVF-osx/svf/include/include/FastCluster/LICENSE.TXT +0 -13
  180. package/SVF-osx/svf/include/include/FastCluster/fastcluster.h +0 -80
  181. package/SVF-osx/svf/include/include/Graphs/CFLGraph.h +0 -215
  182. package/SVF-osx/svf/include/include/Graphs/CHG.h +0 -351
  183. package/SVF-osx/svf/include/include/Graphs/ConsG.h +0 -408
  184. package/SVF-osx/svf/include/include/Graphs/ConsGEdge.h +0 -353
  185. package/SVF-osx/svf/include/include/Graphs/ConsGNode.h +0 -391
  186. package/SVF-osx/svf/include/include/Graphs/DOTGraphTraits.h +0 -188
  187. package/SVF-osx/svf/include/include/Graphs/GenericGraph.h +0 -620
  188. package/SVF-osx/svf/include/include/Graphs/GraphPrinter.h +0 -111
  189. package/SVF-osx/svf/include/include/Graphs/GraphTraits.h +0 -150
  190. package/SVF-osx/svf/include/include/Graphs/GraphWriter.h +0 -380
  191. package/SVF-osx/svf/include/include/Graphs/ICFG.h +0 -331
  192. package/SVF-osx/svf/include/include/Graphs/ICFGEdge.h +0 -264
  193. package/SVF-osx/svf/include/include/Graphs/ICFGNode.h +0 -523
  194. package/SVF-osx/svf/include/include/Graphs/ICFGStat.h +0 -164
  195. package/SVF-osx/svf/include/include/Graphs/IRGraph.h +0 -243
  196. package/SVF-osx/svf/include/include/Graphs/PTACallGraph.h +0 -471
  197. package/SVF-osx/svf/include/include/Graphs/SVFG.h +0 -490
  198. package/SVF-osx/svf/include/include/Graphs/SVFGEdge.h +0 -237
  199. package/SVF-osx/svf/include/include/Graphs/SVFGNode.h +0 -513
  200. package/SVF-osx/svf/include/include/Graphs/SVFGOPT.h +0 -362
  201. package/SVF-osx/svf/include/include/Graphs/SVFGStat.h +0 -273
  202. package/SVF-osx/svf/include/include/Graphs/ThreadCallGraph.h +0 -422
  203. package/SVF-osx/svf/include/include/Graphs/VFG.h +0 -664
  204. package/SVF-osx/svf/include/include/Graphs/VFGEdge.h +0 -295
  205. package/SVF-osx/svf/include/include/Graphs/VFGNode.h +0 -1197
  206. package/SVF-osx/svf/include/include/MSSA/MSSAMuChi.h +0 -722
  207. package/SVF-osx/svf/include/include/MSSA/MemPartition.h +0 -169
  208. package/SVF-osx/svf/include/include/MSSA/MemRegion.h +0 -491
  209. package/SVF-osx/svf/include/include/MSSA/MemSSA.h +0 -452
  210. package/SVF-osx/svf/include/include/MSSA/SVFGBuilder.h +0 -98
  211. package/SVF-osx/svf/include/include/MTA/FSMPTA.h +0 -270
  212. package/SVF-osx/svf/include/include/MTA/LockAnalysis.h +0 -517
  213. package/SVF-osx/svf/include/include/MTA/MHP.h +0 -565
  214. package/SVF-osx/svf/include/include/MTA/MTA.h +0 -101
  215. package/SVF-osx/svf/include/include/MTA/MTAResultValidator.h +0 -448
  216. package/SVF-osx/svf/include/include/MTA/MTAStat.h +0 -74
  217. package/SVF-osx/svf/include/include/MTA/PCG.h +0 -229
  218. package/SVF-osx/svf/include/include/MTA/TCT.h +0 -599
  219. package/SVF-osx/svf/include/include/MemoryModel/AbstractPointsToDS.h +0 -316
  220. package/SVF-osx/svf/include/include/MemoryModel/ConditionalPT.h +0 -878
  221. package/SVF-osx/svf/include/include/MemoryModel/LocationSet.h +0 -148
  222. package/SVF-osx/svf/include/include/MemoryModel/MutablePointsToDS.h +0 -1025
  223. package/SVF-osx/svf/include/include/MemoryModel/PersistentPointsToCache.h +0 -463
  224. package/SVF-osx/svf/include/include/MemoryModel/PersistentPointsToDS.h +0 -955
  225. package/SVF-osx/svf/include/include/MemoryModel/PointerAnalysis.h +0 -452
  226. package/SVF-osx/svf/include/include/MemoryModel/PointerAnalysisImpl.h +0 -590
  227. package/SVF-osx/svf/include/include/MemoryModel/PointsTo.h +0 -255
  228. package/SVF-osx/svf/include/include/MemoryModel/SVFLoop.h +0 -164
  229. package/SVF-osx/svf/include/include/SABER/DoubleFreeChecker.h +0 -76
  230. package/SVF-osx/svf/include/include/SABER/FileChecker.h +0 -82
  231. package/SVF-osx/svf/include/include/SABER/LeakChecker.h +0 -124
  232. package/SVF-osx/svf/include/include/SABER/ProgSlice.h +0 -313
  233. package/SVF-osx/svf/include/include/SABER/SaberCheckerAPI.h +0 -166
  234. package/SVF-osx/svf/include/include/SABER/SaberCondAllocator.h +0 -310
  235. package/SVF-osx/svf/include/include/SABER/SaberSVFGBuilder.h +0 -104
  236. package/SVF-osx/svf/include/include/SABER/SrcSnkDDA.h +0 -321
  237. package/SVF-osx/svf/include/include/SABER/SrcSnkSolver.h +0 -186
  238. package/SVF-osx/svf/include/include/SVFIR/PAGBuilderFromFile.h +0 -80
  239. package/SVF-osx/svf/include/include/SVFIR/SVFIR.h +0 -659
  240. package/SVF-osx/svf/include/include/SVFIR/SVFModule.h +0 -233
  241. package/SVF-osx/svf/include/include/SVFIR/SVFStatements.h +0 -1136
  242. package/SVF-osx/svf/include/include/SVFIR/SVFType.h +0 -527
  243. package/SVF-osx/svf/include/include/SVFIR/SVFValue.h +0 -1120
  244. package/SVF-osx/svf/include/include/SVFIR/SVFVariables.h +0 -721
  245. package/SVF-osx/svf/include/include/SVFIR/SymbolTableInfo.h +0 -597
  246. package/SVF-osx/svf/include/include/Util/Annotator.h +0 -180
  247. package/SVF-osx/svf/include/include/Util/BitVector.h +0 -55
  248. package/SVF-osx/svf/include/include/Util/CallGraphBuilder.h +0 -74
  249. package/SVF-osx/svf/include/include/Util/Casting.h +0 -426
  250. package/SVF-osx/svf/include/include/Util/CommandLine.h +0 -530
  251. package/SVF-osx/svf/include/include/Util/CoreBitVector.h +0 -214
  252. package/SVF-osx/svf/include/include/Util/CppUtil.h +0 -81
  253. package/SVF-osx/svf/include/include/Util/CxtStmt.h +0 -501
  254. package/SVF-osx/svf/include/include/Util/DPItem.h +0 -618
  255. package/SVF-osx/svf/include/include/Util/ExtAPI.h +0 -339
  256. package/SVF-osx/svf/include/include/Util/ExtAPI.json +0 -5707
  257. package/SVF-osx/svf/include/include/Util/GraphReachSolver.h +0 -186
  258. package/SVF-osx/svf/include/include/Util/NodeIDAllocator.h +0 -194
  259. package/SVF-osx/svf/include/include/Util/Options.h +0 -266
  260. package/SVF-osx/svf/include/include/Util/PTAStat.h +0 -65
  261. package/SVF-osx/svf/include/include/Util/SCC.h +0 -354
  262. package/SVF-osx/svf/include/include/Util/SVFStat.h +0 -100
  263. package/SVF-osx/svf/include/include/Util/SVFUtil.h +0 -660
  264. package/SVF-osx/svf/include/include/Util/SparseBitVector.h +0 -1202
  265. package/SVF-osx/svf/include/include/Util/ThreadAPI.h +0 -330
  266. package/SVF-osx/svf/include/include/Util/WorkList.h +0 -317
  267. package/SVF-osx/svf/include/include/Util/Z3Expr.h +0 -318
  268. package/SVF-osx/svf/include/include/Util/cJSON.h +0 -300
  269. package/SVF-osx/svf/include/include/Util/iterator.h +0 -407
  270. package/SVF-osx/svf/include/include/Util/iterator_range.h +0 -76
  271. package/SVF-osx/svf/include/include/WPA/Andersen.h +0 -416
  272. package/SVF-osx/svf/include/include/WPA/AndersenPWC.h +0 -160
  273. package/SVF-osx/svf/include/include/WPA/CSC.h +0 -95
  274. package/SVF-osx/svf/include/include/WPA/FlowSensitive.h +0 -317
  275. package/SVF-osx/svf/include/include/WPA/Steensgaard.h +0 -126
  276. package/SVF-osx/svf/include/include/WPA/TypeAnalysis.h +0 -83
  277. package/SVF-osx/svf/include/include/WPA/VersionedFlowSensitive.h +0 -287
  278. package/SVF-osx/svf/include/include/WPA/WPAFSSolver.h +0 -254
  279. package/SVF-osx/svf/include/include/WPA/WPAPass.h +0 -119
  280. package/SVF-osx/svf/include/include/WPA/WPASolver.h +0 -205
  281. package/SVF-osx/svf/include/include/WPA/WPAStat.h +0 -222
  282. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/BasicTypes.h +0 -250
  283. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/BreakConstantExpr.h +0 -94
  284. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/CHGBuilder.h +0 -73
  285. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/DCHG.h +0 -484
  286. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/GEPTypeBridgeIterator.h +0 -183
  287. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/ICFGBuilder.h +0 -106
  288. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/LLVMLoopAnalysis.h +0 -61
  289. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/LLVMModule.h +0 -360
  290. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/LLVMUtil.h +0 -466
  291. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/SVFIRBuilder.h +0 -417
  292. package/SVF-osx/svf-llvm/include/SVF-LLVM/SVF-LLVM/SymbolTableBuilder.h +0 -110
@@ -1,1202 +0,0 @@
1
- //===- SparseBitVector.h - Efficient Sparse BitVector --*- C++ -*-===//
2
- //
3
- // From the LLVM Project with some modifications, under the Apache License v2.0
4
- // with LLVM Exceptions. See https://llvm.org/LICENSE.txt for license information.
5
- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
- //
7
-
8
- #ifndef SPARSEBITVECTOR_H
9
- #define SPARSEBITVECTOR_H
10
-
11
- #include <ostream>
12
- #include <cassert>
13
- #include <cstring>
14
- #include <climits>
15
- #include <limits>
16
- #include <iterator>
17
- #include <list>
18
-
19
- // Appease GCC?
20
- #ifdef __has_builtin
21
- # define HAS_CLZ __has_builtin(__builtin_clz)
22
- # define HAS_CLZLL __has_builtin(__builtin_clzll)
23
- #else
24
- # define HAS_CLZ 0
25
- # define HAS_CLZLL 0
26
- #endif
27
-
28
- namespace SVF
29
- {
30
-
31
- /// The behavior an operation has on an input of 0.
32
- enum ZeroBehavior
33
- {
34
- /// The returned value is undefined.
35
- ZB_Undefined,
36
- /// The returned value is numeric_limits<T>::max()
37
- ZB_Max,
38
- /// The returned value is numeric_limits<T>::digits
39
- ZB_Width
40
- };
41
-
42
- template <typename T, std::size_t SizeOfT> struct TrailingZerosCounter
43
- {
44
- static unsigned count(T Val, ZeroBehavior)
45
- {
46
- if (!Val)
47
- return std::numeric_limits<T>::digits;
48
- if (Val & 0x1)
49
- return 0;
50
-
51
- // Bisection method.
52
- unsigned ZeroBits = 0;
53
- T Shift = std::numeric_limits<T>::digits >> 1;
54
- T Mask = std::numeric_limits<T>::max() >> Shift;
55
- while (Shift)
56
- {
57
- if ((Val & Mask) == 0)
58
- {
59
- Val >>= Shift;
60
- ZeroBits |= Shift;
61
- }
62
- Shift >>= 1;
63
- Mask >>= Shift;
64
- }
65
- return ZeroBits;
66
- }
67
- };
68
-
69
- /// Count number of 0's from the least significant bit to the most
70
- /// stopping at the first 1.
71
- ///
72
- /// Only unsigned integral types are allowed.
73
- ///
74
- /// \param ZB the behavior on an input of 0. Only ZB_Width and ZB_Undefined are
75
- /// valid arguments.
76
- template <typename T>
77
- unsigned countTrailingZeros(T Val, ZeroBehavior ZB = ZB_Width)
78
- {
79
- static_assert(std::numeric_limits<T>::is_integer &&
80
- !std::numeric_limits<T>::is_signed,
81
- "Only unsigned integral types are allowed.");
82
- return TrailingZerosCounter<T, sizeof(T)>::count(Val, ZB);
83
- }
84
-
85
- template <typename T, std::size_t SizeOfT> struct PopulationCounter
86
- {
87
- static unsigned count(T Value)
88
- {
89
- // Generic version, forward to 32 bits.
90
- static_assert(SizeOfT <= 4, "Not implemented!");
91
- #if defined(__GNUC__)
92
- return __builtin_popcount(Value);
93
- #else
94
- uint32_t v = Value;
95
- v = v - ((v >> 1) & 0x55555555);
96
- v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
97
- return ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
98
- #endif
99
- }
100
- };
101
-
102
- template <typename T, std::size_t SizeOfT> struct LeadingZerosCounter
103
- {
104
- static unsigned count(T Val, ZeroBehavior)
105
- {
106
- if (!Val)
107
- return std::numeric_limits<T>::digits;
108
-
109
- // Bisection method.
110
- unsigned ZeroBits = 0;
111
- for (T Shift = std::numeric_limits<T>::digits >> 1; Shift; Shift >>= 1)
112
- {
113
- T Tmp = Val >> Shift;
114
- if (Tmp)
115
- Val = Tmp;
116
- else
117
- ZeroBits |= Shift;
118
- }
119
- return ZeroBits;
120
- }
121
- };
122
-
123
- #if defined(__GNUC__) || defined(_MSC_VER)
124
- template <typename T> struct LeadingZerosCounter<T, 4>
125
- {
126
- static unsigned count(T Val, ZeroBehavior ZB)
127
- {
128
- if (ZB != ZB_Undefined && Val == 0)
129
- return 32;
130
-
131
- #if defined(__GNUC__) || HAS_CLZ
132
- return __builtin_clz(Val);
133
- #elif defined(_MSC_VER)
134
- unsigned long Index;
135
- _BitScanReverse(&Index, Val);
136
- return Index ^ 31;
137
- #endif
138
- }
139
- };
140
-
141
- #if !defined(_MSC_VER) || defined(_M_X64)
142
- template <typename T> struct LeadingZerosCounter<T, 8>
143
- {
144
- static unsigned count(T Val, ZeroBehavior ZB)
145
- {
146
- if (ZB != ZB_Undefined && Val == 0)
147
- return 64;
148
-
149
- #if defined(__GNUC__) || HAS_CLZLL
150
- return __builtin_clzll(Val);
151
- #elif defined(_MSC_VER)
152
- unsigned long Index;
153
- _BitScanReverse64(&Index, Val);
154
- return Index ^ 63;
155
- #endif
156
- }
157
- };
158
- #endif
159
- #endif
160
-
161
- /// Count number of 0's from the most significant bit to the least
162
- /// stopping at the first 1.
163
- ///
164
- /// Only unsigned integral types are allowed.
165
- ///
166
- /// \param ZB the behavior on an input of 0. Only ZB_Width and ZB_Undefined are
167
- /// valid arguments.
168
- template <typename T>
169
- unsigned countLeadingZeros(T Val, ZeroBehavior ZB = ZB_Width)
170
- {
171
- static_assert(std::numeric_limits<T>::is_integer &&
172
- !std::numeric_limits<T>::is_signed,
173
- "Only unsigned integral types are allowed.");
174
- return LeadingZerosCounter<T, sizeof(T)>::count(Val, ZB);
175
- }
176
-
177
- template <typename T> struct PopulationCounter<T, 8>
178
- {
179
- static unsigned count(T Value)
180
- {
181
- #if defined(__GNUC__)
182
- return __builtin_popcountll(Value);
183
- #else
184
- uint64_t v = Value;
185
- v = v - ((v >> 1) & 0x5555555555555555ULL);
186
- v = (v & 0x3333333333333333ULL) + ((v >> 2) & 0x3333333333333333ULL);
187
- v = (v + (v >> 4)) & 0x0F0F0F0F0F0F0F0FULL;
188
- return unsigned((uint64_t)(v * 0x0101010101010101ULL) >> 56);
189
- #endif
190
- }
191
- };
192
-
193
- /// Count the number of set bits in a value.
194
- /// Ex. countPopulation(0xF000F000) = 8
195
- /// Returns 0 if the word is zero.
196
- template <typename T>
197
- inline unsigned countPopulation(T Value)
198
- {
199
- static_assert(std::numeric_limits<T>::is_integer &&
200
- !std::numeric_limits<T>::is_signed,
201
- "Only unsigned integral types are allowed.");
202
- return PopulationCounter<T, sizeof(T)>::count(Value);
203
- }
204
-
205
- /// SparseBitVector is an implementation of a bitvector that is sparse by only
206
- /// storing the elements that have non-zero bits set. In order to make this
207
- /// fast for the most common cases, SparseBitVector is implemented as a linked
208
- /// list of SparseBitVectorElements. We maintain a pointer to the last
209
- /// SparseBitVectorElement accessed (in the form of a list iterator), in order
210
- /// to make multiple in-order test/set constant time after the first one is
211
- /// executed. Note that using vectors to store SparseBitVectorElement's does
212
- /// not work out very well because it causes insertion in the middle to take
213
- /// enormous amounts of time with a large amount of bits. Other structures that
214
- /// have better worst cases for insertion in the middle (various balanced trees,
215
- /// etc) do not perform as well in practice as a linked list with this iterator
216
- /// kept up to date. They are also significantly more memory intensive.
217
- template <unsigned ElementSize = 128> struct SparseBitVectorElement
218
- {
219
- public:
220
- using BitWord = unsigned long;
221
- using size_type = unsigned;
222
- enum
223
- {
224
- BITWORD_SIZE = sizeof(BitWord) * CHAR_BIT,
225
- BITWORDS_PER_ELEMENT = (ElementSize + BITWORD_SIZE - 1) / BITWORD_SIZE,
226
- BITS_PER_ELEMENT = ElementSize
227
- };
228
-
229
- private:
230
- // Index of Element in terms of where first bit starts.
231
- unsigned ElementIndex = 0;
232
- BitWord Bits[BITWORDS_PER_ELEMENT] = {0};
233
-
234
- SparseBitVectorElement() = default;
235
-
236
- public:
237
- explicit SparseBitVectorElement(unsigned Idx) : ElementIndex(Idx) {}
238
-
239
- // Comparison.
240
- bool operator==(const SparseBitVectorElement &RHS) const
241
- {
242
- if (ElementIndex != RHS.ElementIndex)
243
- return false;
244
- for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i)
245
- if (Bits[i] != RHS.Bits[i])
246
- return false;
247
- return true;
248
- }
249
-
250
- bool operator!=(const SparseBitVectorElement &RHS) const
251
- {
252
- return !(*this == RHS);
253
- }
254
-
255
- // Return the bits that make up word Idx in our element.
256
- BitWord word(unsigned Idx) const
257
- {
258
- assert(Idx < BITWORDS_PER_ELEMENT);
259
- return Bits[Idx];
260
- }
261
-
262
- unsigned index() const
263
- {
264
- return ElementIndex;
265
- }
266
-
267
- bool empty() const
268
- {
269
- for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i)
270
- if (Bits[i])
271
- return false;
272
- return true;
273
- }
274
-
275
- void set(unsigned Idx)
276
- {
277
- Bits[Idx / BITWORD_SIZE] |= 1L << (Idx % BITWORD_SIZE);
278
- }
279
-
280
- bool test_and_set(unsigned Idx)
281
- {
282
- bool old = test(Idx);
283
- if (!old)
284
- {
285
- set(Idx);
286
- return true;
287
- }
288
- return false;
289
- }
290
-
291
- void reset(unsigned Idx)
292
- {
293
- Bits[Idx / BITWORD_SIZE] &= ~(1L << (Idx % BITWORD_SIZE));
294
- }
295
-
296
- bool test(unsigned Idx) const
297
- {
298
- return Bits[Idx / BITWORD_SIZE] & (1L << (Idx % BITWORD_SIZE));
299
- }
300
-
301
- size_type count() const
302
- {
303
- unsigned NumBits = 0;
304
- for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i)
305
- NumBits += countPopulation(Bits[i]);
306
- return NumBits;
307
- }
308
-
309
- /// find_first - Returns the index of the first set bit.
310
- int find_first() const
311
- {
312
- for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i)
313
- if (Bits[i] != 0)
314
- return i * BITWORD_SIZE + countTrailingZeros(Bits[i]);
315
- assert(false && "SBV: find_first: SBV cannot be empty");
316
- abort();
317
- }
318
-
319
- /// find_last - Returns the index of the last set bit.
320
- int find_last() const
321
- {
322
- for (unsigned I = 0; I < BITWORDS_PER_ELEMENT; ++I)
323
- {
324
- unsigned Idx = BITWORDS_PER_ELEMENT - I - 1;
325
- if (Bits[Idx] != 0)
326
- return Idx * BITWORD_SIZE + BITWORD_SIZE -
327
- countLeadingZeros(Bits[Idx]) - 1;
328
- }
329
- assert(false && "SBV: find_last: SBV cannot be empty");
330
- abort();
331
- }
332
-
333
- /// find_next - Returns the index of the next set bit starting from the
334
- /// "Curr" bit. Returns -1 if the next set bit is not found.
335
- int find_next(unsigned Curr) const
336
- {
337
- if (Curr >= BITS_PER_ELEMENT)
338
- return -1;
339
-
340
- unsigned WordPos = Curr / BITWORD_SIZE;
341
- unsigned BitPos = Curr % BITWORD_SIZE;
342
- BitWord Copy = Bits[WordPos];
343
- assert(WordPos <= BITWORDS_PER_ELEMENT
344
- && "Word Position outside of element");
345
-
346
- // Mask off previous bits.
347
- Copy &= ~0UL << BitPos;
348
-
349
- if (Copy != 0)
350
- return WordPos * BITWORD_SIZE + countTrailingZeros(Copy);
351
-
352
- // Check subsequent words.
353
- for (unsigned i = WordPos+1; i < BITWORDS_PER_ELEMENT; ++i)
354
- if (Bits[i] != 0)
355
- return i * BITWORD_SIZE + countTrailingZeros(Bits[i]);
356
- return -1;
357
- }
358
-
359
- // Union this element with RHS and return true if this one changed.
360
- bool unionWith(const SparseBitVectorElement &RHS)
361
- {
362
- bool changed = false;
363
- for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i)
364
- {
365
- BitWord old = changed ? 0 : Bits[i];
366
-
367
- Bits[i] |= RHS.Bits[i];
368
- if (!changed && old != Bits[i])
369
- changed = true;
370
- }
371
- return changed;
372
- }
373
-
374
- // Return true if we have any bits in common with RHS
375
- bool intersects(const SparseBitVectorElement &RHS) const
376
- {
377
- for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i)
378
- {
379
- if (RHS.Bits[i] & Bits[i])
380
- return true;
381
- }
382
- return false;
383
- }
384
-
385
- // Intersect this Element with RHS and return true if this one changed.
386
- // BecameZero is set to true if this element became all-zero bits.
387
- bool intersectWith(const SparseBitVectorElement &RHS,
388
- bool &BecameZero)
389
- {
390
- bool changed = false;
391
- bool allzero = true;
392
-
393
- BecameZero = false;
394
- for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i)
395
- {
396
- BitWord old = changed ? 0 : Bits[i];
397
-
398
- Bits[i] &= RHS.Bits[i];
399
- if (Bits[i] != 0)
400
- allzero = false;
401
-
402
- if (!changed && old != Bits[i])
403
- changed = true;
404
- }
405
- BecameZero = allzero;
406
- return changed;
407
- }
408
-
409
- // Intersect this Element with the complement of RHS and return true if this
410
- // one changed. BecameZero is set to true if this element became all-zero
411
- // bits.
412
- bool intersectWithComplement(const SparseBitVectorElement &RHS,
413
- bool &BecameZero)
414
- {
415
- bool changed = false;
416
- bool allzero = true;
417
-
418
- BecameZero = false;
419
- for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i)
420
- {
421
- BitWord old = changed ? 0 : Bits[i];
422
-
423
- Bits[i] &= ~RHS.Bits[i];
424
- if (Bits[i] != 0)
425
- allzero = false;
426
-
427
- if (!changed && old != Bits[i])
428
- changed = true;
429
- }
430
- BecameZero = allzero;
431
- return changed;
432
- }
433
-
434
- // Three argument version of intersectWithComplement that intersects
435
- // RHS1 & ~RHS2 into this element
436
- void intersectWithComplement(const SparseBitVectorElement &RHS1,
437
- const SparseBitVectorElement &RHS2,
438
- bool &BecameZero)
439
- {
440
- bool allzero = true;
441
-
442
- BecameZero = false;
443
- for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i)
444
- {
445
- Bits[i] = RHS1.Bits[i] & ~RHS2.Bits[i];
446
- if (Bits[i] != 0)
447
- allzero = false;
448
- }
449
- BecameZero = allzero;
450
- }
451
- };
452
-
453
- template <unsigned ElementSize = 128>
454
- class SparseBitVector
455
- {
456
- using ElementList = std::list<SparseBitVectorElement<ElementSize>>;
457
- using ElementListIter = typename ElementList::iterator;
458
- using ElementListConstIter = typename ElementList::const_iterator;
459
- enum
460
- {
461
- BITWORD_SIZE = SparseBitVectorElement<ElementSize>::BITWORD_SIZE
462
- };
463
-
464
- ElementList Elements;
465
- // Pointer to our current Element. This has no visible effect on the external
466
- // state of a SparseBitVector, it's just used to improve performance in the
467
- // common case of testing/modifying bits with similar indices.
468
- mutable ElementListIter CurrElementIter;
469
-
470
- // This is like std::lower_bound, except we do linear searching from the
471
- // current position.
472
- ElementListIter FindLowerBoundImpl(unsigned ElementIndex) const
473
- {
474
-
475
- // We cache a non-const iterator so we're forced to resort to const_cast to
476
- // get the begin/end in the case where 'this' is const. To avoid duplication
477
- // of code with the only difference being whether the const cast is present
478
- // 'this' is always const in this particular function and we sort out the
479
- // difference in FindLowerBound and FindLowerBoundConst.
480
- ElementListIter Begin =
481
- const_cast<SparseBitVector<ElementSize> *>(this)->Elements.begin();
482
- ElementListIter End =
483
- const_cast<SparseBitVector<ElementSize> *>(this)->Elements.end();
484
-
485
- if (Elements.empty())
486
- {
487
- CurrElementIter = Begin;
488
- return CurrElementIter;
489
- }
490
-
491
- // Make sure our current iterator is valid.
492
- if (CurrElementIter == End)
493
- --CurrElementIter;
494
-
495
- // Search from our current iterator, either backwards or forwards,
496
- // depending on what element we are looking for.
497
- ElementListIter ElementIter = CurrElementIter;
498
- if (CurrElementIter->index() == ElementIndex)
499
- {
500
- return ElementIter;
501
- }
502
- else if (CurrElementIter->index() > ElementIndex)
503
- {
504
- while (ElementIter != Begin
505
- && ElementIter->index() > ElementIndex)
506
- --ElementIter;
507
- }
508
- else
509
- {
510
- while (ElementIter != End &&
511
- ElementIter->index() < ElementIndex)
512
- ++ElementIter;
513
- }
514
- CurrElementIter = ElementIter;
515
- return ElementIter;
516
- }
517
- ElementListConstIter FindLowerBoundConst(unsigned ElementIndex) const
518
- {
519
- return FindLowerBoundImpl(ElementIndex);
520
- }
521
- ElementListIter FindLowerBound(unsigned ElementIndex)
522
- {
523
- return FindLowerBoundImpl(ElementIndex);
524
- }
525
-
526
- // Iterator to walk set bits in the bitmap. This iterator is a lot uglier
527
- // than it would be, in order to be efficient.
528
- class SparseBitVectorIterator
529
- {
530
- private:
531
- bool AtEnd;
532
-
533
- const SparseBitVector<ElementSize> *BitVector = nullptr;
534
-
535
- // Current element inside of bitmap.
536
- ElementListConstIter Iter;
537
-
538
- // Current bit number inside of our bitmap.
539
- unsigned BitNumber;
540
-
541
- // Current word number inside of our element.
542
- unsigned WordNumber;
543
-
544
- // Current bits from the element.
545
- typename SparseBitVectorElement<ElementSize>::BitWord Bits;
546
-
547
- // Move our iterator to the first non-zero bit in the bitmap.
548
- void AdvanceToFirstNonZero()
549
- {
550
- if (AtEnd)
551
- return;
552
- if (BitVector->Elements.empty())
553
- {
554
- AtEnd = true;
555
- return;
556
- }
557
- Iter = BitVector->Elements.begin();
558
- BitNumber = Iter->index() * ElementSize;
559
- unsigned BitPos = Iter->find_first();
560
- BitNumber += BitPos;
561
- WordNumber = (BitNumber % ElementSize) / BITWORD_SIZE;
562
- Bits = Iter->word(WordNumber);
563
- Bits >>= BitPos % BITWORD_SIZE;
564
- }
565
-
566
- // Move our iterator to the next non-zero bit.
567
- void AdvanceToNextNonZero()
568
- {
569
- if (AtEnd)
570
- return;
571
-
572
- while (Bits && !(Bits & 1))
573
- {
574
- Bits >>= 1;
575
- BitNumber += 1;
576
- }
577
-
578
- // See if we ran out of Bits in this word.
579
- if (!Bits)
580
- {
581
- int NextSetBitNumber = Iter->find_next(BitNumber % ElementSize) ;
582
- // If we ran out of set bits in this element, move to next element.
583
- if (NextSetBitNumber == -1 || (BitNumber % ElementSize == 0))
584
- {
585
- ++Iter;
586
- WordNumber = 0;
587
-
588
- // We may run out of elements in the bitmap.
589
- if (Iter == BitVector->Elements.end())
590
- {
591
- AtEnd = true;
592
- return;
593
- }
594
- // Set up for next non-zero word in bitmap.
595
- BitNumber = Iter->index() * ElementSize;
596
- NextSetBitNumber = Iter->find_first();
597
- BitNumber += NextSetBitNumber;
598
- WordNumber = (BitNumber % ElementSize) / BITWORD_SIZE;
599
- Bits = Iter->word(WordNumber);
600
- Bits >>= NextSetBitNumber % BITWORD_SIZE;
601
- }
602
- else
603
- {
604
- WordNumber = (NextSetBitNumber % ElementSize) / BITWORD_SIZE;
605
- Bits = Iter->word(WordNumber);
606
- Bits >>= NextSetBitNumber % BITWORD_SIZE;
607
- BitNumber = Iter->index() * ElementSize;
608
- BitNumber += NextSetBitNumber;
609
- }
610
- }
611
- }
612
-
613
- public:
614
- SparseBitVectorIterator() = delete;
615
-
616
- SparseBitVectorIterator(const SparseBitVector<ElementSize> *RHS,
617
- bool end = false):BitVector(RHS)
618
- {
619
- Iter = BitVector->Elements.begin();
620
- BitNumber = 0;
621
- Bits = 0;
622
- WordNumber = ~0;
623
- AtEnd = end;
624
- AdvanceToFirstNonZero();
625
- }
626
-
627
- // Preincrement.
628
- inline SparseBitVectorIterator& operator++()
629
- {
630
- ++BitNumber;
631
- Bits >>= 1;
632
- AdvanceToNextNonZero();
633
- return *this;
634
- }
635
-
636
- // Postincrement.
637
- inline SparseBitVectorIterator operator++(int)
638
- {
639
- SparseBitVectorIterator tmp = *this;
640
- ++*this;
641
- return tmp;
642
- }
643
-
644
- // Return the current set bit number.
645
- unsigned operator*() const
646
- {
647
- return BitNumber;
648
- }
649
-
650
- bool operator==(const SparseBitVectorIterator &RHS) const
651
- {
652
- // If they are both at the end, ignore the rest of the fields.
653
- if (AtEnd && RHS.AtEnd)
654
- return true;
655
- // Otherwise they are the same if they have the same bit number and
656
- // bitmap.
657
- return AtEnd == RHS.AtEnd && RHS.BitNumber == BitNumber;
658
- }
659
-
660
- bool operator!=(const SparseBitVectorIterator &RHS) const
661
- {
662
- return !(*this == RHS);
663
- }
664
- };
665
-
666
- public:
667
- using iterator = SparseBitVectorIterator;
668
-
669
- SparseBitVector() : Elements(), CurrElementIter(Elements.begin()) {}
670
-
671
- SparseBitVector(const SparseBitVector &RHS)
672
- : Elements(RHS.Elements), CurrElementIter(Elements.begin()) {}
673
- SparseBitVector(SparseBitVector &&RHS)
674
- noexcept : Elements(std::move(RHS.Elements)), CurrElementIter(Elements.begin()) {}
675
-
676
- // Clear.
677
- void clear()
678
- {
679
- Elements.clear();
680
- }
681
-
682
- // Assignment
683
- SparseBitVector& operator=(const SparseBitVector& RHS)
684
- {
685
- if (this == &RHS)
686
- return *this;
687
-
688
- Elements = RHS.Elements;
689
- CurrElementIter = Elements.begin();
690
- return *this;
691
- }
692
- SparseBitVector &operator=(SparseBitVector &&RHS)
693
- {
694
- Elements = std::move(RHS.Elements);
695
- CurrElementIter = Elements.begin();
696
- return *this;
697
- }
698
-
699
- // Test, Reset, and Set a bit in the bitmap.
700
- bool test(unsigned Idx) const
701
- {
702
- if (Elements.empty())
703
- return false;
704
-
705
- unsigned ElementIndex = Idx / ElementSize;
706
- ElementListConstIter ElementIter = FindLowerBoundConst(ElementIndex);
707
-
708
- // If we can't find an element that is supposed to contain this bit, there
709
- // is nothing more to do.
710
- if (ElementIter == Elements.end() ||
711
- ElementIter->index() != ElementIndex)
712
- return false;
713
- return ElementIter->test(Idx % ElementSize);
714
- }
715
-
716
- void reset(unsigned Idx)
717
- {
718
- if (Elements.empty())
719
- return;
720
-
721
- unsigned ElementIndex = Idx / ElementSize;
722
- ElementListIter ElementIter = FindLowerBound(ElementIndex);
723
-
724
- // If we can't find an element that is supposed to contain this bit, there
725
- // is nothing more to do.
726
- if (ElementIter == Elements.end() ||
727
- ElementIter->index() != ElementIndex)
728
- return;
729
- ElementIter->reset(Idx % ElementSize);
730
-
731
- // When the element is zeroed out, delete it.
732
- if (ElementIter->empty())
733
- {
734
- ++CurrElementIter;
735
- Elements.erase(ElementIter);
736
- }
737
- }
738
-
739
- void set(unsigned Idx)
740
- {
741
- unsigned ElementIndex = Idx / ElementSize;
742
- ElementListIter ElementIter;
743
- if (Elements.empty())
744
- {
745
- ElementIter = Elements.emplace(Elements.end(), ElementIndex);
746
- }
747
- else
748
- {
749
- ElementIter = FindLowerBound(ElementIndex);
750
-
751
- if (ElementIter == Elements.end() ||
752
- ElementIter->index() != ElementIndex)
753
- {
754
- // We may have hit the beginning of our SparseBitVector, in which case,
755
- // we may need to insert right after this element, which requires moving
756
- // the current iterator forward one, because insert does insert before.
757
- if (ElementIter != Elements.end() &&
758
- ElementIter->index() < ElementIndex)
759
- ++ElementIter;
760
- ElementIter = Elements.emplace(ElementIter, ElementIndex);
761
- }
762
- }
763
- CurrElementIter = ElementIter;
764
-
765
- ElementIter->set(Idx % ElementSize);
766
- }
767
-
768
- bool test_and_set(unsigned Idx)
769
- {
770
- bool old = test(Idx);
771
- if (!old)
772
- {
773
- set(Idx);
774
- return true;
775
- }
776
- return false;
777
- }
778
-
779
- bool operator!=(const SparseBitVector &RHS) const
780
- {
781
- return !(*this == RHS);
782
- }
783
-
784
- bool operator==(const SparseBitVector &RHS) const
785
- {
786
- ElementListConstIter Iter1 = Elements.begin();
787
- ElementListConstIter Iter2 = RHS.Elements.begin();
788
-
789
- for (; Iter1 != Elements.end() && Iter2 != RHS.Elements.end();
790
- ++Iter1, ++Iter2)
791
- {
792
- if (*Iter1 != *Iter2)
793
- return false;
794
- }
795
- return Iter1 == Elements.end() && Iter2 == RHS.Elements.end();
796
- }
797
-
798
- // Union our bitmap with the RHS and return true if we changed.
799
- bool operator|=(const SparseBitVector &RHS)
800
- {
801
- if (this == &RHS)
802
- return false;
803
-
804
- bool changed = false;
805
- ElementListIter Iter1 = Elements.begin();
806
- ElementListConstIter Iter2 = RHS.Elements.begin();
807
-
808
- // If RHS is empty, we are done
809
- if (RHS.Elements.empty())
810
- return false;
811
-
812
- while (Iter2 != RHS.Elements.end())
813
- {
814
- if (Iter1 == Elements.end() || Iter1->index() > Iter2->index())
815
- {
816
- Elements.insert(Iter1, *Iter2);
817
- ++Iter2;
818
- changed = true;
819
- }
820
- else if (Iter1->index() == Iter2->index())
821
- {
822
- changed |= Iter1->unionWith(*Iter2);
823
- ++Iter1;
824
- ++Iter2;
825
- }
826
- else
827
- {
828
- ++Iter1;
829
- }
830
- }
831
- CurrElementIter = Elements.begin();
832
- return changed;
833
- }
834
-
835
- // Intersect our bitmap with the RHS and return true if ours changed.
836
- bool operator&=(const SparseBitVector &RHS)
837
- {
838
- if (this == &RHS)
839
- return false;
840
-
841
- bool changed = false;
842
- ElementListIter Iter1 = Elements.begin();
843
- ElementListConstIter Iter2 = RHS.Elements.begin();
844
-
845
- // Check if both bitmaps are empty.
846
- if (Elements.empty() && RHS.Elements.empty())
847
- return false;
848
-
849
- // Loop through, intersecting as we go, erasing elements when necessary.
850
- while (Iter2 != RHS.Elements.end())
851
- {
852
- if (Iter1 == Elements.end())
853
- {
854
- CurrElementIter = Elements.begin();
855
- return changed;
856
- }
857
-
858
- if (Iter1->index() > Iter2->index())
859
- {
860
- ++Iter2;
861
- }
862
- else if (Iter1->index() == Iter2->index())
863
- {
864
- bool BecameZero;
865
- changed |= Iter1->intersectWith(*Iter2, BecameZero);
866
- if (BecameZero)
867
- {
868
- ElementListIter IterTmp = Iter1;
869
- ++Iter1;
870
- Elements.erase(IterTmp);
871
- }
872
- else
873
- {
874
- ++Iter1;
875
- }
876
- ++Iter2;
877
- }
878
- else
879
- {
880
- ElementListIter IterTmp = Iter1;
881
- ++Iter1;
882
- Elements.erase(IterTmp);
883
- changed = true;
884
- }
885
- }
886
- if (Iter1 != Elements.end())
887
- {
888
- Elements.erase(Iter1, Elements.end());
889
- changed = true;
890
- }
891
- CurrElementIter = Elements.begin();
892
- return changed;
893
- }
894
-
895
- // Intersect our bitmap with the complement of the RHS and return true
896
- // if ours changed.
897
- bool intersectWithComplement(const SparseBitVector &RHS)
898
- {
899
- if (this == &RHS)
900
- {
901
- if (!empty())
902
- {
903
- clear();
904
- return true;
905
- }
906
- return false;
907
- }
908
-
909
- bool changed = false;
910
- ElementListIter Iter1 = Elements.begin();
911
- ElementListConstIter Iter2 = RHS.Elements.begin();
912
-
913
- // If either our bitmap or RHS is empty, we are done
914
- if (Elements.empty() || RHS.Elements.empty())
915
- return false;
916
-
917
- // Loop through, intersecting as we go, erasing elements when necessary.
918
- while (Iter2 != RHS.Elements.end())
919
- {
920
- if (Iter1 == Elements.end())
921
- {
922
- CurrElementIter = Elements.begin();
923
- return changed;
924
- }
925
-
926
- if (Iter1->index() > Iter2->index())
927
- {
928
- ++Iter2;
929
- }
930
- else if (Iter1->index() == Iter2->index())
931
- {
932
- bool BecameZero;
933
- changed |= Iter1->intersectWithComplement(*Iter2, BecameZero);
934
- if (BecameZero)
935
- {
936
- ElementListIter IterTmp = Iter1;
937
- ++Iter1;
938
- Elements.erase(IterTmp);
939
- }
940
- else
941
- {
942
- ++Iter1;
943
- }
944
- ++Iter2;
945
- }
946
- else
947
- {
948
- ++Iter1;
949
- }
950
- }
951
- CurrElementIter = Elements.begin();
952
- return changed;
953
- }
954
-
955
- bool intersectWithComplement(const SparseBitVector<ElementSize> *RHS) const
956
- {
957
- return intersectWithComplement(*RHS);
958
- }
959
-
960
- // Three argument version of intersectWithComplement.
961
- // Result of RHS1 & ~RHS2 is stored into this bitmap.
962
- void intersectWithComplement(const SparseBitVector<ElementSize> &RHS1,
963
- const SparseBitVector<ElementSize> &RHS2)
964
- {
965
- if (this == &RHS1)
966
- {
967
- intersectWithComplement(RHS2);
968
- return;
969
- }
970
- else if (this == &RHS2)
971
- {
972
- SparseBitVector RHS2Copy(RHS2);
973
- intersectWithComplement(RHS1, RHS2Copy);
974
- return;
975
- }
976
-
977
- Elements.clear();
978
- CurrElementIter = Elements.begin();
979
- ElementListConstIter Iter1 = RHS1.Elements.begin();
980
- ElementListConstIter Iter2 = RHS2.Elements.begin();
981
-
982
- // If RHS1 is empty, we are done
983
- // If RHS2 is empty, we still have to copy RHS1
984
- if (RHS1.Elements.empty())
985
- return;
986
-
987
- // Loop through, intersecting as we go, erasing elements when necessary.
988
- while (Iter2 != RHS2.Elements.end())
989
- {
990
- if (Iter1 == RHS1.Elements.end())
991
- return;
992
-
993
- if (Iter1->index() > Iter2->index())
994
- {
995
- ++Iter2;
996
- }
997
- else if (Iter1->index() == Iter2->index())
998
- {
999
- bool BecameZero = false;
1000
- Elements.emplace_back(Iter1->index());
1001
- Elements.back().intersectWithComplement(*Iter1, *Iter2, BecameZero);
1002
- if (BecameZero)
1003
- Elements.pop_back();
1004
- ++Iter1;
1005
- ++Iter2;
1006
- }
1007
- else
1008
- {
1009
- Elements.push_back(*Iter1++);
1010
- }
1011
- }
1012
-
1013
- // copy the remaining elements
1014
- std::copy(Iter1, RHS1.Elements.end(), std::back_inserter(Elements));
1015
- }
1016
-
1017
- void intersectWithComplement(const SparseBitVector<ElementSize> *RHS1,
1018
- const SparseBitVector<ElementSize> *RHS2)
1019
- {
1020
- intersectWithComplement(*RHS1, *RHS2);
1021
- }
1022
-
1023
- bool intersects(const SparseBitVector<ElementSize> *RHS) const
1024
- {
1025
- return intersects(*RHS);
1026
- }
1027
-
1028
- // Return true if we share any bits in common with RHS
1029
- bool intersects(const SparseBitVector<ElementSize> &RHS) const
1030
- {
1031
- ElementListConstIter Iter1 = Elements.begin();
1032
- ElementListConstIter Iter2 = RHS.Elements.begin();
1033
-
1034
- // Check if both bitmaps are empty.
1035
- if (Elements.empty() && RHS.Elements.empty())
1036
- return false;
1037
-
1038
- // Loop through, intersecting stopping when we hit bits in common.
1039
- while (Iter2 != RHS.Elements.end())
1040
- {
1041
- if (Iter1 == Elements.end())
1042
- return false;
1043
-
1044
- if (Iter1->index() > Iter2->index())
1045
- {
1046
- ++Iter2;
1047
- }
1048
- else if (Iter1->index() == Iter2->index())
1049
- {
1050
- if (Iter1->intersects(*Iter2))
1051
- return true;
1052
- ++Iter1;
1053
- ++Iter2;
1054
- }
1055
- else
1056
- {
1057
- ++Iter1;
1058
- }
1059
- }
1060
- return false;
1061
- }
1062
-
1063
- // Return true iff all bits set in this SparseBitVector are
1064
- // also set in RHS.
1065
- bool contains(const SparseBitVector<ElementSize> &RHS) const
1066
- {
1067
- SparseBitVector<ElementSize> Result(*this);
1068
- Result &= RHS;
1069
- return (Result == RHS);
1070
- }
1071
-
1072
- // Return the first set bit in the bitmap. Return -1 if no bits are set.
1073
- int find_first() const
1074
- {
1075
- if (Elements.empty())
1076
- return -1;
1077
- const SparseBitVectorElement<ElementSize> &First = *(Elements.begin());
1078
- return (First.index() * ElementSize) + First.find_first();
1079
- }
1080
-
1081
- // Return the last set bit in the bitmap. Return -1 if no bits are set.
1082
- int find_last() const
1083
- {
1084
- if (Elements.empty())
1085
- return -1;
1086
- const SparseBitVectorElement<ElementSize> &Last = *(Elements.rbegin());
1087
- return (Last.index() * ElementSize) + Last.find_last();
1088
- }
1089
-
1090
- // Return true if the SparseBitVector is empty
1091
- bool empty() const
1092
- {
1093
- return Elements.empty();
1094
- }
1095
-
1096
- unsigned count() const
1097
- {
1098
- unsigned BitCount = 0;
1099
- for (ElementListConstIter Iter = Elements.begin();
1100
- Iter != Elements.end();
1101
- ++Iter)
1102
- BitCount += Iter->count();
1103
-
1104
- return BitCount;
1105
- }
1106
-
1107
- iterator begin() const
1108
- {
1109
- return iterator(this);
1110
- }
1111
-
1112
- iterator end() const
1113
- {
1114
- return iterator(this, true);
1115
- }
1116
- };
1117
-
1118
- // Convenience functions to allow Or and And without dereferencing in the user
1119
- // code.
1120
-
1121
- template <unsigned ElementSize>
1122
- inline bool operator |=(SparseBitVector<ElementSize> &LHS,
1123
- const SparseBitVector<ElementSize> *RHS)
1124
- {
1125
- return LHS |= *RHS;
1126
- }
1127
-
1128
- template <unsigned ElementSize>
1129
- inline bool operator |=(SparseBitVector<ElementSize> *LHS,
1130
- const SparseBitVector<ElementSize> &RHS)
1131
- {
1132
- return LHS->operator|=(RHS);
1133
- }
1134
-
1135
- template <unsigned ElementSize>
1136
- inline bool operator &=(SparseBitVector<ElementSize> *LHS,
1137
- const SparseBitVector<ElementSize> &RHS)
1138
- {
1139
- return LHS->operator&=(RHS);
1140
- }
1141
-
1142
- template <unsigned ElementSize>
1143
- inline bool operator &=(SparseBitVector<ElementSize> &LHS,
1144
- const SparseBitVector<ElementSize> *RHS)
1145
- {
1146
- return LHS &= *RHS;
1147
- }
1148
-
1149
- // Convenience functions for infix union, intersection, difference operators.
1150
-
1151
- template <unsigned ElementSize>
1152
- inline SparseBitVector<ElementSize>
1153
- operator|(const SparseBitVector<ElementSize> &LHS,
1154
- const SparseBitVector<ElementSize> &RHS)
1155
- {
1156
- SparseBitVector<ElementSize> Result(LHS);
1157
- Result |= RHS;
1158
- return Result;
1159
- }
1160
-
1161
- template <unsigned ElementSize>
1162
- inline SparseBitVector<ElementSize>
1163
- operator&(const SparseBitVector<ElementSize> &LHS,
1164
- const SparseBitVector<ElementSize> &RHS)
1165
- {
1166
- SparseBitVector<ElementSize> Result(LHS);
1167
- Result &= RHS;
1168
- return Result;
1169
- }
1170
-
1171
- template <unsigned ElementSize>
1172
- inline SparseBitVector<ElementSize>
1173
- operator-(const SparseBitVector<ElementSize> &LHS,
1174
- const SparseBitVector<ElementSize> &RHS)
1175
- {
1176
- SparseBitVector<ElementSize> Result;
1177
- Result.intersectWithComplement(LHS, RHS);
1178
- return Result;
1179
- }
1180
-
1181
- // Dump a SparseBitVector to a stream
1182
- template <unsigned ElementSize>
1183
- void dump(const SparseBitVector<ElementSize> &LHS, std::ostream &out)
1184
- {
1185
- out << "[";
1186
-
1187
- typename SparseBitVector<ElementSize>::iterator bi = LHS.begin(),
1188
- be = LHS.end();
1189
- if (bi != be)
1190
- {
1191
- out << *bi;
1192
- for (++bi; bi != be; ++bi)
1193
- {
1194
- out << " " << *bi;
1195
- }
1196
- }
1197
- out << "]\n";
1198
- }
1199
-
1200
- } // End namespace SVF
1201
-
1202
- #endif // SPARSEBITVECTOR_H