10 #ifndef LLVM_FUNCTIONIMPORT_H
11 #define LLVM_FUNCTIONIMPORT_H
21 #include <unordered_set>
26 class GlobalValueSummary;
48 typedef std::function<Expected<std::unique_ptr<Module>>(
StringRef Identifier)>
53 : Index(Index), ModuleLoader(std::move(ModuleLoader)) {}
61 bool ForceImportReferencedDiscardableSymbols =
false);
128 std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex);
146 #endif // LLVM_FUNCTIONIMPORT_H
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
std::function< Expected< std::unique_ptr< Module > >StringRef Identifier)> ModuleLoaderTy
A function of this type is used to load modules referenced by the index.
A Module instance is used to store all the information related to an LLVM module. ...
Implements a dense probed hash-table based set.
std::map< GlobalValue::GUID, unsigned > FunctionsToImportTy
Set of functions to import from a source module.
Expected< bool > importFunctions(Module &M, const ImportMapTy &ImportList, bool ForceImportReferencedDiscardableSymbols=false)
Import functions in Module M based on the supplied import list.
std::unordered_set< GlobalValue::GUID > ExportSetTy
The set contains an entry for every global value the module exports.
FunctionImporter(const ModuleSummaryIndex &Index, ModuleLoaderTy ModuleLoader)
Create a Function Importer.
Tagged union holding either a T or a Error.
static cl::opt< std::string > OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::init("-"))
A CRTP mix-in to automatically provide informational APIs needed for passes.
Class to hold module path string table and global value map, and encapsulate methods for operating on...
The function importing pass.
A set of analyses that are preserved following a run of a transformation pass.
void gatherImportedSummariesForModule(StringRef ModulePath, const StringMap< GVSummaryMapTy > &ModuleToDefinedGVSummaries, const FunctionImporter::ImportMapTy &ImportList, std::map< std::string, GVSummaryMapTy > &ModuleToSummariesForIndex)
Compute the set of summaries needed for a ThinLTO backend compilation of ModulePath.
void ComputeCrossModuleImport(const ModuleSummaryIndex &Index, const StringMap< GVSummaryMapTy > &ModuleToDefinedGVSummaries, StringMap< FunctionImporter::ImportMapTy > &ImportLists, StringMap< FunctionImporter::ExportSetTy > &ExportLists, const DenseSet< GlobalValue::GUID > *DeadSymbols=nullptr)
Compute all the imports and exports for every module in the Index.
std::error_code EmitImportsFiles(StringRef ModulePath, StringRef OutputFilename, const FunctionImporter::ImportMapTy &ModuleImports)
Emit into OutputFilename the files module ModulePath will import from.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
std::map< GlobalValue::GUID, GlobalValueSummary * > GVSummaryMapTy
Map of global value GUID to its summary, used to identify values defined in a particular module...
DenseSet< GlobalValue::GUID > computeDeadSymbols(const ModuleSummaryIndex &Index, const DenseSet< GlobalValue::GUID > &GUIDPreservedSymbols)
Compute all the symbols that are "dead": i.e these that can't be reached in the graph from any of t...
void thinLTOInternalizeModule(Module &TheModule, const GVSummaryMapTy &DefinedGlobals)
Internalize TheModule based on the information recorded in the summaries during global summary-based ...
StringMap< FunctionsToImportTy > ImportMapTy
The map contains an entry for every module to import from, the key being the module identifier to pas...
void thinLTOResolveWeakForLinkerModule(Module &TheModule, const GVSummaryMapTy &DefinedGlobals)
Resolve WeakForLinker values in TheModule based on the information recorded in the summaries during g...
void ComputeCrossModuleImportForModule(StringRef ModulePath, const ModuleSummaryIndex &Index, FunctionImporter::ImportMapTy &ImportList)
Compute all the imports for the given module using the Index.
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
The function importer is automatically importing function from other modules based on the provided su...
StringRef - Represent a constant reference to a string, i.e.
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.