1f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===- llvm/CodeGen/GCMetadataPrinter.h - Prints asm GC tables --*- C++ -*-===//
2f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
3f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//                     The LLVM Compiler Infrastructure
4f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
5f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// This file is distributed under the University of Illinois Open Source
6f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// License. See LICENSE.TXT for details.
7f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
8f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===----------------------------------------------------------------------===//
9f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
10f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// The abstract base class GCMetadataPrinter supports writing GC metadata tables
11f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// as assembly code. This is a separate class from GCStrategy in order to allow
12f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// users of the LLVM JIT to avoid linking with the AsmWriter.
13f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
14f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// Subclasses of GCMetadataPrinter must be registered using the
15f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// GCMetadataPrinterRegistry. This is separate from the GCStrategy itself
16f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// because these subclasses are logically plugins for the AsmWriter.
17f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//
18f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===----------------------------------------------------------------------===//
19f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
20f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#ifndef LLVM_CODEGEN_GCMETADATAPRINTER_H
21f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#define LLVM_CODEGEN_GCMETADATAPRINTER_H
22f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
23f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/Support/Registry.h"
24f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
25f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotnamespace llvm {
26f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
27f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass AsmPrinter;
28f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass GCMetadataPrinter;
29f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass GCModuleInfo;
30f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass GCStrategy;
31f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass Module;
32f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
33f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// GCMetadataPrinterRegistry - The GC assembly printer registry uses all the
34f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// defaults from Registry.
35f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotusing GCMetadataPrinterRegistry = Registry<GCMetadataPrinter>;
36f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
37f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// GCMetadataPrinter - Emits GC metadata as assembly code.  Instances are
38f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// created, managed, and owned by the AsmPrinter.
39f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass GCMetadataPrinter {
40f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotprivate:
41f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  friend class AsmPrinter;
42f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
43f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  GCStrategy *S;
44f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
45f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotprotected:
46f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  // May only be subclassed.
47f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  GCMetadataPrinter();
48f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
49f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic:
50f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  GCMetadataPrinter(const GCMetadataPrinter &) = delete;
51f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  GCMetadataPrinter &operator=(const GCMetadataPrinter &) = delete;
52f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  virtual ~GCMetadataPrinter();
53f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
54f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  GCStrategy &getStrategy() { return *S; }
55f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
56f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Called before the assembly for the module is generated by
57f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// the AsmPrinter (but after target specific hooks.)
58f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  virtual void beginAssembly(Module &M, GCModuleInfo &Info, AsmPrinter &AP) {}
59f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
60f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// Called after the assembly for the module is generated by
61f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  /// the AsmPrinter (but before target specific hooks)
62f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot  virtual void finishAssembly(Module &M, GCModuleInfo &Info, AsmPrinter &AP) {}
63f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot};
64f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
65f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot} // end namespace llvm
66f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot
67f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#endif // LLVM_CODEGEN_GCMETADATAPRINTER_H
68