svf-tools 1.0.577 → 1.0.578

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 (153) hide show
  1. package/SVF-doxygen/html/html/CFLAlias_8cpp.html +0 -1
  2. package/SVF-doxygen/html/html/CFLAlias_8cpp_source.html +18 -25
  3. package/SVF-doxygen/html/html/CFLAlias_8h.html +1 -8
  4. package/SVF-doxygen/html/html/CFLAlias_8h_source.html +23 -49
  5. package/SVF-doxygen/html/html/CFLBase_8h.html +103 -0
  6. package/SVF-doxygen/html/html/CFLBase_8h_source.html +124 -0
  7. package/SVF-doxygen/html/html/CFLGraph_8cpp_source.html +2 -2
  8. package/SVF-doxygen/html/html/CFLGraph_8h_source.html +5 -4
  9. package/SVF-doxygen/html/html/CFLStat_8cpp_source.html +24 -19
  10. package/SVF-doxygen/html/html/CFLStat_8h.html +1 -0
  11. package/SVF-doxygen/html/html/CFLStat_8h_source.html +22 -21
  12. package/SVF-doxygen/html/html/CFLVF_8cpp.html +0 -2
  13. package/SVF-doxygen/html/html/CFLVF_8cpp_source.html +5 -8
  14. package/SVF-doxygen/html/html/CFLVF_8h.html +3 -8
  15. package/SVF-doxygen/html/html/CFLVF_8h_source.html +12 -26
  16. package/SVF-doxygen/html/html/CHG_8cpp_source.html +1 -1
  17. package/SVF-doxygen/html/html/CHG_8h_source.html +1 -1
  18. package/SVF-doxygen/html/html/ConsGNode_8h_source.html +5 -5
  19. package/SVF-doxygen/html/html/ConsG_8cpp_source.html +1 -1
  20. package/SVF-doxygen/html/html/ConsG_8h_source.html +1 -1
  21. package/SVF-doxygen/html/html/DCHG_8h_source.html +1 -1
  22. package/SVF-doxygen/html/html/DataFlowUtil_8cpp_source.html +1 -1
  23. package/SVF-doxygen/html/html/GEPTypeBridgeIterator_8h_source.html +1 -1
  24. package/SVF-doxygen/html/html/GenericGraph_8h_source.html +1 -1
  25. package/SVF-doxygen/html/html/GraphPrinter_8h_source.html +1 -1
  26. package/SVF-doxygen/html/html/ICFG_8cpp_source.html +1 -1
  27. package/SVF-doxygen/html/html/ICFG_8h_source.html +1 -1
  28. package/SVF-doxygen/html/html/IRGraph_8cpp_source.html +1 -1
  29. package/SVF-doxygen/html/html/IRGraph_8h_source.html +1 -1
  30. package/SVF-doxygen/html/html/PTACallGraph_8cpp_source.html +1 -1
  31. package/SVF-doxygen/html/html/PTACallGraph_8h_source.html +1 -1
  32. package/SVF-doxygen/html/html/SVFG_8cpp_source.html +1 -1
  33. package/SVF-doxygen/html/html/SVFG_8h_source.html +1 -1
  34. package/SVF-doxygen/html/html/TCT_8cpp_source.html +1 -1
  35. package/SVF-doxygen/html/html/TCT_8h_source.html +1 -1
  36. package/SVF-doxygen/html/html/VFG_8cpp_source.html +1 -1
  37. package/SVF-doxygen/html/html/VFG_8h_source.html +1 -1
  38. package/SVF-doxygen/html/html/annotated.html +271 -270
  39. package/SVF-doxygen/html/html/cfl_8cpp.html +6 -9
  40. package/SVF-doxygen/html/html/cfl_8cpp_source.html +6 -8
  41. package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +9 -8
  42. package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.png +0 -0
  43. package/SVF-doxygen/html/html/classSVF_1_1CFLAlias-members.html +75 -71
  44. package/SVF-doxygen/html/html/classSVF_1_1CFLAlias.html +239 -679
  45. package/SVF-doxygen/html/html/classSVF_1_1CFLAlias.png +0 -0
  46. package/SVF-doxygen/html/html/classSVF_1_1CFLBase-members.html +275 -0
  47. package/SVF-doxygen/html/html/classSVF_1_1CFLBase.html +1341 -0
  48. package/SVF-doxygen/html/html/classSVF_1_1CFLBase.png +0 -0
  49. package/SVF-doxygen/html/html/classSVF_1_1CFLGraph-members.html +21 -20
  50. package/SVF-doxygen/html/html/classSVF_1_1CFLGraph.html +33 -3
  51. package/SVF-doxygen/html/html/classSVF_1_1CFLStat-members.html +2 -2
  52. package/SVF-doxygen/html/html/classSVF_1_1CFLStat.html +58 -58
  53. package/SVF-doxygen/html/html/classSVF_1_1CFLVF-members.html +91 -72
  54. package/SVF-doxygen/html/html/classSVF_1_1CFLVF.html +243 -274
  55. package/SVF-doxygen/html/html/classSVF_1_1CFLVF.png +0 -0
  56. package/SVF-doxygen/html/html/classSVF_1_1ConstraintNode-members.html +26 -26
  57. package/SVF-doxygen/html/html/classSVF_1_1ConstraintNode.html +43 -43
  58. package/SVF-doxygen/html/html/classSVF_1_1GenericNode.html +21 -20
  59. package/SVF-doxygen/html/html/classSVF_1_1GenericNode.png +0 -0
  60. package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +12 -11
  61. package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.png +0 -0
  62. package/SVF-doxygen/html/html/classes.html +96 -95
  63. package/SVF-doxygen/html/html/dda_8cpp_source.html +1 -1
  64. package/SVF-doxygen/html/html/dir_ae8aa099e368efaa962140c6624142bc.html +2 -0
  65. package/SVF-doxygen/html/html/files.html +8 -7
  66. package/SVF-doxygen/html/html/functions_0x7e.html +2 -5
  67. package/SVF-doxygen/html/html/functions_a.html +10 -9
  68. package/SVF-doxygen/html/html/functions_c.html +28 -28
  69. package/SVF-doxygen/html/html/functions_f.html +17 -16
  70. package/SVF-doxygen/html/html/functions_func.html +6 -5
  71. package/SVF-doxygen/html/html/functions_func_0x7e.html +2 -5
  72. package/SVF-doxygen/html/html/functions_func_c.html +29 -21
  73. package/SVF-doxygen/html/html/functions_func_f.html +4 -1
  74. package/SVF-doxygen/html/html/functions_func_g.html +14 -11
  75. package/SVF-doxygen/html/html/functions_func_i.html +10 -7
  76. package/SVF-doxygen/html/html/functions_func_p.html +1 -1
  77. package/SVF-doxygen/html/html/functions_func_s.html +2 -2
  78. package/SVF-doxygen/html/html/functions_g.html +18 -17
  79. package/SVF-doxygen/html/html/functions_i.html +10 -7
  80. package/SVF-doxygen/html/html/functions_l.html +6 -6
  81. package/SVF-doxygen/html/html/functions_m.html +2 -2
  82. package/SVF-doxygen/html/html/functions_n.html +14 -11
  83. package/SVF-doxygen/html/html/functions_o.html +15 -15
  84. package/SVF-doxygen/html/html/functions_p.html +19 -15
  85. package/SVF-doxygen/html/html/functions_r.html +3 -7
  86. package/SVF-doxygen/html/html/functions_s.html +16 -16
  87. package/SVF-doxygen/html/html/functions_t.html +9 -6
  88. package/SVF-doxygen/html/html/functions_type_c.html +0 -1
  89. package/SVF-doxygen/html/html/functions_v.html +6 -6
  90. package/SVF-doxygen/html/html/functions_vars_a.html +1 -1
  91. package/SVF-doxygen/html/html/functions_vars_c.html +0 -1
  92. package/SVF-doxygen/html/html/functions_vars_g.html +2 -4
  93. package/SVF-doxygen/html/html/functions_vars_m.html +1 -1
  94. package/SVF-doxygen/html/html/functions_vars_n.html +11 -8
  95. package/SVF-doxygen/html/html/functions_vars_p.html +1 -1
  96. package/SVF-doxygen/html/html/functions_vars_s.html +2 -4
  97. package/SVF-doxygen/html/html/functions_vars_t.html +9 -6
  98. package/SVF-doxygen/html/html/hierarchy.html +58 -57
  99. package/SVF-doxygen/html/html/mta_8cpp_source.html +1 -1
  100. package/SVF-doxygen/html/html/namespaceSVF.html +2 -0
  101. package/SVF-doxygen/html/html/saber_8cpp_source.html +1 -1
  102. package/SVF-doxygen/html/html/search/all_1.js +2 -2
  103. package/SVF-doxygen/html/html/search/all_10.js +11 -11
  104. package/SVF-doxygen/html/html/search/all_11.js +2 -2
  105. package/SVF-doxygen/html/html/search/all_12.js +11 -11
  106. package/SVF-doxygen/html/html/search/all_13.js +9 -8
  107. package/SVF-doxygen/html/html/search/all_15.js +4 -4
  108. package/SVF-doxygen/html/html/search/all_16.js +1 -1
  109. package/SVF-doxygen/html/html/search/all_19.js +1 -2
  110. package/SVF-doxygen/html/html/search/all_3.js +5 -2
  111. package/SVF-doxygen/html/html/search/all_6.js +2 -2
  112. package/SVF-doxygen/html/html/search/all_7.js +4 -3
  113. package/SVF-doxygen/html/html/search/all_9.js +2 -2
  114. package/SVF-doxygen/html/html/search/all_c.js +4 -4
  115. package/SVF-doxygen/html/html/search/all_d.js +3 -3
  116. package/SVF-doxygen/html/html/search/all_e.js +11 -10
  117. package/SVF-doxygen/html/html/search/all_f.js +2 -2
  118. package/SVF-doxygen/html/html/search/classes_2.js +1 -0
  119. package/SVF-doxygen/html/html/search/files_2.js +1 -0
  120. package/SVF-doxygen/html/html/search/functions_0.js +1 -1
  121. package/SVF-doxygen/html/html/search/functions_11.js +1 -1
  122. package/SVF-doxygen/html/html/search/functions_17.js +1 -2
  123. package/SVF-doxygen/html/html/search/functions_2.js +3 -1
  124. package/SVF-doxygen/html/html/search/functions_5.js +1 -1
  125. package/SVF-doxygen/html/html/search/functions_6.js +2 -1
  126. package/SVF-doxygen/html/html/search/functions_8.js +1 -1
  127. package/SVF-doxygen/html/html/search/functions_f.js +1 -1
  128. package/SVF-doxygen/html/html/search/typedefs_2.js +1 -1
  129. package/SVF-doxygen/html/html/search/variables_1.js +1 -1
  130. package/SVF-doxygen/html/html/search/variables_10.js +1 -1
  131. package/SVF-doxygen/html/html/search/variables_12.js +2 -2
  132. package/SVF-doxygen/html/html/search/variables_13.js +9 -8
  133. package/SVF-doxygen/html/html/search/variables_3.js +1 -1
  134. package/SVF-doxygen/html/html/search/variables_7.js +2 -2
  135. package/SVF-doxygen/html/html/search/variables_9.js +1 -1
  136. package/SVF-doxygen/html/html/search/variables_c.js +1 -1
  137. package/SVF-doxygen/html/html/search/variables_d.js +1 -1
  138. package/SVF-doxygen/html/html/search/variables_e.js +9 -8
  139. package/SVF-doxygen/html/html/structllvm_1_1GraphTraits_3_01Inverse_3_01SVF_1_1CFLNode_01_5_01_4_01_4.html +1 -1
  140. package/SVF-doxygen/html/html/structllvm_1_1GraphTraits_3_01SVF_1_1CFLGraph_01_5_01_4.html +2 -2
  141. package/SVF-doxygen/html/html/structllvm_1_1GraphTraits_3_01SVF_1_1CFLNode_01_5_01_4.html +1 -1
  142. package/SVF-doxygen/html/html/svf-ex_8cpp_source.html +1 -1
  143. package/SVF-doxygen/html/html/wpa_8cpp_source.html +1 -1
  144. package/include/CFL/CFLAlias.h +10 -47
  145. package/include/CFL/CFLBase.h +111 -0
  146. package/include/CFL/CFLStat.h +4 -2
  147. package/include/CFL/CFLVF.h +13 -23
  148. package/include/Graphs/CFLGraph.h +5 -0
  149. package/lib/CFL/CFLAlias.cpp +60 -52
  150. package/lib/CFL/CFLStat.cpp +11 -19
  151. package/lib/CFL/CFLVF.cpp +40 -35
  152. package/package.json +1 -1
  153. package/tools/CFL/cfl.cpp +12 -25
@@ -28,30 +28,18 @@
28
28
  */
29
29
 
30
30
  #include "CFL/CFLAlias.h"
31
- #include "Util/SVFBasicTypes.h"
32
31
 
33
32
  using namespace SVF;
34
33
  using namespace cppUtil;
35
34
  using namespace SVFUtil;
36
35
 
37
- u32_t CFLAlias::numOfProcessedAddr = 0;
38
- u32_t CFLAlias::numOfProcessedCopy = 0;
39
- u32_t CFLAlias::numOfProcessedGep = 0;
40
- u32_t CFLAlias::numOfProcessedLoad = 0;
41
- u32_t CFLAlias::numOfProcessedStore = 0;
42
- u32_t CFLAlias::numOfSfrs = 0;
43
- u32_t CFLAlias::numOfFieldExpand = 0;
44
-
45
- u32_t CFLAlias::numOfSCCDetection = 0;
46
- double CFLAlias::timeOfSCCDetection = 0;
47
- double CFLAlias::timeOfSCCMerges = 0;
48
- double CFLAlias::timeOfCollapse = 0;
49
-
50
- u32_t CFLAlias::AveragePointsToSetSize = 0;
51
- u32_t CFLAlias::MaxPointsToSetSize = 0;
52
- double CFLAlias::timeOfProcessCopyGep = 0;
53
- double CFLAlias::timeOfProcessLoadStore = 0;
54
- double CFLAlias::timeOfUpdateCallGraph = 0;
36
+ u32_t CFLBase::AveragePointsToSetSize = 0;
37
+ u32_t CFLBase::MaxPointsToSetSize = 0;
38
+ double CFLBase::timeOfProcessCopyGep = 0;
39
+ double CFLBase::timeOfProcessLoadStore = 0;
40
+ double CFLBase::timeOfUpdateCallGraph = 0;
41
+ double CFLBase::timeOfSolving = 0;
42
+ double CFLBase::numOfSumEdges=0;
55
43
 
56
44
  /*!
57
45
  * On the fly call graph construction
@@ -193,9 +181,6 @@ void CFLAlias::heapAllocatorViaIndCall(CallSite cs)
193
181
  */
194
182
  bool CFLAlias::updateCallGraph(const CallSiteToFunPtrMap& callsites)
195
183
  {
196
-
197
- // double cgUpdateStart = stat->getClk();
198
-
199
184
  CallEdgeMap newEdges;
200
185
  onTheFlyCallGraphSolve(callsites,newEdges);
201
186
  for(CallEdgeMap::iterator it = newEdges.begin(), eit = newEdges.end(); it!=eit; ++it )
@@ -203,65 +188,88 @@ bool CFLAlias::updateCallGraph(const CallSiteToFunPtrMap& callsites)
203
188
  CallSite cs = SVFUtil::getLLVMCallSite(it->first->getCallSite());
204
189
  for(FunctionSet::iterator cit = it->second.begin(), ecit = it->second.end(); cit!=ecit; ++cit)
205
190
  {
206
- std::cout << cs.arg_size();
207
191
  connectCaller2CalleeParams(cs,*cit);
208
192
  }
209
193
  }
210
194
 
211
- // double cgUpdateEnd = stat->getClk();
212
- //timeOfUpdateCallGraph += (cgUpdateEnd - cgUpdateStart) / TIMEINTERVAL;
213
-
214
195
  return (!solver->isWorklistEmpty());
215
196
  }
216
197
 
217
- void CFLAlias::analyze()
198
+ void CFLAlias::initialize()
218
199
  {
219
200
  stat = new CFLStat(this);
201
+
202
+ // Build CFL Grammar
220
203
  GrammarBuilder grammarBuilder = GrammarBuilder(Options::GrammarFilename);
221
- CFGNormalizer normalizer = CFGNormalizer();
204
+ GrammarBase *grammarBase = grammarBuilder.build();
205
+
206
+
207
+ // Build CFL Graph
222
208
  AliasCFLGraphBuilder cflGraphBuilder = AliasCFLGraphBuilder();
223
- CFLGramGraphChecker cflChecker = CFLGramGraphChecker();
224
- if (Options::CFLGraph.empty())
209
+ if (Options::CFLGraph.empty()) // built from svfir
225
210
  {
226
211
  PointerAnalysis::initialize();
227
- GrammarBase *grammarBase = grammarBuilder.build();
228
212
  ConstraintGraph *consCG = new ConstraintGraph(svfir);
229
213
  if (Options::PEGTransfer)
230
- {
231
214
  graph = cflGraphBuilder.buildBiPEGgraph(consCG, grammarBase->getStartKind(), grammarBase, svfir);
232
- }
233
215
  else
234
- {
235
216
  graph = cflGraphBuilder.buildBigraph(consCG, grammarBase->getStartKind(), grammarBase);
236
- }
237
-
238
- cflChecker.check(grammarBase, &cflGraphBuilder, graph);
239
- grammar = normalizer.normalize(grammarBase);
240
- cflChecker.check(grammar, &cflGraphBuilder, graph);
241
217
  delete consCG;
242
- delete grammarBase;
243
218
  }
244
219
  else
245
- {
246
- GrammarBase *grammarBase = grammarBuilder.build();
247
220
  graph = cflGraphBuilder.buildFromDot(Options::CFLGraph, grammarBase);
248
- cflChecker.check(grammarBase, &cflGraphBuilder, graph);
249
- grammar = normalizer.normalize(grammarBase);
250
- cflChecker.check(grammar, &cflGraphBuilder, graph);
251
- delete grammarBase;
252
- }
221
+
222
+ // Check CFL Graph and Grammar are accordance with grammar
223
+ CFLGramGraphChecker cflChecker = CFLGramGraphChecker();
224
+ cflChecker.check(grammarBase, &cflGraphBuilder, graph);
225
+
226
+ // Normalize grammar
227
+ CFGNormalizer normalizer = CFGNormalizer();
228
+ grammar = normalizer.normalize(grammarBase);
229
+
253
230
  solver = new CFLSolver(graph, grammar);
254
- solver->solve();
255
- while (updateCallGraph(svfir->getIndirectCallsites()))
256
- solver->solve();
231
+ delete grammarBase;
232
+ }
233
+
234
+ void CFLAlias::finalize()
235
+ {
257
236
  if(Options::PrintCFL == true)
258
237
  {
259
- svfir->dump("IR");
238
+ if (Options::CFLGraph.empty())
239
+ svfir->dump("IR");
260
240
  grammar->dump("Grammar");
261
241
  graph->dump("CFLGraph");
262
242
  }
263
243
  if (Options::CFLGraph.empty())
264
- {
265
244
  PointerAnalysis::finalize();
245
+ }
246
+
247
+ void CFLAlias::analyze()
248
+ {
249
+ initialize();
250
+
251
+ // Start solving
252
+ double start = stat->getClk(true);
253
+
254
+ solver->solve();
255
+ if (Options::CFLGraph.empty())
256
+ {
257
+ while (updateCallGraph(svfir->getIndirectCallsites()))
258
+ solver->solve();
259
+ } // Only cflgraph built from bc could reanlyze by update call graph
260
+
261
+ double end = stat->getClk(true);
262
+ timeOfSolving += (end - start) / TIMEINTERVAL;
263
+
264
+ finalize();
265
+ }
266
+
267
+ void CFLAlias::countSumEdges()
268
+ {
269
+ numOfSumEdges = 0;
270
+ for(auto it = getCFLGraph()->getCFLEdges().begin(); it != getCFLGraph()->getCFLEdges().end(); it++ )
271
+ {
272
+ if ((*it)->getEdgeKind() == grammar->getStartKind())
273
+ numOfSumEdges++;
266
274
  }
267
275
  }
@@ -44,11 +44,8 @@ const char* CFLStat::CollapseTime = "CollapseTime";
44
44
  /*!
45
45
  * Constructor
46
46
  */
47
- CFLStat::CFLStat(CFLAlias* p): PTAStat(p),pta(p)
47
+ CFLStat::CFLStat(CFLBase* p): PTAStat(p),pta(p)
48
48
  {
49
- _NumOfNullPtr = 0;
50
- _NumOfConstantPtr= 0;
51
- _NumOfBlackholePtr = 0;
52
49
  startClk();
53
50
  }
54
51
 
@@ -57,11 +54,10 @@ CFLStat::CFLStat(CFLAlias* p): PTAStat(p),pta(p)
57
54
  */
58
55
  void CFLStat::collectCFLInfo(CFLGraph* CFLGraph)
59
56
  {
60
- _NumOfCycles = 0;
61
- _NumOfPWCCycles = 0;
62
- _NumOfNodesInCycles = 0;
63
- NodeSet repNodes;
64
- repNodes.clear();
57
+ PTNumStatMap["NumOfNodes"] = CFLGraph->getTotalNodeNum();
58
+ PTNumStatMap["NumOfEdges"] = CFLGraph->getCFLEdges().size();
59
+
60
+ PTAStat::printStat("CFLGraph Stats");
65
61
  }
66
62
 
67
63
 
@@ -219,19 +215,15 @@ void CFLStat::statNullPtr()
219
215
  */
220
216
  void CFLStat::performStat()
221
217
  {
222
-
223
- assert(SVFUtil::isa<CFLAlias>(pta) && "not an CFLAlias pass!! what else??");
218
+ assert((SVFUtil::isa<CFLAlias>(pta)||SVFUtil::isa<CFLVF>(pta)) && "not an CFLAlias pass!! what else??");
224
219
  endClk();
225
- // SVFIR* pag = pta->getPAG();
220
+
226
221
  CFLGraph* CFLGraph = pta->getCFLGraph();
227
- // collect cfl graph infor
228
222
  collectCFLInfo(CFLGraph);
229
- // delete CFLGraph;
230
- // collect constraint graph cycles
231
- // collectCycleInfo(consCG);
232
-
233
- // stat null ptr number
234
- statNullPtr();
223
+ pta->countSumEdges();
224
+ timeStatMap["AnalysisTime"] = pta->timeOfSolving;
225
+ PTNumStatMap["SumEdges"] = pta->numOfSumEdges;
226
+ PTAStat::printStat("CFL-reachability analysis Stats");
235
227
 
236
228
  u32_t totalPointers = 0;
237
229
  u32_t totalTopLevPointers = 0;
package/lib/CFL/CFLVF.cpp CHANGED
@@ -28,62 +28,67 @@
28
28
  */
29
29
 
30
30
  #include "CFL/CFLVF.h"
31
- #include "Util/SVFBasicTypes.h"
32
- #include "WPA/Andersen.h"
33
31
 
34
32
  using namespace SVF;
35
33
  using namespace cppUtil;
36
34
  using namespace SVFUtil;
37
35
 
38
-
39
-
40
- void CFLVF::analyze()
36
+ void CFLVF::initialize()
41
37
  {
38
+ // Build CFL Grammar and Normalize
42
39
  GrammarBuilder grammarBuilder = GrammarBuilder(Options::GrammarFilename);
43
- CFGNormalizer normalizer = CFGNormalizer();
40
+ GrammarBase *grammarBase = grammarBuilder.build();
41
+
42
+ // Build CFL Graph
44
43
  VFCFLGraphBuilder cflGraphBuilder = VFCFLGraphBuilder();
45
- CFLGramGraphChecker cflChecker = CFLGramGraphChecker();
46
- if (Options::CFLGraph.empty())
44
+ if (Options::CFLGraph.empty()) // built from svfir
47
45
  {
48
46
  PointerAnalysis::initialize();
49
- GrammarBase *grammarBase = grammarBuilder.build();
50
47
  AndersenWaveDiff* ander = AndersenWaveDiff::createAndersenWaveDiff(pag);
51
48
  svfg = memSSA.buildFullSVFG(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;
49
+ graph = cflGraphBuilder.buildBigraph(svfg, grammarBase->getStartKind(), grammarBase);
67
50
  }
68
51
  else
69
- {
70
- GrammarBase *grammarBase = grammarBuilder.build();
71
52
  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
- }
53
+
54
+ // Check CFL Graph and Grammar are accordance with grammar
55
+ CFLGramGraphChecker cflChecker = CFLGramGraphChecker();
56
+ cflChecker.check(grammarBase, &cflGraphBuilder, graph);
57
+
58
+ // Normalize grammar
59
+ CFGNormalizer normalizer = CFGNormalizer();
60
+ grammar = normalizer.normalize(grammarBase);
61
+
77
62
  solver = new CFLSolver(graph, grammar);
78
- solver->solve();
63
+ delete grammarBase;
64
+ }
65
+
66
+ void CFLVF::finalize()
67
+ {
79
68
  if(Options::PrintCFL == true)
80
69
  {
81
- svfir->dump("IR");
70
+ if (Options::CFLGraph.empty())
71
+ svfir->dump("IR");
82
72
  grammar->dump("Grammar");
83
73
  graph->dump("CFLGraph");
84
74
  }
85
- if (Options::CFLGraph.empty())
75
+ }
76
+
77
+ void CFLVF::analyze()
78
+ {
79
+ initialize();
80
+
81
+ solver->solve();
82
+
83
+ finalize();
84
+ }
85
+
86
+ void CFLVF::countSumEdges()
87
+ {
88
+ numOfSumEdges = 0;
89
+ for(auto it = getCFLGraph()->getCFLEdges().begin(); it != getCFLGraph()->getCFLEdges().end(); it++ )
86
90
  {
87
- PointerAnalysis::finalize();
91
+ if ((*it)->getEdgeKind() == grammar->getStartKind())
92
+ numOfSumEdges++;
88
93
  }
89
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-tools",
3
- "version": "1.0.577",
3
+ "version": "1.0.578",
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,11 +28,9 @@
28
28
 
29
29
 
30
30
  #include "SVF-FE/LLVMUtil.h"
31
- #include "Util/Options.h"
31
+ #include "SVF-FE/SVFIRBuilder.h"
32
32
  #include "CFL/CFLAlias.h"
33
33
  #include "CFL/CFLVF.h"
34
- #include "SVF-FE/SVFIRBuilder.h"
35
- #include "CFL/CFGNormalizer.h"
36
34
 
37
35
  using namespace llvm;
38
36
  using namespace SVF;
@@ -57,35 +55,24 @@ int main(int argc, char ** argv)
57
55
  {
58
56
  LLVMModuleSet::getLLVMModuleSet()->preProcessBCs(moduleNameVec);
59
57
  }
58
+
59
+ SVFIR* svfir = nullptr;
60
60
  if (Options::CFLGraph.empty())
61
61
  {
62
62
  SVFModule* svfModule = LLVMModuleSet::getLLVMModuleSet()->buildSVFModule(moduleNameVec);
63
63
  svfModule->buildSymbolTableInfo();
64
-
65
- /// Build Program Assignment Graph (SVFIR)
66
64
  SVFIRBuilder builder;
67
- SVFIR* svfir = builder.build(svfModule);
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
- }
80
- }
65
+ svfir = builder.build(svfModule);
66
+ } // if no dot form CFLGraph is specified, we use svfir from .bc.
67
+
68
+ BVDataPTAImpl* cfl;
69
+ if (Options::CFLSVFG)
70
+ cfl = new CFLVF(svfir);
81
71
  else
82
- {
83
- SVFIR* svfir = nullptr;
84
- CFLAlias* cflaa = new CFLAlias(svfir);
85
- cflaa->analyze();
86
- delete cflaa;
87
- }
72
+ cfl = new CFLAlias(svfir); // if no svfg is specified, we use CFLAlias as the default one.
73
+ cfl->analyze();
88
74
 
75
+ delete cfl;
89
76
  SVFIR::releaseSVFIR();
90
77
  SVF::LLVMModuleSet::releaseLLVMModuleSet();
91
78