@@ -78,21 +78,21 @@ static Size getCoroutineContextSize(IRGenModule &IGM,
78
78
llvm_unreachable (" bad kind" );
79
79
}
80
80
81
- AsyncContextLayout irgen::getAsyncContextLayout (IRGenFunction &IGF ,
81
+ AsyncContextLayout irgen::getAsyncContextLayout (IRGenModule &IGM ,
82
82
SILFunction *function) {
83
83
SubstitutionMap forwardingSubstitutionMap =
84
84
function->getForwardingSubstitutionMap ();
85
85
CanSILFunctionType originalType = function->getLoweredFunctionType ();
86
86
CanSILFunctionType substitutedType = originalType->substGenericArgs (
87
- IGF. IGM .getSILModule (), forwardingSubstitutionMap,
88
- IGF. IGM .getMaximalTypeExpansionContext ());
89
- auto layout = getAsyncContextLayout (IGF , originalType, substitutedType,
87
+ IGM.getSILModule (), forwardingSubstitutionMap,
88
+ IGM.getMaximalTypeExpansionContext ());
89
+ auto layout = getAsyncContextLayout (IGM , originalType, substitutedType,
90
90
forwardingSubstitutionMap);
91
91
return layout;
92
92
}
93
93
94
94
AsyncContextLayout irgen::getAsyncContextLayout (
95
- IRGenFunction &IGF , CanSILFunctionType originalType,
95
+ IRGenModule &IGM , CanSILFunctionType originalType,
96
96
CanSILFunctionType substitutedType, SubstitutionMap substitutionMap) {
97
97
SmallVector<const TypeInfo *, 4 > typeInfos;
98
98
SmallVector<SILType, 4 > valTypes;
@@ -103,25 +103,25 @@ AsyncContextLayout irgen::getAsyncContextLayout(
103
103
SmallVector<SILResultInfo, 4 > directReturnInfos;
104
104
105
105
auto parameters = substitutedType->getParameters ();
106
- SILFunctionConventions fnConv (substitutedType, IGF .getSILModule ());
106
+ SILFunctionConventions fnConv (substitutedType, IGM .getSILModule ());
107
107
108
108
auto addTaskContinuationFunction = [&]() {
109
109
auto ty = SILType ();
110
- auto &ti = IGF. IGM .getTaskContinuationFunctionPtrTypeInfo ();
110
+ auto &ti = IGM.getTaskContinuationFunctionPtrTypeInfo ();
111
111
valTypes.push_back (ty);
112
112
typeInfos.push_back (&ti);
113
113
};
114
114
auto addExecutor = [&]() {
115
115
auto ty = SILType ();
116
- auto &ti = IGF. IGM .getSwiftExecutorPtrTypeInfo ();
116
+ auto &ti = IGM.getSwiftExecutorPtrTypeInfo ();
117
117
valTypes.push_back (ty);
118
118
typeInfos.push_back (&ti);
119
119
};
120
120
121
121
// AsyncContext * __ptrauth_swift_async_context_parent Parent;
122
122
{
123
123
auto ty = SILType ();
124
- auto &ti = IGF. IGM .getSwiftContextPtrTypeInfo ();
124
+ auto &ti = IGM.getSwiftContextPtrTypeInfo ();
125
125
valTypes.push_back (ty);
126
126
typeInfos.push_back (&ti);
127
127
}
@@ -136,9 +136,9 @@ AsyncContextLayout irgen::getAsyncContextLayout(
136
136
// AsyncContextFlags Flags;
137
137
{
138
138
auto ty = SILType::getPrimitiveObjectType (
139
- BuiltinIntegerType::get (32 , IGF. IGM .IRGen .SIL .getASTContext ())
139
+ BuiltinIntegerType::get (32 , IGM.IRGen .SIL .getASTContext ())
140
140
->getCanonicalType ());
141
- const auto &ti = IGF. IGM .getTypeInfo (ty);
141
+ const auto &ti = IGM.getTypeInfo (ty);
142
142
valTypes.push_back (ty);
143
143
typeInfos.push_back (&ti);
144
144
}
@@ -149,19 +149,19 @@ AsyncContextLayout irgen::getAsyncContextLayout(
149
149
}
150
150
151
151
// SwiftError *errorResult;
152
- auto errorCanType = IGF. IGM .Context .getExceptionType ();
152
+ auto errorCanType = IGM.Context .getExceptionType ();
153
153
auto errorType = SILType::getPrimitiveObjectType (errorCanType);
154
- auto &errorTypeInfo = IGF .getTypeInfoForLowered (errorCanType);
154
+ auto &errorTypeInfo = IGM .getTypeInfoForLowered (errorCanType);
155
155
typeInfos.push_back (&errorTypeInfo);
156
156
valTypes.push_back (errorType);
157
157
158
158
// IndirectResultTypes *indirectResults...;
159
159
auto indirectResults = fnConv.getIndirectSILResults ();
160
160
for (auto indirectResult : indirectResults) {
161
161
auto ty = fnConv.getSILType (indirectResult,
162
- IGF. IGM .getMaximalTypeExpansionContext ());
162
+ IGM.getMaximalTypeExpansionContext ());
163
163
auto retLoweringTy = CanInOutType::get (ty.getASTType ());
164
- auto &ti = IGF .getTypeInfoForLowered (retLoweringTy);
164
+ auto &ti = IGM .getTypeInfoForLowered (retLoweringTy);
165
165
valTypes.push_back (ty);
166
166
typeInfos.push_back (&ti);
167
167
indirectReturnInfos.push_back (indirectResult);
@@ -178,8 +178,8 @@ AsyncContextLayout irgen::getAsyncContextLayout(
178
178
// YieldTypes yieldValues...
179
179
for (auto yield : fnConv.getYields ()) {
180
180
auto ty =
181
- fnConv.getSILType (yield, IGF. IGM .getMaximalTypeExpansionContext ());
182
- auto &ti = IGF .getTypeInfoForLowered (ty.getASTType ());
181
+ fnConv.getSILType (yield, IGM.getMaximalTypeExpansionContext ());
182
+ auto &ti = IGM .getTypeInfoForLowered (ty.getASTType ());
183
183
valTypes.push_back (ty);
184
184
typeInfos.push_back (&ti);
185
185
yieldInfos.push_back (yield);
@@ -188,8 +188,8 @@ AsyncContextLayout irgen::getAsyncContextLayout(
188
188
// ResultTypes directResults...;
189
189
for (auto result : fnConv.getDirectSILResults ()) {
190
190
auto ty =
191
- fnConv.getSILType (result, IGF. IGM .getMaximalTypeExpansionContext ());
192
- auto &ti = IGF .getTypeInfoForLowered (ty.getASTType ());
191
+ fnConv.getSILType (result, IGM.getMaximalTypeExpansionContext ());
192
+ auto &ti = IGM .getTypeInfoForLowered (ty.getASTType ());
193
193
valTypes.push_back (ty);
194
194
typeInfos.push_back (&ti);
195
195
directReturnInfos.push_back (result);
@@ -208,25 +208,25 @@ AsyncContextLayout irgen::getAsyncContextLayout(
208
208
209
209
// ArgTypes formalArguments...;
210
210
for (auto parameter : parameters) {
211
- SILType ty = IGF. IGM .silConv .getSILType (
212
- parameter, substitutedType, IGF. IGM .getMaximalTypeExpansionContext ());
211
+ SILType ty = IGM.silConv .getSILType (
212
+ parameter, substitutedType, IGM.getMaximalTypeExpansionContext ());
213
213
214
214
auto argumentLoweringType =
215
215
getArgumentLoweringType (ty.getASTType (), parameter,
216
216
/* isNoEscape*/ true );
217
217
218
- auto &ti = IGF .getTypeInfoForLowered (argumentLoweringType);
218
+ auto &ti = IGM .getTypeInfoForLowered (argumentLoweringType);
219
219
220
220
valTypes.push_back (ty);
221
221
typeInfos.push_back (&ti);
222
222
paramInfos.push_back ({ty, parameter.getConvention ()});
223
223
}
224
224
auto bindings = NecessaryBindings::forAsyncFunctionInvocation (
225
- IGF. IGM , originalType, substitutionMap);
225
+ IGM, originalType, substitutionMap);
226
226
if (!bindings.empty ()) {
227
- auto bindingsSize = bindings.getBufferSize (IGF. IGM );
228
- auto &bindingsTI = IGF. IGM .getOpaqueStorageTypeInfo (
229
- bindingsSize, IGF. IGM .getPointerAlignment ());
227
+ auto bindingsSize = bindings.getBufferSize (IGM);
228
+ auto &bindingsTI = IGM.getOpaqueStorageTypeInfo (
229
+ bindingsSize, IGM.getPointerAlignment ());
230
230
valTypes.push_back (SILType ());
231
231
typeInfos.push_back (&bindingsTI);
232
232
}
@@ -235,20 +235,20 @@ AsyncContextLayout irgen::getAsyncContextLayout(
235
235
if (hasLocalContext) {
236
236
if (hasLocalContextParameter) {
237
237
SILType ty =
238
- IGF. IGM .silConv .getSILType (localContextParameter, substitutedType,
239
- IGF. IGM .getMaximalTypeExpansionContext ());
238
+ IGM.silConv .getSILType (localContextParameter, substitutedType,
239
+ IGM.getMaximalTypeExpansionContext ());
240
240
auto argumentLoweringType =
241
241
getArgumentLoweringType (ty.getASTType (), localContextParameter,
242
242
/* isNoEscape*/ true );
243
243
244
- auto &ti = IGF .getTypeInfoForLowered (argumentLoweringType);
244
+ auto &ti = IGM .getTypeInfoForLowered (argumentLoweringType);
245
245
valTypes.push_back (ty);
246
246
typeInfos.push_back (&ti);
247
247
localContextInfo = {ty, localContextParameter.getConvention ()};
248
248
} else {
249
249
// TODO: DETERMINE: Is there a field in this case to match the sync ABI?
250
- auto &ti = IGF. IGM .getNativeObjectTypeInfo ();
251
- SILType ty = SILType::getNativeObjectType (IGF. IGM .Context );
250
+ auto &ti = IGM.getNativeObjectTypeInfo ();
251
+ SILType ty = SILType::getNativeObjectType (IGM.Context );
252
252
valTypes.push_back (ty);
253
253
typeInfos.push_back (&ti);
254
254
localContextInfo = {ty, substitutedType->getCalleeConvention ()};
@@ -259,27 +259,27 @@ AsyncContextLayout irgen::getAsyncContextLayout(
259
259
Optional<AsyncContextLayout::TrailingWitnessInfo> trailingWitnessInfo;
260
260
if (originalType->getRepresentation () ==
261
261
SILFunctionTypeRepresentation::WitnessMethod) {
262
- assert (getTrailingWitnessSignatureLength (IGF. IGM , originalType) == 2 );
262
+ assert (getTrailingWitnessSignatureLength (IGM, originalType) == 2 );
263
263
264
264
// First, the Self metadata.
265
265
{
266
266
auto ty = SILType ();
267
- auto &ti = IGF. IGM .getTypeMetadataPtrTypeInfo ();
267
+ auto &ti = IGM.getTypeMetadataPtrTypeInfo ();
268
268
valTypes.push_back (ty);
269
269
typeInfos.push_back (&ti);
270
270
}
271
271
// Then, the Self witness table.
272
272
{
273
273
auto ty = SILType ();
274
- auto &ti = IGF. IGM .getWitnessTablePtrTypeInfo ();
274
+ auto &ti = IGM.getWitnessTablePtrTypeInfo ();
275
275
valTypes.push_back (ty);
276
276
typeInfos.push_back (&ti);
277
277
}
278
278
trailingWitnessInfo = AsyncContextLayout::TrailingWitnessInfo ();
279
279
}
280
280
281
281
return AsyncContextLayout (
282
- IGF. IGM , LayoutStrategy::Optimal, valTypes, typeInfos, IGF , originalType,
282
+ IGM, LayoutStrategy::Optimal, valTypes, typeInfos, originalType,
283
283
substitutedType, substitutionMap, std::move (bindings),
284
284
trailingWitnessInfo, errorType, canHaveValidError, paramInfos,
285
285
isCoroutine, yieldInfos, indirectReturnInfos, directReturnInfos,
@@ -288,7 +288,7 @@ AsyncContextLayout irgen::getAsyncContextLayout(
288
288
289
289
AsyncContextLayout::AsyncContextLayout (
290
290
IRGenModule &IGM, LayoutStrategy strategy, ArrayRef<SILType> fieldTypes,
291
- ArrayRef<const TypeInfo *> fieldTypeInfos, IRGenFunction &IGF,
291
+ ArrayRef<const TypeInfo *> fieldTypeInfos,
292
292
CanSILFunctionType originalType, CanSILFunctionType substitutedType,
293
293
SubstitutionMap substitutionMap, NecessaryBindings &&bindings,
294
294
Optional<TrailingWitnessInfo> trailingWitnessInfo, SILType errorType,
@@ -299,7 +299,7 @@ AsyncContextLayout::AsyncContextLayout(
299
299
Optional<AsyncContextLayout::ArgumentInfo> localContextInfo)
300
300
: StructLayout(IGM, /* decl=*/ nullptr , LayoutKind::NonHeapObject, strategy,
301
301
fieldTypeInfos, /* typeToFill*/ nullptr ),
302
- IGF(IGF ), originalType(originalType), substitutedType(substitutedType),
302
+ IGM(IGM ), originalType(originalType), substitutedType(substitutedType),
303
303
substitutionMap(substitutionMap), errorType(errorType),
304
304
canHaveValidError(canHaveValidError), isCoroutine(isCoroutine),
305
305
yieldInfos(yieldInfos.begin(), yieldInfos.end()),
@@ -2171,7 +2171,7 @@ class AsyncCallEmission final : public CallEmission {
2171
2171
AsyncContextLayout getAsyncContextLayout () {
2172
2172
if (!asyncContextLayout) {
2173
2173
asyncContextLayout.emplace (::getAsyncContextLayout (
2174
- IGF, getCallee ().getOrigFunctionType (),
2174
+ IGF. IGM , getCallee ().getOrigFunctionType (),
2175
2175
getCallee ().getSubstFunctionType (), getCallee ().getSubstitutions ()));
2176
2176
}
2177
2177
return *asyncContextLayout;
0 commit comments