svf-tools 1.0.378 → 1.0.382

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 (172) hide show
  1. package/SVF-doxygen/html/html/AndersenSFR_8cpp_source.html +3 -3
  2. package/SVF-doxygen/html/html/Andersen_8cpp_source.html +1 -1
  3. package/SVF-doxygen/html/html/CHGBuilder_8cpp_source.html +1 -1
  4. package/SVF-doxygen/html/html/ConsGEdge_8h_source.html +2 -2
  5. package/SVF-doxygen/html/html/ConsG_8cpp_source.html +2 -2
  6. package/SVF-doxygen/html/html/ConsG_8h_source.html +3 -3
  7. package/SVF-doxygen/html/html/ContextDDA_8cpp_source.html +3 -3
  8. package/SVF-doxygen/html/html/DDAVFSolver_8h_source.html +6 -6
  9. package/SVF-doxygen/html/html/FlowDDA_8cpp_source.html +2 -2
  10. package/SVF-doxygen/html/html/FlowSensitiveStat_8cpp_source.html +3 -3
  11. package/SVF-doxygen/html/html/FlowSensitiveTBHC_8cpp_source.html +1 -1
  12. package/SVF-doxygen/html/html/IRAnnotator_8h_source.html +1 -1
  13. package/SVF-doxygen/html/html/IRGraph_8cpp_source.html +1 -1
  14. package/SVF-doxygen/html/html/IRGraph_8h_source.html +2 -2
  15. package/SVF-doxygen/html/html/LocationSet_8cpp_source.html +8 -8
  16. package/SVF-doxygen/html/html/LocationSet_8h.html +0 -2
  17. package/SVF-doxygen/html/html/LocationSet_8h_source.html +28 -21
  18. package/SVF-doxygen/html/html/MemRegion_8cpp_source.html +6 -6
  19. package/SVF-doxygen/html/html/PAGBuilderFromFile_8cpp_source.html +2 -2
  20. package/SVF-doxygen/html/html/PTAStat_8cpp_source.html +15 -15
  21. package/SVF-doxygen/html/html/PointerAnalysisImpl_8cpp_source.html +3 -3
  22. package/SVF-doxygen/html/html/PointerAnalysis_8cpp_source.html +6 -6
  23. package/SVF-doxygen/html/html/PointerAnalysis_8h_source.html +6 -6
  24. package/SVF-doxygen/html/html/SVFIRBuilder_8cpp_source.html +4 -5
  25. package/SVF-doxygen/html/html/SVFIRBuilder_8h_source.html +59 -58
  26. package/SVF-doxygen/html/html/SVFIR_8cpp_source.html +8 -8
  27. package/SVF-doxygen/html/html/SVFIR_8h_source.html +8 -8
  28. package/SVF-doxygen/html/html/SVFModule_8cpp_source.html +1 -1
  29. package/SVF-doxygen/html/html/SVFStatements_8cpp_source.html +27 -27
  30. package/SVF-doxygen/html/html/SVFStatements_8h_source.html +6 -6
  31. package/SVF-doxygen/html/html/SVFVariables_8h_source.html +8 -8
  32. package/SVF-doxygen/html/html/SaberSVFGBuilder_8cpp_source.html +1 -1
  33. package/SVF-doxygen/html/html/SymbolTableBuilder_8cpp_source.html +23 -23
  34. package/SVF-doxygen/html/html/SymbolTableBuilder_8h_source.html +1 -1
  35. package/SVF-doxygen/html/html/SymbolTableInfo_8cpp_source.html +80 -84
  36. package/SVF-doxygen/html/html/SymbolTableInfo_8h_source.html +79 -77
  37. package/SVF-doxygen/html/html/ThreadCallGraph_8cpp_source.html +3 -3
  38. package/SVF-doxygen/html/html/TypeBasedHeapCloning_8cpp_source.html +5 -5
  39. package/SVF-doxygen/html/html/TypeBasedHeapCloning_8h_source.html +2 -2
  40. package/SVF-doxygen/html/html/VFGNode_8h_source.html +1 -1
  41. package/SVF-doxygen/html/html/VersionedFlowSensitiveStat_8cpp_source.html +3 -3
  42. package/SVF-doxygen/html/html/annotated.html +192 -193
  43. package/SVF-doxygen/html/html/classSVF_1_1AddrStmt-members.html +1 -1
  44. package/SVF-doxygen/html/html/classSVF_1_1AddrStmt.html +5 -5
  45. package/SVF-doxygen/html/html/classSVF_1_1AddrVFGNode.html +1 -1
  46. package/SVF-doxygen/html/html/classSVF_1_1AndersenBase.html +1 -1
  47. package/SVF-doxygen/html/html/classSVF_1_1AndersenSFR.html +3 -3
  48. package/SVF-doxygen/html/html/classSVF_1_1AssignStmt-members.html +1 -1
  49. package/SVF-doxygen/html/html/classSVF_1_1AssignStmt.html +4 -4
  50. package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +4 -4
  51. package/SVF-doxygen/html/html/classSVF_1_1BinaryOPStmt-members.html +1 -1
  52. package/SVF-doxygen/html/html/classSVF_1_1BinaryOPStmt.html +7 -7
  53. package/SVF-doxygen/html/html/classSVF_1_1BranchStmt-members.html +1 -1
  54. package/SVF-doxygen/html/html/classSVF_1_1BranchStmt.html +17 -17
  55. package/SVF-doxygen/html/html/classSVF_1_1BranchVFGNode.html +1 -1
  56. package/SVF-doxygen/html/html/classSVF_1_1CHGBuilder.html +1 -1
  57. package/SVF-doxygen/html/html/classSVF_1_1CallPE-members.html +1 -1
  58. package/SVF-doxygen/html/html/classSVF_1_1CallPE.html +5 -5
  59. package/SVF-doxygen/html/html/classSVF_1_1CmpStmt-members.html +1 -1
  60. package/SVF-doxygen/html/html/classSVF_1_1CmpStmt.html +7 -7
  61. package/SVF-doxygen/html/html/classSVF_1_1ConstraintGraph.html +3 -3
  62. package/SVF-doxygen/html/html/classSVF_1_1ContextDDA.html +3 -3
  63. package/SVF-doxygen/html/html/classSVF_1_1CopyStmt-members.html +1 -1
  64. package/SVF-doxygen/html/html/classSVF_1_1CopyStmt.html +5 -5
  65. package/SVF-doxygen/html/html/classSVF_1_1CopyVFGNode.html +1 -1
  66. package/SVF-doxygen/html/html/classSVF_1_1DDAVFSolver.html +1 -1
  67. package/SVF-doxygen/html/html/classSVF_1_1FlowDDA.html +2 -2
  68. package/SVF-doxygen/html/html/classSVF_1_1FlowSensitive.html +1 -1
  69. package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveStat.html +3 -3
  70. package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveTBHC.html +3 -3
  71. package/SVF-doxygen/html/html/classSVF_1_1GepObjVar.html +8 -8
  72. package/SVF-doxygen/html/html/classSVF_1_1GepStmt-members.html +1 -1
  73. package/SVF-doxygen/html/html/classSVF_1_1GepStmt.html +7 -7
  74. package/SVF-doxygen/html/html/classSVF_1_1GepVFGNode.html +1 -1
  75. package/SVF-doxygen/html/html/classSVF_1_1GepValVar.html +1 -1
  76. package/SVF-doxygen/html/html/classSVF_1_1IRGraph.html +4 -4
  77. package/SVF-doxygen/html/html/classSVF_1_1LoadStmt-members.html +1 -1
  78. package/SVF-doxygen/html/html/classSVF_1_1LoadStmt.html +5 -5
  79. package/SVF-doxygen/html/html/classSVF_1_1LoadVFGNode.html +1 -1
  80. package/SVF-doxygen/html/html/classSVF_1_1LocationSet.html +54 -54
  81. package/SVF-doxygen/html/html/classSVF_1_1MRGenerator.html +7 -7
  82. package/SVF-doxygen/html/html/classSVF_1_1MemObj.html +87 -87
  83. package/SVF-doxygen/html/html/classSVF_1_1MultiOpndStmt-members.html +1 -1
  84. package/SVF-doxygen/html/html/classSVF_1_1MultiOpndStmt.html +9 -9
  85. package/SVF-doxygen/html/html/classSVF_1_1NormalGepCGEdge.html +1 -1
  86. package/SVF-doxygen/html/html/classSVF_1_1ObjTypeInfo.html +88 -92
  87. package/SVF-doxygen/html/html/classSVF_1_1ObjVar.html +1 -1
  88. package/SVF-doxygen/html/html/classSVF_1_1PAGBuilderFromFile.html +2 -2
  89. package/SVF-doxygen/html/html/classSVF_1_1PTAStat.html +16 -16
  90. package/SVF-doxygen/html/html/classSVF_1_1PhiStmt-members.html +1 -1
  91. package/SVF-doxygen/html/html/classSVF_1_1PhiStmt.html +8 -8
  92. package/SVF-doxygen/html/html/classSVF_1_1PointerAnalysis.html +9 -9
  93. package/SVF-doxygen/html/html/classSVF_1_1RetPE-members.html +1 -1
  94. package/SVF-doxygen/html/html/classSVF_1_1RetPE.html +5 -5
  95. package/SVF-doxygen/html/html/classSVF_1_1SVFIR.html +22 -22
  96. package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder-members.html +61 -60
  97. package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +295 -243
  98. package/SVF-doxygen/html/html/classSVF_1_1SVFModule.html +1 -1
  99. package/SVF-doxygen/html/html/classSVF_1_1SVFStmt-members.html +1 -1
  100. package/SVF-doxygen/html/html/classSVF_1_1SVFStmt.html +17 -11
  101. package/SVF-doxygen/html/html/classSVF_1_1SaberSVFGBuilder.html +1 -1
  102. package/SVF-doxygen/html/html/classSVF_1_1SelectStmt-members.html +1 -1
  103. package/SVF-doxygen/html/html/classSVF_1_1SelectStmt.html +6 -6
  104. package/SVF-doxygen/html/html/classSVF_1_1StInfo-members.html +24 -23
  105. package/SVF-doxygen/html/html/classSVF_1_1StInfo.html +99 -64
  106. package/SVF-doxygen/html/html/classSVF_1_1StmtVFGNode.html +2 -2
  107. package/SVF-doxygen/html/html/classSVF_1_1StoreStmt-members.html +1 -1
  108. package/SVF-doxygen/html/html/classSVF_1_1StoreStmt.html +5 -5
  109. package/SVF-doxygen/html/html/classSVF_1_1StoreVFGNode.html +1 -1
  110. package/SVF-doxygen/html/html/classSVF_1_1SymbolTableBuilder.html +33 -33
  111. package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo-members.html +3 -3
  112. package/SVF-doxygen/html/html/classSVF_1_1SymbolTableInfo.html +126 -110
  113. package/SVF-doxygen/html/html/classSVF_1_1TDForkPE-members.html +1 -1
  114. package/SVF-doxygen/html/html/classSVF_1_1TDForkPE.html +5 -5
  115. package/SVF-doxygen/html/html/classSVF_1_1TDJoinPE-members.html +1 -1
  116. package/SVF-doxygen/html/html/classSVF_1_1TDJoinPE.html +5 -5
  117. package/SVF-doxygen/html/html/classSVF_1_1ThreadCallGraph.html +3 -3
  118. package/SVF-doxygen/html/html/classSVF_1_1TypeBasedHeapCloning.html +6 -6
  119. package/SVF-doxygen/html/html/classSVF_1_1UnaryOPStmt-members.html +1 -1
  120. package/SVF-doxygen/html/html/classSVF_1_1UnaryOPStmt.html +13 -13
  121. package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitiveStat.html +3 -3
  122. package/SVF-doxygen/html/html/classes.html +97 -98
  123. package/SVF-doxygen/html/html/functions_f.html +12 -18
  124. package/SVF-doxygen/html/html/functions_func_f.html +0 -3
  125. package/SVF-doxygen/html/html/functions_func_g.html +23 -24
  126. package/SVF-doxygen/html/html/functions_func_s.html +1 -1
  127. package/SVF-doxygen/html/html/functions_g.html +24 -25
  128. package/SVF-doxygen/html/html/functions_l.html +5 -5
  129. package/SVF-doxygen/html/html/functions_n.html +6 -6
  130. package/SVF-doxygen/html/html/functions_o.html +3 -3
  131. package/SVF-doxygen/html/html/functions_p.html +9 -9
  132. package/SVF-doxygen/html/html/functions_r.html +3 -5
  133. package/SVF-doxygen/html/html/functions_s.html +4 -4
  134. package/SVF-doxygen/html/html/functions_t.html +3 -3
  135. package/SVF-doxygen/html/html/functions_v.html +3 -3
  136. package/SVF-doxygen/html/html/functions_vars_f.html +3 -6
  137. package/SVF-doxygen/html/html/functions_w.html +9 -5
  138. package/SVF-doxygen/html/html/hierarchy.html +332 -333
  139. package/SVF-doxygen/html/html/namespaceSVF.html +0 -2
  140. package/SVF-doxygen/html/html/search/all_10.js +6 -6
  141. package/SVF-doxygen/html/html/search/all_12.js +2 -2
  142. package/SVF-doxygen/html/html/search/all_13.js +5 -5
  143. package/SVF-doxygen/html/html/search/all_14.js +3 -3
  144. package/SVF-doxygen/html/html/search/all_16.js +1 -1
  145. package/SVF-doxygen/html/html/search/all_17.js +1 -1
  146. package/SVF-doxygen/html/html/search/all_6.js +2 -4
  147. package/SVF-doxygen/html/html/search/all_7.js +6 -6
  148. package/SVF-doxygen/html/html/search/all_c.js +4 -4
  149. package/SVF-doxygen/html/html/search/all_d.js +2 -2
  150. package/SVF-doxygen/html/html/search/all_e.js +3 -3
  151. package/SVF-doxygen/html/html/search/all_f.js +1 -1
  152. package/SVF-doxygen/html/html/search/classes_5.js +0 -1
  153. package/SVF-doxygen/html/html/search/functions_10.js +2 -2
  154. package/SVF-doxygen/html/html/search/functions_5.js +0 -1
  155. package/SVF-doxygen/html/html/search/functions_6.js +6 -6
  156. package/SVF-doxygen/html/html/search/variables_14.js +1 -1
  157. package/SVF-doxygen/html/html/search/variables_6.js +2 -3
  158. package/SVF-doxygen/html/html/search/variables_d.js +2 -2
  159. package/SVF-doxygen/html/html/search/variables_e.js +1 -1
  160. package/SVF-doxygen/html/html/structstd_1_1hash_3_01SVF_1_1LocationSet_01_4.html +4 -4
  161. package/include/MemoryModel/LocationSet.h +0 -24
  162. package/include/MemoryModel/SVFIR.h +1 -1
  163. package/include/MemoryModel/SVFStatements.h +1 -1
  164. package/include/MemoryModel/SVFVariables.h +1 -1
  165. package/include/MemoryModel/SymbolTableInfo.h +17 -10
  166. package/include/SVF-FE/SVFIRBuilder.h +8 -4
  167. package/lib/Graphs/IRGraph.cpp +3 -3
  168. package/lib/MemoryModel/SVFStatements.cpp +7 -5
  169. package/lib/MemoryModel/SymbolTableInfo.cpp +56 -57
  170. package/lib/SVF-FE/SVFIRBuilder.cpp +52 -57
  171. package/lib/SVF-FE/SymbolTableBuilder.cpp +3 -3
  172. package/package.json +1 -1
@@ -82,7 +82,7 @@ Public Member Functions</h2></td></tr>
82
82
  struct std::hash&lt; SVF::LocationSet &gt;</h3>
83
83
 
84
84
 
85
- <p class="definition">Definition at line <a class="el" href="LocationSet_8h_source.html#l00162">162</a> of file <a class="el" href="LocationSet_8h_source.html">LocationSet.h</a>.</p>
85
+ <p class="definition">Definition at line <a class="el" href="LocationSet_8h_source.html#l00138">138</a> of file <a class="el" href="LocationSet_8h_source.html">LocationSet.h</a>.</p>
86
86
  </div><h2 class="groupheader">Member Function Documentation</h2>
87
87
  <a id="a701401db0e876205424e9cc797fb5984"></a>
88
88
  <h2 class="memtitle"><span class="permalink"><a href="#a701401db0e876205424e9cc797fb5984">&#9670;&nbsp;</a></span>operator()()</h2>
@@ -108,10 +108,10 @@ struct std::hash&lt; SVF::LocationSet &gt;</h3>
108
108
  </table>
109
109
  </div><div class="memdoc">
110
110
 
111
- <p class="definition">Definition at line <a class="el" href="LocationSet_8h_source.html#l00163">163</a> of file <a class="el" href="LocationSet_8h_source.html">LocationSet.h</a>.</p>
112
- <div class="fragment"><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; {</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; <a class="code" href="structSVF_1_1Hash.html">SVF::Hash&lt;std::pair&lt;SVF::NodeID, SVF::NodeID&gt;</a>&gt; h;</div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; std::hash&lt;SVF::LocationSet::OffsetValueVec&gt; v;</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; <span class="keywordflow">return</span> h(std::make_pair(ls.<a class="code" href="classSVF_1_1LocationSet.html#ab987c41ffdae931d941f89d03ed09146">accumulateConstantFieldIdx</a>(), v(ls.<a class="code" href="classSVF_1_1LocationSet.html#a5a5ca0b81da0b34ab426bc6a28ed346c">getOffsetValueVec</a>())));</div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; }</div><div class="ttc" id="classSVF_1_1LocationSet_html_ab987c41ffdae931d941f89d03ed09146"><div class="ttname"><a href="classSVF_1_1LocationSet.html#ab987c41ffdae931d941f89d03ed09146">SVF::LocationSet::accumulateConstantFieldIdx</a></div><div class="ttdeci">s64_t accumulateConstantFieldIdx() const</div><div class="ttdoc">Get methods. </div><div class="ttdef"><b>Definition:</b> <a href="LocationSet_8h_source.html#l00114">LocationSet.h:114</a></div></div>
111
+ <p class="definition">Definition at line <a class="el" href="LocationSet_8h_source.html#l00139">139</a> of file <a class="el" href="LocationSet_8h_source.html">LocationSet.h</a>.</p>
112
+ <div class="fragment"><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; {</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; <a class="code" href="structSVF_1_1Hash.html">SVF::Hash&lt;std::pair&lt;SVF::NodeID, SVF::NodeID&gt;</a>&gt; h;</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; std::hash&lt;SVF::LocationSet::OffsetValueVec&gt; v;</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <span class="keywordflow">return</span> h(std::make_pair(ls.<a class="code" href="classSVF_1_1LocationSet.html#ab987c41ffdae931d941f89d03ed09146">accumulateConstantFieldIdx</a>(), v(ls.<a class="code" href="classSVF_1_1LocationSet.html#a5a5ca0b81da0b34ab426bc6a28ed346c">getOffsetValueVec</a>())));</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; }</div><div class="ttc" id="classSVF_1_1LocationSet_html_ab987c41ffdae931d941f89d03ed09146"><div class="ttname"><a href="classSVF_1_1LocationSet.html#ab987c41ffdae931d941f89d03ed09146">SVF::LocationSet::accumulateConstantFieldIdx</a></div><div class="ttdeci">s64_t accumulateConstantFieldIdx() const</div><div class="ttdoc">Get methods. </div><div class="ttdef"><b>Definition:</b> <a href="LocationSet_8h_source.html#l00090">LocationSet.h:90</a></div></div>
113
113
  <div class="ttc" id="structSVF_1_1Hash_html"><div class="ttname"><a href="structSVF_1_1Hash.html">SVF::Hash</a></div><div class="ttdoc">provide extra hash function for std::pair handling </div><div class="ttdef"><b>Definition:</b> <a href="SVFBasicTypes_8h_source.html#l00052">SVFBasicTypes.h:52</a></div></div>
114
- <div class="ttc" id="classSVF_1_1LocationSet_html_a5a5ca0b81da0b34ab426bc6a28ed346c"><div class="ttname"><a href="classSVF_1_1LocationSet.html#a5a5ca0b81da0b34ab426bc6a28ed346c">SVF::LocationSet::getOffsetValueVec</a></div><div class="ttdeci">const OffsetValueVec &amp; getOffsetValueVec() const</div><div class="ttdef"><b>Definition:</b> <a href="LocationSet_8h_source.html#l00122">LocationSet.h:122</a></div></div>
114
+ <div class="ttc" id="classSVF_1_1LocationSet_html_a5a5ca0b81da0b34ab426bc6a28ed346c"><div class="ttname"><a href="classSVF_1_1LocationSet.html#a5a5ca0b81da0b34ab426bc6a28ed346c">SVF::LocationSet::getOffsetValueVec</a></div><div class="ttdeci">const OffsetValueVec &amp; getOffsetValueVec() const</div><div class="ttdef"><b>Definition:</b> <a href="LocationSet_8h_source.html#l00098">LocationSet.h:98</a></div></div>
115
115
  </div><!-- fragment -->
116
116
  </div>
117
117
  </div>
@@ -39,30 +39,6 @@
39
39
  namespace SVF
40
40
  {
41
41
 
42
- /*!
43
- * Field information of an aggregate object
44
- */
45
- class FlattenedFieldInfo
46
- {
47
- private:
48
- u32_t flattenedFldIdx;
49
- const Type* flattenedElemTy;
50
- public:
51
- FlattenedFieldInfo(u32_t idx, const Type* ty) :
52
- flattenedFldIdx(idx), flattenedElemTy(ty)
53
- {
54
- }
55
- inline u32_t getFlattenFldIdx() const
56
- {
57
- return flattenedFldIdx;
58
- }
59
- inline const Type* getFlattenElemTy() const
60
- {
61
- return flattenedElemTy;
62
- }
63
- };
64
-
65
-
66
42
  /*
67
43
  * Location set represents a set of locations in a memory block with following offsets:
68
44
  * { offset + \sum_{i=0}^N (stride_i * j_i) | 0 \leq j_i < M_i }
@@ -329,7 +329,7 @@ public:
329
329
  }
330
330
  inline SVFStmt* getIntraPAGEdge(SVFVar* src, SVFVar* dst, SVFStmt::PEDGEK kind)
331
331
  {
332
- SVFStmt edge(src,dst,kind);
332
+ SVFStmt edge(src,dst,kind, false);
333
333
  const SVFStmt::SVFStmtSetTy& edgeSet = getSVFStmtSet(kind);
334
334
  SVFStmt::SVFStmtSetTy::const_iterator it = edgeSet.find(&edge);
335
335
  assert(it != edgeSet.end() && "can not find pag edge");
@@ -65,7 +65,7 @@ public:
65
65
  static u32_t totalEdgeNum; ///< Total edge number
66
66
 
67
67
  /// Constructor
68
- SVFStmt(SVFVar* s, SVFVar* d, GEdgeFlag k);
68
+ SVFStmt(SVFVar* s, SVFVar* d, GEdgeFlag k, bool real=true);
69
69
  /// Destructor
70
70
  ~SVFStmt()
71
71
  {
@@ -503,7 +503,7 @@ public:
503
503
  /// Return the type of this gep object
504
504
  inline virtual const Type* getType() const
505
505
  {
506
- return SymbolTableInfo::SymbolInfo()->getOriginalFieldType(mem->getType(), ls.accumulateConstantFieldIdx());
506
+ return SymbolTableInfo::SymbolInfo()->getFlatternedElemType(mem->getType(), ls.accumulateConstantFieldIdx());
507
507
  }
508
508
 
509
509
  /// Return name of a LLVM value
@@ -358,13 +358,12 @@ public:
358
358
  /// Flatterned element idx of an array or struct by considering stride
359
359
  u32_t getFlattenedElemIdx(const Type *T, s64_t origId);
360
360
 
361
- const std::vector<FlattenedFieldInfo>& getFlattenedFieldInfoVec(const Type *T);
362
-
363
361
  /// struct A { int id; int salary; }; struct B { char name[20]; struct A a;} B b;
364
- /// OriginalFieldType of b with field_idx 1 : Struct A
365
- /// FlatternedFieldType of b with field_idx 1 : int
366
- const Type* getOriginalFieldType(const Type* baseType, u32_t field_idx);
367
- const Type* getFlatternedFieldType(const Type* baseType, u32_t field_idx);
362
+ /// OriginalElemType of b with field_idx 1 : Struct A
363
+ /// FlatternedElemType of b with field_idx 1 : int
364
+ const Type* getOriginalElemType(const Type* baseType, u32_t origId);
365
+ /// Return the type of a flattened element given a flattened index
366
+ const Type* getFlatternedElemType(const Type* baseType, u32_t flatten_idx);
368
367
  //@}
369
368
 
370
369
  /// Collect type info
@@ -381,6 +380,9 @@ public:
381
380
  virtual void dump();
382
381
 
383
382
  protected:
383
+ /// Return the flattened field type for struct type only
384
+ const std::vector<const Type*>& getFlattenFieldTypes(const StructType *T);
385
+
384
386
  /// Collect the struct info
385
387
  virtual void collectStructInfo(const StructType *T);
386
388
  /// Collect the array info
@@ -507,13 +509,15 @@ private:
507
509
  /// Types of all fields of a struct
508
510
  Map<u32_t, const Type*> fldIdx2TypeMap;
509
511
  /// All field infos after flattening a struct
510
- std::vector<FlattenedFieldInfo> finfo;
512
+ std::vector<const Type*> finfo;
511
513
  /// stride represents the number of repetitive elements if this StInfo represent an ArrayType. stride is 1 by default.
512
514
  u32_t stride;
513
515
  /// number of elements after flattenning (including array elements)
514
516
  u32_t numOfFlattenElements;
515
517
  /// number of fields after flattenning (ignoring array elements)
516
518
  u32_t numOfFlattenFields;
519
+ /// Type vector of fields
520
+ std::vector<const Type*> flattenElementTypes;
517
521
  /// Max field limit
518
522
  static u32_t maxFieldLimit;
519
523
 
@@ -545,8 +549,7 @@ public:
545
549
  /// OriginalFieldType of b with field_idx 1 : Struct A
546
550
  /// FlatternedFieldType of b with field_idx 1 : int
547
551
  //{@
548
- const Type* getOriginalFieldType(u32_t fldIdx);
549
- const Type* getFlatternedFieldType(u32_t fldIdx);
552
+ const Type* getOriginalElemType(u32_t fldIdx);
550
553
 
551
554
  inline std::vector<u32_t>& getFlattenedFieldIdxVec()
552
555
  {
@@ -556,7 +559,11 @@ public:
556
559
  {
557
560
  return elemIdxVec;
558
561
  }
559
- inline std::vector<FlattenedFieldInfo>& getFlattenedFieldInfoVec()
562
+ inline std::vector<const Type*>& getFlattenElementTypes()
563
+ {
564
+ return flattenElementTypes;
565
+ }
566
+ inline std::vector<const Type*>& getFlattenFieldTypes()
560
567
  {
561
568
  return finfo;
562
569
  }
@@ -205,16 +205,14 @@ public:
205
205
  // TODO: ignore here:
206
206
  }
207
207
  //}@
208
- /// Compute offset of a gep instruction or gep constant expression
209
- bool computeGepOffset(const User *V, LocationSet& ls);
210
-
208
+
211
209
  protected:
212
210
  /// Handle globals including (global variable and functions)
213
211
  //@{
214
212
  void visitGlobal(SVFModule* svfModule);
215
213
  void InitialGlobal(const GlobalVariable *gvar, Constant *C,
216
214
  u32_t offset);
217
- NodeID getGlobalVarField(const GlobalVariable *gvar, u32_t offset);
215
+ NodeID getGlobalVarField(const GlobalVariable *gvar, u32_t offset, Type* tpy);
218
216
  //@}
219
217
 
220
218
  /// Process constant expression
@@ -223,6 +221,12 @@ protected:
223
221
  /// Infer field index from byteoffset.
224
222
  u32_t inferFieldIdxFromByteOffset(const llvm::GEPOperator* gepOp, DataLayout *dl, LocationSet& ls, s64_t idx);
225
223
 
224
+ /// Compute offset of a gep instruction or gep constant expression
225
+ bool computeGepOffset(const User *V, LocationSet& ls);
226
+
227
+ /// Get the base value of (i8* src and i8* dst) for external argument (e.g. memcpy(i8* dst, i8* src, int size))
228
+ const Value* getBaseValueForExtArg(const Value* V);
229
+
226
230
  /// Get the base type and max offset
227
231
  const Type *getBaseTypeAndFlattenedFields(const Value *V, std::vector<LocationSet> &fields, const Value* sz);
228
232
 
@@ -58,7 +58,7 @@ bool IRGraph::addEdge(SVFVar* src, SVFVar* dst, SVFStmt* edge)
58
58
  */
59
59
  SVFStmt* IRGraph::hasNonlabeledEdge(SVFVar* src, SVFVar* dst, SVFStmt::PEDGEK kind)
60
60
  {
61
- SVFStmt edge(src,dst,kind);
61
+ SVFStmt edge(src,dst,kind, false);
62
62
  SVFStmt::SVFStmtSetTy::iterator it = KindToSVFStmtSetMap[kind].find(&edge);
63
63
  if (it != KindToSVFStmtSetMap[kind].end())
64
64
  {
@@ -72,7 +72,7 @@ SVFStmt* IRGraph::hasNonlabeledEdge(SVFVar* src, SVFVar* dst, SVFStmt::PEDGEK ki
72
72
  */
73
73
  SVFStmt* IRGraph::hasLabeledEdge(SVFVar* src, SVFVar* op1, SVFStmt::PEDGEK kind, const SVFVar* op2)
74
74
  {
75
- SVFStmt edge(src,op1,SVFStmt::makeEdgeFlagWithAddionalOpnd(kind,op2));
75
+ SVFStmt edge(src,op1,SVFStmt::makeEdgeFlagWithAddionalOpnd(kind,op2), false);
76
76
  SVFStmt::SVFStmtSetTy::iterator it = KindToSVFStmtSetMap[kind].find(&edge);
77
77
  if (it != KindToSVFStmtSetMap[kind].end())
78
78
  {
@@ -86,7 +86,7 @@ SVFStmt* IRGraph::hasLabeledEdge(SVFVar* src, SVFVar* op1, SVFStmt::PEDGEK kind,
86
86
  */
87
87
  SVFStmt* IRGraph::hasLabeledEdge(SVFVar* src, SVFVar* dst, SVFStmt::PEDGEK kind, const ICFGNode* callInst)
88
88
  {
89
- SVFStmt edge(src,dst,SVFStmt::makeEdgeFlagWithCallInst(kind,callInst));
89
+ SVFStmt edge(src,dst,SVFStmt::makeEdgeFlagWithCallInst(kind,callInst), false);
90
90
  SVFStmt::SVFStmtSetTy::iterator it = KindToSVFStmtSetMap[kind].find(&edge);
91
91
  if (it != KindToSVFStmtSetMap[kind].end())
92
92
  {
@@ -43,11 +43,13 @@ SVFStmt::Var2LabelMap SVFStmt::var2LabelMap;
43
43
  /*!
44
44
  * SVFStmt constructor
45
45
  */
46
- SVFStmt::SVFStmt(SVFVar* s, SVFVar* d, GEdgeFlag k) :
47
- GenericPAGEdgeTy(s,d,k),value(nullptr),basicBlock(nullptr),icfgNode(nullptr)
48
- {
49
- edgeId = SVFIR::getPAG()->getTotalEdgeNum();
50
- SVFIR::getPAG()->incEdgeNum();
46
+ SVFStmt::SVFStmt(SVFVar* s, SVFVar* d, GEdgeFlag k, bool real) :
47
+ GenericPAGEdgeTy(s,d,k),value(nullptr),basicBlock(nullptr),icfgNode(nullptr),edgeId(UINT_MAX)
48
+ {
49
+ if(real){
50
+ edgeId = SVFIR::getPAG()->getTotalEdgeNum();
51
+ SVFIR::getPAG()->incEdgeNum();
52
+ }
51
53
  }
52
54
 
53
55
  /*!
@@ -67,21 +67,13 @@ void StInfo::addFldWithType(u32_t fldIdx, const Type* type, u32_t elemIdx)
67
67
  /// OriginalFieldType of b with field_idx 1 : Struct A
68
68
  /// FlatternedFieldType of b with field_idx 1 : int
69
69
  //{@
70
- const Type* StInfo::getOriginalFieldType(u32_t fldIdx)
70
+ const Type* StInfo::getOriginalElemType(u32_t fldIdx)
71
71
  {
72
72
  Map<u32_t, const Type*>::const_iterator it = fldIdx2TypeMap.find(fldIdx);
73
73
  if(it!=fldIdx2TypeMap.end())
74
74
  return it->second;
75
75
  return nullptr;
76
76
  }
77
- const Type* StInfo::getFlatternedFieldType(u32_t fldIdx)
78
- {
79
- for(FlattenedFieldInfo& fallenedFld : finfo){
80
- if(fallenedFld.getFlattenFldIdx() == fldIdx)
81
- return fallenedFld.getFlattenElemTy();
82
- }
83
- return nullptr;
84
- }
85
77
 
86
78
  SymbolTableInfo::TypeToFieldInfoMap::iterator SymbolTableInfo::getStructInfoIter(const Type *T)
87
79
  {
@@ -158,8 +150,8 @@ void SymbolTableInfo::collectArrayInfo(const ArrayType* ty)
158
150
  if(totalElemNum==0){
159
151
  stinfo->addFldWithType(0, elemTy, 0);
160
152
  stinfo->setNumOfFieldsAndElems(1, 1);
161
- FlattenedFieldInfo field(0, elemTy);
162
- stinfo->getFlattenedFieldInfoVec().push_back(field);
153
+ stinfo->getFlattenFieldTypes().push_back(elemTy);
154
+ stinfo->getFlattenElementTypes().push_back(elemTy);
163
155
  return;
164
156
  }
165
157
 
@@ -169,10 +161,8 @@ void SymbolTableInfo::collectArrayInfo(const ArrayType* ty)
169
161
  u32_t nfE = elemStInfo->getNumOfFlattenFields();
170
162
  for (u32_t j = 0; j < nfE; j++)
171
163
  {
172
- u32_t idx = elemStInfo->getFlattenedFieldInfoVec()[j].getFlattenFldIdx();
173
- const Type* fieldTy = elemStInfo->getFlattenedFieldInfoVec()[j].getFlattenElemTy();
174
- FlattenedFieldInfo field(idx, fieldTy);
175
- stinfo->getFlattenedFieldInfoVec().push_back(field);
164
+ const Type* fieldTy = elemStInfo->getFlattenFieldTypes()[j];
165
+ stinfo->getFlattenFieldTypes().push_back(fieldTy);
176
166
  }
177
167
 
178
168
  /// Flatten arrays, map each array element index `i` to flattened index `(i * nfE * totalElemNum)/outArrayElemNum`
@@ -181,6 +171,13 @@ void SymbolTableInfo::collectArrayInfo(const ArrayType* ty)
181
171
  for(u32_t i = 0; i < outArrayElemNum; i++)
182
172
  stinfo->addFldWithType(0, elemTy, (i * nfE * totalElemNum)/outArrayElemNum);
183
173
 
174
+ for(u32_t i = 0; i < totalElemNum; i++){
175
+ for(u32_t j = 0; j < nfE; j++){
176
+ stinfo->getFlattenElementTypes().push_back(elemStInfo->getFlattenFieldTypes()[j]);
177
+ }
178
+ }
179
+
180
+ assert(stinfo->getFlattenElementTypes().size() == nfE * totalElemNum && "typeForArray size incorrect!!!");
184
181
  stinfo->setNumOfFieldsAndElems(nfE, nfE * totalElemNum);
185
182
  }
186
183
 
@@ -213,23 +210,27 @@ void SymbolTableInfo::collectStructInfo(const StructType *sty)
213
210
  //Copy ST's info, whose element 0 is the size of ST itself.
214
211
  for (u32_t j = 0; j < nfE; j++)
215
212
  {
216
- u32_t fldIdx = nf + subStinfo->getFlattenedFieldInfoVec()[j].getFlattenFldIdx();
217
- const Type* elemTy = subStinfo->getFlattenedFieldInfoVec()[j].getFlattenElemTy();
218
- FlattenedFieldInfo field(fldIdx, elemTy);
219
- stinfo->getFlattenedFieldInfoVec().push_back(field);
213
+ const Type* elemTy = subStinfo->getFlattenFieldTypes()[j];
214
+ stinfo->getFlattenFieldTypes().push_back(elemTy);
220
215
  }
221
216
  nf += nfE;
222
217
  strideOffset += nfE * subStinfo->getStride();
218
+ for(u32_t tpi = 0; tpi < subStinfo->getStride(); tpi++){
219
+ for(u32_t tpj = 0; tpj < nfE; tpj++){
220
+ stinfo->getFlattenElementTypes().push_back(subStinfo->getFlattenFieldTypes()[tpj]);
221
+ }
222
+ }
223
223
  }
224
224
  else //simple type
225
225
  {
226
- FlattenedFieldInfo field(nf, et);
227
- stinfo->getFlattenedFieldInfoVec().push_back(field);
228
226
  nf += 1;
229
227
  strideOffset += 1;
228
+ stinfo->getFlattenFieldTypes().push_back(et);
229
+ stinfo->getFlattenElementTypes().push_back(et);
230
230
  }
231
231
  }
232
232
 
233
+ assert(stinfo->getFlattenElementTypes().size() == strideOffset && "typeForStruct size incorrect!");
233
234
  stinfo->setNumOfFieldsAndElems(nf,strideOffset);
234
235
 
235
236
  //Record the size of the complete struct and update max_struct.
@@ -252,9 +253,8 @@ void SymbolTableInfo::collectSimpleTypeInfo(const Type* ty)
252
253
  /// Only one field
253
254
  stinfo->addFldWithType(0, ty, 0);
254
255
 
255
- FlattenedFieldInfo field(0, ty);
256
- stinfo->getFlattenedFieldInfoVec().push_back(field);
257
-
256
+ stinfo->getFlattenFieldTypes().push_back(ty);
257
+ stinfo->getFlattenElementTypes().push_back(ty);
258
258
  stinfo->setNumOfFieldsAndElems(1,1);
259
259
  }
260
260
 
@@ -353,11 +353,10 @@ bool SymbolTableInfo::isConstantObjSym(const Value *val)
353
353
  else
354
354
  {
355
355
  StInfo *stInfo = getStructInfo(v->getInitializer()->getType());
356
- const std::vector<FlattenedFieldInfo> &fields = stInfo->getFlattenedFieldInfoVec();
357
- for (std::vector<FlattenedFieldInfo>::const_iterator it = fields.begin(), eit = fields.end(); it != eit; ++it)
356
+ const std::vector<const Type*> &fields = stInfo->getFlattenFieldTypes();
357
+ for (std::vector<const Type*>::const_iterator it = fields.begin(), eit = fields.end(); it != eit; ++it)
358
358
  {
359
- const FlattenedFieldInfo &field = *it;
360
- const Type *elemTy = field.getFlattenElemTy();
359
+ const Type *elemTy = *it;
361
360
  assert(!SVFUtil::isa<FunctionType>(elemTy) && "Initializer of a global is a function?");
362
361
  if (SVFUtil::isa<PointerType>(elemTy))
363
362
  return false;
@@ -410,7 +409,7 @@ u32_t SymbolTableInfo::getFlattenedElemIdx(const Type *T, s64_t origId)
410
409
  {
411
410
  if(Options::ModelArrays){
412
411
  std::vector<u32_t>& so = getStructInfoIter(T)->second->getFlattenedElemIdxVec();
413
- assert ((unsigned)origId <= so.size() && !so.empty() && "Array index out of bounds, can't get flattened index!");
412
+ assert ((unsigned)origId <= so.size() && !so.empty() && "element index out of bounds, can't get flattened index!");
414
413
  return so[origId];
415
414
  }
416
415
  else{
@@ -427,18 +426,29 @@ u32_t SymbolTableInfo::getFlattenedElemIdx(const Type *T, s64_t origId)
427
426
  }
428
427
  }
429
428
 
430
- const std::vector<FlattenedFieldInfo>& SymbolTableInfo::getFlattenedFieldInfoVec(const Type *T)
429
+ const Type* SymbolTableInfo::getOriginalElemType(const Type* baseType, u32_t origId)
431
430
  {
432
- return getStructInfoIter(T)->second->getFlattenedFieldInfoVec();
431
+ return getStructInfoIter(baseType)->second->getOriginalElemType(origId);
433
432
  }
434
433
 
435
- const Type* SymbolTableInfo::getOriginalFieldType(const Type* baseType, u32_t field_idx)
436
- {
437
- return getStructInfoIter(baseType)->second->getOriginalFieldType(field_idx);
434
+ /// Return the type of a flattened element given a flattened index
435
+ const Type* SymbolTableInfo::getFlatternedElemType(const Type* baseType, u32_t flatten_idx){
436
+ if(Options::ModelArrays){
437
+ const std::vector<const Type*>& so = getStructInfoIter(baseType)->second->getFlattenElementTypes();
438
+ assert (flatten_idx <= so.size() && !so.empty() && "element index out of bounds, can't get element type!");
439
+ return so[flatten_idx];
440
+ }
441
+ else{
442
+ const std::vector<const Type*>& so = getStructInfoIter(baseType)->second->getFlattenFieldTypes();
443
+ assert (flatten_idx <= so.size() && !so.empty() && "element index out of bounds, can't get element type!");
444
+ return so[flatten_idx];
445
+ }
438
446
  }
439
447
 
440
- const Type* SymbolTableInfo::getFlatternedFieldType(const Type* baseType, u32_t field_idx){
441
- return getStructInfoIter(baseType)->second->getFlatternedFieldType(field_idx);
448
+
449
+ const std::vector<const Type*>& SymbolTableInfo::getFlattenFieldTypes(const StructType *T)
450
+ {
451
+ return getStructInfoIter(T)->second->getFlattenFieldTypes();
442
452
  }
443
453
 
444
454
  /*
@@ -462,15 +472,15 @@ void SymbolTableInfo::printFlattenFields(const Type* type)
462
472
  outs() <<" {Type: ";
463
473
  st->print(outs());
464
474
  outs() << "}\n";
465
- std::vector<FlattenedFieldInfo>& finfo = getStructInfo(st)->getFlattenedFieldInfoVec();
475
+ std::vector<const Type*>& finfo = getStructInfo(st)->getFlattenFieldTypes();
466
476
  int field_idx = 0;
467
- for(std::vector<FlattenedFieldInfo>::iterator it = finfo.begin(), eit = finfo.end();
477
+ for(std::vector<const Type*>::const_iterator it = finfo.begin(), eit = finfo.end();
468
478
  it!=eit; ++it, field_idx++)
469
479
  {
470
- outs() << " \tField_idx = " << (*it).getFlattenFldIdx();
480
+ outs() << " \tField_idx = " << field_idx;
471
481
  outs() << ", field type: ";
472
- (*it).getFlattenElemTy()->print(outs());
473
- outs() << ", field size: " << getTypeSizeInBytes((*it).getFlattenElemTy());
482
+ (*it)->print(outs());
483
+ outs() << ", field size: " << getTypeSizeInBytes((*it));
474
484
  outs() << "\n";
475
485
  }
476
486
  outs() << "\n";
@@ -625,22 +635,11 @@ bool ObjTypeInfo::isNonPtrFieldObj(const LocationSet& ls)
625
635
 
626
636
  if (SVFUtil::isa<StructType>(ety) || SVFUtil::isa<ArrayType>(ety))
627
637
  {
628
- bool hasIntersection = false;
629
- const vector<FlattenedFieldInfo> &infovec = SymbolTableInfo::SymbolInfo()->getFlattenedFieldInfoVec(ety);
630
- vector<FlattenedFieldInfo>::const_iterator it = infovec.begin();
631
- vector<FlattenedFieldInfo>::const_iterator eit = infovec.end();
632
- for (; it != eit; ++it)
633
- {
634
- const FlattenedFieldInfo& fieldLS = *it;
635
- if (ls.intersects(LocationSet(fieldLS.getFlattenFldIdx())))
636
- {
637
- hasIntersection = true;
638
- if (fieldLS.getFlattenElemTy()->isPointerTy())
639
- return false;
640
- }
641
- }
642
- //assert(hasIntersection && "cannot find field of specified offset");
643
- return true;
638
+ const Type* elemTy = SymbolTableInfo::SymbolInfo()->getFlatternedElemType(ety, ls.accumulateConstantFieldIdx());
639
+ if(elemTy->isPointerTy())
640
+ return false;
641
+ else
642
+ return true;
644
643
  }
645
644
  else
646
645
  {