svf-lib 1.0.747 → 1.0.748
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-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
|
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
|
|
@@ -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
|
{
|
|
@@ -192,7 +192,7 @@ private:
|
|
|
192
192
|
|
|
193
193
|
|
|
194
194
|
/*!
|
|
195
|
-
*
|
|
195
|
+
* Address statement (memory allocations)
|
|
196
196
|
*/
|
|
197
197
|
class AddrStmt: public SVFStmt
|
|
198
198
|
{
|
|
@@ -227,7 +227,7 @@ public:
|
|
|
227
227
|
|
|
228
228
|
|
|
229
229
|
/*!
|
|
230
|
-
* Copy
|
|
230
|
+
* Copy statements (simple assignment and casting)
|
|
231
231
|
*/
|
|
232
232
|
class CopyStmt: public SVFStmt
|
|
233
233
|
{
|
|
@@ -260,6 +260,9 @@ public:
|
|
|
260
260
|
virtual const std::string toString() const override;
|
|
261
261
|
};
|
|
262
262
|
|
|
263
|
+
/*
|
|
264
|
+
* Program statements with multiple operands including BinaryOPStmt, CmpStmt and PhiStmt
|
|
265
|
+
*/
|
|
263
266
|
class MultiOpndStmt : public SVFStmt{
|
|
264
267
|
public:
|
|
265
268
|
typedef std::vector<SVFVar*> OPVars;
|
|
@@ -324,7 +327,8 @@ public:
|
|
|
324
327
|
};
|
|
325
328
|
|
|
326
329
|
/*!
|
|
327
|
-
* 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
|
|
328
332
|
*/
|
|
329
333
|
class PhiStmt: public MultiOpndStmt
|
|
330
334
|
{
|
|
@@ -370,7 +374,7 @@ public:
|
|
|
370
374
|
|
|
371
375
|
|
|
372
376
|
/*!
|
|
373
|
-
*
|
|
377
|
+
* Comparison statement
|
|
374
378
|
*/
|
|
375
379
|
class CmpStmt: public MultiOpndStmt
|
|
376
380
|
{
|
|
@@ -383,7 +387,7 @@ private:
|
|
|
383
387
|
SVFVar* getSrcID(); ///< place holder, use getOpVarID(pos) instead
|
|
384
388
|
SVFVar* getDstID(); ///< place holder, use getResID() instead
|
|
385
389
|
|
|
386
|
-
u32_t
|
|
390
|
+
u32_t predicate;
|
|
387
391
|
public:
|
|
388
392
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
389
393
|
//@{
|
|
@@ -406,13 +410,13 @@ public:
|
|
|
406
410
|
//@}
|
|
407
411
|
|
|
408
412
|
/// constructor
|
|
409
|
-
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)
|
|
410
414
|
{
|
|
411
415
|
}
|
|
412
416
|
|
|
413
|
-
u32_t
|
|
417
|
+
u32_t getPredicate() const
|
|
414
418
|
{
|
|
415
|
-
return
|
|
419
|
+
return predicate;
|
|
416
420
|
}
|
|
417
421
|
|
|
418
422
|
virtual const std::string toString() const override;
|
|
@@ -420,7 +424,7 @@ public:
|
|
|
420
424
|
|
|
421
425
|
|
|
422
426
|
/*!
|
|
423
|
-
* Binary
|
|
427
|
+
* Binary statement
|
|
424
428
|
*/
|
|
425
429
|
class BinaryOPStmt: public MultiOpndStmt
|
|
426
430
|
{
|
|
@@ -470,7 +474,7 @@ public:
|
|
|
470
474
|
};
|
|
471
475
|
|
|
472
476
|
/*!
|
|
473
|
-
* Unary
|
|
477
|
+
* Unary statement
|
|
474
478
|
*/
|
|
475
479
|
class UnaryOPStmt: public SVFStmt
|
|
476
480
|
{
|
|
@@ -587,7 +591,7 @@ public:
|
|
|
587
591
|
};
|
|
588
592
|
|
|
589
593
|
/*!
|
|
590
|
-
* Store
|
|
594
|
+
* Store statement
|
|
591
595
|
*/
|
|
592
596
|
class StoreStmt: public SVFStmt
|
|
593
597
|
{
|
|
@@ -624,7 +628,7 @@ public:
|
|
|
624
628
|
|
|
625
629
|
|
|
626
630
|
/*!
|
|
627
|
-
* Load
|
|
631
|
+
* Load statement
|
|
628
632
|
*/
|
|
629
633
|
class LoadStmt: public SVFStmt
|
|
630
634
|
{
|
|
@@ -660,7 +664,7 @@ public:
|
|
|
660
664
|
|
|
661
665
|
|
|
662
666
|
/*!
|
|
663
|
-
* Gep
|
|
667
|
+
* Gep statement for field access and pointer arithmetic
|
|
664
668
|
*/
|
|
665
669
|
class GepStmt: public SVFStmt
|
|
666
670
|
{
|
|
@@ -700,7 +704,7 @@ protected:
|
|
|
700
704
|
|
|
701
705
|
|
|
702
706
|
/*!
|
|
703
|
-
* Gep
|
|
707
|
+
* Gep statement with a fixed offset
|
|
704
708
|
*/
|
|
705
709
|
class NormalGepStmt : public GepStmt
|
|
706
710
|
{
|
|
@@ -750,7 +754,7 @@ public:
|
|
|
750
754
|
};
|
|
751
755
|
|
|
752
756
|
/*!
|
|
753
|
-
* Gep
|
|
757
|
+
* Gep statement with a variant offset
|
|
754
758
|
*/
|
|
755
759
|
class VariantGepStmt : public GepStmt
|
|
756
760
|
{
|
|
@@ -789,7 +793,7 @@ public:
|
|
|
789
793
|
|
|
790
794
|
|
|
791
795
|
/*!
|
|
792
|
-
* Call
|
|
796
|
+
* Call
|
|
793
797
|
*/
|
|
794
798
|
class CallPE: public SVFStmt
|
|
795
799
|
{
|
|
@@ -841,7 +845,7 @@ public:
|
|
|
841
845
|
|
|
842
846
|
|
|
843
847
|
/*!
|
|
844
|
-
* Return
|
|
848
|
+
* Return
|
|
845
849
|
*/
|
|
846
850
|
class RetPE: public SVFStmt
|
|
847
851
|
{
|
|
@@ -893,7 +897,7 @@ public:
|
|
|
893
897
|
|
|
894
898
|
|
|
895
899
|
/*!
|
|
896
|
-
* Thread Fork
|
|
900
|
+
* Thread Fork
|
|
897
901
|
*/
|
|
898
902
|
class TDForkPE: public CallPE
|
|
899
903
|
{
|
|
@@ -931,7 +935,7 @@ public:
|
|
|
931
935
|
|
|
932
936
|
|
|
933
937
|
/*!
|
|
934
|
-
* Thread Join
|
|
938
|
+
* Thread Join
|
|
935
939
|
*/
|
|
936
940
|
class TDJoinPE: public RetPE
|
|
937
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
|
|
@@ -157,19 +157,19 @@ public:
|
|
|
157
157
|
return nullptr;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
/// Get incoming SVFIR edges
|
|
160
|
+
/// Get incoming SVFIR statements (edges)
|
|
161
161
|
inline SVFStmt::SVFStmtSetTy& getIncomingEdges(SVFStmt::PEDGEK kind)
|
|
162
162
|
{
|
|
163
163
|
return InEdgeKindToSetMap[kind];
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
/// Get outgoing SVFIR edges
|
|
166
|
+
/// Get outgoing SVFIR statements (edges)
|
|
167
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
175
|
SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
|
|
@@ -206,7 +206,7 @@ public:
|
|
|
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
212
|
SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
|
|
@@ -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
|
{
|
|
@@ -302,9 +302,9 @@ public:
|
|
|
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->addCmpStmt(op1, op2, dst,
|
|
307
|
+
CmpStmt *edge = pag->addCmpStmt(op1, op2, dst, predict);
|
|
308
308
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
309
309
|
return edge;
|
|
310
310
|
}
|
|
@@ -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;
|