X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FTransforms%2FIPO%2FFunctionImport.h;h=e3da8a79c23ebb450da73e881d6843acbfea2f6d;hp=0315c72811c168d5f91e0a51e258154d6563ef27;hb=b2bc86f25144aa907b977e27fd93e316e15500d6;hpb=903c0998cc5aa55e9392cf46c9da397ee4e1d9af diff --git a/include/llvm/Transforms/IPO/FunctionImport.h b/include/llvm/Transforms/IPO/FunctionImport.h index 0315c72811c..e3da8a79c23 100644 --- a/include/llvm/Transforms/IPO/FunctionImport.h +++ b/include/llvm/Transforms/IPO/FunctionImport.h @@ -18,23 +18,6 @@ class LLVMContext; class Module; class FunctionInfoIndex; -/// Helper to load on demand a Module from file and cache it for subsequent -/// queries. It can be used with the FunctionImporter. -class ModuleLazyLoaderCache { - /// The context that will be used for importing. - LLVMContext &Context; - - /// Cache of lazily loaded module for import. - StringMap> ModuleMap; - -public: - /// Create the loader, Module will be initialized in \p Context. - ModuleLazyLoaderCache(LLVMContext &Context) : Context(Context) {} - - /// Retrieve a Module from the cache or lazily load it on demand. - Module &operator()(StringRef FileName); -}; - /// The function importer is automatically importing function from other modules /// based on the provided summary informations. class FunctionImporter { @@ -45,16 +28,17 @@ class FunctionImporter { /// Diagnostic will be sent to this handler. DiagnosticHandlerFunction DiagnosticHandler; - /// Retrieve a Module from the cache or lazily load it on demand. - std::function getLazyModule; + /// Factory function to load a Module for a given identifier + std::function(StringRef Identifier)> ModuleLoader; public: /// Create a Function Importer. - FunctionImporter(const FunctionInfoIndex &Index, - DiagnosticHandlerFunction DiagnosticHandler, - std::function ModuleLoader) + FunctionImporter( + const FunctionInfoIndex &Index, + DiagnosticHandlerFunction DiagnosticHandler, + std::function(StringRef Identifier)> ModuleLoader) : Index(Index), DiagnosticHandler(DiagnosticHandler), - getLazyModule(ModuleLoader) {} + ModuleLoader(ModuleLoader) {} /// Import functions in Module \p M based on the summary informations. bool importFunctions(Module &M);