Skip to content

Commit d9205fa

Browse files
committed
[IRGen] Prepare to emit prespecializations.
1 parent 840ded4 commit d9205fa

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,7 @@ void IRGenerator::emitLazyDefinitions() {
11501150
CanType type = LazySpecializedTypeMetadataRecords.pop_back_val();
11511151
auto *nominal = type->getNominalOrBoundGenericNominal();
11521152
CurrentIGMPtr IGM = getGenModule(nominal->getDeclContext());
1153+
emitLazySpecializedGenericTypeMetadata(*IGM.get(), type);
11531154
}
11541155
while (!LazyTypeContextDescriptors.empty()) {
11551156
NominalTypeDecl *type = LazyTypeContextDescriptors.pop_back_val();

lib/IRGen/GenMeta.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,6 +1834,11 @@ void irgen::emitLazyTypeMetadata(IRGenModule &IGM, NominalTypeDecl *type) {
18341834
}
18351835
}
18361836

1837+
void irgen::emitLazySpecializedGenericTypeMetadata(IRGenModule &IGM,
1838+
CanType type) {
1839+
emitSpecializedGenericStructMetadata(IGM, type);
1840+
}
1841+
18371842
llvm::Constant *
18381843
IRGenModule::getAddrOfSharedContextDescriptor(LinkEntity entity,
18391844
ConstantInit definition,
@@ -3678,6 +3683,10 @@ void irgen::emitStructMetadata(IRGenModule &IGM, StructDecl *structDecl) {
36783683
init.finishAndCreateFuture());
36793684
}
36803685

3686+
/// Emit the type metadata or metadata template for a struct.
3687+
void irgen::emitSpecializedGenericStructMetadata(IRGenModule &IGM,
3688+
CanType type) {}
3689+
36813690
// Enums
36823691

36833692
static Optional<Size> getConstantPayloadSize(IRGenModule &IGM,

lib/IRGen/GenMeta.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ namespace irgen {
7171
/// generated definitions.
7272
void emitLazyTypeMetadata(IRGenModule &IGM, NominalTypeDecl *type);
7373

74+
void emitLazySpecializedGenericTypeMetadata(IRGenModule &IGM, CanType type);
7475

7576
/// Emit metadata for a foreign struct, enum or class.
7677
void emitForeignTypeMetadata(IRGenModule &IGM, NominalTypeDecl *decl);
@@ -81,6 +82,8 @@ namespace irgen {
8182
/// Emit the metadata associated with the given enum declaration.
8283
void emitEnumMetadata(IRGenModule &IGM, EnumDecl *theEnum);
8384

85+
void emitSpecializedGenericStructMetadata(IRGenModule &IGM, CanType type);
86+
8487
/// Get what will be the index into the generic type argument array at the end
8588
/// of a nominal type's metadata.
8689
int32_t getIndexOfGenericArgument(IRGenModule &IGM,

0 commit comments

Comments
 (0)