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
, Used
};
21 StringMap
<State
> Symbols
;
22 void markDefined(const MCSymbol
&Symbol
);
23 void markGlobal(const MCSymbol
&Symbol
);
24 void markUsed(const MCSymbol
&Symbol
);
25 void visitUsedSymbol(const MCSymbol
&Sym
) override
;
28 typedef StringMap
<State
>::const_iterator const_iterator
;
29 const_iterator
begin();
31 RecordStreamer(MCContext
&Context
);
32 void EmitInstruction(const MCInst
&Inst
, const MCSubtargetInfo
&STI
) override
;
33 void EmitLabel(MCSymbol
*Symbol
) override
;
34 void EmitAssignment(MCSymbol
*Symbol
, const MCExpr
*Value
) override
;
35 bool EmitSymbolAttribute(MCSymbol
*Symbol
, MCSymbolAttr Attribute
) override
;
36 void EmitZerofill(const MCSection
*Section
, MCSymbol
*Symbol
, uint64_t Size
,
37 unsigned ByteAlignment
) override
;
38 void EmitCommonSymbol(MCSymbol
*Symbol
, uint64_t Size
,
39 unsigned ByteAlignment
) override
;