[DefaultOverrides] SIL representation.

See the comment in SILDefaultOverrideTable.h for details.
This commit is contained in:
Nate Chandler
2025-03-20 15:47:19 -07:00
parent 5eacbfd9d9
commit 89e5e3dfca
5 changed files with 493 additions and 0 deletions

View File

@@ -23,6 +23,7 @@
#include "swift/SIL/FormalLinkage.h"
#include "swift/SIL/Notifications.h"
#include "swift/SIL/SILDebugScope.h"
#include "swift/SIL/SILDefaultOverrideTable.h"
#include "swift/SIL/SILMoveOnlyDeinit.h"
#include "swift/SIL/SILRemarkStreamer.h"
#include "swift/SIL/SILValue.h"
@@ -290,6 +291,31 @@ void SILModule::deleteWitnessTable(SILWitnessTable *Wt) {
witnessTables.erase(Wt);
}
SILDefaultOverrideTable *SILModule::createDefaultOverrideTableDefinition(
const ClassDecl *decl, SILLinkage linkage,
ArrayRef<SILDefaultOverrideTable::Entry> entries) {
return SILDefaultOverrideTable::define(*this, linkage, decl, entries);
}
SILDefaultOverrideTable *
SILModule::lookUpDefaultOverrideTable(const ClassDecl *decl,
bool deserializeLazily) {
// Note: we only ever look up default override tables in the translation unit
// that is currently being compiled, since SILGen generates them when it
// visits the class declaration, and IRGen emits them when emitting the
// class descriptor metadata for the class.
auto found = DefaultOverrideTableMap.find(decl);
if (found == DefaultOverrideTableMap.end()) {
if (deserializeLazily) {
}
return nullptr;
}
return found->second;
}
const IntrinsicInfo &SILModule::getIntrinsicInfo(Identifier ID) {
unsigned OldSize = IntrinsicIDCache.size();
IntrinsicInfo &Info = IntrinsicIDCache[ID];