blob: 617d8a43fbd26ccd12fb9e48222e866c0e652dbf [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:
Davide Italianof7518492016-09-15 17:54:22 +000018 enum State { NeverSeen, Global, Defined, DefinedGlobal, DefinedWeak, Used,
19 UndefinedWeak};
Rafael Espindola13b69d62014-07-03 18:59:23 +000020
21private:
22 StringMap<State> Symbols;
23 void markDefined(const MCSymbol &Symbol);
Davide Italianoec7e29e2016-06-22 20:48:15 +000024 void markGlobal(const MCSymbol &Symbol, MCSymbolAttr Attribute);
Rafael Espindola13b69d62014-07-03 18:59:23 +000025 void markUsed(const MCSymbol &Symbol);
26 void visitUsedSymbol(const MCSymbol &Sym) override;
27
28public:
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;
Rafael Espindola0709a7b2015-05-21 19:20:38 +000037 void EmitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
Rafael Espindola13b69d62014-07-03 18:59:23 +000038 unsigned ByteAlignment) override;
39 void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
40 unsigned ByteAlignment) override;
41};
Alexander Kornienkof00654e2015-06-23 09:49:53 +000042}
Rafael Espindola13b69d62014-07-03 18:59:23 +000043#endif