svf-lib 1.0.1178 → 1.0.1179
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.
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/CFL/CFGNormalizer.h +3 -3
- package/SVF-osx/include/CFL/CFLAlias.h +5 -1
- package/SVF-osx/include/CFL/CFLGraphBuilder.h +11 -1
- package/SVF-osx/include/CFL/PEGGrammar.txt +28 -0
- package/SVF-osx/include/DDA/DDAStat.h +1 -1
- package/SVF-osx/include/Graphs/ICFGStat.h +1 -1
- package/SVF-osx/include/Graphs/SVFGStat.h +1 -1
- package/SVF-osx/include/MTA/MTAStat.h +1 -1
- package/SVF-osx/include/SVF-FE/LLVMUtil.h +2 -2
- package/SVF-osx/include/Util/ExtAPI.h +2 -2
- package/SVF-osx/include/Util/Options.h +3 -1
- package/SVF-osx/include/Util/PTAStat.h +174 -0
- package/SVF-osx/include/WPA/Andersen.h +3 -3
- package/SVF-osx/include/WPA/WPAStat.h +1 -1
- package/package.json +1 -1
|
Binary file
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
* Author: Pei Xu
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
#ifndef
|
|
31
|
-
#define
|
|
30
|
+
#ifndef INCLUDE_CFL_CFGNORMALIZER_H_
|
|
31
|
+
#define INCLUDE_CFL_CFGNORMALIZER_H_
|
|
32
32
|
|
|
33
33
|
#include "CFLGrammar.h"
|
|
34
34
|
|
|
@@ -79,4 +79,4 @@ private:
|
|
|
79
79
|
|
|
80
80
|
} // End namespace SVF
|
|
81
81
|
|
|
82
|
-
#endif /*
|
|
82
|
+
#endif /* INCLUDE_CFL_CFGNORMALIZER_H_*/
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
* Author: Yulei Sui
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
+
#ifndef INCLUDE_CFL_CFLALIAS_H_
|
|
31
|
+
#define INCLUDE_CFL_CFLALIAS_H_
|
|
30
32
|
|
|
31
33
|
#include "CFL/CFLSolver.h"
|
|
32
34
|
#include "CFL/CFGNormalizer.h"
|
|
@@ -144,4 +146,6 @@ private:
|
|
|
144
146
|
CFLSolver *solver;
|
|
145
147
|
};
|
|
146
148
|
|
|
147
|
-
}
|
|
149
|
+
} // End namespace SVF
|
|
150
|
+
|
|
151
|
+
#endif /* INCLUDE_CFL_CFLALIAS_H_*/
|
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
* Author: Pei Xu
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
+
#ifndef INCLUDE_CFL_CFLGRAPHBUILDER_H_
|
|
31
|
+
#define INCLUDE_CFL_CFLGRAPHBUILDER_H_
|
|
32
|
+
|
|
30
33
|
#include "CFL/CFLGrammar.h"
|
|
31
34
|
#include "Graphs/CFLGraph.h"
|
|
32
35
|
namespace SVF
|
|
@@ -118,6 +121,7 @@ public:
|
|
|
118
121
|
}
|
|
119
122
|
return cflGraph;
|
|
120
123
|
}
|
|
124
|
+
|
|
121
125
|
/// Build graph from file
|
|
122
126
|
void build(std::string filename, CFLGraph* cflGraph);
|
|
123
127
|
|
|
@@ -138,6 +142,8 @@ public:
|
|
|
138
142
|
{
|
|
139
143
|
return this->kind2AttrsMap;
|
|
140
144
|
}
|
|
145
|
+
|
|
146
|
+
|
|
141
147
|
};
|
|
142
148
|
|
|
143
149
|
class AliasCFLGraphBuilder : public CFLGraphBuilder
|
|
@@ -145,8 +151,12 @@ class AliasCFLGraphBuilder : public CFLGraphBuilder
|
|
|
145
151
|
public:
|
|
146
152
|
/// Build Bidirectional graph by copying nodes and edges from const graph inherited from GenericGraph
|
|
147
153
|
CFLGraph* buildBigraph(ConstraintGraph *graph, Kind startKind, GrammarBase *grammar);
|
|
154
|
+
|
|
155
|
+
/// Build Bidirectional graph by copying nodes and edges from any graph inherited from GenericGraph
|
|
156
|
+
/// And transfer Load Store to copy edge and address edge to construct PEG style CFG
|
|
157
|
+
CFLGraph* buildBiPEGgraph(ConstraintGraph *graph, Kind startKind, GrammarBase *grammar, SVFIR* pag);
|
|
148
158
|
};
|
|
149
159
|
|
|
150
160
|
}// SVF
|
|
151
161
|
|
|
152
|
-
|
|
162
|
+
#endif /* INCLUDE_CFL_CFLGRAPHBUILDER_H_*/
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Start:
|
|
2
|
+
V
|
|
3
|
+
Terminal:
|
|
4
|
+
Addr Copy Store Load Gep Vgep
|
|
5
|
+
Productions:
|
|
6
|
+
F -> epsilon;
|
|
7
|
+
M -> Addr V Addrbar;
|
|
8
|
+
V -> Fbar V F;
|
|
9
|
+
V -> Gepbar_i V Gep_i;
|
|
10
|
+
V -> M;
|
|
11
|
+
V -> epsilon;
|
|
12
|
+
F -> F Copy;
|
|
13
|
+
F -> F Copy M;
|
|
14
|
+
Fbar -> epsilon;
|
|
15
|
+
Fbar -> Copybar Fbar;
|
|
16
|
+
Fbar -> M Copybar Fbar;
|
|
17
|
+
Gep_1 -> Gep_0 F Vgep;
|
|
18
|
+
Gepbar_1 -> Vgepbar Fbar Gepbar_0;
|
|
19
|
+
Gepbarpath -> Gepbar_0 Gepbar_0;
|
|
20
|
+
Gepbarpath -> Gepbarpath Gepbar_0;
|
|
21
|
+
Gep_3 -> Gep_0;
|
|
22
|
+
Gepbar_3 -> Gepbar_0;
|
|
23
|
+
Memcpy -> Addrbar V Addr;
|
|
24
|
+
Memcpy -> Gep_i Memcpy Gepbar_i;
|
|
25
|
+
Memcpy -> F Memcpy Fbar;
|
|
26
|
+
V -> Gepbar_i Memcpy Gep_i;
|
|
27
|
+
V -> Gep_i Memcpy Gepbar_i;
|
|
28
|
+
V -> Gepbarpath V Gep_0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//===-
|
|
1
|
+
//===- LLVMUtil.h -- Analysis helper functions----------------------------//
|
|
2
2
|
//
|
|
3
3
|
// SVF: Static Value-Flow Analysis
|
|
4
4
|
//
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
//===----------------------------------------------------------------------===//
|
|
22
22
|
|
|
23
23
|
/*
|
|
24
|
-
*
|
|
24
|
+
* LLVMUtil.h
|
|
25
25
|
*
|
|
26
26
|
* Created on: Apr 11, 2013
|
|
27
27
|
* Author: Yulei Sui
|
|
@@ -63,14 +63,14 @@ overwrite_app_function = 1: Use specifications in ExtAPI.json to overwrite the u
|
|
|
63
63
|
Function type represents the properties of the function.
|
|
64
64
|
For example,
|
|
65
65
|
"EFT_ALLOC" represents if this external function allocates a new object and assigns it to one of its arguments,
|
|
66
|
-
For the selection of function type and a more detailed explanation, please refer to the definition of enum *
|
|
66
|
+
For the selection of function type and a more detailed explanation, please refer to the definition of enum *extType* in ExtAPI.h.
|
|
67
67
|
|
|
68
68
|
*** [4] Function operations
|
|
69
69
|
Function operations indicate the relationships between input and output,
|
|
70
70
|
mainly between function parameters or between parameters and return values after the execution.
|
|
71
71
|
For example,
|
|
72
72
|
"copy": ["A2", "L"] indicates that after this external function is executed, the value of the 2nd parameter is copied into the return value.
|
|
73
|
-
For the selection of function type and a more detailed explanation, please refer to the definition of enum *
|
|
73
|
+
For the selection of function type and a more detailed explanation, please refer to the definition of enum *extf_t* in ExtAPI.h.
|
|
74
74
|
|
|
75
75
|
For operands of function operation, e.g., "A2", "L", there are the following options:
|
|
76
76
|
"A": represents a parameter;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
#include <sstream>
|
|
7
7
|
#include "FastCluster/fastcluster.h"
|
|
8
|
-
#include "
|
|
8
|
+
#include "Util/PTAStat.h"
|
|
9
9
|
#include "MemoryModel/PointerAnalysisImpl.h"
|
|
10
10
|
#include "Util/NodeIDAllocator.h"
|
|
11
11
|
#include "MSSA/MemSSA.h"
|
|
@@ -253,6 +253,8 @@ public:
|
|
|
253
253
|
static const llvm::cl::opt<std::string> CFLGraph;
|
|
254
254
|
static const llvm::cl::opt<bool> PrintCFL;
|
|
255
255
|
static const llvm::cl::opt<bool> FlexSymMap;
|
|
256
|
+
static const llvm::cl::opt<bool> PEGTransfer;
|
|
257
|
+
static const llvm::cl::opt<bool> NullDummyNode;
|
|
256
258
|
|
|
257
259
|
// Loop Analysis
|
|
258
260
|
static const llvm::cl::opt<bool> LoopAnalysis;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
//===- PTAStat.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
|
+
* AndersenStat.h
|
|
25
|
+
*
|
|
26
|
+
* Created on: Oct 12, 2013
|
|
27
|
+
* Author: Yulei Sui
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef ANDERSENSTAT_H_
|
|
31
|
+
#define ANDERSENSTAT_H_
|
|
32
|
+
|
|
33
|
+
#include "Util/BasicTypes.h"
|
|
34
|
+
#include "MemoryModel/PointsTo.h"
|
|
35
|
+
#include <iostream>
|
|
36
|
+
#include <map>
|
|
37
|
+
#include <string>
|
|
38
|
+
|
|
39
|
+
using namespace std;
|
|
40
|
+
|
|
41
|
+
namespace SVF
|
|
42
|
+
{
|
|
43
|
+
|
|
44
|
+
class PointerAnalysis;
|
|
45
|
+
|
|
46
|
+
/*!
|
|
47
|
+
* Pointer Analysis Statistics
|
|
48
|
+
*/
|
|
49
|
+
class PTAStat
|
|
50
|
+
{
|
|
51
|
+
public:
|
|
52
|
+
static const char* TotalAnalysisTime; ///< Total analysis time
|
|
53
|
+
static const char* SCCDetectionTime; ///< Total SCC detection time
|
|
54
|
+
static const char* SCCMergeTime; ///< Total SCC merge time
|
|
55
|
+
|
|
56
|
+
static const char* ProcessLoadStoreTime;///< time of processing loads and stores
|
|
57
|
+
static const char* ProcessCopyGepTime; ///< time of processing copys and geps
|
|
58
|
+
static const char* UpdateCallGraphTime; ///< time of updating call graph
|
|
59
|
+
|
|
60
|
+
static const char* TotalNumOfPointers; ///< Total SVFIR value node
|
|
61
|
+
static const char* TotalNumOfObjects; ///< Total SVFIR object node
|
|
62
|
+
static const char* TotalNumOfFieldObjects; ///< Total SVFIR field object node
|
|
63
|
+
static const char* MaxStructSize; ///< Max struct size
|
|
64
|
+
static const char* TotalNumOfEdges; ///< Total SVFIR edge number
|
|
65
|
+
|
|
66
|
+
static const char* NumOfAddrs; ///< SVFIR addr edge
|
|
67
|
+
static const char* NumOfLoads; ///< SVFIR load edge
|
|
68
|
+
static const char* NumOfStores; ///< SVFIR store edge
|
|
69
|
+
static const char* NumOfCopys; ///< SVFIR copy edge
|
|
70
|
+
static const char* NumOfGeps; ///< SVFIR gep edge
|
|
71
|
+
static const char* NumOfCalls; ///< SVFIR call edge
|
|
72
|
+
static const char* NumOfReturns; ///< SVFIR return edge
|
|
73
|
+
|
|
74
|
+
static const char* NumOfProcessedAddrs; ///< SVFIR processed addr edge
|
|
75
|
+
static const char* NumOfProcessedLoads; ///< SVFIR processed load edge
|
|
76
|
+
static const char* NumOfProcessedStores; ///< SVFIR processed store edge
|
|
77
|
+
static const char* NumOfProcessedCopys; ///< SVFIR processed copy edge
|
|
78
|
+
static const char* NumOfProcessedGeps; ///< SVFIR processed gep edge
|
|
79
|
+
|
|
80
|
+
static const char* NumOfSfr; ///< num of field representatives
|
|
81
|
+
static const char* NumOfFieldExpand;
|
|
82
|
+
|
|
83
|
+
static const char* NumOfFunctionObjs; ///< Function numbers
|
|
84
|
+
static const char* NumOfGlobalObjs; ///< SVFIR global object node
|
|
85
|
+
static const char* NumOfHeapObjs; ///< SVFIR heap object node
|
|
86
|
+
static const char* NumOfStackObjs; ///< SVFIR stack object node
|
|
87
|
+
|
|
88
|
+
static const char* NumOfObjsHasVarStruct; ///< SVFIR object node has var struct (maybe nested with array)
|
|
89
|
+
static const char* NumOfObjsHasVarArray; ///< SVFIR object node has var array (maybe nested with struct)
|
|
90
|
+
static const char* NumOfObjsHasConstStruct; ///< SVFIR object node has const struct (maybe nested with array)
|
|
91
|
+
static const char* NumOfObjsHasConstArray; ///< SVFIR object node has const array (maybe nested with struct)
|
|
92
|
+
static const char* NumOfNonPtrObjs; ///< SVFIR object node which is non pointer type object (do not have pts)
|
|
93
|
+
static const char* NumOfConstantObjs; ///< SVFIR object node which is purely constant
|
|
94
|
+
|
|
95
|
+
static const char* NumberOfFieldInsensitiveObj;
|
|
96
|
+
static const char* NumberOfFieldSensitiveObj;
|
|
97
|
+
|
|
98
|
+
static const char* NumOfPointers; ///< SVFIR value node, each of them maps to a llvm value
|
|
99
|
+
static const char* NumOfGepFieldPointers; ///< SVFIR gep value node (field value, dynamically created dummy node)
|
|
100
|
+
|
|
101
|
+
static const char* NumOfMemObjects; ///< SVFIR object node, each of them maps to a llvm value
|
|
102
|
+
static const char* NumOfGepFieldObjects; ///< SVFIR gep object node (field obj, dynamically created dummy node)
|
|
103
|
+
|
|
104
|
+
static const char* AveragePointsToSetSize; ///< Average points-to size of all variables
|
|
105
|
+
static const char* AverageTopLevPointsToSetSize; ///< Average points-to size of top-level variables
|
|
106
|
+
static const char* MaxPointsToSetSize; ///< Max points-to size
|
|
107
|
+
|
|
108
|
+
static const char* NumOfIterations; ///< Number of iterations during resolution
|
|
109
|
+
|
|
110
|
+
static const char* NumOfIndirectCallSites; ///< Number of indirect callsites
|
|
111
|
+
static const char* NumOfIndirectEdgeSolved; ///< Number of indirect calledge resolved
|
|
112
|
+
|
|
113
|
+
static const char* NumOfSCCDetection; ///< Number of scc detection performed
|
|
114
|
+
static const char* NumOfCycles; ///< Number of scc cycles detected
|
|
115
|
+
static const char* NumOfPWCCycles; ///< Number of scc cycles detected
|
|
116
|
+
static const char* NumOfNodesInCycles; ///< Number of nodes in cycles detected
|
|
117
|
+
static const char* MaxNumOfNodesInSCC; ///< max Number of nodes in one scc
|
|
118
|
+
|
|
119
|
+
static const char* NumOfNullPointer; ///< Number of pointers points-to null
|
|
120
|
+
|
|
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
|
+
PTAStat(PointerAnalysis* p);
|
|
132
|
+
virtual ~PTAStat() {}
|
|
133
|
+
|
|
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
|
+
NUMStatMap PTNumStatMap;
|
|
149
|
+
TIMEStatMap timeStatMap;
|
|
150
|
+
NodeBS localVarInRecursion;
|
|
151
|
+
|
|
152
|
+
double startTime;
|
|
153
|
+
double endTime;
|
|
154
|
+
|
|
155
|
+
virtual void performStat();
|
|
156
|
+
|
|
157
|
+
virtual void printStat(string str = "");
|
|
158
|
+
|
|
159
|
+
virtual void performStatPerQuery(NodeID) {}
|
|
160
|
+
|
|
161
|
+
virtual void printStatPerQuery(NodeID, const PointsTo&) {}
|
|
162
|
+
|
|
163
|
+
virtual void callgraphStat();
|
|
164
|
+
private:
|
|
165
|
+
void bitcastInstStat();
|
|
166
|
+
void branchStat();
|
|
167
|
+
|
|
168
|
+
PointerAnalysis* pta;
|
|
169
|
+
std::string moduleName;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
} // End namespace SVF
|
|
173
|
+
|
|
174
|
+
#endif /* ANDERSENSTAT_H_ */
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
* Author: Yulei Sui
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
#ifndef
|
|
31
|
-
#define
|
|
30
|
+
#ifndef INCLUDE_WPA_ANDERSEN_H_
|
|
31
|
+
#define INCLUDE_WPA_ANDERSEN_H_
|
|
32
32
|
|
|
33
33
|
#include "MemoryModel/PointerAnalysisImpl.h"
|
|
34
34
|
#include "WPA/WPAStat.h"
|
|
@@ -433,4 +433,4 @@ public:
|
|
|
433
433
|
|
|
434
434
|
} // End namespace SVF
|
|
435
435
|
|
|
436
|
-
#endif /*
|
|
436
|
+
#endif /* INCLUDE_WPA_ANDERSEN_H_ */
|