IRGen: Kill classifyTypeSize(), NFC
diff --git a/lib/IRGen/GenType.cpp b/lib/IRGen/GenType.cpp
index ddf30a9..0c1f4ef 100644
--- a/lib/IRGen/GenType.cpp
+++ b/lib/IRGen/GenType.cpp
@@ -1924,114 +1924,6 @@
}
-namespace {
- struct ClassifyTypeSize : CanTypeVisitor<ClassifyTypeSize, ObjectSize> {
- IRGenModule &IGM;
- ResilienceScope Scope;
- ClassifyTypeSize(IRGenModule &IGM, ResilienceScope scope)
- : IGM(IGM), Scope(scope) {}
-
-#define ALWAYS(KIND, RESULT) \
- ObjectSize visit##KIND##Type(KIND##Type *t) { return ObjectSize::RESULT; }
-
- ALWAYS(Builtin, Fixed)
- ALWAYS(SILFunction, Fixed)
- ALWAYS(Class, Fixed)
- ALWAYS(BoundGenericClass, Fixed)
- ALWAYS(Protocol, Fixed)
- ALWAYS(ProtocolComposition, Fixed)
- ALWAYS(LValue, Dependent)
-#undef ALWAYS
-
- ObjectSize visitArchetypeType(CanArchetypeType archetype) {
- if (archetype->requiresClass())
- return ObjectSize::Fixed;
- return ObjectSize::Dependent;
- }
-
- ObjectSize visitTupleType(CanTupleType tuple) {
- ObjectSize result = ObjectSize::Fixed;
- for (auto eltType : tuple.getElementTypes()) {
- result = std::max(result, visit(eltType));
- }
- return result;
- }
-
- ObjectSize visitStructType(CanStructType type) {
- if (type->getDecl()->getGenericParamsOfContext())
- return visitGenericStructType(type, type->getDecl());
- if (IGM.isResilient(type->getDecl(), Scope))
- return ObjectSize::Resilient;
- return ObjectSize::Fixed;
- }
-
- ObjectSize visitBoundGenericStructType(CanBoundGenericStructType type) {
- return visitGenericStructType(type, type->getDecl());
- }
-
- ObjectSize visitGenericStructType(CanType type, StructDecl *D) {
- assert(D->getGenericParamsOfContext());
-
- // If a generic struct is resilient, we have to assume that any
- // unknown fields might be dependently-sized.
- if (IGM.isResilient(D, Scope))
- return ObjectSize::Dependent;
-
- auto structType = SILType::getPrimitiveAddressType(type);
-
- ObjectSize result = ObjectSize::Fixed;
- for (auto field : D->getStoredProperties()) {
- auto fieldType = structType.getFieldType(field, *IGM.SILMod);
- result = std::max(result, visitSILType(fieldType));
- }
- return result;
- }
-
- ObjectSize visitEnumType(CanEnumType type) {
- if (type->getDecl()->getGenericParamsOfContext())
- return visitGenericEnumType(type, type->getDecl());
- if (IGM.isResilient(type->getDecl(), Scope))
- return ObjectSize::Resilient;
- return ObjectSize::Fixed;
- }
-
- ObjectSize visitBoundGenericEnumType(CanBoundGenericEnumType type) {
- return visitGenericEnumType(type, type->getDecl());
- }
-
- ObjectSize visitGenericEnumType(CanType type, EnumDecl *D) {
- assert(D->getGenericParamsOfContext());
-
- // If a generic enum is resilient, we have to assume that any
- // unknown elements might be dependently-sized.
- if (IGM.isResilient(D, Scope))
- return ObjectSize::Dependent;
-
- auto enumType = SILType::getPrimitiveAddressType(type);
-
- ObjectSize result = ObjectSize::Fixed;
- for (auto elt : D->getAllElements()) {
- if (!elt->hasArgumentType()) continue;
- auto eltType = enumType.getEnumElementType(elt, *IGM.SILMod);
- result = std::max(result, visitSILType(eltType));
- }
- return result;
- }
-
- ObjectSize visitType(CanType type) {
- return ObjectSize::Fixed;
- }
-
- ObjectSize visitSILType(SILType type) {
- return visit(type.getSwiftRValueType());
- }
- };
-}
-
-ObjectSize IRGenModule::classifyTypeSize(SILType type, ResilienceScope scope) {
- return ClassifyTypeSize(*this, scope).visitSILType(type);
-}
-
SpareBitVector IRGenModule::getSpareBitsForType(llvm::Type *scalarTy, Size size) {
auto it = SpareBitsForTypes.find(scalarTy);
if (it != SpareBitsForTypes.end())
diff --git a/lib/IRGen/IRGen.h b/lib/IRGen/IRGen.h
index 2cc93bd..172fd54 100644
--- a/lib/IRGen/IRGen.h
+++ b/lib/IRGen/IRGen.h
@@ -116,20 +116,6 @@
Universal
};
-/// Whether an object is fixed in size or not. This answer is always
-/// relative to some resilience scope.
-enum class ObjectSize : uint8_t {
- /// The object's size is fixed in the resilience scope.
- Fixed,
-
- /// The object's size is unknown in the resilience domain, but it is
- /// not dependent.
- Resilient,
-
- /// The object's size is dependent on a generic parameter.
- Dependent
-};
-
/// Destructor variants.
enum class DestructorKind : uint8_t {
/// A deallocating destructor destroys the object and deallocates
diff --git a/lib/IRGen/IRGenModule.h b/lib/IRGen/IRGenModule.h
index d32f435..5e4680a 100644
--- a/lib/IRGen/IRGenModule.h
+++ b/lib/IRGen/IRGenModule.h
@@ -470,7 +470,6 @@
llvm::PointerType *isSingleIndirectValue(SILType T);
llvm::PointerType *requiresIndirectResult(SILType T);
bool isPOD(SILType type, ResilienceScope scope);
- ObjectSize classifyTypeSize(SILType type, ResilienceScope scope);
clang::CanQual<clang::Type> getClangType(CanType type);
clang::CanQual<clang::Type> getClangType(SILType type);
clang::CanQual<clang::Type> getClangType(SILParameterInfo param);