1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00
Commit Graph

629 Commits

Author SHA1 Message Date
Saleem Abdulrasool
8c60842d3a build: add the ability to create a symlink for dsymutil
Add a `LLVM_INSTALL_CCTOOLS_SYMLINKS` to mirror
`LLVM_INSTALL_BINUTILS_SYMLINKS`.  For now, this allows us to create
symlinks for `dsymutil` to `llvm-dsymutil`.  This option is off by
default, but the user can enable it.

llvm-svn: 326381
2018-02-28 23:00:50 +00:00
Justin Bogner
8b37edeaaa CMake: Allow specifying arbitrary CCACHE parameters
Introduces the LLVM_CCACHE_PARAMS cmake variable, which can be used to
pass arbitrary parameters to ccache invocations.

llvm-svn: 324779
2018-02-09 23:25:23 +00:00
Martell Malone
ab78cec62e CMAKE: apply -O3 for mingw clang
Differential Revision: https://reviews.llvm.org/D41596

llvm-svn: 324570
2018-02-08 07:13:17 +00:00
Shoaib Meenai
f6c223bd56 [CMake] Fix Bug Report URL
It looks like this hasn't been updated since bugzilla moved.

Patch by Colden Cullen.

Differential Revision: https://reviews.llvm.org/D42496

llvm-svn: 323457
2018-01-25 19:16:46 +00:00
Don Hinton
7c9b4f6a12 [cmake] Set cmake policy CMP0068 to suppress warnings on OSX
Set cmake policy CMP0068=NEW, if available, and set
"CMAKE_BUILD_WITH_INSTALL_NAME_DIR=On" globally to
maintain current behavior.

This is needed to suppress warnings on OSX starting with cmake version
3.9.6.

Differential Revision: https://reviews.llvm.org/D42463

llvm-svn: 323404
2018-01-25 04:55:18 +00:00
Paul Robinson
76705a7388 Fix up and document controlling ccache via CMake options.
Patch by Matthew Davis!

Differential Revision: https://reviews.llvm.org/D41757

llvm-svn: 323357
2018-01-24 18:15:08 +00:00
Don Hinton
988be483dd [cmake] Fix typo in LLVM_UTILS_INSTALL_DIR definition.
Differential Revision: https://reviews.llvm.org/D41804

llvm-svn: 322959
2018-01-19 17:02:12 +00:00
Hans Wennborg
7f2ddd92b5 The trunk version is now 7.0.0svn
llvm-svn: 321712
2018-01-03 14:52:54 +00:00
Don Hinton
d4b6dda211 [cmake] Update experimental target error message
Summary:
Update this error message indicate this test only ensures experimental
targets were passed via LLVM_EXPERIMENTAL_TARGETS_TO_BUILD.

Originally, this test validated all targets, but in r184923, it was moved
after the LLVMBUILDTOOL test, which also validates all targets, making
that part of the test redundant.

Differential Revision: https://reviews.llvm.org/D41273

llvm-svn: 321012
2017-12-18 19:15:15 +00:00
Shoaib Meenai
99b6e72b29 [cmake] Only attempt to install MSVC system libraries on Windows
Newer versions of CMake (I'm on 3.10, but I believe 3.9 behaves the same
way) attempt to query the system for information about the VS 2017
install. Unfortunately, this query fails on non-Windows systems:

  cmake_host_system_information does not recognize <key> VS_15_DIR

CMake isn't going to find these system libraries on non-Windows anyway
(and we were previously silencing the resultant warnings in our
cross-compilation toolchain), so it makes sense to just omit the
attempted installation entirely on non-Windows.

Differential Revision: https://reviews.llvm.org/D41220

llvm-svn: 320724
2017-12-14 18:41:49 +00:00
Don Hinton
b7e3d51c7a [cmake] Support moving debuginfo-tests to llvm/projects
Differential Revision: https://reviews.llvm.org/D40972

llvm-svn: 320497
2017-12-12 17:06:08 +00:00
Shoaib Meenai
978249b8f1 [llvm] Add install-distribution-stripped
This is identical to the install-distribution target, except that it
strips the installed binaries.

Differential Revision: https://reviews.llvm.org/D40689

llvm-svn: 320184
2017-12-08 19:44:45 +00:00
Don Hinton
6426554d8f [dump] Make LLVM_ENABLE_DUMP independent, and move to llvm-config.h
Summary: Make LLVM_ENABLE_DUMP independent LLVM_ENABLE_ASSERTIONS,
move it to llvm-config.h, and update description.

Differential Revision: https://reviews.llvm.org/D38406

llvm-svn: 320111
2017-12-07 22:55:40 +00:00
Shoaib Meenai
bb1b6ae244 [llvm] Add stripped installation targets
CMake's generated installation scripts support `CMAKE_INSTALL_DO_STRIP`
to enable stripping the installed binaries. LLVM's build system doesn't
expose this option to the `install-` targets, but it's useful in
conjunction with `install-distribution`.

Add a new function to create the install targets, which creates both the
regular install target and a second install target that strips during
installation. Change the creation of all installation targets to use
this new function. Stripping doesn't make a whole lot of sense for some
installation targets (e.g. the LLVM headers), but consistency doesn't
hurt.

I'll make other repositories (e.g. clang, compiler-rt) use this in a
follow-up, and then add an `install-distribution-stripped` target to
actually accomplish the end goal of creating a stripped distribution. I
don't want to do that step yet because the creation of that target would
depend on the presence of the `install-*-stripped` target for each
distribution component, and the distribution components from other
repositories will be missing that target right now.

Differential Revision: https://reviews.llvm.org/D40620

llvm-svn: 319480
2017-11-30 21:48:26 +00:00
Zachary Turner
7c8a28c1eb Re-revert "Refactor debuginfo-tests."
This is still breaking greendragon.

At this point I give up until someone can fix the greendragon
bots, and I will probably abandon this effort in favor of using
a private github repository.

llvm-svn: 318722
2017-11-21 01:20:28 +00:00
Zachary Turner
58ed7109e9 Resubmit "Refactor debuginfo-tests" again.
This was reverted due to the tests being run twice on some
build bots.  Each run had a slightly different configuration
due to the way in which it was being invoked.  This fixes
the problem (albeit in a somewhat hacky way).  Hopefully in
the future we can get rid of the workflow of running
debuginfo-tests as part of clang, and then this hack can
go away.

llvm-svn: 318697
2017-11-20 21:41:36 +00:00
Zachary Turner
1d6366ddcf Re-revert "Refactor debuginfo-tests"
This is still broken because it causes certain tests to be
run twice with slightly different configurations, which is
wrong in some cases.

You can observe this by running:

  ninja -nv check-all | grep debuginfo-tests

And seeing that it passes clang/test and clang/test/debuginfo-tests
to lit, which causes it to run debuginfo-tests twice.  The fix is
going to involve either:

  a) figuring out that we're running in this "deprecated" configuration,
     and then deleting the clang/test/debuginfo-tests path, which should
     cause it to behave identically to before, or:
  b) make lit smart enough that it doesn't descend into a sub-suite if
     that sub-suite already has a lit.cfg file.

llvm-svn: 318486
2017-11-17 00:41:18 +00:00
Zachary Turner
4c235f94ec Resubmit "Refactor debuginfo-tests"
This was reverted due to some failures on specific darwin buildbots,
the issue being that the new lit configuration was not setting the
SDKROOT environment variable.  We've tested a fix locally and confirmed
that it works, so this patch resubmits everything with the fix
applied.

llvm-svn: 318435
2017-11-16 18:26:20 +00:00
Daniel Sanders
f521e30212 [globalisel][tablegen] Generate rule coverage and use it to identify untested rules
Summary:
This patch adds a LLVM_ENABLE_GISEL_COV which, like LLVM_ENABLE_DAGISEL_COV,
causes TableGen to instrument the generated table to collect rule coverage
information. However, LLVM_ENABLE_GISEL_COV goes a bit further than
LLVM_ENABLE_DAGISEL_COV. The information is written to files
(${CMAKE_BINARY_DIR}/gisel-coverage-* by default). These files can then be
concatenated into ${LLVM_GISEL_COV_PREFIX}-all after which TableGen will
read this information and use it to emit warnings about untested rules.

This technique could also be used by SelectionDAG and can be further
extended to detect hot rules and give them priority over colder rules.

Usage:
* Enable LLVM_ENABLE_GISEL_COV in CMake
* Build the compiler and run some tests
* cat gisel-coverage-[0-9]* > gisel-coverage-all
* Delete lib/Target/*/*GenGlobalISel.inc*
* Build the compiler

Known issues:
* ${LLVM_GISEL_COV_PREFIX}-all must be generated as a manual
  step due to a lack of a portable 'cat' command. It should be the
  concatenation of all ${LLVM_GISEL_COV_PREFIX}-[0-9]* files.
* There's no mechanism to discard coverage information when the ruleset
  changes

Depends on D39742

Reviewers: ab, qcolombet, t.p.northover, aditya_nandakumar, rovka

Reviewed By: rovka

Subscribers: vsk, arsenm, nhaehnle, mgorny, kristof.beyls, javed.absar, igorb, llvm-commits

Differential Revision: https://reviews.llvm.org/D39747

llvm-svn: 318356
2017-11-16 00:46:35 +00:00
Hans Wennborg
da29bc5094 CMake: Turn LLVM_ENABLE_LIBXML2 into a tri-state option
In addition to the current ON and OFF options, this adds the FORCE_ON
option, which causes a configuration error if libxml2 cannot be used.

Differential revision: https://reviews.llvm.org/D40050

llvm-svn: 318209
2017-11-14 22:32:49 +00:00
Zachary Turner
3bd8031c4f Revert "Update test_debuginfo.pl script to point to new tree location."
This reverts the aforementioned patch and 2 subsequent follow-ups,
as some buildbots are still failing 2 tests because of it.
Investigation is ongoing into the cause of the failures.

llvm-svn: 318112
2017-11-13 23:33:29 +00:00
Zachary Turner
7497a5ca3a [debuginfo-tests] Make debuginfo-tests work in a standard configuration.
Previously, debuginfo-tests was expected to be checked out into
clang/test and then the tests would automatically run as part of
check-clang.  This is not a standard workflow for handling
external projects, and it brings with it some serious drawbacks
such as the inability to depend on things other than clang, which
we will need going forward.

The goal of this patch is to migrate towards a more standard
workflow.  To ease the transition for build bot maintainers,
this patch tries not to break the existing workflow, but instead
simply deprecate it to give maintainers a chance to update
the build infrastructure.

Differential Revision: https://reviews.llvm.org/D39605

llvm-svn: 317925
2017-11-10 20:57:57 +00:00
Aaron Ballman
a931962faf Move the srpm, ocaml_make_directory, llvm_vcsrevision_h, and llvm-headers projects into the Misc folder on IDEs like Visual Studio rather than leave them in the root directory. NFC.
llvm-svn: 317416
2017-11-04 19:59:14 +00:00
Shoaib Meenai
8e98660f03 [tools] Add option to install binutils symlinks
The LLVM tools can be used as a replacement for binutils, in which case
it's convenient to create symlinks with the binutils names. Add support
for these symlinks in the build system. As with any other llvm tool
symlinks, the user can limit the installed symlinks by only adding the
desired ones to `LLVM_TOOLCHAIN_TOOLS`.

Differential Revision: https://reviews.llvm.org/D39530

llvm-svn: 317272
2017-11-02 21:43:32 +00:00
Shoaib Meenai
2ed6294e10 [cmake] Remove policy conditionals
LLVM now requires a minimum of cmake 3.4.3, and all the policies
currently being set are present in that cmake version, so the
conditionals will always be true and are therefore unnecessary. The
movation is that the conditionals can give the false impression that the
policy settings are optional, whereas for example it's necessary to set
CMP0056 in order for `check_linker_flags` to operate correctly after
r316972. Inline the project version and language setting in the process.

Differential Revision: https://reviews.llvm.org/D39442

llvm-svn: 317264
2017-11-02 20:33:36 +00:00
Shoaib Meenai
c3a64e65b6 [cmake] Switch FATAL_ERROR to SEND_ERROR
It's possible for multiple distribution components to have missing
targets, and it's a lot more convenient to get all those errors in one
shot rather than having to fix them individually.

llvm-svn: 317148
2017-11-02 01:07:37 +00:00
Shoaib Meenai
b65a04dcd7 [cmake] Make check_linker_flags operate via linker flags
`check_linker_flags` currently sets the *compiler* flags (via
`CMAKE_REQUIRED_FLAGS`), and thus implicitly relies on cmake's default
behavior of passing the compiler flags to the linker. This breaks when
cmake's build rules have been altered to not pollute the link line with
compiler flags (which can be desirable for build cleanliness). Instead,
set `CMAKE_EXE_LINKER_FLAGS` explicitly and use `CMP0056` to ensure the
linker flags are passed along. Additionally, since we're inside a
function, we can just alter the variable directly (as the alteration
will be limited to the scope of the function) rather than saving and
restoring the old value.

Differential Revision: https://reviews.llvm.org/D39431

llvm-svn: 316972
2017-10-31 01:30:46 +00:00
Chris Bieneman
73a2505e62 [CMake] Allow parent projects to use in-source builds
LLVM checks if it is performing an in-source build and then stop the
build. However, this check is also triggered if LLVM is being build as
part of a parent project, which prevents the parent project itself from
using in-source builds. For example, CMake allows a parent project to
specify the output of its subproject:

add_subdirectory(llvm llvm_build)

This tells CMake to conduct an out-tree build of LLVM, which without
this patch will still fails because what is being tested is the parent
project, not LLVM. This is fixed by using the "CURRENT" variable, which
is only concerned by the CMakeLists that is actually bein processed at
the moment.

Tests:
Ran `make check-llvm`.

Patch by Henrique Jung <henriquenj_AT_gmail_DOT_com>

llvm-svn: 316142
2017-10-19 00:43:48 +00:00
Matthias Braun
842254ba37 cmake: BSD: Mark /usr/local/include as system include directory
We add /usr/local/include to the include directory list for some BSD
systems. We should mark this as a system directory to avoid files from
/usr/local/include getting picked over files shipping with llvm.

This typically manifested as gtest headers installed with the system
getting picked over the ones shipping with llvm.

Patch by Petr Penzin <penzin.dev@gmail.com>

Differential Revision: https://reviews.llvm.org/D37415

llvm-svn: 315952
2017-10-16 23:03:21 +00:00
Krzysztof Parzyszek
2a412829f6 Phony change to CMakeLists.txt to (hopefully) trigger regeneration
Ninja doesn't seem to recognize a change in a CMakeLists.txt in a
subdirectory, so r315861 is not having any effect.

llvm-svn: 315870
2017-10-15 18:23:16 +00:00
Aaron Ballman
1dbcb12601 Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people.
Error LNK2019 unresolved external symbol "public: void __cdecl `anonymous namespace'::MatchableInfo::dump(void)const " (?dump@MatchableInfo@?A0xf4f1c304@@QEBAXXZ) referenced in function "public: void __cdecl `anonymous namespace'::AsmMatcherEmitter::run(class llvm::raw_ostream &)" (?run@AsmMatcherEmitter@?A0xf4f1c304@@QEAAXAEAVraw_ostream@llvm@@@Z) llvm-tblgen D:\llvm\2017\utils\TableGen\AsmMatcherEmitter.obj 1

llvm-svn: 315854
2017-10-15 14:32:27 +00:00
Matt Morehouse
9d74587a92 [cmake] Allow building fuzzers with OSS-Fuzz flags.
Reviewers: kcc, bogner

Reviewed By: bogner

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D38858

llvm-svn: 315629
2017-10-12 21:58:41 +00:00
Don Hinton
16622c817e [dump] Remove NDEBUG from test to enable dump methods [NFC]
Summary:
Add LLVM_FORCE_ENABLE_DUMP cmake option, and use it along with
LLVM_ENABLE_ASSERTIONS to set LLVM_ENABLE_DUMP.

Remove NDEBUG and only use LLVM_ENABLE_DUMP to enable dump methods.

Move definition of LLVM_ENABLE_DUMP from config.h to llvm-config.h so
it'll be picked up by public headers.

Differential Revision: https://reviews.llvm.org/D38406

llvm-svn: 315590
2017-10-12 16:16:06 +00:00
Brian Gesiak
4f332ea1ef Revert "[CMake] Remove CMAKE_.*_OUTPUT_DIRECTORY (NFCI)"
Summary:
It appears polly makes use of the `CMAKE_RUNTIME_OUTPUT_DIRECTORY` variable
when configuring its lit test suite. Reverting this for now.

llvm-svn: 314551
2017-09-29 19:50:41 +00:00
Brian Gesiak
646138eb79 [CMake] Remove CMAKE_.*_OUTPUT_DIRECTORY (NFCI)
Summary:
Three `CMAKE_.*_OUTPUT_DIRECTORY` variables used to be set in CMake and
referenced in various other parts of the project. However, in r198205
chapuni added a note to "don't set them anymore", and any remaining
references to them were subsequently removed in r198316 and r199592.

Now that the variables are no longer used anywhere, remove them, along
with the comments advising against using them any longer.

Test Plan:
I ran `check-all` and confirmed the tests built and passed.

Reviewers: beanz, chapuni

Reviewed By: beanz

Subscribers: mgorny

Differential Revision: https://reviews.llvm.org/D38389

llvm-svn: 314550
2017-09-29 19:34:57 +00:00
Brian Gesiak
b3a2f3e82d [CMake] Fix typo "Wraning" (NFC)
Summary:
The typo was added in https://reviews.llvm.org/rL247151.
It should be "warning", not "wraning".

llvm-svn: 314486
2017-09-29 02:48:07 +00:00
Brian Gesiak
044afc7f97 [CMake] Fix typo: "in-tree" -> "in-source" (NFC)
Summary:
*In-source builds* of LLVM, in which a user invokes `cmake` from within the
LLVM source directory, or invokes `cmake -B/path/to/source/dir/of/llvm`,
are explicitly checked for and disallowed by LLVM's `CMakeLists.txt`.

*In-tree builds*, on the other hand, refer to when the source directories
of projects such as Clang are nested within the `llvm/tools` source
directory. These are not disallowed, and are in fact a common way of
building LLVM and Clang.

Revise the comment to match the logic underneath it: it checks for an
"in-source build", not an "in-tree build".

Reviewers: beanz

Reviewed By: beanz

Subscribers: mgorny

Differential Revision: https://reviews.llvm.org/D38317

llvm-svn: 314348
2017-09-27 21:37:33 +00:00
Don Hinton
0e8c8d4830 Cleanup some problems with LLVM_ENABLE_DUMP in release builds, and
always set LLVM_ENABLE_DUMP=ON for +Asserts builds.

Differential Revision: https://reviews.llvm.org/D38306

llvm-svn: 314346
2017-09-27 21:19:56 +00:00
Matthias Braun
d2ac8bfeac CMake: Add option to set LLVM_ENABLE_DUMP
Differential Revision: https://reviews.llvm.org/D38267

llvm-svn: 314186
2017-09-26 02:36:58 +00:00
Vedant Kumar
cb51713f37 [cmake] Add an option to build llvm with IR PGO
This adds an LLVM_ENABLE_IR_PGO option to enable building llvm and its
tools with IR PGO instrumentation.

Usage: -DLLVM_BUILD_INSTRUMENTED=On -DLLVM_ENABLE_IR_PGO=On (both
options must be enabled)

Differential Revision: https://reviews.llvm.org/D38066

llvm-svn: 313770
2017-09-20 17:16:01 +00:00
Zachary Turner
34baee188e Resubmit "[lit] Force site configs to run before source-tree configs"
This is a resubmission of r313270.  It broke standalone builds of
compiler-rt because we were not correctly generating the llvm-lit
script in the standalone build directory.

The fixes incorporated here attempt to find llvm/utils/llvm-lit
from the source tree returned by llvm-config.  If present, it
will generate llvm-lit into the output directory.  Regardless,
the user can specify -DLLVM_EXTERNAL_LIT to point to a specific
lit.py on their file system.  This supports the use case of
someone installing lit via a package manager.  If it cannot find
a source tree, and -DLLVM_EXTERNAL_LIT is either unspecified or
invalid, then we print a warning that tests will not be able
to run.

Differential Revision: https://reviews.llvm.org/D37756

llvm-svn: 313407
2017-09-15 22:10:46 +00:00
Zachary Turner
3fb7a0e8be Revert "[lit] Force site configs to run before source-tree configs"
This patch is still breaking several multi-stage compiler-rt bots.
I already know what the fix is, but I want to get the bots green
for now and then try re-applying in the morning.

llvm-svn: 313335
2017-09-15 02:56:40 +00:00
Zachary Turner
2fadf8bf73 [lit] Force site configs to be run before source-tree configs
This patch simplifies LLVM's lit infrastructure by enforcing an ordering
that a site config is always run before a source-tree config.

A significant amount of the complexity from lit config files arises from
the fact that inside of a source-tree config file, we don't yet know if
the site config has been run.  However it is *always* required to run
a site config first, because it passes various variables down through
CMake that the main config depends on.  As a result, every config
file has to do a bunch of magic to try to reverse-engineer the location
of the site config file if they detect (heuristically) that the site
config file has not yet been run.

This patch solves the problem by emitting a mapping from source tree
config file to binary tree site config file in llvm-lit.py. Then, during
discovery when we find a config file, we check to see if we have a
target mapping for it, and if so we use that instead.

This mechanism is generic enough that it does not affect external users
of lit. They will just not have a config mapping defined, and everything
will work as normal.

On the other hand, for us it allows us to make many simplifications:

* We are guaranteed that a site config will be executed first
* Inside of a main config, we no longer have to assume that attributes
  might not be present and use getattr everywhere.
* We no longer have to pass parameters such as --param llvm_site_config=<path>
  on the command line.
* It is future-proof, meaning you don't have to edit llvm-lit.in to add
  support for new projects.
* All of the duplicated logic of trying various fallback mechanisms of
  finding a site config from the main config are now gone.

One potentially noteworthy thing that was required to implement this
change is that whereas the ninja check targets previously used the first
method to spawn lit, they now use the second. In particular, you can no
longer run lit.py against the source tree while specifying the various
`foo_site_config=<path>` parameters.  Instead, you need to run
llvm-lit.py.

Differential Revision: https://reviews.llvm.org/D37756

llvm-svn: 313270
2017-09-14 16:47:58 +00:00
Zachary Turner
249c2c1b9b Revert "Determine up front which projects are enabled."
This was intended to be a generic CMake solution to a problem
shared across several projects.  It turns out it doesn't interact
very well certain CMake configurations, and furthermore the
"problem" is actually not a problem, as the problematic code
is never executed to begin with.  So this really isn't solving
anything.

llvm-svn: 313191
2017-09-13 20:49:25 +00:00
Zachary Turner
8756b4c9f1 Determine up front which projects are enabled.
Some projects need to add conditional dependencies on other projects.
compiler-rt is already doing this, and I attempted to add this to
debuginfo-tests when I ran into the ordering problem, that you can't
conditionally add a dependency unless that dependency's CMakeLists.txt
has already been run (which would allow you to say if (TARGET foo).

The solution to this seems to be to determine very early on the entire
set of projects which is enabled. This is complicated by the fact that
there are multiple ways to enable projects, and different tree layouts
(e.g. mono-repo, out of -tree, external, etc). This patch attempts to
centralize all of this into one place, and then updates compiler-rt to
demonstrate as a proof of concept how this can simplify code.

Differential Revision: https://reviews.llvm.org/D37637

llvm-svn: 313091
2017-09-12 23:32:34 +00:00
Reid Kleckner
1b156543dd [cmake] Stop putting the revision info in LLVM_VERSION_STRING
Summary:
This reduces the number of build actions after a no-op commit from
thousands to about six, which should be acceptable. If six actions is
still too many, developers can disable the LLVM_APPEND_VC_REV cmake
option.

llvm-config.h is a widely included header that should rarely change.
Before this patch, it would change after every re-configure. Very few
users of llvm-config.h need to know the precise version, and those that
do can migrate to incorporating LLVM_REVISION as provided by
llvm/Support/VCSRevision.h.

This should bring LLVM back to the behavior that it had before r306858
from June 30 2017. Most LLVM tools will now print a version string like
"6.0.0svn" instead of "6.0.0-git-c40c2a23de4".

Fixes PR34308

Reviewers: pcc, rafael, hans

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D37272

llvm-svn: 312043
2017-08-29 21:44:21 +00:00
Alex Bradbury
861b2b3298 Remove RISCV from LLVM_ALL_TARGETS in CMakeLists.txt
It was mistakenly added to that list in D23560 (committed in rL285712). RISCV 
is an experimental backend and should never have been in that list, I 
mistakenly interpreted LLVM_ALL_TARGETS as a list of all targets rather than 
targets to build by default. Unfortunately, because of this the RISCV backend 
has been building by default when it shouldn't be.

This commet adds a description comment, which should help to avoid such 
mistakes in the future.

See my message to llvm-dev for more information and analysis 
<http://lists.llvm.org/pipermail/llvm-dev/2017-August/116347.html>.

Differential Revision: https://reviews.llvm.org/D36538

llvm-svn: 310796
2017-08-13 18:49:33 +00:00
Quentin Colombet
7b3de01101 [GlobalISel] Make GlobalISel a non-optional library.
With this change, the GlobalISel library gets always built. In
particular, this is not possible to opt GlobalISel out of the build
using the LLVM_BUILD_GLOBAL_ISEL variable any more.

llvm-svn: 309990
2017-08-03 21:52:25 +00:00
Reid Kleckner
1891e34dd6 Revert "[lit] Avoid copying llvm/utils/lit/tests/Inputs with lit site configs"
This reverts r309602, check-lit still leaves Output directories in the
source directory.

llvm-svn: 309833
2017-08-02 17:16:25 +00:00
Reid Kleckner
88f63a118a [lit] Avoid copying llvm/utils/lit/tests/Inputs with lit site configs
Summary:
This is an alternative solution to running the lit test suite on bots
without polluting the source directory. Each input test suite gets an
auto-generated site config in the build directory that points back to
the test input source directory.

This adds some cmake comlexity, but now we don't need to remove and
re-copy the test input directory before every test.

Reviewers: delcypher, modocache

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D36026

llvm-svn: 309602
2017-07-31 18:45:44 +00:00
Brian Gesiak
c480ecccc2 Un-revert "Teach the CMake build system to run lit's test suite. These can be run"
Summary:
Depends on https://reviews.llvm.org/D35879.

This reverts rL257268, which in turn was a revert of rL257221.
https://reviews.llvm.org/D35879 marks the tests in the lit test suite
that fail on Windows as XFAIL, which should allow these tests to pass
on Windows-based buildbots.

Reviewers: delcypher, beanz, mgorny, jroelofs, rnk

Reviewed By: mgorny

Subscribers: rnk, ddunbar, george.karpenkov, llvm-commits

Differential Revision: https://reviews.llvm.org/D35880

llvm-svn: 309310
2017-07-27 19:18:35 +00:00
NAKAMURA Takumi
045a6d0499 [Modules] Rework r274270. Let Clang targets depend on intrinsics_gen.
This gets rid of almost LLVM targets unconditionally depending on intrinsic_gen.

Clang's modules still have weird dependencies and hard to remove intrinsics_gen in better way.
Then, it'd be better to give whole clang targets depend on intrinsic_gen.

llvm-svn: 308844
2017-07-23 05:09:44 +00:00
Eric Beckmann
2a72bb6108 Implement parsing and writing of a single xml manifest file.
Summary: Implement parsing and writing of a single xml manifest file.

Subscribers: mgorny, llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D35425

llvm-svn: 308679
2017-07-20 21:42:04 +00:00
Hans Wennborg
e845d29c41 Update trunk version to 6.0.0svn
llvm-svn: 308442
2017-07-19 12:19:01 +00:00
NAKAMURA Takumi
c0aac4cb7b Recommit r274270, [CMake] Module builds depend on target intrinsics_gen to be built first.
The builder clang-x86_64-linux-selfhost-modules-2 complains. Investigating.

llvm-svn: 308439
2017-07-19 11:27:31 +00:00
NAKAMURA Takumi
218b5d2231 Revert r274270, "[CMake] Module builds depend on target intrinsics_gen to be built first."
I think modulemap is sufficient for intrinsics_gen in trunk. I won't find any issues around that.

llvm-svn: 308434
2017-07-19 10:47:38 +00:00
Tom Stellard
447f9d8866 CMake: Add LLVM_UTILS_INSTALL_DIR option
Summary:
This is like the LLVM_TOOLS_INSTALL_DIR option, but for the utils
that are installed when the LLVM_INSTALL_UTILS.  This option
defaults to 'bin' to remain consistent with the current behavior, but
distros may want to install these to libexec/llvm.

Reviewers: beanz

Reviewed By: beanz

Subscribers: llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D30655

llvm-svn: 307150
2017-07-05 12:57:30 +00:00
Rafael Espindola
444f6a8d61 Completely disable git/svn version checking if not needed.
Working with git on a branch I find it really annoying that committing
a change causes ninja to think that stuff needs to be rebuilt.

With this change at least nothing in llvm needs to be rebuild when
something is committed.

llvm-svn: 306858
2017-06-30 18:48:33 +00:00
Kamil Rytarowski
e9a30e9c44 [Solaris] replace Solaris.h hack with a set of better hacks
Summary:
Got rid of unwieldy -include Solaris.h portability solution, replacing it with interposed header and moving endian defines into Host.h.

Fixes PR28370.

Reviewers: joerg, alekseyshl, mgorny

Reviewed By: joerg

Subscribers: llvm-commits, mgorny, ro, krytarowski

Patch by Fedor Sergeev.

Differential Revision: https://reviews.llvm.org/D3413

llvm-svn: 306002
2017-06-22 13:18:46 +00:00
Ekaterina Vaartis
31fedbb3b8 Test commit
llvm-svn: 305994
2017-06-22 10:38:49 +00:00
NAKAMURA Takumi
e6ce8bcee4 [CMake] Introduce LLVM_TARGET_TRIPLE_ENV as an option to override LLVM_DEFAULT_TARGET_TRIPLE at runtime.
No behavior is changed if LLVM_TARGET_TRIPLE_ENV is blank or undefined.

If LLVM_TARGET_TRIPLE_ENV is "TEST_TARGET_TRIPLE" and $TEST_TARGET_TRIPLE is not blank,
llvm::sys::getDefaultTargetTriple() returns $TEST_TARGET_TRIPLE.
Lit resets config.target_triple and config.environment[LLVM_TARGET_TRIPLE_ENV] to change the default target.

Without changing LLVM_DEFAULT_TARGET_TRIPLE nor rebuilding, lit can be run;

  TEST_TARGET_TRIPLE=i686-pc-win32 bin/llvm-lit -sv path/to/test/
  TEST_TARGET_TRIPLE=i686-pc-win32 ninja check-clang-tools

Differential Revision: https://reviews.llvm.org/D33662

llvm-svn: 305632
2017-06-17 03:19:08 +00:00
Vassil Vassilev
592c727a07 Enable c++1z experimental builds.
Patch by David Abdurachmanov!

llvm-svn: 305123
2017-06-09 22:09:57 +00:00
Vassil Vassilev
9c6f15ec87 We do not need google test utils if we disabled LLVM_INCLUDE_TESTS
Fixes embedded uses of llvm where google testing framework is provided outside.

llvm-svn: 305088
2017-06-09 16:37:39 +00:00
Aaron Ballman
9614394657 Update the documentation and CMake file for Visual Studio generators.
By default, CMake uses a 32-bit toolchain, even when on a 64-bit platform targeting a 64-bit build. However, due to the size of the binaries involved, this can cause linker instabilities (such as the linker running out of memory). Guide people to the correct solution to get CMake to use the native toolchain.

llvm-svn: 303912
2017-05-25 21:01:30 +00:00
Tom Stellard
18b13ed966 CMake: Add LLVM_DYLIB_SYMBOL_VERSIONING option
Summary:
When apps or other libraries link against a library with symbol
versions, the version string is recorded in the import table, and used
at runtime to resolve the symbol back to a library that provides that
version (vaguely like how two-level namespaces work in Mach-O).  ld's
--default-symver flag tags every exported symbol with a symbol version
string equal to the library's soname.  Using --default-symver means
multiple versions of libLLVM can coexist within the same process, at
least to the extent that they don't try to pass data between each
other's llvms.

As an example, imagine a language like Rust using llvm for CPU codegen,
binding to OpenGL, with Mesa as the OpenGL implementation using llvm for
R600 codegen.  With --default-symver Rust and Mesa will resolve their
llvm usage to the version each was linked against, which need not match.

(Other ELF platforms like BSD and Solaris might have similar semantics,
I've not checked.)

This is based on an autoconf version of this patch by Adam Jackson.

This new option can be used to add --default-symver to the linker flags
for libLLVM.so.

Reviewers: beanz

Reviewed By: beanz

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D30997

llvm-svn: 302026
2017-05-03 14:43:44 +00:00
Xin Tong
dc8dd17743 Allow suppressing host and target info in VersionPrinter
Summary:
VersionPrinter by default outputs information about the Host CPU
and Default target. Printing this information requires linking in
a large amount of data, such as supported target triples as C
strings, which in turn bloats the binary size.

Enable a new CMake option LLVM_VERSION_PRINTER_SHOW_HOST_TARGET_INFO
which controls printing of the host and target info. This allows
the target triple names to be dead-code stripped. This is a nice
win for LLVM clients that wish to minimize their binary size, such
as graphics drivers.

By default this is ON, so there is no change in the default behavior.
Clients who wish to suppress this printing can do so by setting this
option to off via CMake.

A test app on Linux that uses ParseCommandLineOptions() shows a binary
size reduction of 23KB (from 149K to 126K) for a Release build, and 24KB
(from 135K to 111K) in a MinSizeRel build.

Reviewers: klimek, beanz, bogner, chandlerc, compnerd

Reviewed By: compnerd

Patch by pammon (Peter Ammon) !

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D30904

llvm-svn: 300630
2017-04-19 00:03:36 +00:00
Petr Hosek
c7a150fa81 [CMake] Provide an option to disable runtimes build
This could be used to either disable the runtimes build altogether
or avoid building them but still generate the build targets.

Differential Revision: https://reviews.llvm.org/D31060

llvm-svn: 298653
2017-03-23 22:40:10 +00:00
Vassil Vassilev
aec9f83386 Do not polute the source directory.
When a python script is run, by default it creates the bytecode file if the directory is writable, and this ‘pollutes’ source folders.

From python's help:
-B Don’t write .py[co] files on import. See also PYTHONDONTWRITEBYTECODE.

Patch by Pere Mato (D30604)!

llvm-svn: 298603
2017-03-23 14:54:34 +00:00
Serge Pavlov
4367811d11 Fix evaluation of LLVM_DEFINITIONS
CMake variable LLVM_DEFINITIONS collects preprocessor definitions provided
for host compiler that builds llvm components. A function
add_llvm_definitions was introduced in AddLLVMDefinitions.cmake to keep
track of these definitions and was intended to be a replacement for CMake
command add_definitions. Actually in many cases add_definitions is still
used and the content of LLVM_DEFINITIONS is not actual now. On the other
hand the current version of CMake allows getting set of definitions in a
more convenient way. This fix implements evaluation of the variable by
reading corresponding cmake property.

Differential Revision: https://reviews.llvm.org/D31125

llvm-svn: 298336
2017-03-21 04:03:24 +00:00
Bob Wilson
885bbc45ef remove Cmake option for LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
This is a follow-up to my change in r295090, which added support for
disabling these checks selectively based on setting the preprocessor
macro without relying on the Cmake setting. Swift has moved over to use
that approach, so we can clean up here and remove the Cmake setting.

https://reviews.llvm.org/D30578

llvm-svn: 297109
2017-03-07 00:51:07 +00:00
Tom Stellard
ec0b8c6945 CMake: Add a build target for generating a source RPM
Summary:
'make srpm' or 'ninja srpm' will tar up the current source code and then
build a source RPM package.

By default it will use the llvm.spec file to generate the source RPM,
but you can specify your own custom spec file with the
LLVM_SRPM_USER_BINARY_SPECFILE option.  CMake will perform variable
substitution on your custom specfile, so you can reference CMake
variables in it.  For example:

Version:        @LLVM_RPM_SPEC_VERSION@

Note that everything in the source directory will be included in the
tarball so if you have a clang check out in tools/clang, then all
the clang source will end up in the tarball to.  It is recommended
to only use this build target with a clean source tree.

Reviewers: beanz

Reviewed By: beanz

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D30093

llvm-svn: 297007
2017-03-06 14:26:50 +00:00
Aditya Nandakumar
b5cce55dd5 [Tablegen] Instrumenting table gen DAGGenISelDAG
To help assist in debugging ISEL or to prioritize GlobalISel backend
work, this patch adds two more tables to <Target>GenISelDAGISel.inc -
one which contains the patterns that are used during selection and the
other containing include source location of the patterns
Enabled through CMake varialbe LLVM_ENABLE_DAGISEL_COV

llvm-svn: 295081
2017-02-14 18:32:41 +00:00
Chris Bieneman
7c80cb46fa [CMake] Allow overriding CMAKE_LIBTOOL
This patch allows a user to specify a their own libtool instead of auto-detecting one.

llvm-svn: 294371
2017-02-07 23:32:56 +00:00
Chris Bieneman
193c70a24d [CMake] Move ninja job pool options to HandleLLVMOptions
Moving the Ninja job pool configuration settings into the HandleLLVMOptions module will allow standalone builds of LLVM sub-projects to use the LLVM options without needing to re-implement them.

llvm-svn: 294334
2017-02-07 19:06:22 +00:00
Vadim Chugunov
a7e71e83a0 This addresses LLDB bug 31699, which was caused by LLVM using static linking on Windows.
In order to make sure that LLVM continues to work on machines that do not have the Universal CRT yet,
we'll need to ship a copy of UCRT in the Windows installation package. Fortunately, CMake 3.6+ already
supports app-local deployment of UCRT dlls, we just need to turn this on.

Differential Revision: https://reviews.llvm.org/D29146

llvm-svn: 293373
2017-01-28 07:39:52 +00:00
Quentin Colombet
e7e532525f Switch the default for building GlobalISel.
Now, GlobalISel will be built by default. To turn that off, one has to
use -DLLVM_BUILD_GLOBAL_ISEL=OFF on the cmake command line.

<rdar://problem/30004433>

llvm-svn: 293232
2017-01-26 23:53:31 +00:00
Hans Wennborg
cfdc41713e Bump trunk version to 5.0.0svn
llvm-svn: 291815
2017-01-12 21:22:36 +00:00
Reid Kleckner
786cc439a4 Build KillTheDoctor with mingw-w64
compiler-rt uses it in its lit tests.

llvm-svn: 290357
2016-12-22 19:11:42 +00:00
Chris Bieneman
c02aeaa9b8 [CMake] Fixing clang standalone build
I broke this in r288770.

llvm-svn: 288829
2016-12-06 17:09:29 +00:00
Chris Bieneman
2716b34915 [CMake] Cleanup TableGen include flags
It is kinda crazy to have llvm/include and llvm/lib/Target in the include path for every tablegen invocation for every tablegen-like tool.

This patch removes those flags from the tablgen function that is called everywhere by instead creating a variable LLVM_TABLEGEN_FLAGS which is setup in the LLVM source directories.

This removes TableGen.cmake's dependency on LLVM_MAIN_SRC_DIR, and LLVM_MAIN_INCLUDE_DIR.

llvm-svn: 288770
2016-12-06 04:45:11 +00:00
Mehdi Amini
a1faf78cda Introduces cmake option LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
Summary:
We recently introduced a feature that enforce at link-time that the
LLVM headers used by a clients are matching the ABI setting of the
LLVM library linked to.

However for clients that are using only headers from ADT and promise
they won't call into LLVM, this is forcing to link libSupport. This
new flag is intended to provide a way to configure LLVM with this
promise for such client.

Reviewers: bob.wilson, compnerd

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D27432

llvm-svn: 288754
2016-12-06 01:23:04 +00:00
Kuba Mracek
9b6f6b59b1 Use Darwin libtool's -no_warning_for_no_symbols if available to silence the "has no symbols" link warning
Building compiler-rt on Darwin produces dozens of meaningless warnings about object files having no symbols during static archive creation. This is very intentional as compiler-rt uses #ifdefs to conditionally compile platform-specific code, and we even have a .cpp source file that only contains static asserts to make sure the environment is configured right. On Linux, this situation is fine and no warning is produced. This patch adds a libtool version detection and if it's new enough, we'll use the -no_warning_for_no_symbols flag that suppresses this warning. Build logs should be much cleaner now!

Differential Revision: https://reviews.llvm.org/D27119

llvm-svn: 288640
2016-12-05 05:21:44 +00:00
Mehdi Amini
cfa184f7d2 Add link-time detection of LLVM_ABI_BREAKING_CHECKS mismatch
The macro LLVM_ENABLE_ABI_BREAKING_CHECKS is moved to a new header
abi-breaking.h, from llvm-config.h. Only headers that are using the
macro are including this new header.

LLVM will define a symbol, either EnableABIBreakingChecks or
DisableABIBreakingChecks depending on the configuration setting for
LLVM_ABI_BREAKING_CHECKS.

The abi-breaking.h header will add weak references to these symbols in
every clients that includes this header. This should ensure that
a mismatch triggers a link failure (or a load time failure for DSO).

On MSVC, the pragma "detect_mismatch" is used instead.

Differential Revision: https://reviews.llvm.org/D26876

llvm-svn: 288082
2016-11-28 22:23:53 +00:00
Daniil Fukalov
4f50e2021b [CMAKE] fix LLVM_OPTIMIZED_TABLEGEN for Visual Studio
At the moment optimized tablegen is generated by LLVM_USE_HOST_TOOLS variable that is not set for Visual Sudio since LLVM_ENABLE_ASSERTIONS depends on CMAKE_BUILD_TYPE value that is not equal to "DEBUG" in case of Visual Studio soltion generation.

Modified to do not depend on LLVM_ENABLE_ASSERTIONS value in VS and Xcode cases

Reviewers: beanz

Subscribers: RKSimon, llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D27135

llvm-svn: 288042
2016-11-28 17:12:09 +00:00
Yichao Yu
7bcebdc718 Add an option to disable libedit
Summary: This should provide the function similar to `--disable-libedit` with the autotools build system, which seems to be missing from the commit (r200595) that adds this.

Reviewers: pcc, beanz

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D26550

llvm-svn: 287293
2016-11-18 01:25:49 +00:00
Pavel Labath
d1b5564292 [cmake] Move LLVM_BUILD_STATIC check to an earlier point
Summary:
The motivation for this is to enable correct detection of dlopen() on Android.
Android does not provide a static version of libdl, so if we add the -static flag
after performing the check, it will succeed even though subsequent link steps
will fail. With this change we correctly detect the absence of libdl in a
LLVM_BUILD_STATIC build on Android.

The link itself still does not succeed because the code does not check the result
of this check properly, but I plan to fix that in a separate change.

Reviewers: beanz

Subscribers: danalbert, mgorny, srhines, tberghammer, llvm-commits

Differential Revision: https://reviews.llvm.org/D26463

llvm-svn: 287220
2016-11-17 11:22:23 +00:00
Chris Bieneman
9dda0e2259 [CMake] [Darwin] Add support for debugging tablegen dependencies
This patch adds an option to the build system LLVM_DEPENDENCY_DEBUGGING. Over time I plan to extend this to do more complex verifications, but the initial patch causes compile errors wherever there is missing a dependency on intrinsics_gen.

Because intrinsics_gen is a compile-time dependency not a link-time dependency, everything that relies on the headers generated in intrinsics_gen needs an explicit dependency.

llvm-svn: 287207
2016-11-17 04:36:59 +00:00
Mehdi Amini
36890938d0 [cmake] Fix handling compiler-rt in LLVM_ENABLE_PROJECTS by turning any "-" into "_"
llvm-svn: 286317
2016-11-09 00:23:20 +00:00
Mehdi Amini
d060d957a1 Add experimental support for unofficial monorepo-like directory layout
Summary:
This allows to have clang and llvm and the other subprojects
side-by-side instead of nested. This can be used with the monorepo or
multiple repos.

It will help having a single set of sources checked out but allows to
have a build directory with llvm and another one with llvm+clang.
Basically it abstracts LLVM_EXTERNAL_xxxx_SOURCE_DIR making it more
convenient by adopting a convention.

Reviewers: bogner, beanz, jlebar

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D26365

llvm-svn: 286162
2016-11-07 22:13:38 +00:00
Mehdi Amini
296f7ccf4f Revert "Add some facilities to work with a git monorepo (experimental setup)"
This reverts commit r286123, accidentally commited while testing itself...

llvm-svn: 286124
2016-11-07 17:43:08 +00:00
Mehdi Amini
aab2cc8976 Add some facilities to work with a git monorepo (experimental setup)
Summary:
Some changes are made to cmake, especially the addition of a new
LLVM_ENABLE_PROJECTS option that makes the build system aware of
the monorepo directory structure.

Also a new script is added in llvm/utils/git-svn/. When present in
the $PATH, it enables a `git llvm` command. It is providing at this
point only the ability to push from the git monorepo: `git llvm push`.
It is intended to evolves with more features, for instance I plan on
features like `git llvm show r284955` to help working with sequential
revision numbers.
The push feature is taken from Justin Lebar's script available here:
https://github.com/jlebar/llvm-repo-tools/

Reviewers: jlebar

Subscribers: mgorny, modocache, llvm-commits

Differential Revision: https://reviews.llvm.org/D26334

llvm-svn: 286123
2016-11-07 17:40:28 +00:00
Shoaib Meenai
cc318d3604 [CMake] Set default build type correctly
At least with cmake 3.6.1, the default build type setting was having no
effect; the generated CMakeCache.txt still had an empty CMAKE_BUILD_TYPE.
Force the variable to be set to achieve the desired behavior.

Differential Revision: https://reviews.llvm.org/D26200

llvm-svn: 285789
2016-11-02 06:10:03 +00:00
Chris Bieneman
6454f88f98 [CMake] Fix rpath construction for out-of-tree builds
This patch was produced in conjunction with Michał Górny. It should resolve the issues that were trying to be solved by D25304.

This moves rpath handling into `llvm_add_library` and `add_llvm_executable` so that it is available to all projects using AddLLVM whether built in-tree or out-of-tree.

llvm-svn: 285714
2016-11-01 17:44:58 +00:00
Alex Bradbury
4b9563cf55 [RISCV] Add stub backend
This contains just enough for lib/Target/RISCV to compile. Notably a basic 
RISCVTargetMachine and RISCVTargetInfo. At this point you can attempt llc 
-march=riscv32 myinput.ll and will find it fails due to the lack of 
MCAsmInfo.

See http://lists.llvm.org/pipermail/llvm-dev/2016-August/103748.html for 
further discussion

Differential Revision: https://reviews.llvm.org/D23560

llvm-svn: 285712
2016-11-01 17:27:54 +00:00
Justin Bogner
d6b5f38a66 cmake: Rename installhdrs to install-llvm-headers and fix the dependencies
The installhdrs target was inconsistently named and would behave
differently depending on whether or not you ran a build first. This
renames it to install-llvm-headers to match other target names and
adds a dependency on intrinsics_gen so that it will always install the
same set of things.

llvm-svn: 285035
2016-10-24 21:58:58 +00:00
Michal Gorny
691da67fd3 [cmake] Declare LLVM_CMAKE_PATH for use in subprojects
Declare the LLVM_CMAKE_PATH to the source directory location of CMake
files, in order to make it possible to easily use them in subprojects.
Such a variable is already declared in most of LLVM projects
(and inconsistently mixed with direct source tree references), including
Clang, LLDB, compiler-rt, libcxx... Declaring it inside main LLVM tree
makes it possible to avoid having to declare fallback values or use
conditionals in those projects.

It should be noted that in some of the subprojects LLVM_CMAKE_PATH is
used to reference generated LLVMConfig.cmake file. However, these
references are conditional to stand-alone builds and explicitly
including this file is unnecessary in combined builds.

Differential Revision: https://reviews.llvm.org/D25724

llvm-svn: 284581
2016-10-19 12:18:34 +00:00
Hongbin Zheng
57e4e747e3 [cmake] Treat polly as "in tree" if LLVM_EXTERNAL_POLLY_SOURCE_DIR is provided
Differential Revision: https://reviews.llvm.org/D25354

llvm-svn: 283608
2016-10-07 21:32:47 +00:00
Chris Bieneman
a8eef1b953 [CMake] Force CMP0057 to NEW
Hans reported an issue with r282510 on the list. This should resolve the issue.

llvm-svn: 282552
2016-09-27 23:18:32 +00:00
Michal Gorny
433a851091 [cmake] Support overriding remaining HTML doc install directories
Support overriding the Doxygen & OCamldoc install directories,
and provide a more FHS-compliant defaults for both of them. This extends
r282240 that added this override for Sphinx-built documentation.

LLVM_INSTALL_DOXYGEN_HTML_DIR and LLVM_INSTALL_OCAMLDOC_HTML_DIR are
added, to control the location where Doxygen-generated and
OCamldoc-generated HTML docs are installed appropriately. They both
specify CMake-style install paths, and therefore can either by relative
to the install prefix or absolute.

The new defaults are subdirectories of share/doc/llvm, and replace
the previous directories of 'docs/html' and 'docs/ocaml/html' that
resulted in creating invalid '/usr/docs' that furthermore lacked proper
namespacing for the LLVM package. The new defaults are consistent with
the ones used for Sphinx HTML documentation, differing only in the last
component. Since the 'html' subdirectory is already used for Sphinx
docs, the 'doxygen-html' and 'ocaml-html' directories are used instead.

Differential Revision: https://reviews.llvm.org/D24935

llvm-svn: 282536
2016-09-27 19:52:29 +00:00
Chris Bieneman
4853b82d35 Improve CMake output of host and target triple
Summary:
The previous output was confusing as it would output "Taget triple:
x86_64-unknown-linux-gnu" even when LLVM_HOST_TRIPLE or
LLVM_DEFAULT_TARGET_TRIPLE were set on the CMake command line

Patch by: Alex Richardson!

Reviewers: beanz

Subscribers: Eugene.Zelenko

Differential Revision: https://reviews.llvm.org/D17067

llvm-svn: 282516
2016-09-27 18:08:40 +00:00
Rafael Espindola
66de9e0d16 Try to fix a circular dependency in the modules build.
llvm-svn: 280746
2016-09-06 20:16:19 +00:00
Chris Bieneman
e7ba91fa87 [CMake] Connecting check-all and test-depends targets correctly
My previous attempt at this connected the sub-project check targets to the test-depends target instead of to the check-all target. That resulted in the tests running multiple times on bots that built "test-depends" and "check-all" in separate build invocations.

llvm-svn: 280392
2016-09-01 18:26:01 +00:00
Chris Bieneman
9b02f49869 Hooking up a check-all target for the runtimes projects
llvm-svn: 279756
2016-08-25 17:18:41 +00:00
Peter Zotov
40de94a24e [CMake] [OCaml] Add -DLLVM_ENABLE_OCAMLDOC switch
Patch by Michael Gorny.

llvm-svn: 279544
2016-08-23 18:07:16 +00:00
Jacques Pienaar
e532c7cb3b [lanai] Make Lanai backend non-experimental
Summary:
Add Lanai backend to default targets.

Discussion of proposal: http://lists.llvm.org/pipermail/llvm-dev/2016-July/102480.html. ISA added in r279149.

Reviewers: jyknight, rengolin, eliben, chandlerc

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D22530

llvm-svn: 279498
2016-08-23 01:06:44 +00:00
Chris Bieneman
7cd2668bb7 [CMake] Silence message on multi-configuration generators
The Xcode and Visual Studio generators always log "-- No build type selected, default to Debug". This is because CMake doesn't initialize "CMAKE_CONFIGURATION_TYPES" until the generator's EnableLanguage call gets hit.

The first place EnableLanguage gets hit in our configuration is in the project() call. Since CMAKE_BUILD_TYPE isn't used until after we call project() it is safe to just move this check down a bit.

llvm-svn: 279110
2016-08-18 18:17:28 +00:00
Jonas Hahnfeld
432bf8f81d Remove LLVM_ENABLE_LIBCXXABI
libc++.so is now a linker script that includes -lc++abi if necessary.

Differential Revision: https://reviews.llvm.org/D22861

llvm-svn: 277714
2016-08-04 10:24:48 +00:00
Sumanth Gundapaneni
dd83de66a8 Build llvm with ccache if package is present
This patch has the following changes

The CMake variable LLVM_CCACHE_BUILD is set to OFF by default.
Set this to ON for a ccache enabled build

CCACHE_CPP2 is required to compile the source file directly instead
of compiling the preprocessed file. This will help WERROR is turned ON
for a host clang compiler

The below two options makes more sense in the context of a buildbot

CCACHE_HASHDIR is required to maintain the separate cached data across
builders. This will also help the debuggers to point to the correct source
location

CCACHE_SIZE is important in the perspective of buildbot to increase the
limit on the amount of data to hold in cache for faster compilation

CCACHE_DIR is used to save the cached data to a specific directory.

llvm-svn: 277389
2016-08-01 21:28:03 +00:00
Eugene Zelenko
aef9df0c15 Add LLVM_ENABLE_LLD option to use LLD as C/C++ linker.
Differential revision: https://reviews.llvm.org/D22896

llvm-svn: 277093
2016-07-29 00:46:13 +00:00
Chris Bieneman
11e49d70ad [CMake] Support feeding DYLD_LIBRARY_PATH into archiver calls
OS X 10.11 has a feature named System Integrity Protection. The goal of the feature is to make system binaries immutable (even as root). One part of this is that protected binaries do not receive DYLD_* environment variables because the kernel scrubs them before process launch.

This causes problems for LTO bootstrap builds on Darwin that try to use the just-built libLTO with the host ar, ranlib, or libtool.

This patch addresses two problems.

(1) The tools themselves aren't protected binaries but the shim tools installed at / are, so we need to call xcrun -find to find libtool instead of using the one CMake finds.

(2) Some build tools (ninja and make) use /bin/sh to invoke their subprocesses. Since /bin/sh is a system binary, the kernel scrubs the DYLD envars from their environment. To work around this we need to set the environment variables as part of the archiver commands, so the envars are set by the shell process instead of on the shell process.

llvm-svn: 276710
2016-07-25 23:46:08 +00:00
Vedant Kumar
f67bc851fc [cmake] Use a sane default for LLVM_PROFILE_DATA_DIR
It's been pointed out that arbitrarily spraying raw profiles into a
build directory is insane. Doing this wastes a tremendous amount of
space and is also very lossy, since the test harness tends to wipe away
temporary sub-directories (which usually contain relevant profile data).

The new default is a `profiles` directory inside of the build dir.

llvm-svn: 276504
2016-07-23 00:38:11 +00:00
Michael Gottesman
adecc6a299 [cmake] Move the including of utils/unittests under LLVM_INCLUDE_UTILS instead of LLVM_INCLUDE_TESTS.
This does not change anything by default since LLVM_INCLUDE_UTILS is already set
to TRUE by default. In addition, since LLVM_INCLUDE_TESTS => LLVM_INCLUDE_UTILS,
the only way that this can cause changes is in the case where LLVM_INCLUDE_UTILS
is set to TRUE, but LLVM_INCLUDE_TESTS is FALSE. In that case, building gtest is
not a huge cost.

The reason to do this is that without this change, one can not turn off
LLVM_INCLUDE_TESTS in downstream projects that also use gtest for unittests. It
also just in general makes more sense since LLVM_INCLUDE_UTILS gates FileCheck
and other utilities that are along the lines of gtest.

Additionally from talking with chandlerc, this was not done for any specific
reason, so there is no reason not to do it and lots of benefit to doing it.

llvm-svn: 276342
2016-07-21 21:35:23 +00:00
Quentin Colombet
02adacfe73 [CMake][GlobalISel] Turn LLVM_BUILD_GLOBAL_ISEL into an option. NFC.
Previously LLVM_BUILD_GLOBAL_ISEL was a boolean variable and although,
this is strictly identical to an option, it did not convey the
information that the user may set it. Options are here for that.

llvm-svn: 276306
2016-07-21 17:26:45 +00:00
Chandler Carruth
93b744cf6b Add AIX support to Path.inc, Host.h, and CMake.
Patch by Andrew Paprocki!

Differential Revision: https://reviews.llvm.org/D18359

llvm-svn: 276045
2016-07-19 22:46:39 +00:00
Hans Wennborg
39d26639c0 Bump the trunk version to 4.0.0svn.
Differential Revision: https://reviews.llvm.org/D21821

llvm-svn: 275827
2016-07-18 17:51:04 +00:00
Michael Gottesman
a1e74f182b [cmake] Create the LLVM_BUILD_UTILS option.
This option is the equivalent option to LLVM_BUILD_TOOLS but for executables
created via add_llvm_utility.

This is a useful tool for improving compile time in situations where LLVM is
used as a library and no testing tools are needed.

It follows the exact same implemention model as LLVM_BUILD_TOOLS.

Since the option is by default set to on, no behavior is changed unless one sets
it from the command line to be false.

llvm-svn: 275007
2016-07-10 02:43:47 +00:00
Vassil Vassilev
7007fed7cc [CMake] Module builds depend on target intrinsics_gen to be built first.
When compiling with modules, header A and B can be in the same module M.
B depends on intrinsics_gen and A doesn't. Compiling a source file #include-ing
header A, we implicitly request module M to be built. It puts header A and B in
the same TU and tries to build them. Since B depends on intrinsics_gen (which
might not be built yet) we run into build failures.

This should fix our modules buildbot.

Patch reviewed by Chris Bieneman.

llvm-svn: 274270
2016-06-30 20:35:56 +00:00
Adrian Prantl
a0611feb1f [CMake] Add an LLVM_ENABLE_MODULE_DEBUGGING flag for building with -gmodules.
This flag is only effective in builds with debug info and modules.
The default is On for Darwin only.

rdar://problem/27019000

llvm-svn: 274244
2016-06-30 17:15:44 +00:00
Adrian Prantl
18577887ec [CMake] Introduce a LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY flag.
On Darwin it is currently impossible to build LLVM with modules
because the Darwin system module map is not compatible with
-fmodules-local-submodule-visibility at this point in time.  This
patch makes the flag optional and off by default on Darwin so it
becomes possible to build LLVM with modules again.

http://reviews.llvm.org/D21827
rdar://problem/27019000

llvm-svn: 274196
2016-06-30 01:46:49 +00:00
Chris Bieneman
3fe6b38cf2 [CMake] Add LLVM runtimes directory
Summary:
There are a few LLVM projects that produce runtime libraries. Ideally
runtime libraries should be built differently than other projects,
specifically they should be built using the just-built toolchain.

There is support for building compiler-rt in this way from the clang
build. Moving this logic into the LLVM build is interesting because it
provides a simpler way to extend the just-built toolchain to include
LLD and the LLVM object file tools.

Once this functionality is better fleshed out and tested we’ll want to
encapsulate it in a module that can be used for clang standalone
builds, and we’ll want to make it the default way to build compiler-rt.

With this patch applied there is no immediate change in the build.
Moving compiler-rt out from llvm/projects into llvm/runtimes enables
the functionality.

This code has a few improvements over the method provided by
LLVM_BUILD_EXTERNAL_COMPILER_RT. Specifically the sub-ninja command is
always invoked, so changes to compiler-rt source files will get built
properly, so this patch can be used for iterative development with
just-built tools.

This first patch only works with compiler-rt. Support for other
runtime projects will be coming in follow-up patches.

Reviewers: chandlerc, bogner

Subscribers: kubabrecka, llvm-commits

Differential Revision: http://reviews.llvm.org/D20992

llvm-svn: 273620
2016-06-23 22:07:21 +00:00
Vedant Kumar
c6b8569cc2 Add support for collating profiles for use with code coverage
Differential Revision: http://reviews.llvm.org/D20993

llvm-svn: 272599
2016-06-13 23:33:48 +00:00
Chris Bieneman
cc15f2401c [CMake] Cleanup version checks for CMake 3.0
This just removes some redundant checks and updates warning text.

llvm-svn: 272218
2016-06-08 22:38:30 +00:00
Chris Bieneman
746ef5229c [CMake] Cleanup uses of USES_TERMINAL
Now that we are on CMake 3.4.3 we no longer need a version check around this.

llvm-svn: 272211
2016-06-08 22:19:25 +00:00
Chris Bieneman
b087e27002 [CMake] Support overriding binary install directory
This patch adds a new option LLVM_TOOLS_INSTALL_DIR which allows customizing the location executables and symlinks get installed to. This adds the functionality provided by autoconf's --bindir flag.

This patch is based on patches from and collaboration with Tony Kelman, and replaces http://reviews.llvm.org/D20934.

llvm-svn: 272200
2016-06-08 21:19:26 +00:00
Chris Bieneman
a234eb432f [CMake] Update to requiring CMake 3.4.3
Summary:
This is as per the discussions on developer lists:

http://lists.llvm.org/pipermail/llvm-dev/2016-April/098780.html
http://lists.llvm.org/pipermail/llvm-dev/2016-May/100058.html

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D20822

llvm-svn: 271325
2016-05-31 20:21:32 +00:00
Chris Bieneman
64aa95c1c8 Remove LLVM_ENABLE_TIMESTAMPS
Summary:
As per the discussion on LLVM-dev this patch proposes removing LLVM_ENABLE_TIMESTAMPS.

The only complicated bit of this patch is the Windows support. On windows we used to log an error if /INCREMENTAL was passed to the linker when timestamps were disabled.

With this change since timestamps in code are always disabled we will always compile on windows with /Brepro unless /INCREMENTAL is specified, and we will log a warning when /INCREMENTAL is specified to notify the user that the build will be non-deterministic.

See: http://lists.llvm.org/pipermail/llvm-dev/2016-May/098990.html

Reviewers: bogner, silvas, rnk

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D19892

llvm-svn: 268670
2016-05-05 19:57:03 +00:00
James Y Knight
49bc30f7bb Remove bit-rotten CppBackend.
This backend was supposed to generate C++ code which will re-construct
the LLVM IR passed as input. This seems to me to have very marginal
usefulness in the first place.

However, the code has never been updated to use IRBuilder, which makes
its current value negative -- people who look at the output may be
steered to use the *wrong* C++ APIs to construct IR.

Furthermore, it's generated code that doesn't compile since at least
2013.

Differential Revision: http://reviews.llvm.org/D19942

llvm-svn: 268631
2016-05-05 14:35:40 +00:00
Tobias Grosser
47b6dec455 cmake: Prefix Polly options with LLVM_ to avoid variable shadowing
Summary:
Before this change certain Polly variables have been used both as user-facing
CACHED cmake variables as well as uncached internal variables. Even though
this seems to have worked OK in practice, the behavior only worked due to
one variable shadowing the other. This behavior has been found confusing.
To make the use of cmake variables more clear we now prefix the cached, user
facing variables with LLVM_ as it is common habit for LLVM options and also
moved the _POLLY_ term to the beginning to ensure related options are sorted
after each other. The variables that control the behavior of LLVM/Polly are then
set by forwarding the values set in the user facing option variables.
As a result, Polly is now enabled with LLVM_POLLY_BUILD instead of BUILD_POLLY
and the linking behavior of Polly is controlled with LLVM_POLLY_LINK_INTO_TOOLS
instead of LINK_POLLY_INTO_TOOLS.

Reviewers: bogner, Meinersbur

Subscribers: pollydev, llvm-commits

Differential Revision: http://reviews.llvm.org/D19907

llvm-svn: 268537
2016-05-04 20:04:40 +00:00
Chris Bieneman
56186a0a2f Disable LLVM_ENABLE_TIMESTAMPS by default
This change is based on the discussion from http://lists.llvm.org/pipermail/llvm-dev/2016-May/098990.html.

The goal is to make the default LLVM configuration build deterministically.

llvm-svn: 268441
2016-05-03 21:22:14 +00:00
Filipe Cabecinhas
c8ae081a57 Unify XDEBUG and EXPENSIVE_CHECKS (into the latter), and add an option to the cmake build to enable them.
Summary:
Historically, we had a switch in the Makefiles for turning on "expensive
checks". This has never been ported to the cmake build, but the
(dead-ish) code is still around.

This will also make it easier to turn it on in buildbots.

Reviewers: chandlerc

Subscribers: jyknight, mzolotukhin, RKSimon, gberry, llvm-commits

Differential Revision: http://reviews.llvm.org/D19723

llvm-svn: 268050
2016-04-29 15:22:48 +00:00
Tobias Grosser
c59be741e5 cmake: Set LINK_POLLY_INTO_TOOLS to ON (v2)
This is the second try. This time we disable this feature if no Polly checkout
is available. For this to work we need to check if tools/polly is present
early enough that our decision is known before cmake generates Config/config.h.

With Polly checked into LLVM it was since a long time possible to compile
clang/opt/bugpoint with Polly support directly linked in, instead of only
providing Polly as a separate loadable module. This commit switches the
default from providing Polly as a module to linking Polly into tools, such
that it becomes unnecessary to load the Polly module when playing with Polly.
Such configuration has shown a lot more convenient for day-to-day Polly use.

This change does not impact the default behavior of any tool, if Polly is not
explicitly enabled when calling clang/opt/bugpoint Polly does not affect
compilation.

This change also does not impact normal LLVM/clang checkouts that do not
contain Polly.

Reviewers: jdoerfert, Meinersbur

Subscribers: pollydev, llvm-commits

Differential Revision: http://reviews.llvm.org/D19711

llvm-svn: 268048
2016-04-29 15:07:22 +00:00
Tobias Grosser
98d937f925 Revert "cmake: Set LINK_POLLY_INTO_TOOLS to ON"
This reverts commit r268033 as it breaks some buildbots.

llvm-svn: 268035
2016-04-29 12:38:24 +00:00
Tobias Grosser
8072212fd5 cmake: Set LINK_POLLY_INTO_TOOLS to ON
With Polly checked into LLVM it was since a long time possible to compile
clang/opt/bugpoint with Polly support directly linked in, instead of only
providing Polly as a separate loadable module. This commit switches the
default from providing Polly as a module to linking Polly into tools, such
that it becomes unnecessary to load the Polly module when playing with Polly.
Such configuration has shown a lot more convenient for day-to-day Polly use.

This change does not impact the default behavior of any tool, if Polly is not
explicitly enabled when calling clang/opt/bugpoint Polly does not affect
compilation.

This change also does not impact normal LLVM/clang checkouts that do not
contain Polly.

Reviewers: jdoerfert, Meinersbur, sebpop, etherzhhb, zinob, hiraditya

Subscribers: pollydev, llvm-commits

Differential Revision: http://reviews.llvm.org/D19711

llvm-svn: 268033
2016-04-29 12:23:11 +00:00
Chris Bieneman
d575650867 [CMake] [Darwin] Use libtool instead of ar && ranlib
Summary: Using libtool instead of ar and ranlib on Darwin shaves a minute off my clang build. This is because on Darwin libtool is optimized to give hints to the kernel about filesystem interactions that allow it to be faster.

Reviewers: bogner, pete

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D19611

llvm-svn: 267930
2016-04-28 20:14:19 +00:00
Aaron Ballman
97d20cba92 Moving llvm-test-depends and test-depends into the Tests folder; NFC, this simply cleans up the generated solution so that these targets don't live in the root folder of the IDE.
llvm-svn: 266078
2016-04-12 15:09:14 +00:00
Reid Kleckner
11380bdeed dos2unix CMakeLists.txt
The sign now reads "0 days since the last line ending confusion"

llvm-svn: 264609
2016-03-28 18:19:32 +00:00
Mike Spertus
2b661ae3a6 Forgot to commit this file in revision 264601
llvm-svn: 264602
2016-03-28 17:59:40 +00:00
Justin Bogner
57ad3995ac llvm-shlib: Remove the option to override __cxa_atexit
If anybody is actually using this, it probably doesn't do what they
think it does. This actually causes the dylib to *export* a
__cxa_atexit symbol, so anything that links it probably loses their
exit time destructors as well as disabling LLVM's.

This just removes the option entirely. If somebody does need this
behaviour we should figure out a more principled way to do it.

This is effectively a revert of r223805.

llvm-svn: 263498
2016-03-14 21:54:45 +00:00
Chris Bieneman
d5c3a96844 [CMake] Add test-depends target to build dependencies of check-all
This is just another convenience target for bots to use. It enables isolation of building and testing.

llvm-svn: 262494
2016-03-02 17:56:30 +00:00
Chris Bieneman
d204338a75 [CMake] Add distribution target that is the "just-build" side of install-distribution
This is just a convenience target to allow limiting what you build.

llvm-svn: 262427
2016-03-02 00:27:12 +00:00
Chris Bieneman
d8e8c23332 [CMake] Allow LLVM_TARGETS_TO_BUILD to accept "Native"
This allows a user to specify "Native" as a target when configuring LLVM. Native will resolve to the LLVM_NATIVE_ARCH, which is the target that supports code generation for the host.

llvm-svn: 262070
2016-02-26 21:21:40 +00:00
Chris Bieneman
c833f3d653 [CMake] Create an install-distribution target driven by LLVM_DISTRIBUTION_COMPONENTS
The idea here is to provide a customizable install target that only depends on building the things you actually want to install. It relies on each component being installed having an auto-generated install-${component}, which in turn depends only on the target being installed.

This is fundamentally a workaround for the fact that CMake generates build files which have their "install" target depend on the "all" target. This results in "ninja install" building a bunch of unneeded things.

llvm-svn: 261681
2016-02-23 20:33:53 +00:00
Chris Bieneman
aa34a674c5 [CMake] Properly set CMAKE_BUILD_TYPE to Debug by default
Summary:
PR26666: CMAKE_BUILD_TYPE was previously being reset to blank.

Reviewers: rnk, beanz

Subscribers: llvm-commits

Patch By: Derek Bruening

Differential Revision: http://reviews.llvm.org/D17398

llvm-svn: 261273
2016-02-18 23:07:09 +00:00
Quentin Colombet
fb75f3ace2 [CMake] Add a macro definition to detect if we are building GlobalISel:
LLVM_BUILD_GLOBAL_ISEL

llvm-svn: 260457
2016-02-10 23:00:57 +00:00
Quentin Colombet
8d3acd6266 [GlobalISel] Add the proper cmake plumbing.
This patch adds the necessary plumbing to cmake to build the sources related to
GlobalISel.

To build the sources related to GlobalISel, we need to add -DBUILD_GLOBAL_ISEL=ON.
By default, this is OFF, thus GlobalISel sources will not impact people that do
not explicitly opt-in.

Differential Revision: http://reviews.llvm.org/D15983

llvm-svn: 258344
2016-01-20 20:58:56 +00:00
Hans Wennborg
63448e6292 Update version to 3.9.
llvm-svn: 257627
2016-01-13 17:32:32 +00:00
Dan Liew
277612653e Revert "Teach the CMake build system to run lit's test suite. These can be run"
This reverts r257221.

This caused several build bot failures

* It looks like some of the tests don't work correctly under Windows
* It looks like the lit per test timeout tests fail

So I'm reverting for now. Once the above failures are fixed running
lit's tests can be enabled again.

llvm-svn: 257268
2016-01-09 21:42:57 +00:00
Dan Liew
c14975ef62 Teach the CMake build system to run lit's test suite. These can be run
directy with ``make check-lit`` and are run as part of
``make check-all``.

In principle we should run lit's testsuite before testing LLVM using lit
so that any problems with lit get discovered before testing LLVM so we
can bail out early.  However this implementation (``check-all`` runs all
tests together) seemed simpler and will still report failing lit tests.

Note that the tests and the configured ``lit.site.cfg`` have to be
copied into the build directory to avoid polluting the source tree.

llvm-svn: 257221
2016-01-08 22:36:22 +00:00
Benjamin Kramer
620dbe5571 Generate a clang CompilationDatabase when running CMake
This generates a compile_commands.json file, which tells tools like
YouCompleteMe and clang_complete exactly how to build each source file.

Patch by Justin Lebar!

llvm-svn: 255789
2015-12-16 18:17:45 +00:00
Chris Bieneman
fa052602ba [CMake] Add option LLVM_EXTERNALIZE_DEBUGINFO
Summary: This adds support for generating dSYM files and stripping debug info from executables and dylibs. It also supports passing -object_path_lto to the linker to generate dSYMs for LTO builds.

Reviewers: bogner, friss

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D15133

llvm-svn: 254627
2015-12-03 18:45:39 +00:00