diff options
Diffstat (limited to 'include/llvm/LTO/legacy/ThinLTOCodeGenerator.h')
-rw-r--r-- | include/llvm/LTO/legacy/ThinLTOCodeGenerator.h | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h b/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h index d4c69a1ce260..210a2ce00bdf 100644 --- a/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h +++ b/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h @@ -1,9 +1,8 @@ //===-ThinLTOCodeGenerator.h - LLVM Link Time Optimizer -------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -20,6 +19,7 @@ #include "llvm/ADT/StringSet.h" #include "llvm/ADT/Triple.h" #include "llvm/IR/ModuleSummaryIndex.h" +#include "llvm/LTO/LTO.h" #include "llvm/Support/CachePruning.h" #include "llvm/Support/CodeGen.h" #include "llvm/Support/MemoryBuffer.h" @@ -32,23 +32,6 @@ class StringRef; class LLVMContext; class TargetMachine; -/// Wrapper around MemoryBufferRef, owning the identifier -class ThinLTOBuffer { - std::string OwnedIdentifier; - StringRef Buffer; - -public: - ThinLTOBuffer(StringRef Buffer, StringRef Identifier) - : OwnedIdentifier(Identifier), Buffer(Buffer) {} - - MemoryBufferRef getMemBuffer() const { - return MemoryBufferRef(Buffer, - {OwnedIdentifier.c_str(), OwnedIdentifier.size()}); - } - StringRef getBuffer() const { return Buffer; } - StringRef getBufferIdentifier() const { return OwnedIdentifier; } -}; - /// Helper to gather options relevant to the target machine creation struct TargetMachineBuilder { Triple TheTriple; @@ -268,37 +251,49 @@ public: * and additionally resolve weak and linkonce symbols. * Index is updated to reflect linkage changes from weak resolution. */ - void promote(Module &Module, ModuleSummaryIndex &Index); + void promote(Module &Module, ModuleSummaryIndex &Index, + const lto::InputFile &File); /** * Compute and emit the imported files for module at \p ModulePath. */ void emitImports(Module &Module, StringRef OutputName, - ModuleSummaryIndex &Index); + ModuleSummaryIndex &Index, + const lto::InputFile &File); /** * Perform cross-module importing for the module identified by * ModuleIdentifier. */ - void crossModuleImport(Module &Module, ModuleSummaryIndex &Index); + void crossModuleImport(Module &Module, ModuleSummaryIndex &Index, + const lto::InputFile &File); /** * Compute the list of summaries needed for importing into module. */ void gatherImportedSummariesForModule( Module &Module, ModuleSummaryIndex &Index, - std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex); + std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex, + const lto::InputFile &File); /** * Perform internalization. Index is updated to reflect linkage changes. */ - void internalize(Module &Module, ModuleSummaryIndex &Index); + void internalize(Module &Module, ModuleSummaryIndex &Index, + const lto::InputFile &File); /** * Perform post-importing ThinLTO optimizations. */ void optimize(Module &Module); + /** + * Write temporary object file to SavedObjectDirectoryPath, write symlink + * to Cache directory if needed. Returns the path to the generated file in + * SavedObjectsDirectoryPath. + */ + std::string writeGeneratedObject(int count, StringRef CacheEntryPath, + const MemoryBuffer &OutputBuffer); /**@}*/ private: @@ -314,7 +309,7 @@ private: /// Vector holding the input buffers containing the bitcode modules to /// process. - std::vector<ThinLTOBuffer> Modules; + std::vector<std::unique_ptr<lto::InputFile>> Modules; /// Set of symbols that need to be preserved outside of the set of bitcode /// files. |