[llvm-commits] PATCH: pruning llvm w/ config flags --enable-target-oses=os1, os2 similar to --enable-target=arch1, arch2.

Jan Voung jvoung at google.com
Wed Aug 24 13:12:51 PDT 2011


Hi all,

Attached is a patch that can help prune the size of the llvm binaries (e.g.,
llc, lli) a bit. This is done by adding configure flags
--enable-target-oses=os1,os2 and --enable-target-envs=env1,env2 similar to
--enable-target=arch1,arch2. These flags generate pre-processor defines that
are then checked within the Triple module to force certain code paths to be
considered dead (if llvm is built with an LTO-enabled-compiler).

The if-defs could be spread further to give the same benefit for non-LTO
compilers, but that isn't done.

Concretely, if you build LLVM w/ clang -O4 and --enable-target-oses=Linux,
there is about a 170 KB savings (prunes most of the MC COFF support, plus
some branches in various places). If --enable-target-envs=gnu is also
specified then most of MC MachO code is also pruned:

llc built with lto, x86+arm arches, all oses, all environments: 12757900
llc built with lto, x86+arm arches, only Linux, all environments: 12584978
llc built with lto, x86+arm arches, only Linux, only gnu environment:
12528216

Is this worth adding?

Again, patch is attached, or you can view the patch online:
http://codereview.chromium.org/7730004/

Thanks!
- Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110824/66ef3fbf/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm_enable_os_env.patch
Type: text/x-patch
Size: 33501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110824/66ef3fbf/attachment.bin>


More information about the llvm-commits mailing list