1 //===-- llvm/ModuleProvider.h - Interface for module providers --*- C++ -*-===//
3 // This file provides an abstract interface for loading a module from some
4 // place. This interface allows incremental or random access loading of
5 // functions from the file. This is useful for applications like JIT compilers
6 // or interprocedural optimizers that do not need the entire program in memory
9 //===----------------------------------------------------------------------===//
11 #ifndef MODULEPROVIDER_H
12 #define MODULEPROVIDER_H
17 class ModuleProvider {
23 virtual ~ModuleProvider();
25 /// getModule - returns the module this provider is encapsulating.
27 Module* getModule() { return TheModule; }
29 /// materializeFunction - make sure the given function is fully read.
31 virtual void materializeFunction(Function *F) = 0;
33 /// materializeModule - make sure the entire Module has been completely read.
35 void materializeModule();
37 /// releaseModule - no longer delete the Module* when provider is destroyed.
39 virtual Module* releaseModule() {
40 // Since we're losing control of this Module, we must hand it back complete
42 Module *tempM = TheModule;