SIL: Introduce lowered SILLayouts.

This gives us a concept we can eventually use to cache the lowered physical layout of fragile structs and classes, and more immediately, concretize the layout of closure boxes in a way that lets us represent the capture of generic environments and multiple captured values without compromising the "nominal" nature of box layouts. To start exercising the basic implementation, change the representation of SILBoxType to be in terms of a SILLayout, though avoid any immediate functionality change by preserving the single-boxed-type interface for now.
This commit is contained in:
Joe Groff
2016-10-19 14:01:18 -07:00
parent 22f5dfa50a
commit cabaa0a51a
11 changed files with 414 additions and 26 deletions

View File

@@ -85,6 +85,7 @@ namespace swift {
class Substitution;
class TypeCheckerDebugConsumer;
class DocComment;
class SILBoxType;
enum class KnownProtocolKind : uint8_t;
@@ -156,6 +157,8 @@ public:
~ConstraintCheckerArenaRAII();
};
class SILLayout; // From SIL
/// \brief Describes either a nominal type declaration or an extension
/// declaration.
typedef llvm::PointerUnion<NominalTypeDecl *, ExtensionDecl *>
@@ -784,6 +787,10 @@ public:
clang::ObjCInterfaceDecl *classDecl,
bool forInstance);
/// Retrieve a generic signature with a single unconstrained type parameter,
/// like `<T>`.
CanGenericSignature getSingleGenericParameterSignature() const;
/// Whether our effective Swift version is in the Swift 3 family
bool isSwiftVersion3() const { return LangOpts.isSwiftVersion3(); }
@@ -821,6 +828,12 @@ private:
friend class ArchetypeType;
friend class ArchetypeBuilder::PotentialArchetype;
/// Provide context-level uniquing for SIL lowered type layouts.
friend SILLayout;
llvm::FoldingSet<SILLayout> *&getSILLayouts();
friend SILBoxType;
llvm::DenseMap<CanType, SILBoxType *> &getSILBoxTypes();
};
/// Retrieve information about the given Objective-C method for