@@ -3834,6 +3834,11 @@ class SILParameterInfo {
3834
3834
return SILParameterInfo (type, getConvention (), getDifferentiability ());
3835
3835
}
3836
3836
3837
+ // / Return a version of this parameter info with the convention replaced.
3838
+ SILParameterInfo getWithConvention (ParameterConvention c) const {
3839
+ return SILParameterInfo (getInterfaceType (), c, getDifferentiability ());
3840
+ }
3841
+
3837
3842
// / Transform this SILParameterInfo by applying the user-provided
3838
3843
// / function to its type.
3839
3844
// /
@@ -3849,6 +3854,15 @@ class SILParameterInfo {
3849
3854
->getCanonicalType ());
3850
3855
}
3851
3856
3857
+ // / Treating this parameter info as a component of the given function
3858
+ // / type, apply any substitutions from the function type to it to
3859
+ // / get a substituted version of it, as you would get from
3860
+ // / SILFunctionType::getUnsubstitutedType.
3861
+ SILParameterInfo getUnsubstituted (SILModule &M,
3862
+ const SILFunctionType *fnType) const {
3863
+ return getWithInterfaceType (getArgumentType (M, fnType));
3864
+ }
3865
+
3852
3866
void profile (llvm::FoldingSetNodeID &id) {
3853
3867
id.AddPointer (getInterfaceType ().getPointer ());
3854
3868
id.AddInteger ((unsigned )getConvention ());
@@ -3951,6 +3965,11 @@ class SILResultInfo {
3951
3965
return SILResultInfo (type, getConvention ());
3952
3966
}
3953
3967
3968
+ // / Return a version of this result info with the convention replaced.
3969
+ SILResultInfo getWithConvention (ResultConvention c) const {
3970
+ return SILResultInfo (getInterfaceType (), c);
3971
+ }
3972
+
3954
3973
// Does this result convention require indirect storage? This reflects a
3955
3974
// SILFunctionType's formal (immutable) conventions, as opposed to the
3956
3975
// transient SIL conventions that dictate SILValue types.
@@ -3976,6 +3995,15 @@ class SILResultInfo {
3976
3995
->getCanonicalType ());
3977
3996
}
3978
3997
3998
+ // / Treating this result info as a component of the given function
3999
+ // / type, apply any substitutions from the function type to it to
4000
+ // / get a substituted version of it, as you would get from
4001
+ // / SILFunctionType::getUnsubstitutedType.
4002
+ SILResultInfo getUnsubstituted (SILModule &M,
4003
+ const SILFunctionType *fnType) const {
4004
+ return getWithInterfaceType (getReturnValueType (M, fnType));
4005
+ }
4006
+
3979
4007
void profile (llvm::FoldingSetNodeID &id) {
3980
4008
id.AddPointer (TypeAndConvention.getOpaqueValue ());
3981
4009
}
@@ -4016,6 +4044,11 @@ class SILYieldInfo : public SILParameterInfo {
4016
4044
return SILYieldInfo (type, getConvention ());
4017
4045
}
4018
4046
4047
+ // / Return a version of this yield info with the convention replaced.
4048
+ SILYieldInfo getWithConvention (YieldConvention c) const {
4049
+ return SILYieldInfo (getInterfaceType (), c);
4050
+ }
4051
+
4019
4052
template <typename F>
4020
4053
SILYieldInfo map (const F &fn) const {
4021
4054
return getWithInterfaceType (fn (getInterfaceType ()));
@@ -4025,6 +4058,20 @@ class SILYieldInfo : public SILParameterInfo {
4025
4058
return getWithInterfaceType (getInterfaceType ()->mapTypeOutOfContext ()
4026
4059
->getCanonicalType ());
4027
4060
}
4061
+
4062
+ CanType getYieldValueType (SILModule &M,
4063
+ const SILFunctionType *fnType) const {
4064
+ return getArgumentType (M, fnType);
4065
+ }
4066
+
4067
+ // / Treating this yield info as a component of the given function
4068
+ // / type, apply any substitutions from the function type to it to
4069
+ // / get a substituted version of it, as you would get from
4070
+ // / SILFunctionType::getUnsubstitutedType.
4071
+ SILYieldInfo getUnsubstituted (SILModule &M,
4072
+ const SILFunctionType *fnType) const {
4073
+ return getWithInterfaceType (getYieldValueType (M, fnType));
4074
+ }
4028
4075
};
4029
4076
4030
4077
// / SILCoroutineKind - What kind of coroutine is this SILFunction?
0 commit comments