1251607Sdim//===-- ObjectCache.h - Class definition for the ObjectCache -----C++ -*-===//
2251607Sdim//
3251607Sdim//                     The LLVM Compiler Infrastructure
4251607Sdim//
5251607Sdim// This file is distributed under the University of Illinois Open Source
6251607Sdim// License. See LICENSE.TXT for details.
7251607Sdim//
8251607Sdim//===----------------------------------------------------------------------===//
9251607Sdim
10263509Sdim#ifndef LLVM_EXECUTIONENGINE_OBJECTCACHE_H
11263509Sdim#define LLVM_EXECUTIONENGINE_OBJECTCACHE_H
12251607Sdim
13251607Sdim#include "llvm/Support/MemoryBuffer.h"
14251607Sdim
15251607Sdimnamespace llvm {
16251607Sdim
17251607Sdimclass Module;
18251607Sdim
19251607Sdim/// This is the base ObjectCache type which can be provided to an
20251607Sdim/// ExecutionEngine for the purpose of avoiding compilation for Modules that
21251607Sdim/// have already been compiled and an object file is available.
22251607Sdimclass ObjectCache {
23263509Sdim  virtual void anchor();
24251607Sdimpublic:
25251607Sdim  ObjectCache() { }
26251607Sdim
27251607Sdim  virtual ~ObjectCache() { }
28251607Sdim
29251607Sdim  /// notifyObjectCompiled - Provides a pointer to compiled code for Module M.
30251607Sdim  virtual void notifyObjectCompiled(const Module *M, const MemoryBuffer *Obj) = 0;
31251607Sdim
32251607Sdim  /// getObjectCopy - Returns a pointer to a newly allocated MemoryBuffer that
33251607Sdim  /// contains the object which corresponds with Module M, or 0 if an object is
34263509Sdim  /// not available. The caller owns both the MemoryBuffer returned by this
35263509Sdim  /// and the memory it references.
36263509Sdim  virtual MemoryBuffer* getObject(const Module* M) = 0;
37251607Sdim};
38251607Sdim
39251607Sdim}
40251607Sdim
41251607Sdim#endif
42