svf-lib 1.0.745 → 1.0.749
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/DDA/ContextDDA.h +1 -1
- package/SVF-linux/include/DDA/FlowDDA.h +1 -1
- package/SVF-linux/include/Graphs/ConsG.h +10 -10
- package/SVF-linux/include/Graphs/ICFGNode.h +3 -3
- package/SVF-linux/include/Graphs/IRGraph.h +7 -7
- package/SVF-linux/include/Graphs/VFG.h +4 -4
- package/SVF-linux/include/MSSA/MemRegion.h +3 -3
- package/SVF-linux/include/MSSA/MemSSA.h +1 -1
- package/SVF-linux/include/MemoryModel/PointerAnalysis.h +8 -8
- package/SVF-linux/include/MemoryModel/PointerAnalysisImpl.h +2 -2
- package/SVF-linux/include/MemoryModel/SVFIR.h +66 -67
- package/SVF-linux/include/MemoryModel/SVFStatements.h +30 -25
- package/SVF-linux/include/MemoryModel/SVFVariables.h +32 -32
- package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +15 -15
- package/SVF-linux/include/Util/IRAnnotator.h +1 -1
- package/SVF-linux/include/Util/Options.h +3 -1
- package/SVF-linux/include/Util/TypeBasedHeapCloning.h +2 -2
- package/SVF-linux/include/WPA/Andersen.h +1 -1
- package/SVF-linux/include/WPA/FlowSensitiveTBHC.h +1 -1
- 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/ConsG.h +2 -2
- package/SVF-osx/include/MemoryModel/PointerAnalysis.h +2 -2
- package/SVF-osx/include/MemoryModel/PointerAnalysisImpl.h +1 -1
- package/SVF-osx/include/MemoryModel/SVFIR.h +12 -12
- package/SVF-osx/include/MemoryModel/SVFStatements.h +26 -22
- package/SVF-osx/include/MemoryModel/SVFVariables.h +17 -17
- package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +2 -2
- package/SVF-osx/include/WPA/Andersen.h +1 -1
- package/SVF-osx/include/WPA/FlowSensitiveTBHC.h +1 -1
- package/package.json +1 -1
|
@@ -41,15 +41,15 @@ namespace SVF
|
|
|
41
41
|
class SVFVar;
|
|
42
42
|
|
|
43
43
|
/*
|
|
44
|
-
* SVFIR
|
|
44
|
+
* SVFIR program statements (PAGEdges)
|
|
45
45
|
*/
|
|
46
46
|
typedef GenericEdge<SVFVar> GenericPAGEdgeTy;
|
|
47
47
|
class SVFStmt : public GenericPAGEdgeTy
|
|
48
48
|
{
|
|
49
49
|
|
|
50
50
|
public:
|
|
51
|
-
///
|
|
52
|
-
/// Gep represents offset
|
|
51
|
+
/// Types of SVFIR statements
|
|
52
|
+
/// Gep represents (base + offset) for field sensitivity
|
|
53
53
|
/// ThreadFork/ThreadJoin is to model parameter passings between thread spawners and spawnees.
|
|
54
54
|
enum PEDGEK
|
|
55
55
|
{
|
|
@@ -175,9 +175,10 @@ public:
|
|
|
175
175
|
}
|
|
176
176
|
//@}
|
|
177
177
|
|
|
178
|
-
typedef GenericNode<SVFVar,SVFStmt>::GEdgeSetTy
|
|
179
|
-
typedef Map<EdgeID,
|
|
180
|
-
typedef PAGEdgeToSetMapTy
|
|
178
|
+
typedef GenericNode<SVFVar,SVFStmt>::GEdgeSetTy SVFStmtSetTy;
|
|
179
|
+
typedef Map<EdgeID, SVFStmtSetTy> PAGEdgeToSetMapTy;
|
|
180
|
+
typedef PAGEdgeToSetMapTy KindToSVFStmtMapTy;
|
|
181
|
+
typedef SVFStmtSetTy PAGEdgeSetTy;
|
|
181
182
|
|
|
182
183
|
private:
|
|
183
184
|
typedef Map<const ICFGNode*, u32_t> Inst2LabelMap;
|
|
@@ -191,7 +192,7 @@ private:
|
|
|
191
192
|
|
|
192
193
|
|
|
193
194
|
/*!
|
|
194
|
-
*
|
|
195
|
+
* Address statement (memory allocations)
|
|
195
196
|
*/
|
|
196
197
|
class AddrStmt: public SVFStmt
|
|
197
198
|
{
|
|
@@ -226,7 +227,7 @@ public:
|
|
|
226
227
|
|
|
227
228
|
|
|
228
229
|
/*!
|
|
229
|
-
* Copy
|
|
230
|
+
* Copy statements (simple assignment and casting)
|
|
230
231
|
*/
|
|
231
232
|
class CopyStmt: public SVFStmt
|
|
232
233
|
{
|
|
@@ -259,6 +260,9 @@ public:
|
|
|
259
260
|
virtual const std::string toString() const override;
|
|
260
261
|
};
|
|
261
262
|
|
|
263
|
+
/*
|
|
264
|
+
* Program statements with multiple operands including BinaryOPStmt, CmpStmt and PhiStmt
|
|
265
|
+
*/
|
|
262
266
|
class MultiOpndStmt : public SVFStmt{
|
|
263
267
|
public:
|
|
264
268
|
typedef std::vector<SVFVar*> OPVars;
|
|
@@ -323,7 +327,8 @@ public:
|
|
|
323
327
|
};
|
|
324
328
|
|
|
325
329
|
/*!
|
|
326
|
-
* Phi
|
|
330
|
+
* Phi statement (e.g., p = phi(q,r) which receives values from variables q and r from different paths)
|
|
331
|
+
* it is typically at a joint point of the control-flow graph
|
|
327
332
|
*/
|
|
328
333
|
class PhiStmt: public MultiOpndStmt
|
|
329
334
|
{
|
|
@@ -369,7 +374,7 @@ public:
|
|
|
369
374
|
|
|
370
375
|
|
|
371
376
|
/*!
|
|
372
|
-
*
|
|
377
|
+
* Comparison statement
|
|
373
378
|
*/
|
|
374
379
|
class CmpStmt: public MultiOpndStmt
|
|
375
380
|
{
|
|
@@ -382,7 +387,7 @@ private:
|
|
|
382
387
|
SVFVar* getSrcID(); ///< place holder, use getOpVarID(pos) instead
|
|
383
388
|
SVFVar* getDstID(); ///< place holder, use getResID() instead
|
|
384
389
|
|
|
385
|
-
u32_t
|
|
390
|
+
u32_t predicate;
|
|
386
391
|
public:
|
|
387
392
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
388
393
|
//@{
|
|
@@ -405,13 +410,13 @@ public:
|
|
|
405
410
|
//@}
|
|
406
411
|
|
|
407
412
|
/// constructor
|
|
408
|
-
CmpStmt(SVFVar* s, const OPVars& opnds, u32_t
|
|
413
|
+
CmpStmt(SVFVar* s, const OPVars& opnds, u32_t pre) : MultiOpndStmt(s,opnds,SVFStmt::Cmp), predicate(pre)
|
|
409
414
|
{
|
|
410
415
|
}
|
|
411
416
|
|
|
412
|
-
u32_t
|
|
417
|
+
u32_t getPredicate() const
|
|
413
418
|
{
|
|
414
|
-
return
|
|
419
|
+
return predicate;
|
|
415
420
|
}
|
|
416
421
|
|
|
417
422
|
virtual const std::string toString() const override;
|
|
@@ -419,7 +424,7 @@ public:
|
|
|
419
424
|
|
|
420
425
|
|
|
421
426
|
/*!
|
|
422
|
-
* Binary
|
|
427
|
+
* Binary statement
|
|
423
428
|
*/
|
|
424
429
|
class BinaryOPStmt: public MultiOpndStmt
|
|
425
430
|
{
|
|
@@ -469,7 +474,7 @@ public:
|
|
|
469
474
|
};
|
|
470
475
|
|
|
471
476
|
/*!
|
|
472
|
-
* Unary
|
|
477
|
+
* Unary statement
|
|
473
478
|
*/
|
|
474
479
|
class UnaryOPStmt: public SVFStmt
|
|
475
480
|
{
|
|
@@ -586,7 +591,7 @@ public:
|
|
|
586
591
|
};
|
|
587
592
|
|
|
588
593
|
/*!
|
|
589
|
-
* Store
|
|
594
|
+
* Store statement
|
|
590
595
|
*/
|
|
591
596
|
class StoreStmt: public SVFStmt
|
|
592
597
|
{
|
|
@@ -623,7 +628,7 @@ public:
|
|
|
623
628
|
|
|
624
629
|
|
|
625
630
|
/*!
|
|
626
|
-
* Load
|
|
631
|
+
* Load statement
|
|
627
632
|
*/
|
|
628
633
|
class LoadStmt: public SVFStmt
|
|
629
634
|
{
|
|
@@ -659,7 +664,7 @@ public:
|
|
|
659
664
|
|
|
660
665
|
|
|
661
666
|
/*!
|
|
662
|
-
* Gep
|
|
667
|
+
* Gep statement for field access and pointer arithmetic
|
|
663
668
|
*/
|
|
664
669
|
class GepStmt: public SVFStmt
|
|
665
670
|
{
|
|
@@ -699,7 +704,7 @@ protected:
|
|
|
699
704
|
|
|
700
705
|
|
|
701
706
|
/*!
|
|
702
|
-
* Gep
|
|
707
|
+
* Gep statement with a fixed offset
|
|
703
708
|
*/
|
|
704
709
|
class NormalGepStmt : public GepStmt
|
|
705
710
|
{
|
|
@@ -749,7 +754,7 @@ public:
|
|
|
749
754
|
};
|
|
750
755
|
|
|
751
756
|
/*!
|
|
752
|
-
* Gep
|
|
757
|
+
* Gep statement with a variant offset
|
|
753
758
|
*/
|
|
754
759
|
class VariantGepStmt : public GepStmt
|
|
755
760
|
{
|
|
@@ -788,7 +793,7 @@ public:
|
|
|
788
793
|
|
|
789
794
|
|
|
790
795
|
/*!
|
|
791
|
-
* Call
|
|
796
|
+
* Call
|
|
792
797
|
*/
|
|
793
798
|
class CallPE: public SVFStmt
|
|
794
799
|
{
|
|
@@ -840,7 +845,7 @@ public:
|
|
|
840
845
|
|
|
841
846
|
|
|
842
847
|
/*!
|
|
843
|
-
* Return
|
|
848
|
+
* Return
|
|
844
849
|
*/
|
|
845
850
|
class RetPE: public SVFStmt
|
|
846
851
|
{
|
|
@@ -892,7 +897,7 @@ public:
|
|
|
892
897
|
|
|
893
898
|
|
|
894
899
|
/*!
|
|
895
|
-
* Thread Fork
|
|
900
|
+
* Thread Fork
|
|
896
901
|
*/
|
|
897
902
|
class TDForkPE: public CallPE
|
|
898
903
|
{
|
|
@@ -930,7 +935,7 @@ public:
|
|
|
930
935
|
|
|
931
936
|
|
|
932
937
|
/*!
|
|
933
|
-
* Thread Join
|
|
938
|
+
* Thread Join
|
|
934
939
|
*/
|
|
935
940
|
class TDJoinPE: public RetPE
|
|
936
941
|
{
|
|
@@ -40,14 +40,14 @@ namespace SVF
|
|
|
40
40
|
|
|
41
41
|
class SVFVar;
|
|
42
42
|
/*
|
|
43
|
-
* SVFIR
|
|
43
|
+
* SVFIR program variables (PAGNodes)
|
|
44
44
|
*/
|
|
45
45
|
typedef GenericNode<SVFVar,SVFStmt> GenericPAGNodeTy;
|
|
46
46
|
class SVFVar : public GenericPAGNodeTy
|
|
47
47
|
{
|
|
48
48
|
|
|
49
49
|
public:
|
|
50
|
-
/// Nine kinds of SVFIR
|
|
50
|
+
/// Nine kinds of SVFIR variables
|
|
51
51
|
/// ValNode: llvm pointer value
|
|
52
52
|
/// ObjNode: memory object
|
|
53
53
|
/// RetNode: unique return node
|
|
@@ -76,8 +76,8 @@ public:
|
|
|
76
76
|
|
|
77
77
|
protected:
|
|
78
78
|
const Value* value; ///< value of this SVFIR node
|
|
79
|
-
SVFStmt::
|
|
80
|
-
SVFStmt::
|
|
79
|
+
SVFStmt::KindToSVFStmtMapTy InEdgeKindToSetMap;
|
|
80
|
+
SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap;
|
|
81
81
|
bool isTLPointer; /// top-level pointer
|
|
82
82
|
bool isATPointer; /// address-taken pointer
|
|
83
83
|
|
|
@@ -157,22 +157,22 @@ public:
|
|
|
157
157
|
return nullptr;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
/// Get incoming SVFIR edges
|
|
161
|
-
inline SVFStmt::
|
|
160
|
+
/// Get incoming SVFIR statements (edges)
|
|
161
|
+
inline SVFStmt::SVFStmtSetTy& getIncomingEdges(SVFStmt::PEDGEK kind)
|
|
162
162
|
{
|
|
163
163
|
return InEdgeKindToSetMap[kind];
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
/// Get outgoing SVFIR edges
|
|
167
|
-
inline SVFStmt::
|
|
166
|
+
/// Get outgoing SVFIR statements (edges)
|
|
167
|
+
inline SVFStmt::SVFStmtSetTy& getOutgoingEdges(SVFStmt::PEDGEK kind)
|
|
168
168
|
{
|
|
169
169
|
return OutEdgeKindToSetMap[kind];
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
/// Has incoming SVFIR edges
|
|
172
|
+
/// Has incoming SVFIR statements (edges)
|
|
173
173
|
inline bool hasIncomingEdges(SVFStmt::PEDGEK kind) const
|
|
174
174
|
{
|
|
175
|
-
SVFStmt::
|
|
175
|
+
SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
|
|
176
176
|
if (it != InEdgeKindToSetMap.end())
|
|
177
177
|
return (!it->second.empty());
|
|
178
178
|
else
|
|
@@ -182,7 +182,7 @@ public:
|
|
|
182
182
|
/// Has incoming VariantGepEdges
|
|
183
183
|
inline bool hasIncomingVariantGepEdge() const
|
|
184
184
|
{
|
|
185
|
-
SVFStmt::
|
|
185
|
+
SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(SVFStmt::VariantGep);
|
|
186
186
|
if (it != InEdgeKindToSetMap.end())
|
|
187
187
|
{
|
|
188
188
|
return (!it->second.empty());
|
|
@@ -191,25 +191,25 @@ public:
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
/// Get incoming SVFStmt iterator
|
|
194
|
-
inline SVFStmt::
|
|
194
|
+
inline SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesBegin(SVFStmt::PEDGEK kind) const
|
|
195
195
|
{
|
|
196
|
-
SVFStmt::
|
|
196
|
+
SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
|
|
197
197
|
assert(it!=InEdgeKindToSetMap.end() && "The node does not have such kind of edge");
|
|
198
198
|
return it->second.begin();
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
/// Get incoming SVFStmt iterator
|
|
202
|
-
inline SVFStmt::
|
|
202
|
+
inline SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesEnd(SVFStmt::PEDGEK kind) const
|
|
203
203
|
{
|
|
204
|
-
SVFStmt::
|
|
204
|
+
SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
|
|
205
205
|
assert(it!=InEdgeKindToSetMap.end() && "The node does not have such kind of edge");
|
|
206
206
|
return it->second.end();
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
/// Has outgoing SVFIR edges
|
|
209
|
+
/// Has outgoing SVFIR statements (edges)
|
|
210
210
|
inline bool hasOutgoingEdges(SVFStmt::PEDGEK kind) const
|
|
211
211
|
{
|
|
212
|
-
SVFStmt::
|
|
212
|
+
SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
|
|
213
213
|
if (it != OutEdgeKindToSetMap.end())
|
|
214
214
|
return (!it->second.empty());
|
|
215
215
|
else
|
|
@@ -217,17 +217,17 @@ public:
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
/// Get outgoing SVFStmt iterator
|
|
220
|
-
inline SVFStmt::
|
|
220
|
+
inline SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesBegin(SVFStmt::PEDGEK kind) const
|
|
221
221
|
{
|
|
222
|
-
SVFStmt::
|
|
222
|
+
SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
|
|
223
223
|
assert(it!=OutEdgeKindToSetMap.end() && "The node does not have such kind of edge");
|
|
224
224
|
return it->second.begin();
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
/// Get outgoing SVFStmt iterator
|
|
228
|
-
inline SVFStmt::
|
|
228
|
+
inline SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesEnd(SVFStmt::PEDGEK kind) const
|
|
229
229
|
{
|
|
230
|
-
SVFStmt::
|
|
230
|
+
SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
|
|
231
231
|
assert(it!=OutEdgeKindToSetMap.end() && "The node does not have such kind of edge");
|
|
232
232
|
return it->second.end();
|
|
233
233
|
}
|
|
@@ -268,7 +268,7 @@ public:
|
|
|
268
268
|
|
|
269
269
|
|
|
270
270
|
/*
|
|
271
|
-
* Value(Pointer)
|
|
271
|
+
* Value (Pointer) variable
|
|
272
272
|
*/
|
|
273
273
|
class ValVar: public SVFVar
|
|
274
274
|
{
|
|
@@ -312,7 +312,7 @@ public:
|
|
|
312
312
|
|
|
313
313
|
|
|
314
314
|
/*
|
|
315
|
-
* Memory Object
|
|
315
|
+
* Memory Object variable
|
|
316
316
|
*/
|
|
317
317
|
class ObjVar: public SVFVar
|
|
318
318
|
{
|
|
@@ -377,9 +377,9 @@ public:
|
|
|
377
377
|
|
|
378
378
|
|
|
379
379
|
/*
|
|
380
|
-
* Gep Value (Pointer)
|
|
381
|
-
* e.g. memcpy, temp gep value
|
|
382
|
-
* Each Gep Value
|
|
380
|
+
* Gep Value (Pointer) variable, this variable can be dynamic generated for field sensitive analysis
|
|
381
|
+
* e.g. memcpy, temp gep value variable needs to be created
|
|
382
|
+
* Each Gep Value variable is connected to base value variable via gep edge
|
|
383
383
|
*/
|
|
384
384
|
class GepValVar: public ValVar
|
|
385
385
|
{
|
|
@@ -416,7 +416,7 @@ public:
|
|
|
416
416
|
{
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
-
/// offset of the base value
|
|
419
|
+
/// offset of the base value variable
|
|
420
420
|
inline u32_t getOffset() const
|
|
421
421
|
{
|
|
422
422
|
return ls.getOffset();
|
|
@@ -445,8 +445,8 @@ public:
|
|
|
445
445
|
|
|
446
446
|
|
|
447
447
|
/*
|
|
448
|
-
* Gep Obj
|
|
449
|
-
* Each gep obj
|
|
448
|
+
* Gep Obj variable, this is dynamic generated for field sensitive analysis
|
|
449
|
+
* Each gep obj variable is one field of a MemObj (base)
|
|
450
450
|
*/
|
|
451
451
|
class GepObjPN: public ObjVar
|
|
452
452
|
{
|
|
@@ -521,7 +521,7 @@ public:
|
|
|
521
521
|
};
|
|
522
522
|
|
|
523
523
|
/*
|
|
524
|
-
* Field-insensitive Gep Obj
|
|
524
|
+
* Field-insensitive Gep Obj variable, 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
527
|
class FIObjVar: public ObjVar
|
|
@@ -649,7 +649,7 @@ public:
|
|
|
649
649
|
|
|
650
650
|
|
|
651
651
|
/*
|
|
652
|
-
* Dummy
|
|
652
|
+
* Dummy variable without any LLVM value
|
|
653
653
|
*/
|
|
654
654
|
class DummyValVar: public ValVar
|
|
655
655
|
{
|
|
@@ -688,7 +688,7 @@ public:
|
|
|
688
688
|
|
|
689
689
|
|
|
690
690
|
/*
|
|
691
|
-
* Dummy
|
|
691
|
+
* Dummy object variable
|
|
692
692
|
*/
|
|
693
693
|
class DummyObjVar: public ObjVar
|
|
694
694
|
{
|
|
@@ -269,13 +269,13 @@ public:
|
|
|
269
269
|
|
|
270
270
|
public:
|
|
271
271
|
|
|
272
|
-
NodeID
|
|
272
|
+
NodeID getGepValVar(const Value* val, const LocationSet& ls, const Type *baseType, u32_t fieldidx);
|
|
273
273
|
|
|
274
274
|
void setCurrentBBAndValueForPAGEdge(PAGEdge* edge);
|
|
275
275
|
|
|
276
276
|
inline PAGEdge* addBlackHoleAddrEdge(NodeID node)
|
|
277
277
|
{
|
|
278
|
-
PAGEdge *edge = pag->
|
|
278
|
+
PAGEdge *edge = pag->addBlackHoleAddrStmt(node);
|
|
279
279
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
280
280
|
return edge;
|
|
281
281
|
}
|
|
@@ -283,42 +283,42 @@ public:
|
|
|
283
283
|
/// Add Address edge
|
|
284
284
|
inline AddrStmt* addAddrEdge(NodeID src, NodeID dst)
|
|
285
285
|
{
|
|
286
|
-
AddrStmt *edge = pag->
|
|
286
|
+
AddrStmt *edge = pag->addAddrStmt(src, dst);
|
|
287
287
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
288
288
|
return edge;
|
|
289
289
|
}
|
|
290
290
|
/// Add Copy edge
|
|
291
291
|
inline CopyStmt* addCopyEdge(NodeID src, NodeID dst)
|
|
292
292
|
{
|
|
293
|
-
CopyStmt *edge = pag->
|
|
293
|
+
CopyStmt *edge = pag->addCopyStmt(src, dst);
|
|
294
294
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
295
295
|
return edge;
|
|
296
296
|
}
|
|
297
297
|
/// Add Copy edge
|
|
298
|
-
inline PhiStmt*
|
|
298
|
+
inline PhiStmt* addPhiStmt(NodeID res, NodeID opnd)
|
|
299
299
|
{
|
|
300
|
-
PhiStmt *edge = pag->
|
|
300
|
+
PhiStmt *edge = pag->addPhiStmt(res,opnd);
|
|
301
301
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
302
302
|
return edge;
|
|
303
303
|
}
|
|
304
304
|
/// Add Copy edge
|
|
305
|
-
inline CmpStmt* addCmpEdge(NodeID op1, NodeID op2, NodeID dst, u32_t
|
|
305
|
+
inline CmpStmt* addCmpEdge(NodeID op1, NodeID op2, NodeID dst, u32_t predict)
|
|
306
306
|
{
|
|
307
|
-
CmpStmt *edge = pag->
|
|
307
|
+
CmpStmt *edge = pag->addCmpStmt(op1, op2, dst, predict);
|
|
308
308
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
309
309
|
return edge;
|
|
310
310
|
}
|
|
311
311
|
/// Add Copy edge
|
|
312
312
|
inline BinaryOPStmt* addBinaryOPEdge(NodeID op1, NodeID op2, NodeID dst, u32_t opcode)
|
|
313
313
|
{
|
|
314
|
-
BinaryOPStmt *edge = pag->
|
|
314
|
+
BinaryOPStmt *edge = pag->addBinaryOPStmt(op1, op2, dst, opcode);
|
|
315
315
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
316
316
|
return edge;
|
|
317
317
|
}
|
|
318
318
|
/// Add Unary edge
|
|
319
319
|
inline UnaryOPStmt* addUnaryOPEdge(NodeID src, NodeID dst, u32_t opcode)
|
|
320
320
|
{
|
|
321
|
-
UnaryOPStmt *edge = pag->
|
|
321
|
+
UnaryOPStmt *edge = pag->addUnaryOPStmt(src, dst, opcode);
|
|
322
322
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
323
323
|
return edge;
|
|
324
324
|
}
|
|
@@ -331,7 +331,7 @@ public:
|
|
|
331
331
|
/// Add Load edge
|
|
332
332
|
inline LoadStmt* addLoadEdge(NodeID src, NodeID dst)
|
|
333
333
|
{
|
|
334
|
-
LoadStmt *edge = pag->
|
|
334
|
+
LoadStmt *edge = pag->addLoadStmt(src, dst);
|
|
335
335
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
336
336
|
return edge;
|
|
337
337
|
}
|
|
@@ -343,7 +343,7 @@ public:
|
|
|
343
343
|
node = pag->getICFG()->getIntraBlockNode(inst);
|
|
344
344
|
else
|
|
345
345
|
node = nullptr;
|
|
346
|
-
StoreStmt *edge = pag->
|
|
346
|
+
StoreStmt *edge = pag->addStoreStmt(src, dst, node);
|
|
347
347
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
348
348
|
return edge;
|
|
349
349
|
}
|
|
@@ -364,21 +364,21 @@ public:
|
|
|
364
364
|
/// Add Gep edge
|
|
365
365
|
inline GepStmt* addGepEdge(NodeID src, NodeID dst, const LocationSet& ls, bool constGep)
|
|
366
366
|
{
|
|
367
|
-
GepStmt *edge = pag->
|
|
367
|
+
GepStmt *edge = pag->addGepStmt(src, dst, ls, constGep);
|
|
368
368
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
369
369
|
return edge;
|
|
370
370
|
}
|
|
371
371
|
/// Add Offset(Gep) edge
|
|
372
372
|
inline NormalGepStmt* addNormalGepEdge(NodeID src, NodeID dst, const LocationSet& ls)
|
|
373
373
|
{
|
|
374
|
-
NormalGepStmt *edge = pag->
|
|
374
|
+
NormalGepStmt *edge = pag->addNormalGepStmt(src, dst, ls);
|
|
375
375
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
376
376
|
return edge;
|
|
377
377
|
}
|
|
378
378
|
/// Add Variant(Gep) edge
|
|
379
379
|
inline VariantGepStmt* addVariantGepEdge(NodeID src, NodeID dst)
|
|
380
380
|
{
|
|
381
|
-
VariantGepStmt *edge = pag->
|
|
381
|
+
VariantGepStmt *edge = pag->addVariantGepStmt(src, dst);
|
|
382
382
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
383
383
|
return edge;
|
|
384
384
|
}
|
|
@@ -99,7 +99,7 @@ private:
|
|
|
99
99
|
SVF::Size_t locationSetOffset = std::stoi(llvm::cast<llvm::MDString>(mdNode->getOperand(1))->getString().str());
|
|
100
100
|
|
|
101
101
|
LocationSet locationSet = LocationSet(locationSetOffset);
|
|
102
|
-
SVF::NodeID gepnodeId = pag->
|
|
102
|
+
SVF::NodeID gepnodeId = pag->getGepObjVar(baseNodeId, locationSet);
|
|
103
103
|
|
|
104
104
|
assert(nodeId == gepnodeId && "nodeId != gepnodeId");
|
|
105
105
|
}
|
|
@@ -243,13 +243,15 @@ public:
|
|
|
243
243
|
// TypeAnalysis.cpp
|
|
244
244
|
static const llvm::cl::opt<bool> GenICFG;
|
|
245
245
|
|
|
246
|
-
//WPAPass.cpp
|
|
246
|
+
// WPAPass.cpp
|
|
247
247
|
static const llvm::cl::opt<bool> AnderSVFG;
|
|
248
248
|
static const llvm::cl::opt<bool> SABERFULLSVFG;
|
|
249
249
|
static const llvm::cl::opt<bool> PrintAliases;
|
|
250
250
|
static llvm::cl::bits<PointerAnalysis::PTATY> PASelected;
|
|
251
251
|
static llvm::cl::bits<WPAPass::AliasCheckRule> AliasRule;
|
|
252
252
|
|
|
253
|
+
// DOTGraphTraits
|
|
254
|
+
static const llvm::cl::opt<bool> ShowHiddenNode;
|
|
253
255
|
};
|
|
254
256
|
} // namespace SVF
|
|
255
257
|
|
|
@@ -97,8 +97,8 @@ protected:
|
|
|
97
97
|
const NodeBS &getGepObjs(NodeID base);
|
|
98
98
|
|
|
99
99
|
/// Returns the GEP object node(s) of base for ls. This may include clones.
|
|
100
|
-
/// If there are no GEP objects, then
|
|
101
|
-
/// (through base's
|
|
100
|
+
/// If there are no GEP objects, then getGepObjVar is called on the SVFIR
|
|
101
|
+
/// (through base's getGepObjVar) which will create one.
|
|
102
102
|
const NodeBS getGepObjClones(NodeID base, unsigned offset);
|
|
103
103
|
|
|
104
104
|
/// Initialise the pointees of p at loc (which is type tildet *). reuse indicates
|
|
@@ -73,7 +73,7 @@ public:
|
|
|
73
73
|
virtual bool processPhi(const PHISVFGNode* phi) override;
|
|
74
74
|
virtual bool processCopy(const CopySVFGNode* copy) override;
|
|
75
75
|
|
|
76
|
-
virtual inline const NodeBS&
|
|
76
|
+
virtual inline const NodeBS& getAllFieldsObjVars(NodeID id) override;
|
|
77
77
|
|
|
78
78
|
virtual inline bool updateInFromIn(const SVFGNode* srcStmt, NodeID srcVar, const SVFGNode* dstStmt, NodeID dstVar) override;
|
|
79
79
|
virtual inline bool updateInFromOut(const SVFGNode* srcStmt, NodeID srcVar, const SVFGNode* dstStmt, NodeID dstVar) override;
|
|
Binary file
|
|
Binary file
|
|
@@ -310,9 +310,9 @@ public:
|
|
|
310
310
|
{
|
|
311
311
|
return pag->isBlkObjOrConstantObj(id);
|
|
312
312
|
}
|
|
313
|
-
inline NodeBS&
|
|
313
|
+
inline NodeBS& getAllFieldsObjVars(NodeID id)
|
|
314
314
|
{
|
|
315
|
-
return pag->
|
|
315
|
+
return pag->getAllFieldsObjVars(id);
|
|
316
316
|
}
|
|
317
317
|
inline NodeID getBaseObjVar(NodeID id)
|
|
318
318
|
{
|
|
@@ -358,9 +358,9 @@ public:
|
|
|
358
358
|
{
|
|
359
359
|
return pag->getGepObjVar(id,ls);
|
|
360
360
|
}
|
|
361
|
-
virtual inline const NodeBS&
|
|
361
|
+
virtual inline const NodeBS& getAllFieldsObjVars(NodeID id)
|
|
362
362
|
{
|
|
363
|
-
return pag->
|
|
363
|
+
return pag->getAllFieldsObjVars(id);
|
|
364
364
|
}
|
|
365
365
|
inline void setObjFieldInsensitive(NodeID id)
|
|
366
366
|
{
|
|
@@ -354,7 +354,7 @@ public:
|
|
|
354
354
|
{
|
|
355
355
|
if(pag->getBaseObjVar(cit->get_id())==cit->get_id())
|
|
356
356
|
{
|
|
357
|
-
NodeBS& fields = pag->
|
|
357
|
+
NodeBS& fields = pag->getAllFieldsObjVars(cit->get_id());
|
|
358
358
|
for(NodeBS::iterator it = fields.begin(), eit = fields.end(); it!=eit; ++it)
|
|
359
359
|
{
|
|
360
360
|
CVar cvar(cit->get_cond(),*it);
|
|
@@ -61,7 +61,7 @@ public:
|
|
|
61
61
|
typedef Map<const RetBlockNode*,const SVFVar*> CSToRetMap;
|
|
62
62
|
typedef Map<const SVFFunction*,const SVFVar*> FunToRetMap;
|
|
63
63
|
typedef Map<const SVFFunction*,SVFStmtSet> FunToPAGEdgeSetMap;
|
|
64
|
-
typedef Map<const ICFGNode*,SVFStmtList>
|
|
64
|
+
typedef Map<const ICFGNode*,SVFStmtList> ICFGNode2SVFStmtsMap;
|
|
65
65
|
typedef Map<NodeID, NodeID> NodeToNodeMap;
|
|
66
66
|
typedef std::pair<NodeID, Size_t> NodeOffset;
|
|
67
67
|
typedef std::pair<NodeID, LocationSet> NodeLocationSet;
|
|
@@ -73,8 +73,8 @@ public:
|
|
|
73
73
|
private:
|
|
74
74
|
/// ValueNodes - This map indicates the Node that a particular Value* is
|
|
75
75
|
/// represented by. This contains entries for all pointers.
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
ICFGNode2SVFStmtsMap icfgNode2SVFStmtsMap; ///< Map an ICFGNode to its SVFStmts
|
|
77
|
+
ICFGNode2SVFStmtsMap icfgNode2PTASVFStmtsMap; ///< Map an ICFGNode to its PointerAnalysis related SVFStmts
|
|
78
78
|
GepValueVarMap GepValObjMap; ///< Map a pair<base,off> to a gep value node id
|
|
79
79
|
NodeLocationSetMap GepObjVarMap; ///< Map a pair<base,off> to a gep obj node id
|
|
80
80
|
MemObjToFieldsMap memToFieldsMap; ///< Map a mem object id to all its fields
|
|
@@ -171,29 +171,29 @@ public:
|
|
|
171
171
|
/// Whether this instruction has SVFIR Edge
|
|
172
172
|
inline bool hasSVFStmtList(const ICFGNode* inst) const
|
|
173
173
|
{
|
|
174
|
-
return
|
|
174
|
+
return icfgNode2SVFStmtsMap.find(inst)!=icfgNode2SVFStmtsMap.end();
|
|
175
175
|
}
|
|
176
176
|
inline bool hasPTASVFStmtList(const ICFGNode* inst) const
|
|
177
177
|
{
|
|
178
|
-
return
|
|
178
|
+
return icfgNode2PTASVFStmtsMap.find(inst)!=icfgNode2PTASVFStmtsMap.end();
|
|
179
179
|
}
|
|
180
180
|
/// Given an instruction, get all its PAGEdges
|
|
181
181
|
inline SVFStmtList& getSVFStmtList(const ICFGNode* inst)
|
|
182
182
|
{
|
|
183
|
-
return
|
|
183
|
+
return icfgNode2SVFStmtsMap[inst];
|
|
184
184
|
}
|
|
185
185
|
/// Given an instruction, get all its PTA PAGEdges
|
|
186
186
|
inline SVFStmtList& getPTASVFStmtList(const ICFGNode* inst)
|
|
187
187
|
{
|
|
188
|
-
return
|
|
188
|
+
return icfgNode2PTASVFStmtsMap[inst];
|
|
189
189
|
}
|
|
190
190
|
/// Add a SVFStmt into instruction map
|
|
191
191
|
inline void addToSVFStmtList(ICFGNode* inst, SVFStmt* edge)
|
|
192
192
|
{
|
|
193
193
|
edge->setICFGNode(inst);
|
|
194
|
-
|
|
194
|
+
icfgNode2SVFStmtsMap[inst].push_back(edge);
|
|
195
195
|
if (edge->isPTAEdge())
|
|
196
|
-
|
|
196
|
+
icfgNode2PTASVFStmtsMap[inst].push_back(edge);
|
|
197
197
|
}
|
|
198
198
|
/// Get global PAGEdges (not in a procedure)
|
|
199
199
|
inline SVFStmtSet& getGlobalSVFStmtSet()
|
|
@@ -454,8 +454,8 @@ public:
|
|
|
454
454
|
|
|
455
455
|
/// Get all fields of an object
|
|
456
456
|
//@{
|
|
457
|
-
NodeBS&
|
|
458
|
-
NodeBS&
|
|
457
|
+
NodeBS& getAllFieldsObjVars(const MemObj* obj);
|
|
458
|
+
NodeBS& getAllFieldsObjVars(NodeID id);
|
|
459
459
|
NodeBS getFieldsAfterCollapse(NodeID id);
|
|
460
460
|
//@}
|
|
461
461
|
inline NodeID addDummyValNode()
|
|
@@ -631,7 +631,7 @@ private:
|
|
|
631
631
|
/// Add phi node information
|
|
632
632
|
PhiStmt* addPhiStmt(NodeID res, NodeID opnd);
|
|
633
633
|
/// Add Copy edge
|
|
634
|
-
CmpStmt* addCmpStmt(NodeID op1, NodeID op2, NodeID dst, u32_t
|
|
634
|
+
CmpStmt* addCmpStmt(NodeID op1, NodeID op2, NodeID dst, u32_t predict);
|
|
635
635
|
/// Add Copy edge
|
|
636
636
|
BinaryOPStmt* addBinaryOPStmt(NodeID op1, NodeID op2, NodeID dst, u32_t opcode);
|
|
637
637
|
/// Add Unary edge
|