Static Value-Flow Analysis
WPAStat.h
Go to the documentation of this file.
1 //===- WPAStat.h -- WPA 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 Affero General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU Affero General Public License for more details.
17 
18 // You should have received a copy of the GNU Affero General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 //
21 //===----------------------------------------------------------------------===//
22 
23 
24 /*
25  * FlowSensitiveStat.h
26  *
27  * Created on: 27/11/2013
28  * Author: yesen
29  */
30 
31 #ifndef FLOWSENSITIVESTAT_H_
32 #define FLOWSENSITIVESTAT_H_
33 
34 #include "Util/PTAStat.h"
35 #include "WPA/FlowSensitive.h"
37 
38 namespace SVF
39 {
40 
41 class AndersenBase;
42 class SVFIR;
43 class ConstraintGraph;
44 
48 class AndersenStat : public PTAStat
49 {
50 
51 private:
53 
54 public:
55  static const char* CollapseTime;
56 
65 
67 
68  virtual ~AndersenStat()
69  {
70 
71  }
72 
73  virtual void performStat();
74 
75  void collectCycleInfo(ConstraintGraph* consCG);
76 
77  void statNullPtr();
78 
79  void constraintGraphStat();
80 };
81 
85 class FlowSensitiveStat : public PTAStat
86 {
87 public:
90 
92 
94  {
95  fspta = pta;
96  clearStat();
97  startClk();
98  }
99 
100  virtual ~FlowSensitiveStat() {}
101 
102  virtual void performStat();
103 
104 private:
106  {
107  IN,
108  OUT
109  };
110 
111  void clearStat();
112 
113  void statNullPtr();
114 
115  void statPtsSize();
116 
117  void statAddrVarPtsSize();
118 
119  void calculateAddrVarPts(NodeID pointer, const SVFGNode* node);
120 
121  void statInOutPtsSize(const DFInOutMap& data, ENUM_INOUT inOrOut);
122 
126 
136 
148 
153 
155 
156  double _AvgPtsSize;
158  double _AvgInOutPtsSize[2];
160 
163 };
164 
166 {
167 public:
169 
171  {
172  vfspta = pta;
173  clearStat();
174  startClk();
175  }
176 
178 
179  virtual void performStat();
180 
181 private:
182  void clearStat();
183 
185  void versionStat(void);
186 
188  void ptsSizeStat(void);
189 
202 
209 
212 
214  double _AvgPtsSize;
219 };
220 } // End namespace SVF
221 
222 #endif /* FLOWSENSITIVESTAT_H_ */
cJSON * p
Definition: cJSON.cpp:2559
AndersenStat(AndersenBase *p)
u32_t _NumOfBlackholePtr
Definition: WPAStat.h:64
virtual ~AndersenStat()
Definition: WPAStat.h:68
u32_t _NumOfNullPtr
Definition: WPAStat.h:62
static const char * CollapseTime
Definition: WPAStat.h:55
virtual void performStat()
static u32_t _NumOfCycles
Definition: WPAStat.h:58
static u32_t _MaxPtsSize
Definition: WPAStat.h:57
AndersenBase * pta
Definition: WPAStat.h:52
static u32_t _NumOfNodesInCycles
Definition: WPAStat.h:60
u32_t _NumOfConstantPtr
Definition: WPAStat.h:63
static u32_t _MaxNumOfNodesInSCC
Definition: WPAStat.h:61
void collectCycleInfo(ConstraintGraph *consCG)
static u32_t _NumOfPWCCycles
Definition: WPAStat.h:59
void calculateAddrVarPts(NodeID pointer, const SVFGNode *node)
u32_t _NumOfActualInSVFGNodesHaveInOut[2]
Definition: WPAStat.h:131
double _AvgPtsSize
average points-to set size.
Definition: WPAStat.h:156
double _AvgAddrTakenVarPtsSize
average points-to set size of addr-taken variables.
Definition: WPAStat.h:159
u32_t _PotentialNumOfVarHaveINOUTPts[2]
Definition: WPAStat.h:147
u32_t _NumOfVarHaveINOUTPtsInFormalOut[2]
Definition: WPAStat.h:141
FlowSensitive::PtsMap PtsMap
Definition: WPAStat.h:89
u32_t _NumOfFormalOutSVFGNodesHaveInOut[2]
Definition: WPAStat.h:130
u32_t _NumOfVarHaveEmptyINOUTPts[2]
Definition: WPAStat.h:139
u32_t _NumOfVarHaveINOUTPtsInStore[2]
Definition: WPAStat.h:145
FlowSensitiveStat(FlowSensitive *pta)
Definition: WPAStat.h:93
u32_t _NumOfFormalInSVFGNodesHaveInOut[2]
Definition: WPAStat.h:129
virtual ~FlowSensitiveStat()
Definition: WPAStat.h:100
double _AvgTopLvlPtsSize
average points-to set size in top-level pointers.
Definition: WPAStat.h:157
u32_t _NumOfActualOutSVFGNodesHaveInOut[2]
Definition: WPAStat.h:132
u32_t _NumOfVarHaveINOUTPtsInActualIn[2]
Definition: WPAStat.h:142
FlowSensitive::DFInOutMap DFInOutMap
Definition: WPAStat.h:88
u32_t _NumOfMSSAPhiSVFGNodesHaveInOut[2]
Definition: WPAStat.h:135
u32_t _MaxPtsSize
sizes of points-to set
Definition: WPAStat.h:150
u32_t _MaxAddrTakenVarPts
max points-to set size of addr-taken variables.
Definition: WPAStat.h:161
void statInOutPtsSize(const DFInOutMap &data, ENUM_INOUT inOrOut)
u32_t _TotalPtsSize
total points-to set size.
Definition: WPAStat.h:154
u32_t _NumOfVarHaveINOUTPtsInMSSAPhi[2]
Definition: WPAStat.h:146
u32_t _NumOfSVFGNodesHaveInOut[2]
number of SVFG nodes which have IN/OUT set.
Definition: WPAStat.h:128
u32_t _NumOfVarHaveINOUTPtsInLoad[2]
Definition: WPAStat.h:144
u32_t _MaxInOutPtsSize[2]
max points-to set size in IN/OUT set.
Definition: WPAStat.h:152
u32_t _NumOfVarHaveINOUTPts[2]
number of pag nodes which have points-to set in IN/OUT set.
Definition: WPAStat.h:138
u32_t _NumOfLoadSVFGNodesHaveInOut[2]
Definition: WPAStat.h:133
u32_t _NumOfVarHaveINOUTPtsInActualOut[2]
Definition: WPAStat.h:143
u32_t _NumOfVarHaveINOUTPtsInFormalIn[2]
Definition: WPAStat.h:140
u32_t _NumOfStoreSVFGNodesHaveInOut[2]
Definition: WPAStat.h:134
u32_t _NumOfAddrTakeVar
number of occurrences of addr-taken variables in load/store.
Definition: WPAStat.h:162
u32_t _MaxTopLvlPtsSize
max points-to set size in top-level pointers.
Definition: WPAStat.h:151
double _AvgInOutPtsSize[2]
average points-to set size in IN set.
Definition: WPAStat.h:158
FlowSensitive * fspta
Definition: WPAStat.h:91
BVDataPTAImpl::MutDFPTDataTy::PtsMap PtsMap
Definition: FlowSensitive.h:58
BVDataPTAImpl::MutDFPTDataTy::DFPtsMap DFInOutMap
Definition: FlowSensitive.h:57
PointerAnalysis * pta
Definition: PTAStat.h:74
virtual void startClk()
Definition: SVFStat.h:58
VersionedFlowSensitive * vfspta
Definition: WPAStat.h:168
double _AvgVersionPtsSize
Average points-to set size for address-taken objects.
Definition: WPAStat.h:218
u32_t _NumSingleVersion
Number of objects which have a single version.
Definition: WPAStat.h:201
virtual ~VersionedFlowSensitiveStat()
Definition: WPAStat.h:177
u32_t _NumEmptyVersions
Number of versions with empty points-to sets (actually empty, not never-accessed).
Definition: WPAStat.h:199
u32_t _NumNonEmptyVersions
Number of versions with non-empty points-to sets (since versioning is over-approximate).
Definition: WPAStat.h:197
u32_t _TotalPtsSize
Total of points-to set sizes for calculating averages.
Definition: WPAStat.h:211
double _AvgPtsSize
Average size across all points-to sets.
Definition: WPAStat.h:214
VersionedFlowSensitiveStat(VersionedFlowSensitive *pta)
Definition: WPAStat.h:170
u32_t _NumVersions
Total number of versions across all objects.
Definition: WPAStat.h:191
double _AvgTopLvlPtsSize
Average points-to set size for top-level pointers.
Definition: WPAStat.h:216
u32_t _MaxVersionPtsSize
Max address-taken points-to set size.
Definition: WPAStat.h:208
u32_t _MaxPtsSize
Largest PTS size.
Definition: WPAStat.h:204
u32_t _MaxVersions
Most versions for a single object.
Definition: WPAStat.h:193
u32_t _MaxTopLvlPtsSize
Max points-to set size in top-level pointers.
Definition: WPAStat.h:206
u32_t _NumUsedVersions
Number of version PTSs actually used (sum of next two fields).
Definition: WPAStat.h:195
void ptsSizeStat(void)
For all PTS size related statistics not handled by versionStat.
void versionStat(void)
For all version-related statistics.
for isBitcode
Definition: BasicTypes.h:68
u32_t NodeID
Definition: GeneralType.h:55
unsigned u32_t
Definition: GeneralType.h:46