-
Notifications
You must be signed in to change notification settings - Fork 321
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
[NPM] Add hooks for llvm passes in llvmlite #1091
base: main
Are you sure you want to change the base?
Conversation
yashssh
commented
Oct 24, 2024
- Add hooks for most of the passes currently supported by the legacy pm
- Add todo for future passes, simplify pass registration in newpassmanager.py
- Add dot printer passes
Add todo for future passes, simplify pass registeration in newpassmanager.py Add dot printer passes Add hooks for most of the passes currently supported by legacy pm Fix working of new APIs with llvm16
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@yashssh Now that CI is up and working again, I think there is an issue with the Windows build that might be a real problem - do you know why it's not finding The other issue appears to just be a C++ formatting issue. |
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.
I just noticed, the problem on Windows is that many of the new functions are missing the API_EXPORT
macro.
I'm not sure why windows is not able to find
AFICT I have defined everything albeit not explicitly but using C++ macros to prevent rewriting same code over and over again. Can you point me to specific example if I have missed it? |
It's indeed an issue with C++ macros not being expanded/evaluated correctly on windows as now it's failing with a different API |
From out-of-band discussion: Graham to point to the usage of the API_EXPORT macro. |
ffi/newpassmanagers.cpp
Outdated
} | ||
|
||
#define CGSCC_PASS(NAME) \ | ||
void LLVMPY_module_Add##NAME(LLVMModulePassManagerRef MPM) { \ |
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 is where I think API_EXPORT
needs adding to enable these functions to be exported from the DLL in Windows:
void LLVMPY_module_Add##NAME(LLVMModulePassManagerRef MPM) { \ | |
API_EXPORT(void) LLVMPY_module_Add##NAME(LLVMModulePassManagerRef MPM) { \ |
ffi/newpassmanagers.cpp
Outdated
#include "PASSREGISTRY.def" | ||
|
||
#define MODULE_PASS(NAME) \ | ||
void LLVMPY_module_Add##NAME(LLVMModulePassManagerRef MPM) { \ |
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.
void LLVMPY_module_Add##NAME(LLVMModulePassManagerRef MPM) { \ | |
API_EXPORT(void) LLVMPY_module_Add##NAME(LLVMModulePassManagerRef MPM) { \ |
ffi/newpassmanagers.cpp
Outdated
#include "PASSREGISTRY.def" | ||
|
||
#define FUNCTION_PASS(NAME) \ | ||
void LLVMPY_module_Add##NAME(LLVMModulePassManagerRef MPM) { \ |
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.
void LLVMPY_module_Add##NAME(LLVMModulePassManagerRef MPM) { \ | |
API_EXPORT(void) LLVMPY_module_Add##NAME(LLVMModulePassManagerRef MPM) { \ |
ffi/newpassmanagers.cpp
Outdated
void LLVMPY_module_Add##NAME(LLVMModulePassManagerRef MPM) { \ | ||
llvm::unwrap(MPM)->addPass(createModuleToFunctionPassAdaptor(NAME())); \ | ||
} \ | ||
void LLVMPY_function_Add##NAME(LLVMFunctionPassManagerRef FPM) { \ |
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.
void LLVMPY_function_Add##NAME(LLVMFunctionPassManagerRef FPM) { \ | |
API_EXPORT(void) LLVMPY_function_Add##NAME(LLVMFunctionPassManagerRef FPM) { \ |
ffi/newpassmanagers.cpp
Outdated
#include "PASSREGISTRY.def" | ||
|
||
#define LOOP_PASS(NAME) \ | ||
void LLVMPY_module_Add##NAME(LLVMModulePassManagerRef MPM) { \ |
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.
void LLVMPY_module_Add##NAME(LLVMModulePassManagerRef MPM) { \ | |
API_EXPORT(void) LLVMPY_module_Add##NAME(LLVMModulePassManagerRef MPM) { \ |
ffi/newpassmanagers.cpp
Outdated
llvm::unwrap(MPM)->addPass(createModuleToFunctionPassAdaptor( \ | ||
createFunctionToLoopPassAdaptor(NAME()))); \ | ||
} \ | ||
void LLVMPY_function_Add##NAME(LLVMFunctionPassManagerRef FPM) { \ |
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.
void LLVMPY_function_Add##NAME(LLVMFunctionPassManagerRef FPM) { \ | |
API_EXPORT(void) LLVMPY_function_Add##NAME(LLVMFunctionPassManagerRef FPM) { \ |
ffi/newpassmanagers.cpp
Outdated
} | ||
#include "PASSREGISTRY.def" | ||
|
||
const char *LLVMPY_getModuleLevelPasses() { |
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 probably needs an API_EXPORT
as well but I don't trust myself to get the syntax exactly right without trying it first, so no suggestion as such :-)
@yashssh I added some notes on where I think adding |
…ing macro" This reverts commit 58acb78.
Thanks for the changes @gmarkall! I have updated the files, all tests seem to pass now |