svf-tools 1.0.357 → 1.0.358
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-doxygen/html/html/AndersenSFR_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/CHGBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ConsG_8h_source.html +2 -2
- package/SVF-doxygen/html/html/ContextDDA_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/DDAVFSolver_8h_source.html +6 -6
- package/SVF-doxygen/html/html/FlowDDA_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/FlowSensitiveStat_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/IRGraph_8h_source.html +2 -2
- package/SVF-doxygen/html/html/LocationSet_8cpp_source.html +12 -12
- package/SVF-doxygen/html/html/LocationSet_8h_source.html +1 -1
- package/SVF-doxygen/html/html/MemRegion_8cpp_source.html +6 -6
- package/SVF-doxygen/html/html/PAGBuilderFromFile_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PTAStat_8cpp_source.html +15 -15
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/PointerAnalysis_8cpp_source.html +6 -6
- package/SVF-doxygen/html/html/PointerAnalysis_8h_source.html +5 -5
- package/SVF-doxygen/html/html/SVFIRBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFIR_8cpp_source.html +7 -7
- package/SVF-doxygen/html/html/SVFIR_8h_source.html +5 -5
- package/SVF-doxygen/html/html/SVFModule_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFStatements_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFStatements_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SVFVariables_8h_source.html +5 -5
- package/SVF-doxygen/html/html/SaberSVFGBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SymbolTableBuilder_8cpp_source.html +22 -22
- package/SVF-doxygen/html/html/SymbolTableBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SymbolTableInfo_8cpp_source.html +52 -50
- package/SVF-doxygen/html/html/SymbolTableInfo_8h_source.html +86 -83
- package/SVF-doxygen/html/html/ThreadCallGraph_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/TypeBasedHeapCloning_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/TypeBasedHeapCloning_8h_source.html +1 -1
- package/SVF-doxygen/html/html/VersionedFlowSensitiveStat_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSFR.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1BranchStmt.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1CHGBuilder.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1ContextDDA.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1DDAVFSolver.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1FlowDDA.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitive.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveStat.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1GepObjVar.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1GepStmt.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1IRGraph.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1LocationSet.html +27 -29
- package/SVF-doxygen/html/html/classSVF_1_1MRGenerator.html +7 -7
- package/SVF-doxygen/html/html/classSVF_1_1MemObj.html +87 -87
- package/SVF-doxygen/html/html/classSVF_1_1ObjTypeInfo.html +99 -99
- package/SVF-doxygen/html/html/classSVF_1_1ObjVar.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1PAGBuilderFromFile.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1PTAStat.html +16 -16
- package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1SVFIR.html +16 -16
- package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1SVFModule.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SaberSVFGBuilder.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1StInfo-members.html +20 -15
- package/SVF-doxygen/html/html/classSVF_1_1StInfo.html +239 -89
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableBuilder.html +35 -35
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo-members.html +6 -4
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo.html +178 -130
- package/SVF-doxygen/html/html/classSVF_1_1ThreadCallGraph.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1TypeBasedHeapCloning.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitiveStat.html +3 -3
- package/SVF-doxygen/html/html/functions_a.html +1 -1
- package/SVF-doxygen/html/html/functions_e.html +3 -0
- package/SVF-doxygen/html/html/functions_f.html +12 -17
- package/SVF-doxygen/html/html/functions_func.html +1 -1
- package/SVF-doxygen/html/html/functions_func_g.html +21 -13
- package/SVF-doxygen/html/html/functions_func_s.html +8 -5
- package/SVF-doxygen/html/html/functions_g.html +20 -12
- package/SVF-doxygen/html/html/functions_i.html +3 -3
- package/SVF-doxygen/html/html/functions_l.html +3 -3
- package/SVF-doxygen/html/html/functions_m.html +1 -1
- package/SVF-doxygen/html/html/functions_n.html +9 -3
- package/SVF-doxygen/html/html/functions_o.html +11 -11
- package/SVF-doxygen/html/html/functions_p.html +10 -10
- package/SVF-doxygen/html/html/functions_r.html +2 -4
- package/SVF-doxygen/html/html/functions_s.html +23 -22
- package/SVF-doxygen/html/html/functions_t.html +3 -3
- package/SVF-doxygen/html/html/functions_v.html +6 -6
- package/SVF-doxygen/html/html/functions_vars_e.html +3 -0
- package/SVF-doxygen/html/html/functions_vars_f.html +0 -3
- package/SVF-doxygen/html/html/functions_vars_n.html +6 -0
- package/SVF-doxygen/html/html/functions_w.html +5 -9
- package/SVF-doxygen/html/html/search/all_1.js +1 -1
- package/SVF-doxygen/html/html/search/all_10.js +7 -7
- package/SVF-doxygen/html/html/search/all_12.js +2 -2
- package/SVF-doxygen/html/html/search/all_13.js +11 -10
- package/SVF-doxygen/html/html/search/all_14.js +4 -4
- package/SVF-doxygen/html/html/search/all_15.js +1 -1
- package/SVF-doxygen/html/html/search/all_16.js +3 -3
- package/SVF-doxygen/html/html/search/all_17.js +1 -1
- package/SVF-doxygen/html/html/search/all_5.js +1 -0
- package/SVF-doxygen/html/html/search/all_6.js +1 -2
- package/SVF-doxygen/html/html/search/all_7.js +6 -4
- package/SVF-doxygen/html/html/search/all_9.js +1 -1
- package/SVF-doxygen/html/html/search/all_c.js +1 -1
- package/SVF-doxygen/html/html/search/all_d.js +2 -2
- package/SVF-doxygen/html/html/search/all_e.js +5 -3
- package/SVF-doxygen/html/html/search/all_f.js +1 -1
- package/SVF-doxygen/html/html/search/functions_0.js +1 -1
- package/SVF-doxygen/html/html/search/functions_10.js +2 -1
- package/SVF-doxygen/html/html/search/functions_6.js +6 -4
- package/SVF-doxygen/html/html/search/variables_14.js +2 -2
- package/SVF-doxygen/html/html/search/variables_15.js +1 -1
- package/SVF-doxygen/html/html/search/variables_5.js +1 -0
- package/SVF-doxygen/html/html/search/variables_6.js +0 -1
- package/SVF-doxygen/html/html/search/variables_d.js +1 -1
- package/SVF-doxygen/html/html/search/variables_e.js +3 -1
- package/include/MemoryModel/SymbolTableInfo.h +37 -41
- package/lib/MemoryModel/LocationSet.cpp +42 -37
- package/lib/MemoryModel/SymbolTableInfo.cpp +71 -8
- package/package.json +1 -1
|
@@ -36,7 +36,6 @@ var searchData=
|
|
|
36
36
|
['fspta',['fspta',['../classSVF_1_1FlowSensitive.html#a4ad2095dc708df07602de25e4a004776',1,'SVF::FlowSensitive::fspta()'],['../classSVF_1_1FlowSensitiveStat.html#af7e04f73ee17647c52e571cadef8729f',1,'SVF::FlowSensitiveStat::fspta()']]],
|
|
37
37
|
['fstimelimit',['FsTimeLimit',['../classSVF_1_1Options.html#ad03c4697dd4da2b6adde112e3ee1884b',1,'SVF::Options']]],
|
|
38
38
|
['fulljoin',['fullJoin',['../classSVF_1_1ForkJoinAnalysis.html#a4193a30050195cd9aaafd58511b66ccc',1,'SVF::ForkJoinAnalysis']]],
|
|
39
|
-
['fulloffsetvec',['fullOffsetVec',['../classSVF_1_1StInfo.html#a5a7987ced798a2194d8c74025547f407',1,'SVF::StInfo']]],
|
|
40
39
|
['fullreachable',['fullReachable',['../classSVF_1_1ProgSlice.html#a632db4b2e69848955925746ac721d94f',1,'SVF::ProgSlice']]],
|
|
41
40
|
['fun',['fun',['../classSVF_1_1ICFGNode.html#a03587dbd558d8fffe25307b42e3195be',1,'SVF::ICFGNode::fun()'],['../classSVF_1_1FunExitICFGNode.html#adfcebc33f3c36b8145074d370dfa1cb9',1,'SVF::FunExitICFGNode::fun()'],['../classSVF_1_1PTACallGraphNode.html#a1453299fc45dc51d2c9842ff4de1b860',1,'SVF::PTACallGraphNode::fun()'],['../classSVF_1_1InterMSSAPHISVFGNode.html#aa7ccd369a342e151e22062c92bf1f978',1,'SVF::InterMSSAPHISVFGNode::fun()'],['../classSVF_1_1FormalParmVFGNode.html#ad8f56074e213d2e7dc1d22a1b0765f8c',1,'SVF::FormalParmVFGNode::fun()'],['../classSVF_1_1FormalRetVFGNode.html#ae267daf3681188e6e74f656a73d21be3',1,'SVF::FormalRetVFGNode::fun()'],['../classSVF_1_1InterPHIVFGNode.html#a5aa8e8a10a5c30f2f4669c9190e18740',1,'SVF::InterPHIVFGNode::fun()'],['../classSVF_1_1RetMU.html#a4982f6fffac4f4775e27f994677a9f2c',1,'SVF::RetMU::fun()'],['../classSVF_1_1EntryCHI.html#afd2b2d4a7198f62467b4062740e5196c',1,'SVF::EntryCHI::fun()'],['../classSVF_1_1SVFFunction.html#af33c2824b5ca3a44e0467655ae890623',1,'SVF::SVFFunction::fun()'],['../classSVF_1_1CxtProc.html#a70b6a2ae40bd7e4b08ddcb6d6b0289df',1,'SVF::CxtProc::fun()']]],
|
|
42
41
|
['funargslistmap',['funArgsListMap',['../classSVF_1_1SVFIR.html#a864c465fbfdbbbdcc7fc8bbe26737903',1,'SVF::SVFIR']]],
|
|
@@ -17,7 +17,7 @@ var searchData=
|
|
|
17
17
|
['maxcachehard',['maxCacheHard',['../structDdManager.html#a1b53bee9cf86fc1131c420c2aef7e473',1,'DdManager']]],
|
|
18
18
|
['maxcontextlen',['MaxContextLen',['../classSVF_1_1Options.html#a2e53156bd075d7802d390672f129c6a8',1,'SVF::Options']]],
|
|
19
19
|
['maxcxtsize',['MaxCxtSize',['../classSVF_1_1TCT.html#aaae41663b1d1f4d38b047c50c156defb',1,'SVF::TCT']]],
|
|
20
|
-
['maxfieldlimit',['
|
|
20
|
+
['maxfieldlimit',['MaxFieldLimit',['../classSVF_1_1Options.html#adfc1a5c6098d3867e29fc65ca9ffa1cc',1,'SVF::Options::MaxFieldLimit()'],['../classSVF_1_1SymbolTableInfo.html#a9b8b7ecb217c7395025231b04e7b4c26',1,'SVF::SymbolTableInfo::maxFieldLimit()'],['../classSVF_1_1StInfo.html#a4cd926bd095254dd287f1cf26e02483e',1,'SVF::StInfo::maxFieldLimit()']]],
|
|
21
21
|
['maxgrowth',['maxGrowth',['../structDdManager.html#a8a6a4238d1bc8a87eabd2c3eabd233d7',1,'DdManager']]],
|
|
22
22
|
['maxgrowthalt',['maxGrowthAlt',['../structDdManager.html#a2926e48e488cec20a61e9b0dc6b91795',1,'DdManager']]],
|
|
23
23
|
['maximumbudget',['maximumBudget',['../classSVF_1_1DPItem.html#a5dbb0e6010b38c5b937ff06cb40cd0ef',1,'SVF::DPItem']]],
|
|
@@ -71,7 +71,9 @@ var searchData=
|
|
|
71
71
|
['numofentrychi',['NumOfEntryChi',['../classSVF_1_1MemSSAStat.html#ad96437d0c28f8088c711a718d2f2730e',1,'SVF::MemSSAStat']]],
|
|
72
72
|
['numofentrynodes',['numOfEntryNodes',['../classSVF_1_1ICFGStat.html#ad37793e64fe58a8faba201c18d876685',1,'SVF::ICFGStat']]],
|
|
73
73
|
['numofexitnodes',['numOfExitNodes',['../classSVF_1_1ICFGStat.html#ad7e00680fb8ca31afbd166f9a4adc5ec',1,'SVF::ICFGStat']]],
|
|
74
|
-
['numoffieldexpand',['
|
|
74
|
+
['numoffieldexpand',['NumOfFieldExpand',['../classSVF_1_1PTAStat.html#a1745e5c3c026a130a70954da9c0074b1',1,'SVF::PTAStat::NumOfFieldExpand()'],['../classSVF_1_1AndersenBase.html#a9f453ec1b4236b8194ae590981217259',1,'SVF::AndersenBase::numOfFieldExpand()']]],
|
|
75
|
+
['numofflattenelements',['numOfFlattenElements',['../classSVF_1_1StInfo.html#a7aa5b5018b4dec4913eb6aecf25568a4',1,'SVF::StInfo']]],
|
|
76
|
+
['numofflattenfields',['numOfFlattenFields',['../classSVF_1_1StInfo.html#aa9b4e659f4a4421aadf736a3de24ca50',1,'SVF::StInfo']]],
|
|
75
77
|
['numofformalin',['numOfFormalIn',['../classSVF_1_1SVFGStat.html#abc5e079242666bb55ec7dbc7f258b3db',1,'SVF::SVFGStat']]],
|
|
76
78
|
['numofformalout',['numOfFormalOut',['../classSVF_1_1SVFGStat.html#ab20900eb0ecb0d2e1e601755848ac531',1,'SVF::SVFGStat']]],
|
|
77
79
|
['numofformalparam',['numOfFormalParam',['../classSVF_1_1SVFGStat.html#a1e9ddd5678b05e145af41a6d53f47748',1,'SVF::SVFGStat']]],
|
|
@@ -344,18 +344,7 @@ public:
|
|
|
344
344
|
/// Get struct info
|
|
345
345
|
//@{
|
|
346
346
|
///Get an iterator for StructInfo, designed as internal methods
|
|
347
|
-
TypeToFieldInfoMap::iterator getStructInfoIter(const Type *T)
|
|
348
|
-
{
|
|
349
|
-
assert(T);
|
|
350
|
-
TypeToFieldInfoMap::iterator it = typeToFieldInfo.find(T);
|
|
351
|
-
if (it != typeToFieldInfo.end())
|
|
352
|
-
return it;
|
|
353
|
-
else
|
|
354
|
-
{
|
|
355
|
-
collectTypeInfo(T);
|
|
356
|
-
return typeToFieldInfo.find(T);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
347
|
+
TypeToFieldInfoMap::iterator getStructInfoIter(const Type *T);
|
|
359
348
|
|
|
360
349
|
///Get a reference to StructInfo.
|
|
361
350
|
inline StInfo* getStructInfo(const Type *T)
|
|
@@ -364,8 +353,12 @@ public:
|
|
|
364
353
|
}
|
|
365
354
|
|
|
366
355
|
///Get a reference to the components of struct_info.
|
|
367
|
-
///
|
|
368
|
-
const
|
|
356
|
+
/// Number of flattenned elements of an array or struct
|
|
357
|
+
const u32_t getNumOfFlattenElements(const Type *T);
|
|
358
|
+
/// Number of flattenned fields of a struct
|
|
359
|
+
const u32_t getNumOfFlattenFields(const StructType *T);
|
|
360
|
+
/// Flatterned element idx of an array or struct by considering stride
|
|
361
|
+
const std::vector<u32_t>& getFlattenedElemIdxVec(const Type *T);
|
|
369
362
|
/// Flatterned field index information of a struct ignoring any array field
|
|
370
363
|
const std::vector<u32_t>& getFlattenedFieldIdxVec(const StructType *T);
|
|
371
364
|
|
|
@@ -513,14 +506,18 @@ class StInfo
|
|
|
513
506
|
private:
|
|
514
507
|
/// flattened field indices of a struct (ignoring arrays)
|
|
515
508
|
std::vector<u32_t> fldIdxVec;
|
|
516
|
-
/// flattened
|
|
517
|
-
std::vector<u32_t>
|
|
509
|
+
/// flattened element indices including structs and arrays by considering strides
|
|
510
|
+
std::vector<u32_t> elemIdxVec;
|
|
518
511
|
/// Types of all fields of a struct
|
|
519
512
|
Map<u32_t, const Type*> fldIdx2TypeMap;
|
|
520
513
|
/// All field infos after flattening a struct
|
|
521
514
|
std::vector<FlattenedFieldInfo> finfo;
|
|
522
515
|
/// stride represents the number of repetitive elements if this StInfo represent an ArrayType. stride is 1 by default.
|
|
523
516
|
u32_t stride;
|
|
517
|
+
/// number of elements after flattenning (including array elements)
|
|
518
|
+
u32_t numOfFlattenElements;
|
|
519
|
+
/// number of fields after flattenning (ignoring array elements)
|
|
520
|
+
u32_t numOfFlattenFields;
|
|
524
521
|
/// Max field limit
|
|
525
522
|
static u32_t maxFieldLimit;
|
|
526
523
|
|
|
@@ -530,7 +527,7 @@ private:
|
|
|
530
527
|
|
|
531
528
|
public:
|
|
532
529
|
/// Constructor
|
|
533
|
-
StInfo(u32_t s) : stride(s)
|
|
530
|
+
StInfo(u32_t s) : stride(s), numOfFlattenElements(s), numOfFlattenFields(s)
|
|
534
531
|
{
|
|
535
532
|
}
|
|
536
533
|
/// Destructor
|
|
@@ -552,28 +549,16 @@ public:
|
|
|
552
549
|
/// OriginalFieldType of b with field_idx 1 : Struct A
|
|
553
550
|
/// FlatternedFieldType of b with field_idx 1 : int
|
|
554
551
|
//{@
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
if(it!=fldIdx2TypeMap.end())
|
|
559
|
-
return it->second;
|
|
560
|
-
return nullptr;
|
|
561
|
-
}
|
|
562
|
-
inline const Type* getFlatternedFieldType(u32_t fldIdx)
|
|
563
|
-
{
|
|
564
|
-
for(FlattenedFieldInfo& fallenedFld : finfo){
|
|
565
|
-
if(fallenedFld.getFlattenFldIdx() == fldIdx)
|
|
566
|
-
return fallenedFld.getFlattenElemTy();
|
|
567
|
-
}
|
|
568
|
-
return nullptr;
|
|
569
|
-
}
|
|
552
|
+
const Type* getOriginalFieldType(u32_t fldIdx);
|
|
553
|
+
const Type* getFlatternedFieldType(u32_t fldIdx);
|
|
554
|
+
|
|
570
555
|
inline std::vector<u32_t>& getFlattenedFieldIdxVec()
|
|
571
556
|
{
|
|
572
557
|
return fldIdxVec;
|
|
573
558
|
}
|
|
574
|
-
inline std::vector<u32_t>&
|
|
559
|
+
inline std::vector<u32_t>& getFlattenedElemIdxVec()
|
|
575
560
|
{
|
|
576
|
-
return
|
|
561
|
+
return elemIdxVec;
|
|
577
562
|
}
|
|
578
563
|
inline std::vector<FlattenedFieldInfo>& getFlattenedFieldInfoVec()
|
|
579
564
|
{
|
|
@@ -581,16 +566,27 @@ public:
|
|
|
581
566
|
}
|
|
582
567
|
//@}
|
|
583
568
|
|
|
584
|
-
/// Add field
|
|
585
|
-
|
|
569
|
+
/// Add field index and element index and their corresponding type
|
|
570
|
+
void addFldWithType(u32_t fldIdx, const Type* type, u32_t elemIdx);
|
|
571
|
+
|
|
572
|
+
/// Set number of fields and elements of an aggrate
|
|
573
|
+
inline void setNumOfFieldsAndElems(u32_t nf, u32_t ne)
|
|
586
574
|
{
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
fldIdx2TypeMap[fldIdx] = type;
|
|
575
|
+
numOfFlattenFields = nf;
|
|
576
|
+
numOfFlattenElements = ne;
|
|
590
577
|
}
|
|
591
578
|
|
|
592
|
-
///
|
|
593
|
-
inline u32_t
|
|
579
|
+
/// Return number of elements after flattenning (including array elements)
|
|
580
|
+
inline u32_t getNumOfFlattenElements() const {
|
|
581
|
+
return numOfFlattenElements;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/// Return the number of fields after flattenning (ignoring array elements)
|
|
585
|
+
inline u32_t getNumOfFlattenFields() const {
|
|
586
|
+
return numOfFlattenFields;
|
|
587
|
+
}
|
|
588
|
+
/// Return the stride
|
|
589
|
+
inline u32_t getStride() const{
|
|
594
590
|
return stride;
|
|
595
591
|
}
|
|
596
592
|
};
|
|
@@ -56,71 +56,76 @@ bool LocationSet::isConstantOffset() const
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/// Return element number of a type
|
|
59
|
-
/// (1) StructType, return flatterned number elements
|
|
60
|
-
/// (2)
|
|
61
|
-
/// (3)
|
|
62
|
-
/// (4) non-pointer SingleValueType, return 1
|
|
59
|
+
/// (1) StructType or Array, return flatterned number elements.
|
|
60
|
+
/// (2) PointerType, return the element number of the pointee
|
|
61
|
+
/// (3) non-pointer SingleValueType, return 1
|
|
63
62
|
u32_t LocationSet::getElementNum(const Type* type) const{
|
|
64
|
-
|
|
65
|
-
if(
|
|
66
|
-
{
|
|
67
|
-
/// handle nested arrays
|
|
68
|
-
const Type* innerTy = aty;
|
|
69
|
-
while (const ArrayType* arr = SVFUtil::dyn_cast<ArrayType>(innerTy))
|
|
70
|
-
{
|
|
71
|
-
sz *= arr->getNumElements();
|
|
72
|
-
innerTy = arr->getElementType();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
else if (const StructType *sty = SVFUtil::dyn_cast<StructType>(type) )
|
|
63
|
+
|
|
64
|
+
if(SVFUtil::isa<ArrayType>(type) || SVFUtil::isa<StructType>(type))
|
|
76
65
|
{
|
|
77
|
-
|
|
78
|
-
sz = so.back() + 1;
|
|
66
|
+
return SymbolTableInfo::SymbolInfo()->getNumOfFlattenElements(type);
|
|
79
67
|
}
|
|
80
68
|
else if (type->isSingleValueType())
|
|
81
69
|
{
|
|
82
70
|
/// This is a pointer arithmic
|
|
83
|
-
if(const PointerType* pty = SVFUtil::dyn_cast<PointerType>(type)
|
|
84
|
-
|
|
85
|
-
|
|
71
|
+
if(const PointerType* pty = SVFUtil::dyn_cast<PointerType>(type))
|
|
72
|
+
return getElementNum(pty->getElementType());
|
|
73
|
+
else
|
|
74
|
+
return 1;
|
|
86
75
|
}
|
|
87
76
|
else{
|
|
88
77
|
SVFUtil::outs() << "GepIter Type" << *type << "\n";
|
|
89
78
|
assert(false && "What other types for this gep?");
|
|
79
|
+
abort();
|
|
90
80
|
}
|
|
91
|
-
return sz;
|
|
92
81
|
}
|
|
93
82
|
|
|
94
83
|
/// Return accumulated constant offset
|
|
95
84
|
///
|
|
96
85
|
/// "value" is the offset variable (must be a constant)
|
|
97
86
|
/// "type" is the location where we want to compute offset
|
|
98
|
-
///
|
|
99
|
-
///
|
|
100
|
-
///
|
|
101
|
-
|
|
102
|
-
///
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
87
|
+
/// Given a vector: [(value1,type1), (value2,type2), (value3,type3)]
|
|
88
|
+
/// totalConstOffset = flattenOffset(value1,type1) * flattenOffset(type2,type2) + flattenOffset(type3,type3)
|
|
89
|
+
/// For a pointer type (e.g., t1 is PointerType), we will retrieve the pointee type and times the offset, i.e., getElementNum(t1) X off1
|
|
90
|
+
|
|
91
|
+
/// For example,
|
|
92
|
+
// struct inner{ int rollNumber; float percentage;};
|
|
93
|
+
// struct Student { struct inner rollNumber; char studentName[10][3];}
|
|
94
|
+
// char x = studentRecord[1].studentName[3][2];
|
|
95
|
+
|
|
96
|
+
/// %5 = getelementptr inbounds %struct.Student, %struct.Student* %4, i64 1
|
|
97
|
+
/// value1: i64 1 type1: %struct.Student*
|
|
98
|
+
/// accumulateConstantOffset = 32
|
|
99
|
+
/// %6 = getelementptr inbounds %struct.Student, %struct.Student* %5, i32 0, i32 1
|
|
100
|
+
/// value1: i32 0 type1: %struct.Student*
|
|
101
|
+
/// value2: i32 1 type2: %struct.Student = type { %struct.inner, [10 x [3 x i8]] }
|
|
102
|
+
/// accumulateConstantOffset = 2
|
|
103
|
+
/// %7 = getelementptr inbounds [10 x [3 x i8]], [10 x [3 x i8]]* %6, i64 0, i64 3
|
|
104
|
+
/// value1: i64 0 type1: [10 x [3 x i8]]*
|
|
105
|
+
/// value2: i64 3 type2: [10 x [3 x i8]]
|
|
106
|
+
/// accumulateConstantOffset = 9
|
|
107
|
+
/// %8 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 2
|
|
108
|
+
/// value1: i64 0 type1: [3 x i8]*
|
|
109
|
+
/// value2: i64 2 type2: [3 x i8]
|
|
110
|
+
/// accumulateConstantOffset = 2
|
|
106
111
|
s64_t LocationSet::accumulateConstantOffset() const{
|
|
107
112
|
|
|
108
113
|
assert(isConstantOffset() && "not a constant offset");
|
|
109
114
|
|
|
110
115
|
s64_t totalConstOffset = 0;
|
|
111
|
-
u32_t sz = 1;
|
|
112
116
|
for(int i = offsetValues.size() - 1; i >= 0; i--){
|
|
113
117
|
const Value* value = offsetValues[i].first;
|
|
114
118
|
const Type* type = offsetValues[i].second;
|
|
115
119
|
const ConstantInt *op = SVFUtil::dyn_cast<ConstantInt>(value);
|
|
116
120
|
assert(op && "not a constant offset?");
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
if(const PointerType* pty = SVFUtil::dyn_cast<PointerType>(type))
|
|
122
|
+
totalConstOffset += op->getSExtValue() * getElementNum(pty->getElementType());
|
|
123
|
+
else{
|
|
124
|
+
s64_t offset = op->getSExtValue();
|
|
125
|
+
const std::vector<u32_t>& so = SymbolTableInfo::SymbolInfo()->getFlattenedElemIdxVec(type);
|
|
126
|
+
assert((u32_t)offset <= so.size() && "out of bounds or offset is a negative value?");
|
|
127
|
+
totalConstOffset += so[op->getSExtValue()];
|
|
121
128
|
}
|
|
122
|
-
totalConstOffset += op->getSExtValue() * sz;
|
|
123
|
-
sz *= getElementNum(type);
|
|
124
129
|
}
|
|
125
130
|
return totalConstOffset;
|
|
126
131
|
}
|
|
@@ -43,6 +43,48 @@ DataLayout* SymbolTableInfo::dl = nullptr;
|
|
|
43
43
|
SymbolTableInfo* SymbolTableInfo::symInfo = nullptr;
|
|
44
44
|
u32_t StInfo::maxFieldLimit = 0;
|
|
45
45
|
|
|
46
|
+
|
|
47
|
+
/// Add field (index and offset) with its corresponding type
|
|
48
|
+
void StInfo::addFldWithType(u32_t fldIdx, const Type* type, u32_t elemIdx)
|
|
49
|
+
{
|
|
50
|
+
fldIdxVec.push_back(fldIdx);
|
|
51
|
+
elemIdxVec.push_back(elemIdx);
|
|
52
|
+
fldIdx2TypeMap[fldIdx] = type;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/// struct A { int id; int salary; }; struct B { char name[20]; struct A a;} B b;
|
|
56
|
+
/// OriginalFieldType of b with field_idx 1 : Struct A
|
|
57
|
+
/// FlatternedFieldType of b with field_idx 1 : int
|
|
58
|
+
//{@
|
|
59
|
+
const Type* StInfo::getOriginalFieldType(u32_t fldIdx)
|
|
60
|
+
{
|
|
61
|
+
Map<u32_t, const Type*>::const_iterator it = fldIdx2TypeMap.find(fldIdx);
|
|
62
|
+
if(it!=fldIdx2TypeMap.end())
|
|
63
|
+
return it->second;
|
|
64
|
+
return nullptr;
|
|
65
|
+
}
|
|
66
|
+
const Type* StInfo::getFlatternedFieldType(u32_t fldIdx)
|
|
67
|
+
{
|
|
68
|
+
for(FlattenedFieldInfo& fallenedFld : finfo){
|
|
69
|
+
if(fallenedFld.getFlattenFldIdx() == fldIdx)
|
|
70
|
+
return fallenedFld.getFlattenElemTy();
|
|
71
|
+
}
|
|
72
|
+
return nullptr;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
SymbolTableInfo::TypeToFieldInfoMap::iterator SymbolTableInfo::getStructInfoIter(const Type *T)
|
|
76
|
+
{
|
|
77
|
+
assert(T);
|
|
78
|
+
TypeToFieldInfoMap::iterator it = typeToFieldInfo.find(T);
|
|
79
|
+
if (it != typeToFieldInfo.end())
|
|
80
|
+
return it;
|
|
81
|
+
else
|
|
82
|
+
{
|
|
83
|
+
collectTypeInfo(T);
|
|
84
|
+
return typeToFieldInfo.find(T);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
46
88
|
/*
|
|
47
89
|
* Initial the memory object here (for a dummy object)
|
|
48
90
|
*/
|
|
@@ -87,20 +129,17 @@ void SymbolTableInfo::collectTypeInfo(const Type* ty)
|
|
|
87
129
|
*/
|
|
88
130
|
void SymbolTableInfo::collectArrayInfo(const ArrayType* ty)
|
|
89
131
|
{
|
|
90
|
-
u64_t
|
|
132
|
+
u64_t totalElemNum = ty->getNumElements();
|
|
91
133
|
const Type* elemTy = ty->getElementType();
|
|
92
134
|
while (const ArrayType* aty = SVFUtil::dyn_cast<ArrayType>(elemTy))
|
|
93
135
|
{
|
|
94
|
-
|
|
136
|
+
totalElemNum *= aty->getNumElements();
|
|
95
137
|
elemTy = aty->getElementType();
|
|
96
138
|
}
|
|
97
139
|
|
|
98
|
-
StInfo* stinfo = new StInfo(
|
|
140
|
+
StInfo* stinfo = new StInfo(totalElemNum);
|
|
99
141
|
typeToFieldInfo[ty] = stinfo;
|
|
100
142
|
|
|
101
|
-
/// Array itself only has one field which is the inner most element
|
|
102
|
-
stinfo->addFldWithType(0, elemTy, 0);
|
|
103
|
-
|
|
104
143
|
/// Array's flatten field infor is the same as its element's
|
|
105
144
|
/// flatten infor.
|
|
106
145
|
StInfo* elemStInfo = getStructInfo(elemTy);
|
|
@@ -112,6 +151,14 @@ void SymbolTableInfo::collectArrayInfo(const ArrayType* ty)
|
|
|
112
151
|
FlattenedFieldInfo field(idx, fieldTy);
|
|
113
152
|
stinfo->getFlattenedFieldInfoVec().push_back(field);
|
|
114
153
|
}
|
|
154
|
+
|
|
155
|
+
/// Flatten arrays, map each array element index `i` to flattened index `(i * nfE * totalElemNum)/outArrayElemNum`
|
|
156
|
+
/// nfE>1 if the array element is a struct with more than one field.
|
|
157
|
+
u32_t outArrayElemNum = ty->getNumElements();
|
|
158
|
+
for(u32_t i = 0; i < outArrayElemNum; i++)
|
|
159
|
+
stinfo->addFldWithType(0, elemTy, (i * nfE * totalElemNum)/outArrayElemNum);
|
|
160
|
+
|
|
161
|
+
stinfo->setNumOfFieldsAndElems(nfE, nfE * totalElemNum);
|
|
115
162
|
}
|
|
116
163
|
|
|
117
164
|
|
|
@@ -160,6 +207,8 @@ void SymbolTableInfo::collectStructInfo(const StructType *sty)
|
|
|
160
207
|
}
|
|
161
208
|
}
|
|
162
209
|
|
|
210
|
+
stinfo->setNumOfFieldsAndElems(nf,strideOffset);
|
|
211
|
+
|
|
163
212
|
//Record the size of the complete struct and update max_struct.
|
|
164
213
|
if (nf > maxStSize)
|
|
165
214
|
{
|
|
@@ -182,6 +231,8 @@ void SymbolTableInfo::collectSimpleTypeInfo(const Type* ty)
|
|
|
182
231
|
|
|
183
232
|
FlattenedFieldInfo field(0, ty);
|
|
184
233
|
stinfo->getFlattenedFieldInfoVec().push_back(field);
|
|
234
|
+
|
|
235
|
+
stinfo->setNumOfFieldsAndElems(1,1);
|
|
185
236
|
}
|
|
186
237
|
|
|
187
238
|
|
|
@@ -322,10 +373,22 @@ const MemObj* SymbolTableInfo::createDummyObj(SymID symId, const Type* type)
|
|
|
322
373
|
return memObj;
|
|
323
374
|
}
|
|
324
375
|
|
|
376
|
+
/// Number of flattenned elements of an array or struct
|
|
377
|
+
const u32_t SymbolTableInfo::getNumOfFlattenElements(const Type *T)
|
|
378
|
+
{
|
|
379
|
+
return getStructInfoIter(T)->second->getNumOfFlattenElements();
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/// Number of flattenned fields of a struct
|
|
383
|
+
const u32_t SymbolTableInfo::getNumOfFlattenFields(const StructType *T)
|
|
384
|
+
{
|
|
385
|
+
return getStructInfoIter(T)->second->getNumOfFlattenFields();
|
|
386
|
+
}
|
|
387
|
+
|
|
325
388
|
/// Flatterned full offset information of a struct including its array fields
|
|
326
|
-
const std::vector<u32_t>& SymbolTableInfo::
|
|
389
|
+
const std::vector<u32_t>& SymbolTableInfo::getFlattenedElemIdxVec(const Type *T)
|
|
327
390
|
{
|
|
328
|
-
return getStructInfoIter(T)->second->
|
|
391
|
+
return getStructInfoIter(T)->second->getFlattenedElemIdxVec();
|
|
329
392
|
}
|
|
330
393
|
|
|
331
394
|
/// Flatterned field index information of a struct ignoring any array field
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.358",
|
|
4
4
|
"description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|