Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:28

0001 //===- llvm/CodeGen/GCMetadataPrinter.h - Prints asm GC tables --*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // The abstract base class GCMetadataPrinter supports writing GC metadata tables
0010 // as assembly code. This is a separate class from GCStrategy in order to allow
0011 // users of the LLVM JIT to avoid linking with the AsmWriter.
0012 //
0013 // Subclasses of GCMetadataPrinter must be registered using the
0014 // GCMetadataPrinterRegistry. This is separate from the GCStrategy itself
0015 // because these subclasses are logically plugins for the AsmWriter.
0016 //
0017 //===----------------------------------------------------------------------===//
0018 
0019 #ifndef LLVM_CODEGEN_GCMETADATAPRINTER_H
0020 #define LLVM_CODEGEN_GCMETADATAPRINTER_H
0021 
0022 #include "llvm/Support/Registry.h"
0023 
0024 namespace llvm {
0025 
0026 class AsmPrinter;
0027 class GCMetadataPrinter;
0028 class GCModuleInfo;
0029 class GCStrategy;
0030 class Module;
0031 class StackMaps;
0032 
0033 /// GCMetadataPrinterRegistry - The GC assembly printer registry uses all the
0034 /// defaults from Registry.
0035 using GCMetadataPrinterRegistry = Registry<GCMetadataPrinter>;
0036 
0037 extern template class LLVM_TEMPLATE_ABI Registry<GCMetadataPrinter>;
0038 
0039 /// GCMetadataPrinter - Emits GC metadata as assembly code.  Instances are
0040 /// created, managed, and owned by the AsmPrinter.
0041 class GCMetadataPrinter {
0042 private:
0043   friend class AsmPrinter;
0044 
0045   GCStrategy *S;
0046 
0047 protected:
0048   // May only be subclassed.
0049   GCMetadataPrinter();
0050 
0051 public:
0052   GCMetadataPrinter(const GCMetadataPrinter &) = delete;
0053   GCMetadataPrinter &operator=(const GCMetadataPrinter &) = delete;
0054   virtual ~GCMetadataPrinter();
0055 
0056   GCStrategy &getStrategy() { return *S; }
0057 
0058   /// Called before the assembly for the module is generated by
0059   /// the AsmPrinter (but after target specific hooks.)
0060   virtual void beginAssembly(Module &M, GCModuleInfo &Info, AsmPrinter &AP) {}
0061 
0062   /// Called after the assembly for the module is generated by
0063   /// the AsmPrinter (but before target specific hooks)
0064   virtual void finishAssembly(Module &M, GCModuleInfo &Info, AsmPrinter &AP) {}
0065 
0066   /// Called when the stack maps are generated. Return true if
0067   /// stack maps with a custom format are generated. Otherwise
0068   /// returns false and the default format will be used.
0069   virtual bool emitStackMaps(StackMaps &SM, AsmPrinter &AP) { return false; }
0070 };
0071 
0072 } // end namespace llvm
0073 
0074 #endif // LLVM_CODEGEN_GCMETADATAPRINTER_H