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.

74 lines
2.2 KiB

  1. //===-- llvm/CodeGen/GCMetadataPrinter.h - Prints asm GC tables -*- 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. // The abstract base class GCMetadataPrinter supports writing GC metadata tables
  11. // as assembly code. This is a separate class from GCStrategy in order to allow
  12. // users of the LLVM JIT to avoid linking with the AsmWriter.
  13. //
  14. // Subclasses of GCMetadataPrinter must be registered using the
  15. // GCMetadataPrinterRegistry. This is separate from the GCStrategy itself
  16. // because these subclasses are logically plugins for the AsmWriter.
  17. //
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_CODEGEN_GCMETADATAPRINTER_H
  20. #define LLVM_CODEGEN_GCMETADATAPRINTER_H
  21. #include "llvm/CodeGen/GCMetadata.h"
  22. #include "llvm/CodeGen/GCStrategy.h"
  23. #include "llvm/Support/Registry.h"
  24. namespace llvm {
  25. class GCMetadataPrinter;
  26. /// GCMetadataPrinterRegistry - The GC assembly printer registry uses all the
  27. /// defaults from Registry.
  28. typedef Registry<GCMetadataPrinter> GCMetadataPrinterRegistry;
  29. /// GCMetadataPrinter - Emits GC metadata as assembly code.
  30. ///
  31. class GCMetadataPrinter {
  32. public:
  33. typedef GCStrategy::list_type list_type;
  34. typedef GCStrategy::iterator iterator;
  35. private:
  36. GCStrategy *S;
  37. friend class AsmPrinter;
  38. protected:
  39. // May only be subclassed.
  40. GCMetadataPrinter();
  41. private:
  42. GCMetadataPrinter(const GCMetadataPrinter &) LLVM_DELETED_FUNCTION;
  43. GCMetadataPrinter &
  44. operator=(const GCMetadataPrinter &) LLVM_DELETED_FUNCTION;
  45. public:
  46. GCStrategy &getStrategy() { return *S; }
  47. const Module &getModule() const { return S->getModule(); }
  48. /// begin/end - Iterate over the collected function metadata.
  49. iterator begin() { return S->begin(); }
  50. iterator end() { return S->end(); }
  51. /// beginAssembly/finishAssembly - Emit module metadata as assembly code.
  52. virtual void beginAssembly(AsmPrinter &AP);
  53. virtual void finishAssembly(AsmPrinter &AP);
  54. virtual ~GCMetadataPrinter();
  55. };
  56. }
  57. #endif