ObjectCache.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #ifndef LLVM_EXECUTIONENGINE_OBJECTCACHE_H
  10. #define LLVM_EXECUTIONENGINE_OBJECTCACHE_H
  11. #include "llvm/Support/MemoryBuffer.h"
  12. namespace llvm {
  13. class Module;
  14. /// This is the base ObjectCache type which can be provided to an
  15. /// ExecutionEngine for the purpose of avoiding compilation for Modules that
  16. /// have already been compiled and an object file is available.
  17. class ObjectCache {
  18. virtual void anchor();
  19. public:
  20. ObjectCache() { }
  21. virtual ~ObjectCache() { }
  22. /// notifyObjectCompiled - Provides a pointer to compiled code for Module M.
  23. virtual void notifyObjectCompiled(const Module *M, MemoryBufferRef Obj) = 0;
  24. /// Returns a pointer to a newly allocated MemoryBuffer that contains the
  25. /// object which corresponds with Module M, or 0 if an object is not
  26. /// available.
  27. virtual std::unique_ptr<MemoryBuffer> getObject(const Module* M) = 0;
  28. };
  29. }
  30. #endif