svf-tools 1.0.327 → 1.0.331
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/AndersenHCD_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/AndersenSCD_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/AndersenSFR_8cpp_source.html +7 -7
- package/SVF-doxygen/html/html/AndersenSFR_8h_source.html +4 -4
- package/SVF-doxygen/html/html/AndersenWaveDiff_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/Andersen_8cpp_source.html +38 -38
- package/SVF-doxygen/html/html/Andersen_8h_source.html +6 -6
- package/SVF-doxygen/html/html/CSC_8cpp_source.html +2 -3
- package/SVF-doxygen/html/html/ConsGEdge_8h_source.html +3 -3
- package/SVF-doxygen/html/html/ConsGNode_8h_source.html +5 -5
- package/SVF-doxygen/html/html/ConsG_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/ConsG_8h_source.html +4 -4
- package/SVF-doxygen/html/html/ContextDDA_8cpp_source.html +6 -6
- 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 +6 -6
- package/SVF-doxygen/html/html/FSMPTA_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/FlowDDA_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/FlowDDA_8h_source.html +2 -2
- package/SVF-doxygen/html/html/FlowSensitiveStat_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/FlowSensitiveTBHC_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/FlowSensitive_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/IRAnnotator_8h_source.html +6 -7
- package/SVF-doxygen/html/html/IRGraph_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/IRGraph_8h_source.html +1 -1
- package/SVF-doxygen/html/html/LocationSet_8cpp.html +1 -0
- package/SVF-doxygen/html/html/LocationSet_8cpp_source.html +12 -15
- package/SVF-doxygen/html/html/LocationSet_8h.html +1 -1
- package/SVF-doxygen/html/html/LocationSet_8h_source.html +26 -40
- package/SVF-doxygen/html/html/MemRegion_8cpp_source.html +5 -5
- package/SVF-doxygen/html/html/OfflineConsG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PAGBuilderFromFile_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/PTAStat_8cpp_source.html +15 -15
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8cpp_source.html +10 -10
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8h_source.html +2 -2
- package/SVF-doxygen/html/html/PointerAnalysis_8cpp_source.html +28 -29
- package/SVF-doxygen/html/html/PointerAnalysis_8h_source.html +29 -29
- package/SVF-doxygen/html/html/SVFIRBuilder_8cpp_source.html +11 -3
- package/SVF-doxygen/html/html/SVFIRBuilder_8h_source.html +71 -70
- package/SVF-doxygen/html/html/SVFIR_8cpp_source.html +12 -12
- package/SVF-doxygen/html/html/SVFIR_8h_source.html +13 -13
- package/SVF-doxygen/html/html/SVFStatements_8h_source.html +3 -3
- package/SVF-doxygen/html/html/SVFVariables_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/SVFVariables_8h.html +1 -1
- package/SVF-doxygen/html/html/SVFVariables_8h_source.html +69 -69
- package/SVF-doxygen/html/html/SaberSVFGBuilder_8cpp_source.html +4 -4
- package/SVF-doxygen/html/html/Steensgaard_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SymbolTableBuilder_8cpp_source.html +21 -21
- package/SVF-doxygen/html/html/SymbolTableBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SymbolTableInfo_8cpp_source.html +52 -63
- package/SVF-doxygen/html/html/SymbolTableInfo_8h_source.html +72 -79
- package/SVF-doxygen/html/html/ThreadCallGraph_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/TypeAnalysis_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/TypeBasedHeapCloning_8cpp_source.html +13 -13
- package/SVF-doxygen/html/html/TypeBasedHeapCloning_8h_source.html +2 -2
- package/SVF-doxygen/html/html/VersionedFlowSensitiveStat_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/annotated.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1Andersen-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1Andersen.html +79 -79
- package/SVF-doxygen/html/html/classSVF_1_1AndersenBase-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1AndersenBase.html +23 -24
- package/SVF-doxygen/html/html/classSVF_1_1AndersenHCD-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1AndersenHCD.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1AndersenHLCD-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1AndersenHLCD.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1AndersenLCD-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1AndersenLCD.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSCD-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSCD.html +13 -13
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSFR-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSFR.html +13 -13
- package/SVF-doxygen/html/html/classSVF_1_1AndersenWaveDiff-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1AndersenWaveDiff.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +17 -17
- package/SVF-doxygen/html/html/classSVF_1_1CSC.html +2 -3
- package/SVF-doxygen/html/html/classSVF_1_1CloneDummyObjVar.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1CloneFIObjVar.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1CloneGepObjVar-members.html +56 -55
- package/SVF-doxygen/html/html/classSVF_1_1CloneGepObjVar.html +44 -41
- package/SVF-doxygen/html/html/classSVF_1_1CloneGepObjVar.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1CondPTAImpl-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CondPTAImpl.html +7 -7
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintGraph.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintNode-members.html +26 -26
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintNode.html +43 -43
- package/SVF-doxygen/html/html/classSVF_1_1ContextDDA-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1ContextDDA.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1DDAPass.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1DDAStat.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1DDAVFSolver.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1DummyObjVar.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1DummyValVar.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1FIObjVar.html +13 -13
- package/SVF-doxygen/html/html/classSVF_1_1FSMPTA-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1FSMPTA.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1FlattenedFieldInfo-members.html +85 -0
- package/SVF-doxygen/html/html/classSVF_1_1FlattenedFieldInfo.html +254 -0
- package/SVF-doxygen/html/html/classSVF_1_1FlowDDA-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1FlowDDA.html +7 -7
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitive-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitive.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveStat.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveTBHC-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveTBHC.html +10 -10
- package/SVF-doxygen/html/html/classSVF_1_1FunptrDDAClient.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1GenericNode.html +22 -23
- package/SVF-doxygen/html/html/classSVF_1_1GenericNode.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1GepObjPN.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1GepObjVar-members.html +173 -0
- package/SVF-doxygen/html/html/classSVF_1_1GepObjVar.html +813 -0
- package/SVF-doxygen/html/html/classSVF_1_1GepObjVar.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1GepValVar.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1IRAnnotator-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1IRAnnotator.html +8 -8
- package/SVF-doxygen/html/html/classSVF_1_1LocationSet-members.html +17 -21
- package/SVF-doxygen/html/html/classSVF_1_1LocationSet.html +150 -326
- package/SVF-doxygen/html/html/classSVF_1_1MRGenerator.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1MemObj.html +84 -84
- package/SVF-doxygen/html/html/classSVF_1_1NormalGepCGEdge.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1NormalGepStmt.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1ObjTypeInfo.html +96 -96
- package/SVF-doxygen/html/html/classSVF_1_1ObjVar.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1ObjVar.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1PAGBuilderFromFile.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1PTAStat.html +15 -15
- package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +75 -73
- package/SVF-doxygen/html/html/classSVF_1_1RetPN.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1SVFIR-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SVFIR.html +31 -31
- package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder-members.html +57 -56
- package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +301 -229
- package/SVF-doxygen/html/html/classSVF_1_1SVFVar.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1SVFVar.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1SaberSVFGBuilder.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1StInfo-members.html +11 -14
- package/SVF-doxygen/html/html/classSVF_1_1StInfo.html +70 -168
- package/SVF-doxygen/html/html/classSVF_1_1Steensgaard-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1Steensgaard.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableBuilder.html +30 -30
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo-members.html +20 -24
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo.html +110 -291
- package/SVF-doxygen/html/html/classSVF_1_1ThreadCallGraph.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1TypeAnalysis-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1TypeAnalysis.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1TypeBasedHeapCloning.html +18 -18
- package/SVF-doxygen/html/html/classSVF_1_1VarArgPN.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitive-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitive.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitiveStat.html +3 -3
- package/SVF-doxygen/html/html/classes.html +6 -6
- package/SVF-doxygen/html/html/functions_a.html +13 -10
- package/SVF-doxygen/html/html/functions_b.html +1 -5
- package/SVF-doxygen/html/html/functions_c.html +19 -20
- package/SVF-doxygen/html/html/functions_d.html +1 -1
- package/SVF-doxygen/html/html/functions_e.html +0 -16
- package/SVF-doxygen/html/html/functions_f.html +21 -19
- package/SVF-doxygen/html/html/functions_func.html +15 -12
- package/SVF-doxygen/html/html/functions_func_c.html +16 -17
- package/SVF-doxygen/html/html/functions_func_d.html +1 -1
- package/SVF-doxygen/html/html/functions_func_e.html +2 -8
- package/SVF-doxygen/html/html/functions_func_f.html +4 -4
- package/SVF-doxygen/html/html/functions_func_g.html +36 -58
- package/SVF-doxygen/html/html/functions_func_i.html +11 -14
- package/SVF-doxygen/html/html/functions_func_r.html +3 -3
- package/SVF-doxygen/html/html/functions_func_s.html +6 -9
- package/SVF-doxygen/html/html/functions_func_t.html +1 -1
- package/SVF-doxygen/html/html/functions_func_w.html +1 -1
- package/SVF-doxygen/html/html/functions_g.html +41 -63
- package/SVF-doxygen/html/html/functions_i.html +6 -9
- package/SVF-doxygen/html/html/functions_l.html +4 -4
- package/SVF-doxygen/html/html/functions_n.html +4 -7
- package/SVF-doxygen/html/html/functions_o.html +25 -20
- package/SVF-doxygen/html/html/functions_p.html +12 -16
- package/SVF-doxygen/html/html/functions_r.html +4 -4
- package/SVF-doxygen/html/html/functions_s.html +15 -18
- package/SVF-doxygen/html/html/functions_t.html +1 -1
- package/SVF-doxygen/html/html/functions_type_e.html +0 -4
- package/SVF-doxygen/html/html/functions_type_o.html +3 -0
- package/SVF-doxygen/html/html/functions_v.html +3 -3
- package/SVF-doxygen/html/html/functions_vars_b.html +1 -5
- package/SVF-doxygen/html/html/functions_vars_c.html +1 -1
- package/SVF-doxygen/html/html/functions_vars_e.html +0 -6
- package/SVF-doxygen/html/html/functions_vars_f.html +9 -7
- package/SVF-doxygen/html/html/functions_vars_l.html +1 -1
- package/SVF-doxygen/html/html/functions_vars_n.html +0 -3
- package/SVF-doxygen/html/html/functions_vars_o.html +2 -2
- package/SVF-doxygen/html/html/functions_w.html +1 -1
- package/SVF-doxygen/html/html/hierarchy.html +64 -64
- package/SVF-doxygen/html/html/namespaceSVF.html +3 -3
- package/SVF-doxygen/html/html/search/all_1.js +3 -2
- package/SVF-doxygen/html/html/search/all_10.js +6 -6
- package/SVF-doxygen/html/html/search/all_12.js +3 -3
- package/SVF-doxygen/html/html/search/all_13.js +5 -6
- package/SVF-doxygen/html/html/search/all_14.js +6 -6
- package/SVF-doxygen/html/html/search/all_16.js +2 -2
- package/SVF-doxygen/html/html/search/all_17.js +1 -1
- package/SVF-doxygen/html/html/search/all_2.js +2 -3
- package/SVF-doxygen/html/html/search/all_3.js +5 -5
- package/SVF-doxygen/html/html/search/all_4.js +1 -1
- package/SVF-doxygen/html/html/search/all_5.js +0 -5
- package/SVF-doxygen/html/html/search/all_6.js +6 -5
- package/SVF-doxygen/html/html/search/all_7.js +15 -23
- package/SVF-doxygen/html/html/search/all_9.js +2 -3
- package/SVF-doxygen/html/html/search/all_c.js +4 -4
- package/SVF-doxygen/html/html/search/all_e.js +1 -2
- package/SVF-doxygen/html/html/search/all_f.js +5 -4
- package/SVF-doxygen/html/html/search/classes_5.js +1 -1
- package/SVF-doxygen/html/html/search/classes_6.js +1 -1
- package/SVF-doxygen/html/html/search/functions_0.js +3 -2
- package/SVF-doxygen/html/html/search/functions_10.js +2 -3
- package/SVF-doxygen/html/html/search/functions_11.js +1 -1
- package/SVF-doxygen/html/html/search/functions_14.js +1 -1
- package/SVF-doxygen/html/html/search/functions_2.js +3 -3
- package/SVF-doxygen/html/html/search/functions_3.js +1 -1
- package/SVF-doxygen/html/html/search/functions_4.js +0 -2
- package/SVF-doxygen/html/html/search/functions_5.js +1 -1
- package/SVF-doxygen/html/html/search/functions_6.js +15 -23
- package/SVF-doxygen/html/html/search/functions_8.js +1 -2
- package/SVF-doxygen/html/html/search/functions_a.js +1 -1
- package/SVF-doxygen/html/html/search/functions_e.js +1 -1
- package/SVF-doxygen/html/html/search/functions_f.js +1 -1
- package/SVF-doxygen/html/html/search/typedefs_4.js +0 -1
- package/SVF-doxygen/html/html/search/typedefs_e.js +1 -0
- package/SVF-doxygen/html/html/search/variables_14.js +3 -3
- package/SVF-doxygen/html/html/search/variables_2.js +2 -3
- package/SVF-doxygen/html/html/search/variables_3.js +1 -1
- package/SVF-doxygen/html/html/search/variables_5.js +0 -2
- package/SVF-doxygen/html/html/search/variables_6.js +5 -4
- package/SVF-doxygen/html/html/search/variables_c.js +1 -1
- package/SVF-doxygen/html/html/search/variables_e.js +0 -1
- package/SVF-doxygen/html/html/search/variables_f.js +1 -1
- package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01ConstraintGraph_01_5_01_4.html +1 -1
- package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01IRGraph_01_5_01_4.html +1 -1
- package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01OfflineConsG_01_5_01_4.html +1 -1
- package/SVF-doxygen/html/html/structstd_1_1hash_3_01SVF_1_1LocationSet_01_4.html +5 -5
- package/SVF-doxygen/html/html/svf-ex_8cpp.html +1 -1
- package/SVF-doxygen/html/html/svf-ex_8cpp_source.html +1 -1
- package/include/Graphs/ConsG.h +1 -1
- package/include/Graphs/ConsGEdge.h +1 -1
- package/include/MemoryModel/LocationSet.h +39 -126
- package/include/MemoryModel/PointerAnalysis.h +1 -1
- package/include/MemoryModel/SVFIR.h +2 -2
- package/include/MemoryModel/SVFStatements.h +1 -1
- package/include/MemoryModel/SVFVariables.h +17 -11
- package/include/MemoryModel/SymbolTableInfo.h +27 -31
- package/include/SVF-FE/SVFIRBuilder.h +6 -1
- package/include/Util/IRAnnotator.h +3 -3
- package/lib/DDA/ContextDDA.cpp +1 -1
- package/lib/Graphs/ConsG.cpp +1 -1
- package/lib/Graphs/IRGraph.cpp +1 -1
- package/lib/Graphs/OfflineConsG.cpp +1 -1
- package/lib/MemoryModel/LocationSet.cpp +53 -95
- package/lib/MemoryModel/PointerAnalysis.cpp +4 -2
- package/lib/MemoryModel/PointerAnalysisImpl.cpp +4 -4
- package/lib/MemoryModel/SVFIR.cpp +4 -4
- package/lib/MemoryModel/SVFVariables.cpp +2 -2
- package/lib/MemoryModel/SymbolTableInfo.cpp +44 -212
- package/lib/SABER/SaberSVFGBuilder.cpp +1 -1
- package/lib/SVF-FE/SVFIRBuilder.cpp +135 -7
- package/lib/SVF-FE/SymbolTableBuilder.cpp +4 -4
- package/lib/Util/TypeBasedHeapCloning.cpp +10 -10
- package/lib/WPA/Andersen.cpp +1 -5
- package/lib/WPA/AndersenSFR.cpp +2 -2
- package/lib/WPA/CSC.cpp +1 -1
- package/lib/WPA/FlowSensitiveTBHC.cpp +6 -6
- package/package.json +1 -1
- package/tools/Example/svf-ex.cpp +1 -2
|
@@ -101,22 +101,18 @@ void SymbolTableInfo::collectArrayInfo(const ArrayType* ty)
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/// Array itself only has one field which is the inner most element
|
|
104
|
-
stinfo->addFldWithType(0,
|
|
104
|
+
stinfo->addFldWithType(0,elemTy);
|
|
105
105
|
|
|
106
106
|
/// Array's flatten field infor is the same as its element's
|
|
107
107
|
/// flatten infor.
|
|
108
108
|
StInfo* elemStInfo = getStructInfo(elemTy);
|
|
109
|
-
u32_t nfE = elemStInfo->
|
|
109
|
+
u32_t nfE = elemStInfo->getFlattenedFieldInfoVec().size();
|
|
110
110
|
for (u32_t j = 0; j < nfE; j++)
|
|
111
111
|
{
|
|
112
|
-
u32_t idx = elemStInfo->
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
/// append the additional number
|
|
117
|
-
pair.push_back(std::make_pair(out_num, out_stride));
|
|
118
|
-
FieldInfo field(idx, off, fieldTy, pair);
|
|
119
|
-
stinfo->getFlattenFieldInfoVec().push_back(field);
|
|
112
|
+
u32_t idx = elemStInfo->getFlattenedFieldInfoVec()[j].getFlattenFldIdx();
|
|
113
|
+
const Type* fieldTy = elemStInfo->getFlattenedFieldInfoVec()[j].getFlattenElemTy();
|
|
114
|
+
FlattenedFieldInfo field(idx, fieldTy);
|
|
115
|
+
stinfo->getFlattenedFieldInfoVec().push_back(field);
|
|
120
116
|
}
|
|
121
117
|
}
|
|
122
118
|
|
|
@@ -139,36 +135,27 @@ void SymbolTableInfo::collectStructInfo(const StructType *sty)
|
|
|
139
135
|
sty->element_end(); it != ie; ++it, ++field_idx)
|
|
140
136
|
{
|
|
141
137
|
const Type *et = *it;
|
|
142
|
-
// This offset is computed after alignment with the current struct
|
|
143
|
-
u64_t eOffsetInBytes = getTypeSizeInBytes(sty, field_idx);
|
|
144
|
-
//The offset is where this element will be placed in the exp. struct.
|
|
145
|
-
/// FIXME: As the layout size is uint_64, here we assume
|
|
146
138
|
/// offset with uint_32 (Size_t) is large enough and will not cause overflow
|
|
147
|
-
stinfo->addFldWithType(nf,
|
|
139
|
+
stinfo->addFldWithType(nf, et);
|
|
148
140
|
|
|
149
141
|
if (SVFUtil::isa<StructType>(et) || SVFUtil::isa<ArrayType>(et))
|
|
150
142
|
{
|
|
151
143
|
StInfo * subStinfo = getStructInfo(et);
|
|
152
|
-
u32_t nfE = subStinfo->
|
|
144
|
+
u32_t nfE = subStinfo->getFlattenedFieldInfoVec().size();
|
|
153
145
|
//Copy ST's info, whose element 0 is the size of ST itself.
|
|
154
146
|
for (u32_t j = 0; j < nfE; j++)
|
|
155
147
|
{
|
|
156
|
-
u32_t fldIdx = nf + subStinfo->
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
pair.push_back(std::make_pair(1, 0));
|
|
161
|
-
FieldInfo field(fldIdx, off,elemTy,pair);
|
|
162
|
-
stinfo->getFlattenFieldInfoVec().push_back(field);
|
|
148
|
+
u32_t fldIdx = nf + subStinfo->getFlattenedFieldInfoVec()[j].getFlattenFldIdx();
|
|
149
|
+
const Type* elemTy = subStinfo->getFlattenedFieldInfoVec()[j].getFlattenElemTy();
|
|
150
|
+
FlattenedFieldInfo field(fldIdx, elemTy);
|
|
151
|
+
stinfo->getFlattenedFieldInfoVec().push_back(field);
|
|
163
152
|
}
|
|
164
153
|
nf += nfE;
|
|
165
154
|
}
|
|
166
155
|
else //simple type
|
|
167
156
|
{
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
FieldInfo field(nf, eOffsetInBytes, et,pair);
|
|
171
|
-
stinfo->getFlattenFieldInfoVec().push_back(field);
|
|
157
|
+
FlattenedFieldInfo field(nf, et);
|
|
158
|
+
stinfo->getFlattenedFieldInfoVec().push_back(field);
|
|
172
159
|
++nf;
|
|
173
160
|
}
|
|
174
161
|
}
|
|
@@ -191,162 +178,13 @@ void SymbolTableInfo::collectSimpleTypeInfo(const Type* ty)
|
|
|
191
178
|
typeToFieldInfo[ty] = stinfo;
|
|
192
179
|
|
|
193
180
|
/// Only one field
|
|
194
|
-
stinfo->addFldWithType(0,
|
|
181
|
+
stinfo->addFldWithType(0, ty);
|
|
195
182
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
FieldInfo field(0, 0, ty, pair);
|
|
199
|
-
stinfo->getFlattenFieldInfoVec().push_back(field);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/*!
|
|
203
|
-
* Compute gep offset
|
|
204
|
-
*/
|
|
205
|
-
bool SymbolTableInfo::computeGepOffset(const User *V, LocationSet& ls)
|
|
206
|
-
{
|
|
207
|
-
assert(V);
|
|
208
|
-
|
|
209
|
-
const llvm::GEPOperator *gepOp = SVFUtil::dyn_cast<const llvm::GEPOperator>(V);
|
|
210
|
-
DataLayout * dataLayout = getDataLayout(LLVMModuleSet::getLLVMModuleSet()->getMainLLVMModule());
|
|
211
|
-
llvm::APInt byteOffset(dataLayout->getIndexSizeInBits(gepOp->getPointerAddressSpace()),0,true);
|
|
212
|
-
if(gepOp && dataLayout && gepOp->accumulateConstantOffset(*dataLayout,byteOffset))
|
|
213
|
-
{
|
|
214
|
-
Size_t bo = byteOffset.getSExtValue();
|
|
215
|
-
ls.setByteOffset(bo + ls.getByteOffset());
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
for (bridge_gep_iterator gi = bridge_gep_begin(*V), ge = bridge_gep_end(*V);
|
|
219
|
-
gi != ge; ++gi)
|
|
220
|
-
{
|
|
221
|
-
|
|
222
|
-
// Handling array types, skipe array handling here
|
|
223
|
-
// We treat whole array as one, then we can distinguish different field of an array of struct
|
|
224
|
-
// e.g. s[1].f1 is differet from s[0].f2
|
|
225
|
-
if(SVFUtil::isa<ArrayType>(*gi))
|
|
226
|
-
continue;
|
|
227
|
-
|
|
228
|
-
//The int-value object of the current index operand
|
|
229
|
-
// (may not be constant for arrays).
|
|
230
|
-
ConstantInt *op = SVFUtil::dyn_cast<ConstantInt>(gi.getOperand());
|
|
231
|
-
|
|
232
|
-
/// given a gep edge p = q + i,
|
|
233
|
-
if(!op)
|
|
234
|
-
{
|
|
235
|
-
return false;
|
|
236
|
-
}
|
|
237
|
-
//The actual index
|
|
238
|
-
Size_t idx = op->getSExtValue();
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
// Handling pointer types
|
|
242
|
-
// These GEP instructions are simply making address computations from the base pointer address
|
|
243
|
-
// e.g. idx = (char*) &p + 4, at this case gep only one offset index (idx)
|
|
244
|
-
// Case 1: This operation is likely accessing an array through pointer p.
|
|
245
|
-
// Case 2: It may also be used to access a field of a struct (which is not ANSI-compliant)
|
|
246
|
-
// Since this is a field-index based memory model,
|
|
247
|
-
// for case 1: we consider the whole array as one element, This can be improved by LocMemModel as it can distinguish different
|
|
248
|
-
// elements of the same array.
|
|
249
|
-
// for case 2: we treat idx the same as &p by ignoring const 4 (This handling is unsound since the program itself is not ANSI-compliant).
|
|
250
|
-
if (SVFUtil::isa<PointerType>(*gi))
|
|
251
|
-
{
|
|
252
|
-
//off += idx;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
// Handling struct here
|
|
257
|
-
if (const StructType *ST = SVFUtil::dyn_cast<StructType>(*gi) )
|
|
258
|
-
{
|
|
259
|
-
assert(op && "non-const struct index in GEP");
|
|
260
|
-
const vector<u32_t> &so = SymbolTableInfo::SymbolInfo()->getFattenFieldIdxVec(ST);
|
|
261
|
-
if ((unsigned)idx >= so.size())
|
|
262
|
-
{
|
|
263
|
-
outs() << "!! Struct index out of bounds" << idx << "\n";
|
|
264
|
-
assert(0);
|
|
265
|
-
}
|
|
266
|
-
//add the translated offset
|
|
267
|
-
ls.setFldIdx(ls.getOffset() + so[idx]);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
return true;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
/*!
|
|
275
|
-
* Replace fields with flatten fields of T if the number of its fields is larger than msz.
|
|
276
|
-
*/
|
|
277
|
-
u32_t SymbolTableInfo::getFields(std::vector<LocationSet>& fields, const Type* T, u32_t msz)
|
|
278
|
-
{
|
|
279
|
-
if (!SVFUtil::isa<PointerType>(T))
|
|
280
|
-
return 0;
|
|
281
|
-
|
|
282
|
-
T = T->getContainedType(0);
|
|
283
|
-
const std::vector<FieldInfo>& stVec = SymbolTableInfo::SymbolInfo()->getFlattenFieldInfoVec(T);
|
|
284
|
-
u32_t sz = stVec.size();
|
|
285
|
-
if (msz < sz)
|
|
286
|
-
{
|
|
287
|
-
/// Replace fields with T's flatten fields.
|
|
288
|
-
fields.clear();
|
|
289
|
-
for(std::vector<FieldInfo>::const_iterator it = stVec.begin(), eit = stVec.end(); it!=eit; ++it)
|
|
290
|
-
fields.push_back(LocationSet(*it));
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return sz;
|
|
183
|
+
FlattenedFieldInfo field(0, ty);
|
|
184
|
+
stinfo->getFlattenedFieldInfoVec().push_back(field);
|
|
294
185
|
}
|
|
295
186
|
|
|
296
187
|
|
|
297
|
-
/*!
|
|
298
|
-
* Find the base type and the max possible offset for an object pointed to by (V).
|
|
299
|
-
*/
|
|
300
|
-
const Type *SymbolTableInfo::getBaseTypeAndFlattenedFields(const Value *V, std::vector<LocationSet> &fields)
|
|
301
|
-
{
|
|
302
|
-
assert(V);
|
|
303
|
-
fields.push_back(LocationSet(0));
|
|
304
|
-
|
|
305
|
-
const Type *T = V->getType();
|
|
306
|
-
// Use the biggest struct type out of all operands.
|
|
307
|
-
if (const User *U = SVFUtil::dyn_cast<User>(V))
|
|
308
|
-
{
|
|
309
|
-
u32_t msz = 1; //the max size seen so far
|
|
310
|
-
// In case of BitCast, try the target type itself
|
|
311
|
-
if (SVFUtil::isa<BitCastInst>(V))
|
|
312
|
-
{
|
|
313
|
-
u32_t sz = getFields(fields, T, msz);
|
|
314
|
-
if (msz < sz)
|
|
315
|
-
{
|
|
316
|
-
msz = sz;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
// Try the types of all operands
|
|
320
|
-
for (User::const_op_iterator it = U->op_begin(), ie = U->op_end();
|
|
321
|
-
it != ie; ++it)
|
|
322
|
-
{
|
|
323
|
-
const Type *operandtype = it->get()->getType();
|
|
324
|
-
|
|
325
|
-
u32_t sz = getFields(fields, operandtype, msz);
|
|
326
|
-
if (msz < sz)
|
|
327
|
-
{
|
|
328
|
-
msz = sz;
|
|
329
|
-
T = operandtype;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
// If V is a CE, the actual pointer type is its operand.
|
|
334
|
-
else if (const ConstantExpr *E = SVFUtil::dyn_cast<ConstantExpr>(V))
|
|
335
|
-
{
|
|
336
|
-
T = E->getOperand(0)->getType();
|
|
337
|
-
getFields(fields, T, 0);
|
|
338
|
-
}
|
|
339
|
-
// Handle Argument case
|
|
340
|
-
else if (SVFUtil::isa<Argument>(V))
|
|
341
|
-
{
|
|
342
|
-
getFields(fields, T, 0);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
while (const PointerType *ptype = SVFUtil::dyn_cast<PointerType>(T))
|
|
346
|
-
T = ptype->getElementType();
|
|
347
|
-
return T;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
188
|
/*!
|
|
351
189
|
* Get modulus offset given the type information
|
|
352
190
|
*/
|
|
@@ -357,7 +195,7 @@ LocationSet SymbolTableInfo::getModulusOffset(const MemObj* obj, const LocationS
|
|
|
357
195
|
/// of current struct. Make the offset positive so we can still get a node within current
|
|
358
196
|
/// struct to represent this obj.
|
|
359
197
|
|
|
360
|
-
Size_t offset = ls.
|
|
198
|
+
Size_t offset = ls.accumulateConstantOffset();
|
|
361
199
|
if(offset < 0)
|
|
362
200
|
{
|
|
363
201
|
writeWrnMsg("try to create a gep node with negative offset.");
|
|
@@ -393,8 +231,14 @@ void SymbolTableInfo::destroy()
|
|
|
393
231
|
delete iter->second;
|
|
394
232
|
}
|
|
395
233
|
|
|
396
|
-
|
|
397
|
-
|
|
234
|
+
if(dl){
|
|
235
|
+
delete dl;
|
|
236
|
+
dl = nullptr;
|
|
237
|
+
}
|
|
238
|
+
if(mod){
|
|
239
|
+
delete mod;
|
|
240
|
+
mod = nullptr;
|
|
241
|
+
}
|
|
398
242
|
}
|
|
399
243
|
|
|
400
244
|
/*!
|
|
@@ -435,10 +279,10 @@ bool SymbolTableInfo::isConstantObjSym(const Value *val)
|
|
|
435
279
|
else
|
|
436
280
|
{
|
|
437
281
|
StInfo *stInfo = getStructInfo(v->getInitializer()->getType());
|
|
438
|
-
const std::vector<
|
|
439
|
-
for (std::vector<
|
|
282
|
+
const std::vector<FlattenedFieldInfo> &fields = stInfo->getFlattenedFieldInfoVec();
|
|
283
|
+
for (std::vector<FlattenedFieldInfo>::const_iterator it = fields.begin(), eit = fields.end(); it != eit; ++it)
|
|
440
284
|
{
|
|
441
|
-
const
|
|
285
|
+
const FlattenedFieldInfo &field = *it;
|
|
442
286
|
const Type *elemTy = field.getFlattenElemTy();
|
|
443
287
|
assert(!SVFUtil::isa<FunctionType>(elemTy) && "Initializer of a global is a function?");
|
|
444
288
|
if (SVFUtil::isa<PointerType>(elemTy))
|
|
@@ -478,29 +322,23 @@ const MemObj* SymbolTableInfo::createDummyObj(SymID symId, const Type* type)
|
|
|
478
322
|
return memObj;
|
|
479
323
|
}
|
|
480
324
|
|
|
481
|
-
const std::vector<u32_t>& SymbolTableInfo::
|
|
482
|
-
{
|
|
483
|
-
return getStructInfoIter(T)->second->getFieldIdxVec();
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
const std::vector<u32_t>& SymbolTableInfo::getFattenFieldOffsetVec(const Type *T)
|
|
325
|
+
const std::vector<u32_t>& SymbolTableInfo::getFlattenedFieldIdxVec(const Type *T)
|
|
487
326
|
{
|
|
488
|
-
return getStructInfoIter(T)->second->
|
|
327
|
+
return getStructInfoIter(T)->second->getFlattenedFieldIdxVec();
|
|
489
328
|
}
|
|
490
329
|
|
|
491
|
-
const std::vector<
|
|
330
|
+
const std::vector<FlattenedFieldInfo>& SymbolTableInfo::getFlattenedFieldInfoVec(const Type *T)
|
|
492
331
|
{
|
|
493
|
-
return getStructInfoIter(T)->second->
|
|
332
|
+
return getStructInfoIter(T)->second->getFlattenedFieldInfoVec();
|
|
494
333
|
}
|
|
495
334
|
|
|
496
|
-
const Type* SymbolTableInfo::
|
|
335
|
+
const Type* SymbolTableInfo::getOriginalFieldType(const Type* baseType, u32_t field_idx)
|
|
497
336
|
{
|
|
498
|
-
return getStructInfoIter(baseType)->second->
|
|
337
|
+
return getStructInfoIter(baseType)->second->getOriginalFieldType(field_idx);
|
|
499
338
|
}
|
|
500
339
|
|
|
501
|
-
const Type* SymbolTableInfo::
|
|
502
|
-
|
|
503
|
-
return getStructInfoIter(baseType)->second->getFieldTypeWithByteOffset(byteOffset);
|
|
340
|
+
const Type* SymbolTableInfo::getFlatternedFieldType(const Type* baseType, u32_t field_idx){
|
|
341
|
+
return getStructInfoIter(baseType)->second->getFlatternedFieldType(field_idx);
|
|
504
342
|
}
|
|
505
343
|
|
|
506
344
|
/*
|
|
@@ -524,21 +362,15 @@ void SymbolTableInfo::printFlattenFields(const Type* type)
|
|
|
524
362
|
outs() <<" {Type: ";
|
|
525
363
|
st->print(outs());
|
|
526
364
|
outs() << "}\n";
|
|
527
|
-
std::vector<
|
|
365
|
+
std::vector<FlattenedFieldInfo>& finfo = getStructInfo(st)->getFlattenedFieldInfoVec();
|
|
528
366
|
int field_idx = 0;
|
|
529
|
-
for(std::vector<
|
|
367
|
+
for(std::vector<FlattenedFieldInfo>::iterator it = finfo.begin(), eit = finfo.end();
|
|
530
368
|
it!=eit; ++it, field_idx++)
|
|
531
369
|
{
|
|
532
|
-
outs() << " \tField_idx = " << (*it).getFlattenFldIdx()
|
|
370
|
+
outs() << " \tField_idx = " << (*it).getFlattenFldIdx();
|
|
533
371
|
outs() << ", field type: ";
|
|
534
372
|
(*it).getFlattenElemTy()->print(outs());
|
|
535
373
|
outs() << ", field size: " << getTypeSizeInBytes((*it).getFlattenElemTy());
|
|
536
|
-
outs() << ", field stride pair: ";
|
|
537
|
-
for(FieldInfo::ElemNumStridePairVec::const_iterator pit = (*it).elemStridePairBegin(),
|
|
538
|
-
peit = (*it).elemStridePairEnd(); pit!=peit; ++pit)
|
|
539
|
-
{
|
|
540
|
-
outs() << "[ " << pit->first << ", " << pit->second << " ] ";
|
|
541
|
-
}
|
|
542
374
|
outs() << "\n";
|
|
543
375
|
}
|
|
544
376
|
outs() << "\n";
|
|
@@ -717,12 +549,12 @@ bool ObjTypeInfo::isNonPtrFieldObj(const LocationSet& ls)
|
|
|
717
549
|
if (SVFUtil::isa<StructType>(ety) || SVFUtil::isa<ArrayType>(ety))
|
|
718
550
|
{
|
|
719
551
|
bool hasIntersection = false;
|
|
720
|
-
const vector<
|
|
721
|
-
vector<
|
|
722
|
-
vector<
|
|
552
|
+
const vector<FlattenedFieldInfo> &infovec = SymbolTableInfo::SymbolInfo()->getFlattenedFieldInfoVec(ety);
|
|
553
|
+
vector<FlattenedFieldInfo>::const_iterator it = infovec.begin();
|
|
554
|
+
vector<FlattenedFieldInfo>::const_iterator eit = infovec.end();
|
|
723
555
|
for (; it != eit; ++it)
|
|
724
556
|
{
|
|
725
|
-
const
|
|
557
|
+
const FlattenedFieldInfo& fieldLS = *it;
|
|
726
558
|
if (ls.intersects(LocationSet(fieldLS)))
|
|
727
559
|
{
|
|
728
560
|
hasIntersection = true;
|
|
@@ -73,7 +73,7 @@ void SaberSVFGBuilder::collectGlobals(BVDataPTAImpl* pta)
|
|
|
73
73
|
if(SVFUtil::isa<DummyValVar>(pagNode) || SVFUtil::isa<DummyObjVar>(pagNode))
|
|
74
74
|
continue;
|
|
75
75
|
|
|
76
|
-
if(
|
|
76
|
+
if(GepObjVar* gepobj = SVFUtil::dyn_cast<GepObjVar>(pagNode)) {
|
|
77
77
|
if(SVFUtil::isa<DummyObjVar>(pag->getGNode(gepobj->getBaseNode())))
|
|
78
78
|
continue;
|
|
79
79
|
}
|
|
@@ -204,7 +204,69 @@ void SVFIRBuilder::initialiseNodes()
|
|
|
204
204
|
*/
|
|
205
205
|
bool SVFIRBuilder::computeGepOffset(const User *V, LocationSet& ls)
|
|
206
206
|
{
|
|
207
|
-
|
|
207
|
+
assert(V);
|
|
208
|
+
|
|
209
|
+
const llvm::GEPOperator *gepOp = SVFUtil::dyn_cast<const llvm::GEPOperator>(V);
|
|
210
|
+
DataLayout * dataLayout = SymbolTableInfo::getDataLayout(LLVMModuleSet::getLLVMModuleSet()->getMainLLVMModule());
|
|
211
|
+
llvm::APInt byteOffset(dataLayout->getIndexSizeInBits(gepOp->getPointerAddressSpace()),0,true);
|
|
212
|
+
if(gepOp && dataLayout && gepOp->accumulateConstantOffset(*dataLayout,byteOffset))
|
|
213
|
+
{
|
|
214
|
+
Size_t bo = byteOffset.getSExtValue();
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
for (bridge_gep_iterator gi = bridge_gep_begin(*V), ge = bridge_gep_end(*V);
|
|
218
|
+
gi != ge; ++gi)
|
|
219
|
+
{
|
|
220
|
+
ls.addOffsetValue(gi.getOperand());
|
|
221
|
+
// Handling array types, skipe array handling here
|
|
222
|
+
// We treat whole array as one, then we can distinguish different field of an array of struct
|
|
223
|
+
// e.g. s[1].f1 is differet from s[0].f2
|
|
224
|
+
if(SVFUtil::isa<ArrayType>(*gi))
|
|
225
|
+
continue;
|
|
226
|
+
|
|
227
|
+
//The int-value object of the current index operand
|
|
228
|
+
// (may not be constant for arrays).
|
|
229
|
+
ConstantInt *op = SVFUtil::dyn_cast<ConstantInt>(gi.getOperand());
|
|
230
|
+
|
|
231
|
+
/// given a gep edge p = q + i,
|
|
232
|
+
if(!op)
|
|
233
|
+
{
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
//The actual index
|
|
237
|
+
Size_t idx = op->getSExtValue();
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
// Handling pointer types
|
|
241
|
+
// These GEP instructions are simply making address computations from the base pointer address
|
|
242
|
+
// e.g. idx = (char*) &p + 4, at this case gep only one offset index (idx)
|
|
243
|
+
// Case 1: This operation is likely accessing an array through pointer p.
|
|
244
|
+
// Case 2: It may also be used to access a field of a struct (which is not ANSI-compliant)
|
|
245
|
+
// Since this is a field-index based memory model,
|
|
246
|
+
// for case 1: we consider the whole array as one element, This can be improved by LocMemModel as it can distinguish different
|
|
247
|
+
// elements of the same array.
|
|
248
|
+
// for case 2: we treat idx the same as &p by ignoring const 4 (This handling is unsound since the program itself is not ANSI-compliant).
|
|
249
|
+
if (SVFUtil::isa<PointerType>(*gi))
|
|
250
|
+
{
|
|
251
|
+
//off += idx;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
// Handling struct here
|
|
256
|
+
if (const StructType *ST = SVFUtil::dyn_cast<StructType>(*gi) )
|
|
257
|
+
{
|
|
258
|
+
assert(op && "non-const struct index in GEP");
|
|
259
|
+
const vector<u32_t> &so = SymbolTableInfo::SymbolInfo()->getFlattenedFieldIdxVec(ST);
|
|
260
|
+
if ((unsigned)idx >= so.size())
|
|
261
|
+
{
|
|
262
|
+
outs() << "!! Struct index out of bounds" << idx << "\n";
|
|
263
|
+
assert(0);
|
|
264
|
+
}
|
|
265
|
+
//add the translated offset
|
|
266
|
+
ls.setFldIdx(ls.accumulateConstantOffset() + so[idx]);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return true;
|
|
208
270
|
}
|
|
209
271
|
|
|
210
272
|
/*!
|
|
@@ -420,7 +482,7 @@ void SVFIRBuilder::InitialGlobal(const GlobalVariable *gvar, Constant *C,
|
|
|
420
482
|
{
|
|
421
483
|
const StructType *sty = SVFUtil::cast<StructType>(C->getType());
|
|
422
484
|
const std::vector<u32_t>& offsetvect =
|
|
423
|
-
SymbolTableInfo::SymbolInfo()->
|
|
485
|
+
SymbolTableInfo::SymbolInfo()->getFlattenedFieldIdxVec(sty);
|
|
424
486
|
for (u32_t i = 0, e = C->getNumOperands(); i != e; i++)
|
|
425
487
|
{
|
|
426
488
|
u32_t off = offsetvect[i];
|
|
@@ -895,9 +957,54 @@ void SVFIRBuilder::handleDirectCall(CallSite cs, const SVFFunction *F)
|
|
|
895
957
|
/*!
|
|
896
958
|
* Find the base type and the max possible offset of an object pointed to by (V).
|
|
897
959
|
*/
|
|
898
|
-
const Type *SVFIRBuilder::getBaseTypeAndFlattenedFields(Value *V, std::vector<LocationSet> &fields)
|
|
960
|
+
const Type *SVFIRBuilder::getBaseTypeAndFlattenedFields(const Value *V, std::vector<LocationSet> &fields)
|
|
899
961
|
{
|
|
900
|
-
|
|
962
|
+
assert(V);
|
|
963
|
+
fields.push_back(LocationSet(0));
|
|
964
|
+
|
|
965
|
+
const Type *T = V->getType();
|
|
966
|
+
// Use the biggest struct type out of all operands.
|
|
967
|
+
if (const User *U = SVFUtil::dyn_cast<User>(V))
|
|
968
|
+
{
|
|
969
|
+
u32_t msz = 1; //the max size seen so far
|
|
970
|
+
// In case of BitCast, try the target type itself
|
|
971
|
+
if (SVFUtil::isa<BitCastInst>(V))
|
|
972
|
+
{
|
|
973
|
+
u32_t sz = getFields(fields, T, msz);
|
|
974
|
+
if (msz < sz)
|
|
975
|
+
{
|
|
976
|
+
msz = sz;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
// Try the types of all operands
|
|
980
|
+
for (User::const_op_iterator it = U->op_begin(), ie = U->op_end();
|
|
981
|
+
it != ie; ++it)
|
|
982
|
+
{
|
|
983
|
+
const Type *operandtype = it->get()->getType();
|
|
984
|
+
|
|
985
|
+
u32_t sz = getFields(fields, operandtype, msz);
|
|
986
|
+
if (msz < sz)
|
|
987
|
+
{
|
|
988
|
+
msz = sz;
|
|
989
|
+
T = operandtype;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
// If V is a CE, the actual pointer type is its operand.
|
|
994
|
+
else if (const ConstantExpr *E = SVFUtil::dyn_cast<ConstantExpr>(V))
|
|
995
|
+
{
|
|
996
|
+
T = E->getOperand(0)->getType();
|
|
997
|
+
getFields(fields, T, 0);
|
|
998
|
+
}
|
|
999
|
+
// Handle Argument case
|
|
1000
|
+
else if (SVFUtil::isa<Argument>(V))
|
|
1001
|
+
{
|
|
1002
|
+
getFields(fields, T, 0);
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
while (const PointerType *ptype = SVFUtil::dyn_cast<PointerType>(T))
|
|
1006
|
+
T = ptype->getElementType();
|
|
1007
|
+
return T;
|
|
901
1008
|
}
|
|
902
1009
|
|
|
903
1010
|
/*!
|
|
@@ -1182,7 +1289,7 @@ void SVFIRBuilder::handleExtCall(CallSite cs, const SVFFunction *callee)
|
|
|
1182
1289
|
// We have vArg3 points to the entry of _Rb_tree_node_base { color; parent; left; right; }.
|
|
1183
1290
|
// Now we calculate the offset from base to vArg3
|
|
1184
1291
|
NodeID vnArg3 = pag->getValueNode(vArg3);
|
|
1185
|
-
Size_t offset = pag->getLocationSetFromBaseNode(vnArg3).
|
|
1292
|
+
Size_t offset = pag->getLocationSetFromBaseNode(vnArg3).accumulateConstantOffset();
|
|
1186
1293
|
|
|
1187
1294
|
// We get all flattened fields of base
|
|
1188
1295
|
vector<LocationSet> fields;
|
|
@@ -1206,7 +1313,7 @@ void SVFIRBuilder::handleExtCall(CallSite cs, const SVFFunction *callee)
|
|
|
1206
1313
|
|
|
1207
1314
|
Value *vArg = cs.getArgument(0);
|
|
1208
1315
|
NodeID vnArg = pag->getValueNode(vArg);
|
|
1209
|
-
Size_t offset = pag->getLocationSetFromBaseNode(vnArg).
|
|
1316
|
+
Size_t offset = pag->getLocationSetFromBaseNode(vnArg).accumulateConstantOffset();
|
|
1210
1317
|
|
|
1211
1318
|
// We get all fields
|
|
1212
1319
|
vector<LocationSet> fields;
|
|
@@ -1415,7 +1522,7 @@ NodeID SVFIRBuilder::getGepValVar(const Value* val, const LocationSet& ls, const
|
|
|
1415
1522
|
* 2. GlobalVariable
|
|
1416
1523
|
*/
|
|
1417
1524
|
assert((SVFUtil::isa<Instruction>(curVal) || SVFUtil::isa<GlobalVariable>(curVal)) && "curVal not an instruction or a globalvariable?");
|
|
1418
|
-
const std::vector<
|
|
1525
|
+
const std::vector<FlattenedFieldInfo> &fieldinfo = SymbolTableInfo::SymbolInfo()->getFlattenedFieldInfoVec(baseType);
|
|
1419
1526
|
const Type *type = fieldinfo[fieldidx].getFlattenElemTy();
|
|
1420
1527
|
|
|
1421
1528
|
// We assume every GepValNode and its GepEdge to the baseNode are unique across the whole program
|
|
@@ -1510,3 +1617,24 @@ void SVFIRBuilder::setCurrentBBAndValueForPAGEdge(PAGEdge* edge)
|
|
|
1510
1617
|
}
|
|
1511
1618
|
|
|
1512
1619
|
|
|
1620
|
+
/*!
|
|
1621
|
+
* Replace fields with flatten fields of T if the number of its fields is larger than msz.
|
|
1622
|
+
*/
|
|
1623
|
+
u32_t SVFIRBuilder::getFields(std::vector<LocationSet>& fields, const Type* T, u32_t msz)
|
|
1624
|
+
{
|
|
1625
|
+
if (!SVFUtil::isa<PointerType>(T))
|
|
1626
|
+
return 0;
|
|
1627
|
+
|
|
1628
|
+
T = T->getContainedType(0);
|
|
1629
|
+
const std::vector<FlattenedFieldInfo>& stVec = SymbolTableInfo::SymbolInfo()->getFlattenedFieldInfoVec(T);
|
|
1630
|
+
u32_t sz = stVec.size();
|
|
1631
|
+
if (msz < sz)
|
|
1632
|
+
{
|
|
1633
|
+
/// Replace fields with T's flatten fields.
|
|
1634
|
+
fields.clear();
|
|
1635
|
+
for(std::vector<FlattenedFieldInfo>::const_iterator it = stVec.begin(), eit = stVec.end(); it!=eit; ++it)
|
|
1636
|
+
fields.push_back(LocationSet(*it));
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
return sz;
|
|
1640
|
+
}
|
|
@@ -444,7 +444,7 @@ void SymbolTableBuilder::handleGlobalInitializerCE(const Constant *C,
|
|
|
444
444
|
{
|
|
445
445
|
const StructType *sty = SVFUtil::cast<StructType>(C->getType());
|
|
446
446
|
const std::vector<u32_t>& offsetvect =
|
|
447
|
-
SymbolTableInfo::SymbolInfo()->
|
|
447
|
+
SymbolTableInfo::SymbolInfo()->getFlattenedFieldIdxVec(sty);
|
|
448
448
|
for (u32_t i = 0, e = C->getNumOperands(); i != e; i++)
|
|
449
449
|
{
|
|
450
450
|
u32_t off = offsetvect[i];
|
|
@@ -515,8 +515,8 @@ void SymbolTableBuilder::analyzeGlobalStackObjType(ObjTypeInfo* typeinfo, const
|
|
|
515
515
|
}
|
|
516
516
|
if (const StructType *ST= SVFUtil::dyn_cast<StructType>(elemTy))
|
|
517
517
|
{
|
|
518
|
-
const std::vector<
|
|
519
|
-
for(std::vector<
|
|
518
|
+
const std::vector<FlattenedFieldInfo>& flattenFields = SymbolTableInfo::SymbolInfo()->getFlattenedFieldInfoVec(ST);
|
|
519
|
+
for(std::vector<FlattenedFieldInfo>::const_iterator it = flattenFields.begin(), eit = flattenFields.end();
|
|
520
520
|
it!=eit; ++it)
|
|
521
521
|
{
|
|
522
522
|
if((*it).getFlattenElemTy()->isPointerTy())
|
|
@@ -600,7 +600,7 @@ u32_t SymbolTableBuilder::getObjSize(const Value* val)
|
|
|
600
600
|
u32_t numOfFields = 1;
|
|
601
601
|
if (SVFUtil::isa<StructType>(ety) || SVFUtil::isa<ArrayType>(ety))
|
|
602
602
|
{
|
|
603
|
-
numOfFields = SymbolTableInfo::SymbolInfo()->
|
|
603
|
+
numOfFields = SymbolTableInfo::SymbolInfo()->getFlattenedFieldInfoVec(ety).size();
|
|
604
604
|
}
|
|
605
605
|
return numOfFields;
|
|
606
606
|
}
|
|
@@ -153,9 +153,9 @@ const NodeBS TypeBasedHeapCloning::getGepObjClones(NodeID base, unsigned offset)
|
|
|
153
153
|
// totalOffset is the offset from the real base (i.e. base of base),
|
|
154
154
|
// offset is the offset into base, whether it is a field itself or not.
|
|
155
155
|
unsigned totalOffset = offset;
|
|
156
|
-
if (const
|
|
156
|
+
if (const GepObjVar *baseGep = SVFUtil::dyn_cast<GepObjVar>(baseNode))
|
|
157
157
|
{
|
|
158
|
-
totalOffset += baseGep->
|
|
158
|
+
totalOffset += baseGep->getOffset();
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
const DIType *baseType = getType(base);
|
|
@@ -184,12 +184,12 @@ const NodeBS TypeBasedHeapCloning::getGepObjClones(NodeID base, unsigned offset)
|
|
|
184
184
|
{
|
|
185
185
|
PAGNode *node = ppag->getGNode(gep);
|
|
186
186
|
assert(node && "TBHC: expected gep node doesn't exist.");
|
|
187
|
-
assert((SVFUtil::isa<
|
|
187
|
+
assert((SVFUtil::isa<GepObjVar>(node) || SVFUtil::isa<FIObjVar>(node))
|
|
188
188
|
&& "TBHC: expected a GEP or FI object.");
|
|
189
189
|
|
|
190
|
-
if (
|
|
190
|
+
if (GepObjVar *gepNode = SVFUtil::dyn_cast<GepObjVar>(node))
|
|
191
191
|
{
|
|
192
|
-
if (gepNode->
|
|
192
|
+
if (gepNode->getOffset() == totalOffset)
|
|
193
193
|
{
|
|
194
194
|
geps.set(gep);
|
|
195
195
|
}
|
|
@@ -225,7 +225,7 @@ const NodeBS TypeBasedHeapCloning::getGepObjClones(NodeID base, unsigned offset)
|
|
|
225
225
|
newGep = ppag->getGepObjVar(base, newLS);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
if (
|
|
228
|
+
if (GepObjVar *gep = SVFUtil::dyn_cast<GepObjVar>(ppag->getGNode(newGep)))
|
|
229
229
|
{
|
|
230
230
|
gep->setBaseNode(base);
|
|
231
231
|
}
|
|
@@ -412,9 +412,9 @@ NodeID TypeBasedHeapCloning::cloneObject(NodeID o, const DIType *type, bool)
|
|
|
412
412
|
{
|
|
413
413
|
NodeID clone;
|
|
414
414
|
const PAGNode *obj = ppag->getGNode(o);
|
|
415
|
-
if (const
|
|
415
|
+
if (const GepObjVar *gepObj = SVFUtil::dyn_cast<GepObjVar>(obj))
|
|
416
416
|
{
|
|
417
|
-
const NodeBS &clones = getGepObjClones(gepObj->getBaseNode(), gepObj->
|
|
417
|
+
const NodeBS &clones = getGepObjClones(gepObj->getBaseNode(), gepObj->getOffset());
|
|
418
418
|
// TODO: a bit of repetition.
|
|
419
419
|
for (NodeID clone : clones)
|
|
420
420
|
{
|
|
@@ -427,7 +427,7 @@ NodeID TypeBasedHeapCloning::cloneObject(NodeID o, const DIType *type, bool)
|
|
|
427
427
|
clone = addCloneGepObjNode(gepObj->getMemObj(), gepObj->getLocationSet());
|
|
428
428
|
|
|
429
429
|
// The base needs to know about the new clone.
|
|
430
|
-
addGepToObj(clone, gepObj->getBaseNode(), gepObj->
|
|
430
|
+
addGepToObj(clone, gepObj->getBaseNode(), gepObj->getOffset());
|
|
431
431
|
|
|
432
432
|
addClone(o, clone);
|
|
433
433
|
addClone(getOriginalObj(o), clone);
|
|
@@ -539,7 +539,7 @@ const DIType *TypeBasedHeapCloning::getTypeFromCTirMetadata(const Value *v)
|
|
|
539
539
|
bool TypeBasedHeapCloning::isGep(const PAGNode *n) const
|
|
540
540
|
{
|
|
541
541
|
assert(n != nullptr && "TBHC: testing if null is a GEP object!");
|
|
542
|
-
return SVFUtil::isa<
|
|
542
|
+
return SVFUtil::isa<GepObjVar>(n);
|
|
543
543
|
}
|
|
544
544
|
|
|
545
545
|
/// Returns true if the function name matches MAYALIAS, NOALIAS, etc.
|
package/lib/WPA/Andersen.cpp
CHANGED
|
@@ -64,10 +64,6 @@ AndersenBase::~AndersenBase()
|
|
|
64
64
|
{
|
|
65
65
|
delete consCG;
|
|
66
66
|
consCG = nullptr;
|
|
67
|
-
|
|
68
|
-
auto * chg = getCHGraph();
|
|
69
|
-
delete chg;
|
|
70
|
-
chg = nullptr;
|
|
71
67
|
}
|
|
72
68
|
|
|
73
69
|
/*!
|
|
@@ -170,7 +166,7 @@ void AndersenBase::normalizePointsTo()
|
|
|
170
166
|
// for redundant gepnodes and remove those nodes from pag
|
|
171
167
|
for (NodeID n: redundantGepNodes) {
|
|
172
168
|
NodeID base = pag->getBaseObjVar(n);
|
|
173
|
-
|
|
169
|
+
GepObjVar *gepNode = SVFUtil::dyn_cast<GepObjVar>(pag->getGNode(n));
|
|
174
170
|
assert(gepNode && "Not a gep node in redundantGepNodes set");
|
|
175
171
|
const LocationSet ls = gepNode->getLocationSet();
|
|
176
172
|
GepObjVarMap.erase(std::make_pair(base, ls));
|