diff options
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 15 | 
1 files changed, 14 insertions, 1 deletions
| diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 173b0dcba1c2..536c55ae4e18 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -375,6 +375,10 @@ void CodeGenModule::Release() {      if (llvm::Function *CudaDtorFunction = CUDARuntime->makeModuleDtorFunction())        AddGlobalDtor(CudaDtorFunction);    } +  if (OpenMPRuntime) +    if (llvm::Function *OpenMPRegistrationFunction = +            OpenMPRuntime->emitRegistrationFunction()) +      AddGlobalCtor(OpenMPRegistrationFunction, 0);    if (PGOReader) {      getModule().setMaximumFunctionCount(PGOReader->getMaximumFunctionCount());      if (PGOStats.hasDiagnostics()) @@ -770,7 +774,8 @@ void CodeGenModule::SetLLVMFunctionAttributes(const Decl *D,                                                llvm::Function *F) {    unsigned CallingConv;    AttributeListType AttributeList; -  ConstructAttributeList(Info, D, AttributeList, CallingConv, false); +  ConstructAttributeList(F->getName(), Info, D, AttributeList, CallingConv, +                         false);    F->setAttributes(llvm::AttributeSet::get(getLLVMContext(), AttributeList));    F->setCallingConv(static_cast<llvm::CallingConv::ID>(CallingConv));  } @@ -1490,6 +1495,11 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) {      }    } +  // If this is OpenMP device, check if it is legal to emit this global +  // normally. +  if (OpenMPRuntime && OpenMPRuntime->emitTargetGlobal(GD)) +    return; +    // Ignore declarations, they will be emitted on their first use.    if (const auto *FD = dyn_cast<FunctionDecl>(Global)) {      // Forward declarations are emitted lazily on first use. @@ -3596,6 +3606,9 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {      // File-scope asm is ignored during device-side CUDA compilation.      if (LangOpts.CUDA && LangOpts.CUDAIsDevice)        break; +    // File-scope asm is ignored during device-side OpenMP compilation. +    if (LangOpts.OpenMPIsDevice) +      break;      auto *AD = cast<FileScopeAsmDecl>(D);      getModule().appendModuleInlineAsm(AD->getAsmString()->getString());      break; | 
