• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- ObjectCache.h - Class definition for the ObjectCache -----C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_EXECUTIONENGINE_OBJECTCACHE_H
11 #define LLVM_EXECUTIONENGINE_OBJECTCACHE_H
12 
13 #include "llvm/Support/MemoryBuffer.h"
14 
15 namespace llvm {
16 
17 class Module;
18 
19 /// This is the base ObjectCache type which can be provided to an
20 /// ExecutionEngine for the purpose of avoiding compilation for Modules that
21 /// have already been compiled and an object file is available.
22 class ObjectCache {
23   virtual void anchor();
24 public:
ObjectCache()25   ObjectCache() { }
26 
~ObjectCache()27   virtual ~ObjectCache() { }
28 
29   /// notifyObjectCompiled - Provides a pointer to compiled code for Module M.
30   virtual void notifyObjectCompiled(const Module *M, const MemoryBuffer *Obj) = 0;
31 
32   /// getObjectCopy - Returns a pointer to a newly allocated MemoryBuffer that
33   /// contains the object which corresponds with Module M, or 0 if an object is
34   /// not available. The caller owns both the MemoryBuffer returned by this
35   /// and the memory it references.
36   virtual MemoryBuffer* getObject(const Module* M) = 0;
37 };
38 
39 }
40 
41 #endif
42