]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Object/RecordStreamer.h
Update ELF Tool Chain to upstream r3520
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Object / RecordStreamer.h
1 //===-- RecordStreamer.h - Record asm defined and used symbols ---*- 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 #ifndef LLVM_LIB_OBJECT_RECORDSTREAMER_H
11 #define LLVM_LIB_OBJECT_RECORDSTREAMER_H
12
13 #include "llvm/MC/MCStreamer.h"
14
15 namespace llvm {
16 class RecordStreamer : public MCStreamer {
17 public:
18   enum State { NeverSeen, Global, Defined, DefinedGlobal, DefinedWeak, Used,
19                UndefinedWeak};
20
21 private:
22   StringMap<State> Symbols;
23   void markDefined(const MCSymbol &Symbol);
24   void markGlobal(const MCSymbol &Symbol, MCSymbolAttr Attribute);
25   void markUsed(const MCSymbol &Symbol);
26   void visitUsedSymbol(const MCSymbol &Sym) override;
27
28 public:
29   typedef StringMap<State>::const_iterator const_iterator;
30   const_iterator begin();
31   const_iterator end();
32   RecordStreamer(MCContext &Context);
33   void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override;
34   void EmitLabel(MCSymbol *Symbol) override;
35   void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
36   bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
37   void EmitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
38                     unsigned ByteAlignment) override;
39   void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
40                         unsigned ByteAlignment) override;
41 };
42 }
43 #endif