svf-tools 1.0.352 → 1.0.356
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/ConsG_8cpp_source.html +7 -7
- package/SVF-doxygen/html/html/ConsG_8h_source.html +2 -2
- package/SVF-doxygen/html/html/ContextDDA_8cpp_source.html +4 -4
- package/SVF-doxygen/html/html/ContextDDA_8h_source.html +1 -1
- package/SVF-doxygen/html/html/DDAClient_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/DDAStat_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/DDAVFSolver_8h_source.html +8 -8
- package/SVF-doxygen/html/html/FlowDDA_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/FlowDDA_8h_source.html +1 -1
- package/SVF-doxygen/html/html/FlowSensitiveStat_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/FlowSensitiveTBHC_8cpp_source.html +12 -12
- package/SVF-doxygen/html/html/FlowSensitive_8cpp_source.html +28 -29
- package/SVF-doxygen/html/html/FlowSensitive_8h_source.html +26 -26
- package/SVF-doxygen/html/html/Graph2Json_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ICFG_8cpp_source.html +10 -9
- package/SVF-doxygen/html/html/IRGraph_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/IRGraph_8h_source.html +1 -1
- package/SVF-doxygen/html/html/LocationSet_8cpp_source.html +19 -8
- package/SVF-doxygen/html/html/LocationSet_8h_source.html +6 -6
- package/SVF-doxygen/html/html/MemRegion_8cpp_source.html +5 -5
- package/SVF-doxygen/html/html/Options_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PAGBuilderFromFile_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/PTAStat_8cpp_source.html +14 -14
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8cpp_source.html +5 -5
- package/SVF-doxygen/html/html/PointerAnalysis_8cpp_source.html +18 -21
- package/SVF-doxygen/html/html/PointerAnalysis_8h_source.html +17 -17
- package/SVF-doxygen/html/html/SVFGBuilder_8cpp_source.html +7 -8
- package/SVF-doxygen/html/html/SVFGBuilder_8h_source.html +8 -8
- package/SVF-doxygen/html/html/SVFIRBuilder_8cpp_source.html +6 -5
- package/SVF-doxygen/html/html/SVFIRBuilder_8h_source.html +25 -24
- package/SVF-doxygen/html/html/SVFIR_8cpp_source.html +20 -19
- package/SVF-doxygen/html/html/SVFIR_8h_source.html +15 -14
- package/SVF-doxygen/html/html/SVFStatements_8h_source.html +89 -85
- package/SVF-doxygen/html/html/SVFVariables_8h_source.html +4 -4
- package/SVF-doxygen/html/html/SaberSVFGBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SaberSVFGBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SrcSnkDDA_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 +51 -50
- package/SVF-doxygen/html/html/SymbolTableInfo_8h_source.html +67 -62
- 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/VFGNode_8h_source.html +9 -8
- package/SVF-doxygen/html/html/VFG_8cpp_source.html +14 -14
- package/SVF-doxygen/html/html/VFG_8h_source.html +10 -10
- package/SVF-doxygen/html/html/VersionedFlowSensitiveStat_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/VersionedFlowSensitive_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/VersionedFlowSensitive_8h_source.html +1 -1
- package/SVF-doxygen/html/html/WPAPass_8cpp_source.html +4 -6
- package/SVF-doxygen/html/html/WPAPass_8h_source.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSFR.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1BinaryOPStmt.html +15 -15
- package/SVF-doxygen/html/html/classSVF_1_1BranchStmt-members.html +26 -24
- package/SVF-doxygen/html/html/classSVF_1_1BranchStmt.html +140 -86
- package/SVF-doxygen/html/html/classSVF_1_1BranchVFGNode-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1BranchVFGNode.html +8 -8
- package/SVF-doxygen/html/html/classSVF_1_1CallPE.html +15 -15
- package/SVF-doxygen/html/html/classSVF_1_1CmpStmt.html +16 -16
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintGraph.html +7 -7
- package/SVF-doxygen/html/html/classSVF_1_1ContextDDA.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1DDAPass.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1DDAStat.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1DDAVFSolver.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1FSMPTA.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1FlowDDA.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitive.html +76 -78
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveStat.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveTBHC.html +12 -12
- package/SVF-doxygen/html/html/classSVF_1_1FunptrDDAClient.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1GepObjVar.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1GepStmt-members.html +68 -67
- package/SVF-doxygen/html/html/classSVF_1_1GepStmt.html +38 -7
- package/SVF-doxygen/html/html/classSVF_1_1ICFG.html +3 -1
- package/SVF-doxygen/html/html/classSVF_1_1ICFGPrinter.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1LocationSet-members.html +22 -21
- package/SVF-doxygen/html/html/classSVF_1_1LocationSet.html +86 -32
- package/SVF-doxygen/html/html/classSVF_1_1MRGenerator.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1MTASVFGBuilder-members.html +2 -4
- package/SVF-doxygen/html/html/classSVF_1_1MTASVFGBuilder.html +10 -14
- package/SVF-doxygen/html/html/classSVF_1_1MemObj.html +87 -87
- package/SVF-doxygen/html/html/classSVF_1_1MultiOpndStmt.html +25 -25
- package/SVF-doxygen/html/html/classSVF_1_1ObjTypeInfo.html +98 -98
- package/SVF-doxygen/html/html/classSVF_1_1ObjVar.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1PAGBuilderFromFile.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1PTAStat.html +14 -14
- package/SVF-doxygen/html/html/classSVF_1_1PhiStmt.html +15 -15
- package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +43 -48
- package/SVF-doxygen/html/html/classSVF_1_1RetPE.html +15 -15
- package/SVF-doxygen/html/html/classSVF_1_1SVFGBuilder-members.html +2 -4
- package/SVF-doxygen/html/html/classSVF_1_1SVFGBuilder.html +32 -78
- package/SVF-doxygen/html/html/classSVF_1_1SVFIR-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SVFIR.html +30 -30
- package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +79 -73
- package/SVF-doxygen/html/html/classSVF_1_1SaberSVFGBuilder-members.html +2 -4
- package/SVF-doxygen/html/html/classSVF_1_1SaberSVFGBuilder.html +8 -12
- package/SVF-doxygen/html/html/classSVF_1_1SrcSnkDDA.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1StInfo-members.html +13 -6
- package/SVF-doxygen/html/html/classSVF_1_1StInfo.html +263 -37
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableBuilder.html +24 -24
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo-members.html +65 -64
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo.html +90 -63
- package/SVF-doxygen/html/html/classSVF_1_1TDForkPE.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1TDJoinPE.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1ThreadCallGraph.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1TypeAnalysis.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1TypeBasedHeapCloning.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1UnaryOPStmt.html +20 -20
- package/SVF-doxygen/html/html/classSVF_1_1VFG.html +16 -16
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitive.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitiveStat.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1WPAPass.html +13 -14
- package/SVF-doxygen/html/html/functions_a.html +13 -12
- package/SVF-doxygen/html/html/functions_b.html +5 -11
- package/SVF-doxygen/html/html/functions_f.html +20 -15
- package/SVF-doxygen/html/html/functions_func.html +14 -13
- package/SVF-doxygen/html/html/functions_func_b.html +0 -6
- package/SVF-doxygen/html/html/functions_func_g.html +28 -15
- package/SVF-doxygen/html/html/functions_func_o.html +2 -1
- package/SVF-doxygen/html/html/functions_func_s.html +4 -4
- package/SVF-doxygen/html/html/functions_g.html +26 -13
- package/SVF-doxygen/html/html/functions_l.html +8 -8
- package/SVF-doxygen/html/html/functions_o.html +12 -13
- package/SVF-doxygen/html/html/functions_p.html +16 -16
- package/SVF-doxygen/html/html/functions_r.html +1 -1
- package/SVF-doxygen/html/html/functions_s.html +18 -12
- package/SVF-doxygen/html/html/functions_t.html +3 -1
- package/SVF-doxygen/html/html/functions_type_s.html +3 -0
- package/SVF-doxygen/html/html/functions_v.html +6 -6
- package/SVF-doxygen/html/html/functions_vars_f.html +3 -0
- package/SVF-doxygen/html/html/functions_vars_s.html +4 -1
- package/SVF-doxygen/html/html/functions_w.html +9 -5
- package/SVF-doxygen/html/html/search/all_1.js +3 -3
- package/SVF-doxygen/html/html/search/all_10.js +7 -7
- package/SVF-doxygen/html/html/search/all_12.js +1 -1
- package/SVF-doxygen/html/html/search/all_13.js +12 -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_2.js +1 -3
- package/SVF-doxygen/html/html/search/all_6.js +1 -0
- package/SVF-doxygen/html/html/search/all_7.js +6 -2
- package/SVF-doxygen/html/html/search/all_c.js +4 -4
- package/SVF-doxygen/html/html/search/all_e.js +1 -1
- package/SVF-doxygen/html/html/search/all_f.js +1 -1
- package/SVF-doxygen/html/html/search/functions_0.js +3 -3
- package/SVF-doxygen/html/html/search/functions_1.js +1 -3
- package/SVF-doxygen/html/html/search/functions_10.js +1 -1
- package/SVF-doxygen/html/html/search/functions_6.js +6 -2
- package/SVF-doxygen/html/html/search/functions_d.js +1 -1
- package/SVF-doxygen/html/html/search/functions_e.js +1 -1
- package/SVF-doxygen/html/html/search/typedefs_11.js +1 -0
- package/SVF-doxygen/html/html/search/variables_13.js +2 -1
- 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_6.js +1 -0
- package/SVF-doxygen/html/html/search/variables_e.js +1 -1
- package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01ICFG_01_5_01_4.html +16 -16
- package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01IRGraph_01_5_01_4.html +2 -2
- package/SVF-doxygen/html/html/structstd_1_1hash_3_01SVF_1_1LocationSet_01_4.html +3 -3
- package/SVF-doxygen/html/html/svf-ex_8cpp.html +1 -1
- package/SVF-doxygen/html/html/svf-ex_8cpp_source.html +2 -2
- package/include/DDA/DDAVFSolver.h +1 -1
- package/include/Graphs/VFGNode.h +1 -1
- package/include/MSSA/SVFGBuilder.h +0 -2
- package/include/MemoryModel/LocationSet.h +4 -0
- package/include/MemoryModel/SVFIR.h +1 -1
- package/include/MemoryModel/SVFStatements.h +25 -5
- package/include/MemoryModel/SymbolTableInfo.h +27 -6
- package/include/SVF-FE/SVFIRBuilder.h +1 -1
- package/lib/Graphs/ICFG.cpp +4 -0
- package/lib/MSSA/SVFGBuilder.cpp +4 -11
- package/lib/MemoryModel/LocationSet.cpp +69 -7
- package/lib/MemoryModel/PointerAnalysis.cpp +0 -6
- package/lib/MemoryModel/SVFIR.cpp +1 -1
- package/lib/MemoryModel/SymbolTableInfo.cpp +23 -16
- package/lib/SABER/SrcSnkDDA.cpp +2 -2
- package/lib/SVF-FE/SVFIRBuilder.cpp +9 -4
- package/lib/Util/Options.cpp +1 -1
- package/lib/WPA/FlowSensitive.cpp +3 -5
- package/lib/WPA/WPAPass.cpp +1 -9
- package/package.json +1 -1
- package/tools/Example/svf-ex.cpp +1 -1
|
@@ -45,7 +45,7 @@ bool LocationSet::addOffsetValue(const Value* offsetVal, const Type* type)
|
|
|
45
45
|
return true;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
/// Return
|
|
48
|
+
/// Return true if all offset values are constants
|
|
49
49
|
bool LocationSet::isConstantOffset() const
|
|
50
50
|
{
|
|
51
51
|
for(auto it : offsetValues){
|
|
@@ -55,12 +55,74 @@ bool LocationSet::isConstantOffset() const
|
|
|
55
55
|
return true;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
/// Return
|
|
59
|
-
///
|
|
60
|
-
///
|
|
61
|
-
|
|
58
|
+
/// Return element number of a type
|
|
59
|
+
/// (1) StructType, return flatterned number elements, i.e., the index of the last element (getFlattenedOffsetVec().back()) plus one.
|
|
60
|
+
/// (2) ArrayType, return number of elements
|
|
61
|
+
/// (3) PointerType, return the element number of the pointee
|
|
62
|
+
/// (4) non-pointer SingleValueType, return 1
|
|
63
|
+
u32_t LocationSet::getElementNum(const Type* type) const{
|
|
64
|
+
u32_t sz = 1;
|
|
65
|
+
if(const ArrayType* aty = SVFUtil::dyn_cast<ArrayType>(type))
|
|
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) )
|
|
76
|
+
{
|
|
77
|
+
const vector<u32_t> &so = SymbolTableInfo::SymbolInfo()->getFlattenedOffsetVec(sty);
|
|
78
|
+
sz = so.back() + 1;
|
|
79
|
+
}
|
|
80
|
+
else if (type->isSingleValueType())
|
|
81
|
+
{
|
|
82
|
+
/// This is a pointer arithmic
|
|
83
|
+
if(const PointerType* pty = SVFUtil::dyn_cast<PointerType>(type) ){
|
|
84
|
+
sz = getElementNum(pty->getElementType());
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else{
|
|
88
|
+
SVFUtil::outs() << "GepIter Type" << *type << "\n";
|
|
89
|
+
assert(false && "What other types for this gep?");
|
|
90
|
+
}
|
|
91
|
+
return sz;
|
|
92
|
+
}
|
|
62
93
|
|
|
63
|
-
|
|
94
|
+
/// Return accumulated constant offset
|
|
95
|
+
///
|
|
96
|
+
/// "value" is the offset variable (must be a constant)
|
|
97
|
+
/// "type" is the location where we want to compute offset
|
|
98
|
+
/// e.g., %3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
|
|
99
|
+
/// offsetValues[0] value: i64 0, type: [10 x i32]*
|
|
100
|
+
/// offsetValues[1] value: i64 5, type: [10 x i32]
|
|
101
|
+
///
|
|
102
|
+
/// Given a vector: [(v1,t1), (v2,t2), (v3,t3)]
|
|
103
|
+
/// totalConstOffset = v1 * sz(t2) + v2 * sz(t3) + v3 * 1
|
|
104
|
+
/// If the vector only has one element (one gep operand), then it must be a pointer arithmetic and type must be a PointerType
|
|
105
|
+
/// totalConstOffset = v1 * sz(t1)
|
|
106
|
+
s64_t LocationSet::accumulateConstantOffset() const{
|
|
107
|
+
|
|
108
|
+
assert(isConstantOffset() && "not a constant offset");
|
|
109
|
+
|
|
110
|
+
s64_t totalConstOffset = 0;
|
|
111
|
+
u32_t sz = 1;
|
|
112
|
+
for(int i = offsetValues.size() - 1; i >= 0; i--){
|
|
113
|
+
const Value* value = offsetValues[i].first;
|
|
114
|
+
const Type* type = offsetValues[i].second;
|
|
115
|
+
const ConstantInt *op = SVFUtil::dyn_cast<ConstantInt>(value);
|
|
116
|
+
assert(op && "not a constant offset?");
|
|
117
|
+
/// if this gep only has one operand, the gepIterType must be the pointer type, and we will need to retrieve size of its elementType.
|
|
118
|
+
if(offsetValues.size()==1){
|
|
119
|
+
assert(SVFUtil::isa<PointerType>(type) && "If gep has only one operand, its gepIterType must be PointerType!");
|
|
120
|
+
sz = getElementNum(type);
|
|
121
|
+
}
|
|
122
|
+
totalConstOffset += op->getSExtValue() * sz;
|
|
123
|
+
sz *= getElementNum(type);
|
|
124
|
+
}
|
|
125
|
+
return totalConstOffset;
|
|
64
126
|
}
|
|
65
127
|
/*!
|
|
66
128
|
* Compute all possible locations according to offset and number-stride pairs.
|
|
@@ -147,4 +209,4 @@ std::string LocationSet::dump() const
|
|
|
147
209
|
}
|
|
148
210
|
rawstr << " }\n";
|
|
149
211
|
return rawstr.str();
|
|
150
|
-
}
|
|
212
|
+
}
|
|
@@ -208,12 +208,6 @@ void PointerAnalysis::finalize()
|
|
|
208
208
|
if (Options::PAGDotGraph)
|
|
209
209
|
pag->dump("pag_final");
|
|
210
210
|
|
|
211
|
-
// dump ICFG
|
|
212
|
-
if (Options::DumpICFG){
|
|
213
|
-
pag->getICFG()->updateCallGraph(ptaCallGraph);
|
|
214
|
-
pag->getICFG()->dump("icfg_final");
|
|
215
|
-
}
|
|
216
|
-
|
|
217
211
|
/// Dump results
|
|
218
212
|
if (Options::PTSPrint)
|
|
219
213
|
{
|
|
@@ -164,7 +164,7 @@ UnaryOPStmt* SVFIR::addUnaryOPStmt(NodeID src, NodeID dst, u32_t opcode)
|
|
|
164
164
|
/*
|
|
165
165
|
* Add BranchStmt
|
|
166
166
|
*/
|
|
167
|
-
BranchStmt* SVFIR::addBranchStmt(NodeID br, NodeID cond,
|
|
167
|
+
BranchStmt* SVFIR::addBranchStmt(NodeID br, NodeID cond, const BranchStmt::SuccAndCondPairVec& succs)
|
|
168
168
|
{
|
|
169
169
|
SVFVar* brNode = getGNode(br);
|
|
170
170
|
SVFVar* condNode = getGNode(cond);
|
|
@@ -87,21 +87,19 @@ void SymbolTableInfo::collectTypeInfo(const Type* ty)
|
|
|
87
87
|
*/
|
|
88
88
|
void SymbolTableInfo::collectArrayInfo(const ArrayType* ty)
|
|
89
89
|
{
|
|
90
|
-
StInfo* stinfo = new StInfo();
|
|
91
|
-
typeToFieldInfo[ty] = stinfo;
|
|
92
|
-
|
|
93
90
|
u64_t out_num = ty->getNumElements();
|
|
94
|
-
const
|
|
95
|
-
u32_t out_stride = getTypeSizeInBytes(elemTy);
|
|
91
|
+
const Type* elemTy = ty->getElementType();
|
|
96
92
|
while (const ArrayType* aty = SVFUtil::dyn_cast<ArrayType>(elemTy))
|
|
97
93
|
{
|
|
98
94
|
out_num *= aty->getNumElements();
|
|
99
95
|
elemTy = aty->getElementType();
|
|
100
|
-
out_stride = getTypeSizeInBytes(elemTy);
|
|
101
96
|
}
|
|
97
|
+
|
|
98
|
+
StInfo* stinfo = new StInfo(out_num);
|
|
99
|
+
typeToFieldInfo[ty] = stinfo;
|
|
102
100
|
|
|
103
101
|
/// Array itself only has one field which is the inner most element
|
|
104
|
-
stinfo->addFldWithType(0,elemTy);
|
|
102
|
+
stinfo->addFldWithType(0, elemTy, 0);
|
|
105
103
|
|
|
106
104
|
/// Array's flatten field infor is the same as its element's
|
|
107
105
|
/// flatten infor.
|
|
@@ -124,19 +122,19 @@ void SymbolTableInfo::collectArrayInfo(const ArrayType* ty)
|
|
|
124
122
|
void SymbolTableInfo::collectStructInfo(const StructType *sty)
|
|
125
123
|
{
|
|
126
124
|
/// The struct info should not be processed before
|
|
127
|
-
StInfo* stinfo = new StInfo();
|
|
125
|
+
StInfo* stinfo = new StInfo(1);
|
|
128
126
|
typeToFieldInfo[sty] = stinfo;
|
|
129
127
|
|
|
130
128
|
// Number of fields after flattening the struct
|
|
131
129
|
u32_t nf = 0;
|
|
132
|
-
//
|
|
133
|
-
u32_t
|
|
130
|
+
// The offset when considering array stride info
|
|
131
|
+
u32_t strideOffset = 0;
|
|
134
132
|
for (StructType::element_iterator it = sty->element_begin(), ie =
|
|
135
|
-
sty->element_end(); it != ie; ++it
|
|
133
|
+
sty->element_end(); it != ie; ++it)
|
|
136
134
|
{
|
|
137
135
|
const Type *et = *it;
|
|
138
136
|
/// offset with int_32 (s64_t) is large enough and will not cause overflow
|
|
139
|
-
stinfo->addFldWithType(nf, et);
|
|
137
|
+
stinfo->addFldWithType(nf, et, strideOffset);
|
|
140
138
|
|
|
141
139
|
if (SVFUtil::isa<StructType>(et) || SVFUtil::isa<ArrayType>(et))
|
|
142
140
|
{
|
|
@@ -151,12 +149,14 @@ void SymbolTableInfo::collectStructInfo(const StructType *sty)
|
|
|
151
149
|
stinfo->getFlattenedFieldInfoVec().push_back(field);
|
|
152
150
|
}
|
|
153
151
|
nf += nfE;
|
|
152
|
+
strideOffset += nfE * subStinfo->getStride();
|
|
154
153
|
}
|
|
155
154
|
else //simple type
|
|
156
155
|
{
|
|
157
156
|
FlattenedFieldInfo field(nf, et);
|
|
158
157
|
stinfo->getFlattenedFieldInfoVec().push_back(field);
|
|
159
|
-
|
|
158
|
+
nf += 1;
|
|
159
|
+
strideOffset += 1;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
|
|
@@ -174,11 +174,11 @@ void SymbolTableInfo::collectStructInfo(const StructType *sty)
|
|
|
174
174
|
*/
|
|
175
175
|
void SymbolTableInfo::collectSimpleTypeInfo(const Type* ty)
|
|
176
176
|
{
|
|
177
|
-
StInfo* stinfo = new StInfo();
|
|
177
|
+
StInfo* stinfo = new StInfo(1);
|
|
178
178
|
typeToFieldInfo[ty] = stinfo;
|
|
179
179
|
|
|
180
180
|
/// Only one field
|
|
181
|
-
stinfo->addFldWithType(0, ty);
|
|
181
|
+
stinfo->addFldWithType(0, ty, 0);
|
|
182
182
|
|
|
183
183
|
FlattenedFieldInfo field(0, ty);
|
|
184
184
|
stinfo->getFlattenedFieldInfoVec().push_back(field);
|
|
@@ -322,7 +322,14 @@ const MemObj* SymbolTableInfo::createDummyObj(SymID symId, const Type* type)
|
|
|
322
322
|
return memObj;
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
|
|
325
|
+
/// Flatterned full offset information of a struct including its array fields
|
|
326
|
+
const std::vector<u32_t>& SymbolTableInfo::getFlattenedOffsetVec(const StructType *T)
|
|
327
|
+
{
|
|
328
|
+
return getStructInfoIter(T)->second->getFlattenedOffsetVec();
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/// Flatterned field index information of a struct ignoring any array field
|
|
332
|
+
const std::vector<u32_t>& SymbolTableInfo::getFlattenedFieldIdxVec(const StructType *T)
|
|
326
333
|
{
|
|
327
334
|
return getStructInfoIter(T)->second->getFlattenedFieldIdxVec();
|
|
328
335
|
}
|
package/lib/SABER/SrcSnkDDA.cpp
CHANGED
|
@@ -46,9 +46,9 @@ void SrcSnkDDA::initialize(SVFModule* module)
|
|
|
46
46
|
|
|
47
47
|
AndersenWaveDiff* ander = AndersenWaveDiff::createAndersenWaveDiff(pag);
|
|
48
48
|
if(Options::SABERFULLSVFG)
|
|
49
|
-
svfg = memSSA.
|
|
49
|
+
svfg = memSSA.buildFullSVFG(ander);
|
|
50
50
|
else
|
|
51
|
-
svfg = memSSA.
|
|
51
|
+
svfg = memSSA.buildPTROnlySVFG(ander);
|
|
52
52
|
setGraph(memSSA.getSVFG());
|
|
53
53
|
ptaCallGraph = ander->getPTACallGraph();
|
|
54
54
|
//AndersenWaveDiff::releaseAndersenWaveDiff();
|
|
@@ -887,12 +887,14 @@ void SVFIRBuilder::visitBranchInst(BranchInst &inst){
|
|
|
887
887
|
else
|
|
888
888
|
cond = pag->getNullPtr();
|
|
889
889
|
|
|
890
|
-
|
|
890
|
+
assert(inst.getNumSuccessors() <= 2 && "if/else has more than two branches?");
|
|
891
|
+
|
|
892
|
+
BranchStmt::SuccAndCondPairVec successors;
|
|
891
893
|
for (u32_t i = 0; i < inst.getNumSuccessors(); ++i)
|
|
892
894
|
{
|
|
893
895
|
const Instruction* succInst = &inst.getSuccessor(i)->front();
|
|
894
896
|
const ICFGNode* icfgNode = pag->getICFG()->getBlockICFGNode(succInst);
|
|
895
|
-
successors.push_back(icfgNode);
|
|
897
|
+
successors.push_back(std::make_pair(icfgNode, 1-i));
|
|
896
898
|
}
|
|
897
899
|
const BranchStmt *brStmt = addBranchStmt(brinst, cond,successors);
|
|
898
900
|
}
|
|
@@ -901,12 +903,15 @@ void SVFIRBuilder::visitSwitchInst(SwitchInst &inst){
|
|
|
901
903
|
NodeID brinst = getValueNode(&inst);
|
|
902
904
|
NodeID cond = getValueNode(inst.getCondition());
|
|
903
905
|
|
|
904
|
-
|
|
906
|
+
BranchStmt::SuccAndCondPairVec successors;
|
|
905
907
|
for (u32_t i = 0; i < inst.getNumSuccessors(); ++i)
|
|
906
908
|
{
|
|
907
909
|
const Instruction* succInst = &inst.getSuccessor(i)->front();
|
|
910
|
+
const ConstantInt* condVal = inst.findCaseDest(inst.getSuccessor(i));
|
|
911
|
+
/// default case is set to -1;
|
|
912
|
+
s64_t val = condVal ? condVal->getSExtValue() : -1;
|
|
908
913
|
const ICFGNode* icfgNode = pag->getICFG()->getBlockICFGNode(succInst);
|
|
909
|
-
successors.push_back(icfgNode);
|
|
914
|
+
successors.push_back(std::make_pair(icfgNode,val));
|
|
910
915
|
}
|
|
911
916
|
const BranchStmt *brStmt = addBranchStmt(brinst, cond,successors);
|
|
912
917
|
}
|
package/lib/Util/Options.cpp
CHANGED
|
@@ -73,11 +73,9 @@ void FlowSensitive::initialize()
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// When evaluating ctir aliases, we want the whole SVFG.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
svfg = memSSA.buildPTROnlySVFGWithoutOPT(ander);
|
|
80
|
-
|
|
76
|
+
|
|
77
|
+
svfg = Options::CTirAliasEval ? memSSA.buildFullSVFG(ander) : memSSA.buildPTROnlySVFG(ander);
|
|
78
|
+
|
|
81
79
|
setGraph(svfg);
|
|
82
80
|
//AndersenWaveDiff::releaseAndersenWaveDiff();
|
|
83
81
|
}
|
package/lib/WPA/WPAPass.cpp
CHANGED
|
@@ -150,15 +150,7 @@ void WPAPass::runPointerAnalysis(SVFModule* svfModule, u32_t kind)
|
|
|
150
150
|
{
|
|
151
151
|
SVFGBuilder memSSA(true);
|
|
152
152
|
assert(SVFUtil::isa<AndersenBase>(_pta) && "supports only andersen/steensgaard for pre-computed SVFG");
|
|
153
|
-
SVFG *svfg;
|
|
154
|
-
if (Options::OPTSVFG)
|
|
155
|
-
{
|
|
156
|
-
svfg = memSSA.buildFullSVFG((BVDataPTAImpl*)_pta);
|
|
157
|
-
} else
|
|
158
|
-
{
|
|
159
|
-
svfg = memSSA.buildFullSVFGWithoutOPT((BVDataPTAImpl*)_pta);
|
|
160
|
-
}
|
|
161
|
-
|
|
153
|
+
SVFG *svfg = memSSA.buildFullSVFG((BVDataPTAImpl*)_pta);
|
|
162
154
|
/// support mod-ref queries only for -ander
|
|
163
155
|
if (Options::PASelected.isSet(PointerAnalysis::AndersenWaveDiff_WPA))
|
|
164
156
|
_svfg = svfg;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.356",
|
|
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": {
|
package/tools/Example/svf-ex.cpp
CHANGED
|
@@ -184,7 +184,7 @@ int main(int argc, char ** argv)
|
|
|
184
184
|
|
|
185
185
|
/// Sparse value-flow graph (SVFG)
|
|
186
186
|
SVFGBuilder svfBuilder(true);
|
|
187
|
-
SVFG* svfg = svfBuilder.
|
|
187
|
+
SVFG* svfg = svfBuilder.buildFullSVFG(ander);
|
|
188
188
|
|
|
189
189
|
/// Collect uses of an LLVM Value
|
|
190
190
|
/// traverseOnVFG(svfg, value);
|