Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.4 KiB

  1. //===-- llvm/GVMaterializer.h - Interface for GV materializers --*- 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. // 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
  14. // at the same time.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_GVMATERIALIZER_H
  18. #define LLVM_GVMATERIALIZER_H
  19. #include <string>
  20. namespace llvm {
  21. class Function;
  22. class GlobalValue;
  23. class Module;
  24. class GVMaterializer {
  25. protected:
  26. GVMaterializer() {}
  27. public:
  28. virtual ~GVMaterializer();
  29. /// isMaterializable - True if GV can be materialized from whatever backing
  30. /// store this GVMaterializer uses and has not been materialized yet.
  31. virtual bool isMaterializable(const GlobalValue *GV) const = 0;
  32. /// isDematerializable - True if GV has been materialized and can be
  33. /// dematerialized back to whatever backing store this GVMaterializer uses.
  34. virtual bool isDematerializable(const GlobalValue *GV) const = 0;
  35. /// Materialize - make sure the given GlobalValue is fully read. If the
  36. /// module is corrupt, this returns true and fills in the optional string with
  37. /// information about the problem. If successful, this returns false.
  38. ///
  39. virtual bool Materialize(GlobalValue *GV, std::string *ErrInfo = 0) = 0;
  40. /// Dematerialize - If the given GlobalValue is read in, and if the
  41. /// GVMaterializer supports it, release the memory for the GV, and set it up
  42. /// to be materialized lazily. If the Materializer doesn't support this
  43. /// capability, this method is a noop.
  44. ///
  45. virtual void Dematerialize(GlobalValue *) {}
  46. /// MaterializeModule - make sure the entire Module has been completely read.
  47. /// On error, this returns true and fills in the optional string with
  48. /// information about the problem. If successful, this returns false.
  49. ///
  50. virtual bool MaterializeModule(Module *M, std::string *ErrInfo = 0) = 0;
  51. };
  52. } // End llvm namespace
  53. #endif