svf-tools 1.0.1033 → 1.0.1035
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/AE/Svfexe/AbsExtAPI.h +0 -7
- package/svf/include/CFL/CFLAlias.h +0 -8
- package/svf/include/DDA/DDAPass.h +4 -1
- package/svf/include/Graphs/BasicBlockG.h +310 -0
- package/svf/include/Graphs/ConsG.h +0 -5
- package/svf/include/Graphs/GenericGraph.h +1 -0
- package/svf/include/Graphs/IRGraph.h +0 -24
- package/svf/include/MSSA/MemRegion.h +1 -1
- package/svf/include/MemoryModel/PointerAnalysis.h +2 -2
- package/svf/include/MemoryModel/PointerAnalysisImpl.h +7 -4
- package/svf/include/SVFIR/SVFIR.h +3 -3
- package/svf/include/SVFIR/SVFValue.h +25 -124
- package/svf/include/SVFIR/SVFVariables.h +3 -3
- package/svf/include/Util/SVFUtil.h +0 -16
- package/svf/include/WPA/WPAPass.h +0 -7
- package/svf/lib/AE/Svfexe/AbsExtAPI.cpp +0 -6
- package/svf/lib/DDA/DDAPass.cpp +0 -27
- package/svf/lib/Graphs/BasicBlockG.cpp +10 -0
- package/svf/lib/MSSA/MemRegion.cpp +13 -16
- package/svf/lib/MSSA/MemSSA.cpp +1 -1
- package/svf/lib/MTA/LockAnalysis.cpp +2 -1
- package/svf/lib/MTA/MHP.cpp +2 -1
- package/svf/lib/MTA/MTA.cpp +2 -1
- package/svf/lib/MTA/MTAStat.cpp +1 -1
- package/svf/lib/MemoryModel/PointerAnalysisImpl.cpp +0 -8
- package/svf/lib/SABER/SaberCondAllocator.cpp +1 -1
- package/svf/lib/SVFIR/SVFIR.cpp +4 -4
- package/svf/lib/SVFIR/SVFValue.cpp +1 -68
- package/svf/lib/SVFIR/SVFVariables.cpp +1 -1
- package/svf/lib/Util/CDGBuilder.cpp +2 -1
- package/svf/lib/Util/CallGraphBuilder.cpp +6 -3
- package/svf/lib/Util/SVFStat.cpp +1 -1
- package/svf/lib/Util/ThreadAPI.cpp +1 -1
- package/svf/lib/WPA/WPAPass.cpp +0 -62
- package/svf-llvm/include/SVF-LLVM/LLVMModule.h +8 -4
- package/svf-llvm/lib/LLVMModule.cpp +5 -8
- package/svf-llvm/lib/LLVMUtil.cpp +12 -4
- package/svf-llvm/lib/ObjTypeInference.cpp +4 -4
- package/svf-llvm/lib/SVFIRBuilder.cpp +2 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1035",
|
|
4
4
|
"description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -130,13 +130,6 @@ public:
|
|
|
130
130
|
*/
|
|
131
131
|
AbstractState& getAbsStateFromTrace(const ICFGNode* node);
|
|
132
132
|
|
|
133
|
-
/**
|
|
134
|
-
* @brief Retrieves the SVF variable from a given SVF value.
|
|
135
|
-
* @param val Pointer to the SVF value.
|
|
136
|
-
* @return Pointer to the corresponding SVF variable.
|
|
137
|
-
*/
|
|
138
|
-
const SVFVar* getSVFVar(const SVFValue* val);
|
|
139
|
-
|
|
140
133
|
protected:
|
|
141
134
|
SVFIR* svfir; ///< Pointer to the SVF intermediate representation.
|
|
142
135
|
ICFG* icfg; ///< Pointer to the interprocedural control flow graph.
|
|
@@ -61,14 +61,6 @@ public:
|
|
|
61
61
|
/// Solving CFL Reachability
|
|
62
62
|
virtual void solve();
|
|
63
63
|
|
|
64
|
-
/// Interface exposed to users of our Alias analysis, given Value infos
|
|
65
|
-
virtual AliasResult alias(const SVFValue* v1, const SVFValue* v2)
|
|
66
|
-
{
|
|
67
|
-
NodeID n1 = svfir->getValueNode(v1);
|
|
68
|
-
NodeID n2 = svfir->getValueNode(v2);
|
|
69
|
-
return alias(n1,n2);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
64
|
/// Interface exposed to users of our Alias analysis, given PAGNodeID
|
|
73
65
|
virtual AliasResult alias(NodeID node1, NodeID node2)
|
|
74
66
|
{
|
|
@@ -57,7 +57,10 @@ public:
|
|
|
57
57
|
~DDAPass();
|
|
58
58
|
|
|
59
59
|
/// Interface expose to users of our pointer analysis, given Value infos
|
|
60
|
-
virtual AliasResult alias(const
|
|
60
|
+
virtual AliasResult alias(const SVFVar* V1, const SVFVar* V2)
|
|
61
|
+
{
|
|
62
|
+
return alias(V1->getId(), V2->getId());
|
|
63
|
+
}
|
|
61
64
|
|
|
62
65
|
/// Interface expose to users of our pointer analysis, given PAGNodes
|
|
63
66
|
virtual AliasResult alias(NodeID V1, NodeID V2);
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
//===- BasicBlockG.h -- BasicBlock node------------------------------------------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-2025> <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
|
+
* ICFGNode.h
|
|
25
|
+
*
|
|
26
|
+
* Created on: 23 Jan, 2025
|
|
27
|
+
* Author: Jiawei, Xiao
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef BASICBLOCKGRAPH_H_
|
|
31
|
+
#define BASICBLOCKGRAPH_H_
|
|
32
|
+
#include "GenericGraph.h"
|
|
33
|
+
#include <sstream>
|
|
34
|
+
#include <algorithm>
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
namespace SVF
|
|
38
|
+
{
|
|
39
|
+
class SVFBasicBlock;
|
|
40
|
+
class BasicBlockEdge;
|
|
41
|
+
class ICFGNode;
|
|
42
|
+
class SVFFunction;
|
|
43
|
+
typedef GenericEdge<SVFBasicBlock> GenericBasicBlockEdgeTy;
|
|
44
|
+
class BasicBlockEdge: public GenericBasicBlockEdgeTy
|
|
45
|
+
{
|
|
46
|
+
friend class SVFIRWriter;
|
|
47
|
+
friend class SVFIRReader;
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
public:
|
|
51
|
+
/// Constructor
|
|
52
|
+
BasicBlockEdge(SVFBasicBlock* s, SVFBasicBlock* d) : GenericBasicBlockEdgeTy(s, d, 0)
|
|
53
|
+
{
|
|
54
|
+
}
|
|
55
|
+
/// Destructor
|
|
56
|
+
~BasicBlockEdge() {}
|
|
57
|
+
|
|
58
|
+
/// Overloading operator << for dumping ICFG node ID
|
|
59
|
+
//@{
|
|
60
|
+
friend OutStream& operator<<(OutStream& o, const BasicBlockEdge& edge)
|
|
61
|
+
{
|
|
62
|
+
o << edge.toString();
|
|
63
|
+
return o;
|
|
64
|
+
}
|
|
65
|
+
//@}
|
|
66
|
+
|
|
67
|
+
virtual const std::string toString() const;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
typedef GenericNode<SVFBasicBlock, BasicBlockEdge> GenericBasicBlockNodeTy;
|
|
72
|
+
class SVFBasicBlock : public GenericBasicBlockNodeTy
|
|
73
|
+
{
|
|
74
|
+
friend class LLVMModuleSet;
|
|
75
|
+
friend class SVFIRWriter;
|
|
76
|
+
friend class SVFIRReader;
|
|
77
|
+
friend class SVFIRBuilder;
|
|
78
|
+
friend class SVFFunction;
|
|
79
|
+
friend class ICFGBuilder;
|
|
80
|
+
friend class ICFG;
|
|
81
|
+
|
|
82
|
+
public:
|
|
83
|
+
typedef std::vector<const ICFGNode*>::const_iterator const_iterator;
|
|
84
|
+
std::vector<const SVFBasicBlock*> succBBs;
|
|
85
|
+
std::vector<const SVFBasicBlock*> predBBs;
|
|
86
|
+
|
|
87
|
+
private:
|
|
88
|
+
std::vector<const ICFGNode*> allICFGNodes; ///< all ICFGNodes in this BasicBlock
|
|
89
|
+
const SVFFunction* fun; /// Function where this BasicBlock is
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
protected:
|
|
94
|
+
///@{ attributes to be set only through Module builders e.g., LLVMModule
|
|
95
|
+
|
|
96
|
+
inline void addICFGNode(const ICFGNode* icfgNode)
|
|
97
|
+
{
|
|
98
|
+
assert(std::find(getICFGNodeList().begin(), getICFGNodeList().end(),
|
|
99
|
+
icfgNode) == getICFGNodeList().end() && "duplicated icfgnode");
|
|
100
|
+
allICFGNodes.push_back(icfgNode);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/// @}
|
|
104
|
+
|
|
105
|
+
public:
|
|
106
|
+
/// Constructor without name
|
|
107
|
+
SVFBasicBlock(NodeID id, const SVFFunction* f): GenericBasicBlockNodeTy(id, BasicBlockKd), fun(f)
|
|
108
|
+
{
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
SVFBasicBlock() = delete;
|
|
112
|
+
~SVFBasicBlock()
|
|
113
|
+
{
|
|
114
|
+
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static inline bool classof(const SVFBaseNode* node)
|
|
118
|
+
{
|
|
119
|
+
return node->getNodeKind() == SVFBaseNode::BasicBlockKd;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
static inline bool classof(const SVFBasicBlock* node)
|
|
123
|
+
{
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
//@{
|
|
128
|
+
friend OutStream &operator<<(OutStream &o, const SVFBasicBlock&node)
|
|
129
|
+
{
|
|
130
|
+
o << node.toString();
|
|
131
|
+
return o;
|
|
132
|
+
}
|
|
133
|
+
//@}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
inline const std::vector<const ICFGNode*>& getICFGNodeList() const
|
|
137
|
+
{
|
|
138
|
+
return allICFGNodes;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
inline const_iterator begin() const
|
|
142
|
+
{
|
|
143
|
+
return allICFGNodes.begin();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
inline const_iterator end() const
|
|
147
|
+
{
|
|
148
|
+
return allICFGNodes.end();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
inline void addSuccBasicBlock(const SVFBasicBlock* succ2)
|
|
152
|
+
{
|
|
153
|
+
// check if the edge already exists
|
|
154
|
+
for (auto edge: this->getOutEdges())
|
|
155
|
+
{
|
|
156
|
+
if (edge->getDstNode() == succ2)
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
SVFBasicBlock* succ = const_cast<SVFBasicBlock*>(succ2);
|
|
161
|
+
BasicBlockEdge* edge = new BasicBlockEdge(this, succ);
|
|
162
|
+
this->addOutgoingEdge(edge);
|
|
163
|
+
succ->addIncomingEdge(edge);
|
|
164
|
+
this->succBBs.push_back(succ);
|
|
165
|
+
succ->predBBs.push_back(this);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
inline void addPredBasicBlock(const SVFBasicBlock* pred2)
|
|
169
|
+
{
|
|
170
|
+
// check if the edge already exists
|
|
171
|
+
for (auto edge: this->getInEdges())
|
|
172
|
+
{
|
|
173
|
+
if (edge->getSrcNode() == pred2)
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
SVFBasicBlock* pred = const_cast<SVFBasicBlock*>(pred2);
|
|
177
|
+
BasicBlockEdge* edge = new BasicBlockEdge(pred, this);
|
|
178
|
+
this->addIncomingEdge(edge);
|
|
179
|
+
pred->addOutgoingEdge(edge);
|
|
180
|
+
this->predBBs.push_back(pred);
|
|
181
|
+
pred->succBBs.push_back(this);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
inline const SVFFunction* getParent() const
|
|
185
|
+
{
|
|
186
|
+
return fun;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
inline const SVFFunction* getFunction() const
|
|
190
|
+
{
|
|
191
|
+
return fun;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
inline const ICFGNode* front() const
|
|
195
|
+
{
|
|
196
|
+
assert(!allICFGNodes.empty() && "bb empty?");
|
|
197
|
+
return allICFGNodes.front();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
inline const ICFGNode* back() const
|
|
201
|
+
{
|
|
202
|
+
assert(!allICFGNodes.empty() && "bb empty?");
|
|
203
|
+
return allICFGNodes.back();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
inline std::vector<const SVFBasicBlock*> getSuccessors() const
|
|
207
|
+
{
|
|
208
|
+
std::vector<const SVFBasicBlock*> res;
|
|
209
|
+
for (auto edge : this->getOutEdges())
|
|
210
|
+
{
|
|
211
|
+
res.push_back(edge->getDstNode());
|
|
212
|
+
}
|
|
213
|
+
return res;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
inline std::vector<const SVFBasicBlock*> getPredecessors() const
|
|
217
|
+
{
|
|
218
|
+
std::vector<const SVFBasicBlock*> res;
|
|
219
|
+
for (auto edge : this->getInEdges())
|
|
220
|
+
{
|
|
221
|
+
res.push_back(edge->getSrcNode());
|
|
222
|
+
}
|
|
223
|
+
return res;
|
|
224
|
+
}
|
|
225
|
+
u32_t getNumSuccessors() const
|
|
226
|
+
{
|
|
227
|
+
return this->getOutEdges().size();
|
|
228
|
+
}
|
|
229
|
+
u32_t getBBSuccessorPos(const SVFBasicBlock* Succ)
|
|
230
|
+
{
|
|
231
|
+
u32_t i = 0;
|
|
232
|
+
for (const SVFBasicBlock* SuccBB: succBBs)
|
|
233
|
+
{
|
|
234
|
+
if (SuccBB == Succ)
|
|
235
|
+
return i;
|
|
236
|
+
i++;
|
|
237
|
+
}
|
|
238
|
+
assert(false && "Didn't find successor edge?");
|
|
239
|
+
return 0;
|
|
240
|
+
}
|
|
241
|
+
u32_t getBBSuccessorPos(const SVFBasicBlock* Succ) const
|
|
242
|
+
{
|
|
243
|
+
u32_t i = 0;
|
|
244
|
+
for (const SVFBasicBlock* SuccBB: succBBs)
|
|
245
|
+
{
|
|
246
|
+
if (SuccBB == Succ)
|
|
247
|
+
return i;
|
|
248
|
+
i++;
|
|
249
|
+
}
|
|
250
|
+
assert(false && "Didn't find successor edge?");
|
|
251
|
+
return 0;
|
|
252
|
+
|
|
253
|
+
}
|
|
254
|
+
u32_t getBBPredecessorPos(const SVFBasicBlock* succbb)
|
|
255
|
+
{
|
|
256
|
+
u32_t pos = 0;
|
|
257
|
+
for (const SVFBasicBlock* PredBB : succbb->getPredecessors())
|
|
258
|
+
{
|
|
259
|
+
if(PredBB == this)
|
|
260
|
+
return pos;
|
|
261
|
+
++pos;
|
|
262
|
+
}
|
|
263
|
+
assert(false && "Didn't find predecessor edge?");
|
|
264
|
+
return pos;
|
|
265
|
+
}
|
|
266
|
+
u32_t getBBPredecessorPos(const SVFBasicBlock* succbb) const
|
|
267
|
+
{
|
|
268
|
+
u32_t pos = 0;
|
|
269
|
+
for (const SVFBasicBlock* PredBB : succbb->getPredecessors())
|
|
270
|
+
{
|
|
271
|
+
if(PredBB == this)
|
|
272
|
+
return pos;
|
|
273
|
+
++pos;
|
|
274
|
+
}
|
|
275
|
+
assert(false && "Didn't find predecessor edge?");
|
|
276
|
+
return pos;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const std::string toString() const;
|
|
280
|
+
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
typedef GenericGraph<SVFBasicBlock, BasicBlockEdge> GenericBasicBlockGraphTy;
|
|
286
|
+
class BasicBlockGraph: public GenericBasicBlockGraphTy
|
|
287
|
+
{
|
|
288
|
+
private:
|
|
289
|
+
NodeID id{0};
|
|
290
|
+
const SVFFunction* fun;
|
|
291
|
+
public:
|
|
292
|
+
/// Constructor
|
|
293
|
+
BasicBlockGraph(const SVFFunction* f): fun(f)
|
|
294
|
+
{
|
|
295
|
+
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
SVFBasicBlock* addBasicBlock(const std::string& bbname)
|
|
299
|
+
{
|
|
300
|
+
id++;
|
|
301
|
+
SVFBasicBlock* bb = new SVFBasicBlock(id, fun);
|
|
302
|
+
addGNode(id, bb);
|
|
303
|
+
bb->setName(bbname);
|
|
304
|
+
return bb;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
#endif
|
|
@@ -76,11 +76,6 @@ protected:
|
|
|
76
76
|
|
|
77
77
|
/// Wrappers used internally, not expose to Andersen Pass
|
|
78
78
|
//@{
|
|
79
|
-
inline NodeID getValueNode(const SVFValue* value) const
|
|
80
|
-
{
|
|
81
|
-
return sccRepNode(pag->getValueNode(value));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
79
|
inline NodeID getReturnNode(const SVFFunction* value) const
|
|
85
80
|
{
|
|
86
81
|
return pag->getReturnNode(value);
|
|
@@ -53,7 +53,6 @@ class IRGraph : public GenericGraph<SVFVar, SVFStmt>
|
|
|
53
53
|
|
|
54
54
|
public:
|
|
55
55
|
typedef Set<const SVFStmt*> SVFStmtSet;
|
|
56
|
-
typedef Map<const SVFValue*,SVFStmtSet> ValueToEdgeMap;
|
|
57
56
|
|
|
58
57
|
protected:
|
|
59
58
|
SVFStmt::KindToSVFStmtMapTy KindToSVFStmtSetMap; ///< SVFIR edge map containing all PAGEdges
|
|
@@ -61,7 +60,6 @@ protected:
|
|
|
61
60
|
bool fromFile; ///< Whether the SVFIR is built according to user specified data from a txt file
|
|
62
61
|
NodeID nodeNumAfterPAGBuild; ///< initial node number after building SVFIR, excluding later added nodes, e.g., gepobj nodes
|
|
63
62
|
u32_t totalPTAPAGEdge;
|
|
64
|
-
ValueToEdgeMap valueToEdgeMap; ///< Map SVFValues (e.g., ICFGNodes) to all corresponding PAGEdges
|
|
65
63
|
SymbolTableInfo* symInfo;
|
|
66
64
|
|
|
67
65
|
/// Add a node into the graph
|
|
@@ -86,22 +84,11 @@ protected:
|
|
|
86
84
|
SVFStmt* hasLabeledEdge(SVFVar* src, SVFVar* op1, SVFStmt::PEDGEK kind,
|
|
87
85
|
const SVFVar* op2);
|
|
88
86
|
|
|
89
|
-
/// Map a value to a set of edges
|
|
90
|
-
inline void mapValueToEdge(const SVFValue* V, SVFStmt *edge)
|
|
91
|
-
{
|
|
92
|
-
auto inserted = valueToEdgeMap.emplace(V, SVFStmtSet{edge});
|
|
93
|
-
if (!inserted.second)
|
|
94
|
-
{
|
|
95
|
-
inserted.first->second.emplace(edge);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
87
|
public:
|
|
99
88
|
IRGraph(bool buildFromFile)
|
|
100
89
|
: fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0)
|
|
101
90
|
{
|
|
102
91
|
symInfo = SymbolTableInfo::SymbolInfo();
|
|
103
|
-
// insert dummy value if a correct value cannot be found
|
|
104
|
-
valueToEdgeMap[nullptr] = SVFStmtSet();
|
|
105
92
|
}
|
|
106
93
|
|
|
107
94
|
virtual ~IRGraph();
|
|
@@ -115,17 +102,6 @@ public:
|
|
|
115
102
|
{
|
|
116
103
|
return fromFile;
|
|
117
104
|
}
|
|
118
|
-
/// Get all SVFIR Edges that corresponds to an LLVM value
|
|
119
|
-
inline const SVFStmtSet& getValueEdges(const SVFValue* V)
|
|
120
|
-
{
|
|
121
|
-
auto it = valueToEdgeMap.find(V);
|
|
122
|
-
if (it == valueToEdgeMap.end())
|
|
123
|
-
{
|
|
124
|
-
//special empty set
|
|
125
|
-
return valueToEdgeMap.at(nullptr);
|
|
126
|
-
}
|
|
127
|
-
return it->second;
|
|
128
|
-
}
|
|
129
105
|
|
|
130
106
|
/// Get SVFIR Node according to LLVM value
|
|
131
107
|
///getNode - Return the node corresponding to the specified pointer.
|
|
@@ -480,7 +480,7 @@ public:
|
|
|
480
480
|
NodeBS getModInfoForCall(const CallICFGNode* cs);
|
|
481
481
|
NodeBS getRefInfoForCall(const CallICFGNode* cs);
|
|
482
482
|
ModRefInfo getModRefInfo(const CallICFGNode* cs);
|
|
483
|
-
ModRefInfo getModRefInfo(const CallICFGNode* cs, const
|
|
483
|
+
ModRefInfo getModRefInfo(const CallICFGNode* cs, const SVFVar* V);
|
|
484
484
|
ModRefInfo getModRefInfo(const CallICFGNode* cs1, const CallICFGNode* cs2);
|
|
485
485
|
//@}
|
|
486
486
|
|
|
@@ -233,8 +233,8 @@ public:
|
|
|
233
233
|
virtual void computeDDAPts(NodeID) {}
|
|
234
234
|
|
|
235
235
|
/// Interface exposed to users of our pointer analysis, given Value infos
|
|
236
|
-
virtual AliasResult alias(const
|
|
237
|
-
const
|
|
236
|
+
virtual AliasResult alias(const SVFVar* V1,
|
|
237
|
+
const SVFVar* V2) = 0;
|
|
238
238
|
|
|
239
239
|
/// Interface exposed to users of our pointer analysis, given PAGNodeID
|
|
240
240
|
virtual AliasResult alias(NodeID node1, NodeID node2) = 0;
|
|
@@ -215,8 +215,11 @@ private:
|
|
|
215
215
|
|
|
216
216
|
public:
|
|
217
217
|
/// Interface expose to users of our pointer analysis, given Value infos
|
|
218
|
-
AliasResult alias(const
|
|
219
|
-
const
|
|
218
|
+
AliasResult alias(const SVFVar* V1,
|
|
219
|
+
const SVFVar* V2) override
|
|
220
|
+
{
|
|
221
|
+
return alias(V1->getId(), V2->getId());
|
|
222
|
+
}
|
|
220
223
|
|
|
221
224
|
/// Interface expose to users of our pointer analysis, given PAGNodeID
|
|
222
225
|
AliasResult alias(NodeID node1, NodeID node2) override;
|
|
@@ -501,9 +504,9 @@ public:
|
|
|
501
504
|
}
|
|
502
505
|
|
|
503
506
|
/// Interface expose to users of our pointer analysis, given Value infos
|
|
504
|
-
virtual inline AliasResult alias(const
|
|
507
|
+
virtual inline AliasResult alias(const SVFVar* V1, const SVFVar* V2)
|
|
505
508
|
{
|
|
506
|
-
return alias(
|
|
509
|
+
return alias(V1->getId(), V2->getId());
|
|
507
510
|
}
|
|
508
511
|
/// Interface expose to users of our pointer analysis, given two pointers
|
|
509
512
|
virtual inline AliasResult alias(NodeID node1, NodeID node2)
|
|
@@ -70,7 +70,7 @@ public:
|
|
|
70
70
|
typedef std::pair<NodeID, AccessPath> NodeAccessPath;
|
|
71
71
|
typedef Map<NodeOffset,NodeID> NodeOffsetMap;
|
|
72
72
|
typedef Map<NodeAccessPath,NodeID> NodeAccessPathMap;
|
|
73
|
-
typedef Map<
|
|
73
|
+
typedef Map<NodeID, NodeAccessPathMap> GepValueVarMap;
|
|
74
74
|
typedef std::pair<const SVFType*, std::vector<AccessPath>> SVFTypeLocSetsPair;
|
|
75
75
|
typedef Map<NodeID, SVFTypeLocSetsPair> TypeLocSetsMap;
|
|
76
76
|
typedef Map<NodePair,NodeID> NodePairSetMap;
|
|
@@ -343,7 +343,7 @@ public:
|
|
|
343
343
|
//@}
|
|
344
344
|
|
|
345
345
|
/// Due to constraint expression, curInst is used to distinguish different instructions (e.g., memorycpy) when creating GepValVar.
|
|
346
|
-
NodeID getGepValVar(
|
|
346
|
+
NodeID getGepValVar(NodeID curInst, NodeID base,
|
|
347
347
|
const AccessPath& ap) const;
|
|
348
348
|
|
|
349
349
|
/// Add/get indirect callsites
|
|
@@ -693,7 +693,7 @@ private:
|
|
|
693
693
|
}
|
|
694
694
|
|
|
695
695
|
/// Add a temp field value node, this method can only invoked by getGepValVar
|
|
696
|
-
NodeID addGepValNode(
|
|
696
|
+
NodeID addGepValNode(NodeID curInst, const ValVar* base, const AccessPath& ap, NodeID i, const SVFType* type, const ICFGNode* node);
|
|
697
697
|
/// Add a field obj node, this method can only invoked by getGepObjVar
|
|
698
698
|
NodeID addGepObjNode(const BaseObjVar* baseObj, const APOffset& apOffset, const NodeID gepId);
|
|
699
699
|
/// Add a field-insensitive node, this method can only invoked by getFIGepObjNode
|