1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00
Commit Graph

7680 Commits

Author SHA1 Message Date
Adrian McCarthy
e357098006 Fix some lit test ResourceWarnings on Windows
When running LLDB lit tests on Windows, the system selects a debug version
of Python, which was issuing lots of ResourceWarnings about files that
weren't closed.  There are two kinds of them, and each test triggered one
of each.

This patch fixes one kind by ensuring TestRunner explicitly close the
temporary files created for routing stderr.  This is important on Windows
but has no net effect on Posix systems.

The remaining ResourceWarnings are more elusive; the bug may lie in
the Python library subprocess.py, and it may be Windows-specific.

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

llvm-svn: 363700
2019-06-18 16:36:57 +00:00
Nico Weber
106284874f gn build: Merge r363658
llvm-svn: 363673
2019-06-18 12:29:04 +00:00
Nico Weber
a55cae1e66 gn build: Merge r363649
This reverts commit "gn build: Merge r363626" because r363626
was reverted in r363649.

llvm-svn: 363672
2019-06-18 12:26:31 +00:00
Diogo N. Sampaio
66545ae9c9 [NFC] Improve triple match of scripts that update tests
Summary:
The prior behavior of the triple matcher would stop
in the first matched triple. It was not possible to
create specific matches for sub-sets of a triple
(e.g aarch64-apple-darwin would never be used after
aarch64 was matched).

This patch:
1) Allows that specialized triples take priority,
considering that the string lenght of the triple
indentifies how specialized a triple is. If two
triples of same lenght match, the one matched first
prevails, preserving the old behavior.

2) Remove 20 duplicated triples of arm, thumb,
aarch64 options with same arguments, matching
the common prefix (aarch64, arm, thumb) of them.

3) Creates three new function matching regexes and
five triple options for arm64-apple-ios,
(arm|thumb)-apple-ios and thumb(v5)?-macho

Reviewers: lebedev.ri, RKSimon, MaskRay, gbedwell

Reviewed By: MaskRay

Subscribers: javed.absar, kristof.beyls, llvm-commits, carwil

Tags: #llvm

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

llvm-svn: 363656
2019-06-18 10:04:36 +00:00
Peter Collingbourne
5b2ec1b30d gn build: Merge r363626.
llvm-svn: 363634
2019-06-17 23:39:31 +00:00
Peter Collingbourne
b1afe40af5 gn build: Merge r363483.
llvm-svn: 363610
2019-06-17 20:03:11 +00:00
Peter Collingbourne
54e38a1e56 gn build: Merge r363584.
llvm-svn: 363609
2019-06-17 19:59:16 +00:00
Nico Weber
9848cb5275 gn build: Merge r363541
llvm-svn: 363583
2019-06-17 17:45:12 +00:00
Nico Weber
c377505761 gn build: Merge r363530
llvm-svn: 363549
2019-06-17 12:18:27 +00:00
Nico Weber
3f76d78820 gn build: Merge r363444
llvm-svn: 363505
2019-06-16 02:24:01 +00:00
Matt Arsenault
d4b5b30e5d UpdateTestChecks: Consider .section as end of function for AMDGPU
Kernels seem to go directly to a section switch instead of emitting
.Lfunc_end. This fixes including all of the kernel metadata in the
check lines, which is undesirable most of the time.

llvm-svn: 363452
2019-06-14 20:40:15 +00:00
Nico Weber
a2154ca0c7 gn build: Add NVPTX target
The NVPTX target is a bit unusual in that it's the only target without a
disassembler, and one of three targets without an asm parser (and the
first one of those three in the gn build). NVPTX doesn't have those
because it's not a binary format.

The CMake build checks for the existence of
{AsmParser,Disassembler}/CMakeLists.txt when setting
LLVM_ENUM_ASM_PARSERS / LLVM_ENUM_DISASSEBLERS
(http://llvm-cs.pcc.me.uk/CMakeLists.txt#744). The GN build doesn't want
to hit the disk for things like this, so instead I'm adding explicit
`targets_with_asm_parsers` and `targets_with_disassemblers` lists. Since
both are needed rarely, they are defined in their own gni files.

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

llvm-svn: 363437
2019-06-14 18:07:00 +00:00
Nico Weber
837241307e gn build: Simplify Target build files
Now that the cycle between MCTargetDesc and TargetInfo is gone
(see revisions 360709 360718 360722 360724 360726 360731 360733 360735 360736),
remove the dependency from TargetInfo on MCTargetDesc:tablegen. In most
targets, this makes MCTargetDesc:tablegen have just a single use, so
inline it there.

For AArch64, ARM, and RISCV there's still a similar cycle between
MCTargetDesc and Utils, so the MCTargetDesc:tablegen indirection is
still needed there.

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

llvm-svn: 363436
2019-06-14 17:58:34 +00:00
Michal Gorny
2e09cdda41 [lit] Fix UnicodeEncodeError when test commands contain non-ASCII chars
Ensure that the bash script written by lit TestRunner is open with UTF-8
encoding when using Python 3.  Otherwise, attempt to write non-ASCII
characters causes UnicodeEncodeError.  This happened e.g. with
the following LLD test:

UNRESOLVED: lld :: ELF/format-binary-non-ascii.s (657 of 2119)
******************** TEST 'lld :: ELF/format-binary-non-ascii.s' FAILED ********************
Exception during script execution:
Traceback (most recent call last):
  File "/home/mgorny/llvm-project/llvm/utils/lit/lit/worker.py", line 63, in _execute_test
    result = test.config.test_format.execute(test, lit_config)
  File "/home/mgorny/llvm-project/llvm/utils/lit/lit/formats/shtest.py", line 25, in execute
    self.execute_external)
  File "/home/mgorny/llvm-project/llvm/utils/lit/lit/TestRunner.py", line 1644, in executeShTest
    res = _runShTest(test, litConfig, useExternalSh, script, tmpBase)
  File "/home/mgorny/llvm-project/llvm/utils/lit/lit/TestRunner.py", line 1590, in _runShTest
    res = executeScript(test, litConfig, tmpBase, script, execdir)
  File "/home/mgorny/llvm-project/llvm/utils/lit/lit/TestRunner.py", line 1157, in executeScript
    f.write('{ ' + '; } &&\n{ '.join(commands) + '; }')
UnicodeEncodeError: 'ascii' codec can't encode character '\xa3' in position 274: ordinal not in range(128)

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

llvm-svn: 363388
2019-06-14 13:31:48 +00:00
Nico Weber
8972dd7f74 Revert r363298 "[lit] Disable test on darwin when building shared libs."
It broke running check-lld on mac, see https://reviews.llvm.org/D61697

llvm-svn: 363379
2019-06-14 12:58:17 +00:00
Nico Weber
a2bb38a508 gn build: Merge r363376
llvm-svn: 363378
2019-06-14 12:31:18 +00:00
Nico Weber
6b6852bab8 gn build: Merge r363204 (clang-scan-deps)
llvm-svn: 363353
2019-06-14 04:26:01 +00:00
Craig Topper
54e0aaff00 [X86Disassembler] Unify the EVEX and VEX code in emitContextTable. Merge the ATTR_VEXL/ATTR_EVEXL bits. NFCI
Merging the two bits shrinks the context table from 16384 bytes to 8192 bytes.

Remove the ATTRIBUTE_BITS macro and just create an enum directly. Then fix the ATTR_max define to be 8192 to reflect the table size so we stop hardcoding it separately.

llvm-svn: 363330
2019-06-13 22:15:25 +00:00
Nico Weber
7d8d84a0ca gn build: Merge r363242
llvm-svn: 363324
2019-06-13 20:25:18 +00:00
Don Hinton
9ed1d471f3 [lit] Disable test on darwin when building shared libs.
Summary:
This test fails to link shared libraries because tries to run
a copied version of clang-check to see if the mock version of libcxx
in the same directory can be loaded dynamically.  Since the test is
specifically designed not to look in the default just-built lib
directory, it must be disabled when building with
BUILD_SHARED_LIBS=ON.

Currently only disabling it on Darwin and basing it on the
enable_shared flag.

Reviewed By: ilya-biryukov

Tags: #clang, #llvm

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

llvm-svn: 363298
2019-06-13 19:08:49 +00:00
Sander de Smalen
5f91239343 Improve reduction intrinsics by overloading result value.
This patch uses the mechanism from D62995 to strengthen the
definitions of the reduction intrinsics by letting the scalar
result/accumulator type be overloaded from the vector element type.

For example:

  ; The LLVM LangRef specifies that the scalar result must equal the
  ; vector element type, but this is not checked/enforced by LLVM.
  declare i32 @llvm.experimental.vector.reduce.or.i32.v4i32(<4 x i32> %a)

This patch changes that into:

  declare i32 @llvm.experimental.vector.reduce.or.v4i32(<4 x i32> %a)

Which has the type-constraint more explicit and causes LLVM to check
the result type with the vector element type.

Reviewers: RKSimon, arsenm, rnk, greened, aemerson

Reviewed By: arsenm

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

llvm-svn: 363240
2019-06-13 09:37:38 +00:00
Sander de Smalen
dfbd44a9f0 [IntrinsicEmitter] Extend argument overloading with forward references.
Extend the mechanism to overload intrinsic arguments by using either
backward or forward references to the overloadable arguments.

In for example:

  def int_something : Intrinsic<[LLVMPointerToElt<0>],
                                [llvm_anyvector_ty], []>;

LLVMPointerToElt<0> is a forward reference to the overloadable operand
of type 'llvm_anyvector_ty' and would allow intrinsics such as:

  declare i32* @llvm.something.v4i32(<4 x i32>);
  declare i64* @llvm.something.v2i64(<2 x i64>);

where the result pointer type is deduced from the element type of the
first argument.

If the returned pointer is not a pointer to the element type, LLVM will
give an error:

  Intrinsic has incorrect return type!
  i64* (<4 x i32>)* @llvm.something.v4i32

Reviewers: RKSimon, arsenm, rnk, greened

Reviewed By: arsenm

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

llvm-svn: 363233
2019-06-13 08:19:33 +00:00
Nico Weber
15d33a74eb gn build: Add SystemZ target
llvm-svn: 363170
2019-06-12 14:24:43 +00:00
Nico Weber
c78f801842 gn build: Add Mips target
llvm-svn: 363159
2019-06-12 13:25:58 +00:00
Nico Weber
2b1c2395d2 gn build: add RISCV target
Patch from David L. Jones <dlj@google.com>, with minor tweaks by me.

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

llvm-svn: 363154
2019-06-12 12:41:03 +00:00
Nico Weber
9777aac7a0 gn build: Merge r363122
llvm-svn: 363152
2019-06-12 12:27:04 +00:00
Nico Weber
e9a0448218 Share /machine: handling code with llvm-cvtres too
r363016 let lld-link and llvm-lib share the /machine: parsing code.
This lets llvm-cvtres share it as well.

Making llvm-cvtres depend on llvm-lib seemed a bit strange (it doesn't
need llvm-lib's dependencies on BinaryFormat and BitReader) and I
couldn't find a good place to put this code. Since it's just a few
lines, put it in lib/Object for now.

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

llvm-svn: 363144
2019-06-12 11:32:43 +00:00
Nico Weber
1aeeff713a lld-link: Reject more than one resource .obj file
Users are exepcted to pass all .res files to the linker, which then
merges all the resource in all .res files into a tree structure and then
converts the final tree structure to a .obj file with .rsrc$01 and
.rsrc$02 sections and then links that.

If the user instead passes several .obj files containing such resources,
the correct thing to do would be to have custom code to merge the trees
in the resource sections instead of doing normal section merging -- but
link.exe rejects if multiple resource obj files are passed in with
LNK4078, so let lld-link do that too instead of silently writing broken
.rsrc sections in that case.

The only real way to run into this is if users manually convert .res
files to .obj files by running cvtres and then handing the resulting
.obj files to lld-link instead, which in practice likely never happens.

(lld-link is slightly stricter than link.exe now: If link.exe is passed
one .obj file created by cvtres, and a .res file, for some reason it
just emits a warning instead of an error and outputs strange looking
data. lld-link now errors out on mixed input like this.)

One way users could accidentally run into this is the following
scenario: If a .res file is passed to lib.exe, then lib.exe calls
cvtres.exe on the .res file before putting it in the output .lib.
(llvm-lib currently doesn't do this.)
link.exe's /wholearchive seems to only add obj files referenced from the
static library index, but lld-link current really adds all files in the
archive. So if lld-link /wholearchive is used with .lib files produced
by lib.exe and .res files were among the files handed to lib.exe, we
previously silently produced invalid output, but now we error out.

link.exe's /wholearchive semantics on the other hand mean that it
wouldn't load the resource object files from the .lib file at all.
Since this scenario is probably still an unlikely corner case,
the difference in behavior here seems fine -- and lld-link might have to
change to use link.exe's /wholearchive semantics in the future anyways.

Vaguely related to PR42180.

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

llvm-svn: 363078
2019-06-11 15:22:28 +00:00
Tom Stellard
f97cbfd486 Revert CMake: Make most target symbols hidden by default
This reverts r362990 (git commit 374571301dc8e9bc9fdd1d70f86015de198673bd)

This was causing linker warnings on Darwin:

ld: warning: direct access in function 'llvm::initializeEvexToVexInstPassPass(llvm::PassRegistry&)'
from file '../../lib/libLLVMX86CodeGen.a(X86EvexToVex.cpp.o)' to global weak symbol
'void std::__1::__call_once_proxy<std::__1::tuple<void* (&)(llvm::PassRegistry&),
std::__1::reference_wrapper<llvm::PassRegistry>&&> >(void*)' from file '../../lib/libLLVMCore.a(Verifier.cpp.o)'
means the weak symbol cannot be overridden at runtime. This was likely caused by different translation
units being compiled with different visibility settings.

llvm-svn: 363028
2019-06-11 03:21:13 +00:00
Nico Weber
9314454aa3 gn build: Merge r362939
llvm-svn: 363020
2019-06-11 01:29:11 +00:00
Nico Weber
d7283ba66e gn build: Merge r362972
llvm-svn: 363019
2019-06-11 01:23:38 +00:00
Tom Stellard
5311f9a49e CMake: Make most target symbols hidden by default
Summary:
For builds with LLVM_BUILD_LLVM_DYLIB=ON and BUILD_SHARED_LIBS=OFF
this change makes all symbols in the target specific libraries hidden
by default.

A new macro called LLVM_EXTERNAL_VISIBILITY has been added to mark symbols in these
libraries public, which is mainly needed for the definitions of the
LLVMInitialize* functions.

This patch reduces the number of public symbols in libLLVM.so by about
25%.  This should improve load times for the dynamic library and also
make abi checker tools, like abidiff require less memory when analyzing
libLLVM.so

One side-effect of this change is that for builds with
LLVM_BUILD_LLVM_DYLIB=ON and LLVM_LINK_LLVM_DYLIB=ON some unittests that
access symbols that are no longer public will need to be statically linked.

Before and after public symbol counts (using gcc 8.2.1, ld.bfd 2.31.1):
nm before/libLLVM-9svn.so | grep ' [A-Zuvw] ' | wc -l
36221
nm after/libLLVM-9svn.so | grep ' [A-Zuvw] ' | wc -l
26278

Reviewers: chandlerc, beanz, mgorny, rnk, hans

Reviewed By: rnk, hans

Subscribers: Jim, hiraditya, michaelplatings, chapuni, jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, javed.absar, sbc100, jgravelle-google, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, mgrang, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, kristina, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 362990
2019-06-10 22:12:56 +00:00
Sameer AbuAsal
ebac1d7786 [RISCV] Replace map with set in getReqFeatures
Summary:
Use a set in getReqFeatures() in RISCVCompressInstEmitter instead of a map
because the index we save is not needed.

This also fixes bug 41666.

Reviewers: llvm-commits, apazos, asb, nickdesaulniers

Reviewed By: asb

Subscribers: Jim, nickdesaulniers, rbar, johnrusso, simoncook, niosHD, kito-cheng, shiva0217, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna

Tags: #llvm

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

llvm-svn: 362968
2019-06-10 17:15:45 +00:00
Nico Weber
5ce0272690 gn build: Merge r362913
llvm-svn: 362932
2019-06-10 12:49:02 +00:00
Nico Weber
879d32d933 gn build: Merge r362857
llvm-svn: 362864
2019-06-08 01:27:47 +00:00
Mike Spertus
c3996c8313 Visualizer for APInt and remove obsolete visualizer
Visualizer for the simple case of APInt (uints < 2^64)
as will be required  for Clang ConstantArrayType visualizer.
Also, removed obsolete VS2013 SmallVectorVisualizer as VS2013
is no longer supported.

llvm-svn: 362860
2019-06-08 00:23:08 +00:00
Adrian McCarthy
fbf8ada68a Fix string literals to avoid deprecation warnings in regexp patterns
In LLDB, where tests run with the debug version of Python, we get a
series of deprecation warnings because escape sequences like `\(` are
being treated as part of the string literal rather than an escape for
the regexp pattern.

NFC intended.

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

llvm-svn: 362846
2019-06-07 21:14:33 +00:00
David Tenty
d4999fa5bd Build with _XOPEN_SOURCE defined on AIX
Summary:
It is useful to build with _XOPEN_SOURCE defined on AIX, enabling X/Open
and POSIX compatibility mode, to work around stray macros and other
bugs in the headers provided by the system and build compiler.

This patch adds the config to cmake to build with _XOPEN_SOURCE defined
on AIX with a few exceptions. Google Test internals require access to
platform specific thread info constructs on AIX so in that case we build
with _ALL_SOURCE defined instead. Libclang also uses header which needs
_ALL_SOURCE on AIX so we leave that as is as well.

We also add building on AIX with the large file API and doing CMake
header checks with X/OPEN definitions so the results are consistent with
the environment that will be present in the build.

Reviewers: hubert.reinterpretcast, xingxue, andusy

Reviewed By: hubert.reinterpretcast

Subscribers: mgorny, jsji, cfe-commits, llvm-commits

Tags: #llvm, #clang

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

llvm-svn: 362808
2019-06-07 15:45:25 +00:00
Nico Weber
139cf066b4 llvm-lib: Disallow mixing object files with different machine types
lib.exe doesn't allow creating .lib files with object files that have
differing machine types. Update llvm-lib to match.

The motivation is to make it possible to infer the machine type of a
.lib file in lld, so that it can warn when e.g. a 32-bit .lib file is
passed to a 64-bit link (PR38965).

Fixes PR38782.

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

llvm-svn: 362798
2019-06-07 13:24:34 +00:00
Nico Weber
a7938d1e3e gn build: Merge r362766
llvm-svn: 362796
2019-06-07 13:09:40 +00:00
Nico Weber
4b7b51fcea gn build: Merge r362774
llvm-svn: 362795
2019-06-07 13:08:17 +00:00
Nico Weber
5bd90460cf gn build: Run git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
llvm-svn: 362794
2019-06-07 13:07:00 +00:00
Nico Weber
208d53836a gn build: Merge r362685
llvm-svn: 362719
2019-06-06 16:55:05 +00:00
Ilya Biryukov
0ef6b523dd gn build: Add new tidy checks to gn files
The checks were added in r362673 and r362672.

llvm-svn: 362709
2019-06-06 14:51:55 +00:00
Ulrich Weigand
fba10ebb96 Allow target to handle STRICT floating-point nodes
The ISD::STRICT_ nodes used to implement the constrained floating-point
intrinsics are currently never passed to the target back-end, which makes
it impossible to handle them correctly (e.g. mark instructions are depending
on a floating-point status and control register, or mark instructions as
possibly trapping).

This patch allows the target to use setOperationAction to switch the action
on ISD::STRICT_ nodes to Legal. If this is done, the SelectionDAG common code
will stop converting the STRICT nodes to regular floating-point nodes, but
instead pass the STRICT nodes to the target using normal SelectionDAG
matching rules.

To avoid having the back-end duplicate all the floating-point instruction
patterns to handle both strict and non-strict variants, we make the MI
codegen explicitly aware of the floating-point exceptions by introducing
two new concepts:

- A new MCID flag "mayRaiseFPException" that the target should set on any
  instruction that possibly can raise FP exception according to the
  architecture definition.
- A new MI flag FPExcept that CodeGen/SelectionDAG will set on any MI
  instruction resulting from expansion of any constrained FP intrinsic.

Any MI instruction that is *both* marked as mayRaiseFPException *and*
FPExcept then needs to be considered as raising exceptions by MI-level
codegen (e.g. scheduling).

Setting those two new flags is straightforward. The mayRaiseFPException
flag is simply set via TableGen by marking all relevant instruction
patterns in the .td files.

The FPExcept flag is set in SDNodeFlags when creating the STRICT_ nodes
in the SelectionDAG, and gets inherited in the MachineSDNode nodes created
from it during instruction selection. The flag is then transfered to an
MIFlag when creating the MI from the MachineSDNode. This is handled just
like fast-math flags like no-nans are handled today.

This patch includes both common code changes required to implement the
new features, and the SystemZ implementation.

Reviewed By: andrew.w.kaylor

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

llvm-svn: 362663
2019-06-05 22:33:10 +00:00
Roman Lebedev
169313ec4b UpdateTestChecks: hexagon support
Summary:
These tests are being affected by an upcoming patch,
so having an understandable (autogenerated) diff is helpful.

This target, again, prefers `-march`:
```
llvm/test/CodeGen/Hexagon$ grep -r triple | wc -l
467
llvm/test/CodeGen/Hexagon$ grep -r march | wc -l
1167
```

Reviewers: RKSimon, kparzysz

Reviewed By: kparzysz

Subscribers: xbolva00, llvm-commits

Tags: #llvm

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

llvm-svn: 362605
2019-06-05 14:08:01 +00:00
Nico Weber
4e860add7f gn build: Merge r362578
llvm-svn: 362598
2019-06-05 12:05:54 +00:00
Nico Weber
5407c02e4b svn propset svn:executable on utils/prepare-code-coverage-artifact.py
llvm-svn: 362561
2019-06-04 23:35:07 +00:00
Nico Weber
83cb36265f gn build: Merge r362459
llvm-svn: 362498
2019-06-04 13:42:45 +00:00
Peter Collingbourne
0ace03cc0e gn build: Merge r361896.
llvm-svn: 362445
2019-06-03 20:40:07 +00:00
Nico Weber
d34a24ff8e gn build: Merge r362371
llvm-svn: 362433
2019-06-03 18:29:00 +00:00
Nico Weber
eed1fe011e gn build: Merge r362352
llvm-svn: 362428
2019-06-03 18:13:29 +00:00
Mikael Holmen
ddff06cdd7 [TableGen] Fix std::array initializer to avoid warnings with older tool chains. NFC
A std::array is implemented as a template with an array inside a struct.
Older versions of clang, like 3.6, require an extra set of curly braces
around std::array initializations to avoid warnings.

The C++ language was changed regarding this by CWG 1270. So more modern
tool chains does not complain even if leaving out one level of braces.

llvm-svn: 362360
2019-06-03 06:38:01 +00:00
Mike Spertus
752a16bcdf Update MSVC Visualizer to reflect new variadic PointerUnion
This changed updates the MSVC Visualizer to work with the recent change
of PointerUnion into a variadic template. As an extra bonus, we
fix some bit rot in the SmallPtrSet visualizer as well

llvm-svn: 362345
2019-06-02 23:33:32 +00:00
Craig Topper
56f4fa247d [X86] Make the X86FoldTablesEmitter functional again. Fix the spacing in the output to make it easier to diff.
Fix a few other formatting issues in the manual table. And remove some
old FIXMEs.

llvm-svn: 362287
2019-06-01 06:20:55 +00:00
Simon Pilgrim
828a13e476 [UpdateTestChecks] Add support for -march=r600 to match existing -march=amdgcn support
llvm-svn: 362228
2019-05-31 15:05:06 +00:00
Nico Weber
9f2de13cb7 gn build: Merge r362160
llvm-svn: 362223
2019-05-31 12:07:05 +00:00
Nico Weber
aceb52b7fd gn build: Merge r362196
llvm-svn: 362222
2019-05-31 11:52:59 +00:00
Nico Weber
cd278170e0 gn build: Merge r362190
llvm-svn: 362221
2019-05-31 11:51:42 +00:00
Sjoerd Meijer
ba322fceb7 Follow up and fix for rL362064
Fix the misleadingly indentation introduced in rL362064. This will get rid of
the compiler warning, and it was actually a bug. This change will be used and
tested in D62669.

llvm-svn: 362211
2019-05-31 08:39:34 +00:00
Pengfei Wang
d1fdadc458 [X86] Add VP2INTERSECT instructions
Support Intel AVX512 VP2INTERSECT instructions in llvm

Patch by Xiang Zhang (xiangzhangllvm)

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

llvm-svn: 362188
2019-05-31 02:50:41 +00:00
Sjoerd Meijer
e852d6fa9b [TableGen] AsmMatcher: allow repeated input operands
If an assembly instruction has to mention an input operand name twice,
for example the MVE VMOV instruction that accesses two lanes of the
same vector by writing 'vmov r1, r2, q0[3], q0[1]', then the obvious
way to write its AsmString is to include the same operand (here $Qd)
twice. But this causes the AsmMatcher generator to omit that
instruction completely from the match table, on the basis that the
generator isn't clever enough to deal with the duplication.

But you need to have _some_ way of dealing with an instruction like
this - and in this case, where the mnemonic is shared with many other
instructions that the AsmMatcher does handle, it would be very painful
to take it out of the AsmMatcher system completely.

A nicer way is to add a custom AsmMatchConverter routine, and let that
deal with the problem if the autogenerated converter can't. But that
doesn't work, because TableGen leaves the instruction out of its table
_even_ if you provide a custom converter.

Solution: this change, which makes TableGen relax the restriction on
duplicated operands in the case where there's a custom converter.

Patch by: Simon Tatham

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

llvm-svn: 362066
2019-05-30 07:38:09 +00:00
Sjoerd Meijer
e1301bfbc7 [TableGen] New default operand "undef_tied_input"
This is a new special identifier which you can use as a default in
OperandWithDefaultOps. The idea is that you use it for an input
operand of an instruction that's tied to an output operand, and its
semantics are that (in the default case) the input operand's value is
not used at all.

The detailed effect is that when instruction selection emits the
instruction in the form of a pre-regalloc MachineInstr, it creates an
IMPLICIT_DEF node to use as that input.

If you're creating an MCInst with explicit register names, then the
right handling would be to set the input operand to the same register
as the output one (honouring the tie) and to add the 'undef' flag
indicating that that register is deemed to acquire a new don't-care
definition just before we read it. But I haven't done that in this
commit, because there was no need to - no Tablegen backend seems to
autogenerate default fields in an MCInst.

Patch by: Simon Tatham

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

llvm-svn: 362064
2019-05-30 07:30:37 +00:00
Roman Lebedev
bf24ab9e18 UpdateTestChecks: Lanai triple support
Summary:
The assembly structure most resembles the SPARC pattern:
```
        .globl  f6                      ! -- Begin function f6
        .p2align        2
        .type   f6,@function
f6:                                     ! @f6
        .cfi_startproc
! %bb.0:
        st      %fp, [--%sp]
<...>
        ld      -8[%fp], %fp
.Lfunc_end0:
        .size   f6, .Lfunc_end0-f6
        .cfi_endproc
                                        ! -- End function
```
Test being affected by upcoming patch, so regenerate it.

Reviewers: RKSimon, jpienaar

Reviewed By: RKSimon

Subscribers: jyknight, fedor.sergeev, llvm-commits

Tags: #llvm

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

llvm-svn: 362019
2019-05-29 20:03:00 +00:00
Nico Weber
55d79c5578 gn build: Make it possible to build with coverage information
Differential Revision: https://reviews.llvm.org/D62508

llvm-svn: 362018
2019-05-29 20:00:36 +00:00
Stella Stamenova
edb99e597f lit: modernize the lit configuration for the lit tests
Summary: This also normalizes the config feature that represents the windows platform to "system-windows" as opposed to having both "windows" and "system-windows"

Reviewers: asmith, probinson

Subscribers: delcypher, llvm-commits

Tags: #llvm

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

llvm-svn: 361998
2019-05-29 18:07:39 +00:00
Nico Weber
edf3d01d6d gn build: Merge r361953
llvm-svn: 361961
2019-05-29 14:15:35 +00:00
David Blaikie
12a22606f9 Fix GDB pretty printer for Optional after r354246
llvm-svn: 361870
2019-05-28 20:22:16 +00:00
Ilya Biryukov
61a121470a gn build: make clangd depend on clang resource headers
Summary:
clangd needs them to function properly, even though they are not
strictly required for the build.

Reviewers: thakis

Reviewed By: thakis

Subscribers: MaskRay, jkorous, arphaman, llvm-commits, kadircet

Tags: #llvm

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

llvm-svn: 361828
2019-05-28 14:23:00 +00:00
Nico Weber
e2f61e4247 gn build: Merge r361664
llvm-svn: 361722
2019-05-26 13:06:48 +00:00
Nico Weber
5518a4a213 Rename clangToolingRefactor to clangToolingRefactoring for consistency with its directory
See "[cfe-dev] The name of clang/lib/Tooling/Refactoring".

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

llvm-svn: 361684
2019-05-25 00:27:19 +00:00
Nico Weber
22843bc3fb gn build: Merge r361607
llvm-svn: 361640
2019-05-24 14:24:25 +00:00
Roman Lebedev
2ed3460f1d UpdateTestChecks: ppc32 triple support
Summary:
Appears identical to powerpc64{,le}.
Regenerate test that is being affected by upcoming patch.

Reviewers: RKSimon

Reviewed By: RKSimon

Subscribers: nemanjai, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 361543
2019-05-23 19:54:41 +00:00
Roman Lebedev
6db0591e88 [NFC] UpdateTestChecks: asm.py: fix whitespace issue
llvm-svn: 361538
2019-05-23 19:15:05 +00:00
Jordan Rupprecht
4106506993 [git] Be more specific when looking for llvm-svn
Summary:
A commit may, for some reason, have `llvm-svn:` in it multiple times. It may even take up the whole line and look identical to what gets added automatically when svn commits land in github.

To workaround this, make changes to both lookups:

1) When doing the git -> svn lookup, make sure to go through the whole message, and:
 a) Only look for llvm-svn starting at the beginning of the line (excluding the whitespace that `git log` adds).
 b) Take the last one (at the end of the commit message), if there are multiple matches.

2) When doing the svn -> git lookup, look through a sizeable but still reasonably small number of git commits (10k, about 4-5 months right now), and:
 a) Only consider commits with the '^llvm-svn: NNNNNN' we expect, and
 b) Only consider those that also follow the same git -> svn matching above. (Error if it's not exactly one commit).

Reviewers: jyknight

Reviewed By: jyknight

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 361532
2019-05-23 18:43:19 +00:00
Roman Lebedev
bf13037243 UpdateTestChecks: -march=mips/-march=mipsel is mips triple.
Again, a mixture of march and triple, with majority being march:

llvm/test/CodeGen/Mips$ grep -ri triple | wc -l
818
llvm/test/CodeGen/Mips$ grep -ri march | wc -l
1457

llvm-svn: 361521
2019-05-23 18:08:00 +00:00
Nico Weber
f7d33f967e gn build: Merge r361418 more
llvm-svn: 361520
2019-05-23 18:01:16 +00:00
Nico Weber
89d96c0ab3 gn build: Merge r361487
llvm-svn: 361498
2019-05-23 13:59:44 +00:00
Peter Collingbourne
fab26129e7 gn build: Merge r361418.
llvm-svn: 361449
2019-05-23 00:31:55 +00:00
Thomas Preud'homme
8959c7cf6c FileCheck: Improve FileCheck variable terminology
Summary:
Terminology introduced by [[#]] blocks is confusing and does not
integrate well with existing terminology.

First, variables referred by [[]] blocks are called "pattern variables"
while the text a CHECK directive needs to match is called a "CHECK
pattern". This is inconsistent with variables in [[#]] blocks since
[[#]] blocks are also found in CHECK pattern yet those variables are
called "numeric variable".

Second, the replacing of both [[]] and [[#]] blocks by the value of the
variable or expression they contain is represented by a
FileCheckPatternSubstitution class. The naming refers to being a
substitution in a CHECK pattern but could be wrongly understood as being
a substitution of a pattern variable.

Third and lastly, comments use "numeric expression" to refer both to the
[[#]] blocks as well as to the numeric expressions these blocks contain
which get evaluated at match time.

This patch solves these confusions by
- calling variables in [[]] and [[#]] blocks as string and numeric
  variables respectively;
- referring to [[]] and [[#]] as substitution *blocks*, with the former
  being a string substitution block and the latter a numeric
  substitution block;
- calling [[]] and [[#]] blocks to be replaced by the value of a
  variable or expression they contain a substitution (as opposed to
  definition when these blocks are used to defined a variable), with the
  former being a string substitution and the latter a numeric
  substitution;
- renaming the FileCheckPatternSubstitution as a FileCheckSubstitution
  class with FileCheckStringSubstitution and
  FileCheckNumericSubstitution subclasses;
- restricting the use of "numeric expression" to refer to the expression
  that is evaluated in a numeric substitution.

While numeric substitution blocks only support numeric substitutions of
numeric expressions at the moment there are plans to augment numeric
substitution blocks to support numeric definitions as well as both a
numeric definition and numeric substitution in the same numeric
substitution block.

Reviewers: jhenderson, jdenny, probinson, arichardson

Subscribers: hiraditya, arichardson, probinson, llvm-commits

Tags: #llvm

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

llvm-svn: 361445
2019-05-23 00:10:14 +00:00
Nico Weber
25ef8bb74a gn build: Fix check-clangd target after r359825
llvm-svn: 361419
2019-05-22 19:03:45 +00:00
Ilya Biryukov
1fab3c1330 Reland r361148 with a fix to the buildbot failure.
Reverted in r361377.
Also reland the '.gn' files (reverted in r361389).

llvm-svn: 361391
2019-05-22 14:44:45 +00:00
Nico Weber
3df408c83e gn build: Merge r361377
llvm-svn: 361389
2019-05-22 14:31:22 +00:00
Roman Lebedev
a7cac55c64 UpdateTestChecks: sparc march handling
Summary:
Another target that prefers to use `-march` in tests
```
llvm/test/CodeGen/SPARC$ grep -ri mtriple | wc -l
25
llvm/test/CodeGen/SPARC$ grep -ri march | wc -l
165
```

This test is being affected by a further patch,
so regenerate it to better visualize the changes

Reviewers: RKSimon, dcederman, gberry

Reviewed By: RKSimon

Subscribers: jyknight, fedor.sergeev, jrtc27, llvm-commits

Tags: #llvm

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

llvm-svn: 361381
2019-05-22 13:04:34 +00:00
Dan Gohman
17703faffc [WebAssembly] Add the signature for the new llround builtin function
r360889 added new llround builtin functions. This patch adds their
signatures for the WebAssembly backend.

It also adds wasm32 support to utils/update_llc_test_checks.py, since
that's the script other targets are using for their testcases for this
feature.

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

llvm-svn: 361327
2019-05-21 23:06:34 +00:00
Nico Weber
2866d8d07b gn build: Merge r361264
llvm-svn: 361267
2019-05-21 14:41:27 +00:00
Nico Weber
05840794be gn build: Run git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
llvm-svn: 361262
2019-05-21 14:22:38 +00:00
Nico Weber
85b5d381a7 gn build: Merge r361252
llvm-svn: 361260
2019-05-21 14:20:46 +00:00
Nico Weber
3fe4ef39d8 gn build: Merge r361233
llvm-svn: 361259
2019-05-21 14:10:55 +00:00
Nico Weber
33739a26c1 Try to fix build with older gccs after r361152
Also merge the cmake change there to the gn build.

llvm-svn: 361209
2019-05-21 00:27:26 +00:00
Nico Weber
e8e4bbe863 gn build: Merge r361148
llvm-svn: 361191
2019-05-20 19:33:32 +00:00
Pete Couperus
b885b98121 [TableGen] - Type comparison LE should be LT or equal.
Differential Revision: https://reviews.llvm.org/D61705

llvm-svn: 361183
2019-05-20 18:09:37 +00:00
Nico Weber
1c71cc0052 gn build: Merge r361152
llvm-svn: 361153
2019-05-20 13:46:42 +00:00
Nico Weber
9f90ad3812 gn build: Merge r361117
llvm-svn: 361121
2019-05-20 00:51:16 +00:00
Roman Lebedev
0e0d5175c3 UpdateTestChecks: fix AMDGPU handling
Summary:
Was looking into supporting `(srl (shl x, c1), c2)` with c1 != c2 in dagcombiner,
this test changes, but makes `update_llc_test_checks.py` unhappy.

**Many** AMDGPU tests specify `-march`, not `-mtriple`, which results in `update_llc_test_checks.py`
defaulting to x86 asm function detection heuristics, which don't work here.
I propose to fix this by adding an infrastructure to map from `-march` to `-mtriple`,
in the UpdateTestChecks tooling.

Reviewers: RKSimon, MaskRay, arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

Tags: #llvm

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

llvm-svn: 361101
2019-05-18 13:00:03 +00:00
Roman Lebedev
5c25c2689c UpdateTestChecks: arm64-eabi handlind
Summary:
Was looking into supporting `(srl (shl x, c1), c2)` with c1 != c2 in dagcombiner,
this test changes, but makes `update_llc_test_checks.py` unhappy

Reviewers: RKSimon

Reviewed By: RKSimon

Subscribers: javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

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

llvm-svn: 361100
2019-05-18 12:59:56 +00:00
Nico Weber
80075ed35e gn build: Merge r360993
llvm-svn: 361062
2019-05-17 18:37:46 +00:00
Nico Weber
61ab06b78d Revert r361033 "Add a Visit overload for DynTypedNode to ASTNodeTraverser"
It fails to build on some bots.

Also revert follow-up r361055.

llvm-svn: 361059
2019-05-17 18:31:24 +00:00
Nico Weber
13302106be gn build: Merge r361033
llvm-svn: 361055
2019-05-17 17:36:06 +00:00
Nico Weber
9c83179ccf gn build: Merge r360991
llvm-svn: 361053
2019-05-17 17:32:00 +00:00
Vitaly Buka
410ce9e6a9 Fix GN build
llvm-svn: 360829
2019-05-16 00:19:37 +00:00
Nico Weber
878cbbad19 gn build: Merge r360671
llvm-svn: 360766
2019-05-15 12:08:45 +00:00
Nico Weber
413854ab80 gn build: Run git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
llvm-svn: 360764
2019-05-15 12:03:10 +00:00
David L. Jones
d9dec9f566 gn build: add Hexagon target
Differential Revision: https://reviews.llvm.org/D61819

llvm-svn: 360647
2019-05-14 04:13:59 +00:00
David L. Jones
32023b6597 gn build: add Sparc target
llvm-svn: 360645
2019-05-14 04:02:50 +00:00
David L. Jones
a489663e33 gn build: add Lanai target
llvm-svn: 360644
2019-05-14 03:52:33 +00:00
Vitaly Buka
55419fb427 [gn] Fix build
llvm-svn: 360629
2019-05-13 22:30:53 +00:00
Stanislav Mekhanoshin
5f942ba058 [AMDGPU] gfx1010 SearchableTableEmitter patch for NSA
This part was accidentally missing from NSA image support commit.

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

llvm-svn: 360623
2019-05-13 21:59:03 +00:00
Paul Robinson
bfaa373ab9 Stop defining negative versions of some lit feature keywords:
zlib/nozlib, asan/not_asan, msan/not_msan, ubsan/not_ubsan.

We still have two other ways to express the absence of a feature.
First, we have the '!' operator to invert the sense of a keyword.  For
example, given a feature that depends on zlib being unavailable, its
test can say:
    REQUIRES: !zlib

Second, if a test doesn't play well with some features, such as
sanitizers, that test can say:
    UNSUPPORTED: asan, msan

The different ways of writing these exclusions both have the same
technical effect, but have different implications to the reader.

llvm-svn: 360603
2019-05-13 17:18:58 +00:00
Nico Weber
63a4633ada gn build: Fewer dependencies in llvm/lib/Target
The tablegen groups only need public_deps for inc files included
(possibly transitively) in other targets. Move inc files that are
internan to the MCTargetDesc libraries into regular deps.

Related to the changes that merged InstPrinter into MCTargetDesc
(360484, 360486 etc).

llvm-svn: 360600
2019-05-13 16:59:43 +00:00
Nico Weber
e46b1fe16b gn build: Merge r360572
llvm-svn: 360597
2019-05-13 16:15:40 +00:00
David L. Jones
81acaea3c5 gn build: support host build on ppc64 (a.k.a. powerpc64le)
llvm-svn: 360553
2019-05-13 04:07:54 +00:00
David L. Jones
21592c0bd7 gn build: merge r360550
llvm-svn: 360551
2019-05-13 03:43:25 +00:00
Nico Weber
2ca48a0383 gn build: Merge r360540
llvm-svn: 360549
2019-05-12 23:47:03 +00:00
Fangrui Song
60386c1c20 [utils] update_test_checks.py: allow opt-8, opt-9
Allow using Debian's opt-8, opt-9 with update_test_checks.py

Patch by Shawn Landden!

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

llvm-svn: 360536
2019-05-12 04:55:09 +00:00
David L. Jones
c867400ae9 gn build: sort tablegen rules for X86 and AArch64
llvm-svn: 360508
2019-05-11 03:23:37 +00:00
David L. Jones
f2f0101892 gn build: merge r360494 and r360502
llvm-svn: 360507
2019-05-11 03:20:09 +00:00
David L. Jones
6f91878254 gn build: merge r360490
llvm-svn: 360492
2019-05-11 00:44:30 +00:00
David L. Jones
8e105e2823 gn build: merge r360484 and r360486
llvm-svn: 360491
2019-05-11 00:35:53 +00:00
David L. Jones
cc139afe3e gn build: merge r360345
llvm-svn: 360489
2019-05-11 00:20:18 +00:00
Stella Stamenova
056ec58399 Use UNSUPPORTED: windows in shtest-timeout.py. Apparently system-windows does not cover all cases either and the case it doesn't cover affects one of the buildbots.
llvm-svn: 360373
2019-05-09 20:22:02 +00:00
Stella Stamenova
ffa8726113 Use UNSUPPORTED: system-windows instead of REQUIRES: nowindows or UNSUPPORTED: windows. nowindows is not currently defined and windows does not cover all cases. system-windows is also consistent with how other platforms are used.
llvm-svn: 360368
2019-05-09 19:40:21 +00:00
Paul Robinson
dce877c3d9 Re-enable lit test shtest-timeout.py on non-Windows.
It was disabled incorrectly, which meant it wasn't running anywhere.

llvm-svn: 360356
2019-05-09 17:01:03 +00:00
Nico Weber
20d1acfc29 gn build: Merge r960255
llvm-svn: 360343
2019-05-09 14:14:21 +00:00
Alex Lorenz
ed5b19cc95 lit config: disable LSan for Apple clang compiler in addition to Apple LLVM
Apple clang is the canonical way to refer to the compiler shipped with Xcode.

llvm-svn: 360307
2019-05-09 02:46:20 +00:00
Nico Weber
3928569ed7 gn build: Merge r360151
llvm-svn: 360253
2019-05-08 13:41:01 +00:00
Jonas Devlieghere
a70eaf5039 Revert "[OpenMP][Clang] Support for target math functions"
This commit appears to be breaking stage-2 builds on GreenDragon. The
OpenMP wrappers for cmath and math.h are copied into the root of the
resource directory and cause a cyclic dependency in module 'Darwin':
Darwin -> std -> Darwin. This blows up when CMake is testing for modules
support and breaks all stage 2 module builds, including the ThinLTO bot
and all LLDB bots.

CMake Error at cmake/modules/HandleLLVMOptions.cmake:497 (message):
  LLVM_ENABLE_MODULES is not supported by this compiler

llvm-svn: 360192
2019-05-07 21:08:15 +00:00
Nico Weber
24bbeb6ca8 gn build: Merge r360116
llvm-svn: 360141
2019-05-07 13:07:23 +00:00
Nico Weber
b45450b792 gn build: Run git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
llvm-svn: 360140
2019-05-07 13:02:18 +00:00
Krasimir Georgiev
c6e44e02ee Revert "[TableGen] Fix a typo"
Summary:
This reverts commit r360106.

The revisioin causes llvm-tblgen to hang while generating info for
RISCV.td. The root cause might be in the RISCV.td definition but I don't
know enough about this to investigate further.

Command that starts hangning after r360106:
`llvm-build/bin/llvm-tblgen -I llvm/include -I llvm/tools/clang/include -I llvm/lib/Target/RISCV -gen-instr-info llvm/lib/Target/RISCV/RISCV.td`

Reviewers: sammccall, yan_luo, craig.topper, gribozavr

Reviewed By: gribozavr

Subscribers: PkmX, llvm-commits

Tags: #llvm

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

llvm-svn: 360136
2019-05-07 11:39:35 +00:00
Yan Luo
d72c0ea7c9 [TableGen] Fix a typo
Check "Big" instead of "Small" in the second condition.

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

llvm-svn: 360106
2019-05-07 01:07:46 +00:00
Peter Collingbourne
d40c98a67f gn build: Merge r360063.
llvm-svn: 360074
2019-05-06 20:09:12 +00:00
Nico Weber
6611f815fb gn build: More TODO tweaking
Differential Revision: https://reviews.llvm.org/D61468

llvm-svn: 360057
2019-05-06 17:17:41 +00:00
Nico Weber
03d470e2ab gn build: Update TODO now that libcxx libcxxabi libunwind clang-tools-extra are done
Differential Revision: https://reviews.llvm.org/D61468

llvm-svn: 360056
2019-05-06 17:15:19 +00:00
Nico Weber
c80ff859b2 gn build: Merge r360018
llvm-svn: 360049
2019-05-06 15:06:43 +00:00
Petr Hosek
a19a164c99 [libcxxabi] Don't use -fvisibility-global-new-delete-hidden when not defining them
When builing the hermetic static library, the compiler switch
-fvisibility-global-new-delete-hidden is necessary to get the new and
delete operator definitions made correctly. However, when those
definitions are not included in the library, then this switch does harm.
With lld (though not all linkers) setting STV_HIDDEN on SHN_UNDEF
symbols makes it an error to leave them undefined or defined via dynamic
linking that should generate PLTs for -shared linking (lld makes this a
hard error even without -z defs). Though leaving the symbols undefined
would usually work in practice if the linker were to allow it (and the
user didn't pass -z defs), this actually indicates a real problem that
could bite some target configurations more subtly at runtime. For
example, x86-32 ELF -fpic code generation uses hidden visibility on
declarations in the caller's scope as a signal that the call will never
be resolved to a PLT entry and so doesn't have to meet the special ABI
requirements for PLT calls (setting %ebx). Since these functions might
actually be resolved to PLT entries at link time (we don't know what the
user is linking in when the hermetic library doesn't provide all the
symbols itself), it's not safe for the compiler to treat their
declarations at call sites as having hidden visibility.

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

llvm-svn: 360004
2019-05-06 01:25:31 +00:00
Petr Hosek
19935dd4c1 [libcxx] Don't use -fvisibility-global-new-delete-hidden when not defining them
When builing the hermetic static library, the compiler switch
-fvisibility-global-new-delete-hidden is necessary to get the new and
delete operator definitions made correctly. However, when those
definitions are not included in the library, then this switch does harm.
With lld (though not all linkers) setting STV_HIDDEN on SHN_UNDEF
symbols makes it an error to leave them undefined or defined via dynamic
linking that should generate PLTs for -shared linking (lld makes this a
hard error even without -z defs). Though leaving the symbols undefined
would usually work in practice if the linker were to allow it (and the
user didn't pass -z defs), this actually indicates a real problem that
could bite some target configurations more subtly at runtime. For
example, x86-32 ELF -fpic code generation uses hidden visibility on
declarations in the caller's scope as a signal that the call will never
be resolved to a PLT entry and so doesn't have to meet the special ABI
requirements for PLT calls (setting %ebx). Since these functions might
actually be resolved to PLT entries at link time (we don't know what the
user is linking in when the hermetic library doesn't provide all the
symbols itself), it's not safe for the compiler to treat their
declarations at call sites as having hidden visibility.

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

llvm-svn: 360003
2019-05-06 01:22:28 +00:00
Craig Topper
09db3b5d76 Make the git-llvm script work on older git versions that don't support git rev-parse --git-common-dir.
Not all versions of git support git rev-parse --git-common-dir. Rather than erorr or print any kind of
useful error, they just print back '--git-common-dir' instead of a directory. The git-llvm script
ends up taking this '--git-common-dir' as a diretory name to use.

Not sure exactly what happens after that, but the end result is that the 'git llvm push' ends up
looking like it pushed your commits, but really did nothing.

This patch makes the script detect the bogus directory name for --git-common-dir and falls back to using --git-dir instead.

llvm-svn: 359939
2019-05-03 22:03:29 +00:00
Nico Weber
9e458ccc02 gn build: Merge r359878
llvm-svn: 359888
2019-05-03 14:27:12 +00:00
Petr Hosek
a954e23d64 [gn] Include the missing BUILD.gn file for libcxxabi includes
This was omitted in r359805.

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

llvm-svn: 359828
2019-05-02 21:20:08 +00:00
Petr Hosek
296e01372b [gn] Update the clangd test lit site configuration
This reflects changes made in r359763.

llvm-svn: 359825
2019-05-02 20:34:54 +00:00
Petr Hosek
52777ec83d [gn] Include libcxx configuration file
This was omitted in r359806 but is already referenced in the GN build.

llvm-svn: 359815
2019-05-02 19:07:23 +00:00
Petr Hosek
fdc10c3a09 [gn] Support for building libc++
This change introduces support for building libc++. The library
build should be complete, but not all CMake options have been
replicated in GN. We also don't support tests yet.

We only support two stage build at the moment.

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

llvm-svn: 359806
2019-05-02 17:29:41 +00:00
Petr Hosek
180a8a461c [gn] Support for building libcxxabi
This change introduces support for building libcxxabi. The library
build should be complete, but not all CMake options have been
replicated in GN. We also don't support tests yet.

We only support two stage build at the moment.

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

llvm-svn: 359805
2019-05-02 17:29:39 +00:00
Petr Hosek
89e4e6043e [gn] Support for building libunwind
This change introduces support for building libuwind. The library
build should be complete, but not all CMake options have been
replicated in GN. We also don't support tests yet.

We only support two stage build at the moment.

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

llvm-svn: 359804
2019-05-02 17:29:37 +00:00
Nico Weber
48f5d68b55 Revert r359717, "Make check-clang depend on the clang-check binary always"
The Tooling tests do have a lit.local.cfg with

    if not config.root.clang_staticanalyzer:
        config.unsupported = True

so what's wrong isn't the missing dep, but that lit prints a warning for
the binary missing. This will need a different kind of fix.

llvm-svn: 359739
2019-05-01 23:32:38 +00:00
Nico Weber
47c89465fa Make check-clang depend on the clang-check binary always
check-clang (the target that runs all clang tests) used to
only depend on clang-check (a binary like clang-tidy,
clang-refactor, etc) if the static analyzer is enabled.
However, several lit tests call clang-check unconditionally,
so always depend on it.

Fixes a "could not find clang-check" lit warning in clean builds with
the static analyzer disabled.

Also sort the deps in the CMake file and put just one dep on each line.

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

llvm-svn: 359717
2019-05-01 19:34:00 +00:00
Hubert Tong
5aa34ef39a [lit][tests][AIX] Update expected form of diagnostic messages; use not to normalize non-zero exit values
Summary:
Various tests in the `lit` testing suite expect specific return codes
and forms of diagnostic message from utility programs. As per
POSIX.1-2017 XCU Section 1.4, Utility Description Defaults, "[the]
format of diagnostic messages for most utilities is unspecified".
The STDERR subsections of the `cat` and `wc` utilities merely indicate
that "[the] standard error shall be used only for diagnostic messages".
The corresponding EXIT STATUS subsections merely indicate, with regard
to errors, an exit value of >0.

The affected tests are updated to accept the applicable diagnostic
message as produced by the utilities on AIX. The exit value is
normalized using `not` as necessary.

Reviewers: xingxue, sfertile, jasonliu

Reviewed By: xingxue

Subscribers: delcypher, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 359690
2019-05-01 15:47:16 +00:00
Nico Weber
2db21a2e13 gn build: Fix build on macOS after r359570 / r359527
llvm-svn: 359637
2019-04-30 23:40:58 +00:00
Nico Weber
a9e03d81c8 gn build: Merge r359626
llvm-svn: 359635
2019-04-30 23:22:40 +00:00
Nico Weber
4f4965c191 gn build: Add check-clangd target after r3359424
r359527 already merged some of that to the GN build,
but it was missing some bits as well.

The check-clangd target works (at least for now) differently than all
the other check-foo targets, see https://reviews.llvm.org/D61187

For that reason, there's no gni file and the generated lit configs are
not (yet?) added to llvm-lit/BUILD.gn.

llvm-svn: 359570
2019-04-30 15:36:02 +00:00
Nico Weber
1ea10098b3 gn build: Merge r359455
llvm-svn: 359562
2019-04-30 13:45:16 +00:00
Vitaly Buka
d8291f6818 [clangd] Fix GN build
llvm-svn: 359527
2019-04-30 01:35:42 +00:00
Nico Weber
109d580d68 gn build: Merge r359252
llvm-svn: 359514
2019-04-29 23:06:03 +00:00
Martin Storsjo
c802834204 [UpdateTestChecks] Allow Lbegin_func without a leading period
On mingw/i686, local labels don't start with a leading period.

Also escape the leading period, as it previously could match
any char.

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

llvm-svn: 359497
2019-04-29 20:25:56 +00:00
Petr Hosek
b793e10d4b [gn] Use label_name rather than target_output_name for objects
Multiple targets in the same output directory can use the same
target_output_name. The typical example of that is having a shared
and a static library of the same, e.g. libc++.so and libc++.a.
When that's the case, the object files produced for each target
are going to conflict. Using the label_name avoids this conflict
since labels are guaranteed to be unique within a single BUILD.gn
file which corresponds to a single output directory.

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

llvm-svn: 359494
2019-04-29 20:04:20 +00:00
Simon Pilgrim
412b4068b0 [TableGen] Fix null pointer dereferencing.
Reported in https://www.viva64.com/en/b/0629/

llvm-svn: 359474
2019-04-29 17:41:27 +00:00
Hans Wennborg
d808ff5e65 gn: Fix check-clang build after r359179
llvm-svn: 359429
2019-04-29 09:58:48 +00:00
Nico Weber
bf835b8a3c gn build: Document llvm_enable_dia_sdk variable better
llvm-svn: 359196
2019-04-25 14:56:56 +00:00
Nico Weber
7c0e4f3073 gn build: Make setting llvm_enable_dia_sdk=true work
If this is set, %INCLUDE% must contain ".../DIA SDK/include"
and %LIB% must contain ".../DIA SKD/lib/amd64" (assuming you're doing a
64-bit build).

llvm-svn: 359195
2019-04-25 14:53:53 +00:00
Nico Weber
b2c75bfdfa gn build: Merge r359179
llvm-svn: 359189
2019-04-25 13:29:34 +00:00
Nico Weber
cb493da02e gn build: Merge r359174
llvm-svn: 359188
2019-04-25 13:26:54 +00:00
Nico Weber
2c1fe93f05 gn build: Merge r359142
llvm-svn: 359187
2019-04-25 13:25:00 +00:00
Davide Italiano
046df957e4 [utils] Add a lldb data formatter for llvm::SmallString.
Result:

(lldb) p val
(llvm::SmallString<32>) $31 = "patatino"

llvm-svn: 359157
2019-04-25 00:03:02 +00:00
Nico Weber
2e1e85c460 gn build: Merge r359050 more
llvm-svn: 359058
2019-04-24 00:59:24 +00:00
Nico Weber
6e96a7273a gn build: Merge r359050
llvm-svn: 359056
2019-04-24 00:44:14 +00:00
Fangrui Song
b6f3e92a7b Use llvm::stable_sort
While touching the code, simplify if feasible.

llvm-svn: 358996
2019-04-23 14:51:27 +00:00
Nico Weber
28cc552f75 gn build: Merge r358944
llvm-svn: 358993
2019-04-23 14:32:18 +00:00
Nico Weber
4d5804c774 gn build: Merge r358949
llvm-svn: 358991
2019-04-23 14:31:15 +00:00
Nico Weber
56f4e6ed4f gn build: Merge r358869
llvm-svn: 358912
2019-04-22 19:25:40 +00:00
Nico Weber
f8b26b773e gn build: Re-run git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
llvm-svn: 358862
2019-04-21 20:14:21 +00:00
Nico Weber
f60215b015 gn build: Merge r358749
Since the symlinks list for llvm-symbolizer is now never empty,
the :symlinks target no longer needs an explicit dep on :llvm-symbolizer
-- there will be at least one dep on a symlink, and each symlink depends
on :llvm-symbolizer already.

Since llvm-symbolizer:symlinks now produces symlinks that check-llvm
uses, make llvm/test depend on the symlink target.

llvm-svn: 358861
2019-04-21 20:08:45 +00:00
Nico Weber
6563e5f2d0 gn build: Merge r358818 (JITLink)
llvm-svn: 358860
2019-04-21 19:45:37 +00:00
Nico Weber
fa157169b6 gn build: Fix build after r358837
llvm-svn: 358851
2019-04-21 14:07:13 +00:00
Petr Hosek
292476a361 [gn] Move Features.inc to clangd, create a config for it
ClangdLSPServer and clangd unittests now include Features.inc so we
need to append the target_gen_dir that contains it to their
include_dirs. To do so, we use a public config that's applied to
any target that depends on the features one.

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

llvm-svn: 358837
2019-04-21 01:09:15 +00:00
Vitaly Buka
e7a16d2932 Update GN files to build with r358103
llvm-svn: 358790
2019-04-19 22:27:50 +00:00
Petr Hosek
070eff6077 [gn] Support dots in CMake paths in the sync script
Some file paths use dots to pick up sources from parent directories.

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

llvm-svn: 358774
2019-04-19 18:29:17 +00:00
Nico Weber
f2a4cc293c gn build: Merge r358722
llvm-svn: 358755
2019-04-19 13:18:41 +00:00
Nico Weber
b848de15bf gn build: Merge r358691
llvm-svn: 358754
2019-04-19 13:16:26 +00:00
Nico Weber
dd0f5b8dc8 gn build: Merge r358607
llvm-svn: 358670
2019-04-18 14:27:38 +00:00
Nico Weber
bc3d18640f gn build: Merge r358633
llvm-svn: 358669
2019-04-18 14:26:52 +00:00
Nico Weber
c7caca2e44 gn build: Merge r358620
llvm-svn: 358668
2019-04-18 14:25:45 +00:00
Nico Weber
02c525c439 gn build: Merge r358554
llvm-svn: 358578
2019-04-17 13:40:57 +00:00
Dmitri Gribenko
a289742c00 Fixed error message printing in write_cmake_config.py
Summary:
Previously, write_cmake_config.py would raise an error while printing
the error, because `leftovers` in "'\n'.join(leftovers)" is a tuple.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 358557
2019-04-17 06:11:27 +00:00
Nico Weber
64c1542260 gn build: Merge r358422
llvm-svn: 358486
2019-04-16 12:54:43 +00:00
Nico Weber
ddef9d89d4 gn build: Merge r358390
llvm-svn: 358397
2019-04-15 11:25:23 +00:00
Simon Tatham
29a17fb85b [TableGen] Include schedule model name in diagnostic.
If you have more than one schedule model in your TableGen target
definitions, then the diagnostic "No schedule information for
instruction 'foo'" is rather unhelpful, because it doesn't tell you
_which_ schedule model is missing the necessary information (or, as it
might be, missing the UnsupportedFeatures definition that would stop
it thinking it needed it).

Extended the message to include the name of the schedule model that
it's complaining about.

Reviewers: nhaehnle, hfinkel, javedabsar, efriedma, javed.absar

Reviewed By: javed.absar

Subscribers: javed.absar, llvm-commits

Tags: #llvm

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

llvm-svn: 358389
2019-04-15 10:06:26 +00:00
Nico Weber
5100730b92 gn build: Merge r358297
llvm-svn: 358366
2019-04-14 23:23:14 +00:00
Nico Weber
a3be3764cc gn build: Merge r358243
llvm-svn: 358365
2019-04-14 23:21:58 +00:00
Nico Weber
1a1fd38110 gn build: Merge r358272
llvm-svn: 358364
2019-04-14 23:19:32 +00:00
Michal Gorny
d2ca92ee7d [llvm] [lit] Add target-x86* features
Add a 'target-x86' and 'target-x86_64' feature sthat indicates that
the default target is 32-bit or 64-bit x86, appropriately.  Combined
with 'native' feature, we're going to use this to control x86-specific
LLDB native process tests.

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

llvm-svn: 358177
2019-04-11 14:58:39 +00:00
Roman Lebedev
daceaa0714 [TableGen] Introduce !listsplat 'binary' operator
Summary:
```
``!listsplat(a, size)``
    A list value that contains the value ``a`` ``size`` times.
    Example: ``!listsplat(0, 2)`` results in ``[0, 0]``.
```

I plan to use this in X86ScheduleBdVer2.td for LoadRes handling.

This is a little bit controversial because unlike every other binary operator
the types aren't identical.

Reviewers: stoklund, javed.absar, nhaehnle, craig.topper

Reviewed By: javed.absar

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 358117
2019-04-10 18:26:36 +00:00
Roman Lebedev
2fd926c01b [kate] Add '!mul' operator that was introduced in D58775
llvm-svn: 358116
2019-04-10 18:26:23 +00:00
Nico Weber
47bc850541 gn build: Fix Windows builds after r357797
llvm-svn: 358004
2019-04-09 14:02:02 +00:00
Craig Topper
9cf3e9375d [X86] Remove check on isAsmParserOnly from EVEX2VEX tablegenerator. NFCI
There are no instructions VEX or EVEX instructions that set this field.

llvm-svn: 357973
2019-04-09 07:40:19 +00:00
Craig Topper
3db442c0ca [X86] Have EVEX2VEX tablegenerator use HasVEX_L and HasEVEX_L2 fields instead of the composite EVEX_LL field. Remove the EVEX_LL field. NFCI
The composite existed to simplify some other tablegen code and not really in an
important way. Remove the combined field and just calculate the vector size
using two ifs.

llvm-svn: 357972
2019-04-09 07:40:14 +00:00
Craig Topper
62c248a7ea [X86] Use VEX_WIG for VPINSRB/W and VPEXTRB/W to match what is done for EVEX.
The instruction's document this as W0 for the VEX encoding. But there's a
footnote mentioning that VEX.W is ignored in 64-bit mode. And the main VEX
encoding description says the VEX.W bit is ignored for instructions that are
equivalent to a legacy SSE instruction that uses REX.W to select a GPR which
would apply here.

By making this match EVEX we can remove a special case of allowing EVEX2VEX to
turn an EVEX.WIG instruction into VEX.W0.

llvm-svn: 357971
2019-04-09 07:40:10 +00:00
Craig Topper
4d9415ad93 [X86] Split the VEX_WPrefix in X86Inst tablegen class into 3 separate fields with clear meanings.
llvm-svn: 357970
2019-04-09 07:40:06 +00:00
Nico Weber
d6250e08aa gn build: Merge r357905
llvm-svn: 357907
2019-04-08 12:43:46 +00:00
Nico Weber
a58ff34300 gn-build: Re-run git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
llvm-svn: 357906
2019-04-08 12:42:37 +00:00
Petr Hosek
cfdca6e9ce [gn] Support for per-target runtime directory layout
This change also introduces the clang_enable_per_target_runtime_dir
to enable the use of per-target runtime directory layout which is the
equivalent of LLVM_ENABLE_PER_TARGET_RUNTIME_DIR CMake option.

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

llvm-svn: 357850
2019-04-06 23:05:56 +00:00
Nico Weber
9f4707c6ca gn build: Pacify gn format
llvm-svn: 357830
2019-04-05 23:57:10 +00:00
Petr Hosek
e9fc38b6ef [gn] Support for building compiler-rt builtins
This is support for building compiler-rt builtins, The library build
should be complete for a subset of supported platforms, but not all
CMake options have been replicated in GN.

We always use the just built compiler to build all the runtimes, which
is equivalent to the CMake runtimes build. This simplifies the build
configuration because we don't need to support arbitrary host compiler
and can always assume the latest Clang. With GN's toolchain support,
this is significantly more efficient than the CMake runtimes build.

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

llvm-svn: 357821
2019-04-05 21:30:40 +00:00
Craig Topper
38e5713f51 [X86] Merge the different Jcc instructions for each condition code into single instructions that store the condition code as an operand.
Summary:
This avoids needing an isel pattern for each condition code. And it removes translation switches for converting between Jcc instructions and condition codes.

Now the printer, encoder and disassembler take care of converting the immediate. We use InstAliases to handle the assembly matching. But we print using the asm string in the instruction definition. The instruction itself is marked IsCodeGenOnly=1 to hide it from the assembly parser.

Reviewers: spatel, lebedev.ri, courbet, gchatelet, RKSimon

Reviewed By: RKSimon

Subscribers: MatzeB, qcolombet, eraman, hiraditya, arphaman, llvm-commits

Tags: #llvm

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

llvm-svn: 357802
2019-04-05 19:28:09 +00:00
Craig Topper
1311b33688 [X86] Merge the different SETcc instructions for each condition code into single instructions that store the condition code as an operand.
Summary:
This avoids needing an isel pattern for each condition code. And it removes translation switches for converting between SETcc instructions and condition codes.

Now the printer, encoder and disassembler take care of converting the immediate. We use InstAliases to handle the assembly matching. But we print using the asm string in the instruction definition. The instruction itself is marked IsCodeGenOnly=1 to hide it from the assembly parser.

Reviewers: andreadb, courbet, RKSimon, spatel, lebedev.ri

Reviewed By: andreadb

Subscribers: hiraditya, lebedev.ri, llvm-commits

Tags: #llvm

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

llvm-svn: 357801
2019-04-05 19:27:49 +00:00
Craig Topper
aeed624501 [X86] Merge the different CMOV instructions for each condition code into single instructions that store the condition code as an immediate.
Summary:
Reorder the condition code enum to match their encodings. Move it to MC layer so it can be used by the scheduler models.

This avoids needing an isel pattern for each condition code. And it removes
translation switches for converting between CMOV instructions and condition
codes.

Now the printer, encoder and disassembler take care of converting the immediate.
We use InstAliases to handle the assembly matching. But we print using the
asm string in the instruction definition. The instruction itself is marked
IsCodeGenOnly=1 to hide it from the assembly parser.

This does complicate the scheduler models a little since we can't assign the
A and BE instructions to a separate class now.

I plan to make similar changes for SETcc and Jcc.

Reviewers: RKSimon, spatel, lebedev.ri, andreadb, courbet

Reviewed By: RKSimon

Subscribers: gchatelet, hiraditya, kristina, lebedev.ri, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 357800
2019-04-05 19:27:41 +00:00
Petr Hosek
0d2bd5df2b [gn] Rebase paths in symlink_or_copy against root_build_dir
We should be always rebasing paths against root_build_dir which is
the directory where scripts are run from, not root_out_dir which is
the current toolchain directory. The latter can result in invalid
paths when the action is being used from a non-default toolchain.

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

llvm-svn: 357798
2019-04-05 19:13:54 +00:00
Petr Hosek
1bafa2bce0 [gn] Make -no-exceptions flag a config
This allows it to be disabled for targets that need exceptions
like libunwind, libc++abi and libc++.

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

llvm-svn: 357797
2019-04-05 19:12:37 +00:00
Saleem Abdulrasool
0521d7d983 lit: make rm python 3 friendly (NFC)
Add some alterations for python 3 compatibility.

llvm-svn: 357789
2019-04-05 18:00:49 +00:00
Nico Weber
47ed8a5f54 gn build: Merge 357768 and 357770
llvm-svn: 357783
2019-04-05 17:05:54 +00:00
Nico Weber
d5ec8f6bbd gn build: Merge r357719
llvm-svn: 357781
2019-04-05 16:57:34 +00:00
Saleem Abdulrasool
52d35270c6 lit: support long paths on Windows
Use ctypes to call into SHFileOperationW with the extended NT path to allow us
to remove paths which exceed 261 characters on Windows. This functionality is
exercised by swift's test suite.

llvm-svn: 357778
2019-04-05 16:48:00 +00:00
Nico Weber
6b741602ec gn build: Merge r357663
llvm-svn: 357666
2019-04-04 02:08:10 +00:00
Reid Kleckner
08deb01a79 [gn] Use "$link /lib" for archives instead of lib.exe
Summary:
This avoids the need to talk about lib.exe or llvm-lib.exe and it does
the right thing with LLD.

Reviewers: thakis

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 357660
2019-04-04 00:31:19 +00:00
Nico Weber
8ee2b9e35a gn build: Add build file for dexp
None of check-clang-tools's tests run this, but the CMake
check-clang-tools depends on the binary, so add it for consistency.

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

llvm-svn: 357624
2019-04-03 19:09:15 +00:00
Nico Weber
3f0ac2eebd gn build: Add build files for clangd xpc framework code
This is a bit of a larger change since this is the first (and as far as
I can tell only) place where the LLVM build produces macOS framework
bundles.

GN has some built-in support for this, so use that.
`gn help create_bundle` has a terse description (but it's a bit
outdated: `deps` must be `public_deps` and the conditionals in the
example in the help aren't quite right on non-iOS).

We need a new 'copy_bundle_data' tool, and since we copy the clangd.xpc
bundle as bundle_data into ClangdXPC.framework it needs to be able to
handle directories in addition to files.

GN also insists we have a compile_xcassets tool even though it's not
used. I just made that run `false`.

Despite GN's support for bundles, we still need to manually create the
expected symlink structure in the .framework bundle. Since this code
never runs on Windows, it's safe to create the symlinks before the
symlink targets exist, so we can just make the bundle depend on the
steps that create the symlinks. For this to work, change the symlink
script to create the symlink's containing directory if it doesn't yet
exist.

I locally verified that CMake and GN build create the same bundle
structure. (I noticed that both builds set LC_ID_DYLIB to the pre-copy
libClangdXPCLib.dylib name, but that seems to not cause any issues and
it happens in the CMake build too.)

(Also add an error message to clangd-xpc-test-client for when loading
the dylib fails – this was useful while locally debugging this.)

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

llvm-svn: 357574
2019-04-03 12:33:19 +00:00
Craig Topper
409ce511c0 [TableGen] Properly calculate the minimum size needed or ConvertFn in GenAsmmatcher.inc files
We were using the number of Matchables rather than the number of rows in the converter table.

This only matters for a few of the targets where the number of matchables is more than 255, but the number of converters is less than 255. Many of the targets have more than 256 converters. So already required a uint16_t.

llvm-svn: 357527
2019-04-02 20:52:04 +00:00
Rainer Orth
843c8afe4e [FileCheck] Fix FileCheck.cpp compilation on Solaris
Both LLVM 8.0.0 and current trunk fail to compile on Solaris with GCC 8.1.0:

  /vol/llvm/src/llvm/dist/utils/FileCheck/FileCheck.cpp: In function ‘void DumpAnnotatedInput(llvm::raw_ostream&, const llvm::FileCheckRequest&, llvm::StringRef, std::vector<InputAnnotation>&, unsigned int)’:
  /vol/llvm/src/llvm/dist/utils/FileCheck/FileCheck.cpp:408:41: error: call of overloaded ‘log10(unsigned int&)’ is ambiguous
     unsigned LineNoWidth = log10(LineCount) + 1;
                                           ^
  In file included from /vol/gcc-8/lib/gcc/i386-pc-solaris2.11/8.1.0/include-fixed/math.h:24,
                   from /vol/gcc-8/include/c++/8.1.0/cmath:45,
                   from /vol/llvm/src/llvm/dist/include/llvm-c/DataTypes.h:28,
                   from /vol/llvm/src/llvm/dist/include/llvm/Support/DataTypes.h:16,
                   from /vol/llvm/src/llvm/dist/include/llvm/ADT/Hashing.h:47,
                   from /vol/llvm/src/llvm/dist/include/llvm/ADT/ArrayRef.h:12,
                   from /vol/llvm/src/llvm/dist/include/llvm/Support/CommandLine.h:22,
                   from /vol/llvm/src/llvm/dist/utils/FileCheck/FileCheck.cpp:18:
  /vol/gcc-8/lib/gcc/i386-pc-solaris2.11/8.1.0/include-fixed/iso/math_iso.h:209:21: note: candidate: ‘long double std::log10(long double)’
    inline long double log10(long double __X) { return __log10l(__X); }
                       ^~~~~
  /vol/gcc-8/lib/gcc/i386-pc-solaris2.11/8.1.0/include-fixed/iso/math_iso.h:170:15: note: candidate: ‘float std::log10(float)’
    inline float log10(float __X) { return __log10f(__X); }
                 ^~~~~
  /vol/gcc-8/lib/gcc/i386-pc-solaris2.11/8.1.0/include-fixed/iso/math_iso.h:70:15: note: candidate: ‘double std::log10(double)’
   extern double log10 __P((double));
                 ^~~~~

Fixed by using std::log10 instead, which allowed the compilation on i386-pc-solaris2.11
and sparc-sun-solaris2.11 to continue.

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

llvm-svn: 357509
2019-04-02 18:38:23 +00:00
Nico Weber
af1dc31af1 gn build: Merge r357469
llvm-svn: 357477
2019-04-02 14:44:34 +00:00
Nico Weber
f710c62d2a gn build: Add build files for non-framework xpc clangd bits
Differential Revision: https://reviews.llvm.org/D60124

llvm-svn: 357476
2019-04-02 14:39:34 +00:00
Nico Weber
82d54396c6 gn build: Merge r357383
llvm-svn: 357398
2019-04-01 14:59:50 +00:00
Nico Weber
7206d03873 gn build: Add build files for most clang-tools-extra unit tests
Differential Revision: https://reviews.llvm.org/D60038

llvm-svn: 357369
2019-03-31 16:49:54 +00:00
Liang Zou
773c0f6e6e fix typo: "\t" => " "
Reviewers: llvm.org, Jim

Reviewed By: Jim

Subscribers: arsenm, jvesely, nhaehnle, rupprecht, llvm-commits

Tags: #llvm

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

llvm-svn: 357365
2019-03-31 14:49:00 +00:00
Nico Weber
6c278d286e gn build: Merge r357340
llvm-svn: 357358
2019-03-31 00:03:37 +00:00
Nico Weber
f9aeade8a6 gn build: Merge r357326
llvm-svn: 357357
2019-03-31 00:01:24 +00:00
Nico Weber
0feba4f8bb gn build: Merge r357248
llvm-svn: 357261
2019-03-29 14:31:28 +00:00
Nico Weber
089ac9f04e gn build: Merge r357259
llvm-svn: 357260
2019-03-29 14:30:01 +00:00
Nico Weber
ab1afdd4e4 gn build: Add check-clang-tools to run clang-tools-extra lit tests
Only runs the clang-tools-extra lit tests; not yet the unit tests.

Add a build file for clangd-indexer too, since it's needed for
the tests.

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

llvm-svn: 357232
2019-03-29 02:49:13 +00:00
Thomas Lively
2f3b03882d [WebAssembly] Merge used feature sets, update atomics linkage policy
Summary:
It does not currently make sense to use WebAssembly features in some functions
but not others, so this CL adds an IR pass that takes the union of all used
feature sets and applies it to each function in the module. This allows us to
prevent atomics from being lowered away if some function has opted in to using
them. When atomics is not enabled anywhere, we detect whether there exists any
atomic operations or thread local storage that would be stripped and disallow
linking with objects that contain atomics if and only if atomics or tls are
stripped. When atomics is enabled, mark it as used but do not require it of
other objects in the link. These changes allow libraries that do not use atomics
to be built once and linked into both single-threaded and multithreaded
binaries.

Reviewers: aheejin, sbc100, dschuff

Subscribers: jgravelle-google, hiraditya, sunfish, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 357226
2019-03-29 00:14:01 +00:00
Rumeet Dhindsa
9afdfb25b8 Update lit config for ld.lld command to match "ld\.lld" instead of trying to match respective regex. (It was able to work with ld-lld and ld1lld as well)
Differential Revision: https://reviews.llvm.org/D59962

llvm-svn: 357218
2019-03-28 22:26:51 +00:00
Nico Weber
8b4910a0f5 gn build: Add some build files for clangd
Enough to build the clangd binaries, but this is still missing build
files for:
- fuzzer
- indexer
- index/dex/dexp
- benchmarks
- xpc

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

llvm-svn: 357182
2019-03-28 16:53:32 +00:00
Jordan Rupprecht
f0db1c1b78 Add "git llvm revert" and "git llvm svn-lookup" subcommands
Summary:
The current git-svnrevert script only works with git-svn repos (e.g. using "git svn find-rev" to find the commit to revert). This adds a similar implementation that works with the llvm git command handler.

Usage:
```
// Revert by svn id
$ git llvm revert r123456
// See what commands would be run instead of actually reverting
$ git llvm revert -n r123456
<full git revert + git commit commands>
// Git commit hash also fine
$ git llvm revert abc123456
// For convenience, the git->svn method can be used directly:
$ git llvm svn-lookup abc123456
r123456
// Push revert upstream (drop the -n when ready)
$ git llvm push -n
```

Regardless of how the command is invoked (with a svn revision or git hash), the message is:

```
Revert [LibFoo] Change Foo implementation

This reverts r123456 (git commit abc123)
```

Reviewers: jyknight, mehdi_amini, jlebar

Reviewed By: jlebar

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 357180
2019-03-28 16:15:28 +00:00
Nico Weber
915462d704 gn build: Merge r357047
llvm-svn: 357071
2019-03-27 15:10:47 +00:00
Nico Weber
937536d59a gn build: Add build files for clang-include-fixer and find-all-symbols
Differential Revision: https://reviews.llvm.org/D59838

llvm-svn: 357042
2019-03-27 00:17:05 +00:00
Nico Weber
8f414fddf8 gn build: Format all build files
Re-ran `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`.

llvm-svn: 357021
2019-03-26 19:16:28 +00:00
Nico Weber
3fe9ab7497 gn build: Merge r356929 (effectively relands r353518, reverted in r353621)
llvm-svn: 357019
2019-03-26 18:55:37 +00:00
Tom Stellard
43880afb99 merge-request.sh: Update 8.0 metabug for 8.0.1
llvm-svn: 356924
2019-03-25 17:01:29 +00:00
Alexander Kornienko
373196d88f [clang-tidy] Separate the check-facing interface
Summary:
Move ClangTidyCheck to a separate header/.cpp
Switch checks to #include "ClangTidyCheck.h"
Mention ClangTidyCheck.h in the docs

Reviewers: hokein, gribozavr, aaron.ballman

Reviewed By: hokein

Subscribers: mgorny, javed.absar, xazax.hun, arphaman, jdoerfert, llvm-commits, cfe-commits

Tags: #clang, #llvm

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

llvm-svn: 356890
2019-03-25 12:36:30 +00:00
Nico Weber
e1010d77d5 gn build: Clean up README.rst a bit
- Make introduction a bit shorter
- Add a `git clone` step to Quick start
- Put command to run first in each of the Quick start steps
- Use ``code`` instead of `label` throughout; this is .rst not .md

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

llvm-svn: 356885
2019-03-25 11:33:19 +00:00
Nico Weber
0a60122796 gn build: Let get.py keep zip file in memory instead of using a temp file
The zip is small, and it's a bit less code this way.
No intended behavior change.

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

llvm-svn: 356884
2019-03-25 11:32:27 +00:00
Nico Weber
a67bb45dad gn build: Merge r356820
llvm-svn: 356846
2019-03-23 23:22:45 +00:00
Nico Weber
0470bd0ebe gn build: Add build files for modularize and pp-trace
Differential Revision: https://reviews.llvm.org/D59701

llvm-svn: 356845
2019-03-23 23:16:41 +00:00
Vitaly Buka
c00fa5293b [gn] Add clang-tools-extra/clang-tidy/tool/BUILD.gn
llvm-svn: 356828
2019-03-23 02:31:23 +00:00
Vitaly Buka
287888fecf [gn] Add clang-tools-extra/clang-tidy/tool/BUILD.gn
llvm-svn: 356827
2019-03-23 02:20:48 +00:00
Nico Weber
f978aa441a Make clang-move use same file naming convention as other tools
In all the other clang-foo tools, the main library file is called
Foo.cpp and the file in the tool/ folder is called ClangFoo.cpp.
Do this for clang-move too.

No intended behavior change.

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

llvm-svn: 356780
2019-03-22 16:34:39 +00:00
Nico Weber
edf9122701 gn build: Merge r356750
llvm-svn: 356772
2019-03-22 16:00:16 +00:00
Nico Weber
49e0c14bbb gn build: Merge r356570
llvm-svn: 356771
2019-03-22 15:58:33 +00:00
Nico Weber
f10041f3c8 gn build: Merge r356662
llvm-svn: 356770
2019-03-22 15:56:33 +00:00
Nico Weber
7cf98174b4 gn build: Merge r356692
llvm-svn: 356769
2019-03-22 15:54:29 +00:00
Nico Weber
cf4d715d85 gn build: Merge r356753
llvm-svn: 356767
2019-03-22 15:50:24 +00:00