Skip to content

Commit fdd3eb0

Browse files
committed
[IRGen] Define coroutine function pointer types.
They're isomorphic to async function pointers. Even so, having this distinction will be clearer than reusing AFPs for this other purpose.
1 parent 9e60894 commit fdd3eb0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lib/IRGen/IRGenModule.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,10 @@ IRGenModule::IRGenModule(IRGenerator &irgen,
783783

784784
DifferentiabilityWitnessTy = createStructType(
785785
*this, "swift.differentiability_witness", {Int8PtrTy, Int8PtrTy});
786+
787+
CoroFunctionPointerTy = createStructType(*this, "swift.coro_func_pointer",
788+
{RelativeAddressTy, Int32Ty}, true);
789+
CoroFunctionPointerPtrTy = CoroFunctionPointerTy->getPointerTo();
786790
}
787791

788792
IRGenModule::~IRGenModule() {

lib/IRGen/IRGenModule.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,9 @@ class IRGenModule {
842842
llvm::StructType *DifferentiabilityWitnessTy; // { i8*, i8* }
843843
// clang-format on
844844

845+
llvm::StructType *CoroFunctionPointerTy; // { i32, i32 }
846+
llvm::PointerType *CoroFunctionPointerPtrTy;
847+
845848
llvm::GlobalVariable *TheTrivialPropertyDescriptor = nullptr;
846849

847850
llvm::Constant *swiftImmortalRefCount = nullptr;

0 commit comments

Comments
 (0)