[llvm-dev] Runtime-configurable LLVM_DEFAULT_TARGET_TRIPLE by env var

Reid Kleckner via llvm-dev
2017-05-03T00:49:43Z

Hypothetically you could hack this in with our existing environment
override option, CCC_OVERRIDE_OPTIONS, like so:
ninja all
export CCC_OVERRIDE_OPTIONS=#^--target=$triple
# run lit tests

I'd rather not make a new, easier to use environment variable because it
will encourage people to use it for production cross-compilation. The
existing mechanism is probably good enough for testing purposes.

On Tue, May 2, 2017 at 5:26 PM, NAKAMURA Takumi via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> I have been working for extending test coverage for years.
> Nowadays, I have several cross-testing (target != host). See
> http://bb.pgr.jp/console
> Each of them (test-*-linux) is doing;
>
>   - Assume a preceding builder passes with warming ccache.
>   - All compilation units will hit ccache whenever the tree is built
> before lit.
>   - Almost all compilation units will hit ccache except for Host.cpp when
> the tree is built with different LLVM_DEFAULT_TARGET_TRIPLE.
>
> FYI, I am doing a trick to let ccache recognize compilation units
> identical for build.ninja;
>
>   $ sed -i -r 's=(-I|_COMPILER\S*
)/home/bb/\w[^/]*/llvm-project=\1../llvm-project=g'
> build.ninja
>
> In other words, testing builders have almost same build except for
> Host.cpp.
> I have to build the tree for each testing target.
>
> I propose an option to override LLVM_DEFAULT_TARGET_TRIPLE in run-time.
> The change will be small but I wonder which option I could take.
> Please let me know your suggestions.
>
> * Should it be configurable option?
>
> I think it shouldn't be required for release binaries, and it
wouldn't be
> required for most developers.
> I think it may be off by default.
>
> * What is the name of environment variable?
>
> I suggest the name itself could be configurable.
> If I would introduce the envvar name as "LLVM_TARGET", clang
users would
> complain why clang didn't have like "CLANG_TARGET".
>
>   $ cmake -DLLVM_DEFAULT_TARGET_ENVVAR_NAME=LLVM_TARGET
>   $ LLVM_TARGET=i686-win32 bin/llvm-lit path/to/tests
>
> This feature may be disabled if LLVM_DEFAULT_TARGET_ENVVAR_NAME is blank.
> I wonder the name LLVM_DEFAULT_TARGET_ENVVAR_NAME might be weird.
> Better suggestions are welcome.
>
> As a future plan, I will implement, in Lit, run tests with the matrix of
> triples,
> like {arm|mips|i686|x86_64}-{darwin|linux|win32}.
> Some of tests should be skipped if it isn't affected to default target
> triple.
> For example, FileCheck
>
> Regards, Takumi
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20170502/62439303/attachment.html>