================
@@ -124,10 +156,83 @@ RValue CIRGenFunction::emitCoroutineFrame() {
if (curCoro.data && curCoro.data->coroBegin) {
return RValue::get(curCoro.data->coroBegin);
}
+
+ if (curAwaitSuspendWrapper.framePtr)
+ return RValue::get(curAwaitSuspendWrapper.framePtr);
+
cgm.errorNYI("NYI");
return RValue();
}
+cir::FuncOp
+CIRGenFunction::generateAwaitSuspendWrapper(llvm::StringRef coroutineName,
+ llvm::StringRef suspendPointName,
+ const CoroutineSuspendExpr &s) {
+ llvm::SmallString<128> functionName(coroutineName);
+ functionName += ".__await_suspend_wrapper__";
+ functionName += suspendPointName;
+
+ ASTContext &context = getContext();
+
+ auto *awaiterDecl = ImplicitParamDecl::Create(context, context.VoidPtrTy,
+ ImplicitParamKind::Other);
+ auto *frameDecl = ImplicitParamDecl::Create(context, context.VoidPtrTy,
+ ImplicitParamKind::Other);
+
+ QualType returnTy = s.getSuspendExpr()->getType();
+
+ FunctionArgList args;
+ args.push_back(awaiterDecl);
+ args.push_back(frameDecl);
+
+ const CIRGenFunctionInfo &functionInfo =
+ cgm.getTypes().arrangeBuiltinFunctionDeclaration(returnTy, args);
+
+ cir::FuncType functionType = cgm.getTypes().getFunctionType(functionInfo);
+
+ cir::FuncOp function =
+ cgm.createCIRFunction(getLoc(s.getSourceRange()), functionName,
+ functionType, /*funcDecl=*/nullptr);
+
+ function.setLinkage(cir::GlobalLinkageKind::InternalLinkage);
----------------
xakep8 wrote:
done
https://github.com/llvm/llvm-project/pull/240737
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits