Skip to content

Commit 980fb7c

Browse files
committed
SIL: Remove default resilience expansion from isTypeABIAccessible()
1 parent 909868f commit 980fb7c

File tree

8 files changed

+28
-18
lines changed

8 files changed

+28
-18
lines changed

include/swift/SIL/SILFunction.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,8 @@ class SILFunction
482482

483483
const Lowering::TypeLowering &getTypeLowering(SILType type) const;
484484

485+
bool isTypeABIAccessible(SILType type) const;
486+
485487
/// Returns true if this function has a calling convention that has a self
486488
/// argument.
487489
bool hasSelfParam() const {

include/swift/SIL/SILModule.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,10 +591,8 @@ class SILModule {
591591

592592
/// Can value operations (copies and destroys) on the given lowered type
593593
/// be performed in this module?
594-
// FIXME: Expansion
595594
bool isTypeABIAccessible(SILType type,
596-
ResilienceExpansion forExpansion
597-
= ResilienceExpansion::Minimal);
595+
ResilienceExpansion forExpansion);
598596

599597
/// Can type metadata for the given formal type be fetched in
600598
/// the given module?

lib/IRGen/GenEnum.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6202,8 +6202,7 @@ SingletonEnumImplStrategy::completeEnumTypeLayout(TypeConverter &TC,
62026202
if (TIK <= Opaque) {
62036203
auto alignment = eltTI.getBestKnownAlignment();
62046204
applyLayoutAttributes(TC.IGM, theEnum, /*fixed*/false, alignment);
6205-
auto enumAccessible =
6206-
IsABIAccessible_t(TC.IGM.getSILModule().isTypeABIAccessible(Type));
6205+
auto enumAccessible = IsABIAccessible_t(TC.IGM.isTypeABIAccessible(Type));
62076206
return registerEnumTypeInfo(new NonFixedEnumTypeInfo(*this, enumTy,
62086207
alignment,
62096208
eltTI.isPOD(ResilienceExpansion::Maximal),
@@ -6389,8 +6388,7 @@ TypeInfo *SinglePayloadEnumImplStrategy::completeDynamicLayout(
63896388

63906389
applyLayoutAttributes(TC.IGM, theEnum, /*fixed*/false, alignment);
63916390

6392-
auto enumAccessible =
6393-
IsABIAccessible_t(TC.IGM.getSILModule().isTypeABIAccessible(Type));
6391+
auto enumAccessible = IsABIAccessible_t(TC.IGM.isTypeABIAccessible(Type));
63946392

63956393
return registerEnumTypeInfo(new NonFixedEnumTypeInfo(*this, enumTy,
63966394
alignment,
@@ -6590,8 +6588,7 @@ TypeInfo *MultiPayloadEnumImplStrategy::completeDynamicLayout(
65906588

65916589
applyLayoutAttributes(TC.IGM, theEnum, /*fixed*/false, alignment);
65926590

6593-
auto enumAccessible =
6594-
IsABIAccessible_t(TC.IGM.getSILModule().isTypeABIAccessible(Type));
6591+
auto enumAccessible = IsABIAccessible_t(TC.IGM.isTypeABIAccessible(Type));
65956592

65966593
return registerEnumTypeInfo(new NonFixedEnumTypeInfo(*this, enumTy,
65976594
alignment, pod, bt,
@@ -6614,8 +6611,7 @@ ResilientEnumImplStrategy::completeEnumTypeLayout(TypeConverter &TC,
66146611
SILType Type,
66156612
EnumDecl *theEnum,
66166613
llvm::StructType *enumTy) {
6617-
auto abiAccessible =
6618-
IsABIAccessible_t(TC.IGM.getSILModule().isTypeABIAccessible(Type));
6614+
auto abiAccessible = IsABIAccessible_t(TC.IGM.isTypeABIAccessible(Type));
66196615
return registerEnumTypeInfo(
66206616
new ResilientEnumTypeInfo(*this, enumTy, abiAccessible));
66216617
}

lib/IRGen/GenTuple.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ namespace {
355355
FieldsAreABIAccessible_t fieldsAccessible,
356356
StructLayout &&layout) {
357357
auto tupleAccessible = IsABIAccessible_t(
358-
IGM.getSILModule().isTypeABIAccessible(TheTuple));
358+
IGM.isTypeABIAccessible(TheTuple));
359359
return NonFixedTupleTypeInfo::create(fields, fieldsAccessible,
360360
layout.getType(),
361361
layout.getAlignment(),

lib/IRGen/GenType.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,19 +1433,25 @@ const TypeInfo &IRGenFunction::getTypeInfo(SILType T) {
14331433
}
14341434

14351435
/// Return the SIL-lowering of the given type.
1436-
SILType IRGenModule::getLoweredType(AbstractionPattern orig, Type subst) {
1436+
SILType IRGenModule::getLoweredType(AbstractionPattern orig, Type subst) const {
14371437
// FIXME: Expansion
14381438
return getSILTypes().getLoweredType(orig, subst,
14391439
ResilienceExpansion::Minimal);
14401440
}
14411441

14421442
/// Return the SIL-lowering of the given type.
1443-
SILType IRGenModule::getLoweredType(Type subst) {
1443+
SILType IRGenModule::getLoweredType(Type subst) const {
14441444
// FIXME: Expansion
14451445
return getSILTypes().getLoweredType(subst,
14461446
ResilienceExpansion::Minimal);
14471447
}
14481448

1449+
bool IRGenModule::isTypeABIAccessible(SILType type) const {
1450+
// FIXME: Expansion
1451+
return getSILModule().isTypeABIAccessible(type,
1452+
ResilienceExpansion::Minimal);
1453+
}
1454+
14491455
/// Get a pointer to the storage type for the given type. Note that,
14501456
/// unlike fetching the type info and asking it for the storage type,
14511457
/// this operation will succeed for forward-declarations.

lib/IRGen/IRGenModule.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,8 +747,10 @@ class IRGenModule {
747747
getConformanceInfo(const ProtocolDecl *protocol,
748748
const ProtocolConformance *conformance);
749749

750-
SILType getLoweredType(AbstractionPattern orig, Type subst);
751-
SILType getLoweredType(Type subst);
750+
SILType getLoweredType(AbstractionPattern orig, Type subst) const;
751+
SILType getLoweredType(Type subst) const;
752+
bool isTypeABIAccessible(SILType type) const;
753+
752754
const TypeInfo &getTypeInfoForUnlowered(AbstractionPattern orig,
753755
CanType subst);
754756
const TypeInfo &getTypeInfoForUnlowered(AbstractionPattern orig,

lib/SIL/SILFunction.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ const TypeLowering &SILFunction::getTypeLowering(SILType type) const {
263263
ResilienceExpansion::Minimal);
264264
}
265265

266+
bool SILFunction::isTypeABIAccessible(SILType type) const {
267+
// FIXME: Expansion
268+
return getModule().isTypeABIAccessible(type,
269+
ResilienceExpansion::Minimal);
270+
}
271+
266272
SILBasicBlock *SILFunction::createBasicBlock() {
267273
return new (getModule()) SILBasicBlock(this, nullptr, false);
268274
}

lib/SIL/SILVerifier.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,7 +1913,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
19131913
"Dest address should be lvalue");
19141914
require(SI->getDest()->getType() == SI->getSrc()->getType(),
19151915
"Store operand type and dest type mismatch");
1916-
require(F.getModule().isTypeABIAccessible(SI->getDest()->getType()),
1916+
require(F.isTypeABIAccessible(SI->getDest()->getType()),
19171917
"cannot directly copy type with inaccessible ABI");
19181918
}
19191919

@@ -2328,7 +2328,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
23282328
void checkDestroyAddrInst(DestroyAddrInst *DI) {
23292329
require(DI->getOperand()->getType().isAddress(),
23302330
"Operand of destroy_addr must be address");
2331-
require(F.getModule().isTypeABIAccessible(DI->getOperand()->getType()),
2331+
require(F.isTypeABIAccessible(DI->getOperand()->getType()),
23322332
"cannot directly destroy type with inaccessible ABI");
23332333
}
23342334

0 commit comments

Comments
 (0)