14#include "mlir/Support/LLVM.h"
35 assert(!
curCoro.
data &&
"EmitCoroutineBodyStatement called twice?");
42 mlir::Value nullPtr) {
43 cir::IntType int32Ty = builder.getUInt32Ty();
48 mlir::Operation *builtin =
cgm.getGlobalValue(
cgm.builtinCoroId);
52 fnOp =
cgm.createCIRBuiltinFunction(
53 loc,
cgm.builtinCoroId,
54 cir::FuncType::get({int32Ty, VoidPtrTy, VoidPtrTy, VoidPtrTy}, int32Ty),
56 assert(fnOp &&
"should always succeed");
61 return builder.createCallOp(loc, fnOp,
62 mlir::ValueRange{builder.getUInt32(newAlign, loc),
63 nullPtr, nullPtr, nullPtr});
68 mlir::Location openCurlyLoc =
getLoc(
s.getBeginLoc());
69 cir::ConstantOp nullPtrCst = builder.getNullPtr(
VoidPtrTy, openCurlyLoc);
71 auto fn = mlir::cast<cir::FuncOp>(
curFn);
72 fn.setCoroutine(
true);
81 return mlir::success();
static void createCoroData(CIRGenFunction &cgf, CIRGenFunction::CGCoroInfo &curCoro, cir::CallOp coroId)
__device__ __2f16 float __ockl_bool s
cir::CallOp emitCoroIDBuiltinCall(mlir::Location loc, mlir::Value nullPtr)
mlir::Location getLoc(clang::SourceLocation srcLoc)
Helpers to convert Clang's SourceLocation to a MLIR Location.
mlir::Operation * curFn
The current function or global initializer that is generated code for.
mlir::LogicalResult emitCoroutineBody(const CoroutineBodyStmt &s)
Represents the body of a coroutine.
Exposes information about the current target.
unsigned getNewAlign() const
Return the largest alignment for which a suitably-sized allocation with 'operator new(size_t)' is gua...
unsigned getCharWidth() const
Defines the clang::TargetInfo interface.
The JSON file list parser is used to communicate input to InstallAPI.
U cast(CodeGen::Address addr)
static bool coroAllocBuiltinCall()
static bool coroBeginBuiltinCall()
static bool generateDebugInfo()
std::unique_ptr< CGCoroData > data
cir::PointerType VoidPtrTy
void* in address space 0