[clang] [SYCL] Basic code generation for SYCL kernel caller offload entry point functions. (PR #133030)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 26 10:28:03 PDT 2025
================
@@ -3303,6 +3303,27 @@ void CodeGenModule::EmitDeferred() {
CurDeclsToEmit.swap(DeferredDeclsToEmit);
for (GlobalDecl &D : CurDeclsToEmit) {
+ // Functions declared with the sycl_kernel_entry_point attribute are
+ // emitted normally during host compilation. During device compilation,
+ // a SYCL kernel caller offload entry point function is generated and
+ // emitted in place of each of these functions.
+ if (const auto *FD = D.getDecl()->getAsFunction()) {
+ if (LangOpts.SYCLIsDevice && FD->hasAttr<SYCLKernelEntryPointAttr>() &&
+ FD->isDefined()) {
+ // Functions with an invalid sycl_kernel_entry_point attribute are
+ // ignored during device compilation.
+ if (!FD->getAttr<SYCLKernelEntryPointAttr>()->isInvalidAttr()) {
----------------
Fznamznon wrote:
Can we simply drop the attribute if it is invalid when checking its validity?
https://github.com/llvm/llvm-project/pull/133030
More information about the cfe-commits
mailing list