Commit Graph

770 Commits

Author SHA1 Message Date
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 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
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
Aaron Ballman 416b127456 Disable __has_cpp_attribute when not compiling in C++ mode. As this feature test macro only supports C++ style attributes, it doesn't apply to code compiled as C code, and can lead to diagnostics when given a scoped attribute.
This addresses PR23435.

llvm-svn: 236996
2015-05-11 14:09:50 +00:00
Will Wilson db2588ab82 [MSVC] Mimic MSVC whitespace collapse for incompatible token pasting
In public MS headers for XAudio, clang would fail to generate a valid UUID due to the UUID components being combined with the '-' UUID separators. Clang would attempting to recover but would preserve the leading whitespace from the tokens after each failed paste leading to spaces creeping into the UUID and causing an error in the __declspace(uuid()) parsing.

Reference: Microsoft DirectX SDK (June 2010)\Include\XAudio2.h(51)

Resolves http://llvm.org/pr23071

llvm-svn: 235186
2015-04-17 12:43:57 +00:00
Vladimir Sukharev e851e04262 [AArch64] Add v8.1a architecture
Add support for AArch64 v8.1 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

Subscribers: cfe-commits

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

llvm-svn: 235110
2015-04-16 15:53:09 +00:00
Petar Jovanovic 1dbc317736 [Mips] Generate warning for invalid '-mnan' and '-march' combinations
This patch generates a warning for invalid combination of '-mnan' and
'-march' options, it properly sets NaN encoding for a given '-march',
and it passes a proper NaN encoding to the assembler.

Patch by Vladimir Radosavljevic.

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

llvm-svn: 234882
2015-04-14 12:49:08 +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
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
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
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
Benjamin Kramer 18ff02dd51 [lex] Don't create a garbage token if parsing of __has_include fails.
It will crash downstream somewhere. Found by afl-fuzz.

llvm-svn: 233493
2015-03-29 15:33:29 +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
Yunzhong Gao 7b0f428573 Disable this test for PS4 target because PS4 issues different diagnostics.
llvm-svn: 233210
2015-03-25 20:16:29 +00:00
Yunzhong Gao 99efc0361b Adds a warning for unrecognized argument to #pragma comment() on PS4.
PS4 target recognizes the #pragma comment() syntax as in -fms-extensions, but
only handles the case of #pragma comment(lib). This patch adds a warning if any
other arguments are encountered.

This patch also refactors the code in ParsePragma.cpp a little bit to make it
more obvious that some codes are being shared between -fms-extensions and PS4.

llvm-svn: 233015
2015-03-23 20:41:42 +00:00
David Majnemer d8dee1f54b Lex: Don't call getIdentifierInfo on annotation tokens
These calls are usually guarded by checks for isAnnotation() but it
looks like we missed a spot.  This would cause the included test to
crash clang.

llvm-svn: 232616
2015-03-18 07:53:20 +00:00
Hal Finkel 0d0a1a53e3 [PowerPC] ABI support for the QPX vector instruction set
Support for the QPX vector instruction set, used on the IBM BG/Q supercomputer,
has recently been added to the LLVM PowerPC backend. This vector instruction
set requires some ABI modifications because the ABI on the BG/Q expects
<4 x double> vectors to be provided with 32-byte stack alignment, and to be
handled as native vector types (similar to how Altivec vectors are handled on
mainline PPC systems). I've named this ABI variant elfv1-qpx, have made this
the default ABI when QPX is supported, and have updated the ABI handling code
to provide QPX vectors with the correct stack alignment and associated
register-assignment logic.

llvm-svn: 231960
2015-03-11 19:14:15 +00:00
Ed Schouten f33c607c0a Add target information for CloudABI on x86-64.
CloudABI can be identified by the __CloudABI__ preprocessor definition. The
system uses ELF executables.

CloudABI uses Unicode 7.0.0 for the encoding of wchar_t. As Unicode 7.0.0 is
synchronized with ISO/IEC 10646:2012 (released on 2012-06-01),
__STDC_ISO_10646__ is defined as 201206L.

llvm-svn: 231912
2015-03-11 08:42:46 +00:00
Nemanja Ivanovic 55e757db4a Add Clang support for PPC cryptography builtins
Review: http://reviews.llvm.org/D7951

llvm-svn: 231291
2015-03-04 21:48:22 +00:00
Renato Golin 9ba392351e Add __ARM_DWARF_EH__ to signify the use of Itanium ABI for unwind instructions.
Equally to NetBSD, Bitrig will be using .eh_frame unwinding on ARM.

Patch by Patrick Wildt.

llvm-svn: 230763
2015-02-27 16:35:48 +00:00
Tom Stellard fded50f2f9 AMDGCN: Define cl_khr_fp64 when compiling OpenCL programs
llvm-svn: 230761
2015-02-27 15:10:19 +00:00
Reid Kleckner 1df0fea593 Add -fuse-line-directive flag to control usage of #line with -E
Currently -fms-extensions controls this behavior, which doesn't make
much sense. It means we can't identify what is and isn't a system header
when compiling our own preprocessed output, because #line doesn't
represent this information.

If someone is feeding Clang's preprocessed output to another compiler,
they can use this flag.

Fixes PR20553.

Reviewers: rsmith

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

llvm-svn: 230587
2015-02-26 00:17:25 +00:00
Michael Wong 867eeb5861 Commit patch for PR19649. Set the correct sign of wide character for literals based on underlying type of wchar_t.
Reviewed:
http://reviews.llvm.org/D7559
Patch by Rachel Craig; Test cases by Hubert Tong.

llvm-svn: 230333
2015-02-24 13:34:20 +00:00
Ed Schouten 4992099b42 Add C11 *_DECIMAL_DIG.
Before C11 there was only the DECIMAL_DIG definition. As of C11, we now
have one definition per floating point type (e.g. DBL_DECIMAL_DIG).
Change the existing code to define the new versions. To remain backward
compatible, define __DECIMAL_DIG__ as __LDBL_DECIMAL_DIG__.

Also update the tests. It seems that some of the existing test vectors
were incorrect. Change all tests for __DECIMAL_DIG__ to expect
__LDBL_DECIMAL_DIG__. Add tests for *_DECIMAL_DIG for FreeBSD/amd64, as
I happen to have such a system laying around. I've validated that the
values are in sync with <float.h>.

llvm-svn: 230207
2015-02-23 09:12:31 +00:00
Simon Atanasyan 162feb5f8e [Mips] Support mips32r3, mips32r5, mips64r3, mips64r5 MIPS ISA names
The patch teaches the clang's driver to understand new MIPS ISA names,
pass appropriate options to the assembler, defines corresponding macros etc

http://reviews.llvm.org/D7737

llvm-svn: 230092
2015-02-20 23:37:40 +00:00
Bradley Smith d86d670e85 [ARM] Add missing M/R class CPUs
Add some of the missing M and R class Cortex CPUs, namely:

Cortex-M0+ (called Cortex-M0plus for GCC compatibility)
Cortex-M1
SC000
SC300
Cortex-R5

llvm-svn: 229661
2015-02-18 10:34:48 +00:00
Vasileios Kalintiris ea50312b84 [mips] Partially revert r223927: Removing __SIZEOF_INT128__ macro for MIPS64
Partially revert r223927 because LLVM gained support for 128-bit integers
in r227089. Modify and keep the tests that verify the definition of the
macro __SIZEOF_INT128__ for MIPS64 BE & LE in the preprocessor.

llvm-svn: 228918
2015-02-12 11:36:56 +00:00
Tim Northover a6a19f1e38 Preprocessor: support __BIGGEST_ALIGNMENT__ macro
For compatibility with GCC (and because it's generally helpful information
otherwise inaccessible to the preprocessor). This appears to be canonically the
alignment of max_align_t (e.g. on i386, __BIGGEST_ALIGNMENT__ is 4 even though
vector types will be given greater alignment).

Patch mostly by Mats Petersson

llvm-svn: 228367
2015-02-06 01:25:07 +00:00
Renato Golin 84545d7a5c Teaches the Clang driver to accept Cortex-A72
A previous commit added Cortex-A72 to LLVM, this teaches Clang to
accept it as well.

Patch by Ranjeet Singh.

llvm-svn: 228141
2015-02-04 13:31:56 +00:00
Sean Silva 110de6fc29 No longer SCE_PRIVATE ;)
llvm-svn: 227200
2015-01-27 16:53:56 +00:00
Alex Rosenberg 12207fab78 Begin to teach clang about the PS4.
llvm-svn: 227194
2015-01-27 14:47:44 +00:00
Simon Atanasyan 495523e4ea [Mips] Fix type of 64-bit integer in case of MIPS N64 ABI
Differential Revision: http://reviews.llvm.org/D7127

llvm-svn: 226877
2015-01-22 23:16:48 +00:00
Simon Atanasyan e6694eb245 [Mips] Define macros `__mips_isa_rev` in case of mips32r6/mips64r6 options
llvm-svn: 226136
2015-01-15 07:04:48 +00:00
Chandler Carruth fd3cc70ed4 [multilib] Teach Clang's code about multilib by threading
a CLANG_LIBDIR_SUFFIX down from the build system and using that as part
of the default resource dir computation.

Without this, essentially nothing that uses the clang driver works when
building clang with a libdir suffix. This is probably the single biggest
missing piece of support for multilib as without this people could hack
clang to end up installed in the correct location, but it would then
fail to find its own basic resources. I know of at least one distro that
has some variation on this patch to hack around this; hopefully they'll
be able to use the libdir suffix functionality directly as the rest of
these bits land.

This required fixing a copy of the code to compute Clang's resource
directory that is buried inside of the frontend (!!!). It had bitrotted
significantly relative to the driver code. I've made it essentially
a clone of the driver code in order to keep tests (which use cc1
heavily) passing. This copy should probably just be removed and the
frontend taught to always rely on an explicit resource directory from
the driver, but that is a much more invasive change for another day.

I've also updated one test which actually encoded the resource directory
in its checked output to tolerate multilib suffixes.

Note that this relies on a prior LLVM commit to add a stub to the
autoconf build system for this variable.

llvm-svn: 224924
2014-12-29 12:09:08 +00:00
David Majnemer f2d3bc0474 Lex: Don't let annotation tokens get into macro expansion
We'd let annotation tokens from '#pragma pack' and the like get inside a
function-like macro.  This would lead to terror and mayhem; stop the
madness early.

This fixes PR22037.

llvm-svn: 224896
2014-12-28 07:42:49 +00:00
Serge Pavlov 07c0f04e08 Fixed warnings on redefine keywords and reserved ids.
Repared support for warnings -Wkeyword-macro and -Wreserved-id-macro.
The warning -Wkeyword-macro now is not issued in patterns that are used
in configuration scripts:

    #define inline

also for 'const', 'extern' and 'static'. If macro repalcement is identical
to macro name, the warning also is not issued:

    #define volatile volatile

And finally if macro replacement is also a keyword identical to the replaced
one but decorated with leading/trailing underscores:

    #define inline __inline
    #define inline __inline__
    #define inline _inline // in MSVC compatibility mode

Warning -Wreserved-id-macro is off by default, it could help catching
things like:

    #undef __cplusplus

llvm-svn: 224512
2014-12-18 11:14:21 +00:00
Nico Weber 92c14bb2ff Move -Wkeyword-macro into -pedantic, remove -Wreserved-id-macro.
As discussed on the post-commit review thread for r224012, -Wkeyword-macro fires
mostly on headers trying to set up portable defines and doesn't find much bad
stuff in practice.  But [macro.names]p2 does disallow defining or undefining
keywords, override and final, and alignas, so keep the warning but move it
into -pedantic.

-Wreserved-id-macro warns on

    #define __need_size_t

which is more or less public api for glibc headers. Since this warning isn't
motivated by a standard, remove it.

(See also r223114 for a previous follow-up to r224012.)

llvm-svn: 224371
2014-12-16 21:16:10 +00:00
David Majnemer d616362fe3 Preprocessor: Recover instead of mutating a token in ExpandBuiltinMacro
We would CreateString on arbitrary garbage instead of just skipping to
the end of the builtin macro.  Eventually, this would cause us to crash
because we would end up replacing the contents of a character token with
a numeric literal.

This fixes PR21825.

llvm-svn: 224238
2014-12-15 09:03:58 +00:00
Serge Pavlov 59da7b8a68 Do not warn on keyword undef
#undef a keyword is generally harmless but used often in configuration scripts.
Also added tests that I forgot to include to commit in r223114.

llvm-svn: 224100
2014-12-12 06:37:55 +00:00
Serge Pavlov 83cf078f8f Emit warning if define or undef reserved identifier or keyword.
Recommit of r223114, reverted in r223120.

llvm-svn: 224012
2014-12-11 12:18:08 +00:00
Simon Atanasyan d83248e60c [mips] Removing __SIZEOF_INT128__ macro for MIPS64
This is a temporary workaround while MIPS64 has not yet fully supported
128-bit integers. But declaration of int128 type is necessary even though
`__SIZEOF_INT128__` is undefined because c++ standard header files like
`limits` throw error message if `__int128` is not available.

Patch by Sagar Thakur.

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

llvm-svn: 223927
2014-12-10 15:44:07 +00:00
Aaron Ballman a6f759e423 Modify __has_attribute so that it only looks for GNU-style attributes. Removes the ability to look for generic attributes and keywords via this macro, which has the potential to be a breaking change. However, since there is __has_cpp_attribute and __has_declspec_attribute, and given the limited usefulness of querying a generic attribute name regardless of syntax, this seems like the correct path forward.
llvm-svn: 223468
2014-12-05 15:24:55 +00:00
Aaron Ballman 3c0f9b4a7d Added a new preprocessor macro: __has_declspec_attribute. This can be used as a way to determine whether Clang supports a __declspec spelling for a given attribute, similar to __has_attribute and __has_cpp_attribute.
llvm-svn: 223467
2014-12-05 15:05:29 +00:00
Serge Pavlov 376aee9ae7 Reverted r223114, it caused failure on on clang-native-arm-cortex-a9.
llvm-svn: 223120
2014-12-02 14:52:20 +00:00
Serge Pavlov 1ecb41c09b Emit warning if define or undef reserved identifier or keyword.
Summary:
This change implements warnings if macro name is identical to a keyword or
reserved identifier. The warnings are different depending on the "danger"
of the operation. Defining macro that replaces a keyword is on by default.
Other cases produce warning that is off by default but can be turned on
using option -Wreserved-id-macro.

This change fixes PR11488.

Reviewers: rnk

Reviewed By: rnk

Subscribers: rnk, cfe-commits

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

llvm-svn: 223114
2014-12-02 11:06:09 +00:00
Sergey Dmitrouk 745f530446 [ARM] Define __ARM_FEATURE_DSP macro for CPUs that have DSP instructions
Summary:
This resolves [[ http://llvm.org/bugs/show_bug.cgi?id=17391 | PR17391 ]].

GCC's sources were used as a guide (couldn't find much information in ARM documentation).

Reviewers: doug.gregor, asl

Reviewed By: asl

Subscribers: asl, aemerson, cfe-commits

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

llvm-svn: 222741
2014-11-25 08:57:36 +00:00
Timur Iskhodzhanov f0934fa708 Convert CR+LF -> LF in a test file
llvm-svn: 222429
2014-11-20 12:59:14 +00:00
Richard Smith c8b9badef7 Avoid earlier test interfering with later one.
llvm-svn: 222403
2014-11-20 01:50:37 +00:00
Aaron Ballman a0344c5d7b Complete support for the SD-6 standing document (based off N4200) with support for __has_cpp_attribute.
llvm-svn: 221991
2014-11-14 13:44:02 +00:00