@@ -3640,7 +3640,7 @@ inline CanGenericSignature CanAnyFunctionType::getOptGenericSignature() const {
3640
3640
}
3641
3641
3642
3642
// / Conventions for passing arguments as parameters.
3643
- enum class ParameterConvention {
3643
+ enum class ParameterConvention : uint8_t {
3644
3644
// / This argument is passed indirectly, i.e. by directly passing the address
3645
3645
// / of an object in memory. The callee is responsible for destroying the
3646
3646
// / object. The callee may assume that the address does not alias any valid
@@ -3686,7 +3686,7 @@ enum class ParameterConvention {
3686
3686
};
3687
3687
// Check that the enum values fit inside Bits.SILFunctionType.
3688
3688
static_assert (unsigned (ParameterConvention::Direct_Guaranteed) < (1 <<3 ),
3689
- "fits in Bits.SILFunctionType and SILParameterInfo ");
3689
+ "fits in Bits.SILFunctionType");
3690
3690
3691
3691
// Does this parameter convention require indirect storage? This reflects a
3692
3692
// SILFunctionType's formal (immutable) conventions, as opposed to the transient
@@ -3745,7 +3745,7 @@ inline bool isGuaranteedParameter(ParameterConvention conv) {
3745
3745
}
3746
3746
3747
3747
// / The differentiability of a SIL function type parameter.
3748
- enum class SILParameterDifferentiability : unsigned {
3748
+ enum class SILParameterDifferentiability : bool {
3749
3749
// / Either differentiable or not applicable.
3750
3750
// /
3751
3751
// / - If the function type is not `@differentiable`, parameter
@@ -3763,16 +3763,17 @@ enum class SILParameterDifferentiability : unsigned {
3763
3763
3764
3764
// / A parameter type and the rules for passing it.
3765
3765
class SILParameterInfo {
3766
- llvm::PointerIntPair<CanType, 3 , ParameterConvention> TypeAndConvention;
3767
- SILParameterDifferentiability Differentiability : 1 ;
3766
+ CanType Type;
3767
+ ParameterConvention Convention;
3768
+ SILParameterDifferentiability Differentiability;
3768
3769
3769
3770
public:
3770
3771
SILParameterInfo () = default ;// : Ty(), Convention((ParameterConvention)0) {}
3771
3772
SILParameterInfo (
3772
3773
CanType type, ParameterConvention conv,
3773
3774
SILParameterDifferentiability differentiability =
3774
3775
SILParameterDifferentiability::DifferentiableOrNotApplicable)
3775
- : TypeAndConvention (type, conv), Differentiability(differentiability) {
3776
+ : Type (type), Convention( conv), Differentiability(differentiability) {
3776
3777
assert (type->isLegalSILType () && " SILParameterInfo has illegal SIL type" );
3777
3778
}
3778
3779
@@ -3781,15 +3782,15 @@ class SILParameterInfo {
3781
3782
// /
3782
3783
// / For most purposes, you probably want \c getArgumentType .
3783
3784
CanType getInterfaceType () const {
3784
- return TypeAndConvention. getPointer () ;
3785
+ return Type ;
3785
3786
}
3786
3787
3787
3788
// / Return the type of a call argument matching this parameter.
3788
3789
// /
3789
3790
// / \c t must refer back to the function type this is a parameter for.
3790
3791
CanType getArgumentType (SILModule &M, const SILFunctionType *t, TypeExpansionContext context) const ;
3791
3792
ParameterConvention getConvention () const {
3792
- return TypeAndConvention. getInt () ;
3793
+ return Convention ;
3793
3794
}
3794
3795
// Does this parameter convention require indirect storage? This reflects a
3795
3796
// SILFunctionType's formal (immutable) conventions, as opposed to the
@@ -3908,7 +3909,7 @@ class SILParameterInfo {
3908
3909
};
3909
3910
3910
3911
// / Conventions for returning values.
3911
- enum class ResultConvention {
3912
+ enum class ResultConvention : uint8_t {
3912
3913
// / This result is returned indirectly, i.e. by passing the address
3913
3914
// / of an uninitialized object in memory. The callee is responsible
3914
3915
// / for leaving an initialized object at this address. The callee
@@ -3943,7 +3944,7 @@ inline bool isIndirectFormalResult(ResultConvention convention) {
3943
3944
}
3944
3945
3945
3946
// / The differentiability of a SIL function type result.
3946
- enum class SILResultDifferentiability : unsigned {
3947
+ enum class SILResultDifferentiability : bool {
3947
3948
// / Either differentiable or not applicable.
3948
3949
// /
3949
3950
// / - If the function type is not `@differentiable`, result
@@ -3961,15 +3962,16 @@ enum class SILResultDifferentiability : unsigned {
3961
3962
3962
3963
// / A result type and the rules for returning it.
3963
3964
class SILResultInfo {
3964
- llvm::PointerIntPair<CanType, 3 , ResultConvention> TypeAndConvention;
3965
- SILResultDifferentiability Differentiability : 1 ;
3965
+ CanType Type;
3966
+ ResultConvention Convention;
3967
+ SILResultDifferentiability Differentiability;
3966
3968
3967
3969
public:
3968
3970
SILResultInfo () = default ;
3969
3971
SILResultInfo (CanType type, ResultConvention conv,
3970
3972
SILResultDifferentiability differentiability =
3971
3973
SILResultDifferentiability::DifferentiableOrNotApplicable)
3972
- : TypeAndConvention (type, conv), Differentiability(differentiability) {
3974
+ : Type (type), Convention( conv), Differentiability(differentiability) {
3973
3975
assert (type->isLegalSILType () && " SILResultInfo has illegal SIL type" );
3974
3976
}
3975
3977
@@ -3978,7 +3980,7 @@ class SILResultInfo {
3978
3980
// /
3979
3981
// / For most purposes, you probably want \c getReturnValueType .
3980
3982
CanType getInterfaceType () const {
3981
- return TypeAndConvention. getPointer () ;
3983
+ return Type ;
3982
3984
}
3983
3985
3984
3986
// / The type of a return value corresponding to this result.
@@ -3988,7 +3990,7 @@ class SILResultInfo {
3988
3990
TypeExpansionContext context) const ;
3989
3991
3990
3992
ResultConvention getConvention () const {
3991
- return TypeAndConvention. getInt () ;
3993
+ return Convention ;
3992
3994
}
3993
3995
3994
3996
SILResultDifferentiability getDifferentiability () const {
@@ -4056,8 +4058,9 @@ class SILResultInfo {
4056
4058
}
4057
4059
4058
4060
void profile (llvm::FoldingSetNodeID &id) {
4059
- id.AddPointer (TypeAndConvention.getOpaqueValue ());
4060
- id.AddInteger ((unsigned )getDifferentiability ());
4061
+ id.AddPointer (Type.getPointer ());
4062
+ id.AddInteger (unsigned (getConvention ()));
4063
+ id.AddInteger (unsigned (getDifferentiability ()));
4061
4064
}
4062
4065
4063
4066
SWIFT_DEBUG_DUMP;
@@ -4074,7 +4077,8 @@ class SILResultInfo {
4074
4077
getOwnershipKind (SILFunction &, CanSILFunctionType fTy ) const ; // in SILType.cpp
4075
4078
4076
4079
bool operator ==(SILResultInfo rhs) const {
4077
- return TypeAndConvention == rhs.TypeAndConvention ;
4080
+ return Type == rhs.Type && Convention == rhs.Convention
4081
+ && Differentiability == rhs.Differentiability ;
4078
4082
}
4079
4083
bool operator !=(SILResultInfo rhs) const {
4080
4084
return !(*this == rhs);
0 commit comments