svf-tools 1.0.563 → 1.0.564

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 (126) hide show
  1. package/SVF-doxygen/html/html/AndersenStat_8cpp_source.html +7 -38
  2. package/SVF-doxygen/html/html/CHGBuilder_8cpp_source.html +1 -1
  3. package/SVF-doxygen/html/html/ContextDDA_8cpp_source.html +3 -3
  4. package/SVF-doxygen/html/html/DDAStat_8cpp_source.html +7 -7
  5. package/SVF-doxygen/html/html/DDAStat_8h_source.html +1 -1
  6. package/SVF-doxygen/html/html/DDAVFSolver_8h_source.html +1 -1
  7. package/SVF-doxygen/html/html/FlowSensitiveStat_8cpp_source.html +3 -3
  8. package/SVF-doxygen/html/html/ICFGStat_8h_source.html +2 -2
  9. package/SVF-doxygen/html/html/LockAnalysis_8cpp_source.html +1 -1
  10. package/SVF-doxygen/html/html/MHP_8cpp_source.html +1 -1
  11. package/SVF-doxygen/html/html/MTAStat_8cpp_source.html +4 -4
  12. package/SVF-doxygen/html/html/MTA_8cpp_source.html +1 -1
  13. package/SVF-doxygen/html/html/MemSSA_8cpp_source.html +1 -1
  14. package/SVF-doxygen/html/html/NodeIDAllocator_8cpp_source.html +1 -1
  15. package/SVF-doxygen/html/html/PTAStat_8cpp.html +0 -1
  16. package/SVF-doxygen/html/html/PTAStat_8cpp_source.html +9 -114
  17. package/SVF-doxygen/html/html/PTAStat_8h_source.html +7 -69
  18. package/SVF-doxygen/html/html/PointerAnalysis_8cpp_source.html +1 -1
  19. package/SVF-doxygen/html/html/SVFGStat_8cpp_source.html +6 -6
  20. package/SVF-doxygen/html/html/SVFGStat_8h_source.html +1 -1
  21. package/SVF-doxygen/html/html/SVFModule_8cpp_source.html +2 -2
  22. package/SVF-doxygen/html/html/SVFStat_8cpp_source.html +65 -6
  23. package/SVF-doxygen/html/html/SVFStat_8h_source.html +16 -14
  24. package/SVF-doxygen/html/html/VersionedFlowSensitiveStat_8cpp_source.html +3 -3
  25. package/SVF-doxygen/html/html/VersionedFlowSensitive_8cpp_source.html +1 -1
  26. package/SVF-doxygen/html/html/classSVF_1_1Andersen.html +4 -4
  27. package/SVF-doxygen/html/html/classSVF_1_1AndersenSCD.html +4 -4
  28. package/SVF-doxygen/html/html/classSVF_1_1AndersenStat-members.html +21 -74
  29. package/SVF-doxygen/html/html/classSVF_1_1AndersenStat.html +16 -208
  30. package/SVF-doxygen/html/html/classSVF_1_1AndersenWaveDiff.html +2 -2
  31. package/SVF-doxygen/html/html/classSVF_1_1CHGBuilder.html +1 -1
  32. package/SVF-doxygen/html/html/classSVF_1_1ContextDDA.html +3 -3
  33. package/SVF-doxygen/html/html/classSVF_1_1DDAStat-members.html +22 -75
  34. package/SVF-doxygen/html/html/classSVF_1_1DDAStat.html +15 -176
  35. package/SVF-doxygen/html/html/classSVF_1_1DDAVFSolver.html +2 -2
  36. package/SVF-doxygen/html/html/classSVF_1_1FlowDDA.html +3 -3
  37. package/SVF-doxygen/html/html/classSVF_1_1FlowSensitive.html +13 -13
  38. package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveStat-members.html +26 -79
  39. package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveStat.html +13 -188
  40. package/SVF-doxygen/html/html/classSVF_1_1ICFGStat-members.html +22 -75
  41. package/SVF-doxygen/html/html/classSVF_1_1ICFGStat.html +11 -172
  42. package/SVF-doxygen/html/html/classSVF_1_1LLVMModuleSet.html +2 -2
  43. package/SVF-doxygen/html/html/classSVF_1_1LockAnalysis.html +3 -3
  44. package/SVF-doxygen/html/html/classSVF_1_1MHP.html +2 -2
  45. package/SVF-doxygen/html/html/classSVF_1_1MTA.html +1 -1
  46. package/SVF-doxygen/html/html/classSVF_1_1MTAStat-members.html +26 -79
  47. package/SVF-doxygen/html/html/classSVF_1_1MTAStat.html +19 -180
  48. package/SVF-doxygen/html/html/classSVF_1_1MemSSA.html +2 -2
  49. package/SVF-doxygen/html/html/classSVF_1_1MemSSAStat-members.html +30 -83
  50. package/SVF-doxygen/html/html/classSVF_1_1MemSSAStat.html +11 -172
  51. package/SVF-doxygen/html/html/classSVF_1_1NodeIDAllocator_1_1Clusterer.html +3 -3
  52. package/SVF-doxygen/html/html/classSVF_1_1PTAStat-members.html +6 -62
  53. package/SVF-doxygen/html/html/classSVF_1_1PTAStat.html +33 -1841
  54. package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +1 -1
  55. package/SVF-doxygen/html/html/classSVF_1_1SVFGStat-members.html +44 -97
  56. package/SVF-doxygen/html/html/classSVF_1_1SVFGStat.html +25 -186
  57. package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +2 -2
  58. package/SVF-doxygen/html/html/classSVF_1_1SVFModule.html +2 -2
  59. package/SVF-doxygen/html/html/classSVF_1_1SVFStat-members.html +17 -15
  60. package/SVF-doxygen/html/html/classSVF_1_1SVFStat.html +158 -37
  61. package/SVF-doxygen/html/html/classSVF_1_1TypeAnalysis.html +1 -1
  62. package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitive.html +6 -6
  63. package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitiveStat-members.html +23 -76
  64. package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitiveStat.html +13 -187
  65. package/SVF-doxygen/html/html/functions_a.html +5 -9
  66. package/SVF-doxygen/html/html/functions_b.html +8 -11
  67. package/SVF-doxygen/html/html/functions_c.html +2 -2
  68. package/SVF-doxygen/html/html/functions_e.html +2 -3
  69. package/SVF-doxygen/html/html/functions_f.html +6 -6
  70. package/SVF-doxygen/html/html/functions_func_b.html +1 -4
  71. package/SVF-doxygen/html/html/functions_func_p.html +4 -5
  72. package/SVF-doxygen/html/html/functions_func_s.html +1 -1
  73. package/SVF-doxygen/html/html/functions_i.html +6 -6
  74. package/SVF-doxygen/html/html/functions_l.html +5 -5
  75. package/SVF-doxygen/html/html/functions_m.html +1 -9
  76. package/SVF-doxygen/html/html/functions_n.html +0 -114
  77. package/SVF-doxygen/html/html/functions_o.html +12 -12
  78. package/SVF-doxygen/html/html/functions_p.html +19 -28
  79. package/SVF-doxygen/html/html/functions_s.html +18 -25
  80. package/SVF-doxygen/html/html/functions_t.html +3 -18
  81. package/SVF-doxygen/html/html/functions_u.html +0 -3
  82. package/SVF-doxygen/html/html/functions_vars_a.html +0 -4
  83. package/SVF-doxygen/html/html/functions_vars_e.html +1 -2
  84. package/SVF-doxygen/html/html/functions_vars_m.html +1 -9
  85. package/SVF-doxygen/html/html/functions_vars_n.html +0 -114
  86. package/SVF-doxygen/html/html/functions_vars_p.html +1 -7
  87. package/SVF-doxygen/html/html/functions_vars_s.html +1 -8
  88. package/SVF-doxygen/html/html/functions_vars_t.html +0 -15
  89. package/SVF-doxygen/html/html/functions_vars_u.html +0 -3
  90. package/SVF-doxygen/html/html/functions_w.html +11 -11
  91. package/SVF-doxygen/html/html/search/all_1.js +1 -2
  92. package/SVF-doxygen/html/html/search/all_10.js +13 -15
  93. package/SVF-doxygen/html/html/search/all_11.js +1 -1
  94. package/SVF-doxygen/html/html/search/all_12.js +7 -9
  95. package/SVF-doxygen/html/html/search/all_13.js +6 -11
  96. package/SVF-doxygen/html/html/search/all_14.js +1 -1
  97. package/SVF-doxygen/html/html/search/all_15.js +2 -2
  98. package/SVF-doxygen/html/html/search/all_16.js +2 -2
  99. package/SVF-doxygen/html/html/search/all_2.js +1 -2
  100. package/SVF-doxygen/html/html/search/all_3.js +1 -1
  101. package/SVF-doxygen/html/html/search/all_5.js +2 -2
  102. package/SVF-doxygen/html/html/search/all_6.js +2 -2
  103. package/SVF-doxygen/html/html/search/all_9.js +2 -2
  104. package/SVF-doxygen/html/html/search/all_c.js +3 -3
  105. package/SVF-doxygen/html/html/search/all_d.js +2 -4
  106. package/SVF-doxygen/html/html/search/all_e.js +3 -39
  107. package/SVF-doxygen/html/html/search/all_f.js +1 -1
  108. package/SVF-doxygen/html/html/search/functions_1.js +1 -2
  109. package/SVF-doxygen/html/html/search/functions_11.js +1 -1
  110. package/SVF-doxygen/html/html/search/functions_f.js +3 -3
  111. package/SVF-doxygen/html/html/search/variables_1.js +1 -2
  112. package/SVF-doxygen/html/html/search/variables_10.js +1 -3
  113. package/SVF-doxygen/html/html/search/variables_12.js +1 -3
  114. package/SVF-doxygen/html/html/search/variables_13.js +3 -8
  115. package/SVF-doxygen/html/html/search/variables_14.js +1 -1
  116. package/SVF-doxygen/html/html/search/variables_5.js +1 -1
  117. package/SVF-doxygen/html/html/search/variables_d.js +2 -4
  118. package/SVF-doxygen/html/html/search/variables_e.js +3 -39
  119. package/include/Util/PTAStat.h +0 -79
  120. package/include/Util/SVFStat.h +3 -2
  121. package/lib/Util/PTAStat.cpp +7 -259
  122. package/lib/Util/SVFStat.cpp +197 -2
  123. package/lib/WPA/AndersenStat.cpp +31 -31
  124. package/lib/WPA/FlowSensitiveStat.cpp +14 -14
  125. package/lib/WPA/VersionedFlowSensitiveStat.cpp +13 -13
  126. package/package.json +1 -1
@@ -48,95 +48,16 @@ class PointerAnalysis;
48
48
  class PTAStat: public SVFStat
49
49
  {
50
50
  public:
51
- static const char* TotalAnalysisTime; ///< Total analysis time
52
- static const char* SCCDetectionTime; ///< Total SCC detection time
53
- static const char* SCCMergeTime; ///< Total SCC merge time
54
-
55
- static const char* ProcessLoadStoreTime;///< time of processing loads and stores
56
- static const char* ProcessCopyGepTime; ///< time of processing copys and geps
57
- static const char* UpdateCallGraphTime; ///< time of updating call graph
58
-
59
- static const char* TotalNumOfPointers; ///< Total SVFIR value node
60
- static const char* TotalNumOfObjects; ///< Total SVFIR object node
61
- static const char* TotalNumOfFieldObjects; ///< Total SVFIR field object node
62
- static const char* MaxStructSize; ///< Max struct size
63
- static const char* TotalNumOfEdges; ///< Total SVFIR edge number
64
-
65
- static const char* NumOfAddrs; ///< SVFIR addr edge
66
- static const char* NumOfLoads; ///< SVFIR load edge
67
- static const char* NumOfStores; ///< SVFIR store edge
68
- static const char* NumOfCopys; ///< SVFIR copy edge
69
- static const char* NumOfGeps; ///< SVFIR gep edge
70
- static const char* NumOfCalls; ///< SVFIR call edge
71
- static const char* NumOfReturns; ///< SVFIR return edge
72
-
73
- static const char* NumOfProcessedAddrs; ///< SVFIR processed addr edge
74
- static const char* NumOfProcessedLoads; ///< SVFIR processed load edge
75
- static const char* NumOfProcessedStores; ///< SVFIR processed store edge
76
- static const char* NumOfProcessedCopys; ///< SVFIR processed copy edge
77
- static const char* NumOfProcessedGeps; ///< SVFIR processed gep edge
78
-
79
- static const char* NumOfSfr; ///< num of field representatives
80
- static const char* NumOfFieldExpand;
81
-
82
- static const char* NumOfFunctionObjs; ///< Function numbers
83
- static const char* NumOfGlobalObjs; ///< SVFIR global object node
84
- static const char* NumOfHeapObjs; ///< SVFIR heap object node
85
- static const char* NumOfStackObjs; ///< SVFIR stack object node
86
-
87
- static const char* NumOfObjsHasVarStruct; ///< SVFIR object node has var struct (maybe nested with array)
88
- static const char* NumOfObjsHasVarArray; ///< SVFIR object node has var array (maybe nested with struct)
89
- static const char* NumOfObjsHasConstStruct; ///< SVFIR object node has const struct (maybe nested with array)
90
- static const char* NumOfObjsHasConstArray; ///< SVFIR object node has const array (maybe nested with struct)
91
- static const char* NumOfNonPtrObjs; ///< SVFIR object node which is non pointer type object (do not have pts)
92
- static const char* NumOfConstantObjs; ///< SVFIR object node which is purely constant
93
-
94
- static const char* NumberOfFieldInsensitiveObj;
95
- static const char* NumberOfFieldSensitiveObj;
96
-
97
- static const char* NumOfPointers; ///< SVFIR value node, each of them maps to a llvm value
98
- static const char* NumOfGepFieldPointers; ///< SVFIR gep value node (field value, dynamically created dummy node)
99
-
100
- static const char* NumOfMemObjects; ///< SVFIR object node, each of them maps to a llvm value
101
- static const char* NumOfGepFieldObjects; ///< SVFIR gep object node (field obj, dynamically created dummy node)
102
-
103
- static const char* AveragePointsToSetSize; ///< Average points-to size of all variables
104
- static const char* AverageTopLevPointsToSetSize; ///< Average points-to size of top-level variables
105
- static const char* MaxPointsToSetSize; ///< Max points-to size
106
-
107
- static const char* NumOfIterations; ///< Number of iterations during resolution
108
-
109
- static const char* NumOfIndirectCallSites; ///< Number of indirect callsites
110
- static const char* NumOfIndirectEdgeSolved; ///< Number of indirect calledge resolved
111
-
112
- static const char* NumOfSCCDetection; ///< Number of scc detection performed
113
- static const char* NumOfCycles; ///< Number of scc cycles detected
114
- static const char* NumOfPWCCycles; ///< Number of scc cycles detected
115
- static const char* NumOfNodesInCycles; ///< Number of nodes in cycles detected
116
- static const char* MaxNumOfNodesInSCC; ///< max Number of nodes in one scc
117
-
118
- static const char* NumOfNullPointer; ///< Number of pointers points-to null
119
-
120
51
  PTAStat(PointerAnalysis* p);
121
52
  virtual ~PTAStat() {}
122
53
 
123
- NUMStatMap PTNumStatMap;
124
54
  NodeBS localVarInRecursion;
125
55
 
126
- double startTime;
127
- double endTime;
128
-
129
56
  void performStat() override;
130
57
 
131
- virtual void printStat(std::string str = "") override;
132
-
133
58
  void callgraphStat() override;
134
59
  private:
135
- void bitcastInstStat();
136
- void branchStat();
137
-
138
60
  PointerAnalysis* pta;
139
- std::string moduleName;
140
61
  };
141
62
 
142
63
  } // End namespace SVF
@@ -71,6 +71,7 @@ public:
71
71
  static double getClk(bool mark = false);
72
72
 
73
73
  NUMStatMap generalNumMap;
74
+ NUMStatMap PTNumStatMap;
74
75
  TIMEStatMap timeStatMap;
75
76
 
76
77
  double startTime;
@@ -78,7 +79,7 @@ public:
78
79
 
79
80
  virtual void performStat() = 0;
80
81
 
81
- virtual void printStat(std::string str = "") = 0;
82
+ virtual void printStat(std::string str = "");
82
83
 
83
84
  virtual void performStatPerQuery(NodeID) {}
84
85
 
@@ -91,7 +92,7 @@ public:
91
92
  static double timeOfBuildingSVFIR;
92
93
 
93
94
  private:
94
-
95
+ void branchStat();
95
96
  std::string moduleName;
96
97
  }; // End class SVFStat
97
98
 
@@ -2,7 +2,7 @@
2
2
  //
3
3
  // SVF: Static Value-Flow Analysis
4
4
  //
5
- // Copyright (C) <2013-2017> <Yulei Sui>
5
+ // Copyright (C) <2013-> <Yulei Sui>
6
6
  //
7
7
 
8
8
  // This program is free software: you can redistribute it and/or modify
@@ -32,191 +32,33 @@
32
32
  #include "Util/PTAStat.h"
33
33
  #include "MemoryModel/PointerAnalysisImpl.h"
34
34
  #include "MemoryModel/SVFIR.h"
35
- #include "Util/Options.h"
36
35
 
37
36
  using namespace SVF;
38
37
  using namespace std;
39
38
 
40
- const char* PTAStat:: TotalAnalysisTime = "TotalTime"; ///< SVFIR value nodes ??
41
- const char* PTAStat:: SCCDetectionTime = "SCCDetectTime"; ///< Total SCC detection time
42
- const char* PTAStat:: SCCMergeTime = "SCCMergeTime"; ///< Total SCC merge time
43
-
44
- const char* PTAStat:: ProcessLoadStoreTime = "LoadStoreTime"; ///< process load and store time
45
- const char* PTAStat:: ProcessCopyGepTime = "CopyGepTime"; ///< process copy and gep time
46
- const char* PTAStat:: UpdateCallGraphTime = "UpdateCGTime"; ///< process copy and gep time ??
47
-
48
- const char* PTAStat:: TotalNumOfPointers = "TotalPointers"; ///< SVFIR value nodes
49
- const char* PTAStat:: TotalNumOfObjects = "TotalObjects"; ///< Total SVFIR object node
50
- const char* PTAStat:: TotalNumOfFieldObjects = "TotalFieldObjects"; ///< Total SVFIR field object node
51
- const char* PTAStat:: MaxStructSize = "MaxStructSize"; ///< Max struct size (bytes)
52
- const char* PTAStat:: TotalNumOfEdges = "TotalSVFStmts"; ///< Total SVFIR edge number
53
-
54
- const char* PTAStat:: NumOfFunctionObjs = "FunctionObjs"; ///< function numbers
55
- const char* PTAStat:: NumOfGlobalObjs = "GlobalObjs"; ///< SVFIR global object node
56
- const char* PTAStat:: NumOfHeapObjs = "HeapObjs"; ///< SVFIR heap object node
57
- const char* PTAStat:: NumOfStackObjs = "StackObjs"; ///< SVFIR stack object node
58
-
59
- const char* PTAStat::NumberOfFieldInsensitiveObj = "FIObjNum";
60
- const char* PTAStat::NumberOfFieldSensitiveObj = "FSObjNum";
61
-
62
- const char* PTAStat:: NumOfObjsHasVarStruct = "VarStructObj"; ///< SVFIR object node has struct (maybe nested with array)
63
- const char* PTAStat:: NumOfObjsHasVarArray = "VarArrayObj"; ///< SVFIR object node has array (maybe nested with struct)
64
- const char* PTAStat:: NumOfObjsHasConstStruct = "ConstStructObj"; ///< SVFIR object node has const struct (maybe nested with array)
65
- const char* PTAStat:: NumOfObjsHasConstArray = "ConstArrayObj"; ///< SVFIR object node has const array (maybe nested with struct)
66
- const char* PTAStat:: NumOfNonPtrObjs = "NonPtrObj"; ///< SVFIR object node which is non pointer type object (do not have pts)
67
- const char* PTAStat:: NumOfConstantObjs = "ConstantObj"; ///< SVFIR object node which is purely scalar
68
-
69
- const char* PTAStat:: NumOfAddrs = "AddrsNum"; ///< SVFIR addr edge
70
- const char* PTAStat:: NumOfLoads = "LoadsNum"; ///< SVFIR load edge
71
- const char* PTAStat:: NumOfStores = "StoresNum"; ///< SVFIR store edge
72
- const char* PTAStat:: NumOfCopys = "CopysNum"; ///< SVFIR copy edge
73
- const char* PTAStat:: NumOfGeps = "GepsNum"; ///< SVFIR gep edge
74
- const char* PTAStat:: NumOfCalls = "CallsNum"; ///< SVFIR call edge
75
- const char* PTAStat:: NumOfReturns = "ReturnsNum"; ///< SVFIR return edge
76
-
77
- const char* PTAStat:: NumOfProcessedAddrs = "AddrProcessed"; ///< SVFIR addr processed edge
78
- const char* PTAStat:: NumOfProcessedLoads = "LoadProcessed"; ///< SVFIR load processed edge
79
- const char* PTAStat:: NumOfProcessedStores = "StoreProcessed"; ///< SVFIR store processed edge
80
- const char* PTAStat:: NumOfProcessedCopys = "CopyProcessed"; ///< SVFIR copy processed edge
81
- const char* PTAStat:: NumOfProcessedGeps = "GepProcessed"; ///< SVFIR gep processed edge
82
-
83
- const char* PTAStat::NumOfSfr = "NumOfSFRs"; ///< number of field representatives
84
- const char* PTAStat::NumOfFieldExpand = "NumOfFieldExpand";
85
-
86
- const char* PTAStat:: NumOfPointers = "Pointers"; ///< SVFIR value node, each of them maps to a llvm value
87
- const char* PTAStat:: NumOfGepFieldPointers = "DYFieldPtrs"; ///< SVFIR gep value node (field value, dynamically created dummy node)
88
-
89
- const char* PTAStat:: NumOfMemObjects = "MemObjects"; ///< SVFIR object node, each of them maps to a llvm value
90
- const char* PTAStat:: NumOfGepFieldObjects = "DYFieldObjs"; ///< SVFIR gep object node (field obj, dynamically created dummy node)
91
-
92
- const char* PTAStat:: AveragePointsToSetSize = "AvgPtsSetSize"; ///< Average Points-to set size
93
- const char* PTAStat:: AverageTopLevPointsToSetSize = "AvgTopLvlPtsSize"; ///< Average Points-to set size of top level pointers
94
- const char* PTAStat:: MaxPointsToSetSize = "MaxPtsSetSize"; ///< Max Points-to set size
95
-
96
- const char* PTAStat:: NumOfIterations = "Iterations"; ///< Number of iterations during resolution
97
-
98
- const char* PTAStat:: NumOfIndirectCallSites = "IndCallSites"; ///< Number of indirect callsites
99
- const char* PTAStat:: NumOfIndirectEdgeSolved = "IndEdgeSolved"; ///< Number of indirect calledge resolved
100
-
101
- const char* PTAStat:: NumOfSCCDetection = "NumOfSCCDetect"; ///< Number of scc detection performed
102
- const char* PTAStat:: NumOfCycles = "TotalCycleNum"; ///< Number of scc cycles detected
103
- const char* PTAStat:: NumOfPWCCycles = "TotalPWCCycleNum"; ///< Number of pwc scc cycles detected
104
- const char* PTAStat:: NumOfNodesInCycles = "NodesInCycles"; ///< Number of nodes in cycles detected
105
- const char* PTAStat:: MaxNumOfNodesInSCC = "MaxNodesInSCC"; ///< max Number of nodes in one scc cycle
106
-
107
- const char* PTAStat:: NumOfNullPointer = "NullPointer"; ///< Number of pointers points-to null
108
-
109
- PTAStat::PTAStat(PointerAnalysis* p) : SVFStat(), startTime(0), endTime(0), pta(p)
39
+ PTAStat::PTAStat(PointerAnalysis* p) : SVFStat(), pta(p)
110
40
  {
111
-
112
41
  }
113
42
 
114
43
  void PTAStat::performStat()
115
44
  {
116
-
117
45
  callgraphStat();
118
46
 
47
+ SVFStat::performStat();
48
+
119
49
  SVFIR* pag = SVFIR::getPAG();
120
- u32_t numOfFunction = 0;
121
- u32_t numOfGlobal = 0;
122
- u32_t numOfStack = 0;
123
- u32_t numOfHeap = 0;
124
- u32_t numOfHasVarArray = 0;
125
- u32_t numOfHasVarStruct = 0;
126
- u32_t numOfHasConstArray = 0;
127
- u32_t numOfHasConstStruct = 0;
128
- u32_t numOfScalar = 0;
129
- u32_t numOfConstant = 0;
130
- u32_t fiObjNumber = 0;
131
- u32_t fsObjNumber = 0;
132
- Set<SymID> memObjSet;
133
50
  for(SVFIR::iterator it = pag->begin(), eit = pag->end(); it!=eit; ++it)
134
51
  {
135
52
  PAGNode* node = it->second;
136
- if(ObjVar* obj = SVFUtil::dyn_cast<ObjVar>(node))
53
+ if(SVFUtil::isa<ObjVar>(node))
137
54
  {
138
- const MemObj* mem = obj->getMemObj();
139
- if (memObjSet.insert(mem->getId()).second == false)
140
- continue;
141
- if(mem->isBlackHoleObj())
142
- continue;
143
- if(mem->isFunction())
144
- numOfFunction++;
145
- if(mem->isGlobalObj())
146
- numOfGlobal++;
147
- if(mem->isStack())
148
- numOfStack++;
149
- if(mem->isHeap())
150
- numOfHeap++;
151
- if(mem->isVarArray())
152
- numOfHasVarArray++;
153
- if(mem->isVarStruct())
154
- numOfHasVarStruct++;
155
- if(mem->isConstantArray())
156
- numOfHasConstArray++;
157
- if(mem->isConstantStruct())
158
- numOfHasConstStruct++;
159
- if(mem->hasPtrObj() == false)
160
- numOfScalar++;
161
- if(mem->isConstDataOrConstGlobal())
162
- numOfConstant++;
163
-
164
- if (mem->isFieldInsensitive())
165
- fiObjNumber++;
166
- else
167
- fsObjNumber++;
168
-
169
55
  if(pta->isLocalVarInRecursiveFun(node->getId()))
170
56
  {
171
57
  localVarInRecursion.set(node->getId());
172
58
  }
173
59
  }
174
60
  }
175
-
176
-
177
-
178
- generalNumMap[TotalNumOfPointers] = pag->getValueNodeNum() + pag->getFieldValNodeNum();
179
- generalNumMap[TotalNumOfObjects] = pag->getObjectNodeNum();
180
- generalNumMap[TotalNumOfFieldObjects] = pag->getFieldObjNodeNum();
181
- generalNumMap[MaxStructSize] = SymbolTableInfo::SymbolInfo()->getMaxStructSize();
182
- generalNumMap[TotalNumOfEdges] = pag->getPAGEdgeNum();
183
- generalNumMap["TotalPTASVFStmts"] = pag->getPTAPAGEdgeNum();
184
- generalNumMap[NumberOfFieldInsensitiveObj] = fiObjNumber;
185
- generalNumMap[NumberOfFieldSensitiveObj] = fsObjNumber;
186
-
187
- generalNumMap[NumOfAddrs] = pag->getSVFStmtSet(SVFStmt::Addr).size();
188
- generalNumMap[NumOfLoads] = pag->getSVFStmtSet(SVFStmt::Load).size();
189
- generalNumMap[NumOfStores] = pag->getSVFStmtSet(SVFStmt::Store).size();
190
- generalNumMap[NumOfCopys] = pag->getSVFStmtSet(SVFStmt::Copy).size();
191
- generalNumMap[NumOfGeps] = pag->getSVFStmtSet(SVFStmt::Gep).size();
192
- generalNumMap[NumOfCalls] = pag->getSVFStmtSet(SVFStmt::Call).size();
193
- generalNumMap[NumOfReturns] = pag->getSVFStmtSet(SVFStmt::Ret).size();
194
-
195
- generalNumMap[NumOfFunctionObjs] = numOfFunction;
196
- generalNumMap[NumOfGlobalObjs] = numOfGlobal;
197
- generalNumMap[NumOfHeapObjs] = numOfHeap;
198
- generalNumMap[NumOfStackObjs] = numOfStack;
199
-
200
- generalNumMap[NumOfObjsHasVarStruct] = numOfHasVarStruct;
201
- generalNumMap[NumOfObjsHasVarArray] = numOfHasVarArray;
202
- generalNumMap[NumOfObjsHasConstStruct] = numOfHasConstStruct;
203
- generalNumMap[NumOfObjsHasConstArray] = numOfHasConstArray;
204
- generalNumMap[NumOfNonPtrObjs] = numOfScalar;
205
- generalNumMap[NumOfConstantObjs] = numOfConstant;
206
-
207
- generalNumMap[NumOfIndirectCallSites] = pag->getIndirectCallsites().size();
208
- generalNumMap["TotalCallSite"] = pag->getCallSiteSet().size();
209
- generalNumMap["LocalVarInRecur"] = localVarInRecursion.count();
210
-
211
- timeStatMap["LLVMIRTime"] = SVFStat::timeOfBuildingLLVMModule;
212
- timeStatMap["SymbolTableTime"] = SVFStat::timeOfBuildingSymbolTable;
213
- timeStatMap["SVFIRTime"] = SVFStat::timeOfBuildingSVFIR;
214
-
215
- // REFACTOR-TODO bitcastInstStat();
216
- branchStat();
217
-
218
- printStat("General Stats");
219
-
61
+ PTNumStatMap["LocalVarInRecur"] = localVarInRecursion.count();
220
62
  }
221
63
 
222
64
  void PTAStat::callgraphStat()
@@ -270,101 +112,7 @@ void PTAStat::callgraphStat()
270
112
  PTNumStatMap["TotalEdge"] = totalEdge;
271
113
  PTNumStatMap["CalRetPairInCycle"] = edgeInCycle;
272
114
 
273
- PTAStat::printStat("CallGraph Stats");
115
+ SVFStat::printStat("CallGraph Stats");
274
116
 
275
117
  delete callgraphSCC;
276
118
  }
277
-
278
- void PTAStat::printStat(string statname)
279
- {
280
-
281
- std::string moduleName(SymbolTableInfo::SymbolInfo()->getModule()->getModuleIdentifier());
282
- std::vector<std::string> names = SVFUtil::split(moduleName,'/');
283
- if (names.size() > 1)
284
- {
285
- moduleName = names[names.size() - 1];
286
- }
287
-
288
- SVFUtil::outs() << "\n*********" << statname << "***************\n";
289
- SVFUtil::outs() << "################ (program : " << moduleName << ")###############\n";
290
- SVFUtil::outs().flags(std::ios::left);
291
- unsigned field_width = 20;
292
- for(NUMStatMap::iterator it = generalNumMap.begin(), eit = generalNumMap.end(); it!=eit; ++it)
293
- {
294
- // format out put with width 20 space
295
- std::cout << std::setw(field_width) << it->first << it->second << "\n";
296
- }
297
- SVFUtil::outs() << "-------------------------------------------------------\n";
298
- for(TIMEStatMap::iterator it = timeStatMap.begin(), eit = timeStatMap.end(); it!=eit; ++it)
299
- {
300
- // format out put with width 20 space
301
- SVFUtil::outs() << std::setw(field_width) << it->first << it->second << "\n";
302
- }
303
- for(NUMStatMap::iterator it = PTNumStatMap.begin(), eit = PTNumStatMap.end(); it!=eit; ++it)
304
- {
305
- // format out put with width 20 space
306
- SVFUtil::outs() << std::setw(field_width) << it->first << it->second << "\n";
307
- }
308
-
309
- SVFUtil::outs() << "#######################################################" << std::endl;
310
- SVFUtil::outs().flush();
311
- generalNumMap.clear();
312
- PTNumStatMap.clear();
313
- timeStatMap.clear();
314
- }
315
-
316
-
317
- /* REFACTOR-TODO
318
- void PTAStat::bitcastInstStat()
319
- {
320
- SVFModule* module = pta->getModule();
321
- u32_t numberOfBitCast = 0;
322
- for (SVFModule::llvm_const_iterator funIter = module->llvmFunBegin(), funEiter = module->llvmFunEnd();
323
- funIter != funEiter; ++funIter)
324
- {
325
- const Function* func = *funIter;
326
- for (Function::const_iterator bbIt = func->begin(), bbEit = func->end();
327
- bbIt != bbEit; ++bbIt)
328
- {
329
- const BasicBlock& bb = *bbIt;
330
- for (BasicBlock::const_iterator instIt = bb.begin(), instEit = bb.end();
331
- instIt != instEit; ++instIt)
332
- {
333
- const Instruction& inst = *instIt;
334
- if (const BitCastInst* bitcast = SVFUtil::dyn_cast<BitCastInst>(&inst))
335
- {
336
- if (SVFUtil::isa<PointerType>(bitcast->getSrcTy()))
337
- numberOfBitCast++;
338
- }
339
- }
340
- }
341
- }
342
-
343
- generalNumMap["BitCastNumber"] = numberOfBitCast;
344
- }
345
- */
346
-
347
- void PTAStat::branchStat()
348
- {
349
- SVFModule* module = pta->getModule();
350
- u32_t numOfBB_2Succ = 0;
351
- u32_t numOfBB_3Succ = 0;
352
- for (SVFModule::llvm_const_iterator funIter = module->llvmFunBegin(), funEiter = module->llvmFunEnd();
353
- funIter != funEiter; ++funIter)
354
- {
355
- const Function* func = *funIter;
356
- for (Function::const_iterator bbIt = func->begin(), bbEit = func->end();
357
- bbIt != bbEit; ++bbIt)
358
- {
359
- const BasicBlock& bb = *bbIt;
360
- u32_t numOfSucc = bb.getTerminator()->getNumSuccessors();
361
- if (numOfSucc == 2)
362
- numOfBB_2Succ++;
363
- else if (numOfSucc > 2)
364
- numOfBB_3Succ++;
365
- }
366
- }
367
-
368
- generalNumMap["BBWith2Succ"] = numOfBB_2Succ;
369
- generalNumMap["BBWith3Succ"] = numOfBB_3Succ;
370
- }
@@ -2,7 +2,7 @@
2
2
  //
3
3
  // SVF: Static Value-Flow Analysis
4
4
  //
5
- // Copyright (C) <2013-2017> <Yulei Sui>
5
+ // Copyright (C) <2013-> <Yulei Sui>
6
6
  //
7
7
 
8
8
  // This program is free software: you can redistribute it and/or modify
@@ -31,6 +31,7 @@
31
31
  #include "Util/SVFStat.h"
32
32
 
33
33
  using namespace SVF;
34
+ using namespace std;
34
35
 
35
36
  double SVFStat::timeOfBuildingLLVMModule = 0;
36
37
  double SVFStat::timeOfBuildingSVFIR = 0;
@@ -60,4 +61,198 @@ double SVFStat::getClk(bool mark)
60
61
 
61
62
  assert(false && "PTAStat::getClk: unknown clock type");
62
63
  abort();
63
- }
64
+ }
65
+
66
+ void SVFStat::printStat(string statname)
67
+ {
68
+
69
+ std::string moduleName(SymbolTableInfo::SymbolInfo()->getModule()->getModuleIdentifier());
70
+ std::vector<std::string> names = SVFUtil::split(moduleName,'/');
71
+ if (names.size() > 1)
72
+ {
73
+ moduleName = names[names.size() - 1];
74
+ }
75
+
76
+ SVFUtil::outs() << "\n*********" << statname << "***************\n";
77
+ SVFUtil::outs() << "################ (program : " << moduleName << ")###############\n";
78
+ SVFUtil::outs().flags(std::ios::left);
79
+ unsigned field_width = 20;
80
+ for(NUMStatMap::iterator it = generalNumMap.begin(), eit = generalNumMap.end(); it!=eit; ++it)
81
+ {
82
+ // format out put with width 20 space
83
+ std::cout << std::setw(field_width) << it->first << it->second << "\n";
84
+ }
85
+ SVFUtil::outs() << "-------------------------------------------------------\n";
86
+ for(TIMEStatMap::iterator it = timeStatMap.begin(), eit = timeStatMap.end(); it!=eit; ++it)
87
+ {
88
+ // format out put with width 20 space
89
+ SVFUtil::outs() << std::setw(field_width) << it->first << it->second << "\n";
90
+ }
91
+ for(NUMStatMap::iterator it = PTNumStatMap.begin(), eit = PTNumStatMap.end(); it!=eit; ++it)
92
+ {
93
+ // format out put with width 20 space
94
+ SVFUtil::outs() << std::setw(field_width) << it->first << it->second << "\n";
95
+ }
96
+
97
+ SVFUtil::outs() << "#######################################################" << std::endl;
98
+ SVFUtil::outs().flush();
99
+ generalNumMap.clear();
100
+ PTNumStatMap.clear();
101
+ timeStatMap.clear();
102
+ }
103
+
104
+ void SVFStat::performStat()
105
+ {
106
+
107
+ SVFIR* pag = SVFIR::getPAG();
108
+ u32_t numOfFunction = 0;
109
+ u32_t numOfGlobal = 0;
110
+ u32_t numOfStack = 0;
111
+ u32_t numOfHeap = 0;
112
+ u32_t numOfHasVarArray = 0;
113
+ u32_t numOfHasVarStruct = 0;
114
+ u32_t numOfHasConstArray = 0;
115
+ u32_t numOfHasConstStruct = 0;
116
+ u32_t numOfScalar = 0;
117
+ u32_t numOfConstant = 0;
118
+ u32_t fiObjNumber = 0;
119
+ u32_t fsObjNumber = 0;
120
+ Set<SymID> memObjSet;
121
+ for(SVFIR::iterator it = pag->begin(), eit = pag->end(); it!=eit; ++it)
122
+ {
123
+ PAGNode* node = it->second;
124
+ if(ObjVar* obj = SVFUtil::dyn_cast<ObjVar>(node))
125
+ {
126
+ const MemObj* mem = obj->getMemObj();
127
+ if (memObjSet.insert(mem->getId()).second == false)
128
+ continue;
129
+ if(mem->isBlackHoleObj())
130
+ continue;
131
+ if(mem->isFunction())
132
+ numOfFunction++;
133
+ if(mem->isGlobalObj())
134
+ numOfGlobal++;
135
+ if(mem->isStack())
136
+ numOfStack++;
137
+ if(mem->isHeap())
138
+ numOfHeap++;
139
+ if(mem->isVarArray())
140
+ numOfHasVarArray++;
141
+ if(mem->isVarStruct())
142
+ numOfHasVarStruct++;
143
+ if(mem->isConstantArray())
144
+ numOfHasConstArray++;
145
+ if(mem->isConstantStruct())
146
+ numOfHasConstStruct++;
147
+ if(mem->hasPtrObj() == false)
148
+ numOfScalar++;
149
+ if(mem->isConstDataOrConstGlobal())
150
+ numOfConstant++;
151
+
152
+ if (mem->isFieldInsensitive())
153
+ fiObjNumber++;
154
+ else
155
+ fsObjNumber++;
156
+ }
157
+ }
158
+
159
+
160
+
161
+ generalNumMap["TotalPointers"] = pag->getValueNodeNum() + pag->getFieldValNodeNum();
162
+ generalNumMap["TotalObjects"] = pag->getObjectNodeNum();
163
+ generalNumMap["TotalFieldObjects"] = pag->getFieldObjNodeNum();
164
+ generalNumMap["MaxStructSize"] = SymbolTableInfo::SymbolInfo()->getMaxStructSize();
165
+ generalNumMap["TotalSVFStmts"] = pag->getPAGEdgeNum();
166
+ generalNumMap["TotalPTASVFStmts"] = pag->getPTAPAGEdgeNum();
167
+ generalNumMap["FIObjNum"] = fiObjNumber;
168
+ generalNumMap["FSObjNum"] = fsObjNumber;
169
+
170
+ generalNumMap["AddrsNum"] = pag->getSVFStmtSet(SVFStmt::Addr).size();
171
+ generalNumMap["LoadsNum"] = pag->getSVFStmtSet(SVFStmt::Load).size();
172
+ generalNumMap["StoresNum"] = pag->getSVFStmtSet(SVFStmt::Store).size();
173
+ generalNumMap["CopysNum"] = pag->getSVFStmtSet(SVFStmt::Copy).size();
174
+ generalNumMap["GepsNum"] = pag->getSVFStmtSet(SVFStmt::Gep).size();
175
+ generalNumMap["CallsNum"] = pag->getSVFStmtSet(SVFStmt::Call).size();
176
+ generalNumMap["ReturnsNum"] = pag->getSVFStmtSet(SVFStmt::Ret).size();
177
+
178
+ generalNumMap["FunctionObjs"] = numOfFunction;
179
+ generalNumMap["GlobalObjs"] = numOfGlobal;
180
+ generalNumMap["HeapObjs"] = numOfHeap;
181
+ generalNumMap["StackObjs"] = numOfStack;
182
+
183
+ generalNumMap["VarStructObj"] = numOfHasVarStruct;
184
+ generalNumMap["VarArrayObj"] = numOfHasVarArray;
185
+ generalNumMap["ConstStructObj"] = numOfHasConstStruct;
186
+ generalNumMap["ConstArrayObj"] = numOfHasConstArray;
187
+ generalNumMap["NonPtrObj"] = numOfScalar;
188
+ generalNumMap["ConstantObj"] = numOfConstant;
189
+
190
+ generalNumMap["IndCallSites"] = pag->getIndirectCallsites().size();
191
+ generalNumMap["TotalCallSite"] = pag->getCallSiteSet().size();
192
+
193
+ timeStatMap["LLVMIRTime"] = SVFStat::timeOfBuildingLLVMModule;
194
+ timeStatMap["SymbolTableTime"] = SVFStat::timeOfBuildingSymbolTable;
195
+ timeStatMap["SVFIRTime"] = SVFStat::timeOfBuildingSVFIR;
196
+
197
+ // REFACTOR-TODO bitcastInstStat();
198
+ branchStat();
199
+
200
+ printStat("General Stats");
201
+
202
+ }
203
+
204
+
205
+ void SVFStat::branchStat()
206
+ {
207
+ SVFModule* module = SVFIR::getPAG()->getModule();
208
+ u32_t numOfBB_2Succ = 0;
209
+ u32_t numOfBB_3Succ = 0;
210
+ for (SVFModule::llvm_const_iterator funIter = module->llvmFunBegin(), funEiter = module->llvmFunEnd();
211
+ funIter != funEiter; ++funIter)
212
+ {
213
+ const Function* func = *funIter;
214
+ for (Function::const_iterator bbIt = func->begin(), bbEit = func->end();
215
+ bbIt != bbEit; ++bbIt)
216
+ {
217
+ const BasicBlock& bb = *bbIt;
218
+ u32_t numOfSucc = bb.getTerminator()->getNumSuccessors();
219
+ if (numOfSucc == 2)
220
+ numOfBB_2Succ++;
221
+ else if (numOfSucc > 2)
222
+ numOfBB_3Succ++;
223
+ }
224
+ }
225
+
226
+ generalNumMap["BBWith2Succ"] = numOfBB_2Succ;
227
+ generalNumMap["BBWith3Succ"] = numOfBB_3Succ;
228
+ }
229
+
230
+ /* REFACTOR-TODO
231
+ void PTAStat::bitcastInstStat()
232
+ {
233
+ SVFModule* module = pta->getModule();
234
+ u32_t numberOfBitCast = 0;
235
+ for (SVFModule::llvm_const_iterator funIter = module->llvmFunBegin(), funEiter = module->llvmFunEnd();
236
+ funIter != funEiter; ++funIter)
237
+ {
238
+ const Function* func = *funIter;
239
+ for (Function::const_iterator bbIt = func->begin(), bbEit = func->end();
240
+ bbIt != bbEit; ++bbIt)
241
+ {
242
+ const BasicBlock& bb = *bbIt;
243
+ for (BasicBlock::const_iterator instIt = bb.begin(), instEit = bb.end();
244
+ instIt != instEit; ++instIt)
245
+ {
246
+ const Instruction& inst = *instIt;
247
+ if (const BitCastInst* bitcast = SVFUtil::dyn_cast<BitCastInst>(&inst))
248
+ {
249
+ if (SVFUtil::isa<PointerType>(bitcast->getSrcTy()))
250
+ numberOfBitCast++;
251
+ }
252
+ }
253
+ }
254
+ }
255
+
256
+ generalNumMap["BitCastNumber"] = numberOfBitCast;
257
+ }
258
+ */