diff options
Diffstat (limited to 'contrib/llvm/include/llvm/Transforms/IPO/FunctionImport.h')
-rw-r--r-- | contrib/llvm/include/llvm/Transforms/IPO/FunctionImport.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/contrib/llvm/include/llvm/Transforms/IPO/FunctionImport.h b/contrib/llvm/include/llvm/Transforms/IPO/FunctionImport.h new file mode 100644 index 0000000..d770779 --- /dev/null +++ b/contrib/llvm/include/llvm/Transforms/IPO/FunctionImport.h @@ -0,0 +1,43 @@ +//===- llvm/Transforms/IPO/FunctionImport.h - ThinLTO importing -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_FUNCTIONIMPORT_H +#define LLVM_FUNCTIONIMPORT_H + +#include "llvm/ADT/StringMap.h" +#include <functional> + +namespace llvm { +class LLVMContext; +class Module; +class FunctionInfoIndex; + +/// The function importer is automatically importing function from other modules +/// based on the provided summary informations. +class FunctionImporter { + + /// The summaries index used to trigger importing. + const FunctionInfoIndex &Index; + + /// Factory function to load a Module for a given identifier + std::function<std::unique_ptr<Module>(StringRef Identifier)> ModuleLoader; + +public: + /// Create a Function Importer. + FunctionImporter( + const FunctionInfoIndex &Index, + std::function<std::unique_ptr<Module>(StringRef Identifier)> ModuleLoader) + : Index(Index), ModuleLoader(ModuleLoader) {} + + /// Import functions in Module \p M based on the summary informations. + bool importFunctions(Module &M); +}; +} + +#endif // LLVM_FUNCTIONIMPORT_H |