Commit Graph

123 Commits

Author SHA1 Message Date
Gor Nishanov 97e3b6d895 [coroutines] Adding builtins for coroutine intrinsics and backendutil support.
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

llvm-svn: 283155
2016-10-03 22:44:48 +00:00
George Burgess IV 61e43277ef [Docs] Try to fix the docs buildbot.
It's complaining that it couldn't lex a compiler warning as C++. I don't
blame it.

llvm-svn: 273227
2016-06-21 00:16:23 +00:00
Adam Nemet 0c58eb711c Fix documentation bot after r272656
llvm-svn: 272699
2016-06-14 19:33:16 +00:00
Adam Nemet 2de463ece3 Add loop pragma for Loop Distribution
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

llvm-svn: 272656
2016-06-14 12:04:26 +00:00
David Majnemer b3d96882ec Clang support for __is_assignable intrinsic
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

llvm-svn: 270458
2016-05-23 17:21:55 +00:00
David L Kreitzer d8984101e5 Add address space 258 (X86 SS segment) to clang documentation.
The change reflects llvm r268431.

Patch by Michael Lemay (michael.lemay@intel.com)

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

llvm-svn: 268432
2016-05-03 20:20:59 +00:00
Aaron Ballman bcf13da98e Fix Sphinx errors with documentation build.
llvm-svn: 264263
2016-03-24 12:34:44 +00:00
Matt Arsenault 08087c52eb Add missing __builtin_bitreverse8
Also add documentation for bitreverse builtins

llvm-svn: 264203
2016-03-23 22:14:43 +00:00
Matt Arsenault 2d9339890f Add __builtin_canonicalize
llvm-svn: 262122
2016-02-27 09:06:18 +00:00
Sylvestre Ledru be8f396bde Fix some typos in the clang doc
llvm-svn: 260856
2016-02-14 20:20:58 +00:00
David Majnemer 55cf252d75 Mark is_destructible/is_nothrow_destructible as implemented
These were implemented back in r244564.  However, I forgot to update the
docs.

llvm-svn: 253128
2015-11-14 07:21:35 +00:00
John McCall 03107a4ef0 Add support for __builtin_{add,sub,mul}_overflow.
Patch by David Grayson!

llvm-svn: 251651
2015-10-29 20:48:01 +00:00
Michael Zolotukhin 59d72b1c8a Docs: Document __builtin_nontemporal_load and __builtin_nontemporal_store.
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

llvm-svn: 247374
2015-09-11 02:01:15 +00:00
Michael Zolotukhin c3f09ffa4d Docs: Add missing new line before a list.
llvm-svn: 247360
2015-09-10 23:56:10 +00:00
Sanjay Patel a24296b459 add __builtin_unpredictable and convert to metadata
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

llvm-svn: 246699
2015-09-02 20:01:30 +00:00
Nick Lewycky 00a5d21803 Fix typo.
llvm-svn: 244490
2015-08-10 19:54:11 +00:00
Mark Heffernan 397a98d86d Add new llvm.loop.unroll.enable metadata for use with "#pragma unroll".
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.

llvm-svn: 244467
2015-08-10 17:29:39 +00:00
James Y Knight 81167fb799 Add missing atomic libcall support.
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

llvm-svn: 244063
2015-08-05 16:57:36 +00:00
Mark Heffernan 7ccb5e2316 Update documentation for unroll pragmas on loops with runtime trip counts.
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.

llvm-svn: 242048
2015-07-13 18:31:37 +00:00
Peter Collingbourne c4122c17b4 Protection against stack-based memory corruption errors using SafeStack: 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

llvm-svn: 239762
2015-06-15 21:08:13 +00:00
Ben Langmuir 921f2e6746 Document __has_feature(modules) in LanguageExtensions
Fixes PR18985

Patch by Vassil Vassilev!

llvm-svn: 231789
2015-03-10 14:39:26 +00:00
Aaron Ballman 4bfaeba6a9 Amending r223468 with this documentation change.
llvm-svn: 223479
2014-12-05 17:11:49 +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
Nico Weber 736a993828 Add support for has_feature(cxx_alignof) and has_feature(c_alignof).
r142020 added support for has_feature(cxx_alignas). This does the same for
alignof.

llvm-svn: 223186
2014-12-03 01:25:49 +00:00
Aaron Ballman 631bd7b110 Oops, the underline was too short for sphinx to like.
llvm-svn: 221993
2014-11-14 14:01:55 +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
Richard Smith 38af8561f9 Update Clang's SD-6 support to match N4200 (except for __has_cpp_attribute,
which we don't yet implement).

llvm-svn: 221816
2014-11-12 21:16:38 +00:00
JF Bastien e6ccacf9b0 Fix documentation typo.
llvm-svn: 219509
2014-10-10 16:09:48 +00:00
Dan Liew fe7268600d [sphinx clean up] Fix warning introduced by r218957
llvm-svn: 218983
2014-10-03 12:36:20 +00:00
Hal Finkel 6970ac8b0a Add an implementation of C11's stdatomic.h
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).

llvm-svn: 218957
2014-10-03 04:29:40 +00:00
Hal Finkel bcc06085a8 Add __builtin_assume and __builtin_assume_aligned using @llvm.assume.
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.

llvm-svn: 217349
2014-09-07 22:58:14 +00:00
Anton Yartsev 94e46f3eb8 Enhance the 'Vectors and Extended Vectors' section.
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.

llvm-svn: 217055
2014-09-03 17:59:21 +00:00
Yunzhong Gao 637cb90ba8 Fixing a typo in the documented __builtin_convertvector example.
"vf[0]" ==> "vs[0]"

llvm-svn: 216935
2014-09-02 19:24:14 +00:00
Mark Heffernan 450c23843e In unroll pragma syntax and loop hint metadata, change "enable" forms to a new form using the string "full".
llvm-svn: 213771
2014-07-23 17:31:31 +00:00
Yi Kong 4de26fb2e0 ARM: Add doc for ACLE memory barrier intrinsics
Add documentations for ACLE memory barrier intrinsics, describing their motion
barrier characteristics.

llvm-svn: 213733
2014-07-23 09:25:02 +00:00
Alp Toker 958027b698 Fix typos
Also consolidate 'backward compatibility'

llvm-svn: 212974
2014-07-14 19:42:55 +00:00
Tim Northover 3acd6bd0b6 ARM: add support for v8 ldaex/stlex builtins.
ARMv8 adds (to both AArch32 and AArch64) acquiring and releasing
variants of the exclusive operations, in line with the C++11 memory
model.

This adds support for two new intrinsics to expose them to C & C++
developers directly: __builtin_arm_ldaex and __builtin_arm_stlex, in
direct analogy with the versions with no implicit barrier.

rdar://problem/15885451

llvm-svn: 212175
2014-07-02 12:56:02 +00:00
Eli Bendersky 778268df57 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]

llvm-svn: 211286
2014-06-19 18:12:44 +00:00
Tyler Nowicki db2668a1da Documentation for #pragma clang loop directive and options vectorize and interleave.
Reviewed by: Aaron Ballman and Dmitri Gribenko

llvm-svn: 211135
2014-06-18 00:51:32 +00:00
Richard Smith 760520bcb7 Add __builtin_operator_new and __builtin_operator_delete, which act like calls
to the normal non-placement ::operator new and ::operator delete, but allow
optimizations like new-expressions and delete-expressions do.

llvm-svn: 210137
2014-06-03 23:27:44 +00:00
Dario Domizioli 33c1787147 [DOC] Documentation for #pragma clang optimize on/off
llvm-svn: 209738
2014-05-28 14:06:38 +00:00
Tim Northover 573cbee543 AArch64/ARM64: rename ARM64 components to AArch64
This keeps Clang consistent with backend naming conventions.

llvm-svn: 209579
2014-05-24 12:52:07 +00:00
Richard Smith 6d54014144 PR19698, PR19674: enable __has_feature checks for cxx_generic_lambdas and
cxx_decltype_auto, and fix documentation of cxx_generic_lambdas and
cxx_init_captures to specify the right feature-check name.

llvm-svn: 208445
2014-05-09 21:08:59 +00:00
Yunzhong Gao a8c45c9f88 Add description about the __is_identifier() macro
llvm-svn: 206099
2014-04-12 02:25:32 +00:00
Tim Northover a2ee433c8d ARM64: initial clang support commit.
This adds Clang support for the ARM64 backend. There are definitely
still some rough edges, so please bring up any issues you see with
this patch.

As with the LLVM commit though, we think it'll be more useful for
merging with AArch64 from within the tree.

llvm-svn: 205100
2014-03-29 15:09:45 +00:00
Aaron Ballman 5ee46d2a9e Moving the documentation for the format attribute into AttrDocs.
llvm-svn: 201857
2014-02-21 14:36:13 +00:00
Aaron Ballman ea6668c4e8 Moving the documentation for the type safety checking attributes into AttrDocs. If a custom heading is provided, do not automatically generate the alternate spelling list. This is necessary because some attributes have distinct semantic spellings and meanings, but use the same semantic attribute internally. Such attributes should have multiple elements in their documentation list, but not show all spellings. At some point, it would be nice to have a way to attach the documentation element to a specific spelling for these cases.
llvm-svn: 201851
2014-02-21 14:14:04 +00:00
Aaron Ballman 7803b888c4 Moving the documentation for the sanitizer negation attributes into AttrDocs.
llvm-svn: 201850
2014-02-21 13:44:43 +00:00
Aaron Ballman 68893db056 Doing some temporary touch-up on the gnu namespace attribute documentation, from a post-commit review comment.
Ideally, this content will eventually find a home with the rest of the attribute documentation.

llvm-svn: 201736
2014-02-19 23:21:40 +00:00
Aaron Ballman 4de1b584cd Refactored the way attribute category headers are handled so that it is possible to use custom categories. This allows for moving the consumable attributes (consumable, callable_when, return_typestate, etc) to be grouped together, with a content heading, like they were in the language extensions documentation. Moved the consumable attribute documentation from the language extensions into the attribute documentation table.
llvm-svn: 201732
2014-02-19 22:59:32 +00:00