Commit Graph

4582 Commits

Author SHA1 Message Date
Leonard Chan db01c3adc6 [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals
This diff includes the logic for setting the precision bits for each primary fixed point type in the target info and logic for initializing a fixed point literal.

Fixed point literals are declared using the suffixes

```
hr: short _Fract
uhr: unsigned short _Fract
r: _Fract
ur: unsigned _Fract
lr: long _Fract
ulr: unsigned long _Fract
hk: short _Accum
uhk: unsigned short _Accum
k: _Accum
uk: unsigned _Accum
```
Errors are also thrown for illegal literal values

```
unsigned short _Accum u_short_accum = 256.0uhk;   // expected-error{{the integral part of this literal is too large for this unsigned _Accum type}}
```

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

llvm-svn: 335148
2018-06-20 17:19:40 +00:00
David Blaikie bc023c968c Modules: Fix implicit output file for .cppm to .pcm instead of stdout
This code was introduced back in r178148, a change to introduce
-module-file-info - which still exists & seems like it's still tested (&
this change didn't cause any of those tests to fail).

It doesn't look like this change was necessary there - since it's about
pcm output, whereas -module-file-info looks like it's for pcm /input/.
So I'm not really sure what the original motivation was.

I'm open to ideas though, if it turns out the original change was
necessary/useful.

llvm-svn: 334778
2018-06-14 23:09:06 +00:00
Peter Collingbourne d86ca94901 Driver: De-duplicate some code. NFCI.
llvm-svn: 334673
2018-06-14 00:03:41 +00:00
Piotr Padlewski e368de364e Add -fforce-emit-vtables
Summary:
 In many cases we can't devirtualize
 because definition of vtable is not present. Most of the
 time it is caused by inline virtual function not beeing
 emitted. Forcing emitting of vtable adds a reference of these
 inline virtual functions.
 Note that GCC was always doing it.

Reviewers: rjmccall, rsmith, amharc, kuhar

Subscribers: llvm-commits, cfe-commits

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

Co-authored-by: Krzysztof Pszeniczny <krzysztof.pszeniczny@gmail.com>
llvm-svn: 334600
2018-06-13 13:55:42 +00:00
Petr Hosek 7250908016 [AArch64] Support reserving x20 register
Register x20 is a callee-saved register which may be used for other
purposes in certain contexts, for example to hold special variables
within the kernel. This change adds support for reserving this register
both to frontend and backend to make this register usable for these
purposes.

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

llvm-svn: 334531
2018-06-12 20:00:50 +00:00
Zachary Turner 08426e1f9f Refactor ExecuteAndWait to take StringRefs.
This simplifies some code which had StringRefs to begin with, and
makes other code more complicated which had const char* to begin
with.

In the end, I think this makes for a more idiomatic and platform
agnostic API.  Not all platforms launch process with null terminated
c-string arrays for the environment pointer and argv, but the api
was designed that way because it allowed easy pass-through for
posix-based platforms.  There's a little additional overhead now
since on posix based platforms we'll be takign StringRefs which
were constructed from null terminated strings and then copying
them to null terminate them again, but from a readability and
usability standpoint of the API user, I think this API signature
is strictly better.

llvm-svn: 334518
2018-06-12 17:43:52 +00:00
Pavel Labath d8c6290ba4 Move VersionTuple from clang/Basic to llvm/Support
Summary:
This kind of functionality is useful to other project apart from clang.
LLDB works with version numbers a lot, but it does not have a convenient
abstraction for this. Moving this class to a lower level library allows
it to be freely used within LLDB.

Since this class is used in a lot of places in clang, and it used to be
in the clang namespace, it seemed appropriate to add it to the list of
adopted classes in LLVM.h to avoid prefixing all uses with "llvm::".

Also, I didn't find any tests specific for this class, so I wrote a
couple of quick ones for the more interesting bits of functionality.

Reviewers: zturner, erik.pilkington

Subscribers: mgorny, cfe-commits, llvm-commits

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

llvm-svn: 334399
2018-06-11 10:28:04 +00:00
Zachary Turner 1f67a3cba9 [FileSystem] Split up the OpenFlags enumeration.
This breaks the OpenFlags enumeration into two separate
enumerations: OpenFlags and CreationDisposition.  The first
controls the behavior of the API depending on whether or not
the target file already exists, and is not a flags-based
enum.  The second controls more flags-like values.

This yields a more easy to understand API, while also allowing
flags to be passed to the openForRead api, where most of the
values didn't make sense before.  This also makes the apis more
testable as it becomes easy to enumerate all the configurations
which make sense, so I've added many new tests to exercise all
the different values.

llvm-svn: 334221
2018-06-07 19:58:58 +00:00
Shoaib Meenai 09edbddee7 [Driver] Stop passing -fseh-exceptions for x86_64-windows-msvc
-fseh-exceptions is only meaningful for MinGW targets, and that driver
already has logic to pass either -fdwarf-exceptions or -fseh-exceptions
as appropriate. -fseh-exceptions is just a no-op for MSVC triples, and
passing it to cc1 causes unnecessary confusion.

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

llvm-svn: 334145
2018-06-06 23:09:02 +00:00
Yaxun Liu 470b833bed [HIP] Fix unbundling
HIP uses clang-offload-bundler to bundle intermediate files for host
and different gpu archs together. When a file is unbundled,
clang-offload-bundler should be called only once, and the objects
for host and different gpu archs should be passed to the next
jobs. This is because Driver maintains CachedResults which maps
triple-arch string to output files for each job.

This patch fixes a bug in Driver::BuildJobsForActionNoCache which
uses incorrect key for CachedResults for HIP which causes
clang-offload-bundler being called mutiple times and incorrect
output files being used.

It only affects HIP.

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

llvm-svn: 334128
2018-06-06 19:44:10 +00:00
Pierre Gousseau 1abf9439d5 [Driver] Add flag "--dependent-lib=..." when enabling asan or ubsan on PS4.
NFC for targets other than PS4.

Simplify users' workflow when enabling asan or ubsan and calling the linker separately.

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

llvm-svn: 334096
2018-06-06 14:04:15 +00:00
Petr Hosek 03eece728f [Driver][Fuchsia] Pass LTO flags to linker
Even though we use lld by default for Fuchsia, we use Gold plugin
arguments like all other drivers as lld supports Gold plugin options.

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

llvm-svn: 333979
2018-06-05 01:50:59 +00:00
Leonard Chan f921d85422 This diff includes changes for supporting the following types.
// Primary fixed point types
signed short _Accum s_short_accum;
signed _Accum s_accum;
signed long _Accum s_long_accum;
unsigned short _Accum u_short_accum;
unsigned _Accum u_accum;
unsigned long _Accum u_long_accum;

// Aliased fixed point types
short _Accum short_accum;
_Accum accum;
long _Accum long_accum;
This diff only allows for declaration of the fixed point types. Assignment and other operations done on fixed point types according to http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf will be added in future patches. The saturated versions of these types and the equivalent _Fract types will also be added in future patches.

The tests included are for asserting that we can declare these types.

Fixed the test that was failing by not checking for dso_local on some
targets.

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

llvm-svn: 333923
2018-06-04 16:07:52 +00:00
Leonard Chan 0d485dbb40 Revert "This diff includes changes for supporting the following types."
This reverts commit r333814, which fails for a test checking the bit
width on ubuntu.

llvm-svn: 333815
2018-06-02 03:27:13 +00:00
Leonard Chan db55d8331e This diff includes changes for supporting the following types.
```

// Primary fixed point types
signed short _Accum s_short_accum;
signed _Accum s_accum;
signed long _Accum s_long_accum;
unsigned short _Accum u_short_accum;
unsigned _Accum u_accum;
unsigned long _Accum u_long_accum;

// Aliased fixed point types
short _Accum short_accum;
_Accum accum;
long _Accum long_accum;

```

This diff only allows for declaration of the fixed point types. Assignment and other operations done on fixed point types according to http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf will be added in future patches. The saturated versions of these types and the equivalent `_Fract` types will also be added in future patches.

The tests included are for asserting that we can declare these types.

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

llvm-svn: 333814
2018-06-02 02:58:51 +00:00
Jonas Hahnfeld 78c29e2735 [OpenMP] Fix typo in NVPTX linker, NFC.
Clang calls "nvlink" for linking multiple object files with OpenMP
target functions, so correct this information when printing errors.

llvm-svn: 333757
2018-06-01 14:43:48 +00:00
David Stenberg 3891885ca0 [Driver] Clean up tmp files when deleting Compilation objects
Summary:
In rL327851 the createUniqueFile() and createTemporaryFile()
variants that do not return the file descriptors were changed to
create empty files, rather than only check if the paths are free.
This change was done in order to make the functions race-free.

That change led to clang-tidy (and possibly other tools) leaving
behind temporary assembly files, of the form placeholder-*, when
using a target that does not support the internal assembler.

The temporary files are created when building the Compilation
object in stripPositionalArgs(), as a part of creating the
compilation database for the arguments after the double-dash. The
files are created by Driver::GetNamedOutputPath().

Fix this issue by cleaning out temporary files at the deletion of
Compilation objects.

This fixes https://bugs.llvm.org/show_bug.cgi?id=37091.

Reviewers: klimek, sepavloff, arphaman, aaron.ballman, john.brawn, mehdi_amini, sammccall, bkramer, alexfh, JDevlieghere

Reviewed By: aaron.ballman, JDevlieghere

Subscribers: erichkeane, lebedev.ri, Ka-Ka, cfe-commits

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

llvm-svn: 333637
2018-05-31 09:05:22 +00:00
Sam McCall 43fdd22970 Fix -Wunused in NDEBUG introduced by HIP r333484
llvm-svn: 333514
2018-05-30 08:03:43 +00:00
Peter Collingbourne 54d13b4068 Sema: Add a flag for rejecting member pointers with incomplete base types.
Codebases that need to be compatible with the Microsoft ABI can pass
this flag to avoid issues caused by the lack of a fixed ABI for
incomplete member pointers.

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

llvm-svn: 333498
2018-05-30 03:40:04 +00:00
Yaxun Liu f614422da9 Add HIP toolchain
This patch adds HIP toolchain to support HIP language mode. It includes:

Create specific compiler jobs for HIP.

Choose specific libraries for HIP.

With contribution from Greg Rodgers.

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

llvm-svn: 333484
2018-05-30 00:53:50 +00:00
Yaxun Liu 3af038beec Add action builder for HIP
To support separate compile/link and linking across device IR in different source files,
a new HIP action builder is introduced. Basically it compiles/links host and device
code separately, and embed fat binary in host linking stage through linker script.

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

llvm-svn: 333483
2018-05-30 00:49:10 +00:00
Petr Hosek dd38d93198 [Driver] Rename DefaultTargetTriple to TargetTriple
While this value is initialized with the DefaultTargetTriple, it
can be later overriden using the -target flag so TargetTriple is
a more accurate name. This change also provides an accessor which
could be accessed from ToolChain implementations.

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

llvm-svn: 333468
2018-05-29 22:35:39 +00:00
Shiva Chen f78fc3842f [RISCV] Add -mrelax/-mno-relax flags to enable/disable RISCV linker relaxation
Differential Revision: https://reviews.llvm.org/D44888

llvm-svn: 333385
2018-05-29 00:44:15 +00:00
Daniel Cederman cfba053491 [Sparc] Use the leon arch for Leon3's when using an external assembler
Summary: This allows the use of the casa instruction available in most Leon3's.

Reviewers: jyknight

Reviewed By: jyknight

Subscribers: joerg, fedor.sergeev, jrtc27, cfe-commits

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

llvm-svn: 333157
2018-05-24 06:16:02 +00:00
Artem Belevich 578653a8fc [CUDA] Fixed the list of GPUs supported by CUDA-9.
Differential Revision: https://reviews.llvm.org/D47268

llvm-svn: 333098
2018-05-23 16:45:23 +00:00
Peter Collingbourne 91d02844a3 Reland r332885, "CodeGen, Driver: Start using direct split dwarf emission in clang."
As well as two follow-on commits r332906, r332911 with a fix for
test clang/test/CodeGen/split-debug-filename.c.

llvm-svn: 333013
2018-05-22 18:52:37 +00:00
Amara Emerson f528bcc32a Revert "CodeGen, Driver: Start using direct split dwarf emission in clang."
This reverts commit r332885 as it broke several greendragon buildbots.

llvm-svn: 332973
2018-05-22 11:18:58 +00:00
David Chisnall 404bbcbdcb Revert "Revert r332955 "GNUstep Objective-C ABI version 2""
llvm-svn: 332963
2018-05-22 10:13:06 +00:00
Bjorn Pettersson 844663353d Revert r332955 "GNUstep Objective-C ABI version 2"
Reverted due to buildbot failures.
Seems like isnumber() is some Apple addition to cctype.

llvm-svn: 332957
2018-05-22 08:16:45 +00:00
David Chisnall 79356eefc0 GNUstep Objective-C ABI version 2
Summary:
This includes initial support for the (hopefully final) updated Objective-C ABI, developed here:

https://github.com/davidchisnall/clang-gnustep-abi-2

It also includes some cleanups and refactoring from older GNU ABIs.

The current version is ELF only, other formats to follow.

Reviewers: rjmccall, DHowett-MSFT

Reviewed By: rjmccall

Subscribers: smeenai, cfe-commits

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

llvm-svn: 332950
2018-05-22 06:09:23 +00:00
Peter Collingbourne 47bc01786d CodeGen, Driver: Start using direct split dwarf emission in clang.
Fixes PR37466.

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

llvm-svn: 332885
2018-05-21 20:31:59 +00:00
Alexey Bataev 66f9577f09 [OPENMP-SIMD] Fix PR37536: Fix definition of _OPENMP macro.
if `-fopenmp-simd` is specified alone, `_OPENMP` macro should not be
  defined. If `-fopenmp-simd` is specified along with the `-fopenmp`,
  `_OPENMP` macro should be defined with the value `201511`.

llvm-svn: 332852
2018-05-21 16:40:32 +00:00
Sunil Srivastava 2ada2499ea Do not enable RTTI with -fexceptions, for PS4
NFC for targets other than PS4.

This patch is a change in behavior for PS4, in that PS4 will no longer enable
RTTI when -fexceptions is specified (RTTI and Exceptions are disabled by default
on PS4). RTTI will remain disabled except for types being thrown or caught.
Also, '-fexceptions -fno-rtti' (previously prohibited on PS4) is now accepted,
as it is for other targets.

This patch removes some PS4 specific code, making the code cleaner.

Also, in the test file rtti-options.cpp, PS4 tests where the behavior is the
same as the generic x86_64-linux are removed, making the test cleaner.

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

llvm-svn: 332784
2018-05-18 23:32:01 +00:00
Eric Liu 7112fe63ec Fix unused variable warning in r332724
llvm-svn: 332734
2018-05-18 16:29:42 +00:00
Yaxun Liu 29155b01c1 [HIP] Support offloading by linker script
To support linking device code in different source files, it is necessary to
embed fat binary at host linking stage.

This patch emits an external symbol for fat binary in host codegen, then
embed the fat binary by lld through a linker script.

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

llvm-svn: 332724
2018-05-18 15:07:56 +00:00
Walter Lee a5cc222c68 [sanitizer] Don't add --export-dynamic for Myriad
This is to work around a bug in some versions of gnu ld, where
--export-dynamic implies -shared even if -static is explicitly given.
Myriad supports static linking only, so --export-dynamic is never
needed.

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

llvm-svn: 332635
2018-05-17 18:04:39 +00:00
Petr Hosek e857f5af6a [Driver] Only use -lc++ on Fuchsia
The fact that libc++ depends on libc++abi and libunwind is an internal
detail that's captured by the libc++.so linker script.

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

llvm-svn: 332138
2018-05-11 20:42:31 +00:00
Yaxun Liu f5a6b96c0f [HIP] Set proper triple and offload kind for the toolchain
Also introduce --hip-link option to indicate HIP for linking.

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

llvm-svn: 332123
2018-05-11 19:21:39 +00:00
Yaxun Liu 00f31d514c [HIP] Diagnose unsupported host triple
Differential Revision: https://reviews.llvm.org/D46487

llvm-svn: 332122
2018-05-11 19:14:34 +00:00
Yaxun Liu 609f752929 [HIP] Let clang-offload-bundler support HIP
When bundle/unbundle intermediate files for HIP, there may be multiple
sub archs, therefore BoundArch needs to be included in the target
and output file names for clang-offload-bundler.

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

llvm-svn: 332121
2018-05-11 19:02:18 +00:00
Kamil Rytarowski a092e184cf Support XRay in the NetBSD driver
Summary:
While there, perform a small cleanup, reducing delta
with drivers for other OSes.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, dberris

Reviewed By: dberris

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 332071
2018-05-11 01:00:38 +00:00
Kamil Rytarowski 448631f6b1 Permit -fxray-instrument for NetBSD/amd64
Summary:
Use the same branch as FreeBSD and OpenBSD.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dberris, vitalybuka

Reviewed By: vitalybuka

Subscribers: emaste, llvm-commits

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

llvm-svn: 332070
2018-05-11 00:58:55 +00:00
Sylvestre Ledru 93dd5dcdf7 Add support of the next Ubuntu (Ubuntu 18.10 - Cosmic Canimal)
Patch by Adam Conrad

llvm-svn: 331965
2018-05-10 08:45:43 +00:00
Artem Belevich 679dafe69e [CUDA] Added -f[no-]cuda-short-ptr option
The option enables use of 32-bit pointers for accessing
const/local/shared memory. The feature is disabled by default.

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

llvm-svn: 331938
2018-05-09 23:10:09 +00:00
Martin Storsjo f1f8f4a1fd Revert "[Driver] Use -fuse-line-directives by default in MSVC mode"
This reverts commit SVN r331666.

It was afterwards pointed out in https://reviews.llvm.org/D46520
that #line directives lose information about what parts come from a
system header. That means the result of -E usually won't compile,
since Windows headers are typically full of warnings and
default-error warnings.

llvm-svn: 331858
2018-05-09 09:11:01 +00:00
Adrian Prantl 9fc8faf9e6 Remove \brief commands from doxygen comments.
This is similar to the LLVM change https://reviews.llvm.org/D46290.

We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done

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

llvm-svn: 331834
2018-05-09 01:00:01 +00:00
Yaxun Liu 398612b4c2 [HIP] Add hip offload kind
There are quite differences in HIP action builder and action job creation,
which justifies to define a separate offload kind.

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

llvm-svn: 331811
2018-05-08 21:02:12 +00:00
Jessica Paquette 544bb55a3e Add a mno-outline flag to disable the MachineOutliner
Since we're working on turning the MachineOutliner by default under -Oz for
AArch64, it makes sense to have an -mno-outline flag available. This currently
doesn't do much (it basically just undoes -moutline).

When the MachineOutliner is on by default under AArch64, this flag should
set -mllvm -enable-machine-outliner=never.

llvm-svn: 331810
2018-05-08 20:58:32 +00:00
Martin Storsjo f9fa17b873 [Driver] Don't add -dwarf-column-info when using -gcodeview on non-msvc targets
-dwarf-column-info is omitted if -gcodeview is specified for msvc
targets at the moment, but since -gcodeview is an option that can be
specified for any target, there's little reason to restrict this
handling to msvc targets.

This allows getting proper codeview debug info by passing -gcodeview
for e.g. MinGW targets as well.

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

llvm-svn: 331807
2018-05-08 20:55:23 +00:00
Jessica Paquette 635af6223b Change -foutline to -moutline
Nitpicky, but the MachineOutliner is a machine-level pass, and so we should
reflect that by using "m" instead of "n".

Figured we should get this in before people get used to the letter f. :)

llvm-svn: 331806
2018-05-08 20:53:19 +00:00