-
Notifications
You must be signed in to change notification settings - Fork 5
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
Remove fn body pass #30
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Some initial comments.
add_library(RemoveFunctionBody SHARED RemoveFunctionBody.cpp) | ||
target_link_libraries(RemoveFunctionBody "$<$<PLATFORM_ID:Darwin>:-undefined dynamic_lookup>") | ||
|
||
# separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS}) |
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.
The commented sections can probably go away?
|
||
project(RemoveFunctionBodyPass) | ||
|
||
set(LT_LLVM_INSTALL_DIR "" CACHE PATH "LLVM installation directory") |
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.
Why do we need to set this path? Doesn't opt
support explicitly passing the shard object path?
#include "llvm/Passes/PassPlugin.h" | ||
#include "llvm/Support/CommandLine.h" | ||
using namespace llvm; | ||
using namespace std; |
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.
Please to not use using namespace std
.
|
||
namespace { | ||
cl::list<int> Lists("index", cl::desc("Specify function index"), cl::OneOrMore); | ||
struct RemoveFunctionBodyPass : PassInfoMixin<RemoveFunctionBodyPass> { |
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.
Why is this a struct and not a class?
@@ -0,0 +1,3 @@ | |||
mkdir build && cd build | |||
cmake -GNinja .. |
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.
This script doesn't seem to be particularly useful and I don't think it needs to be in-tree.
module load ninja
to loadninja
build package. Go into RemoveFunctionBodyPass directory (cd llvm-ir-dataset-utils-internal/llvm_ir_dataset_utils/tools/RemoveFunctionBodyPass
), run./install
to build and install the out-of-tree pass.opt -load build/libRemoveFunctionBody.so -load-pass-plugin=build/libRemoveFunctionBody.so -passes='remove-fn-body' -index <index in integer here> <path to bitcode module file>
(insideRemoveFunctionBodyPass
directory. If want to try somewhere else, modify the path after-load
and-load-pass-plugin
)