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"
18 class FunctionInfoIndex;
20 /// The function importer is automatically importing function from other modules
21 /// based on the provided summary informations.
22 class FunctionImporter {
24 /// The summaries index used to trigger importing.
25 const FunctionInfoIndex &Index;
27 /// Factory function to load a Module for a given identifier
28 std::function<std::unique_ptr<Module>(StringRef Identifier)> ModuleLoader;
31 /// Create a Function Importer.
33 const FunctionInfoIndex &Index,
34 std::function<std::unique_ptr<Module>(StringRef Identifier)> ModuleLoader)
35 : Index(Index), ModuleLoader(ModuleLoader) {}
37 /// Import functions in Module \p M based on the summary informations.
38 bool importFunctions(Module &M);
42 #endif // LLVM_FUNCTIONIMPORT_H