I did "make" inside llvm/examples/ and inside
llvm/examples/HowToUseJIT/ and expected to get an ELF executable.. But
I've only got the 2 Release/HowToUseJIT.[do] files..
All executables are placed in tools/$(BUILD_TYPE), in your case,
llvm/tools/Release. That is there from the time before we had the
examples/ directory, and the only executables produced were the tools.
Perhaps that should be changed to build into examples/$(BUILD_TYPE) ...
> Bottom line: you don't need llvm/runtime.
What are the exact libraries I'll need from LLVM (to JIT generate
machine code)?
Look through llvm/tools/Makefile.JIT -- it adds JIT support libraries to
the USEDLIBS variable, so for x86, for example:
LLVMJIT LLVMCodeGen LLVMExecutionEngine LLVMX86 LLVMSelectionDAG
LLVMInterpreter LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a
LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMSystem.a
For the ones without an extension, append .o, for the ones with .a,
prepend 'lib' and look in llvm/lib/Release .
Where are these (I would like the list of all the lib*.{a,so} and all
headers <*.h> in /usr/local/ on my Linux/Debian/Sid/x86 system)?
The headers are llvm/include/llvm/*, however, I can't tell you
immediately what is the _minimal_ set of headers that will make a JIT
application compile, because your JIT may use any of the LLVM
functionality (theoretically). You could see what any of the examples
#includes (HowToUseJIT, Fibonacci, etc) but some headers #include
others...
How are these supposed to be installed (if possible, I want to avoid
llvm-gcc, because I hpave trouble compiling the latest CVS of it, and
because I believe I really don't need it)?
You don't need llvm-gcc for these libraries or headers. Theoretically,
you would install these in something like /usr/local/include/llvm/* and
/usr/local/lib/* or something similar to that. 'make install' should
install into $prefix/ include, lib, etc.
How can I tell LLVM the address where I want the generated code to go
(or how can I get this address, preferably with a "destructor"
function to release the memory)? I coded a garbage collector which
should garbege generated code...
At present, you cannot tell the JIT *where* you want the code to go.
Machine code destruction is currently not implemented (but you may
find it implemented in the near future). In the mean time, you can use
this function to tell the ExecutionEngine to release memory for
generated code:
ExecutionEngine::freeMachineCodeForFunction(Function *F);
Note that you'll have to update your sources to get the changes from CVS
for this.
How do I plug my copying GC into LLVM? It has to know about the stack
frames, etc... (I mostly need the location inside the stack frames of
GC-ed pointers)
I'm not the person to ask about GC, I'll let Chris Lattner chime in on
this. You can read a previous discussion about scheme GC and LLVM:
http://mail.cs.uiuc.edu/pipermail/llvmdev/2004-July/thread.html#1524
Or you can also read up on the scheme compiler directly:
http://llvm.cs.uiuc.edu/ProjectsWithLLVM/#scheme
I'm sorry to ask such basic questions, but the documentation don't
help me much (and I am a bit lost in it.. I don't care about any kind
of llvm-gcc or llvm-ld, I just want to generate and then run code in
memory!)
If some kind LLVM person is in charge of LLVM documentation, I am
missing a "using LLVM for JIT machine-code generation for dummies"
page -which would explain the examples/HowToUseJIT/ and similar-
Apparently, JIT is a by-product of LLVM, but it is the main feature
that attracts me here...
Thanks for the feedback! We'll see about including such JIT-specific
"howto" guide to LLVM document library.
BTW, are there some European LLVM users & developers (working & living
in Europe) or is LLVM only a US software?
LLVM is used world-wide. Specifically in Europe, I believe there are
LLVM users/developers in (at least) Denmark, England, France, Germany,
Italy, Norway, Russia, Spain, and Sweden. Sorry if I'm missing anyone,
this is what I remember off the top of my head.
We don't keep tabs on them, but many of them do read this list so you'll
hear from them, don't worry. 