1 //===- llvm/CodeGen/GCMetadataPrinter.h - Prints asm GC tables --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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.
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.
18 //===----------------------------------------------------------------------===//
20 #ifndef LLVM_CODEGEN_GCMETADATAPRINTER_H
21 #define LLVM_CODEGEN_GCMETADATAPRINTER_H
23 #include "llvm/Support/Registry.h"
28 class GCMetadataPrinter;
33 /// GCMetadataPrinterRegistry - The GC assembly printer registry uses all the
34 /// defaults from Registry.
35 using GCMetadataPrinterRegistry = Registry<GCMetadataPrinter>;
37 /// GCMetadataPrinter - Emits GC metadata as assembly code. Instances are
38 /// created, managed, and owned by the AsmPrinter.
39 class GCMetadataPrinter {
41 friend class AsmPrinter;
46 // May only be subclassed.
50 GCMetadataPrinter(const GCMetadataPrinter &) = delete;
51 GCMetadataPrinter &operator=(const GCMetadataPrinter &) = delete;
52 virtual ~GCMetadataPrinter();
54 GCStrategy &getStrategy() { return *S; }
56 /// Called before the assembly for the module is generated by
57 /// the AsmPrinter (but after target specific hooks.)
58 virtual void beginAssembly(Module &M, GCModuleInfo &Info, AsmPrinter &AP) {}
60 /// Called after the assembly for the module is generated by
61 /// the AsmPrinter (but before target specific hooks)
62 virtual void finishAssembly(Module &M, GCModuleInfo &Info, AsmPrinter &AP) {}
65 } // end namespace llvm
67 #endif // LLVM_CODEGEN_GCMETADATAPRINTER_H