[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 31 14:15:33 PDT 2011


On Tue, Aug 30, 2011 at 4:59 PM, Eric Christopher <echristo at apple.com>wrote:
>
>  On Aug 29, 2011, at 4:58 PM, Jan Voung wrote:
>
> - Is this approach acceptable?
>  >   - I guess it is hard to test if this has any effect / depends on the
> compiler.
>
> I'm not really wild about this approach, no. I'd prefer separating out the
> targets from each other and then conditionally compiling in support rather
> than relying on DCE and LTO to decide whether or not the code should be
> there. I'm open to other ideas/discussion on it though.


Hmm I'll have to think a bit more about how to facilitate conditionally
compiling-in support (e.g., the way lib/Target/X is done). The OS and
environment checks + inline code are currently quite widespread. Here is an
estimate:

grep -r "isOSDarwin" . | grep -v "\.svn" | wc -l
44
grep -r "isMacOSX" . | grep -v "\.svn" | wc -l
30
grep -r "isTargetDarwin" . | grep -v "\.svn" | wc -l
58
grep -r "Triple::Darwin" . | grep -v "\.svn" | wc -l
21
grep -r "Triple::MachO" . | grep -v "\.svn" | wc -l
9
grep -r "Triple::IOS" . | grep -v "\.svn" | wc -l
4
grep -r "Triple::MacOSX" . | grep -v "\.svn" | wc -l
4

grep -r "isOSWindows" . | grep -v "\.svn" | wc -l
11
grep -r "isTargetWindows" . | grep -v "\.svn" | wc -l
13
grep -r "isTargetCygwin" . | grep -v "\.svn" | wc -l
3
grep -r "isTargetCygMing" . | grep -v "\.svn" | wc -l
14
grep -r "Triple::Win32" . | grep -v "\.svn" | wc -l
14
grep -r "Triple::Cygwin" . | grep -v "\.svn" | wc -l
10
grep -r "Triple::MinGW32" . | grep -v "\.svn" | wc -l
14

grep -r "Triple::Linux" . | grep -v "\.svn" | wc -l
14
grep -r "isTargetLinux" . | grep -v "\.svn" | wc -l
5
grep -r "Triple::OpenBSD" . | grep -v "\.svn" | wc -l
7
...
Total matches so far: 275

Perhaps there are some cases that may be easy to refactor, yet account for
most of the bytes. Refactoring everything will probably take a while. The
fact that many of them overlap in certain ways (e.g., isTargetCygMing) makes
it... harder. Anyway, I'll think about it more. Thanks!



> > - Is trimming the size of the llvm binaries (via config flags) useful to
> others?
> >   - Other examples:
> >     - make "include/llvm/Intrinsics.td" not #include intrinsincs for
> targets that were not enabled through "--enable-target"
> >     - config flags to avoid building unused register allocators, other
> passes
>
> This is quite useful in general, I'm just not a fan of the current method.
>
> The cleanups that you have are definitely useful patches and I hope you'll
> submit those separately.

Thanks!
>
> -eric
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110831/dd054960/attachment.html>


More information about the llvm-commits mailing list