A question about using LLVM in an embedded system

Dear all,

I would like to write a compiler on an embedded system to compile GLSL
shader source codes "at runtime" (That means when 3D programs running)
to produce GPU binary codes.
After surveying many solutions, I found that LLVM is a very impressive
project, and I consider to use it.

That means I have to write a GLSL frontend & a GPU backend for LLVM.
After reading LLVM documentations, I think that is not very hard to
accomplish it.

However, I found that LLVM takes about 15 MB disk space when it is
compiled in the Release mode. I don't count executables under
llvm-installation-folder/bin, and various backend libraries under
llvm-installation-folder/lib. I just count the LLVM target-independent
libraries only.

My question is "Are there any ways to reduce the disk space needed by LLVM?"
Ex:
if I don't need some optimization passes, can I use some preprocessor
macros to disable that pieces of codes?
If such preprocessor macros or other methods don't exist, are there
any guide lines or suggestions I can follow to reduce the disk space
usage?

Thank you all very much.

Wei wrote:

-----------------8<------8<------
My question is "Are there any ways to reduce the disk space needed by LLVM?"
Ex:
if I don't need some optimization passes, can I use some preprocessor
macros to disable that pieces of codes?
If such preprocessor macros or other methods don't exist, are there
any guide lines or suggestions I can follow to reduce the disk space
usage?

Thank you all very much.

When you link your program link only the parts that you need.
llvm-config --components will tell you the components. For example, you
will need the codegen code, but not the .bc bitcode/assembly parser or
the JIT. When you statically link, you will only get the used functions
(and their dependencies) in your executable. If you need the actual
static library files on the device, I think you may be able to omit the
ones that you do not use.

Hope this is any help,
Jonathan