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, 0) {}
24 /// @name MCStreamer Interface
27 virtual void InitToTextSection() {
30 virtual void InitSections() {
33 virtual void ChangeSection(const MCSection *Section,
34 const MCExpr *Subsection) {
37 virtual void EmitLabel(MCSymbol *Symbol) {
38 assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
39 assert(getCurrentSection().first &&"Cannot emit before setting section!");
40 AssignSection(Symbol, getCurrentSection().first);
42 virtual void EmitDebugLabel(MCSymbol *Symbol) {
45 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {}
46 virtual void EmitThumbFunc(MCSymbol *Func) {}
48 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
49 virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol){}
50 virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
51 const MCSymbol *LastLabel,
52 const MCSymbol *Label,
53 unsigned PointerSize) {}
55 virtual bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute){
59 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
61 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) {}
62 virtual void EmitCOFFSymbolStorageClass(int StorageClass) {}
63 virtual void EmitCOFFSymbolType(int Type) {}
64 virtual void EndCOFFSymbolDef() {}
65 virtual void EmitCOFFSecRel32(MCSymbol const *Symbol) {}
67 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
68 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
69 unsigned ByteAlignment) {}
70 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
71 unsigned ByteAlignment) {}
72 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
73 uint64_t Size = 0, unsigned ByteAlignment = 0) {}
74 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
75 uint64_t Size, unsigned ByteAlignment) {}
76 virtual void EmitBytes(StringRef Data) {}
78 virtual void EmitValueImpl(const MCExpr *Value, unsigned Size) {}
79 virtual void EmitULEB128Value(const MCExpr *Value) {}
80 virtual void EmitSLEB128Value(const MCExpr *Value) {}
81 virtual void EmitGPRel32Value(const MCExpr *Value) {}
82 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
83 unsigned ValueSize = 1,
84 unsigned MaxBytesToEmit = 0) {}
86 virtual void EmitCodeAlignment(unsigned ByteAlignment,
87 unsigned MaxBytesToEmit = 0) {}
89 virtual bool EmitValueToOffset(const MCExpr *Offset,
90 unsigned char Value = 0) { return false; }
92 virtual void EmitFileDirective(StringRef Filename) {}
93 virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
94 StringRef Filename, unsigned CUID = 0) {
97 virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
98 unsigned Column, unsigned Flags,
99 unsigned Isa, unsigned Discriminator,
100 StringRef FileName) {}
101 virtual void EmitInstruction(const MCInst &Inst) {}
103 virtual void EmitBundleAlignMode(unsigned AlignPow2) {}
104 virtual void EmitBundleLock(bool AlignToEnd) {}
105 virtual void EmitBundleUnlock() {}
107 virtual void FinishImpl() {}
109 virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) {
110 RecordProcEnd(Frame);
116 MCStreamer *llvm::createNullStreamer(MCContext &Context) {
117 return new MCNullStreamer(Context);