SIL: Rework KeyPathInst to accommodate computed components.

- Separate out a uniquable KeyPathPattern that describes the context-free shape of the key path, with generic parameters and (eventually) subscript index slots factored out.
- Add component kinds for gettable and settable properties.
This commit is contained in:
Joe Groff
2017-04-11 19:30:06 -07:00
parent 7eebb27153
commit d6ced9d9e4
17 changed files with 812 additions and 221 deletions

View File

@@ -36,6 +36,7 @@
#include "swift/SIL/TypeLowering.h"
#include "swift/SIL/SILPrintContext.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/SetVector.h"
@@ -48,6 +49,7 @@ namespace swift {
class AnyFunctionType;
class ASTContext;
class FuncDecl;
class KeyPathPattern;
class SILUndef;
class SourceFile;
class SerializedSILLoader;
@@ -99,18 +101,19 @@ public:
using LinkingMode = SILOptions::LinkingMode;
private:
friend class SILBasicBlock;
friend class SILCoverageMap;
friend class SILDefaultWitnessTable;
friend class SILFunction;
friend class SILGlobalVariable;
friend class SILLayout;
friend class SILType;
friend class SILVTable;
friend class SILUndef;
friend class SILWitnessTable;
friend class Lowering::SILGenModule;
friend class Lowering::TypeConverter;
friend KeyPathPattern;
friend SILBasicBlock;
friend SILCoverageMap;
friend SILDefaultWitnessTable;
friend SILFunction;
friend SILGlobalVariable;
friend SILLayout;
friend SILType;
friend SILVTable;
friend SILUndef;
friend SILWitnessTable;
friend Lowering::SILGenModule;
friend Lowering::TypeConverter;
class SerializationCallback;
/// Allocator that manages the memory of all the pieces of the SILModule.
@@ -222,6 +225,9 @@ private:
/// has not been created yet.
SerializedSILLoader *getSILLoader();
/// Folding set for key path patterns.
llvm::FoldingSet<KeyPathPattern> KeyPathPatterns;
public:
~SILModule();