summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorSamuel Antao <sfantao@us.ibm.com>2016-02-06 06:52:48 +0000
committerSamuel Antao <sfantao@us.ibm.com>2016-02-06 06:52:48 +0000
commit0572837eff1648aa238c469405978712ce243066 (patch)
treec59eec1929684696cdf12cd5383931751be5da77 /clang/lib/CodeGen/CodeGenModule.cpp
parent0a1eaf802534eaa15891be1c02c68a203f61c147 (diff)
downloadbcm5719-llvm-0572837eff1648aa238c469405978712ce243066.tar.gz
bcm5719-llvm-0572837eff1648aa238c469405978712ce243066.zip
Re-apply r259977 - [OpenMP] Reorganize code to allow specialized code generation for different devices.
This was reverted due to a failure in a buildbot, but it turned out the failure was unrelated. llvm-svn: 259985
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index a30e62499fa..aabcc524c93 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() {
OpenPOWER on IntegriCloud