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"
11 #include "llvm/MC/MCContext.h"
12 #include "llvm/MC/MCInst.h"
13 #include "llvm/MC/MCSectionMachO.h"
14 #include "llvm/MC/MCSymbol.h"
20 class MCNullStreamer : public MCStreamer {
22 MCNullStreamer(MCContext &Context) : MCStreamer(Context) {}
24 /// @name MCStreamer Interface
27 virtual void ChangeSection(const MCSection *Section,
28 const MCExpr *Subsection) {
31 virtual void EmitLabel(MCSymbol *Symbol) {
32 assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
33 assert(getCurrentSection().first &&"Cannot emit before setting section!");
34 AssignSection(Symbol, getCurrentSection().first);
36 virtual void EmitDebugLabel(MCSymbol *Symbol) {
39 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {}
40 virtual void EmitThumbFunc(MCSymbol *Func) {}
42 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
43 virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol){}
44 virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
45 const MCSymbol *LastLabel,
46 const MCSymbol *Label,
47 unsigned PointerSize) {}
49 virtual bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute){
53 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
55 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) {}
56 virtual void EmitCOFFSymbolStorageClass(int StorageClass) {}
57 virtual void EmitCOFFSymbolType(int Type) {}
58 virtual void EndCOFFSymbolDef() {}
59 virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) {}
61 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
62 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
63 unsigned ByteAlignment) {}
64 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
65 unsigned ByteAlignment) {}
66 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
67 uint64_t Size = 0, unsigned ByteAlignment = 0) {}
68 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
69 uint64_t Size, unsigned ByteAlignment) {}
70 virtual void EmitBytes(StringRef Data) {}
72 virtual void EmitValueImpl(const MCExpr *Value, unsigned Size) {}
73 virtual void EmitULEB128Value(const MCExpr *Value) {}
74 virtual void EmitSLEB128Value(const MCExpr *Value) {}
75 virtual void EmitGPRel32Value(const MCExpr *Value) {}
76 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
77 unsigned ValueSize = 1,
78 unsigned MaxBytesToEmit = 0) {}
80 virtual void EmitCodeAlignment(unsigned ByteAlignment,
81 unsigned MaxBytesToEmit = 0) {}
83 virtual bool EmitValueToOffset(const MCExpr *Offset,
84 unsigned char Value = 0) { return false; }
86 virtual void EmitFileDirective(StringRef Filename) {}
87 virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
88 StringRef Filename, unsigned CUID = 0) {
91 virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
92 unsigned Column, unsigned Flags,
93 unsigned Isa, unsigned Discriminator,
94 StringRef FileName) {}
95 virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo&) {}
97 virtual void EmitBundleAlignMode(unsigned AlignPow2) {}
98 virtual void EmitBundleLock(bool AlignToEnd) {}
99 virtual void EmitBundleUnlock() {}
101 virtual void FinishImpl() {}
103 virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) {
104 RecordProcEnd(Frame);
110 MCStreamer *llvm::createNullStreamer(MCContext &Context) {
111 return new MCNullStreamer(Context);