Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVFGStat.h
Go to the documentation of this file.
1//===- SVFGStat.h -- Statistics of SVFG---------------------------------------//
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 * @file: SVFGStat.h
25 * @author: yesen
26 * @date: 10/12/2013
27 * @version: 1.0
28 *
29 * @section LICENSE
30 *
31 * @section DESCRIPTION
32 *
33 */
34
35
36#ifndef SVFGSTAT_H_
37#define SVFGSTAT_H_
38
39#include "Graphs/SVFG.h"
40#include "SCC.h"
41#include "Util/PTAStat.h"
42
43namespace SVF
44{
45
46class MemSSA;
47
48class MemSSAStat : public PTAStat
49{
50
51public:
52 static const char* TotalTimeOfConstructMemSSA;
53 static const char* TimeOfGeneratingMemRegions;
54 static const char* TimeOfCreateMUCHI;
55 static const char* TimeOfInsertingPHI;
56 static const char* TimeOfSSARenaming;
57
58 static const char* NumOfMaxRegion;
59 static const char* NumOfAveragePtsInRegion;
60 static const char* NumOfMemRegions;
61 static const char* NumOfEntryChi;
62 static const char* NumOfRetMu;
63 static const char* NumOfCSChi;
64 static const char* NumOfCSMu;
65 static const char* NumOfLoadMu;
66 static const char* NumOfStoreChi;
67 static const char* NumOfMSSAPhi;
68
69 static const char* NumOfFunHasEntryChi;
70 static const char* NumOfFunHasRetMu;
71 static const char* NumOfCSHasChi;
72 static const char* NumOfCSHasMu;
73 static const char* NumOfLoadHasMu;
74 static const char* NumOfStoreHasChi;
75 static const char* NumOfBBHasMSSAPhi;
76
78
79 virtual ~MemSSAStat()
80 {
81
82 }
83 virtual void performStat() override;
84
85 virtual void printStat(std::string str = "") override;
86
87private:
89};
90
91
92class SVFGStat : public PTAStat
93{
94public:
98
99 SVFGStat(SVFG* g);
100
101 virtual ~SVFGStat() {}
102
103 virtual void performStat() override;
104
105 virtual void printStat(std::string str = "") override;
106
108
113
118
123
128
133
135 {
137 }
138
143
145 {
147 }
148
150 {
152 }
153
155 {
157 }
158
159private:
160 void clear();
161
162 void processGraph();
163
165
166 NodeID getSCCRep(SVFGSCC* scc, NodeID id) const;
167
168 NodeID nodeInCycle(SVFGSCC* scc, NodeID id) const;
169
171
173
178
183
189
192
198
203
205
210
215
218
221
224
227
230
235
236public:
237 inline void addToSources(const SVFGNode* node)
238 {
239 sources.insert(node);
240 }
241 inline void addToSinks(const SVFGNode* node)
242 {
243 sinks.insert(node);
244 }
245 inline void addToForwardSlice(const SVFGNode* node)
246 {
247 forwardSlice.insert(node);
248 }
249 inline void addToBackwardSlice(const SVFGNode* node)
250 {
251 backwardSlice.insert(node);
252 }
253 inline bool inForwardSlice(const SVFGNode* node) const
254 {
255 return forwardSlice.find(node)!=forwardSlice.end();
256 }
257 inline bool inBackwardSlice(const SVFGNode* node) const
258 {
259 return backwardSlice.find(node)!=backwardSlice.end();
260 }
261 inline bool isSource(const SVFGNode* node) const
262 {
263 return sources.find(node)!=sources.end();
264 }
265 inline bool isSink(const SVFGNode* node) const
266 {
267 return sinks.find(node)!=sinks.end();
268 }
269};
270
271} // End namespace SVF
272
273#endif /* SVFGSTAT_H_ */
static const char * TimeOfInsertingPHI
Time for inserting phis.
Definition SVFGStat.h:55
static const char * NumOfRetMu
Number of function return mu.
Definition SVFGStat.h:62
static const char * NumOfLoadMu
Number of load mu.
Definition SVFGStat.h:65
static const char * NumOfStoreHasChi
Number of stores which have chi.
Definition SVFGStat.h:74
static const char * TimeOfCreateMUCHI
Time for generating mu/chi for load/store/calls.
Definition SVFGStat.h:54
static const char * NumOfMSSAPhi
Number of mssa phi.
Definition SVFGStat.h:67
static const char * NumOfBBHasMSSAPhi
Number of basic blocks which have mssa phi.
Definition SVFGStat.h:75
static const char * NumOfAveragePtsInRegion
Number of average points-to set in region.
Definition SVFGStat.h:59
static const char * TimeOfGeneratingMemRegions
Time for allocating regions.
Definition SVFGStat.h:53
static const char * NumOfCSMu
Number of call site mu.
Definition SVFGStat.h:64
static const char * TotalTimeOfConstructMemSSA
Total time for constructing memory SSA.
Definition SVFGStat.h:52
virtual ~MemSSAStat()
Definition SVFGStat.h:79
static const char * NumOfStoreChi
Number of store chi.
Definition SVFGStat.h:66
static const char * TimeOfSSARenaming
Time for SSA rename.
Definition SVFGStat.h:56
virtual void performStat() override
Definition SVFGStat.cpp:74
static const char * NumOfCSChi
Number of call site chi.
Definition SVFGStat.h:63
static const char * NumOfMemRegions
Number of memory regions.
Definition SVFGStat.h:60
static const char * NumOfFunHasRetMu
Number of functions which have return mu.
Definition SVFGStat.h:70
MemSSA * mssa
Definition SVFGStat.h:88
static const char * NumOfMaxRegion
Number of max points-to set in region.
Definition SVFGStat.h:58
static const char * NumOfLoadHasMu
Number of loads which have mu.
Definition SVFGStat.h:73
virtual void printStat(std::string str="") override
Definition SVFGStat.cpp:128
static const char * NumOfEntryChi
Number of function entry chi.
Definition SVFGStat.h:61
static const char * NumOfCSHasChi
Number of call sites which have chi.
Definition SVFGStat.h:71
static const char * NumOfFunHasEntryChi
Number of functions which have entry chi.
Definition SVFGStat.h:69
static const char * NumOfCSHasMu
Number of call sites which have mu.
Definition SVFGStat.h:72
virtual void performStat() override
Definition SVFGStat.cpp:178
int numOfActualParam
Definition SVFGStat.h:181
int totalIndEdgeLabels
Total number of l –o--> lp.
Definition SVFGStat.h:197
double connectDirSVFGEdgeTimeStart
Definition SVFGStat.h:222
int totalIndCallEdge
Definition SVFGStat.h:199
int numOfActualOut
number of actual out svfg nodes.
Definition SVFGStat.h:180
int avgOutDegree
average out degrees of SVFG nodes.
Definition SVFGStat.h:207
SCCDetection< SVFG * > SVFGSCC
Definition SVFGStat.h:97
void dirVFEdgeStart()
Definition SVFGStat.h:109
void TLVFNodeEnd()
Definition SVFGStat.h:134
int totalOutEdge
Total number of outgoing SVFG edges.
Definition SVFGStat.h:194
SVFGNodeSet sources
Definition SVFGStat.h:233
SVFGNodeSet forwardSlice
Definition SVFGStat.h:231
double svfgOptTimeStart
Definition SVFGStat.h:228
int totalDirCallEdge
Definition SVFGStat.h:201
int numOfFormalParam
Definition SVFGStat.h:176
SVFGNodeSet backwardSlice
Definition SVFGStat.h:232
int numOfFormalRet
Definition SVFGStat.h:177
double connectIndSVFGEdgeTimeStart
Definition SVFGStat.h:225
virtual void printStat(std::string str="") override
Definition SVFGStat.cpp:499
void TLVFNodeStart()
Definition SVFGStat.h:129
u32_t maxIndInDegree
max indirect in degrees of SVFG nodes.
Definition SVFGStat.h:213
double addAddrTakenNodeTimeEnd
Definition SVFGStat.h:220
double connectIndSVFGEdgeTimeEnd
Definition SVFGStat.h:226
SVFGNodeSet sinks
Definition SVFGStat.h:234
int avgIndInDegree
average indirect in degrees of SVFG nodes.
Definition SVFGStat.h:211
void processGraph()
Definition SVFGStat.cpp:244
SVFG * graph
Definition SVFGStat.h:170
NodeID nodeInCycle(SVFGSCC *scc, NodeID id) const
Definition SVFGStat.cpp:173
int avgInDegree
average in degrees of SVFG nodes.
Definition SVFGStat.h:206
void ATVFNodeStart()
Definition SVFGStat.h:139
int numOfStore
number of store svfg nodes.
Definition SVFGStat.h:185
int numOfActualIn
number of actual in svfg nodes.
Definition SVFGStat.h:179
u32_t maxInDegree
max in degrees of SVFG nodes.
Definition SVFGStat.h:208
void addToBackwardSlice(const SVFGNode *node)
Definition SVFGStat.h:249
void calculateNodeDegrees(SVFGNode *node, NodeSet &nodeHasIndInEdge, NodeSet &nodeHasIndOutEdge)
Definition SVFGStat.cpp:302
void addToSources(const SVFGNode *node)
Definition SVFGStat.h:237
int avgWeight
average weight.
Definition SVFGStat.h:204
int totalDirRetEdge
Definition SVFGStat.h:202
u32_t maxOutDegree
max out degrees of SVFG nodes.
Definition SVFGStat.h:209
bool inBackwardSlice(const SVFGNode *node) const
Definition SVFGStat.h:257
bool isSource(const SVFGNode *node) const
Definition SVFGStat.h:261
int avgIndOutDegree
average indirect out degrees of SVFG nodes.
Definition SVFGStat.h:212
int totalInEdge
Total number of incoming SVFG edges.
Definition SVFGStat.h:193
int numOfLoad
number of load svfg nodes.
Definition SVFGStat.h:184
virtual void performSCCStat(SVFGEdgeSet insensitiveCalRetEdges)
Definition SVFGStat.cpp:369
double addTopLevelNodeTimeEnd
Definition SVFGStat.h:217
void indVFEdgeEnd()
Definition SVFGStat.h:124
int totalIndInEdge
Total number of indirect SVFG edges.
Definition SVFGStat.h:195
NodeID getSCCRep(SVFGSCC *scc, NodeID id) const
Definition SVFGStat.cpp:169
int totalIndOutEdge
Definition SVFGStat.h:196
int numOfMSSAPhi
number of mssa phi svfg nodes.
Definition SVFGStat.h:190
double addAddrTakenNodeTimeStart
Definition SVFGStat.h:219
void ATVFNodeEnd()
Definition SVFGStat.h:144
void sfvgOptEnd()
Definition SVFGStat.h:154
int numOfFormalOut
number of formal out svfg nodes.
Definition SVFGStat.h:175
int numOfNodes
number of svfg nodes.
Definition SVFGStat.h:172
int numOfFormalIn
number of formal in svfg nodes.
Definition SVFGStat.h:174
void dirVFEdgeEnd()
Definition SVFGStat.h:114
double svfgOptTimeEnd
Definition SVFGStat.h:229
double connectDirSVFGEdgeTimeEnd
Definition SVFGStat.h:223
u32_t maxIndOutDegree
max indirect out degrees of SVFG nodes.
Definition SVFGStat.h:214
void sfvgOptStart()
Definition SVFGStat.h:149
int numOfActualRet
Definition SVFGStat.h:182
virtual ~SVFGStat()
Definition SVFGStat.h:101
double addTopLevelNodeTimeStart
Definition SVFGStat.h:216
bool inForwardSlice(const SVFGNode *node) const
Definition SVFGStat.h:253
void indVFEdgeStart()
Definition SVFGStat.h:119
void addToSinks(const SVFGNode *node)
Definition SVFGStat.h:241
bool isSink(const SVFGNode *node) const
Definition SVFGStat.h:265
Set< const SVFGNode * > SVFGNodeSet
Definition SVFGStat.h:95
void addToForwardSlice(const SVFGNode *node)
Definition SVFGStat.h:245
int totalIndRetEdge
Definition SVFGStat.h:200
OrderedSet< const SVFGEdge * > SVFGEdgeSet
Definition SVFGStat.h:96
static double getClk(bool mark=false)
Definition SVFStat.cpp:48
for isBitcode
Definition BasicTypes.h:68
Set< NodeID > NodeSet
u32_t NodeID
Definition GeneralType.h:55
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74
unsigned u32_t
Definition GeneralType.h:46