[LLVMdev] LLVM footprint
Chris Lattner
sabre at nondot.org
Mon Dec 3 14:40:25 PST 2007
On Mon, 3 Dec 2007, Benjamin Smedberg wrote:
> What is the expected footprint of a tool using the LLVM JIT?
Right now it's ~1.5 to 2M for one platform, at least on darwin.
> I have created a simple project that uses the LLVM C++ API to JIT calls
> to XPCOM method signature... it works well, but the component DLL is
> very large (Linux x86-74, 5.8MB optimized and stripped). Is this normal?
> Am I linking to "too much" or not using the correct link flags?
That is large. I'd suggest using the output of the llvm-config tool to
pass the right options to the linker:
$ llvm-config --libs --ldflags jit native
-L/Volumes/ProjectsDisk/cvs/llvm/Debug/lib -lpthread -lltdl -lm
/Volumes/ProjectsDisk/cvs/llvm/Debug/lib/LLVMPowerPC.o -lLLVMSelectionDAG
-lLLVMCodeGen -lLLVMScalarOpts -lLLVMTransformUtils -lLLVMipa
-lLLVMAnalysis /Volumes/ProjectsDisk/cvs/llvm/Debug/lib/LLVMJIT.o
/Volumes/ProjectsDisk/cvs/llvm/Debug/lib/LLVMExecutionEngine.o
-lLLVMTarget -lLLVMCore -lLLVMSupport -lLLVMSystem
(this is on a ppc/darwin system).
> Note that I'm not using the LLVM build system, I'm using the Mozilla build
> system and manually pulling in the libraries I needed to resolve symbols...
That should be fine.
> Note that because this is a sharedlib I had to configure LLVM with
> - --enable-pic --enable-optimize, but I used no other configure options...
> should I have? Are there features that can be disabled to reduce footprint?
LLVM uses a lot of strings in assertion messages. building with
'ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1' will give a significantly
smaller build than just an optimized build. Also, there are lots of
options for strip that you can play with.
Finally, there is still a lot that can be done to reduce code size. For
example, building a JIT links in the .s file printers in, and they have
non-trivial size (big string tables etc). It would be great to refactor
the code to avoid things like this. I wouldn't be surprised if we could
shrink the size of a JIT down by another 30% or so.
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list