svf-tools 1.0.418 → 1.0.421
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/AndersenWaveDiff_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/Andersen_8cpp_source.html +14 -14
- package/SVF-doxygen/html/html/CHGBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/Conditions_8cpp.html +0 -1
- package/SVF-doxygen/html/html/Conditions_8cpp_source.html +58 -49
- package/SVF-doxygen/html/html/Conditions_8h.html +6 -2
- package/SVF-doxygen/html/html/Conditions_8h_source.html +68 -60
- package/SVF-doxygen/html/html/ConsG_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/ContextDDA_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/DCHG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/DDAPass_8cpp_source.html +9 -9
- package/SVF-doxygen/html/html/FSMPTA_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/FlowSensitiveTBHC_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/FlowSensitive_8cpp_source.html +7 -7
- package/SVF-doxygen/html/html/ICFG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/IRGraph_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/LeakChecker_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/LockAnalysis_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/LockResultValidator_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MHP_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MTAAnnotator_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MTAResultValidator_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MTAStat_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MemRegion_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MemSSA_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/NodeIDAllocator_8cpp_source.html +6 -6
- package/SVF-doxygen/html/html/OfflineConsG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/Options_8cpp_source.html +114 -113
- package/SVF-doxygen/html/html/Options_8h.html +1 -0
- package/SVF-doxygen/html/html/Options_8h_source.html +117 -115
- package/SVF-doxygen/html/html/PTAStat_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/PathCondAllocator_8cpp_source.html +41 -23
- package/SVF-doxygen/html/html/PathCondAllocator_8h_source.html +74 -74
- package/SVF-doxygen/html/html/PathDPItem_8h_source.html +7 -7
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8cpp_source.html +4 -4
- package/SVF-doxygen/html/html/PointerAnalysis_8cpp_source.html +12 -12
- package/SVF-doxygen/html/html/PointsTo_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ProgSlice_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ProgSlice_8h_source.html +13 -13
- package/SVF-doxygen/html/html/SVFGBuilder_8cpp_source.html +5 -5
- package/SVF-doxygen/html/html/SVFGOPT_8cpp_source.html +4 -4
- package/SVF-doxygen/html/html/SVFG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFIR_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/SVFStatements_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFUtil_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SVFVariables_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/SrcSnkDDA_8cpp_source.html +4 -4
- package/SVF-doxygen/html/html/SymbolTableBuilder_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/SymbolTableInfo_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/TCT_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/TypeAnalysis_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/VFG_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/VersionedFlowSensitive_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/WPAPass_8cpp_source.html +4 -4
- package/SVF-doxygen/html/html/annotated.html +7 -5
- package/SVF-doxygen/html/html/classSVF_1_1AddrStmt.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1Andersen.html +23 -25
- package/SVF-doxygen/html/html/classSVF_1_1AndersenBase.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1AndersenHCD.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1AndersenLCD.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSFR.html +4 -0
- package/SVF-doxygen/html/html/classSVF_1_1AndersenWaveDiff.html +2 -6
- package/SVF-doxygen/html/html/classSVF_1_1BDDExpr-members.html +92 -0
- package/SVF-doxygen/html/html/classSVF_1_1BDDExpr.html +304 -0
- package/SVF-doxygen/html/html/classSVF_1_1BDDExpr.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1BDDManager-members.html +124 -0
- package/SVF-doxygen/html/html/classSVF_1_1BDDManager.html +1139 -0
- package/SVF-doxygen/html/html/classSVF_1_1BDDManager.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1BinaryOPStmt.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1BranchStmt.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CHGBuilder.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CallPE.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CmpStmt.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CondExpr-members.html +5 -8
- package/SVF-doxygen/html/html/classSVF_1_1CondExpr.html +22 -151
- package/SVF-doxygen/html/html/classSVF_1_1CondExpr.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1CondManager-members.html +25 -36
- package/SVF-doxygen/html/html/classSVF_1_1CondManager.html +276 -605
- package/SVF-doxygen/html/html/classSVF_1_1CondManager.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1ContextDDA.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CopyStmt.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1DCHGraph.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1DDAPass.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1FIObjVar.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1FlowDDA.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitive.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveTBHC.html +7 -7
- package/SVF-doxygen/html/html/classSVF_1_1GepObjVar.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1GepStmt.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1GepValVar.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1ICFG.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1LLVMModuleSet.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1LeakChecker.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1LoadStmt.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1LockAnalysis.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1LockResultValidator.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1MHP.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1MRGenerator.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1MTAAnnotator.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1MTAResultValidator.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1MTASVFGBuilder.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1MTAStat.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1MemSSA.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1NodeIDAllocator.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1NodeIDAllocator_1_1Clusterer.html +6 -6
- package/SVF-doxygen/html/html/classSVF_1_1ObjVar.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1OfflineConsG.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1Options-members.html +103 -102
- package/SVF-doxygen/html/html/classSVF_1_1Options.html +141 -115
- package/SVF-doxygen/html/html/classSVF_1_1PTAStat.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1PathCondAllocator-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1PathCondAllocator.html +189 -196
- package/SVF-doxygen/html/html/classSVF_1_1PhiStmt.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +13 -13
- package/SVF-doxygen/html/html/classSVF_1_1PointsTo.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1ProgSlice.html +20 -20
- package/SVF-doxygen/html/html/classSVF_1_1RetPE.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SVFGBuilder.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1SVFGOPT.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1SVFIR.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1SelectStmt.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SrcSnkDDA.html +8 -8
- package/SVF-doxygen/html/html/classSVF_1_1StoreStmt.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableBuilder.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo.html +5 -5
- package/SVF-doxygen/html/html/classSVF_1_1TCT.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1TDForkPE.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1TDJoinPE.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1TypeAnalysis.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1UnaryOPStmt.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1VFG.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1ValVar.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitive.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1WPAPass.html +11 -11
- package/SVF-doxygen/html/html/classSVF_1_1Z3Expr-members.html +95 -0
- package/SVF-doxygen/html/html/classSVF_1_1Z3Expr.html +396 -0
- package/SVF-doxygen/html/html/classSVF_1_1Z3Expr.png +0 -0
- package/SVF-doxygen/html/html/classSVF_1_1Z3Manager-members.html +122 -0
- package/SVF-doxygen/html/html/classSVF_1_1Z3Manager.html +1066 -0
- package/SVF-doxygen/html/html/classSVF_1_1Z3Manager.png +0 -0
- package/SVF-doxygen/html/html/classes.html +12 -11
- package/SVF-doxygen/html/html/functions_0x7e.html +9 -3
- package/SVF-doxygen/html/html/functions_a.html +4 -6
- package/SVF-doxygen/html/html/functions_b.html +33 -34
- package/SVF-doxygen/html/html/functions_c.html +43 -32
- package/SVF-doxygen/html/html/functions_d.html +5 -4
- package/SVF-doxygen/html/html/functions_e.html +8 -7
- package/SVF-doxygen/html/html/functions_enum.html +3 -0
- package/SVF-doxygen/html/html/functions_eval_b.html +6 -3
- package/SVF-doxygen/html/html/functions_eval_z.html +79 -0
- package/SVF-doxygen/html/html/functions_f.html +3 -3
- package/SVF-doxygen/html/html/functions_func.html +8 -7
- package/SVF-doxygen/html/html/functions_func_0x7e.html +9 -3
- package/SVF-doxygen/html/html/functions_func_b.html +10 -10
- package/SVF-doxygen/html/html/functions_func_c.html +23 -20
- package/SVF-doxygen/html/html/functions_func_d.html +5 -4
- package/SVF-doxygen/html/html/functions_func_e.html +3 -2
- package/SVF-doxygen/html/html/functions_func_g.html +33 -24
- package/SVF-doxygen/html/html/functions_func_i.html +17 -11
- package/SVF-doxygen/html/html/functions_func_n.html +4 -3
- package/SVF-doxygen/html/html/functions_func_o.html +4 -3
- package/SVF-doxygen/html/html/functions_func_p.html +3 -3
- package/SVF-doxygen/html/html/functions_func_s.html +2 -2
- package/SVF-doxygen/html/html/functions_func_z.html +79 -0
- package/SVF-doxygen/html/html/functions_g.html +35 -26
- package/SVF-doxygen/html/html/functions_i.html +30 -15
- package/SVF-doxygen/html/html/functions_l.html +8 -8
- package/SVF-doxygen/html/html/functions_m.html +1 -1
- package/SVF-doxygen/html/html/functions_n.html +4 -3
- package/SVF-doxygen/html/html/functions_o.html +9 -14
- package/SVF-doxygen/html/html/functions_p.html +10 -10
- package/SVF-doxygen/html/html/functions_r.html +7 -7
- package/SVF-doxygen/html/html/functions_rela.html +4 -0
- package/SVF-doxygen/html/html/functions_s.html +13 -15
- package/SVF-doxygen/html/html/functions_t.html +1 -3
- package/SVF-doxygen/html/html/functions_type_b.html +5 -6
- package/SVF-doxygen/html/html/functions_type_c.html +1 -1
- package/SVF-doxygen/html/html/functions_type_i.html +4 -1
- package/SVF-doxygen/html/html/functions_type_z.html +77 -0
- package/SVF-doxygen/html/html/functions_v.html +3 -3
- package/SVF-doxygen/html/html/functions_vars_a.html +0 -3
- package/SVF-doxygen/html/html/functions_vars_b.html +6 -9
- package/SVF-doxygen/html/html/functions_vars_c.html +5 -2
- package/SVF-doxygen/html/html/functions_vars_e.html +1 -1
- package/SVF-doxygen/html/html/functions_vars_i.html +6 -0
- package/SVF-doxygen/html/html/functions_vars_m.html +1 -1
- package/SVF-doxygen/html/html/functions_vars_n.html +1 -1
- package/SVF-doxygen/html/html/functions_vars_s.html +1 -1
- package/SVF-doxygen/html/html/functions_z.html +16 -0
- package/SVF-doxygen/html/html/hierarchy.html +436 -434
- package/SVF-doxygen/html/html/menudata.js +5 -2
- package/SVF-doxygen/html/html/namespaceSVF.html +8 -4
- package/SVF-doxygen/html/html/search/all_1.js +1 -2
- package/SVF-doxygen/html/html/search/all_10.js +11 -11
- package/SVF-doxygen/html/html/search/all_12.js +1 -1
- package/SVF-doxygen/html/html/search/all_13.js +8 -8
- package/SVF-doxygen/html/html/search/all_14.js +1 -1
- package/SVF-doxygen/html/html/search/all_15.js +1 -1
- package/SVF-doxygen/html/html/search/all_16.js +1 -1
- package/SVF-doxygen/html/html/search/all_1a.js +5 -0
- package/SVF-doxygen/html/html/search/all_1b.js +5 -3
- package/SVF-doxygen/html/html/search/all_2.js +10 -9
- package/SVF-doxygen/html/html/search/all_3.js +9 -7
- package/SVF-doxygen/html/html/search/all_4.js +3 -3
- package/SVF-doxygen/html/html/search/all_5.js +2 -2
- package/SVF-doxygen/html/html/search/all_6.js +1 -1
- package/SVF-doxygen/html/html/search/all_7.js +13 -11
- package/SVF-doxygen/html/html/search/all_9.js +8 -6
- package/SVF-doxygen/html/html/search/all_c.js +5 -5
- package/SVF-doxygen/html/html/search/all_d.js +2 -2
- package/SVF-doxygen/html/html/search/all_e.js +4 -4
- package/SVF-doxygen/html/html/search/all_f.js +2 -2
- package/SVF-doxygen/html/html/search/classes_1.js +2 -2
- package/SVF-doxygen/html/html/search/classes_14.html +26 -0
- package/SVF-doxygen/html/html/search/classes_14.js +5 -0
- package/SVF-doxygen/html/html/search/enums_1.js +1 -0
- package/SVF-doxygen/html/html/search/enumvalues_1.js +2 -1
- package/SVF-doxygen/html/html/search/enumvalues_14.html +26 -0
- package/SVF-doxygen/html/html/search/enumvalues_14.js +5 -0
- package/SVF-doxygen/html/html/search/functions_0.js +1 -1
- package/SVF-doxygen/html/html/search/functions_1.js +5 -5
- package/SVF-doxygen/html/html/search/functions_10.js +2 -2
- package/SVF-doxygen/html/html/search/functions_15.js +2 -0
- package/SVF-doxygen/html/html/search/functions_16.js +5 -3
- package/SVF-doxygen/html/html/search/functions_2.js +5 -5
- package/SVF-doxygen/html/html/search/functions_3.js +3 -3
- package/SVF-doxygen/html/html/search/functions_4.js +1 -1
- package/SVF-doxygen/html/html/search/functions_6.js +13 -11
- package/SVF-doxygen/html/html/search/functions_8.js +4 -4
- package/SVF-doxygen/html/html/search/functions_c.js +1 -1
- package/SVF-doxygen/html/html/search/functions_d.js +1 -1
- package/SVF-doxygen/html/html/search/functions_e.js +4 -4
- package/SVF-doxygen/html/html/search/related_0.js +2 -1
- package/SVF-doxygen/html/html/search/searchdata.js +3 -3
- package/SVF-doxygen/html/html/search/typedefs_1.js +2 -2
- package/SVF-doxygen/html/html/search/typedefs_16.html +26 -0
- package/SVF-doxygen/html/html/search/typedefs_16.js +4 -0
- package/SVF-doxygen/html/html/search/typedefs_2.js +1 -1
- package/SVF-doxygen/html/html/search/typedefs_8.js +2 -1
- package/SVF-doxygen/html/html/search/variables_1.js +0 -1
- package/SVF-doxygen/html/html/search/variables_13.js +1 -1
- package/SVF-doxygen/html/html/search/variables_14.js +1 -1
- package/SVF-doxygen/html/html/search/variables_15.js +1 -1
- package/SVF-doxygen/html/html/search/variables_2.js +2 -3
- package/SVF-doxygen/html/html/search/variables_3.js +2 -1
- package/SVF-doxygen/html/html/search/variables_5.js +1 -1
- package/SVF-doxygen/html/html/search/variables_9.js +2 -0
- package/SVF-doxygen/html/html/search/variables_d.js +2 -2
- package/SVF-doxygen/html/html/search/variables_e.js +3 -3
- package/include/SABER/PathCondAllocator.h +2 -3
- package/include/Util/Conditions.h +272 -166
- package/include/Util/Options.h +4 -0
- package/index.html +2 -0
- package/lib/SABER/PathCondAllocator.cpp +3 -0
- package/lib/Util/Conditions.cpp +245 -209
- package/lib/Util/Options.cpp +11 -0
- package/lib/WPA/Andersen.cpp +10 -9
- package/package.json +1 -1
package/lib/Util/Conditions.cpp
CHANGED
|
@@ -30,188 +30,147 @@
|
|
|
30
30
|
|
|
31
31
|
#include "Util/Options.h"
|
|
32
32
|
#include "Util/Conditions.h"
|
|
33
|
-
#include "Util/SVFUtil.h"
|
|
34
33
|
|
|
35
34
|
using namespace SVF;
|
|
35
|
+
using namespace SVFUtil;
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
CondExpr*
|
|
39
|
-
CondExpr*
|
|
40
|
-
CondManager*
|
|
38
|
+
CondExpr *CondManager::trueCond = nullptr;
|
|
39
|
+
CondExpr *CondManager::falseCond = nullptr;
|
|
40
|
+
CondManager *CondManager::condMgr = nullptr;
|
|
41
41
|
u32_t CondManager::totalCondNum = 0;
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
falseCond = getOrAddBranchCond(falseExpr, branchCondManager.getFalseCond());
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/*!
|
|
55
|
-
* Destructor
|
|
56
|
-
*/
|
|
57
|
-
CondManager::~CondManager()
|
|
58
|
-
{
|
|
59
|
-
for (const auto& it : allocatedConds)
|
|
60
|
-
{
|
|
61
|
-
delete it.second;
|
|
43
|
+
CondManager *CondManager::getCondMgr(CondMgrKind _condMgrKind) {
|
|
44
|
+
if (condMgr == nullptr) {
|
|
45
|
+
if (_condMgrKind == BDDMgrK)
|
|
46
|
+
condMgr = new BDDManager();
|
|
47
|
+
else if (_condMgrKind == Z3MgrK)
|
|
48
|
+
condMgr = new Z3Manager();
|
|
49
|
+
else
|
|
50
|
+
assert(false && "invalid condition manager kind!");
|
|
62
51
|
}
|
|
52
|
+
return condMgr;
|
|
63
53
|
}
|
|
64
54
|
|
|
65
55
|
/*!
|
|
66
|
-
*
|
|
67
|
-
* e.g., Compressing using And-Inverter-Graph, Gaussian Elimination
|
|
56
|
+
* Whether **All Paths** are reachable
|
|
68
57
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
z3::tactic qe =
|
|
72
|
-
z3::tactic(expr.ctx(), "aig");
|
|
73
|
-
g.add(expr);
|
|
74
|
-
z3::apply_result r = qe(g);
|
|
75
|
-
z3::expr res(expr.ctx().bool_val(false));
|
|
76
|
-
for (u32_t i = 0; i < r.size(); ++i) {
|
|
77
|
-
if (res.is_false()) {
|
|
78
|
-
res = r[i].as_expr();
|
|
79
|
-
} else {
|
|
80
|
-
res = res || r[i].as_expr();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return res;
|
|
58
|
+
bool CondManager::isAllPathReachable(const CondExpr *e) {
|
|
59
|
+
return isEquivalentBranchCond(e, getTrueCond());
|
|
84
60
|
}
|
|
85
61
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
* Create a fresh condition to encode each program branch
|
|
90
|
-
*/
|
|
91
|
-
CondExpr* CondManager::createFreshBranchCond(const Instruction* inst)
|
|
92
|
-
{
|
|
93
|
-
u32_t condCountIdx = totalCondNum++;
|
|
94
|
-
const z3::expr &expr = cxt.bool_const(("c" + std::to_string(condCountIdx)).c_str());
|
|
95
|
-
IDToCondExprMap::const_iterator it = allocatedConds.find(expr.id());
|
|
96
|
-
if (it != allocatedConds.end())
|
|
62
|
+
Z3Expr *Z3Manager::getOrAddZ3Cond(const Z3Cond &z3Cond) {
|
|
63
|
+
auto it = idToCondExprMap.find(z3Cond.id());
|
|
64
|
+
if (it != idToCondExprMap.end()) {
|
|
97
65
|
return it->second;
|
|
98
|
-
else{
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
auto *negCond = NEG(cond);
|
|
102
|
-
setCondInst(cond, inst);
|
|
103
|
-
setNegCondInst(negCond, inst);
|
|
104
|
-
branchCondToCondExpr.emplace(branchCond, cond);
|
|
105
|
-
return allocatedConds.emplace(expr.id(), cond).first->second;
|
|
66
|
+
} else {
|
|
67
|
+
Z3Expr *z3CondExpr = new Z3Expr(z3Cond);
|
|
68
|
+
return idToCondExprMap.emplace(z3Cond.id(), z3CondExpr).first->second;
|
|
106
69
|
}
|
|
107
70
|
}
|
|
108
71
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
auto *cond = new BranchCondExpr(e, branchCond);
|
|
120
|
-
branchCondToCondExpr.emplace(branchCond, cond);
|
|
121
|
-
return allocatedConds.emplace(e.id(), cond).first->second;
|
|
72
|
+
Z3Manager::Z3Manager() : sol(cxt) {
|
|
73
|
+
const z3::expr &trueExpr = cxt.bool_val(true);
|
|
74
|
+
trueCond = getOrAddZ3Cond(trueExpr);
|
|
75
|
+
const z3::expr &falseExpr = cxt.bool_val(false);
|
|
76
|
+
falseCond = getOrAddZ3Cond(falseExpr);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
Z3Manager::~Z3Manager() {
|
|
80
|
+
for (const auto &it: idToCondExprMap) {
|
|
81
|
+
delete it.second;
|
|
122
82
|
}
|
|
123
83
|
}
|
|
124
84
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
85
|
+
inline bool Z3Manager::isEquivalentBranchCond(const CondExpr *lhs, const CondExpr *rhs) {
|
|
86
|
+
sol.push();
|
|
87
|
+
const Z3Expr *z3lhs = dyn_cast<Z3Expr>(lhs);
|
|
88
|
+
const Z3Expr *z3rhs = dyn_cast<Z3Expr>(rhs);
|
|
89
|
+
assert(z3lhs && z3rhs && "not z3 condition?");
|
|
90
|
+
sol.add(z3lhs->getExpr() != z3rhs->getExpr());
|
|
91
|
+
z3::check_result res = sol.check();
|
|
92
|
+
sol.pop();
|
|
93
|
+
return res == z3::unsat;
|
|
131
94
|
}
|
|
95
|
+
|
|
132
96
|
/// Operations on conditions.
|
|
133
97
|
//@{
|
|
134
|
-
CondExpr*
|
|
135
|
-
|
|
98
|
+
CondExpr *Z3Manager::AND(CondExpr *lhs, CondExpr *rhs) {
|
|
99
|
+
auto *z3lhs = dyn_cast<Z3Expr>(lhs);
|
|
100
|
+
auto *z3rhs = dyn_cast<Z3Expr>(rhs);
|
|
101
|
+
assert(z3lhs && z3rhs && "not z3 condition?");
|
|
102
|
+
if (z3lhs == getFalseCond() || z3rhs == getFalseCond())
|
|
136
103
|
return getFalseCond();
|
|
137
|
-
else if (
|
|
138
|
-
return
|
|
139
|
-
else if (
|
|
140
|
-
return
|
|
104
|
+
else if (z3lhs == getTrueCond())
|
|
105
|
+
return z3rhs;
|
|
106
|
+
else if (z3rhs == getTrueCond())
|
|
107
|
+
return z3lhs;
|
|
141
108
|
else {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const z3::expr &expr = lhs->getExpr() && rhs->getExpr();
|
|
145
|
-
return getOrAddBranchCond(expr, branchCond);
|
|
109
|
+
const z3::expr &expr = z3lhs->getExpr() && z3rhs->getExpr();
|
|
110
|
+
return getOrAddZ3Cond(expr);
|
|
146
111
|
}
|
|
147
112
|
}
|
|
148
113
|
|
|
149
|
-
CondExpr*
|
|
150
|
-
|
|
114
|
+
CondExpr *Z3Manager::OR(CondExpr *lhs, CondExpr *rhs) {
|
|
115
|
+
auto *z3lhs = dyn_cast<Z3Expr>(lhs);
|
|
116
|
+
auto *z3rhs = dyn_cast<Z3Expr>(rhs);
|
|
117
|
+
assert(z3lhs && z3rhs && "not z3 condition?");
|
|
118
|
+
if (z3lhs == getTrueCond() || z3rhs == getTrueCond())
|
|
151
119
|
return getTrueCond();
|
|
152
|
-
else if (
|
|
153
|
-
return
|
|
154
|
-
else if (
|
|
155
|
-
return
|
|
156
|
-
else{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const z3::expr &expr = lhs->getExpr() || rhs->getExpr();
|
|
160
|
-
return getOrAddBranchCond(expr, branchCond);
|
|
120
|
+
else if (z3lhs == getFalseCond())
|
|
121
|
+
return z3rhs;
|
|
122
|
+
else if (z3rhs == getFalseCond())
|
|
123
|
+
return z3lhs;
|
|
124
|
+
else {
|
|
125
|
+
const z3::expr &expr = z3lhs->getExpr() || z3rhs->getExpr();
|
|
126
|
+
return getOrAddZ3Cond(expr);
|
|
161
127
|
}
|
|
162
128
|
}
|
|
163
|
-
|
|
164
|
-
|
|
129
|
+
|
|
130
|
+
CondExpr *Z3Manager::NEG(CondExpr *lhs) {
|
|
131
|
+
auto *z3lhs = dyn_cast<Z3Expr>(lhs);
|
|
132
|
+
assert(z3lhs && "not z3 condition?");
|
|
133
|
+
if (z3lhs == getTrueCond())
|
|
165
134
|
return getFalseCond();
|
|
166
|
-
else if (
|
|
135
|
+
else if (z3lhs == getFalseCond())
|
|
167
136
|
return getTrueCond();
|
|
168
|
-
else{
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return getOrAddBranchCond(expr, branchCond);
|
|
137
|
+
else {
|
|
138
|
+
const z3::expr &expr = !z3lhs->getExpr();
|
|
139
|
+
return getOrAddZ3Cond(expr);
|
|
172
140
|
}
|
|
173
141
|
}
|
|
174
142
|
//@}
|
|
175
143
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
144
|
+
CondExpr *Z3Manager::createFreshBranchCond(const Instruction *inst) {
|
|
145
|
+
u32_t condCountIdx = totalCondNum++;
|
|
146
|
+
const z3::expr &expr = cxt.bool_const(("c" + std::to_string(condCountIdx)).c_str());
|
|
147
|
+
auto it = idToCondExprMap.find(expr.id());
|
|
148
|
+
if (it != idToCondExprMap.end())
|
|
149
|
+
return it->second;
|
|
150
|
+
else {
|
|
151
|
+
auto *cond = new Z3Expr(expr);
|
|
152
|
+
auto *negCond = NEG(cond);
|
|
153
|
+
setCondInst(cond, inst);
|
|
154
|
+
setNegCondInst(negCond, inst);
|
|
155
|
+
return idToCondExprMap.emplace(expr.id(), cond).first->second;
|
|
187
156
|
}
|
|
188
157
|
}
|
|
189
158
|
|
|
190
|
-
/*!
|
|
191
|
-
* Return memory usage for this condition manager
|
|
192
|
-
*/
|
|
193
|
-
std::string CondManager::getMemUsage()
|
|
194
|
-
{
|
|
195
|
-
//std::ostringstream os;
|
|
196
|
-
//memory::display_max_usage(os);
|
|
197
|
-
//return os.str();
|
|
198
|
-
return "";
|
|
199
|
-
}
|
|
200
|
-
|
|
201
159
|
/*!
|
|
202
160
|
* Extract sub conditions of this expression
|
|
203
161
|
*/
|
|
204
|
-
void
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
162
|
+
void Z3Manager::extractSubConds(const CondExpr *cond, NodeBS &support) const {
|
|
163
|
+
const auto *z3CondExpr = dyn_cast<Z3Expr>(cond);
|
|
164
|
+
assert(z3CondExpr && "not z3 condition?");
|
|
165
|
+
if (z3CondExpr->getExpr().num_args() == 1 && isNegCond(z3CondExpr)) {
|
|
166
|
+
support.set(z3CondExpr->getExpr().id());
|
|
208
167
|
return;
|
|
209
168
|
}
|
|
210
|
-
if (
|
|
211
|
-
if (!
|
|
212
|
-
support.set(
|
|
213
|
-
for (u32_t i = 0; i <
|
|
214
|
-
const z3::expr &expr =
|
|
169
|
+
if (z3CondExpr->getExpr().num_args() == 0)
|
|
170
|
+
if (!z3CondExpr->getExpr().is_true() && !z3CondExpr->getExpr().is_false())
|
|
171
|
+
support.set(z3CondExpr->getExpr().id());
|
|
172
|
+
for (u32_t i = 0; i < z3CondExpr->getExpr().num_args(); ++i) {
|
|
173
|
+
const z3::expr &expr = z3CondExpr->getExpr().arg(i);
|
|
215
174
|
extractSubConds(getCond(expr.id()), support);
|
|
216
175
|
}
|
|
217
176
|
}
|
|
@@ -219,10 +178,13 @@ void CondManager::extractSubConds(const CondExpr* cond, NodeBS &support) const
|
|
|
219
178
|
/*!
|
|
220
179
|
* Whether the condition is satisfiable
|
|
221
180
|
*/
|
|
222
|
-
bool
|
|
223
|
-
sol.
|
|
224
|
-
|
|
181
|
+
bool Z3Manager::isSatisfiable(const CondExpr *cond) {
|
|
182
|
+
sol.push();
|
|
183
|
+
const Z3Expr *z3CondExpr = dyn_cast<Z3Expr>(cond);
|
|
184
|
+
assert(z3CondExpr && "not z3 condition?");
|
|
185
|
+
sol.add(z3CondExpr->getExpr());
|
|
225
186
|
z3::check_result result = sol.check();
|
|
187
|
+
sol.pop();
|
|
226
188
|
if (result == z3::sat || result == z3::unknown)
|
|
227
189
|
return true;
|
|
228
190
|
else
|
|
@@ -230,54 +192,124 @@ bool CondManager::isSatisfiable(const CondExpr* cond){
|
|
|
230
192
|
}
|
|
231
193
|
|
|
232
194
|
/*!
|
|
233
|
-
*
|
|
195
|
+
* Preprocess the condition,
|
|
196
|
+
* e.g., Compressing using And-Inverter-Graph, Gaussian Elimination
|
|
234
197
|
*/
|
|
235
|
-
|
|
236
|
-
|
|
198
|
+
z3::expr Z3Manager::simplify(const z3::expr &expr) const {
|
|
199
|
+
z3::goal g(expr.ctx());
|
|
200
|
+
z3::tactic qe =
|
|
201
|
+
z3::tactic(expr.ctx(), "aig");
|
|
202
|
+
g.add(expr);
|
|
203
|
+
z3::apply_result r = qe(g);
|
|
204
|
+
z3::expr res(expr.ctx().bool_val(false));
|
|
205
|
+
for (u32_t i = 0; i < r.size(); ++i) {
|
|
206
|
+
if (res.is_false()) {
|
|
207
|
+
res = r[i].as_expr();
|
|
208
|
+
} else {
|
|
209
|
+
res = res || r[i].as_expr();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return res;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
/*!
|
|
217
|
+
* Print the expressions in this model
|
|
218
|
+
*/
|
|
219
|
+
void Z3Manager::printModel() {
|
|
220
|
+
SVFUtil::outs() << sol.check() << "\n";
|
|
221
|
+
z3::model m = sol.get_model();
|
|
222
|
+
for (u32_t i = 0; i < m.size(); i++) {
|
|
223
|
+
z3::func_decl v = m[i];
|
|
224
|
+
SVFUtil::outs() << v.name() << " = " << m.get_const_interp(v) << "\n";
|
|
225
|
+
}
|
|
237
226
|
}
|
|
238
227
|
|
|
239
228
|
/*!
|
|
240
229
|
* Print out one particular expression
|
|
241
230
|
*/
|
|
242
|
-
inline void
|
|
243
|
-
|
|
244
|
-
|
|
231
|
+
inline void Z3Manager::printDbg(const CondExpr *e) {
|
|
232
|
+
const Z3Expr *z3CondExpr = dyn_cast<Z3Expr>(e);
|
|
233
|
+
assert(z3CondExpr && "not z3 condition?");
|
|
234
|
+
SVFUtil::outs() << z3CondExpr->getExpr() << "\n";
|
|
245
235
|
}
|
|
246
236
|
|
|
247
237
|
/*!
|
|
248
238
|
* Return string format of this expression
|
|
249
239
|
*/
|
|
250
|
-
std::string
|
|
251
|
-
{
|
|
240
|
+
std::string Z3Manager::dumpStr(const CondExpr *e) const {
|
|
252
241
|
std::ostringstream out;
|
|
253
|
-
|
|
242
|
+
const Z3Expr *z3CondExpr = dyn_cast<Z3Expr>(e);
|
|
243
|
+
assert(z3CondExpr && "not z3 condition?");
|
|
244
|
+
out << z3CondExpr->getExpr();
|
|
254
245
|
return out.str();
|
|
255
246
|
}
|
|
256
247
|
|
|
248
|
+
|
|
249
|
+
/*!
|
|
250
|
+
* Get or add a single branch condition,
|
|
251
|
+
* e.g., when doing condition conjunction
|
|
252
|
+
*/
|
|
253
|
+
BDDExpr *BDDManager::getOrAddBranchCond(BDDCond *bddCond) {
|
|
254
|
+
auto it = bddToBddCondExprMap.find(bddCond);
|
|
255
|
+
if (it != bddToBddCondExprMap.end())
|
|
256
|
+
return it->second;
|
|
257
|
+
else {
|
|
258
|
+
auto *cond = new BDDExpr(bddCond);
|
|
259
|
+
return bddToBddCondExprMap.emplace(bddCond, cond).first->second;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
BDDManager::BDDManager() {
|
|
264
|
+
m_bdd_mgr = Cudd_Init(0, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0);
|
|
265
|
+
trueCond = getOrAddBranchCond(BddOne());
|
|
266
|
+
falseCond = getOrAddBranchCond(BddZero());
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
BDDManager::~BDDManager() {
|
|
270
|
+
for (const auto &it: bddToBddCondExprMap) {
|
|
271
|
+
delete it.second;
|
|
272
|
+
}
|
|
273
|
+
Cudd_Quit(m_bdd_mgr);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
CondExpr *BDDManager::createFreshBranchCond(const Instruction *inst) {
|
|
277
|
+
u32_t condCountIdx = totalCondNum++;
|
|
278
|
+
BDDCond *bddCond = createCond(condCountIdx);
|
|
279
|
+
auto it = bddToBddCondExprMap.find(bddCond);
|
|
280
|
+
if (it != bddToBddCondExprMap.end())
|
|
281
|
+
return it->second;
|
|
282
|
+
else {
|
|
283
|
+
auto *cond = new BDDExpr(bddCond);
|
|
284
|
+
setCondInst(cond, inst);
|
|
285
|
+
auto *negCond = NEG(cond);
|
|
286
|
+
setCondInst(negCond, inst);
|
|
287
|
+
return bddToBddCondExprMap.emplace(bddCond, cond).first->second;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
257
291
|
/// Operations on conditions.
|
|
258
292
|
//@{
|
|
259
293
|
/// use Cudd_bddAndLimit interface to avoid bdds blow up
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
294
|
+
CondExpr *BDDManager::AND(CondExpr *lhs, CondExpr *rhs) {
|
|
295
|
+
auto *bddlhs = dyn_cast<BDDExpr>(lhs);
|
|
296
|
+
auto *bddrhs = dyn_cast<BDDExpr>(rhs);
|
|
297
|
+
assert(bddlhs && bddrhs && "not bdd condition?");
|
|
298
|
+
if (bddlhs == getFalseCond() || bddrhs == getFalseCond())
|
|
263
299
|
return getFalseCond();
|
|
264
|
-
else if (
|
|
265
|
-
return
|
|
266
|
-
else if (
|
|
267
|
-
return
|
|
268
|
-
else
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if(tmp==nullptr)
|
|
272
|
-
{
|
|
300
|
+
else if (bddlhs == getTrueCond())
|
|
301
|
+
return bddrhs;
|
|
302
|
+
else if (bddrhs == getTrueCond())
|
|
303
|
+
return bddlhs;
|
|
304
|
+
else {
|
|
305
|
+
BDDCond *tmp = Cudd_bddAndLimit(m_bdd_mgr, bddlhs->getBDDCond(), bddrhs->getBDDCond(), Options::MaxBddSize);
|
|
306
|
+
if (tmp == nullptr) {
|
|
273
307
|
SVFUtil::writeWrnMsg("exceeds max bdd size \n");
|
|
274
308
|
///drop the rhs condition
|
|
275
|
-
return
|
|
276
|
-
}
|
|
277
|
-
else
|
|
278
|
-
{
|
|
309
|
+
return bddlhs;
|
|
310
|
+
} else {
|
|
279
311
|
Cudd_Ref(tmp);
|
|
280
|
-
return tmp;
|
|
312
|
+
return getOrAddBranchCond(tmp);
|
|
281
313
|
}
|
|
282
314
|
}
|
|
283
315
|
}
|
|
@@ -285,48 +317,55 @@ BranchCondManager::BranchCond* BranchCondManager::AND(BranchCond* lhs, BranchCon
|
|
|
285
317
|
/*!
|
|
286
318
|
* Use Cudd_bddOrLimit interface to avoid bdds blow up
|
|
287
319
|
*/
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
320
|
+
CondExpr *BDDManager::OR(CondExpr *lhs, CondExpr *rhs) {
|
|
321
|
+
auto *bddlhs = dyn_cast<BDDExpr>(lhs);
|
|
322
|
+
auto *bddrhs = dyn_cast<BDDExpr>(rhs);
|
|
323
|
+
assert(bddlhs && bddrhs && "not bdd condition?");
|
|
324
|
+
|
|
325
|
+
if (bddlhs == getTrueCond() || bddrhs == getTrueCond())
|
|
291
326
|
return getTrueCond();
|
|
292
|
-
else if (
|
|
293
|
-
return
|
|
294
|
-
else if (
|
|
295
|
-
return
|
|
296
|
-
else
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
if(tmp==nullptr)
|
|
300
|
-
{
|
|
327
|
+
else if (bddlhs == getFalseCond())
|
|
328
|
+
return bddrhs;
|
|
329
|
+
else if (bddrhs == getFalseCond())
|
|
330
|
+
return bddlhs;
|
|
331
|
+
else {
|
|
332
|
+
BDDCond *tmp = Cudd_bddOrLimit(m_bdd_mgr, bddlhs->getBDDCond(), bddrhs->getBDDCond(), Options::MaxBddSize);
|
|
333
|
+
if (tmp == nullptr) {
|
|
301
334
|
SVFUtil::writeWrnMsg("exceeds max bdd size \n");
|
|
302
335
|
/// drop the two conditions here
|
|
303
336
|
return getTrueCond();
|
|
304
|
-
}
|
|
305
|
-
else
|
|
306
|
-
{
|
|
337
|
+
} else {
|
|
307
338
|
Cudd_Ref(tmp);
|
|
308
|
-
return tmp;
|
|
339
|
+
return getOrAddBranchCond(tmp);
|
|
309
340
|
}
|
|
310
341
|
}
|
|
311
342
|
}
|
|
312
343
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
344
|
+
CondExpr *BDDManager::NEG(CondExpr *lhs) {
|
|
345
|
+
auto *bddlhs = dyn_cast<BDDExpr>(lhs);
|
|
346
|
+
assert(bddlhs && "not bdd condition?");
|
|
347
|
+
|
|
348
|
+
if (bddlhs == getTrueCond())
|
|
316
349
|
return getFalseCond();
|
|
317
|
-
else if (
|
|
350
|
+
else if (bddlhs == getFalseCond())
|
|
318
351
|
return getTrueCond();
|
|
319
352
|
else
|
|
320
|
-
return Cudd_Not(
|
|
353
|
+
return getOrAddBranchCond(Cudd_Not(bddlhs->getBDDCond()));
|
|
321
354
|
}
|
|
322
355
|
//@}
|
|
323
356
|
|
|
357
|
+
/*!
|
|
358
|
+
* Whether the condition is satisfiable
|
|
359
|
+
*/
|
|
360
|
+
bool BDDManager::isSatisfiable(const CondExpr *cond) {
|
|
361
|
+
return cond != getFalseCond();
|
|
362
|
+
}
|
|
363
|
+
|
|
324
364
|
/*!
|
|
325
365
|
* Utilities for dumping conditions. These methods use global functions from CUDD
|
|
326
366
|
* package and they can be removed outside this class scope to be used by others.
|
|
327
367
|
*/
|
|
328
|
-
void
|
|
329
|
-
{
|
|
368
|
+
void BDDManager::ddClearFlag(BDDCond *f) const {
|
|
330
369
|
if (!Cudd_IsComplement(f->next))
|
|
331
370
|
return;
|
|
332
371
|
/* Clear visited flag. */
|
|
@@ -338,8 +377,7 @@ void BranchCondManager::ddClearFlag(BranchCond * f) const
|
|
|
338
377
|
return;
|
|
339
378
|
}
|
|
340
379
|
|
|
341
|
-
void
|
|
342
|
-
{
|
|
380
|
+
void BDDManager::BddSupportStep(BDDCond *f, NodeBS &support) const {
|
|
343
381
|
if (cuddIsConstant(f) || Cudd_IsComplement(f->next))
|
|
344
382
|
return;
|
|
345
383
|
|
|
@@ -351,47 +389,45 @@ void BranchCondManager::BddSupportStep(BranchCond * f, NodeBS &support) const
|
|
|
351
389
|
f->next = Cudd_Complement(f->next);
|
|
352
390
|
}
|
|
353
391
|
|
|
354
|
-
void
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
392
|
+
void BDDManager::extractSubConds(const CondExpr *f, NodeBS &support) const {
|
|
393
|
+
const auto *bddCondExpr = dyn_cast<BDDExpr>(f);
|
|
394
|
+
assert(bddCondExpr && "not bdd condition?");
|
|
395
|
+
BddSupportStep(Cudd_Regular(bddCondExpr->getBDDCond()), support);
|
|
396
|
+
ddClearFlag(Cudd_Regular(bddCondExpr->getBDDCond()));
|
|
358
397
|
}
|
|
359
398
|
|
|
360
399
|
/*!
|
|
361
400
|
* Dump BDD
|
|
362
401
|
*/
|
|
363
|
-
void
|
|
364
|
-
{
|
|
402
|
+
void BDDManager::dump(const CondExpr *lhs, OutStream &O) {
|
|
365
403
|
if (lhs == getTrueCond())
|
|
366
404
|
O << "T";
|
|
367
|
-
else
|
|
368
|
-
{
|
|
405
|
+
else {
|
|
369
406
|
NodeBS support;
|
|
370
407
|
extractSubConds(lhs, support);
|
|
371
408
|
for (NodeBS::iterator iter = support.begin(); iter != support.end();
|
|
372
|
-
|
|
373
|
-
{
|
|
409
|
+
++iter) {
|
|
374
410
|
unsigned rid = *iter;
|
|
375
411
|
O << rid << " ";
|
|
376
412
|
}
|
|
377
413
|
}
|
|
378
414
|
}
|
|
379
415
|
|
|
416
|
+
|
|
380
417
|
/*!
|
|
381
418
|
* Dump BDD
|
|
382
419
|
*/
|
|
383
|
-
std::string
|
|
384
|
-
|
|
420
|
+
std::string BDDManager::dumpStr(const CondExpr *e) const {
|
|
421
|
+
const auto *bddCondExpr = dyn_cast<BDDExpr>(e);
|
|
422
|
+
assert(bddCondExpr && "not bdd condition?");
|
|
385
423
|
std::string str;
|
|
386
|
-
if (
|
|
424
|
+
if (bddCondExpr == getTrueCond())
|
|
387
425
|
str += "T";
|
|
388
|
-
else
|
|
389
|
-
{
|
|
426
|
+
else {
|
|
390
427
|
NodeBS support;
|
|
391
|
-
extractSubConds(
|
|
428
|
+
extractSubConds(bddCondExpr, support);
|
|
392
429
|
for (NodeBS::iterator iter = support.begin(); iter != support.end();
|
|
393
|
-
|
|
394
|
-
{
|
|
430
|
+
++iter) {
|
|
395
431
|
unsigned rid = *iter;
|
|
396
432
|
char int2str[16];
|
|
397
433
|
sprintf(int2str, "%d", rid);
|
package/lib/Util/Options.cpp
CHANGED
|
@@ -797,4 +797,15 @@ namespace SVF
|
|
|
797
797
|
llvm::cl::init(false),
|
|
798
798
|
llvm::cl::desc("Show hidden nodes on DOT Graphs (e.g., isolated node on a graph)")
|
|
799
799
|
);
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
const llvm::cl::opt<CondManager::CondMgrKind> Options::ConditionType(
|
|
803
|
+
"cond-type",
|
|
804
|
+
llvm::cl::init(CondManager::CondMgrKind::BDDMgrK),
|
|
805
|
+
llvm::cl::desc("condition type used in path-sensitive analysis"),
|
|
806
|
+
llvm::cl::values(
|
|
807
|
+
clEnumValN(CondManager::CondMgrKind::BDDMgrK, "bdd", "BDD condition"),
|
|
808
|
+
clEnumValN(CondManager::CondMgrKind::Z3MgrK, "z3", "z3 condition")
|
|
809
|
+
)
|
|
810
|
+
);
|
|
800
811
|
} // namespace SVF.
|
package/lib/WPA/Andersen.cpp
CHANGED
|
@@ -788,14 +788,21 @@ bool Andersen::mergeSrcToTgt(NodeID nodeId, NodeID newRepId)
|
|
|
788
788
|
|
|
789
789
|
/// move the edges from node to rep, and remove the node
|
|
790
790
|
ConstraintNode* node = consCG->getConstraintNode(nodeId);
|
|
791
|
-
bool
|
|
791
|
+
bool pwc = consCG->moveEdgesToRepNode(node, consCG->getConstraintNode(newRepId));
|
|
792
|
+
|
|
793
|
+
/// 1. if find gep edges inside SCC cycle, the rep node will become a PWC node and
|
|
794
|
+
/// its pts should be collapsed later.
|
|
795
|
+
/// 2. if the node to be merged is already a PWC node, the rep node will also become
|
|
796
|
+
/// a PWC node as it will have a self-cycle gep edge.
|
|
797
|
+
if(node->isPWCNode())
|
|
798
|
+
pwc = true;
|
|
792
799
|
|
|
793
800
|
/// set rep and sub relations
|
|
794
801
|
updateNodeRepAndSubs(node->getId(),newRepId);
|
|
795
802
|
|
|
796
803
|
consCG->removeConstraintNode(node);
|
|
797
804
|
|
|
798
|
-
return
|
|
805
|
+
return pwc;
|
|
799
806
|
}
|
|
800
807
|
/*
|
|
801
808
|
* Merge a node to its rep node based on SCC detection
|
|
@@ -803,13 +810,7 @@ bool Andersen::mergeSrcToTgt(NodeID nodeId, NodeID newRepId)
|
|
|
803
810
|
void Andersen::mergeNodeToRep(NodeID nodeId,NodeID newRepId)
|
|
804
811
|
{
|
|
805
812
|
|
|
806
|
-
|
|
807
|
-
bool gepInsideScc = mergeSrcToTgt(nodeId,newRepId);
|
|
808
|
-
/// 1. if find gep edges inside SCC cycle, the rep node will become a PWC node and
|
|
809
|
-
/// its pts should be collapsed later.
|
|
810
|
-
/// 2. if the node to be merged is already a PWC node, the rep node will also become
|
|
811
|
-
/// a PWC node as it will have a self-cycle gep edge.
|
|
812
|
-
if (gepInsideScc || node->isPWCNode())
|
|
813
|
+
if (mergeSrcToTgt(nodeId,newRepId))
|
|
813
814
|
consCG->setPWCNode(newRepId);
|
|
814
815
|
}
|
|
815
816
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.421",
|
|
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": {
|