@@ -737,7 +737,7 @@ struct Allocator {
737737 case Field::AllocateFrame:
738738 case Field::DeallocateFrame:
739739 auto attrs = llvm::AttributeList ();
740- IGM.addSwiftCoroAttributes (attrs, 0 );
740+ IGM.addSwiftCoroAttributes (attrs, 1 );
741741 return attrs;
742742 }
743743 }
@@ -877,12 +877,13 @@ struct Allocator {
877877
878878llvm::Constant *getCoroAllocFn (AllocationKind kind, IRGenModule &IGM) {
879879 return IGM.getOrCreateHelperFunction (
880- kind.getAllocationFunctionName (), IGM.Int8PtrTy ,
881- {IGM.CoroAllocatorPtrTy , IGM.SizeTy },
880+ kind.getAllocationFunctionName (), IGM.CoroAllocationTy ,
881+ {IGM.CoroAllocatorPtrTy , IGM.CoroAllocationTy , IGM. SizeTy },
882882 [kind](IRGenFunction &IGF) {
883883 auto isSwiftCoroCCAvailable =
884884 IGF.IGM .SwiftCoroCC == llvm::CallingConv::SwiftCoro;
885885 auto parameters = IGF.collectParameters ();
886+ auto *frame = parameters.claimNext ();
886887 auto *allocatorValue = parameters.claimNext ();
887888 auto allocator = Allocator (allocatorValue, IGF);
888889 auto *size = parameters.claimNext ();
@@ -903,7 +904,7 @@ llvm::Constant *getCoroAllocFn(AllocationKind kind, IRGenModule &IGM) {
903904 });
904905 }
905906 auto fnPtr = allocator.getAllocate (kind);
906- auto *call = IGF.Builder .CreateCall (fnPtr, {allocatorValue, size});
907+ auto *call = IGF.Builder .CreateCall (fnPtr, {frame, allocatorValue, size});
907908 call->setDoesNotThrow ();
908909 call->setCallingConv (IGF.IGM .SwiftCC );
909910 IGF.Builder .CreateRet (call);
@@ -914,18 +915,19 @@ llvm::Constant *getCoroAllocFn(AllocationKind kind, IRGenModule &IGM) {
914915 /* optionalLinkageOverride=*/ nullptr , IGM.SwiftCoroCC ,
915916 /* transformAttributes=*/
916917 [&IGM](llvm::AttributeList &attrs) {
917- IGM.addSwiftCoroAttributes (attrs, 0 );
918+ IGM.addSwiftCoroAttributes (attrs, 1 );
918919 });
919920}
920921
921922llvm::Constant *getCoroDeallocFn (AllocationKind kind, IRGenModule &IGM) {
922923 return IGM.getOrCreateHelperFunction (
923924 kind.getDeallocationFunctionName (), IGM.VoidTy ,
924- {IGM.CoroAllocatorPtrTy , IGM.Int8PtrTy },
925+ {IGM.CoroAllocatorPtrTy , IGM.CoroAllocationTy , IGM. CoroAllocationTy },
925926 [kind](IRGenFunction &IGF) {
926927 auto isSwiftCoroCCAvailable =
927928 IGF.IGM .SwiftCoroCC == llvm::CallingConv::SwiftCoro;
928929 auto parameters = IGF.collectParameters ();
930+ auto *frame = parameters.claimNext ();
929931 auto *allocatorValue = parameters.claimNext ();
930932 auto allocator = Allocator (allocatorValue, IGF);
931933 auto *ptr = parameters.claimNext ();
@@ -959,7 +961,7 @@ llvm::Constant *getCoroDeallocFn(AllocationKind kind, IRGenModule &IGM) {
959961 // Start emitting the "normal" block.
960962 IGF.Builder .emitBlock (normalBlock);
961963 auto fnPtr = allocator.getDeallocate (kind);
962- auto *call = IGF.Builder .CreateCall (fnPtr, {allocatorValue, ptr});
964+ auto *call = IGF.Builder .CreateCall (fnPtr, {frame, allocatorValue, ptr});
963965 call->setDoesNotThrow ();
964966 call->setCallingConv (IGF.IGM .SwiftCC );
965967 IGF.Builder .CreateRetVoid ();
@@ -970,7 +972,7 @@ llvm::Constant *getCoroDeallocFn(AllocationKind kind, IRGenModule &IGM) {
970972 /* optionalLinkageOverride=*/ nullptr , IGM.SwiftCoroCC ,
971973 /* transformAttributes=*/
972974 [&IGM](llvm::AttributeList &attrs) {
973- IGM.addSwiftCoroAttributes (attrs, 0 );
975+ IGM.addSwiftCoroAttributes (attrs, 1 );
974976 });
975977}
976978
@@ -1003,6 +1005,7 @@ getAddrOfSwiftCoroAllocThunk(StringRef name,
10031005 name, ty->getReturnType (), ty->params (),
10041006 [getAlloc](IRGenFunction &IGF) {
10051007 auto parameters = IGF.collectParameters ();
1008+ parameters.claimNext (); // frame
10061009 parameters.claimNext (); // allocator
10071010 auto *size = parameters.claimNext ();
10081011 auto alloc = (IGF.IGM .*getAlloc)();
@@ -1015,7 +1018,7 @@ getAddrOfSwiftCoroAllocThunk(StringRef name,
10151018 /* specialCallingConv=*/ std::nullopt ,
10161019 /* transformAttributes=*/
10171020 [&IGM](llvm::AttributeList &attrs) {
1018- IGM.addSwiftCoroAttributes (attrs, 0 );
1021+ IGM.addSwiftCoroAttributes (attrs, 1 );
10191022 });
10201023}
10211024
@@ -1030,6 +1033,7 @@ getAddrOfSwiftCoroDeallocThunk(StringRef name,
10301033 name, ty->getReturnType (), ty->params (),
10311034 [getDealloc](IRGenFunction &IGF) {
10321035 auto parameters = IGF.collectParameters ();
1036+ parameters.claimNext (); // frame
10331037 parameters.claimNext (); // allocator
10341038 auto *ptr = parameters.claimNext ();
10351039 auto dealloc = (IGF.IGM .*getDealloc)();
@@ -1042,7 +1046,7 @@ getAddrOfSwiftCoroDeallocThunk(StringRef name,
10421046 /* specialCallingConv=*/ std::nullopt ,
10431047 /* transformAttributes=*/
10441048 [&IGM](llvm::AttributeList &attrs) {
1045- IGM.addSwiftCoroAttributes (attrs, 0 );
1049+ IGM.addSwiftCoroAttributes (attrs, 1 );
10461050 });
10471051}
10481052
0 commit comments