summaryrefslogtreecommitdiffstats
path: root/docs/LanguageExtensions.rst
Commit message (Collapse)AuthorAgeFilesLines
* [docs] Add section 'Half-Precision Floating Point'Sjoerd Meijer2017-11-071-0/+43
| | | | | | | | | | This documents the differences/interactions between _Float16 and __fp16 and is a companion change for the _Float16 type implementation (r312794). Differential Revision: https://reviews.llvm.org/D35295 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317558 91177308-0d34-0410-b5e6-96231b3b80d8
* Add OpenCL 2.0 atomic builtin functions as Clang builtinYaxun Liu2017-08-041-1/+7
| | | | | | | | | | | | | | | | | | | | | | OpenCL 2.0 atomic builtin functions have a scope argument which is ideally represented as synchronization scope argument in LLVM atomic instructions. Clang supports translating Clang atomic builtin functions to LLVM atomic instructions. However it currently does not support synchronization scope of LLVM atomic instructions. Without this, users have to use LLVM assembly code to implement OpenCL atomic builtin functions. This patch adds OpenCL 2.0 atomic builtin functions as Clang builtin functions, which supports generating LLVM atomic instructions with synchronization scope operand. Currently only constant memory scope argument is supported. Support of non-constant memory scope argument will be added later. Differential Revision: https://reviews.llvm.org/D28691 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310082 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix flag names in @available docs.Nico Weber2017-07-141-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308048 91177308-0d34-0410-b5e6-96231b3b80d8
* Add documentation for @availableNico Weber2017-07-141-2/+81
| | | | | | | https://reviews.llvm.org/D35379 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308044 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for #pragma clang sectionJaved Absar2017-06-051-0/+42
| | | | | | | | | | | | | | | | | This patch provides a means to specify section-names for global variables, functions and static variables, using #pragma directives. This feature is only defined to work sensibly for ELF targets. One can specify section names as: #pragma clang section bss="myBSS" data="myData" rodata="myRodata" text="myText" One can "unspecify" a section name with empty string e.g. #pragma clang section bss="" data="" text="" rodata="" Reviewers: Roger Ferrer, Jonathan Roelofs, Reid Kleckner Differential Revision: https://reviews.llvm.org/D33412 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304705 91177308-0d34-0410-b5e6-96231b3b80d8
* Update LanguageExtensions doc to refer to C++14 instead of C++1yEric Fiselier2017-05-061-16/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302364 91177308-0d34-0410-b5e6-96231b3b80d8
* Add #pragma clang attributeAlex Lorenz2017-04-181-0/+175
| | | | | | | | | | | | | | | | | | This is a recommit of r300539 that was reverted in r300543 due to test failures. The original commit message is displayed below: The new '#pragma clang attribute' directive can be used to apply attributes to multiple declarations. An attribute must satisfy the following conditions to be supported by the pragma: - It must have a subject list that's defined in the TableGen file. - It must be documented. - It must not be late parsed. - It must have a GNU/C++11 spelling. Differential Revision: https://reviews.llvm.org/D30009 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300556 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r300539 - Add #pragma clang attributeAlex Lorenz2017-04-181-175/+0
| | | | | | | | Some tests fail on the Windows buildbots. I will have to investigate more. This commit reverts r300539, r300540 and r300542. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300543 91177308-0d34-0410-b5e6-96231b3b80d8
* Add #pragma clang attributeAlex Lorenz2017-04-181-0/+175
| | | | | | | | | | | | | | | The new '#pragma clang attribute' directive can be used to apply attributes to multiple declarations. An attribute must satisfy the following conditions to be supported by the pragma: - It must have a subject list that's defined in the TableGen file. - It must be documented. - It must not be late parsed. - It must have a GNU/C++11 spelling. Differential Revision: https://reviews.llvm.org/D30009 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300539 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Add __is_aggregate type-traitEric Fiselier2017-04-121-0/+1
| | | | | | | | | | | | | | | | Summary: [LWG 2911](http://cplusplus.github.io/LWG/lwg-defects.html#2911) adds `std::is_aggregate` to the library, which requires a new builtin trait. This patch implements `__is_aggregate`. Reviewers: rsmith, majnemer, aaron.ballman Reviewed By: aaron.ballman Subscribers: STL_MSFT, cfe-commits Differential Revision: https://reviews.llvm.org/D31513 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300116 91177308-0d34-0410-b5e6-96231b3b80d8
* Another attempt to fix the sphinx warning from r299470Adam Nemet2017-04-041-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299488 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix sphinx warning from r299470Adam Nemet2017-04-041-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299481 91177308-0d34-0410-b5e6-96231b3b80d8
* Add #pragma clang fpAdam Nemet2017-04-041-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | This adds the new pragma and the first variant, contract(on/off/fast). The pragma has the same block scope rules as STDC FP_CONTRACT, i.e. it can be placed at the beginning of a compound statement or at file scope. Similarly to STDC FP_CONTRACT there is no need to use attributes. First an annotate token is inserted with the parsed details of the pragma. Then the annotate token is parsed in the proper contexts and the Sema is updated with the corresponding FPOptions using the shared ActOn function with STDC FP_CONTRACT. After this the FPOptions from the Sema is propagated into the AST expression nodes. There is no change here. I was going to add a 'default' option besides 'on/off/fast' similar to STDC FP_CONTRACT but then decided against it. I think that we'd have to make option uppercase then to avoid using 'default' the keyword. Also because of the scoped activation of pragma I am not sure there is really a need a for this. Differential Revision: https://reviews.llvm.org/D31276 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299470 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the -faltivec alias option and replace it with -maltivec everywhere.Eric Christopher2017-03-211-1/+1
| | | | | | | | | | | The alias was only ever used on darwin and had some issues there, and isn't used in practice much. Also fixes a problem with -mno-altivec not turning off -maltivec. Also add a diagnostic for faltivec/fno-altivec that directs users to use maltivec options and include the altivec.h file explicitly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298449 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix documentation typo from r292558.Richard Smith2017-01-231-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292811 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix documentation typo.Richard Smith2017-01-201-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292559 91177308-0d34-0410-b5e6-96231b3b80d8
* Add documentation for constexpr string builtin support.Richard Smith2017-01-201-0/+40
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292558 91177308-0d34-0410-b5e6-96231b3b80d8
* [coroutines] Adding builtins for coroutine intrinsics and backendutil support.Gor Nishanov2016-10-031-0/+76
| | | | | | | | | | | | | Summary: With this commit simple coroutines can be created in plain C using coroutine builtins. Reviewers: rnk, EricWF, rsmith Subscribers: modocache, mgorny, mehdi_amini, beanz, cfe-commits Differential Revision: https://reviews.llvm.org/D24373 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283155 91177308-0d34-0410-b5e6-96231b3b80d8
* [Docs] Try to fix the docs buildbot.George Burgess IV2016-06-211-1/+1
| | | | | | | | It's complaining that it couldn't lex a compiler warning as C++. I don't blame it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273227 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix documentation bot after r272656Adam Nemet2016-06-141-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272699 91177308-0d34-0410-b5e6-96231b3b80d8
* Add loop pragma for Loop DistributionAdam Nemet2016-06-141-3/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is similar to other loop pragmas like 'vectorize'. Currently it only has state values: distribute(enable) and distribute(disable). When one of these is specified the corresponding loop metadata is generated: !{!"llvm.loop.distribute.enable", i1 true/false} As a result, loop distribution will be attempted on the loop even if Loop Distribution in not enabled globally. Analogously, with 'disable' distribution can be turned off for an individual loop even when the pass is otherwise enabled. There are some slight differences compared to the existing loop pragmas. 1. There is no 'assume_safety' variant which makes its handling slightly different from 'vectorize'/'interleave'. 2. Unlike the existing loop pragmas, it does not have a corresponding numeric pragma like 'vectorize' -> 'vectorize_width'. So for the consistency checks in CheckForIncompatibleAttributes we don't need to check it against other pragmas. We just need to check for duplicates of the same pragma. Reviewers: rsmith, dexonsmith, aaron.ballman Subscribers: bob.wilson, cfe-commits, hfinkel Differential Revision: http://reviews.llvm.org/D19403 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272656 91177308-0d34-0410-b5e6-96231b3b80d8
* Clang support for __is_assignable intrinsicDavid Majnemer2016-05-231-0/+1
| | | | | | | | | | | | | | | | | | | MSVC now supports the __is_assignable type trait intrinsic, to enable easier and more efficient implementation of the Standard Library's is_assignable trait. As of Visual Studio 2015 Update 3, the VC Standard Library implementation uses the new intrinsic unconditionally. The implementation is pretty straightforward due to the previously existing is_nothrow_assignable and is_trivially_assignable. We handle __is_assignable via the same code as the other two except that we skip the extra checks for nothrow or triviality. Patch by Dave Bartolomeo! Differential Revision: http://reviews.llvm.org/D20492 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270458 91177308-0d34-0410-b5e6-96231b3b80d8
* Add address space 258 (X86 SS segment) to clang documentation.David L Kreitzer2016-05-031-4/+5
| | | | | | | | | | | The change reflects llvm r268431. Patch by Michael Lemay (michael.lemay@intel.com) Differential Revision: http://reviews.llvm.org/D19458 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268432 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix Sphinx errors with documentation build.Aaron Ballman2016-03-241-1/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264263 91177308-0d34-0410-b5e6-96231b3b80d8
* Add missing __builtin_bitreverse8Matt Arsenault2016-03-231-0/+27
| | | | | | Also add documentation for bitreverse builtins git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264203 91177308-0d34-0410-b5e6-96231b3b80d8
* Add __builtin_canonicalizeMatt Arsenault2016-02-271-0/+18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262122 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some typos in the clang docSylvestre Ledru2016-02-141-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260856 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark is_destructible/is_nothrow_destructible as implementedDavid Majnemer2015-11-141-2/+2
| | | | | | | These were implemented back in r244564. However, I forgot to update the docs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253128 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for __builtin_{add,sub,mul}_overflow.John McCall2015-10-291-2/+20
| | | | | | Patch by David Grayson! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251651 91177308-0d34-0410-b5e6-96231b3b80d8
* Docs: Document __builtin_nontemporal_load and __builtin_nontemporal_store.Michael Zolotukhin2015-09-111-0/+20
| | | | | | | | | | Summary: In r247104 I added the builtins for generating non-temporal memory operations, but now I realized that they lack documentation. This patch adds some. Differential Revision: http://reviews.llvm.org/D12785 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247374 91177308-0d34-0410-b5e6-96231b3b80d8
* Docs: Add missing new line before a list.Michael Zolotukhin2015-09-101-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247360 91177308-0d34-0410-b5e6-96231b3b80d8
* add __builtin_unpredictable and convert to metadataSanjay Patel2015-09-021-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | This patch depends on r246688 (D12341). The goal is to make LLVM generate different code for these functions for a target that has cheap branches (see PR23827 for more details): int foo(); int normal(int x, int y, int z) { if (x != 0 && y != 0) return foo(); return 1; } int crazy(int x, int y) { if (__builtin_unpredictable(x != 0 && y != 0)) return foo(); return 1; } Differential Revision: http://reviews.llvm.org/D12458 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246699 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo.Nick Lewycky2015-08-101-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244490 91177308-0d34-0410-b5e6-96231b3b80d8
* Add new llvm.loop.unroll.enable metadata for use with "#pragma unroll".Mark Heffernan2015-08-101-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | This change adds the new unroll metadata "llvm.loop.unroll.enable" which directs the optimizer to unroll a loop fully if the trip count is known at compile time, and unroll partially if the trip count is not known at compile time. This differs from "llvm.loop.unroll.full" which explicitly does not unroll a loop if the trip count is not known at compile time With this change "#pragma unroll" generates "llvm.loop.unroll.enable" rather than "llvm.loop.unroll.full" metadata. This changes the semantics of "#pragma unroll" slightly to mean "unroll aggressively (fully or partially)" rather than "unroll fully or not at all". The motivating example for this change was some internal code with a loop marked with "#pragma unroll" which only sometimes had a compile-time trip count depending on template magic. When the trip count was a compile-time constant, everything works as expected and the loop is fully unrolled. However, when the trip count was not a compile-time constant the "#pragma unroll" explicitly disabled unrolling of the loop(!). Removing "#pragma unroll" caused the loop to be unrolled partially which was desirable from a performance perspective. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244467 91177308-0d34-0410-b5e6-96231b3b80d8
* Add missing atomic libcall support.James Y Knight2015-08-051-0/+3
| | | | | | | | | | Support for emitting libcalls for __atomic_fetch_nand and __atomic_{add,sub,and,or,xor,nand}_fetch was missing; add it, and some test cases. Differential Revision: http://reviews.llvm.org/D10847 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244063 91177308-0d34-0410-b5e6-96231b3b80d8
* Update documentation for unroll pragmas on loops with runtime trip counts.Mark Heffernan2015-07-131-5/+5
| | | | | | | | | | This change updates the documentation for the loop unrolling pragma behavior change in r242047. Specifically, with that change "#pragma unroll" will not unroll loops with a runtime trip count. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242048 91177308-0d34-0410-b5e6-96231b3b80d8
* Protection against stack-based memory corruption errors using SafeStack: ↵Peter Collingbourne2015-06-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Clang command line option and function attribute This patch adds the -fsanitize=safe-stack command line argument for clang, which enables the Safe Stack protection (see http://reviews.llvm.org/D6094 for the detailed description of the Safe Stack). This patch is our implementation of the safe stack on top of Clang. The patches make the following changes: - Add -fsanitize=safe-stack and -fno-sanitize=safe-stack options to clang to control safe stack usage (the safe stack is disabled by default). - Add __attribute__((no_sanitize("safe-stack"))) attribute to clang that can be used to disable the safe stack for individual functions even when enabled globally. Original patch by Volodymyr Kuznetsov and others at the Dependable Systems Lab at EPFL; updates and upstreaming by myself. Differential Revision: http://reviews.llvm.org/D6095 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239762 91177308-0d34-0410-b5e6-96231b3b80d8
* Document __has_feature(modules) in LanguageExtensionsBen Langmuir2015-03-101-0/+8
| | | | | | | | Fixes PR18985 Patch by Vassil Vassilev! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231789 91177308-0d34-0410-b5e6-96231b3b80d8
* Amending r223468 with this documentation change.Aaron Ballman2014-12-051-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223479 91177308-0d34-0410-b5e6-96231b3b80d8
* Added a new preprocessor macro: __has_declspec_attribute. This can be used ↵Aaron Ballman2014-12-051-0/+27
| | | | | | as a way to determine whether Clang supports a __declspec spelling for a given attribute, similar to __has_attribute and __has_cpp_attribute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223467 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for has_feature(cxx_alignof) and has_feature(c_alignof).Nico Weber2014-12-031-0/+6
| | | | | | | | r142020 added support for has_feature(cxx_alignas). This does the same for alignof. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223186 91177308-0d34-0410-b5e6-96231b3b80d8
* Oops, the underline was too short for sphinx to like.Aaron Ballman2014-11-141-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221993 91177308-0d34-0410-b5e6-96231b3b80d8
* Complete support for the SD-6 standing document (based off N4200) with ↵Aaron Ballman2014-11-141-0/+30
| | | | | | support for __has_cpp_attribute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221991 91177308-0d34-0410-b5e6-96231b3b80d8
* Update Clang's SD-6 support to match N4200 (except for __has_cpp_attribute,Richard Smith2014-11-121-0/+14
| | | | | | | which we don't yet implement). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221816 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix documentation typo.JF Bastien2014-10-101-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219509 91177308-0d34-0410-b5e6-96231b3b80d8
* [sphinx clean up] Fix warning introduced by r218957Dan Liew2014-10-031-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218983 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an implementation of C11's stdatomic.hHal Finkel2014-10-031-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | Adds a Clang-specific implementation of C11's stdatomic.h header. On systems, such as FreeBSD, where a stdatomic.h header is already provided, we defer to that header instead (using our __has_include_next technology). Otherwise, we provide an implementation in terms of our __c11_atomic_* intrinsics (that were created for this purpose). C11 7.1.4p1 requires function declarations for atomic_thread_fence, atomic_signal_fence, atomic_flag_test_and_set, atomic_flag_test_and_set_explicit, and atomic_flag_clear, and requires that they have external linkage. Accordingly, we provide these declarations, but if a user elides the shadowing macros and uses them, then they must have a libc (or similar) that actually provides definitions. atomic_flag is implemented using _Bool as the underlying type. This is consistent with the implementation provided by FreeBSD and also GCC 4.9 (at least when __GCC_ATOMIC_TEST_AND_SET_TRUEVAL == 1). Patch by Richard Smith (rebased and slightly edited by me -- Richard said I should drive at this point). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218957 91177308-0d34-0410-b5e6-96231b3b80d8
* Add __builtin_assume and __builtin_assume_aligned using @llvm.assume.Hal Finkel2014-09-071-2/+39
| | | | | | | | | | | This makes use of the recently-added @llvm.assume intrinsic to implement a __builtin_assume(bool) intrinsic (to provide additional information to the optimizer). This hooks up __assume in MS-compatibility mode to mirror __builtin_assume (the semantics have been intentionally kept compatible), and implements GCC's __builtin_assume_aligned as assume((p - o) & mask == 0). LLVM now contains special logic to deal with assumptions of this form. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217349 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhance the 'Vectors and Extended Vectors' section.Anton Yartsev2014-09-031-17/+23
| | | | | | | Added cast operations to the table of vector operations. Supported status 'no' means that there are no tests in the Clang test suite for the given cast. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217055 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing a typo in the documented __builtin_convertvector example.Yunzhong Gao2014-09-021-1/+1
| | | | | | | | "vf[0]" ==> "vs[0]" git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216935 91177308-0d34-0410-b5e6-96231b3b80d8