mirror of
https://github.com/RPCSX/llvm.git
synced 2025-04-03 08:41:44 +00:00
Rename variables to reflect linker split (NFC)
Renamed variables to be more reflective of whether they are an instance of Linker, IRLinker or ModuleLinker. Also fix a stale comment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256011 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
96e80fcbfd
commit
18f59c52f2
@ -171,7 +171,7 @@ private:
|
|||||||
|
|
||||||
LLVMContext &Context;
|
LLVMContext &Context;
|
||||||
std::unique_ptr<Module> MergedModule;
|
std::unique_ptr<Module> MergedModule;
|
||||||
std::unique_ptr<Linker> IRLinker;
|
std::unique_ptr<Linker> TheLinker;
|
||||||
std::unique_ptr<TargetMachine> TargetMach;
|
std::unique_ptr<TargetMachine> TargetMach;
|
||||||
bool EmitDwarfDebugInfo = false;
|
bool EmitDwarfDebugInfo = false;
|
||||||
bool ScopeRestrictionsDone = false;
|
bool ScopeRestrictionsDone = false;
|
||||||
|
@ -66,7 +66,7 @@ const char* LTOCodeGenerator::getVersionString() {
|
|||||||
|
|
||||||
LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context)
|
LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context)
|
||||||
: Context(Context), MergedModule(new Module("ld-temp.o", Context)),
|
: Context(Context), MergedModule(new Module("ld-temp.o", Context)),
|
||||||
IRLinker(new Linker(*MergedModule)) {
|
TheLinker(new Linker(*MergedModule)) {
|
||||||
initializeLTOPasses();
|
initializeLTOPasses();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ bool LTOCodeGenerator::addModule(LTOModule *Mod) {
|
|||||||
assert(&Mod->getModule().getContext() == &Context &&
|
assert(&Mod->getModule().getContext() == &Context &&
|
||||||
"Expected module in same context");
|
"Expected module in same context");
|
||||||
|
|
||||||
bool ret = IRLinker->linkInModule(Mod->takeModule());
|
bool ret = TheLinker->linkInModule(Mod->takeModule());
|
||||||
|
|
||||||
const std::vector<const char *> &undefs = Mod->getAsmUndefinedRefs();
|
const std::vector<const char *> &undefs = Mod->getAsmUndefinedRefs();
|
||||||
for (int i = 0, e = undefs.size(); i != e; ++i)
|
for (int i = 0, e = undefs.size(); i != e; ++i)
|
||||||
@ -122,7 +122,7 @@ void LTOCodeGenerator::setModule(std::unique_ptr<LTOModule> Mod) {
|
|||||||
AsmUndefinedRefs.clear();
|
AsmUndefinedRefs.clear();
|
||||||
|
|
||||||
MergedModule = Mod->takeModule();
|
MergedModule = Mod->takeModule();
|
||||||
IRLinker = make_unique<Linker>(*MergedModule);
|
TheLinker = make_unique<Linker>(*MergedModule);
|
||||||
|
|
||||||
const std::vector<const char*> &Undefs = Mod->getAsmUndefinedRefs();
|
const std::vector<const char*> &Undefs = Mod->getAsmUndefinedRefs();
|
||||||
for (int I = 0, E = Undefs.size(); I != E; ++I)
|
for (int I = 0, E = Undefs.size(); I != E; ++I)
|
||||||
|
@ -335,7 +335,7 @@ LinkDiagnosticInfo::LinkDiagnosticInfo(DiagnosticSeverity Severity,
|
|||||||
void LinkDiagnosticInfo::print(DiagnosticPrinter &DP) const { DP << Msg; }
|
void LinkDiagnosticInfo::print(DiagnosticPrinter &DP) const { DP << Msg; }
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// ModuleLinker implementation.
|
// IRLinker implementation.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -345,10 +345,10 @@ class IRLinker;
|
|||||||
/// speeds up linking for modules with many/ lazily linked functions of which
|
/// speeds up linking for modules with many/ lazily linked functions of which
|
||||||
/// few get used.
|
/// few get used.
|
||||||
class GlobalValueMaterializer final : public ValueMaterializer {
|
class GlobalValueMaterializer final : public ValueMaterializer {
|
||||||
IRLinker *ModLinker;
|
IRLinker *TheIRLinker;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GlobalValueMaterializer(IRLinker *ModLinker) : ModLinker(ModLinker) {}
|
GlobalValueMaterializer(IRLinker *TheIRLinker) : TheIRLinker(TheIRLinker) {}
|
||||||
Value *materializeDeclFor(Value *V) override;
|
Value *materializeDeclFor(Value *V) override;
|
||||||
void materializeInitFor(GlobalValue *New, GlobalValue *Old) override;
|
void materializeInitFor(GlobalValue *New, GlobalValue *Old) override;
|
||||||
Metadata *mapTemporaryMetadata(Metadata *MD) override;
|
Metadata *mapTemporaryMetadata(Metadata *MD) override;
|
||||||
@ -358,10 +358,10 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class LocalValueMaterializer final : public ValueMaterializer {
|
class LocalValueMaterializer final : public ValueMaterializer {
|
||||||
IRLinker *ModLinker;
|
IRLinker *TheIRLinker;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LocalValueMaterializer(IRLinker *ModLinker) : ModLinker(ModLinker) {}
|
LocalValueMaterializer(IRLinker *TheIRLinker) : TheIRLinker(TheIRLinker) {}
|
||||||
Value *materializeDeclFor(Value *V) override;
|
Value *materializeDeclFor(Value *V) override;
|
||||||
void materializeInitFor(GlobalValue *New, GlobalValue *Old) override;
|
void materializeInitFor(GlobalValue *New, GlobalValue *Old) override;
|
||||||
Metadata *mapTemporaryMetadata(Metadata *MD) override;
|
Metadata *mapTemporaryMetadata(Metadata *MD) override;
|
||||||
@ -567,47 +567,47 @@ static void forceRenaming(GlobalValue *GV, StringRef Name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Value *GlobalValueMaterializer::materializeDeclFor(Value *V) {
|
Value *GlobalValueMaterializer::materializeDeclFor(Value *V) {
|
||||||
return ModLinker->materializeDeclFor(V, false);
|
return TheIRLinker->materializeDeclFor(V, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalValueMaterializer::materializeInitFor(GlobalValue *New,
|
void GlobalValueMaterializer::materializeInitFor(GlobalValue *New,
|
||||||
GlobalValue *Old) {
|
GlobalValue *Old) {
|
||||||
ModLinker->materializeInitFor(New, Old, false);
|
TheIRLinker->materializeInitFor(New, Old, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Metadata *GlobalValueMaterializer::mapTemporaryMetadata(Metadata *MD) {
|
Metadata *GlobalValueMaterializer::mapTemporaryMetadata(Metadata *MD) {
|
||||||
return ModLinker->mapTemporaryMetadata(MD);
|
return TheIRLinker->mapTemporaryMetadata(MD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalValueMaterializer::replaceTemporaryMetadata(const Metadata *OrigMD,
|
void GlobalValueMaterializer::replaceTemporaryMetadata(const Metadata *OrigMD,
|
||||||
Metadata *NewMD) {
|
Metadata *NewMD) {
|
||||||
ModLinker->replaceTemporaryMetadata(OrigMD, NewMD);
|
TheIRLinker->replaceTemporaryMetadata(OrigMD, NewMD);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GlobalValueMaterializer::isMetadataNeeded(Metadata *MD) {
|
bool GlobalValueMaterializer::isMetadataNeeded(Metadata *MD) {
|
||||||
return ModLinker->isMetadataNeeded(MD);
|
return TheIRLinker->isMetadataNeeded(MD);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *LocalValueMaterializer::materializeDeclFor(Value *V) {
|
Value *LocalValueMaterializer::materializeDeclFor(Value *V) {
|
||||||
return ModLinker->materializeDeclFor(V, true);
|
return TheIRLinker->materializeDeclFor(V, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalValueMaterializer::materializeInitFor(GlobalValue *New,
|
void LocalValueMaterializer::materializeInitFor(GlobalValue *New,
|
||||||
GlobalValue *Old) {
|
GlobalValue *Old) {
|
||||||
ModLinker->materializeInitFor(New, Old, true);
|
TheIRLinker->materializeInitFor(New, Old, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Metadata *LocalValueMaterializer::mapTemporaryMetadata(Metadata *MD) {
|
Metadata *LocalValueMaterializer::mapTemporaryMetadata(Metadata *MD) {
|
||||||
return ModLinker->mapTemporaryMetadata(MD);
|
return TheIRLinker->mapTemporaryMetadata(MD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalValueMaterializer::replaceTemporaryMetadata(const Metadata *OrigMD,
|
void LocalValueMaterializer::replaceTemporaryMetadata(const Metadata *OrigMD,
|
||||||
Metadata *NewMD) {
|
Metadata *NewMD) {
|
||||||
ModLinker->replaceTemporaryMetadata(OrigMD, NewMD);
|
TheIRLinker->replaceTemporaryMetadata(OrigMD, NewMD);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocalValueMaterializer::isMetadataNeeded(Metadata *MD) {
|
bool LocalValueMaterializer::isMetadataNeeded(Metadata *MD) {
|
||||||
return ModLinker->isMetadataNeeded(MD);
|
return TheIRLinker->isMetadataNeeded(MD);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *IRLinker::materializeDeclFor(Value *V, bool ForAlias) {
|
Value *IRLinker::materializeDeclFor(Value *V, bool ForAlias) {
|
||||||
@ -1650,9 +1650,9 @@ bool IRMover::move(
|
|||||||
std::function<void(GlobalValue &, ValueAdder Add)> AddLazyFor,
|
std::function<void(GlobalValue &, ValueAdder Add)> AddLazyFor,
|
||||||
DenseMap<unsigned, MDNode *> *ValIDToTempMDMap,
|
DenseMap<unsigned, MDNode *> *ValIDToTempMDMap,
|
||||||
bool IsMetadataLinkingPostpass) {
|
bool IsMetadataLinkingPostpass) {
|
||||||
IRLinker TheLinker(Composite, IdentifiedStructTypes, Src, ValuesToLink,
|
IRLinker TheIRLinker(Composite, IdentifiedStructTypes, Src, ValuesToLink,
|
||||||
AddLazyFor, ValIDToTempMDMap, IsMetadataLinkingPostpass);
|
AddLazyFor, ValIDToTempMDMap, IsMetadataLinkingPostpass);
|
||||||
bool RetCode = TheLinker.run();
|
bool RetCode = TheIRLinker.run();
|
||||||
Composite.dropTriviallyDeadConstantArrays();
|
Composite.dropTriviallyDeadConstantArrays();
|
||||||
return RetCode;
|
return RetCode;
|
||||||
}
|
}
|
||||||
|
@ -803,14 +803,14 @@ bool Linker::linkInModule(std::unique_ptr<Module> Src, unsigned Flags,
|
|||||||
const FunctionInfoIndex *Index,
|
const FunctionInfoIndex *Index,
|
||||||
DenseSet<const GlobalValue *> *FunctionsToImport,
|
DenseSet<const GlobalValue *> *FunctionsToImport,
|
||||||
DenseMap<unsigned, MDNode *> *ValIDToTempMDMap) {
|
DenseMap<unsigned, MDNode *> *ValIDToTempMDMap) {
|
||||||
ModuleLinker TheLinker(Mover, *Src, Flags, Index, FunctionsToImport,
|
ModuleLinker ModLinker(Mover, *Src, Flags, Index, FunctionsToImport,
|
||||||
ValIDToTempMDMap);
|
ValIDToTempMDMap);
|
||||||
return TheLinker.run();
|
return ModLinker.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Linker::linkInModuleForCAPI(Module &Src) {
|
bool Linker::linkInModuleForCAPI(Module &Src) {
|
||||||
ModuleLinker TheLinker(Mover, Src, 0, nullptr, nullptr);
|
ModuleLinker ModLinker(Mover, Src, 0, nullptr, nullptr);
|
||||||
return TheLinker.run();
|
return ModLinker.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Linker::linkInMetadata(Module &Src,
|
bool Linker::linkInMetadata(Module &Src,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user