svf-tools 1.0.664 → 1.0.666
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/package.json +1 -1
- package/svf/include/SVFIR/SVFIR.h +2 -2
- package/svf/include/SVFIR/SVFModule.h +9 -7
- package/svf/include/SVFIR/SVFModuleRW.h +178 -0
- package/svf/include/SVFIR/SVFType.h +16 -6
- package/svf/include/SVFIR/SVFValue.h +38 -3
- package/svf/include/Util/NodeIDAllocator.h +3 -3
- package/svf/lib/Graphs/CFBasicBlockG.cpp +2 -0
- package/svf/lib/SVFIR/SVFModule.cpp +10 -2
- package/svf/lib/SVFIR/SVFModuleRW.cpp +1206 -0
- package/svf/lib/Util/NodeIDAllocator.cpp +3 -3
- package/svf/lib/Util/Options.cpp +1 -1
- package/svf-llvm/lib/LLVMModule.cpp +7 -0
- package/svf-llvm/tools/WPA/wpa.cpp +8 -6
|
@@ -64,7 +64,7 @@ NodeID NodeIDAllocator::allocateObjectId(void)
|
|
|
64
64
|
// Everything is sequential and intermixed.
|
|
65
65
|
id = numNodes;
|
|
66
66
|
}
|
|
67
|
-
else if (strategy == Strategy::
|
|
67
|
+
else if (strategy == Strategy::DBUG)
|
|
68
68
|
{
|
|
69
69
|
// Non-GEPs just grab the next available ID.
|
|
70
70
|
// We may have "holes" because GEPs increment the total
|
|
@@ -101,7 +101,7 @@ NodeID NodeIDAllocator::allocateGepObjectId(NodeID base, u32_t offset, u32_t max
|
|
|
101
101
|
// Everything is sequential and intermixed.
|
|
102
102
|
id = numNodes;
|
|
103
103
|
}
|
|
104
|
-
else if (strategy == Strategy::
|
|
104
|
+
else if (strategy == Strategy::DBUG)
|
|
105
105
|
{
|
|
106
106
|
// For a gep id, base id is set at lower bits, and offset is set at higher bits
|
|
107
107
|
// e.g., 1100050 denotes base=50 and offset=10
|
|
@@ -146,7 +146,7 @@ NodeID NodeIDAllocator::allocateValueId(void)
|
|
|
146
146
|
// Everything is sequential and intermixed.
|
|
147
147
|
id = numNodes;
|
|
148
148
|
}
|
|
149
|
-
else if (strategy == Strategy::
|
|
149
|
+
else if (strategy == Strategy::DBUG)
|
|
150
150
|
{
|
|
151
151
|
id = numNodes;
|
|
152
152
|
}
|
package/svf/lib/Util/Options.cpp
CHANGED
|
@@ -29,7 +29,7 @@ const OptionMap<NodeIDAllocator::Strategy> Options::NodeAllocStrat(
|
|
|
29
29
|
{NodeIDAllocator::Strategy::DENSE, "dense", "allocate objects together [0-n] and values together [m-MAX], separately"},
|
|
30
30
|
{NodeIDAllocator::Strategy::REVERSE_DENSE, "reverse-dense", "like dense but flipped, objects are [m-MAX], values are [0-n]"},
|
|
31
31
|
{NodeIDAllocator::Strategy::SEQ, "seq", "allocate values and objects sequentially, intermixed (default)"},
|
|
32
|
-
{NodeIDAllocator::Strategy::
|
|
32
|
+
{NodeIDAllocator::Strategy::DBUG, "debug", "allocate value and objects sequentially, intermixed, except GEP objects as offsets"},
|
|
33
33
|
}
|
|
34
34
|
);
|
|
35
35
|
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
#include "Util/Options.h"
|
|
31
31
|
#include <queue>
|
|
32
32
|
#include "SVFIR/SVFModule.h"
|
|
33
|
+
#include "SVFIR/SVFModuleRW.h"
|
|
33
34
|
#include "Util/SVFUtil.h"
|
|
34
35
|
#include "SVF-LLVM/BasicTypes.h"
|
|
35
36
|
#include "SVF-LLVM/LLVMUtil.h"
|
|
@@ -68,6 +69,9 @@ using namespace SVF;
|
|
|
68
69
|
#define SVF_GLOBAL_CTORS "llvm.global_ctors"
|
|
69
70
|
#define SVF_GLOBAL_DTORS "llvm.global_dtors"
|
|
70
71
|
|
|
72
|
+
static Option<std::string> dumpJson("dump-json",
|
|
73
|
+
"Dump the SVFModule to JSON file", "");
|
|
74
|
+
|
|
71
75
|
LLVMModuleSet *LLVMModuleSet::llvmModuleSet = nullptr;
|
|
72
76
|
std::string SVFModule::pagReadFromTxt = "";
|
|
73
77
|
|
|
@@ -119,8 +123,11 @@ SVFModule* LLVMModuleSet::buildSVFModule(const std::vector<std::string> &moduleN
|
|
|
119
123
|
|
|
120
124
|
build_symbol_table();
|
|
121
125
|
|
|
126
|
+
svfModule->writeToJson(dumpJson());
|
|
127
|
+
|
|
122
128
|
return svfModule.get();
|
|
123
129
|
}
|
|
130
|
+
|
|
124
131
|
void LLVMModuleSet::build_symbol_table() const
|
|
125
132
|
{
|
|
126
133
|
double startSymInfoTime = SVFStat::getClk(true);
|
|
@@ -36,21 +36,23 @@ using namespace llvm;
|
|
|
36
36
|
using namespace std;
|
|
37
37
|
using namespace SVF;
|
|
38
38
|
|
|
39
|
-
int main(int argc, char
|
|
39
|
+
int main(int argc, char** argv)
|
|
40
40
|
{
|
|
41
41
|
|
|
42
|
-
char
|
|
42
|
+
char** arg_value = new char*[argc];
|
|
43
43
|
std::vector<std::string> moduleNameVec;
|
|
44
|
-
moduleNameVec =
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
moduleNameVec =
|
|
45
|
+
OptionBase::parseOptions(argc, argv, "Whole Program Points-to Analysis",
|
|
46
|
+
"[options] <input-bitcode...>");
|
|
47
47
|
|
|
48
48
|
if (Options::WriteAnder() == "ir_annotator")
|
|
49
49
|
{
|
|
50
50
|
LLVMModuleSet::getLLVMModuleSet()->preProcessBCs(moduleNameVec);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
SVFModule* svfModule =
|
|
53
|
+
SVFModule* svfModule =
|
|
54
|
+
LLVMModuleSet::getLLVMModuleSet()->buildSVFModule(moduleNameVec);
|
|
55
|
+
|
|
54
56
|
/// Build SVFIR
|
|
55
57
|
SVFIRBuilder builder(svfModule);
|
|
56
58
|
SVFIR* pag = builder.build();
|