-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace ExAPI.json with extapi.c, using attributes to represent some … #1157
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #1157 +/- ##
==========================================
+ Coverage 64.68% 64.73% +0.05%
==========================================
Files 223 222 -1
Lines 23821 23477 -344
==========================================
- Hits 15408 15198 -210
+ Misses 8413 8279 -134
|
@@ -292,6 +292,7 @@ class SVFFunction : public SVFValue | |||
const SVFFunction* realDefFun; /// the definition of a function across multiple modules | |||
std::vector<const SVFBasicBlock*> allBBs; /// all BasicBlocks of this function | |||
std::vector<const SVFArgument*> allArgs; /// all formal arguments of this function | |||
std::vector<std::string> annotations; /// annotations of this function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use one string?
svf-llvm/lib/SVFIRBuilder.cpp
Outdated
@@ -1257,10 +1187,10 @@ void SVFIRBuilder::sanityCheck() | |||
* Add a temp field value node according to base value and offset | |||
* this node is after the initial node method, it is out of scope of symInfo table | |||
*/ | |||
NodeID SVFIRBuilder::getGepValVar(const SVFValue* val, const AccessPath& ap, const SVFType* elementType) | |||
NodeID SVFIRBuilder::getGepValVar(const Value* val, const AccessPath& ls, const SVFType* elementType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename ls => ap
svf-llvm/include/SVF-LLVM/LLVMUtil.h
Outdated
@@ -99,6 +98,121 @@ inline const Function* getProgFunction(const std::string& funName) | |||
return nullptr; | |||
} | |||
|
|||
inline std::vector<std::string> getFunAnnotations(const Function* fun) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put the function body into LLVMUtil.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplify this function
svf-llvm/include/SVF-LLVM/LLVMUtil.h
Outdated
return annotations; | ||
} | ||
|
||
inline void removeFunAnnotations(const std::vector<Function*>& removedFuncList) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the function body into LLVMUtil.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplify this function
CMakeLists.txt
Outdated
@@ -87,3 +87,19 @@ install( | |||
DESTINATION include/svf | |||
FILES_MATCHING | |||
PATTERN "**/*.h") | |||
|
|||
# Compile extapi.c to extapi.bc | |||
string(REGEX REPLACE "/lib/cmake/llvm$" "" LLVM_DIR "${LLVM_DIR}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplify this part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Post benchmark statistics of 2-3 large bcs, including time and other stats.
svf-llvm/include/SVF-LLVM/LLVMUtil.h
Outdated
@@ -99,6 +98,121 @@ inline const Function* getProgFunction(const std::string& funName) | |||
return nullptr; | |||
} | |||
|
|||
inline std::vector<std::string> getFunAnnotations(const Function* fun) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplify this function
svf-llvm/include/SVF-LLVM/LLVMUtil.h
Outdated
return annotations; | ||
} | ||
|
||
inline void removeFunAnnotations(const std::vector<Function*>& removedFuncList) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplify this function
@@ -287,7 +278,7 @@ class SVFIRBuilder: public llvm::InstVisitor<SVFIRBuilder> | |||
return nullPtr; | |||
} | |||
|
|||
NodeID getGepValVar(const SVFValue* val, const AccessPath& ap, const SVFType* baseType); | |||
NodeID getGepValVar(const Value* val, const AccessPath& ls, const SVFType* elementType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const AccessPath& ls => const AccessPath& ap;
svf-llvm/lib/LLVMModule.cpp
Outdated
|
||
for (Module& mod : modules) | ||
{ | ||
std::vector<Function*> removedFuncList; | ||
/// Function | ||
for (Function& func : mod.functions()) | ||
{ | ||
if (func.isDeclaration()) | ||
if (func.isDeclaration() && (FunDefToDeclsMap.find(&func) != FunDefToDeclsMap.end() || mod.getName().str() != Options::ExtAPIInput())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix this and put the later conditions inside the if branch. Add comments to explain this.
svf-llvm/lib/LLVMModule.cpp
Outdated
} | ||
else | ||
{ | ||
/// if this function is definition | ||
if (mod.getName().str() == Options::ExtAPIInput() && FunDefToDeclsMap[&func].empty() && func.getName().str() != "svf__main") | ||
if (mod.getName().str() == Options::ExtAPIInput() && FunDefToDeclsMap.find(&func) == FunDefToDeclsMap.end() && func.getName().str() != "svf__main") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
combine this condition and the above one into a method. Use the method as a condtion.
svf-llvm/lib/LLVMModule.cpp
Outdated
// Remove unused function annotations in extapi.bc | ||
LLVMUtil::removeFunAnnotations(removedFuncList); | ||
// Remove unused function in extapi.bc | ||
for (Function* func : removedFuncList) | ||
{ | ||
mod.getFunctionList().remove(func); | ||
func->eraseFromParent(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this as one function.
svf-llvm/lib/LLVMModule.cpp
Outdated
// The module of ext.bc needs to be imported before other modules. | ||
// Otherwise, when overwriting the app function with SVF extern function, | ||
// the corresponding SVFFunction of the extern function will not be found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure the comments reflect what your code is. Put an example.
extapi.bc Andersen Pointer Analysis Stats******
|
…SVF operations