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 20#ifndef LLVM_CODEGEN_GCMETADATAPRINTER_H 21#define LLVM_CODEGEN_GCMETADATAPRINTER_H 22 23#include "llvm/CodeGen/GCMetadata.h" 24#include "llvm/CodeGen/GCStrategy.h" 25#include "llvm/Support/Registry.h" 26 27namespace llvm {
|
28
|
28 |
29 class GCMetadataPrinter;
|
30
|
30 |
31 /// GCMetadataPrinterRegistry - The GC assembly printer registry uses all the 32 /// defaults from Registry. 33 typedef Registry<GCMetadataPrinter> GCMetadataPrinterRegistry;
|
34
|
34 |
35 /// GCMetadataPrinter - Emits GC metadata as assembly code.
|
36 ///
|
36 /// |
37 class GCMetadataPrinter { 38 public: 39 typedef GCStrategy::list_type list_type; 40 typedef GCStrategy::iterator iterator;
|
41
|
41 |
42 private: 43 GCStrategy *S;
|
44
|
44 |
45 friend class AsmPrinter;
|
46
|
46 |
47 protected: 48 // May only be subclassed. 49 GCMetadataPrinter();
|
50
|
50 |
51 // Do not implement. 52 GCMetadataPrinter(const GCMetadataPrinter &); 53 GCMetadataPrinter &operator=(const GCMetadataPrinter &);
|
54
|
54 |
55 public: 56 GCStrategy &getStrategy() { return *S; } 57 const Module &getModule() const { return S->getModule(); }
|
58
|
58 |
59 /// begin/end - Iterate over the collected function metadata. 60 iterator begin() { return S->begin(); } 61 iterator end() { return S->end(); }
|
62
|
62 |
63 /// beginAssembly/finishAssembly - Emit module metadata as assembly code. 64 virtual void beginAssembly(AsmPrinter &AP);
|
65
|
65 |
66 virtual void finishAssembly(AsmPrinter &AP);
|
67
|
67 |
68 virtual ~GCMetadataPrinter(); 69 };
|
70
|
70 |
71} 72 73#endif
|