@@ -87,9 +87,7 @@ static std::optional<Size> getCoroutineContextSize(IRGenModule &IGM,
87
87
case SILCoroutineKind::None:
88
88
llvm_unreachable (" expand a coroutine" );
89
89
case SILCoroutineKind::YieldOnce2:
90
- if (!IGM.IRGen .Opts .EmitYieldOnce2AsYieldOnce )
91
- return std::nullopt;
92
- LLVM_FALLTHROUGH;
90
+ return std::nullopt;
93
91
case SILCoroutineKind::YieldOnce:
94
92
return getYieldOnceCoroutineBufferSize (IGM);
95
93
case SILCoroutineKind::YieldMany:
@@ -387,7 +385,7 @@ irgen::expandCallingConv(IRGenModule &IGM,
387
385
case SILFunctionTypeRepresentation::KeyPathAccessorSetter:
388
386
case SILFunctionTypeRepresentation::KeyPathAccessorEquals:
389
387
case SILFunctionTypeRepresentation::KeyPathAccessorHash:
390
- if (isCalleeAllocatedCoro && !IGM. getOptions (). EmitYieldOnce2AsYieldOnce )
388
+ if (isCalleeAllocatedCoro)
391
389
return IGM.SwiftCoroCC ;
392
390
if (isAsync)
393
391
return IGM.SwiftAsyncCC ;
@@ -578,7 +576,7 @@ namespace {
578
576
579
577
// / Expand the components of the continuation entrypoint of the
580
578
// / function type.
581
- void expandCoroutineContinuationType (bool emitYieldOnce2AsYieldOnce );
579
+ void expandCoroutineContinuationType ();
582
580
583
581
// Expand the components for the async continuation entrypoint of the
584
582
// function type (the function to be called on returning).
@@ -646,7 +644,7 @@ namespace {
646
644
void expandExternalSignatureTypes ();
647
645
648
646
void expandCoroutineResult (bool forContinuation);
649
- void expandCoroutineContinuationParameters (bool emitYieldOnce2AsYieldOnce );
647
+ void expandCoroutineContinuationParameters ();
650
648
651
649
void addIndirectThrowingResult ();
652
650
llvm::Type *getErrorRegisterType ();
@@ -886,12 +884,11 @@ void SignatureExpansion::expandCoroutineResult(bool forContinuation) {
886
884
: llvm::StructType::get (IGM.getLLVMContext (), components);
887
885
}
888
886
889
- void SignatureExpansion::expandCoroutineContinuationParameters (
890
- bool emitYieldOnce2AsYieldOnce) {
887
+ void SignatureExpansion::expandCoroutineContinuationParameters () {
891
888
// The coroutine context.
892
889
addCoroutineContextParameter ();
893
890
894
- if (FnType->isCalleeAllocatedCoroutine () && !emitYieldOnce2AsYieldOnce ) {
891
+ if (FnType->isCalleeAllocatedCoroutine ()) {
895
892
// Whether this is an unwind resumption.
896
893
ParamIRTypes.push_back (IGM.CoroAllocatorPtrTy );
897
894
} else {
@@ -1950,12 +1947,10 @@ void SignatureExpansion::expandParameters(
1950
1947
case SILCoroutineKind::None:
1951
1948
break ;
1952
1949
case SILCoroutineKind::YieldOnce2:
1953
- if (!IGM.IRGen .Opts .EmitYieldOnce2AsYieldOnce ) {
1954
- addCoroutineContextParameter ();
1955
- addCoroutineAllocatorParameter ();
1956
- break ;
1957
- }
1958
- LLVM_FALLTHROUGH;
1950
+ addCoroutineContextParameter ();
1951
+ addCoroutineAllocatorParameter ();
1952
+
1953
+ break ;
1959
1954
case SILCoroutineKind::YieldOnce:
1960
1955
case SILCoroutineKind::YieldMany:
1961
1956
addCoroutineContextParameter ();
@@ -2121,10 +2116,9 @@ void SignatureExpansion::expandFunctionType(
2121
2116
llvm_unreachable (" bad abstract calling convention" );
2122
2117
}
2123
2118
2124
- void SignatureExpansion::expandCoroutineContinuationType (
2125
- bool emitYieldOnce2AsYieldOnce) {
2119
+ void SignatureExpansion::expandCoroutineContinuationType () {
2126
2120
expandCoroutineResult (/* for continuation*/ true );
2127
- expandCoroutineContinuationParameters (emitYieldOnce2AsYieldOnce );
2121
+ expandCoroutineContinuationParameters ();
2128
2122
}
2129
2123
2130
2124
llvm::Type *SignatureExpansion::getErrorRegisterType () {
@@ -2457,8 +2451,7 @@ Signature Signature::forCoroutineContinuation(IRGenModule &IGM,
2457
2451
CanSILFunctionType fnType) {
2458
2452
assert (fnType->isCoroutine ());
2459
2453
SignatureExpansion expansion (IGM, fnType, FunctionPointerKind (fnType));
2460
- expansion.expandCoroutineContinuationType (
2461
- IGM.IRGen .Opts .EmitYieldOnce2AsYieldOnce );
2454
+ expansion.expandCoroutineContinuationType ();
2462
2455
return expansion.getSignature ();
2463
2456
}
2464
2457
@@ -2768,15 +2761,15 @@ class SyncCallEmission final : public CallEmission {
2768
2761
assert (!coroStaticFrame.isValid ());
2769
2762
assert (!coroAllocator);
2770
2763
2771
- if (IsCalleeAllocatedCoroutine &&
2772
- !IGF.IGM .IRGen .Opts .EmitYieldOnce2AsYieldOnce ) {
2764
+ if (IsCalleeAllocatedCoroutine) {
2773
2765
llvm::Value *bufferSize32;
2774
2766
std::tie (calleeFunction, bufferSize32) =
2775
2767
getCoroFunctionAndSize (IGF, CurCallee.getFunctionPointer ());
2776
2768
auto *bufferSize = IGF.Builder .CreateZExt (bufferSize32, IGF.IGM .SizeTy );
2777
2769
coroStaticFrame = emitAllocYieldOnce2CoroutineFrame (IGF, bufferSize);
2778
- // TODO: Optimize allocator kind (e.g. async callers only need to use the
2779
- // TaskAllocator if the coroutine is suspended across an await).
2770
+ // TODO: CoroutineAccessors: Optimize allocator kind (e.g. async callers
2771
+ // only need to use the TaskAllocator if the
2772
+ // coroutine is suspended across an await).
2780
2773
coroAllocator = emitYieldOnce2CoroutineAllocator (
2781
2774
IGF, IGF.getDefaultCoroutineAllocatorKind ());
2782
2775
}
@@ -2878,11 +2871,8 @@ class SyncCallEmission final : public CallEmission {
2878
2871
switch (origCalleeType->getCoroutineKind ()) {
2879
2872
case SILCoroutineKind::YieldOnce2:
2880
2873
// Pass along the coroutine buffer and allocator.
2881
- if (!IGF.IGM .IRGen .Opts .EmitYieldOnce2AsYieldOnce ) {
2882
- original.transferInto (adjusted, 2 );
2883
- break ;
2884
- }
2885
- LLVM_FALLTHROUGH;
2874
+ original.transferInto (adjusted, 2 );
2875
+ break ;
2886
2876
case SILCoroutineKind::YieldOnce:
2887
2877
case SILCoroutineKind::YieldMany:
2888
2878
// Pass along the coroutine buffer.
@@ -4974,10 +4964,8 @@ irgen::getCoroutineResumeFunctionPointerAuth(IRGenModule &IGM,
4974
4964
return { IGM.getOptions ().PointerAuth .YieldManyResumeFunctions ,
4975
4965
PointerAuthEntity::forYieldTypes (fnType) };
4976
4966
case SILCoroutineKind::YieldOnce2:
4977
- if (!IGM.IRGen .Opts .EmitYieldOnce2AsYieldOnce )
4978
- return {IGM.getOptions ().PointerAuth .YieldOnce2ResumeFunctions ,
4979
- PointerAuthEntity::forYieldTypes (fnType)};
4980
- LLVM_FALLTHROUGH;
4967
+ return {IGM.getOptions ().PointerAuth .YieldOnce2ResumeFunctions ,
4968
+ PointerAuthEntity::forYieldTypes (fnType)};
4981
4969
case SILCoroutineKind::YieldOnce:
4982
4970
return { IGM.getOptions ().PointerAuth .YieldOnceResumeFunctions ,
4983
4971
PointerAuthEntity::forYieldTypes (fnType) };
@@ -5233,10 +5221,6 @@ void irgen::emitDeallocYieldManyCoroutineBuffer(IRGenFunction &IGF,
5233
5221
5234
5222
void irgen::emitDeallocYieldOnce2CoroutineFrame (IRGenFunction &IGF,
5235
5223
StackAddress frame) {
5236
- if (IGF.IGM .IRGen .Opts .EmitYieldOnce2AsYieldOnce ) {
5237
- assert (!frame.isValid ());
5238
- return ;
5239
- }
5240
5224
assert (frame.isValid ());
5241
5225
emitDeallocCoroStaticFrame (IGF, frame);
5242
5226
}
@@ -5352,8 +5336,7 @@ llvm::Value *irgen::emitYield(IRGenFunction &IGF,
5352
5336
5353
5337
// Perform the yield.
5354
5338
llvm::Value *isUnwind = nullptr ;
5355
- if (coroutineType->isCalleeAllocatedCoroutine () &&
5356
- !IGF.IGM .IRGen .Opts .EmitYieldOnce2AsYieldOnce ) {
5339
+ if (coroutineType->isCalleeAllocatedCoroutine ()) {
5357
5340
IGF.Builder .CreateIntrinsicCall (llvm::Intrinsic::coro_suspend_retcon,
5358
5341
{IGF.IGM .CoroAllocatorPtrTy }, yieldArgs);
5359
5342
isUnwind = llvm::ConstantInt::get (IGF.IGM .Int1Ty , 0 );
0 commit comments