[serialization] Rename SILGenericOuterParamDeclID to SILGenericOuterParams.

Also, add the record to the block info for the SIL block, so that it can be
inspected by llvm-bcanalyzer.

Swift SVN r14417
This commit is contained in:
Jordan Rose
2014-02-26 22:15:56 +00:00
parent b9cd3c1163
commit b6fa8a00bd
5 changed files with 13 additions and 11 deletions

View File

@@ -326,11 +326,11 @@ maybeReadGenericDeclContext(ModuleFile *MF, llvm::BitstreamCursor &Cursor) {
return MF->getAssociatedModule(); return MF->getAssociatedModule();
unsigned kind = Cursor.readRecord(next.ID, scratch); unsigned kind = Cursor.readRecord(next.ID, scratch);
if (kind != SIL_GENERIC_OUTER_PARAM_DECL_ID) if (kind != SIL_GENERIC_OUTER_PARAMS)
return MF->getAssociatedModule(); return MF->getAssociatedModule();
uint64_t declID; uint64_t declID;
SILGenericOuterParamDeclIDLayout::readRecord(scratch, declID); SILGenericOuterParamsLayout::readRecord(scratch, declID);
return MF->getDeclContext((DeclID)declID); return MF->getDeclContext((DeclID)declID);
} }

View File

@@ -103,7 +103,7 @@ namespace sil_block {
SIL_WITNESS_BASE_ENTRY = decls_block::BOUND_GENERIC_SUBSTITUTION + 1, SIL_WITNESS_BASE_ENTRY = decls_block::BOUND_GENERIC_SUBSTITUTION + 1,
SIL_WITNESS_ASSOC_PROTOCOL, SIL_WITNESS_ASSOC_PROTOCOL,
SIL_WITNESS_ASSOC_ENTRY, SIL_WITNESS_ASSOC_ENTRY,
SIL_GENERIC_OUTER_PARAM_DECL_ID, SIL_GENERIC_OUTER_PARAMS,
// We also share these layouts from the decls block. Their enumerators must // We also share these layouts from the decls block. Their enumerators must
// not overlap with ours. // not overlap with ours.
@@ -298,8 +298,8 @@ namespace sil_block {
SILValueResultField SILValueResultField
>; >;
using SILGenericOuterParamDeclIDLayout = BCRecordLayout< using SILGenericOuterParamsLayout = BCRecordLayout<
SIL_GENERIC_OUTER_PARAM_DECL_ID, SIL_GENERIC_OUTER_PARAMS,
DeclIDField // The decl id of the outer param if any. DeclIDField // The decl id of the outer param if any.
>; >;
} }

View File

@@ -283,6 +283,7 @@ void Serializer::writeBlockInfoBlock() {
BLOCK_RECORD(sil_block, SIL_WITNESS_BASE_ENTRY); BLOCK_RECORD(sil_block, SIL_WITNESS_BASE_ENTRY);
BLOCK_RECORD(sil_block, SIL_WITNESS_ASSOC_PROTOCOL); BLOCK_RECORD(sil_block, SIL_WITNESS_ASSOC_PROTOCOL);
BLOCK_RECORD(sil_block, SIL_WITNESS_ASSOC_ENTRY); BLOCK_RECORD(sil_block, SIL_WITNESS_ASSOC_ENTRY);
BLOCK_RECORD(sil_block, SIL_GENERIC_OUTER_PARAMS);
// These layouts can exist in both decl blocks and sil blocks. // These layouts can exist in both decl blocks and sil blocks.
#define BLOCK_RECORD_WITH_NAMESPACE(K, X) emitRecordID(Out, X, #X, nameBuffer) #define BLOCK_RECORD_WITH_NAMESPACE(K, X) emitRecordID(Out, X, #X, nameBuffer)

View File

@@ -209,10 +209,8 @@ void SILSerializer::writeSILFunction(const SILFunction &F, bool DeclOnly) {
// parent. // parent.
if (GenericParamList *outerParams = gp->getOuterParameters()) { if (GenericParamList *outerParams = gp->getOuterParameters()) {
DeclID D = S.addDeclRef(S.getGenericContext(outerParams)); DeclID D = S.addDeclRef(S.getGenericContext(outerParams));
using SILGenericOuterParamDeclIDLayout = unsigned abbrCode = SILAbbrCodes[SILGenericOuterParamsLayout::Code];
SILGenericOuterParamDeclIDLayout; SILGenericOuterParamsLayout::emitRecord(Out, ScratchRecord, abbrCode,
unsigned abbrCode = SILAbbrCodes[SILGenericOuterParamDeclIDLayout::Code];
SILGenericOuterParamDeclIDLayout::emitRecord(Out, ScratchRecord, abbrCode,
D); D);
} }
@@ -1385,7 +1383,7 @@ void SILSerializer::writeModule(const SILModule *SILMod) {
registerSILAbbr<WitnessBaseEntryLayout>(); registerSILAbbr<WitnessBaseEntryLayout>();
registerSILAbbr<WitnessAssocProtocolLayout>(); registerSILAbbr<WitnessAssocProtocolLayout>();
registerSILAbbr<WitnessAssocEntryLayout>(); registerSILAbbr<WitnessAssocEntryLayout>();
registerSILAbbr<SILGenericOuterParamDeclIDLayout>(); registerSILAbbr<SILGenericOuterParamsLayout>();
registerSILAbbr<SILInstCastLayout>(); registerSILAbbr<SILInstCastLayout>();

View File

@@ -1,2 +1,5 @@
// Make sure that we can deserialize the stdlib. // Make sure that we can deserialize the stdlib.
// RUN: %sil-opt -verify %libdir/swift/macosx/Swift.swiftmodule -module-name=Swift > /dev/null // RUN: %sil-opt -verify %libdir/swift/macosx/Swift.swiftmodule -module-name=Swift > /dev/null
// RUN: llvm-bcanalyzer %libdir/swift/macosx/Swift.swiftmodule | FileCheck %s
// CHECK-NOT: Unknown