svf-lib 1.0.2135 → 1.0.2136
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/bin/ae +0 -0
- package/SVF-osx/Release-build/bin/cfl +0 -0
- package/SVF-osx/Release-build/bin/dvf +0 -0
- package/SVF-osx/Release-build/bin/llvm2svf +0 -0
- package/SVF-osx/Release-build/bin/mta +0 -0
- package/SVF-osx/Release-build/bin/saber +0 -0
- package/SVF-osx/Release-build/bin/svf-ex +0 -0
- package/SVF-osx/Release-build/bin/wpa +0 -0
- package/SVF-osx/Release-build/include/Graphs/CallGraph.h +264 -0
- package/SVF-osx/Release-build/include/Graphs/PTACallGraph.h +39 -42
- package/SVF-osx/Release-build/include/Graphs/ThreadCallGraph.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/LLVMModule.h +1 -1
- package/SVF-osx/Release-build/include/SVFIR/SVFIR.h +5 -4
- package/SVF-osx/Release-build/include/Util/CallGraphBuilder.h +6 -2
- package/SVF-osx/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
//===- CallGraph.h -- Call graph representation----------------------------//
|
|
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
|
+
* CallGraph.h
|
|
25
|
+
*
|
|
26
|
+
* Created on: Nov 7, 2013
|
|
27
|
+
* Author: Yulei Sui
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef CALLGRAPH_H_
|
|
31
|
+
#define CALLGRAPH_H_
|
|
32
|
+
|
|
33
|
+
#include "Graphs/GenericGraph.h"
|
|
34
|
+
#include "SVFIR/SVFValue.h"
|
|
35
|
+
#include "Graphs/ICFG.h"
|
|
36
|
+
#include <set>
|
|
37
|
+
|
|
38
|
+
namespace SVF
|
|
39
|
+
{
|
|
40
|
+
|
|
41
|
+
class CallGraphNode;
|
|
42
|
+
class SVFModule;
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
* Call Graph edge representing a calling relation between two functions
|
|
47
|
+
* Multiple calls from function A to B are merged into one call edge
|
|
48
|
+
* Each call edge has a set of direct callsites and a set of indirect callsites
|
|
49
|
+
*/
|
|
50
|
+
typedef GenericEdge<CallGraphNode> GenericCallGraphEdgeTy;
|
|
51
|
+
class CallGraphEdge : public GenericCallGraphEdgeTy
|
|
52
|
+
{
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
typedef Set<const CallICFGNode*> CallInstSet;
|
|
56
|
+
|
|
57
|
+
private:
|
|
58
|
+
CallInstSet directCalls;
|
|
59
|
+
public:
|
|
60
|
+
/// Constructor
|
|
61
|
+
CallGraphEdge(CallGraphNode* s, CallGraphNode* d, const CallICFGNode* icfgNode) :
|
|
62
|
+
GenericCallGraphEdgeTy(s, d, icfgNode->getId())
|
|
63
|
+
{
|
|
64
|
+
}
|
|
65
|
+
/// Destructor
|
|
66
|
+
virtual ~CallGraphEdge()
|
|
67
|
+
{
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/// Add direct callsite
|
|
71
|
+
//@{
|
|
72
|
+
void addDirectCallSite(const CallICFGNode* call);
|
|
73
|
+
//@}
|
|
74
|
+
|
|
75
|
+
/// Iterators for direct and indirect callsites
|
|
76
|
+
//@{
|
|
77
|
+
inline CallInstSet::const_iterator directCallsBegin() const
|
|
78
|
+
{
|
|
79
|
+
return directCalls.begin();
|
|
80
|
+
}
|
|
81
|
+
inline CallInstSet::const_iterator directCallsEnd() const
|
|
82
|
+
{
|
|
83
|
+
return directCalls.end();
|
|
84
|
+
}
|
|
85
|
+
//@}
|
|
86
|
+
|
|
87
|
+
/// ClassOf
|
|
88
|
+
//@{
|
|
89
|
+
static inline bool classof(const CallGraphEdge*)
|
|
90
|
+
{
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
//@}
|
|
94
|
+
|
|
95
|
+
/// Overloading operator << for dumping ICFG node ID
|
|
96
|
+
//@{
|
|
97
|
+
friend OutStream& operator<< (OutStream &o, const CallGraphEdge&edge)
|
|
98
|
+
{
|
|
99
|
+
o << edge.toString();
|
|
100
|
+
return o;
|
|
101
|
+
}
|
|
102
|
+
//@}
|
|
103
|
+
|
|
104
|
+
virtual const std::string toString() const;
|
|
105
|
+
|
|
106
|
+
typedef GenericNode<CallGraphNode, CallGraphEdge>::GEdgeSetTy CallGraphEdgeSet;
|
|
107
|
+
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/*
|
|
111
|
+
* Call Graph node representing a function
|
|
112
|
+
*/
|
|
113
|
+
typedef GenericNode<CallGraphNode, CallGraphEdge> GenericCallGraphNodeTy;
|
|
114
|
+
class CallGraphNode : public GenericCallGraphNodeTy
|
|
115
|
+
{
|
|
116
|
+
private:
|
|
117
|
+
const SVFFunction* fun;
|
|
118
|
+
|
|
119
|
+
public:
|
|
120
|
+
/// Constructor
|
|
121
|
+
CallGraphNode(NodeID i, const SVFFunction* f) : GenericCallGraphNodeTy(i,CallNodeKd), fun(f)
|
|
122
|
+
{
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
inline const std::string &getName() const
|
|
126
|
+
{
|
|
127
|
+
return fun->getName();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/// Get function of this call node
|
|
131
|
+
inline const SVFFunction* getFunction() const
|
|
132
|
+
{
|
|
133
|
+
return fun;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
/// Overloading operator << for dumping ICFG node ID
|
|
138
|
+
//@{
|
|
139
|
+
friend OutStream& operator<< (OutStream &o, const CallGraphNode&node)
|
|
140
|
+
{
|
|
141
|
+
o << node.toString();
|
|
142
|
+
return o;
|
|
143
|
+
}
|
|
144
|
+
//@}
|
|
145
|
+
|
|
146
|
+
virtual const std::string toString() const;
|
|
147
|
+
|
|
148
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
149
|
+
//@{
|
|
150
|
+
static inline bool classof(const CallGraphNode*)
|
|
151
|
+
{
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static inline bool classof(const GenericICFGNodeTy* node)
|
|
156
|
+
{
|
|
157
|
+
return node->getNodeKind() == CallNodeKd;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
static inline bool classof(const SVFBaseNode* node)
|
|
161
|
+
{
|
|
162
|
+
return node->getNodeKind() == CallNodeKd;
|
|
163
|
+
}
|
|
164
|
+
//@}
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/*!
|
|
168
|
+
* Pointer Analysis Call Graph used internally for various pointer analysis
|
|
169
|
+
*/
|
|
170
|
+
typedef GenericGraph<CallGraphNode, CallGraphEdge> GenericCallGraphTy;
|
|
171
|
+
class CallGraph : public GenericCallGraphTy
|
|
172
|
+
{
|
|
173
|
+
friend class PTACallGraph;
|
|
174
|
+
|
|
175
|
+
public:
|
|
176
|
+
typedef CallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet;
|
|
177
|
+
typedef Map<const SVFFunction*, CallGraphNode*> FunToCallGraphNodeMap;
|
|
178
|
+
typedef Map<const CallICFGNode*, CallGraphEdgeSet> CallInstToCallGraphEdgesMap;
|
|
179
|
+
typedef Set<const SVFFunction*> FunctionSet;
|
|
180
|
+
typedef OrderedMap<const CallICFGNode*, FunctionSet> CallEdgeMap;
|
|
181
|
+
|
|
182
|
+
protected:
|
|
183
|
+
FunToCallGraphNodeMap funToCallGraphNodeMap; ///< Call Graph node map
|
|
184
|
+
CallInstToCallGraphEdgesMap callinstToCallGraphEdgesMap; ///< Map a call instruction to its corresponding call edges
|
|
185
|
+
|
|
186
|
+
NodeID callGraphNodeNum;
|
|
187
|
+
|
|
188
|
+
/// Clean up memory
|
|
189
|
+
void destroy();
|
|
190
|
+
|
|
191
|
+
/// Add call graph edge
|
|
192
|
+
inline void addEdge(CallGraphEdge* edge)
|
|
193
|
+
{
|
|
194
|
+
edge->getDstNode()->addIncomingEdge(edge);
|
|
195
|
+
edge->getSrcNode()->addOutgoingEdge(edge);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
public:
|
|
200
|
+
/// Constructor
|
|
201
|
+
CallGraph();
|
|
202
|
+
|
|
203
|
+
void addCallGraphNode(const SVFFunction* fun);
|
|
204
|
+
|
|
205
|
+
/// Destructor
|
|
206
|
+
virtual ~CallGraph()
|
|
207
|
+
{
|
|
208
|
+
destroy();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/// Get call graph node
|
|
212
|
+
//@{
|
|
213
|
+
inline CallGraphNode* getCallGraphNode(NodeID id) const
|
|
214
|
+
{
|
|
215
|
+
return getGNode(id);
|
|
216
|
+
}
|
|
217
|
+
inline CallGraphNode* getCallGraphNode(const SVFFunction* fun) const
|
|
218
|
+
{
|
|
219
|
+
FunToCallGraphNodeMap::const_iterator it = funToCallGraphNodeMap.find(fun);
|
|
220
|
+
assert(it!=funToCallGraphNodeMap.end() && "call graph node not found!!");
|
|
221
|
+
return it->second;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
//@}
|
|
225
|
+
|
|
226
|
+
/// Whether we have already created this call graph edge
|
|
227
|
+
CallGraphEdge* hasGraphEdge(CallGraphNode* src, CallGraphNode* dst,
|
|
228
|
+
const CallICFGNode* callIcfgNode) const;
|
|
229
|
+
|
|
230
|
+
/// Add direct call edges
|
|
231
|
+
void addDirectCallGraphEdge(const CallICFGNode* call, const SVFFunction* callerFun, const SVFFunction* calleeFun);
|
|
232
|
+
/// Dump the graph
|
|
233
|
+
void dump(const std::string& filename);
|
|
234
|
+
|
|
235
|
+
/// View the graph from the debugger
|
|
236
|
+
void view();
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
} // End namespace SVF
|
|
240
|
+
|
|
241
|
+
namespace SVF
|
|
242
|
+
{
|
|
243
|
+
/* !
|
|
244
|
+
* GenericGraphTraits specializations for generic graph algorithms.
|
|
245
|
+
* Provide graph traits for traversing from a constraint node using standard graph traversals.
|
|
246
|
+
*/
|
|
247
|
+
template<> struct GenericGraphTraits<SVF::CallGraphNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::CallGraphNode, SVF::CallGraphEdge>* >
|
|
248
|
+
{
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
/// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
|
|
252
|
+
template<>
|
|
253
|
+
struct GenericGraphTraits<Inverse<SVF::CallGraphNode*> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::CallGraphNode, SVF::CallGraphEdge>* > >
|
|
254
|
+
{
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
template<> struct GenericGraphTraits<SVF::CallGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::CallGraphNode, SVF::CallGraphEdge>* >
|
|
258
|
+
{
|
|
259
|
+
typedef SVF::CallGraphNode*NodeRef;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
} // End namespace llvm
|
|
263
|
+
|
|
264
|
+
#endif /* CALLGRAPH_H_ */
|
|
@@ -40,6 +40,7 @@ namespace SVF
|
|
|
40
40
|
|
|
41
41
|
class PTACallGraphNode;
|
|
42
42
|
class SVFModule;
|
|
43
|
+
class CallGraph;
|
|
43
44
|
|
|
44
45
|
|
|
45
46
|
/*
|
|
@@ -47,8 +48,8 @@ class SVFModule;
|
|
|
47
48
|
* Multiple calls from function A to B are merged into one call edge
|
|
48
49
|
* Each call edge has a set of direct callsites and a set of indirect callsites
|
|
49
50
|
*/
|
|
50
|
-
typedef GenericEdge<PTACallGraphNode>
|
|
51
|
-
class PTACallGraphEdge : public
|
|
51
|
+
typedef GenericEdge<PTACallGraphNode> GenericPTACallGraphEdgeTy;
|
|
52
|
+
class PTACallGraphEdge : public GenericPTACallGraphEdgeTy
|
|
52
53
|
{
|
|
53
54
|
|
|
54
55
|
public:
|
|
@@ -66,7 +67,7 @@ private:
|
|
|
66
67
|
public:
|
|
67
68
|
/// Constructor
|
|
68
69
|
PTACallGraphEdge(PTACallGraphNode* s, PTACallGraphNode* d, CEDGEK kind, CallSiteID cs) :
|
|
69
|
-
|
|
70
|
+
GenericPTACallGraphEdgeTy(s, d, makeEdgeFlagWithInvokeID(kind, cs)), csId(cs)
|
|
70
71
|
{
|
|
71
72
|
}
|
|
72
73
|
/// Destructor
|
|
@@ -144,7 +145,7 @@ public:
|
|
|
144
145
|
{
|
|
145
146
|
return true;
|
|
146
147
|
}
|
|
147
|
-
static inline bool classof(const
|
|
148
|
+
static inline bool classof(const GenericPTACallGraphEdgeTy *edge)
|
|
148
149
|
{
|
|
149
150
|
return edge->getEdgeKind() == PTACallGraphEdge::CallRetEdge ||
|
|
150
151
|
edge->getEdgeKind() == PTACallGraphEdge::TDForkEdge ||
|
|
@@ -170,21 +171,15 @@ public:
|
|
|
170
171
|
/*
|
|
171
172
|
* Call Graph node representing a function
|
|
172
173
|
*/
|
|
173
|
-
typedef GenericNode<PTACallGraphNode, PTACallGraphEdge>
|
|
174
|
-
class PTACallGraphNode : public
|
|
174
|
+
typedef GenericNode<PTACallGraphNode, PTACallGraphEdge> GenericPTACallGraphNodeTy;
|
|
175
|
+
class PTACallGraphNode : public GenericPTACallGraphNodeTy
|
|
175
176
|
{
|
|
176
|
-
|
|
177
|
-
public:
|
|
178
|
-
typedef PTACallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet;
|
|
179
|
-
typedef PTACallGraphEdge::CallGraphEdgeSet::iterator iterator;
|
|
180
|
-
typedef PTACallGraphEdge::CallGraphEdgeSet::const_iterator const_iterator;
|
|
181
|
-
|
|
182
177
|
private:
|
|
183
178
|
const SVFFunction* fun;
|
|
184
179
|
|
|
185
180
|
public:
|
|
186
181
|
/// Constructor
|
|
187
|
-
PTACallGraphNode(NodeID i, const SVFFunction* f) :
|
|
182
|
+
PTACallGraphNode(NodeID i, const SVFFunction* f) : GenericPTACallGraphNodeTy(i,CallNodeKd), fun(f)
|
|
188
183
|
{
|
|
189
184
|
|
|
190
185
|
}
|
|
@@ -237,8 +232,8 @@ public:
|
|
|
237
232
|
/*!
|
|
238
233
|
* Pointer Analysis Call Graph used internally for various pointer analysis
|
|
239
234
|
*/
|
|
240
|
-
typedef GenericGraph<PTACallGraphNode, PTACallGraphEdge>
|
|
241
|
-
class PTACallGraph : public
|
|
235
|
+
typedef GenericGraph<PTACallGraphNode, PTACallGraphEdge> GenericPTACallGraphTy;
|
|
236
|
+
class PTACallGraph : public GenericPTACallGraphTy
|
|
242
237
|
{
|
|
243
238
|
|
|
244
239
|
public:
|
|
@@ -278,14 +273,36 @@ protected:
|
|
|
278
273
|
/// Clean up memory
|
|
279
274
|
void destroy();
|
|
280
275
|
|
|
276
|
+
protected:
|
|
277
|
+
/// Add CallSiteID
|
|
278
|
+
inline CallSiteID addCallSite(const CallICFGNode* cs, const SVFFunction* callee)
|
|
279
|
+
{
|
|
280
|
+
std::pair<const CallICFGNode*, const SVFFunction*> newCS(std::make_pair(cs, callee));
|
|
281
|
+
CallSiteToIdMap::const_iterator it = csToIdMap.find(newCS);
|
|
282
|
+
//assert(it == csToIdMap.end() && "cannot add a callsite twice");
|
|
283
|
+
if(it == csToIdMap.end())
|
|
284
|
+
{
|
|
285
|
+
CallSiteID id = totalCallSiteNum++;
|
|
286
|
+
csToIdMap.insert(std::make_pair(newCS, id));
|
|
287
|
+
idToCSMap.insert(std::make_pair(id, newCS));
|
|
288
|
+
return id;
|
|
289
|
+
}
|
|
290
|
+
return it->second;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/// Add call graph edge
|
|
294
|
+
inline void addEdge(PTACallGraphEdge* edge)
|
|
295
|
+
{
|
|
296
|
+
edge->getDstNode()->addIncomingEdge(edge);
|
|
297
|
+
edge->getSrcNode()->addOutgoingEdge(edge);
|
|
298
|
+
}
|
|
299
|
+
|
|
281
300
|
public:
|
|
282
301
|
/// Constructor
|
|
283
302
|
PTACallGraph(CGEK k = NormCallGraph);
|
|
284
303
|
|
|
285
304
|
/// Copy constructor
|
|
286
|
-
PTACallGraph(const
|
|
287
|
-
|
|
288
|
-
void addCallGraphNode(const SVFFunction* fun);
|
|
305
|
+
PTACallGraph(const CallGraph& other);
|
|
289
306
|
|
|
290
307
|
/// Destructor
|
|
291
308
|
virtual ~PTACallGraph()
|
|
@@ -349,22 +366,8 @@ public:
|
|
|
349
366
|
|
|
350
367
|
//@}
|
|
351
368
|
|
|
352
|
-
///
|
|
369
|
+
/// Get CallSiteID
|
|
353
370
|
//@{
|
|
354
|
-
inline CallSiteID addCallSite(const CallICFGNode* cs, const SVFFunction* callee)
|
|
355
|
-
{
|
|
356
|
-
std::pair<const CallICFGNode*, const SVFFunction*> newCS(std::make_pair(cs, callee));
|
|
357
|
-
CallSiteToIdMap::const_iterator it = csToIdMap.find(newCS);
|
|
358
|
-
//assert(it == csToIdMap.end() && "cannot add a callsite twice");
|
|
359
|
-
if(it == csToIdMap.end())
|
|
360
|
-
{
|
|
361
|
-
CallSiteID id = totalCallSiteNum++;
|
|
362
|
-
csToIdMap.insert(std::make_pair(newCS, id));
|
|
363
|
-
idToCSMap.insert(std::make_pair(id, newCS));
|
|
364
|
-
return id;
|
|
365
|
-
}
|
|
366
|
-
return it->second;
|
|
367
|
-
}
|
|
368
371
|
inline CallSiteID getCallSiteID(const CallICFGNode* cs, const SVFFunction* callee) const
|
|
369
372
|
{
|
|
370
373
|
CallSitePair newCS(std::make_pair(cs, callee));
|
|
@@ -439,16 +442,10 @@ public:
|
|
|
439
442
|
return it->second.end();
|
|
440
443
|
}
|
|
441
444
|
//@}
|
|
442
|
-
/// Add call graph edge
|
|
443
|
-
inline void addEdge(PTACallGraphEdge* edge)
|
|
444
|
-
{
|
|
445
|
-
edge->getDstNode()->addIncomingEdge(edge);
|
|
446
|
-
edge->getSrcNode()->addOutgoingEdge(edge);
|
|
447
|
-
}
|
|
448
445
|
|
|
449
|
-
|
|
446
|
+
|
|
447
|
+
/// Add indirect call edges
|
|
450
448
|
//@{
|
|
451
|
-
void addDirectCallGraphEdge(const CallICFGNode* call, const SVFFunction* callerFun, const SVFFunction* calleeFun);
|
|
452
449
|
void addIndirectCallGraphEdge(const CallICFGNode* cs,const SVFFunction* callerFun, const SVFFunction* calleeFun);
|
|
453
450
|
//@}
|
|
454
451
|
|
|
@@ -494,4 +491,4 @@ template<> struct GenericGraphTraits<SVF::PTACallGraph*> : public GenericGraphTr
|
|
|
494
491
|
|
|
495
492
|
} // End namespace llvm
|
|
496
493
|
|
|
497
|
-
#endif /*
|
|
494
|
+
#endif /* PTACALLGRAPH_H_ */
|
|
@@ -172,7 +172,7 @@ public:
|
|
|
172
172
|
typedef Map<const CallICFGNode*, ParForEdgeSet> CallInstToParForEdgesMap;
|
|
173
173
|
|
|
174
174
|
/// Constructor
|
|
175
|
-
ThreadCallGraph(const
|
|
175
|
+
ThreadCallGraph(const CallGraph& cg);
|
|
176
176
|
|
|
177
177
|
ThreadCallGraph(ThreadCallGraph& cg) = delete;
|
|
178
178
|
|
|
@@ -105,7 +105,7 @@ private:
|
|
|
105
105
|
InstToBlockNodeMapTy InstToBlockNodeMap; ///< map a basic block to its ICFGNode
|
|
106
106
|
FunToFunEntryNodeMapTy FunToFunEntryNodeMap; ///< map a function to its FunExitICFGNode
|
|
107
107
|
FunToFunExitNodeMapTy FunToFunExitNodeMap; ///< map a function to its FunEntryICFGNode
|
|
108
|
-
|
|
108
|
+
CallGraph* callgraph;
|
|
109
109
|
|
|
110
110
|
/// Constructor
|
|
111
111
|
LLVMModuleSet();
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
namespace SVF
|
|
36
36
|
{
|
|
37
37
|
class CommonCHGraph;
|
|
38
|
+
class CallGraph;
|
|
38
39
|
/*!
|
|
39
40
|
* SVF Intermediate representation, representing variables and statements as a Program Assignment Graph (PAG)
|
|
40
41
|
* Variables as nodes and statements as edges.
|
|
@@ -98,7 +99,7 @@ private:
|
|
|
98
99
|
ICFG* icfg; // ICFG
|
|
99
100
|
CommonCHGraph* chgraph; // class hierarchy graph
|
|
100
101
|
CallSiteSet callSiteSet; /// all the callsites of a program
|
|
101
|
-
|
|
102
|
+
CallGraph* callGraph; /// call graph
|
|
102
103
|
|
|
103
104
|
static std::unique_ptr<SVFIR> pag; ///< Singleton pattern here to enable instance of SVFIR can only be created once.
|
|
104
105
|
|
|
@@ -185,13 +186,13 @@ public:
|
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
/// Set/Get CG
|
|
188
|
-
inline void setCallGraph(
|
|
189
|
+
inline void setCallGraph(CallGraph* c)
|
|
189
190
|
{
|
|
190
191
|
callGraph = c;
|
|
191
192
|
}
|
|
192
|
-
inline
|
|
193
|
+
inline CallGraph* getCallGraph()
|
|
193
194
|
{
|
|
194
|
-
assert(callGraph && "empty
|
|
195
|
+
assert(callGraph && "empty CallGraph! Build SVF IR first!");
|
|
195
196
|
return callGraph;
|
|
196
197
|
}
|
|
197
198
|
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
#ifndef INCLUDE_SVF_FE_CALLGRAPHBUILDER_H_
|
|
32
32
|
#define INCLUDE_SVF_FE_CALLGRAPHBUILDER_H_
|
|
33
33
|
|
|
34
|
-
#include "Graphs/PTACallGraph.h"
|
|
35
34
|
#include "Graphs/ThreadCallGraph.h"
|
|
36
35
|
|
|
37
36
|
namespace SVF
|
|
@@ -39,6 +38,8 @@ namespace SVF
|
|
|
39
38
|
|
|
40
39
|
class ICFG;
|
|
41
40
|
class SVFModule;
|
|
41
|
+
class CallGraph;
|
|
42
|
+
class ThreadCallGraph;
|
|
42
43
|
|
|
43
44
|
class CallGraphBuilder
|
|
44
45
|
{
|
|
@@ -46,7 +47,10 @@ public:
|
|
|
46
47
|
CallGraphBuilder()=default;
|
|
47
48
|
|
|
48
49
|
/// Buidl SVFIR callgraoh
|
|
49
|
-
|
|
50
|
+
CallGraph* buildSVFIRCallGraph(SVFModule* svfModule);
|
|
51
|
+
|
|
52
|
+
/// Buidl PTA callgraoh
|
|
53
|
+
PTACallGraph* buildPTACallGraph();
|
|
50
54
|
|
|
51
55
|
/// Build thread-aware callgraph
|
|
52
56
|
ThreadCallGraph* buildThreadCallGraph();
|
|
Binary file
|
|
Binary file
|