LLVM API Documentation

GCMetadataPrinter.h
Go to the documentation of this file.
00001 //===-- llvm/CodeGen/GCMetadataPrinter.h - Prints asm GC tables -*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // The abstract base class GCMetadataPrinter supports writing GC metadata tables
00011 // as assembly code. This is a separate class from GCStrategy in order to allow
00012 // users of the LLVM JIT to avoid linking with the AsmWriter.
00013 //
00014 // Subclasses of GCMetadataPrinter must be registered using the
00015 // GCMetadataPrinterRegistry. This is separate from the GCStrategy itself
00016 // because these subclasses are logically plugins for the AsmWriter.
00017 //
00018 //===----------------------------------------------------------------------===//
00019 
00020 #ifndef LLVM_CODEGEN_GCMETADATAPRINTER_H
00021 #define LLVM_CODEGEN_GCMETADATAPRINTER_H
00022 
00023 #include "llvm/CodeGen/GCMetadata.h"
00024 #include "llvm/CodeGen/GCStrategy.h"
00025 #include "llvm/Support/Registry.h"
00026 
00027 namespace llvm {
00028 
00029   class GCMetadataPrinter;
00030 
00031   /// GCMetadataPrinterRegistry - The GC assembly printer registry uses all the
00032   /// defaults from Registry.
00033   typedef Registry<GCMetadataPrinter> GCMetadataPrinterRegistry;
00034 
00035   /// GCMetadataPrinter - Emits GC metadata as assembly code.
00036   ///
00037   class GCMetadataPrinter {
00038   public:
00039     typedef GCStrategy::list_type list_type;
00040     typedef GCStrategy::iterator iterator;
00041 
00042   private:
00043     GCStrategy *S;
00044 
00045     friend class AsmPrinter;
00046 
00047   protected:
00048     // May only be subclassed.
00049     GCMetadataPrinter();
00050 
00051   private:
00052     GCMetadataPrinter(const GCMetadataPrinter &) LLVM_DELETED_FUNCTION;
00053     GCMetadataPrinter &
00054       operator=(const GCMetadataPrinter &) LLVM_DELETED_FUNCTION;
00055 
00056   public:
00057     GCStrategy &getStrategy() { return *S; }
00058     const Module &getModule() const { return S->getModule(); }
00059 
00060     /// begin/end - Iterate over the collected function metadata.
00061     iterator begin() { return S->begin(); }
00062     iterator end()   { return S->end();   }
00063 
00064     /// beginAssembly/finishAssembly - Emit module metadata as assembly code.
00065     virtual void beginAssembly(AsmPrinter &AP);
00066 
00067     virtual void finishAssembly(AsmPrinter &AP);
00068 
00069     virtual ~GCMetadataPrinter();
00070   };
00071 
00072 }
00073 
00074 #endif