1 //===- lib/MC/MCNullStreamer.cpp - Dummy Streamer Implementation ----------===//
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 "llvm/MC/MCStreamer.h"
12 #include "llvm/MC/MCContext.h"
13 #include "llvm/MC/MCInst.h"
14 #include "llvm/MC/MCSectionMachO.h"
15 #include "llvm/MC/MCSymbol.h"
21 class MCNullStreamer : public MCStreamer {
23 MCNullStreamer(MCContext &Context) : MCStreamer(Context) {}
25 /// @name MCStreamer Interface
28 virtual void SwitchSection(const MCSection *Section) {
29 PrevSection = CurSection;
33 virtual void EmitLabel(MCSymbol *Symbol) {
34 assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
35 assert(CurSection && "Cannot emit before setting section!");
36 Symbol->setSection(*CurSection);
39 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {}
41 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
43 virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute){}
45 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
47 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) {}
48 virtual void EmitCOFFSymbolStorageClass(int StorageClass) {}
49 virtual void EmitCOFFSymbolType(int Type) {}
50 virtual void EndCOFFSymbolDef() {}
52 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
53 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
54 unsigned ByteAlignment) {}
55 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) {}
57 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
58 unsigned Size = 0, unsigned ByteAlignment = 0) {}
59 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
60 uint64_t Size, unsigned ByteAlignment) {}
61 virtual void EmitBytes(StringRef Data, unsigned AddrSpace) {}
63 virtual void EmitValue(const MCExpr *Value, unsigned Size,
64 unsigned AddrSpace) {}
65 virtual void EmitGPRel32Value(const MCExpr *Value) {}
66 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
67 unsigned ValueSize = 1,
68 unsigned MaxBytesToEmit = 0) {}
70 virtual void EmitCodeAlignment(unsigned ByteAlignment,
71 unsigned MaxBytesToEmit = 0) {}
73 virtual void EmitValueToOffset(const MCExpr *Offset,
74 unsigned char Value = 0) {}
76 virtual void EmitFileDirective(StringRef Filename) {}
77 virtual void EmitDwarfFileDirective(unsigned FileNo,StringRef Filename) {}
78 virtual void EmitInstruction(const MCInst &Inst) {}
80 virtual void Finish() {}
87 MCStreamer *llvm::createNullStreamer(MCContext &Context) {
88 return new MCNullStreamer(Context);