1 //===-- llvm/ModuleProvider.h - Interface for module providers --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file provides an abstract interface for loading a module from some
11 // place. This interface allows incremental or random access loading of
12 // functions from the file. This is useful for applications like JIT compilers
13 // or interprocedural optimizers that do not need the entire program in memory
16 //===----------------------------------------------------------------------===//
18 #ifndef MODULEPROVIDER_H
19 #define MODULEPROVIDER_H
24 class ModuleProvider {
30 virtual ~ModuleProvider();
32 /// getModule - returns the module this provider is encapsulating.
34 Module* getModule() { return TheModule; }
36 /// materializeFunction - make sure the given function is fully read.
38 virtual void materializeFunction(Function *F) = 0;
40 /// materializeModule - make sure the entire Module has been completely read.
42 Module* materializeModule();
44 /// releaseModule - no longer delete the Module* when provider is destroyed.
46 virtual Module* releaseModule() {
47 // Since we're losing control of this Module, we must hand it back complete
49 Module *tempM = TheModule;