• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- lib/MC/MCNullStreamer.cpp - Dummy Streamer Implementation ----------===//
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 
10 #include "llvm/MC/MCStreamer.h"
11 
12 #include "llvm/MC/MCContext.h"
13 #include "llvm/MC/MCInst.h"
14 #include "llvm/MC/MCSectionMachO.h"
15 #include "llvm/MC/MCSymbol.h"
16 
17 using namespace llvm;
18 
19 namespace {
20 
21   class MCNullStreamer : public MCStreamer {
22   public:
MCNullStreamer(MCContext & Context)23     MCNullStreamer(MCContext &Context) : MCStreamer(Context) {}
24 
25     /// @name MCStreamer Interface
26     /// @{
27 
InitSections()28     virtual void InitSections() {
29     }
30 
ChangeSection(const MCSection * Section)31     virtual void ChangeSection(const MCSection *Section) {
32     }
33 
EmitLabel(MCSymbol * Symbol)34     virtual void EmitLabel(MCSymbol *Symbol) {
35       assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
36       assert(getCurrentSection() && "Cannot emit before setting section!");
37       Symbol->setSection(*getCurrentSection());
38     }
39 
EmitAssemblerFlag(MCAssemblerFlag Flag)40     virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {}
EmitThumbFunc(MCSymbol * Func)41     virtual void EmitThumbFunc(MCSymbol *Func) {}
42 
EmitAssignment(MCSymbol * Symbol,const MCExpr * Value)43     virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
EmitWeakReference(MCSymbol * Alias,const MCSymbol * Symbol)44     virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol){}
EmitDwarfAdvanceLineAddr(int64_t LineDelta,const MCSymbol * LastLabel,const MCSymbol * Label,unsigned PointerSize)45     virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
46                                           const MCSymbol *LastLabel,
47                                           const MCSymbol *Label,
48                                           unsigned PointerSize) {}
49 
EmitSymbolAttribute(MCSymbol * Symbol,MCSymbolAttr Attribute)50     virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute){}
51 
EmitSymbolDesc(MCSymbol * Symbol,unsigned DescValue)52     virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
53 
BeginCOFFSymbolDef(const MCSymbol * Symbol)54     virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) {}
EmitCOFFSymbolStorageClass(int StorageClass)55     virtual void EmitCOFFSymbolStorageClass(int StorageClass) {}
EmitCOFFSymbolType(int Type)56     virtual void EmitCOFFSymbolType(int Type) {}
EndCOFFSymbolDef()57     virtual void EndCOFFSymbolDef() {}
58 
EmitELFSize(MCSymbol * Symbol,const MCExpr * Value)59     virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
EmitCommonSymbol(MCSymbol * Symbol,uint64_t Size,unsigned ByteAlignment)60     virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
61                                   unsigned ByteAlignment) {}
EmitLocalCommonSymbol(MCSymbol * Symbol,uint64_t Size,unsigned ByteAlignment)62     virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
63                                        unsigned ByteAlignment) {}
EmitZerofill(const MCSection * Section,MCSymbol * Symbol=0,unsigned Size=0,unsigned ByteAlignment=0)64     virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
65                               unsigned Size = 0, unsigned ByteAlignment = 0) {}
EmitTBSSSymbol(const MCSection * Section,MCSymbol * Symbol,uint64_t Size,unsigned ByteAlignment)66     virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
67                                 uint64_t Size, unsigned ByteAlignment) {}
EmitBytes(StringRef Data,unsigned AddrSpace)68     virtual void EmitBytes(StringRef Data, unsigned AddrSpace) {}
69 
EmitValueImpl(const MCExpr * Value,unsigned Size,unsigned AddrSpace)70     virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
71                                unsigned AddrSpace) {}
EmitULEB128Value(const MCExpr * Value)72     virtual void EmitULEB128Value(const MCExpr *Value) {}
EmitSLEB128Value(const MCExpr * Value)73     virtual void EmitSLEB128Value(const MCExpr *Value) {}
EmitGPRel32Value(const MCExpr * Value)74     virtual void EmitGPRel32Value(const MCExpr *Value) {}
EmitValueToAlignment(unsigned ByteAlignment,int64_t Value=0,unsigned ValueSize=1,unsigned MaxBytesToEmit=0)75     virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
76                                       unsigned ValueSize = 1,
77                                       unsigned MaxBytesToEmit = 0) {}
78 
EmitCodeAlignment(unsigned ByteAlignment,unsigned MaxBytesToEmit=0)79     virtual void EmitCodeAlignment(unsigned ByteAlignment,
80                                    unsigned MaxBytesToEmit = 0) {}
81 
EmitValueToOffset(const MCExpr * Offset,unsigned char Value=0)82     virtual void EmitValueToOffset(const MCExpr *Offset,
83                                    unsigned char Value = 0) {}
84 
EmitFileDirective(StringRef Filename)85     virtual void EmitFileDirective(StringRef Filename) {}
EmitDwarfFileDirective(unsigned FileNo,StringRef Filename)86     virtual bool EmitDwarfFileDirective(unsigned FileNo,StringRef Filename) {
87       return false;
88     }
EmitDwarfLocDirective(unsigned FileNo,unsigned Line,unsigned Column,unsigned Flags,unsigned Isa,unsigned Discriminator,StringRef FileName)89     virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
90                                        unsigned Column, unsigned Flags,
91                                        unsigned Isa, unsigned Discriminator,
92                                        StringRef FileName) {}
EmitInstruction(const MCInst & Inst)93     virtual void EmitInstruction(const MCInst &Inst) {}
94 
Finish()95     virtual void Finish() {}
96 
97     /// @}
98   };
99 
100 }
101 
createNullStreamer(MCContext & Context)102 MCStreamer *llvm::createNullStreamer(MCContext &Context) {
103   return new MCNullStreamer(Context);
104 }
105