svf-tools 1.0.1022 → 1.0.1023
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-llvm/include/SVF-LLVM/ICFGBuilder.h +1 -1
- package/svf-llvm/include/SVF-LLVM/LLVMModule.h +4 -0
- package/svf-llvm/lib/ICFGBuilder.cpp +11 -12
- package/svf-llvm/lib/LLVMLoopAnalysis.cpp +1 -2
- package/svf-llvm/lib/LLVMModule.cpp +10 -2
- package/svf-llvm/lib/LLVMUtil.cpp +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1023",
|
|
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": {
|
|
@@ -75,7 +75,7 @@ private:
|
|
|
75
75
|
///@{
|
|
76
76
|
void processFunEntry(const Function* fun, WorkList& worklist);
|
|
77
77
|
|
|
78
|
-
void
|
|
78
|
+
void processUnreachableFromEntry(const Function* fun, WorkList& worklist);
|
|
79
79
|
|
|
80
80
|
void processFunBody(WorkList& worklist);
|
|
81
81
|
|
|
@@ -109,6 +109,8 @@ private:
|
|
|
109
109
|
FunToFunExitNodeMapTy FunToFunExitNodeMap; ///< map a function to its FunEntryICFGNode
|
|
110
110
|
CallGraph* callgraph;
|
|
111
111
|
|
|
112
|
+
Map<const Function*, DominatorTree> FunToDominatorTree;
|
|
113
|
+
|
|
112
114
|
/// Constructor
|
|
113
115
|
LLVMModuleSet();
|
|
114
116
|
|
|
@@ -397,6 +399,8 @@ public:
|
|
|
397
399
|
return icfg;
|
|
398
400
|
}
|
|
399
401
|
|
|
402
|
+
DominatorTree& getDomTree(const Function* fun);
|
|
403
|
+
|
|
400
404
|
private:
|
|
401
405
|
/// Create SVFTypes
|
|
402
406
|
SVFType* addSVFTypeInfo(const Type* t);
|
|
@@ -70,7 +70,7 @@ ICFG* ICFGBuilder::build()
|
|
|
70
70
|
continue;
|
|
71
71
|
WorkList worklist;
|
|
72
72
|
processFunEntry(fun,worklist);
|
|
73
|
-
|
|
73
|
+
processUnreachableFromEntry(fun, worklist);
|
|
74
74
|
processFunBody(worklist);
|
|
75
75
|
processFunExit(fun);
|
|
76
76
|
|
|
@@ -122,21 +122,20 @@ void ICFGBuilder::processFunEntry(const Function* fun, WorkList& worklist)
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
/*!
|
|
125
|
-
* bbs
|
|
125
|
+
* bbs unreachable from function entry
|
|
126
126
|
*/
|
|
127
|
-
void ICFGBuilder::
|
|
127
|
+
void ICFGBuilder::processUnreachableFromEntry(const Function* fun, WorkList& worklist)
|
|
128
128
|
{
|
|
129
|
-
|
|
129
|
+
SVFLoopAndDomInfo* pInfo =
|
|
130
|
+
llvmModuleSet()->getSVFFunction(fun)->getLoopAndDomInfo();
|
|
131
|
+
for (const auto& bb : *fun)
|
|
130
132
|
{
|
|
131
|
-
|
|
133
|
+
if (pInfo->isUnreachable(llvmModuleSet()->getSVFBasicBlock(&bb)) &&
|
|
134
|
+
!visited.count(&bb.front()))
|
|
132
135
|
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
visited.insert(&inst);
|
|
137
|
-
(void)addBlockICFGNode(&inst);
|
|
138
|
-
worklist.push(&inst);
|
|
139
|
-
}
|
|
136
|
+
visited.insert(&bb.front());
|
|
137
|
+
(void)addBlockICFGNode(&bb.front());
|
|
138
|
+
worklist.push(&bb.front());
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
141
|
}
|
|
@@ -48,7 +48,6 @@ using namespace SVFUtil;
|
|
|
48
48
|
*/
|
|
49
49
|
void LLVMLoopAnalysis::buildLLVMLoops(SVFModule *mod, ICFG* icfg)
|
|
50
50
|
{
|
|
51
|
-
llvm::DominatorTree DT = llvm::DominatorTree();
|
|
52
51
|
std::vector<const Loop *> loop_stack;
|
|
53
52
|
for (Module& M : LLVMModuleSet::getLLVMModuleSet()->getLLVMModules())
|
|
54
53
|
{
|
|
@@ -59,7 +58,7 @@ void LLVMLoopAnalysis::buildLLVMLoops(SVFModule *mod, ICFG* icfg)
|
|
|
59
58
|
if (func->isDeclaration()) continue;
|
|
60
59
|
// do not analyze external call
|
|
61
60
|
if (SVFUtil::isExtCall(svffun)) continue;
|
|
62
|
-
DT
|
|
61
|
+
llvm::DominatorTree& DT = LLVMModuleSet::getLLVMModuleSet()->getDomTree(func);
|
|
63
62
|
llvm::LoopInfoBase<llvm::BasicBlock, llvm::Loop> loopInfo;
|
|
64
63
|
std::vector<const Loop*> llvmLoops;
|
|
65
64
|
loopInfo.analyze(DT);
|
|
@@ -99,6 +99,15 @@ ObjTypeInference* LLVMModuleSet::getTypeInference()
|
|
|
99
99
|
return typeInference;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
DominatorTree& LLVMModuleSet::getDomTree(const SVF::Function* fun)
|
|
103
|
+
{
|
|
104
|
+
auto it = FunToDominatorTree.find(fun);
|
|
105
|
+
if(it != FunToDominatorTree.end()) return it->second;
|
|
106
|
+
DominatorTree& dt = FunToDominatorTree[fun];
|
|
107
|
+
dt.recalculate(const_cast<Function&>(*fun));
|
|
108
|
+
return dt;
|
|
109
|
+
}
|
|
110
|
+
|
|
102
111
|
SVFModule* LLVMModuleSet::buildSVFModule(Module &mod)
|
|
103
112
|
{
|
|
104
113
|
LLVMModuleSet* mset = getLLVMModuleSet();
|
|
@@ -407,9 +416,8 @@ void LLVMModuleSet::initDomTree(SVFFunction* svffun, const Function* fun)
|
|
|
407
416
|
if (fun->isDeclaration())
|
|
408
417
|
return;
|
|
409
418
|
//process and stored dt & df
|
|
410
|
-
DominatorTree dt;
|
|
411
419
|
DominanceFrontier df;
|
|
412
|
-
dt
|
|
420
|
+
DominatorTree& dt = getDomTree(fun);
|
|
413
421
|
df.analyze(dt);
|
|
414
422
|
LoopInfo loopInfo = LoopInfo(dt);
|
|
415
423
|
PostDominatorTree pdt = PostDominatorTree(const_cast<Function&>(*fun));
|
|
@@ -75,8 +75,7 @@ void LLVMUtil::getFunReachableBBs (const Function* fun, std::vector<const SVFBas
|
|
|
75
75
|
{
|
|
76
76
|
assert(!SVFUtil::isExtCall(LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(fun)) && "The calling function cannot be an external function.");
|
|
77
77
|
//initial DominatorTree
|
|
78
|
-
DominatorTree dt;
|
|
79
|
-
dt.recalculate(const_cast<Function&>(*fun));
|
|
78
|
+
DominatorTree& dt = LLVMModuleSet::getLLVMModuleSet()->getDomTree(fun);
|
|
80
79
|
|
|
81
80
|
Set<const BasicBlock*> visited;
|
|
82
81
|
std::vector<const BasicBlock*> bbVec;
|