svf-lib 1.0.2237 → 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,664 @@
1
+ //===- VFG.h ----------------------------------------------------------------//
2
+ //
3
+ // SVF: Static Value-Flow Analysis
4
+ //
5
+ // Copyright (C) <2013-2018> <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
+ * VFG.h
25
+ *
26
+ * Created on: 18 Sep. 2018
27
+ * Author: Yulei Sui
28
+ */
29
+
30
+ #ifndef INCLUDE_UTIL_VFG_H_
31
+ #define INCLUDE_UTIL_VFG_H_
32
+
33
+
34
+ #include "SVFIR/SVFIR.h"
35
+ #include "Graphs/CallGraph.h"
36
+ #include "Graphs/VFGNode.h"
37
+ #include "Graphs/VFGEdge.h"
38
+
39
+ namespace SVF
40
+ {
41
+
42
+ class PointerAnalysis;
43
+ class VFGStat;
44
+ class CallICFGNode;
45
+
46
+ /*!
47
+ * Value Flow Graph (VFG)
48
+ */
49
+ typedef GenericGraph<VFGNode,VFGEdge> GenericVFGTy;
50
+ class VFG : public GenericVFGTy
51
+ {
52
+
53
+ public:
54
+ /// VFG kind
55
+ enum VFGK
56
+ {
57
+ FULLSVFG, PTRONLYSVFG, FULLSVFG_OPT, PTRONLYSVFG_OPT
58
+ };
59
+
60
+ typedef OrderedMap<NodeID, VFGNode *> VFGNodeIDToNodeMapTy;
61
+ typedef Set<VFGNode*> VFGNodeSet;
62
+ typedef Map<const PAGNode*, NodeID> PAGNodeToDefMapTy;
63
+ typedef Map<std::pair<NodeID,const CallICFGNode*>, ActualParmVFGNode *> PAGNodeToActualParmMapTy;
64
+ typedef Map<const PAGNode*, ActualRetVFGNode *> PAGNodeToActualRetMapTy;
65
+ typedef Map<const PAGNode*, FormalParmVFGNode *> PAGNodeToFormalParmMapTy;
66
+ typedef Map<const PAGNode*, FormalRetVFGNode *> PAGNodeToFormalRetMapTy;
67
+ typedef Map<const PAGEdge*, StmtVFGNode*> PAGEdgeToStmtVFGNodeMapTy;
68
+ typedef Map<const PAGNode*, IntraPHIVFGNode*> PAGNodeToPHIVFGNodeMapTy;
69
+ typedef Map<const PAGNode*, BinaryOPVFGNode*> PAGNodeToBinaryOPVFGNodeMapTy;
70
+ typedef Map<const PAGNode*, UnaryOPVFGNode*> PAGNodeToUnaryOPVFGNodeMapTy;
71
+ typedef Map<const PAGNode*, BranchVFGNode*> PAGNodeToBranchVFGNodeMapTy;
72
+ typedef Map<const PAGNode*, CmpVFGNode*> PAGNodeToCmpVFGNodeMapTy;
73
+ typedef Map<const FunObjVar*, VFGNodeSet > FunToVFGNodesMapTy;
74
+
75
+ typedef FormalParmVFGNode::CallPESet CallPESet;
76
+ typedef FormalRetVFGNode::RetPESet RetPESet;
77
+ typedef VFGEdge::VFGEdgeSetTy VFGEdgeSetTy;
78
+ typedef VFGEdge::SVFGEdgeSetTy SVFGEdgeSetTy;
79
+ typedef VFGEdge::VFGEdgeSetTy::iterator VFGNodeIter;
80
+ typedef VFGNodeIDToNodeMapTy::iterator iterator;
81
+ typedef VFGNodeIDToNodeMapTy::const_iterator const_iterator;
82
+ typedef SVFIR::SVFStmtSet SVFStmtSet;
83
+ typedef Set<const VFGNode*> GlobalVFGNodeSet;
84
+ typedef Set<const PAGNode*> PAGNodeSet;
85
+
86
+
87
+ protected:
88
+ NodeID totalVFGNode;
89
+ PAGNodeToDefMapTy PAGNodeToDefMap; ///< map a pag node to its definition SVG node
90
+ PAGNodeToActualParmMapTy PAGNodeToActualParmMap; ///< map a PAGNode to an actual parameter
91
+ PAGNodeToActualRetMapTy PAGNodeToActualRetMap; ///< map a PAGNode to an actual return
92
+ PAGNodeToFormalParmMapTy PAGNodeToFormalParmMap; ///< map a PAGNode to a formal parameter
93
+ PAGNodeToFormalRetMapTy PAGNodeToFormalRetMap; ///< map a PAGNode to a formal return
94
+ PAGNodeToPHIVFGNodeMapTy PAGNodeToIntraPHIVFGNodeMap; ///< map a PAGNode to its PHIVFGNode
95
+ PAGNodeToBinaryOPVFGNodeMapTy PAGNodeToBinaryOPVFGNodeMap; ///< map a PAGNode to its BinaryOPVFGNode
96
+ PAGNodeToUnaryOPVFGNodeMapTy PAGNodeToUnaryOPVFGNodeMap; ///< map a PAGNode to its UnaryOPVFGNode
97
+ PAGNodeToBranchVFGNodeMapTy PAGNodeToBranchVFGNodeMap; ///< map a PAGNode to its BranchVFGNode
98
+ PAGNodeToCmpVFGNodeMapTy PAGNodeToCmpVFGNodeMap; ///< map a PAGNode to its CmpVFGNode
99
+ PAGEdgeToStmtVFGNodeMapTy PAGEdgeToStmtVFGNodeMap; ///< map a PAGEdge to its StmtVFGNode
100
+ FunToVFGNodesMapTy funToVFGNodesMap; ///< map a function to its VFGNodes;
101
+
102
+ GlobalVFGNodeSet globalVFGNodes; ///< set of global store VFG nodes
103
+ CallGraph* callgraph;
104
+ SVFIR* pag;
105
+ VFGK kind;
106
+
107
+ /// Clean up memory
108
+ void destroy();
109
+
110
+ public:
111
+ /// Constructor
112
+ VFG(CallGraph* callgraph, VFGK k = FULLSVFG);
113
+
114
+ /// Destructor
115
+ virtual ~VFG()
116
+ {
117
+ destroy();
118
+ }
119
+
120
+ /// Get VFG kind
121
+ inline VFGK getKind() const
122
+ {
123
+ return kind;
124
+ }
125
+
126
+ /// Return true if this VFG only contains pointer related SVFGNodes for pointer analysis
127
+ inline bool isPtrOnlySVFG() const
128
+ {
129
+ return (kind == PTRONLYSVFG) || (kind == PTRONLYSVFG_OPT);
130
+ }
131
+
132
+ /// Return SVFIR
133
+ inline SVFIR* getPAG() const
134
+ {
135
+ return pag;
136
+ }
137
+
138
+ /// Return PTACallGraph
139
+ inline CallGraph* getCallGraph() const
140
+ {
141
+ return callgraph;
142
+ }
143
+
144
+ /// Get a VFG node
145
+ inline VFGNode* getVFGNode(NodeID id) const
146
+ {
147
+ return getGNode(id);
148
+ }
149
+
150
+ /// Whether has the VFGNode
151
+ inline bool hasVFGNode(NodeID id) const
152
+ {
153
+ return hasGNode(id);
154
+ }
155
+ /// Return global stores
156
+ inline GlobalVFGNodeSet& getGlobalVFGNodes()
157
+ {
158
+ return globalVFGNodes;
159
+ }
160
+
161
+ /// Get a SVFG edge according to src and dst
162
+ VFGEdge* getIntraVFGEdge(const VFGNode* src, const VFGNode* dst, VFGEdge::VFGEdgeK kind);
163
+
164
+ /// Dump graph into dot file
165
+ void dump(const std::string& file, bool simple = false);
166
+
167
+ /// Dump graph into dot file
168
+ void view();
169
+
170
+ /// Update VFG based on pointer analysis results
171
+ void updateCallGraph(PointerAnalysis* pta);
172
+
173
+ /// Connect VFG nodes between caller and callee for indirect call site
174
+ virtual void connectCallerAndCallee(const CallICFGNode* cs, const FunObjVar* callee, VFGEdgeSetTy& edges);
175
+
176
+ /// Get callsite given a callsiteID
177
+ //@{
178
+ inline CallSiteID getCallSiteID(const CallICFGNode* cs, const FunObjVar* func) const
179
+ {
180
+ return callgraph->getCallSiteID(cs, func);
181
+ }
182
+ inline const CallICFGNode* getCallSite(CallSiteID id) const
183
+ {
184
+ return callgraph->getCallSite(id);
185
+ }
186
+ //@}
187
+
188
+ /// Given a pagNode, return its definition site
189
+ inline const VFGNode* getDefVFGNode(const PAGNode* pagNode) const
190
+ {
191
+ return getVFGNode(getDef(pagNode));
192
+ }
193
+
194
+ // Given an VFG node, return its left hand side top level pointer (PAGnode)
195
+ const PAGNode* getLHSTopLevPtr(const VFGNode* node) const;
196
+
197
+ /// Get an VFGNode
198
+ //@{
199
+ inline StmtVFGNode* getStmtVFGNode(const PAGEdge* pagEdge) const
200
+ {
201
+ PAGEdgeToStmtVFGNodeMapTy::const_iterator it = PAGEdgeToStmtVFGNodeMap.find(pagEdge);
202
+ assert(it != PAGEdgeToStmtVFGNodeMap.end() && "StmtVFGNode can not be found??");
203
+ return it->second;
204
+ }
205
+ inline IntraPHIVFGNode* getIntraPHIVFGNode(const PAGNode* pagNode) const
206
+ {
207
+ PAGNodeToPHIVFGNodeMapTy::const_iterator it = PAGNodeToIntraPHIVFGNodeMap.find(pagNode);
208
+ assert(it != PAGNodeToIntraPHIVFGNodeMap.end() && "PHIVFGNode can not be found??");
209
+ return it->second;
210
+ }
211
+ inline BinaryOPVFGNode* getBinaryOPVFGNode(const PAGNode* pagNode) const
212
+ {
213
+ PAGNodeToBinaryOPVFGNodeMapTy::const_iterator it = PAGNodeToBinaryOPVFGNodeMap.find(pagNode);
214
+ assert(it != PAGNodeToBinaryOPVFGNodeMap.end() && "BinaryOPVFGNode can not be found??");
215
+ return it->second;
216
+ }
217
+ inline UnaryOPVFGNode* getUnaryOPVFGNode(const PAGNode* pagNode) const
218
+ {
219
+ PAGNodeToUnaryOPVFGNodeMapTy::const_iterator it = PAGNodeToUnaryOPVFGNodeMap.find(pagNode);
220
+ assert(it != PAGNodeToUnaryOPVFGNodeMap.end() && "UnaryOPVFGNode can not be found??");
221
+ return it->second;
222
+ }
223
+ inline BranchVFGNode* getBranchVFGNode(const PAGNode* pagNode) const
224
+ {
225
+ PAGNodeToBranchVFGNodeMapTy::const_iterator it = PAGNodeToBranchVFGNodeMap.find(pagNode);
226
+ assert(it != PAGNodeToBranchVFGNodeMap.end() && "BranchVFGNode can not be found??");
227
+ return it->second;
228
+ }
229
+ inline CmpVFGNode* getCmpVFGNode(const PAGNode* pagNode) const
230
+ {
231
+ PAGNodeToCmpVFGNodeMapTy::const_iterator it = PAGNodeToCmpVFGNodeMap.find(pagNode);
232
+ assert(it != PAGNodeToCmpVFGNodeMap.end() && "CmpVFGNode can not be found??");
233
+ return it->second;
234
+ }
235
+ inline ActualParmVFGNode* getActualParmVFGNode(const PAGNode* aparm,const CallICFGNode* cs) const
236
+ {
237
+ PAGNodeToActualParmMapTy::const_iterator it = PAGNodeToActualParmMap.find(std::make_pair(aparm->getId(),cs));
238
+ assert(it!=PAGNodeToActualParmMap.end() && "actual parameter VFG node can not be found??");
239
+ return it->second;
240
+ }
241
+ inline ActualRetVFGNode* getActualRetVFGNode(const PAGNode* aret) const
242
+ {
243
+ PAGNodeToActualRetMapTy::const_iterator it = PAGNodeToActualRetMap.find(aret);
244
+ assert(it!=PAGNodeToActualRetMap.end() && "actual return VFG node can not be found??");
245
+ return it->second;
246
+ }
247
+ inline FormalParmVFGNode* getFormalParmVFGNode(const PAGNode* fparm) const
248
+ {
249
+ PAGNodeToFormalParmMapTy::const_iterator it = PAGNodeToFormalParmMap.find(fparm);
250
+ assert(it!=PAGNodeToFormalParmMap.end() && "formal parameter VFG node can not be found??");
251
+ return it->second;
252
+ }
253
+ inline FormalRetVFGNode* getFormalRetVFGNode(const PAGNode* fret) const
254
+ {
255
+ PAGNodeToFormalRetMapTy::const_iterator it = PAGNodeToFormalRetMap.find(fret);
256
+ assert(it!=PAGNodeToFormalRetMap.end() && "formal return VFG node can not be found??");
257
+ return it->second;
258
+ }
259
+ //@}
260
+
261
+ /// Whether a node is function entry VFGNode
262
+ const FunObjVar* isFunEntryVFGNode(const VFGNode* node) const;
263
+
264
+ /// Whether a PAGNode has a blackhole or const object as its definition
265
+ inline bool hasBlackHoleConstObjAddrAsDef(const PAGNode* pagNode) const
266
+ {
267
+ if (hasDef(pagNode))
268
+ {
269
+ const VFGNode* defNode = getVFGNode(getDef(pagNode));
270
+ if (const AddrVFGNode* addr = SVFUtil::dyn_cast<AddrVFGNode>(defNode))
271
+ {
272
+ if (SVFIR::getPAG()->isBlkObjOrConstantObj(addr->getPAGEdge()->getSrcID()))
273
+ return true;
274
+ }
275
+ else if(const CopyVFGNode* copy = SVFUtil::dyn_cast<CopyVFGNode>(defNode))
276
+ {
277
+ if (SVFIR::getPAG()->isNullPtr(copy->getPAGEdge()->getSrcID()))
278
+ return true;
279
+ }
280
+ }
281
+ return false;
282
+ }
283
+
284
+ /// Return all the VFGNodes of a function
285
+ ///@{
286
+ inline VFGNodeSet& getVFGNodes(const FunObjVar *fun)
287
+ {
288
+ return funToVFGNodesMap[fun];
289
+ }
290
+ inline bool hasVFGNodes(const FunObjVar *fun) const
291
+ {
292
+ return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
293
+ }
294
+ inline bool VFGNodes(const FunObjVar *fun) const
295
+ {
296
+ return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
297
+ }
298
+ inline VFGNodeSet::const_iterator getVFGNodeBegin(const FunObjVar *fun) const
299
+ {
300
+ FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
301
+ assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
302
+ return it->second.begin();
303
+ }
304
+ inline VFGNodeSet::const_iterator getVFGNodeEnd(const FunObjVar *fun) const
305
+ {
306
+ FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
307
+ assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
308
+ return it->second.end();
309
+ }
310
+ ///@}
311
+ /// Add control-flow edges for top level pointers
312
+ //@{
313
+ VFGEdge* addIntraDirectVFEdge(NodeID srcId, NodeID dstId);
314
+ VFGEdge* addCallEdge(NodeID srcId, NodeID dstId, CallSiteID csId);
315
+ VFGEdge* addRetEdge(NodeID srcId, NodeID dstId, CallSiteID csId);
316
+ //@}
317
+
318
+ /// Remove a SVFG edge
319
+ inline void removeVFGEdge(VFGEdge* edge)
320
+ {
321
+ edge->getDstNode()->removeIncomingEdge(edge);
322
+ edge->getSrcNode()->removeOutgoingEdge(edge);
323
+ delete edge;
324
+ }
325
+ /// Remove a VFGNode
326
+ inline void removeVFGNode(VFGNode* node)
327
+ {
328
+ removeGNode(node);
329
+ }
330
+
331
+ /// Whether we has a SVFG edge
332
+ //@{
333
+ VFGEdge* hasIntraVFGEdge(VFGNode* src, VFGNode* dst, VFGEdge::VFGEdgeK kind);
334
+ VFGEdge* hasInterVFGEdge(VFGNode* src, VFGNode* dst, VFGEdge::VFGEdgeK kind, CallSiteID csId);
335
+ VFGEdge* hasThreadVFGEdge(VFGNode* src, VFGNode* dst, VFGEdge::VFGEdgeK kind);
336
+ //@}
337
+
338
+ /// Add VFG edge
339
+ inline bool addVFGEdge(VFGEdge* edge)
340
+ {
341
+ bool added1 = edge->getDstNode()->addIncomingEdge(edge);
342
+ bool added2 = edge->getSrcNode()->addOutgoingEdge(edge);
343
+ bool both_added = added1 & added2;
344
+ assert(both_added && "VFGEdge not added??");
345
+ return both_added;
346
+ }
347
+
348
+ protected:
349
+
350
+ /// sanitize Intra edges, verify that both nodes belong to the same function.
351
+ inline void checkIntraEdgeParents(const VFGNode *srcNode, const VFGNode *dstNode)
352
+ {
353
+ const FunObjVar *srcfun = srcNode->getFun();
354
+ const FunObjVar *dstfun = dstNode->getFun();
355
+ if(srcfun != nullptr && dstfun != nullptr)
356
+ {
357
+ assert((srcfun == dstfun) && "src and dst nodes of an intra VFG edge are not in the same function?");
358
+ }
359
+ }
360
+
361
+ /// Add inter VF edge from actual to formal parameters
362
+ inline VFGEdge* addInterEdgeFromAPToFP(ActualParmVFGNode* src, FormalParmVFGNode* dst, CallSiteID csId)
363
+ {
364
+ return addCallEdge(src->getId(),dst->getId(),csId);
365
+ }
366
+ /// Add inter VF edge from callee return to callsite receive parameter
367
+ inline VFGEdge* addInterEdgeFromFRToAR(FormalRetVFGNode* src, ActualRetVFGNode* dst, CallSiteID csId)
368
+ {
369
+ return addRetEdge(src->getId(),dst->getId(),csId);
370
+ }
371
+
372
+ /// Add inter VF edge from actual to formal parameters
373
+ inline VFGEdge* addInterEdgeFromAPToFP(NodeID src, NodeID dst, CallSiteID csId)
374
+ {
375
+ return addCallEdge(src,dst,csId);
376
+ }
377
+ /// Add inter VF edge from callee return to callsite receive parameter
378
+ inline VFGEdge* addInterEdgeFromFRToAR(NodeID src, NodeID dst, CallSiteID csId)
379
+ {
380
+ return addRetEdge(src,dst,csId);
381
+ }
382
+
383
+ /// Connect VFG nodes between caller and callee for indirect call site
384
+ //@{
385
+ /// Connect actual-param and formal param
386
+ virtual inline void connectAParamAndFParam(const PAGNode* csArg, const PAGNode* funArg, const CallICFGNode* cbn, CallSiteID csId, VFGEdgeSetTy& edges)
387
+ {
388
+ NodeID actualParam = getActualParmVFGNode(csArg, cbn)->getId();
389
+ NodeID formalParam = getFormalParmVFGNode(funArg)->getId();
390
+ VFGEdge* edge = addInterEdgeFromAPToFP(actualParam, formalParam,csId);
391
+ if (edge != nullptr)
392
+ edges.insert(edge);
393
+ }
394
+ /// Connect formal-ret and actual ret
395
+ virtual inline void connectFRetAndARet(const PAGNode* funReturn, const PAGNode* csReturn, CallSiteID csId, VFGEdgeSetTy& edges)
396
+ {
397
+ NodeID formalRet = getFormalRetVFGNode(funReturn)->getId();
398
+ NodeID actualRet = getActualRetVFGNode(csReturn)->getId();
399
+ VFGEdge* edge = addInterEdgeFromFRToAR(formalRet, actualRet,csId);
400
+ if (edge != nullptr)
401
+ edges.insert(edge);
402
+ }
403
+ //@}
404
+
405
+ /// Given a PAGNode, set/get its def VFG node (definition of top level pointers)
406
+ //@{
407
+ inline void setDef(const PAGNode* pagNode, const VFGNode* node)
408
+ {
409
+ PAGNodeToDefMapTy::iterator it = PAGNodeToDefMap.find(pagNode);
410
+ if(it == PAGNodeToDefMap.end())
411
+ {
412
+ PAGNodeToDefMap[pagNode] = node->getId();
413
+ assert(hasVFGNode(node->getId()) && "not in the map!!");
414
+ }
415
+ else
416
+ {
417
+ assert((it->second == node->getId()) && "a SVFVar can only have unique definition ");
418
+ }
419
+ }
420
+ inline NodeID getDef(const PAGNode* pagNode) const
421
+ {
422
+ PAGNodeToDefMapTy::const_iterator it = PAGNodeToDefMap.find(pagNode);
423
+ assert(it!=PAGNodeToDefMap.end() && "SVFVar does not have a definition??");
424
+ return it->second;
425
+ }
426
+ inline bool hasDef(const PAGNode* pagNode) const
427
+ {
428
+ return (PAGNodeToDefMap.find(pagNode) != PAGNodeToDefMap.end());
429
+ }
430
+ //@}
431
+
432
+ /// Create VFG nodes
433
+ void addVFGNodes();
434
+
435
+ /// Get PAGEdge set
436
+ virtual inline SVFStmt::SVFStmtSetTy& getPAGEdgeSet(SVFStmt::PEDGEK kind)
437
+ {
438
+ if (isPtrOnlySVFG())
439
+ return pag->getPTASVFStmtSet(kind);
440
+ else
441
+ return pag->getSVFStmtSet(kind);
442
+ }
443
+
444
+ virtual inline bool isInterestedPAGNode(const SVFVar* node) const
445
+ {
446
+ if (isPtrOnlySVFG())
447
+ return node->isPointer();
448
+ else
449
+ return true;
450
+ }
451
+
452
+ /// Create edges between VFG nodes within a function
453
+ void connectDirectVFGEdges();
454
+
455
+ /// Create edges between VFG nodes across functions
456
+ void addVFGInterEdges(const CallICFGNode* cs, const FunObjVar* callee);
457
+
458
+ inline bool isPhiCopyEdge(const PAGEdge* copy) const
459
+ {
460
+ return pag->isPhiNode(copy->getDstNode());
461
+ }
462
+
463
+ /// Add a VFG node
464
+ virtual inline void addVFGNode(VFGNode* vfgNode, ICFGNode* icfgNode)
465
+ {
466
+ addGNode(vfgNode->getId(), vfgNode);
467
+ vfgNode->setICFGNode(icfgNode);
468
+ icfgNode->addVFGNode(vfgNode);
469
+
470
+ if(const FunObjVar* fun = icfgNode->getFun())
471
+ funToVFGNodesMap[fun].insert(vfgNode);
472
+ else
473
+ globalVFGNodes.insert(vfgNode);
474
+ }
475
+
476
+ /// Add a VFG node for program statement
477
+ inline void addStmtVFGNode(StmtVFGNode* node, const PAGEdge* pagEdge)
478
+ {
479
+ assert(PAGEdgeToStmtVFGNodeMap.find(pagEdge)==PAGEdgeToStmtVFGNodeMap.end() && "should not insert twice!");
480
+ PAGEdgeToStmtVFGNodeMap[pagEdge] = node;
481
+ addVFGNode(node, pagEdge->getICFGNode());
482
+ }
483
+ /// Add a Dummy VFG node for null pointer definition
484
+ /// To be noted for black hole pointer it has already has address edge connected
485
+ inline void addNullPtrVFGNode(const PAGNode* pagNode)
486
+ {
487
+ NullPtrVFGNode* sNode = new NullPtrVFGNode(totalVFGNode++,pagNode);
488
+ addVFGNode(sNode, pag->getICFG()->getGlobalICFGNode());
489
+ setDef(pagNode,sNode);
490
+ }
491
+ /// Add an Address VFG node
492
+ inline void addAddrVFGNode(const AddrStmt* addr)
493
+ {
494
+ AddrVFGNode* sNode = new AddrVFGNode(totalVFGNode++,addr);
495
+ addStmtVFGNode(sNode, addr);
496
+ setDef(addr->getLHSVar(),sNode);
497
+ }
498
+ /// Add a Copy VFG node
499
+ inline void addCopyVFGNode(const CopyStmt* copy)
500
+ {
501
+ CopyVFGNode* sNode = new CopyVFGNode(totalVFGNode++,copy);
502
+ addStmtVFGNode(sNode, copy);
503
+ setDef(copy->getLHSVar(),sNode);
504
+ }
505
+ /// Add a Gep VFG node
506
+ inline void addGepVFGNode(const GepStmt* gep)
507
+ {
508
+ GepVFGNode* sNode = new GepVFGNode(totalVFGNode++,gep);
509
+ addStmtVFGNode(sNode, gep);
510
+ setDef(gep->getLHSVar(),sNode);
511
+ }
512
+ /// Add a Load VFG node
513
+ void addLoadVFGNode(const LoadStmt* load)
514
+ {
515
+ LoadVFGNode* sNode = new LoadVFGNode(totalVFGNode++,load);
516
+ addStmtVFGNode(sNode, load);
517
+ setDef(load->getLHSVar(),sNode);
518
+ }
519
+ /// Add a Store VFG node,
520
+ /// To be noted store does not create a new pointer, we do not set def for any SVFIR node
521
+ void addStoreVFGNode(const StoreStmt* store)
522
+ {
523
+ StoreVFGNode* sNode = new StoreVFGNode(totalVFGNode++,store);
524
+ addStmtVFGNode(sNode, store);
525
+ }
526
+
527
+ /// Add an actual parameter VFG node
528
+ /// To be noted that multiple actual parameters may have same value (PAGNode)
529
+ /// So we need to make a pair <PAGNodeID,CallSiteID> to find the right VFGParmNode
530
+ inline void addActualParmVFGNode(const PAGNode* aparm, const CallICFGNode* cs)
531
+ {
532
+ ActualParmVFGNode* sNode = new ActualParmVFGNode(totalVFGNode++,aparm,cs);
533
+ addVFGNode(sNode, const_cast<CallICFGNode*>(cs));
534
+ PAGNodeToActualParmMap[std::make_pair(aparm->getId(),cs)] = sNode;
535
+ /// do not set def here, this node is not a variable definition
536
+ }
537
+ /// Add a formal parameter VFG node
538
+ inline void addFormalParmVFGNode(const PAGNode* fparm, const FunObjVar* fun, CallPESet& callPEs)
539
+ {
540
+ FormalParmVFGNode* sNode = new FormalParmVFGNode(totalVFGNode++,fparm,fun);
541
+ addVFGNode(sNode, pag->getICFG()->getFunEntryICFGNode(fun));
542
+ for(CallPESet::const_iterator it = callPEs.begin(), eit=callPEs.end();
543
+ it!=eit; ++it)
544
+ sNode->addCallPE(*it);
545
+
546
+ setDef(fparm,sNode);
547
+ PAGNodeToFormalParmMap[fparm] = sNode;
548
+ }
549
+ /// Add a callee Return VFG node
550
+ /// To be noted that here we assume returns of a procedure have already been unified into one
551
+ /// Otherwise, we need to handle formalRet using <PAGNodeID,CallSiteID> pair to find FormalRetVFG node same as handling actual parameters
552
+ inline void addFormalRetVFGNode(const PAGNode* uniqueFunRet, const FunObjVar* fun, RetPESet& retPEs)
553
+ {
554
+ FormalRetVFGNode *sNode = new FormalRetVFGNode(totalVFGNode++, uniqueFunRet, fun);
555
+ addVFGNode(sNode, pag->getICFG()->getFunExitICFGNode(fun));
556
+ for (RetPESet::const_iterator it = retPEs.begin(), eit = retPEs.end(); it != eit; ++it)
557
+ sNode->addRetPE(*it);
558
+
559
+ PAGNodeToFormalRetMap[uniqueFunRet] = sNode;
560
+ /// if this uniqueFunRet is a phi node, which means it will receive values from multiple return instructions of fun
561
+ /// we will set this phi node's def later
562
+ /// Ideally, every function uniqueFunRet should be a PhiNode (SVFIRBuilder.cpp), unless it does not have ret instruction
563
+ if (!pag->isPhiNode(uniqueFunRet))
564
+ {
565
+ std::string warn = fun->getName();
566
+ SVFUtil::writeWrnMsg(warn + " does not have any ret instruction!");
567
+ setDef(uniqueFunRet, sNode);
568
+ }
569
+ }
570
+ /// Add a callsite Receive VFG node
571
+ inline void addActualRetVFGNode(const PAGNode* ret,const CallICFGNode* cs)
572
+ {
573
+ ActualRetVFGNode* sNode = new ActualRetVFGNode(totalVFGNode++,ret,cs);
574
+ addVFGNode(sNode, const_cast<RetICFGNode*>(cs->getRetICFGNode()));
575
+ setDef(ret,sNode);
576
+ PAGNodeToActualRetMap[ret] = sNode;
577
+ }
578
+ /// Add an llvm PHI VFG node
579
+ inline void addIntraPHIVFGNode(const MultiOpndStmt* edge)
580
+ {
581
+ IntraPHIVFGNode* sNode = new IntraPHIVFGNode(totalVFGNode++,edge->getRes());
582
+ u32_t pos = 0;
583
+ for(auto var : edge->getOpndVars())
584
+ {
585
+ sNode->setOpVerAndBB(pos, var, edge->getICFGNode());
586
+ pos++;
587
+ }
588
+ addVFGNode(sNode,edge->getICFGNode());
589
+ setDef(edge->getRes(),sNode);
590
+ PAGNodeToIntraPHIVFGNodeMap[edge->getRes()] = sNode;
591
+ }
592
+ /// Add a Compare VFG node
593
+ inline void addCmpVFGNode(const CmpStmt* edge)
594
+ {
595
+ CmpVFGNode* sNode = new CmpVFGNode(totalVFGNode++, edge->getRes());
596
+ u32_t pos = 0;
597
+ for(auto var : edge->getOpndVars())
598
+ {
599
+ sNode->setOpVer(pos, var);
600
+ pos++;
601
+ }
602
+ addVFGNode(sNode,edge->getICFGNode());
603
+ setDef(edge->getRes(),sNode);
604
+ PAGNodeToCmpVFGNodeMap[edge->getRes()] = sNode;
605
+ }
606
+ /// Add a BinaryOperator VFG node
607
+ inline void addBinaryOPVFGNode(const BinaryOPStmt* edge)
608
+ {
609
+ BinaryOPVFGNode* sNode = new BinaryOPVFGNode(totalVFGNode++, edge->getRes());
610
+ u32_t pos = 0;
611
+ for(auto var : edge->getOpndVars())
612
+ {
613
+ sNode->setOpVer(pos, var);
614
+ pos++;
615
+ }
616
+ addVFGNode(sNode,edge->getICFGNode());
617
+ setDef(edge->getRes(),sNode);
618
+ PAGNodeToBinaryOPVFGNodeMap[edge->getRes()] = sNode;
619
+ }
620
+ /// Add a UnaryOperator VFG node
621
+ inline void addUnaryOPVFGNode(const UnaryOPStmt* edge)
622
+ {
623
+ UnaryOPVFGNode* sNode = new UnaryOPVFGNode(totalVFGNode++, edge->getRes());
624
+ sNode->setOpVer(0, edge->getOpVar());
625
+ addVFGNode(sNode,edge->getICFGNode());
626
+ setDef(edge->getRes(),sNode);
627
+ PAGNodeToUnaryOPVFGNodeMap[edge->getRes()] = sNode;
628
+ }
629
+ /// Add a BranchVFGNode
630
+ inline void addBranchVFGNode(const BranchStmt* edge)
631
+ {
632
+ BranchVFGNode* sNode = new BranchVFGNode(totalVFGNode++, edge);
633
+ addVFGNode(sNode,edge->getICFGNode());
634
+ setDef(edge->getBranchInst(),sNode);
635
+ PAGNodeToBranchVFGNodeMap[edge->getBranchInst()] = sNode;
636
+ }
637
+ };
638
+
639
+ } // End namespace SVF
640
+
641
+ namespace SVF
642
+ {
643
+ /* !
644
+ * GenericGraphTraits specializations for generic graph algorithms.
645
+ * Provide graph traits for traversing from a constraint node using standard graph traversals.
646
+ */
647
+ template<> struct GenericGraphTraits<SVF::VFGNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::VFGNode,SVF::VFGEdge>* >
648
+ {
649
+ };
650
+
651
+ /// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
652
+ template<>
653
+ struct GenericGraphTraits<Inverse<SVF::VFGNode *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::VFGNode,SVF::VFGEdge>* > >
654
+ {
655
+ };
656
+
657
+ template<> struct GenericGraphTraits<SVF::VFG*> : public GenericGraphTraits<SVF::GenericGraph<SVF::VFGNode,SVF::VFGEdge>* >
658
+ {
659
+ typedef SVF::VFGNode *NodeRef;
660
+ };
661
+
662
+ } // End namespace llvm
663
+
664
+ #endif /* INCLUDE_UTIL_VFG_H_ */