[llvm-dev] Dynamic recompilation with ORC JIT API
Sebastiano Miano via llvm-dev
llvm-dev at lists.llvm.org
Sat Nov 28 06:51:22 PST 2020
Dear all,
I am recently playing a little bit with the ORC JIT APIs with the goal
of creating a prototype of a JIT compiler that loads the IR module of
a C++ class, compiles it and instantiates the class.
During the execution, I would like to replace some class methods by
recompiling them with an optimized version.
I have started from the latest version of the KaleidoscopeJIT, using
the CompileOnDemandLayer to perform a lazy compilation of the class.
I have managed successfully to load the code and instantiate the
object, by getting the pointer of a "factory" method in the IR Module
that returns the object itself.
What I want to do now is to trigger the recompilation of a specific
class method (i.e., function in the IR Module), and perform some IR
transformations before the function is compiled. Then, I would like to
point the old function to the new version (through the
IndirectStubManager).
The questions are:
1. How can I trigger the re-optimization and re-compilation from the
existing ExecutionSession? Is there a method in the
CompileOnDemandLayer that allows it?
2. Do I need to "manually" update the trampoline through the
IndirectStubManager, or it is automatically done once the new function
is compiled?
Thanks a lot,
Sebastiano
More information about the llvm-dev
mailing list