@@ -339,6 +339,13 @@ class alignas(1 << TypeAlignInBits) TypeBase {
339
339
};
340
340
NUMBITS (SILFunctionType, NumTypeBaseBits + 12 );
341
341
342
+ struct SILBoxTypeBitfields {
343
+ unsigned : NumTypeBaseBits;
344
+ unsigned : 32 - NumTypeBaseBits; // unused / padding
345
+ unsigned NumGenericArgs : 32 ;
346
+ };
347
+ NUMBITS (SILBoxType, 64 );
348
+
342
349
struct AnyMetatypeTypeBitfields {
343
350
unsigned : NumTypeBaseBits;
344
351
// / The representation of the metatype.
@@ -379,6 +386,7 @@ class alignas(1 << TypeAlignInBits) TypeBase {
379
386
TypeVariableTypeBitfields TypeVariableTypeBits;
380
387
ArchetypeTypeBitfields ArchetypeTypeBits;
381
388
SILFunctionTypeBitfields SILFunctionTypeBits;
389
+ SILBoxTypeBitfields SILBoxTypeBits;
382
390
AnyMetatypeTypeBitfields AnyMetatypeTypeBits;
383
391
ProtocolCompositionTypeBitfields ProtocolCompositionTypeBits;
384
392
TupleTypeBitfields TupleTypeBits;
@@ -2955,7 +2963,7 @@ enum class ParameterConvention {
2955
2963
};
2956
2964
// Check that the enum values fit inside SILFunctionTypeBits.
2957
2965
static_assert (unsigned (ParameterConvention::Direct_Guaranteed) < (1 <<3 ),
2958
- "fits in SILFunctionTypeBits");
2966
+ "fits in SILFunctionTypeBits and SILParameterInfo ");
2959
2967
2960
2968
// Does this parameter convention require indirect storage? This reflects a
2961
2969
// SILFunctionType's formal (immutable) conventions, as opposed to the transient
@@ -3015,20 +3023,19 @@ inline bool isGuaranteedParameter(ParameterConvention conv) {
3015
3023
3016
3024
// / A parameter type and the rules for passing it.
3017
3025
class SILParameterInfo {
3018
- CanType Ty;
3019
- ParameterConvention Convention;
3026
+ llvm::PointerIntPair<CanType, 3 , ParameterConvention> TypeAndConvention;
3020
3027
public:
3021
- SILParameterInfo () : Ty(), Convention((ParameterConvention)0 ) {}
3028
+ SILParameterInfo () = default ; // : Ty(), Convention((ParameterConvention)0) {}
3022
3029
SILParameterInfo (CanType type, ParameterConvention conv)
3023
- : Ty (type), Convention( conv) {
3030
+ : TypeAndConvention (type, conv) {
3024
3031
assert (type->isLegalSILType () && " SILParameterInfo has illegal SIL type" );
3025
3032
}
3026
3033
3027
3034
CanType getType () const {
3028
- return Ty ;
3035
+ return TypeAndConvention. getPointer () ;
3029
3036
}
3030
3037
ParameterConvention getConvention () const {
3031
- return Convention ;
3038
+ return TypeAndConvention. getInt () ;
3032
3039
}
3033
3040
// Does this parameter convention require indirect storage? This reflects a
3034
3041
// SILFunctionType's formal (immutable) conventions, as opposed to the
@@ -3089,8 +3096,8 @@ class SILParameterInfo {
3089
3096
}
3090
3097
3091
3098
void profile (llvm::FoldingSetNodeID &id) {
3092
- id.AddPointer (Ty .getPointer ());
3093
- id.AddInteger ((unsigned )Convention );
3099
+ id.AddPointer (getType () .getPointer ());
3100
+ id.AddInteger ((unsigned )getConvention () );
3094
3101
}
3095
3102
3096
3103
void dump () const ;
@@ -3104,7 +3111,7 @@ class SILParameterInfo {
3104
3111
}
3105
3112
3106
3113
bool operator ==(SILParameterInfo rhs) const {
3107
- return Ty == rhs.Ty && Convention == rhs.Convention ;
3114
+ return getType () == rhs.getType () && getConvention () == rhs.getConvention () ;
3108
3115
}
3109
3116
bool operator !=(SILParameterInfo rhs) const {
3110
3117
return !(*this == rhs);
@@ -3807,7 +3814,6 @@ class SILBoxType final : public TypeBase,
3807
3814
friend TrailingObjects;
3808
3815
3809
3816
SILLayout *Layout;
3810
- unsigned NumGenericArgs;
3811
3817
3812
3818
static RecursiveTypeProperties
3813
3819
getRecursivePropertiesFromSubstitutions (SubstitutionList Args);
@@ -3823,7 +3829,7 @@ class SILBoxType final : public TypeBase,
3823
3829
SILLayout *getLayout () const { return Layout; }
3824
3830
SubstitutionList getGenericArgs () const {
3825
3831
return llvm::makeArrayRef (getTrailingObjects<Substitution>(),
3826
- NumGenericArgs);
3832
+ SILBoxTypeBits. NumGenericArgs );
3827
3833
}
3828
3834
3829
3835
// In SILType.h:
0 commit comments