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/lib/Serialization/ASTReaderDecl.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/lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index b5a447d197d..0fbbf18c23b 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -2274,7 +2274,8 @@ static bool isConsumerInterestedIn(Decl *D, bool HasBody) { if (isa<FileScopeAsmDecl>(D) || isa<ObjCProtocolDecl>(D) || isa<ObjCImplDecl>(D) || - isa<ImportDecl>(D)) + isa<ImportDecl>(D) || + isa<OMPThreadPrivateDecl>(D)) return true; if (VarDecl *Var = dyn_cast<VarDecl>(D)) return Var->isFileVarDecl() && @@ -3686,6 +3687,10 @@ void ASTDeclReader::UpdateDecl(Decl *D, ModuleFile &ModuleFile, case UPD_STATIC_LOCAL_NUMBER: Reader.Context.setStaticLocalNumber(cast<VarDecl>(D), Record[Idx++]); break; + case UPD_DECL_MARKED_OPENMP_THREADPRIVATE: + D->addAttr(OMPThreadPrivateDeclAttr::CreateImplicit( + Reader.Context, ReadSourceRange(Record, Idx))); + break; } } } |