summaryrefslogtreecommitdiffstats
path: root/lib/AST/Stmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [OPENMP] Check DSA for variables captured by value.Alexey Bataev2017-05-151-1/+1
| | | | | | | | Currently clang checks for default data sharing attributes only for variables captured in OpenMP regions by reference. Patch adds checks for variables captured by value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303077 91177308-0d34-0410-b5e6-96231b3b80d8
* Spelling mistakes in comments. NFCI. (PR27635)Simon Pilgrim2017-03-301-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299083 91177308-0d34-0410-b5e6-96231b3b80d8
* [x86][inline-asm] Add support for curly brackets escape using "%" in ↵Michael Zuckerman2016-10-311-7/+9
| | | | | | | | | | | | | | | | | | | extended inline asm. Commit on behalf of mharoush After LGTM and check all: This patch is a compatibility fix for clang, matching GCC support for charter escape when using extended in-line assembly (i.e, "%{" ,"%}" --> "{" ,"}" ). It is meant to enable support for advanced features such as AVX512 conditional\masked vector instructions/broadcast assembly syntax. Reviewer: 1. rnk Differential Revision: https://reviews.llvm.org/D25012 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285585 91177308-0d34-0410-b5e6-96231b3b80d8
* Retire llvm::alignOf in favor of C++11 alignof.Benjamin Kramer2016-10-201-5/+5
| | | | | | No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284730 91177308-0d34-0410-b5e6-96231b3b80d8
* [ObjC] Warn on unguarded use of partial declarationErik Pilkington2016-08-161-0/+4
| | | | | | | | | | | | | | This commit adds a traversal of the AST after Sema of a function that diagnoses unguarded references to declarations that are partially available (based on availability attributes). This traversal is only done when we would otherwise emit -Wpartial-availability. This commit is part of a feature I proposed here: http://lists.llvm.org/pipermail/cfe-dev/2016-July/049851.html Differential revision: https://reviews.llvm.org/D23003 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278826 91177308-0d34-0410-b5e6-96231b3b80d8
* P0305R0: Semantic analysis and code generation for C++17 init-statement for ↵Richard Smith2016-07-141-3/+6
| | | | | | | | | | | 'if' and 'switch': if (stmt; condition) { ... } Patch by Anton Bikineev! Some minor formatting and comment tweets by me. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275350 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement p0292r2 (constexpr if), a likely C++1z feature.Richard Smith2016-06-231-4/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273602 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid O(n^2) string analysis when handling GNU __asm__ statements.Richard Smith2016-05-161-8/+15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269716 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for LLVM function name change.Rui Ueyama2016-01-141-4/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257802 91177308-0d34-0410-b5e6-96231b3b80d8
* [ptr-traits] Move methods manipulating PointerUnions, DenseMap pointerChandler Carruth2015-12-301-0/+34
| | | | | | | | | | | | | | | keys, and PointerIntPairs where the pointee types are incomplete out-of-line to where we have the complete type. This is the standard pattern used throughout the AST library to address the inherently mutually cross referenced nature of the AST. This is part of a series of patches to allow LLVM to check for complete pointee types when computing its pointer traits. This is absolutely necessary to get correct (or reproducible) results for things like how many low bits are guaranteed to be zero. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256612 91177308-0d34-0410-b5e6-96231b3b80d8
* Use std::copy and std::transform instead of manual loops. NFCCraig Topper2015-12-051-17/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254845 91177308-0d34-0410-b5e6-96231b3b80d8
* [AST] ArrayRef-ize CompoundStmt::setStmts.Craig Topper2015-12-041-6/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254703 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenMP] Update target directive codegen to use 4.5 implicit data mappings.Samuel Antao2015-12-021-0/+27
| | | | | | | | | | | | | | | Summary: This patch implements the 4.5 specification for the implicit data maps. OpenMP 4.5 specification changes the default way data is captured into a target region. All the non-aggregate kinds are passed by value by default. This required activating the capturing by value during SEMA for the target region. All the non-aggregate values that can be encoded in the size of a pointer are properly casted and forwarded to the runtime library. On top of fixing the previous weird behavior for mapping pointers in nested data regions (an explicit map was always required), this also improves performance as the number of allocations/transactions to the device per non-aggregate map are reduced from two to only one - instead of passing a reference and the value, only the value passed. Explicit maps will be added later on once firstprivate, private, and map clauses' SEMA and parsing are available. Reviewers: hfinkel, rjmccall, ABataev Subscribers: cfe-commits, carlo.bertolli Differential Revision: http://reviews.llvm.org/D14940 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254521 91177308-0d34-0410-b5e6-96231b3b80d8
* Move functions declared in Stmt{ObjC,CXX}.h and OpenMPClause.h intoJames Y Knight2015-10-021-1258/+0
| | | | | | | | | | | their associated .cpp file. Previous refactorings long long ago had split out the above categories of classes from Stmt.h into their own header files, but failed to also split the Stmt.cpp implementation file similarly. Do so for readability's sake. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249131 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP 4.1] Add 'threads' clause for '#pragma omp ordered'.Alexey Bataev2015-09-251-6/+12
| | | | | | | | | OpenMP 4.1 extends format of '#pragma omp ordered'. It adds 3 additional clauses: 'threads', 'simd' and 'depend'. If no clause is specified, the ordered construct behaves as if the threads clause had been specified. If the threads clause is specified, the threads in the team executing the loop region execute ordered regions sequentially in the order of the loop iterations. The loop region to which an ordered region without any clause or with a threads clause binds must have an ordered clause without the parameter specified on the corresponding loop directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248569 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP 4.0] Add 'if' clause for 'cancel' directive.Alexey Bataev2015-09-181-6/+11
| | | | | | | Add parsing, sema analysis and codegen for 'if' clause in 'cancel' directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247976 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Emit __kmpc_cancel_barrier() and code for 'cancellation point' only ↵Alexey Bataev2015-09-151-15/+19
| | | | | | | | | | | | | | | if 'cancel' is found. Patch improves codegen for OpenMP constructs. If the OpenMP region does not have internal 'cancel' construct, a call to 'void __kmpc_barrier()' runtime function is generated for all implicit/explicit barriers. If the region has inner 'cancel' directive, then ``` if (__kmpc_cancel_barrier()) exit from outer construct; ``` code is generated. Also, the code for 'canellation point' directive is not generated if parent directive does not have 'cancel' directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247681 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenMP] Make the filetered clause iterator a real iterator and type safe.Benjamin Kramer2015-08-301-12/+0
| | | | | | | | | This replaces the filtered generic iterator with a type-specfic one based on dyn_cast instead of comparing the kind enum. This allows us to use range-based for loops and eliminates casts. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246384 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP 4.0] Initial support for array sections.Alexey Bataev2015-08-251-0/+1
| | | | | | | | | Adds parsing/sema analysis/serialization/deserialization for array sections in OpenMP constructs (introduced in OpenMP 4.0). Currently it is allowed to use array sections only in OpenMP clauses that accepts list of expressions. Differential Revision: http://reviews.llvm.org/D10732 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245937 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP 4.1] Initial support for modifiers in 'linear' clause.Alexey Bataev2015-08-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | OpenMP 4.1 adds 3 optional modifiers to 'linear' clause. Format of 'linear' clause has changed to: ``` linear(linear-list[ : linear-step]) ``` where linear-list is one of the following ``` list modifier(list) ``` where modifier is one of the following: ``` ref (C++) val (C/C++) uval (C++) ``` Patch adds parsing and sema analysis for these modifiers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245550 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP 4.1] Allow variables with reference types in private clauses.Alexey Bataev2015-08-181-8/+14
| | | | | | | OpenMP 4.1 allows to use variables with reference types in all private clauses (private, firstprivate, lastprivate, linear etc.). Patch allows to use such variables and fixes codegen for linear variables with reference types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245268 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Fix for http://llvm.org/PR24371: Assert failure compiling blender 2.75.Alexey Bataev2015-08-141-0/+11
| | | | | | | | blender uses statements expression in condition of the loop under control of the '#pragma omp parallel for'. This condition is used several times in different expressions required for codegen of the loop directive. If there are some variables defined in statement expression, it fires an assert during codegen because of redefinition of the same variables. We have to rebuild several expression to be sure that all variables are unique. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245041 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP 4.1] Allow references in init expression for loop-based constructs.Alexey Bataev2015-08-061-0/+12
| | | | | | | OpenMP 4.1 allows to use variables with reference types in private clauses and, therefore, in init expressions of the cannonical loop forms. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244209 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTContext] Add a templated convenience wrapper for Allocate.Benjamin Kramer2015-08-041-1/+1
| | | | | | | | | This brings ASTContext closer to LLVM's Allocator concept. Ideally we would just derive ASTContext from llvm::AllocatorBase, but that does not work because ASTContext's allocator is mutable and we allocate using const ASTContext& everywhere. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243972 91177308-0d34-0410-b5e6-96231b3b80d8
* [AST] Use StringRef's convenient copy method. No functionality change.Benjamin Kramer2015-08-041-6/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243966 91177308-0d34-0410-b5e6-96231b3b80d8
* [UB] When attaching empty strings to the AST, use an empty StringRefChandler Carruth2015-08-041-0/+2
| | | | | | | | rather than forcing the bump pointer allocator to produce a viable pointer. This also fixes UB when we would try to memcpy from the null incoming StringRef. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243947 91177308-0d34-0410-b5e6-96231b3b80d8
* Commit for http://reviews.llvm.org/D10765Michael Wong2015-07-211-0/+24
| | | | | | | for OpenMP 4 target data directive parsing and sema. This commit is on behalf of Kelvin Li. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242785 91177308-0d34-0410-b5e6-96231b3b80d8
* [AST] Remove StmtRange in favor of an iterator_range.Benjamin Kramer2015-07-181-1/+1
| | | | | | | | | StmtRange was just a convenient wrapper for two StmtIterators before we had real range support. This removes some of the implicit conversions StmtRange had leading to slightly more verbose code but also should make more obvious what's going on. No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242615 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix alignment issues in Clang.James Y Knight2015-07-171-3/+2
| | | | | | | | | | | | | | | | | Some const-correctness changes snuck in here too, since they were in the area of code I was modifying. This seems to make Clang actually work without Bus Error on 32bit-sparc. Follow-up patches will factor out a trailing-object helper class, to make classes using the idiom of appending objects to other objects easier to understand, and to ensure (with static_assert) that required alignment guarantees continue to hold. Differential Revision: http://reviews.llvm.org/D10272 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242554 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP 4.0] Initial support for 'omp cancel' construct.Alexey Bataev2015-07-021-0/+20
| | | | | | | Implemented parsing/sema analysis + (de)serialization. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241253 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP 4.0] Initial support for 'omp cancellation point' construct.Alexey Bataev2015-07-011-0/+20
| | | | | | | Add parsing and sema analysis for 'omp cancellation point' directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241145 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Initial support for 'depend' clause (4.0).Alexey Bataev2015-06-231-0/+24
| | | | | | | Parsing and sema analysis (without support for array sections in arguments) for 'depend' clause (used in 'task' directive, OpenMP 4.0). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240409 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240353 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-2/+2
| | | | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240270 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Support for '#pragma omp taskgroup' directive.Alexey Bataev2015-06-181-1/+22
| | | | | | | | | | | | | | Added parsing, sema analysis and codegen for '#pragma omp taskgroup' directive (OpenMP 4.0). The code for directive is generated the following way: #pragma omp taskgroup <body> void __kmpc_taskgroup(<loc>, thread_id); <body> void __kmpc_end_taskgroup(<loc>, thread_id); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240011 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Remove last iteration separation for loop-based constructs.Alexey Bataev2015-06-161-5/+5
| | | | | | | Previously the last iteration for simd loop-based OpenMP constructs were generated as a separate code. This feature is not required and codegen is simplified. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239810 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer2015-05-291-2/+2
| | | | | | | | | | | | | | | | | | | | If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238601 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Simplified iteration over clauses, NFC.Alexey Bataev2015-04-271-4/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235838 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Codegen for 'copyin' clause in 'parallel' directive.Alexey Bataev2015-04-161-7/+31
| | | | | | | | | | | | | | | | Emits the following code for the clause at the beginning of the outlined function for implicit threads: if (<not a master thread>) { ... <thread local copy of var> = <master thread local copy of var>; ... } <sync point>; Checking for a non-master thread is performed by comparing of the address of the thread local variable with the address of the master's variable. Master thread always uses original variables, so you always know the address of the variable in the master thread. Differential Revision: http://reviews.llvm.org/D9026 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235075 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Codegen for 'lastprivate' clause in 'for' directive.Alexey Bataev2015-04-161-7/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | #pragma omp for lastprivate(<var>) for (i = a; i < b; ++b) <BODY>; This construct is translated into something like: <last_iter> = alloca i32 <lastprivate_var> = alloca <type> <last_iter> = 0 ; No initializer for simple variables or a default constructor is called for objects. ; For arrays perform element by element initialization by the call of the default constructor. ... OMP_FOR_START(...,<last_iter>, ..); sets <last_iter> to 1 if this is the last iteration. <BODY> ... OMP_FOR_END if (<last_iter> != 0) { <var> = <lastprivate_var> ; Update original variable with the lastprivate value. } call __kmpc_cancel_barrier() ; an implicit barrier to avoid possible data race. Differential Revision: http://reviews.llvm.org/D8658 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235074 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Codegen for 'reduction' clause in 'parallel' directive.Alexey Bataev2015-04-101-3/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Emit a code for reduction clause. Next code should be emitted for reductions: static kmp_critical_name lock = { 0 }; void reduce_func(void *lhs[<n>], void *rhs[<n>]) { ... *(Type<i> *)lhs[i] = RedOp<i>(*(Type<i> *)lhs[i], *(Type<i> *)rhs[i]); ... } ... void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n> - 1]}; switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) { case 1: ... <LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]); ... __kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>); break; case 2: ... Atomic(<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i])); ... break; default: ; } Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation. Differential Revision: http://reviews.llvm.org/D8915 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234583 91177308-0d34-0410-b5e6-96231b3b80d8
* [ast] Put the Stmt hierarchy on a diet for 64 bit targets.Benjamin Kramer2015-04-021-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we would waste 32 bits on alignment, use LLVM_ALIGNAS to free that space for derived classes an place. Sadly still have to #ifdef out MSVC 2013 because it can't align based on a sizeof expr. No intended functionality change. New byte counts: sizeof(before) | sizeof(after) LabelStmt: 32 | LabelStmt: 24 SwitchStmt: 48 | SwitchStmt: 40 WhileStmt: 40 | WhileStmt: 32 DoStmt: 40 | DoStmt: 32 ForStmt: 64 | ForStmt: 56 ContinueStmt: 16 | ContinueStmt: 8 BreakStmt: 16 | BreakStmt: 8 ReturnStmt: 32 | ReturnStmt: 24 AsmStmt: 40 | AsmStmt: 32 GCCAsmStmt: 80 | GCCAsmStmt: 72 MSAsmStmt: 96 | MSAsmStmt: 88 SEHExceptStmt: 32 | SEHExceptStmt: 24 SEHFinallyStmt: 24 | SEHFinallyStmt: 16 SEHLeaveStmt: 16 | SEHLeaveStmt: 8 CapturedStmt: 32 | CapturedStmt: 24 CXXCatchStmt: 32 | CXXCatchStmt: 24 CXXForRangeStmt: 72 | CXXForRangeStmt: 64 ObjCAtFinallyStmt: 24 | ObjCAtFinallyStmt: 16 ObjCAtSynchronizedStmt: 32 | ObjCAtSynchronizedStmt: 24 ObjCAtThrowStmt: 24 | ObjCAtThrowStmt: 16 ObjCAutoreleasePoolStmt: 24 | ObjCAutoreleasePoolStmt: 16 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233921 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Sema analysis for 'atomic capture' construct.Alexey Bataev2015-04-011-5/+5
| | | | | | | Added sema checks for forms of expressions/statements allowed under control of 'atomic capture' directive + generation of helper objects for future codegen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233785 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Codegen for 'atomic update' construct.Alexey Bataev2015-03-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds atomic update codegen for the following forms of expressions: x binop= expr; x++; ++x; x--; --x; x = x binop expr; x = expr binop x; If x and expr are integer and binop is associative or x is a LHS in a RHS of the assignment expression, and atomics are allowed for type of x on the target platform atomicrmw instruction is emitted. Otherwise compare-and-swap sequence is emitted: bb: ... atomic load <x> cont: <expected> = phi [ <x>, label %bb ], [ <new_failed>, %cont ] <desired> = <expected> binop <expr> <res> = cmpxchg atomic &<x>, desired, expected <new_failed> = <res>.field1; br <res>field2, label %exit, label %cont exit: ... Differential Revision: http://reviews.llvm.org/D8536 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233513 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Codegen for 'copyprivate' clause ('single' directive).Alexey Bataev2015-03-231-7/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If there is at least one 'copyprivate' clause is associated with the single directive, the following code is generated: ``` i32 did_it = 0; \\ for 'copyprivate' clause if(__kmpc_single(ident_t *, gtid)) { SingleOpGen(); __kmpc_end_single(ident_t *, gtid); did_it = 1; \\ for 'copyprivate' clause } <copyprivate_list>[0] = &var0; ... <copyprivate_list>[n] = &varn; call __kmpc_copyprivate(ident_t *, gtid, <copyprivate_list_size>, <copyprivate_list>, <copy_func>, did_it); ... void<copy_func>(void *LHSArg, void *RHSArg) { Dst = (void * [n])(LHSArg); Src = (void * [n])(RHSArg); Dst[0] = Src[0]; ... Dst[n] = Src[n]; } ``` All list items from all 'copyprivate' clauses are gathered into single <copyprivate list> (<copyprivate_list_size> is a size in bytes of this list) and <copy_func> is used to propagate values of private or threadprivate variables from the 'single' region to other implicit threads from outer 'parallel' region. Differential Revision: http://reviews.llvm.org/D8410 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232932 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] CodeGen of the 'linear' clause for the 'omp simd' directive.Alexander Musman2015-03-211-8/+37
| | | | | | | | | | | The linear variable is privatized (similar to 'private') and its value on current iteration is calculated, similar to the loop counter variables. Differential revision: http://reviews.llvm.org/D8375 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232890 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Additional sema analysis for 'omp atomic[ update]'.Alexey Bataev2015-03-131-3/+6
| | | | | | | Adds additional semantic analysis + generation of helper expressions for proper codegen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232164 91177308-0d34-0410-b5e6-96231b3b80d8
* Various fixes to mangling of list-initialization.Richard Smith2015-02-051-2/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228274 91177308-0d34-0410-b5e6-96231b3b80d8
* First patch with codegen of the 'omp for' directive. It implementsAlexander Musman2014-12-151-91/+115
| | | | | | | | | | | | | | | | | the simplest case, which is used when no chunk_size is specified in the schedule(static) or no 'schedule' clause is specified - the iteration space is divided by the library into chunks that are approximately equal in size, and at most one chunk is distributed to each thread. In this case, we do not need an outer loop in each thread - each thread requests once which iterations range it should handle (using __kmpc_for_static_init runtime call) and then runs the inner loop on this range. Differential Revision: http://reviews.llvm.org/D5865 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224233 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Additional processing of 'omp atomic read' directive.Alexey Bataev2014-11-181-8/+10
| | | | | | | According to OpenMP standard, Section 2.12.6, atomic Construct, '#pragma omp atomic read' is allowed to be used only for expression statements of form 'v = x;', where x and v (as applicable) are both l-value expressions with scalar type. Patch adds checks for it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222231 91177308-0d34-0410-b5e6-96231b3b80d8