mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL Linker: Use SILModule::loadFunction()
This means SILLinkerVisitor no longer depends on the SILLoader; the latter is now just an implementation detail of SILModule.
This commit is contained in:
@@ -37,15 +37,13 @@ bool SILLinkerVisitor::addFunctionToWorklist(SILFunction *F) {
|
||||
|
||||
DEBUG(llvm::dbgs() << "Imported function: "
|
||||
<< F->getName() << "\n");
|
||||
if (auto *NewFn = Loader->lookupSILFunction(F)) {
|
||||
if (NewFn->isExternalDeclaration())
|
||||
if (Mod.loadFunction(F)) {
|
||||
if (F->isExternalDeclaration())
|
||||
return false;
|
||||
|
||||
assert(NewFn == F && "This shouldn't happen");
|
||||
|
||||
NewFn->setBare(IsBare);
|
||||
NewFn->verify();
|
||||
Worklist.push_back(NewFn);
|
||||
F->setBare(IsBare);
|
||||
F->verify();
|
||||
Worklist.push_back(F);
|
||||
++NumFuncLinked;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "swift/SIL/SILDebugScope.h"
|
||||
#include "swift/SIL/SILVisitor.h"
|
||||
#include "swift/SIL/SILModule.h"
|
||||
#include "swift/Serialization/SerializedSILLoader.h"
|
||||
#include <functional>
|
||||
|
||||
namespace swift {
|
||||
@@ -28,9 +27,6 @@ class SILLinkerVisitor : public SILInstructionVisitor<SILLinkerVisitor, bool> {
|
||||
/// The SILModule that we are loading from.
|
||||
SILModule &Mod;
|
||||
|
||||
/// The SILLoader that this visitor is using to link.
|
||||
SerializedSILLoader *Loader;
|
||||
|
||||
/// Break cycles visiting recursive protocol conformances.
|
||||
llvm::DenseSet<ProtocolConformance *> VisitedConformances;
|
||||
|
||||
@@ -45,9 +41,8 @@ class SILLinkerVisitor : public SILInstructionVisitor<SILLinkerVisitor, bool> {
|
||||
LinkingMode Mode;
|
||||
|
||||
public:
|
||||
SILLinkerVisitor(SILModule &M, SerializedSILLoader *L,
|
||||
SILModule::LinkingMode LinkingMode)
|
||||
: Mod(M), Loader(L), Worklist(), FunctionDeserializationWorklist(),
|
||||
SILLinkerVisitor(SILModule &M, SILModule::LinkingMode LinkingMode)
|
||||
: Mod(M), Worklist(), FunctionDeserializationWorklist(),
|
||||
Mode(LinkingMode) {}
|
||||
|
||||
/// Process F, recursively deserializing any thing F may reference.
|
||||
|
||||
@@ -495,7 +495,7 @@ bool SILModule::loadFunction(SILFunction *F) {
|
||||
}
|
||||
|
||||
bool SILModule::linkFunction(SILFunction *F, SILModule::LinkingMode Mode) {
|
||||
return SILLinkerVisitor(*this, getSILLoader(), Mode).processFunction(F);
|
||||
return SILLinkerVisitor(*this, Mode).processFunction(F);
|
||||
}
|
||||
|
||||
SILFunction *SILModule::findFunction(StringRef Name, SILLinkage Linkage) {
|
||||
|
||||
Reference in New Issue
Block a user