diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2018-03-30 18:31:07 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2018-03-30 18:31:07 +0000 |
commit | 03f270c900e1f8563419fdd302683a9503e98722 (patch) | |
tree | 9da96a39200b5080cc79dc9b6e0fee4d76bb4cc8 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 399b46c98d638a9a6694091b2ba8c511052a3999 (diff) | |
download | bcm5719-llvm-03f270c900e1f8563419fdd302683a9503e98722.tar.gz bcm5719-llvm-03f270c900e1f8563419fdd302683a9503e98722.zip |
[OPENMP] Added emission of offloading data sections for declare target
variables.
Added emission of the offloading data sections for the variables within
declare target regions + fixes emission of the declare target variables
marked as declare target not within the declare target region.
llvm-svn: 328888
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 188648cecc9..dcdb0dbc142 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -408,13 +408,15 @@ void CodeGenModule::Release() { if (llvm::Function *CudaDtorFunction = CUDARuntime->makeModuleDtorFunction()) AddGlobalDtor(CudaDtorFunction); } - if (OpenMPRuntime) + if (OpenMPRuntime) { if (llvm::Function *OpenMPRegistrationFunction = OpenMPRuntime->emitRegistrationFunction()) { auto ComdatKey = OpenMPRegistrationFunction->hasComdat() ? OpenMPRegistrationFunction : nullptr; AddGlobalCtor(OpenMPRegistrationFunction, 0, ComdatKey); } + OpenMPRuntime->clear(); + } if (PGOReader) { getModule().setProfileSummary(PGOReader->getSummary().getMD(VMContext)); if (PGOStats.hasDiagnostics()) @@ -2693,6 +2695,9 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, if (D && !D->hasAttr<DLLImportAttr>() && !D->hasAttr<DLLExportAttr>()) Entry->setDLLStorageClass(llvm::GlobalValue::DefaultStorageClass); + if (LangOpts.OpenMP && !LangOpts.OpenMPSimd && D) + getOpenMPRuntime().registerTargetGlobalVariable(D, Entry); + if (Entry->getType() == Ty) return Entry; @@ -2761,6 +2766,9 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, // Handle things which are present even on external declarations. if (D) { + if (LangOpts.OpenMP && !LangOpts.OpenMPSimd) + getOpenMPRuntime().registerTargetGlobalVariable(D, GV); + // FIXME: This code is overly simple and should be merged with other global // handling. GV->setConstant(isTypeConstant(D->getType(), false)); |