svf-lib 1.0.993 → 1.0.996
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-osx/Release-build/lib/CUDD/libCudd.a +0 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/CFL/CFGNormalizer.h +6 -3
- package/SVF-osx/include/CFL/CFLAlias.h +26 -15
- package/SVF-osx/include/CFL/CFLGrammar.h +30 -16
- package/SVF-osx/include/CFL/CFLSolver.h +9 -5
- package/SVF-osx/include/CFL/GrammarBuilder.h +10 -7
- package/SVF-osx/include/CUDD/cudd.h +20 -11
- package/SVF-osx/include/CUDD/cuddInt.h +48 -31
- package/SVF-osx/include/CUDD/epd.h +35 -29
- package/SVF-osx/include/CUDD/mtr.h +4 -3
- package/SVF-osx/include/CUDD/st.h +7 -4
- package/SVF-osx/include/CUDD/util.h +6 -6
- package/SVF-osx/include/FastCluster/fastcluster.h +13 -12
- package/SVF-osx/include/Graphs/CFLGraph.h +16 -10
- package/SVF-osx/include/Graphs/CHG.h +2 -2
- package/SVF-osx/include/Graphs/ConsG.h +2 -1
- package/SVF-osx/include/Graphs/GenericGraph.h +3 -3
- package/SVF-osx/include/Graphs/ICFG.h +2 -2
- package/SVF-osx/include/Graphs/ICFGEdge.h +16 -9
- package/SVF-osx/include/Graphs/ICFGNode.h +2 -2
- package/SVF-osx/include/Graphs/IRGraph.h +10 -6
- package/SVF-osx/include/Graphs/PTACallGraph.h +1 -1
- package/SVF-osx/include/Graphs/SVFG.h +4 -3
- package/SVF-osx/include/Graphs/SVFGNode.h +14 -8
- package/SVF-osx/include/Graphs/ThreadCallGraph.h +4 -2
- package/SVF-osx/include/Graphs/VFG.h +45 -39
- package/SVF-osx/include/Graphs/VFGNode.h +8 -4
- package/SVF-osx/include/MSSA/MemSSA.h +1 -1
- package/SVF-osx/include/MTA/FSMPTA.h +55 -44
- package/SVF-osx/include/MTA/LockAnalysis.h +11 -9
- package/SVF-osx/include/MTA/LockResultValidator.h +64 -54
- package/SVF-osx/include/MTA/MHP.h +17 -13
- package/SVF-osx/include/MTA/MTAResultValidator.h +24 -20
- package/SVF-osx/include/MTA/PCG.h +9 -7
- package/SVF-osx/include/MTA/TCT.h +27 -22
- package/SVF-osx/include/MemoryModel/LocationSet.h +5 -3
- package/SVF-osx/include/MemoryModel/PersistentPointsToCache.h +28 -13
- package/SVF-osx/include/MemoryModel/PersistentPointsToDS.h +2 -2
- package/SVF-osx/include/MemoryModel/PointerAnalysis.h +5 -4
- package/SVF-osx/include/MemoryModel/PointsTo.h +8 -2
- package/SVF-osx/include/MemoryModel/SVFIR.h +6 -5
- package/SVF-osx/include/MemoryModel/SVFStatements.h +65 -45
- package/SVF-osx/include/MemoryModel/SVFVariables.h +6 -5
- package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +18 -15
- package/SVF-osx/include/SABER/PathCondAllocator.h +14 -7
- package/SVF-osx/include/SABER/ProgSlice.h +2 -1
- package/SVF-osx/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-osx/include/SABER/SrcSnkDDA.h +8 -4
- package/SVF-osx/include/SVF-FE/CHGBuilder.h +4 -2
- package/SVF-osx/include/SVF-FE/DataFlowUtil.h +10 -9
- package/SVF-osx/include/SVF-FE/IRAnnotator.h +8 -8
- package/SVF-osx/include/SVF-FE/LLVMModule.h +13 -12
- package/SVF-osx/include/SVF-FE/LLVMUtil.h +4 -4
- package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +13 -9
- package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +3 -2
- package/SVF-osx/include/Util/BDDExpr.h +32 -16
- package/SVF-osx/include/Util/BasicTypes.h +77 -25
- package/SVF-osx/include/Util/CoreBitVector.h +2 -1
- package/SVF-osx/include/Util/CxtStmt.h +37 -27
- package/SVF-osx/include/Util/ExeState.h +42 -22
- package/SVF-osx/include/Util/ExtAPI.h +1 -1
- package/SVF-osx/include/Util/NodeIDAllocator.h +7 -4
- package/SVF-osx/include/Util/Options.h +3 -3
- package/SVF-osx/include/Util/SVFBasicTypes.h +49 -40
- package/SVF-osx/include/Util/SVFModule.h +5 -5
- package/SVF-osx/include/Util/SVFUtil.h +12 -9
- package/SVF-osx/include/Util/Z3Expr.h +191 -144
- package/SVF-osx/include/WPA/Andersen.h +11 -11
- package/SVF-osx/include/WPA/VersionedFlowSensitive.h +4 -1
- package/package.json +1 -1
|
@@ -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
|
}
|
|
@@ -589,7 +589,7 @@ public:
|
|
|
589
589
|
virtual inline bool updateDFInFromIn(LocID srcLoc, const Key& srcVar, LocID dstLoc, const Key& dstVar) override
|
|
590
590
|
{
|
|
591
591
|
if (varHasNewDFInPts(srcLoc, srcVar)
|
|
592
|
-
|
|
592
|
+
&& this->unionPtsThroughIds(this->getDFInPtIdRef(dstLoc, dstVar), this->getDFInPtIdRef(srcLoc, srcVar)))
|
|
593
593
|
{
|
|
594
594
|
setVarDFInSetUpdated(dstLoc, dstVar);
|
|
595
595
|
return true;
|
|
@@ -601,7 +601,7 @@ public:
|
|
|
601
601
|
virtual inline bool updateDFInFromOut(LocID srcLoc, const Key& srcVar, LocID dstLoc, const Key& dstVar) override
|
|
602
602
|
{
|
|
603
603
|
if (varHasNewDFOutPts(srcLoc, srcVar)
|
|
604
|
-
|
|
604
|
+
&& this->unionPtsThroughIds(this->getDFInPtIdRef(dstLoc, dstVar), this->getDFOutPtIdRef(srcLoc, srcVar)))
|
|
605
605
|
{
|
|
606
606
|
setVarDFInSetUpdated(dstLoc, dstVar);
|
|
607
607
|
return true;
|
|
@@ -165,10 +165,11 @@ protected:
|
|
|
165
165
|
TypeSystem *typeSystem;
|
|
166
166
|
|
|
167
167
|
public:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
/// Get ICFG
|
|
169
|
+
inline ICFG* getICFG() const
|
|
170
|
+
{
|
|
171
|
+
return pag->getICFG();
|
|
172
|
+
}
|
|
172
173
|
/// Return number of resolved indirect call edges
|
|
173
174
|
inline u32_t getNumOfResolvedIndCallEdge() const
|
|
174
175
|
{
|
|
@@ -124,8 +124,14 @@ public:
|
|
|
124
124
|
/// If not, remaps.
|
|
125
125
|
void checkAndRemap(void);
|
|
126
126
|
|
|
127
|
-
const_iterator begin(void) const
|
|
128
|
-
|
|
127
|
+
const_iterator begin(void) const
|
|
128
|
+
{
|
|
129
|
+
return PointsToIterator(this);
|
|
130
|
+
}
|
|
131
|
+
const_iterator end(void) const
|
|
132
|
+
{
|
|
133
|
+
return PointsToIterator(this, true);
|
|
134
|
+
}
|
|
129
135
|
|
|
130
136
|
MappingPtr getNodeMapping(void) const;
|
|
131
137
|
|
|
@@ -43,10 +43,10 @@ namespace SVF
|
|
|
43
43
|
class SVFIR : public IRGraph
|
|
44
44
|
{
|
|
45
45
|
|
|
46
|
-
friend class SVFIRBuilder;
|
|
47
|
-
friend class ExternalPAG;
|
|
48
|
-
friend class PAGBuilderFromFile;
|
|
49
|
-
friend class TypeBasedHeapCloning;
|
|
46
|
+
friend class SVFIRBuilder;
|
|
47
|
+
friend class ExternalPAG;
|
|
48
|
+
friend class PAGBuilderFromFile;
|
|
49
|
+
friend class TypeBasedHeapCloning;
|
|
50
50
|
|
|
51
51
|
public:
|
|
52
52
|
typedef Set<const CallICFGNode*> CallSiteSet;
|
|
@@ -447,7 +447,8 @@ public:
|
|
|
447
447
|
private:
|
|
448
448
|
|
|
449
449
|
/// Map a SVFStatement type to a set of corresponding SVF statements
|
|
450
|
-
inline void addToStmt2TypeMap(SVFStmt* edge)
|
|
450
|
+
inline void addToStmt2TypeMap(SVFStmt* edge)
|
|
451
|
+
{
|
|
451
452
|
bool added = KindToSVFStmtSetMap[edge->getEdgeKind()].insert(edge).second;
|
|
452
453
|
assert(added && "duplicated edge, not added!!!");
|
|
453
454
|
if (edge->isPTAEdge())
|
|
@@ -194,7 +194,8 @@ private:
|
|
|
194
194
|
connecting RHS expression and LHS expression with an assignment (e.g., LHSExpr = RHSExpr)
|
|
195
195
|
Only one operand on the right handside of an assignment
|
|
196
196
|
*/
|
|
197
|
-
class AssignStmt : public SVFStmt
|
|
197
|
+
class AssignStmt : public SVFStmt
|
|
198
|
+
{
|
|
198
199
|
|
|
199
200
|
private:
|
|
200
201
|
AssignStmt(); ///< place holder
|
|
@@ -244,18 +245,22 @@ public:
|
|
|
244
245
|
}
|
|
245
246
|
//@}
|
|
246
247
|
|
|
247
|
-
inline SVFVar* getRHSVar() const
|
|
248
|
+
inline SVFVar* getRHSVar() const
|
|
249
|
+
{
|
|
248
250
|
return SVFStmt::getSrcNode();
|
|
249
|
-
}
|
|
250
|
-
inline SVFVar* getLHSVar() const
|
|
251
|
+
}
|
|
252
|
+
inline SVFVar* getLHSVar() const
|
|
253
|
+
{
|
|
251
254
|
return SVFStmt::getDstNode();
|
|
252
|
-
}
|
|
253
|
-
inline NodeID getRHSVarID() const
|
|
255
|
+
}
|
|
256
|
+
inline NodeID getRHSVarID() const
|
|
257
|
+
{
|
|
254
258
|
return SVFStmt::getSrcID();
|
|
255
|
-
}
|
|
256
|
-
inline NodeID getLHSVarID() const
|
|
259
|
+
}
|
|
260
|
+
inline NodeID getLHSVarID() const
|
|
261
|
+
{
|
|
257
262
|
return SVFStmt::getDstID();
|
|
258
|
-
}
|
|
263
|
+
}
|
|
259
264
|
|
|
260
265
|
virtual const std::string toString() const = 0;
|
|
261
266
|
};
|
|
@@ -441,7 +446,8 @@ public:
|
|
|
441
446
|
return getLocationSet().getOffsetValueVec();
|
|
442
447
|
}
|
|
443
448
|
/// Return TRUE if this is a constant location set.
|
|
444
|
-
inline bool isConstantOffset() const
|
|
449
|
+
inline bool isConstantOffset() const
|
|
450
|
+
{
|
|
445
451
|
return getLocationSet().isConstantOffset();
|
|
446
452
|
}
|
|
447
453
|
/// Return accumulated constant offset (when accessing array or struct) if this offset is a constant.
|
|
@@ -455,11 +461,11 @@ public:
|
|
|
455
461
|
assert(isVariantFieldGep()==false && "Can't retrieve the LocationSet if using a variable field index (pointer arithmetic) for struct field access ");
|
|
456
462
|
return getLocationSet().accumulateConstantFieldIdx();
|
|
457
463
|
}
|
|
458
|
-
/// Gep statement with a variant field index (pointer arithmetic) for struct field access
|
|
464
|
+
/// Gep statement with a variant field index (pointer arithmetic) for struct field access
|
|
459
465
|
inline bool isVariantFieldGep() const
|
|
460
466
|
{
|
|
461
467
|
return variantField;
|
|
462
|
-
}
|
|
468
|
+
}
|
|
463
469
|
|
|
464
470
|
/// constructor
|
|
465
471
|
GepStmt(SVFVar* s, SVFVar* d, const LocationSet& l, bool varfld=false) : AssignStmt(s,d,SVFStmt::Gep), ls(l), variantField(varfld)
|
|
@@ -472,7 +478,7 @@ public:
|
|
|
472
478
|
|
|
473
479
|
|
|
474
480
|
/*!
|
|
475
|
-
* Call
|
|
481
|
+
* Call
|
|
476
482
|
*/
|
|
477
483
|
class CallPE: public AssignStmt
|
|
478
484
|
{
|
|
@@ -481,7 +487,7 @@ private:
|
|
|
481
487
|
CallPE(const CallPE &); ///< place holder
|
|
482
488
|
void operator=(const CallPE &); ///< place holder
|
|
483
489
|
|
|
484
|
-
const CallICFGNode* call; /// the callsite statement calling from
|
|
490
|
+
const CallICFGNode* call; /// the callsite statement calling from
|
|
485
491
|
const FunEntryICFGNode* entry; /// the function exit statement calling to
|
|
486
492
|
public:
|
|
487
493
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -493,12 +499,12 @@ public:
|
|
|
493
499
|
static inline bool classof(const SVFStmt *edge)
|
|
494
500
|
{
|
|
495
501
|
return edge->getEdgeKind() == SVFStmt::Call
|
|
496
|
-
|
|
502
|
+
|| edge->getEdgeKind() == SVFStmt::ThreadFork;
|
|
497
503
|
}
|
|
498
504
|
static inline bool classof(const GenericPAGEdgeTy *edge)
|
|
499
505
|
{
|
|
500
506
|
return edge->getEdgeKind() == SVFStmt::Call
|
|
501
|
-
|
|
507
|
+
|| edge->getEdgeKind() == SVFStmt::ThreadFork;
|
|
502
508
|
}
|
|
503
509
|
//@}
|
|
504
510
|
|
|
@@ -529,7 +535,7 @@ public:
|
|
|
529
535
|
|
|
530
536
|
|
|
531
537
|
/*!
|
|
532
|
-
* Return
|
|
538
|
+
* Return
|
|
533
539
|
*/
|
|
534
540
|
class RetPE: public AssignStmt
|
|
535
541
|
{
|
|
@@ -550,12 +556,12 @@ public:
|
|
|
550
556
|
static inline bool classof(const SVFStmt *edge)
|
|
551
557
|
{
|
|
552
558
|
return edge->getEdgeKind() == SVFStmt::Ret
|
|
553
|
-
|
|
559
|
+
|| edge->getEdgeKind() == SVFStmt::ThreadJoin;
|
|
554
560
|
}
|
|
555
561
|
static inline bool classof(const GenericPAGEdgeTy *edge)
|
|
556
562
|
{
|
|
557
563
|
return edge->getEdgeKind() == SVFStmt::Ret
|
|
558
|
-
|
|
564
|
+
|| edge->getEdgeKind() == SVFStmt::ThreadJoin;
|
|
559
565
|
}
|
|
560
566
|
//@}
|
|
561
567
|
|
|
@@ -587,7 +593,8 @@ public:
|
|
|
587
593
|
/*
|
|
588
594
|
* Program statements with multiple operands including BinaryOPStmt, CmpStmt and PhiStmt
|
|
589
595
|
*/
|
|
590
|
-
class MultiOpndStmt : public SVFStmt
|
|
596
|
+
class MultiOpndStmt : public SVFStmt
|
|
597
|
+
{
|
|
591
598
|
public:
|
|
592
599
|
typedef std::vector<SVFVar*> OPVars;
|
|
593
600
|
private:
|
|
@@ -647,7 +654,8 @@ public:
|
|
|
647
654
|
{
|
|
648
655
|
return opVars.size();
|
|
649
656
|
}
|
|
650
|
-
inline const OPVars& getOpndVars() const
|
|
657
|
+
inline const OPVars& getOpndVars() const
|
|
658
|
+
{
|
|
651
659
|
return opVars;
|
|
652
660
|
}
|
|
653
661
|
inline OPVars::const_iterator opVarBegin() const
|
|
@@ -702,18 +710,20 @@ public:
|
|
|
702
710
|
{
|
|
703
711
|
assert(opnds.size()==icfgNodes.size() && "Numbers of operands and their ICFGNodes are not consistent?");
|
|
704
712
|
}
|
|
705
|
-
void addOpVar(SVFVar* op, const ICFGNode* inode)
|
|
713
|
+
void addOpVar(SVFVar* op, const ICFGNode* inode)
|
|
714
|
+
{
|
|
706
715
|
opVars.push_back(op);
|
|
707
716
|
opICFGNodes.push_back(inode);
|
|
708
717
|
assert(opVars.size()==opICFGNodes.size() && "Numbers of operands and their ICFGNodes are not consistent?");
|
|
709
718
|
}
|
|
710
719
|
|
|
711
720
|
/// Return the corresponding ICFGNode of this operand
|
|
712
|
-
inline const ICFGNode* getOpICFGNode(u32_t op_idx) const
|
|
721
|
+
inline const ICFGNode* getOpICFGNode(u32_t op_idx) const
|
|
722
|
+
{
|
|
713
723
|
return opICFGNodes.at(op_idx);
|
|
714
724
|
}
|
|
715
725
|
|
|
716
|
-
/// Return true if this is a phi at the function exit
|
|
726
|
+
/// Return true if this is a phi at the function exit
|
|
717
727
|
/// to receive one or multiple return values of this function
|
|
718
728
|
bool isFunctionRetPhi() const;
|
|
719
729
|
|
|
@@ -759,13 +769,16 @@ public:
|
|
|
759
769
|
}
|
|
760
770
|
virtual const std::string toString() const override;
|
|
761
771
|
|
|
762
|
-
inline const SVFVar* getCondition() const
|
|
772
|
+
inline const SVFVar* getCondition() const
|
|
773
|
+
{
|
|
763
774
|
return condition;
|
|
764
775
|
}
|
|
765
|
-
inline const SVFVar* getTrueValue() const
|
|
776
|
+
inline const SVFVar* getTrueValue() const
|
|
777
|
+
{
|
|
766
778
|
return getOpVar(0);
|
|
767
779
|
}
|
|
768
|
-
inline const SVFVar* getFalseValue() const
|
|
780
|
+
inline const SVFVar* getFalseValue() const
|
|
781
|
+
{
|
|
769
782
|
return getOpVar(1);
|
|
770
783
|
}
|
|
771
784
|
};
|
|
@@ -811,7 +824,7 @@ public:
|
|
|
811
824
|
{
|
|
812
825
|
return predicate;
|
|
813
826
|
}
|
|
814
|
-
|
|
827
|
+
|
|
815
828
|
virtual const std::string toString() const override;
|
|
816
829
|
};
|
|
817
830
|
|
|
@@ -902,10 +915,12 @@ public:
|
|
|
902
915
|
{
|
|
903
916
|
return opcode;
|
|
904
917
|
}
|
|
905
|
-
inline const SVFVar* getOpVar() const
|
|
918
|
+
inline const SVFVar* getOpVar() const
|
|
919
|
+
{
|
|
906
920
|
return SVFStmt::getSrcNode();
|
|
907
921
|
}
|
|
908
|
-
inline const SVFVar* getRes() const
|
|
922
|
+
inline const SVFVar* getRes() const
|
|
923
|
+
{
|
|
909
924
|
return SVFStmt::getDstNode();
|
|
910
925
|
}
|
|
911
926
|
NodeID getOpVarID() const;
|
|
@@ -916,7 +931,7 @@ public:
|
|
|
916
931
|
|
|
917
932
|
|
|
918
933
|
/*!
|
|
919
|
-
* Branch statements including if/else and switch
|
|
934
|
+
* Branch statements including if/else and switch
|
|
920
935
|
*/
|
|
921
936
|
class BranchStmt: public SVFStmt
|
|
922
937
|
{
|
|
@@ -926,8 +941,8 @@ private:
|
|
|
926
941
|
BranchStmt(); ///< place holder
|
|
927
942
|
BranchStmt(const BranchStmt &); ///< place holder
|
|
928
943
|
void operator=(const BranchStmt &); ///< place holder
|
|
929
|
-
SVFVar* getSrcNode(); ///< place holder, not allowed
|
|
930
|
-
SVFVar* getDstNode(); ///< place holder, not allowed
|
|
944
|
+
SVFVar* getSrcNode(); ///< place holder, not allowed
|
|
945
|
+
SVFVar* getDstNode(); ///< place holder, not allowed
|
|
931
946
|
NodeID getSrcID(); ///< place holder, use getOpVarID(pos) instead
|
|
932
947
|
NodeID getDstID(); ///< place holder, use getResID() instead
|
|
933
948
|
|
|
@@ -961,33 +976,38 @@ public:
|
|
|
961
976
|
bool isUnconditional() const;
|
|
962
977
|
/// The branch is conditional if cond is not a null value
|
|
963
978
|
bool isConditional() const;
|
|
964
|
-
/// Return the condition
|
|
979
|
+
/// Return the condition
|
|
965
980
|
const SVFVar* getCondition() const;
|
|
966
|
-
const SVFVar* getBranchInst() const
|
|
981
|
+
const SVFVar* getBranchInst() const
|
|
982
|
+
{
|
|
967
983
|
return brInst;
|
|
968
984
|
}
|
|
969
|
-
|
|
985
|
+
|
|
970
986
|
/// For example if(c) {stmt1} else {stmt2}
|
|
971
987
|
/// successor(0): stmt1, 1
|
|
972
|
-
/// successor(1): stmt2, 0
|
|
988
|
+
/// successor(1): stmt2, 0
|
|
973
989
|
|
|
974
990
|
/// For example switch(c) case 0: {stmt1; break;} case 1: {stmt2; break;} default {stmt3: break}
|
|
975
991
|
/// successor(0): stmt1, 0
|
|
976
|
-
/// successor(1): stmt2, 1
|
|
977
|
-
/// successor(3): stmt3, -1
|
|
992
|
+
/// successor(1): stmt2, 1
|
|
993
|
+
/// successor(3): stmt3, -1
|
|
978
994
|
|
|
979
995
|
/// Successors of this branch statement
|
|
980
996
|
///@{
|
|
981
|
-
u32_t getNumSuccessors() const
|
|
997
|
+
u32_t getNumSuccessors() const
|
|
998
|
+
{
|
|
982
999
|
return successors.size();
|
|
983
1000
|
}
|
|
984
|
-
const SuccAndCondPairVec& getSuccessors() const
|
|
1001
|
+
const SuccAndCondPairVec& getSuccessors() const
|
|
1002
|
+
{
|
|
985
1003
|
return successors;
|
|
986
1004
|
}
|
|
987
|
-
const ICFGNode* getSuccessor (u32_t i) const
|
|
1005
|
+
const ICFGNode* getSuccessor (u32_t i) const
|
|
1006
|
+
{
|
|
988
1007
|
return successors.at(i).first;
|
|
989
1008
|
}
|
|
990
|
-
s32_t getSuccessorCondValue (u32_t i) const
|
|
1009
|
+
s32_t getSuccessorCondValue (u32_t i) const
|
|
1010
|
+
{
|
|
991
1011
|
return successors.at(i).second;
|
|
992
1012
|
}
|
|
993
1013
|
//@}
|
|
@@ -996,7 +1016,7 @@ public:
|
|
|
996
1016
|
|
|
997
1017
|
|
|
998
1018
|
/*!
|
|
999
|
-
* Thread Fork
|
|
1019
|
+
* Thread Fork
|
|
1000
1020
|
*/
|
|
1001
1021
|
class TDForkPE: public CallPE
|
|
1002
1022
|
{
|
|
@@ -1034,7 +1054,7 @@ public:
|
|
|
1034
1054
|
|
|
1035
1055
|
|
|
1036
1056
|
/*!
|
|
1037
|
-
* Thread Join
|
|
1057
|
+
* Thread Join
|
|
1038
1058
|
*/
|
|
1039
1059
|
class TDJoinPE: public RetPE
|
|
1040
1060
|
{
|
|
@@ -45,9 +45,9 @@ class SVFVar;
|
|
|
45
45
|
typedef GenericNode<SVFVar,SVFStmt> GenericPAGNodeTy;
|
|
46
46
|
class SVFVar : public GenericPAGNodeTy
|
|
47
47
|
{
|
|
48
|
-
friend class IRGraph;
|
|
49
|
-
friend class SVFIR;
|
|
50
|
-
friend class VFG;
|
|
48
|
+
friend class IRGraph;
|
|
49
|
+
friend class SVFIR;
|
|
50
|
+
friend class VFG;
|
|
51
51
|
|
|
52
52
|
public:
|
|
53
53
|
/// Nine kinds of SVFIR variables
|
|
@@ -177,7 +177,7 @@ public:
|
|
|
177
177
|
else
|
|
178
178
|
return false;
|
|
179
179
|
}
|
|
180
|
-
|
|
180
|
+
|
|
181
181
|
/// Get incoming SVFStmt iterator
|
|
182
182
|
inline SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesBegin(SVFStmt::PEDGEK kind) const
|
|
183
183
|
{
|
|
@@ -233,7 +233,8 @@ private:
|
|
|
233
233
|
SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(SVFStmt::Gep);
|
|
234
234
|
if (it != InEdgeKindToSetMap.end())
|
|
235
235
|
{
|
|
236
|
-
for(auto gep : it->second)
|
|
236
|
+
for(auto gep : it->second)
|
|
237
|
+
{
|
|
237
238
|
if(SVFUtil::cast<GepStmt>(gep)->isVariantFieldGep())
|
|
238
239
|
return true;
|
|
239
240
|
}
|