svf-lib 1.0.1213 → 1.0.1216

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.
@@ -21,7 +21,7 @@
21
21
  //===----------------------------------------------------------------------===//
22
22
 
23
23
  /*
24
- * AndersenStat.h
24
+ * PTAStat.h
25
25
  *
26
26
  * Created on: Oct 12, 2013
27
27
  * Author: Yulei Sui
@@ -32,12 +32,11 @@
32
32
 
33
33
  #include "Util/BasicTypes.h"
34
34
  #include "MemoryModel/PointsTo.h"
35
+ #include "Util/SVFStat.h"
35
36
  #include <iostream>
36
37
  #include <map>
37
38
  #include <string>
38
39
 
39
- using namespace std;
40
-
41
40
  namespace SVF
42
41
  {
43
42
 
@@ -46,7 +45,7 @@ class PointerAnalysis;
46
45
  /*!
47
46
  * Pointer Analysis Statistics
48
47
  */
49
- class PTAStat
48
+ class PTAStat: public SVFStat
50
49
  {
51
50
  public:
52
51
  static const char* TotalAnalysisTime; ///< Total analysis time
@@ -118,49 +117,20 @@ public:
118
117
 
119
118
  static const char* NumOfNullPointer; ///< Number of pointers points-to null
120
119
 
121
- typedef Map<const char*,u32_t> NUMStatMap;
122
-
123
- typedef Map<const char*,double> TIMEStatMap;
124
-
125
- enum ClockType
126
- {
127
- Wall,
128
- CPU,
129
- };
130
-
131
120
  PTAStat(PointerAnalysis* p);
132
121
  virtual ~PTAStat() {}
133
122
 
134
- virtual inline void startClk()
135
- {
136
- startTime = getClk(true);
137
- }
138
- virtual inline void endClk()
139
- {
140
- endTime = getClk(true);
141
- }
142
- /// When mark is true, real clock is always returned. When mark is false, it is
143
- /// only returned when Options::MarkedClocksOnly is not set.
144
- /// Default call for getClk is unmarked, while MarkedClocksOnly is false by default.
145
- static double getClk(bool mark=false);
146
-
147
- NUMStatMap generalNumMap;
148
123
  NUMStatMap PTNumStatMap;
149
- TIMEStatMap timeStatMap;
150
124
  NodeBS localVarInRecursion;
151
125
 
152
126
  double startTime;
153
127
  double endTime;
154
128
 
155
- virtual void performStat();
156
-
157
- virtual void printStat(string str = "");
158
-
159
- virtual void performStatPerQuery(NodeID) {}
129
+ void performStat() override;
160
130
 
161
- virtual void printStatPerQuery(NodeID, const PointsTo&) {}
131
+ virtual void printStat(std::string str = "") override;
162
132
 
163
- virtual void callgraphStat();
133
+ void callgraphStat() override;
164
134
  private:
165
135
  void bitcastInstStat();
166
136
  void branchStat();
@@ -0,0 +1,95 @@
1
+ //===- SVFStat.h -- Base class for statistics---------------------------------//
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
+ * SVFStat.h
25
+ *
26
+ * Created on: Sep 1, 2022
27
+ * Author: Xiao Cheng
28
+ */
29
+
30
+ #ifndef SVF_SVFSTAT_H
31
+ #define SVF_SVFSTAT_H
32
+
33
+ namespace SVF
34
+ {
35
+
36
+
37
+ /*!
38
+ * Pointer Analysis Statistics
39
+ */
40
+ class SVFStat
41
+ {
42
+ public:
43
+
44
+ typedef OrderedMap<const char *, u32_t> NUMStatMap;
45
+
46
+ typedef OrderedMap<const char *, double> TIMEStatMap;
47
+
48
+ enum ClockType
49
+ {
50
+ Wall,
51
+ CPU,
52
+ };
53
+
54
+ SVFStat();
55
+
56
+ virtual ~SVFStat() {}
57
+
58
+ virtual inline void startClk()
59
+ {
60
+ startTime = getClk(true);
61
+ }
62
+
63
+ virtual inline void endClk()
64
+ {
65
+ endTime = getClk(true);
66
+ }
67
+
68
+ /// When mark is true, real clock is always returned. When mark is false, it is
69
+ /// only returned when Options::MarkedClocksOnly is not set.
70
+ /// Default call for getClk is unmarked, while MarkedClocksOnly is false by default.
71
+ static double getClk(bool mark = false);
72
+
73
+ NUMStatMap generalNumMap;
74
+ TIMEStatMap timeStatMap;
75
+
76
+ double startTime;
77
+ double endTime;
78
+
79
+ virtual void performStat() = 0;
80
+
81
+ virtual void printStat(std::string str = "") = 0;
82
+
83
+ virtual void performStatPerQuery(NodeID) {}
84
+
85
+ virtual void printStatPerQuery(NodeID, const PointsTo &) {}
86
+
87
+ virtual void callgraphStat() {}
88
+
89
+ private:
90
+
91
+ std::string moduleName;
92
+ }; // End class SVFStat
93
+
94
+ } // End namespace SVF
95
+ #endif //SVF_SVFSTAT_H
@@ -104,7 +104,7 @@ class AndersenSFR : public AndersenSCD
104
104
  public:
105
105
  typedef Map<NodeID, NodeBS> NodeStrides;
106
106
  typedef Map<NodeID, NodeSet> FieldReps;
107
- typedef Map<NodeID, pair<NodeID, NodeSet>> SFRTrait;
107
+ typedef Map<NodeID, std::pair<NodeID, NodeSet>> SFRTrait;
108
108
 
109
109
  private:
110
110
  static AndersenSFR* sfrAndersen;
Binary file
@@ -142,7 +142,7 @@ public:
142
142
  }
143
143
  }
144
144
 
145
- void printStat(string statname)
145
+ void printStat(std::string statname)
146
146
  {
147
147
 
148
148
  SVFUtil::outs() << "\n************ " << statname << " ***************\n";
@@ -21,7 +21,7 @@
21
21
  //===----------------------------------------------------------------------===//
22
22
 
23
23
  /*
24
- * AndersenStat.h
24
+ * PTAStat.h
25
25
  *
26
26
  * Created on: Oct 12, 2013
27
27
  * Author: Yulei Sui
@@ -32,12 +32,11 @@
32
32
 
33
33
  #include "Util/BasicTypes.h"
34
34
  #include "MemoryModel/PointsTo.h"
35
+ #include "Util/SVFStat.h"
35
36
  #include <iostream>
36
37
  #include <map>
37
38
  #include <string>
38
39
 
39
- using namespace std;
40
-
41
40
  namespace SVF
42
41
  {
43
42
 
@@ -46,7 +45,7 @@ class PointerAnalysis;
46
45
  /*!
47
46
  * Pointer Analysis Statistics
48
47
  */
49
- class PTAStat
48
+ class PTAStat: public SVFStat
50
49
  {
51
50
  public:
52
51
  static const char* TotalAnalysisTime; ///< Total analysis time
@@ -118,49 +117,20 @@ public:
118
117
 
119
118
  static const char* NumOfNullPointer; ///< Number of pointers points-to null
120
119
 
121
- typedef Map<const char*,u32_t> NUMStatMap;
122
-
123
- typedef Map<const char*,double> TIMEStatMap;
124
-
125
- enum ClockType
126
- {
127
- Wall,
128
- CPU,
129
- };
130
-
131
120
  PTAStat(PointerAnalysis* p);
132
121
  virtual ~PTAStat() {}
133
122
 
134
- virtual inline void startClk()
135
- {
136
- startTime = getClk(true);
137
- }
138
- virtual inline void endClk()
139
- {
140
- endTime = getClk(true);
141
- }
142
- /// When mark is true, real clock is always returned. When mark is false, it is
143
- /// only returned when Options::MarkedClocksOnly is not set.
144
- /// Default call for getClk is unmarked, while MarkedClocksOnly is false by default.
145
- static double getClk(bool mark=false);
146
-
147
- NUMStatMap generalNumMap;
148
123
  NUMStatMap PTNumStatMap;
149
- TIMEStatMap timeStatMap;
150
124
  NodeBS localVarInRecursion;
151
125
 
152
126
  double startTime;
153
127
  double endTime;
154
128
 
155
- virtual void performStat();
156
-
157
- virtual void printStat(string str = "");
158
-
159
- virtual void performStatPerQuery(NodeID) {}
129
+ void performStat() override;
160
130
 
161
- virtual void printStatPerQuery(NodeID, const PointsTo&) {}
131
+ virtual void printStat(std::string str = "") override;
162
132
 
163
- virtual void callgraphStat();
133
+ void callgraphStat() override;
164
134
  private:
165
135
  void bitcastInstStat();
166
136
  void branchStat();
@@ -0,0 +1,95 @@
1
+ //===- SVFStat.h -- Base class for statistics---------------------------------//
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
+ * SVFStat.h
25
+ *
26
+ * Created on: Sep 1, 2022
27
+ * Author: Xiao Cheng
28
+ */
29
+
30
+ #ifndef SVF_SVFSTAT_H
31
+ #define SVF_SVFSTAT_H
32
+
33
+ namespace SVF
34
+ {
35
+
36
+
37
+ /*!
38
+ * Pointer Analysis Statistics
39
+ */
40
+ class SVFStat
41
+ {
42
+ public:
43
+
44
+ typedef OrderedMap<const char *, u32_t> NUMStatMap;
45
+
46
+ typedef OrderedMap<const char *, double> TIMEStatMap;
47
+
48
+ enum ClockType
49
+ {
50
+ Wall,
51
+ CPU,
52
+ };
53
+
54
+ SVFStat();
55
+
56
+ virtual ~SVFStat() {}
57
+
58
+ virtual inline void startClk()
59
+ {
60
+ startTime = getClk(true);
61
+ }
62
+
63
+ virtual inline void endClk()
64
+ {
65
+ endTime = getClk(true);
66
+ }
67
+
68
+ /// When mark is true, real clock is always returned. When mark is false, it is
69
+ /// only returned when Options::MarkedClocksOnly is not set.
70
+ /// Default call for getClk is unmarked, while MarkedClocksOnly is false by default.
71
+ static double getClk(bool mark = false);
72
+
73
+ NUMStatMap generalNumMap;
74
+ TIMEStatMap timeStatMap;
75
+
76
+ double startTime;
77
+ double endTime;
78
+
79
+ virtual void performStat() = 0;
80
+
81
+ virtual void printStat(std::string str = "") = 0;
82
+
83
+ virtual void performStatPerQuery(NodeID) {}
84
+
85
+ virtual void printStatPerQuery(NodeID, const PointsTo &) {}
86
+
87
+ virtual void callgraphStat() {}
88
+
89
+ private:
90
+
91
+ std::string moduleName;
92
+ }; // End class SVFStat
93
+
94
+ } // End namespace SVF
95
+ #endif //SVF_SVFSTAT_H
@@ -104,7 +104,7 @@ class AndersenSFR : public AndersenSCD
104
104
  public:
105
105
  typedef Map<NodeID, NodeBS> NodeStrides;
106
106
  typedef Map<NodeID, NodeSet> FieldReps;
107
- typedef Map<NodeID, pair<NodeID, NodeSet>> SFRTrait;
107
+ typedef Map<NodeID, std::pair<NodeID, NodeSet>> SFRTrait;
108
108
 
109
109
  private:
110
110
  static AndersenSFR* sfrAndersen;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1213",
3
+ "version": "1.0.1216",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {