svf-lib 1.0.2207 → 1.0.2209
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 +2 -2
- package/SVF-linux/Release-build/include/Graphs/PTACallGraph.h +9 -1
- package/SVF-linux/Release-build/include/Graphs/ThreadCallGraph.h +1 -1
- package/SVF-linux/Release-build/include/SVF-LLVM/LLVMModule.h +1 -12
- package/SVF-linux/Release-build/include/SVFIR/SVFIR.h +11 -12
- package/SVF-linux/Release-build/include/SVFIR/SVFValue.h +0 -10
- package/SVF-linux/Release-build/include/SVFIR/SVFVariables.h +13 -13
- package/SVF-linux/Release-build/include/Util/CallGraphBuilder.h +1 -1
- 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 +4 -4
- package/SVF-osx/Release-build/include/Graphs/{PTACallGraph.h → CallGraph.h} +38 -38
- package/SVF-osx/Release-build/include/Graphs/ICFG.h +2 -2
- package/SVF-osx/Release-build/include/Graphs/ThreadCallGraph.h +25 -25
- package/SVF-osx/Release-build/include/Graphs/VFG.h +4 -4
- 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 +5 -5
- 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 +3 -3
- 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
- package/SVF-linux/Release-build/include/Graphs/CallGraph.h +0 -266
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -251,8 +251,8 @@ private:
|
|
|
251
251
|
AEStat* stat;
|
|
252
252
|
|
|
253
253
|
std::vector<const CallICFGNode*> callSiteStack;
|
|
254
|
-
Map<const
|
|
255
|
-
Set<const
|
|
254
|
+
Map<const SVFFunction*, ICFGWTO*> funcToWTO;
|
|
255
|
+
Set<const SVFFunction*> recursiveFuns;
|
|
256
256
|
|
|
257
257
|
|
|
258
258
|
AbstractState& getAbsStateFromTrace(const ICFGNode* node)
|
|
@@ -302,7 +302,7 @@ public:
|
|
|
302
302
|
PTACallGraph(CGEK k = NormCallGraph);
|
|
303
303
|
|
|
304
304
|
/// Copy constructor
|
|
305
|
-
PTACallGraph(const
|
|
305
|
+
PTACallGraph(const PTACallGraph& other);
|
|
306
306
|
|
|
307
307
|
/// Destructor
|
|
308
308
|
virtual ~PTACallGraph()
|
|
@@ -351,8 +351,16 @@ public:
|
|
|
351
351
|
/// Issue a warning if the function which has indirect call sites can not be reached from program entry.
|
|
352
352
|
void verifyCallGraph();
|
|
353
353
|
|
|
354
|
+
/// Add direct call edges
|
|
355
|
+
void addDirectCallGraphEdge(const CallICFGNode* call, const SVFFunction* callerFun, const SVFFunction* calleeFun);
|
|
356
|
+
|
|
357
|
+
void addCallGraphNode(const SVFFunction* fun);
|
|
358
|
+
|
|
354
359
|
/// Get call graph node
|
|
355
360
|
//@{
|
|
361
|
+
|
|
362
|
+
const PTACallGraphNode* getCallGraphNode(const std::string& name);
|
|
363
|
+
|
|
356
364
|
inline PTACallGraphNode* getCallGraphNode(NodeID id) const
|
|
357
365
|
{
|
|
358
366
|
return getGNode(id);
|
|
@@ -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
|
|
|
@@ -55,7 +55,6 @@ public:
|
|
|
55
55
|
typedef Map<const GlobalVariable*, GlobalVariable*> GlobalDefToRepMapTy;
|
|
56
56
|
|
|
57
57
|
typedef Map<const Function*, SVFFunction*> LLVMFun2SVFFunMap;
|
|
58
|
-
typedef Map<const Function*, CallGraphNode*> LLVMFun2CallGraphNodeMap;
|
|
59
58
|
typedef Map<const BasicBlock*, SVFBasicBlock*> LLVMBB2SVFBBMap;
|
|
60
59
|
typedef Map<const Instruction*, SVFInstruction*> LLVMInst2SVFInstMap;
|
|
61
60
|
typedef Map<const Argument*, SVFArgument*> LLVMArgument2SVFArgumentMap;
|
|
@@ -95,7 +94,6 @@ private:
|
|
|
95
94
|
GlobalDefToRepMapTy GlobalDefToRepMap;
|
|
96
95
|
|
|
97
96
|
LLVMFun2SVFFunMap LLVMFunc2SVFFunc; ///< Map an LLVM Function to an SVF Function
|
|
98
|
-
LLVMFun2CallGraphNodeMap LLVMFunc2CallGraphNode; ///< Map an LLVM Function to an CallGraph Node
|
|
99
97
|
LLVMBB2SVFBBMap LLVMBB2SVFBB;
|
|
100
98
|
LLVMInst2SVFInstMap LLVMInst2SVFInst;
|
|
101
99
|
LLVMArgument2SVFArgumentMap LLVMArgument2SVFArgument;
|
|
@@ -112,7 +110,7 @@ private:
|
|
|
112
110
|
InstToBlockNodeMapTy InstToBlockNodeMap; ///< map a basic block to its ICFGNode
|
|
113
111
|
FunToFunEntryNodeMapTy FunToFunEntryNodeMap; ///< map a function to its FunExitICFGNode
|
|
114
112
|
FunToFunExitNodeMapTy FunToFunExitNodeMap; ///< map a function to its FunEntryICFGNode
|
|
115
|
-
|
|
113
|
+
PTACallGraph* callgraph;
|
|
116
114
|
|
|
117
115
|
Map<const Function*, DominatorTree> FunToDominatorTree;
|
|
118
116
|
|
|
@@ -218,8 +216,6 @@ public:
|
|
|
218
216
|
setValueAttr(func,svfFunc);
|
|
219
217
|
}
|
|
220
218
|
|
|
221
|
-
void addFunctionMap(const Function* func, CallGraphNode* svfFunc);
|
|
222
|
-
|
|
223
219
|
// create a SVFBasicBlock according to LLVM BasicBlock, then add it to SVFFunction's BasicBlockGraph
|
|
224
220
|
inline void addBasicBlock(SVFFunction* fun, const BasicBlock* bb)
|
|
225
221
|
{
|
|
@@ -296,13 +292,6 @@ public:
|
|
|
296
292
|
return it->second;
|
|
297
293
|
}
|
|
298
294
|
|
|
299
|
-
inline CallGraphNode* getCallGraphNode(const Function* fun) const
|
|
300
|
-
{
|
|
301
|
-
LLVMFun2CallGraphNodeMap::const_iterator it = LLVMFunc2CallGraphNode.find(fun);
|
|
302
|
-
assert(it!=LLVMFunc2CallGraphNode.end() && "SVF Function not found!");
|
|
303
|
-
return it->second;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
295
|
inline SVFFunction* getSVFFunction(const Function* fun) const
|
|
307
296
|
{
|
|
308
297
|
LLVMFun2SVFFunMap::const_iterator it = LLVMFunc2SVFFunc.find(fun);
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
namespace SVF
|
|
36
36
|
{
|
|
37
37
|
class CommonCHGraph;
|
|
38
|
-
class CallGraph;
|
|
39
38
|
/*!
|
|
40
39
|
* SVF Intermediate representation, representing variables and statements as a Program Assignment Graph (PAG)
|
|
41
40
|
* Variables as nodes and statements as edges.
|
|
@@ -62,7 +61,7 @@ public:
|
|
|
62
61
|
typedef Map<const CallICFGNode*,SVFVarList> CSToArgsListMap;
|
|
63
62
|
typedef Map<const RetICFGNode*,const SVFVar*> CSToRetMap;
|
|
64
63
|
typedef Map<const SVFFunction*,const SVFVar*> FunToRetMap;
|
|
65
|
-
typedef Map<const
|
|
64
|
+
typedef Map<const SVFFunction*,const FunObjVar *> FunToFunObjVarMap;
|
|
66
65
|
typedef Map<const SVFFunction*,SVFStmtSet> FunToPAGEdgeSetMap;
|
|
67
66
|
typedef Map<const ICFGNode*,SVFStmtList> ICFGNode2SVFStmtsMap;
|
|
68
67
|
typedef Map<NodeID, NodeID> NodeToNodeMap;
|
|
@@ -100,7 +99,7 @@ private:
|
|
|
100
99
|
ICFG* icfg; // ICFG
|
|
101
100
|
CommonCHGraph* chgraph; // class hierarchy graph
|
|
102
101
|
CallSiteSet callSiteSet; /// all the callsites of a program
|
|
103
|
-
|
|
102
|
+
PTACallGraph* callGraph; /// call graph
|
|
104
103
|
|
|
105
104
|
static std::unique_ptr<SVFIR> pag; ///< Singleton pattern here to enable instance of SVFIR can only be created once.
|
|
106
105
|
|
|
@@ -187,11 +186,11 @@ public:
|
|
|
187
186
|
}
|
|
188
187
|
|
|
189
188
|
/// Set/Get CG
|
|
190
|
-
inline void setCallGraph(
|
|
189
|
+
inline void setCallGraph(PTACallGraph* c)
|
|
191
190
|
{
|
|
192
191
|
callGraph = c;
|
|
193
192
|
}
|
|
194
|
-
inline
|
|
193
|
+
inline PTACallGraph* getCallGraph()
|
|
195
194
|
{
|
|
196
195
|
assert(callGraph && "empty CallGraph! Build SVF IR first!");
|
|
197
196
|
return callGraph;
|
|
@@ -331,7 +330,7 @@ public:
|
|
|
331
330
|
}
|
|
332
331
|
//@}
|
|
333
332
|
|
|
334
|
-
inline const FunObjVar* getFunObjVar(const
|
|
333
|
+
inline const FunObjVar* getFunObjVar(const SVFFunction* node) const
|
|
335
334
|
{
|
|
336
335
|
FunToFunObjVarMap::const_iterator it = funToFunObjvarMap.find(node);
|
|
337
336
|
assert(it != funToFunObjvarMap.end() && "this function doesn't have funobjvar");
|
|
@@ -547,13 +546,13 @@ private:
|
|
|
547
546
|
return addValNode(node);
|
|
548
547
|
}
|
|
549
548
|
|
|
550
|
-
NodeID addFunValNode(NodeID i, const ICFGNode* icfgNode, const
|
|
549
|
+
NodeID addFunValNode(NodeID i, const ICFGNode* icfgNode, const SVFFunction* callGraphNode, const SVFType* type)
|
|
551
550
|
{
|
|
552
551
|
FunValVar* node = new FunValVar(i, icfgNode, callGraphNode, type);
|
|
553
552
|
return addValNode(node);
|
|
554
553
|
}
|
|
555
554
|
|
|
556
|
-
NodeID addArgValNode(NodeID i, u32_t argNo, const ICFGNode* icfgNode, const
|
|
555
|
+
NodeID addArgValNode(NodeID i, u32_t argNo, const ICFGNode* icfgNode, const SVFFunction* callGraphNode, const SVFType* type)
|
|
557
556
|
{
|
|
558
557
|
ArgValVar* node =
|
|
559
558
|
new ArgValVar(i, argNo, icfgNode, callGraphNode, type);
|
|
@@ -625,7 +624,7 @@ private:
|
|
|
625
624
|
return addObjNode(stackObj);
|
|
626
625
|
}
|
|
627
626
|
|
|
628
|
-
NodeID addFunObjNode(NodeID id, ObjTypeInfo* ti, const
|
|
627
|
+
NodeID addFunObjNode(NodeID id, ObjTypeInfo* ti, const SVFFunction* callGraphNode, const SVFType* type, const ICFGNode* node)
|
|
629
628
|
{
|
|
630
629
|
memToFieldsMap[id].set(id);
|
|
631
630
|
FunObjVar* funObj = new FunObjVar(id, ti, callGraphNode, type, node);
|
|
@@ -678,13 +677,13 @@ private:
|
|
|
678
677
|
}
|
|
679
678
|
|
|
680
679
|
/// Add a unique return node for a procedure
|
|
681
|
-
inline NodeID addRetNode(NodeID i, const
|
|
680
|
+
inline NodeID addRetNode(NodeID i, const SVFFunction* callGraphNode, const SVFType* type, const ICFGNode* icn)
|
|
682
681
|
{
|
|
683
682
|
SVFVar *node = new RetValPN(i, callGraphNode, type, icn);
|
|
684
683
|
return addRetNode(callGraphNode, node);
|
|
685
684
|
}
|
|
686
685
|
/// Add a unique vararg node for a procedure
|
|
687
|
-
inline NodeID addVarargNode(NodeID i, const
|
|
686
|
+
inline NodeID addVarargNode(NodeID i, const SVFFunction* val, const SVFType* type, const ICFGNode* n)
|
|
688
687
|
{
|
|
689
688
|
SVFVar *node = new VarArgValPN(i, val, type, n);
|
|
690
689
|
return addNode(node);
|
|
@@ -758,7 +757,7 @@ private:
|
|
|
758
757
|
return addNode(node);
|
|
759
758
|
}
|
|
760
759
|
/// Add a unique return node for a procedure
|
|
761
|
-
inline NodeID addRetNode(const
|
|
760
|
+
inline NodeID addRetNode(const SVFFunction*, SVFVar *node)
|
|
762
761
|
{
|
|
763
762
|
return addNode(node);
|
|
764
763
|
}
|
|
@@ -320,14 +320,9 @@ private:
|
|
|
320
320
|
const SVFFunction* realDefFun; /// the definition of a function across multiple modules
|
|
321
321
|
std::vector<const ArgValVar*> allArgs; /// all formal arguments of this function
|
|
322
322
|
SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
|
|
323
|
-
const CallGraphNode *callGraphNode; /// call graph node for this function
|
|
324
323
|
BasicBlockGraph* bbGraph; /// the basic block graph of this function
|
|
325
324
|
|
|
326
325
|
protected:
|
|
327
|
-
inline void setCallGraphNode(CallGraphNode *cgn)
|
|
328
|
-
{
|
|
329
|
-
callGraphNode = cgn;
|
|
330
|
-
}
|
|
331
326
|
|
|
332
327
|
inline void addArgument(const ArgValVar* arg)
|
|
333
328
|
{
|
|
@@ -355,11 +350,6 @@ public:
|
|
|
355
350
|
SVFFunction(void) = delete;
|
|
356
351
|
virtual ~SVFFunction();
|
|
357
352
|
|
|
358
|
-
inline const CallGraphNode* getCallGraphNode() const
|
|
359
|
-
{
|
|
360
|
-
return callGraphNode;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
353
|
static inline bool classof(const SVFValue *node)
|
|
364
354
|
{
|
|
365
355
|
return node->getKind() == SVFFunc;
|
|
@@ -366,7 +366,7 @@ class ArgValVar: public ValVar
|
|
|
366
366
|
friend class SVFIRReader;
|
|
367
367
|
|
|
368
368
|
private:
|
|
369
|
-
const
|
|
369
|
+
const SVFFunction* cgNode;
|
|
370
370
|
u32_t argNo;
|
|
371
371
|
|
|
372
372
|
protected:
|
|
@@ -399,7 +399,7 @@ public:
|
|
|
399
399
|
//@}
|
|
400
400
|
|
|
401
401
|
/// Constructor
|
|
402
|
-
ArgValVar(NodeID i, u32_t argNo, const ICFGNode* icn, const
|
|
402
|
+
ArgValVar(NodeID i, u32_t argNo, const ICFGNode* icn, const SVFFunction* callGraphNode,
|
|
403
403
|
const SVFType* svfType);
|
|
404
404
|
|
|
405
405
|
/// Return name of a LLVM value
|
|
@@ -968,7 +968,7 @@ class FunValVar : public ValVar
|
|
|
968
968
|
friend class SVFIRWriter;
|
|
969
969
|
friend class SVFIRReader;
|
|
970
970
|
private:
|
|
971
|
-
const
|
|
971
|
+
const SVFFunction* callGraphNode;
|
|
972
972
|
|
|
973
973
|
public:
|
|
974
974
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -995,13 +995,13 @@ public:
|
|
|
995
995
|
}
|
|
996
996
|
//@}
|
|
997
997
|
|
|
998
|
-
inline const
|
|
998
|
+
inline virtual const SVFFunction* getFunction() const
|
|
999
999
|
{
|
|
1000
1000
|
return callGraphNode;
|
|
1001
1001
|
}
|
|
1002
1002
|
|
|
1003
1003
|
/// Constructor
|
|
1004
|
-
FunValVar(NodeID i, const ICFGNode* icn, const
|
|
1004
|
+
FunValVar(NodeID i, const ICFGNode* icn, const SVFFunction* cgn, const SVFType* svfType);
|
|
1005
1005
|
|
|
1006
1006
|
|
|
1007
1007
|
virtual bool isPointer() const
|
|
@@ -1018,7 +1018,7 @@ class FunObjVar : public BaseObjVar
|
|
|
1018
1018
|
friend class SVFIRReader;
|
|
1019
1019
|
|
|
1020
1020
|
private:
|
|
1021
|
-
const
|
|
1021
|
+
const SVFFunction* callGraphNode;
|
|
1022
1022
|
|
|
1023
1023
|
private:
|
|
1024
1024
|
/// Constructor to create empty ObjVar (for SVFIRReader/deserialization)
|
|
@@ -1054,9 +1054,9 @@ public:
|
|
|
1054
1054
|
//@}
|
|
1055
1055
|
|
|
1056
1056
|
/// Constructor
|
|
1057
|
-
FunObjVar(NodeID i, ObjTypeInfo* ti, const
|
|
1057
|
+
FunObjVar(NodeID i, ObjTypeInfo* ti, const SVFFunction* cgNode, const SVFType* svfType, const ICFGNode* node);
|
|
1058
1058
|
|
|
1059
|
-
inline const
|
|
1059
|
+
inline const SVFFunction* getCallGraphNode() const
|
|
1060
1060
|
{
|
|
1061
1061
|
return callGraphNode;
|
|
1062
1062
|
}
|
|
@@ -1782,7 +1782,7 @@ class RetValPN : public ValVar
|
|
|
1782
1782
|
friend class SVFIRReader;
|
|
1783
1783
|
|
|
1784
1784
|
private:
|
|
1785
|
-
const
|
|
1785
|
+
const SVFFunction* callGraphNode;
|
|
1786
1786
|
private:
|
|
1787
1787
|
/// Constructor to create empty RetValPN (for SVFIRReader/deserialization)
|
|
1788
1788
|
RetValPN(NodeID i) : ValVar(i, RetValNode) {}
|
|
@@ -1813,9 +1813,9 @@ public:
|
|
|
1813
1813
|
|
|
1814
1814
|
|
|
1815
1815
|
/// Constructor
|
|
1816
|
-
RetValPN(NodeID i, const
|
|
1816
|
+
RetValPN(NodeID i, const SVFFunction* node, const SVFType* svfType, const ICFGNode* icn);
|
|
1817
1817
|
|
|
1818
|
-
inline const
|
|
1818
|
+
inline const SVFFunction* getCallGraphNode() const
|
|
1819
1819
|
{
|
|
1820
1820
|
return callGraphNode;
|
|
1821
1821
|
}
|
|
@@ -1838,7 +1838,7 @@ class VarArgValPN : public ValVar
|
|
|
1838
1838
|
friend class SVFIRWriter;
|
|
1839
1839
|
friend class SVFIRReader;
|
|
1840
1840
|
private:
|
|
1841
|
-
const
|
|
1841
|
+
const SVFFunction* callGraphNode;
|
|
1842
1842
|
|
|
1843
1843
|
private:
|
|
1844
1844
|
/// Constructor to create empty VarArgValPN (for SVFIRReader/deserialization)
|
|
@@ -1869,7 +1869,7 @@ public:
|
|
|
1869
1869
|
//@}
|
|
1870
1870
|
|
|
1871
1871
|
/// Constructor
|
|
1872
|
-
VarArgValPN(NodeID i, const
|
|
1872
|
+
VarArgValPN(NodeID i, const SVFFunction* node, const SVFType* svfType, const ICFGNode* icn)
|
|
1873
1873
|
: ValVar(i, svfType, icn, VarargValNode), callGraphNode(node)
|
|
1874
1874
|
{
|
|
1875
1875
|
}
|
|
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<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;
|
|
@@ -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
|
}
|
|
@@ -774,7 +774,7 @@ protected:
|
|
|
774
774
|
SVFG* _svfg; ///< SVFG
|
|
775
775
|
AndersenWaveDiff* _ander; ///< Andersen's analysis
|
|
776
776
|
NodeBS candidateQueries; ///< candidate pointers;
|
|
777
|
-
|
|
777
|
+
CallGraph* _callGraph; ///< PTACallGraph
|
|
778
778
|
CallGraphSCC* _callGraphSCC; ///< SCC for PTACallGraph
|
|
779
779
|
SVFGSCC* _svfgSCC; ///< SCC for SVFG
|
|
780
780
|
DPTItemSet backwardVisited; ///< visited map during backward traversing
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
namespace SVF
|
|
39
39
|
{
|
|
40
40
|
|
|
41
|
-
class
|
|
41
|
+
class CallGraphNode;
|
|
42
42
|
class SVFModule;
|
|
43
43
|
class CallGraph;
|
|
44
44
|
|
|
@@ -48,8 +48,8 @@ class CallGraph;
|
|
|
48
48
|
* Multiple calls from function A to B are merged into one call edge
|
|
49
49
|
* Each call edge has a set of direct callsites and a set of indirect callsites
|
|
50
50
|
*/
|
|
51
|
-
typedef GenericEdge<
|
|
52
|
-
class
|
|
51
|
+
typedef GenericEdge<CallGraphNode> GenericPTACallGraphEdgeTy;
|
|
52
|
+
class CallGraphEdge : public GenericPTACallGraphEdgeTy
|
|
53
53
|
{
|
|
54
54
|
|
|
55
55
|
public:
|
|
@@ -66,12 +66,12 @@ private:
|
|
|
66
66
|
CallSiteID csId;
|
|
67
67
|
public:
|
|
68
68
|
/// Constructor
|
|
69
|
-
|
|
69
|
+
CallGraphEdge(CallGraphNode* s, CallGraphNode* d, CEDGEK kind, CallSiteID cs) :
|
|
70
70
|
GenericPTACallGraphEdgeTy(s, d, makeEdgeFlagWithInvokeID(kind, cs)), csId(cs)
|
|
71
71
|
{
|
|
72
72
|
}
|
|
73
73
|
/// Destructor
|
|
74
|
-
virtual ~
|
|
74
|
+
virtual ~CallGraphEdge()
|
|
75
75
|
{
|
|
76
76
|
}
|
|
77
77
|
/// Compute the unique edgeFlag value from edge kind and CallSiteID.
|
|
@@ -141,21 +141,21 @@ public:
|
|
|
141
141
|
|
|
142
142
|
/// ClassOf
|
|
143
143
|
//@{
|
|
144
|
-
static inline bool classof(const
|
|
144
|
+
static inline bool classof(const CallGraphEdge*)
|
|
145
145
|
{
|
|
146
146
|
return true;
|
|
147
147
|
}
|
|
148
148
|
static inline bool classof(const GenericPTACallGraphEdgeTy *edge)
|
|
149
149
|
{
|
|
150
|
-
return edge->getEdgeKind() ==
|
|
151
|
-
edge->getEdgeKind() ==
|
|
152
|
-
edge->getEdgeKind() ==
|
|
150
|
+
return edge->getEdgeKind() == CallGraphEdge::CallRetEdge ||
|
|
151
|
+
edge->getEdgeKind() == CallGraphEdge::TDForkEdge ||
|
|
152
|
+
edge->getEdgeKind() == CallGraphEdge::TDJoinEdge;
|
|
153
153
|
}
|
|
154
154
|
//@}
|
|
155
155
|
|
|
156
156
|
/// Overloading operator << for dumping ICFG node ID
|
|
157
157
|
//@{
|
|
158
|
-
friend OutStream& operator<< (OutStream &o, const
|
|
158
|
+
friend OutStream& operator<< (OutStream &o, const CallGraphEdge&edge)
|
|
159
159
|
{
|
|
160
160
|
o << edge.toString();
|
|
161
161
|
return o;
|
|
@@ -164,22 +164,22 @@ public:
|
|
|
164
164
|
|
|
165
165
|
virtual const std::string toString() const;
|
|
166
166
|
|
|
167
|
-
typedef GenericNode<
|
|
167
|
+
typedef GenericNode<CallGraphNode, CallGraphEdge>::GEdgeSetTy CallGraphEdgeSet;
|
|
168
168
|
|
|
169
169
|
};
|
|
170
170
|
|
|
171
171
|
/*
|
|
172
172
|
* Call Graph node representing a function
|
|
173
173
|
*/
|
|
174
|
-
typedef GenericNode<
|
|
175
|
-
class
|
|
174
|
+
typedef GenericNode<CallGraphNode, CallGraphEdge> GenericPTACallGraphNodeTy;
|
|
175
|
+
class CallGraphNode : public GenericPTACallGraphNodeTy
|
|
176
176
|
{
|
|
177
177
|
private:
|
|
178
178
|
const SVFFunction* fun;
|
|
179
179
|
|
|
180
180
|
public:
|
|
181
181
|
/// Constructor
|
|
182
|
-
|
|
182
|
+
CallGraphNode(NodeID i, const SVFFunction* f) : GenericPTACallGraphNodeTy(i,CallNodeKd), fun(f)
|
|
183
183
|
{
|
|
184
184
|
|
|
185
185
|
}
|
|
@@ -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;
|
|
@@ -212,7 +212,7 @@ public:
|
|
|
212
212
|
|
|
213
213
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
214
214
|
//@{
|
|
215
|
-
static inline bool classof(const
|
|
215
|
+
static inline bool classof(const CallGraphNode*)
|
|
216
216
|
{
|
|
217
217
|
return true;
|
|
218
218
|
}
|
|
@@ -232,13 +232,13 @@ public:
|
|
|
232
232
|
/*!
|
|
233
233
|
* Pointer Analysis Call Graph used internally for various pointer analysis
|
|
234
234
|
*/
|
|
235
|
-
typedef GenericGraph<
|
|
236
|
-
class
|
|
235
|
+
typedef GenericGraph<CallGraphNode, CallGraphEdge> GenericPTACallGraphTy;
|
|
236
|
+
class CallGraph : public GenericPTACallGraphTy
|
|
237
237
|
{
|
|
238
238
|
|
|
239
239
|
public:
|
|
240
|
-
typedef
|
|
241
|
-
typedef Map<const SVFFunction*,
|
|
240
|
+
typedef CallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet;
|
|
241
|
+
typedef Map<const SVFFunction*, CallGraphNode*> FunToCallGraphNodeMap;
|
|
242
242
|
typedef Map<const CallICFGNode*, CallGraphEdgeSet> CallInstToCallGraphEdgesMap;
|
|
243
243
|
typedef std::pair<const CallICFGNode*, const SVFFunction*> CallSitePair;
|
|
244
244
|
typedef Map<CallSitePair, CallSiteID> CallSiteToIdMap;
|
|
@@ -291,7 +291,7 @@ protected:
|
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
/// Add call graph edge
|
|
294
|
-
inline void addEdge(
|
|
294
|
+
inline void addEdge(CallGraphEdge* edge)
|
|
295
295
|
{
|
|
296
296
|
edge->getDstNode()->addIncomingEdge(edge);
|
|
297
297
|
edge->getSrcNode()->addOutgoingEdge(edge);
|
|
@@ -299,13 +299,13 @@ protected:
|
|
|
299
299
|
|
|
300
300
|
public:
|
|
301
301
|
/// Constructor
|
|
302
|
-
|
|
302
|
+
CallGraph(CGEK k = NormCallGraph);
|
|
303
303
|
|
|
304
304
|
/// Copy constructor
|
|
305
|
-
|
|
305
|
+
CallGraph(const CallGraph& other);
|
|
306
306
|
|
|
307
307
|
/// Destructor
|
|
308
|
-
virtual ~
|
|
308
|
+
virtual ~CallGraph()
|
|
309
309
|
{
|
|
310
310
|
destroy();
|
|
311
311
|
}
|
|
@@ -359,13 +359,13 @@ public:
|
|
|
359
359
|
/// Get call graph node
|
|
360
360
|
//@{
|
|
361
361
|
|
|
362
|
-
const
|
|
362
|
+
const CallGraphNode* getCallGraphNode(const std::string& name);
|
|
363
363
|
|
|
364
|
-
inline
|
|
364
|
+
inline CallGraphNode* getCallGraphNode(NodeID id) const
|
|
365
365
|
{
|
|
366
366
|
return getGNode(id);
|
|
367
367
|
}
|
|
368
|
-
inline
|
|
368
|
+
inline CallGraphNode* getCallGraphNode(const SVFFunction* fun) const
|
|
369
369
|
{
|
|
370
370
|
FunToCallGraphNodeMap::const_iterator it = funToCallGraphNodeMap.find(fun);
|
|
371
371
|
assert(it!=funToCallGraphNodeMap.end() && "call graph node not found!!");
|
|
@@ -409,11 +409,11 @@ public:
|
|
|
409
409
|
}
|
|
410
410
|
//@}
|
|
411
411
|
/// Whether we have already created this call graph edge
|
|
412
|
-
|
|
413
|
-
|
|
412
|
+
CallGraphEdge* hasGraphEdge(CallGraphNode* src, CallGraphNode* dst,
|
|
413
|
+
CallGraphEdge::CEDGEK kind, CallSiteID csId) const;
|
|
414
414
|
/// Get call graph edge via nodes
|
|
415
|
-
|
|
416
|
-
|
|
415
|
+
CallGraphEdge* getGraphEdge(CallGraphNode* src, CallGraphNode* dst,
|
|
416
|
+
CallGraphEdge::CEDGEK kind, CallSiteID csId);
|
|
417
417
|
|
|
418
418
|
/// Get all callees for a callsite
|
|
419
419
|
inline void getCallees(const CallICFGNode* cs, FunctionSet& callees)
|
|
@@ -459,9 +459,9 @@ public:
|
|
|
459
459
|
|
|
460
460
|
/// Get callsites invoking the callee
|
|
461
461
|
//@{
|
|
462
|
-
void getAllCallSitesInvokingCallee(const SVFFunction* callee,
|
|
463
|
-
void getDirCallSitesInvokingCallee(const SVFFunction* callee,
|
|
464
|
-
void getIndCallSitesInvokingCallee(const SVFFunction* callee,
|
|
462
|
+
void getAllCallSitesInvokingCallee(const SVFFunction* callee, CallGraphEdge::CallInstSet& csSet);
|
|
463
|
+
void getDirCallSitesInvokingCallee(const SVFFunction* callee, CallGraphEdge::CallInstSet& csSet);
|
|
464
|
+
void getIndCallSitesInvokingCallee(const SVFFunction* callee, CallGraphEdge::CallInstSet& csSet);
|
|
465
465
|
//@}
|
|
466
466
|
|
|
467
467
|
/// Whether its reachable between two functions
|
|
@@ -482,19 +482,19 @@ namespace SVF
|
|
|
482
482
|
* GenericGraphTraits specializations for generic graph algorithms.
|
|
483
483
|
* Provide graph traits for traversing from a constraint node using standard graph traversals.
|
|
484
484
|
*/
|
|
485
|
-
template<> struct GenericGraphTraits<SVF::
|
|
485
|
+
template<> struct GenericGraphTraits<SVF::CallGraphNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::CallGraphNode,SVF::CallGraphEdge>* >
|
|
486
486
|
{
|
|
487
487
|
};
|
|
488
488
|
|
|
489
489
|
/// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
|
|
490
490
|
template<>
|
|
491
|
-
struct GenericGraphTraits<Inverse<SVF::
|
|
491
|
+
struct GenericGraphTraits<Inverse<SVF::CallGraphNode*> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::CallGraphNode,SVF::CallGraphEdge>* > >
|
|
492
492
|
{
|
|
493
493
|
};
|
|
494
494
|
|
|
495
|
-
template<> struct GenericGraphTraits<SVF::
|
|
495
|
+
template<> struct GenericGraphTraits<SVF::CallGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::CallGraphNode,SVF::CallGraphEdge>* >
|
|
496
496
|
{
|
|
497
|
-
typedef SVF::
|
|
497
|
+
typedef SVF::CallGraphNode*NodeRef;
|
|
498
498
|
};
|
|
499
499
|
|
|
500
500
|
} // End namespace llvm
|
|
@@ -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)
|
|
@@ -111,7 +111,7 @@ public:
|
|
|
111
111
|
void view();
|
|
112
112
|
|
|
113
113
|
/// update ICFG for indirect calls
|
|
114
|
-
void updateCallGraph(
|
|
114
|
+
void updateCallGraph(CallGraph* callgraph);
|
|
115
115
|
|
|
116
116
|
/// Whether node is in a loop
|
|
117
117
|
inline bool isInLoop(const ICFGNode *node)
|