Skip to content

Commit 11f727e

Browse files
committed
SIL: Add no-arg overload of SILFunction::getLoweredFunctionTypeInContext()
1 parent ec39484 commit 11f727e

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

include/swift/SIL/SILBridgingImpl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,7 @@ bool BridgedFunction::hasOwnership() const { return getFunction()->hasOwnership(
706706
bool BridgedFunction::hasLoweredAddresses() const { return getFunction()->getModule().useLoweredAddresses(); }
707707

708708
BridgedCanType BridgedFunction::getLoweredFunctionTypeInContext() const {
709-
auto expansion = getFunction()->getTypeExpansionContext();
710-
return getFunction()->getLoweredFunctionTypeInContext(expansion);
709+
return getFunction()->getLoweredFunctionTypeInContext();
711710
}
712711

713712
BridgedGenericSignature BridgedFunction::getGenericSignature() const {

include/swift/SIL/SILFunction.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,9 @@ class SILFunction
572572
CanSILFunctionType getLoweredFunctionType() const {
573573
return LoweredType;
574574
}
575+
576+
CanSILFunctionType getLoweredFunctionTypeInContext() const;
577+
575578
CanSILFunctionType
576579
getLoweredFunctionTypeInContext(TypeExpansionContext context) const;
577580

lib/SIL/IR/SILFunctionType.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5291,11 +5291,15 @@ TypeExpansionContext::TypeExpansionContext(const SILFunction &f)
52915291
inContext(f.getModule().getAssociatedContext()),
52925292
isContextWholeModule(f.getModule().isWholeModule()) {}
52935293

5294+
CanSILFunctionType SILFunction::getLoweredFunctionTypeInContext() const {
5295+
return getLoweredFunctionTypeInContext(getTypeExpansionContext());
5296+
}
5297+
52945298
CanSILFunctionType SILFunction::getLoweredFunctionTypeInContext(
52955299
TypeExpansionContext context) const {
52965300
auto origFunTy = getLoweredFunctionType();
52975301
auto &M = getModule();
5298-
auto funTy = M.Types.getLoweredType(origFunTy , context);
5302+
auto funTy = M.Types.getLoweredType(origFunTy, context);
52995303
return cast<SILFunctionType>(funTy.getASTType());
53005304
}
53015305

lib/SILGen/SILGenApply.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6499,8 +6499,7 @@ void SILGenFunction::emitYield(SILLocation loc,
64996499
SmallVector<ManagedValue, 4> yieldArgs;
65006500
SmallVector<DelayedArgument, 2> delayedArgs;
65016501

6502-
auto fnType = F.getLoweredFunctionTypeInContext(getTypeExpansionContext())
6503-
->getUnsubstitutedType(SGM.M);
6502+
auto fnType = F.getLoweredFunctionTypeInContext()->getUnsubstitutedType(SGM.M);
65046503
SmallVector<SILParameterInfo, 4> substYieldTys;
65056504
for (auto origYield : fnType->getYields()) {
65066505
substYieldTys.push_back(

lib/SILGen/SILGenExpr.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3734,8 +3734,7 @@ static SILFunction *getOrCreateKeyPathGetter(
37343734
thunk->setGenericEnvironment(genericEnv);
37353735
}
37363736
SILGenFunction subSGF(SGM, *thunk, SGM.SwiftModule);
3737-
signature = subSGF.F.getLoweredFunctionTypeInContext(
3738-
subSGF.F.getTypeExpansionContext());
3737+
signature = subSGF.F.getLoweredFunctionTypeInContext();
37393738
auto resultArgTy =
37403739
subSGF.silConv.getSILType(signature->getSingleResult(), signature,
37413740
subSGF.F.getTypeExpansionContext());
@@ -3832,8 +3831,7 @@ static SILFunction *getOrCreateKeyPathSetter(
38323831
thunk->setGenericEnvironment(genericEnv);
38333832
}
38343833
SILGenFunction subSGF(SGM, *thunk, SGM.SwiftModule);
3835-
signature = subSGF.F.getLoweredFunctionTypeInContext(
3836-
subSGF.F.getTypeExpansionContext());
3834+
signature = subSGF.F.getLoweredFunctionTypeInContext();
38373835
auto valueArgTy =
38383836
subSGF.silConv.getSILType(signature->getParameters()[0], signature,
38393837
subSGF.getTypeExpansionContext());
@@ -3968,8 +3966,7 @@ static SILFunction *getOrCreateKeyPathAppliedMethod(
39683966
thunk->setGenericEnvironment(genericEnv);
39693967
}
39703968
SILGenFunction subSGF(SGM, *thunk, SGM.SwiftModule);
3971-
signature = subSGF.F.getLoweredFunctionTypeInContext(
3972-
subSGF.F.getTypeExpansionContext());
3969+
signature = subSGF.F.getLoweredFunctionTypeInContext();
39733970
auto resultArgTy =
39743971
subSGF.silConv.getSILType(signature->getSingleResult(), signature,
39753972
subSGF.F.getTypeExpansionContext());
@@ -4058,8 +4055,7 @@ static SILFunction *getOrCreateUnappliedKeypathMethod(
40584055
thunk->setGenericEnvironment(genericEnv);
40594056
}
40604057
SILGenFunction subSGF(SGM, *thunk, SGM.SwiftModule);
4061-
signature = subSGF.F.getLoweredFunctionTypeInContext(
4062-
subSGF.F.getTypeExpansionContext());
4058+
signature = subSGF.F.getLoweredFunctionTypeInContext();
40634059
auto resultArgTy =
40644060
subSGF.silConv.getSILType(signature->getSingleResult(), signature,
40654061
subSGF.F.getTypeExpansionContext());

lib/SILGen/SILGenProlog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct LoweredParamGenerator {
9292
unsigned numIgnoredTrailingParameters)
9393
: SGF(SGF), fnTy(SGF.F.getLoweredFunctionType()),
9494
parameterTypes(
95-
SGF.F.getLoweredFunctionTypeInContext(SGF.B.getTypeExpansionContext())
95+
SGF.F.getLoweredFunctionTypeInContext()
9696
->getParameters().drop_back(numIgnoredTrailingParameters)) {}
9797

9898
ParamDecl *paramDecl = nullptr;

0 commit comments

Comments
 (0)