svf-tools 1.0.360 → 1.0.364

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.
Files changed (201) hide show
  1. package/SVF-doxygen/html/html/AndersenStat_8cpp_source.html +1 -1
  2. package/SVF-doxygen/html/html/Andersen_8h_source.html +1 -1
  3. package/SVF-doxygen/html/html/ConsGNode_8h_source.html +5 -5
  4. package/SVF-doxygen/html/html/ConsG_8cpp_source.html +34 -32
  5. package/SVF-doxygen/html/html/ConsG_8h_source.html +20 -20
  6. package/SVF-doxygen/html/html/ContextDDA_8h_source.html +1 -1
  7. package/SVF-doxygen/html/html/DDAClient_8cpp_source.html +2 -2
  8. package/SVF-doxygen/html/html/DDAClient_8h_source.html +1 -1
  9. package/SVF-doxygen/html/html/DDAPass_8cpp_source.html +1 -1
  10. package/SVF-doxygen/html/html/DDAStat_8cpp_source.html +1 -1
  11. package/SVF-doxygen/html/html/DDAVFSolver_8h_source.html +1 -1
  12. package/SVF-doxygen/html/html/FlowDDA_8h_source.html +1 -1
  13. package/SVF-doxygen/html/html/ICFGBuilder_8cpp_source.html +1 -1
  14. package/SVF-doxygen/html/html/IRAnnotator_8h_source.html +1 -1
  15. package/SVF-doxygen/html/html/LocationSet_8h_source.html +1 -1
  16. package/SVF-doxygen/html/html/MTAAnnotator_8cpp_source.html +1 -1
  17. package/SVF-doxygen/html/html/MemRegion_8cpp_source.html +1 -1
  18. package/SVF-doxygen/html/html/PAGBuilderFromFile_8cpp_source.html +1 -1
  19. package/SVF-doxygen/html/html/PointerAnalysisImpl_8cpp_source.html +5 -5
  20. package/SVF-doxygen/html/html/PointerAnalysisImpl_8h_source.html +1 -1
  21. package/SVF-doxygen/html/html/PointerAnalysis_8cpp_source.html +13 -15
  22. package/SVF-doxygen/html/html/PointerAnalysis_8h_source.html +14 -14
  23. package/SVF-doxygen/html/html/SVFGOPT_8h_source.html +2 -2
  24. package/SVF-doxygen/html/html/SVFG_8cpp_source.html +4 -4
  25. package/SVF-doxygen/html/html/SVFG_8h_source.html +1 -1
  26. package/SVF-doxygen/html/html/SVFIRBuilder_8cpp_source.html +12 -6
  27. package/SVF-doxygen/html/html/SVFIRBuilder_8h_source.html +90 -84
  28. package/SVF-doxygen/html/html/SVFIR_8cpp_source.html +43 -39
  29. package/SVF-doxygen/html/html/SVFIR_8h_source.html +41 -39
  30. package/SVF-doxygen/html/html/SVFStatements_8cpp_source.html +21 -20
  31. package/SVF-doxygen/html/html/SVFStatements_8h.html +2 -0
  32. package/SVF-doxygen/html/html/SVFStatements_8h_source.html +78 -62
  33. package/SVF-doxygen/html/html/SaberSVFGBuilder_8cpp_source.html +1 -1
  34. package/SVF-doxygen/html/html/SymbolTableBuilder_8cpp_source.html +14 -13
  35. package/SVF-doxygen/html/html/SymbolTableBuilder_8h_source.html +12 -12
  36. package/SVF-doxygen/html/html/TypeBasedHeapCloning_8cpp_source.html +1 -1
  37. package/SVF-doxygen/html/html/VFGNode_8h_source.html +5 -5
  38. package/SVF-doxygen/html/html/VFG_8cpp_source.html +42 -40
  39. package/SVF-doxygen/html/html/VFG_8h_source.html +26 -26
  40. package/SVF-doxygen/html/html/annotated.html +58 -57
  41. package/SVF-doxygen/html/html/classSVF_1_1AddrCGEdge.html +2 -2
  42. package/SVF-doxygen/html/html/classSVF_1_1AddrStmt-members.html +14 -13
  43. package/SVF-doxygen/html/html/classSVF_1_1AddrStmt.html +4 -3
  44. package/SVF-doxygen/html/html/classSVF_1_1Andersen.html +1 -1
  45. package/SVF-doxygen/html/html/classSVF_1_1AndersenBase.html +3 -3
  46. package/SVF-doxygen/html/html/classSVF_1_1AndersenStat.html +1 -1
  47. package/SVF-doxygen/html/html/classSVF_1_1ArgumentVFGNode.html +2 -2
  48. package/SVF-doxygen/html/html/classSVF_1_1AssignStmt-members.html +14 -13
  49. package/SVF-doxygen/html/html/classSVF_1_1AssignStmt.html +4 -3
  50. package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +6 -6
  51. package/SVF-doxygen/html/html/classSVF_1_1BinaryOPStmt-members.html +30 -28
  52. package/SVF-doxygen/html/html/classSVF_1_1BinaryOPStmt.html +26 -22
  53. package/SVF-doxygen/html/html/classSVF_1_1BinaryOPVFGNode.html +2 -2
  54. package/SVF-doxygen/html/html/classSVF_1_1BranchStmt-members.html +16 -15
  55. package/SVF-doxygen/html/html/classSVF_1_1BranchStmt.html +41 -40
  56. package/SVF-doxygen/html/html/classSVF_1_1BranchVFGNode.html +4 -4
  57. package/SVF-doxygen/html/html/classSVF_1_1CallPE-members.html +14 -13
  58. package/SVF-doxygen/html/html/classSVF_1_1CallPE.html +6 -5
  59. package/SVF-doxygen/html/html/classSVF_1_1CmpStmt-members.html +30 -28
  60. package/SVF-doxygen/html/html/classSVF_1_1CmpStmt.html +27 -23
  61. package/SVF-doxygen/html/html/classSVF_1_1CmpVFGNode.html +2 -2
  62. package/SVF-doxygen/html/html/classSVF_1_1CondPTAImpl.html +1 -1
  63. package/SVF-doxygen/html/html/classSVF_1_1ConstraintGraph.html +79 -77
  64. package/SVF-doxygen/html/html/classSVF_1_1ConstraintNode-members.html +26 -26
  65. package/SVF-doxygen/html/html/classSVF_1_1ConstraintNode.html +43 -43
  66. package/SVF-doxygen/html/html/classSVF_1_1ContextDDA.html +1 -1
  67. package/SVF-doxygen/html/html/classSVF_1_1CopyStmt-members.html +14 -13
  68. package/SVF-doxygen/html/html/classSVF_1_1CopyStmt.html +4 -3
  69. package/SVF-doxygen/html/html/classSVF_1_1DDAClient.html +2 -2
  70. package/SVF-doxygen/html/html/classSVF_1_1DDAPass.html +3 -3
  71. package/SVF-doxygen/html/html/classSVF_1_1DDAStat.html +1 -1
  72. package/SVF-doxygen/html/html/classSVF_1_1DDAVFSolver.html +3 -3
  73. package/SVF-doxygen/html/html/classSVF_1_1FlowDDA.html +1 -1
  74. package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveStat.html +1 -1
  75. package/SVF-doxygen/html/html/classSVF_1_1FunptrDDAClient.html +1 -1
  76. package/SVF-doxygen/html/html/classSVF_1_1GenericNode.html +20 -21
  77. package/SVF-doxygen/html/html/classSVF_1_1GenericNode.png +0 -0
  78. package/SVF-doxygen/html/html/classSVF_1_1GepStmt-members.html +15 -14
  79. package/SVF-doxygen/html/html/classSVF_1_1GepStmt.html +6 -5
  80. package/SVF-doxygen/html/html/classSVF_1_1ICFGBuilder.html +1 -1
  81. package/SVF-doxygen/html/html/classSVF_1_1LoadStmt-members.html +14 -13
  82. package/SVF-doxygen/html/html/classSVF_1_1LoadStmt.html +6 -5
  83. package/SVF-doxygen/html/html/classSVF_1_1LocationSet.html +2 -1
  84. package/SVF-doxygen/html/html/classSVF_1_1MRGenerator.html +1 -1
  85. package/SVF-doxygen/html/html/classSVF_1_1MTAAnnotator.html +1 -1
  86. package/SVF-doxygen/html/html/classSVF_1_1MTASVFGBuilder.html +1 -1
  87. package/SVF-doxygen/html/html/classSVF_1_1MultiOpndStmt-members.html +33 -31
  88. package/SVF-doxygen/html/html/classSVF_1_1MultiOpndStmt.html +66 -24
  89. package/SVF-doxygen/html/html/classSVF_1_1MultiOpndStmt.png +0 -0
  90. package/SVF-doxygen/html/html/classSVF_1_1OfflineConsG.html +4 -4
  91. package/SVF-doxygen/html/html/classSVF_1_1PAGBuilderFromFile.html +9 -10
  92. package/SVF-doxygen/html/html/classSVF_1_1PHIVFGNode.html +2 -2
  93. package/SVF-doxygen/html/html/classSVF_1_1PhiStmt-members.html +21 -16
  94. package/SVF-doxygen/html/html/classSVF_1_1PhiStmt.html +186 -73
  95. package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +38 -40
  96. package/SVF-doxygen/html/html/classSVF_1_1RetPE-members.html +14 -13
  97. package/SVF-doxygen/html/html/classSVF_1_1RetPE.html +6 -5
  98. package/SVF-doxygen/html/html/classSVF_1_1SVFG-members.html +1 -1
  99. package/SVF-doxygen/html/html/classSVF_1_1SVFG.html +10 -10
  100. package/SVF-doxygen/html/html/classSVF_1_1SVFGBuilder.html +1 -1
  101. package/SVF-doxygen/html/html/classSVF_1_1SVFGOPT-members.html +1 -1
  102. package/SVF-doxygen/html/html/classSVF_1_1SVFGOPT.html +8 -8
  103. package/SVF-doxygen/html/html/classSVF_1_1SVFIR-members.html +177 -176
  104. package/SVF-doxygen/html/html/classSVF_1_1SVFIR.html +160 -90
  105. package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder-members.html +36 -34
  106. package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +335 -222
  107. package/SVF-doxygen/html/html/classSVF_1_1SVFStmt-members.html +17 -16
  108. package/SVF-doxygen/html/html/classSVF_1_1SVFStmt.html +9 -5
  109. package/SVF-doxygen/html/html/classSVF_1_1SVFStmt.png +0 -0
  110. package/SVF-doxygen/html/html/classSVF_1_1SaberSVFGBuilder.html +3 -3
  111. package/SVF-doxygen/html/html/classSVF_1_1SelectStmt-members.html +154 -0
  112. package/SVF-doxygen/html/html/classSVF_1_1SelectStmt.html +704 -0
  113. package/SVF-doxygen/html/html/classSVF_1_1SelectStmt.png +0 -0
  114. package/SVF-doxygen/html/html/classSVF_1_1StmtVFGNode.html +2 -2
  115. package/SVF-doxygen/html/html/classSVF_1_1StoreStmt-members.html +17 -16
  116. package/SVF-doxygen/html/html/classSVF_1_1StoreStmt.html +6 -5
  117. package/SVF-doxygen/html/html/classSVF_1_1SymbolTableBuilder.html +40 -40
  118. package/SVF-doxygen/html/html/classSVF_1_1TDForkPE-members.html +17 -16
  119. package/SVF-doxygen/html/html/classSVF_1_1TDForkPE.html +15 -14
  120. package/SVF-doxygen/html/html/classSVF_1_1TDJoinPE-members.html +17 -16
  121. package/SVF-doxygen/html/html/classSVF_1_1TDJoinPE.html +15 -14
  122. package/SVF-doxygen/html/html/classSVF_1_1TypeAnalysis.html +2 -2
  123. package/SVF-doxygen/html/html/classSVF_1_1TypeBasedHeapCloning.html +1 -1
  124. package/SVF-doxygen/html/html/classSVF_1_1UnaryOPStmt-members.html +17 -16
  125. package/SVF-doxygen/html/html/classSVF_1_1UnaryOPStmt.html +29 -28
  126. package/SVF-doxygen/html/html/classSVF_1_1VFG-members.html +1 -1
  127. package/SVF-doxygen/html/html/classSVF_1_1VFG.html +61 -59
  128. package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitiveStat.html +1 -1
  129. package/SVF-doxygen/html/html/classes.html +70 -70
  130. package/SVF-doxygen/html/html/functions_a.html +12 -8
  131. package/SVF-doxygen/html/html/functions_b.html +4 -2
  132. package/SVF-doxygen/html/html/functions_c.html +31 -29
  133. package/SVF-doxygen/html/html/functions_eval_s.html +3 -0
  134. package/SVF-doxygen/html/html/functions_func.html +12 -8
  135. package/SVF-doxygen/html/html/functions_func_c.html +18 -17
  136. package/SVF-doxygen/html/html/functions_func_g.html +19 -6
  137. package/SVF-doxygen/html/html/functions_func_o.html +2 -1
  138. package/SVF-doxygen/html/html/functions_func_s.html +8 -5
  139. package/SVF-doxygen/html/html/functions_func_t.html +1 -0
  140. package/SVF-doxygen/html/html/functions_func_u.html +1 -0
  141. package/SVF-doxygen/html/html/functions_g.html +22 -9
  142. package/SVF-doxygen/html/html/functions_i.html +3 -3
  143. package/SVF-doxygen/html/html/functions_l.html +3 -3
  144. package/SVF-doxygen/html/html/functions_m.html +1 -1
  145. package/SVF-doxygen/html/html/functions_o.html +20 -13
  146. package/SVF-doxygen/html/html/functions_p.html +6 -6
  147. package/SVF-doxygen/html/html/functions_s.html +23 -17
  148. package/SVF-doxygen/html/html/functions_t.html +5 -4
  149. package/SVF-doxygen/html/html/functions_type_o.html +3 -0
  150. package/SVF-doxygen/html/html/functions_u.html +1 -0
  151. package/SVF-doxygen/html/html/functions_vars_c.html +3 -0
  152. package/SVF-doxygen/html/html/functions_vars_o.html +3 -0
  153. package/SVF-doxygen/html/html/hierarchy.html +55 -54
  154. package/SVF-doxygen/html/html/namespaceSVF.html +3 -1
  155. package/SVF-doxygen/html/html/search/all_1.js +4 -3
  156. package/SVF-doxygen/html/html/search/all_10.js +7 -7
  157. package/SVF-doxygen/html/html/search/all_12.js +1 -1
  158. package/SVF-doxygen/html/html/search/all_13.js +8 -6
  159. package/SVF-doxygen/html/html/search/all_14.js +4 -4
  160. package/SVF-doxygen/html/html/search/all_15.js +1 -1
  161. package/SVF-doxygen/html/html/search/all_16.js +1 -1
  162. package/SVF-doxygen/html/html/search/all_2.js +1 -1
  163. package/SVF-doxygen/html/html/search/all_3.js +3 -3
  164. package/SVF-doxygen/html/html/search/all_7.js +5 -1
  165. package/SVF-doxygen/html/html/search/all_9.js +1 -1
  166. package/SVF-doxygen/html/html/search/all_c.js +2 -2
  167. package/SVF-doxygen/html/html/search/all_d.js +1 -1
  168. package/SVF-doxygen/html/html/search/all_e.js +1 -1
  169. package/SVF-doxygen/html/html/search/all_f.js +3 -1
  170. package/SVF-doxygen/html/html/search/classes_f.js +1 -0
  171. package/SVF-doxygen/html/html/search/enumvalues_f.js +1 -0
  172. package/SVF-doxygen/html/html/search/functions_0.js +4 -3
  173. package/SVF-doxygen/html/html/search/functions_10.js +1 -0
  174. package/SVF-doxygen/html/html/search/functions_11.js +1 -1
  175. package/SVF-doxygen/html/html/search/functions_12.js +1 -1
  176. package/SVF-doxygen/html/html/search/functions_2.js +1 -1
  177. package/SVF-doxygen/html/html/search/functions_6.js +5 -1
  178. package/SVF-doxygen/html/html/search/functions_d.js +1 -1
  179. package/SVF-doxygen/html/html/search/functions_e.js +1 -1
  180. package/SVF-doxygen/html/html/search/typedefs_e.js +1 -0
  181. package/SVF-doxygen/html/html/search/variables_14.js +1 -1
  182. package/SVF-doxygen/html/html/search/variables_3.js +1 -0
  183. package/SVF-doxygen/html/html/search/variables_e.js +1 -1
  184. package/SVF-doxygen/html/html/search/variables_f.js +1 -0
  185. package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01ConstraintGraph_01_5_01_4.html +16 -16
  186. package/SVF-doxygen/html/html/structllvm_1_1DOTGraphTraits_3_01VFG_01_5_01_4.html +18 -18
  187. package/include/Graphs/VFG.h +1 -1
  188. package/include/MemoryModel/LocationSet.h +1 -1
  189. package/include/MemoryModel/SVFIR.h +3 -1
  190. package/include/MemoryModel/SVFStatements.h +76 -4
  191. package/include/SVF-FE/SVFIRBuilder.h +12 -2
  192. package/lib/Graphs/ConsG.cpp +9 -0
  193. package/lib/Graphs/VFG.cpp +9 -0
  194. package/lib/MemoryModel/PAGBuilderFromFile.cpp +3 -1
  195. package/lib/MemoryModel/PointerAnalysis.cpp +0 -3
  196. package/lib/MemoryModel/SVFIR.cpp +24 -3
  197. package/lib/MemoryModel/SVFStatements.cpp +14 -0
  198. package/lib/SVF-FE/ICFGBuilder.cpp +4 -4
  199. package/lib/SVF-FE/SVFIRBuilder.cpp +36 -9
  200. package/lib/SVF-FE/SymbolTableBuilder.cpp +2 -1
  201. package/package.json +1 -1
@@ -74,6 +74,15 @@ void ConstraintGraph::buildCG()
74
74
  addCopyCGEdge(opVar->getId(),edge->getResID());
75
75
  }
76
76
 
77
+ SVFStmt::SVFStmtSetTy& selects = getPAGEdgeSet(SVFStmt::Select);
78
+ for (SVFStmt::SVFStmtSetTy::iterator iter = selects.begin(), eiter =
79
+ selects.end(); iter != eiter; ++iter)
80
+ {
81
+ const SelectStmt* edge = SVFUtil::cast<SelectStmt>(*iter);
82
+ for(const auto opVar : edge->getOpndVars())
83
+ addCopyCGEdge(opVar->getId(),edge->getResID());
84
+ }
85
+
77
86
  SVFStmt::SVFStmtSetTy& calls = getPAGEdgeSet(SVFStmt::Call);
78
87
  for (SVFStmt::SVFStmtSetTy::iterator iter = calls.begin(), eiter =
79
88
  calls.end(); iter != eiter; ++iter)
@@ -489,6 +489,15 @@ void VFG::addVFGNodes()
489
489
  if(isInterestedPAGNode(edge->getRes()))
490
490
  addIntraPHIVFGNode(edge);
491
491
  }
492
+ // initialize select statement
493
+ SVFStmt::SVFStmtSetTy& selects = getPAGEdgeSet(SVFStmt::Select);
494
+ for (SVFStmt::SVFStmtSetTy::iterator iter = selects.begin(), eiter =
495
+ selects.end(); iter != eiter; ++iter)
496
+ {
497
+ const MultiOpndStmt* edge = SVFUtil::cast<MultiOpndStmt>(*iter);
498
+ if(isInterestedPAGNode(edge->getRes()))
499
+ addIntraPHIVFGNode(edge);
500
+ }
492
501
  // initialize llvm binary nodes (binary operators)
493
502
  SVFStmt::SVFStmtSetTy& binaryops = getPAGEdgeSet(SVFStmt::BinaryOp);
494
503
  for (SVFStmt::SVFStmtSetTy::iterator iter = binaryops.begin(), eiter =
@@ -183,7 +183,9 @@ void PAGBuilderFromFile::addEdge(NodeID srcID, NodeID dstID,
183
183
  else if (edge == "unary-op")
184
184
  pag->addUnaryOPStmt(srcID, dstID, dstID);
185
185
  else if (edge == "phi")
186
- pag->addPhiStmt(srcID, dstID);
186
+ assert(false && "fix phi here!");
187
+ else if (edge == "select")
188
+ assert(false && "fix select here!");
187
189
  else if (edge == "branch"){
188
190
  assert(false && "fix successors here!");
189
191
  //pag->addBranchStmt(srcID, dstID, nullptr);
@@ -204,9 +204,6 @@ void PointerAnalysis::finalize()
204
204
  dumpStat();
205
205
 
206
206
  SVFIR* pag = SVFIR::getPAG();
207
- // dump SVFIR
208
- if (Options::PAGDotGraph)
209
- pag->dump("pag_final");
210
207
 
211
208
  /// Dump results
212
209
  if (Options::PTSPrint)
@@ -84,24 +84,45 @@ CopyStmt* SVFIR::addCopyStmt(NodeID src, NodeID dst)
84
84
  /*!
85
85
  * Add Phi statement
86
86
  */
87
- PhiStmt* SVFIR::addPhiStmt(NodeID res, NodeID opnd)
87
+ PhiStmt* SVFIR::addPhiStmt(NodeID res, NodeID opnd, const ICFGNode* pred)
88
88
  {
89
89
  SVFVar* opNode = getGNode(opnd);
90
90
  SVFVar* resNode = getGNode(res);
91
91
  PHINodeMap::iterator it = phiNodeMap.find(resNode);
92
92
  if(it == phiNodeMap.end()){
93
- PhiStmt* phi = new PhiStmt(resNode, {opNode});
93
+ PhiStmt* phi = new PhiStmt(resNode, {opNode}, {pred});
94
94
  addToStmt2TypeMap(phi);
95
95
  addEdge(opNode, resNode, phi);
96
96
  phiNodeMap[resNode] = phi;
97
97
  return phi;
98
98
  }
99
99
  else{
100
- it->second->addOpVar(opNode);
100
+ it->second->addOpVar(opNode,pred);
101
101
  return it->second;
102
102
  }
103
103
  }
104
104
 
105
+ /*!
106
+ * Add Phi statement
107
+ */
108
+ SelectStmt* SVFIR::addSelectStmt(NodeID res, NodeID op1, NodeID op2, NodeID cond)
109
+ {
110
+ SVFVar* op1Node = getGNode(op1);
111
+ SVFVar* op2Node = getGNode(op2);
112
+ SVFVar* dstNode = getGNode(res);
113
+ SVFVar* condNode = getGNode(cond);
114
+ if(SVFStmt* edge = hasLabeledEdge(op1Node, dstNode, SVFStmt::Select, op2Node))
115
+ return SVFUtil::cast<SelectStmt>(edge);
116
+ else
117
+ {
118
+ std::vector<SVFVar*> opnds = {op1Node, op2Node};
119
+ SelectStmt* select = new SelectStmt(dstNode, opnds, condNode);
120
+ addToStmt2TypeMap(select);
121
+ addEdge(op1Node, dstNode, select);
122
+ return select;
123
+ }
124
+ }
125
+
105
126
  /*!
106
127
  * Add Compare edge
107
128
  */
@@ -101,6 +101,20 @@ const std::string PhiStmt::toString() const{
101
101
  return rawstr.str();
102
102
  }
103
103
 
104
+ const std::string SelectStmt::toString() const{
105
+ std::string str;
106
+ raw_string_ostream rawstr(str);
107
+ rawstr << "SelectStmt: (Condition Var" << getCondition()->getId() << ") [Var" << getResID() << " <-- (Var";
108
+ for(const SVFVar* op : getOpndVars())
109
+ rawstr << op->getId() << ",";
110
+ rawstr << ")]\t";
111
+ if (Options::ShowSVFIRValue) {
112
+ rawstr << "\n";
113
+ rawstr << value2String(getValue());
114
+ }
115
+ return rawstr.str();
116
+ }
117
+
104
118
  const std::string CmpStmt::toString() const{
105
119
  std::string str;
106
120
  raw_string_ostream rawstr(str);
@@ -171,7 +171,7 @@ InterICFGNode* ICFGBuilder::getOrAddInterBlockICFGNode(const Instruction* inst)
171
171
  */
172
172
  void ICFGBuilder::addICFGInterEdges(const Instruction* cs, const SVFFunction* callee)
173
173
  {
174
- CallICFGNode* CallICFGNode = getCallICFGNode(cs);
174
+ CallICFGNode* callICFGNode = getCallICFGNode(cs);
175
175
  RetICFGNode* retBlockNode = getRetICFGNode(cs);
176
176
 
177
177
  /// direct call
@@ -179,20 +179,20 @@ void ICFGBuilder::addICFGInterEdges(const Instruction* cs, const SVFFunction* ca
179
179
  /// if this is an external function (no function body)
180
180
  if (isExtCall(callee))
181
181
  {
182
- icfg->addIntraEdge(CallICFGNode, retBlockNode);
182
+ icfg->addIntraEdge(callICFGNode, retBlockNode);
183
183
  }
184
184
  /// otherwise connect interprocedural edges
185
185
  else
186
186
  {
187
187
  FunEntryICFGNode* calleeEntryNode = icfg->getFunEntryICFGNode(callee);
188
188
  FunExitICFGNode* calleeExitNode = icfg->getFunExitICFGNode(callee);
189
- icfg->addCallEdge(CallICFGNode, calleeEntryNode, cs);
189
+ icfg->addCallEdge(callICFGNode, calleeEntryNode, cs);
190
190
  icfg->addRetEdge(calleeExitNode, retBlockNode, cs);
191
191
  }
192
192
  }
193
193
  /// indirect call (don't know callee)
194
194
  else{
195
- icfg->addIntraEdge(CallICFGNode, retBlockNode);
195
+ icfg->addIntraEdge(callICFGNode, retBlockNode);
196
196
  }
197
197
  }
198
198
  /*
@@ -369,11 +369,11 @@ void SVFIRBuilder::processCE(const Value *val)
369
369
  const Value* cval = getCurrentValue();
370
370
  const BasicBlock* cbb = getCurrentBB();
371
371
  setCurrentLocation(selectce, nullptr);
372
+ NodeID cond = pag->getValueNode(selectce->getOperand(0));
372
373
  NodeID nsrc1 = pag->getValueNode(src1);
373
374
  NodeID nsrc2 = pag->getValueNode(src2);
374
375
  NodeID nres = pag->getValueNode(selectce);
375
- addPhiStmt(nres,nsrc1);
376
- addPhiStmt(nres,nsrc2);
376
+ addSelectStmt(nres,nsrc1, nsrc2, cond);
377
377
  setCurrentLocation(cval, cbb);
378
378
  }
379
379
  // if we meet a int2ptr, then it points-to black hole
@@ -629,9 +629,10 @@ void SVFIRBuilder::visitPHINode(PHINode &inst)
629
629
  const Value* val = inst.getIncomingValue(i);
630
630
  const Instruction* incomingInst = SVFUtil::dyn_cast<Instruction>(val);
631
631
  assert((incomingInst==nullptr) || (incomingInst->getFunction() == inst.getFunction()));
632
-
632
+ const Instruction* predInst = &inst.getIncomingBlock(i)->front();
633
+ const ICFGNode* icfgNode = pag->getICFG()->getICFGNode(predInst);
633
634
  NodeID src = getValueNode(val);
634
- addPhiStmt(dst,src);
635
+ addPhiStmt(dst,src,icfgNode);
635
636
  }
636
637
  }
637
638
 
@@ -772,10 +773,9 @@ void SVFIRBuilder::visitSelectInst(SelectInst &inst)
772
773
  NodeID dst = getValueNode(&inst);
773
774
  NodeID src1 = getValueNode(inst.getTrueValue());
774
775
  NodeID src2 = getValueNode(inst.getFalseValue());
775
-
776
+ NodeID cond = getValueNode(inst.getCondition());
776
777
  /// Two operands have same incoming basic block, both are the current BB
777
- addPhiStmt(dst,src1);
778
- addPhiStmt(dst,src2);
778
+ addSelectStmt(dst,src1,src2, cond);
779
779
  }
780
780
 
781
781
  /*
@@ -841,8 +841,9 @@ void SVFIRBuilder::visitReturnInst(ReturnInst &inst)
841
841
 
842
842
  NodeID rnF = getReturnNode(F);
843
843
  NodeID vnS = getValueNode(src);
844
+ const ICFGNode* icfgNode = pag->getICFG()->getICFGNode(&inst);
844
845
  //vnS may be null if src is a null ptr
845
- addPhiStmt(rnF,vnS);
846
+ addPhiStmt(rnF,vnS,icfgNode);
846
847
  }
847
848
  }
848
849
 
@@ -892,7 +893,7 @@ void SVFIRBuilder::visitBranchInst(BranchInst &inst){
892
893
  BranchStmt::SuccAndCondPairVec successors;
893
894
  for (u32_t i = 0; i < inst.getNumSuccessors(); ++i)
894
895
  {
895
- const Instruction* succInst = &inst.getSuccessor(i)->front();
896
+ const Instruction* succInst = &inst.getSuccessor(i)->back();
896
897
  const ICFGNode* icfgNode = pag->getICFG()->getICFGNode(succInst);
897
898
  successors.push_back(std::make_pair(icfgNode, 1-i));
898
899
  }
@@ -1693,3 +1694,29 @@ u32_t SVFIRBuilder::getFields(std::vector<LocationSet>& fields, const Type* T, u
1693
1694
 
1694
1695
  return sz;
1695
1696
  }
1697
+
1698
+
1699
+ void SVFIRBuilder::updateCallGraph(PTACallGraph* callgraph){
1700
+ PTACallGraph::CallEdgeMap::const_iterator iter = callgraph->getIndCallMap().begin();
1701
+ PTACallGraph::CallEdgeMap::const_iterator eiter = callgraph->getIndCallMap().end();
1702
+ for (; iter != eiter; iter++)
1703
+ {
1704
+ const CallICFGNode* callBlock = iter->first;
1705
+ CallSite cs = getLLVMCallSite(callBlock->getCallSite());
1706
+ setCurrentLocation(callBlock->getCallSite(), callBlock->getCallSite()->getParent());
1707
+ assert(callBlock->isIndirectCall() && "this is not an indirect call?");
1708
+ const PTACallGraph::FunctionSet & functions = iter->second;
1709
+ for (PTACallGraph::FunctionSet::const_iterator func_iter = functions.begin(); func_iter != functions.end(); func_iter++)
1710
+ {
1711
+ const SVFFunction* callee = *func_iter;
1712
+ if (isExtCall(callee))
1713
+ handleExtCall(cs, callee);
1714
+ else
1715
+ handleDirectCall(cs, callee);
1716
+ }
1717
+ }
1718
+
1719
+ // dump SVFIR
1720
+ if (Options::PAGDotGraph)
1721
+ pag->dump("svfir_final");
1722
+ }
@@ -130,6 +130,7 @@ void SymbolTableBuilder::buildMemModel(SVFModule* svfModule)
130
130
  {
131
131
  collectSym(sel->getTrueValue());
132
132
  collectSym(sel->getFalseValue());
133
+ collectSym(sel->getCondition());
133
134
  }
134
135
  else if (const BinaryOperator *binary = SVFUtil::dyn_cast<BinaryOperator>(inst))
135
136
  {
@@ -613,7 +614,7 @@ u32_t SymbolTableBuilder::getObjSize(const Value* val)
613
614
  u32_t numOfFields = 1;
614
615
  if (SVFUtil::isa<StructType>(ety) || SVFUtil::isa<ArrayType>(ety))
615
616
  {
616
- numOfFields = SymbolTableInfo::SymbolInfo()->getFlattenedFieldInfoVec(ety).size();
617
+ numOfFields = SymbolTableInfo::SymbolInfo()->getNumOfFlattenElements(ety);
617
618
  }
618
619
  return numOfFields;
619
620
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-tools",
3
- "version": "1.0.360",
3
+ "version": "1.0.364",
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": {