svf-tools 1.0.977 → 1.0.979
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/AbstractInterpretation.h +1 -1
- package/svf/include/DDA/ContextDDA.h +2 -2
- package/svf/include/DDA/DDAVFSolver.h +5 -5
- package/svf/include/DDA/FlowDDA.h +1 -1
- package/svf/include/Graphs/{PTACallGraph.h → CallGraph.h} +41 -41
- package/svf/include/Graphs/ICFG.h +2 -2
- package/svf/include/Graphs/IRGraph.h +1 -1
- package/svf/include/Graphs/ThreadCallGraph.h +24 -32
- package/svf/include/Graphs/VFG.h +4 -4
- package/svf/include/MSSA/MemRegion.h +4 -4
- package/svf/include/MTA/LockAnalysis.h +42 -32
- package/svf/include/MTA/MHP.h +33 -55
- package/svf/include/MTA/MTA.h +0 -3
- package/svf/include/MTA/MTAStat.h +1 -2
- package/svf/include/MTA/TCT.h +43 -25
- package/svf/include/MemoryModel/PointerAnalysis.h +13 -13
- package/svf/include/SABER/SaberCheckerAPI.h +4 -20
- package/svf/include/SABER/SaberSVFGBuilder.h +1 -1
- package/svf/include/SABER/SrcSnkDDA.h +7 -7
- package/svf/include/Util/CallGraphBuilder.h +5 -5
- package/svf/include/Util/CxtStmt.h +13 -12
- package/svf/include/Util/Options.h +1 -20
- package/svf/include/Util/SVFUtil.h +9 -83
- package/svf/include/Util/ThreadAPI.h +42 -85
- package/svf/lib/AE/Svfexe/AbstractInterpretation.cpp +1 -1
- package/svf/lib/CFL/CFLSVFGBuilder.cpp +1 -1
- package/svf/lib/DDA/ContextDDA.cpp +9 -9
- package/svf/lib/DDA/DDAClient.cpp +3 -3
- package/svf/lib/DDA/DDAPass.cpp +4 -4
- package/svf/lib/DDA/FlowDDA.cpp +2 -2
- package/svf/lib/Graphs/{PTACallGraph.cpp → CallGraph.cpp} +66 -66
- package/svf/lib/Graphs/ICFG.cpp +6 -6
- package/svf/lib/Graphs/SVFG.cpp +7 -7
- package/svf/lib/Graphs/SVFGReadWrite.cpp +6 -6
- package/svf/lib/Graphs/SVFGStat.cpp +1 -1
- package/svf/lib/Graphs/ThreadCallGraph.cpp +12 -84
- package/svf/lib/Graphs/VFG.cpp +1 -1
- package/svf/lib/MSSA/MemRegion.cpp +7 -7
- package/svf/lib/MTA/LockAnalysis.cpp +100 -92
- package/svf/lib/MTA/MHP.cpp +159 -138
- package/svf/lib/MTA/MTA.cpp +3 -41
- package/svf/lib/MTA/MTAStat.cpp +7 -33
- package/svf/lib/MTA/TCT.cpp +52 -52
- package/svf/lib/MemoryModel/PointerAnalysis.cpp +12 -12
- package/svf/lib/SABER/LeakChecker.cpp +4 -4
- package/svf/lib/SABER/SaberCondAllocator.cpp +1 -1
- package/svf/lib/SABER/SaberSVFGBuilder.cpp +4 -4
- package/svf/lib/SABER/SrcSnkDDA.cpp +1 -1
- package/svf/lib/Util/CallGraphBuilder.cpp +2 -17
- package/svf/lib/Util/Options.cpp +0 -62
- package/svf/lib/Util/PTAStat.cpp +7 -7
- package/svf/lib/Util/SVFUtil.cpp +4 -4
- package/svf/lib/Util/ThreadAPI.cpp +27 -6
- package/svf/lib/WPA/VersionedFlowSensitive.cpp +2 -2
- package/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +1 -1
- package/svf-llvm/lib/SVFIRBuilder.cpp +5 -5
- package/svf-llvm/lib/SVFIRExtAPI.cpp +0 -26
- package/svf-llvm/tools/AE/ae.cpp +1 -1
- package/svf-llvm/tools/Example/svf-ex.cpp +1 -1
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.979",
|
|
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": {
|
|
@@ -111,7 +111,7 @@ class AbstractInterpretation
|
|
|
111
111
|
|
|
112
112
|
public:
|
|
113
113
|
enum ExtAPIType { UNCLASSIFIED, MEMCPY, MEMSET, STRCPY, STRCAT };
|
|
114
|
-
typedef SCCDetection<
|
|
114
|
+
typedef SCCDetection<CallGraph*> CallGraphSCC;
|
|
115
115
|
/// Constructor
|
|
116
116
|
AbstractInterpretation();
|
|
117
117
|
|
|
@@ -133,8 +133,8 @@ public:
|
|
|
133
133
|
/// Whether call/return inside recursion
|
|
134
134
|
inline virtual bool isEdgeInRecursion(CallSiteID csId)
|
|
135
135
|
{
|
|
136
|
-
const SVFFunction* caller =
|
|
137
|
-
const SVFFunction* callee =
|
|
136
|
+
const SVFFunction* caller = getCallGraph()->getCallerOfCallSite(csId);
|
|
137
|
+
const SVFFunction* callee = getCallGraph()->getCalleeOfCallSite(csId);
|
|
138
138
|
return inSameCallGraphSCC(caller, callee);
|
|
139
139
|
}
|
|
140
140
|
/// Update call graph.
|
|
@@ -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<CallGraph*> CallGraphSCC;
|
|
53
|
+
typedef CallGraphEdge::CallInstSet CallInstSet;
|
|
54
54
|
typedef SVFIR::CallSiteSet CallSiteSet;
|
|
55
55
|
typedef OrderedSet<DPIm> DPTItemSet;
|
|
56
56
|
typedef OrderedMap<DPIm, CPtSet> DPImToCPtSetMap;
|
|
@@ -505,7 +505,7 @@ protected:
|
|
|
505
505
|
{
|
|
506
506
|
CallInstSet csSet;
|
|
507
507
|
/// use pre-analysis call graph to approximate all potential callsites
|
|
508
|
-
_ander->
|
|
508
|
+
_ander->getCallGraph()->getIndCallSitesInvokingCallee(fun,csSet);
|
|
509
509
|
for(CallInstSet::const_iterator it = csSet.begin(), eit = csSet.end(); it!=eit; ++it)
|
|
510
510
|
{
|
|
511
511
|
NodeID funPtr = _pag->getFunPtr(*it);
|
|
@@ -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 (CallGraph* cg)
|
|
628
628
|
{
|
|
629
629
|
_callGraph = cg;
|
|
630
630
|
}
|
|
@@ -775,7 +775,7 @@ protected:
|
|
|
775
775
|
SVFG* _svfg; ///< SVFG
|
|
776
776
|
AndersenWaveDiff* _ander; ///< Andersen's analysis
|
|
777
777
|
NodeBS candidateQueries; ///< candidate pointers;
|
|
778
|
-
|
|
778
|
+
CallGraph* _callGraph; ///< CallGraph
|
|
779
779
|
CallGraphSCC* _callGraphSCC; ///< SCC for CallGraph
|
|
780
780
|
SVFGSCC* _svfgSCC; ///< SCC for SVFG
|
|
781
781
|
DPTItemSet backwardVisited; ///< visited map during backward traversing
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//===-
|
|
1
|
+
//===- CallGraph.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
|
+
* CallGraph.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 CALLGRAPH_H_
|
|
31
|
+
#define CALLGRAPH_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 CallGraphNode;
|
|
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<CallGraphNode> GenericCallGraphEdgeTy;
|
|
51
|
+
class CallGraphEdge : 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
|
+
CallGraphEdge(CallGraphNode* s, CallGraphNode* 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 ~CallGraphEdge()
|
|
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 CallGraphEdge*)
|
|
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() == CallGraphEdge::CallRetEdge ||
|
|
150
|
+
edge->getEdgeKind() == CallGraphEdge::TDForkEdge ||
|
|
151
|
+
edge->getEdgeKind() == CallGraphEdge::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 CallGraphEdge &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<CallGraphNode,CallGraphEdge>::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<CallGraphNode,CallGraphEdge> GenericCallGraphNodeTy;
|
|
174
|
+
class CallGraphNode : public GenericCallGraphNodeTy
|
|
175
175
|
{
|
|
176
176
|
|
|
177
177
|
public:
|
|
178
|
-
typedef
|
|
179
|
-
typedef
|
|
180
|
-
typedef
|
|
178
|
+
typedef CallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet;
|
|
179
|
+
typedef CallGraphEdge::CallGraphEdgeSet::iterator iterator;
|
|
180
|
+
typedef CallGraphEdge::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
|
+
CallGraphNode(NodeID i, const SVFFunction* f) : GenericCallGraphNodeTy(i,0), fun(f)
|
|
188
188
|
{
|
|
189
189
|
|
|
190
190
|
}
|
|
@@ -201,7 +201,7 @@ public:
|
|
|
201
201
|
|
|
202
202
|
/// Overloading operator << for dumping ICFG node ID
|
|
203
203
|
//@{
|
|
204
|
-
friend OutStream& operator<< (OutStream &o, const
|
|
204
|
+
friend OutStream& operator<< (OutStream &o, const CallGraphNode &node)
|
|
205
205
|
{
|
|
206
206
|
o << node.toString();
|
|
207
207
|
return o;
|
|
@@ -214,13 +214,13 @@ public:
|
|
|
214
214
|
/*!
|
|
215
215
|
* Pointer Analysis Call Graph used internally for various pointer analysis
|
|
216
216
|
*/
|
|
217
|
-
typedef GenericGraph<
|
|
218
|
-
class
|
|
217
|
+
typedef GenericGraph<CallGraphNode,CallGraphEdge> GenericCallGraphTy;
|
|
218
|
+
class CallGraph : public GenericCallGraphTy
|
|
219
219
|
{
|
|
220
220
|
|
|
221
221
|
public:
|
|
222
|
-
typedef
|
|
223
|
-
typedef Map<const SVFFunction*,
|
|
222
|
+
typedef CallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet;
|
|
223
|
+
typedef Map<const SVFFunction*, CallGraphNode *> FunToCallGraphNodeMap;
|
|
224
224
|
typedef Map<const CallICFGNode*, CallGraphEdgeSet> CallInstToCallGraphEdgesMap;
|
|
225
225
|
typedef std::pair<const CallICFGNode*, const SVFFunction*> CallSitePair;
|
|
226
226
|
typedef Map<CallSitePair, CallSiteID> CallSiteToIdMap;
|
|
@@ -258,13 +258,13 @@ protected:
|
|
|
258
258
|
|
|
259
259
|
public:
|
|
260
260
|
/// Constructor
|
|
261
|
-
|
|
261
|
+
CallGraph(CGEK k = NormCallGraph);
|
|
262
262
|
|
|
263
263
|
/// Add callgraph Node
|
|
264
264
|
void addCallGraphNode(const SVFFunction* fun);
|
|
265
265
|
|
|
266
266
|
/// Destructor
|
|
267
|
-
virtual ~
|
|
267
|
+
virtual ~CallGraph()
|
|
268
268
|
{
|
|
269
269
|
destroy();
|
|
270
270
|
}
|
|
@@ -312,11 +312,11 @@ public:
|
|
|
312
312
|
|
|
313
313
|
/// Get call graph node
|
|
314
314
|
//@{
|
|
315
|
-
inline
|
|
315
|
+
inline CallGraphNode* getCallGraphNode(NodeID id) const
|
|
316
316
|
{
|
|
317
317
|
return getGNode(id);
|
|
318
318
|
}
|
|
319
|
-
inline
|
|
319
|
+
inline CallGraphNode* getCallGraphNode(const SVFFunction* fun) const
|
|
320
320
|
{
|
|
321
321
|
FunToCallGraphNodeMap::const_iterator it = funToCallGraphNodeMap.find(fun);
|
|
322
322
|
assert(it!=funToCallGraphNodeMap.end() && "call graph node not found!!");
|
|
@@ -374,9 +374,9 @@ public:
|
|
|
374
374
|
}
|
|
375
375
|
//@}
|
|
376
376
|
/// Whether we have already created this call graph edge
|
|
377
|
-
|
|
377
|
+
CallGraphEdge* hasGraphEdge(CallGraphNode* src, CallGraphNode* dst,CallGraphEdge::CEDGEK kind, CallSiteID csId) const;
|
|
378
378
|
/// Get call graph edge via nodes
|
|
379
|
-
|
|
379
|
+
CallGraphEdge* getGraphEdge(CallGraphNode* src, CallGraphNode* dst,CallGraphEdge::CEDGEK kind, CallSiteID csId);
|
|
380
380
|
|
|
381
381
|
/// Get all callees for a callsite
|
|
382
382
|
inline void getCallees(const CallICFGNode* cs, FunctionSet& callees)
|
|
@@ -414,7 +414,7 @@ public:
|
|
|
414
414
|
}
|
|
415
415
|
//@}
|
|
416
416
|
/// Add call graph edge
|
|
417
|
-
inline void addEdge(
|
|
417
|
+
inline void addEdge(CallGraphEdge* edge)
|
|
418
418
|
{
|
|
419
419
|
edge->getDstNode()->addIncomingEdge(edge);
|
|
420
420
|
edge->getSrcNode()->addOutgoingEdge(edge);
|
|
@@ -428,9 +428,9 @@ public:
|
|
|
428
428
|
|
|
429
429
|
/// Get callsites invoking the callee
|
|
430
430
|
//@{
|
|
431
|
-
void getAllCallSitesInvokingCallee(const SVFFunction* callee,
|
|
432
|
-
void getDirCallSitesInvokingCallee(const SVFFunction* callee,
|
|
433
|
-
void getIndCallSitesInvokingCallee(const SVFFunction* callee,
|
|
431
|
+
void getAllCallSitesInvokingCallee(const SVFFunction* callee, CallGraphEdge::CallInstSet& csSet);
|
|
432
|
+
void getDirCallSitesInvokingCallee(const SVFFunction* callee, CallGraphEdge::CallInstSet& csSet);
|
|
433
|
+
void getIndCallSitesInvokingCallee(const SVFFunction* callee, CallGraphEdge::CallInstSet& csSet);
|
|
434
434
|
//@}
|
|
435
435
|
|
|
436
436
|
/// Whether its reachable between two functions
|
|
@@ -451,21 +451,21 @@ namespace SVF
|
|
|
451
451
|
* GenericGraphTraits specializations for generic graph algorithms.
|
|
452
452
|
* Provide graph traits for traversing from a constraint node using standard graph traversals.
|
|
453
453
|
*/
|
|
454
|
-
template<> struct GenericGraphTraits<SVF::
|
|
454
|
+
template<> struct GenericGraphTraits<SVF::CallGraphNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::CallGraphNode,SVF::CallGraphEdge>* >
|
|
455
455
|
{
|
|
456
456
|
};
|
|
457
457
|
|
|
458
458
|
/// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
|
|
459
459
|
template<>
|
|
460
|
-
struct GenericGraphTraits<Inverse<SVF::
|
|
460
|
+
struct GenericGraphTraits<Inverse<SVF::CallGraphNode *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::CallGraphNode,SVF::CallGraphEdge>* > >
|
|
461
461
|
{
|
|
462
462
|
};
|
|
463
463
|
|
|
464
|
-
template<> struct GenericGraphTraits<SVF::
|
|
464
|
+
template<> struct GenericGraphTraits<SVF::CallGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::CallGraphNode,SVF::CallGraphEdge>* >
|
|
465
465
|
{
|
|
466
|
-
typedef SVF::
|
|
466
|
+
typedef SVF::CallGraphNode *NodeRef;
|
|
467
467
|
};
|
|
468
468
|
|
|
469
469
|
} // End namespace llvm
|
|
470
470
|
|
|
471
|
-
#endif /*
|
|
471
|
+
#endif /* CALLGRAPH_H_ */
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
namespace SVF
|
|
39
39
|
{
|
|
40
40
|
|
|
41
|
-
class
|
|
41
|
+
class CallGraph;
|
|
42
42
|
|
|
43
43
|
/*!
|
|
44
44
|
* Interprocedural Control-Flow Graph (ICFG)
|
|
@@ -117,7 +117,7 @@ public:
|
|
|
117
117
|
void view();
|
|
118
118
|
|
|
119
119
|
/// update ICFG for indirect calls
|
|
120
|
-
void updateCallGraph(
|
|
120
|
+
void updateCallGraph(CallGraph* callgraph);
|
|
121
121
|
|
|
122
122
|
/// Whether node is in a loop
|
|
123
123
|
inline bool isInLoop(const ICFGNode *node)
|
|
@@ -61,7 +61,7 @@ protected:
|
|
|
61
61
|
bool fromFile; ///< Whether the SVFIR is built according to user specified data from a txt file
|
|
62
62
|
NodeID nodeNumAfterPAGBuild; ///< initial node number after building SVFIR, excluding later added nodes, e.g., gepobj nodes
|
|
63
63
|
u32_t totalPTAPAGEdge;
|
|
64
|
-
ValueToEdgeMap valueToEdgeMap; ///< Map SVFValues (e.g.,
|
|
64
|
+
ValueToEdgeMap valueToEdgeMap; ///< Map SVFValues (e.g., ICFGNodes) to all corresponding PAGEdges
|
|
65
65
|
SymbolTableInfo* symInfo;
|
|
66
66
|
|
|
67
67
|
/// Add a node into the graph
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
#ifndef RCG_H_
|
|
31
31
|
#define RCG_H_
|
|
32
32
|
|
|
33
|
-
#include "Graphs/
|
|
33
|
+
#include "Graphs/CallGraph.h"
|
|
34
34
|
#include "MemoryModel/PointerAnalysisImpl.h"
|
|
35
35
|
|
|
36
36
|
namespace SVF
|
|
@@ -41,13 +41,13 @@ class ThreadAPI;
|
|
|
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 CallGraphEdge
|
|
45
45
|
{
|
|
46
46
|
|
|
47
47
|
public:
|
|
48
48
|
/// Constructor
|
|
49
|
-
ThreadForkEdge(
|
|
50
|
-
|
|
49
|
+
ThreadForkEdge(CallGraphNode* s, CallGraphNode* d, CallSiteID csId) :
|
|
50
|
+
CallGraphEdge(s, d, CallGraphEdge::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 CallGraphEdge *edge)
|
|
65
65
|
{
|
|
66
|
-
return edge->getEdgeKind() ==
|
|
66
|
+
return edge->getEdgeKind() == CallGraphEdge::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<CallGraphNode, 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 CallGraphEdge
|
|
88
88
|
{
|
|
89
89
|
|
|
90
90
|
public:
|
|
91
91
|
/// Constructor
|
|
92
|
-
ThreadJoinEdge(
|
|
93
|
-
|
|
92
|
+
ThreadJoinEdge(CallGraphNode* s, CallGraphNode* d, CallSiteID csId) :
|
|
93
|
+
CallGraphEdge(s, d, CallGraphEdge::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 CallGraphEdge *edge)
|
|
106
106
|
{
|
|
107
|
-
return edge->getEdgeKind() ==
|
|
107
|
+
return edge->getEdgeKind() == CallGraphEdge::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<CallGraphNode, 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 CallGraphEdge
|
|
128
128
|
{
|
|
129
129
|
|
|
130
130
|
public:
|
|
131
131
|
/// Constructor
|
|
132
|
-
HareParForEdge(
|
|
133
|
-
|
|
132
|
+
HareParForEdge(CallGraphNode* s, CallGraphNode* d, CallSiteID csId) :
|
|
133
|
+
CallGraphEdge(s, d, CallGraphEdge::HareParForEdge, csId)
|
|
134
134
|
{
|
|
135
135
|
}
|
|
136
136
|
/// Destructor
|
|
@@ -144,27 +144,25 @@ public:
|
|
|
144
144
|
{
|
|
145
145
|
return true;
|
|
146
146
|
}
|
|
147
|
-
static inline bool classof(const
|
|
147
|
+
static inline bool classof(const CallGraphEdge *edge)
|
|
148
148
|
{
|
|
149
|
-
return edge->getEdgeKind() ==
|
|
149
|
+
return edge->getEdgeKind() == CallGraphEdge::HareParForEdge;
|
|
150
150
|
}
|
|
151
151
|
//@}
|
|
152
152
|
|
|
153
|
-
typedef GenericNode<
|
|
153
|
+
typedef GenericNode<CallGraphNode, 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 CallGraph
|
|
161
161
|
{
|
|
162
162
|
|
|
163
163
|
public:
|
|
164
164
|
typedef Set<const CallICFGNode*> InstSet;
|
|
165
165
|
typedef InstSet CallSiteSet;
|
|
166
|
-
typedef std::vector<const SVFInstruction*> InstVector;
|
|
167
|
-
typedef Map<const SVFInstruction*, InstSet> CallToInstMap;
|
|
168
166
|
typedef Set<CallSiteSet*> CtxSet;
|
|
169
167
|
typedef ThreadForkEdge::ForkEdgeSet ForkEdgeSet;
|
|
170
168
|
typedef Map<const CallICFGNode*, ForkEdgeSet> CallInstToForkEdgesMap;
|
|
@@ -186,9 +184,9 @@ public:
|
|
|
186
184
|
{
|
|
187
185
|
return true;
|
|
188
186
|
}
|
|
189
|
-
static inline bool classof(const
|
|
187
|
+
static inline bool classof(const CallGraph *g)
|
|
190
188
|
{
|
|
191
|
-
return g->getKind() ==
|
|
189
|
+
return g->getKind() == CallGraph::ThdCallGraph;
|
|
192
190
|
}
|
|
193
191
|
//@}
|
|
194
192
|
|
|
@@ -237,7 +235,7 @@ public:
|
|
|
237
235
|
assert(it != callinstToThreadJoinEdgesMap.end() && "call instruction does not have a valid callee");
|
|
238
236
|
return it->second.end();
|
|
239
237
|
}
|
|
240
|
-
inline void getJoinSites(const
|
|
238
|
+
inline void getJoinSites(const CallGraphNode* routine, InstSet& csSet)
|
|
241
239
|
{
|
|
242
240
|
for(CallInstToJoinEdgesMap::const_iterator it = callinstToThreadJoinEdgesMap.begin(), eit = callinstToThreadJoinEdgesMap.end(); it!=eit; ++it)
|
|
243
241
|
{
|
|
@@ -356,12 +354,6 @@ public:
|
|
|
356
354
|
void addDirectJoinEdge(const CallICFGNode* cs,const CallSiteSet& forksite);
|
|
357
355
|
//@}
|
|
358
356
|
|
|
359
|
-
/// Add direct/indirect parallel for edges
|
|
360
|
-
//@{
|
|
361
|
-
void addDirectParForEdge(const CallICFGNode* cs);
|
|
362
|
-
void addIndirectParForEdge(const CallICFGNode* cs, const SVFFunction* callee);
|
|
363
|
-
//@}
|
|
364
|
-
|
|
365
357
|
|
|
366
358
|
/// map call instruction to its CallGraphEdge map
|
|
367
359
|
inline void addThreadForkEdgeSetMap(const CallICFGNode* cs, ThreadForkEdge* edge)
|
|
@@ -394,7 +386,7 @@ public:
|
|
|
394
386
|
}
|
|
395
387
|
|
|
396
388
|
/// has thread join edge
|
|
397
|
-
inline ThreadJoinEdge* hasThreadJoinEdge(const CallICFGNode* call,
|
|
389
|
+
inline ThreadJoinEdge* hasThreadJoinEdge(const CallICFGNode* call, CallGraphNode* joinFunNode, CallGraphNode* threadRoutineFunNode, CallSiteID csId) const
|
|
398
390
|
{
|
|
399
391
|
ThreadJoinEdge joinEdge(joinFunNode,threadRoutineFunNode, csId);
|
|
400
392
|
CallInstToJoinEdgesMap::const_iterator it = callinstToThreadJoinEdgesMap.find(call);
|
package/svf/include/Graphs/VFG.h
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
#include "SVFIR/SVFIR.h"
|
|
35
|
-
#include "Graphs/
|
|
35
|
+
#include "Graphs/CallGraph.h"
|
|
36
36
|
#include "Graphs/VFGNode.h"
|
|
37
37
|
#include "Graphs/VFGEdge.h"
|
|
38
38
|
|
|
@@ -100,7 +100,7 @@ protected:
|
|
|
100
100
|
FunToVFGNodesMapTy funToVFGNodesMap; ///< map a function to its VFGNodes;
|
|
101
101
|
|
|
102
102
|
GlobalVFGNodeSet globalVFGNodes; ///< set of global store VFG nodes
|
|
103
|
-
|
|
103
|
+
CallGraph* callgraph;
|
|
104
104
|
SVFIR* pag;
|
|
105
105
|
VFGK kind;
|
|
106
106
|
|
|
@@ -109,7 +109,7 @@ protected:
|
|
|
109
109
|
|
|
110
110
|
public:
|
|
111
111
|
/// Constructor
|
|
112
|
-
VFG(
|
|
112
|
+
VFG(CallGraph* callgraph, VFGK k = FULLSVFG);
|
|
113
113
|
|
|
114
114
|
/// Destructor
|
|
115
115
|
virtual ~VFG()
|
|
@@ -136,7 +136,7 @@ public:
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/// Return CallGraph
|
|
139
|
-
inline
|
|
139
|
+
inline CallGraph* getCallGraph() const
|
|
140
140
|
{
|
|
141
141
|
return callgraph;
|
|
142
142
|
}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
#define MEMORYREGION_H_
|
|
36
36
|
|
|
37
37
|
#include "Graphs/ICFG.h"
|
|
38
|
-
#include "Graphs/
|
|
38
|
+
#include "Graphs/CallGraph.h"
|
|
39
39
|
#include "Graphs/SCC.h"
|
|
40
40
|
#include "SVFIR/SVFIR.h"
|
|
41
41
|
#include "Util/WorkList.h"
|
|
@@ -175,7 +175,7 @@ public:
|
|
|
175
175
|
/// SVFIR edge list
|
|
176
176
|
typedef SVFIR::SVFStmtList SVFStmtList;
|
|
177
177
|
/// Call Graph SCC
|
|
178
|
-
typedef SCCDetection<
|
|
178
|
+
typedef SCCDetection<CallGraph*> SCC;
|
|
179
179
|
|
|
180
180
|
MRSet& getMRSet()
|
|
181
181
|
{
|
|
@@ -196,7 +196,7 @@ private:
|
|
|
196
196
|
|
|
197
197
|
BVDataPTAImpl* pta;
|
|
198
198
|
SCC* callGraphSCC;
|
|
199
|
-
|
|
199
|
+
CallGraph* callGraph;
|
|
200
200
|
bool ptrOnlyMSSA;
|
|
201
201
|
|
|
202
202
|
/// Map a function to all its memory regions
|
|
@@ -330,7 +330,7 @@ protected:
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
/// Mod-Ref analysis for callsite invoking this callGraphNode
|
|
333
|
-
virtual void modRefAnalysis(
|
|
333
|
+
virtual void modRefAnalysis(CallGraphNode* callGraphNode, WorkList& worklist);
|
|
334
334
|
|
|
335
335
|
/// Get Mod-Ref of a callee function
|
|
336
336
|
virtual bool handleCallsiteModRef(NodeBS& mod, NodeBS& ref, const CallICFGNode* cs, const SVFFunction* fun);
|