svf-lib 1.0.1657 → 1.0.1659
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-linux/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-linux/svf-llvm/include/SVF-LLVM/LLVMModule.h +0 -16
- package/SVF-linux/svf-llvm/include/SVF-LLVM/LLVMUtil.h +4 -9
- package/SVF-osx/Release-build/svf/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/LLVMModule.h +0 -16
- package/SVF-osx/svf-llvm/include/SVF-LLVM/LLVMUtil.h +4 -9
- package/package.json +1 -1
|
Binary file
|
|
@@ -239,24 +239,8 @@ public:
|
|
|
239
239
|
/// Remove unused function in extapi.bc module
|
|
240
240
|
bool isCalledExtFunction(Function* func)
|
|
241
241
|
{
|
|
242
|
-
/// check if a llvm Function is called.
|
|
243
|
-
auto isCalledFunction = [](llvm::Function* F)
|
|
244
|
-
{
|
|
245
|
-
for (auto& use : F->uses())
|
|
246
|
-
{
|
|
247
|
-
llvm::User* user = use.getUser();
|
|
248
|
-
|
|
249
|
-
if (llvm::isa<llvm::CallBase>(user))
|
|
250
|
-
{
|
|
251
|
-
return true;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
return false;
|
|
255
|
-
};
|
|
256
242
|
/// if this function func defined in extapi.bc but never used in application code (without any corresponding declared functions).
|
|
257
243
|
if (func->getParent()->getName().str() == Options::ExtAPIInput()
|
|
258
|
-
&& !isCalledFunction(func)
|
|
259
|
-
&& func->getName().str() != "svf__main"
|
|
260
244
|
&& FunDefToDeclsMap.find(func) == FunDefToDeclsMap.end()
|
|
261
245
|
&& std::find(ExtFuncsVec.begin(), ExtFuncsVec.end(), func) == ExtFuncsVec.end())
|
|
262
246
|
{
|
|
@@ -376,6 +376,10 @@ bool isIntrinsicFun(const Function* func);
|
|
|
376
376
|
std::vector<const Function *> getCalledFunctions(const Function *F);
|
|
377
377
|
std::vector<std::string> getFunAnnotations(const Function* fun);
|
|
378
378
|
void removeFunAnnotations(std::vector<Function*>& removedFuncList);
|
|
379
|
+
bool isUnusedGlobalVariable(const GlobalVariable& global);
|
|
380
|
+
void removeUnusedGlobalVariables(Module* module);
|
|
381
|
+
/// Delete unused functions, annotations and global variables in extapi.bc
|
|
382
|
+
void removeUnusedFuncsAndAnnotationsAndGlobalVariables(std::vector<Function*> removedFuncList);
|
|
379
383
|
|
|
380
384
|
inline u32_t SVFType2ByteSize(const SVFType* type)
|
|
381
385
|
{
|
|
@@ -394,15 +398,6 @@ inline u32_t SVFType2ByteSize(const SVFType* type)
|
|
|
394
398
|
return llvm_elem_size;
|
|
395
399
|
}
|
|
396
400
|
|
|
397
|
-
inline void removeUnusedFuncsAndAnnotations(std::vector<Function*> removedFuncList)
|
|
398
|
-
{
|
|
399
|
-
/// Remove unused function annotations in extapi.bc
|
|
400
|
-
LLVMUtil::removeFunAnnotations(removedFuncList);
|
|
401
|
-
/// Remove unused function in extapi.bc
|
|
402
|
-
for (Function* func : removedFuncList)
|
|
403
|
-
func->eraseFromParent();
|
|
404
|
-
}
|
|
405
|
-
|
|
406
401
|
/// Get the corresponding Function based on its name
|
|
407
402
|
inline const SVFFunction* getFunction(const std::string& name)
|
|
408
403
|
{
|
|
Binary file
|
|
Binary file
|
|
@@ -239,24 +239,8 @@ public:
|
|
|
239
239
|
/// Remove unused function in extapi.bc module
|
|
240
240
|
bool isCalledExtFunction(Function* func)
|
|
241
241
|
{
|
|
242
|
-
/// check if a llvm Function is called.
|
|
243
|
-
auto isCalledFunction = [](llvm::Function* F)
|
|
244
|
-
{
|
|
245
|
-
for (auto& use : F->uses())
|
|
246
|
-
{
|
|
247
|
-
llvm::User* user = use.getUser();
|
|
248
|
-
|
|
249
|
-
if (llvm::isa<llvm::CallBase>(user))
|
|
250
|
-
{
|
|
251
|
-
return true;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
return false;
|
|
255
|
-
};
|
|
256
242
|
/// if this function func defined in extapi.bc but never used in application code (without any corresponding declared functions).
|
|
257
243
|
if (func->getParent()->getName().str() == Options::ExtAPIInput()
|
|
258
|
-
&& !isCalledFunction(func)
|
|
259
|
-
&& func->getName().str() != "svf__main"
|
|
260
244
|
&& FunDefToDeclsMap.find(func) == FunDefToDeclsMap.end()
|
|
261
245
|
&& std::find(ExtFuncsVec.begin(), ExtFuncsVec.end(), func) == ExtFuncsVec.end())
|
|
262
246
|
{
|
|
@@ -376,6 +376,10 @@ bool isIntrinsicFun(const Function* func);
|
|
|
376
376
|
std::vector<const Function *> getCalledFunctions(const Function *F);
|
|
377
377
|
std::vector<std::string> getFunAnnotations(const Function* fun);
|
|
378
378
|
void removeFunAnnotations(std::vector<Function*>& removedFuncList);
|
|
379
|
+
bool isUnusedGlobalVariable(const GlobalVariable& global);
|
|
380
|
+
void removeUnusedGlobalVariables(Module* module);
|
|
381
|
+
/// Delete unused functions, annotations and global variables in extapi.bc
|
|
382
|
+
void removeUnusedFuncsAndAnnotationsAndGlobalVariables(std::vector<Function*> removedFuncList);
|
|
379
383
|
|
|
380
384
|
inline u32_t SVFType2ByteSize(const SVFType* type)
|
|
381
385
|
{
|
|
@@ -394,15 +398,6 @@ inline u32_t SVFType2ByteSize(const SVFType* type)
|
|
|
394
398
|
return llvm_elem_size;
|
|
395
399
|
}
|
|
396
400
|
|
|
397
|
-
inline void removeUnusedFuncsAndAnnotations(std::vector<Function*> removedFuncList)
|
|
398
|
-
{
|
|
399
|
-
/// Remove unused function annotations in extapi.bc
|
|
400
|
-
LLVMUtil::removeFunAnnotations(removedFuncList);
|
|
401
|
-
/// Remove unused function in extapi.bc
|
|
402
|
-
for (Function* func : removedFuncList)
|
|
403
|
-
func->eraseFromParent();
|
|
404
|
-
}
|
|
405
|
-
|
|
406
401
|
/// Get the corresponding Function based on its name
|
|
407
402
|
inline const SVFFunction* getFunction(const std::string& name)
|
|
408
403
|
{
|