Is it possible to get a function pointer from a FunctionValue, or at least not the name? #547
Unanswered
PartyWumpus
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Converted to a discussion as it is more of a question than a feature or bug |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the Bug
I'm writing a simple jit compiler using inkwell, and I'm caching functions, so I need access to the generated function pointers. If I didn't need to cache, I could just use ExecutionEngine's
run_function
which takes in a FunctionValue.Seemingly the only way to access the function pointer myself is with ExectionEngine's
get_function
, which takes in a name which has to be globally unique (as in if 2 modules have functions with the same name there is no way to specify which to pick). Also afaict it is slower (not profiled it properly)?Am I missing a way to get from a FunctionValue to a function pointer (specifically a JitFunction but a raw function pointer is good too i think)? I could just store the FunctionValue instead of the function pointer, but I'd rather just have a pointer directly to the function instead of going through LLVM for every call.
Sorry if this is more of a question/feature request than a bug report, but I wasn't really sure what to label it as.
To Reproduce
This is what I've been doing as a temporary solution, but it does not spark joy
LLVM Version (please complete the following information):
Desktop (please complete the following information):
Beta Was this translation helpful? Give feedback.
All reactions