Hi all,<div><br></div><div>Here is a set of patches (one llvm, one clang) that could trim the size of the llvm backends. This is one changes Intrinsics.td to only include Intrinsics for the targets that were enabled via --enable-targets=X,Y,Z. This is about ~100KB savings if you only enable X86 (haven't measured others, but it should be greater for targets with fewer intrinsics).</div>
<div><span style="font-family: arial, helvetica, sans-serif; "><br></span></div><div><span style="font-family: arial, helvetica, sans-serif; background-color: rgb(255, 255, 255); ">"size llc" w/ only x86</span></div>
<div><font face="arial, helvetica, sans-serif"><span style="background-color: rgb(255, 255, 255); ">BEFORE: </span><br style="background-color: rgb(255, 255, 255); "><span style="background-color: rgb(255, 255, 255); ">text      data    bss     dec     hex    filename </span><br style="background-color: rgb(255, 255, 255); ">
<span style="background-color: rgb(255, 255, 255); ">11328502    502632  36976  11868110         b517ce Release+Asserts/bin/llc </span><br style="background-color: rgb(255, 255, 255); "><br style="background-color: rgb(255, 255, 255); ">
<span style="background-color: rgb(255, 255, 255); ">AFTER: </span><br style="background-color: rgb(255, 255, 255); "><span style="background-color: rgb(255, 255, 255); ">text    data    bss     dec     hex    filename </span><br style="background-color: rgb(255, 255, 255); ">
<span style="background-color: rgb(255, 255, 255); ">11232165    499080  36976  11768221         b3919d Release+Asserts/bin/llc </span></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><div><span style="font-family: arial, helvetica, sans-serif; ">NOTE:</span><b style="font-family: arial, helvetica, sans-serif; "> </b><span style="font-family: arial, helvetica, sans-serif; ">this affects the "opt" tool and other bitcode tools that may depend on Intrinsics.td having all intrinsics available.</span></div>
<div><span style="font-family: arial, helvetica, sans-serif; "><br></span></div><div>I'm not sure how to properly get "svn mv"'ed stuff to show up in the attached files, but they show up in the o<span style="font-family: arial, helvetica, sans-serif; ">nline views:</span></div>
<div><a href="http://codereview.chromium.org/7792066/">http://codereview.chromium.org/7792066/</a></div><div><a href="http://codereview.chromium.org/7824006/" style="font-family: arial, helvetica, sans-serif; color: rgb(65, 130, 250); background-color: rgb(255, 255, 255); ">http://codereview.chromium.org/7824006/</a></div>
<div><br></div><div><span style="font-family: arial, helvetica, sans-serif; ">Other detail:</span></div><font face="arial, helvetica, sans-serif"><br style="background-color: rgb(255, 255, 255); "><span style="background-color: rgb(255, 255, 255); ">(a) This is done by adding an "include_if" directive to TableGen (vs trying to do a full-fledged #if def / #else / #endif). </span></font></div>
<div><font face="arial, helvetica, sans-serif"><br style="background-color: rgb(255, 255, 255); "><span style="background-color: rgb(255, 255, 255); ">(b) Add CPP defines to handle inline code the depends on these intrinsics (e.g., in InstCombine). See second attached patch </span><span style="background-color: rgb(255, 255, 255); ">for clang side changes. I haven't looked into llvm-gcc or dragon egg dependencies on LLVM's Intrinsics.td, so it may take some more work to land.</span></font></div>
<div><font face="arial, helvetica, sans-serif"><br style="background-color: rgb(255, 255, 255); "><span style="background-color: rgb(255, 255, 255); ">(c) move tests that are target dependent into target-specific directories. Previously tests would assume that "opt" understood target specific intrinsics.</span></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); ">TEST= build llvm w/ --enable-targets=all, --enable-targets=x86, --enable-targets=arm, run "make check" in each case. They pass, except for JIT and generic tests w/</span><span style="background-color: rgb(255, 255, 255); "> --enable-target=arm since my host machine is x86. Are there other tests, I should try?</span></font></div>
<div><font face="arial, helvetica, sans-serif"><br></font></div><div><span style="font-family: arial, helvetica, sans-serif; ">As noted above, there might be more work needed for dragon egg and llvm-gcc, but is the overall approach okay? Thanks!</span></div>
<div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">- Jan</font></div>