ObjectCache.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- ObjectCache.h - Class definition for the ObjectCache ----*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_EXECUTIONENGINE_OBJECTCACHE_H
  14. #define LLVM_EXECUTIONENGINE_OBJECTCACHE_H
  15. #include <memory>
  16. namespace llvm {
  17. class MemoryBuffer;
  18. class MemoryBufferRef;
  19. class Module;
  20. /// This is the base ObjectCache type which can be provided to an
  21. /// ExecutionEngine for the purpose of avoiding compilation for Modules that
  22. /// have already been compiled and an object file is available.
  23. class ObjectCache {
  24. virtual void anchor();
  25. public:
  26. ObjectCache() = default;
  27. virtual ~ObjectCache() = default;
  28. /// notifyObjectCompiled - Provides a pointer to compiled code for Module M.
  29. virtual void notifyObjectCompiled(const Module *M, MemoryBufferRef Obj) = 0;
  30. /// Returns a pointer to a newly allocated MemoryBuffer that contains the
  31. /// object which corresponds with Module M, or 0 if an object is not
  32. /// available.
  33. virtual std::unique_ptr<MemoryBuffer> getObject(const Module* M) = 0;
  34. };
  35. } // end namespace llvm
  36. #endif // LLVM_EXECUTIONENGINE_OBJECTCACHE_H
  37. #ifdef __GNUC__
  38. #pragma GCC diagnostic pop
  39. #endif