Apparently the file llvm/examples/Fibonacci/fibonacci.cpp generate JIT code
without explicitly doing any pass (but I suppose that internally, compiler
passes are running!) - is there a dissymetry between JIT machine code
generation in memory, and C or ELF shared object generation in files? I
thought that all these shared a lot of LLVM infrastructure and happen
Also, the llvm/tools/llc/llcp.ccp file explicitly need passes and a pass
manager to generate .so and .c files
I would like to understand precisely how to patch the fibionnaci example to
generate an ELF shared object or a C file, in addition of the JIT-ed code in
memory. May it should become a FAQ.
I also don't understand what is the LLVM meaning of inter-module linking...
To suggest an example, one could add code to fibionacci which load a bitcode
from a file, JIT it, and uses a printing routine there to print fib(10).
Actually, I miss a document or wiki explaining how to use (without extending
it) LLVM to generate code (in variety of ways, including C, ELF shared
object, JIT-ed code in memory) from within an application. Just a simple
example like fibionnaci is great!
My dream would be some tutorial documentation with working actual code
snippets... in the spirit of e.g.
documents an example similar to llvm/examples/Fibonacci/fibonacci.cpp I
would like the same for LLVM, emitting JIT code, ELF shared library, C
file.... Maybe such a documentation exist (hopefully up to date for
LLVM2.0!) but I did not found it yet! Perhaps just linking the example
source files from the web site could be a good idea...
The doxygen documentation is very good, but does not separate enough what an
LLVM user (some developer using LLVM in his own program) should see and what
an LLVM developer (someone enhancing LLVM) should in addition know.
I find LLVM great, but quite hard to grasp.