svf-lib 1.0.2093 → 1.0.2095
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/CFL/CFLAlias.h +3 -3
- package/SVF-linux/Release-build/include/Graphs/CHG.h +13 -31
- package/SVF-linux/Release-build/include/Graphs/ICFG.h +2 -2
- package/SVF-linux/Release-build/include/Graphs/ICFGEdge.h +4 -16
- package/SVF-linux/Release-build/include/Graphs/ICFGNode.h +58 -0
- package/SVF-linux/Release-build/include/Graphs/ThreadCallGraph.h +6 -6
- package/SVF-linux/Release-build/include/MTA/MHP.h +3 -3
- package/SVF-linux/Release-build/include/MTA/TCT.h +1 -1
- package/SVF-linux/Release-build/include/SVF-LLVM/DCHG.h +7 -7
- package/SVF-linux/Release-build/include/SVF-LLVM/LLVMUtil.h +0 -8
- package/SVF-linux/Release-build/include/SVFIR/SVFFileSystem.h +0 -2
- package/SVF-linux/Release-build/include/SVFIR/SVFValue.h +0 -131
- package/SVF-linux/Release-build/include/Util/SVFUtil.h +20 -37
- package/SVF-linux/Release-build/include/Util/ThreadAPI.h +5 -26
- package/SVF-linux/Release-build/include/WPA/Andersen.h +3 -3
- package/SVF-linux/Release-build/include/WPA/Steensgaard.h +3 -3
- package/SVF-linux/Release-build/include/WPA/WPAPass.h +3 -3
- 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/CFL/CFLAlias.h +3 -3
- package/SVF-osx/Release-build/include/Graphs/CHG.h +13 -31
- package/SVF-osx/Release-build/include/Graphs/ICFG.h +2 -2
- package/SVF-osx/Release-build/include/Graphs/ICFGEdge.h +4 -16
- package/SVF-osx/Release-build/include/Graphs/ICFGNode.h +58 -0
- package/SVF-osx/Release-build/include/Graphs/ThreadCallGraph.h +6 -6
- package/SVF-osx/Release-build/include/MTA/MHP.h +3 -3
- package/SVF-osx/Release-build/include/MTA/TCT.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/DCHG.h +7 -7
- package/SVF-osx/Release-build/include/SVF-LLVM/LLVMUtil.h +0 -8
- package/SVF-osx/Release-build/include/SVFIR/SVFFileSystem.h +0 -2
- package/SVF-osx/Release-build/include/SVFIR/SVFValue.h +0 -131
- package/SVF-osx/Release-build/include/Util/SVFUtil.h +20 -37
- package/SVF-osx/Release-build/include/Util/ThreadAPI.h +5 -26
- package/SVF-osx/Release-build/include/WPA/Andersen.h +3 -3
- package/SVF-osx/Release-build/include/WPA/Steensgaard.h +3 -3
- package/SVF-osx/Release-build/include/WPA/WPAPass.h +3 -3
- package/SVF-osx/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -42,7 +42,7 @@ class CFLAlias : public CFLBase
|
|
|
42
42
|
{
|
|
43
43
|
|
|
44
44
|
public:
|
|
45
|
-
typedef OrderedMap<
|
|
45
|
+
typedef OrderedMap<const CallICFGNode*, NodeID> CallSite2DummyValPN;
|
|
46
46
|
|
|
47
47
|
CFLAlias(SVFIR* ir) : CFLBase(ir, PointerAnalysis::CFLFICI_WPA)
|
|
48
48
|
{
|
|
@@ -143,9 +143,9 @@ public:
|
|
|
143
143
|
virtual void onTheFlyCallGraphSolve(const CallSiteToFunPtrMap& callsites, CallEdgeMap& newEdges);
|
|
144
144
|
|
|
145
145
|
/// Connect formal and actual parameters for indirect callsites
|
|
146
|
-
void connectCaller2CalleeParams(
|
|
146
|
+
void connectCaller2CalleeParams(const CallICFGNode* cs, const SVFFunction* F);
|
|
147
147
|
|
|
148
|
-
void heapAllocatorViaIndCall(
|
|
148
|
+
void heapAllocatorViaIndCall(const CallICFGNode* cs);
|
|
149
149
|
|
|
150
150
|
private:
|
|
151
151
|
CallSite2DummyValPN callsite2DummyValPN; ///< Map an instruction to a dummy obj which created at an indirect callsite, which invokes a heap allocator
|
|
@@ -57,11 +57,11 @@ public:
|
|
|
57
57
|
DI
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
virtual bool csHasVFnsBasedonCHA(
|
|
61
|
-
virtual const VFunSet &getCSVFsBasedonCHA(
|
|
62
|
-
virtual bool csHasVtblsBasedonCHA(
|
|
63
|
-
virtual const VTableSet &getCSVtblsBasedonCHA(
|
|
64
|
-
virtual void getVFnsFromVtbls(
|
|
60
|
+
virtual bool csHasVFnsBasedonCHA(const CallICFGNode* cs) = 0;
|
|
61
|
+
virtual const VFunSet &getCSVFsBasedonCHA(const CallICFGNode* cs) = 0;
|
|
62
|
+
virtual bool csHasVtblsBasedonCHA(const CallICFGNode* cs) = 0;
|
|
63
|
+
virtual const VTableSet &getCSVtblsBasedonCHA(const CallICFGNode* cs) = 0;
|
|
64
|
+
virtual void getVFnsFromVtbls(const SVFCallInst* cs, const VTableSet& vtbls,
|
|
65
65
|
VFunSet& virtualFunctions) = 0;
|
|
66
66
|
|
|
67
67
|
CHGKind getKind(void) const
|
|
@@ -222,9 +222,9 @@ public:
|
|
|
222
222
|
typedef Set<const CHNode*> CHNodeSetTy;
|
|
223
223
|
typedef FIFOWorkList<const CHNode*> WorkList;
|
|
224
224
|
typedef Map<std::string, CHNodeSetTy> NameToCHNodesMap;
|
|
225
|
-
typedef Map<
|
|
226
|
-
typedef Map<
|
|
227
|
-
typedef Map<
|
|
225
|
+
typedef Map<const SVFInstruction*, CHNodeSetTy> CallSiteToCHNodesMap;
|
|
226
|
+
typedef Map<const SVFInstruction*, VTableSet> CallSiteToVTableSetMap;
|
|
227
|
+
typedef Map<const SVFInstruction*, VFunSet> CallSiteToVFunSetMap;
|
|
228
228
|
|
|
229
229
|
typedef enum
|
|
230
230
|
{
|
|
@@ -242,7 +242,7 @@ public:
|
|
|
242
242
|
const std::string baseClassName,
|
|
243
243
|
CHEdge::CHEDGETYPE edgeType);
|
|
244
244
|
CHNode *getNode(const std::string name) const;
|
|
245
|
-
void getVFnsFromVtbls(
|
|
245
|
+
void getVFnsFromVtbls(const SVFCallInst* cs, const VTableSet &vtbls, VFunSet &virtualFunctions) override;
|
|
246
246
|
void dump(const std::string& filename);
|
|
247
247
|
void view();
|
|
248
248
|
void printCH();
|
|
@@ -286,28 +286,10 @@ public:
|
|
|
286
286
|
return templateNameToInstancesMap[className];
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
inline bool csHasVFnsBasedonCHA(CallSite cs) override
|
|
295
|
-
{
|
|
296
|
-
CallSiteToVFunSetMap::const_iterator it = csToCHAVFnsMap.find(cs);
|
|
297
|
-
return it != csToCHAVFnsMap.end();
|
|
298
|
-
}
|
|
299
|
-
inline const VTableSet &getCSVtblsBasedonCHA(CallSite cs) override
|
|
300
|
-
{
|
|
301
|
-
CallSiteToVTableSetMap::const_iterator it = csToCHAVtblsMap.find(cs);
|
|
302
|
-
assert(it != csToCHAVtblsMap.end() && "cs does not have vtabls based on CHA.");
|
|
303
|
-
return it->second;
|
|
304
|
-
}
|
|
305
|
-
inline const VFunSet &getCSVFsBasedonCHA(CallSite cs) override
|
|
306
|
-
{
|
|
307
|
-
CallSiteToVFunSetMap::const_iterator it = csToCHAVFnsMap.find(cs);
|
|
308
|
-
assert(it != csToCHAVFnsMap.end() && "cs does not have vfns based on CHA.");
|
|
309
|
-
return it->second;
|
|
310
|
-
}
|
|
289
|
+
bool csHasVtblsBasedonCHA(const CallICFGNode* cs) override;
|
|
290
|
+
bool csHasVFnsBasedonCHA(const CallICFGNode* cs) override;
|
|
291
|
+
const VTableSet &getCSVtblsBasedonCHA(const CallICFGNode* cs) override;
|
|
292
|
+
const VFunSet &getCSVFsBasedonCHA(const CallICFGNode* cs) override;
|
|
311
293
|
|
|
312
294
|
static inline bool classof(const CommonCHGraph *chg)
|
|
313
295
|
{
|
|
@@ -156,8 +156,8 @@ protected:
|
|
|
156
156
|
//@{
|
|
157
157
|
ICFGEdge* addIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode);
|
|
158
158
|
ICFGEdge* addConditionalIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode, const SVFValue* condition, s32_t branchCondVal);
|
|
159
|
-
ICFGEdge* addCallEdge(ICFGNode* srcNode, ICFGNode* dstNode
|
|
160
|
-
ICFGEdge* addRetEdge(ICFGNode* srcNode, ICFGNode* dstNode
|
|
159
|
+
ICFGEdge* addCallEdge(ICFGNode* srcNode, ICFGNode* dstNode);
|
|
160
|
+
ICFGEdge* addRetEdge(ICFGNode* srcNode, ICFGNode* dstNode);
|
|
161
161
|
//@}
|
|
162
162
|
/// Remove a ICFG edge
|
|
163
163
|
inline void removeICFGEdge(ICFGEdge* edge)
|
|
@@ -179,20 +179,14 @@ class CallCFGEdge : public ICFGEdge
|
|
|
179
179
|
friend class SVFIRReader;
|
|
180
180
|
|
|
181
181
|
private:
|
|
182
|
-
const SVFInstruction* cs;
|
|
183
182
|
std::vector<const CallPE*> callPEs;
|
|
184
183
|
|
|
185
184
|
public:
|
|
186
185
|
/// Constructor
|
|
187
|
-
CallCFGEdge(ICFGNode* s, ICFGNode* d
|
|
188
|
-
: ICFGEdge(s, d, CallCF)
|
|
186
|
+
CallCFGEdge(ICFGNode* s, ICFGNode* d)
|
|
187
|
+
: ICFGEdge(s, d, CallCF)
|
|
189
188
|
{
|
|
190
189
|
}
|
|
191
|
-
/// Return callsite ID
|
|
192
|
-
inline const SVFInstruction* getCallSite() const
|
|
193
|
-
{
|
|
194
|
-
return cs;
|
|
195
|
-
}
|
|
196
190
|
/// Add call parameter edge to this CallCFGEdge
|
|
197
191
|
inline void addCallPE(const CallPE* callPE)
|
|
198
192
|
{
|
|
@@ -230,19 +224,13 @@ class RetCFGEdge : public ICFGEdge
|
|
|
230
224
|
friend class SVFIRReader;
|
|
231
225
|
|
|
232
226
|
private:
|
|
233
|
-
const SVFInstruction* cs;
|
|
234
227
|
const RetPE* retPE;
|
|
235
228
|
|
|
236
229
|
public:
|
|
237
230
|
/// Constructor
|
|
238
|
-
RetCFGEdge(ICFGNode* s, ICFGNode* d
|
|
239
|
-
: ICFGEdge(s, d, RetCF),
|
|
240
|
-
{
|
|
241
|
-
}
|
|
242
|
-
/// Return callsite ID
|
|
243
|
-
inline const SVFInstruction* getCallSite() const
|
|
231
|
+
RetCFGEdge(ICFGNode* s, ICFGNode* d)
|
|
232
|
+
: ICFGEdge(s, d, RetCF), retPE(nullptr)
|
|
244
233
|
{
|
|
245
|
-
return cs;
|
|
246
234
|
}
|
|
247
235
|
/// Add call parameter edge to this CallCFGEdge
|
|
248
236
|
inline void addRetPE(const RetPE* ret)
|
|
@@ -476,6 +476,64 @@ public:
|
|
|
476
476
|
{
|
|
477
477
|
APNodes.push_back(ap);
|
|
478
478
|
}
|
|
479
|
+
/// Parameter operations
|
|
480
|
+
//@{
|
|
481
|
+
const SVFValue* getArgument(u32_t ArgNo) const
|
|
482
|
+
{
|
|
483
|
+
return SVFUtil::cast<SVFCallInst>(cs)->getArgOperand(ArgNo);
|
|
484
|
+
}
|
|
485
|
+
const SVFType* getType() const
|
|
486
|
+
{
|
|
487
|
+
return SVFUtil::cast<SVFCallInst>(cs)->getType();
|
|
488
|
+
}
|
|
489
|
+
u32_t arg_size() const
|
|
490
|
+
{
|
|
491
|
+
return SVFUtil::cast<SVFCallInst>(cs)->arg_size();
|
|
492
|
+
}
|
|
493
|
+
bool arg_empty() const
|
|
494
|
+
{
|
|
495
|
+
return SVFUtil::cast<SVFCallInst>(cs)->arg_empty();
|
|
496
|
+
}
|
|
497
|
+
const SVFValue* getArgOperand(u32_t i) const
|
|
498
|
+
{
|
|
499
|
+
return SVFUtil::cast<SVFCallInst>(cs)->getArgOperand(i);
|
|
500
|
+
}
|
|
501
|
+
u32_t getNumArgOperands() const
|
|
502
|
+
{
|
|
503
|
+
return SVFUtil::cast<SVFCallInst>(cs)->arg_size();
|
|
504
|
+
}
|
|
505
|
+
const SVFFunction* getCalledFunction() const
|
|
506
|
+
{
|
|
507
|
+
return SVFUtil::cast<SVFCallInst>(cs)->getCalledFunction();
|
|
508
|
+
}
|
|
509
|
+
const SVFValue* getCalledValue() const
|
|
510
|
+
{
|
|
511
|
+
return SVFUtil::cast<SVFCallInst>(cs)->getCalledOperand();
|
|
512
|
+
}
|
|
513
|
+
bool isVarArg() const
|
|
514
|
+
{
|
|
515
|
+
return SVFUtil::cast<SVFCallInst>(cs)->isVarArg();
|
|
516
|
+
}
|
|
517
|
+
bool isVirtualCall() const
|
|
518
|
+
{
|
|
519
|
+
return SVFUtil::isa<SVFVirtualCallInst>(cs);
|
|
520
|
+
}
|
|
521
|
+
const SVFValue* getVtablePtr() const
|
|
522
|
+
{
|
|
523
|
+
assert(isVirtualCall() && "not a virtual call?");
|
|
524
|
+
return SVFUtil::cast<SVFVirtualCallInst>(cs)->getVtablePtr();
|
|
525
|
+
}
|
|
526
|
+
s32_t getFunIdxInVtable() const
|
|
527
|
+
{
|
|
528
|
+
assert(isVirtualCall() && "not a virtual call?");
|
|
529
|
+
return SVFUtil::cast<SVFVirtualCallInst>(cs)->getFunIdxInVtable();
|
|
530
|
+
}
|
|
531
|
+
const std::string& getFunNameOfVirtualCall() const
|
|
532
|
+
{
|
|
533
|
+
assert(isVirtualCall() && "not a virtual call?");
|
|
534
|
+
return SVFUtil::cast<SVFVirtualCallInst>(cs)->getFunNameOfVirtualCall();
|
|
535
|
+
}
|
|
536
|
+
//@}
|
|
479
537
|
|
|
480
538
|
///Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
481
539
|
//@{
|
|
@@ -72,9 +72,9 @@ public:
|
|
|
72
72
|
std::string str;
|
|
73
73
|
std::stringstream rawstr(str);
|
|
74
74
|
rawstr << "ThreadForkEdge ";
|
|
75
|
-
rawstr << "
|
|
76
|
-
rawstr << "
|
|
77
|
-
rawstr << "
|
|
75
|
+
rawstr << "CallSiteID: " << getCallSiteID();
|
|
76
|
+
rawstr << " srcNodeID " << getSrcID() << " (fun: " << getSrcNode()->getFunction()->getName() << ")";
|
|
77
|
+
rawstr << " dstNodeID " << getDstID() << " (fun: " << getDstNode()->getFunction()->getName() << ")";
|
|
78
78
|
return rawstr.str();
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -112,9 +112,9 @@ public:
|
|
|
112
112
|
std::string str;
|
|
113
113
|
std::stringstream rawstr(str);
|
|
114
114
|
rawstr << "ThreadJoinEdge ";
|
|
115
|
-
rawstr << "
|
|
116
|
-
rawstr << "
|
|
117
|
-
rawstr << "
|
|
115
|
+
rawstr << "CallSiteID: " << getCallSiteID();
|
|
116
|
+
rawstr << " srcNodeID " << getSrcID() << " (fun: " << getSrcNode()->getFunction()->getName() << ")";
|
|
117
|
+
rawstr << " dstNodeID " << getDstID() << " (fun: " << getDstNode()->getFunction()->getName() << ")";
|
|
118
118
|
return rawstr.str();
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -377,7 +377,7 @@ private:
|
|
|
377
377
|
bool sameLoopTripCount(const ICFGNode* forkSite, const ICFGNode* joinSite);
|
|
378
378
|
|
|
379
379
|
/// Whether it is a matched fork join pair
|
|
380
|
-
bool isAliasedForkJoin(const
|
|
380
|
+
bool isAliasedForkJoin(const CallICFGNode* forkSite, const CallICFGNode* joinSite)
|
|
381
381
|
{
|
|
382
382
|
return tct->getPTA()->alias(getForkedThread(forkSite), getJoinedThread(joinSite)) && isSameSCEV(forkSite,joinSite);
|
|
383
383
|
}
|
|
@@ -469,12 +469,12 @@ private:
|
|
|
469
469
|
return getTCG()->getThreadAPI()->isTDJoin(call);
|
|
470
470
|
}
|
|
471
471
|
/// Get forked thread
|
|
472
|
-
inline const SVFValue* getForkedThread(const
|
|
472
|
+
inline const SVFValue* getForkedThread(const CallICFGNode* call)
|
|
473
473
|
{
|
|
474
474
|
return getTCG()->getThreadAPI()->getForkedThread(call);
|
|
475
475
|
}
|
|
476
476
|
/// Get joined thread
|
|
477
|
-
inline const SVFValue* getJoinedThread(const
|
|
477
|
+
inline const SVFValue* getJoinedThread(const CallICFGNode* call)
|
|
478
478
|
{
|
|
479
479
|
return getTCG()->getThreadAPI()->getJoinedThread(call);
|
|
480
480
|
}
|
|
@@ -246,7 +246,7 @@ public:
|
|
|
246
246
|
inline bool isExtCall(const ICFGNode* inst)
|
|
247
247
|
{
|
|
248
248
|
if(const CallICFGNode* call = SVFUtil::dyn_cast<CallICFGNode>(inst))
|
|
249
|
-
return SVFUtil::isExtCall(call
|
|
249
|
+
return SVFUtil::isExtCall(call);
|
|
250
250
|
return false;
|
|
251
251
|
}
|
|
252
252
|
/// Whether it is a callsite
|
|
@@ -249,12 +249,12 @@ public:
|
|
|
249
249
|
|
|
250
250
|
void print(void);
|
|
251
251
|
|
|
252
|
-
virtual bool csHasVFnsBasedonCHA(
|
|
252
|
+
virtual bool csHasVFnsBasedonCHA(const CallICFGNode* cs) override
|
|
253
253
|
{
|
|
254
254
|
return csHasVtblsBasedonCHA(cs);
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
virtual const VFunSet &getCSVFsBasedonCHA(
|
|
257
|
+
virtual const VFunSet &getCSVFsBasedonCHA(const CallICFGNode* cs) override;
|
|
258
258
|
|
|
259
259
|
virtual bool csHasVtblsBasedonCHA(CallBase* cs)
|
|
260
260
|
{
|
|
@@ -268,14 +268,14 @@ public:
|
|
|
268
268
|
return getNode(type)->getVTable() != nullptr;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
virtual bool csHasVtblsBasedonCHA(
|
|
271
|
+
virtual bool csHasVtblsBasedonCHA(const CallICFGNode* cs) override
|
|
272
272
|
{
|
|
273
273
|
assert(false && "not supported!");
|
|
274
274
|
abort();
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
virtual const VTableSet &getCSVtblsBasedonCHA(
|
|
278
|
-
virtual void getVFnsFromVtbls(
|
|
277
|
+
virtual const VTableSet &getCSVtblsBasedonCHA(const CallICFGNode* cs) override;
|
|
278
|
+
virtual void getVFnsFromVtbls(const SVFCallInst* cs, const VTableSet &vtbls, VFunSet &virtualFunctions) override;
|
|
279
279
|
|
|
280
280
|
/// Returns true if a is a transitive base of b. firstField determines
|
|
281
281
|
/// whether to consider first-field edges.
|
|
@@ -373,7 +373,7 @@ protected:
|
|
|
373
373
|
/// Maps types to a set with their vtable and all their children's.
|
|
374
374
|
Map<const DIType*, VTableSet> vtblCHAMap;
|
|
375
375
|
/// Maps callsites to a set of potential virtual functions based on CHA.
|
|
376
|
-
Map<
|
|
376
|
+
Map<const CallICFGNode*, VFunSet> csCHAMap;
|
|
377
377
|
/// Maps types to their canonical type (many-to-one).
|
|
378
378
|
Map<const DIType*, const DIType*> canonicalTypeMap;
|
|
379
379
|
/// Set of all possible canonical types (i.e. values of canonicalTypeMap).
|
|
@@ -414,7 +414,7 @@ private:
|
|
|
414
414
|
/// Retrieves the metadata associated with a *virtual* callsite.
|
|
415
415
|
const DIType* getCSStaticType(CallBase* cs) const;
|
|
416
416
|
|
|
417
|
-
const DIType *getCSStaticType(
|
|
417
|
+
const DIType *getCSStaticType(const CallICFGNode* cs) const
|
|
418
418
|
{
|
|
419
419
|
assert(false && "not supported!");
|
|
420
420
|
abort();
|
|
@@ -287,14 +287,6 @@ inline static DataLayout* getDataLayout(Module* mod)
|
|
|
287
287
|
return dl;
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
/// Get the next instructions following control flow
|
|
291
|
-
void getNextInsts(const Instruction* curInst,
|
|
292
|
-
std::vector<const SVFInstruction*>& instList);
|
|
293
|
-
|
|
294
|
-
/// Get the previous instructions following control flow
|
|
295
|
-
void getPrevInsts(const Instruction* curInst,
|
|
296
|
-
std::vector<const SVFInstruction*>& instList);
|
|
297
|
-
|
|
298
290
|
/// Get the next instructions following control flow
|
|
299
291
|
void getNextInsts(const Instruction* curInst,
|
|
300
292
|
std::vector<const Instruction*>& instList);
|
|
@@ -421,7 +421,6 @@ private:
|
|
|
421
421
|
cJSON* toJson(const CHNode* node); // CHGraph Node
|
|
422
422
|
cJSON* toJson(const CHEdge* edge); // CHGraph Edge
|
|
423
423
|
|
|
424
|
-
cJSON* toJson(const CallSite& cs);
|
|
425
424
|
cJSON* toJson(const AccessPath& ap);
|
|
426
425
|
cJSON* toJson(const SVFLoop* loop);
|
|
427
426
|
cJSON* toJson(const MemObj* memObj);
|
|
@@ -1104,7 +1103,6 @@ private:
|
|
|
1104
1103
|
void readJson(const cJSON* obj, ICFGEdge*& edge); // ICFG Edge
|
|
1105
1104
|
void readJson(const cJSON* obj, CHNode*& node); // CHGraph Node
|
|
1106
1105
|
void readJson(const cJSON* obj, CHEdge*& edge); // CHGraph Edge
|
|
1107
|
-
void readJson(const cJSON* obj, CallSite& cs); // CHGraph's csToClassMap
|
|
1108
1106
|
|
|
1109
1107
|
void readJson(const cJSON* obj, AccessPath& ap);
|
|
1110
1108
|
void readJson(const cJSON* obj, SVFLoop*& loop);
|
|
@@ -637,15 +637,11 @@ class SVFInstruction : public SVFValue
|
|
|
637
637
|
{
|
|
638
638
|
friend class SVFIRWriter;
|
|
639
639
|
friend class SVFIRReader;
|
|
640
|
-
public:
|
|
641
|
-
typedef std::vector<const SVFInstruction*> InstVec;
|
|
642
640
|
|
|
643
641
|
private:
|
|
644
642
|
const SVFBasicBlock* bb; /// The BasicBlock where this Instruction resides
|
|
645
643
|
bool terminator; /// return true if this is a terminator instruction
|
|
646
644
|
bool ret; /// return true if this is an return instruction of a function
|
|
647
|
-
InstVec succInsts; /// successor Instructions
|
|
648
|
-
InstVec predInsts; /// predecessor Instructions
|
|
649
645
|
|
|
650
646
|
public:
|
|
651
647
|
/// Constructor without name, set name with setName()
|
|
@@ -665,36 +661,11 @@ public:
|
|
|
665
661
|
return bb;
|
|
666
662
|
}
|
|
667
663
|
|
|
668
|
-
inline InstVec& getSuccInstructions()
|
|
669
|
-
{
|
|
670
|
-
return succInsts;
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
inline InstVec& getPredInstructions()
|
|
674
|
-
{
|
|
675
|
-
return predInsts;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
inline const InstVec& getSuccInstructions() const
|
|
679
|
-
{
|
|
680
|
-
return succInsts;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
inline const InstVec& getPredInstructions() const
|
|
684
|
-
{
|
|
685
|
-
return predInsts;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
664
|
inline const SVFFunction* getFunction() const
|
|
689
665
|
{
|
|
690
666
|
return bb->getParent();
|
|
691
667
|
}
|
|
692
668
|
|
|
693
|
-
inline bool isTerminator() const
|
|
694
|
-
{
|
|
695
|
-
return terminator;
|
|
696
|
-
}
|
|
697
|
-
|
|
698
669
|
inline bool isRetInst() const
|
|
699
670
|
{
|
|
700
671
|
return ret;
|
|
@@ -1115,98 +1086,6 @@ public:
|
|
|
1115
1086
|
};
|
|
1116
1087
|
|
|
1117
1088
|
|
|
1118
|
-
class CallSite
|
|
1119
|
-
{
|
|
1120
|
-
friend class SVFIRReader;
|
|
1121
|
-
|
|
1122
|
-
private:
|
|
1123
|
-
const SVFCallInst* CB;
|
|
1124
|
-
|
|
1125
|
-
/// Constructs empty CallSite (for SVFIRReader/deserialization)
|
|
1126
|
-
CallSite() : CB{} {}
|
|
1127
|
-
|
|
1128
|
-
public:
|
|
1129
|
-
CallSite(const SVFInstruction* I) : CB(SVFUtil::dyn_cast<SVFCallInst>(I))
|
|
1130
|
-
{
|
|
1131
|
-
assert(CB && "not a callsite?");
|
|
1132
|
-
}
|
|
1133
|
-
const SVFInstruction* getInstruction() const
|
|
1134
|
-
{
|
|
1135
|
-
return CB;
|
|
1136
|
-
}
|
|
1137
|
-
const SVFValue* getArgument(u32_t ArgNo) const
|
|
1138
|
-
{
|
|
1139
|
-
return CB->getArgOperand(ArgNo);
|
|
1140
|
-
}
|
|
1141
|
-
const SVFType* getType() const
|
|
1142
|
-
{
|
|
1143
|
-
return CB->getType();
|
|
1144
|
-
}
|
|
1145
|
-
u32_t arg_size() const
|
|
1146
|
-
{
|
|
1147
|
-
return CB->arg_size();
|
|
1148
|
-
}
|
|
1149
|
-
bool arg_empty() const
|
|
1150
|
-
{
|
|
1151
|
-
return CB->arg_empty();
|
|
1152
|
-
}
|
|
1153
|
-
const SVFValue* getArgOperand(u32_t i) const
|
|
1154
|
-
{
|
|
1155
|
-
return CB->getArgOperand(i);
|
|
1156
|
-
}
|
|
1157
|
-
u32_t getNumArgOperands() const
|
|
1158
|
-
{
|
|
1159
|
-
return CB->arg_size();
|
|
1160
|
-
}
|
|
1161
|
-
const SVFFunction* getCalledFunction() const
|
|
1162
|
-
{
|
|
1163
|
-
return CB->getCalledFunction();
|
|
1164
|
-
}
|
|
1165
|
-
const SVFValue* getCalledValue() const
|
|
1166
|
-
{
|
|
1167
|
-
return CB->getCalledOperand();
|
|
1168
|
-
}
|
|
1169
|
-
const SVFFunction* getCaller() const
|
|
1170
|
-
{
|
|
1171
|
-
return CB->getCaller();
|
|
1172
|
-
}
|
|
1173
|
-
bool isVarArg() const
|
|
1174
|
-
{
|
|
1175
|
-
return CB->isVarArg();
|
|
1176
|
-
}
|
|
1177
|
-
bool isVirtualCall() const
|
|
1178
|
-
{
|
|
1179
|
-
return SVFUtil::isa<SVFVirtualCallInst>(CB);
|
|
1180
|
-
}
|
|
1181
|
-
const SVFValue* getVtablePtr() const
|
|
1182
|
-
{
|
|
1183
|
-
assert(isVirtualCall() && "not a virtual call?");
|
|
1184
|
-
return SVFUtil::cast<SVFVirtualCallInst>(CB)->getVtablePtr();
|
|
1185
|
-
}
|
|
1186
|
-
s32_t getFunIdxInVtable() const
|
|
1187
|
-
{
|
|
1188
|
-
assert(isVirtualCall() && "not a virtual call?");
|
|
1189
|
-
return SVFUtil::cast<SVFVirtualCallInst>(CB)->getFunIdxInVtable();
|
|
1190
|
-
}
|
|
1191
|
-
const std::string& getFunNameOfVirtualCall() const
|
|
1192
|
-
{
|
|
1193
|
-
assert(isVirtualCall() && "not a virtual call?");
|
|
1194
|
-
return SVFUtil::cast<SVFVirtualCallInst>(CB)->getFunNameOfVirtualCall();
|
|
1195
|
-
}
|
|
1196
|
-
bool operator==(const CallSite& CS) const
|
|
1197
|
-
{
|
|
1198
|
-
return CB == CS.CB;
|
|
1199
|
-
}
|
|
1200
|
-
bool operator!=(const CallSite& CS) const
|
|
1201
|
-
{
|
|
1202
|
-
return CB != CS.CB;
|
|
1203
|
-
}
|
|
1204
|
-
bool operator<(const CallSite& CS) const
|
|
1205
|
-
{
|
|
1206
|
-
return getInstruction() < CS.getInstruction();
|
|
1207
|
-
}
|
|
1208
|
-
};
|
|
1209
|
-
|
|
1210
1089
|
/// [FOR DEBUG ONLY, DON'T USE IT UNSIDE `svf`!]
|
|
1211
1090
|
/// Converts an SVFValue to corresponding LLVM::Value, then get the string
|
|
1212
1091
|
/// representation of it. Use it only when you are debugging. Don't use
|
|
@@ -1222,14 +1101,4 @@ OutStream& operator<< (OutStream &o, const std::pair<F, S> &var)
|
|
|
1222
1101
|
|
|
1223
1102
|
} // End namespace SVF
|
|
1224
1103
|
|
|
1225
|
-
/// Specialise hash for CallSites.
|
|
1226
|
-
template <> struct std::hash<SVF::CallSite>
|
|
1227
|
-
{
|
|
1228
|
-
size_t operator()(const SVF::CallSite &cs) const
|
|
1229
|
-
{
|
|
1230
|
-
std::hash<const SVF::SVFInstruction *> h;
|
|
1231
|
-
return h(cs.getInstruction());
|
|
1232
|
-
}
|
|
1233
|
-
};
|
|
1234
|
-
|
|
1235
1104
|
#endif /* INCLUDE_SVFIR_SVFVALUE_H_ */
|