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