Commit Graph

2138 Commits

Author SHA1 Message Date
Adrian Prantl 075bf567f9 Revert r241770 and add Basic to the dependencies of clang-check instead.
PR24067.

llvm-svn: 241782
2015-07-09 02:53:05 +00:00
Adrian Prantl 6335057824 Move the definition of ~PCHContainerOperations from Basic into Frontend.
Fixes PR24067.

llvm-svn: 241770
2015-07-09 01:01:52 +00:00
Petar Jovanovic 26a4a40137 [MIPS] Add support for direct-to-nacl in Clang
For Mips direct-to-nacl, the goal is to be close to le32 front-end and
use Mips32EL backend. This patch defines new NaClMips32ELTargetInfo and
modifies it slightly to be close to le32. It also adds necessary parts,
inline with ARM and X86.

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

llvm-svn: 241678
2015-07-08 13:07:31 +00:00
Adrian Prantl bc068586ac Revert "Revert r241620 and follow-up commits" and move the initialization
of the llvm targets from clang/CodeGen into ClangCheck.cpp and CIndex.cpp.

llvm-svn: 241653
2015-07-08 01:00:30 +00:00
Adrian Prantl 142ec39739 Revert r241620 and follow-up commits while investigating linux buildbot failures.
llvm-svn: 241642
2015-07-07 23:19:46 +00:00
Adrian Prantl e50371b948 Wrap clang modules and pch files in an object file container.
This patch adds ObjectFilePCHContainerOperations uses the LLVM backend
to put the contents of a PCH into a __clangast section inside a COFF, ELF,
or Mach-O object file container.

This is done to facilitate module debugging by makeing it possible to
store the debug info for the types defined by a module alongside the AST.

rdar://problem/20091852

llvm-svn: 241620
2015-07-07 20:11:29 +00:00
Douglas Gregor ab209d83be Implement the Objective-C __kindof type qualifier.
The __kindof type qualifier can be applied to Objective-C object
(pointer) types to indicate id-like behavior, which includes implicit
"downcasting" of __kindof types to subclasses and id-like message-send
behavior. __kindof types provide better type bounds for substitutions
into unspecified generic types, which preserves more type information.

llvm-svn: 241548
2015-07-07 03:58:42 +00:00
Renato Golin 15b86155c9 Revert "Refactored ARMTargetInfo in order to use the API of llvm/lib/Support/TargetParser.cpp
This reverts commit r241343, as it was, again, breaking all ARM buildbots.

llvm-svn: 241362
2015-07-03 16:41:13 +00:00
Alexandros Lamprineas eb73228888 - Refactored ARMTargetInfo in order to use the API of llvm/lib/Support/TargetParser.cpp
for extracting target specific information.
- Patch for commit 241267: ShouldUseInlineAtomic was set incorrectly when subArch was
  not specified, causing regressions.

Change-Id: Iabb35d59722f4972f1a3ab4365880add5bbcfdcc
llvm-svn: 241343
2015-07-03 11:57:23 +00:00
Rafael Espindola 5ab8e2e85c Revert "Refactored ARMTargetInfo in order to use the API of llvm/lib/Support/TargetParser.cpp for extracting target specific information."
This reverts commit r241267. Tests were failing on the bots.

llvm-svn: 241275
2015-07-02 15:14:10 +00:00
Alexandros Lamprineas ec44b157f1 Refactored ARMTargetInfo in order to use the API of llvm/lib/Support/TargetParser.cpp
for extracting target specific information.

Change-Id: Ia0b83ecdb8d9223f9c4ef38dd9206969f78e53f3
llvm-svn: 241267
2015-07-02 14:21:40 +00:00
Alexandros Lamprineas 73b076159b test commit
Change-Id: Ibaa2e1115544ddfa491335b81226819fd9cc04b4
llvm-svn: 241260
2015-07-02 13:21:34 +00:00
Alexey Bataev 80909878ad [OPENMP 4.0] Initial support for 'omp cancel' construct.
Implemented parsing/sema analysis + (de)serialization.

llvm-svn: 241253
2015-07-02 11:25:17 +00:00
Alexey Bataev 0039651304 [OPENMP] Introduced type trait "__builtin_omp_required_simd_align" for default simd alignment.
Adds type trait "__builtin_omp_required_simd_align" after discussions here http://reviews.llvm.org/D9894
Differential Revision: http://reviews.llvm.org/D10597

llvm-svn: 241237
2015-07-02 03:40:19 +00:00
Alexey Bataev 6d4ed05830 [OPENMP 4.0] Initial support for 'omp cancellation point' construct.
Add parsing and sema analysis for 'omp cancellation point' directive.

llvm-svn: 241145
2015-07-01 06:57:41 +00:00
Richard Smith 2aedca340c [modules] Before checking whether the controlling macro of a header is defined,
update the identifier in case we've imported a definition of the macro (and
thus the contents of the header) from a module.

Also fold ExternalIdentifierLookup into ExternalPreprocessorSource; it no longer
makes sense to keep these separate now that the only user of the former also
needs the latter.

llvm-svn: 241137
2015-07-01 02:29:35 +00:00
Eric Christopher 298ac300b2 Fix sse4 for target attribute feature additions.
This reinstates part of the hack removed in r233223, by special
casing sse4 as part of the feature additions. The notable change
here is that we consider it only as part of setting the SSE level
and not as part of the actual target features set which handles
setting the rest of the masks.

llvm-svn: 241130
2015-07-01 00:08:32 +00:00
Adrian Prantl 15bcf70cdf Add a function to ExternalASTSource that returns a descriptor that
abstracts the commonalities between modules and PCH files that are
needed to emit debug info for a module or precompiled header.

llvm-svn: 241083
2015-06-30 17:39:43 +00:00
Eric Christopher d983270976 Add support for the x86 builtin __builtin_cpu_supports.
This matches the implementation of the gcc support for the same
feature, including checking the values set up by libgcc at runtime.
The structure looks like this:

  unsigned int __cpu_vendor;
  unsigned int __cpu_type;
  unsigned int __cpu_subtype;
  unsigned int __cpu_features[1];

with a set of enums to match various fields that are field out after
parsing the output of the cpuid instruction.
This also adds a set of errors checking for valid input (and cpu).

compiler-rt support for this and the other builtins in this family
(__builtin_cpu_init and __builtin_cpu_is) are forthcoming.

llvm-svn: 240994
2015-06-29 21:00:05 +00:00
Ranjeet Singh ac08e53f3a [ARM] The bits set in the variable HW_FP could get unset
when iterating through the Features vector if we don't
keep track of what's already been set. This could lead to
the macro __ARM_FP getting the wrong value. This patch
fixes this issue by keeping track of the bits that have
already been set in the loop.

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

llvm-svn: 240607
2015-06-24 23:39:25 +00:00
Douglas Gregor aea7afdc13 Replace __double_underscored type nullability qualifiers with _Uppercase_underscored
Addresses a conflict with glibc's __nonnull macro by renaming the type
nullability qualifiers as follows:

  __nonnull -> _Nonnull
  __nullable -> _Nullable
  __null_unspecified -> _Null_unspecified

This is the major part of rdar://problem/21530726, but does not yet
provide the Darwin-specific behavior for the old names.

llvm-svn: 240596
2015-06-24 22:02:08 +00:00
Chandler Carruth c026e39451 Remove a limited and somewhat questionable DenseMapInfo specialization
for StringRef now that the core DenseMap library provides this facility.

llvm-svn: 240530
2015-06-24 10:24:30 +00:00
Alexey Bataev 1c2cfbc3ea [OPENMP] Initial support for 'depend' clause (4.0).
Parsing and sema analysis (without support for array sections in arguments) for 'depend' clause (used in 'task' directive, OpenMP 4.0).

llvm-svn: 240409
2015-06-23 14:25:19 +00:00
Alexander Kornienko ab9db51042 Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").
llvm-svn: 240353
2015-06-22 23:07:51 +00:00
Ahmed Bougacha 0b938284da [CodeGen] Teach X86_64ABIInfo about AVX512.
As specified in the SysV AVX512 ABI drafts. It follows the same scheme
as AVX2: 

    Arguments of type __m512 are split into eight eightbyte chunks.
    The least significant one belongs to class SSE and all the others
    to class SSEUP.

This also means we change the OpenMP SIMD default alignment on AVX512.

Based on r240337.
Differential Revision: http://reviews.llvm.org/D9894

llvm-svn: 240338
2015-06-22 21:31:43 +00:00
Alexander Kornienko 3d9d929e42 Fixed/added namespace ending comments using clang-tidy. NFC
The patch is generated using this command:

  $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
      -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
      work/llvm/tools/clang

To reduce churn, not touching namespaces spanning less than 10 lines.

llvm-svn: 240270
2015-06-22 09:47:44 +00:00
Nico Weber 708aabd3ef Suppress bogus gcc -Wreturn-type warnings.
llvm-svn: 240199
2015-06-20 00:06:30 +00:00
Douglas Gregor 813a066f16 Extend type nullability qualifiers for Objective-C.
Introduce context-sensitive, non-underscored nullability specifiers
(nonnull, nullable, null_unspecified) for Objective-C method return
types, method parameter types, and properties.

Introduce Objective-C-specific semantics, including computation of the
nullability of the result of a message send, merging of nullability
information from the @interface of a class into its @implementation,
etc .

This is the Objective-C part of rdar://problem/18868820.

llvm-svn: 240154
2015-06-19 18:14:38 +00:00
Matt Arsenault 3ea39f9e78 AMDGPU: Fix places missed in rename
llvm-svn: 240148
2015-06-19 17:54:10 +00:00
Alexander Potapenko b9b73ef906 [ASan] Initial support for Kernel AddressSanitizer
This patch adds initial support for the -fsanitize=kernel-address flag to Clang.
Right now it's quite restricted: only out-of-line instrumentation is supported, globals are not instrumented, some GCC kasan flags are not supported.
Using this patch I am able to build and boot the KASan tree with LLVMLinux patches from github.com/ramosian-glider/kasan/tree/kasan_llvmlinux.
To disable KASan instrumentation for a certain function attribute((no_sanitize("kernel-address"))) can be used.

llvm-svn: 240131
2015-06-19 12:19:07 +00:00
Tom Stellard 64e0dd0a27 AMDGPU: Add missing GK_VOLCANIC_ISLANDS to switch statement
This fixes buildbot failures introduced by r240038.

llvm-svn: 240059
2015-06-18 21:13:29 +00:00
Tom Stellard 5c38440b2b R600: Add Volcanic Islands targets
Reviewers: arsenm

Subscribers: cfe-commits

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

llvm-svn: 240038
2015-06-18 19:14:15 +00:00
Alexey Bataev c30dd2daf9 [OPENMP] Support for '#pragma omp taskgroup' directive.
Added parsing, sema analysis and codegen for '#pragma omp taskgroup' directive (OpenMP 4.0).
The code for directive is generated the following way:
#pragma omp taskgroup
<body>

void __kmpc_taskgroup(<loc>, thread_id);
<body>
void __kmpc_end_taskgroup(<loc>, thread_id);

llvm-svn: 240011
2015-06-18 12:14:09 +00:00
Alexey Samsonov 9bc2ad5e6c Revert "[Sanitizers] Provide better diagnostic for sanitizers unsupported for target triple."
This reverts commit r239953, while I'm investigating assertion
failure from http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_check/9994/

llvm-svn: 239958
2015-06-17 22:27:32 +00:00
Alexey Samsonov 9170efdc0d [Sanitizers] Provide better diagnostic for sanitizers unsupported for target triple.
Summary:
Introduce ToolChain::getSupportedSanitizers() that would return the set
of sanitizers available on given toolchain. By default, these are
sanitizers which don't necessarily require runtime support (i.e.
set from -fsanitize=undefined-trap).

Sanitizers (ASan, DFSan, TSan, MSan etc.) which cannot function
without runtime library are marked as supported only on platforms
for which we actually build these runtimes.

This would allow more fine-grained checks in the future: for instance,
we have to restrict availability of -fsanitize=vptr to Mac OS 10.9+
(PR23539)

Update test cases accrodingly: add tests for certain unsupported
configurations, remove test cases for -fsanitize=vptr + PS4
integration, as we don't build the runtime for PS4 at the moment.

Test Plan: regression test suite

Reviewers: pcc

Subscribers: cfe-commits, filcab, eugenis, thakis, kubabrecka, emaste, rsmith

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

llvm-svn: 239953
2015-06-17 22:07:28 +00:00
Ulrich Weigand 47fd253f56 [SystemZ] Mangle long double as __float128
In r239421, the mangling of long double on PowerPC Linux targets
was changed to use "g" instead of "e".  This same change also needs
to be done for SystemZ (all targets, since we support only Linux
on SystemZ anyway).

This is because an old ABI variant set "long double" to a 64-bit
type equivalent to "double", and the "e" mangling code is still
used to refer to that old ABI for compatibility reasons.

llvm-svn: 239822
2015-06-16 15:21:47 +00:00
Ed Schouten 7893e6874d Add some basic support for CloudABI on i686.
Some people want to experiment with building i686 CloudABI binaries. I
am not entirely sure this is a good idea, as I'd rather see Intel x32
support appear.

As it only requires a two-line change, let's at least provide compiler
to ease experimenting.

llvm-svn: 239689
2015-06-13 21:33:49 +00:00
Eric Fiselier 098e6de9aa Add `-verify-ignore-unexpected` option to ignore unexpected diagnostics in VerifyDiagnosticsConsumer
Summary:
The goal of this patch is to make `-verify` easier to use when testing libc++. The `notes` attached to compile error diagnostics are numerous and relatively unstable when they reference libc++ header internals. This patch allows libc++ to write stable compilation failure tests by allowing unexpected diagnostic messages to be ignored where they are not relevant.

This patch adds a new CC1 flag called `-verify-ignore-unexpected`. `-verify-ignore-unexpected` tells `VerifyDiagnosticsConsumer` to ignore *all* unexpected diagnostic messages. `-verify-ignore-unexpected=<LevelList>` can be used to only ignore certain diagnostic levels. `<LevelList>` is a comma separated list of diagnostic levels to ignore. The supported levels are `note`, `remark`, `warning` and `error`.



Reviewers: bogner, grosser, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 239665
2015-06-13 07:11:40 +00:00
Benjamin Kramer f367dd90cc push_back() loop -> append() for random access iterators.
append will resize the vector to the optimal size. No functional change
intended.

llvm-svn: 239607
2015-06-12 15:31:50 +00:00
Sean Silva b5aee61c36 [cleanup] Remove some unused #ifdef's
This is all going through the VFS layer now, so there's nothing
platform-specific here.

llvm-svn: 239573
2015-06-11 23:34:13 +00:00
Alexei Starovoitov f657ca8d78 [bpf] add support for BPF backend
add support for bpfel/bpfeb targets

llvm-svn: 239496
2015-06-10 22:59:13 +00:00
David Majnemer 2617ea6756 [ItaniumMangle] Mangle long double as __float128 for some Power targets
GCC mangles long double like __float128 in order to support
compatibility with ABI variants which had a different interpretation of
long double.

This fixes PR23791.

llvm-svn: 239421
2015-06-09 18:05:33 +00:00
Aaron Ballman 825fb3c9d4 Removing spurious semi colons; NFC.
llvm-svn: 239400
2015-06-09 12:04:17 +00:00
Hubert Tong 6e04f98bc3 [Concepts] lex keywords: concept and requires
Summary:
This patch enables lexing of `concept` and `requires` as keywords.
Further changes which add messages for future keyword compat are to
follow.

Test Plan:
Testing of C++14 + Concepts TS mode is added to
`test/Lexer/keywords_test.cpp`, which expects that the new keywords are
enabled under said mode.

Reviewers: faisalv, fraggamuffin, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 239128
2015-06-05 01:10:24 +00:00
Artyom Skrobov 902ac2d837 Simplify ARMTargetParser::parseArch(ARMTargetParser::getCanonical()), following r239099
Reviewers: rengolin

Reviewed By: rengolin

Subscribers: cfe-commits

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

llvm-svn: 239101
2015-06-04 21:31:41 +00:00
James Y Knight 4b4d19ede2 [SPARC] Fix types of size_t, intptr_t, and ptrdiff_t on Linux.
They should be 'int' instead of 'long int' everywhere else except
NetBSD too, from what I gather in GCC's spec files. So, optimistically
changing it for everyone else, too.

llvm-svn: 239046
2015-06-04 15:36:29 +00:00
David Majnemer 5c2589a50b [Basic] Transition getEnvironmentVersion from getOSVersion for android
'android' occupies the environment component of the triple.  Let's use
getEnvironmentVersion to extract it instead of getOSVersion.

llvm-svn: 238797
2015-06-01 23:38:25 +00:00
Tim Northover a8c168db7f ARM: fix ACLE predefine for iOS's "-arch armv7s".
We were getting "#define __ARM_ARCH_7 -S__ 1" which is really not a good idea.

llvm-svn: 238614
2015-05-29 21:28:25 +00:00
Benjamin Kramer 3204b152b5 Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
If the type isn't trivially moveable emplace can skip a potentially
expensive move. It also saves a couple of characters.


Call sites were found with the ASTMatcher + some semi-automated cleanup.

memberCallExpr(
    argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
    on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
    hasArgument(0, bindTemporaryExpr(
                       hasType(recordDecl(hasNonTrivialDestructor())),
                       has(constructExpr()))),
    unless(isInTemplateInstantiation()))

No functional change intended.

llvm-svn: 238601
2015-05-29 19:42:19 +00:00
Renato Golin 391544c431 [ARMTargetParser] Removing string parsing from getCPUDefineSuffix. NFC.
Yet another FIXME from ARMTargetParser.

llvm-svn: 238416
2015-05-28 12:11:11 +00:00
David Majnemer ae1ed0edfe [Basic] Define __declspec for cygwin
Cygwin (and MinGW) targets define __declspec to __attribute__ unless
-fms-extensions is specified.  It turns out that cygwin headers rely on
the existence of this macro.

llvm-svn: 238394
2015-05-28 04:36:18 +00:00
Renato Golin f05bf0090b ARMTargetParser FIXME getCPUProfile A/R/M
This is the last of the easy ones.

llvm-svn: 238324
2015-05-27 14:15:12 +00:00
Renato Golin f5c4dec750 ARMTargetParser FIXME: ARMv8 detection for hdiv
Avoiding ugly combination of string parsing in the front-end. We still
need to move away from CPU parsing at all, but that's for a different
commit.

llvm-svn: 238318
2015-05-27 13:33:00 +00:00
Aaron Ballman 674cf26892 __declspec is not a core Clang language extension. Instead, require -fms-extensions or -fborland to enable the language extension.
Note: __declspec is also temporarily enabled when compiling for a CUDA target because there are implementation details relying on __declspec(property) support currently. When those details change, __declspec should be disabled for CUDA targets.
llvm-svn: 238238
2015-05-26 19:44:52 +00:00
Richard Smith 2b63d15f49 [modules] Retain the name as written for umbrella headers and directories, rather than converting to an absolute path. No observable change expected, but this allows us to correctly compute the module for an umbrella header, which later changes will require.
llvm-svn: 237508
2015-05-16 02:28:53 +00:00
Bill Schmidt 41e14c4dfa [PPC64] Add vector pack/unpack support from ISA 2.07
This patch adds support for the following new instructions in the
Power ISA 2.07:

  vpksdss
  vpksdus
  vpkudus
  vpkudum
  vupkhsw
  vupklsw

These instructions are available through the vec_packs, vec_packsu,
vec_unpackh, and vec_unpackl built-in interfaces.  These are
lane-sensitive instructions, so the built-ins have different
implementations for big- and little-endian, and the instructions must
be marked as killing the vector swap optimization for now.

The first three instructions perform saturating pack operations.  The
fourth performs a modulo pack operation, which means it can be
represented with a vector shuffle, and conversely the appropriate
vector shuffles may cause this instruction to be generated.  The other
instructions are only generated via built-in support for now.

I noticed during patch preparation that the macro __VSX__ was not
previously predefined when the power8-vector or direct-move features
are requested.  This is an error, and I've corrected that here as
well.

Appropriate tests have been added.

There is a companion patch to llvm for the rest of this support.

llvm-svn: 237500
2015-05-16 01:02:25 +00:00
Nemanja Ivanovic e97e111af4 Testing for the fix for bug 23429.
Follow-up to commit for revision 236848.
Just a test case for the macro definition under the right CPU/Arch.
One combination was actually missed in the initial fix:
  - powerpc64-unknown-unknown -mcpu=pwr8 (rather than -mcpu=power8).

llvm-svn: 237386
2015-05-14 20:02:24 +00:00
Vladimir Sukharev 85a19e92d7 [ARM] Fix of architecture naming typo
Inspired by James Greenhalgh's catch

Subscribers: cfe-commits

Relates to: http://reviews.llvm.org/rL237349

llvm-svn: 237370
2015-05-14 16:39:01 +00:00
Vladimir Sukharev c6dab75bd4 [ARM] Add v8.1a architecture
Add support for ARMv8.1a architecture. 

Briefly it is described on http://community.arm.com/groups/processors/blog/2014/12/02/the-armv8-a-architecture-and-its-ongoing-development

Reviewers: 	jmolloy, rengolin

Subscribers: cfe-commits

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

llvm-svn: 237349
2015-05-14 08:25:18 +00:00
Richard Smith 31d5184dc5 Generalize future keyword compat diagnostics.
This, in preparation for the introduction of more new keywords in the
implementation of the C++ language, generalizes the support for future keyword
compat diagnostics (e.g., diag::warn_cxx11_keyword) by extending the
applicability of the relevant property in IdentifierTable with appropriate
renaming.

Patch by Hubert Tong!

llvm-svn: 237332
2015-05-14 04:00:59 +00:00
Douglas Katzman 78d7c54f7c clang-format AllocateTarget. NFC
llvm-svn: 237183
2015-05-12 21:18:10 +00:00
Eric Christopher 9e172d20f0 Remove the code that pulled soft float attributes out of the feature
strings and remove the setting of TargetOptions::UseSoftFloat to
match the code change in llvm r237079.

llvm-svn: 237080
2015-05-12 01:26:21 +00:00
Eric Christopher 5eaf3815c0 Update initialization of a class variable and comment.
llvm-svn: 237071
2015-05-12 00:04:20 +00:00
Peter Collingbourne bf59c34bfd Move sanitizer parser and group expander from Driver to Basic.
No functional change.

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

llvm-svn: 237056
2015-05-11 21:39:20 +00:00
Peter Collingbourne 3eea677f3a Unify sanitizer kind representation between the driver and the rest of the compiler.
No functional change.

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

llvm-svn: 237055
2015-05-11 21:39:14 +00:00
Douglas Katzman f36dddf426 [Sparc] Add support for 'sparcel' to clang.
Differential Revision: http://reviews.llvm.org/D8784

llvm-svn: 237001
2015-05-11 15:21:44 +00:00
David Majnemer b710a938d6 Give isCompatibleWithMSVC a better interface
We now use an enum which maps the marketing name (almost always a year)
to the major version number.

llvm-svn: 236967
2015-05-11 03:57:49 +00:00
Nemanja Ivanovic 531a656cf0 Fix for bug 23429.
The macros for gcc atomic compare and swaps are defined for Power8 CPU's since
the functionality is provided in the back end.

llvm-svn: 236848
2015-05-08 13:07:48 +00:00
Reid Kleckner d167d42888 [AArch64] Advertise that the __sync_*_compare_and_swap_1/2/4/8 builtins work
Fixes PR23428, where std::thread in libstdc++ would go haywire without
these defines.

llvm-svn: 236605
2015-05-06 15:31:46 +00:00
Ulrich Weigand 66ff51b4ea [SystemZ] Add support for z13 and its vector facility
This patch adds support for the z13 architecture type.  For compatibility
with GCC, a pair of options -mvx / -mno-vx can be used to selectively
enable/disable use of the vector facility.

When the vector facility is present, we default to the new vector ABI.
This is characterized by two major differences:
- Vector types are passed/returned in vector registers
  (except for unnamed arguments of a variable-argument list function).
- Vector types are at most 8-byte aligned.

The reason for the choice of 8-byte vector alignment is that the hardware
is able to efficiently load vectors at 8-byte alignment, and the ABI only
guarantees 8-byte alignment of the stack pointer, so requiring any higher
alignment for vectors would require dynamic stack re-alignment code.

However, for compatibility with old code that may use vector types, when
*not* using the vector facility, the old alignment rules (vector types
are naturally aligned) remain in use.

These alignment rules are not only implemented at the C language level,
but also at the LLVM IR level.  This is done by selecting a different
DataLayout string depending on whether the vector ABI is in effect or not.

Based on a patch by Richard Sandiford.

llvm-svn: 236531
2015-05-05 19:35:52 +00:00
Jan Vesely eebeaea0ab R600: Add fma and ldexp asic specific feature macros
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 236453
2015-05-04 19:53:36 +00:00
Tim Northover f9b517c159 ARM: merge Cyclone into other ARMv8 CPUs and add tests for features.
Cyclone actually supports all the goodies you'd expect to come with an AArch64
CPU, so it doesn't need its own clause. Also we should probably be testing
these clauses.

llvm-svn: 236349
2015-05-01 21:17:25 +00:00
Jan Vesely a3abd6da8b R600: Report fp64 on all capable asics
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 236325
2015-05-01 17:38:13 +00:00
Richard Smith a7e2cc684f [modules] Start moving the module visibility information off the Module itself.
It has no place there; it's not a property of the Module, and it makes
restoring the visibility set when we leave a submodule more difficult.

llvm-svn: 236300
2015-05-01 01:53:09 +00:00
Reid Kleckner af67602e14 Use 4 byte preferred aggregate alignment in datalayout on x86 Win32
llvm-svn: 236271
2015-04-30 22:13:05 +00:00
Eric Christopher fb481a4054 Propagate a terrible hack to the sparc target feature handling code
by erasing the soft-float target feature if the rest of the front
end added it because of defaults or the soft float option.

Add some testing for some of the targets that implement this hack.

llvm-svn: 236179
2015-04-29 23:32:17 +00:00
Bradley Smith dfddebcfb9 Revert code changes made under r235976.
This issue was fixed elsewhere in r235396 in a more general way, hence these
changes no longer do anything. Keep the testcase however, to ensure that we
don't regress this for ARM.

llvm-svn: 236104
2015-04-29 14:32:06 +00:00
Bradley Smith ba945626b0 [ARM/AArch64] Enforce alignment for bitfielded structs
When creating a global variable with a type of a struct with bitfields, we must
forcibly set the alignment of the global from the RecordDecl. We must do this so
that the proper bitfield alignment makes its way down to LLVM, since clang will
mangle the bitfields into one large type.

llvm-svn: 235976
2015-04-28 11:24:54 +00:00
Ulrich Weigand ca3cb7f35c Implement target-specific __attribute__((aligned)) value
The GCC construct __attribute__((aligned)) is defined to set alignment
to "the default alignment for the target architecture" according to
the GCC documentation:

  The default alignment is sufficient for all scalar types, but may not be
  enough for all vector types on a target that supports vector operations.
  The default alignment is fixed for a particular target ABI.

clang currently hard-coded an alignment of 16 bytes for that construct,
which is correct on some platforms (including X86), but wrong on others
(including SystemZ).  Since this value is ABI-relevant, it is important
to get correct for compatibility purposes.

This patch adds a new TargetInfo member "DefaultAlignForAttributeAligned"
that targets can set to the appropriate default __attribute__((aligned))
value.

Note that I'm deliberately *not* using the existing "SuitableAlign"
value, which is used to set the pre-defined macro __BIGGEST_ALIGNMENT__,
since those two values may not be the same on all platforms.  In fact,
on X86, __attribute__((aligned)) always uses 16-byte alignment, while
__BIGGEST_ALIGNMENT__ may be larger if AVX-2 or AVX-512 are supported.
(This is actually not yet correctly implemented in clang either.)

The patch provides a value for DefaultAlignForAttributeAligned only for
SystemZ, and leaves the default for all other targets at 16, which means
no visible change in behavior on all other targets.  (The value is still
wrong for some other targets, but I'd prefer to leave it to the target
maintainers for those platforms to fix.)

llvm-svn: 235397
2015-04-21 17:29:35 +00:00
Alexey Bataev f56f98c925 [OPENMP] Codegen for 'copyin' clause in 'parallel' directive.
Emits the following code for the clause at the beginning of the outlined function for implicit threads:

if (<not a master thread>) {
  ...
  <thread local copy of var> = <master thread local copy of var>;
  ...
}
<sync point>;
Checking for a non-master thread is performed by comparing of the address of the thread local variable with the address of the master's variable. Master thread always uses original variables, so you always know the address of the variable in the master thread.
Differential Revision: http://reviews.llvm.org/D9026

llvm-svn: 235075
2015-04-16 05:39:01 +00:00
Tom Stellard 7b1059bb2d R600: Add GCC reg names
llvm-svn: 234892
2015-04-14 14:36:56 +00:00
Nemanja Ivanovic 35458c2fe9 Add Clang support for -mdirect-move on PPC
This patch corresponds to review:
http://reviews.llvm.org/D8930

This just adds a front end option to let the back end know the target has PPC
direct move instructions.

llvm-svn: 234683
2015-04-11 10:43:36 +00:00
Alexander Kornienko 34eb20725d Use 'override/final' instead of 'virtual' for overridden methods
Summary:
The patch is generated using clang-tidy misc-use-override check.

This command was used:

  tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \
    -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: klimek, cfe-commits

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

llvm-svn: 234678
2015-04-11 02:00:23 +00:00
Joerg Sonnenberger 740f3f4a95 Create the correct profiling symbol on NetBSD.
llvm-svn: 234636
2015-04-10 21:02:53 +00:00
Joerg Sonnenberger 22a2d99e25 Create correct platform-specific target for NetBSD PPC64LE.
llvm-svn: 234629
2015-04-10 20:53:48 +00:00
Nemanja Ivanovic 239eec732e Add Clang support for remaining integer divide and permute instructions from ISA 2.06
This patch corresponds to review:
http://reviews.llvm.org/D8398

It adds some builtin functions to access the extended divide and bit permute instructions.

llvm-svn: 234547
2015-04-09 23:58:16 +00:00
Javed Absar 879d18b843 [ARM] add support for Cortex-R4/R4F
Adds ARM Cortex-R4 and R4F support and tests in Clang. Though Cortex-R4
support was present, the support for hwdiv in thumb-mode was not defined
or tested properly. This has also been added.

llvm-svn: 234488
2015-04-09 14:12:10 +00:00
Benjamin Kramer c7dd599e9d Prefer uninitialized memory for scratch space.
No functional change intended.

llvm-svn: 234184
2015-04-06 17:45:11 +00:00
Eli Bendersky 1346717068 Set the type of ptrdiff_t to signed on NVPTX targets
It was unsigned before, which is unlike any other target and also doesn't make
much sense.

llvm-svn: 233836
2015-04-01 20:29:18 +00:00
Eli Bendersky 15f63420a7 Set NVPTX64 target's size_t to match other 64-bit targets
llvm-svn: 233830
2015-04-01 18:29:27 +00:00
Reid Kleckner 7510c09234 Fix data layout mismatch between LLVM and Clang for i686-pc-windows-msvc-elf
Do the same thing as win64. If we're not using COFF, use the ELF
manglings. Maybe if we are targetting *-windows-msvc-macho, we should
use darwin manglings, but I don't need to stir that pot today.

llvm-svn: 233819
2015-04-01 16:45:06 +00:00
Ulrich Weigand cc67344a86 [SystemZ] Add header files to Makefile / module.modulemap
This should fix build-bot failures after r233804.

The patch also adds a "systemz" feature, and renames the
"transactional-execution" feature to "htm", since it turns
out "-" is not a legal character in module feature names.

llvm-svn: 233807
2015-04-01 14:15:35 +00:00
Ulrich Weigand 3a610ebf1e [SystemZ] Support transactional execution on zEC12
The zEC12 provides the transactional-execution facility.  This is exposed
to users via a set of builtin routines on other compilers.  This patch
adds clang support to enable those builtins.  In partciular, the patch:

- enables the transactional-execution feature by default on zEC12
- allows to override presence of that feature via the -mhtm/-mno-htm options
- adds a predefined macro __HTM__ if the feature is enabled
- adds support for the transactional-execution GCC builtins
- adds Sema checking to verify the __builtin_tabort abort code
- adds the s390intrin.h header file (for GCC compatibility)
- adds s390 sections to the htmintrin.h and htmxlintrin.h header files

Since this is first use of target-specific intrinsics on the platform,
the patch creates the include/clang/Basic/BuiltinsSystemZ.def file and
hooks it up in TargetBuiltins.h and lib/Basic/Targets.cpp.

An associated LLVM patch adds the required LLVM IR intrinsics.

For reference, the transactional-execution instructions are documented
in the z/Architecture Principles of Operation for the zEC12:
http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/download/DZ9ZR009.pdf
The associated builtins are documented in the GCC manual:
http://gcc.gnu.org/onlinedocs/gcc/S_002f390-System-z-Built-in-Functions.html
The htmxlintrin.h intrinsics provided for compatibility with the IBM XL
compiler are documented in the "z/OS XL C/C++ Programming Guide".

llvm-svn: 233804
2015-04-01 12:54:25 +00:00
Eli Bendersky 7a0d89153f Add sm_37 target to Clang for NVPTX
Support for this target was added in LLVM r233575 and r233583

llvm-svn: 233715
2015-03-31 17:03:16 +00:00
Derek Schuff 6ab52fabcf Add driver support for Native Client SDK
Add Tool and ToolChain support for clang to target the NaCl OS using the NaCl
SDK for x86-32, x86-64 and ARM.

Includes nacltools::Assemble and Link which are derived from gnutools. They
are similar to Linux but different enought that they warrant their own class.
Also includes a NaCl_TC in ToolChains derived from Generic_ELF with library
and include paths suitable for an SDK and independent of the system tools.

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

llvm-svn: 233594
2015-03-30 20:31:33 +00:00
Ulrich Weigand 881497ac29 [SystemZ] Fix definition of IntMaxType / Int64Type
Like on other 64-bit platforms, Int64Type should be SignedLong
on SystemZ, not SignedLongLong as per default.  This could cause
ABI incompatibilities in certain cases (e.g. name mangling).

llvm-svn: 233544
2015-03-30 13:50:21 +00:00
Daniel Sanders 48fa39e4a1 [mips] Add support for 'ZC' inline assembly memory constraint.
Summary: Also add tests for 'R' and 'm'.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits

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

llvm-svn: 233542
2015-03-30 13:47:23 +00:00
Richard Smith 8f4d3ff146 [modules] Restrict the module use-declaration to only appear in top-level
modules, and allow sub-modules of a module with a use-declaration to make use
of the nominated modules.

llvm-svn: 233323
2015-03-26 22:10:01 +00:00
Eric Christopher f43966f38d Make the msse4/mno-sse4 flags aliases of the maximum sse values
they enable/disable.

This fixes two things:

a) sse4 isn't actually a target feature, don't treat it as one.
b) we weren't correctly disabling sse4.1 when we'd pass -mno-sse4
   after enabling it, thus passing preprocessor directives and
   (soon) passing the function attribute as well when we shouldn't.

llvm-svn: 233223
2015-03-25 22:09:26 +00:00
Kit Barton 8246f28237 Add Hardware Transactional Memory (HTM) Support
This patch adds Hardware Transaction Memory (HTM) support supported by ISA 2.07
(POWER8). The intrinsic support is based on GCC one [1], with both 'PowerPC HTM
Low Level Built-in Functions' and 'PowerPC HTM High Level Inline Functions'
implemented.

Along with builtins a new driver switch is added to enable/disable HTM
instruction support (-mhtm) and a header with common definitions (mostly to
parse the TFHAR register value). The HTM switch also sets a preprocessor builtin
HTM.

The HTM usage requires a recently newer kernel with PPC HTM enabled. Tested on
powerpc64 and powerpc64le.

This is send along a llvm patch to enabled the builtins and option switch.

[1]
https://gcc.gnu.org/onlinedocs/gcc/PowerPC-Hardware-Transactional-Memory-Built-in-Functions.html

Phabricator Review: http://reviews.llvm.org/D8248

llvm-svn: 233205
2015-03-25 19:41:41 +00:00