mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Remove SILExternalSource.
This was once used in lldb but no longer is. I'm cannot find any other users, so I'm removing it as a small part of cleaning up and simplifying the SIL linking process.
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
//===--- SILExternalSource.h - On-demand generation of SIL ------*- C++ -*-===//
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See http://swift.org/LICENSE.txt for license information
|
||||
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the abstract SILExternalSource class.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef SWIFT_SILEXTERNALSOURCE_H
|
||||
#define SWIFT_SILEXTERNALSOURCE_H
|
||||
|
||||
namespace swift {
|
||||
|
||||
class SILFunction;
|
||||
|
||||
class SILExternalSource {
|
||||
public:
|
||||
SILExternalSource() { }
|
||||
virtual ~SILExternalSource() = default;
|
||||
|
||||
/// SILExternalSource gets called for each external function
|
||||
/// that the SIL linker would try to load SIL for. In particular
|
||||
/// this means transparent functions.
|
||||
///
|
||||
/// \param callee is the (usually empty) called function.
|
||||
virtual SILFunction *lookupSILFunction(SILFunction *callee) = 0;
|
||||
|
||||
private:
|
||||
virtual void anchor();
|
||||
};
|
||||
|
||||
} // namespace swift
|
||||
|
||||
#endif
|
||||
@@ -45,7 +45,6 @@ namespace swift {
|
||||
class AnyFunctionType;
|
||||
class ASTContext;
|
||||
class FuncDecl;
|
||||
class SILExternalSource;
|
||||
class SILTypeList;
|
||||
class SILUndef;
|
||||
class SourceFile;
|
||||
@@ -173,9 +172,6 @@ private:
|
||||
/// optimizations can assume that they see the whole module.
|
||||
bool wholeModule;
|
||||
|
||||
/// The external SIL source to use when linking this module.
|
||||
SILExternalSource *ExternalSource = nullptr;
|
||||
|
||||
/// The options passed into this SILModule.
|
||||
SILOptions &Options;
|
||||
|
||||
@@ -493,12 +489,6 @@ public:
|
||||
Stage = s;
|
||||
}
|
||||
|
||||
SILExternalSource *getExternalSource() const { return ExternalSource; }
|
||||
void setExternalSource(SILExternalSource *S) {
|
||||
assert(!ExternalSource && "External source already set");
|
||||
ExternalSource = S;
|
||||
}
|
||||
|
||||
/// \brief Run the SIL verifier to make sure that all Functions follow
|
||||
/// invariants.
|
||||
void verify() const;
|
||||
|
||||
@@ -352,21 +352,6 @@ bool SILLinkerVisitor::process() {
|
||||
if (!shouldImportFunction(F))
|
||||
continue;
|
||||
|
||||
// The ExternalSource may wish to rewrite non-empty bodies.
|
||||
if (!F->isExternalDeclaration() && ExternalSource) {
|
||||
if (auto *NewFn = ExternalSource->lookupSILFunction(F)) {
|
||||
if (NewFn->isExternalDeclaration())
|
||||
continue;
|
||||
|
||||
NewFn->verify();
|
||||
Worklist.push_back(NewFn);
|
||||
|
||||
++NumFuncLinked;
|
||||
Result = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG(llvm::dbgs() << "Imported function: "
|
||||
<< F->getName() << "\n");
|
||||
F->setBare(IsBare);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#define SWIFT_SIL_LINKER_H
|
||||
|
||||
#include "swift/SIL/SILDebugScope.h"
|
||||
#include "swift/SIL/SILExternalSource.h"
|
||||
#include "swift/SIL/SILVisitor.h"
|
||||
#include "swift/SIL/SILModule.h"
|
||||
#include "swift/Serialization/SerializedSILLoader.h"
|
||||
@@ -32,9 +31,6 @@ class SILLinkerVisitor : public SILInstructionVisitor<SILLinkerVisitor, bool> {
|
||||
/// The SILLoader that this visitor is using to link.
|
||||
SerializedSILLoader *Loader;
|
||||
|
||||
/// The external SIL source to use when linking this module.
|
||||
SILExternalSource *ExternalSource = nullptr;
|
||||
|
||||
/// Worklist of SILFunctions we are processing.
|
||||
llvm::SmallVector<SILFunction *, 128> Worklist;
|
||||
|
||||
@@ -47,10 +43,9 @@ class SILLinkerVisitor : public SILInstructionVisitor<SILLinkerVisitor, bool> {
|
||||
|
||||
public:
|
||||
SILLinkerVisitor(SILModule &M, SerializedSILLoader *L,
|
||||
SILModule::LinkingMode LinkingMode,
|
||||
SILExternalSource *E = nullptr)
|
||||
: Mod(M), Loader(L), ExternalSource(E), Worklist(),
|
||||
FunctionDeserializationWorklist(), Mode(LinkingMode) {}
|
||||
SILModule::LinkingMode LinkingMode)
|
||||
: Mod(M), Loader(L), Worklist(), FunctionDeserializationWorklist(),
|
||||
Mode(LinkingMode) {}
|
||||
|
||||
/// Process F, recursively deserializing any thing F may reference.
|
||||
bool processFunction(SILFunction *F);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "swift/SIL/SILModule.h"
|
||||
#include "Linker.h"
|
||||
#include "swift/SIL/SILDebugScope.h"
|
||||
#include "swift/SIL/SILExternalSource.h"
|
||||
#include "swift/SIL/SILVisitor.h"
|
||||
#include "swift/Serialization/SerializedSILLoader.h"
|
||||
#include "swift/SIL/SILValue.h"
|
||||
@@ -44,9 +43,6 @@ namespace swift {
|
||||
};
|
||||
} // end namespace swift.
|
||||
|
||||
void SILExternalSource::anchor() {
|
||||
}
|
||||
|
||||
/// SILTypeListUniquingType - This is the type of the folding set maintained by
|
||||
/// SILModule that these things are uniqued into.
|
||||
typedef llvm::FoldingSet<SILTypeList> SILTypeListUniquingType;
|
||||
@@ -527,18 +523,15 @@ SILFunction *SILModule::lookUpFunction(SILDeclRef fnRef) {
|
||||
}
|
||||
|
||||
bool SILModule::linkFunction(SILFunction *Fun, SILModule::LinkingMode Mode) {
|
||||
return SILLinkerVisitor(*this, getSILLoader(), Mode, ExternalSource)
|
||||
.processFunction(Fun);
|
||||
return SILLinkerVisitor(*this, getSILLoader(), Mode).processFunction(Fun);
|
||||
}
|
||||
|
||||
bool SILModule::linkFunction(SILDeclRef Decl, SILModule::LinkingMode Mode) {
|
||||
return SILLinkerVisitor(*this, getSILLoader(), Mode, ExternalSource)
|
||||
.processDeclRef(Decl);
|
||||
return SILLinkerVisitor(*this, getSILLoader(), Mode).processDeclRef(Decl);
|
||||
}
|
||||
|
||||
bool SILModule::linkFunction(StringRef Name, SILModule::LinkingMode Mode) {
|
||||
return SILLinkerVisitor(*this, getSILLoader(), Mode, ExternalSource)
|
||||
.processFunction(Name);
|
||||
return SILLinkerVisitor(*this, getSILLoader(), Mode).processFunction(Name);
|
||||
}
|
||||
|
||||
void SILModule::linkAllWitnessTables() {
|
||||
@@ -598,8 +591,7 @@ SILVTable *SILModule::lookUpVTable(const ClassDecl *C) {
|
||||
|
||||
// If that fails, try to deserialize it. If that fails, return nullptr.
|
||||
SILVTable *Vtbl =
|
||||
SILLinkerVisitor(*this, getSILLoader(), SILModule::LinkingMode::LinkAll,
|
||||
ExternalSource)
|
||||
SILLinkerVisitor(*this, getSILLoader(), SILModule::LinkingMode::LinkAll)
|
||||
.processClassDecl(C);
|
||||
if (!Vtbl)
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user