1 //===-- RecordStreamer.h - Record asm defined and used symbols ---*- C++ -*===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LIB_OBJECT_RECORDSTREAMER_H
11 #define LLVM_LIB_OBJECT_RECORDSTREAMER_H
13 #include "llvm/MC/MCStreamer.h"
16 class RecordStreamer : public MCStreamer {
18 enum State { NeverSeen, Global, Defined, DefinedGlobal, DefinedWeak, Used,
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;
29 typedef StringMap<State>::const_iterator const_iterator;
30 const_iterator begin();
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;