svf-lib 1.0.2211 → 1.0.2213
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/CFL/CFLAlias.h +1 -1
- package/SVF-linux/Release-build/include/DDA/ContextDDA.h +6 -6
- package/SVF-linux/Release-build/include/DDA/DDAVFSolver.h +2 -2
- package/SVF-linux/Release-build/include/DDA/FlowDDA.h +2 -2
- package/SVF-linux/Release-build/include/Graphs/BasicBlockG.h +17 -9
- package/SVF-linux/Release-build/include/Graphs/CHG.h +7 -7
- package/SVF-linux/Release-build/include/Graphs/CallGraph.h +23 -27
- package/SVF-linux/Release-build/include/Graphs/ConsG.h +2 -2
- package/SVF-linux/Release-build/include/Graphs/ICFG.h +11 -11
- package/SVF-linux/Release-build/include/Graphs/ICFGNode.h +12 -18
- package/SVF-linux/Release-build/include/Graphs/IRGraph.h +11 -9
- package/SVF-linux/Release-build/include/Graphs/SVFG.h +13 -13
- package/SVF-linux/Release-build/include/Graphs/SVFGNode.h +2 -2
- package/SVF-linux/Release-build/include/Graphs/ThreadCallGraph.h +3 -21
- package/SVF-linux/Release-build/include/Graphs/VFG.h +15 -15
- package/SVF-linux/Release-build/include/Graphs/VFGNode.h +10 -10
- package/SVF-linux/Release-build/include/MSSA/MSSAMuChi.h +6 -6
- package/SVF-linux/Release-build/include/MSSA/MemPartition.h +12 -12
- package/SVF-linux/Release-build/include/MSSA/MemRegion.h +21 -21
- package/SVF-linux/Release-build/include/MSSA/MemSSA.h +10 -10
- package/SVF-linux/Release-build/include/MTA/LockAnalysis.h +4 -4
- package/SVF-linux/Release-build/include/MTA/MHP.h +8 -8
- package/SVF-linux/Release-build/include/MTA/TCT.h +10 -10
- package/SVF-linux/Release-build/include/MemoryModel/PointerAnalysis.h +4 -4
- package/SVF-linux/Release-build/include/SABER/DoubleFreeChecker.h +2 -2
- package/SVF-linux/Release-build/include/SABER/FileChecker.h +2 -2
- package/SVF-linux/Release-build/include/SABER/LeakChecker.h +4 -4
- package/SVF-linux/Release-build/include/SABER/SaberCheckerAPI.h +6 -5
- package/SVF-linux/Release-build/include/SABER/SaberCondAllocator.h +5 -5
- package/SVF-linux/Release-build/include/SABER/SrcSnkDDA.h +2 -2
- package/SVF-linux/Release-build/include/SVF-LLVM/LLVMModule.h +83 -7
- package/SVF-linux/Release-build/include/SVF-LLVM/LLVMUtil.h +9 -1
- package/SVF-linux/Release-build/include/SVF-LLVM/SVFIRBuilder.h +5 -2
- package/SVF-linux/Release-build/include/SVFIR/SVFIR.h +20 -27
- package/SVF-linux/Release-build/include/SVFIR/SVFValue.h +3 -2
- package/SVF-linux/Release-build/include/SVFIR/SVFVariables.h +271 -71
- package/SVF-linux/Release-build/include/Util/CDGBuilder.h +1 -1
- package/SVF-linux/Release-build/include/Util/CallGraphBuilder.h +1 -1
- package/SVF-linux/Release-build/include/Util/CxtStmt.h +6 -6
- package/SVF-linux/Release-build/include/Util/ExtAPI.h +20 -16
- package/SVF-linux/Release-build/include/Util/SVFUtil.h +16 -30
- package/SVF-linux/Release-build/include/Util/ThreadAPI.h +2 -11
- package/SVF-linux/Release-build/include/WPA/Andersen.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/DDA/DDAClient.h +6 -11
- package/SVF-osx/Release-build/include/DDA/DDAPass.h +1 -1
- package/SVF-osx/Release-build/include/Graphs/CHG.h +2 -3
- package/SVF-osx/Release-build/include/Graphs/GenericGraph.h +1 -286
- package/SVF-osx/Release-build/include/MTA/MTA.h +2 -2
- package/SVF-osx/Release-build/include/MTA/TCT.h +0 -6
- package/SVF-osx/Release-build/include/MemoryModel/PointerAnalysis.h +1 -7
- package/SVF-osx/Release-build/include/SABER/DoubleFreeChecker.h +1 -1
- package/SVF-osx/Release-build/include/SABER/FileChecker.h +1 -1
- package/SVF-osx/Release-build/include/SABER/LeakChecker.h +1 -1
- package/SVF-osx/Release-build/include/SABER/SaberCondAllocator.h +1 -2
- package/SVF-osx/Release-build/include/SABER/SrcSnkDDA.h +2 -2
- package/SVF-osx/Release-build/include/SVF-LLVM/BreakConstantExpr.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/CppUtil.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/DCHG.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/LLVMLoopAnalysis.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/LLVMModule.h +2 -2
- package/SVF-osx/Release-build/include/SVF-LLVM/LLVMUtil.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/ObjTypeInference.h +1 -1
- package/SVF-osx/Release-build/include/{SVFIR → SVF-LLVM}/SVFModule.h +1 -36
- package/SVF-osx/Release-build/include/SVF-LLVM/SVFValue.h +805 -0
- package/SVF-osx/Release-build/include/SVFIR/ObjTypeInfo.h +0 -1
- package/SVF-osx/Release-build/include/SVFIR/SVFIR.h +38 -11
- package/SVF-osx/Release-build/include/SVFIR/SVFStatements.h +1 -0
- package/SVF-osx/Release-build/include/SVFIR/SVFValue.h +202 -799
- package/SVF-osx/Release-build/include/Util/CDGBuilder.h +1 -1
- package/SVF-osx/Release-build/include/Util/GeneralType.h +1 -0
- package/SVF-osx/Release-build/include/Util/SVFLoopAndDomInfo.h +169 -0
- package/SVF-osx/Release-build/include/Util/SVFUtil.h +3 -1
- package/SVF-osx/Release-build/include/Util/ThreadAPI.h +2 -1
- package/SVF-osx/Release-build/include/WPA/FlowSensitive.h +1 -1
- 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
|
@@ -82,8 +82,8 @@ public:
|
|
|
82
82
|
typedef NodeBS FormalOUTSVFGNodeSet;
|
|
83
83
|
typedef Map<const CallICFGNode*, ActualINSVFGNodeSet> CallSiteToActualINsMapTy;
|
|
84
84
|
typedef Map<const CallICFGNode*, ActualOUTSVFGNodeSet> CallSiteToActualOUTsMapTy;
|
|
85
|
-
typedef Map<const
|
|
86
|
-
typedef Map<const
|
|
85
|
+
typedef Map<const FunObjVar*, FormalINSVFGNodeSet> FunctionToFormalINsMapTy;
|
|
86
|
+
typedef Map<const FunObjVar*, FormalOUTSVFGNodeSet> FunctionToFormalOUTsMapTy;
|
|
87
87
|
typedef MemSSA::MUSet MUSet;
|
|
88
88
|
typedef MemSSA::CHISet CHISet;
|
|
89
89
|
typedef MemSSA::PHISet PHISet;
|
|
@@ -159,13 +159,13 @@ public:
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
/// Get all inter value flow edges of a indirect call site
|
|
162
|
-
void getInterVFEdgesForIndirectCallSite(const CallICFGNode* cs, const
|
|
162
|
+
void getInterVFEdgesForIndirectCallSite(const CallICFGNode* cs, const FunObjVar* callee, SVFGEdgeSetTy& edges);
|
|
163
163
|
|
|
164
164
|
/// Dump graph into dot file
|
|
165
165
|
void dump(const std::string& file, bool simple = false);
|
|
166
166
|
|
|
167
167
|
/// Connect SVFG nodes between caller and callee for indirect call site
|
|
168
|
-
virtual void connectCallerAndCallee(const CallICFGNode* cs, const
|
|
168
|
+
virtual void connectCallerAndCallee(const CallICFGNode* cs, const FunObjVar* callee, SVFGEdgeSetTy& edges);
|
|
169
169
|
|
|
170
170
|
/// Given a pagNode, return its definition site
|
|
171
171
|
inline const SVFGNode* getDefSVFGNode(const PAGNode* pagNode) const
|
|
@@ -194,12 +194,12 @@ public:
|
|
|
194
194
|
return callSiteToActualOUTMap.find(cs)!=callSiteToActualOUTMap.end();
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
inline bool hasFormalINSVFGNodes(const
|
|
197
|
+
inline bool hasFormalINSVFGNodes(const FunObjVar* fun) const
|
|
198
198
|
{
|
|
199
199
|
return funToFormalINMap.find(fun)!=funToFormalINMap.end();
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
inline bool hasFormalOUTSVFGNodes(const
|
|
202
|
+
inline bool hasFormalOUTSVFGNodes(const FunObjVar* fun) const
|
|
203
203
|
{
|
|
204
204
|
return funToFormalOUTMap.find(fun)!=funToFormalOUTMap.end();
|
|
205
205
|
}
|
|
@@ -217,19 +217,19 @@ public:
|
|
|
217
217
|
return callSiteToActualOUTMap[cs];
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
inline FormalINSVFGNodeSet& getFormalINSVFGNodes(const
|
|
220
|
+
inline FormalINSVFGNodeSet& getFormalINSVFGNodes(const FunObjVar* fun)
|
|
221
221
|
{
|
|
222
222
|
return funToFormalINMap[fun];
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
inline FormalOUTSVFGNodeSet& getFormalOUTSVFGNodes(const
|
|
225
|
+
inline FormalOUTSVFGNodeSet& getFormalOUTSVFGNodes(const FunObjVar* fun)
|
|
226
226
|
{
|
|
227
227
|
return funToFormalOUTMap[fun];
|
|
228
228
|
}
|
|
229
229
|
//@}
|
|
230
230
|
|
|
231
231
|
/// Whether a node is function entry SVFGNode
|
|
232
|
-
const
|
|
232
|
+
const FunObjVar* isFunEntrySVFGNode(const SVFGNode* node) const;
|
|
233
233
|
|
|
234
234
|
/// Whether a node is callsite return SVFGNode
|
|
235
235
|
const CallICFGNode* isCallSiteRetSVFGNode(const SVFGNode* node) const;
|
|
@@ -325,7 +325,7 @@ protected:
|
|
|
325
325
|
edges.insert(edge);
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
virtual inline void getInterVFEdgeAtIndCSFromAInToFIn(ActualINSVFGNode* actualIn, const
|
|
328
|
+
virtual inline void getInterVFEdgeAtIndCSFromAInToFIn(ActualINSVFGNode* actualIn, const FunObjVar* callee, SVFGEdgeSetTy& edges)
|
|
329
329
|
{
|
|
330
330
|
for (SVFGNode::const_iterator outIt = actualIn->OutEdgeBegin(), outEit = actualIn->OutEdgeEnd(); outIt != outEit; ++outIt)
|
|
331
331
|
{
|
|
@@ -335,7 +335,7 @@ protected:
|
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
-
virtual inline void getInterVFEdgeAtIndCSFromFOutToAOut(ActualOUTSVFGNode* actualOut, const
|
|
338
|
+
virtual inline void getInterVFEdgeAtIndCSFromFOutToAOut(ActualOUTSVFGNode* actualOut, const FunObjVar* callee, SVFGEdgeSetTy& edges)
|
|
339
339
|
{
|
|
340
340
|
for (SVFGNode::const_iterator inIt = actualOut->InEdgeBegin(), inEit = actualOut->InEdgeEnd(); inIt != inEit; ++inIt)
|
|
341
341
|
{
|
|
@@ -446,11 +446,11 @@ protected:
|
|
|
446
446
|
|
|
447
447
|
/// Has function for EntryCHI/RetMU/CallCHI/CallMU
|
|
448
448
|
//@{
|
|
449
|
-
inline bool hasFuncEntryChi(const
|
|
449
|
+
inline bool hasFuncEntryChi(const FunObjVar* func) const
|
|
450
450
|
{
|
|
451
451
|
return (funToFormalINMap.find(func) != funToFormalINMap.end());
|
|
452
452
|
}
|
|
453
|
-
inline bool hasFuncRetMu(const
|
|
453
|
+
inline bool hasFuncRetMu(const FunObjVar* func) const
|
|
454
454
|
{
|
|
455
455
|
return (funToFormalOUTMap.find(func) != funToFormalOUTMap.end());
|
|
456
456
|
}
|
|
@@ -408,7 +408,7 @@ public:
|
|
|
408
408
|
return (fun==nullptr) && (callInst != nullptr);
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
-
inline const
|
|
411
|
+
inline const FunObjVar* getFun() const
|
|
412
412
|
{
|
|
413
413
|
assert(isFormalINPHI() && "expect a formal parameter phi");
|
|
414
414
|
return fun;
|
|
@@ -447,7 +447,7 @@ public:
|
|
|
447
447
|
virtual const std::string toString() const;
|
|
448
448
|
|
|
449
449
|
private:
|
|
450
|
-
const
|
|
450
|
+
const FunObjVar* fun;
|
|
451
451
|
const CallICFGNode* callInst;
|
|
452
452
|
};
|
|
453
453
|
|
|
@@ -67,16 +67,7 @@ public:
|
|
|
67
67
|
}
|
|
68
68
|
//@}
|
|
69
69
|
|
|
70
|
-
virtual const std::string toString() const
|
|
71
|
-
{
|
|
72
|
-
std::string str;
|
|
73
|
-
std::stringstream rawstr(str);
|
|
74
|
-
rawstr << "ThreadForkEdge ";
|
|
75
|
-
rawstr << "CallSiteID: " << getCallSiteID();
|
|
76
|
-
rawstr << " srcNodeID " << getSrcID() << " (fun: " << getSrcNode()->getFunction()->getName() << ")";
|
|
77
|
-
rawstr << " dstNodeID " << getDstID() << " (fun: " << getDstNode()->getFunction()->getName() << ")";
|
|
78
|
-
return rawstr.str();
|
|
79
|
-
}
|
|
70
|
+
virtual const std::string toString() const;
|
|
80
71
|
|
|
81
72
|
typedef GenericNode<CallGraphNode, ThreadForkEdge>::GEdgeSetTy ForkEdgeSet;
|
|
82
73
|
};
|
|
@@ -107,16 +98,7 @@ public:
|
|
|
107
98
|
return edge->getEdgeKind() == CallGraphEdge::TDJoinEdge;
|
|
108
99
|
}
|
|
109
100
|
|
|
110
|
-
virtual const std::string toString() const
|
|
111
|
-
{
|
|
112
|
-
std::string str;
|
|
113
|
-
std::stringstream rawstr(str);
|
|
114
|
-
rawstr << "ThreadJoinEdge ";
|
|
115
|
-
rawstr << "CallSiteID: " << getCallSiteID();
|
|
116
|
-
rawstr << " srcNodeID " << getSrcID() << " (fun: " << getSrcNode()->getFunction()->getName() << ")";
|
|
117
|
-
rawstr << " dstNodeID " << getDstID() << " (fun: " << getDstNode()->getFunction()->getName() << ")";
|
|
118
|
-
return rawstr.str();
|
|
119
|
-
}
|
|
101
|
+
virtual const std::string toString() const;
|
|
120
102
|
|
|
121
103
|
typedef GenericNode<CallGraphNode, ThreadJoinEdge>::GEdgeSetTy JoinEdgeSet;
|
|
122
104
|
};
|
|
@@ -350,7 +332,7 @@ public:
|
|
|
350
332
|
/// Add direct/indirect thread fork edges
|
|
351
333
|
//@{
|
|
352
334
|
bool addDirectForkEdge(const CallICFGNode* cs);
|
|
353
|
-
bool addIndirectForkEdge(const CallICFGNode* cs, const
|
|
335
|
+
bool addIndirectForkEdge(const CallICFGNode* cs, const FunObjVar* callee);
|
|
354
336
|
//@}
|
|
355
337
|
|
|
356
338
|
/// Add thread join edges
|
|
@@ -70,7 +70,7 @@ public:
|
|
|
70
70
|
typedef Map<const PAGNode*, UnaryOPVFGNode*> PAGNodeToUnaryOPVFGNodeMapTy;
|
|
71
71
|
typedef Map<const PAGNode*, BranchVFGNode*> PAGNodeToBranchVFGNodeMapTy;
|
|
72
72
|
typedef Map<const PAGNode*, CmpVFGNode*> PAGNodeToCmpVFGNodeMapTy;
|
|
73
|
-
typedef Map<const
|
|
73
|
+
typedef Map<const FunObjVar*, VFGNodeSet > FunToVFGNodesMapTy;
|
|
74
74
|
|
|
75
75
|
typedef FormalParmVFGNode::CallPESet CallPESet;
|
|
76
76
|
typedef FormalRetVFGNode::RetPESet RetPESet;
|
|
@@ -171,11 +171,11 @@ public:
|
|
|
171
171
|
void updateCallGraph(PointerAnalysis* pta);
|
|
172
172
|
|
|
173
173
|
/// Connect VFG nodes between caller and callee for indirect call site
|
|
174
|
-
virtual void connectCallerAndCallee(const CallICFGNode* cs, const
|
|
174
|
+
virtual void connectCallerAndCallee(const CallICFGNode* cs, const FunObjVar* callee, VFGEdgeSetTy& edges);
|
|
175
175
|
|
|
176
176
|
/// Get callsite given a callsiteID
|
|
177
177
|
//@{
|
|
178
|
-
inline CallSiteID getCallSiteID(const CallICFGNode* cs, const
|
|
178
|
+
inline CallSiteID getCallSiteID(const CallICFGNode* cs, const FunObjVar* func) const
|
|
179
179
|
{
|
|
180
180
|
return callgraph->getCallSiteID(cs, func);
|
|
181
181
|
}
|
|
@@ -259,7 +259,7 @@ public:
|
|
|
259
259
|
//@}
|
|
260
260
|
|
|
261
261
|
/// Whether a node is function entry VFGNode
|
|
262
|
-
const
|
|
262
|
+
const FunObjVar* isFunEntryVFGNode(const VFGNode* node) const;
|
|
263
263
|
|
|
264
264
|
/// Whether a PAGNode has a blackhole or const object as its definition
|
|
265
265
|
inline bool hasBlackHoleConstObjAddrAsDef(const PAGNode* pagNode) const
|
|
@@ -283,25 +283,25 @@ public:
|
|
|
283
283
|
|
|
284
284
|
/// Return all the VFGNodes of a function
|
|
285
285
|
///@{
|
|
286
|
-
inline VFGNodeSet& getVFGNodes(const
|
|
286
|
+
inline VFGNodeSet& getVFGNodes(const FunObjVar *fun)
|
|
287
287
|
{
|
|
288
288
|
return funToVFGNodesMap[fun];
|
|
289
289
|
}
|
|
290
|
-
inline bool hasVFGNodes(const
|
|
290
|
+
inline bool hasVFGNodes(const FunObjVar *fun) const
|
|
291
291
|
{
|
|
292
292
|
return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
|
|
293
293
|
}
|
|
294
|
-
inline bool VFGNodes(const
|
|
294
|
+
inline bool VFGNodes(const FunObjVar *fun) const
|
|
295
295
|
{
|
|
296
296
|
return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
|
|
297
297
|
}
|
|
298
|
-
inline VFGNodeSet::const_iterator getVFGNodeBegin(const
|
|
298
|
+
inline VFGNodeSet::const_iterator getVFGNodeBegin(const FunObjVar *fun) const
|
|
299
299
|
{
|
|
300
300
|
FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
|
|
301
301
|
assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
|
|
302
302
|
return it->second.begin();
|
|
303
303
|
}
|
|
304
|
-
inline VFGNodeSet::const_iterator getVFGNodeEnd(const
|
|
304
|
+
inline VFGNodeSet::const_iterator getVFGNodeEnd(const FunObjVar *fun) const
|
|
305
305
|
{
|
|
306
306
|
FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
|
|
307
307
|
assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
|
|
@@ -350,8 +350,8 @@ protected:
|
|
|
350
350
|
/// sanitize Intra edges, verify that both nodes belong to the same function.
|
|
351
351
|
inline void checkIntraEdgeParents(const VFGNode *srcNode, const VFGNode *dstNode)
|
|
352
352
|
{
|
|
353
|
-
const
|
|
354
|
-
const
|
|
353
|
+
const FunObjVar *srcfun = srcNode->getFun();
|
|
354
|
+
const FunObjVar *dstfun = dstNode->getFun();
|
|
355
355
|
if(srcfun != nullptr && dstfun != nullptr)
|
|
356
356
|
{
|
|
357
357
|
assert((srcfun == dstfun) && "src and dst nodes of an intra VFG edge are not in the same function?");
|
|
@@ -453,7 +453,7 @@ protected:
|
|
|
453
453
|
void connectDirectVFGEdges();
|
|
454
454
|
|
|
455
455
|
/// Create edges between VFG nodes across functions
|
|
456
|
-
void addVFGInterEdges(const CallICFGNode* cs, const
|
|
456
|
+
void addVFGInterEdges(const CallICFGNode* cs, const FunObjVar* callee);
|
|
457
457
|
|
|
458
458
|
inline bool isPhiCopyEdge(const PAGEdge* copy) const
|
|
459
459
|
{
|
|
@@ -467,7 +467,7 @@ protected:
|
|
|
467
467
|
vfgNode->setICFGNode(icfgNode);
|
|
468
468
|
icfgNode->addVFGNode(vfgNode);
|
|
469
469
|
|
|
470
|
-
if(const
|
|
470
|
+
if(const FunObjVar* fun = icfgNode->getFun())
|
|
471
471
|
funToVFGNodesMap[fun].insert(vfgNode);
|
|
472
472
|
else
|
|
473
473
|
globalVFGNodes.insert(vfgNode);
|
|
@@ -535,7 +535,7 @@ protected:
|
|
|
535
535
|
/// do not set def here, this node is not a variable definition
|
|
536
536
|
}
|
|
537
537
|
/// Add a formal parameter VFG node
|
|
538
|
-
inline void addFormalParmVFGNode(const PAGNode* fparm, const
|
|
538
|
+
inline void addFormalParmVFGNode(const PAGNode* fparm, const FunObjVar* fun, CallPESet& callPEs)
|
|
539
539
|
{
|
|
540
540
|
FormalParmVFGNode* sNode = new FormalParmVFGNode(totalVFGNode++,fparm,fun);
|
|
541
541
|
addVFGNode(sNode, pag->getICFG()->getFunEntryICFGNode(fun));
|
|
@@ -549,7 +549,7 @@ protected:
|
|
|
549
549
|
/// Add a callee Return VFG node
|
|
550
550
|
/// To be noted that here we assume returns of a procedure have already been unified into one
|
|
551
551
|
/// Otherwise, we need to handle formalRet using <PAGNodeID,CallSiteID> pair to find FormalRetVFG node same as handling actual parameters
|
|
552
|
-
inline void addFormalRetVFGNode(const PAGNode* uniqueFunRet, const
|
|
552
|
+
inline void addFormalRetVFGNode(const PAGNode* uniqueFunRet, const FunObjVar* fun, RetPESet& retPEs)
|
|
553
553
|
{
|
|
554
554
|
FormalRetVFGNode *sNode = new FormalRetVFGNode(totalVFGNode++, uniqueFunRet, fun);
|
|
555
555
|
addVFGNode(sNode, pag->getICFG()->getFunExitICFGNode(fun));
|
|
@@ -76,7 +76,7 @@ public:
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/// Get the function of this SVFGNode
|
|
79
|
-
virtual const
|
|
79
|
+
virtual const FunObjVar* getFun() const
|
|
80
80
|
{
|
|
81
81
|
return icfgNode->getFun();
|
|
82
82
|
}
|
|
@@ -947,12 +947,12 @@ public:
|
|
|
947
947
|
class FormalParmVFGNode : public ArgumentVFGNode
|
|
948
948
|
{
|
|
949
949
|
private:
|
|
950
|
-
const
|
|
950
|
+
const FunObjVar* fun;
|
|
951
951
|
CallPESet callPEs;
|
|
952
952
|
|
|
953
953
|
public:
|
|
954
954
|
/// Constructor
|
|
955
|
-
FormalParmVFGNode(NodeID id, const PAGNode* n, const
|
|
955
|
+
FormalParmVFGNode(NodeID id, const PAGNode* n, const FunObjVar* f):
|
|
956
956
|
ArgumentVFGNode(id, n, FParm), fun(f)
|
|
957
957
|
{
|
|
958
958
|
}
|
|
@@ -964,7 +964,7 @@ public:
|
|
|
964
964
|
}
|
|
965
965
|
|
|
966
966
|
/// Return function
|
|
967
|
-
inline const
|
|
967
|
+
inline const FunObjVar* getFun() const override
|
|
968
968
|
{
|
|
969
969
|
return fun;
|
|
970
970
|
}
|
|
@@ -1038,7 +1038,7 @@ public:
|
|
|
1038
1038
|
return cs;
|
|
1039
1039
|
}
|
|
1040
1040
|
/// Receive parameter at callsite
|
|
1041
|
-
inline const
|
|
1041
|
+
inline const FunObjVar* getCaller() const
|
|
1042
1042
|
{
|
|
1043
1043
|
return cs->getCaller();
|
|
1044
1044
|
}
|
|
@@ -1082,7 +1082,7 @@ public:
|
|
|
1082
1082
|
class FormalRetVFGNode: public ArgumentVFGNode
|
|
1083
1083
|
{
|
|
1084
1084
|
private:
|
|
1085
|
-
const
|
|
1085
|
+
const FunObjVar* fun;
|
|
1086
1086
|
RetPESet retPEs;
|
|
1087
1087
|
|
|
1088
1088
|
FormalRetVFGNode(); ///< place holder
|
|
@@ -1091,7 +1091,7 @@ private:
|
|
|
1091
1091
|
|
|
1092
1092
|
public:
|
|
1093
1093
|
/// Constructor
|
|
1094
|
-
FormalRetVFGNode(NodeID id, const PAGNode* n, const
|
|
1094
|
+
FormalRetVFGNode(NodeID id, const PAGNode* n, const FunObjVar* f);
|
|
1095
1095
|
|
|
1096
1096
|
/// Return value at callee
|
|
1097
1097
|
inline const PAGNode* getRet() const
|
|
@@ -1099,7 +1099,7 @@ public:
|
|
|
1099
1099
|
return param;
|
|
1100
1100
|
}
|
|
1101
1101
|
/// Function
|
|
1102
|
-
inline const
|
|
1102
|
+
inline const FunObjVar* getFun() const override
|
|
1103
1103
|
{
|
|
1104
1104
|
return fun;
|
|
1105
1105
|
}
|
|
@@ -1168,7 +1168,7 @@ public:
|
|
|
1168
1168
|
return (fun!=nullptr) && (callInst != nullptr);
|
|
1169
1169
|
}
|
|
1170
1170
|
|
|
1171
|
-
inline const
|
|
1171
|
+
inline const FunObjVar* getFun() const override
|
|
1172
1172
|
{
|
|
1173
1173
|
assert((isFormalParmPHI() || isActualRetPHI()) && "expect a formal parameter phi");
|
|
1174
1174
|
return fun;
|
|
@@ -1207,7 +1207,7 @@ public:
|
|
|
1207
1207
|
const std::string toString() const override;
|
|
1208
1208
|
|
|
1209
1209
|
private:
|
|
1210
|
-
const
|
|
1210
|
+
const FunObjVar* fun;
|
|
1211
1211
|
const CallICFGNode* callInst;
|
|
1212
1212
|
};
|
|
1213
1213
|
|
|
@@ -277,11 +277,11 @@ template<class Cond>
|
|
|
277
277
|
class RetMU : public MSSAMU<Cond>
|
|
278
278
|
{
|
|
279
279
|
private:
|
|
280
|
-
const
|
|
280
|
+
const FunObjVar* fun;
|
|
281
281
|
public:
|
|
282
282
|
/// Constructor/Destructor for MU
|
|
283
283
|
//@{
|
|
284
|
-
RetMU(const
|
|
284
|
+
RetMU(const FunObjVar* f, const MemRegion* m, Cond c = true) :
|
|
285
285
|
MSSAMU<Cond>(MSSAMU<Cond>::RetMSSAMU,m,c), fun(f)
|
|
286
286
|
{
|
|
287
287
|
}
|
|
@@ -289,7 +289,7 @@ public:
|
|
|
289
289
|
//@}
|
|
290
290
|
|
|
291
291
|
/// Return function
|
|
292
|
-
inline const
|
|
292
|
+
inline const FunObjVar* getFunction() const
|
|
293
293
|
{
|
|
294
294
|
return fun;
|
|
295
295
|
}
|
|
@@ -578,11 +578,11 @@ template<class Cond>
|
|
|
578
578
|
class EntryCHI : public MSSACHI<Cond>
|
|
579
579
|
{
|
|
580
580
|
private:
|
|
581
|
-
const
|
|
581
|
+
const FunObjVar* fun;
|
|
582
582
|
public:
|
|
583
583
|
/// Constructors for EntryCHI
|
|
584
584
|
//@{
|
|
585
|
-
EntryCHI(const
|
|
585
|
+
EntryCHI(const FunObjVar* f, const MemRegion* m, Cond c = true) :
|
|
586
586
|
MSSACHI<Cond>(MSSADEF::EntryMSSACHI,m,c),fun(f)
|
|
587
587
|
{
|
|
588
588
|
}
|
|
@@ -592,7 +592,7 @@ public:
|
|
|
592
592
|
//@}
|
|
593
593
|
|
|
594
594
|
/// Return function
|
|
595
|
-
inline const
|
|
595
|
+
inline const FunObjVar* getFunction() const
|
|
596
596
|
{
|
|
597
597
|
return fun;
|
|
598
598
|
}
|
|
@@ -57,13 +57,13 @@ protected:
|
|
|
57
57
|
virtual void partitionMRs();
|
|
58
58
|
|
|
59
59
|
/// Get memory region at a load
|
|
60
|
-
virtual void getMRsForLoad(MRSet& aliasMRs, const NodeBS& cpts, const
|
|
60
|
+
virtual void getMRsForLoad(MRSet& aliasMRs, const NodeBS& cpts, const FunObjVar* fun);
|
|
61
61
|
|
|
62
62
|
/// Get memory regions to be inserted at a load statement.
|
|
63
|
-
virtual void getMRsForCallSiteRef(MRSet& aliasMRs, const NodeBS& cpts, const
|
|
63
|
+
virtual void getMRsForCallSiteRef(MRSet& aliasMRs, const NodeBS& cpts, const FunObjVar* fun);
|
|
64
64
|
private:
|
|
65
65
|
/// Create memory regions for each points-to target.
|
|
66
|
-
void createDistinctMR(const
|
|
66
|
+
void createDistinctMR(const FunObjVar* func, const NodeBS& cpts);
|
|
67
67
|
|
|
68
68
|
};
|
|
69
69
|
|
|
@@ -74,8 +74,8 @@ class IntraDisjointMRG : public MRGenerator
|
|
|
74
74
|
{
|
|
75
75
|
public:
|
|
76
76
|
typedef OrderedMap<NodeBS, PointsToList> PtsToSubPtsMap;
|
|
77
|
-
typedef Map<const
|
|
78
|
-
typedef Map<const
|
|
77
|
+
typedef Map<const FunObjVar*, PtsToSubPtsMap> FunToPtsMap;
|
|
78
|
+
typedef Map<const FunObjVar*, PointsToList> FunToInterMap;
|
|
79
79
|
|
|
80
80
|
IntraDisjointMRG(BVDataPTAImpl* p, bool ptrOnly) : MRGenerator(p, ptrOnly)
|
|
81
81
|
{}
|
|
@@ -94,7 +94,7 @@ protected:
|
|
|
94
94
|
* @param mrs Memory region set contains all possible target memory regions.
|
|
95
95
|
*/
|
|
96
96
|
virtual inline void getMRsForLoad(MRSet& aliasMRs, const NodeBS& cpts,
|
|
97
|
-
const
|
|
97
|
+
const FunObjVar* fun)
|
|
98
98
|
{
|
|
99
99
|
const PointsToList& inters = getIntersList(fun);
|
|
100
100
|
getMRsForLoadFromInterList(aliasMRs, cpts, inters);
|
|
@@ -103,26 +103,26 @@ protected:
|
|
|
103
103
|
void getMRsForLoadFromInterList(MRSet& mrs, const NodeBS& cpts, const PointsToList& inters);
|
|
104
104
|
|
|
105
105
|
/// Get memory regions to be inserted at a load statement.
|
|
106
|
-
virtual void getMRsForCallSiteRef(MRSet& aliasMRs, const NodeBS& cpts, const
|
|
106
|
+
virtual void getMRsForCallSiteRef(MRSet& aliasMRs, const NodeBS& cpts, const FunObjVar* fun);
|
|
107
107
|
|
|
108
108
|
/// Create disjoint memory region
|
|
109
|
-
void createDisjointMR(const
|
|
109
|
+
void createDisjointMR(const FunObjVar* func, const NodeBS& cpts);
|
|
110
110
|
|
|
111
111
|
/// Compute intersections between cpts and computed cpts intersections before.
|
|
112
112
|
void computeIntersections(const NodeBS& cpts, PointsToList& inters);
|
|
113
113
|
|
|
114
114
|
private:
|
|
115
|
-
inline PtsToSubPtsMap& getPtsSubSetMap(const
|
|
115
|
+
inline PtsToSubPtsMap& getPtsSubSetMap(const FunObjVar* func)
|
|
116
116
|
{
|
|
117
117
|
return funcToPtsMap[func];
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
inline PointsToList& getIntersList(const
|
|
120
|
+
inline PointsToList& getIntersList(const FunObjVar* func)
|
|
121
121
|
{
|
|
122
122
|
return funcToInterMap[func];
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
inline const PtsToSubPtsMap& getPtsSubSetMap(const
|
|
125
|
+
inline const PtsToSubPtsMap& getPtsSubSetMap(const FunObjVar* func) const
|
|
126
126
|
{
|
|
127
127
|
FunToPtsMap::const_iterator it = funcToPtsMap.find(func);
|
|
128
128
|
assert(it != funcToPtsMap.end() && "can not find pts map for specified function");
|
|
@@ -155,7 +155,7 @@ protected:
|
|
|
155
155
|
* @param mrs Memory region set contains all possible target memory regions.
|
|
156
156
|
*/
|
|
157
157
|
virtual inline void getMRsForLoad(MRSet& aliasMRs, const NodeBS& cpts,
|
|
158
|
-
const
|
|
158
|
+
const FunObjVar*)
|
|
159
159
|
{
|
|
160
160
|
getMRsForLoadFromInterList(aliasMRs, cpts, inters);
|
|
161
161
|
}
|
|
@@ -139,14 +139,14 @@ public:
|
|
|
139
139
|
//@}
|
|
140
140
|
///Define mem region set
|
|
141
141
|
typedef OrderedSet<const MemRegion*, MemRegion::equalMemRegion> MRSet;
|
|
142
|
-
typedef Map<const PAGEdge*, const
|
|
142
|
+
typedef Map<const PAGEdge*, const FunObjVar*> PAGEdgeToFunMap;
|
|
143
143
|
typedef OrderedSet<NodeBS, SVFUtil::equalNodeBS> PointsToList;
|
|
144
|
-
typedef Map<const
|
|
145
|
-
typedef Map<const
|
|
144
|
+
typedef Map<const FunObjVar*, NodeBS> FunToPointsToMap;
|
|
145
|
+
typedef Map<const FunObjVar*, PointsToList> FunToPointsTosMap;
|
|
146
146
|
typedef OrderedMap<NodeBS, NodeBS, SVFUtil::equalNodeBS> PtsToRepPtsSetMap;
|
|
147
147
|
|
|
148
148
|
/// Map a function to its region set
|
|
149
|
-
typedef Map<const
|
|
149
|
+
typedef Map<const FunObjVar*, MRSet> FunToMRsMap;
|
|
150
150
|
/// Map loads/stores to its mem regions,
|
|
151
151
|
/// TODO:visitAtomicCmpXchgInst, visitAtomicRMWInst??
|
|
152
152
|
//@{
|
|
@@ -165,7 +165,7 @@ public:
|
|
|
165
165
|
/// Maps Mod-Ref analysis
|
|
166
166
|
//@{
|
|
167
167
|
/// Map a function to its indirect refs/mods of memory objects
|
|
168
|
-
typedef Map<const
|
|
168
|
+
typedef Map<const FunObjVar*, NodeBS> FunToNodeBSMap;
|
|
169
169
|
/// Map a callsite to its indirect refs/mods of memory objects
|
|
170
170
|
typedef Map<const CallICFGNode*, NodeBS> CallSiteToNodeBSMap;
|
|
171
171
|
//@}
|
|
@@ -263,7 +263,7 @@ private:
|
|
|
263
263
|
}
|
|
264
264
|
/// Whether the object node is a non-local object
|
|
265
265
|
/// including global, heap, and stack variable in recursions
|
|
266
|
-
bool isNonLocalObject(NodeID id, const
|
|
266
|
+
bool isNonLocalObject(NodeID id, const FunObjVar* curFun) const;
|
|
267
267
|
|
|
268
268
|
/// Get all the objects in callee's modref escaped via global objects (the chain pts of globals)
|
|
269
269
|
void getEscapObjviaGlobals(NodeBS& globs, const NodeBS& pts);
|
|
@@ -278,7 +278,7 @@ protected:
|
|
|
278
278
|
PtsToRepPtsSetMap cptsToRepCPtsMap;
|
|
279
279
|
|
|
280
280
|
/// Generate a memory region and put in into functions which use it
|
|
281
|
-
void createMR(const
|
|
281
|
+
void createMR(const FunObjVar* fun, const NodeBS& cpts);
|
|
282
282
|
|
|
283
283
|
/// Collect all global variables for later escape analysis
|
|
284
284
|
void collectGlobals();
|
|
@@ -304,7 +304,7 @@ protected:
|
|
|
304
304
|
return mr->getPointsTo().intersects(cpts);
|
|
305
305
|
}
|
|
306
306
|
/// Get all aliased mem regions from function fun according to cpts
|
|
307
|
-
virtual inline void getAliasMemRegions(MRSet& aliasMRs, const NodeBS& cpts, const
|
|
307
|
+
virtual inline void getAliasMemRegions(MRSet& aliasMRs, const NodeBS& cpts, const FunObjVar* fun)
|
|
308
308
|
{
|
|
309
309
|
for(MRSet::const_iterator it = funToMRsMap[fun].begin(), eit = funToMRsMap[fun].end(); it!=eit; ++it)
|
|
310
310
|
{
|
|
@@ -314,14 +314,14 @@ protected:
|
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
/// Get memory regions for a load statement according to cpts.
|
|
317
|
-
virtual inline void getMRsForLoad(MRSet& aliasMRs, const NodeBS& cpts, const
|
|
317
|
+
virtual inline void getMRsForLoad(MRSet& aliasMRs, const NodeBS& cpts, const FunObjVar*)
|
|
318
318
|
{
|
|
319
319
|
const MemRegion* mr = getMR(cpts);
|
|
320
320
|
aliasMRs.insert(mr);
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
/// Get memory regions for call site ref according to cpts.
|
|
324
|
-
virtual inline void getMRsForCallSiteRef(MRSet& aliasMRs, const NodeBS& cpts, const
|
|
324
|
+
virtual inline void getMRsForCallSiteRef(MRSet& aliasMRs, const NodeBS& cpts, const FunObjVar*)
|
|
325
325
|
{
|
|
326
326
|
const MemRegion* mr = getMR(cpts);
|
|
327
327
|
aliasMRs.insert(mr);
|
|
@@ -331,18 +331,18 @@ protected:
|
|
|
331
331
|
virtual void modRefAnalysis(CallGraphNode* callGraphNode, WorkList& worklist);
|
|
332
332
|
|
|
333
333
|
/// Get Mod-Ref of a callee function
|
|
334
|
-
virtual bool handleCallsiteModRef(NodeBS& mod, NodeBS& ref, const CallICFGNode* cs, const
|
|
334
|
+
virtual bool handleCallsiteModRef(NodeBS& mod, NodeBS& ref, const CallICFGNode* cs, const FunObjVar* fun);
|
|
335
335
|
|
|
336
336
|
|
|
337
337
|
/// Add cpts to store/load
|
|
338
338
|
//@{
|
|
339
|
-
inline void addCPtsToStore(NodeBS& cpts, const StoreStmt *st, const
|
|
339
|
+
inline void addCPtsToStore(NodeBS& cpts, const StoreStmt *st, const FunObjVar* fun)
|
|
340
340
|
{
|
|
341
341
|
storesToPointsToMap[st] = cpts;
|
|
342
342
|
funToPointsToMap[fun].insert(cpts);
|
|
343
343
|
addModSideEffectOfFunction(fun,cpts);
|
|
344
344
|
}
|
|
345
|
-
inline void addCPtsToLoad(NodeBS& cpts, const LoadStmt *ld, const
|
|
345
|
+
inline void addCPtsToLoad(NodeBS& cpts, const LoadStmt *ld, const FunObjVar* fun)
|
|
346
346
|
{
|
|
347
347
|
loadsToPointsToMap[ld] = cpts;
|
|
348
348
|
funToPointsToMap[fun].insert(cpts);
|
|
@@ -358,11 +358,11 @@ protected:
|
|
|
358
358
|
callsiteToModPointsToMap[cs] |= cpts;
|
|
359
359
|
funToPointsToMap[cs->getCaller()].insert(cpts);
|
|
360
360
|
}
|
|
361
|
-
inline bool hasCPtsList(const
|
|
361
|
+
inline bool hasCPtsList(const FunObjVar* fun) const
|
|
362
362
|
{
|
|
363
363
|
return funToPointsToMap.find(fun)!=funToPointsToMap.end();
|
|
364
364
|
}
|
|
365
|
-
inline PointsToList& getPointsToList(const
|
|
365
|
+
inline PointsToList& getPointsToList(const FunObjVar* fun)
|
|
366
366
|
{
|
|
367
367
|
return funToPointsToMap[fun];
|
|
368
368
|
}
|
|
@@ -374,21 +374,21 @@ protected:
|
|
|
374
374
|
/// Add/Get methods for side-effect of functions and callsites
|
|
375
375
|
//@{
|
|
376
376
|
/// Add indirect uses an memory object in the function
|
|
377
|
-
void addRefSideEffectOfFunction(const
|
|
377
|
+
void addRefSideEffectOfFunction(const FunObjVar* fun, const NodeBS& refs);
|
|
378
378
|
/// Add indirect def an memory object in the function
|
|
379
|
-
void addModSideEffectOfFunction(const
|
|
379
|
+
void addModSideEffectOfFunction(const FunObjVar* fun, const NodeBS& mods);
|
|
380
380
|
/// Add indirect uses an memory object in the function
|
|
381
381
|
bool addRefSideEffectOfCallSite(const CallICFGNode* cs, const NodeBS& refs);
|
|
382
382
|
/// Add indirect def an memory object in the function
|
|
383
383
|
bool addModSideEffectOfCallSite(const CallICFGNode* cs, const NodeBS& mods);
|
|
384
384
|
|
|
385
385
|
/// Get indirect refs of a function
|
|
386
|
-
inline const NodeBS& getRefSideEffectOfFunction(const
|
|
386
|
+
inline const NodeBS& getRefSideEffectOfFunction(const FunObjVar* fun)
|
|
387
387
|
{
|
|
388
388
|
return funToRefsMap[fun];
|
|
389
389
|
}
|
|
390
390
|
/// Get indirect mods of a function
|
|
391
|
-
inline const NodeBS& getModSideEffectOfFunction(const
|
|
391
|
+
inline const NodeBS& getModSideEffectOfFunction(const FunObjVar* fun)
|
|
392
392
|
{
|
|
393
393
|
return funToModsMap[fun];
|
|
394
394
|
}
|
|
@@ -430,7 +430,7 @@ public:
|
|
|
430
430
|
virtual void generateMRs();
|
|
431
431
|
|
|
432
432
|
/// Get the function which SVFIR Edge located
|
|
433
|
-
const
|
|
433
|
+
const FunObjVar* getFunction(const PAGEdge* pagEdge) const
|
|
434
434
|
{
|
|
435
435
|
PAGEdgeToFunMap::const_iterator it = pagEdgeToFunMap.find(pagEdge);
|
|
436
436
|
assert(it!=pagEdgeToFunMap.end() && "can not find its function, it is a global SVFIR edge");
|
|
@@ -438,7 +438,7 @@ public:
|
|
|
438
438
|
}
|
|
439
439
|
/// Get Memory Region set
|
|
440
440
|
//@{
|
|
441
|
-
inline MRSet& getFunMRSet(const
|
|
441
|
+
inline MRSet& getFunMRSet(const FunObjVar* fun)
|
|
442
442
|
{
|
|
443
443
|
return funToMRsMap[fun];
|
|
444
444
|
}
|