[clang] [SYCL] Basic code generation for SYCL kernel caller offload entry point functions. (PR #133030)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 10 06:58:06 PDT 2025
================
@@ -0,0 +1,73 @@
+//===--------- CodeGenSYCL.cpp - Code for SYCL kernel generation ----------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This contains code required for generation of SYCL kernel caller offload
+// entry point functions.
+//
+//===----------------------------------------------------------------------===//
+
+#include "CodeGenFunction.h"
+#include "CodeGenModule.h"
+
+using namespace clang;
+using namespace CodeGen;
+
+static void SetSYCLKernelAttributes(llvm::Function *Fn, CodeGenFunction &CGF) {
+ // SYCL 2020 device language restrictions require forward progress and
+ // disallow recursion.
+ Fn->setDoesNotRecurse();
+ if (CGF.checkIfFunctionMustProgress())
+ Fn->addFnAttr(llvm::Attribute::MustProgress);
+}
+
+void CodeGenModule::EmitSYCLKernelCaller(const FunctionDecl *KernelEntryPointFn,
+ ASTContext &Ctx) {
+ assert(Ctx.getLangOpts().SYCLIsDevice &&
+ "SYCL kernel caller offload entry point functions can only be emitted"
+ " during device compilation");
+
+ const auto *KernelEntryPointAttr =
+ KernelEntryPointFn->getAttr<SYCLKernelEntryPointAttr>();
----------------
erichkeane wrote:
Got it, thanks!
https://github.com/llvm/llvm-project/pull/133030
More information about the cfe-commits
mailing list