diff options
author | Teresa Johnson <tejohnson@google.com> | 2016-05-10 15:54:09 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2016-05-10 15:54:09 +0000 |
commit | 8570fe47ef2019911fca7bce9bbd912eedd0c34a (patch) | |
tree | e8f78fcf18c17c3ba9f6347532a4a884df422e67 /llvm/lib/LTO/ThinLTOCodeGenerator.cpp | |
parent | c191acf09769666ee5472e52fc29a2b831e0645b (diff) | |
download | llvm-8570fe47ef2019911fca7bce9bbd912eedd0c34a.zip llvm-8570fe47ef2019911fca7bce9bbd912eedd0c34a.tar.gz llvm-8570fe47ef2019911fca7bce9bbd912eedd0c34a.tar.bz2 |
[ThinLTO] Add option to emit imports files for distributed backends
Summary:
Add support for emission of plaintext lists of the imported files for
each distributed backend compilation. Used for distributed build file
staging.
Invoked with new gold-plugin thinlto-emit-imports-files option, which is
only valid with thinlto-index-only (i.e. for distributed builds), or
from llvm-lto with new -thinlto-action=emitimports value.
Depends on D19556.
Reviewers: joker.eph
Subscribers: llvm-commits, joker.eph
Differential Revision: http://reviews.llvm.org/D19636
llvm-svn: 269067
Diffstat (limited to 'llvm/lib/LTO/ThinLTOCodeGenerator.cpp')
-rw-r--r-- | llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index 68d7a71..93a3f3e 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -743,6 +743,30 @@ void ThinLTOCodeGenerator::gatherImportedSummariesForModule( } /** + * Emit the list of files needed for importing into module. + */ +void ThinLTOCodeGenerator::emitImports(StringRef ModulePath, + StringRef OutputName, + ModuleSummaryIndex &Index) { + auto ModuleCount = Index.modulePaths().size(); + + // Collect for each module the list of function it defines (GUID -> Summary). + StringMap<GVSummaryMapTy> ModuleToDefinedGVSummaries(ModuleCount); + Index.collectDefinedGVSummariesPerModule(ModuleToDefinedGVSummaries); + + // Generate import/export list + StringMap<FunctionImporter::ImportMapTy> ImportLists(ModuleCount); + StringMap<FunctionImporter::ExportSetTy> ExportLists(ModuleCount); + ComputeCrossModuleImport(Index, ModuleToDefinedGVSummaries, ImportLists, + ExportLists); + + std::error_code EC; + if ((EC = EmitImportsFiles(ModulePath, OutputName, ImportLists))) + report_fatal_error(Twine("Failed to open ") + OutputName + + " to save imports lists\n"); +} + +/** * Perform internalization. */ void ThinLTOCodeGenerator::internalize(Module &TheModule, |