22#include "llvm/Support/SaveAndRestore.h"
36 "Attempt to emit a SYCL kernel call statement during device "
58 : builder.getUnknownLoc()};
60 mlir::Location fusedLoc =
getLoc(bodyRange);
61 mlir::Block *entryBB = funcOp.addEntryBlock();
70 if (mlir::failed(funcOp.verifyBody()))
81 "SYCL kernel caller offload entry point functions can only be emitted"
82 " during device compilation");
84 const auto *kernelEntryPointAttr =
85 kernelEntryPointFn->
getAttr<SYCLKernelEntryPointAttr>();
86 assert(kernelEntryPointAttr &&
"Missing sycl_kernel_entry_point attribute");
87 assert(!kernelEntryPointAttr->isInvalidAttr() &&
88 "sycl_kernel_entry_point attribute is invalid");
116 funcOp.setLinkage(cir::GlobalLinkageKind::ExternalLinkage);
137 mlir::OpBuilder::InsertionGuard guard(builder);
141 setDSOLocal(
static_cast<mlir::Operation *
>(funcOp));
Defines the clang::ASTContext interface.
This file declares types used to describe SYCL kernels.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
static CanQualType getCanonicalType(QualType T)
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
const LangOptions & getLangOpts() const
const SYCLKernelInfo & getSYCLKernelInfo(QualType T) const
Given a type used as a SYCL kernel name, returns a reference to the metadata generated from the corre...
clang::GlobalDecl curGD
The GlobalDecl for the current function being compiled or the global variable currently being initial...
const clang::LangOptions & getLangOpts() const
mlir::Location getLoc(clang::SourceLocation srcLoc)
Helpers to convert Clang's SourceLocation to a MLIR Location.
llvm::ScopedHashTableScope< const clang::Decl *, mlir::Value > SymTableScopeTy
void finishFunction(SourceLocation endLoc)
mlir::LogicalResult emitFunctionBody(const clang::Stmt *body)
void startFunction(clang::GlobalDecl gd, clang::QualType returnType, cir::FuncOp fn, cir::FuncType funcType, FunctionArgList args, clang::SourceLocation loc, clang::SourceLocation startLoc)
Emit code for the start of a function.
static void eraseEmptyAndUnusedBlocks(cir::FuncOp func)
Remove leftover empty and unreachable blocks from an emitted function.
clang::ASTContext & getContext() const
void emitSYCLKernelCaller(const clang::OutlinedFunctionDecl *outlinedFnDecl, cir::FuncOp funcOp, cir::FuncType funcType, FunctionArgList &args)
mlir::LogicalResult emitStmt(const clang::Stmt *s, bool useCurrentScope, llvm::ArrayRef< const Attr * > attrs={})
mlir::LogicalResult emitSYCLKernelCallStmt(const SYCLKernelCallStmt &s)
void setDSOLocal(mlir::Operation *op) const
void setCIRFunctionAttributes(GlobalDecl gd, const CIRGenFunctionInfo &info, cir::FuncOp func, bool isThunk)
Set the CIR function attributes (Sext, zext, etc).
cir::FuncOp createCIRFunction(mlir::Location loc, llvm::StringRef name, cir::FuncType funcType, const clang::FunctionDecl *funcDecl)
const TargetCIRGenInfo & getTargetCIRGenInfo()
mlir::Location getLoc(clang::SourceLocation cLoc)
Helpers to convert the presumed location of Clang's SourceLocation to an MLIR Location.
void emitSYCLKernelCaller(const clang::FunctionDecl *kernelEntryPointFn, clang::ASTContext &ctx)
Emit the SYCL kernel caller offload entry point function generated for a function declared with the s...
void setCIRFunctionAttributesForDefinition(const clang::FunctionDecl *fd, cir::FuncOp f)
Set extra attributes (inline, etc.) for a function.
cir::FuncType getFunctionType(const CIRGenFunctionInfo &info)
Get the CIR function type for.
const CIRGenFunctionInfo & arrangeDeviceKernelCallerDeclaration(clang::QualType resultType, const FunctionArgList &args)
Arrange the function info for a device kernel caller entry point (e.g.
Type for representing both the decl and type of parameters to a function.
SourceLocation getLocation() const
Represents a function declaration or definition.
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
GlobalDecl - represents a global declaration.
Represents a partial function definition.
parameter_const_iterator param_end() const
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
parameter_const_iterator param_begin() const
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
OutlinedFunctionDecl * getOutlinedFunctionDecl()
Stmt * getKernelLaunchStmt()
const std::string & GetKernelName() const
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getBegin() const
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Top level wrappers for InstallAPI frontend operations.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
U cast(CodeGen::Address addr)
static bool opFuncExtraAttrs()
static bool setLLVMFunctionFEnvAttributes()
Represents a scope, including function bodies, compound statements, and the substatements of if/while...