28 "Attempt to emit a SYCL kernel call statement during device"
36 Fn->setDoesNotRecurse();
38 Fn->addFnAttr(llvm::Attribute::MustProgress);
41void CodeGenModule::EmitSYCLKernelCaller(
const FunctionDecl *KernelEntryPointFn,
44 "SYCL kernel caller offload entry point functions can only be emitted"
45 " during device compilation");
47 const auto *KernelEntryPointAttr =
48 KernelEntryPointFn->
getAttr<SYCLKernelEntryPointAttr>();
49 assert(KernelEntryPointAttr &&
"Missing sycl_kernel_entry_point attribute");
50 assert(!KernelEntryPointAttr->isInvalidAttr() &&
51 "sycl_kernel_entry_point attribute is invalid");
54 SYCLKernelCallStmt *KernelCallStmt =
59 const OutlinedFunctionDecl *OutlinedFnDecl =
64 const CGFunctionInfo &FnInfo =
72 auto *
Fn = llvm::Function::Create(FnTy, llvm::Function::ExternalLinkage,
76 CodeGenFunction CGF(*
this);
79 CGF.StartFunction(GlobalDecl(), Ctx.
VoidTy, Fn, FnInfo, Args,
80 SourceLocation(), SourceLocation());
81 CGF.EmitFunctionBody(OutlinedFnDecl->
getBody());
static void SetSYCLKernelAttributes(llvm::Function *Fn, CodeGenFunction &CGF)
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...
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
const LangOptions & getLangOpts() const
void EmitStmt(const Stmt *S, ArrayRef< const Attr * > Attrs={})
EmitStmt - Emit the code for the statement.
void EmitSYCLKernelCallStmt(const SYCLKernelCallStmt &S)
bool checkIfFunctionMustProgress()
Returns true if a function must make progress, which means the mustprogress attribute can be added.
void setDSOLocal(llvm::GlobalValue *GV) const
llvm::Module & getModule() const
CodeGenTypes & getTypes()
void SetLLVMFunctionAttributes(GlobalDecl GD, const CGFunctionInfo &Info, llvm::Function *F, bool IsThunk)
Set the LLVM function attributes (sext, zext, etc).
void SetLLVMFunctionAttributesForDefinition(const Decl *D, llvm::Function *F)
Set the LLVM function attributes which only apply to a function definition.
llvm::FunctionType * GetFunctionType(const CGFunctionInfo &Info)
GetFunctionType - Get the LLVM function type for.
const CGFunctionInfo & arrangeDeviceKernelCallerDeclaration(QualType resultType, const FunctionArgList &args)
A device kernel caller function is an offload device entry point function with a target device depend...
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
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
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
U cast(CodeGen::Address addr)