svf-tools 1.0.976 → 1.0.978
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/package.json +1 -1
- package/svf/include/Graphs/ThreadCallGraph.h +0 -6
- package/svf/include/MTA/LockAnalysis.h +41 -31
- package/svf/include/MTA/MHP.h +34 -54
- package/svf/include/MTA/MTAStat.h +1 -2
- package/svf/include/MTA/TCT.h +36 -18
- package/svf/include/Util/CxtStmt.h +13 -12
- package/svf/include/Util/Options.h +1 -20
- package/svf/include/Util/SVFUtil.h +8 -43
- package/svf/include/Util/ThreadAPI.h +42 -85
- package/svf/lib/Graphs/ThreadCallGraph.cpp +1 -73
- package/svf/lib/MTA/LockAnalysis.cpp +83 -75
- package/svf/lib/MTA/MHP.cpp +142 -121
- package/svf/lib/MTA/MTA.cpp +2 -40
- package/svf/lib/MTA/MTAStat.cpp +7 -33
- package/svf/lib/MTA/TCT.cpp +30 -30
- package/svf/lib/Util/CallGraphBuilder.cpp +0 -15
- package/svf/lib/Util/Options.cpp +0 -62
- package/svf/lib/Util/ThreadAPI.cpp +27 -6
- package/svf-llvm/lib/SVFIRExtAPI.cpp +0 -26
- package/svf-llvm/tools/MTA/CMakeLists.txt +1 -1
- package/svf-llvm/tools/MTA/mta.cpp +0 -8
- package/svf/include/MTA/FSMPTA.h +0 -270
- package/svf/include/MTA/MTAResultValidator.h +0 -448
- package/svf/include/MTA/PCG.h +0 -229
- package/svf/lib/MTA/FSMPTA.cpp +0 -792
- package/svf/lib/MTA/PCG.cpp +0 -364
- package/svf-llvm/tools/MTA/LockResultValidator.cpp +0 -251
- package/svf-llvm/tools/MTA/LockResultValidator.h +0 -84
- package/svf-llvm/tools/MTA/MTAAnnotator.cpp +0 -293
- package/svf-llvm/tools/MTA/MTAAnnotator.h +0 -120
- package/svf-llvm/tools/MTA/MTAResultValidator.cpp +0 -716
- package/svf-llvm/tools/MTA/MTAResultValidator.h +0 -337
package/svf/include/MTA/PCG.h
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
//===- PCG.h -- Procedure creation graph-------------//
|
|
2
|
-
//
|
|
3
|
-
// SVF: Static Value-Flow Analysis
|
|
4
|
-
//
|
|
5
|
-
// Copyright (C) <2013-> <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
|
-
* MHP.h
|
|
25
|
-
*
|
|
26
|
-
* Created on: Jan 21, 2014
|
|
27
|
-
* Author: Yulei Sui, Peng Di
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
#ifndef PCG_H_
|
|
31
|
-
#define PCG_H_
|
|
32
|
-
|
|
33
|
-
#include "Util/ThreadAPI.h"
|
|
34
|
-
#include "Graphs/CallGraph.h"
|
|
35
|
-
#include "Util/WorkList.h"
|
|
36
|
-
#include "WPA/Andersen.h"
|
|
37
|
-
#include <set>
|
|
38
|
-
#include <vector>
|
|
39
|
-
|
|
40
|
-
#include "MHP.h"
|
|
41
|
-
|
|
42
|
-
namespace SVF
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
/*!
|
|
46
|
-
* This class serves as a base may-happen in parallel analysis for multithreaded program
|
|
47
|
-
* It distinguish thread spawner, spawnee, follower in procedure level by
|
|
48
|
-
* modeling pthread_create, pthread_join, pthread_exit, pthread_cancel synchronization operations
|
|
49
|
-
*/
|
|
50
|
-
class PCG
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
public:
|
|
54
|
-
typedef Set<const SVFFunction*> FunSet;
|
|
55
|
-
typedef std::vector<const SVFFunction*> FunVec;
|
|
56
|
-
typedef Set<const SVFInstruction*> CallInstSet;
|
|
57
|
-
typedef FIFOWorkList<const SVFFunction*> FunWorkList;
|
|
58
|
-
typedef FIFOWorkList<const SVFBasicBlock*> BBWorkList;
|
|
59
|
-
|
|
60
|
-
private:
|
|
61
|
-
FunSet spawners;
|
|
62
|
-
FunSet spawnees;
|
|
63
|
-
FunSet followers;
|
|
64
|
-
FunSet mhpfuns;
|
|
65
|
-
CallGraph* callgraph;
|
|
66
|
-
SVFModule* mod;
|
|
67
|
-
PointerAnalysis* pta;
|
|
68
|
-
ThreadAPI* tdAPI;
|
|
69
|
-
|
|
70
|
-
/// Callsites direct or Indirect call a function which spawn a thread
|
|
71
|
-
CallInstSet spawnCallSites;
|
|
72
|
-
|
|
73
|
-
/// Add/Get methods for thread properties of a procedure
|
|
74
|
-
//@{
|
|
75
|
-
inline bool isSpawnerFun(const SVFFunction* fun) const
|
|
76
|
-
{
|
|
77
|
-
return spawners.find(fun) != spawners.end();
|
|
78
|
-
}
|
|
79
|
-
inline bool isSpawneeFun(const SVFFunction* fun) const
|
|
80
|
-
{
|
|
81
|
-
return spawnees.find(fun) != spawnees.end();
|
|
82
|
-
}
|
|
83
|
-
inline bool isFollowerFun(const SVFFunction* fun) const
|
|
84
|
-
{
|
|
85
|
-
return followers.find(fun) != followers.end();
|
|
86
|
-
}
|
|
87
|
-
inline bool addSpawnerFun(const SVFFunction* fun)
|
|
88
|
-
{
|
|
89
|
-
if (fun->isDeclaration())
|
|
90
|
-
return false;
|
|
91
|
-
return spawners.insert(fun).second;
|
|
92
|
-
}
|
|
93
|
-
inline bool addSpawneeFun(const SVFFunction* fun)
|
|
94
|
-
{
|
|
95
|
-
if (fun->isDeclaration())
|
|
96
|
-
return false;
|
|
97
|
-
return spawnees.insert(fun).second;
|
|
98
|
-
}
|
|
99
|
-
inline bool addFollowerFun(const SVFFunction* fun)
|
|
100
|
-
{
|
|
101
|
-
if (fun->isDeclaration())
|
|
102
|
-
return false;
|
|
103
|
-
return followers.insert(fun).second;
|
|
104
|
-
}
|
|
105
|
-
//@}
|
|
106
|
-
|
|
107
|
-
/// Add/search spawn sites which directly or indirectly create a thread
|
|
108
|
-
//@{
|
|
109
|
-
inline bool addSpawnsite(const SVFInstruction* callInst)
|
|
110
|
-
{
|
|
111
|
-
return spawnCallSites.insert(callInst).second;
|
|
112
|
-
}
|
|
113
|
-
inline bool isSpawnsite(const SVFInstruction* callInst)
|
|
114
|
-
{
|
|
115
|
-
return spawnCallSites.find(callInst) != spawnCallSites.end();
|
|
116
|
-
}
|
|
117
|
-
//@}
|
|
118
|
-
/// Spawn sites iterators
|
|
119
|
-
//@{
|
|
120
|
-
inline CallInstSet::const_iterator spawnSitesBegin() const
|
|
121
|
-
{
|
|
122
|
-
return spawnCallSites.begin();
|
|
123
|
-
}
|
|
124
|
-
inline CallInstSet::const_iterator spawnSitesEnd() const
|
|
125
|
-
{
|
|
126
|
-
return spawnCallSites.end();
|
|
127
|
-
}
|
|
128
|
-
//@}
|
|
129
|
-
|
|
130
|
-
public:
|
|
131
|
-
|
|
132
|
-
/// Constructor
|
|
133
|
-
PCG(PointerAnalysis* an) : pta(an)
|
|
134
|
-
{
|
|
135
|
-
mod = pta->getModule();
|
|
136
|
-
tdAPI=ThreadAPI::getThreadAPI();
|
|
137
|
-
callgraph = pta->getCallGraph();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/// We start the pass here
|
|
141
|
-
virtual bool analyze();
|
|
142
|
-
|
|
143
|
-
/// Destructor
|
|
144
|
-
virtual ~PCG()
|
|
145
|
-
{
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
CallICFGNode* getCallICFGNode(const SVFInstruction* inst)
|
|
149
|
-
{
|
|
150
|
-
return pta->getICFG()->getCallICFGNode(inst);
|
|
151
|
-
}
|
|
152
|
-
/// Interface to query whether two function may happen-in-parallel
|
|
153
|
-
virtual bool mayHappenInParallel(const SVFInstruction* i1, const SVFInstruction* i2) const;
|
|
154
|
-
bool mayHappenInParallelBetweenFunctions(const SVFFunction* fun1, const SVFFunction* fun2) const;
|
|
155
|
-
inline const FunSet& getMHPFunctions() const
|
|
156
|
-
{
|
|
157
|
-
return mhpfuns;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/// Initialize spawner and spawnee sets with threadAPI
|
|
161
|
-
void initFromThreadAPI(SVFModule* module);
|
|
162
|
-
|
|
163
|
-
/// Infer spawner spawnee and followers sets by traversing on callGraph
|
|
164
|
-
//@{
|
|
165
|
-
void inferFromCallGraph();
|
|
166
|
-
void collectSpawners();
|
|
167
|
-
void collectSpawnees();
|
|
168
|
-
void collectFollowers();
|
|
169
|
-
void identifyFollowers();
|
|
170
|
-
//@}
|
|
171
|
-
|
|
172
|
-
/// Get spawners/spawnees/followers
|
|
173
|
-
//@{
|
|
174
|
-
inline const FunSet& getSpawners() const
|
|
175
|
-
{
|
|
176
|
-
return spawners;
|
|
177
|
-
}
|
|
178
|
-
inline const FunSet& getSpawnees() const
|
|
179
|
-
{
|
|
180
|
-
return spawnees;
|
|
181
|
-
}
|
|
182
|
-
inline const FunSet& getFollowers() const
|
|
183
|
-
{
|
|
184
|
-
return followers;
|
|
185
|
-
}
|
|
186
|
-
//@}
|
|
187
|
-
|
|
188
|
-
/// Iterators for thread properties of a procedure
|
|
189
|
-
//@{
|
|
190
|
-
inline FunSet::const_iterator spawnersBegin(const SVFFunction* fun) const
|
|
191
|
-
{
|
|
192
|
-
return spawners.begin();
|
|
193
|
-
}
|
|
194
|
-
inline FunSet::const_iterator spawnersEnd(const SVFFunction* fun) const
|
|
195
|
-
{
|
|
196
|
-
return spawners.end();
|
|
197
|
-
}
|
|
198
|
-
inline FunSet::const_iterator spawneesBegin(const SVFFunction* fun) const
|
|
199
|
-
{
|
|
200
|
-
return spawnees.begin();
|
|
201
|
-
}
|
|
202
|
-
inline FunSet::const_iterator spawneesEnd(const SVFFunction* fun) const
|
|
203
|
-
{
|
|
204
|
-
return spawnees.end();
|
|
205
|
-
}
|
|
206
|
-
inline FunSet::const_iterator followersBegin(const SVFFunction* fun) const
|
|
207
|
-
{
|
|
208
|
-
return followers.begin();
|
|
209
|
-
}
|
|
210
|
-
inline FunSet::const_iterator followersEnd(const SVFFunction* fun) const
|
|
211
|
-
{
|
|
212
|
-
return followers.end();
|
|
213
|
-
}
|
|
214
|
-
//@}
|
|
215
|
-
|
|
216
|
-
/// Thread interferenceAnalysis
|
|
217
|
-
void interferenceAnalysis();
|
|
218
|
-
|
|
219
|
-
/// Print analysis results
|
|
220
|
-
void printResults();
|
|
221
|
-
/*!
|
|
222
|
-
* Print Thread sensitive properties for each function
|
|
223
|
-
*/
|
|
224
|
-
void printTDFuns();
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
} // End namespace SVF
|
|
228
|
-
|
|
229
|
-
#endif /* PCG_H_ */
|