]> granicus.if.org Git - clang/commit
[omp] Re-work Clang's handling of -fopenmp and undo r237769.
authorChandler Carruth <chandlerc@gmail.com>
Thu, 28 May 2015 01:52:38 +0000 (01:52 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 28 May 2015 01:52:38 +0000 (01:52 +0000)
commit81e187390e740a2dd28e0bc3658962061ffdd33b
treef7e59b37bdea402e71ca13090ff800d0a488e9ba
parent6ce2ab97087a2f56bfa63ae04b20a1941843835a
[omp] Re-work Clang's handling of -fopenmp and undo r237769.

This isn't an actual revert of r237769, it just restores the behavior of
the Clang driver prior to it while completely re-implementing how that
behavior works.

This also re-does the work of making the default OpenMP runtime
selectable at CMake (or configure) time to work in the way all of our
other such hooks do (config.h, configure and cmake hooks, etc.).

I've re-implemented how we manage the '-fopenmp' flagset in an important
way. Now, the "default" hook just makes '-fopenmp' equivalent to
'-fopenmp=<default>' rather than a separate special beast. Also, there
is an '-fno-openmp' flag which does the obvious thing. Also, the code is
shared between all the places to select a known OpenMP runtime and act
on it.

Finally, and most significantly, I've taught the driver to inspect the
selected runtime when choosing whether to propagate the '-fopenmp' flag
to the frontend in the CC1 commandline. Without this, it isn't possible
to use Clang with libgomp, even if you were happy with the serial,
boring way in which it worked previously (ignoring all #pragmas but
linking in the library to satisfy direct calls into the runtime).

While I'm here, I've gone ahead and sketched out a path for the future
name of LLVM's OpenMP runtime (libomp) and the legacy support for its
current name (libiomp5) in what seems a more reasonable way.

To re-enable LLVM's OpenMP runtime (which I think should wait until the
normal getting started instructions are a reasonable way for falks to
check out, build, and install Clang with the runtime) all that needs to
change is the default string in the CMakeLists.txt and configure.ac
file. No code changes necessary.

I also added a test for the driver's behavior around OpenMP since it was
*completely missing* previously. Makes it unsurprising that we got it
wrong.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238389 91177308-0d34-0410-b5e6-96231b3b80d8
CMakeLists.txt
include/clang/Config/config.h.cmake
include/clang/Config/config.h.in
include/clang/Driver/Options.td
lib/Driver/Tools.cpp
test/Driver/fopenmp.c [new file with mode: 0644]