svf-tools 1.0.569 → 1.0.571

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 (151) hide show
  1. package/SVF-doxygen/html/html/CFLAlias_8cpp_source.html +28 -10
  2. package/SVF-doxygen/html/html/CFLAlias_8h.html +1 -0
  3. package/SVF-doxygen/html/html/CFLAlias_8h_source.html +41 -22
  4. package/SVF-doxygen/html/html/CFLGramGraphChecker_8h_source.html +7 -7
  5. package/SVF-doxygen/html/html/CFLGraphBuilder_8cpp_source.html +11 -8
  6. package/SVF-doxygen/html/html/CFLGraphBuilder_8h.html +3 -0
  7. package/SVF-doxygen/html/html/CFLGraphBuilder_8h_source.html +18 -15
  8. package/SVF-doxygen/html/html/CFLSolver_8cpp_source.html +6 -6
  9. package/SVF-doxygen/html/html/CFLSolver_8h_source.html +15 -15
  10. package/SVF-doxygen/html/html/CFLStat_8cpp.html +80 -0
  11. package/SVF-doxygen/html/html/CFLStat_8cpp_source.html +148 -0
  12. package/SVF-doxygen/html/html/CFLStat_8h.html +96 -0
  13. package/SVF-doxygen/html/html/CFLStat_8h_source.html +105 -0
  14. package/SVF-doxygen/html/html/CFLVF_8cpp.html +82 -0
  15. package/SVF-doxygen/html/html/CFLVF_8cpp_source.html +106 -0
  16. package/SVF-doxygen/html/html/CFLVF_8h.html +103 -0
  17. package/SVF-doxygen/html/html/CFLVF_8h_source.html +110 -0
  18. package/SVF-doxygen/html/html/LLVMLoopAnalysis_8cpp_source.html +1 -1
  19. package/SVF-doxygen/html/html/Options_8cpp_source.html +4 -3
  20. package/SVF-doxygen/html/html/Options_8h_source.html +4 -3
  21. package/SVF-doxygen/html/html/PointerAnalysisImpl_8cpp_source.html +1 -1
  22. package/SVF-doxygen/html/html/VFG_8txt.html +98 -0
  23. package/SVF-doxygen/html/html/annotated.html +262 -259
  24. package/SVF-doxygen/html/html/cfl_8cpp.html +7 -4
  25. package/SVF-doxygen/html/html/cfl_8cpp_source.html +6 -3
  26. package/SVF-doxygen/html/html/classSVF_1_1AliasCFLGraphBuilder.html +11 -11
  27. package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +8 -6
  28. package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.png +0 -0
  29. package/SVF-doxygen/html/html/classSVF_1_1CFLAlias-members.html +130 -113
  30. package/SVF-doxygen/html/html/classSVF_1_1CFLAlias.html +554 -81
  31. package/SVF-doxygen/html/html/classSVF_1_1CFLGramGraphChecker.html +3 -3
  32. package/SVF-doxygen/html/html/classSVF_1_1CFLGraphBuilder.html +27 -26
  33. package/SVF-doxygen/html/html/classSVF_1_1CFLGraphBuilder.png +0 -0
  34. package/SVF-doxygen/html/html/classSVF_1_1CFLSolver.html +32 -32
  35. package/SVF-doxygen/html/html/classSVF_1_1CFLStat-members.html +123 -0
  36. package/SVF-doxygen/html/html/classSVF_1_1CFLStat.html +700 -0
  37. package/SVF-doxygen/html/html/classSVF_1_1CFLStat.png +0 -0
  38. package/SVF-doxygen/html/html/classSVF_1_1CFLVF-members.html +259 -0
  39. package/SVF-doxygen/html/html/classSVF_1_1CFLVF.html +854 -0
  40. package/SVF-doxygen/html/html/classSVF_1_1CFLVF.png +0 -0
  41. package/SVF-doxygen/html/html/classSVF_1_1LLVMLoopAnalysis.html +1 -1
  42. package/SVF-doxygen/html/html/classSVF_1_1Options-members.html +112 -111
  43. package/SVF-doxygen/html/html/classSVF_1_1Options.html +28 -2
  44. package/SVF-doxygen/html/html/classSVF_1_1PTAStat.html +8 -7
  45. package/SVF-doxygen/html/html/classSVF_1_1PTAStat.png +0 -0
  46. package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +8 -7
  47. package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.png +0 -0
  48. package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +1 -1
  49. package/SVF-doxygen/html/html/classSVF_1_1SVFStat.html +9 -8
  50. package/SVF-doxygen/html/html/classSVF_1_1SVFStat.png +0 -0
  51. package/SVF-doxygen/html/html/classSVF_1_1VFCFLGraphBuilder-members.html +100 -0
  52. package/SVF-doxygen/html/html/classSVF_1_1VFCFLGraphBuilder.html +407 -0
  53. package/SVF-doxygen/html/html/classSVF_1_1VFCFLGraphBuilder.png +0 -0
  54. package/SVF-doxygen/html/html/classes.html +100 -100
  55. package/SVF-doxygen/html/html/dir_98f9a352f241e0e917d4efaa4086f6e8.html +4 -0
  56. package/SVF-doxygen/html/html/dir_ae8aa099e368efaa962140c6624142bc.html +4 -0
  57. package/SVF-doxygen/html/html/files.html +6 -2
  58. package/SVF-doxygen/html/html/functions.html +11 -0
  59. package/SVF-doxygen/html/html/functions_0x7e.html +6 -0
  60. package/SVF-doxygen/html/html/functions_a.html +9 -5
  61. package/SVF-doxygen/html/html/functions_b.html +4 -2
  62. package/SVF-doxygen/html/html/functions_c.html +48 -24
  63. package/SVF-doxygen/html/html/functions_f.html +6 -6
  64. package/SVF-doxygen/html/html/functions_func.html +17 -14
  65. package/SVF-doxygen/html/html/functions_func_0x7e.html +6 -0
  66. package/SVF-doxygen/html/html/functions_func_b.html +4 -2
  67. package/SVF-doxygen/html/html/functions_func_c.html +38 -26
  68. package/SVF-doxygen/html/html/functions_func_g.html +12 -9
  69. package/SVF-doxygen/html/html/functions_func_p.html +5 -4
  70. package/SVF-doxygen/html/html/functions_func_s.html +8 -7
  71. package/SVF-doxygen/html/html/functions_g.html +15 -10
  72. package/SVF-doxygen/html/html/functions_l.html +3 -3
  73. package/SVF-doxygen/html/html/functions_m.html +4 -2
  74. package/SVF-doxygen/html/html/functions_n.html +8 -0
  75. package/SVF-doxygen/html/html/functions_o.html +15 -15
  76. package/SVF-doxygen/html/html/functions_p.html +16 -14
  77. package/SVF-doxygen/html/html/functions_r.html +2 -2
  78. package/SVF-doxygen/html/html/functions_s.html +16 -12
  79. package/SVF-doxygen/html/html/functions_t.html +9 -3
  80. package/SVF-doxygen/html/html/functions_type_c.html +1 -0
  81. package/SVF-doxygen/html/html/functions_v.html +3 -3
  82. package/SVF-doxygen/html/html/functions_vars.html +11 -0
  83. package/SVF-doxygen/html/html/functions_vars_a.html +1 -0
  84. package/SVF-doxygen/html/html/functions_vars_c.html +5 -0
  85. package/SVF-doxygen/html/html/functions_vars_g.html +2 -0
  86. package/SVF-doxygen/html/html/functions_vars_m.html +3 -1
  87. package/SVF-doxygen/html/html/functions_vars_n.html +8 -0
  88. package/SVF-doxygen/html/html/functions_vars_p.html +1 -0
  89. package/SVF-doxygen/html/html/functions_vars_s.html +4 -1
  90. package/SVF-doxygen/html/html/functions_vars_t.html +6 -0
  91. package/SVF-doxygen/html/html/functions_w.html +11 -11
  92. package/SVF-doxygen/html/html/globals.html +2 -1
  93. package/SVF-doxygen/html/html/globals_vars.html +2 -1
  94. package/SVF-doxygen/html/html/hierarchy.html +14 -11
  95. package/SVF-doxygen/html/html/namespaceSVF.html +6 -0
  96. package/SVF-doxygen/html/html/search/all_0.js +10 -9
  97. package/SVF-doxygen/html/html/search/all_1.js +4 -4
  98. package/SVF-doxygen/html/html/search/all_10.js +10 -10
  99. package/SVF-doxygen/html/html/search/all_11.js +1 -1
  100. package/SVF-doxygen/html/html/search/all_12.js +10 -10
  101. package/SVF-doxygen/html/html/search/all_13.js +12 -12
  102. package/SVF-doxygen/html/html/search/all_15.js +4 -2
  103. package/SVF-doxygen/html/html/search/all_16.js +2 -2
  104. package/SVF-doxygen/html/html/search/all_19.js +2 -0
  105. package/SVF-doxygen/html/html/search/all_2.js +2 -2
  106. package/SVF-doxygen/html/html/search/all_3.js +16 -8
  107. package/SVF-doxygen/html/html/search/all_6.js +3 -3
  108. package/SVF-doxygen/html/html/search/all_7.js +3 -2
  109. package/SVF-doxygen/html/html/search/all_b.js +1 -1
  110. package/SVF-doxygen/html/html/search/all_c.js +2 -2
  111. package/SVF-doxygen/html/html/search/all_d.js +3 -3
  112. package/SVF-doxygen/html/html/search/all_e.js +9 -9
  113. package/SVF-doxygen/html/html/search/all_f.js +3 -3
  114. package/SVF-doxygen/html/html/search/classes_12.js +1 -0
  115. package/SVF-doxygen/html/html/search/classes_2.js +2 -0
  116. package/SVF-doxygen/html/html/search/files_2.js +4 -0
  117. package/SVF-doxygen/html/html/search/files_f.js +1 -0
  118. package/SVF-doxygen/html/html/search/functions_0.js +3 -3
  119. package/SVF-doxygen/html/html/search/functions_1.js +2 -2
  120. package/SVF-doxygen/html/html/search/functions_11.js +1 -1
  121. package/SVF-doxygen/html/html/search/functions_17.js +2 -0
  122. package/SVF-doxygen/html/html/search/functions_2.js +6 -3
  123. package/SVF-doxygen/html/html/search/functions_6.js +1 -0
  124. package/SVF-doxygen/html/html/search/functions_f.js +2 -2
  125. package/SVF-doxygen/html/html/search/typedefs_2.js +1 -1
  126. package/SVF-doxygen/html/html/search/variables_0.js +10 -9
  127. package/SVF-doxygen/html/html/search/variables_1.js +1 -1
  128. package/SVF-doxygen/html/html/search/variables_10.js +1 -1
  129. package/SVF-doxygen/html/html/search/variables_12.js +3 -3
  130. package/SVF-doxygen/html/html/search/variables_13.js +10 -10
  131. package/SVF-doxygen/html/html/search/variables_3.js +3 -2
  132. package/SVF-doxygen/html/html/search/variables_7.js +2 -2
  133. package/SVF-doxygen/html/html/search/variables_d.js +2 -2
  134. package/SVF-doxygen/html/html/search/variables_e.js +9 -9
  135. package/images/svf-stat.pdf +0 -0
  136. package/include/CFL/CFLAlias.h +31 -0
  137. package/include/CFL/CFLGramGraphChecker.h +3 -0
  138. package/include/CFL/CFLGraphBuilder.h +22 -0
  139. package/include/CFL/CFLSolver.h +6 -1
  140. package/include/CFL/CFLStat.h +88 -0
  141. package/include/CFL/CFLVF.h +77 -0
  142. package/include/CFL/VFG.txt +6 -0
  143. package/include/Util/Options.h +1 -0
  144. package/lib/CFL/CFLAlias.cpp +20 -0
  145. package/lib/CFL/CFLGraphBuilder.cpp +71 -0
  146. package/lib/CFL/CFLStat.cpp +269 -0
  147. package/lib/CFL/CFLVF.cpp +89 -0
  148. package/lib/MemoryModel/PointerAnalysisImpl.cpp +1 -1
  149. package/lib/Util/Options.cpp +6 -0
  150. package/package.json +1 -1
  151. package/tools/CFL/cfl.cpp +14 -4
@@ -0,0 +1,269 @@
1
+ //===- CFLStat.cpp -- Statistics of CFL Reachability's analysis------------------//
2
+ //
3
+ // SVF: Static Value-Flow Analysis
4
+ //
5
+ // Copyright (C) <2013-2017> <Yulei Sui>
6
+ //
7
+
8
+ // This program is free software: you can redistribute it and/or modify
9
+ // it under the terms of the GNU 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 General Public License for more details.
17
+
18
+ // You should have received a copy of the GNU General Public License
19
+ // along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ //
21
+ //===----------------------------------------------------------------------===//
22
+
23
+ /*
24
+ * CFLStat.cpp
25
+ *
26
+ * Created on: 17 Sep, 2022
27
+ * Author: Pei Xu
28
+ */
29
+
30
+ #include "CFL/CFLStat.h"
31
+
32
+ using namespace SVF;
33
+ using namespace SVFUtil;
34
+ using namespace std;
35
+
36
+ u32_t CFLStat::_MaxPtsSize = 0;
37
+ u32_t CFLStat::_NumOfCycles = 0;
38
+ u32_t CFLStat::_NumOfPWCCycles = 0;
39
+ u32_t CFLStat::_NumOfNodesInCycles = 0;
40
+ u32_t CFLStat::_MaxNumOfNodesInSCC = 0;
41
+
42
+ const char* CFLStat::CollapseTime = "CollapseTime";
43
+
44
+ /*!
45
+ * Constructor
46
+ */
47
+ CFLStat::CFLStat(CFLAlias* p): PTAStat(p),pta(p)
48
+ {
49
+ _NumOfNullPtr = 0;
50
+ _NumOfConstantPtr= 0;
51
+ _NumOfBlackholePtr = 0;
52
+ startClk();
53
+ }
54
+
55
+ /*!
56
+ * Collect CFLGraph information
57
+ */
58
+ void CFLStat::collectCFLInfo(CFLGraph* CFLGraph)
59
+ {
60
+ _NumOfCycles = 0;
61
+ _NumOfPWCCycles = 0;
62
+ _NumOfNodesInCycles = 0;
63
+ NodeSet repNodes;
64
+ repNodes.clear();
65
+ }
66
+
67
+
68
+
69
+ /*!
70
+ * Collect cycle information
71
+ */
72
+ void CFLStat::collectCycleInfo(ConstraintGraph* consCG)
73
+ {
74
+ _NumOfCycles = 0;
75
+ _NumOfPWCCycles = 0;
76
+ _NumOfNodesInCycles = 0;
77
+ NodeSet repNodes;
78
+ repNodes.clear();
79
+ for(ConstraintGraph::iterator it = consCG->begin(), eit = consCG->end(); it!=eit; ++it)
80
+ {
81
+ // sub nodes have been removed from the constraint graph, only rep nodes are left.
82
+ NodeID repNode = consCG->sccRepNode(it->first);
83
+ NodeBS& subNodes = consCG->sccSubNodes(repNode);
84
+ NodeBS clone = subNodes;
85
+ for (NodeBS::iterator it = subNodes.begin(), eit = subNodes.end(); it != eit; ++it)
86
+ {
87
+ NodeID nodeId = *it;
88
+ PAGNode* pagNode = pta->getPAG()->getGNode(nodeId);
89
+ if (SVFUtil::isa<ObjVar>(pagNode) && pta->isFieldInsensitive(nodeId))
90
+ {
91
+ NodeID baseId = consCG->getBaseObjVar(nodeId);
92
+ clone.reset(nodeId);
93
+ clone.set(baseId);
94
+ }
95
+ }
96
+ u32_t num = clone.count();
97
+ if (num > 1)
98
+ {
99
+ if(repNodes.insert(repNode).second)
100
+ {
101
+ _NumOfNodesInCycles += num;
102
+ if(consCG->isPWCNode(repNode))
103
+ _NumOfPWCCycles ++;
104
+ }
105
+ if( num > _MaxNumOfNodesInSCC)
106
+ _MaxNumOfNodesInSCC = num;
107
+ }
108
+ }
109
+ _NumOfCycles += repNodes.size();
110
+ }
111
+
112
+ void CFLStat::constraintGraphStat()
113
+ {
114
+
115
+
116
+ u32_t numOfCopys = 0;
117
+ u32_t numOfGeps = 0;
118
+
119
+ u32_t totalNodeNumber = 0;
120
+ u32_t cgNodeNumber = 0;
121
+ u32_t objNodeNumber = 0;
122
+ u32_t addrtotalIn = 0;
123
+ u32_t addrmaxIn = 0;
124
+ u32_t addrmaxOut = 0;
125
+ u32_t copytotalIn = 0;
126
+ u32_t copymaxIn = 0;
127
+ u32_t copymaxOut = 0;
128
+ u32_t loadtotalIn = 0;
129
+ u32_t loadmaxIn = 0;
130
+ u32_t loadmaxOut = 0;
131
+ u32_t storetotalIn = 0;
132
+ u32_t storemaxIn = 0;
133
+ u32_t storemaxOut = 0;
134
+
135
+ double storeavgIn = (double)storetotalIn/cgNodeNumber;
136
+ double loadavgIn = (double)loadtotalIn/cgNodeNumber;
137
+ double copyavgIn = (double)copytotalIn/cgNodeNumber;
138
+ double addravgIn = (double)addrtotalIn/cgNodeNumber;
139
+ double avgIn = (double)(addrtotalIn + copytotalIn + loadtotalIn + storetotalIn)/cgNodeNumber;
140
+
141
+
142
+ PTNumStatMap["NumOfCGNode"] = totalNodeNumber;
143
+ PTNumStatMap["TotalValidNode"] = cgNodeNumber;
144
+ PTNumStatMap["TotalValidObjNode"] = objNodeNumber;
145
+ PTNumStatMap["NumOfCopys"] = numOfCopys;
146
+ PTNumStatMap["NumOfGeps"] = numOfGeps;
147
+ PTNumStatMap["MaxInCopyEdge"] = copymaxIn;
148
+ PTNumStatMap["MaxOutCopyEdge"] = copymaxOut;
149
+ PTNumStatMap["MaxInLoadEdge"] = loadmaxIn;
150
+ PTNumStatMap["MaxOutLoadEdge"] = loadmaxOut;
151
+ PTNumStatMap["MaxInStoreEdge"] = storemaxIn;
152
+ PTNumStatMap["MaxOutStoreEdge"] = storemaxOut;
153
+ PTNumStatMap["AvgIn/OutStoreEdge"] = storeavgIn;
154
+ PTNumStatMap["MaxInAddrEdge"] = addrmaxIn;
155
+ PTNumStatMap["MaxOutAddrEdge"] = addrmaxOut;
156
+ timeStatMap["AvgIn/OutCopyEdge"] = copyavgIn;
157
+ timeStatMap["AvgIn/OutLoadEdge"] = loadavgIn;
158
+ timeStatMap["AvgIn/OutAddrEdge"] = addravgIn;
159
+ timeStatMap["AvgIn/OutEdge"] = avgIn;
160
+
161
+ PTAStat::printStat("CFL Graph Stats");
162
+ }
163
+ /*!
164
+ * Stat null pointers
165
+ */
166
+ void CFLStat::statNullPtr()
167
+ {
168
+
169
+ _NumOfNullPtr = 0;
170
+ for (SVFIR::iterator iter = pta->getPAG()->begin(), eiter = pta->getPAG()->end();
171
+ iter != eiter; ++iter)
172
+ {
173
+ NodeID pagNodeId = iter->first;
174
+ PAGNode* pagNode = iter->second;
175
+ if (SVFUtil::isa<ValVar>(pagNode) == false)
176
+ continue;
177
+ SVFStmt::SVFStmtSetTy& inComingStore = pagNode->getIncomingEdges(SVFStmt::Store);
178
+ SVFStmt::SVFStmtSetTy& outGoingLoad = pagNode->getOutgoingEdges(SVFStmt::Load);
179
+ if (inComingStore.empty()==false || outGoingLoad.empty()==false)
180
+ {
181
+ ///TODO: change the condition here to fetch the points-to set
182
+ const PointsTo& pts = pta->getPts(pagNodeId);
183
+ if (pta->containBlackHoleNode(pts))
184
+ _NumOfBlackholePtr++;
185
+
186
+ if (pta->containConstantNode(pts))
187
+ _NumOfConstantPtr++;
188
+
189
+ if(pts.empty())
190
+ {
191
+ std::string str;
192
+ raw_string_ostream rawstr(str);
193
+ if (!SVFUtil::isa<DummyValVar>(pagNode) && !SVFUtil::isa<DummyObjVar>(pagNode) )
194
+ {
195
+ // if a pointer is in dead function, we do not care
196
+ if(SymbolTableInfo::isPtrInUncalledFunction(pagNode->getValue()) == false)
197
+ {
198
+ _NumOfNullPtr++;
199
+ rawstr << "##Null Pointer : (NodeID " << pagNode->getId()
200
+ << ") PtrName:" << pagNode->getValue()->getName();
201
+ writeWrnMsg(rawstr.str());
202
+ //pagNode->getValue()->dump();
203
+ }
204
+ }
205
+ else
206
+ {
207
+ _NumOfNullPtr++;
208
+ rawstr << "##Null Pointer : (NodeID " << pagNode->getId() << ")";
209
+ writeWrnMsg(rawstr.str());
210
+ }
211
+ }
212
+ }
213
+ }
214
+
215
+ }
216
+
217
+ /*!
218
+ * Start here
219
+ */
220
+ void CFLStat::performStat()
221
+ {
222
+
223
+ assert(SVFUtil::isa<CFLAlias>(pta) && "not an CFLAlias pass!! what else??");
224
+ endClk();
225
+ // SVFIR* pag = pta->getPAG();
226
+ CFLGraph* CFLGraph = pta->getCFLGraph();
227
+ // collect cfl graph infor
228
+ collectCFLInfo(CFLGraph);
229
+ // delete CFLGraph;
230
+ // collect constraint graph cycles
231
+ // collectCycleInfo(consCG);
232
+
233
+ // stat null ptr number
234
+ statNullPtr();
235
+
236
+ u32_t totalPointers = 0;
237
+ u32_t totalTopLevPointers = 0;
238
+ u32_t totalPtsSize = 0;
239
+ u32_t totalTopLevPtsSize = 0;
240
+ for (SVFIR::iterator iter = pta->getPAG()->begin(), eiter = pta->getPAG()->end();
241
+ iter != eiter; ++iter)
242
+ {
243
+ NodeID node = iter->first;
244
+ const PointsTo& pts = pta->getPts(node);
245
+ u32_t size = pts.count();
246
+ totalPointers++;
247
+ totalPtsSize+=size;
248
+
249
+ if(pta->getPAG()->isValidTopLevelPtr(pta->getPAG()->getGNode(node)))
250
+ {
251
+ totalTopLevPointers++;
252
+ totalTopLevPtsSize+=size;
253
+ }
254
+
255
+ if(size > _MaxPtsSize )
256
+ _MaxPtsSize = size;
257
+ }
258
+
259
+
260
+ PTAStat::performStat();
261
+
262
+ constraintGraphStat();
263
+
264
+ PTNumStatMap["PointsToConstPtr"] = _NumOfConstantPtr;
265
+ PTNumStatMap["PointsToBlkPtr"] = _NumOfBlackholePtr;
266
+
267
+ PTAStat::printStat("CFL Alias Analysis Stats");
268
+ }
269
+
@@ -0,0 +1,89 @@
1
+ //===----- CFLVF.cpp -- CFL Value Flow Client--------------//
2
+ //
3
+ // SVF: Static Value-Flow Analysis
4
+ //
5
+ // Copyright (C) <2013-> <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 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 General Public License for more details.
17
+
18
+ // You should have received a copy of the GNU General Public License
19
+ // along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ //
21
+ //===----------------------------------------------------------------------===//
22
+
23
+ /*
24
+ * CFLAlias.cpp
25
+ *
26
+ * Created on: September 7 , 2022
27
+ * Author: Pei Xu
28
+ */
29
+
30
+ #include "CFL/CFLVF.h"
31
+ #include "Util/SVFBasicTypes.h"
32
+ #include "WPA/Andersen.h"
33
+
34
+ using namespace SVF;
35
+ using namespace cppUtil;
36
+ using namespace SVFUtil;
37
+
38
+
39
+
40
+ void CFLVF::analyze()
41
+ {
42
+ GrammarBuilder grammarBuilder = GrammarBuilder(Options::GrammarFilename);
43
+ CFGNormalizer normalizer = CFGNormalizer();
44
+ VFCFLGraphBuilder cflGraphBuilder = VFCFLGraphBuilder();
45
+ CFLGramGraphChecker cflChecker = CFLGramGraphChecker();
46
+ if (Options::CFLGraph.empty())
47
+ {
48
+ PointerAnalysis::initialize();
49
+ GrammarBase *grammarBase = grammarBuilder.build();
50
+ AndersenWaveDiff* ander = AndersenWaveDiff::createAndersenWaveDiff(pag);
51
+ svfg = memSSA.buildPTROnlySVFG(ander);
52
+ ConstraintGraph *consCG = new ConstraintGraph(svfir);
53
+ if (Options::PEGTransfer)
54
+ {
55
+ graph = cflGraphBuilder.buildBiPEGgraph(consCG, grammarBase->getStartKind(), grammarBase, svfir);
56
+ }
57
+ else
58
+ {
59
+ graph = cflGraphBuilder.buildBigraph(svfg, grammarBase->getStartKind(), grammarBase);
60
+ }
61
+
62
+ cflChecker.check(grammarBase, &cflGraphBuilder, graph);
63
+ grammar = normalizer.normalize(grammarBase);
64
+ cflChecker.check(grammar, &cflGraphBuilder, graph);
65
+ delete consCG;
66
+ delete grammarBase;
67
+ }
68
+ else
69
+ {
70
+ GrammarBase *grammarBase = grammarBuilder.build();
71
+ graph = cflGraphBuilder.buildFromDot(Options::CFLGraph, grammarBase);
72
+ cflChecker.check(grammarBase, &cflGraphBuilder, graph);
73
+ grammar = normalizer.normalize(grammarBase);
74
+ cflChecker.check(grammar, &cflGraphBuilder, graph);
75
+ delete grammarBase;
76
+ }
77
+ solver = new CFLSolver(graph, grammar);
78
+ solver->solve();
79
+ if(Options::PrintCFL == true)
80
+ {
81
+ svfir->dump("IR");
82
+ grammar->dump("Grammar");
83
+ graph->dump("CFLGraph");
84
+ }
85
+ if (Options::CFLGraph.empty())
86
+ {
87
+ PointerAnalysis::finalize();
88
+ }
89
+ }
@@ -50,7 +50,7 @@ BVDataPTAImpl::BVDataPTAImpl(SVFIR* p, PointerAnalysis::PTATY type, bool alias_c
50
50
  {
51
51
  if (type == Andersen_BASE || type == Andersen_WPA || type == AndersenWaveDiff_WPA
52
52
  || type == TypeCPP_WPA || type == FlowS_DDA
53
- || type == AndersenSCD_WPA || type == AndersenSFR_WPA || type == CFLFICI_WPA )
53
+ || type == AndersenSCD_WPA || type == AndersenSFR_WPA || type == CFLFICI_WPA || type == CFLFSCS_WPA)
54
54
  {
55
55
  // Only maintain reverse points-to when the analysis is field-sensitive, as objects turning
56
56
  // field-insensitive is all it is used for.
@@ -811,6 +811,12 @@ const llvm::cl::opt<bool> Options::PEGTransfer(
811
811
  llvm::cl::desc("When explicit to true, cfl graph builder will transfer PAG load and store edges to copy and addr.")
812
812
  );
813
813
 
814
+ const llvm::cl::opt<bool> Options::CFLSVFG(
815
+ "cflsvfg",
816
+ llvm::cl::init(false),
817
+ llvm::cl::desc("When explicit to true, cfl graph builder will transfer SVFG to CFL Reachability.")
818
+ );
819
+
814
820
 
815
821
  const llvm::cl::opt<bool> Options::LoopAnalysis(
816
822
  "loop-analysis",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-tools",
3
- "version": "1.0.569",
3
+ "version": "1.0.571",
4
4
  "description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tools/CFL/cfl.cpp CHANGED
@@ -28,8 +28,9 @@
28
28
 
29
29
 
30
30
  #include "SVF-FE/LLVMUtil.h"
31
- #include "CFL/CFLAlias.h"
32
31
  #include "Util/Options.h"
32
+ #include "CFL/CFLAlias.h"
33
+ #include "CFL/CFLVF.h"
33
34
  #include "SVF-FE/SVFIRBuilder.h"
34
35
  #include "CFL/CFGNormalizer.h"
35
36
 
@@ -64,9 +65,18 @@ int main(int argc, char ** argv)
64
65
  /// Build Program Assignment Graph (SVFIR)
65
66
  SVFIRBuilder builder;
66
67
  SVFIR* svfir = builder.build(svfModule);
67
- CFLAlias* cflaa = new CFLAlias(svfir);
68
- cflaa->analyze();
69
- delete cflaa;
68
+ if (Options::CFLSVFG)
69
+ {
70
+ CFLVF* cflvf = new CFLVF(svfir);
71
+ cflvf->analyze();
72
+ delete cflvf;
73
+ }
74
+ else
75
+ {
76
+ CFLAlias* cflaa = new CFLAlias(svfir);
77
+ cflaa->analyze();
78
+ delete cflaa;
79
+ }
70
80
  }
71
81
  else
72
82
  {