LLVM API Documentation

RecordStreamer.h
Go to the documentation of this file.
00001 //===-- RecordStreamer.h - Record asm defined and used symbols ---*- 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 #ifndef LLVM_LIB_OBJECT_RECORDSTREAMER_H
00011 #define LLVM_LIB_OBJECT_RECORDSTREAMER_H
00012 
00013 #include "llvm/MC/MCStreamer.h"
00014 
00015 namespace llvm {
00016 class RecordStreamer : public MCStreamer {
00017 public:
00018   enum State { NeverSeen, Global, Defined, DefinedGlobal, Used };
00019 
00020 private:
00021   StringMap<State> Symbols;
00022   void markDefined(const MCSymbol &Symbol);
00023   void markGlobal(const MCSymbol &Symbol);
00024   void markUsed(const MCSymbol &Symbol);
00025   void visitUsedSymbol(const MCSymbol &Sym) override;
00026 
00027 public:
00028   typedef StringMap<State>::const_iterator const_iterator;
00029   const_iterator begin();
00030   const_iterator end();
00031   RecordStreamer(MCContext &Context);
00032   void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override;
00033   void EmitLabel(MCSymbol *Symbol) override;
00034   void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
00035   bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
00036   void EmitZerofill(const MCSection *Section, MCSymbol *Symbol, uint64_t Size,
00037                     unsigned ByteAlignment) override;
00038   void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
00039                         unsigned ByteAlignment) override;
00040 };
00041 }
00042 #endif