diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2014-11-11 04:05:39 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-11-11 04:05:39 +0000 |
commit | 9772000a2250e81654b97f8e54904a96a20c4a86 (patch) | |
tree | 881270747aa7216946f88c594a00a732009cd784 /clang/test/PCH/chain-openmp-threadprivate.cpp | |
parent | ea97e36dfc4b3203a7490844e12c2450a170584c (diff) | |
download | bcm5719-llvm-9772000a2250e81654b97f8e54904a96a20c4a86.tar.gz bcm5719-llvm-9772000a2250e81654b97f8e54904a96a20c4a86.zip |
[OPENMP] Codegen for threadprivate variables
For all threadprivate variables which have constructor/destructor emit call to void __kmpc_threadprivate_register(ident_t * <Current Location>, void *<Original Global Addr>, kmpc_ctor <Constructor>, kmpc_cctor NULL, kmpc_dtor <Destructor>);
In expressions all references to such variables are replaced by calls to void *__kmpc_threadprivate_cached(ident_t *<Current Location>, kmp_int32 <Current Thread Id>, void *<Original Global Addr>, size_t <Size of Data>, void ***<Pointer to autogenerated cache – array of private copies of threadprivate variable>);
Test test/OpenMP/threadprivate_codegen.cpp checks that codegen is correct. Also it checks that codegen is correct after serialization/deserialization and one of passes verifies debug info.
Differential Revision: http://reviews.llvm.org/D4002
llvm-svn: 221663
Diffstat (limited to 'clang/test/PCH/chain-openmp-threadprivate.cpp')
-rw-r--r-- | clang/test/PCH/chain-openmp-threadprivate.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/PCH/chain-openmp-threadprivate.cpp b/clang/test/PCH/chain-openmp-threadprivate.cpp new file mode 100644 index 00000000000..5187257b06e --- /dev/null +++ b/clang/test/PCH/chain-openmp-threadprivate.cpp @@ -0,0 +1,26 @@ +// no PCH +// RUN: %clang_cc1 -fopenmp=libiomp5 -emit-llvm -include %s -include %s %s -o - | FileCheck %s +// with PCH +// RUN: %clang_cc1 -fopenmp=libiomp5 -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s +#if !defined(PASS1) +#define PASS1 + +extern "C" int* malloc (int size); +int *a = malloc(20); + +#elif !defined(PASS2) +#define PASS2 + +#pragma omp threadprivate(a) + +#else + +// CHECK: call {{.*}} @__kmpc_threadprivate_register( + +// CHECK-LABEL: foo +int foo() { + return *a; + // CHECK: call {{.*}} @__kmpc_global_thread_num( + // CHECK: call {{.*}} @__kmpc_threadprivate_cached( +} +#endif |