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/Transforms/IPO | |
| parent | c191acf09769666ee5472e52fc29a2b831e0645b (diff) | |
| download | bcm5719-llvm-8570fe47ef2019911fca7bce9bbd912eedd0c34a.tar.gz bcm5719-llvm-8570fe47ef2019911fca7bce9bbd912eedd0c34a.zip | |
[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/Transforms/IPO')
| -rw-r--r-- | llvm/lib/Transforms/IPO/FunctionImport.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index 6c571f440b9..3ce3b7b841e 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -445,6 +445,21 @@ void llvm::gatherImportedSummariesForModule( } } +/// Emit the files \p ModulePath will import from into \p OutputFilename. +std::error_code llvm::EmitImportsFiles( + StringRef ModulePath, StringRef OutputFilename, + const StringMap<FunctionImporter::ImportMapTy> &ImportLists) { + auto ModuleImports = ImportLists.find(ModulePath); + std::error_code EC; + raw_fd_ostream ImportsOS(OutputFilename, EC, sys::fs::OpenFlags::F_None); + if (EC) + return EC; + if (ModuleImports != ImportLists.end()) + for (auto &ILI : ModuleImports->second) + ImportsOS << ILI.first() << "\n"; + return std::error_code(); +} + // Automatically import functions in Module \p DestModule based on the summaries // index. // |

