svf-lib 1.0.739 → 1.0.743
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/lib/libSvf.a +0 -0
- package/SVF-linux/include/Graphs/CHG.h +2 -2
- package/SVF-linux/include/Graphs/ICFGNode.h +1 -1
- package/SVF-linux/include/Graphs/VFG.h +9 -9
- package/SVF-linux/include/Graphs/VFGNode.h +6 -6
- package/SVF-linux/include/MSSA/MSSAMuChi.h +6 -6
- package/SVF-linux/include/MSSA/MemRegion.h +8 -8
- package/SVF-linux/include/MSSA/MemSSA.h +10 -10
- package/SVF-linux/include/MemoryModel/PointerAnalysis.h +1 -1
- package/SVF-linux/include/MemoryModel/PointerAnalysisImpl.h +2 -2
- package/SVF-linux/include/MemoryModel/SVFIR.h +28 -28
- package/SVF-linux/include/MemoryModel/SVFStatements.h +68 -68
- package/SVF-linux/include/MemoryModel/SVFVariables.h +39 -39
- package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +22 -22
- package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/Graphs/CHG.h +2 -2
- package/SVF-osx/include/Graphs/SVFGOPT.h +3 -2
- package/package.json +1 -1
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
//===----- CHG.h --
|
|
1
|
+
//===----- CHG.h -- Class hirachary graph ---------------------------//
|
|
2
2
|
//
|
|
3
3
|
// SVF: Static Value-Flow Analysis
|
|
4
4
|
//
|
|
5
|
-
// Copyright (C) <2013
|
|
5
|
+
// Copyright (C) <2013-> <Yulei Sui>
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
// This program is free software: you can redistribute it and/or modify
|
|
@@ -47,7 +47,7 @@ class VFGNode;
|
|
|
47
47
|
|
|
48
48
|
/*!
|
|
49
49
|
* Interprocedural control-flow graph node, representing different kinds of program statements
|
|
50
|
-
* including top-level pointers (
|
|
50
|
+
* including top-level pointers (ValVar) and address-taken objects (ObjVar)
|
|
51
51
|
*/
|
|
52
52
|
typedef GenericNode<ICFGNode, ICFGEdge> GenericICFGNodeTy;
|
|
53
53
|
|
|
@@ -483,28 +483,28 @@ protected:
|
|
|
483
483
|
setDef(pagNode,sNode);
|
|
484
484
|
}
|
|
485
485
|
/// Add an Address VFG node
|
|
486
|
-
inline void addAddrVFGNode(const
|
|
486
|
+
inline void addAddrVFGNode(const AddrStmt* addr)
|
|
487
487
|
{
|
|
488
488
|
AddrVFGNode* sNode = new AddrVFGNode(totalVFGNode++,addr);
|
|
489
489
|
addStmtVFGNode(sNode, addr);
|
|
490
490
|
setDef(addr->getDstNode(),sNode);
|
|
491
491
|
}
|
|
492
492
|
/// Add a Copy VFG node
|
|
493
|
-
inline void addCopyVFGNode(const
|
|
493
|
+
inline void addCopyVFGNode(const CopyStmt* copy)
|
|
494
494
|
{
|
|
495
495
|
CopyVFGNode* sNode = new CopyVFGNode(totalVFGNode++,copy);
|
|
496
496
|
addStmtVFGNode(sNode, copy);
|
|
497
497
|
setDef(copy->getDstNode(),sNode);
|
|
498
498
|
}
|
|
499
499
|
/// Add a Gep VFG node
|
|
500
|
-
inline void addGepVFGNode(const
|
|
500
|
+
inline void addGepVFGNode(const GepStmt* gep)
|
|
501
501
|
{
|
|
502
502
|
GepVFGNode* sNode = new GepVFGNode(totalVFGNode++,gep);
|
|
503
503
|
addStmtVFGNode(sNode, gep);
|
|
504
504
|
setDef(gep->getDstNode(),sNode);
|
|
505
505
|
}
|
|
506
506
|
/// Add a Load VFG node
|
|
507
|
-
void addLoadVFGNode(const
|
|
507
|
+
void addLoadVFGNode(const LoadStmt* load)
|
|
508
508
|
{
|
|
509
509
|
LoadVFGNode* sNode = new LoadVFGNode(totalVFGNode++,load);
|
|
510
510
|
addStmtVFGNode(sNode, load);
|
|
@@ -512,7 +512,7 @@ protected:
|
|
|
512
512
|
}
|
|
513
513
|
/// Add a Store VFG node,
|
|
514
514
|
/// To be noted store does not create a new pointer, we do not set def for any SVFIR node
|
|
515
|
-
void addStoreVFGNode(const
|
|
515
|
+
void addStoreVFGNode(const StoreStmt* store)
|
|
516
516
|
{
|
|
517
517
|
StoreVFGNode* sNode = new StoreVFGNode(totalVFGNode++,store);
|
|
518
518
|
addStmtVFGNode(sNode, store);
|
|
@@ -569,7 +569,7 @@ protected:
|
|
|
569
569
|
PAGNodeToActualRetMap[ret] = sNode;
|
|
570
570
|
}
|
|
571
571
|
/// Add an llvm PHI VFG node
|
|
572
|
-
inline void addIntraPHIVFGNode(const
|
|
572
|
+
inline void addIntraPHIVFGNode(const PhiStmt* edge)
|
|
573
573
|
{
|
|
574
574
|
IntraPHIVFGNode* sNode = new IntraPHIVFGNode(totalVFGNode++,edge->getRes());
|
|
575
575
|
u32_t pos = 0;
|
|
@@ -583,7 +583,7 @@ protected:
|
|
|
583
583
|
PAGNodeToIntraPHIVFGNodeMap[edge->getRes()] = sNode;
|
|
584
584
|
}
|
|
585
585
|
/// Add a Compare VFG node
|
|
586
|
-
inline void addCmpVFGNode(const
|
|
586
|
+
inline void addCmpVFGNode(const CmpStmt* edge)
|
|
587
587
|
{
|
|
588
588
|
CmpVFGNode* sNode = new CmpVFGNode(totalVFGNode++, edge->getRes());
|
|
589
589
|
u32_t pos = 0;
|
|
@@ -597,7 +597,7 @@ protected:
|
|
|
597
597
|
PAGNodeToCmpVFGNodeMap[edge->getRes()] = sNode;
|
|
598
598
|
}
|
|
599
599
|
/// Add a BinaryOperator VFG node
|
|
600
|
-
inline void addBinaryOPVFGNode(const
|
|
600
|
+
inline void addBinaryOPVFGNode(const BinaryOPStmt* edge)
|
|
601
601
|
{
|
|
602
602
|
BinaryOPVFGNode* sNode = new BinaryOPVFGNode(totalVFGNode++, edge->getRes());
|
|
603
603
|
u32_t pos = 0;
|
|
@@ -611,7 +611,7 @@ protected:
|
|
|
611
611
|
PAGNodeToBinaryOPVFGNodeMap[edge->getRes()] = sNode;
|
|
612
612
|
}
|
|
613
613
|
/// Add a UnaryOperator VFG node
|
|
614
|
-
inline void addUnaryOPVFGNode(const
|
|
614
|
+
inline void addUnaryOPVFGNode(const UnaryOPStmt* edge)
|
|
615
615
|
{
|
|
616
616
|
UnaryOPVFGNode* sNode = new UnaryOPVFGNode(totalVFGNode++, edge->getRes());
|
|
617
617
|
sNode->setOpVer(0, edge->getOpVar());
|
|
@@ -40,7 +40,7 @@ namespace SVF
|
|
|
40
40
|
|
|
41
41
|
/*!
|
|
42
42
|
* Interprocedural control-flow graph node, representing different kinds of program statements
|
|
43
|
-
* including top-level pointers (
|
|
43
|
+
* including top-level pointers (ValVar) and address-taken objects (ObjVar)
|
|
44
44
|
*/
|
|
45
45
|
typedef GenericNode<VFGNode,VFGEdge> GenericVFGNodeTy;
|
|
46
46
|
class VFGNode : public GenericVFGNodeTy
|
|
@@ -202,7 +202,7 @@ private:
|
|
|
202
202
|
|
|
203
203
|
public:
|
|
204
204
|
/// Constructor
|
|
205
|
-
LoadVFGNode(NodeID id, const
|
|
205
|
+
LoadVFGNode(NodeID id, const LoadStmt* edge): StmtVFGNode(id, edge,Load)
|
|
206
206
|
{
|
|
207
207
|
|
|
208
208
|
}
|
|
@@ -241,7 +241,7 @@ private:
|
|
|
241
241
|
|
|
242
242
|
public:
|
|
243
243
|
/// Constructor
|
|
244
|
-
StoreVFGNode(NodeID id,const
|
|
244
|
+
StoreVFGNode(NodeID id,const StoreStmt* edge): StmtVFGNode(id,edge,Store)
|
|
245
245
|
{
|
|
246
246
|
|
|
247
247
|
}
|
|
@@ -280,7 +280,7 @@ private:
|
|
|
280
280
|
|
|
281
281
|
public:
|
|
282
282
|
/// Constructor
|
|
283
|
-
CopyVFGNode(NodeID id,const
|
|
283
|
+
CopyVFGNode(NodeID id,const CopyStmt* copy): StmtVFGNode(id,copy,Copy)
|
|
284
284
|
{
|
|
285
285
|
|
|
286
286
|
}
|
|
@@ -591,7 +591,7 @@ private:
|
|
|
591
591
|
|
|
592
592
|
public:
|
|
593
593
|
/// Constructor
|
|
594
|
-
GepVFGNode(NodeID id,const
|
|
594
|
+
GepVFGNode(NodeID id,const GepStmt* edge): StmtVFGNode(id,edge,Gep)
|
|
595
595
|
{
|
|
596
596
|
|
|
597
597
|
}
|
|
@@ -753,7 +753,7 @@ private:
|
|
|
753
753
|
|
|
754
754
|
public:
|
|
755
755
|
/// Constructor
|
|
756
|
-
AddrVFGNode(NodeID id, const
|
|
756
|
+
AddrVFGNode(NodeID id, const AddrStmt* edge): StmtVFGNode(id, edge,Addr)
|
|
757
757
|
{
|
|
758
758
|
|
|
759
759
|
}
|
|
@@ -166,13 +166,13 @@ class LoadMU : public MSSAMU<Cond>
|
|
|
166
166
|
{
|
|
167
167
|
|
|
168
168
|
private:
|
|
169
|
-
const
|
|
169
|
+
const LoadStmt* inst;
|
|
170
170
|
const BasicBlock* bb;
|
|
171
171
|
|
|
172
172
|
public:
|
|
173
173
|
/// Constructor/Destructor for MU
|
|
174
174
|
//@{
|
|
175
|
-
LoadMU(const BasicBlock* b,const
|
|
175
|
+
LoadMU(const BasicBlock* b,const LoadStmt* i, const MemRegion* m, Cond c = true) :
|
|
176
176
|
MSSAMU<Cond>(MSSAMU<Cond>::LoadMSSAMU,m,c), inst(i), bb(b)
|
|
177
177
|
{
|
|
178
178
|
}
|
|
@@ -183,7 +183,7 @@ public:
|
|
|
183
183
|
//@}
|
|
184
184
|
|
|
185
185
|
/// Return load instruction
|
|
186
|
-
inline const
|
|
186
|
+
inline const LoadStmt* getLoadInst() const
|
|
187
187
|
{
|
|
188
188
|
return inst;
|
|
189
189
|
}
|
|
@@ -462,11 +462,11 @@ class StoreCHI : public MSSACHI<Cond>
|
|
|
462
462
|
{
|
|
463
463
|
private:
|
|
464
464
|
const BasicBlock* bb;
|
|
465
|
-
const
|
|
465
|
+
const StoreStmt* inst;
|
|
466
466
|
public:
|
|
467
467
|
/// Constructors for StoreCHI
|
|
468
468
|
//@{
|
|
469
|
-
StoreCHI(const BasicBlock* b, const
|
|
469
|
+
StoreCHI(const BasicBlock* b, const StoreStmt* i, const MemRegion* m, Cond c = true) :
|
|
470
470
|
MSSACHI<Cond>(MSSADEF::StoreMSSACHI,m,c), bb(b), inst(i)
|
|
471
471
|
{
|
|
472
472
|
}
|
|
@@ -482,7 +482,7 @@ public:
|
|
|
482
482
|
}
|
|
483
483
|
|
|
484
484
|
/// Get store instruction
|
|
485
|
-
inline const
|
|
485
|
+
inline const StoreStmt* getStoreInst() const
|
|
486
486
|
{
|
|
487
487
|
return inst;
|
|
488
488
|
}
|
|
@@ -146,15 +146,15 @@ public:
|
|
|
146
146
|
/// Map loads/stores to its mem regions,
|
|
147
147
|
/// TODO:visitAtomicCmpXchgInst, visitAtomicRMWInst??
|
|
148
148
|
//@{
|
|
149
|
-
typedef Map<const
|
|
150
|
-
typedef Map<const
|
|
149
|
+
typedef Map<const LoadStmt*, MRSet> LoadsToMRsMap;
|
|
150
|
+
typedef Map<const StoreStmt*, MRSet> StoresToMRsMap;
|
|
151
151
|
typedef Map<const CallBlockNode*, MRSet> CallSiteToMRsMap;
|
|
152
152
|
//@}
|
|
153
153
|
|
|
154
154
|
/// Map loads/stores/callsites to their cpts set
|
|
155
155
|
//@{
|
|
156
|
-
typedef Map<const
|
|
157
|
-
typedef Map<const
|
|
156
|
+
typedef Map<const LoadStmt*, NodeBS> LoadsToPointsToMap;
|
|
157
|
+
typedef Map<const StoreStmt*, NodeBS> StoresToPointsToMap;
|
|
158
158
|
typedef Map<const CallBlockNode*, NodeBS> CallSiteToPointsToMap;
|
|
159
159
|
//@}
|
|
160
160
|
|
|
@@ -334,13 +334,13 @@ protected:
|
|
|
334
334
|
|
|
335
335
|
/// Add cpts to store/load
|
|
336
336
|
//@{
|
|
337
|
-
inline void addCPtsToStore(NodeBS& cpts, const
|
|
337
|
+
inline void addCPtsToStore(NodeBS& cpts, const StoreStmt *st, const SVFFunction* fun)
|
|
338
338
|
{
|
|
339
339
|
storesToPointsToMap[st] = cpts;
|
|
340
340
|
funToPointsToMap[fun].insert(cpts);
|
|
341
341
|
addModSideEffectOfFunction(fun,cpts);
|
|
342
342
|
}
|
|
343
|
-
inline void addCPtsToLoad(NodeBS& cpts, const
|
|
343
|
+
inline void addCPtsToLoad(NodeBS& cpts, const LoadStmt *ld, const SVFFunction* fun)
|
|
344
344
|
{
|
|
345
345
|
loadsToPointsToMap[ld] = cpts;
|
|
346
346
|
funToPointsToMap[fun].insert(cpts);
|
|
@@ -440,11 +440,11 @@ public:
|
|
|
440
440
|
{
|
|
441
441
|
return funToMRsMap[fun];
|
|
442
442
|
}
|
|
443
|
-
inline MRSet& getLoadMRSet(const
|
|
443
|
+
inline MRSet& getLoadMRSet(const LoadStmt* load)
|
|
444
444
|
{
|
|
445
445
|
return loadsToMRsMap[load];
|
|
446
446
|
}
|
|
447
|
-
inline MRSet& getStoreMRSet(const
|
|
447
|
+
inline MRSet& getStoreMRSet(const StoreStmt* store)
|
|
448
448
|
{
|
|
449
449
|
return storesToMRsMap[store];
|
|
450
450
|
}
|
|
@@ -71,8 +71,8 @@ public:
|
|
|
71
71
|
/// Map loads/stores to its mem regions,
|
|
72
72
|
/// TODO:visitAtomicCmpXchgInst, visitAtomicRMWInst??
|
|
73
73
|
//@{
|
|
74
|
-
typedef Map<const
|
|
75
|
-
typedef Map<const
|
|
74
|
+
typedef Map<const LoadStmt*, MUSet> LoadToMUSetMap;
|
|
75
|
+
typedef Map<const StoreStmt*, CHISet> StoreToChiSetMap;
|
|
76
76
|
typedef Map<const CallBlockNode*, MUSet> CallSiteToMUSetMap;
|
|
77
77
|
typedef Map<const CallBlockNode*, CHISet> CallSiteToCHISetMap;
|
|
78
78
|
typedef Map<const BasicBlock*, PHISet> BBToPhiSetMap;
|
|
@@ -180,12 +180,12 @@ private:
|
|
|
180
180
|
|
|
181
181
|
/// Add methods for mus/chis/phis
|
|
182
182
|
//@{
|
|
183
|
-
inline void AddLoadMU(const BasicBlock* bb, const
|
|
183
|
+
inline void AddLoadMU(const BasicBlock* bb, const LoadStmt* load, const MRSet& mrSet)
|
|
184
184
|
{
|
|
185
185
|
for (MRSet::iterator iter = mrSet.begin(), eiter = mrSet.end(); iter != eiter; ++iter)
|
|
186
186
|
AddLoadMU(bb,load,*iter);
|
|
187
187
|
}
|
|
188
|
-
inline void AddStoreCHI(const BasicBlock* bb, const
|
|
188
|
+
inline void AddStoreCHI(const BasicBlock* bb, const StoreStmt* store, const MRSet& mrSet)
|
|
189
189
|
{
|
|
190
190
|
for (MRSet::iterator iter = mrSet.begin(), eiter = mrSet.end(); iter != eiter; ++iter)
|
|
191
191
|
AddStoreCHI(bb,store,*iter);
|
|
@@ -205,13 +205,13 @@ private:
|
|
|
205
205
|
for (MRSet::iterator iter = mrSet.begin(), eiter = mrSet.end(); iter != eiter; ++iter)
|
|
206
206
|
AddMSSAPHI(bb,*iter);
|
|
207
207
|
}
|
|
208
|
-
inline void AddLoadMU(const BasicBlock* bb, const
|
|
208
|
+
inline void AddLoadMU(const BasicBlock* bb, const LoadStmt* load, const MemRegion* mr)
|
|
209
209
|
{
|
|
210
210
|
LOADMU* mu = new LOADMU(bb,load, mr);
|
|
211
211
|
load2MuSetMap[load].insert(mu);
|
|
212
212
|
collectRegUses(mr);
|
|
213
213
|
}
|
|
214
|
-
inline void AddStoreCHI(const BasicBlock* bb, const
|
|
214
|
+
inline void AddStoreCHI(const BasicBlock* bb, const StoreStmt* store, const MemRegion* mr)
|
|
215
215
|
{
|
|
216
216
|
STORECHI* chi = new STORECHI(bb,store, mr);
|
|
217
217
|
store2ChiSetMap[store].insert(chi);
|
|
@@ -331,7 +331,7 @@ public:
|
|
|
331
331
|
//@{
|
|
332
332
|
inline bool hasMU(const PAGEdge* inst) const
|
|
333
333
|
{
|
|
334
|
-
if (const
|
|
334
|
+
if (const LoadStmt* load = SVFUtil::dyn_cast<LoadStmt>(inst))
|
|
335
335
|
{
|
|
336
336
|
assert(0 != load2MuSetMap.count(load)
|
|
337
337
|
&& "not associated with mem region!");
|
|
@@ -342,7 +342,7 @@ public:
|
|
|
342
342
|
}
|
|
343
343
|
inline bool hasCHI(const PAGEdge* inst) const
|
|
344
344
|
{
|
|
345
|
-
if (const
|
|
345
|
+
if (const StoreStmt* store = SVFUtil::dyn_cast<StoreStmt>(
|
|
346
346
|
inst))
|
|
347
347
|
{
|
|
348
348
|
assert(0 != store2ChiSetMap.count(store)
|
|
@@ -385,11 +385,11 @@ public:
|
|
|
385
385
|
|
|
386
386
|
/// Get methods of mu/chi/phi
|
|
387
387
|
//@{
|
|
388
|
-
inline MUSet& getMUSet(const
|
|
388
|
+
inline MUSet& getMUSet(const LoadStmt* ld)
|
|
389
389
|
{
|
|
390
390
|
return load2MuSetMap[ld];
|
|
391
391
|
}
|
|
392
|
-
inline CHISet& getCHISet(const
|
|
392
|
+
inline CHISet& getCHISet(const StoreStmt* st)
|
|
393
393
|
{
|
|
394
394
|
return store2ChiSetMap[st];
|
|
395
395
|
}
|
|
@@ -577,11 +577,11 @@ public:
|
|
|
577
577
|
const PAGNode* node = this->getPAG()->getGNode(*nIter);
|
|
578
578
|
if (this->getPAG()->isValidTopLevelPtr(node))
|
|
579
579
|
{
|
|
580
|
-
if (SVFUtil::isa<
|
|
580
|
+
if (SVFUtil::isa<DummyObjVar>(node))
|
|
581
581
|
{
|
|
582
582
|
SVFUtil::outs() << "##<Blackhole or constant> id:" << node->getId();
|
|
583
583
|
}
|
|
584
|
-
else if (!SVFUtil::isa<
|
|
584
|
+
else if (!SVFUtil::isa<DummyValVar>(node))
|
|
585
585
|
{
|
|
586
586
|
SVFUtil::outs() << "##<" << node->getValue()->getName() << "> ";
|
|
587
587
|
//SVFUtil::outs() << "Source Loc: " << SVFUtil::getSourceLoc(node->getValue());
|
|
@@ -55,8 +55,8 @@ public:
|
|
|
55
55
|
typedef Map<NodeID,NodeBS> MemObjToFieldsMap;
|
|
56
56
|
typedef std::vector<const SVFStmt*> PAGEdgeList;
|
|
57
57
|
typedef std::vector<const SVFVar*> PAGNodeList;
|
|
58
|
-
typedef std::vector<const
|
|
59
|
-
typedef Map<const SVFVar*,
|
|
58
|
+
typedef std::vector<const CopyStmt*> CopyPEList;
|
|
59
|
+
typedef Map<const SVFVar*,PhiStmt*> PHINodeMap;
|
|
60
60
|
typedef Map<const SVFFunction*,PAGNodeList> FunToArgsListMap;
|
|
61
61
|
typedef Map<const CallBlockNode*,PAGNodeList> CSToArgsListMap;
|
|
62
62
|
typedef Map<const RetBlockNode*,const SVFVar*> CSToRetMap;
|
|
@@ -292,7 +292,7 @@ public:
|
|
|
292
292
|
}
|
|
293
293
|
//@}
|
|
294
294
|
|
|
295
|
-
/// Due to constaint expression, curInst is used to distinguish different instructions (e.g., memorycpy) when creating
|
|
295
|
+
/// Due to constaint expression, curInst is used to distinguish different instructions (e.g., memorycpy) when creating GepValVar.
|
|
296
296
|
inline NodeID getGepValNode(const Value* curInst, NodeID base, const LocationSet& ls) const
|
|
297
297
|
{
|
|
298
298
|
GepValPNMap::const_iterator iter = GepValNodeMap.find(curInst);
|
|
@@ -353,17 +353,17 @@ public:
|
|
|
353
353
|
|
|
354
354
|
/// Get memory object - Return memory object according to pag node id
|
|
355
355
|
/// return whole allocated memory object if this node is a gep obj node
|
|
356
|
-
/// return nullptr is this node is not a
|
|
356
|
+
/// return nullptr is this node is not a ObjVar type
|
|
357
357
|
//@{
|
|
358
358
|
inline const MemObj*getObject(NodeID id) const
|
|
359
359
|
{
|
|
360
360
|
const SVFVar* node = getGNode(id);
|
|
361
|
-
if(const
|
|
361
|
+
if(const ObjVar* objPN = SVFUtil::dyn_cast<ObjVar>(node))
|
|
362
362
|
return getObject(objPN);
|
|
363
363
|
else
|
|
364
364
|
return nullptr;
|
|
365
365
|
}
|
|
366
|
-
inline const MemObj*getObject(const
|
|
366
|
+
inline const MemObj*getObject(const ObjVar* node) const
|
|
367
367
|
{
|
|
368
368
|
return node->getMemObj();
|
|
369
369
|
}
|
|
@@ -382,8 +382,8 @@ public:
|
|
|
382
382
|
inline NodeID getFIObjNode(NodeID id) const
|
|
383
383
|
{
|
|
384
384
|
SVFVar* node = pag->getGNode(id);
|
|
385
|
-
assert(SVFUtil::isa<
|
|
386
|
-
|
|
385
|
+
assert(SVFUtil::isa<ObjVar>(node) && "need an object node");
|
|
386
|
+
ObjVar* obj = SVFUtil::cast<ObjVar>(node);
|
|
387
387
|
return getFIObjNode(obj->getMemObj());
|
|
388
388
|
}
|
|
389
389
|
//@}
|
|
@@ -415,7 +415,7 @@ public:
|
|
|
415
415
|
inline bool isNonPointerObj(NodeID id) const
|
|
416
416
|
{
|
|
417
417
|
SVFVar* node = getGNode(id);
|
|
418
|
-
if (
|
|
418
|
+
if (FIObjVar* fiNode = SVFUtil::dyn_cast<FIObjVar>(node))
|
|
419
419
|
{
|
|
420
420
|
return (fiNode->getMemObj()->hasPtrObj() == false);
|
|
421
421
|
}
|
|
@@ -423,7 +423,7 @@ public:
|
|
|
423
423
|
{
|
|
424
424
|
return (gepNode->getMemObj()->isNonPtrFieldObj(gepNode->getLocationSet()));
|
|
425
425
|
}
|
|
426
|
-
else if (SVFUtil::isa<
|
|
426
|
+
else if (SVFUtil::isa<DummyObjVar>(node))
|
|
427
427
|
{
|
|
428
428
|
return false;
|
|
429
429
|
}
|
|
@@ -447,8 +447,8 @@ public:
|
|
|
447
447
|
inline const MemObj* getBaseObj(NodeID id) const
|
|
448
448
|
{
|
|
449
449
|
const SVFVar* node = pag->getGNode(id);
|
|
450
|
-
assert(SVFUtil::isa<
|
|
451
|
-
const
|
|
450
|
+
assert(SVFUtil::isa<ObjVar>(node) && "need an object node");
|
|
451
|
+
const ObjVar* obj = SVFUtil::cast<ObjVar>(node);
|
|
452
452
|
return obj->getMemObj();
|
|
453
453
|
}
|
|
454
454
|
//@}
|
|
@@ -530,7 +530,7 @@ private:
|
|
|
530
530
|
/// Add a value (pointer) node
|
|
531
531
|
inline NodeID addValNode(const Value* val, NodeID i)
|
|
532
532
|
{
|
|
533
|
-
SVFVar *node = new
|
|
533
|
+
SVFVar *node = new ValVar(val,i);
|
|
534
534
|
return addValNode(val, node, i);
|
|
535
535
|
}
|
|
536
536
|
/// Add a memory obj node
|
|
@@ -565,12 +565,12 @@ private:
|
|
|
565
565
|
//@{
|
|
566
566
|
inline NodeID addDummyValNode(NodeID i)
|
|
567
567
|
{
|
|
568
|
-
return addValNode(nullptr, new
|
|
568
|
+
return addValNode(nullptr, new DummyValVar(i), i);
|
|
569
569
|
}
|
|
570
570
|
inline NodeID addDummyObjNode(NodeID i, const Type* type)
|
|
571
571
|
{
|
|
572
572
|
const MemObj* mem = addDummyMemObj(i, type);
|
|
573
|
-
return addObjNode(nullptr, new
|
|
573
|
+
return addObjNode(nullptr, new DummyObjVar(i,mem), i);
|
|
574
574
|
}
|
|
575
575
|
inline const MemObj* addDummyMemObj(NodeID i, const Type* type)
|
|
576
576
|
{
|
|
@@ -578,11 +578,11 @@ private:
|
|
|
578
578
|
}
|
|
579
579
|
inline NodeID addBlackholeObjNode()
|
|
580
580
|
{
|
|
581
|
-
return addObjNode(nullptr, new
|
|
581
|
+
return addObjNode(nullptr, new DummyObjVar(getBlackHoleNode(),getBlackHoleObj()), getBlackHoleNode());
|
|
582
582
|
}
|
|
583
583
|
inline NodeID addConstantObjNode()
|
|
584
584
|
{
|
|
585
|
-
return addObjNode(nullptr, new
|
|
585
|
+
return addObjNode(nullptr, new DummyObjVar(getConstantNode(),getConstantObj()), getConstantNode());
|
|
586
586
|
}
|
|
587
587
|
inline NodeID addBlackholePtrNode()
|
|
588
588
|
{
|
|
@@ -626,33 +626,33 @@ private:
|
|
|
626
626
|
/// Add an edge into SVFIR
|
|
627
627
|
//@{
|
|
628
628
|
/// Add Address edge
|
|
629
|
-
|
|
629
|
+
AddrStmt* addAddrPE(NodeID src, NodeID dst);
|
|
630
630
|
/// Add Copy edge
|
|
631
|
-
|
|
631
|
+
CopyStmt* addCopyPE(NodeID src, NodeID dst);
|
|
632
632
|
/// Add phi node information
|
|
633
|
-
|
|
633
|
+
PhiStmt* addPhiNode(NodeID res, NodeID opnd);
|
|
634
634
|
/// Add Copy edge
|
|
635
|
-
|
|
635
|
+
CmpStmt* addCmpPE(NodeID op1, NodeID op2, NodeID dst, u32_t opcode);
|
|
636
636
|
/// Add Copy edge
|
|
637
|
-
|
|
637
|
+
BinaryOPStmt* addBinaryOPPE(NodeID op1, NodeID op2, NodeID dst, u32_t opcode);
|
|
638
638
|
/// Add Unary edge
|
|
639
|
-
|
|
639
|
+
UnaryOPStmt* addUnaryOPPE(NodeID src, NodeID dst, u32_t opcode);
|
|
640
640
|
/// Add BranchStmt
|
|
641
641
|
BranchStmt* addBranchStmt(NodeID br, NodeID cond, std::vector<const ICFGNode*> succs);
|
|
642
642
|
/// Add Load edge
|
|
643
|
-
|
|
643
|
+
LoadStmt* addLoadPE(NodeID src, NodeID dst);
|
|
644
644
|
/// Add Store edge
|
|
645
|
-
|
|
645
|
+
StoreStmt* addStorePE(NodeID src, NodeID dst, const IntraBlockNode* val);
|
|
646
646
|
/// Add Call edge
|
|
647
647
|
CallPE* addCallPE(NodeID src, NodeID dst, const CallBlockNode* cs);
|
|
648
648
|
/// Add Return edge
|
|
649
649
|
RetPE* addRetPE(NodeID src, NodeID dst, const CallBlockNode* cs);
|
|
650
650
|
/// Add Gep edge
|
|
651
|
-
|
|
651
|
+
GepStmt* addGepPE(NodeID src, NodeID dst, const LocationSet& ls, bool constGep);
|
|
652
652
|
/// Add Offset(Gep) edge
|
|
653
|
-
|
|
653
|
+
NormalGepStmt* addNormalGepPE(NodeID src, NodeID dst, const LocationSet& ls);
|
|
654
654
|
/// Add Variant(Gep) edge
|
|
655
|
-
|
|
655
|
+
VariantGepStmt* addVariantGepPE(NodeID src, NodeID dst);
|
|
656
656
|
/// Add Thread fork edge for parameter passing
|
|
657
657
|
TDForkPE* addThreadForkPE(NodeID src, NodeID dst, const CallBlockNode* cs);
|
|
658
658
|
/// Add Thread join edge for parameter passing
|
|
@@ -193,16 +193,16 @@ private:
|
|
|
193
193
|
/*!
|
|
194
194
|
* Copy edge
|
|
195
195
|
*/
|
|
196
|
-
class
|
|
196
|
+
class AddrStmt: public SVFStmt
|
|
197
197
|
{
|
|
198
198
|
private:
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
void operator=(const
|
|
199
|
+
AddrStmt(); ///< place holder
|
|
200
|
+
AddrStmt(const AddrStmt &); ///< place holder
|
|
201
|
+
void operator=(const AddrStmt &); ///< place holder
|
|
202
202
|
public:
|
|
203
203
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
204
204
|
//@{
|
|
205
|
-
static inline bool classof(const
|
|
205
|
+
static inline bool classof(const AddrStmt *)
|
|
206
206
|
{
|
|
207
207
|
return true;
|
|
208
208
|
}
|
|
@@ -217,7 +217,7 @@ public:
|
|
|
217
217
|
//@}
|
|
218
218
|
|
|
219
219
|
/// constructor
|
|
220
|
-
|
|
220
|
+
AddrStmt(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::Addr)
|
|
221
221
|
{
|
|
222
222
|
}
|
|
223
223
|
|
|
@@ -228,16 +228,16 @@ public:
|
|
|
228
228
|
/*!
|
|
229
229
|
* Copy edge
|
|
230
230
|
*/
|
|
231
|
-
class
|
|
231
|
+
class CopyStmt: public SVFStmt
|
|
232
232
|
{
|
|
233
233
|
private:
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
void operator=(const
|
|
234
|
+
CopyStmt(); ///< place holder
|
|
235
|
+
CopyStmt(const CopyStmt &); ///< place holder
|
|
236
|
+
void operator=(const CopyStmt &); ///< place holder
|
|
237
237
|
public:
|
|
238
238
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
239
239
|
//@{
|
|
240
|
-
static inline bool classof(const
|
|
240
|
+
static inline bool classof(const CopyStmt *)
|
|
241
241
|
{
|
|
242
242
|
return true;
|
|
243
243
|
}
|
|
@@ -252,7 +252,7 @@ public:
|
|
|
252
252
|
//@}
|
|
253
253
|
|
|
254
254
|
/// constructor
|
|
255
|
-
|
|
255
|
+
CopyStmt(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::Copy)
|
|
256
256
|
{
|
|
257
257
|
}
|
|
258
258
|
|
|
@@ -325,12 +325,12 @@ public:
|
|
|
325
325
|
/*!
|
|
326
326
|
* Phi instruction edge
|
|
327
327
|
*/
|
|
328
|
-
class
|
|
328
|
+
class PhiStmt: public MultiOpndStmt
|
|
329
329
|
{
|
|
330
330
|
private:
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
void operator=(const
|
|
331
|
+
PhiStmt(); ///< place holder
|
|
332
|
+
PhiStmt(const PhiStmt &); ///< place holder
|
|
333
|
+
void operator=(const PhiStmt &); ///< place holder
|
|
334
334
|
SVFVar* getSrcNode(); ///< place holder, not allowed since this SVFStmt has multiple operands but not a single source
|
|
335
335
|
SVFVar* getDstNode(); ///< place holder, use getRes() instead
|
|
336
336
|
SVFVar* getSrcID(); ///< place holder, use getOpVarID(pos) instead
|
|
@@ -339,7 +339,7 @@ private:
|
|
|
339
339
|
public:
|
|
340
340
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
341
341
|
//@{
|
|
342
|
-
static inline bool classof(const
|
|
342
|
+
static inline bool classof(const PhiStmt *)
|
|
343
343
|
{
|
|
344
344
|
return true;
|
|
345
345
|
}
|
|
@@ -358,7 +358,7 @@ public:
|
|
|
358
358
|
//@}
|
|
359
359
|
|
|
360
360
|
/// constructor
|
|
361
|
-
|
|
361
|
+
PhiStmt(SVFVar* s, const OPVars& opnds) : MultiOpndStmt(s,opnds,SVFStmt::Phi)
|
|
362
362
|
{
|
|
363
363
|
}
|
|
364
364
|
void addOpVar(SVFVar* op){
|
|
@@ -371,12 +371,12 @@ public:
|
|
|
371
371
|
/*!
|
|
372
372
|
* Compare instruction edge
|
|
373
373
|
*/
|
|
374
|
-
class
|
|
374
|
+
class CmpStmt: public MultiOpndStmt
|
|
375
375
|
{
|
|
376
376
|
private:
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
void operator=(const
|
|
377
|
+
CmpStmt(); ///< place holder
|
|
378
|
+
CmpStmt(const CmpStmt &); ///< place holder
|
|
379
|
+
void operator=(const CmpStmt &); ///< place holder
|
|
380
380
|
SVFVar* getSrcNode(); ///< place holder, not allowed since this SVFStmt has multiple operands but not a single source
|
|
381
381
|
SVFVar* getDstNode(); ///< place holder, use getRes() instead
|
|
382
382
|
SVFVar* getSrcID(); ///< place holder, use getOpVarID(pos) instead
|
|
@@ -386,7 +386,7 @@ private:
|
|
|
386
386
|
public:
|
|
387
387
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
388
388
|
//@{
|
|
389
|
-
static inline bool classof(const
|
|
389
|
+
static inline bool classof(const CmpStmt *)
|
|
390
390
|
{
|
|
391
391
|
return true;
|
|
392
392
|
}
|
|
@@ -405,7 +405,7 @@ public:
|
|
|
405
405
|
//@}
|
|
406
406
|
|
|
407
407
|
/// constructor
|
|
408
|
-
|
|
408
|
+
CmpStmt(SVFVar* s, const OPVars& opnds, u32_t oc) : MultiOpndStmt(s,opnds,SVFStmt::Cmp), opcode(oc)
|
|
409
409
|
{
|
|
410
410
|
}
|
|
411
411
|
|
|
@@ -421,12 +421,12 @@ public:
|
|
|
421
421
|
/*!
|
|
422
422
|
* Binary instruction edge
|
|
423
423
|
*/
|
|
424
|
-
class
|
|
424
|
+
class BinaryOPStmt: public MultiOpndStmt
|
|
425
425
|
{
|
|
426
426
|
private:
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
void operator=(const
|
|
427
|
+
BinaryOPStmt(); ///< place holder
|
|
428
|
+
BinaryOPStmt(const BinaryOPStmt &); ///< place holder
|
|
429
|
+
void operator=(const BinaryOPStmt &); ///< place holder
|
|
430
430
|
SVFVar* getSrcNode(); ///< place holder, not allowed since this SVFStmt has multiple operands but not a single source
|
|
431
431
|
SVFVar* getDstNode(); ///< place holder, use getRes() instead
|
|
432
432
|
SVFVar* getSrcID(); ///< place holder, use getOpVarID(pos) instead
|
|
@@ -437,7 +437,7 @@ private:
|
|
|
437
437
|
public:
|
|
438
438
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
439
439
|
//@{
|
|
440
|
-
static inline bool classof(const
|
|
440
|
+
static inline bool classof(const BinaryOPStmt *)
|
|
441
441
|
{
|
|
442
442
|
return true;
|
|
443
443
|
}
|
|
@@ -456,7 +456,7 @@ public:
|
|
|
456
456
|
//@}
|
|
457
457
|
|
|
458
458
|
/// constructor
|
|
459
|
-
|
|
459
|
+
BinaryOPStmt(SVFVar* s, const OPVars& opnds, u32_t oc) : MultiOpndStmt(s,opnds,SVFStmt::BinaryOp), opcode(oc)
|
|
460
460
|
{
|
|
461
461
|
}
|
|
462
462
|
|
|
@@ -471,12 +471,12 @@ public:
|
|
|
471
471
|
/*!
|
|
472
472
|
* Unary instruction edge
|
|
473
473
|
*/
|
|
474
|
-
class
|
|
474
|
+
class UnaryOPStmt: public SVFStmt
|
|
475
475
|
{
|
|
476
476
|
private:
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
void operator=(const
|
|
477
|
+
UnaryOPStmt(); ///< place holder
|
|
478
|
+
UnaryOPStmt(const UnaryOPStmt &); ///< place holder
|
|
479
|
+
void operator=(const UnaryOPStmt &); ///< place holder
|
|
480
480
|
SVFVar* getSrcNode(); ///< place holder, use getOpVar() instead
|
|
481
481
|
SVFVar* getDstNode(); ///< place holder, use getRes() instead
|
|
482
482
|
SVFVar* getSrcID(); ///< place holder, use getOpVarID() instead
|
|
@@ -486,7 +486,7 @@ private:
|
|
|
486
486
|
public:
|
|
487
487
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
488
488
|
//@{
|
|
489
|
-
static inline bool classof(const
|
|
489
|
+
static inline bool classof(const UnaryOPStmt *)
|
|
490
490
|
{
|
|
491
491
|
return true;
|
|
492
492
|
}
|
|
@@ -501,7 +501,7 @@ public:
|
|
|
501
501
|
//@}
|
|
502
502
|
|
|
503
503
|
/// constructor
|
|
504
|
-
|
|
504
|
+
UnaryOPStmt(SVFVar* s, SVFVar* d, u32_t oc) : SVFStmt(s,d,SVFStmt::UnaryOp), opcode(oc)
|
|
505
505
|
{
|
|
506
506
|
}
|
|
507
507
|
|
|
@@ -588,17 +588,17 @@ public:
|
|
|
588
588
|
/*!
|
|
589
589
|
* Store edge
|
|
590
590
|
*/
|
|
591
|
-
class
|
|
591
|
+
class StoreStmt: public SVFStmt
|
|
592
592
|
{
|
|
593
593
|
private:
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
void operator=(const
|
|
594
|
+
StoreStmt(); ///< place holder
|
|
595
|
+
StoreStmt(const StoreStmt &); ///< place holder
|
|
596
|
+
void operator=(const StoreStmt &); ///< place holder
|
|
597
597
|
|
|
598
598
|
public:
|
|
599
599
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
600
600
|
//@{
|
|
601
|
-
static inline bool classof(const
|
|
601
|
+
static inline bool classof(const StoreStmt *)
|
|
602
602
|
{
|
|
603
603
|
return true;
|
|
604
604
|
}
|
|
@@ -613,7 +613,7 @@ public:
|
|
|
613
613
|
//@}
|
|
614
614
|
|
|
615
615
|
/// constructor
|
|
616
|
-
|
|
616
|
+
StoreStmt(SVFVar* s, SVFVar* d, const IntraBlockNode* st) :
|
|
617
617
|
SVFStmt(s, d, makeEdgeFlagWithStoreInst(SVFStmt::Store, st))
|
|
618
618
|
{
|
|
619
619
|
}
|
|
@@ -625,17 +625,17 @@ public:
|
|
|
625
625
|
/*!
|
|
626
626
|
* Load edge
|
|
627
627
|
*/
|
|
628
|
-
class
|
|
628
|
+
class LoadStmt: public SVFStmt
|
|
629
629
|
{
|
|
630
630
|
private:
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
void operator=(const
|
|
631
|
+
LoadStmt(); ///< place holder
|
|
632
|
+
LoadStmt(const LoadStmt &); ///< place holder
|
|
633
|
+
void operator=(const LoadStmt &); ///< place holder
|
|
634
634
|
|
|
635
635
|
public:
|
|
636
636
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
637
637
|
//@{
|
|
638
|
-
static inline bool classof(const
|
|
638
|
+
static inline bool classof(const LoadStmt *)
|
|
639
639
|
{
|
|
640
640
|
return true;
|
|
641
641
|
}
|
|
@@ -650,7 +650,7 @@ public:
|
|
|
650
650
|
//@}
|
|
651
651
|
|
|
652
652
|
/// constructor
|
|
653
|
-
|
|
653
|
+
LoadStmt(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::Load)
|
|
654
654
|
{
|
|
655
655
|
}
|
|
656
656
|
|
|
@@ -661,17 +661,17 @@ public:
|
|
|
661
661
|
/*!
|
|
662
662
|
* Gep edge
|
|
663
663
|
*/
|
|
664
|
-
class
|
|
664
|
+
class GepStmt: public SVFStmt
|
|
665
665
|
{
|
|
666
666
|
private:
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
void operator=(const
|
|
667
|
+
GepStmt(); ///< place holder
|
|
668
|
+
GepStmt(const GepStmt &); ///< place holder
|
|
669
|
+
void operator=(const GepStmt &); ///< place holder
|
|
670
670
|
|
|
671
671
|
public:
|
|
672
672
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
673
673
|
//@{
|
|
674
|
-
static inline bool classof(const
|
|
674
|
+
static inline bool classof(const GepStmt *)
|
|
675
675
|
{
|
|
676
676
|
return true;
|
|
677
677
|
}
|
|
@@ -689,7 +689,7 @@ public:
|
|
|
689
689
|
|
|
690
690
|
protected:
|
|
691
691
|
/// constructor
|
|
692
|
-
|
|
692
|
+
GepStmt(SVFVar* s, SVFVar* d, PEDGEK k) : SVFStmt(s,d,k)
|
|
693
693
|
{
|
|
694
694
|
|
|
695
695
|
}
|
|
@@ -701,23 +701,23 @@ protected:
|
|
|
701
701
|
/*!
|
|
702
702
|
* Gep edge with a fixed offset
|
|
703
703
|
*/
|
|
704
|
-
class
|
|
704
|
+
class NormalGepStmt : public GepStmt
|
|
705
705
|
{
|
|
706
706
|
private:
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
void operator=(const
|
|
707
|
+
NormalGepStmt(); ///< place holder
|
|
708
|
+
NormalGepStmt(const NormalGepStmt&); ///< place holder
|
|
709
|
+
void operator=(const NormalGepStmt&); ///< place holder
|
|
710
710
|
|
|
711
711
|
LocationSet ls; ///< location set of the gep edge
|
|
712
712
|
|
|
713
713
|
public:
|
|
714
714
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
715
715
|
//@{
|
|
716
|
-
static inline bool classof(const
|
|
716
|
+
static inline bool classof(const NormalGepStmt *)
|
|
717
717
|
{
|
|
718
718
|
return true;
|
|
719
719
|
}
|
|
720
|
-
static inline bool classof(const
|
|
720
|
+
static inline bool classof(const GepStmt *edge)
|
|
721
721
|
{
|
|
722
722
|
return edge->getEdgeKind() == SVFStmt::NormalGep;
|
|
723
723
|
}
|
|
@@ -732,7 +732,7 @@ public:
|
|
|
732
732
|
//@}
|
|
733
733
|
|
|
734
734
|
/// constructor
|
|
735
|
-
|
|
735
|
+
NormalGepStmt(SVFVar* s, SVFVar* d, const LocationSet& l) : GepStmt(s,d,SVFStmt::NormalGep), ls(l)
|
|
736
736
|
{}
|
|
737
737
|
|
|
738
738
|
/// offset of the gep edge
|
|
@@ -751,21 +751,21 @@ public:
|
|
|
751
751
|
/*!
|
|
752
752
|
* Gep edge with a variant offset
|
|
753
753
|
*/
|
|
754
|
-
class
|
|
754
|
+
class VariantGepStmt : public GepStmt
|
|
755
755
|
{
|
|
756
756
|
private:
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
void operator=(const
|
|
757
|
+
VariantGepStmt(); ///< place holder
|
|
758
|
+
VariantGepStmt(const VariantGepStmt&); ///< place holder
|
|
759
|
+
void operator=(const VariantGepStmt&); ///< place holder
|
|
760
760
|
|
|
761
761
|
public:
|
|
762
762
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
763
763
|
//@{
|
|
764
|
-
static inline bool classof(const
|
|
764
|
+
static inline bool classof(const VariantGepStmt *)
|
|
765
765
|
{
|
|
766
766
|
return true;
|
|
767
767
|
}
|
|
768
|
-
static inline bool classof(const
|
|
768
|
+
static inline bool classof(const GepStmt *edge)
|
|
769
769
|
{
|
|
770
770
|
return edge->getEdgeKind() == SVFStmt::VariantGep;
|
|
771
771
|
}
|
|
@@ -780,7 +780,7 @@ public:
|
|
|
780
780
|
//@}
|
|
781
781
|
|
|
782
782
|
/// constructor
|
|
783
|
-
|
|
783
|
+
VariantGepStmt(SVFVar* s, SVFVar* d) : GepStmt(s,d,SVFStmt::VariantGep) {}
|
|
784
784
|
|
|
785
785
|
virtual const std::string toString() const override;
|
|
786
786
|
|
|
@@ -270,13 +270,13 @@ public:
|
|
|
270
270
|
/*
|
|
271
271
|
* Value(Pointer) node
|
|
272
272
|
*/
|
|
273
|
-
class
|
|
273
|
+
class ValVar: public SVFVar
|
|
274
274
|
{
|
|
275
275
|
|
|
276
276
|
public:
|
|
277
277
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
278
278
|
//@{
|
|
279
|
-
static inline bool classof(const
|
|
279
|
+
static inline bool classof(const ValVar *)
|
|
280
280
|
{
|
|
281
281
|
return true;
|
|
282
282
|
}
|
|
@@ -295,7 +295,7 @@ public:
|
|
|
295
295
|
//@}
|
|
296
296
|
|
|
297
297
|
/// Constructor
|
|
298
|
-
|
|
298
|
+
ValVar(const Value* val, NodeID i, PNODEK ty = ValNode) :
|
|
299
299
|
SVFVar(val, i, ty)
|
|
300
300
|
{
|
|
301
301
|
}
|
|
@@ -314,20 +314,20 @@ public:
|
|
|
314
314
|
/*
|
|
315
315
|
* Memory Object node
|
|
316
316
|
*/
|
|
317
|
-
class
|
|
317
|
+
class ObjVar: public SVFVar
|
|
318
318
|
{
|
|
319
319
|
|
|
320
320
|
protected:
|
|
321
321
|
const MemObj* mem; ///< memory object
|
|
322
322
|
/// Constructor
|
|
323
|
-
|
|
323
|
+
ObjVar(const Value* val, NodeID i, const MemObj* m, PNODEK ty = ObjNode) :
|
|
324
324
|
SVFVar(val, i, ty), mem(m)
|
|
325
325
|
{
|
|
326
326
|
}
|
|
327
327
|
public:
|
|
328
328
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
329
329
|
//@{
|
|
330
|
-
static inline bool classof(const
|
|
330
|
+
static inline bool classof(const ObjVar *)
|
|
331
331
|
{
|
|
332
332
|
return true;
|
|
333
333
|
}
|
|
@@ -381,7 +381,7 @@ public:
|
|
|
381
381
|
* e.g. memcpy, temp gep value node needs to be created
|
|
382
382
|
* Each Gep Value node is connected to base value node via gep edge
|
|
383
383
|
*/
|
|
384
|
-
class
|
|
384
|
+
class GepValVar: public ValVar
|
|
385
385
|
{
|
|
386
386
|
|
|
387
387
|
private:
|
|
@@ -392,11 +392,11 @@ private:
|
|
|
392
392
|
public:
|
|
393
393
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
394
394
|
//@{
|
|
395
|
-
static inline bool classof(const
|
|
395
|
+
static inline bool classof(const GepValVar *)
|
|
396
396
|
{
|
|
397
397
|
return true;
|
|
398
398
|
}
|
|
399
|
-
static inline bool classof(const
|
|
399
|
+
static inline bool classof(const ValVar * node)
|
|
400
400
|
{
|
|
401
401
|
return node->getNodeKind() == SVFVar::GepValNode;
|
|
402
402
|
}
|
|
@@ -411,8 +411,8 @@ public:
|
|
|
411
411
|
//@}
|
|
412
412
|
|
|
413
413
|
/// Constructor
|
|
414
|
-
|
|
415
|
-
|
|
414
|
+
GepValVar(const Value* val, NodeID i, const LocationSet& l, const Type *ty, u32_t idx) :
|
|
415
|
+
ValVar(val, i, GepValNode), ls(l), gepValType(ty), fieldIdx(idx)
|
|
416
416
|
{
|
|
417
417
|
}
|
|
418
418
|
|
|
@@ -448,7 +448,7 @@ public:
|
|
|
448
448
|
* Gep Obj node, this is dynamic generated for field sensitive analysis
|
|
449
449
|
* Each gep obj node is one field of a MemObj (base)
|
|
450
450
|
*/
|
|
451
|
-
class GepObjPN: public
|
|
451
|
+
class GepObjPN: public ObjVar
|
|
452
452
|
{
|
|
453
453
|
private:
|
|
454
454
|
LocationSet ls;
|
|
@@ -461,7 +461,7 @@ public:
|
|
|
461
461
|
{
|
|
462
462
|
return true;
|
|
463
463
|
}
|
|
464
|
-
static inline bool classof(const
|
|
464
|
+
static inline bool classof(const ObjVar * node)
|
|
465
465
|
{
|
|
466
466
|
return node->getNodeKind() == SVFVar::GepObjNode
|
|
467
467
|
|| node->getNodeKind() == SVFVar::CloneGepObjNode;
|
|
@@ -480,7 +480,7 @@ public:
|
|
|
480
480
|
|
|
481
481
|
/// Constructor
|
|
482
482
|
GepObjPN(const MemObj* mem, NodeID i, const LocationSet& l, PNODEK ty = GepObjNode) :
|
|
483
|
-
|
|
483
|
+
ObjVar(mem->getValue(), i, mem, ty), ls(l)
|
|
484
484
|
{
|
|
485
485
|
base = mem->getId();
|
|
486
486
|
}
|
|
@@ -524,17 +524,17 @@ public:
|
|
|
524
524
|
* Field-insensitive Gep Obj node, this is dynamic generated for field sensitive analysis
|
|
525
525
|
* Each field-insensitive gep obj node represents all fields of a MemObj (base)
|
|
526
526
|
*/
|
|
527
|
-
class
|
|
527
|
+
class FIObjVar: public ObjVar
|
|
528
528
|
{
|
|
529
529
|
public:
|
|
530
530
|
|
|
531
531
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
532
532
|
//@{
|
|
533
|
-
static inline bool classof(const
|
|
533
|
+
static inline bool classof(const FIObjVar *)
|
|
534
534
|
{
|
|
535
535
|
return true;
|
|
536
536
|
}
|
|
537
|
-
static inline bool classof(const
|
|
537
|
+
static inline bool classof(const ObjVar * node)
|
|
538
538
|
{
|
|
539
539
|
return node->getNodeKind() == SVFVar::FIObjNode
|
|
540
540
|
|| node->getNodeKind() == SVFVar::CloneFIObjNode;
|
|
@@ -552,8 +552,8 @@ public:
|
|
|
552
552
|
//@}
|
|
553
553
|
|
|
554
554
|
/// Constructor
|
|
555
|
-
|
|
556
|
-
|
|
555
|
+
FIObjVar(const Value* val, NodeID i, const MemObj* mem, PNODEK ty = FIObjNode) :
|
|
556
|
+
ObjVar(val, i, mem, ty)
|
|
557
557
|
{
|
|
558
558
|
}
|
|
559
559
|
|
|
@@ -651,13 +651,13 @@ public:
|
|
|
651
651
|
/*
|
|
652
652
|
* Dummy node
|
|
653
653
|
*/
|
|
654
|
-
class
|
|
654
|
+
class DummyValVar: public ValVar
|
|
655
655
|
{
|
|
656
656
|
|
|
657
657
|
public:
|
|
658
658
|
|
|
659
659
|
//@{ Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
660
|
-
static inline bool classof(const
|
|
660
|
+
static inline bool classof(const DummyValVar *)
|
|
661
661
|
{
|
|
662
662
|
return true;
|
|
663
663
|
}
|
|
@@ -672,7 +672,7 @@ public:
|
|
|
672
672
|
//@}
|
|
673
673
|
|
|
674
674
|
/// Constructor
|
|
675
|
-
|
|
675
|
+
DummyValVar(NodeID i) : ValVar(nullptr, i, DummyValNode)
|
|
676
676
|
{
|
|
677
677
|
}
|
|
678
678
|
|
|
@@ -690,13 +690,13 @@ public:
|
|
|
690
690
|
/*
|
|
691
691
|
* Dummy node
|
|
692
692
|
*/
|
|
693
|
-
class
|
|
693
|
+
class DummyObjVar: public ObjVar
|
|
694
694
|
{
|
|
695
695
|
|
|
696
696
|
public:
|
|
697
697
|
|
|
698
698
|
//@{ Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
699
|
-
static inline bool classof(const
|
|
699
|
+
static inline bool classof(const DummyObjVar *)
|
|
700
700
|
{
|
|
701
701
|
return true;
|
|
702
702
|
}
|
|
@@ -713,8 +713,8 @@ public:
|
|
|
713
713
|
//@}
|
|
714
714
|
|
|
715
715
|
/// Constructor
|
|
716
|
-
|
|
717
|
-
:
|
|
716
|
+
DummyObjVar(NodeID i,const MemObj* m, PNODEK ty = DummyObjNode)
|
|
717
|
+
: ObjVar(nullptr, i, m, ty)
|
|
718
718
|
{
|
|
719
719
|
}
|
|
720
720
|
|
|
@@ -730,11 +730,11 @@ public:
|
|
|
730
730
|
/*
|
|
731
731
|
* Clone object node for dummy objects.
|
|
732
732
|
*/
|
|
733
|
-
class
|
|
733
|
+
class CloneDummyObjVar: public DummyObjVar
|
|
734
734
|
{
|
|
735
735
|
public:
|
|
736
736
|
//@{ Methods to support type inquiry through isa, cast, and dyn_cast:
|
|
737
|
-
static inline bool classof(const
|
|
737
|
+
static inline bool classof(const CloneDummyObjVar *)
|
|
738
738
|
{
|
|
739
739
|
return true;
|
|
740
740
|
}
|
|
@@ -749,15 +749,15 @@ public:
|
|
|
749
749
|
//@}
|
|
750
750
|
|
|
751
751
|
/// Constructor
|
|
752
|
-
|
|
753
|
-
:
|
|
752
|
+
CloneDummyObjVar(NodeID i, const MemObj* m, PNODEK ty = CloneDummyObjNode)
|
|
753
|
+
: DummyObjVar(i, m, ty)
|
|
754
754
|
{
|
|
755
755
|
}
|
|
756
756
|
|
|
757
757
|
/// Return name of this node
|
|
758
758
|
inline const std::string getValueName() const
|
|
759
759
|
{
|
|
760
|
-
return "clone of " +
|
|
760
|
+
return "clone of " + ObjVar::getValueName();
|
|
761
761
|
}
|
|
762
762
|
|
|
763
763
|
virtual const std::string toString() const;
|
|
@@ -766,11 +766,11 @@ public:
|
|
|
766
766
|
/*
|
|
767
767
|
* Clone object for GEP objects.
|
|
768
768
|
*/
|
|
769
|
-
class
|
|
769
|
+
class CloneGepObjVar : public GepObjPN
|
|
770
770
|
{
|
|
771
771
|
public:
|
|
772
772
|
//@{ Methods to support type inquiry through isa, cast, and dyn_cast:
|
|
773
|
-
static inline bool classof(const
|
|
773
|
+
static inline bool classof(const CloneGepObjVar *)
|
|
774
774
|
{
|
|
775
775
|
return true;
|
|
776
776
|
}
|
|
@@ -785,7 +785,7 @@ public:
|
|
|
785
785
|
//@}
|
|
786
786
|
|
|
787
787
|
/// Constructor
|
|
788
|
-
|
|
788
|
+
CloneGepObjVar(const MemObj* mem, NodeID i, const LocationSet& l, PNODEK ty = CloneGepObjNode) :
|
|
789
789
|
GepObjPN(mem, i, l, ty)
|
|
790
790
|
{
|
|
791
791
|
}
|
|
@@ -802,11 +802,11 @@ public:
|
|
|
802
802
|
/*
|
|
803
803
|
* Clone object for FI objects.
|
|
804
804
|
*/
|
|
805
|
-
class
|
|
805
|
+
class CloneFIObjVar : public FIObjVar
|
|
806
806
|
{
|
|
807
807
|
public:
|
|
808
808
|
//@{ Methods to support type inquiry through isa, cast, and dyn_cast:
|
|
809
|
-
static inline bool classof(const
|
|
809
|
+
static inline bool classof(const CloneFIObjVar *)
|
|
810
810
|
{
|
|
811
811
|
return true;
|
|
812
812
|
}
|
|
@@ -821,15 +821,15 @@ public:
|
|
|
821
821
|
//@}
|
|
822
822
|
|
|
823
823
|
/// Constructor
|
|
824
|
-
|
|
825
|
-
|
|
824
|
+
CloneFIObjVar(const Value* val, NodeID i, const MemObj* mem, PNODEK ty = CloneFIObjNode) :
|
|
825
|
+
FIObjVar(val, i, mem, ty)
|
|
826
826
|
{
|
|
827
827
|
}
|
|
828
828
|
|
|
829
829
|
/// Return name of this node
|
|
830
830
|
inline const std::string getValueName() const
|
|
831
831
|
{
|
|
832
|
-
return "clone (FI) of " +
|
|
832
|
+
return "clone (FI) of " + FIObjVar::getValueName();
|
|
833
833
|
}
|
|
834
834
|
|
|
835
835
|
virtual const std::string toString() const;
|
|
@@ -281,44 +281,44 @@ public:
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
/// Add Address edge
|
|
284
|
-
inline
|
|
284
|
+
inline AddrStmt* addAddrEdge(NodeID src, NodeID dst)
|
|
285
285
|
{
|
|
286
|
-
|
|
286
|
+
AddrStmt *edge = pag->addAddrPE(src, dst);
|
|
287
287
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
288
288
|
return edge;
|
|
289
289
|
}
|
|
290
290
|
/// Add Copy edge
|
|
291
|
-
inline
|
|
291
|
+
inline CopyStmt* addCopyEdge(NodeID src, NodeID dst)
|
|
292
292
|
{
|
|
293
|
-
|
|
293
|
+
CopyStmt *edge = pag->addCopyPE(src, dst);
|
|
294
294
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
295
295
|
return edge;
|
|
296
296
|
}
|
|
297
297
|
/// Add Copy edge
|
|
298
|
-
inline
|
|
298
|
+
inline PhiStmt* addPhiNode(NodeID res, NodeID opnd)
|
|
299
299
|
{
|
|
300
|
-
|
|
300
|
+
PhiStmt *edge = pag->addPhiNode(res,opnd);
|
|
301
301
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
302
302
|
return edge;
|
|
303
303
|
}
|
|
304
304
|
/// Add Copy edge
|
|
305
|
-
inline
|
|
305
|
+
inline CmpStmt* addCmpEdge(NodeID op1, NodeID op2, NodeID dst, u32_t opcode)
|
|
306
306
|
{
|
|
307
|
-
|
|
307
|
+
CmpStmt *edge = pag->addCmpPE(op1, op2, dst, opcode);
|
|
308
308
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
309
309
|
return edge;
|
|
310
310
|
}
|
|
311
311
|
/// Add Copy edge
|
|
312
|
-
inline
|
|
312
|
+
inline BinaryOPStmt* addBinaryOPEdge(NodeID op1, NodeID op2, NodeID dst, u32_t opcode)
|
|
313
313
|
{
|
|
314
|
-
|
|
314
|
+
BinaryOPStmt *edge = pag->addBinaryOPPE(op1, op2, dst, opcode);
|
|
315
315
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
316
316
|
return edge;
|
|
317
317
|
}
|
|
318
318
|
/// Add Unary edge
|
|
319
|
-
inline
|
|
319
|
+
inline UnaryOPStmt* addUnaryOPEdge(NodeID src, NodeID dst, u32_t opcode)
|
|
320
320
|
{
|
|
321
|
-
|
|
321
|
+
UnaryOPStmt *edge = pag->addUnaryOPPE(src, dst, opcode);
|
|
322
322
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
323
323
|
return edge;
|
|
324
324
|
}
|
|
@@ -329,21 +329,21 @@ public:
|
|
|
329
329
|
return edge;
|
|
330
330
|
}
|
|
331
331
|
/// Add Load edge
|
|
332
|
-
inline
|
|
332
|
+
inline LoadStmt* addLoadEdge(NodeID src, NodeID dst)
|
|
333
333
|
{
|
|
334
|
-
|
|
334
|
+
LoadStmt *edge = pag->addLoadPE(src, dst);
|
|
335
335
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
336
336
|
return edge;
|
|
337
337
|
}
|
|
338
338
|
/// Add Store edge
|
|
339
|
-
inline
|
|
339
|
+
inline StoreStmt* addStoreEdge(NodeID src, NodeID dst)
|
|
340
340
|
{
|
|
341
341
|
IntraBlockNode* node;
|
|
342
342
|
if(const Instruction* inst = SVFUtil::dyn_cast<Instruction>(curVal))
|
|
343
343
|
node = pag->getICFG()->getIntraBlockNode(inst);
|
|
344
344
|
else
|
|
345
345
|
node = nullptr;
|
|
346
|
-
|
|
346
|
+
StoreStmt *edge = pag->addStorePE(src, dst, node);
|
|
347
347
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
348
348
|
return edge;
|
|
349
349
|
}
|
|
@@ -362,23 +362,23 @@ public:
|
|
|
362
362
|
return edge;
|
|
363
363
|
}
|
|
364
364
|
/// Add Gep edge
|
|
365
|
-
inline
|
|
365
|
+
inline GepStmt* addGepEdge(NodeID src, NodeID dst, const LocationSet& ls, bool constGep)
|
|
366
366
|
{
|
|
367
|
-
|
|
367
|
+
GepStmt *edge = pag->addGepPE(src, dst, ls, constGep);
|
|
368
368
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
369
369
|
return edge;
|
|
370
370
|
}
|
|
371
371
|
/// Add Offset(Gep) edge
|
|
372
|
-
inline
|
|
372
|
+
inline NormalGepStmt* addNormalGepEdge(NodeID src, NodeID dst, const LocationSet& ls)
|
|
373
373
|
{
|
|
374
|
-
|
|
374
|
+
NormalGepStmt *edge = pag->addNormalGepPE(src, dst, ls);
|
|
375
375
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
376
376
|
return edge;
|
|
377
377
|
}
|
|
378
378
|
/// Add Variant(Gep) edge
|
|
379
|
-
inline
|
|
379
|
+
inline VariantGepStmt* addVariantGepEdge(NodeID src, NodeID dst)
|
|
380
380
|
{
|
|
381
|
-
|
|
381
|
+
VariantGepStmt *edge = pag->addVariantGepPE(src, dst);
|
|
382
382
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
383
383
|
return edge;
|
|
384
384
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
//===----- CHG.h --
|
|
1
|
+
//===----- CHG.h -- Class hirachary graph ---------------------------//
|
|
2
2
|
//
|
|
3
3
|
// SVF: Static Value-Flow Analysis
|
|
4
4
|
//
|
|
5
|
-
// Copyright (C) <2013
|
|
5
|
+
// Copyright (C) <2013-> <Yulei Sui>
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
// This program is free software: you can redistribute it and/or modify
|
|
@@ -103,8 +103,9 @@ protected:
|
|
|
103
103
|
NodeID phiId = getDef(cs_ret);
|
|
104
104
|
NodeID retdef = getDef(fun_ret);
|
|
105
105
|
/// If a function does not have any return instruction. The def of a FormalRetVFGNode is itself (see VFG.h: addFormalRetVFGNode).
|
|
106
|
-
/// Therefore, we do not connect return edge from a function without any return instruction.
|
|
107
|
-
|
|
106
|
+
/// Therefore, we do not connect return edge from a function without any return instruction (i.e., pag->isPhiNode(fun_ret)==false)
|
|
107
|
+
/// because unique fun_ret PAGNode was not collected as a PhiNode in SVFIRBuilder::visitReturnInst
|
|
108
|
+
if (pag->isPhiNode(fun_ret)==false)
|
|
108
109
|
return;
|
|
109
110
|
|
|
110
111
|
SVFGEdge* edge = addRetEdge(retdef, phiId, csId);
|