svf-lib 1.0.2133 → 1.0.2135
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-linux/Release-build/bin/ae +0 -0
- package/SVF-linux/Release-build/bin/cfl +0 -0
- package/SVF-linux/Release-build/bin/dvf +0 -0
- package/SVF-linux/Release-build/bin/llvm2svf +0 -0
- package/SVF-linux/Release-build/bin/mta +0 -0
- package/SVF-linux/Release-build/bin/saber +0 -0
- package/SVF-linux/Release-build/bin/svf-ex +0 -0
- package/SVF-linux/Release-build/bin/wpa +0 -0
- package/SVF-linux/Release-build/include/AE/Svfexe/AbstractInterpretation.h +1 -1
- package/SVF-linux/Release-build/include/DDA/DDAVFSolver.h +5 -5
- package/SVF-linux/Release-build/include/Graphs/ICFG.h +2 -2
- package/SVF-linux/Release-build/include/Graphs/{CallGraph.h → PTACallGraph.h} +44 -42
- package/SVF-linux/Release-build/include/Graphs/ThreadCallGraph.h +28 -28
- package/SVF-linux/Release-build/include/Graphs/VFG.h +5 -5
- package/SVF-linux/Release-build/include/MSSA/MemRegion.h +4 -4
- package/SVF-linux/Release-build/include/MTA/LockAnalysis.h +1 -1
- package/SVF-linux/Release-build/include/MTA/MHP.h +2 -2
- package/SVF-linux/Release-build/include/MTA/TCT.h +6 -6
- package/SVF-linux/Release-build/include/MemoryModel/PointerAnalysis.h +9 -9
- package/SVF-linux/Release-build/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-linux/Release-build/include/SABER/SrcSnkDDA.h +2 -2
- package/SVF-linux/Release-build/include/SVF-LLVM/LLVMModule.h +1 -1
- package/SVF-linux/Release-build/include/SVF-LLVM/SVFIRBuilder.h +1 -1
- package/SVF-linux/Release-build/include/SVFIR/SVFIR.h +4 -4
- package/SVF-linux/Release-build/include/Util/CallGraphBuilder.h +2 -2
- package/SVF-linux/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-linux/Release-build/lib/libSvfLLVM.a +0 -0
- 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/AE/Svfexe/AbstractInterpretation.h +1 -1
- package/SVF-osx/Release-build/include/DDA/DDAVFSolver.h +5 -5
- package/SVF-osx/Release-build/include/Graphs/ICFG.h +2 -2
- package/SVF-osx/Release-build/include/Graphs/{CallGraph.h → PTACallGraph.h} +44 -42
- package/SVF-osx/Release-build/include/Graphs/ThreadCallGraph.h +28 -28
- package/SVF-osx/Release-build/include/Graphs/VFG.h +5 -5
- package/SVF-osx/Release-build/include/MSSA/MemRegion.h +4 -4
- package/SVF-osx/Release-build/include/MTA/LockAnalysis.h +1 -1
- package/SVF-osx/Release-build/include/MTA/MHP.h +2 -2
- package/SVF-osx/Release-build/include/MTA/TCT.h +6 -6
- package/SVF-osx/Release-build/include/MemoryModel/PointerAnalysis.h +9 -9
- package/SVF-osx/Release-build/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-osx/Release-build/include/SABER/SrcSnkDDA.h +2 -2
- package/SVF-osx/Release-build/include/SVF-LLVM/LLVMModule.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/SVFIRBuilder.h +1 -1
- package/SVF-osx/Release-build/include/SVFIR/SVFIR.h +4 -4
- package/SVF-osx/Release-build/include/Util/CallGraphBuilder.h +2 -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
|
@@ -103,7 +103,7 @@ public:
|
|
|
103
103
|
typedef SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap;
|
|
104
104
|
typedef Set<const SVFFunction*> FunctionSet;
|
|
105
105
|
typedef OrderedMap<const CallICFGNode*, FunctionSet> CallEdgeMap;
|
|
106
|
-
typedef SCCDetection<
|
|
106
|
+
typedef SCCDetection<PTACallGraph*> CallGraphSCC;
|
|
107
107
|
typedef Set<const SVFGlobalValue*> VTableSet;
|
|
108
108
|
typedef Set<const SVFFunction*> VFunSet;
|
|
109
109
|
//@}
|
|
@@ -148,8 +148,8 @@ protected:
|
|
|
148
148
|
/// Statistics
|
|
149
149
|
PTAStat* stat;
|
|
150
150
|
/// Call graph used for pointer analysis
|
|
151
|
-
|
|
152
|
-
/// SCC for
|
|
151
|
+
PTACallGraph* callgraph;
|
|
152
|
+
/// SCC for PTACallGraph
|
|
153
153
|
CallGraphSCC* callGraphSCC;
|
|
154
154
|
/// Interprocedural control-flow graph
|
|
155
155
|
ICFG* icfg;
|
|
@@ -168,7 +168,7 @@ public:
|
|
|
168
168
|
return getCallGraph()->getNumOfResolvedIndCallEdge();
|
|
169
169
|
}
|
|
170
170
|
/// Return call graph
|
|
171
|
-
inline
|
|
171
|
+
inline PTACallGraph* getCallGraph() const
|
|
172
172
|
{
|
|
173
173
|
return callgraph;
|
|
174
174
|
}
|
|
@@ -382,9 +382,9 @@ public:
|
|
|
382
382
|
/// Resolve indirect call edges
|
|
383
383
|
virtual void resolveIndCalls(const CallICFGNode* cs, const PointsTo& target, CallEdgeMap& newEdges);
|
|
384
384
|
|
|
385
|
-
///
|
|
385
|
+
/// PTACallGraph SCC related methods
|
|
386
386
|
//@{
|
|
387
|
-
///
|
|
387
|
+
/// PTACallGraph SCC detection
|
|
388
388
|
inline void callGraphSCCDetection()
|
|
389
389
|
{
|
|
390
390
|
if(callGraphSCC==nullptr)
|
|
@@ -397,11 +397,11 @@ public:
|
|
|
397
397
|
{
|
|
398
398
|
return callGraphSCC->repNode(id);
|
|
399
399
|
}
|
|
400
|
-
/// Return TRUE if this edge is inside a
|
|
400
|
+
/// Return TRUE if this edge is inside a PTACallGraph SCC, i.e., src node and dst node are in the same SCC on the SVFG.
|
|
401
401
|
inline bool inSameCallGraphSCC(const SVFFunction* fun1,const SVFFunction* fun2)
|
|
402
402
|
{
|
|
403
|
-
const
|
|
404
|
-
const
|
|
403
|
+
const PTACallGraphNode* src = callgraph->getCallGraphNode(fun1);
|
|
404
|
+
const PTACallGraphNode* dst = callgraph->getCallGraphNode(fun2);
|
|
405
405
|
return (getCallGraphSCCRepNode(src->getId()) == getCallGraphSCCRepNode(dst->getId()));
|
|
406
406
|
}
|
|
407
407
|
inline bool isInRecursion(const SVFFunction* fun) const
|
|
@@ -89,7 +89,7 @@ protected:
|
|
|
89
89
|
|
|
90
90
|
/// Add actual parameter SVFGNode for 1st argument of a deallocation like external function
|
|
91
91
|
/// In order to path sensitive leak detection
|
|
92
|
-
virtual void AddExtActualParmSVFGNodes(
|
|
92
|
+
virtual void AddExtActualParmSVFGNodes(PTACallGraph* callgraph);
|
|
93
93
|
|
|
94
94
|
/// Collect memory pointed global pointers,
|
|
95
95
|
/// note that this collection is recursively performed, for example gp-->obj-->obj'
|
|
@@ -76,7 +76,7 @@ private:
|
|
|
76
76
|
protected:
|
|
77
77
|
SaberSVFGBuilder memSSA;
|
|
78
78
|
SVFG* svfg;
|
|
79
|
-
|
|
79
|
+
PTACallGraph* callgraph;
|
|
80
80
|
SVFBugReport report; /// Bug Reporter
|
|
81
81
|
|
|
82
82
|
public:
|
|
@@ -129,7 +129,7 @@ public:
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
/// Get Callgraph
|
|
132
|
-
inline
|
|
132
|
+
inline PTACallGraph* getCallgraph() const
|
|
133
133
|
{
|
|
134
134
|
return callgraph;
|
|
135
135
|
}
|
|
@@ -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
|
+
PTACallGraph* callgraph;
|
|
109
109
|
|
|
110
110
|
/// Constructor
|
|
111
111
|
LLVMModuleSet();
|
|
@@ -98,7 +98,7 @@ private:
|
|
|
98
98
|
ICFG* icfg; // ICFG
|
|
99
99
|
CommonCHGraph* chgraph; // class hierarchy graph
|
|
100
100
|
CallSiteSet callSiteSet; /// all the callsites of a program
|
|
101
|
-
|
|
101
|
+
PTACallGraph* callGraph; /// call graph
|
|
102
102
|
|
|
103
103
|
static std::unique_ptr<SVFIR> pag; ///< Singleton pattern here to enable instance of SVFIR can only be created once.
|
|
104
104
|
|
|
@@ -185,13 +185,13 @@ public:
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/// Set/Get CG
|
|
188
|
-
inline void setCallGraph(
|
|
188
|
+
inline void setCallGraph(PTACallGraph* c)
|
|
189
189
|
{
|
|
190
190
|
callGraph = c;
|
|
191
191
|
}
|
|
192
|
-
inline
|
|
192
|
+
inline PTACallGraph* getCallGraph()
|
|
193
193
|
{
|
|
194
|
-
assert(callGraph && "empty
|
|
194
|
+
assert(callGraph && "empty PTACallGraph! Build SVF IR first!");
|
|
195
195
|
return callGraph;
|
|
196
196
|
}
|
|
197
197
|
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
#ifndef INCLUDE_SVF_FE_CALLGRAPHBUILDER_H_
|
|
32
32
|
#define INCLUDE_SVF_FE_CALLGRAPHBUILDER_H_
|
|
33
33
|
|
|
34
|
-
#include "Graphs/
|
|
34
|
+
#include "Graphs/PTACallGraph.h"
|
|
35
35
|
#include "Graphs/ThreadCallGraph.h"
|
|
36
36
|
|
|
37
37
|
namespace SVF
|
|
@@ -46,7 +46,7 @@ public:
|
|
|
46
46
|
CallGraphBuilder()=default;
|
|
47
47
|
|
|
48
48
|
/// Buidl SVFIR callgraoh
|
|
49
|
-
|
|
49
|
+
PTACallGraph* buildSVFIRCallGraph(SVFModule* svfModule);
|
|
50
50
|
|
|
51
51
|
/// Build thread-aware callgraph
|
|
52
52
|
ThreadCallGraph* buildThreadCallGraph();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -49,8 +49,8 @@ class DDAVFSolver
|
|
|
49
49
|
friend class DDAStat;
|
|
50
50
|
public:
|
|
51
51
|
typedef SCCDetection<SVFG*> SVFGSCC;
|
|
52
|
-
typedef SCCDetection<
|
|
53
|
-
typedef
|
|
52
|
+
typedef SCCDetection<PTACallGraph*> CallGraphSCC;
|
|
53
|
+
typedef PTACallGraphEdge::CallInstSet CallInstSet;
|
|
54
54
|
typedef SVFIR::CallSiteSet CallSiteSet;
|
|
55
55
|
typedef OrderedSet<DPIm> DPTItemSet;
|
|
56
56
|
typedef OrderedMap<DPIm, CPtSet> DPImToCPtSetMap;
|
|
@@ -624,7 +624,7 @@ protected:
|
|
|
624
624
|
return (getSVFGSCCRepNode(edge->getSrcID()) == getSVFGSCCRepNode(edge->getDstID()));
|
|
625
625
|
}
|
|
626
626
|
/// Set callgraph
|
|
627
|
-
inline void setCallGraph (
|
|
627
|
+
inline void setCallGraph (PTACallGraph* cg)
|
|
628
628
|
{
|
|
629
629
|
_callGraph = cg;
|
|
630
630
|
}
|
|
@@ -775,8 +775,8 @@ protected:
|
|
|
775
775
|
SVFG* _svfg; ///< SVFG
|
|
776
776
|
AndersenWaveDiff* _ander; ///< Andersen's analysis
|
|
777
777
|
NodeBS candidateQueries; ///< candidate pointers;
|
|
778
|
-
|
|
779
|
-
CallGraphSCC* _callGraphSCC; ///< SCC for
|
|
778
|
+
PTACallGraph* _callGraph; ///< PTACallGraph
|
|
779
|
+
CallGraphSCC* _callGraphSCC; ///< SCC for PTACallGraph
|
|
780
780
|
SVFGSCC* _svfgSCC; ///< SCC for SVFG
|
|
781
781
|
DPTItemSet backwardVisited; ///< visited map during backward traversing
|
|
782
782
|
DPImToCPtSetMap dpmToTLCPtSetMap; ///< points-to caching map for top-level vars
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
namespace SVF
|
|
39
39
|
{
|
|
40
40
|
|
|
41
|
-
class
|
|
41
|
+
class PTACallGraph;
|
|
42
42
|
|
|
43
43
|
/*!
|
|
44
44
|
* Interprocedural Control-Flow Graph (ICFG)
|
|
@@ -111,7 +111,7 @@ public:
|
|
|
111
111
|
void view();
|
|
112
112
|
|
|
113
113
|
/// update ICFG for indirect calls
|
|
114
|
-
void updateCallGraph(
|
|
114
|
+
void updateCallGraph(PTACallGraph* callgraph);
|
|
115
115
|
|
|
116
116
|
/// Whether node is in a loop
|
|
117
117
|
inline bool isInLoop(const ICFGNode *node)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//===-
|
|
1
|
+
//===- PTACallGraph.h -- Call graph representation----------------------------//
|
|
2
2
|
//
|
|
3
3
|
// SVF: Static Value-Flow Analysis
|
|
4
4
|
//
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
//===----------------------------------------------------------------------===//
|
|
22
22
|
|
|
23
23
|
/*
|
|
24
|
-
*
|
|
24
|
+
* PTACallGraph.h
|
|
25
25
|
*
|
|
26
26
|
* Created on: Nov 7, 2013
|
|
27
27
|
* Author: Yulei Sui
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
#ifndef
|
|
31
|
-
#define
|
|
30
|
+
#ifndef PTACALLGRAPH_H_
|
|
31
|
+
#define PTACALLGRAPH_H_
|
|
32
32
|
|
|
33
33
|
#include "Graphs/GenericGraph.h"
|
|
34
34
|
#include "SVFIR/SVFValue.h"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
namespace SVF
|
|
39
39
|
{
|
|
40
40
|
|
|
41
|
-
class
|
|
41
|
+
class PTACallGraphNode;
|
|
42
42
|
class SVFModule;
|
|
43
43
|
|
|
44
44
|
|
|
@@ -47,8 +47,8 @@ class SVFModule;
|
|
|
47
47
|
* Multiple calls from function A to B are merged into one call edge
|
|
48
48
|
* Each call edge has a set of direct callsites and a set of indirect callsites
|
|
49
49
|
*/
|
|
50
|
-
typedef GenericEdge<
|
|
51
|
-
class
|
|
50
|
+
typedef GenericEdge<PTACallGraphNode> GenericCallGraphEdgeTy;
|
|
51
|
+
class PTACallGraphEdge : public GenericCallGraphEdgeTy
|
|
52
52
|
{
|
|
53
53
|
|
|
54
54
|
public:
|
|
@@ -65,12 +65,12 @@ private:
|
|
|
65
65
|
CallSiteID csId;
|
|
66
66
|
public:
|
|
67
67
|
/// Constructor
|
|
68
|
-
|
|
68
|
+
PTACallGraphEdge(PTACallGraphNode* s, PTACallGraphNode* d, CEDGEK kind, CallSiteID cs) :
|
|
69
69
|
GenericCallGraphEdgeTy(s, d, makeEdgeFlagWithInvokeID(kind, cs)), csId(cs)
|
|
70
70
|
{
|
|
71
71
|
}
|
|
72
72
|
/// Destructor
|
|
73
|
-
virtual ~
|
|
73
|
+
virtual ~PTACallGraphEdge()
|
|
74
74
|
{
|
|
75
75
|
}
|
|
76
76
|
/// Compute the unique edgeFlag value from edge kind and CallSiteID.
|
|
@@ -140,21 +140,21 @@ public:
|
|
|
140
140
|
|
|
141
141
|
/// ClassOf
|
|
142
142
|
//@{
|
|
143
|
-
static inline bool classof(const
|
|
143
|
+
static inline bool classof(const PTACallGraphEdge*)
|
|
144
144
|
{
|
|
145
145
|
return true;
|
|
146
146
|
}
|
|
147
147
|
static inline bool classof(const GenericCallGraphEdgeTy *edge)
|
|
148
148
|
{
|
|
149
|
-
return edge->getEdgeKind() ==
|
|
150
|
-
edge->getEdgeKind() ==
|
|
151
|
-
edge->getEdgeKind() ==
|
|
149
|
+
return edge->getEdgeKind() == PTACallGraphEdge::CallRetEdge ||
|
|
150
|
+
edge->getEdgeKind() == PTACallGraphEdge::TDForkEdge ||
|
|
151
|
+
edge->getEdgeKind() == PTACallGraphEdge::TDJoinEdge;
|
|
152
152
|
}
|
|
153
153
|
//@}
|
|
154
154
|
|
|
155
155
|
/// Overloading operator << for dumping ICFG node ID
|
|
156
156
|
//@{
|
|
157
|
-
friend OutStream& operator<< (OutStream &o, const
|
|
157
|
+
friend OutStream& operator<< (OutStream &o, const PTACallGraphEdge&edge)
|
|
158
158
|
{
|
|
159
159
|
o << edge.toString();
|
|
160
160
|
return o;
|
|
@@ -163,28 +163,28 @@ public:
|
|
|
163
163
|
|
|
164
164
|
virtual const std::string toString() const;
|
|
165
165
|
|
|
166
|
-
typedef GenericNode<
|
|
166
|
+
typedef GenericNode<PTACallGraphNode, PTACallGraphEdge>::GEdgeSetTy CallGraphEdgeSet;
|
|
167
167
|
|
|
168
168
|
};
|
|
169
169
|
|
|
170
170
|
/*
|
|
171
171
|
* Call Graph node representing a function
|
|
172
172
|
*/
|
|
173
|
-
typedef GenericNode<
|
|
174
|
-
class
|
|
173
|
+
typedef GenericNode<PTACallGraphNode, PTACallGraphEdge> GenericCallGraphNodeTy;
|
|
174
|
+
class PTACallGraphNode : public GenericCallGraphNodeTy
|
|
175
175
|
{
|
|
176
176
|
|
|
177
177
|
public:
|
|
178
|
-
typedef
|
|
179
|
-
typedef
|
|
180
|
-
typedef
|
|
178
|
+
typedef PTACallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet;
|
|
179
|
+
typedef PTACallGraphEdge::CallGraphEdgeSet::iterator iterator;
|
|
180
|
+
typedef PTACallGraphEdge::CallGraphEdgeSet::const_iterator const_iterator;
|
|
181
181
|
|
|
182
182
|
private:
|
|
183
183
|
const SVFFunction* fun;
|
|
184
184
|
|
|
185
185
|
public:
|
|
186
186
|
/// Constructor
|
|
187
|
-
|
|
187
|
+
PTACallGraphNode(NodeID i, const SVFFunction* f) : GenericCallGraphNodeTy(i,CallNodeKd), fun(f)
|
|
188
188
|
{
|
|
189
189
|
|
|
190
190
|
}
|
|
@@ -206,7 +206,7 @@ public:
|
|
|
206
206
|
|
|
207
207
|
/// Overloading operator << for dumping ICFG node ID
|
|
208
208
|
//@{
|
|
209
|
-
friend OutStream& operator<< (OutStream &o, const
|
|
209
|
+
friend OutStream& operator<< (OutStream &o, const PTACallGraphNode&node)
|
|
210
210
|
{
|
|
211
211
|
o << node.toString();
|
|
212
212
|
return o;
|
|
@@ -217,7 +217,7 @@ public:
|
|
|
217
217
|
|
|
218
218
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
219
219
|
//@{
|
|
220
|
-
static inline bool classof(const
|
|
220
|
+
static inline bool classof(const PTACallGraphNode*)
|
|
221
221
|
{
|
|
222
222
|
return true;
|
|
223
223
|
}
|
|
@@ -237,13 +237,13 @@ public:
|
|
|
237
237
|
/*!
|
|
238
238
|
* Pointer Analysis Call Graph used internally for various pointer analysis
|
|
239
239
|
*/
|
|
240
|
-
typedef GenericGraph<
|
|
241
|
-
class
|
|
240
|
+
typedef GenericGraph<PTACallGraphNode, PTACallGraphEdge> GenericCallGraphTy;
|
|
241
|
+
class PTACallGraph : public GenericCallGraphTy
|
|
242
242
|
{
|
|
243
243
|
|
|
244
244
|
public:
|
|
245
|
-
typedef
|
|
246
|
-
typedef Map<const SVFFunction*,
|
|
245
|
+
typedef PTACallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet;
|
|
246
|
+
typedef Map<const SVFFunction*, PTACallGraphNode*> FunToCallGraphNodeMap;
|
|
247
247
|
typedef Map<const CallICFGNode*, CallGraphEdgeSet> CallInstToCallGraphEdgesMap;
|
|
248
248
|
typedef std::pair<const CallICFGNode*, const SVFFunction*> CallSitePair;
|
|
249
249
|
typedef Map<CallSitePair, CallSiteID> CallSiteToIdMap;
|
|
@@ -280,15 +280,15 @@ protected:
|
|
|
280
280
|
|
|
281
281
|
public:
|
|
282
282
|
/// Constructor
|
|
283
|
-
|
|
283
|
+
PTACallGraph(CGEK k = NormCallGraph);
|
|
284
284
|
|
|
285
285
|
/// Copy constructor
|
|
286
|
-
|
|
286
|
+
PTACallGraph(const PTACallGraph& other);
|
|
287
287
|
|
|
288
288
|
void addCallGraphNode(const SVFFunction* fun);
|
|
289
289
|
|
|
290
290
|
/// Destructor
|
|
291
|
-
virtual ~
|
|
291
|
+
virtual ~PTACallGraph()
|
|
292
292
|
{
|
|
293
293
|
destroy();
|
|
294
294
|
}
|
|
@@ -336,11 +336,11 @@ public:
|
|
|
336
336
|
|
|
337
337
|
/// Get call graph node
|
|
338
338
|
//@{
|
|
339
|
-
inline
|
|
339
|
+
inline PTACallGraphNode* getCallGraphNode(NodeID id) const
|
|
340
340
|
{
|
|
341
341
|
return getGNode(id);
|
|
342
342
|
}
|
|
343
|
-
inline
|
|
343
|
+
inline PTACallGraphNode* getCallGraphNode(const SVFFunction* fun) const
|
|
344
344
|
{
|
|
345
345
|
FunToCallGraphNodeMap::const_iterator it = funToCallGraphNodeMap.find(fun);
|
|
346
346
|
assert(it!=funToCallGraphNodeMap.end() && "call graph node not found!!");
|
|
@@ -398,9 +398,11 @@ public:
|
|
|
398
398
|
}
|
|
399
399
|
//@}
|
|
400
400
|
/// Whether we have already created this call graph edge
|
|
401
|
-
|
|
401
|
+
PTACallGraphEdge* hasGraphEdge(PTACallGraphNode* src, PTACallGraphNode* dst,
|
|
402
|
+
PTACallGraphEdge::CEDGEK kind, CallSiteID csId) const;
|
|
402
403
|
/// Get call graph edge via nodes
|
|
403
|
-
|
|
404
|
+
PTACallGraphEdge* getGraphEdge(PTACallGraphNode* src, PTACallGraphNode* dst,
|
|
405
|
+
PTACallGraphEdge::CEDGEK kind, CallSiteID csId);
|
|
404
406
|
|
|
405
407
|
/// Get all callees for a callsite
|
|
406
408
|
inline void getCallees(const CallICFGNode* cs, FunctionSet& callees)
|
|
@@ -438,7 +440,7 @@ public:
|
|
|
438
440
|
}
|
|
439
441
|
//@}
|
|
440
442
|
/// Add call graph edge
|
|
441
|
-
inline void addEdge(
|
|
443
|
+
inline void addEdge(PTACallGraphEdge* edge)
|
|
442
444
|
{
|
|
443
445
|
edge->getDstNode()->addIncomingEdge(edge);
|
|
444
446
|
edge->getSrcNode()->addOutgoingEdge(edge);
|
|
@@ -452,9 +454,9 @@ public:
|
|
|
452
454
|
|
|
453
455
|
/// Get callsites invoking the callee
|
|
454
456
|
//@{
|
|
455
|
-
void getAllCallSitesInvokingCallee(const SVFFunction* callee,
|
|
456
|
-
void getDirCallSitesInvokingCallee(const SVFFunction* callee,
|
|
457
|
-
void getIndCallSitesInvokingCallee(const SVFFunction* callee,
|
|
457
|
+
void getAllCallSitesInvokingCallee(const SVFFunction* callee, PTACallGraphEdge::CallInstSet& csSet);
|
|
458
|
+
void getDirCallSitesInvokingCallee(const SVFFunction* callee, PTACallGraphEdge::CallInstSet& csSet);
|
|
459
|
+
void getIndCallSitesInvokingCallee(const SVFFunction* callee, PTACallGraphEdge::CallInstSet& csSet);
|
|
458
460
|
//@}
|
|
459
461
|
|
|
460
462
|
/// Whether its reachable between two functions
|
|
@@ -475,19 +477,19 @@ namespace SVF
|
|
|
475
477
|
* GenericGraphTraits specializations for generic graph algorithms.
|
|
476
478
|
* Provide graph traits for traversing from a constraint node using standard graph traversals.
|
|
477
479
|
*/
|
|
478
|
-
template<> struct GenericGraphTraits<SVF::
|
|
480
|
+
template<> struct GenericGraphTraits<SVF::PTACallGraphNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::PTACallGraphNode, SVF::PTACallGraphEdge>* >
|
|
479
481
|
{
|
|
480
482
|
};
|
|
481
483
|
|
|
482
484
|
/// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
|
|
483
485
|
template<>
|
|
484
|
-
struct GenericGraphTraits<Inverse<SVF::
|
|
486
|
+
struct GenericGraphTraits<Inverse<SVF::PTACallGraphNode*> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::PTACallGraphNode, SVF::PTACallGraphEdge>* > >
|
|
485
487
|
{
|
|
486
488
|
};
|
|
487
489
|
|
|
488
|
-
template<> struct GenericGraphTraits<SVF::
|
|
490
|
+
template<> struct GenericGraphTraits<SVF::PTACallGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::PTACallGraphNode, SVF::PTACallGraphEdge>* >
|
|
489
491
|
{
|
|
490
|
-
typedef SVF::
|
|
492
|
+
typedef SVF::PTACallGraphNode*NodeRef;
|
|
491
493
|
};
|
|
492
494
|
|
|
493
495
|
} // End namespace llvm
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
#ifndef RCG_H_
|
|
31
31
|
#define RCG_H_
|
|
32
32
|
|
|
33
|
-
#include "Graphs/
|
|
33
|
+
#include "Graphs/PTACallGraph.h"
|
|
34
34
|
|
|
35
35
|
namespace SVF
|
|
36
36
|
{
|
|
@@ -41,13 +41,13 @@ class PointerAnalysis;
|
|
|
41
41
|
/*!
|
|
42
42
|
* PTA thread fork edge from fork site to the entry of a start routine function
|
|
43
43
|
*/
|
|
44
|
-
class ThreadForkEdge: public
|
|
44
|
+
class ThreadForkEdge: public PTACallGraphEdge
|
|
45
45
|
{
|
|
46
46
|
|
|
47
47
|
public:
|
|
48
48
|
/// Constructor
|
|
49
|
-
ThreadForkEdge(
|
|
50
|
-
|
|
49
|
+
ThreadForkEdge(PTACallGraphNode* s, PTACallGraphNode* d, CallSiteID csId) :
|
|
50
|
+
PTACallGraphEdge(s, d, PTACallGraphEdge::TDForkEdge, csId)
|
|
51
51
|
{
|
|
52
52
|
}
|
|
53
53
|
/// Destructor
|
|
@@ -61,9 +61,9 @@ public:
|
|
|
61
61
|
{
|
|
62
62
|
return true;
|
|
63
63
|
}
|
|
64
|
-
static inline bool classof(const
|
|
64
|
+
static inline bool classof(const PTACallGraphEdge*edge)
|
|
65
65
|
{
|
|
66
|
-
return edge->getEdgeKind() ==
|
|
66
|
+
return edge->getEdgeKind() == PTACallGraphEdge::TDForkEdge;
|
|
67
67
|
}
|
|
68
68
|
//@}
|
|
69
69
|
|
|
@@ -78,19 +78,19 @@ public:
|
|
|
78
78
|
return rawstr.str();
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
typedef GenericNode<
|
|
81
|
+
typedef GenericNode<PTACallGraphNode, ThreadForkEdge>::GEdgeSetTy ForkEdgeSet;
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
/*!
|
|
85
85
|
* PTA thread join edge from the exit of a start routine function to a join point of the thread
|
|
86
86
|
*/
|
|
87
|
-
class ThreadJoinEdge: public
|
|
87
|
+
class ThreadJoinEdge: public PTACallGraphEdge
|
|
88
88
|
{
|
|
89
89
|
|
|
90
90
|
public:
|
|
91
91
|
/// Constructor
|
|
92
|
-
ThreadJoinEdge(
|
|
93
|
-
|
|
92
|
+
ThreadJoinEdge(PTACallGraphNode* s, PTACallGraphNode* d, CallSiteID csId) :
|
|
93
|
+
PTACallGraphEdge(s, d, PTACallGraphEdge::TDJoinEdge, csId)
|
|
94
94
|
{
|
|
95
95
|
}
|
|
96
96
|
/// Destructor
|
|
@@ -102,9 +102,9 @@ public:
|
|
|
102
102
|
{
|
|
103
103
|
return true;
|
|
104
104
|
}
|
|
105
|
-
static inline bool classof(const
|
|
105
|
+
static inline bool classof(const PTACallGraphEdge*edge)
|
|
106
106
|
{
|
|
107
|
-
return edge->getEdgeKind() ==
|
|
107
|
+
return edge->getEdgeKind() == PTACallGraphEdge::TDJoinEdge;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
virtual const std::string toString() const
|
|
@@ -118,19 +118,19 @@ public:
|
|
|
118
118
|
return rawstr.str();
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
typedef GenericNode<
|
|
121
|
+
typedef GenericNode<PTACallGraphNode, ThreadJoinEdge>::GEdgeSetTy JoinEdgeSet;
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
/*!
|
|
125
125
|
* hare_parallel_for edge from fork site to the entry of a start routine function
|
|
126
126
|
*/
|
|
127
|
-
class HareParForEdge: public
|
|
127
|
+
class HareParForEdge: public PTACallGraphEdge
|
|
128
128
|
{
|
|
129
129
|
|
|
130
130
|
public:
|
|
131
131
|
/// Constructor
|
|
132
|
-
HareParForEdge(
|
|
133
|
-
|
|
132
|
+
HareParForEdge(PTACallGraphNode* s, PTACallGraphNode* d, CallSiteID csId) :
|
|
133
|
+
PTACallGraphEdge(s, d, PTACallGraphEdge::HareParForEdge, csId)
|
|
134
134
|
{
|
|
135
135
|
}
|
|
136
136
|
/// Destructor
|
|
@@ -144,20 +144,20 @@ public:
|
|
|
144
144
|
{
|
|
145
145
|
return true;
|
|
146
146
|
}
|
|
147
|
-
static inline bool classof(const
|
|
147
|
+
static inline bool classof(const PTACallGraphEdge*edge)
|
|
148
148
|
{
|
|
149
|
-
return edge->getEdgeKind() ==
|
|
149
|
+
return edge->getEdgeKind() == PTACallGraphEdge::HareParForEdge;
|
|
150
150
|
}
|
|
151
151
|
//@}
|
|
152
152
|
|
|
153
|
-
typedef GenericNode<
|
|
153
|
+
typedef GenericNode<PTACallGraphNode, HareParForEdge>::GEdgeSetTy ParForEdgeSet;
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
|
|
157
157
|
/*!
|
|
158
158
|
* Thread sensitive call graph
|
|
159
159
|
*/
|
|
160
|
-
class ThreadCallGraph: public
|
|
160
|
+
class ThreadCallGraph: public PTACallGraph
|
|
161
161
|
{
|
|
162
162
|
|
|
163
163
|
public:
|
|
@@ -172,7 +172,7 @@ public:
|
|
|
172
172
|
typedef Map<const CallICFGNode*, ParForEdgeSet> CallInstToParForEdgesMap;
|
|
173
173
|
|
|
174
174
|
/// Constructor
|
|
175
|
-
ThreadCallGraph(const
|
|
175
|
+
ThreadCallGraph(const PTACallGraph& cg);
|
|
176
176
|
|
|
177
177
|
ThreadCallGraph(ThreadCallGraph& cg) = delete;
|
|
178
178
|
|
|
@@ -187,9 +187,9 @@ public:
|
|
|
187
187
|
{
|
|
188
188
|
return true;
|
|
189
189
|
}
|
|
190
|
-
static inline bool classof(const
|
|
190
|
+
static inline bool classof(const PTACallGraph*g)
|
|
191
191
|
{
|
|
192
|
-
return g->getKind() ==
|
|
192
|
+
return g->getKind() == PTACallGraph::ThdCallGraph;
|
|
193
193
|
}
|
|
194
194
|
//@}
|
|
195
195
|
|
|
@@ -239,7 +239,7 @@ public:
|
|
|
239
239
|
assert(it != callinstToThreadJoinEdgesMap.end() && "call instruction does not have a valid callee");
|
|
240
240
|
return it->second.end();
|
|
241
241
|
}
|
|
242
|
-
inline void getJoinSites(const
|
|
242
|
+
inline void getJoinSites(const PTACallGraphNode* routine, InstSet& csSet)
|
|
243
243
|
{
|
|
244
244
|
for(CallInstToJoinEdgesMap::const_iterator it = callinstToThreadJoinEdgesMap.begin(), eit = callinstToThreadJoinEdgesMap.end(); it!=eit; ++it)
|
|
245
245
|
{
|
|
@@ -359,7 +359,7 @@ public:
|
|
|
359
359
|
//@}
|
|
360
360
|
|
|
361
361
|
|
|
362
|
-
/// map call instruction to its
|
|
362
|
+
/// map call instruction to its PTACallGraphEdge map
|
|
363
363
|
inline void addThreadForkEdgeSetMap(const CallICFGNode* cs, ThreadForkEdge* edge)
|
|
364
364
|
{
|
|
365
365
|
if(edge!=nullptr)
|
|
@@ -369,7 +369,7 @@ public:
|
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
-
/// map call instruction to its
|
|
372
|
+
/// map call instruction to its PTACallGraphEdge map
|
|
373
373
|
inline void addThreadJoinEdgeSetMap(const CallICFGNode* cs, ThreadJoinEdge* edge)
|
|
374
374
|
{
|
|
375
375
|
if(edge!=nullptr)
|
|
@@ -379,7 +379,7 @@ public:
|
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
-
/// map call instruction to its
|
|
382
|
+
/// map call instruction to its PTACallGraphEdge map
|
|
383
383
|
inline void addHareParForEdgeSetMap(const CallICFGNode* cs, HareParForEdge* edge)
|
|
384
384
|
{
|
|
385
385
|
if(edge!=nullptr)
|
|
@@ -390,7 +390,7 @@ public:
|
|
|
390
390
|
}
|
|
391
391
|
|
|
392
392
|
/// has thread join edge
|
|
393
|
-
inline ThreadJoinEdge* hasThreadJoinEdge(const CallICFGNode* call,
|
|
393
|
+
inline ThreadJoinEdge* hasThreadJoinEdge(const CallICFGNode* call, PTACallGraphNode* joinFunNode, PTACallGraphNode* threadRoutineFunNode, CallSiteID csId) const
|
|
394
394
|
{
|
|
395
395
|
ThreadJoinEdge joinEdge(joinFunNode,threadRoutineFunNode, csId);
|
|
396
396
|
CallInstToJoinEdgesMap::const_iterator it = callinstToThreadJoinEdgesMap.find(call);
|