diff options
author | Teresa Johnson <tejohnson@google.com> | 2015-12-21 15:49:59 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2015-12-21 15:49:59 +0000 |
commit | 0e1a49a3ee3897eb147b4d30022a62c9f0b96080 (patch) | |
tree | b59b548ba4156c9c47ba5e1c9c4420fa9fda516b | |
parent | 6cfd049a121d734fcf466dc2c2066f13c9caeb54 (diff) |
Remove unused functions from ModuleLinker (NFC)
Remove a couple ModuleLinker methods and a related static function that
are no longer used after the linker split.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256162 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Linker/LinkModules.cpp | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index e866461cf9a..373bebd6d4f 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -142,16 +142,6 @@ class ModuleLinker { /// to be adjusted. GlobalValue::LinkageTypes getLinkage(const GlobalValue *SGV); - /// Copies the necessary global value attributes and name from the source - /// to the newly cloned global value. - void copyGVAttributes(GlobalValue *NewGV, const GlobalValue *SrcGV); - - /// Updates the visibility for the new global cloned from the source - /// and, if applicable, linked with an existing destination global. - /// Handles visibility change required for promoted locals. - void setVisibility(GlobalValue *NewGV, const GlobalValue *SGV, - const GlobalValue *DGV = nullptr); - public: ModuleLinker(IRMover &Mover, Module &SrcM, unsigned Flags, const FunctionInfoIndex *Index = nullptr, @@ -175,38 +165,6 @@ public: }; } -/// The LLVM SymbolTable class autorenames globals that conflict in the symbol -/// table. This is good for all clients except for us. Go through the trouble -/// to force this back. -static void forceRenaming(GlobalValue *GV, StringRef Name) { - // If the global doesn't force its name or if it already has the right name, - // there is nothing for us to do. - // Note that any required local to global promotion should already be done, - // so promoted locals will not skip this handling as their linkage is no - // longer local. - if (GV->hasLocalLinkage() || GV->getName() == Name) - return; - - Module *M = GV->getParent(); - - // If there is a conflict, rename the conflict. - if (GlobalValue *ConflictGV = M->getNamedValue(Name)) { - GV->takeName(ConflictGV); - ConflictGV->setName(Name); // This will cause ConflictGV to get renamed - assert(ConflictGV->getName() != Name && "forceRenaming didn't work"); - } else { - GV->setName(Name); // Force the name back - } -} - -/// copy additional attributes (those not needed to construct a GlobalValue) -/// from the SrcGV to the DestGV. -void ModuleLinker::copyGVAttributes(GlobalValue *NewGV, - const GlobalValue *SrcGV) { - NewGV->copyAttributesFrom(SrcGV); - forceRenaming(NewGV, getName(SrcGV)); -} - bool ModuleLinker::doImportAsDefinition(const GlobalValue *SGV) { if (!isPerformingImport()) return false; @@ -383,18 +341,6 @@ getMinVisibility(GlobalValue::VisibilityTypes A, return GlobalValue::DefaultVisibility; } -void ModuleLinker::setVisibility(GlobalValue *NewGV, const GlobalValue *SGV, - const GlobalValue *DGV) { - GlobalValue::VisibilityTypes Visibility = SGV->getVisibility(); - if (DGV) - Visibility = getMinVisibility(DGV->getVisibility(), Visibility); - // For promoted locals, mark them hidden so that they can later be - // stripped from the symbol table to reduce bloat. - if (SGV->hasLocalLinkage() && doPromoteLocalToGlobal(SGV)) - Visibility = GlobalValue::HiddenVisibility; - NewGV->setVisibility(Visibility); -} - bool ModuleLinker::getComdatLeader(Module &M, StringRef ComdatName, const GlobalVariable *&GVar) { const GlobalValue *GVal = M.getNamedValue(ComdatName); |