mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL Serialization: perform SIL linking right after SILGen.
Add a SILLinkage mode "Deserialized" to make sure IRGen will emit hidden symbols for deserialized SILFunction. Inside SIL linker, set Linkage to external if we only have a declaration for a callee function. Both sil block and decl block in a module can emit an array of substitutions. To share the serialization between SILSerializer and Serializer, we modify the interface to pass in the abbreviation codes to write functions and to pass in a cursor to read functions. We now correctly handle the serialization of Substitutions in SpecializeInst. For a deserialized SILFunction, we now temporarily set its SILLocation and DebugScope to an empty FileLocation. Once mandatory inliner sets the SILLocation to the location of ApplyInst, a null SILLocation and a null DebugScope may work for a deserialized SILFunction. Update testing cases to reflect that we are now inlining transparent functions from modules, or to disable SILDeserializer for now (I am not sure how to update those testing cases). Swift SVN r8582
This commit is contained in:
@@ -685,6 +685,12 @@ bool LinkEntity::isThunk() const {
|
||||
}
|
||||
}
|
||||
|
||||
bool LinkEntity::isDeserialized() const {
|
||||
if (getKind() == Kind::SILFunction)
|
||||
return getSILFunction()->getLinkage() == SILLinkage::Deserialized;
|
||||
return false;
|
||||
}
|
||||
|
||||
LinkInfo LinkInfo::get(IRGenModule &IGM, const LinkEntity &entity) {
|
||||
LinkInfo result;
|
||||
|
||||
@@ -704,6 +710,9 @@ LinkInfo LinkInfo::get(IRGenModule &IGM, const LinkEntity &entity) {
|
||||
// Clang thunks are linkonce_odr and hidden.
|
||||
result.Linkage = llvm::GlobalValue::LinkOnceODRLinkage;
|
||||
result.Visibility = llvm::GlobalValue::HiddenVisibility;
|
||||
} else if (entity.isDeserialized()) {
|
||||
result.Linkage = llvm::GlobalValue::LinkOnceODRLinkage;
|
||||
result.Visibility = llvm::GlobalValue::HiddenVisibility;
|
||||
} else {
|
||||
// Give everything else external linkage.
|
||||
result.Linkage = llvm::GlobalValue::ExternalLinkage;
|
||||
|
||||
Reference in New Issue
Block a user