diff options
author | Samuel Antao <sfantao@us.ibm.com> | 2016-02-08 15:59:20 +0000 |
---|---|---|
committer | Samuel Antao <sfantao@us.ibm.com> | 2016-02-08 15:59:20 +0000 |
commit | 45bfe4cc8a07cec3c635da9355c30537f2bfde3b (patch) | |
tree | 4b6122771ab9b7c457112788738017eb6734c2c6 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 7a7614757c7b05eaa341d5156f1b275c85532bbb (diff) | |
download | llvm-45bfe4cc8a07cec3c635da9355c30537f2bfde3b.zip llvm-45bfe4cc8a07cec3c635da9355c30537f2bfde3b.tar.gz llvm-45bfe4cc8a07cec3c635da9355c30537f2bfde3b.tar.bz2 |
Re-apply for the 2nd-time r259977 - [OpenMP] Reorganize code to allow specialized code generation for different devices.
This was reverted by r260036, but was not the cause of the problem in the buildbot.
llvm-svn: 260106
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index a30e624..aabcc52 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -20,6 +20,7 @@ #include "CGObjCRuntime.h" #include "CGOpenCLRuntime.h" #include "CGOpenMPRuntime.h" +#include "CGOpenMPRuntimeNVPTX.h" #include "CodeGenFunction.h" #include "CodeGenPGO.h" #include "CodeGenTBAA.h" @@ -200,7 +201,20 @@ void CodeGenModule::createOpenCLRuntime() { } void CodeGenModule::createOpenMPRuntime() { - OpenMPRuntime = new CGOpenMPRuntime(*this); + // Select a specialized code generation class based on the target, if any. + // If it does not exist use the default implementation. + switch (getTarget().getTriple().getArch()) { + + case llvm::Triple::nvptx: + case llvm::Triple::nvptx64: + assert(getLangOpts().OpenMPIsDevice && + "OpenMP NVPTX is only prepared to deal with device code."); + OpenMPRuntime = new CGOpenMPRuntimeNVPTX(*this); + break; + default: + OpenMPRuntime = new CGOpenMPRuntime(*this); + break; + } } void CodeGenModule::createCUDARuntime() { |