[PATCH] D18286: [OPENMP] private and firstprivate clauses of teams code generation for nvptx

Jonas Hahnfeld via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 24 05:25:13 PDT 2016

Hahnfeld added inline comments.

Comment at: lib/CodeGen/CGStmtOpenMP.cpp:3074-3078
@@ +3073,7 @@
+  if (getLangOpts().OpenMPIsDevice && (
+      CGM.getTarget().getTriple().getArch() == llvm::Triple::nvptx ||
+      CGM.getTarget().getTriple().getArch() == llvm::Triple::nvptx64))
+    CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_teams, CodeGen);
+  else
+    emitCommonOMPTeamsDirective(*this, S, OMPD_teams, CodeGen);
This now duplicates logic from `CodeGenModule::createOpenMPRuntime` and has to be extended for every new triple in multiple places.

I would like to propose a new function like `virtual bool CGOpenMPRuntime::shouldEmitInlinedTeamsDirective` which defaults to `false` and can be overriden in `CGOpenMPRuntimeNVPTX`. This way we can later on easily reuse the logic for new device types and target triples.



More information about the cfe-commits mailing list