[clang] [OpenMP] Allow GPUs to be targeted directly via `-fopenmp`. (PR #122149)

Shilei Tian via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 9 09:02:27 PST 2025


================
@@ -1312,6 +1309,19 @@ void CGOpenMPRuntimeGPU::emitBarrierCall(CodeGenFunction &CGF,
                       Args);
 }
 
+void CGOpenMPRuntimeGPU::emitTargetCall(
+    CodeGenFunction &CGF, const OMPExecutableDirective &D,
+    llvm::Function *OutlinedFn, llvm::Value *OutlinedFnID, const Expr *IfCond,
+    llvm::PointerIntPair<const Expr *, 2, OpenMPDeviceClauseModifier> Device,
+    llvm::function_ref<llvm::Value *(CodeGenFunction &CGF,
+                                     const OMPLoopDirective &D)>
+        SizeEmitter) {
+  SmallString<256> Buffer;
+  llvm::raw_svector_ostream Out(Buffer);
+  Out << "Cannot emit a '#pragma omp target' on the GPU";
----------------
shiltian wrote:

Should this be a Sema or CodeGen error?

https://github.com/llvm/llvm-project/pull/122149


More information about the cfe-commits mailing list