1 //===- llvm/Transforms/IPO/FunctionImport.h - ThinLTO importing -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_FUNCTIONIMPORT_H
11 #define LLVM_FUNCTIONIMPORT_H
13 #include "llvm/ADT/StringMap.h"
19 class FunctionInfoIndex;
21 /// The function importer is automatically importing function from other modules
22 /// based on the provided summary informations.
23 class FunctionImporter {
25 /// The summaries index used to trigger importing.
26 const FunctionInfoIndex &Index;
28 /// Factory function to load a Module for a given identifier
29 std::function<std::unique_ptr<Module>(StringRef Identifier)> ModuleLoader;
32 /// Create a Function Importer.
34 const FunctionInfoIndex &Index,
35 std::function<std::unique_ptr<Module>(StringRef Identifier)> ModuleLoader)
36 : Index(Index), ModuleLoader(ModuleLoader) {}
38 /// Import functions in Module \p M based on the summary informations.
39 bool importFunctions(Module &M);
43 #endif // LLVM_FUNCTIONIMPORT_H