]> granicus.if.org Git - clang/log
clang
10 years agoDriver: Skip the -ivfsoverlay argument in driver crash diags
Justin Bogner [Sun, 22 Jun 2014 20:35:10 +0000 (20:35 +0000)]
Driver: Skip the -ivfsoverlay argument in driver crash diags

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211474 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRevert "Revert r211402 (and r211408,r211410), "CodeGen: Refactor dynamic_cast and...
David Majnemer [Sun, 22 Jun 2014 19:05:33 +0000 (19:05 +0000)]
Revert "Revert r211402 (and r211408,r211410), "CodeGen: Refactor dynamic_cast and typeid" It crashes msvc codegen in clang/test/SemaCXX/undefined-internal.cpp."

This reverts commit r211467 which reverted r211408,r211410, it caused
crashes in test/SemaCXX/undefined-internal.cpp for i686-win32 targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211473 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[cxx_status] Minor wording tweaks.
Richard Smith [Sun, 22 Jun 2014 16:00:05 +0000 (16:00 +0000)]
[cxx_status] Minor wording tweaks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211471 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[cxx_status] Be a bit more precise.
Richard Smith [Sun, 22 Jun 2014 15:56:23 +0000 (15:56 +0000)]
[cxx_status] Be a bit more precise.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211470 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix dead link.
Richard Smith [Sun, 22 Jun 2014 15:54:54 +0000 (15:54 +0000)]
Fix dead link.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211469 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRevert r211402 (and r211408,r211410), "CodeGen: Refactor dynamic_cast and typeid...
NAKAMURA Takumi [Sun, 22 Jun 2014 12:42:29 +0000 (12:42 +0000)]
Revert r211402 (and r211408,r211410), "CodeGen: Refactor dynamic_cast and typeid" It crashes msvc codegen in clang/test/SemaCXX/undefined-internal.cpp.

It is reproducible with:

  $ clang -cc1 -triple i686-win32 -emit-llvm-only clang/test/SemaCXX/undefined-internal.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211467 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRemove unused diagnostic and diagnostic group.
Benjamin Kramer [Sun, 22 Jun 2014 12:16:35 +0000 (12:16 +0000)]
Remove unused diagnostic and diagnostic group.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211464 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoTextDiagnosticPrinter: use the mapped level for remark flag computation
Alp Toker [Sun, 22 Jun 2014 10:08:06 +0000 (10:08 +0000)]
TextDiagnosticPrinter: use the mapped level for remark flag computation

Custom diagnostics don't have a builtin class so this wouldn't have worked.
Reduces surface area of remark-related changes.

No test coverage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211462 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoEnable WindowsToolChain on all native Windows builds
Alp Toker [Sun, 22 Jun 2014 04:31:15 +0000 (04:31 +0000)]
Enable WindowsToolChain on all native Windows builds

Make binaries built by MSVC, mingw and clang functionally equivalent. The
checks are trivially performed at runtime to eliminate functional differences
between supported configurations that used to be hard-coded.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211461 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoWindowsToolChain: decouple build environment from the toolchain
Alp Toker [Sun, 22 Jun 2014 03:27:52 +0000 (03:27 +0000)]
WindowsToolChain: decouple build environment from the toolchain

Don't try to find the MSVC version that the binaries were built with. Doing so
defeats testing by causing invalid test passes on the build servers.

Whichever Visual Studio (or clang-cl.exe) edition was used to build the clang
package, it's strictly orthogonal and has no relation to software versions
available on the user's PC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211459 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMake WindowsToolChain portable
Alp Toker [Sun, 22 Jun 2014 03:27:45 +0000 (03:27 +0000)]
Make WindowsToolChain portable

De-conditionalize as much as possible so we can start to fix this code.

No change in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211458 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[analyzer] Check for NULL passed to CFAutorelease.
Jordan Rose [Sat, 21 Jun 2014 23:50:40 +0000 (23:50 +0000)]
[analyzer] Check for NULL passed to CFAutorelease.

Patch by Sean McBride, tests adjusted by me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211453 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMake MS i128 suffix test from r211446 more robust
Alp Toker [Sat, 21 Jun 2014 23:32:05 +0000 (23:32 +0000)]
Make MS i128 suffix test from r211446 more robust

We want to catch both negative and positive failure conditions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211449 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDiagnosticRenderer: emit basic notes as real diagnostics
Alp Toker [Sat, 21 Jun 2014 23:31:59 +0000 (23:31 +0000)]
DiagnosticRenderer: emit basic notes as real diagnostics

Fixes terminal column wrapping and vestigial 'note:' prefixes that would appear
when using emitBasicNote().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211448 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoTextDiagnostic: print remark level diagnostics in bold too
Alp Toker [Sat, 21 Jun 2014 23:31:52 +0000 (23:31 +0000)]
TextDiagnostic: print remark level diagnostics in bold too

The purpose of bolding these is to make them visually distinct from
continuations (supplemental note diagnostics). Therefore, the bolding applies
to all severities _including_ remarks -- it's not in any way an indicator of
priority. Also simplify and comment.

No tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211447 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoThe i128 suffix isn't always available.
David Majnemer [Sat, 21 Jun 2014 22:49:50 +0000 (22:49 +0000)]
The i128 suffix isn't always available.

This Lexer test unconditionally used the i128 integer literal suffix.
This suffix is only available to targets that have 128-bit arithmetic
support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211446 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoLex: Use the correct types for MS integer suffixes
David Majnemer [Sat, 21 Jun 2014 18:46:07 +0000 (18:46 +0000)]
Lex: Use the correct types for MS integer suffixes

Something went wrong with r211426, it is an older version of this code
and should not have been committed.  It was reverted with r211434.

Original commit message:
We didn't properly implement support for the sized integer suffixes.
Suffixes like i16 were essentially ignored instead of mapping them to
the appropriately sized integer type.

This fixes PR20008.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211441 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[test] Add '-target' option to fix bot failure.
Argyrios Kyrtzidis [Sat, 21 Jun 2014 18:28:44 +0000 (18:28 +0000)]
[test] Add '-target' option to fix bot failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211439 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[PCH] Remove the BackingIvarReferencedInAccessor field from DECL_OBJC_IVAR abbreviati...
Argyrios Kyrtzidis [Sat, 21 Jun 2014 18:16:40 +0000 (18:16 +0000)]
[PCH] Remove the BackingIvarReferencedInAccessor field from DECL_OBJC_IVAR abbreviation record.

Patch by Yiding Jia!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211438 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRevert "Lex: Use the correct types for MS integer suffixes"
Rafael Espindola [Sat, 21 Jun 2014 12:39:25 +0000 (12:39 +0000)]
Revert "Lex: Use the correct types for MS integer suffixes"

This reverts commit r211426.

This broke the arm bots. The crash can be reproduced on X86 by running.
./bin/clang -cc1  -fsyntax-only -verify -fms-extensions ~/llvm/clang/test/Lexer/ms-extensions.c -triple arm-linux

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211434 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoLex: Use the correct types for MS integer suffixes
David Majnemer [Sat, 21 Jun 2014 00:51:59 +0000 (00:51 +0000)]
Lex: Use the correct types for MS integer suffixes

We didn't properly implement support for the sized integer suffixes.
Suffixes like i16 were essentially ignored instead of mapping them to
the appropriately sized integer type.

This fixes PR20008.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211426 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDriver: In crashdumps with -fmodule, dump the module dependencies
Justin Bogner [Fri, 20 Jun 2014 22:59:50 +0000 (22:59 +0000)]
Driver: In crashdumps with -fmodule, dump the module dependencies

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211421 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDriver: enhance MSC version compatibility
Saleem Abdulrasool [Fri, 20 Jun 2014 22:58:35 +0000 (22:58 +0000)]
Driver: enhance MSC version compatibility

The version information for Visual Studio is spread over multiple variables.
The newer Windows SDK has started making use of some of the extended versioning
variables that were previously undefined.  Enhance our compatibility definitions
for these cases.

_MSC_VER is defined to be the Major * 100 + Minor.  _MSC_FULL_VER is defined to
be Major * 10000000 + Minor * 100000 + Build.  And _MSC_BUILD is the build
revision of the compiler.

Extend the -fmsc-version option in a compatible manner.  If the value is the
previous form of MMmm, then we assume that the build number is 0.  Otherwise, a
specific build number may be passed by using the form MMmmbbbbb.  Due to
bitwidth limitations of the option, it is currently not possible to define a
revision value.

The version information can be passed as either the decimal encoded value
(_MSC_FULL_VER or _MSC_VER) or as a dot-delimited value.

The change to the TextDiagnostic is to deal with the updated encoding of the
version information.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211420 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDriver: Record that we're in crashdump and push flags to ConstructJob
Justin Bogner [Fri, 20 Jun 2014 22:16:00 +0000 (22:16 +0000)]
Driver: Record that we're in crashdump and push flags to ConstructJob

It's more flexible and arguably better layering to set flags to modify
compiling for diagnostics in the CC1 job themselves, rather than
tweaking the driver flags and letting them propagate.

There is one visible change this causes: crash report files will now
get preprocessed names (.i and friends).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211411 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoCodeGen: Fix test to work with assertions as well
David Majnemer [Fri, 20 Jun 2014 22:08:59 +0000 (22:08 +0000)]
CodeGen: Fix test to work with assertions as well

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211410 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoCodeGen: typeid/dynamic_cast tests don't need asserts
David Majnemer [Fri, 20 Jun 2014 21:44:39 +0000 (21:44 +0000)]
CodeGen: typeid/dynamic_cast tests don't need asserts

These tests relied on information that was only available for clang
builds that included asserts.  Fix these tests to lift that restriction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211408 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDriver: Remove some superfluous calls to Arg->claim()
Justin Bogner [Fri, 20 Jun 2014 21:12:53 +0000 (21:12 +0000)]
Driver: Remove some superfluous calls to Arg->claim()

Args.getLastArg() claims the Arg it returns, so calling claim on these
results is unnecessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211403 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoCodeGen: Refactor dynamic_cast and typeid
David Majnemer [Fri, 20 Jun 2014 21:11:00 +0000 (21:11 +0000)]
CodeGen: Refactor dynamic_cast and typeid

This refactors the emission of dynamic_cast and typeid expressions so
that ABI specific knowledge lives in appropriate places.  There are
quite a few benefits for having the two implementations share a common
core like sharing logic for optimization opportunities.

While we are at it, clean up the tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211402 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoC++ status page: restore the convention of saying "SVN" until we reach a release.
Richard Smith [Fri, 20 Jun 2014 20:35:42 +0000 (20:35 +0000)]
C++ status page: restore the convention of saying "SVN" until we reach a release.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211398 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoBe less bold.
Richard Smith [Fri, 20 Jun 2014 20:34:03 +0000 (20:34 +0000)]
Be less bold.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211397 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[C++1z] Add C++1z to the C++ status page.
Richard Smith [Fri, 20 Jun 2014 20:33:10 +0000 (20:33 +0000)]
[C++1z] Add C++1z to the C++ status page.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211396 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix typo in r211394.
Richard Smith [Fri, 20 Jun 2014 19:58:05 +0000 (19:58 +0000)]
Fix typo in r211394.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211395 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[C++1z] Implement N3928: message in static_assert is optional.
Richard Smith [Fri, 20 Jun 2014 19:57:12 +0000 (19:57 +0000)]
[C++1z] Implement N3928: message in static_assert is optional.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211394 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[C++1z] Implement N3981: Disable trigraphs by default in C++1z mode.
Richard Smith [Fri, 20 Jun 2014 19:23:57 +0000 (19:23 +0000)]
[C++1z] Implement N3981: Disable trigraphs by default in C++1z mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211392 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDon't crash when emitting a glvalue conditional where one arm is a
Richard Smith [Fri, 20 Jun 2014 18:43:47 +0000 (18:43 +0000)]
Don't crash when emitting a glvalue conditional where one arm is a
throw-expression. Based on a patch by Marius Wachtler!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211388 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix crash caused by unnamed union or struct when doing ast-print
Serge Pavlov [Fri, 20 Jun 2014 17:08:28 +0000 (17:08 +0000)]
Fix crash caused by unnamed union or struct when doing ast-print

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211380 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[PowerPC] Fix small argument stack slot offset for LE
Ulrich Weigand [Fri, 20 Jun 2014 16:37:40 +0000 (16:37 +0000)]
[PowerPC] Fix small argument stack slot offset for LE

When small arguments (structures < 8 bytes or "float") are passed in a
stack slot in the ppc64 SVR4 ABI, they must reside in the least
significant part of that slot.  On BE, this means that an offset needs
to be added to the stack address of the parameter, but on LE, the least
significant part of the slot has the same address as the slot itself.

For the most part, this is handled in the LLVM back-end, where I just
fixed the LE case in commit r211368.

However, there is one piece of the clang front-end that is also aware of
these stack-slot offsets: PPC64_SVR4_ABIInfo::EmitVAArg.  This patch
updates that routine to take endianness into account.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211370 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDisable Modules/dependency-dump-dependent-module.m on win32 for now.
NAKAMURA Takumi [Fri, 20 Jun 2014 15:04:25 +0000 (15:04 +0000)]
Disable Modules/dependency-dump-dependent-module.m on win32 for now.

FIXME: This fails on win32 due to ERROR_FILENAME_EXCED_RANGE if the working directory is too deep.

We should make Win32/Path.inc capable of long pathnames with '\\?\'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211363 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoThe ability to use vector initializer lists is a GNU vector extension
James Molloy [Fri, 20 Jun 2014 14:35:13 +0000 (14:35 +0000)]
The ability to use vector initializer lists is a GNU vector extension
and is unrelated to the NEON intrinsics in arm_neon.h. On little
endian machines it works fine, however on big endian machines it
exhibits surprising behaviour:

    uint32x2_t x = {42, 64};
    return vget_lane_u32(x, 0); // Will return 64.

Because of this, explicitly call out that it is unsupported on big
endian machines.

This patch will emit the following warning in big-endian mode:

    test.c:3:15: warning: vector initializers are a GNU extension and are not compatible with NEON intrinsics [-Wgnu]
    int32x4_t x = {0, 1, 2, 3};
                  ^
    test.c:3:15: note: consider using vld1q_s32() to initialize a vector from memory, or vcombine_s32(vcreate_s32(), vcreate_s32()) to initialize from integer constants
    1 warning generated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211362 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd file missed in r211360 commit
Ulrich Weigand [Fri, 20 Jun 2014 14:32:39 +0000 (14:32 +0000)]
Add file missed in r211360 commit

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211361 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[PowerPC] Fix ELF interpreter name for powerpc64le-linux
Ulrich Weigand [Fri, 20 Jun 2014 14:19:02 +0000 (14:19 +0000)]
[PowerPC] Fix ELF interpreter name for powerpc64le-linux

On PowerPC LE the system uses the /lib64/ld64.so.2 dynamic linker name
instead of /lib64/ld64.so.1 (to indicate the ELFv2 ABI version).

This fixes the clang driver to pass the appropriate -dynamic-linker
setting, and adds some more tests to linux-ld.c.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211360 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[PowerPC] Add MultiarchIncludeDirs for powerpc64le
Ulrich Weigand [Fri, 20 Jun 2014 13:41:24 +0000 (13:41 +0000)]
[PowerPC] Add MultiarchIncludeDirs for powerpc64le

There was already partial support for multi-arch on powerpc64le,
but the MultiarchIncludeDirs setting was missing.  This patch
adds the appropriate definition, and also extends the
linux-header-search.cpp test case to verify an Ubuntu 14.04
powerpc64le tree.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211359 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix PR20081: Parsing templates in the presence of -x cuda -std=c++11
Eli Bendersky [Fri, 20 Jun 2014 13:09:59 +0000 (13:09 +0000)]
Fix PR20081: Parsing templates in the presence of -x cuda -std=c++11

http://reviews.llvm.org/D4222

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211357 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd module flags metadata to record the settings for enum and wchar width
Oliver Stannard [Fri, 20 Jun 2014 12:43:07 +0000 (12:43 +0000)]
Add module flags metadata to record the settings for enum and wchar width

Add module flags metadata to record the settings for enum and wchar width,
to allow correct ARM build attribute generation

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211354 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[OPENMP] Initial support for 'nowait' clause.
Alexey Bataev [Fri, 20 Jun 2014 11:19:47 +0000 (11:19 +0000)]
[OPENMP] Initial support for 'nowait' clause.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211352 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoOMPScheduleClause::OMPScheduleClause(): Fix possible typos, s/\brief/\param/g. [...
NAKAMURA Takumi [Fri, 20 Jun 2014 09:52:04 +0000 (09:52 +0000)]
OMPScheduleClause::OMPScheduleClause(): Fix possible typos, s/\brief/\param/g. [-Wdocumentation]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211348 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[OPENMP] Initial support for 'ordered' clause.
Alexey Bataev [Fri, 20 Jun 2014 09:44:06 +0000 (09:44 +0000)]
[OPENMP] Initial support for 'ordered' clause.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211347 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix/Improve SourceRange of explicitly defaulted members
Daniel Jasper [Fri, 20 Jun 2014 08:44:22 +0000 (08:44 +0000)]
Fix/Improve SourceRange of explicitly defaulted members

When adding the implicit compound statement (required for Codegen?), the
end location was previously overridden by the start location, probably
based on the assumptions:

* The location of the compound statement should be the member's location
* The compound statement if present is the last element of a FunctionDecl

This patch changes the location of the compound statement to the
member's end location.

Code review: http://reviews.llvm.org/D4175

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211344 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[OPENMP] Initial support for 'schedule' clause.
Alexey Bataev [Fri, 20 Jun 2014 07:16:17 +0000 (07:16 +0000)]
[OPENMP] Initial support for 'schedule' clause.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211342 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFrontend: Disentangle removePathTraversal from concatenating paths
Justin Bogner [Fri, 20 Jun 2014 03:28:46 +0000 (03:28 +0000)]
Frontend: Disentangle removePathTraversal from concatenating paths

This reimplements part of r211303 in a bit of a cleaner way. Doing so
allows us to use a proper absolute path when calling addFileMapping
rather than relying on a substring being one, which should fix the
tests on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211338 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAvoid invalidating successfully loaded module files
Ben Langmuir [Fri, 20 Jun 2014 00:24:56 +0000 (00:24 +0000)]
Avoid invalidating successfully loaded module files

Successfully loaded module files may be referenced in other
ModuleManagers, so don't invalidate them. Two related things are fixed:

1) I thought the last module in the manager was always the one that
failed, but it isn't.  So check explicitly against the list of
vetted modules from ReadASTCore.

2) We now keep the file descriptor of pcm file open, which avoids the
possibility of having two different pcms for the same module loaded when
building in parallel with headers being modified during a build.

<rdar://problem/16835846>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211330 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agodiagtool: refactor TreeView to resemble C++
Alp Toker [Fri, 20 Jun 2014 00:06:42 +0000 (00:06 +0000)]
diagtool: refactor TreeView to resemble C++

Replace lots of old-school parameter passing with neat class members.
No attempt made yet to modernize loops, but it's a start.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211327 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoObjective-C qoi. When Objective-C pointer mismatches with
Fariborz Jahanian [Thu, 19 Jun 2014 23:05:46 +0000 (23:05 +0000)]
Objective-C qoi. When Objective-C pointer mismatches with
a qualified-id type because pointer is object of a forward
class declaration, include this info in a diagnostic note.
// rdar://10751015

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211324 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agodiagtool: simplify TreeView diagnostic classification
Alp Toker [Thu, 19 Jun 2014 23:00:52 +0000 (23:00 +0000)]
diagtool: simplify TreeView diagnostic classification

This utility doesn't need to know about the specifics of diagnostic levels.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211323 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agotest: Just check the VFS when testing module-dependency-dump
Justin Bogner [Thu, 19 Jun 2014 20:18:00 +0000 (20:18 +0000)]
test: Just check the VFS when testing module-dependency-dump

Checking the filesystem seems to be a bit unreliable. Limit the tests
to the VFS map for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211310 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFrontend: Fix a typo
Justin Bogner [Thu, 19 Jun 2014 19:49:28 +0000 (19:49 +0000)]
Frontend: Fix a typo

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211306 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFrontend: Add a CC1 flag to dump module dependencies to a directory
Justin Bogner [Thu, 19 Jun 2014 19:36:03 +0000 (19:36 +0000)]
Frontend: Add a CC1 flag to dump module dependencies to a directory

This adds the -module-dependency-dir to clang -cc1, which specifies a
directory to copy all of a module's dependencies into in a form
suitable to be used as a VFS using -ivfsoverlay with the generated
vfs.yaml.

This is useful for crashdumps that involve modules, so that the module
dependencies will be intact when a crash report script is used to
reproduce a problem on another machine.

We currently encode the absolute path to the dump directory, due to
limitations in the VFS system. Until we can handle relative paths in
the VFS, users of the VFS map may need to run a simple search and
replace in the file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211303 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFixed formatting.
Yaron Keren [Thu, 19 Jun 2014 19:12:02 +0000 (19:12 +0000)]
Fixed formatting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211295 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix PR20069: bad loop pragma arguments crash FE
Eli Bendersky [Thu, 19 Jun 2014 18:30:15 +0000 (18:30 +0000)]
Fix PR20069: bad loop pragma arguments crash FE

This patch fixes a crash when handling malformed arguments to loop pragmas such
as: "#pragma clang loop vectorize(()".  Essentially any argument which is not an
identifier or constant resulted in a crash.  This patch also changes a couple of
the error messages which weren't quite correct.  New behavior with this patch vs
old behavior:

#pragma clang loop vectorize(1)
OLD: error: missing keyword; expected 'enable' or 'disable'
NEW: error: invalid argument; expected 'enable' or 'disable'

#pragma clang loop vectorize()
OLD: error: expected ')'
NEW: error: missing argument to loop pragma 'vectorize'

#pragma clang loop vectorize_width(bad)
OLD: error: missing value; expected a positive integer value
NEW: error: invalid argument; expected a positive integer value

#pragma clang loop vectorize(bad)
OLD: invalid keyword 'bad'; expected 'enable' or 'disable'
NEW: error: invalid argument; expected 'enable' or 'disable'

http://reviews.llvm.org/D4197

Patch by Mark Heffernan

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211292 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDocument unroll and unroll_count directives.
Eli Bendersky [Thu, 19 Jun 2014 18:12:44 +0000 (18:12 +0000)]
Document unroll and unroll_count directives.

Extend the documentation for "#pragma clang loop" hints to include the unroll
and unroll_count directives.

Patch by Mark Heffernan [http://reviews.llvm.org/D4198]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211286 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDon't call llvm_start_multithreaded() during init. As of LLVM
Zachary Turner [Thu, 19 Jun 2014 18:03:56 +0000 (18:03 +0000)]
Don't call llvm_start_multithreaded() during init.  As of LLVM
revision r211277, this function is essentially a no-op.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211285 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoImprove robustness of tests for module flags metadata
Oliver Stannard [Thu, 19 Jun 2014 16:10:21 +0000 (16:10 +0000)]
Improve robustness of tests for module flags metadata

Fix clang tests to not break if the ID numbers of module flags metadata
nodes change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211276 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix assertion hit or bogus compiler error in cases when instantiating ObjC property...
Argyrios Kyrtzidis [Thu, 19 Jun 2014 14:45:16 +0000 (14:45 +0000)]
Fix assertion hit or bogus compiler error in cases when instantiating ObjC property accesses used with overloaded binary operators.

rdar://17153478

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211270 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[c++1z] Implement N3994: a range-based for loop can declare a variable with super...
Richard Smith [Thu, 19 Jun 2014 11:42:00 +0000 (11:42 +0000)]
[c++1z] Implement N3994: a range-based for loop can declare a variable with super-terse notation

  for (x : range) { ... }

which is equivalent to

  for (auto &&x : range) { ... }

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211267 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[OPENMP] Improved diagnostic messages for vars with the predetermined data sharing...
Alexey Bataev [Thu, 19 Jun 2014 09:13:45 +0000 (09:13 +0000)]
[OPENMP] Improved diagnostic messages for vars with the predetermined data sharing attributes and reformatting

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211262 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDiagnoseUnknownTypename always emits a diagnostic and returns true
Reid Kleckner [Thu, 19 Jun 2014 01:23:22 +0000 (01:23 +0000)]
DiagnoseUnknownTypename always emits a diagnostic and returns true

Make it return void and delete the dead code in the parser that handled
the case where it might return false.  This has been dead since 2010
when John deleted Action.h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211248 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoObjective-C ARC. Allow conversion of (void*) pointers to
Fariborz Jahanian [Wed, 18 Jun 2014 23:52:49 +0000 (23:52 +0000)]
Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
in the context of pointer comparison as this is in effect
a +0 context. // rdar://16627903

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211243 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoSema: Static redeclaration after extern declarations is a Microsoft Extension
David Majnemer [Wed, 18 Jun 2014 23:26:25 +0000 (23:26 +0000)]
Sema: Static redeclaration after extern declarations is a Microsoft Extension

CL permits static redeclarations to follow extern declarations.  The
storage specifier on the latter declaration has no effect.

This fixes PR20034.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211238 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoObjective-C. Revert my patch in r211234.
Fariborz Jahanian [Wed, 18 Jun 2014 23:22:38 +0000 (23:22 +0000)]
Objective-C. Revert my patch in r211234.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211237 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoObjective-C ARC. Allow conversion of (void*) pointers to
Fariborz Jahanian [Wed, 18 Jun 2014 22:50:40 +0000 (22:50 +0000)]
Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
by recognizing this as a +0 context. // rdar://16627903

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211234 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agotests: relax ms-intrinsics test
Saleem Abdulrasool [Wed, 18 Jun 2014 21:48:44 +0000 (21:48 +0000)]
tests: relax ms-intrinsics test

Relax the tests to allow for differences between release and debug builds.  This
should fix the buildbots.

Thanks to Benjamin Kramer and Eric Christo for their invaluable tip that this
was release build specific issue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211227 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRelax the cl-inputs.c test a little bit in case link.exe is on PATH
Reid Kleckner [Wed, 18 Jun 2014 21:34:36 +0000 (21:34 +0000)]
Relax the cl-inputs.c test a little bit in case link.exe is on PATH

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211224 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[MS-ABI] Implement typeid
Warren Hunt [Wed, 18 Jun 2014 21:15:55 +0000 (21:15 +0000)]
[MS-ABI] Implement typeid
This patch enables clang to generate calls to __RTtypeid when lowering
typeid on win32 targets.  Test cases are included.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211223 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoCodeGen: improve ms instrincics support
Saleem Abdulrasool [Wed, 18 Jun 2014 20:51:10 +0000 (20:51 +0000)]
CodeGen: improve ms instrincics support

Add support for _InterlockedCompareExchangePointer, _InterlockExchangePointer,
_InterlockExchange.  These are available as a compiler intrinsic on ARM and x86.
These are used directly by the Windows SDK headers without use of the intrin
header.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211216 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoObjective-C. Check for integer overflow in Objective-C's
Fariborz Jahanian [Wed, 18 Jun 2014 20:49:02 +0000 (20:49 +0000)]
Objective-C. Check for integer overflow in Objective-C's
boxed expression. // rdar://16417427

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211215 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[analyzer] Don't create new PostStmt nodes if we don't have to.
Jordan Rose [Wed, 18 Jun 2014 19:23:30 +0000 (19:23 +0000)]
[analyzer] Don't create new PostStmt nodes if we don't have to.

Doing this caused us to mistakenly think we'd seen a particular state before
when we actually hadn't, which resulted in false negatives. Credit to
Rafael Auler for discovering this issue!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211209 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoObjective-C. Try to fix the test in buildbot in my last patch.
Fariborz Jahanian [Wed, 18 Jun 2014 18:16:37 +0000 (18:16 +0000)]
Objective-C. Try to fix the test in buildbot in my last patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211197 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoObjective-C. Attributes on class declarations carry over
Fariborz Jahanian [Wed, 18 Jun 2014 17:58:27 +0000 (17:58 +0000)]
Objective-C. Attributes on class declarations carry over
to forward class declarations for diagnosis.
// rdar://16681279

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211195 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMake clang-cl accept .lib inputs (PR20065)
Hans Wennborg [Wed, 18 Jun 2014 17:21:50 +0000 (17:21 +0000)]
Make clang-cl accept .lib inputs (PR20065)

Patch by Ehsan Akhgari!

(Tiny tweak by me: renamed PathSegment to LibDir.)

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211189 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDriver: correct the backend option spelling
Saleem Abdulrasool [Wed, 18 Jun 2014 16:52:24 +0000 (16:52 +0000)]
Driver: correct the backend option spelling

The backend option does not have an '-enable' prefix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211177 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoInherit dll attributes to static locals
Hans Wennborg [Wed, 18 Jun 2014 15:55:13 +0000 (15:55 +0000)]
Inherit dll attributes to static locals

This makes us handle static locals in exported/imported functions correctly.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211173 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAArch64: re-enable tests that were looking for a non-existent backend.
Tim Northover [Wed, 18 Jun 2014 08:37:28 +0000 (08:37 +0000)]
AArch64: re-enable tests that were looking for a non-existent backend.

In the final phase of the merge, I managed to disable a bunch of Clang
tests accidentally. Fortunately none of them seem to have broken in
the interim.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211149 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[OPENMP] Reformatting and code improvement.
Alexey Bataev [Wed, 18 Jun 2014 07:08:49 +0000 (07:08 +0000)]
[OPENMP] Reformatting and code improvement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211147 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoReplace some assert(0)'s with llvm_unreachable.
Craig Topper [Wed, 18 Jun 2014 05:13:13 +0000 (05:13 +0000)]
Replace some assert(0)'s with llvm_unreachable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211143 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoConvert an llvm_unreachable in an 'else' block to a removal of the 'if' and an assert...
Craig Topper [Wed, 18 Jun 2014 05:13:11 +0000 (05:13 +0000)]
Convert an llvm_unreachable in an 'else' block to a removal of the 'if' and an assertion of its condition. Suggestion from David Blaikie.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211142 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[OPENMP] Initial support for '#pragma omp for' (fixed incompatibility with MSVC).
Alexey Bataev [Wed, 18 Jun 2014 04:14:57 +0000 (04:14 +0000)]
[OPENMP] Initial support for '#pragma omp for' (fixed incompatibility with MSVC).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211140 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoReplace some assert(0)'s with llvm_unreachable.
Craig Topper [Wed, 18 Jun 2014 03:57:25 +0000 (03:57 +0000)]
Replace some assert(0)'s with llvm_unreachable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211139 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoConvert assert(0) to llvm_unreachable to silence a warning about Addend being uniniti...
Craig Topper [Wed, 18 Jun 2014 03:13:41 +0000 (03:13 +0000)]
Convert assert(0) to llvm_unreachable to silence a warning about Addend being uninitialized in default case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211138 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix bug in code for avoiding dynamic initialization of dllimport globals
Hans Wennborg [Wed, 18 Jun 2014 01:21:33 +0000 (01:21 +0000)]
Fix bug in code for avoiding dynamic initialization of dllimport globals

When instantiating dllimport variables with dynamic initializers, don't
bail out of Sema::InstantiateVariableInitializer without calling
PopExpressionEvaluationContext().

This was causing a stale object to stay on the ExprEvalContexts stack,
causing subsequent calls to getCurrentMangleNumberContext() to fail,
resulting in incorrect numbering of static locals (and probably other
broken things).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211137 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDocumentation for #pragma clang loop directive and options vectorize and interleave.
Tyler Nowicki [Wed, 18 Jun 2014 00:51:32 +0000 (00:51 +0000)]
Documentation for #pragma clang loop directive and options vectorize and interleave.

Reviewed by: Aaron Ballman and Dmitri Gribenko

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211135 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix the caller of checkCorrectionVisibility too.
Kaelyn Takata [Tue, 17 Jun 2014 23:47:29 +0000 (23:47 +0000)]
Fix the caller of checkCorrectionVisibility too.

That's what I get for hurredly splitting the small change out of a much
bigger change that had moved where checkCorrectionVisibility was being
called.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211134 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRemove an unused argument from checkCorrectionVisibility.
Kaelyn Takata [Tue, 17 Jun 2014 23:41:33 +0000 (23:41 +0000)]
Remove an unused argument from checkCorrectionVisibility.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211133 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoObjective-C ARC. Do not warn about properties with both
Fariborz Jahanian [Tue, 17 Jun 2014 23:35:13 +0000 (23:35 +0000)]
Objective-C ARC. Do not warn about properties with both
IBOutlet and weak attributes when accessed being
unpredictably set to nil because usage of such properties
are always single threaded and its ivar cannot be set
to nil asynchronously. // rdar://15885642

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211132 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRetry building modules that were compiled by other instances and are out-of-date
Ben Langmuir [Tue, 17 Jun 2014 22:35:27 +0000 (22:35 +0000)]
Retry building modules that were compiled by other instances and are out-of-date

When another clang instance builds a module, it may still be considered
"out of date" for the current instance in a couple of cases*.  This
patch prevents us from giving spurious errors when compilers race to
build a module by allowing the module load to fail when the pcm was
built by a different compiler instance.

* Cases where a module can be out of date despite just having been
built:

1) There are different -I paths between invocations that result in
finding a different module map file for some dependent module. This is
not an error, and should never be diagnosed.

<rdar://problem/16843887>

2) There are file system races where the headers making up a module are
touched or moved. Although this can sometimes mean trouble, diagnosing
it only during a build-race is worse than useless and we cannot detect
this in general.  It is more robust to just rebuild.  This was causing
spurious issues in some setups where only the modtime of headers was
bumped during a build.

<rdar://problem/16157638>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211129 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRemove dead code.
Diego Novillo [Tue, 17 Jun 2014 20:01:51 +0000 (20:01 +0000)]
Remove dead code.

The parsing for -Rpass= had been factored into the function
GenerateOptimizationRemarkRegex, but at the time I forgot to remove
the original code that just handled OPT_Rpass_EQ.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211122 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoChange libclang initialization to use std::call_once instead of
Zachary Turner [Tue, 17 Jun 2014 19:57:15 +0000 (19:57 +0000)]
Change libclang initialization to use std::call_once instead of
hand rolled once-initialization, and rename the mutex to be more
descriptive of its actual purpose.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211121 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRevert "[OPENMP] Initial support for '#pragma omp for'."
Rafael Espindola [Tue, 17 Jun 2014 17:20:53 +0000 (17:20 +0000)]
Revert "[OPENMP] Initial support for '#pragma omp for'."

This reverts commit r211096. Looks like it broke the msvc build:

SemaOpenMP.cpp(140) : error C4519: default template arguments are only allowed on a class template

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211113 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix the comment which was backwards.
Yaron Keren [Tue, 17 Jun 2014 17:09:24 +0000 (17:09 +0000)]
Fix the comment which was backwards.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211112 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRewrite ARM NEON intrinsic emission completely.
James Molloy [Tue, 17 Jun 2014 13:11:27 +0000 (13:11 +0000)]
Rewrite ARM NEON intrinsic emission completely.

There comes a time in the life of any amateur code generator when dumb string
concatenation just won't cut it any more. For NeonEmitter.cpp, that time has
come.

There were a bunch of magic type codes which meant different things depending on
the context. There were a bunch of special cases that really had no reason to be
there but the whole thing was so creaky that removing them would cause something
weird to fall over. There was a 1000 line switch statement for code generation
involving string concatenation, which actually did lexical scoping to an extent
(!!) with a bunch of semi-repeated cases.

I tried to refactor this three times in three different ways without
success. The only way forward was to rewrite the entire thing. Luckily the
testing coverage on this stuff is absolutely massive, both with regression tests
and the "emperor" random test case generator.

The main change is that previously, in arm_neon.td a bunch of "Operation"s were
defined with special names. NeonEmitter.cpp knew about these Operations and
would emit code based on a huge switch. Actually this doesn't make much sense -
the type information was held as strings, so type checking was impossible. Also
TableGen's DAG type actually suits this sort of code generation very well
(surprising that...)

So now every operation is defined in terms of TableGen DAGs. There are a bunch
of operators to use, including "op" (a generic unary or binary operator), "call"
(to call other intrinsics) and "shuffle" (take a guess...). One of the main
advantages of this apart from making it more obvious what is going on, is that
we have proper type inference. This has two obvious advantages:

  1) TableGen can error on bad intrinsic definitions easier, instead of just
     generating wrong code.
  2) Calls to other intrinsics are typechecked too. So
     we no longer need to work out whether the thing we call needs to be the Q-lane
     version or the D-lane version - TableGen knows that itself!

Here's an example: before:

  case OpAbdl: {
    std::string abd = MangleName("vabd", typestr, ClassS) + "(__a, __b)";
    if (typestr[0] != 'U') {
      // vabd results are always unsigned and must be zero-extended.
      std::string utype = "U" + typestr.str();
      s += "(" + TypeString(proto[0], typestr) + ")";
      abd = "(" + TypeString('d', utype) + ")" + abd;
      s += Extend(utype, abd) + ";";
    } else {
      s += Extend(typestr, abd) + ";";
    }
    break;
  }

after:

  def OP_ABDL     : Op<(cast "R", (call "vmovl", (cast $p0, "U",
                                                       (call "vabd", $p0, $p1))))>;

As an example of what happens if you do something wrong now, here's what happens
if you make $p0 unsigned before the call to "vabd" - that is, $p0 -> (cast "U",
$p0):

arm_neon.td:574:1: error: No compatible intrinsic found - looking up intrinsic 'vabd(uint8x8_t, int8x8_t)'
Available overloads:
  - float64x2_t vabdq_v(float64x2_t, float64x2_t)
  - float64x1_t vabd_v(float64x1_t, float64x1_t)
  - float64_t vabdd_f64(float64_t, float64_t)
  - float32_t vabds_f32(float32_t, float32_t)
... snip ...

This makes it seriously easy to work out what you've done wrong in fairly nasty
intrinsics.

As part of this I've massively beefed up the documentation in arm_neon.td too.

Things still to do / on the radar:
  - Testcase generation. This was implemented in the previous version and not in
    the new one, because
    - Autogenerated tests are not being run. The testcase in test/ differs from
      the autogenerated version.
    - There were a whole slew of special cases in the testcase generation that just
      felt (and looked) like hacks.
    If someone really feels strongly about this, I can try and reimplement it too.
  - Big endian. That's coming soon and should be a very small diff on top of this one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211101 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoclang-format: Introduce style with spaces on both sides of */&.
Daniel Jasper [Tue, 17 Jun 2014 12:40:34 +0000 (12:40 +0000)]
clang-format: Introduce style with spaces on both sides of */&.

Patch by Janusz Sobczak (slightly extended).
This fixes llvm.org/19929.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211098 91177308-0d34-0410-b5e6-96231b3b80d8