@@ -470,7 +470,7 @@ namespace {
470
470
}
471
471
472
472
void destroy (IRGenFunction &IGF, Address addr, SILType T) const override {
473
- if (getSingleton () && !getSingleton ()->isPOD (ResilienceScope::Component ))
473
+ if (getSingleton () && !getSingleton ()->isPOD (ResilienceExpansion::Maximal ))
474
474
getSingleton ()->destroy (IGF, getSingletonAddress (IGF, addr),
475
475
getSingletonType (IGF.IGM , T));
476
476
}
@@ -1193,10 +1193,10 @@ namespace {
1193
1193
void assign (IRGenFunction &IGF, Explosion &e, Address addr) const override {
1194
1194
assert (TIK >= Loadable);
1195
1195
Explosion old;
1196
- if (!isPOD (ResilienceScope::Component ))
1196
+ if (!isPOD (ResilienceExpansion::Maximal ))
1197
1197
loadAsTake (IGF, addr, old);
1198
1198
initialize (IGF, e, addr);
1199
- if (!isPOD (ResilienceScope::Component ))
1199
+ if (!isPOD (ResilienceExpansion::Maximal ))
1200
1200
consume (IGF, old);
1201
1201
}
1202
1202
@@ -1376,13 +1376,13 @@ namespace {
1376
1376
1377
1377
// If the payload is POD, then we can use POD value semantics.
1378
1378
auto &payloadTI = *ElementsWithPayload[0 ].ti ;
1379
- if (payloadTI.isPOD (ResilienceScope::Component )) {
1379
+ if (payloadTI.isPOD (ResilienceExpansion::Maximal )) {
1380
1380
CopyDestroyKind = POD;
1381
1381
// If the payload is a single refcounted pointer and we have a single
1382
1382
// empty case, then the layout will be a nullable pointer, and we can
1383
1383
// pass enum values directly into swift_retain/swift_release as-is.
1384
1384
} else if (tik >= TypeInfoKind::Loadable
1385
- && payloadTI.isSingleRetainablePointer (ResilienceScope::Component ,
1385
+ && payloadTI.isSingleRetainablePointer (ResilienceExpansion::Maximal ,
1386
1386
&Refcounting)
1387
1387
&& ElementsWithNoPayload.size () == 1
1388
1388
// FIXME: All single-retainable-pointer types should eventually have
@@ -2775,14 +2775,14 @@ namespace {
2775
2775
bool allSingleRefcount = true ;
2776
2776
bool haveRefcounting = false ;
2777
2777
for (auto &elt : ElementsWithPayload) {
2778
- if (!elt.ti ->isPOD (ResilienceScope::Component ))
2778
+ if (!elt.ti ->isPOD (ResilienceExpansion::Maximal ))
2779
2779
allPOD = false ;
2780
- if (!elt.ti ->isBitwiseTakable (ResilienceScope::Component ))
2780
+ if (!elt.ti ->isBitwiseTakable (ResilienceExpansion::Maximal ))
2781
2781
allBitwiseTakable = false ;
2782
2782
2783
2783
// refcounting is only set in the else branches
2784
2784
ReferenceCounting refcounting;
2785
- if (!elt.ti ->isSingleRetainablePointer (ResilienceScope::Component ,
2785
+ if (!elt.ti ->isSingleRetainablePointer (ResilienceExpansion::Maximal ,
2786
2786
&refcounting)) {
2787
2787
allSingleRefcount = false ;
2788
2788
} else if (haveRefcounting) {
@@ -3579,7 +3579,7 @@ namespace {
3579
3579
auto &payloadTI = *payloadCasePair.ti ;
3580
3580
3581
3581
// Trivial payloads don't need any work.
3582
- if (payloadTI.isPOD (ResilienceScope::Component )) {
3582
+ if (payloadTI.isPOD (ResilienceExpansion::Maximal )) {
3583
3583
++tagIndex;
3584
3584
continue ;
3585
3585
}
@@ -3861,8 +3861,8 @@ namespace {
3861
3861
auto &payloadTI = *payloadCasePair.ti ;
3862
3862
// Trivial and, in the case of a take, bitwise-takable payloads,
3863
3863
// can all share the default path.
3864
- if (payloadTI.isPOD (ResilienceScope::Component )
3865
- || (isTake && payloadTI.isBitwiseTakable (ResilienceScope::Component ))) {
3864
+ if (payloadTI.isPOD (ResilienceExpansion::Maximal )
3865
+ || (isTake && payloadTI.isBitwiseTakable (ResilienceExpansion::Maximal ))) {
3866
3866
++tagIndex;
3867
3867
continue ;
3868
3868
}
@@ -4646,17 +4646,19 @@ EnumImplStrategy *EnumImplStrategy::get(TypeConverter &TC,
4646
4646
// 1) Physical case indices won't change
4647
4647
// 2) The indirect-ness of cases won't change
4648
4648
// 3) Payload types won't change in a non-resilient way
4649
- bool isResilient = TC.IGM .isResilient (theEnum, ResilienceScope::Component );
4649
+ bool isResilient = TC.IGM .isResilient (theEnum, ResilienceExpansion::Maximal );
4650
4650
4651
4651
// The most general resilience scope where the enum type is visible.
4652
4652
// Case numbering must not depend on any information that is not static
4653
4653
// in this resilience scope.
4654
- ResilienceScope accessScope = TC.IGM .getResilienceScopeForAccess (theEnum);
4654
+ ResilienceExpansion accessScope =
4655
+ TC.IGM .getResilienceExpansionForAccess (theEnum);
4655
4656
4656
4657
// The most general resilience scope where the enum's layout is known.
4657
4658
// Fixed-size optimizations can be applied if all payload types are
4658
4659
// fixed-size from this resilience scope.
4659
- ResilienceScope layoutScope = TC.IGM .getResilienceScopeForLayout (theEnum);
4660
+ ResilienceExpansion layoutScope =
4661
+ TC.IGM .getResilienceExpansionForLayout (theEnum);
4660
4662
4661
4663
for (auto elt : theEnum->getAllElements ()) {
4662
4664
numElements++;
@@ -4711,7 +4713,7 @@ EnumImplStrategy *EnumImplStrategy::get(TypeConverter &TC,
4711
4713
elementsWithPayload.push_back ({elt, substArgTI, origArgTI});
4712
4714
4713
4715
if (!isResilient) {
4714
- if (!substArgTI->isFixedSize (ResilienceScope::Component ))
4716
+ if (!substArgTI->isFixedSize (ResilienceExpansion::Maximal ))
4715
4717
tik = Opaque;
4716
4718
else if (!substArgTI->isLoadable () && tik > Fixed )
4717
4719
tik = Fixed ;
@@ -5034,8 +5036,8 @@ SingletonEnumImplStrategy::completeEnumTypeLayout(TypeConverter &TC,
5034
5036
alignment);
5035
5037
return registerEnumTypeInfo (new NonFixedEnumTypeInfo (*this , enumTy,
5036
5038
alignment,
5037
- eltTI.isPOD (ResilienceScope::Component ),
5038
- eltTI.isBitwiseTakable (ResilienceScope::Component )));
5039
+ eltTI.isPOD (ResilienceExpansion::Maximal ),
5040
+ eltTI.isBitwiseTakable (ResilienceExpansion::Maximal )));
5039
5041
} else {
5040
5042
auto &fixedEltTI = cast<FixedTypeInfo>(eltTI);
5041
5043
auto alignment = fixedEltTI.getFixedAlignment ();
@@ -5046,8 +5048,8 @@ SingletonEnumImplStrategy::completeEnumTypeLayout(TypeConverter &TC,
5046
5048
fixedEltTI.getFixedSize (),
5047
5049
fixedEltTI.getSpareBits (),
5048
5050
alignment,
5049
- fixedEltTI.isPOD (ResilienceScope::Component ),
5050
- fixedEltTI.isBitwiseTakable (ResilienceScope::Component ));
5051
+ fixedEltTI.isPOD (ResilienceExpansion::Maximal ),
5052
+ fixedEltTI.isBitwiseTakable (ResilienceExpansion::Maximal ));
5051
5053
}
5052
5054
}
5053
5055
}
@@ -5106,7 +5108,7 @@ CCompatibleEnumImplStrategy::completeEnumTypeLayout(TypeConverter &TC,
5106
5108
auto &rawTI = TC.getCompleteTypeInfo (
5107
5109
theEnum->getRawType ()->getCanonicalType ());
5108
5110
auto &rawFixedTI = cast<FixedTypeInfo>(rawTI);
5109
- assert (rawFixedTI.isPOD (ResilienceScope::Component )
5111
+ assert (rawFixedTI.isPOD (ResilienceExpansion::Maximal )
5110
5112
&& " c-compatible raw type isn't POD?!" );
5111
5113
ExplosionSchema rawSchema = rawTI.getSchema ();
5112
5114
assert (rawSchema.size () == 1
@@ -5122,7 +5124,7 @@ CCompatibleEnumImplStrategy::completeEnumTypeLayout(TypeConverter &TC,
5122
5124
applyLayoutAttributes (TC.IGM , Type.getSwiftRValueType (), /* fixed*/ true ,
5123
5125
alignment);
5124
5126
5125
- assert (!TC.IGM .isResilient (theEnum, ResilienceScope::Universal ) &&
5127
+ assert (!TC.IGM .isResilient (theEnum, ResilienceExpansion::Minimal ) &&
5126
5128
" C-compatible enums cannot be resilient" );
5127
5129
5128
5130
return registerEnumTypeInfo (new LoadableEnumTypeInfo (*this , enumTy,
@@ -5196,8 +5198,8 @@ TypeInfo *SinglePayloadEnumImplStrategy::completeFixedLayout(
5196
5198
5197
5199
return getFixedEnumTypeInfo (enumTy, Size (sizeWithTag), std::move (spareBits),
5198
5200
alignment,
5199
- payloadTI.isPOD (ResilienceScope::Component ),
5200
- payloadTI.isBitwiseTakable (ResilienceScope::Component ));
5201
+ payloadTI.isPOD (ResilienceExpansion::Maximal ),
5202
+ payloadTI.isBitwiseTakable (ResilienceExpansion::Maximal ));
5201
5203
}
5202
5204
5203
5205
TypeInfo *SinglePayloadEnumImplStrategy::completeDynamicLayout (
@@ -5219,8 +5221,8 @@ TypeInfo *SinglePayloadEnumImplStrategy::completeDynamicLayout(
5219
5221
5220
5222
return registerEnumTypeInfo (new NonFixedEnumTypeInfo (*this , enumTy,
5221
5223
alignment,
5222
- payloadTI.isPOD (ResilienceScope::Component ),
5223
- payloadTI.isBitwiseTakable (ResilienceScope::Component )));
5224
+ payloadTI.isPOD (ResilienceExpansion::Maximal ),
5225
+ payloadTI.isBitwiseTakable (ResilienceExpansion::Maximal )));
5224
5226
}
5225
5227
5226
5228
TypeInfo *
@@ -5256,9 +5258,9 @@ MultiPayloadEnumImplStrategy::completeFixedLayout(TypeConverter &TC,
5256
5258
auto &fixedPayloadTI = cast<FixedTypeInfo>(*elt.ti );
5257
5259
if (fixedPayloadTI.getFixedAlignment () > worstAlignment)
5258
5260
worstAlignment = fixedPayloadTI.getFixedAlignment ();
5259
- if (!fixedPayloadTI.isPOD (ResilienceScope::Component ))
5261
+ if (!fixedPayloadTI.isPOD (ResilienceExpansion::Maximal ))
5260
5262
isPOD = IsNotPOD;
5261
- if (!fixedPayloadTI.isBitwiseTakable (ResilienceScope::Component ))
5263
+ if (!fixedPayloadTI.isBitwiseTakable (ResilienceExpansion::Maximal ))
5262
5264
isBT = IsNotBitwiseTakable;
5263
5265
5264
5266
unsigned payloadBytes = fixedPayloadTI.getFixedSize ().getValue ();
@@ -5401,8 +5403,8 @@ TypeInfo *MultiPayloadEnumImplStrategy::completeDynamicLayout(
5401
5403
for (auto &element : ElementsWithPayload) {
5402
5404
auto &payloadTI = *element.ti ;
5403
5405
alignment = std::max (alignment, payloadTI.getBestKnownAlignment ());
5404
- pod &= payloadTI.isPOD (ResilienceScope::Component );
5405
- bt &= payloadTI.isBitwiseTakable (ResilienceScope::Component );
5406
+ pod &= payloadTI.isPOD (ResilienceExpansion::Maximal );
5407
+ bt &= payloadTI.isBitwiseTakable (ResilienceExpansion::Maximal );
5406
5408
}
5407
5409
5408
5410
applyLayoutAttributes (TC.IGM , Type.getSwiftRValueType (), /* fixed*/ false ,
@@ -5436,7 +5438,7 @@ const TypeInfo *TypeConverter::convertEnumType(TypeBase *key, CanType type,
5436
5438
llvm::StructType *storageType;
5437
5439
5438
5440
// Resilient enum types lower down to the same opaque type.
5439
- if (IGM.isResilient (theEnum, ResilienceScope::Component ))
5441
+ if (IGM.isResilient (theEnum, ResilienceExpansion::Maximal ))
5440
5442
storageType = cast<llvm::StructType>(IGM.OpaquePtrTy ->getElementType ());
5441
5443
else
5442
5444
storageType = IGM.createNominalType (theEnum);
0 commit comments