Ping.<div><br></div><div>- Is this approach acceptable? </div><div>  - I guess it is hard to test if this has any effect / depends on the compiler.</div><div>- Is trimming the size of the llvm binaries (via config flags) useful to others?</div>

<div>  - Other examples:</div><div>    - make "include/llvm/Intrinsics.td" not #include intrinsincs for targets that were not enabled through "--enable-target"</div><div>    - config flags to avoid building unused register allocators, other passes</div>

<div><br></div><div><br></div><div><div><div><div class="gmail_quote">On Wed, Aug 24, 2011 at 1:12 PM, Jan Voung <span dir="ltr"><<a href="mailto:jvoung@google.com" target="_blank">jvoung@google.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><span style="background-color:rgb(255, 255, 255)"><font face="arial, helvetica, sans-serif">Hi all,</font></span></div><font face="arial, helvetica, sans-serif"><span style="background-color:rgb(255, 255, 255)"><div>




<span style="background-color:rgb(255, 255, 255)"><br>
</span></div>Attached is a patch that can help prune the size of the </span><span style="background-color:rgb(255, 255, 255)">llvm binaries (e.g., llc, lli) a bit. </span><span style="background-color:rgb(255, 255, 255)">This is done by adding configure flags --enable-target-oses=os1,os2 and --enable-target-envs=env1,env2 similar to --enable-target=arch1,arch2. </span><span style="background-color:rgb(255, 255, 255)">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).</span></font><div>




<span style="background-color:rgb(255, 255, 255)"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><font face="arial, helvetica, sans-serif">The if-defs could be spread further to give the same benefit for non-LTO compilers, but that isn't done.</font></div>




<div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><span style="background-color:rgb(255, 255, 255)">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). </span><span style="background-color:rgb(255, 255, 255)">If --enable-target-envs=gnu is also specified then most of MC MachO code is also pruned:</span></font><div>




<div><div>
<font face="arial, helvetica, sans-serif"><br style="background-color:rgb(255, 255, 255)"><span style="background-color:rgb(255, 255, 255)">llc built with lto, x86+arm arches, all oses, all environments: 12757900 </span><br style="background-color:rgb(255, 255, 255)">





<span style="background-color:rgb(255, 255, 255)">llc built with lto, x86+arm arches, only Linux, all environments: 12584978 </span><br style="background-color:rgb(255, 255, 255)">
<span style="background-color:rgb(255, 255, 255)">llc built with lto, x86+arm arches, only Linux, only gnu environment: 12528216</span></font></div></div><div><font face="arial, helvetica, sans-serif"><br>
</font></div><div><font face="arial, helvetica, sans-serif">Is this worth adding?</font></div><div><font face="arial, helvetica, sans-serif"><br>
</font></div><div><font face="arial, helvetica, sans-serif">Again, patch is attached, or you can view the patch online: <a href="http://codereview.chromium.org/7730004/" target="_blank">http://codereview.chromium.org/7730004/</a></font></div>




<div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Thanks!</font></div><div><font face="arial, helvetica, sans-serif">- Jan</font></div>
</div></div>
</blockquote></div><br></div></div>
</div>