mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-01 01:14:22 +00:00
[ThinLTO] Helper for performing renaming/promotion on a module
Creates a module and performs necessary renaming/promotion of locals that may be exported to another module. Split out of D15024. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254802 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2174f151dc
commit
5143703795
@ -99,6 +99,13 @@ private:
|
|||||||
DiagnosticHandlerFunction DiagnosticHandler;
|
DiagnosticHandlerFunction DiagnosticHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Create a new module with exported local functions renamed and promoted
|
||||||
|
/// for ThinLTO.
|
||||||
|
std::unique_ptr<Module>
|
||||||
|
renameModuleForThinLTO(std::unique_ptr<Module> &M,
|
||||||
|
const FunctionInfoIndex *Index,
|
||||||
|
DiagnosticHandlerFunction DiagnosticHandler);
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2056,6 +2056,18 @@ bool Linker::linkModules(Module &Dest, Module &Src,
|
|||||||
return L.linkInModule(Src, Flags);
|
return L.linkInModule(Src, Flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<Module>
|
||||||
|
llvm::renameModuleForThinLTO(std::unique_ptr<Module> &M,
|
||||||
|
const FunctionInfoIndex *Index,
|
||||||
|
DiagnosticHandlerFunction DiagnosticHandler) {
|
||||||
|
std::unique_ptr<llvm::Module> RenamedModule(
|
||||||
|
new llvm::Module(M->getModuleIdentifier(), M->getContext()));
|
||||||
|
Linker L(*RenamedModule.get(), DiagnosticHandler);
|
||||||
|
if (L.linkInModule(*M.get(), llvm::Linker::Flags::None, Index))
|
||||||
|
return nullptr;
|
||||||
|
return RenamedModule;
|
||||||
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// C API.
|
// C API.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
Loading…
Reference in New Issue
Block a user