blob: 7dacbdfbfd620d9ecd0892d2be73d3496a079334 [file] [log] [blame]
Rafael Espindola13b69d62014-07-03 18:59:23 +00001//===-- 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
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000010#ifndef LLVM_LIB_OBJECT_RECORDSTREAMER_H
11#define LLVM_LIB_OBJECT_RECORDSTREAMER_H
Rafael Espindola13b69d62014-07-03 18:59:23 +000012
13#include "llvm/MC/MCStreamer.h"
14
15namespace llvm {
16class RecordStreamer : public MCStreamer {
17public:
18 enum State { NeverSeen, Global, Defined, DefinedGlobal, Used };
19
20private:
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;
26
27public:
28 typedef StringMap<State>::const_iterator const_iterator;
29 const_iterator begin();
30 const_iterator end();
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;
40};
41}
42#endif