clang 24.0.0git
CIRGenSYCL.cpp
Go to the documentation of this file.
1//===--------- CIRGenSYCL.cpp - Emit CIR for SYCL kernels -----------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This contains code required for the generation of SYCL kernel code.
10//
11//===----------------------------------------------------------------------===//
12
13#include "CIRGenFunction.h"
14
15#include "clang/AST/StmtSYCL.h"
16
17using namespace clang;
18using namespace clang::CIRGen;
19
20mlir::LogicalResult
22 // SYCLKernelCallStmt nodes are only present in the bodies of functions
23 // declared with the sycl_kernel_entry_point attribute. ODR-use of such a
24 // function in code emitted during device compilation should be diagnosed.
25 // During device compilation, the offload kernel entry point is emitted in
26 // place of such a function (see CIRGenModule::emitDeferred), so this
27 // function is only reached during host compilation.
28 assert(!getLangOpts().SYCLIsDevice &&
29 "Attempt to emit a SYCL kernel call statement during device "
30 "compilation");
31
32 // During host compilation, the kernel launch statement is emitted in place
33 // of the original function body.
34 return emitStmt(s.getKernelLaunchStmt(), /*useCurrentScope=*/true);
35}
This file defines SYCL AST classes used to represent calls to SYCL kernels.
const clang::LangOptions & getLangOpts() const
mlir::LogicalResult emitStmt(const clang::Stmt *s, bool useCurrentScope, llvm::ArrayRef< const Attr * > attrs={})
mlir::LogicalResult emitSYCLKernelCallStmt(const SYCLKernelCallStmt &s)
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Definition StmtSYCL.h:36
The JSON file list parser is used to communicate input to InstallAPI.