I am trying to see how to avoid LLVM JIT compilation every time and use the cached copy. I see that LLVM has ObjectCache
support for code generation from module, but to get module from a file or code string, it needs to be compiled and go through different optimization passes. What is the best way to go about it?
Cache the final image object to some file and first lookup the file, and try to parse and try to create
ExecutionEngine
with the image so that one can execute (get pointer to function and call it)Save the intermediate output of code compilation and optimization - i.e. write a module to some file (e.g., using dump) and try to read it (parse IR). then use
ObjectCache
support for code generation from this module.
Option (2) seems two steps and likely worse than (1), but is (1) the right way to go about it?