1 //===-- RecordStreamer.cpp - Record asm definde and used symbols ----------===//
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 #include "RecordStreamer.h"
11 #include "llvm/MC/MCSymbol.h"
14 void RecordStreamer::markDefined(const MCSymbol &Symbol) {
15 State &S = Symbols[Symbol.getName()];
33 void RecordStreamer::markGlobal(const MCSymbol &Symbol,
34 MCSymbolAttr Attribute) {
35 State &S = Symbols[Symbol.getName()];
39 S = (Attribute == MCSA_Weak) ? DefinedWeak : DefinedGlobal;
45 S = (Attribute == MCSA_Weak) ? UndefinedWeak : Global;
53 void RecordStreamer::markUsed(const MCSymbol &Symbol) {
54 State &S = Symbols[Symbol.getName()];
70 void RecordStreamer::visitUsedSymbol(const MCSymbol &Sym) { markUsed(Sym); }
72 RecordStreamer::const_iterator RecordStreamer::begin() {
73 return Symbols.begin();
76 RecordStreamer::const_iterator RecordStreamer::end() { return Symbols.end(); }
78 RecordStreamer::RecordStreamer(MCContext &Context) : MCStreamer(Context) {}
80 void RecordStreamer::EmitInstruction(const MCInst &Inst,
81 const MCSubtargetInfo &STI) {
82 MCStreamer::EmitInstruction(Inst, STI);
85 void RecordStreamer::EmitLabel(MCSymbol *Symbol) {
86 MCStreamer::EmitLabel(Symbol);
90 void RecordStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
92 MCStreamer::EmitAssignment(Symbol, Value);
95 bool RecordStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
96 MCSymbolAttr Attribute) {
97 if (Attribute == MCSA_Global || Attribute == MCSA_Weak)
98 markGlobal(*Symbol, Attribute);
99 if (Attribute == MCSA_LazyReference)
104 void RecordStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
105 uint64_t Size, unsigned ByteAlignment) {
106 markDefined(*Symbol);
109 void RecordStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
110 unsigned ByteAlignment) {
111 markDefined(*Symbol);