svf-tools 1.0.615 → 1.0.617
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/AndersenPWC_8h_source.html +3 -3
- package/SVF-doxygen/html/html/AndersenSCD_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/AndersenSFR_8cpp_source.html +3 -3
- package/SVF-doxygen/html/html/AndersenWaveDiff_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/Andersen_8cpp_source.html +31 -31
- package/SVF-doxygen/html/html/Andersen_8h_source.html +5 -5
- package/SVF-doxygen/html/html/CFLBase_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ConsG_8h_source.html +3 -2
- package/SVF-doxygen/html/html/ContextDDA_8cpp_source.html +4 -4
- package/SVF-doxygen/html/html/ContextDDA_8h_source.html +4 -4
- package/SVF-doxygen/html/html/DDAStat_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/FlowDDA_8h_source.html +1 -1
- package/SVF-doxygen/html/html/FlowSensitive_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/FlowSensitive_8h_source.html +2 -2
- package/SVF-doxygen/html/html/GenericGraph_8h_source.html +3 -3
- package/SVF-doxygen/html/html/ICFGBuilder_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/ICFG_8h_source.html +3 -2
- package/SVF-doxygen/html/html/LLVMModule_8cpp_source.html +27 -26
- package/SVF-doxygen/html/html/LLVMModule_8h_source.html +27 -26
- package/SVF-doxygen/html/html/LLVMUtil_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/MTAAnnotator_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/MemRegion_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8cpp.html +0 -1
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8cpp_source.html +16 -20
- package/SVF-doxygen/html/html/PointerAnalysisImpl_8h_source.html +68 -69
- package/SVF-doxygen/html/html/SVFG_8h_source.html +2 -2
- package/SVF-doxygen/html/html/SVFIRBuilder_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/SVFIRBuilder_8h_source.html +1 -1
- package/SVF-doxygen/html/html/Steensgaard_8h_source.html +1 -1
- package/SVF-doxygen/html/html/SymbolTableBuilder_8cpp_source.html +2 -2
- package/SVF-doxygen/html/html/VFG_8h_source.html +3 -2
- package/SVF-doxygen/html/html/VersionedFlowSensitive_8cpp_source.html +1 -1
- package/SVF-doxygen/html/html/annotated.html +188 -189
- package/SVF-doxygen/html/html/classSVF_1_1Andersen-members.html +52 -53
- package/SVF-doxygen/html/html/classSVF_1_1Andersen.html +85 -87
- package/SVF-doxygen/html/html/classSVF_1_1AndersenBase-members.html +43 -44
- package/SVF-doxygen/html/html/classSVF_1_1AndersenBase.html +13 -14
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSCD-members.html +52 -53
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSCD.html +12 -14
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSFR-members.html +56 -57
- package/SVF-doxygen/html/html/classSVF_1_1AndersenSFR.html +6 -8
- package/SVF-doxygen/html/html/classSVF_1_1AndersenWaveDiff-members.html +53 -54
- package/SVF-doxygen/html/html/classSVF_1_1AndersenWaveDiff.html +9 -11
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl-members.html +27 -28
- package/SVF-doxygen/html/html/classSVF_1_1BVDataPTAImpl.html +96 -120
- package/SVF-doxygen/html/html/classSVF_1_1CFLAlias-members.html +33 -34
- package/SVF-doxygen/html/html/classSVF_1_1CFLAlias.html +2 -4
- package/SVF-doxygen/html/html/classSVF_1_1CFLBase-members.html +31 -32
- package/SVF-doxygen/html/html/classSVF_1_1CFLBase.html +4 -6
- package/SVF-doxygen/html/html/classSVF_1_1CFLGraph-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CFLGraph.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1CFLVF-members.html +34 -35
- package/SVF-doxygen/html/html/classSVF_1_1CFLVF.html +2 -4
- package/SVF-doxygen/html/html/classSVF_1_1CHGraph-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1CHGraph.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1CondPTAImpl.html +110 -110
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintGraph-members.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1ConstraintGraph.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1ContextDDA.html +8 -8
- package/SVF-doxygen/html/html/classSVF_1_1DCHGraph-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1DCHGraph.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1DDAStat.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1FSMPTA-members.html +60 -61
- package/SVF-doxygen/html/html/classSVF_1_1FSMPTA.html +2 -4
- package/SVF-doxygen/html/html/classSVF_1_1FlowDDA-members.html +47 -48
- package/SVF-doxygen/html/html/classSVF_1_1FlowDDA.html +4 -6
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitive-members.html +56 -57
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitive.html +21 -23
- package/SVF-doxygen/html/html/classSVF_1_1FlowSensitiveStat.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1GenericGraph-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1GenericGraph.html +8 -8
- package/SVF-doxygen/html/html/classSVF_1_1ICFG-members.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1ICFG.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1ICFGBuilder.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1IRGraph-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1IRGraph.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1LLVMModuleSet-members.html +82 -81
- package/SVF-doxygen/html/html/classSVF_1_1LLVMModuleSet.html +139 -102
- package/SVF-doxygen/html/html/classSVF_1_1MRGenerator.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1MTAAnnotator.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1PTACallGraph-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1PTACallGraph.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1RaceResultValidator.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1SVFG-members.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1SVFG.html +8 -8
- package/SVF-doxygen/html/html/classSVF_1_1SVFGOPT-members.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1SVFGOPT.html +7 -7
- package/SVF-doxygen/html/html/classSVF_1_1SVFIR-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1SVFIR.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1SVFIRBuilder.html +7 -7
- package/SVF-doxygen/html/html/classSVF_1_1SVFType.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1Steensgaard-members.html +46 -47
- package/SVF-doxygen/html/html/classSVF_1_1Steensgaard.html +5 -7
- package/SVF-doxygen/html/html/classSVF_1_1SymbolTableBuilder.html +3 -3
- package/SVF-doxygen/html/html/classSVF_1_1TCT-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1TCT.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1ThreadCallGraph-members.html +1 -1
- package/SVF-doxygen/html/html/classSVF_1_1ThreadCallGraph.html +4 -4
- package/SVF-doxygen/html/html/classSVF_1_1TypeAnalysis-members.html +47 -48
- package/SVF-doxygen/html/html/classSVF_1_1TypeAnalysis.html +2 -4
- package/SVF-doxygen/html/html/classSVF_1_1VFG-members.html +2 -2
- package/SVF-doxygen/html/html/classSVF_1_1VFG.html +9 -9
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitive-members.html +76 -77
- package/SVF-doxygen/html/html/classSVF_1_1VersionedFlowSensitive.html +3 -5
- package/SVF-doxygen/html/html/classes.html +99 -99
- package/SVF-doxygen/html/html/dir_967d846b666a902c6ca9bc5c37976e49.html +0 -2
- package/SVF-doxygen/html/html/files.html +5 -6
- package/SVF-doxygen/html/html/functions_0x7e.html +0 -3
- package/SVF-doxygen/html/html/functions_a.html +9 -15
- package/SVF-doxygen/html/html/functions_b.html +5 -2
- package/SVF-doxygen/html/html/functions_c.html +1 -1
- package/SVF-doxygen/html/html/functions_func.html +11 -17
- package/SVF-doxygen/html/html/functions_func_0x7e.html +0 -3
- package/SVF-doxygen/html/html/functions_func_b.html +4 -1
- package/SVF-doxygen/html/html/functions_func_g.html +8 -11
- package/SVF-doxygen/html/html/functions_func_i.html +7 -10
- package/SVF-doxygen/html/html/functions_func_p.html +2 -29
- package/SVF-doxygen/html/html/functions_func_r.html +3 -9
- package/SVF-doxygen/html/html/functions_func_w.html +5 -8
- package/SVF-doxygen/html/html/functions_g.html +14 -17
- package/SVF-doxygen/html/html/functions_i.html +15 -18
- package/SVF-doxygen/html/html/functions_m.html +1 -4
- package/SVF-doxygen/html/html/functions_o.html +12 -12
- package/SVF-doxygen/html/html/functions_p.html +17 -45
- package/SVF-doxygen/html/html/functions_r.html +3 -11
- package/SVF-doxygen/html/html/functions_s.html +17 -15
- package/SVF-doxygen/html/html/functions_t.html +3 -3
- package/SVF-doxygen/html/html/functions_type_c.html +1 -1
- package/SVF-doxygen/html/html/functions_type_i.html +2 -2
- package/SVF-doxygen/html/html/functions_type_v.html +1 -1
- package/SVF-doxygen/html/html/functions_v.html +7 -7
- package/SVF-doxygen/html/html/functions_vars_m.html +0 -3
- package/SVF-doxygen/html/html/functions_vars_p.html +0 -3
- package/SVF-doxygen/html/html/functions_w.html +4 -7
- package/SVF-doxygen/html/html/hierarchy.html +194 -195
- package/SVF-doxygen/html/html/include_2MTA_2MTAResultValidator_8h_source.html +1 -1
- package/SVF-doxygen/html/html/namespaceSVF.html +0 -2
- package/SVF-doxygen/html/html/search/all_1.js +0 -2
- package/SVF-doxygen/html/html/search/all_10.js +6 -16
- package/SVF-doxygen/html/html/search/all_11.js +1 -3
- package/SVF-doxygen/html/html/search/all_12.js +12 -12
- package/SVF-doxygen/html/html/search/all_13.js +3 -3
- package/SVF-doxygen/html/html/search/all_15.js +4 -4
- package/SVF-doxygen/html/html/search/all_16.js +2 -3
- package/SVF-doxygen/html/html/search/all_19.js +0 -1
- package/SVF-doxygen/html/html/search/all_2.js +1 -0
- package/SVF-doxygen/html/html/search/all_3.js +2 -2
- package/SVF-doxygen/html/html/search/all_7.js +0 -1
- package/SVF-doxygen/html/html/search/all_9.js +6 -8
- package/SVF-doxygen/html/html/search/all_c.js +1 -1
- package/SVF-doxygen/html/html/search/all_d.js +3 -4
- package/SVF-doxygen/html/html/search/all_e.js +1 -1
- package/SVF-doxygen/html/html/search/all_f.js +3 -3
- package/SVF-doxygen/html/html/search/classes_8.js +0 -1
- package/SVF-doxygen/html/html/search/files_7.js +0 -1
- package/SVF-doxygen/html/html/search/functions_0.js +0 -2
- package/SVF-doxygen/html/html/search/functions_1.js +1 -0
- package/SVF-doxygen/html/html/search/functions_10.js +0 -2
- package/SVF-doxygen/html/html/search/functions_11.js +1 -1
- package/SVF-doxygen/html/html/search/functions_15.js +1 -2
- package/SVF-doxygen/html/html/search/functions_17.js +0 -1
- package/SVF-doxygen/html/html/search/functions_6.js +0 -1
- package/SVF-doxygen/html/html/search/functions_8.js +1 -2
- package/SVF-doxygen/html/html/search/functions_d.js +1 -1
- package/SVF-doxygen/html/html/search/functions_f.js +0 -9
- package/SVF-doxygen/html/html/search/typedefs_13.js +1 -1
- package/SVF-doxygen/html/html/search/typedefs_2.js +1 -1
- package/SVF-doxygen/html/html/search/typedefs_7.js +3 -3
- package/SVF-doxygen/html/html/search/variables_10.js +0 -1
- package/SVF-doxygen/html/html/search/variables_13.js +2 -2
- package/SVF-doxygen/html/html/search/variables_d.js +0 -1
- package/SVF-doxygen/html/html/tools_2MTA_2MTAResultValidator_8h_source.html +1 -1
- package/include/Graphs/ConsG.h +1 -1
- package/include/Graphs/GenericGraph.h +1 -1
- package/include/Graphs/ICFG.h +1 -1
- package/include/Graphs/VFG.h +1 -1
- package/include/MemoryModel/PointerAnalysisImpl.h +1 -2
- package/include/SVF-LLVM/LLVMModule.h +1 -0
- package/lib/MemoryModel/PointerAnalysisImpl.cpp +87 -63
- package/lib/SVF-LLVM/LLVMModule.cpp +11 -2
- package/lib/WPA/Andersen.cpp +9 -2
- package/package.json +1 -1
- package/include/SVF-LLVM/IRAnnotator.h +0 -324
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
|
|
32
32
|
#include "MemoryModel/PointerAnalysisImpl.h"
|
|
33
33
|
#include "Util/Options.h"
|
|
34
|
-
#include "SVF-LLVM/IRAnnotator.h"
|
|
35
34
|
#include <fstream>
|
|
36
35
|
#include <sstream>
|
|
37
36
|
|
|
@@ -159,6 +158,42 @@ void BVDataPTAImpl::remapPointsToSets(void)
|
|
|
159
158
|
getPTDataTy()->remapAllPts();
|
|
160
159
|
}
|
|
161
160
|
|
|
161
|
+
void BVDataPTAImpl::writeObjVarToFile(const string& filename)
|
|
162
|
+
{
|
|
163
|
+
outs() << "Storing ObjVar to '" << filename << "'...";
|
|
164
|
+
error_code err;
|
|
165
|
+
std::fstream f(filename.c_str(), std::ios_base::out);
|
|
166
|
+
if (!f.good())
|
|
167
|
+
{
|
|
168
|
+
outs() << " error opening file for writing!\n";
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Write BaseNodes insensitivity to file
|
|
173
|
+
NodeBS NodeIDs;
|
|
174
|
+
for (auto it = pag->begin(), ie = pag->end(); it != ie; ++it)
|
|
175
|
+
{
|
|
176
|
+
PAGNode* pagNode = it->second;
|
|
177
|
+
if (!isa<ObjVar>(pagNode)) continue;
|
|
178
|
+
NodeID n = pag->getBaseObjVar(it->first);
|
|
179
|
+
if (NodeIDs.test(n)) continue;
|
|
180
|
+
f << n << " ";
|
|
181
|
+
f << isFieldInsensitive(n) << "\n";
|
|
182
|
+
NodeIDs.set(n);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
f << "------\n";
|
|
186
|
+
|
|
187
|
+
// Job finish and close file
|
|
188
|
+
f.close();
|
|
189
|
+
if (f.good())
|
|
190
|
+
{
|
|
191
|
+
outs() << "\n";
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
}
|
|
196
|
+
|
|
162
197
|
/*!
|
|
163
198
|
* Store pointer analysis result into a file.
|
|
164
199
|
* It includes the points-to relations, and all SVFIR nodes including those
|
|
@@ -166,12 +201,11 @@ void BVDataPTAImpl::remapPointsToSets(void)
|
|
|
166
201
|
*/
|
|
167
202
|
void BVDataPTAImpl::writeToFile(const string& filename)
|
|
168
203
|
{
|
|
169
|
-
writeToModule();
|
|
170
204
|
|
|
171
205
|
outs() << "Storing pointer analysis results to '" << filename << "'...";
|
|
172
206
|
|
|
173
207
|
error_code err;
|
|
174
|
-
std::fstream f(filename.c_str(), std::ios_base::
|
|
208
|
+
std::fstream f(filename.c_str(), std::ios_base::app);
|
|
175
209
|
if (!f.good())
|
|
176
210
|
{
|
|
177
211
|
outs() << " error opening file for writing!\n";
|
|
@@ -200,20 +234,8 @@ void BVDataPTAImpl::writeToFile(const string& filename)
|
|
|
200
234
|
f << "}\n";
|
|
201
235
|
}
|
|
202
236
|
|
|
203
|
-
// Write BaseNodes insensitivity to file
|
|
204
|
-
NodeBS NodeIDs;
|
|
205
|
-
for (auto it = pag->begin(), ie = pag->end(); it != ie; ++it)
|
|
206
|
-
{
|
|
207
|
-
PAGNode* pagNode = it->second;
|
|
208
|
-
if (!isa<ObjVar>(pagNode)) continue;
|
|
209
|
-
NodeID n = pag->getBaseObjVar(it->first);
|
|
210
|
-
if (NodeIDs.test(n)) continue;
|
|
211
|
-
f << n << " ";
|
|
212
|
-
f << isFieldInsensitive(n) << "\n";
|
|
213
|
-
NodeIDs.set(n);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
237
|
f << "------\n";
|
|
238
|
+
|
|
217
239
|
// Write GepPAGNodes to file
|
|
218
240
|
for (auto it = pag->begin(), ie = pag->end(); it != ie; ++it)
|
|
219
241
|
{
|
|
@@ -226,6 +248,21 @@ void BVDataPTAImpl::writeToFile(const string& filename)
|
|
|
226
248
|
}
|
|
227
249
|
}
|
|
228
250
|
|
|
251
|
+
f << "------\n";
|
|
252
|
+
|
|
253
|
+
// Write BaseNodes insensitivity to file
|
|
254
|
+
NodeBS NodeIDs;
|
|
255
|
+
for (auto it = pag->begin(), ie = pag->end(); it != ie; ++it)
|
|
256
|
+
{
|
|
257
|
+
PAGNode* pagNode = it->second;
|
|
258
|
+
if (!isa<ObjVar>(pagNode)) continue;
|
|
259
|
+
NodeID n = pag->getBaseObjVar(it->first);
|
|
260
|
+
if (NodeIDs.test(n)) continue;
|
|
261
|
+
f << n << " ";
|
|
262
|
+
f << isFieldInsensitive(n) << "\n";
|
|
263
|
+
NodeIDs.set(n);
|
|
264
|
+
}
|
|
265
|
+
|
|
229
266
|
// Job finish and close file
|
|
230
267
|
f.close();
|
|
231
268
|
if (f.good())
|
|
@@ -242,12 +279,6 @@ void BVDataPTAImpl::writeToFile(const string& filename)
|
|
|
242
279
|
*/
|
|
243
280
|
bool BVDataPTAImpl::readFromFile(const string& filename)
|
|
244
281
|
{
|
|
245
|
-
// If the module annotations are available, read from there instead
|
|
246
|
-
auto mainModule = SVF::LLVMModuleSet::getLLVMModuleSet()->getMainLLVMModule();
|
|
247
|
-
if (mainModule->getNamedMetadata("SVFIR-Annotated") != nullptr)
|
|
248
|
-
{
|
|
249
|
-
return readFromModule();
|
|
250
|
-
}
|
|
251
282
|
|
|
252
283
|
outs() << "Loading pointer analysis results from '" << filename << "'...";
|
|
253
284
|
|
|
@@ -258,9 +289,24 @@ bool BVDataPTAImpl::readFromFile(const string& filename)
|
|
|
258
289
|
return false;
|
|
259
290
|
}
|
|
260
291
|
|
|
292
|
+
// Read ObjVar
|
|
293
|
+
string line;
|
|
294
|
+
while (F.good())
|
|
295
|
+
{
|
|
296
|
+
getline(F, line);
|
|
297
|
+
if (line == "------") break;
|
|
298
|
+
// Parse a single line in the form of "baseNodeID insensitive"
|
|
299
|
+
istringstream ss(line);
|
|
300
|
+
NodeID base;
|
|
301
|
+
bool insensitive;
|
|
302
|
+
ss >> base >> insensitive;
|
|
303
|
+
|
|
304
|
+
if (insensitive)
|
|
305
|
+
setObjFieldInsensitive(base);
|
|
306
|
+
}
|
|
307
|
+
|
|
261
308
|
// Read analysis results from file
|
|
262
309
|
PTDataTy *ptD = getPTDataTy();
|
|
263
|
-
string line;
|
|
264
310
|
|
|
265
311
|
// Read points-to sets
|
|
266
312
|
string delimiter1 = " -> { ";
|
|
@@ -272,6 +318,7 @@ bool BVDataPTAImpl::readFromFile(const string& filename)
|
|
|
272
318
|
{
|
|
273
319
|
// Parse a single line in the form of "var -> { obj1 obj2 obj3 }"
|
|
274
320
|
getline(F, line);
|
|
321
|
+
if (line == "------") break;
|
|
275
322
|
size_t pos = line.find(delimiter1);
|
|
276
323
|
if (pos == string::npos) break;
|
|
277
324
|
if (line.back() != '}') break;
|
|
@@ -307,26 +354,11 @@ bool BVDataPTAImpl::readFromFile(const string& filename)
|
|
|
307
354
|
for (auto t: nodePtsMap)
|
|
308
355
|
ptD->unionPts(t.first, strPtsMap[t.second]);
|
|
309
356
|
|
|
310
|
-
// Read SVFIR offset nodes
|
|
311
|
-
while (F.good())
|
|
312
|
-
{
|
|
313
|
-
if (line == "------") break;
|
|
314
|
-
// Parse a single line in the form of "baseNodeID insensitive"
|
|
315
|
-
istringstream ss(line);
|
|
316
|
-
NodeID base;
|
|
317
|
-
bool insensitive;
|
|
318
|
-
ss >> base >> insensitive;
|
|
319
|
-
|
|
320
|
-
if (insensitive)
|
|
321
|
-
setObjFieldInsensitive(base);
|
|
322
|
-
|
|
323
|
-
getline(F, line);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
357
|
// Read BaseNode insensitivity
|
|
327
358
|
while (F.good())
|
|
328
359
|
{
|
|
329
360
|
getline(F, line);
|
|
361
|
+
if (line == "------") break;
|
|
330
362
|
// Parse a single line in the form of "ID baseNodeID offset"
|
|
331
363
|
istringstream ss(line);
|
|
332
364
|
NodeID id;
|
|
@@ -339,6 +371,22 @@ bool BVDataPTAImpl::readFromFile(const string& filename)
|
|
|
339
371
|
assert(matched && "Error adding GepObjNode into SVFIR!");
|
|
340
372
|
}
|
|
341
373
|
|
|
374
|
+
// //update ObjVar status
|
|
375
|
+
while (F.good())
|
|
376
|
+
{
|
|
377
|
+
getline(F, line);
|
|
378
|
+
if (line.empty())
|
|
379
|
+
break;
|
|
380
|
+
// Parse a single line in the form of "baseNodeID insensitive"
|
|
381
|
+
istringstream ss(line);
|
|
382
|
+
NodeID base;
|
|
383
|
+
bool insensitive;
|
|
384
|
+
ss >> base >> insensitive;
|
|
385
|
+
|
|
386
|
+
if (insensitive)
|
|
387
|
+
setObjFieldInsensitive(base);
|
|
388
|
+
}
|
|
389
|
+
|
|
342
390
|
// Update callgraph
|
|
343
391
|
updateCallGraph(pag->getIndirectCallsites());
|
|
344
392
|
|
|
@@ -348,30 +396,6 @@ bool BVDataPTAImpl::readFromFile(const string& filename)
|
|
|
348
396
|
return true;
|
|
349
397
|
}
|
|
350
398
|
|
|
351
|
-
/*!
|
|
352
|
-
* Store pointer analysis result into the current LLVM module as metadata.
|
|
353
|
-
* It includes the points-to relations, and all SVFIR nodes including those
|
|
354
|
-
* created when solving Andersen's constraints.
|
|
355
|
-
*/
|
|
356
|
-
void BVDataPTAImpl::writeToModule()
|
|
357
|
-
{
|
|
358
|
-
auto irAnnotator = std::make_unique<IRAnnotator>();
|
|
359
|
-
|
|
360
|
-
irAnnotator->processAndersenResults(pag, this, true);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/*!
|
|
364
|
-
* Load pointer analysis result from the metadata in the module.
|
|
365
|
-
* It populates BVDataPTAImpl with the points-to data, and updates SVFIR with
|
|
366
|
-
* the SVFIR offset nodes created during Andersen's solving stage.
|
|
367
|
-
*/
|
|
368
|
-
bool BVDataPTAImpl::readFromModule()
|
|
369
|
-
{
|
|
370
|
-
auto irAnnotator = std::make_unique<IRAnnotator>();
|
|
371
|
-
irAnnotator->processAndersenResults(pag, this, false);
|
|
372
|
-
return true;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
399
|
/*!
|
|
376
400
|
* Dump points-to of each pag node
|
|
377
401
|
*/
|
|
@@ -83,10 +83,15 @@ LLVMModuleSet::~LLVMModuleSet()
|
|
|
83
83
|
|
|
84
84
|
SVFModule* LLVMModuleSet::buildSVFModule(Module &mod)
|
|
85
85
|
{
|
|
86
|
+
double startSVFModuleTime = SVFStat::getClk(true);
|
|
86
87
|
svfModule = std::make_unique<SVFModule>(mod.getModuleIdentifier());
|
|
87
88
|
modules.emplace_back(mod);
|
|
88
89
|
|
|
89
90
|
build();
|
|
91
|
+
double endSVFModuleTime = SVFStat::getClk(true);
|
|
92
|
+
SVFStat::timeOfBuildingLLVMModule = (endSVFModuleTime - startSVFModuleTime)/TIMEINTERVAL;
|
|
93
|
+
|
|
94
|
+
build_symbol_table();
|
|
90
95
|
|
|
91
96
|
return svfModule.get();
|
|
92
97
|
}
|
|
@@ -109,6 +114,12 @@ SVFModule* LLVMModuleSet::buildSVFModule(const std::vector<std::string> &moduleN
|
|
|
109
114
|
double endSVFModuleTime = SVFStat::getClk(true);
|
|
110
115
|
SVFStat::timeOfBuildingLLVMModule = (endSVFModuleTime - startSVFModuleTime)/TIMEINTERVAL;
|
|
111
116
|
|
|
117
|
+
build_symbol_table();
|
|
118
|
+
|
|
119
|
+
return svfModule.get();
|
|
120
|
+
}
|
|
121
|
+
void LLVMModuleSet::build_symbol_table() const
|
|
122
|
+
{
|
|
112
123
|
double startSymInfoTime = SVFStat::getClk(true);
|
|
113
124
|
if (!SVFModule::pagReadFromTXT())
|
|
114
125
|
{
|
|
@@ -119,8 +130,6 @@ SVFModule* LLVMModuleSet::buildSVFModule(const std::vector<std::string> &moduleN
|
|
|
119
130
|
}
|
|
120
131
|
double endSymInfoTime = SVFStat::getClk(true);
|
|
121
132
|
SVFStat::timeOfBuildingSymbolTable = (endSymInfoTime - startSymInfoTime)/TIMEINTERVAL;
|
|
122
|
-
|
|
123
|
-
return svfModule.get();
|
|
124
133
|
}
|
|
125
134
|
|
|
126
135
|
void LLVMModuleSet::build()
|
package/lib/WPA/Andersen.cpp
CHANGED
|
@@ -113,6 +113,9 @@ void AndersenBase::analyze()
|
|
|
113
113
|
PointerAnalysis::finalize();
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
if (!Options::WriteAnder.empty())
|
|
117
|
+
this->writeObjVarToFile(Options::WriteAnder);
|
|
118
|
+
|
|
116
119
|
if(!readResultsFromFile)
|
|
117
120
|
{
|
|
118
121
|
// Start solving constraints
|
|
@@ -142,12 +145,16 @@ void AndersenBase::analyze()
|
|
|
142
145
|
|
|
143
146
|
DBOUT(DGENERAL, outs() << SVFUtil::pasMsg("Finish Solving Constraints\n"));
|
|
144
147
|
|
|
145
|
-
// Finalize the analysis
|
|
146
|
-
finalize();
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
if (!Options::WriteAnder.empty())
|
|
151
|
+
{
|
|
150
152
|
this->writeToFile(Options::WriteAnder);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (!readResultsFromFile)
|
|
156
|
+
// Finalize the analysis
|
|
157
|
+
finalize();
|
|
151
158
|
}
|
|
152
159
|
|
|
153
160
|
void AndersenBase::cleanConsCG(NodeID id)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.617",
|
|
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": {
|
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Annotator.h
|
|
3
|
-
*
|
|
4
|
-
* Created on: March 22, 2021
|
|
5
|
-
* Author: Nicholas Tsom
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#ifndef IRANNOTATOR_H_
|
|
9
|
-
#define IRANNOTATOR_H_
|
|
10
|
-
|
|
11
|
-
#include "llvm/IR/InlineAsm.h"
|
|
12
|
-
#include "SVFIR/SVFIR.h"
|
|
13
|
-
#include "MemoryModel/PointerAnalysisImpl.h"
|
|
14
|
-
#include "Util/SVFUtil.h"
|
|
15
|
-
#include "llvm/IR/Metadata.h"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
namespace SVF
|
|
19
|
-
{
|
|
20
|
-
/*!
|
|
21
|
-
* Program annotator to write metadata information on LLVM IR
|
|
22
|
-
*/
|
|
23
|
-
class IRAnnotator
|
|
24
|
-
{
|
|
25
|
-
public:
|
|
26
|
-
IRAnnotator():
|
|
27
|
-
mainModule(nullptr),
|
|
28
|
-
ptsTo(nullptr)
|
|
29
|
-
{}
|
|
30
|
-
~IRAnnotator() {}
|
|
31
|
-
|
|
32
|
-
void processAndersenResults(SVFIR *pag, BVDataPTAImpl *ptsTo, bool writeFlag)
|
|
33
|
-
{
|
|
34
|
-
this->ptsTo = ptsTo;
|
|
35
|
-
mainModule = LLVMModuleSet::getLLVMModuleSet()->getMainLLVMModule();
|
|
36
|
-
|
|
37
|
-
// Add a named metadata node used to check whether or not
|
|
38
|
-
// this IR has been annotated with Andersen information
|
|
39
|
-
if (writeFlag)
|
|
40
|
-
mainModule->getOrInsertNamedMetadata("SVFIR-Annotated");
|
|
41
|
-
|
|
42
|
-
for (auto it = pag->begin(); it != pag->end(); ++it)
|
|
43
|
-
{
|
|
44
|
-
auto nodeId = it->first;
|
|
45
|
-
auto pagNode = it->second;
|
|
46
|
-
auto gepNode = SVFUtil::dyn_cast<GepObjVar>(pagNode);
|
|
47
|
-
|
|
48
|
-
if (gepNode && writeFlag)
|
|
49
|
-
{
|
|
50
|
-
writePAGgepNode(nodeId, gepNode);
|
|
51
|
-
}
|
|
52
|
-
else if (pagNode->hasValue())
|
|
53
|
-
{
|
|
54
|
-
const Value* val = LLVMModuleSet::getLLVMModuleSet()->getLLVMValue(pagNode->getValue());
|
|
55
|
-
processPAGNode(val, nodeId, writeFlag);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (!writeFlag)
|
|
60
|
-
readPAGgepNodes(pag);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
private:
|
|
64
|
-
// Write the PAGgepNode to the IR such that metadata name is the SVFIR node id and the operands
|
|
65
|
-
// are its base node's id and location offset
|
|
66
|
-
void writePAGgepNode(SVF::NodeID nodeId, GepObjVar* gepNode)
|
|
67
|
-
{
|
|
68
|
-
auto baseNodeId = gepNode->getBaseNode();
|
|
69
|
-
auto locationSetOffset = gepNode->getConstantFieldIdx();
|
|
70
|
-
|
|
71
|
-
LLVMContext &context = mainModule->getContext();
|
|
72
|
-
llvm::SmallVector<llvm::Metadata *, 32> operands;
|
|
73
|
-
operands.push_back(llvm::MDString::get(context, std::to_string(baseNodeId)));
|
|
74
|
-
operands.push_back(llvm::MDString::get(context, std::to_string(locationSetOffset)));
|
|
75
|
-
|
|
76
|
-
llvm::MDTuple *metadata = llvm::MDTuple::get(context, operands);
|
|
77
|
-
std::string label = "gepnode-" + std::to_string(nodeId);
|
|
78
|
-
|
|
79
|
-
mainModule->getOrInsertNamedMetadata(label)->addOperand(metadata);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Reads the PAGGepNodes in the annotated IR and creates a new SVFIR Node based on the
|
|
83
|
-
// data contained in the operands of the metadata node
|
|
84
|
-
void readPAGgepNodes(SVFIR *pag)
|
|
85
|
-
{
|
|
86
|
-
for (auto it = mainModule->named_metadata_begin(); it != mainModule->named_metadata_end(); ++it)
|
|
87
|
-
{
|
|
88
|
-
std::string label = it->getName().str();
|
|
89
|
-
std::string toErase = "gepnode-";
|
|
90
|
-
std::size_t pos = label.find(toErase);
|
|
91
|
-
if (pos == std::string::npos)
|
|
92
|
-
{
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
label.erase(pos, toErase.length());
|
|
96
|
-
|
|
97
|
-
SVF::NodeID nodeId = std::stoi(label);
|
|
98
|
-
auto mdNode = it->getOperand(0);
|
|
99
|
-
|
|
100
|
-
SVF::NodeID baseNodeId = std::stoi(llvm::cast<llvm::MDString>(mdNode->getOperand(0))->getString().str());
|
|
101
|
-
SVF::s32_t locationSetOffset = std::stoi(llvm::cast<llvm::MDString>(mdNode->getOperand(1))->getString().str());
|
|
102
|
-
|
|
103
|
-
LocationSet locationSet = LocationSet(locationSetOffset);
|
|
104
|
-
SVF::NodeID gepnodeId = pag->getGepObjVar(baseNodeId, locationSet);
|
|
105
|
-
|
|
106
|
-
bool idEq = (nodeId == gepnodeId);
|
|
107
|
-
(void)idEq; // Suppress warning of unused variable under release build
|
|
108
|
-
assert(idEq && "nodeId is not equal to gepnodeId?");
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Deduce the LLVM value's type, and process the metadata accordingly
|
|
113
|
-
void processPAGNode(const Value* value, SVF::NodeID nodeId, bool writeFlag)
|
|
114
|
-
{
|
|
115
|
-
if (auto instruction = const_cast<Instruction* >(SVFUtil::dyn_cast<Instruction>(value)))
|
|
116
|
-
{
|
|
117
|
-
processInstructionNode(instruction, nodeId, writeFlag);
|
|
118
|
-
}
|
|
119
|
-
else if (auto argument = const_cast<Argument* >(SVFUtil::dyn_cast<Argument>(value)))
|
|
120
|
-
{
|
|
121
|
-
processArgumentNode(argument, nodeId, writeFlag);
|
|
122
|
-
}
|
|
123
|
-
else if (auto function = const_cast<Function* >(SVFUtil::dyn_cast<Function>(value)))
|
|
124
|
-
{
|
|
125
|
-
processFunctionNode(function, nodeId, writeFlag);
|
|
126
|
-
}
|
|
127
|
-
else if (auto globalVar = const_cast<GlobalVariable *>(SVFUtil::dyn_cast<GlobalVariable>(value)))
|
|
128
|
-
{
|
|
129
|
-
processGlobalVarNode(globalVar, nodeId, writeFlag);
|
|
130
|
-
}
|
|
131
|
-
else if (auto basicBlock = const_cast<BasicBlock* >(SVFUtil::dyn_cast<BasicBlock>(value)))
|
|
132
|
-
{
|
|
133
|
-
processBasicBlockNode(basicBlock, nodeId, writeFlag);
|
|
134
|
-
}
|
|
135
|
-
else if (SVFUtil::isa<Constant>(value))
|
|
136
|
-
{
|
|
137
|
-
processConstantNode(nodeId, writeFlag);
|
|
138
|
-
}
|
|
139
|
-
else if (auto inlineAsm = const_cast<llvm::InlineAsm *>(SVFUtil::dyn_cast<llvm::InlineAsm>(value)))
|
|
140
|
-
{
|
|
141
|
-
processInlineAsmNode(inlineAsm, nodeId, writeFlag);
|
|
142
|
-
}
|
|
143
|
-
else
|
|
144
|
-
{
|
|
145
|
-
SVFUtil::outs() << "Value is NOT a Instruction, Argument, Function, GlobalVariable, BasicBlock, Constant or InlineAsm" << std::endl;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
void processInstructionNode(Instruction* instruction, const SVF::NodeID &nodeId, bool writeFlag)
|
|
150
|
-
{
|
|
151
|
-
std::string label = "inode-" + std::to_string(nodeId);
|
|
152
|
-
|
|
153
|
-
if (writeFlag)
|
|
154
|
-
{
|
|
155
|
-
LLVMContext &context = instruction->getContext();
|
|
156
|
-
auto mdNodePts = getMdNodePts(nodeId, context);
|
|
157
|
-
instruction->setMetadata(label, mdNodePts);
|
|
158
|
-
}
|
|
159
|
-
else
|
|
160
|
-
{
|
|
161
|
-
auto mdNode = instruction->getMetadata(label);
|
|
162
|
-
assert(mdNode != nullptr && "Failed to retrive valid node id at instruction");
|
|
163
|
-
addAndersenMetadata(nodeId, mdNode);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
void processArgumentNode(Argument* argument, const SVF::NodeID &nodeId, bool writeFlag)
|
|
168
|
-
{
|
|
169
|
-
std::string label = "anode-" + std::to_string(nodeId);
|
|
170
|
-
|
|
171
|
-
if (writeFlag)
|
|
172
|
-
{
|
|
173
|
-
LLVMContext &context = argument->getContext();
|
|
174
|
-
auto mdNodePts = getMdNodePts(nodeId, context);
|
|
175
|
-
argument->getParent()->setMetadata(label, mdNodePts);
|
|
176
|
-
}
|
|
177
|
-
else
|
|
178
|
-
{
|
|
179
|
-
auto mdNode = argument->getParent()->getMetadata(label);
|
|
180
|
-
assert(mdNode != nullptr && "Failed to retrive valid node id at argument");
|
|
181
|
-
addAndersenMetadata(nodeId, mdNode);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
void processFunctionNode(Function* function, const SVF::NodeID &nodeId, bool writeFlag)
|
|
186
|
-
{
|
|
187
|
-
std::string label = "fnode-" + std::to_string(nodeId);
|
|
188
|
-
|
|
189
|
-
if (writeFlag)
|
|
190
|
-
{
|
|
191
|
-
LLVMContext &context = function->getContext();
|
|
192
|
-
auto mdNodePts = getMdNodePts(nodeId, context);
|
|
193
|
-
function->setMetadata(label, mdNodePts);
|
|
194
|
-
}
|
|
195
|
-
else
|
|
196
|
-
{
|
|
197
|
-
auto mdNode = function->getMetadata(label);
|
|
198
|
-
assert(mdNode != nullptr && "Failed to retrive valid node id at function");
|
|
199
|
-
addAndersenMetadata(nodeId, mdNode);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
void processGlobalVarNode(GlobalVariable *globalVar, const SVF::NodeID &nodeId, bool writeFlag)
|
|
204
|
-
{
|
|
205
|
-
std::string label = "gnode-" + std::to_string(nodeId);
|
|
206
|
-
|
|
207
|
-
if (writeFlag)
|
|
208
|
-
{
|
|
209
|
-
LLVMContext &context = globalVar->getContext();
|
|
210
|
-
auto mdNodePts = getMdNodePts(nodeId, context);
|
|
211
|
-
globalVar->setMetadata(label, mdNodePts);
|
|
212
|
-
}
|
|
213
|
-
else
|
|
214
|
-
{
|
|
215
|
-
auto mdNode = globalVar->getMetadata(label);
|
|
216
|
-
assert(mdNode != nullptr && "Failed to retrive valid node id at instruction");
|
|
217
|
-
addAndersenMetadata(nodeId, mdNode);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
void processBasicBlockNode(BasicBlock* basicBlock, const SVF::NodeID &nodeId, bool writeFlag)
|
|
222
|
-
{
|
|
223
|
-
std::string label = "bnode-" + std::to_string(nodeId);
|
|
224
|
-
|
|
225
|
-
if (writeFlag)
|
|
226
|
-
{
|
|
227
|
-
LLVMContext &context = basicBlock->getContext();
|
|
228
|
-
auto mdNodePts = getMdNodePts(nodeId, context);
|
|
229
|
-
basicBlock->getParent()->setMetadata(label, mdNodePts);
|
|
230
|
-
}
|
|
231
|
-
else
|
|
232
|
-
{
|
|
233
|
-
auto mdNode = basicBlock->getParent()->getMetadata(label);
|
|
234
|
-
assert(mdNode != nullptr && "Failed to retrive valid node id at basicBlock");
|
|
235
|
-
addAndersenMetadata(nodeId, mdNode);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
void processConstantNode(const SVF::NodeID &nodeId, bool writeFlag)
|
|
240
|
-
{
|
|
241
|
-
std::string label = "cnode-" + std::to_string(nodeId);
|
|
242
|
-
|
|
243
|
-
if (writeFlag)
|
|
244
|
-
{
|
|
245
|
-
LLVMContext &context = mainModule->getContext();
|
|
246
|
-
auto mdNodePts = getMdNodePts(nodeId, context);
|
|
247
|
-
mainModule->getOrInsertNamedMetadata(label)->addOperand(mdNodePts);
|
|
248
|
-
}
|
|
249
|
-
else
|
|
250
|
-
{
|
|
251
|
-
auto mdNode = mainModule->getNamedMetadata(label);
|
|
252
|
-
assert(mdNode != nullptr && "Failed to retrive valid node id at instruction");
|
|
253
|
-
addAndersenNamedMetdata(nodeId, mdNode);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
void processInlineAsmNode(llvm::InlineAsm *inlineAsm, const SVF::NodeID &nodeId, bool writeFlag)
|
|
258
|
-
{
|
|
259
|
-
std::string label = "iAsmnode-" + std::to_string(nodeId);
|
|
260
|
-
|
|
261
|
-
if (writeFlag)
|
|
262
|
-
{
|
|
263
|
-
LLVMContext &context = mainModule->getContext();
|
|
264
|
-
auto mdNodePts = getMdNodePts(nodeId, context);
|
|
265
|
-
mainModule->getOrInsertNamedMetadata(label)->addOperand(mdNodePts);
|
|
266
|
-
}
|
|
267
|
-
else
|
|
268
|
-
{
|
|
269
|
-
auto mdNode = mainModule->getNamedMetadata(label);
|
|
270
|
-
assert(mdNode != nullptr && "Failed to retrive valid node id at inlineAsm");
|
|
271
|
-
addAndersenNamedMetdata(nodeId, mdNode);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
void addAndersenMetadata(const SVF::NodeID &nodeId, MDNode *mdNode)
|
|
276
|
-
{
|
|
277
|
-
if (mdNode)
|
|
278
|
-
{
|
|
279
|
-
for (unsigned int i = 0; i < mdNode->getNumOperands(); i++)
|
|
280
|
-
{
|
|
281
|
-
auto anderNodeIdStr = llvm::cast<llvm::MDString>(mdNode->getOperand(i))->getString().str();
|
|
282
|
-
auto anderNodeId = SVF::NodeID(std::stoul(anderNodeIdStr));
|
|
283
|
-
ptsTo->addPts(nodeId, anderNodeId);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
void addAndersenNamedMetdata(const SVF::NodeID &nodeId, NamedMDNode *mdNode)
|
|
289
|
-
{
|
|
290
|
-
if (mdNode)
|
|
291
|
-
{
|
|
292
|
-
for (unsigned int i = 0; i < mdNode->getNumOperands(); i++)
|
|
293
|
-
{
|
|
294
|
-
auto node = mdNode->getOperand(i);
|
|
295
|
-
|
|
296
|
-
for (unsigned int j = 0; j < node->getNumOperands(); j++)
|
|
297
|
-
{
|
|
298
|
-
auto anderNodeIdStr = llvm::cast<llvm::MDString>(node->getOperand(j))->getString().str();
|
|
299
|
-
auto anderNodeId = SVF::NodeID(std::stoul(anderNodeIdStr));
|
|
300
|
-
ptsTo->addPts(nodeId, anderNodeId);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
inline llvm::MDTuple* getMdNodePts(const SVF::NodeID &nodeId, LLVMContext &context)
|
|
307
|
-
{
|
|
308
|
-
llvm::SmallVector<llvm::Metadata *, 32> operands;
|
|
309
|
-
auto &ptTo = ptsTo->getPts(nodeId);
|
|
310
|
-
for (const auto p : ptTo)
|
|
311
|
-
{
|
|
312
|
-
operands.push_back(llvm::MDString::get(context, std::to_string(p)));
|
|
313
|
-
}
|
|
314
|
-
return llvm::MDTuple::get(context, operands);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
Module* mainModule;
|
|
318
|
-
BVDataPTAImpl *ptsTo;
|
|
319
|
-
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
} // End namespace SVF
|
|
323
|
-
|
|
324
|
-
#endif /* IRANNOTATOR_H_ */
|