[LLVMdev] newbie question: "saving" modules

Duncan Sands baldrick at free.fr
Sat Feb 4 00:56:27 PST 2012

Hi Desty,

> 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.

Ciao, Duncan.

> Again, apologies for such a newbie question.
> -D
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list