svf-lib 1.0.992 → 1.0.993
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/CFL/CFGNormalizer.h +6 -3
- package/SVF-linux/include/CFL/CFLAlias.h +26 -15
- package/SVF-linux/include/CFL/CFLGrammar.h +30 -16
- package/SVF-linux/include/CFL/CFLSolver.h +9 -5
- package/SVF-linux/include/CFL/GrammarBuilder.h +10 -7
- package/SVF-linux/include/CUDD/cudd.h +20 -11
- package/SVF-linux/include/CUDD/cuddInt.h +48 -31
- package/SVF-linux/include/CUDD/epd.h +35 -29
- package/SVF-linux/include/CUDD/mtr.h +4 -3
- package/SVF-linux/include/CUDD/st.h +7 -4
- package/SVF-linux/include/CUDD/util.h +6 -6
- package/SVF-linux/include/FastCluster/fastcluster.h +13 -12
- package/SVF-linux/include/Graphs/CFLGraph.h +16 -10
- package/SVF-linux/include/Graphs/CHG.h +2 -2
- package/SVF-linux/include/Graphs/ConsG.h +2 -1
- package/SVF-linux/include/Graphs/GenericGraph.h +3 -3
- package/SVF-linux/include/Graphs/ICFG.h +2 -2
- package/SVF-linux/include/Graphs/ICFGEdge.h +16 -9
- package/SVF-linux/include/Graphs/ICFGNode.h +2 -2
- package/SVF-linux/include/Graphs/IRGraph.h +10 -6
- package/SVF-linux/include/Graphs/PTACallGraph.h +1 -1
- package/SVF-linux/include/Graphs/SVFG.h +4 -3
- package/SVF-linux/include/Graphs/SVFGNode.h +14 -8
- package/SVF-linux/include/Graphs/ThreadCallGraph.h +4 -2
- package/SVF-linux/include/Graphs/VFG.h +45 -39
- package/SVF-linux/include/Graphs/VFGNode.h +8 -4
- package/SVF-linux/include/MSSA/MemSSA.h +1 -1
- package/SVF-linux/include/MTA/FSMPTA.h +55 -44
- package/SVF-linux/include/MTA/LockAnalysis.h +11 -9
- package/SVF-linux/include/MTA/LockResultValidator.h +64 -54
- package/SVF-linux/include/MTA/MHP.h +17 -13
- package/SVF-linux/include/MTA/MTAResultValidator.h +24 -20
- package/SVF-linux/include/MTA/PCG.h +9 -7
- package/SVF-linux/include/MTA/TCT.h +27 -22
- package/SVF-linux/include/MemoryModel/LocationSet.h +5 -3
- package/SVF-linux/include/MemoryModel/PersistentPointsToCache.h +28 -13
- package/SVF-linux/include/MemoryModel/PersistentPointsToDS.h +2 -2
- package/SVF-linux/include/MemoryModel/PointerAnalysis.h +5 -4
- package/SVF-linux/include/MemoryModel/PointsTo.h +8 -2
- package/SVF-linux/include/MemoryModel/SVFIR.h +6 -5
- package/SVF-linux/include/MemoryModel/SVFStatements.h +65 -45
- package/SVF-linux/include/MemoryModel/SVFVariables.h +6 -5
- package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +18 -15
- package/SVF-linux/include/SABER/PathCondAllocator.h +14 -7
- package/SVF-linux/include/SABER/ProgSlice.h +2 -1
- package/SVF-linux/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-linux/include/SABER/SrcSnkDDA.h +8 -4
- package/SVF-linux/include/SVF-FE/CHGBuilder.h +4 -2
- package/SVF-linux/include/SVF-FE/DataFlowUtil.h +10 -9
- package/SVF-linux/include/SVF-FE/IRAnnotator.h +8 -8
- package/SVF-linux/include/SVF-FE/LLVMModule.h +13 -12
- package/SVF-linux/include/SVF-FE/LLVMUtil.h +4 -4
- package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +13 -9
- package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +3 -2
- package/SVF-linux/include/Util/BDDExpr.h +32 -16
- package/SVF-linux/include/Util/BasicTypes.h +77 -25
- package/SVF-linux/include/Util/CoreBitVector.h +2 -1
- package/SVF-linux/include/Util/CxtStmt.h +37 -27
- package/SVF-linux/include/Util/ExeState.h +42 -22
- package/SVF-linux/include/Util/ExtAPI.h +1 -1
- package/SVF-linux/include/Util/NodeIDAllocator.h +7 -4
- package/SVF-linux/include/Util/Options.h +3 -3
- package/SVF-linux/include/Util/SVFBasicTypes.h +49 -40
- package/SVF-linux/include/Util/SVFModule.h +5 -5
- package/SVF-linux/include/Util/SVFUtil.h +12 -9
- package/SVF-linux/include/Util/Z3Expr.h +191 -144
- package/SVF-linux/include/WPA/Andersen.h +11 -11
- package/SVF-linux/include/WPA/VersionedFlowSensitive.h +4 -1
- package/package.json +1 -1
|
@@ -22,40 +22,48 @@ class MHP;
|
|
|
22
22
|
class LockAnalysis;
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
class SVFGNodeLockSpan
|
|
25
|
+
class SVFGNodeLockSpan
|
|
26
|
+
{
|
|
26
27
|
public:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
28
|
+
SVFGNodeLockSpan(const StmtSVFGNode* SVFGnode, LockAnalysis::LockSpan lockspan) :
|
|
29
|
+
SVFGNode(SVFGnode), lockSpan(lockspan) {}
|
|
30
|
+
virtual ~SVFGNodeLockSpan() {}
|
|
31
|
+
|
|
32
|
+
inline bool operator< (const SVFGNodeLockSpan& rhs) const
|
|
33
|
+
{
|
|
34
|
+
if (SVFGNode != rhs.getSVFGNode())
|
|
35
|
+
return SVFGNode < rhs.getSVFGNode();
|
|
36
|
+
return lockSpan.size() < rhs.getLockSpan().size();
|
|
37
|
+
}
|
|
38
|
+
inline SVFGNodeLockSpan& operator= (const SVFGNodeLockSpan& rhs)
|
|
39
|
+
{
|
|
40
|
+
if(*this != rhs)
|
|
41
|
+
{
|
|
42
|
+
SVFGNode = rhs.getSVFGNode();
|
|
43
|
+
lockSpan = rhs.getLockSpan();
|
|
44
|
+
}
|
|
45
|
+
return *this;
|
|
46
|
+
}
|
|
47
|
+
inline bool operator== (const SVFGNodeLockSpan& rhs) const
|
|
48
|
+
{
|
|
49
|
+
return (SVFGNode == rhs.getSVFGNode() && lockSpan == rhs.getLockSpan());
|
|
50
|
+
}
|
|
51
|
+
inline bool operator!= (const SVFGNodeLockSpan& rhs) const
|
|
52
|
+
{
|
|
53
|
+
return !(*this == rhs);
|
|
54
|
+
}
|
|
55
|
+
inline const StmtSVFGNode* getSVFGNode() const
|
|
56
|
+
{
|
|
57
|
+
return SVFGNode;
|
|
58
|
+
}
|
|
59
|
+
inline const LockAnalysis::LockSpan getLockSpan() const
|
|
60
|
+
{
|
|
61
|
+
return lockSpan;
|
|
62
|
+
}
|
|
55
63
|
private:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
64
|
+
const StmtSVFGNode* SVFGNode;
|
|
65
|
+
LockAnalysis::LockSpan lockSpan;
|
|
66
|
+
};
|
|
59
67
|
|
|
60
68
|
/*!
|
|
61
69
|
* SVFG builder for DDA
|
|
@@ -73,7 +81,7 @@ public:
|
|
|
73
81
|
typedef Set<const Instruction*> InstSet;
|
|
74
82
|
typedef std::pair<NodeID,NodeID> NodeIDPair;
|
|
75
83
|
typedef Map<SVFGNodeLockSpan, bool> PairToBoolMap;
|
|
76
|
-
|
|
84
|
+
|
|
77
85
|
/// Constructor
|
|
78
86
|
MTASVFGBuilder(MHP* m, LockAnalysis* la) : SVFGBuilder(), mhp(m), lockana(la)
|
|
79
87
|
{
|
|
@@ -183,11 +191,12 @@ public:
|
|
|
183
191
|
|
|
184
192
|
/// Initialize analysis
|
|
185
193
|
void initialize(SVFModule* module);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
194
|
+
|
|
195
|
+
inline SVFIR* getPAG()
|
|
196
|
+
{
|
|
197
|
+
return mhp->getTCT()->getPTA()->getPAG();
|
|
198
|
+
}
|
|
199
|
+
|
|
191
200
|
/// Create signle instance of flow-sensitive pointer analysis
|
|
192
201
|
static FSMPTA* createFSMPTA(SVFModule* module, MHP* m, LockAnalysis* la)
|
|
193
202
|
{
|
|
@@ -222,12 +231,14 @@ private:
|
|
|
222
231
|
|
|
223
232
|
} // End namespace SVF
|
|
224
233
|
|
|
225
|
-
template <> struct std::hash<SVF::SVFGNodeLockSpan>
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
234
|
+
template <> struct std::hash<SVF::SVFGNodeLockSpan>
|
|
235
|
+
{
|
|
236
|
+
size_t operator()(const SVF::SVFGNodeLockSpan &cs) const
|
|
237
|
+
{
|
|
238
|
+
std::hash<SVF::StmtSVFGNode* >h;
|
|
239
|
+
SVF::StmtSVFGNode* node = const_cast<SVF::StmtSVFGNode* > (cs.getSVFGNode());
|
|
240
|
+
return h(node);
|
|
241
|
+
}
|
|
231
242
|
};
|
|
232
243
|
|
|
233
244
|
#endif /* FSPTANALYSIS_H_ */
|
|
@@ -224,10 +224,11 @@ public:
|
|
|
224
224
|
}
|
|
225
225
|
return find;
|
|
226
226
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
|
|
228
|
+
CxtStmtToCxtLockSet getCSTCLS()
|
|
229
|
+
{
|
|
230
|
+
return cxtStmtToCxtLockSet;
|
|
231
|
+
}
|
|
231
232
|
/// Touch this context statement
|
|
232
233
|
inline void touchCxtStmt(CxtStmt& cts)
|
|
233
234
|
{
|
|
@@ -297,11 +298,12 @@ public:
|
|
|
297
298
|
}
|
|
298
299
|
/// Print locks and spans
|
|
299
300
|
void printLocks(const CxtStmt& cts);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
301
|
+
|
|
302
|
+
/// Get tct
|
|
303
|
+
TCT* getTCT()
|
|
304
|
+
{
|
|
305
|
+
return tct;
|
|
306
|
+
}
|
|
305
307
|
private:
|
|
306
308
|
/// Handle fork
|
|
307
309
|
void handleFork(const CxtStmt& cts);
|
|
@@ -13,53 +13,61 @@
|
|
|
13
13
|
|
|
14
14
|
/* Validate the result of lock analysis */
|
|
15
15
|
|
|
16
|
-
namespace SVF
|
|
17
|
-
|
|
16
|
+
namespace SVF
|
|
17
|
+
{
|
|
18
|
+
class LockResultValidator
|
|
19
|
+
{
|
|
18
20
|
public:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
typedef Set<std::string> CxtLockSetStr;
|
|
22
|
+
typedef Map<const Instruction*, CxtLockSetStr> CxtStmtToCxtLockS;
|
|
23
|
+
|
|
24
|
+
typedef unsigned LOCK_FLAG;
|
|
25
|
+
|
|
26
|
+
LockResultValidator(LockAnalysis* la) : _la(la)
|
|
27
|
+
{
|
|
28
|
+
_mod = _la->getTCT()->getSVFModule();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
~LockResultValidator() {}
|
|
32
|
+
|
|
33
|
+
void analyze();
|
|
34
|
+
|
|
35
|
+
inline SVFModule* getModule() const
|
|
36
|
+
{
|
|
37
|
+
return _mod;
|
|
38
|
+
}
|
|
35
39
|
private:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
// Get CallICFGNode
|
|
41
|
+
inline CallICFGNode* getCBN(const Instruction* inst)
|
|
42
|
+
{
|
|
43
|
+
return _la->getTCT()->getCallICFGNode(inst);
|
|
44
|
+
}
|
|
45
|
+
const Instruction *getPreviousMemoryAccessInst( const Instruction *I)
|
|
46
|
+
{
|
|
41
47
|
I = I->getPrevNode();
|
|
42
48
|
while (I)
|
|
43
49
|
{
|
|
44
50
|
if (SVFUtil::isa<LoadInst>(I) || SVFUtil::isa<StoreInst>(I))
|
|
45
51
|
return I;
|
|
46
52
|
SVFFunction* callee = nullptr;
|
|
47
|
-
|
|
48
|
-
if(SVFUtil::isa<CallInst> (I))
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
|
|
54
|
+
if(SVFUtil::isa<CallInst> (I))
|
|
55
|
+
{
|
|
56
|
+
PTACallGraph::FunctionSet callees;
|
|
57
|
+
_la->getTCT()->getThreadCallGraph()->getCallees(getCBN(I), callees);
|
|
58
|
+
|
|
59
|
+
for(PTACallGraph::FunctionSet::const_iterator cit = callees.begin(),
|
|
60
|
+
ecit = callees.end(); cit!=ecit; cit++)
|
|
61
|
+
{
|
|
62
|
+
if(*cit != nullptr)
|
|
63
|
+
{
|
|
64
|
+
callee = const_cast<SVFFunction*> (*cit);
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
61
69
|
}
|
|
62
|
-
|
|
70
|
+
|
|
63
71
|
if (callee)
|
|
64
72
|
{
|
|
65
73
|
if (ExtAPI::EFT_L_A0__A0R_A1R == ExtAPI::getExtAPI()->get_type(callee)
|
|
@@ -70,39 +78,41 @@ private:
|
|
|
70
78
|
}
|
|
71
79
|
return nullptr;
|
|
72
80
|
}
|
|
73
|
-
|
|
74
|
-
inline bool inFilter(std::string name)
|
|
75
|
-
|
|
81
|
+
|
|
82
|
+
inline bool inFilter(std::string name)
|
|
83
|
+
{
|
|
84
|
+
return filterFun.find(name) != filterFun.end();
|
|
76
85
|
}
|
|
77
|
-
|
|
78
|
-
inline bool match(std::string lockName, CxtLockSetStr LS)
|
|
79
|
-
|
|
86
|
+
|
|
87
|
+
inline bool match(std::string lockName, CxtLockSetStr LS)
|
|
88
|
+
{
|
|
89
|
+
return LS.find(lockName) != LS.end();
|
|
80
90
|
}
|
|
81
|
-
|
|
91
|
+
|
|
82
92
|
Set<std::string> &split(const std::string &s, char delim, Set<std::string> &elems);
|
|
83
93
|
Set<std::string> split(const std::string &s, char delim);
|
|
84
|
-
|
|
94
|
+
|
|
85
95
|
std::string getOutput(const char* scenario, LOCK_FLAG analysisRes);
|
|
86
|
-
|
|
96
|
+
|
|
87
97
|
Set<std::string> getStringArg(const Instruction* inst, unsigned int arg_num);
|
|
88
|
-
|
|
98
|
+
|
|
89
99
|
bool collectLockTargets();
|
|
90
100
|
LOCK_FLAG validateStmtInLock();
|
|
91
|
-
|
|
101
|
+
|
|
92
102
|
CxtStmtToCxtLockS instToCxtLockSet;
|
|
93
103
|
LockAnalysis::CxtStmtToCxtLockSet cxtStmtToCxtLockSet;
|
|
94
104
|
LockAnalysis::CxtLockSet cxtLockSet;
|
|
95
|
-
|
|
105
|
+
|
|
96
106
|
LockAnalysis* _la;
|
|
97
107
|
SVFModule* _mod;
|
|
98
|
-
|
|
108
|
+
|
|
99
109
|
static const LOCK_FLAG LOCK_TRUE = 0x01;
|
|
100
110
|
static const LOCK_FLAG LOCK_IMPRECISE = 0x02;
|
|
101
111
|
static const LOCK_FLAG LOCK_UNSOUND = 0x04;
|
|
102
|
-
|
|
112
|
+
|
|
103
113
|
static constexpr char const *LOCK = "LOCK";
|
|
104
|
-
|
|
114
|
+
|
|
105
115
|
Set<std::string> filterFun = {"LOCK", "INTERLEV_ACCESS", "PAUSE", "CXT_THREAD", "TCT_ACCESS"};
|
|
106
|
-
};
|
|
116
|
+
};
|
|
107
117
|
} // End namespace SVF
|
|
108
118
|
#endif /* LOCKRESULTVALIDATOR_H_ */
|
|
@@ -60,11 +60,12 @@ public:
|
|
|
60
60
|
{
|
|
61
61
|
return tct;
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
|
|
64
|
+
// Get CallICFGNode
|
|
65
|
+
inline CallICFGNode* getCBN(const Instruction* inst)
|
|
66
|
+
{
|
|
67
|
+
return tct->getCallICFGNode(inst);
|
|
68
|
+
}
|
|
68
69
|
|
|
69
70
|
/// Whether the function is connected from main function in thread call graph
|
|
70
71
|
bool isConnectedfromMain(const Function* fun);
|
|
@@ -115,11 +116,12 @@ public:
|
|
|
115
116
|
void printInterleaving();
|
|
116
117
|
|
|
117
118
|
private:
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
|
|
120
|
+
inline const PTACallGraph::FunctionSet& getCallee(const Instruction* inst, PTACallGraph::FunctionSet& callees)
|
|
121
|
+
{
|
|
120
122
|
tcg->getCallees(getCBN(inst), callees);
|
|
121
123
|
return callees;
|
|
122
|
-
|
|
124
|
+
}
|
|
123
125
|
/// Update non-candidate functions' interleaving.
|
|
124
126
|
/// Copy interleaving threads of the entry inst to other insts.
|
|
125
127
|
void updateNonCandidateFunInterleaving();
|
|
@@ -380,9 +382,10 @@ private:
|
|
|
380
382
|
return tct->getPTA()->alias(getForkedThread(forkSite), getJoinedThread(joinSite)) && isSameSCEV(forkSite,joinSite);
|
|
381
383
|
}
|
|
382
384
|
// Get CallICFGNode
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
385
|
+
inline CallICFGNode* getCBN(const Instruction* inst)
|
|
386
|
+
{
|
|
387
|
+
return tct->getCallICFGNode(inst);
|
|
388
|
+
}
|
|
386
389
|
/// Mark thread flags for cxtStmt
|
|
387
390
|
//@{
|
|
388
391
|
/// Get the flag for a cxtStmt
|
|
@@ -485,10 +488,11 @@ private:
|
|
|
485
488
|
{
|
|
486
489
|
return getTCG()->getThreadAPI()->getJoinedThread(call);
|
|
487
490
|
}
|
|
488
|
-
inline const PTACallGraph::FunctionSet& getCallee(const Instruction* inst, PTACallGraph::FunctionSet& callees)
|
|
491
|
+
inline const PTACallGraph::FunctionSet& getCallee(const Instruction* inst, PTACallGraph::FunctionSet& callees)
|
|
492
|
+
{
|
|
489
493
|
getTCG()->getCallees(getCBN(inst), callees);
|
|
490
494
|
return callees;
|
|
491
|
-
|
|
495
|
+
}
|
|
492
496
|
/// ThreadCallGraph
|
|
493
497
|
inline ThreadCallGraph* getTCG() const
|
|
494
498
|
{
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
* Validate the result of context-sensitive analysis, including context-sensitive
|
|
15
15
|
* thread detection and thread interleaving.
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
namespace SVF
|
|
18
|
+
{
|
|
19
|
+
typedef unsigned NodeID;
|
|
20
|
+
|
|
20
21
|
class MTAResultValidator
|
|
21
22
|
{
|
|
22
23
|
|
|
@@ -36,9 +37,10 @@ public:
|
|
|
36
37
|
|
|
37
38
|
// Analysis
|
|
38
39
|
void analyze();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
inline SVFModule* getModule() const
|
|
41
|
+
{
|
|
42
|
+
return mod;
|
|
43
|
+
}
|
|
42
44
|
protected:
|
|
43
45
|
|
|
44
46
|
/*
|
|
@@ -132,12 +134,12 @@ private:
|
|
|
132
134
|
ThreadAPI* tdAPI;
|
|
133
135
|
ThreadCallGraph* tcg;
|
|
134
136
|
MHP* mhp;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
vthdToCxtMap vthdToCxt;
|
|
138
|
+
vthdTorthdMap vthdTorthd;
|
|
139
|
+
rthdTovthdMap rthdTovthd;
|
|
140
|
+
csnumToInst csnumToInstMap;
|
|
141
|
+
rthdToChildrenMap rthdToChildren;
|
|
142
|
+
SVFModule* mod;
|
|
141
143
|
/// Constant INTERLEV_FLAG values
|
|
142
144
|
//@{
|
|
143
145
|
static const INTERLEV_FLAG INTERLEV_TRUE = 0x01;
|
|
@@ -274,13 +276,15 @@ protected:
|
|
|
274
276
|
// Collect call sites of all RC_ACCESS function calls.
|
|
275
277
|
std::vector<const CallInst*> csInsts;
|
|
276
278
|
const Function *F = nullptr;
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
279
|
+
for(auto it = M->llvmFunBegin(); it != M->llvmFunEnd(); it++)
|
|
280
|
+
{
|
|
281
|
+
const std::string fName = (*it)->getName().str();
|
|
282
|
+
if(fName.find(RC_ACCESS) != std::string::npos)
|
|
283
|
+
{
|
|
284
|
+
F = (*it);
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
284
288
|
if (!F) return;
|
|
285
289
|
|
|
286
290
|
for (Value::const_use_iterator it = F->use_begin(), ie =
|
|
@@ -409,7 +413,7 @@ private:
|
|
|
409
413
|
{
|
|
410
414
|
if (SVFUtil::isa<LoadInst>(I) || SVFUtil::isa<StoreInst>(I))
|
|
411
415
|
return I;
|
|
412
|
-
|
|
416
|
+
|
|
413
417
|
if (const SVFFunction *callee = SVFUtil::getCallee(I))
|
|
414
418
|
{
|
|
415
419
|
if (ExtAPI::EFT_L_A0__A0R_A1R == ExtAPI::getExtAPI()->get_type(callee)
|
|
@@ -122,13 +122,15 @@ public:
|
|
|
122
122
|
virtual ~PCG()
|
|
123
123
|
{
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
|
|
126
|
+
CallICFGNode* getCallICFGNode(const Instruction* inst)
|
|
127
|
+
{
|
|
128
|
+
return pta->getICFG()->getCallICFGNode(inst);
|
|
129
|
+
}
|
|
130
|
+
const SVFFunction* getSVFFun(const Function* fun) const
|
|
131
|
+
{
|
|
132
|
+
return LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(fun);
|
|
133
|
+
}
|
|
132
134
|
/// Interface to query whether two function may happen-in-parallel
|
|
133
135
|
virtual bool mayHappenInParallel(const Instruction* i1, const Instruction* i2) const;
|
|
134
136
|
bool mayHappenInParallelBetweenFunctions(const Function* fun1, const Function* fun2) const;
|
|
@@ -148,18 +148,21 @@ public:
|
|
|
148
148
|
destroy();
|
|
149
149
|
}
|
|
150
150
|
/// Get CallICFGNode given inst
|
|
151
|
-
CallICFGNode* getCallICFGNode(const Instruction* inst)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
151
|
+
CallICFGNode* getCallICFGNode(const Instruction* inst)
|
|
152
|
+
{
|
|
153
|
+
return pta->getICFG()->getCallICFGNode(inst);
|
|
154
|
+
}
|
|
155
|
+
/// Get SVFFuntion given Function
|
|
156
|
+
const SVFFunction* getSVFFun(const Function* fun) const
|
|
157
|
+
{
|
|
158
|
+
return LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(fun);
|
|
159
|
+
}
|
|
160
|
+
/// Get SVFFModule
|
|
161
|
+
SVFModule* getSVFModule() const
|
|
162
|
+
{
|
|
163
|
+
return pta->getModule();
|
|
164
|
+
}
|
|
165
|
+
|
|
163
166
|
/// Get TCG
|
|
164
167
|
inline ThreadCallGraph* getThreadCallGraph() const
|
|
165
168
|
{
|
|
@@ -245,20 +248,22 @@ public:
|
|
|
245
248
|
/// Whether it is a candidate function for indirect call
|
|
246
249
|
inline bool isCandidateFun(const PTACallGraph::FunctionSet& callees) const
|
|
247
250
|
{
|
|
248
|
-
|
|
249
|
-
|
|
251
|
+
for(PTACallGraph::FunctionSet::const_iterator cit = callees.begin(),
|
|
252
|
+
ecit = callees.end(); cit!=ecit; cit++)
|
|
250
253
|
{
|
|
251
|
-
|
|
252
|
-
|
|
254
|
+
if(candidateFuncSet.find((*cit)->getLLVMFun())!=candidateFuncSet.end())
|
|
255
|
+
return true;
|
|
253
256
|
}
|
|
254
257
|
return false;
|
|
255
258
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
inline bool isCandidateFun(const Function* fun) const
|
|
260
|
+
{
|
|
261
|
+
return candidateFuncSet.find(fun)!=candidateFuncSet.end();
|
|
262
|
+
}
|
|
263
|
+
inline bool isCandidateFun(const SVFFunction* fun) const
|
|
264
|
+
{
|
|
265
|
+
return isCandidateFun(fun->getLLVMFun());
|
|
266
|
+
}
|
|
262
267
|
/// Whether two functions in the same callgraph scc
|
|
263
268
|
inline bool inSameCallGraphSCC(const PTACallGraphNode* src,const PTACallGraphNode* dst)
|
|
264
269
|
{
|
|
@@ -104,7 +104,7 @@ public:
|
|
|
104
104
|
/// Return accumulated constant offset given OffsetValueVec
|
|
105
105
|
s32_t accumulateConstantOffset() const;
|
|
106
106
|
|
|
107
|
-
/// Return element number of a type.
|
|
107
|
+
/// Return element number of a type.
|
|
108
108
|
u32_t getElementNum(const Type* type) const;
|
|
109
109
|
|
|
110
110
|
bool addOffsetValue(const Value* offsetValue, const Type* type);
|
|
@@ -135,8 +135,10 @@ private:
|
|
|
135
135
|
|
|
136
136
|
} // End namespace SVF
|
|
137
137
|
|
|
138
|
-
template <> struct std::hash<SVF::LocationSet>
|
|
139
|
-
|
|
138
|
+
template <> struct std::hash<SVF::LocationSet>
|
|
139
|
+
{
|
|
140
|
+
size_t operator()(const SVF::LocationSet &ls) const
|
|
141
|
+
{
|
|
140
142
|
SVF::Hash<std::pair<SVF::NodeID, SVF::NodeID>> h;
|
|
141
143
|
std::hash<SVF::LocationSet::OffsetValueVec> v;
|
|
142
144
|
return h(std::make_pair(ls.accumulateConstantFieldIdx(), v(ls.getOffsetValueVec())));
|
|
@@ -34,7 +34,10 @@ public:
|
|
|
34
34
|
// TODO: an unordered pair type may be better.
|
|
35
35
|
typedef Map<std::pair<PointsToID, PointsToID>, PointsToID> OpCache;
|
|
36
36
|
|
|
37
|
-
static PointsToID emptyPointsToId(void)
|
|
37
|
+
static PointsToID emptyPointsToId(void)
|
|
38
|
+
{
|
|
39
|
+
return 0;
|
|
40
|
+
};
|
|
38
41
|
|
|
39
42
|
public:
|
|
40
43
|
PersistentPointsToCache(void) : idCounter(1)
|
|
@@ -48,13 +51,13 @@ public:
|
|
|
48
51
|
/// Clear the cache.
|
|
49
52
|
void clear()
|
|
50
53
|
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
for (const Data *d : idToPts) delete d;
|
|
55
|
+
idToPts.clear();
|
|
56
|
+
ptsToId.clear();
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
unionCache.clear();
|
|
59
|
+
complementCache.clear();
|
|
60
|
+
intersectionCache.clear();
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
/// Resets the cache removing everything except the emptyData it was initialised with.
|
|
@@ -108,7 +111,10 @@ public:
|
|
|
108
111
|
/// Unions lhs and rhs and returns their union's ID.
|
|
109
112
|
PointsToID unionPts(PointsToID lhs, PointsToID rhs)
|
|
110
113
|
{
|
|
111
|
-
static const DataOp unionOp = [](const Data &lhs, const Data &rhs)
|
|
114
|
+
static const DataOp unionOp = [](const Data &lhs, const Data &rhs)
|
|
115
|
+
{
|
|
116
|
+
return lhs | rhs;
|
|
117
|
+
};
|
|
112
118
|
|
|
113
119
|
++totalUnions;
|
|
114
120
|
|
|
@@ -155,7 +161,8 @@ public:
|
|
|
155
161
|
++preemptiveUnions;
|
|
156
162
|
++totalUnions;
|
|
157
163
|
}
|
|
158
|
-
}
|
|
164
|
+
}
|
|
165
|
+
else ++lookupUnions;
|
|
159
166
|
|
|
160
167
|
return result;
|
|
161
168
|
}
|
|
@@ -163,7 +170,10 @@ public:
|
|
|
163
170
|
/// Relatively complements lhs and rhs (lhs \ rhs) and returns it's ID.
|
|
164
171
|
PointsToID complementPts(PointsToID lhs, PointsToID rhs)
|
|
165
172
|
{
|
|
166
|
-
static const DataOp complementOp = [](const Data &lhs, const Data &rhs)
|
|
173
|
+
static const DataOp complementOp = [](const Data &lhs, const Data &rhs)
|
|
174
|
+
{
|
|
175
|
+
return lhs - rhs;
|
|
176
|
+
};
|
|
167
177
|
|
|
168
178
|
++totalComplements;
|
|
169
179
|
|
|
@@ -214,7 +224,8 @@ public:
|
|
|
214
224
|
++preemptiveComplements;
|
|
215
225
|
++totalComplements;
|
|
216
226
|
}
|
|
217
|
-
}
|
|
227
|
+
}
|
|
228
|
+
else ++lookupComplements;
|
|
218
229
|
|
|
219
230
|
return result;
|
|
220
231
|
}
|
|
@@ -222,7 +233,10 @@ public:
|
|
|
222
233
|
/// Intersects lhs and rhs (lhs AND rhs) and returns the intersection's ID.
|
|
223
234
|
PointsToID intersectPts(PointsToID lhs, PointsToID rhs)
|
|
224
235
|
{
|
|
225
|
-
static const DataOp intersectionOp = [](const Data &lhs, const Data &rhs)
|
|
236
|
+
static const DataOp intersectionOp = [](const Data &lhs, const Data &rhs)
|
|
237
|
+
{
|
|
238
|
+
return lhs & rhs;
|
|
239
|
+
};
|
|
226
240
|
|
|
227
241
|
++totalIntersections;
|
|
228
242
|
|
|
@@ -287,7 +301,8 @@ public:
|
|
|
287
301
|
++totalUnions;
|
|
288
302
|
}
|
|
289
303
|
}
|
|
290
|
-
}
|
|
304
|
+
}
|
|
305
|
+
else ++lookupIntersections;
|
|
291
306
|
|
|
292
307
|
return result;
|
|
293
308
|
}
|