]> granicus.if.org Git - clang/commit
[OPENMP] Codegen for 'copyprivate' clause ('single' directive).
authorAlexey Bataev <a.bataev@hotmail.com>
Mon, 23 Mar 2015 06:18:07 +0000 (06:18 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Mon, 23 Mar 2015 06:18:07 +0000 (06:18 +0000)
commit2cbcae88af6f21d84b24b0cadda9aba484a15900
tree343de0088277f5d38266bf33d135cbaf7268eee1
parent2cda1f6f19fb4fbe758a9e9f752aa9dbe3ab469c
[OPENMP] Codegen for 'copyprivate' clause ('single' directive).

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
15 files changed:
include/clang/AST/DataRecursiveASTVisitor.h
include/clang/AST/OpenMPClause.h
include/clang/AST/RecursiveASTVisitor.h
lib/AST/Stmt.cpp
lib/AST/StmtProfile.cpp
lib/CodeGen/CGOpenMPRuntime.cpp
lib/CodeGen/CGOpenMPRuntime.h
lib/CodeGen/CGStmtOpenMP.cpp
lib/CodeGen/CodeGenFunction.h
lib/Sema/SemaOpenMP.cpp
lib/Serialization/ASTReaderStmt.cpp
lib/Serialization/ASTWriterStmt.cpp
test/OpenMP/single_codegen.cpp
test/OpenMP/single_copyprivate_messages.cpp
tools/libclang/CIndex.cpp