svf-tools 1.0.694 → 1.0.695
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/CMakeLists.txt +3 -0
- package/package.json +1 -1
- package/svf/include/Graphs/CHG.h +4 -1
- package/svf/include/Graphs/GenericGraph.h +5 -0
- package/svf/include/Graphs/ICFG.h +1 -0
- package/svf/include/Graphs/ICFGEdge.h +4 -0
- package/svf/include/Graphs/ICFGNode.h +28 -2
- package/svf/include/Graphs/IRGraph.h +1 -0
- package/svf/include/MemoryModel/LocationSet.h +1 -0
- package/svf/include/MemoryModel/SVFLoop.h +1 -0
- package/svf/include/SVFIR/SVFIR.h +1 -0
- package/svf/include/SVFIR/SVFIRRW.h +864 -186
- package/svf/include/SVFIR/SVFModule.h +1 -0
- package/svf/include/SVFIR/SVFModuleRW.h +2 -2
- package/svf/include/SVFIR/SVFStatements.h +65 -15
- package/svf/include/SVFIR/SVFType.h +4 -0
- package/svf/include/SVFIR/SVFValue.h +22 -0
- package/svf/include/SVFIR/SVFVariables.h +42 -0
- package/svf/include/SVFIR/SymbolTableInfo.h +17 -1
- package/svf/include/Util/Options.h +1 -0
- package/svf/include/Util/SVFUtil.h +49 -0
- package/svf/include/Util/SparseBitVector.h +2 -0
- package/svf/lib/SVFIR/SVFIRRW.cpp +1509 -127
- package/svf/lib/SVFIR/SVFModuleRW.cpp +6 -6
- package/svf/lib/SVFIR/SymbolTableInfo.cpp +1 -1
- package/svf/lib/Util/Options.cpp +7 -1
- package/svf-llvm/lib/LLVMModule.cpp +1 -1
- package/svf-llvm/lib/SVFIRBuilder.cpp +1 -1
- package/svf-llvm/tools/WPA/wpa.cpp +17 -14
|
@@ -161,8 +161,8 @@ private:
|
|
|
161
161
|
SVFType* indexToType(TypeIndex i);
|
|
162
162
|
SVFValue* indexToValue(ValueIndex i);
|
|
163
163
|
|
|
164
|
-
void
|
|
165
|
-
void
|
|
164
|
+
void fillSVFTypeAt(size_t i);
|
|
165
|
+
void fillSVFValueAt(size_t i);
|
|
166
166
|
|
|
167
167
|
StInfo* readStInfo(cJSON* iter);
|
|
168
168
|
cJSON* readJson(cJSON* iter, SVFType* type);
|
|
@@ -51,6 +51,7 @@ typedef GenericEdge<SVFVar> GenericPAGEdgeTy;
|
|
|
51
51
|
class SVFStmt : public GenericPAGEdgeTy
|
|
52
52
|
{
|
|
53
53
|
friend class SVFIRWriter;
|
|
54
|
+
friend class SVFIRReader;
|
|
54
55
|
|
|
55
56
|
public:
|
|
56
57
|
/// Types of SVFIR statements
|
|
@@ -81,6 +82,14 @@ private:
|
|
|
81
82
|
const SVFBasicBlock* basicBlock; ///< LLVM BasicBlock
|
|
82
83
|
ICFGNode* icfgNode; ///< ICFGNode
|
|
83
84
|
EdgeID edgeId; ///< Edge ID
|
|
85
|
+
|
|
86
|
+
protected:
|
|
87
|
+
/// Private constructor for reading SVFIR from file without side-effect
|
|
88
|
+
SVFStmt(GEdgeFlag k)
|
|
89
|
+
: GenericPAGEdgeTy({}, {}, k), value{}, basicBlock{}, icfgNode{}
|
|
90
|
+
{
|
|
91
|
+
}
|
|
92
|
+
|
|
84
93
|
public:
|
|
85
94
|
static u32_t totalEdgeNum; ///< Total edge number
|
|
86
95
|
|
|
@@ -222,6 +231,7 @@ private:
|
|
|
222
231
|
class AssignStmt : public SVFStmt
|
|
223
232
|
{
|
|
224
233
|
friend class SVFIRWriter;
|
|
234
|
+
friend class SVFIRReader;
|
|
225
235
|
|
|
226
236
|
private:
|
|
227
237
|
AssignStmt(); ///< place holder
|
|
@@ -235,6 +245,8 @@ private:
|
|
|
235
245
|
protected:
|
|
236
246
|
/// constructor
|
|
237
247
|
AssignStmt(SVFVar* s, SVFVar* d, GEdgeFlag k) : SVFStmt(s, d, k) {}
|
|
248
|
+
/// Constructor to create empty AssignStmt (for SVFIRReader/serilization)
|
|
249
|
+
AssignStmt(GEdgeFlag k) : SVFStmt(k) {}
|
|
238
250
|
|
|
239
251
|
public:
|
|
240
252
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -295,9 +307,11 @@ public:
|
|
|
295
307
|
class AddrStmt: public AssignStmt
|
|
296
308
|
{
|
|
297
309
|
friend class SVFIRWriter;
|
|
310
|
+
friend class SVFIRReader;
|
|
298
311
|
|
|
299
312
|
private:
|
|
300
|
-
AddrStmt()
|
|
313
|
+
/// Constructs empty AddrStmt (for SVFIRReader/serilization)
|
|
314
|
+
AddrStmt() : AssignStmt(SVFStmt::Addr) {}
|
|
301
315
|
AddrStmt(const AddrStmt&); ///< place holder
|
|
302
316
|
void operator=(const AddrStmt&); ///< place holder
|
|
303
317
|
|
|
@@ -330,9 +344,11 @@ public:
|
|
|
330
344
|
class CopyStmt: public AssignStmt
|
|
331
345
|
{
|
|
332
346
|
friend class SVFIRWriter;
|
|
347
|
+
friend class SVFIRReader;
|
|
333
348
|
|
|
334
349
|
private:
|
|
335
|
-
CopyStmt()
|
|
350
|
+
/// Constructs empty CopyStmt (for SVFIRReader/serilization)
|
|
351
|
+
CopyStmt() : AssignStmt(SVFStmt::Copy) {}
|
|
336
352
|
CopyStmt(const CopyStmt&); ///< place holder
|
|
337
353
|
void operator=(const CopyStmt&); ///< place holder
|
|
338
354
|
public:
|
|
@@ -364,9 +380,11 @@ public:
|
|
|
364
380
|
class StoreStmt: public AssignStmt
|
|
365
381
|
{
|
|
366
382
|
friend class SVFIRWriter;
|
|
383
|
+
friend class SVFIRReader;
|
|
367
384
|
|
|
368
385
|
private:
|
|
369
|
-
StoreStmt()
|
|
386
|
+
/// Constructs empty StoreStmt (for SVFIRReader/serilization)
|
|
387
|
+
StoreStmt() : AssignStmt(SVFStmt::Store) {}
|
|
370
388
|
StoreStmt(const StoreStmt&); ///< place holder
|
|
371
389
|
void operator=(const StoreStmt&); ///< place holder
|
|
372
390
|
|
|
@@ -399,9 +417,11 @@ public:
|
|
|
399
417
|
class LoadStmt: public AssignStmt
|
|
400
418
|
{
|
|
401
419
|
friend class SVFIRWriter;
|
|
420
|
+
friend class SVFIRReader;
|
|
402
421
|
|
|
403
422
|
private:
|
|
404
|
-
LoadStmt()
|
|
423
|
+
/// Constructs empty LoadStmt (for SVFIRReader/serilization)
|
|
424
|
+
LoadStmt(): AssignStmt(SVFStmt::Load) {}
|
|
405
425
|
LoadStmt(const LoadStmt&); ///< place holder
|
|
406
426
|
void operator=(const LoadStmt&); ///< place holder
|
|
407
427
|
|
|
@@ -434,9 +454,11 @@ public:
|
|
|
434
454
|
class GepStmt: public AssignStmt
|
|
435
455
|
{
|
|
436
456
|
friend class SVFIRWriter;
|
|
457
|
+
friend class SVFIRReader;
|
|
437
458
|
|
|
438
459
|
private:
|
|
439
|
-
GepStmt()
|
|
460
|
+
/// Constructs empty GepStmt (for SVFIRReader/serilization)
|
|
461
|
+
GepStmt() : AssignStmt(SVFStmt::Gep) {}
|
|
440
462
|
GepStmt(const GepStmt &); ///< place holder
|
|
441
463
|
void operator=(const GepStmt &); ///< place holder
|
|
442
464
|
|
|
@@ -506,14 +528,18 @@ public:
|
|
|
506
528
|
class CallPE: public AssignStmt
|
|
507
529
|
{
|
|
508
530
|
friend class SVFIRWriter;
|
|
531
|
+
friend class SVFIRReader;
|
|
509
532
|
|
|
510
533
|
private:
|
|
511
|
-
CallPE(); ///< place holder
|
|
512
534
|
CallPE(const CallPE&); ///< place holder
|
|
513
535
|
void operator=(const CallPE&); ///< place holder
|
|
514
536
|
|
|
515
537
|
const CallICFGNode* call; /// the callsite statement calling from
|
|
516
538
|
const FunEntryICFGNode* entry; /// the function exit statement calling to
|
|
539
|
+
protected:
|
|
540
|
+
/// Constructs empty CallPE (for SVFIRReader/serilization)
|
|
541
|
+
CallPE(GEdgeFlag k = SVFStmt::Call) : AssignStmt(k), call{}, entry{} {}
|
|
542
|
+
|
|
517
543
|
public:
|
|
518
544
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
519
545
|
//@{
|
|
@@ -562,14 +588,19 @@ public:
|
|
|
562
588
|
class RetPE: public AssignStmt
|
|
563
589
|
{
|
|
564
590
|
friend class SVFIRWriter;
|
|
591
|
+
friend class SVFIRReader;
|
|
565
592
|
|
|
566
593
|
private:
|
|
567
|
-
RetPE(); ///< place holder
|
|
568
594
|
RetPE(const RetPE&); ///< place holder
|
|
569
595
|
void operator=(const RetPE&); ///< place holder
|
|
570
596
|
|
|
571
597
|
const CallICFGNode* call; /// the callsite statement returning to
|
|
572
598
|
const FunExitICFGNode* exit; /// the function exit statement returned from
|
|
599
|
+
|
|
600
|
+
protected:
|
|
601
|
+
/// Constructs empty RetPE (for SVFIRReader/serilization)
|
|
602
|
+
RetPE(GEdgeFlag k = SVFStmt::Ret) : AssignStmt(k), call{}, exit{} {}
|
|
603
|
+
|
|
573
604
|
public:
|
|
574
605
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
575
606
|
//@{
|
|
@@ -618,6 +649,7 @@ public:
|
|
|
618
649
|
class MultiOpndStmt : public SVFStmt
|
|
619
650
|
{
|
|
620
651
|
friend class SVFIRWriter;
|
|
652
|
+
friend class SVFIRReader;
|
|
621
653
|
|
|
622
654
|
public:
|
|
623
655
|
typedef std::vector<SVFVar*> OPVars;
|
|
@@ -635,6 +667,8 @@ protected:
|
|
|
635
667
|
OPVars opVars;
|
|
636
668
|
/// Constructor, only used by subclassess but not external users
|
|
637
669
|
MultiOpndStmt(SVFVar* r, const OPVars& opnds, GEdgeFlag k);
|
|
670
|
+
/// Constructs empty MultiOpndStmt (for SVFIRReader/serilization)
|
|
671
|
+
MultiOpndStmt(GEdgeFlag k) : SVFStmt(k) {}
|
|
638
672
|
|
|
639
673
|
public:
|
|
640
674
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -697,12 +731,14 @@ public:
|
|
|
697
731
|
class PhiStmt: public MultiOpndStmt
|
|
698
732
|
{
|
|
699
733
|
friend class SVFIRWriter;
|
|
734
|
+
friend class SVFIRReader;
|
|
700
735
|
|
|
701
736
|
public:
|
|
702
737
|
typedef std::vector<const ICFGNode*> OpICFGNodeVec;
|
|
703
738
|
|
|
704
739
|
private:
|
|
705
|
-
PhiStmt()
|
|
740
|
+
/// Constructs empty PhiStmt (for SVFIRReader/serilization)
|
|
741
|
+
PhiStmt() : MultiOpndStmt(SVFStmt::Phi) {}
|
|
706
742
|
PhiStmt(const PhiStmt&); ///< place holder
|
|
707
743
|
void operator=(const PhiStmt&); ///< place holder
|
|
708
744
|
|
|
@@ -763,9 +799,11 @@ public:
|
|
|
763
799
|
class SelectStmt: public MultiOpndStmt
|
|
764
800
|
{
|
|
765
801
|
friend class SVFIRWriter;
|
|
802
|
+
friend class SVFIRReader;
|
|
766
803
|
|
|
767
804
|
private:
|
|
768
|
-
SelectStmt()
|
|
805
|
+
/// Constructs empty SelectStmt (for SVFIRReader/serilization)
|
|
806
|
+
SelectStmt() : MultiOpndStmt(SVFStmt::Select), condition{} {}
|
|
769
807
|
SelectStmt(const SelectStmt&); ///< place holder
|
|
770
808
|
void operator=(const SelectStmt&); ///< place holder
|
|
771
809
|
|
|
@@ -816,9 +854,11 @@ public:
|
|
|
816
854
|
class CmpStmt: public MultiOpndStmt
|
|
817
855
|
{
|
|
818
856
|
friend class SVFIRWriter;
|
|
857
|
+
friend class SVFIRReader;
|
|
819
858
|
|
|
820
859
|
private:
|
|
821
|
-
CmpStmt()
|
|
860
|
+
/// Constructs empty CmpStmt (for SVFIRReader/serilization)
|
|
861
|
+
CmpStmt() : MultiOpndStmt(SVFStmt::Cmp) {}
|
|
822
862
|
CmpStmt(const CmpStmt&); ///< place holder
|
|
823
863
|
void operator=(const CmpStmt&); ///< place holder
|
|
824
864
|
|
|
@@ -900,9 +940,11 @@ public:
|
|
|
900
940
|
class BinaryOPStmt: public MultiOpndStmt
|
|
901
941
|
{
|
|
902
942
|
friend class SVFIRWriter;
|
|
943
|
+
friend class SVFIRReader;
|
|
903
944
|
|
|
904
945
|
private:
|
|
905
|
-
BinaryOPStmt()
|
|
946
|
+
/// Constructs empty BinaryOPStmt (for SVFIRReader/serilization)
|
|
947
|
+
BinaryOPStmt() : MultiOpndStmt(SVFStmt::BinaryOp) {}
|
|
906
948
|
BinaryOPStmt(const BinaryOPStmt&); ///< place holder
|
|
907
949
|
void operator=(const BinaryOPStmt&); ///< place holder
|
|
908
950
|
u32_t opcode;
|
|
@@ -968,9 +1010,11 @@ public:
|
|
|
968
1010
|
class UnaryOPStmt: public SVFStmt
|
|
969
1011
|
{
|
|
970
1012
|
friend class SVFIRWriter;
|
|
1013
|
+
friend class SVFIRReader;
|
|
971
1014
|
|
|
972
1015
|
private:
|
|
973
|
-
UnaryOPStmt()
|
|
1016
|
+
/// Constructs empty UnaryOPStmt (for SVFIRReader/serilization)
|
|
1017
|
+
UnaryOPStmt() : SVFStmt(SVFStmt::UnaryOp) {}
|
|
974
1018
|
UnaryOPStmt(const UnaryOPStmt&); ///< place holder
|
|
975
1019
|
void operator=(const UnaryOPStmt&); ///< place holder
|
|
976
1020
|
SVFVar* getSrcNode(); ///< place holder, use getOpVar() instead
|
|
@@ -1033,12 +1077,14 @@ public:
|
|
|
1033
1077
|
class BranchStmt: public SVFStmt
|
|
1034
1078
|
{
|
|
1035
1079
|
friend class SVFIRWriter;
|
|
1080
|
+
friend class SVFIRReader;
|
|
1036
1081
|
|
|
1037
1082
|
public:
|
|
1038
1083
|
typedef std::vector<std::pair<const ICFGNode*, s32_t>> SuccAndCondPairVec;
|
|
1039
1084
|
|
|
1040
1085
|
private:
|
|
1041
|
-
BranchStmt()
|
|
1086
|
+
/// Constructs empty BranchStmt (for SVFIRReader/serilization)
|
|
1087
|
+
BranchStmt() : SVFStmt(SVFStmt::Branch), cond{}, brInst{} {}
|
|
1042
1088
|
BranchStmt(const BranchStmt&); ///< place holder
|
|
1043
1089
|
void operator=(const BranchStmt&); ///< place holder
|
|
1044
1090
|
SVFVar* getSrcNode(); ///< place holder, not allowed
|
|
@@ -1121,9 +1167,11 @@ public:
|
|
|
1121
1167
|
class TDForkPE: public CallPE
|
|
1122
1168
|
{
|
|
1123
1169
|
friend class SVFIRWriter;
|
|
1170
|
+
friend class SVFIRReader;
|
|
1124
1171
|
|
|
1125
1172
|
private:
|
|
1126
|
-
TDForkPE()
|
|
1173
|
+
/// Constructs empty TDForkPE (for SVFIRReader/serilization)
|
|
1174
|
+
TDForkPE() : CallPE(SVFStmt::ThreadFork) {}
|
|
1127
1175
|
TDForkPE(const TDForkPE&); ///< place holder
|
|
1128
1176
|
void operator=(const TDForkPE&); ///< place holder
|
|
1129
1177
|
|
|
@@ -1160,9 +1208,11 @@ public:
|
|
|
1160
1208
|
class TDJoinPE: public RetPE
|
|
1161
1209
|
{
|
|
1162
1210
|
friend class SVFIRWriter;
|
|
1211
|
+
friend class SVFIRReader;
|
|
1163
1212
|
|
|
1164
1213
|
private:
|
|
1165
|
-
TDJoinPE()
|
|
1214
|
+
/// Constructs empty TDJoinPE (for SVFIRReader/serilization)
|
|
1215
|
+
TDJoinPE() : RetPE(SVFStmt::ThreadJoin) {}
|
|
1166
1216
|
TDJoinPE(const TDJoinPE&); ///< place holder
|
|
1167
1217
|
void operator=(const TDJoinPE&); ///< place holder
|
|
1168
1218
|
|
|
@@ -133,6 +133,7 @@ class StInfo
|
|
|
133
133
|
friend class SVFModuleWrite;
|
|
134
134
|
friend class SVFModuleRead;
|
|
135
135
|
friend class SVFIRWriter;
|
|
136
|
+
friend class SVFIRReader;
|
|
136
137
|
|
|
137
138
|
private:
|
|
138
139
|
/// flattened field indices of a struct (ignoring arrays)
|
|
@@ -244,6 +245,7 @@ class SVFType
|
|
|
244
245
|
friend class SVFModuleWrite;
|
|
245
246
|
friend class SVFModuleRead;
|
|
246
247
|
friend class SVFIRWriter;
|
|
248
|
+
friend class SVFIRReader;
|
|
247
249
|
|
|
248
250
|
public:
|
|
249
251
|
typedef s64_t GNodeK;
|
|
@@ -330,6 +332,7 @@ class SVFPointerType : public SVFType
|
|
|
330
332
|
friend class SVFModuleWrite;
|
|
331
333
|
friend class SVFModuleRead;
|
|
332
334
|
friend class SVFIRWriter;
|
|
335
|
+
friend class SVFIRReader;
|
|
333
336
|
|
|
334
337
|
private:
|
|
335
338
|
const SVFType* ptrElementType;
|
|
@@ -364,6 +367,7 @@ class SVFFunctionType : public SVFType
|
|
|
364
367
|
friend class SVFModuleWrite;
|
|
365
368
|
friend class SVFModuleRead;
|
|
366
369
|
friend class SVFIRWriter;
|
|
370
|
+
friend class SVFIRReader;
|
|
367
371
|
|
|
368
372
|
private:
|
|
369
373
|
const SVFType* retTy;
|
|
@@ -52,6 +52,7 @@ class SVFLoopAndDomInfo
|
|
|
52
52
|
friend class SVFModuleWrite;
|
|
53
53
|
friend class SVFModuleRead;
|
|
54
54
|
friend class SVFIRWriter;
|
|
55
|
+
friend class SVFIRReader;
|
|
55
56
|
public:
|
|
56
57
|
typedef Set<const SVFBasicBlock*> BBSet;
|
|
57
58
|
typedef std::vector<const SVFBasicBlock*> BBList;
|
|
@@ -153,6 +154,7 @@ class SVFValue
|
|
|
153
154
|
friend class SVFModuleWrite;
|
|
154
155
|
friend class SVFModuleRead;
|
|
155
156
|
friend class SVFIRWriter;
|
|
157
|
+
friend class SVFIRReader;
|
|
156
158
|
friend class LLVMModuleSet;
|
|
157
159
|
|
|
158
160
|
public:
|
|
@@ -269,6 +271,7 @@ class SVFFunction : public SVFValue
|
|
|
269
271
|
friend class SVFModuleWrite;
|
|
270
272
|
friend class SVFModuleRead;
|
|
271
273
|
friend class SVFIRWriter;
|
|
274
|
+
friend class SVFIRReader;
|
|
272
275
|
|
|
273
276
|
public:
|
|
274
277
|
typedef std::vector<const SVFBasicBlock*>::const_iterator const_iterator;
|
|
@@ -486,6 +489,7 @@ class SVFBasicBlock : public SVFValue
|
|
|
486
489
|
friend class SVFModuleWrite;
|
|
487
490
|
friend class SVFModuleRead;
|
|
488
491
|
friend class SVFIRWriter;
|
|
492
|
+
friend class SVFIRReader;
|
|
489
493
|
|
|
490
494
|
public:
|
|
491
495
|
typedef std::vector<const SVFInstruction*>::const_iterator const_iterator;
|
|
@@ -587,6 +591,7 @@ class SVFInstruction : public SVFValue
|
|
|
587
591
|
friend class SVFModuleWrite;
|
|
588
592
|
friend class SVFModuleRead;
|
|
589
593
|
friend class SVFIRWriter;
|
|
594
|
+
friend class SVFIRReader;
|
|
590
595
|
public:
|
|
591
596
|
typedef std::vector<const SVFInstruction*> InstVec;
|
|
592
597
|
|
|
@@ -655,6 +660,7 @@ class SVFCallInst : public SVFInstruction
|
|
|
655
660
|
friend class SVFModuleWrite;
|
|
656
661
|
friend class SVFModuleRead;
|
|
657
662
|
friend class SVFIRWriter;
|
|
663
|
+
friend class SVFIRReader;
|
|
658
664
|
friend class LLVMModuleSet;
|
|
659
665
|
|
|
660
666
|
private:
|
|
@@ -730,6 +736,7 @@ class SVFVirtualCallInst : public SVFCallInst
|
|
|
730
736
|
friend class SVFModuleWrite;
|
|
731
737
|
friend class SVFModuleRead;
|
|
732
738
|
friend class SVFIRWriter;
|
|
739
|
+
friend class SVFIRReader;
|
|
733
740
|
friend class LLVMModuleSet;
|
|
734
741
|
|
|
735
742
|
private:
|
|
@@ -789,6 +796,7 @@ class SVFConstant : public SVFValue
|
|
|
789
796
|
friend class SVFModuleWrite;
|
|
790
797
|
friend class SVFModuleRead;
|
|
791
798
|
friend class SVFIRWriter;
|
|
799
|
+
friend class SVFIRReader;
|
|
792
800
|
public:
|
|
793
801
|
SVFConstant(const std::string& _const, const SVFType* ty, SVFValKind k = SVFConst): SVFValue(_const, ty, k)
|
|
794
802
|
{
|
|
@@ -812,6 +820,7 @@ class SVFGlobalValue : public SVFConstant
|
|
|
812
820
|
friend class SVFModuleWrite;
|
|
813
821
|
friend class SVFModuleRead;
|
|
814
822
|
friend class SVFIRWriter;
|
|
823
|
+
friend class SVFIRReader;
|
|
815
824
|
friend class LLVMModuleSet;
|
|
816
825
|
|
|
817
826
|
private:
|
|
@@ -851,6 +860,7 @@ class SVFArgument : public SVFValue
|
|
|
851
860
|
friend class SVFModuleWrite;
|
|
852
861
|
friend class SVFModuleRead;
|
|
853
862
|
friend class SVFIRWriter;
|
|
863
|
+
friend class SVFIRReader;
|
|
854
864
|
private:
|
|
855
865
|
const SVFFunction* fun;
|
|
856
866
|
u32_t argNo;
|
|
@@ -891,6 +901,7 @@ class SVFConstantData : public SVFConstant
|
|
|
891
901
|
friend class SVFModuleWrite;
|
|
892
902
|
friend class SVFModuleRead;
|
|
893
903
|
friend class SVFIRWriter;
|
|
904
|
+
friend class SVFIRReader;
|
|
894
905
|
public:
|
|
895
906
|
SVFConstantData(const std::string& _const, const SVFType* ty, SVFValKind k = SVFConstData): SVFConstant(_const, ty, k)
|
|
896
907
|
{
|
|
@@ -921,6 +932,7 @@ class SVFConstantInt : public SVFConstantData
|
|
|
921
932
|
friend class SVFModuleWrite;
|
|
922
933
|
friend class SVFModuleRead;
|
|
923
934
|
friend class SVFIRWriter;
|
|
935
|
+
friend class SVFIRReader;
|
|
924
936
|
private:
|
|
925
937
|
u64_t zval;
|
|
926
938
|
s64_t sval;
|
|
@@ -956,6 +968,7 @@ class SVFConstantFP : public SVFConstantData
|
|
|
956
968
|
friend class SVFModuleWrite;
|
|
957
969
|
friend class SVFModuleRead;
|
|
958
970
|
friend class SVFIRWriter;
|
|
971
|
+
friend class SVFIRReader;
|
|
959
972
|
private:
|
|
960
973
|
float dval;
|
|
961
974
|
public:
|
|
@@ -984,6 +997,7 @@ class SVFConstantNullPtr : public SVFConstantData
|
|
|
984
997
|
friend class SVFModuleWrite;
|
|
985
998
|
friend class SVFModuleRead;
|
|
986
999
|
friend class SVFIRWriter;
|
|
1000
|
+
friend class SVFIRReader;
|
|
987
1001
|
|
|
988
1002
|
public:
|
|
989
1003
|
SVFConstantNullPtr(const std::string& _const, const SVFType* ty): SVFConstantData(_const, ty, SVFValue::SVFNullPtr)
|
|
@@ -1006,6 +1020,7 @@ class SVFBlackHoleValue : public SVFConstantData
|
|
|
1006
1020
|
friend class SVFModuleWrite;
|
|
1007
1021
|
friend class SVFModuleRead;
|
|
1008
1022
|
friend class SVFIRWriter;
|
|
1023
|
+
friend class SVFIRReader;
|
|
1009
1024
|
|
|
1010
1025
|
public:
|
|
1011
1026
|
SVFBlackHoleValue(const std::string& _const, const SVFType* ty): SVFConstantData(_const, ty, SVFValue::SVFBlackHole)
|
|
@@ -1028,6 +1043,7 @@ class SVFOtherValue : public SVFValue
|
|
|
1028
1043
|
friend class SVFModuleWrite;
|
|
1029
1044
|
friend class SVFModuleRead;
|
|
1030
1045
|
friend class SVFIRWriter;
|
|
1046
|
+
friend class SVFIRReader;
|
|
1031
1047
|
public:
|
|
1032
1048
|
SVFOtherValue(const std::string& other, const SVFType* ty, SVFValKind k = SVFValue::SVFOther): SVFValue(other, ty, k)
|
|
1033
1049
|
{
|
|
@@ -1048,6 +1064,7 @@ class SVFMetadataAsValue : public SVFOtherValue
|
|
|
1048
1064
|
friend class SVFModuleWrite;
|
|
1049
1065
|
friend class SVFModuleRead;
|
|
1050
1066
|
friend class SVFIRWriter;
|
|
1067
|
+
friend class SVFIRReader;
|
|
1051
1068
|
public:
|
|
1052
1069
|
SVFMetadataAsValue(const std::string& other, const SVFType* ty): SVFOtherValue(other, ty, SVFValue::SVFMetaAsValue)
|
|
1053
1070
|
{
|
|
@@ -1067,9 +1084,14 @@ public:
|
|
|
1067
1084
|
|
|
1068
1085
|
class CallSite
|
|
1069
1086
|
{
|
|
1087
|
+
friend class SVFIRReader;
|
|
1088
|
+
|
|
1070
1089
|
private:
|
|
1071
1090
|
const SVFCallInst* CB;
|
|
1072
1091
|
|
|
1092
|
+
/// Constructs empty CallSite (for SVFIRReader/deserialization)
|
|
1093
|
+
CallSite() : CB{} {}
|
|
1094
|
+
|
|
1073
1095
|
public:
|
|
1074
1096
|
CallSite(const SVFInstruction* I) : CB(SVFUtil::dyn_cast<SVFCallInst>(I))
|
|
1075
1097
|
{
|
|
@@ -45,6 +45,7 @@ typedef GenericNode<SVFVar, SVFStmt> GenericPAGNodeTy;
|
|
|
45
45
|
class SVFVar : public GenericPAGNodeTy
|
|
46
46
|
{
|
|
47
47
|
friend class SVFIRWriter;
|
|
48
|
+
friend class SVFIRReader;
|
|
48
49
|
friend class IRGraph;
|
|
49
50
|
friend class SVFIR;
|
|
50
51
|
friend class VFG;
|
|
@@ -79,6 +80,9 @@ protected:
|
|
|
79
80
|
SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap;
|
|
80
81
|
bool isPtr; /// whether it is a pointer (top-level or address-taken)
|
|
81
82
|
|
|
83
|
+
/// Constructor to create an empty object (for deserialization)
|
|
84
|
+
SVFVar(NodeID i, PNODEK k) : GenericPAGNodeTy(i, k), value{} {}
|
|
85
|
+
|
|
82
86
|
public:
|
|
83
87
|
/// Constructor
|
|
84
88
|
SVFVar(const SVFValue* val, NodeID i, PNODEK k);
|
|
@@ -258,6 +262,11 @@ public:
|
|
|
258
262
|
class ValVar: public SVFVar
|
|
259
263
|
{
|
|
260
264
|
friend class SVFIRWriter;
|
|
265
|
+
friend class SVFIRReader;
|
|
266
|
+
|
|
267
|
+
protected:
|
|
268
|
+
/// Constructor to create an empty ValVar (for SVFIRReader/deserialization)
|
|
269
|
+
ValVar(NodeID i, PNODEK ty = ValNode) : SVFVar(i, ty) {}
|
|
261
270
|
|
|
262
271
|
public:
|
|
263
272
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -306,9 +315,12 @@ public:
|
|
|
306
315
|
class ObjVar: public SVFVar
|
|
307
316
|
{
|
|
308
317
|
friend class SVFIRWriter;
|
|
318
|
+
friend class SVFIRReader;
|
|
309
319
|
|
|
310
320
|
protected:
|
|
311
321
|
const MemObj* mem; ///< memory object
|
|
322
|
+
/// Constructor to create an empty ObjVar (for SVFIRReader/deserialization)
|
|
323
|
+
ObjVar(NodeID i, PNODEK ty = ObjNode) : SVFVar(i, ty), mem{} {}
|
|
312
324
|
/// Constructor
|
|
313
325
|
ObjVar(const SVFValue* val, NodeID i, const MemObj* m, PNODEK ty = ObjNode) :
|
|
314
326
|
SVFVar(val, i, ty), mem(m)
|
|
@@ -368,11 +380,15 @@ public:
|
|
|
368
380
|
class GepValVar: public ValVar
|
|
369
381
|
{
|
|
370
382
|
friend class SVFIRWriter;
|
|
383
|
+
friend class SVFIRReader;
|
|
371
384
|
|
|
372
385
|
private:
|
|
373
386
|
LocationSet ls; // LocationSet
|
|
374
387
|
const SVFType* gepValType;
|
|
375
388
|
|
|
389
|
+
/// Constructor to create empty GeValVar (for SVFIRReader/deserialization)
|
|
390
|
+
GepValVar(NodeID i) : ValVar(i, GepValNode), gepValType{} {}
|
|
391
|
+
|
|
376
392
|
public:
|
|
377
393
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
378
394
|
//@{
|
|
@@ -432,11 +448,16 @@ public:
|
|
|
432
448
|
class GepObjVar: public ObjVar
|
|
433
449
|
{
|
|
434
450
|
friend class SVFIRWriter;
|
|
451
|
+
friend class SVFIRReader;
|
|
435
452
|
|
|
436
453
|
private:
|
|
437
454
|
LocationSet ls;
|
|
438
455
|
NodeID base = 0;
|
|
439
456
|
|
|
457
|
+
/// Constructor to create empty GepObjVar (for SVFIRReader/deserialization)
|
|
458
|
+
// only for reading from file when we don't have MemObj*
|
|
459
|
+
GepObjVar(NodeID i, PNODEK ty = GepObjNode) : ObjVar(i, ty) {}
|
|
460
|
+
|
|
440
461
|
public:
|
|
441
462
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
442
463
|
//@{
|
|
@@ -514,6 +535,11 @@ public:
|
|
|
514
535
|
class FIObjVar: public ObjVar
|
|
515
536
|
{
|
|
516
537
|
friend class SVFIRWriter;
|
|
538
|
+
friend class SVFIRReader;
|
|
539
|
+
|
|
540
|
+
private:
|
|
541
|
+
/// Constructor to create empty ObjVar (for SVFIRReader/deserialization)
|
|
542
|
+
FIObjVar(NodeID i, PNODEK ty = FIObjNode) : ObjVar(i, ty) {}
|
|
517
543
|
|
|
518
544
|
public:
|
|
519
545
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -560,6 +586,11 @@ public:
|
|
|
560
586
|
class RetPN: public ValVar
|
|
561
587
|
{
|
|
562
588
|
friend class SVFIRWriter;
|
|
589
|
+
friend class SVFIRReader;
|
|
590
|
+
|
|
591
|
+
private:
|
|
592
|
+
/// Constructor to create empty RetPN (for SVFIRReader/deserialization)
|
|
593
|
+
RetPN(NodeID i) : ValVar(i, RetNode) {}
|
|
563
594
|
|
|
564
595
|
public:
|
|
565
596
|
//@{ Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -599,6 +630,11 @@ public:
|
|
|
599
630
|
class VarArgPN: public ValVar
|
|
600
631
|
{
|
|
601
632
|
friend class SVFIRWriter;
|
|
633
|
+
friend class SVFIRReader;
|
|
634
|
+
|
|
635
|
+
private:
|
|
636
|
+
/// Constructor to create empty VarArgPN (for SVFIRReader/deserialization)
|
|
637
|
+
VarArgPN(NodeID i) : ValVar(i, VarargNode) {}
|
|
602
638
|
|
|
603
639
|
public:
|
|
604
640
|
//@{ Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -638,6 +674,7 @@ public:
|
|
|
638
674
|
class DummyValVar: public ValVar
|
|
639
675
|
{
|
|
640
676
|
friend class SVFIRWriter;
|
|
677
|
+
friend class SVFIRReader;
|
|
641
678
|
|
|
642
679
|
public:
|
|
643
680
|
//@{ Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -677,6 +714,11 @@ public:
|
|
|
677
714
|
class DummyObjVar: public ObjVar
|
|
678
715
|
{
|
|
679
716
|
friend class SVFIRWriter;
|
|
717
|
+
friend class SVFIRReader;
|
|
718
|
+
|
|
719
|
+
private:
|
|
720
|
+
/// Constructor to create empty DummyObjVar (for SVFIRReader/deserialization)
|
|
721
|
+
DummyObjVar(NodeID i) : ObjVar(i, DummyObjNode) {}
|
|
680
722
|
|
|
681
723
|
public:
|
|
682
724
|
//@{ Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -48,6 +48,7 @@ class SymbolTableInfo
|
|
|
48
48
|
{
|
|
49
49
|
friend class SymbolTableBuilder;
|
|
50
50
|
friend class SVFIRWriter;
|
|
51
|
+
friend class SVFIRReader;
|
|
51
52
|
|
|
52
53
|
public:
|
|
53
54
|
|
|
@@ -288,6 +289,19 @@ public:
|
|
|
288
289
|
|
|
289
290
|
//@}
|
|
290
291
|
|
|
292
|
+
/// Constant reader that won't change the state of the symbol table
|
|
293
|
+
//@{
|
|
294
|
+
inline const SVFTypeSet& getSVFTypes() const
|
|
295
|
+
{
|
|
296
|
+
return svfTypes;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
inline const Set<const StInfo*>& getStInfos() const
|
|
300
|
+
{
|
|
301
|
+
return stInfos;
|
|
302
|
+
}
|
|
303
|
+
//@}
|
|
304
|
+
|
|
291
305
|
/// Get struct info
|
|
292
306
|
//@{
|
|
293
307
|
///Get a reference to StructInfo.
|
|
@@ -354,7 +368,7 @@ protected:
|
|
|
354
368
|
SVFTypeSet svfTypes;
|
|
355
369
|
|
|
356
370
|
/// @brief (owned) All StInfo
|
|
357
|
-
Set<StInfo*> stInfos;
|
|
371
|
+
Set<const StInfo*> stInfos;
|
|
358
372
|
};
|
|
359
373
|
|
|
360
374
|
|
|
@@ -364,6 +378,7 @@ protected:
|
|
|
364
378
|
class MemObj
|
|
365
379
|
{
|
|
366
380
|
friend class SVFIRWriter;
|
|
381
|
+
friend class SVFIRReader;
|
|
367
382
|
|
|
368
383
|
private:
|
|
369
384
|
/// Type information of this object
|
|
@@ -456,6 +471,7 @@ public:
|
|
|
456
471
|
class ObjTypeInfo
|
|
457
472
|
{
|
|
458
473
|
friend class SVFIRWriter;
|
|
474
|
+
friend class SVFIRReader;
|
|
459
475
|
friend class SymbolTableBuilder;
|
|
460
476
|
|
|
461
477
|
public:
|
|
@@ -135,6 +135,7 @@ public:
|
|
|
135
135
|
static const Option<bool> ShowSVFIRValue;
|
|
136
136
|
static const Option<bool> DumpICFG;
|
|
137
137
|
static const Option<std::string> DumpJson;
|
|
138
|
+
static const Option<bool> ReadJson;
|
|
138
139
|
static const Option<bool> CallGraphDotGraph;
|
|
139
140
|
static const Option<bool> PAGPrint;
|
|
140
141
|
static const Option<u32_t> IndirectCallLimit;
|