[PATCH] D16784: [OpenMP] Reorganize code to allow specialized code generation for different devices.
Samuel Antao via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 3 22:26:19 PST 2016
sfantao added a comment.
Hi Alexey,
Thanks for the feedback!
================
Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:340-341
@@ +339,4 @@
+ case llvm::Triple::nvptx64:
+ assert(CGM.getLangOpts().OpenMPIsDevice &&
+ "OpenMP NVPTX is only prepared to deal with device code.");
+ return createCGOpenMPRuntimeNVPTX(CGM);
----------------
ABataev wrote:
> I think it is better to reorganize this code like that:
> ```
> switch (CGM.getTarget().getTriple().getArch()) {
> case llvm::Triple::nvptx:
> case llvm::Triple::nvptx64:
> assert(CGM.getLangOpts().OpenMPIsDevice &&
> "OpenMP NVPTX is only prepared to deal with device code.");
> return new CGOpenMPRuntimeNVPTX(CGM);
> default:
> break;
> }
> return new CGOpenMPRuntime(CGM);
> ```
Ok, will do.
================
Comment at: lib/CodeGen/CGOpenMPRuntime.h:552-555
@@ -551,2 +551,6 @@
+ /// \brief Create specialized OpenMP runtime code generation class for NVPTX
+ /// targets.
+ static CGOpenMPRuntime *createCGOpenMPRuntimeNVPTX(CodeGenModule &CGM);
+
public:
----------------
ABataev wrote:
> Do you really need this function? Currently, I don't see a point in adding this platform-specific thing to (mostly) common interface
I am using that function to avoid exposing the constructor of `CGOpenMPRuntimeNVPTX ` in CGOpenMPRuntime.h. Do you prefer me to do that instead?
http://reviews.llvm.org/D16784
More information about the cfe-commits
mailing list