@@ -79,11 +79,15 @@ static Size getCoroutineContextSize(IRGenModule &IGM,
7979 switch (fnType->getCoroutineKind ()) {
8080 case SILCoroutineKind::None:
8181 llvm_unreachable (" expand a coroutine" );
82+ case SILCoroutineKind::YieldOnce2:
83+ if (IGM.IRGen .Opts .EmitYieldOnce2AsYieldOnce ) {
84+ LLVM_FALLTHROUGH;
85+ } else {
86+ llvm::report_fatal_error (
87+ " callee allocated coroutines do not have fixed-size buffers" );
88+ }
8289 case SILCoroutineKind::YieldOnce:
8390 return getYieldOnceCoroutineBufferSize (IGM);
84- case SILCoroutineKind::YieldOnce2:
85- llvm::report_fatal_error (
86- " callee allocated coroutines do not have fixed-size buffers" );
8791 case SILCoroutineKind::YieldMany:
8892 return getYieldManyCoroutineBufferSize (IGM);
8993 }
@@ -1811,8 +1815,13 @@ void SignatureExpansion::expandParameters(
18111815 // First, if this is a coroutine, add the coroutine-context parameter.
18121816 switch (FnType->getCoroutineKind ()) {
18131817 case SILCoroutineKind::None:
1814- case SILCoroutineKind::YieldOnce2:
18151818 break ;
1819+ case SILCoroutineKind::YieldOnce2:
1820+ if (IGM.IRGen .Opts .EmitYieldOnce2AsYieldOnce ) {
1821+ LLVM_FALLTHROUGH;
1822+ } else {
1823+ break ;
1824+ }
18161825
18171826 case SILCoroutineKind::YieldOnce:
18181827 case SILCoroutineKind::YieldMany:
@@ -2522,14 +2531,18 @@ class SyncCallEmission final : public CallEmission {
25222531
25232532 // Pass along the coroutine buffer.
25242533 switch (origCalleeType->getCoroutineKind ()) {
2525- case SILCoroutineKind::YieldMany:
2534+ case SILCoroutineKind::YieldOnce2:
2535+ if (IGF.IGM .IRGen .Opts .EmitYieldOnce2AsYieldOnce ) {
2536+ LLVM_FALLTHROUGH;
2537+ } else {
2538+ llvm::report_fatal_error (" unimplemented" );
2539+ break ;
2540+ }
25262541 case SILCoroutineKind::YieldOnce:
2542+ case SILCoroutineKind::YieldMany:
25272543 original.transferInto (adjusted, 1 );
25282544 break ;
25292545
2530- case SILCoroutineKind::YieldOnce2:
2531- llvm::report_fatal_error (" unimplemented" );
2532- break ;
25332546 case SILCoroutineKind::None:
25342547 break ;
25352548 }
@@ -4446,12 +4459,16 @@ irgen::getCoroutineResumeFunctionPointerAuth(IRGenModule &IGM,
44464459 case SILCoroutineKind::YieldMany:
44474460 return { IGM.getOptions ().PointerAuth .YieldManyResumeFunctions ,
44484461 PointerAuthEntity::forYieldTypes (fnType) };
4462+ case SILCoroutineKind::YieldOnce2:
4463+ if (IGM.IRGen .Opts .EmitYieldOnce2AsYieldOnce ) {
4464+ LLVM_FALLTHROUGH;
4465+ } else {
4466+ return {IGM.getOptions ().PointerAuth .YieldOnce2ResumeFunctions ,
4467+ PointerAuthEntity::forYieldTypes (fnType)};
4468+ }
44494469 case SILCoroutineKind::YieldOnce:
44504470 return { IGM.getOptions ().PointerAuth .YieldOnceResumeFunctions ,
44514471 PointerAuthEntity::forYieldTypes (fnType) };
4452- case SILCoroutineKind::YieldOnce2:
4453- return {IGM.getOptions ().PointerAuth .YieldOnce2ResumeFunctions ,
4454- PointerAuthEntity::forYieldTypes (fnType)};
44554472 }
44564473 llvm_unreachable (" bad coroutine kind" );
44574474}
0 commit comments