@@ -78,21 +78,21 @@ static Size getCoroutineContextSize(IRGenModule &IGM,
7878 llvm_unreachable (" bad kind" );
7979}
8080
81- AsyncContextLayout irgen::getAsyncContextLayout (IRGenFunction &IGF ,
81+ AsyncContextLayout irgen::getAsyncContextLayout (IRGenModule &IGM ,
8282 SILFunction *function) {
8383 SubstitutionMap forwardingSubstitutionMap =
8484 function->getForwardingSubstitutionMap ();
8585 CanSILFunctionType originalType = function->getLoweredFunctionType ();
8686 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,
9090 forwardingSubstitutionMap);
9191 return layout;
9292}
9393
9494AsyncContextLayout irgen::getAsyncContextLayout (
95- IRGenFunction &IGF , CanSILFunctionType originalType,
95+ IRGenModule &IGM , CanSILFunctionType originalType,
9696 CanSILFunctionType substitutedType, SubstitutionMap substitutionMap) {
9797 SmallVector<const TypeInfo *, 4 > typeInfos;
9898 SmallVector<SILType, 4 > valTypes;
@@ -103,25 +103,25 @@ AsyncContextLayout irgen::getAsyncContextLayout(
103103 SmallVector<SILResultInfo, 4 > directReturnInfos;
104104
105105 auto parameters = substitutedType->getParameters ();
106- SILFunctionConventions fnConv (substitutedType, IGF .getSILModule ());
106+ SILFunctionConventions fnConv (substitutedType, IGM .getSILModule ());
107107
108108 auto addTaskContinuationFunction = [&]() {
109109 auto ty = SILType ();
110- auto &ti = IGF. IGM .getTaskContinuationFunctionPtrTypeInfo ();
110+ auto &ti = IGM.getTaskContinuationFunctionPtrTypeInfo ();
111111 valTypes.push_back (ty);
112112 typeInfos.push_back (&ti);
113113 };
114114 auto addExecutor = [&]() {
115115 auto ty = SILType ();
116- auto &ti = IGF. IGM .getSwiftExecutorPtrTypeInfo ();
116+ auto &ti = IGM.getSwiftExecutorPtrTypeInfo ();
117117 valTypes.push_back (ty);
118118 typeInfos.push_back (&ti);
119119 };
120120
121121 // AsyncContext * __ptrauth_swift_async_context_parent Parent;
122122 {
123123 auto ty = SILType ();
124- auto &ti = IGF. IGM .getSwiftContextPtrTypeInfo ();
124+ auto &ti = IGM.getSwiftContextPtrTypeInfo ();
125125 valTypes.push_back (ty);
126126 typeInfos.push_back (&ti);
127127 }
@@ -136,9 +136,9 @@ AsyncContextLayout irgen::getAsyncContextLayout(
136136 // AsyncContextFlags Flags;
137137 {
138138 auto ty = SILType::getPrimitiveObjectType (
139- BuiltinIntegerType::get (32 , IGF. IGM .IRGen .SIL .getASTContext ())
139+ BuiltinIntegerType::get (32 , IGM.IRGen .SIL .getASTContext ())
140140 ->getCanonicalType ());
141- const auto &ti = IGF. IGM .getTypeInfo (ty);
141+ const auto &ti = IGM.getTypeInfo (ty);
142142 valTypes.push_back (ty);
143143 typeInfos.push_back (&ti);
144144 }
@@ -149,19 +149,19 @@ AsyncContextLayout irgen::getAsyncContextLayout(
149149 }
150150
151151 // SwiftError *errorResult;
152- auto errorCanType = IGF. IGM .Context .getExceptionType ();
152+ auto errorCanType = IGM.Context .getExceptionType ();
153153 auto errorType = SILType::getPrimitiveObjectType (errorCanType);
154- auto &errorTypeInfo = IGF .getTypeInfoForLowered (errorCanType);
154+ auto &errorTypeInfo = IGM .getTypeInfoForLowered (errorCanType);
155155 typeInfos.push_back (&errorTypeInfo);
156156 valTypes.push_back (errorType);
157157
158158 // IndirectResultTypes *indirectResults...;
159159 auto indirectResults = fnConv.getIndirectSILResults ();
160160 for (auto indirectResult : indirectResults) {
161161 auto ty = fnConv.getSILType (indirectResult,
162- IGF. IGM .getMaximalTypeExpansionContext ());
162+ IGM.getMaximalTypeExpansionContext ());
163163 auto retLoweringTy = CanInOutType::get (ty.getASTType ());
164- auto &ti = IGF .getTypeInfoForLowered (retLoweringTy);
164+ auto &ti = IGM .getTypeInfoForLowered (retLoweringTy);
165165 valTypes.push_back (ty);
166166 typeInfos.push_back (&ti);
167167 indirectReturnInfos.push_back (indirectResult);
@@ -178,8 +178,8 @@ AsyncContextLayout irgen::getAsyncContextLayout(
178178 // YieldTypes yieldValues...
179179 for (auto yield : fnConv.getYields ()) {
180180 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 ());
183183 valTypes.push_back (ty);
184184 typeInfos.push_back (&ti);
185185 yieldInfos.push_back (yield);
@@ -188,8 +188,8 @@ AsyncContextLayout irgen::getAsyncContextLayout(
188188 // ResultTypes directResults...;
189189 for (auto result : fnConv.getDirectSILResults ()) {
190190 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 ());
193193 valTypes.push_back (ty);
194194 typeInfos.push_back (&ti);
195195 directReturnInfos.push_back (result);
@@ -208,25 +208,25 @@ AsyncContextLayout irgen::getAsyncContextLayout(
208208
209209 // ArgTypes formalArguments...;
210210 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 ());
213213
214214 auto argumentLoweringType =
215215 getArgumentLoweringType (ty.getASTType (), parameter,
216216 /* isNoEscape*/ true );
217217
218- auto &ti = IGF .getTypeInfoForLowered (argumentLoweringType);
218+ auto &ti = IGM .getTypeInfoForLowered (argumentLoweringType);
219219
220220 valTypes.push_back (ty);
221221 typeInfos.push_back (&ti);
222222 paramInfos.push_back ({ty, parameter.getConvention ()});
223223 }
224224 auto bindings = NecessaryBindings::forAsyncFunctionInvocation (
225- IGF. IGM , originalType, substitutionMap);
225+ IGM, originalType, substitutionMap);
226226 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 ());
230230 valTypes.push_back (SILType ());
231231 typeInfos.push_back (&bindingsTI);
232232 }
@@ -235,20 +235,20 @@ AsyncContextLayout irgen::getAsyncContextLayout(
235235 if (hasLocalContext) {
236236 if (hasLocalContextParameter) {
237237 SILType ty =
238- IGF. IGM .silConv .getSILType (localContextParameter, substitutedType,
239- IGF. IGM .getMaximalTypeExpansionContext ());
238+ IGM.silConv .getSILType (localContextParameter, substitutedType,
239+ IGM.getMaximalTypeExpansionContext ());
240240 auto argumentLoweringType =
241241 getArgumentLoweringType (ty.getASTType (), localContextParameter,
242242 /* isNoEscape*/ true );
243243
244- auto &ti = IGF .getTypeInfoForLowered (argumentLoweringType);
244+ auto &ti = IGM .getTypeInfoForLowered (argumentLoweringType);
245245 valTypes.push_back (ty);
246246 typeInfos.push_back (&ti);
247247 localContextInfo = {ty, localContextParameter.getConvention ()};
248248 } else {
249249 // 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 );
252252 valTypes.push_back (ty);
253253 typeInfos.push_back (&ti);
254254 localContextInfo = {ty, substitutedType->getCalleeConvention ()};
@@ -259,27 +259,27 @@ AsyncContextLayout irgen::getAsyncContextLayout(
259259 Optional<AsyncContextLayout::TrailingWitnessInfo> trailingWitnessInfo;
260260 if (originalType->getRepresentation () ==
261261 SILFunctionTypeRepresentation::WitnessMethod) {
262- assert (getTrailingWitnessSignatureLength (IGF. IGM , originalType) == 2 );
262+ assert (getTrailingWitnessSignatureLength (IGM, originalType) == 2 );
263263
264264 // First, the Self metadata.
265265 {
266266 auto ty = SILType ();
267- auto &ti = IGF. IGM .getTypeMetadataPtrTypeInfo ();
267+ auto &ti = IGM.getTypeMetadataPtrTypeInfo ();
268268 valTypes.push_back (ty);
269269 typeInfos.push_back (&ti);
270270 }
271271 // Then, the Self witness table.
272272 {
273273 auto ty = SILType ();
274- auto &ti = IGF. IGM .getWitnessTablePtrTypeInfo ();
274+ auto &ti = IGM.getWitnessTablePtrTypeInfo ();
275275 valTypes.push_back (ty);
276276 typeInfos.push_back (&ti);
277277 }
278278 trailingWitnessInfo = AsyncContextLayout::TrailingWitnessInfo ();
279279 }
280280
281281 return AsyncContextLayout (
282- IGF. IGM , LayoutStrategy::Optimal, valTypes, typeInfos, IGF , originalType,
282+ IGM, LayoutStrategy::Optimal, valTypes, typeInfos, originalType,
283283 substitutedType, substitutionMap, std::move (bindings),
284284 trailingWitnessInfo, errorType, canHaveValidError, paramInfos,
285285 isCoroutine, yieldInfos, indirectReturnInfos, directReturnInfos,
@@ -288,7 +288,7 @@ AsyncContextLayout irgen::getAsyncContextLayout(
288288
289289AsyncContextLayout::AsyncContextLayout (
290290 IRGenModule &IGM, LayoutStrategy strategy, ArrayRef<SILType> fieldTypes,
291- ArrayRef<const TypeInfo *> fieldTypeInfos, IRGenFunction &IGF,
291+ ArrayRef<const TypeInfo *> fieldTypeInfos,
292292 CanSILFunctionType originalType, CanSILFunctionType substitutedType,
293293 SubstitutionMap substitutionMap, NecessaryBindings &&bindings,
294294 Optional<TrailingWitnessInfo> trailingWitnessInfo, SILType errorType,
@@ -299,7 +299,7 @@ AsyncContextLayout::AsyncContextLayout(
299299 Optional<AsyncContextLayout::ArgumentInfo> localContextInfo)
300300 : StructLayout(IGM, /* decl=*/ nullptr , LayoutKind::NonHeapObject, strategy,
301301 fieldTypeInfos, /* typeToFill*/ nullptr ),
302- IGF(IGF ), originalType(originalType), substitutedType(substitutedType),
302+ IGM(IGM ), originalType(originalType), substitutedType(substitutedType),
303303 substitutionMap(substitutionMap), errorType(errorType),
304304 canHaveValidError(canHaveValidError), isCoroutine(isCoroutine),
305305 yieldInfos(yieldInfos.begin(), yieldInfos.end()),
@@ -2171,7 +2171,7 @@ class AsyncCallEmission final : public CallEmission {
21712171 AsyncContextLayout getAsyncContextLayout () {
21722172 if (!asyncContextLayout) {
21732173 asyncContextLayout.emplace (::getAsyncContextLayout (
2174- IGF, getCallee ().getOrigFunctionType (),
2174+ IGF. IGM , getCallee ().getOrigFunctionType (),
21752175 getCallee ().getSubstFunctionType (), getCallee ().getSubstitutions ()));
21762176 }
21772177 return *asyncContextLayout;
0 commit comments