[LLVMdev] newbie question: "saving" modules
baldrick at free.fr
Sat Feb 4 00:56:27 PST 2012
> Just starting out with LLVM. I've gone through the example code and the
> Kaleidoscope tutorial, and found it very informative.
> One question, though, and apologies if I missed an answer in Googling. I
> understand that when you create functions in a LLVM language and pass it through
> the JIT interpreter, then that function lives in the current address space for
> the duration of the running process.
> If correct, is there any way to get it to persist so the code doesn't have to be
> re-entered each time the process starts?
you can save the module to the disk using the bitcode writer. You can use the
code generators to turn the bitcode in native object code (like llc does), which
can be linked to form a dynamic library that you can just load into your program
using dlopen whenever you need it.
How about making the function
> available to other processes in real time? Using a mmap, perhaps -- and if so,
> are there any examples out there doing that?
I don't know of any examples.
> Again, apologies for such a newbie question.
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev