Fixed some bugs.
[llvm/zpu.git] / lib / MC / MCNullStreamer.cpp
blob9dfb28c30422cb9797c3f7bba3b0e6b0355e77e3
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 //===----------------------------------------------------------------------===//
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"
17 using namespace llvm;
19 namespace {
21 class MCNullStreamer : public MCStreamer {
22 public:
23 MCNullStreamer(MCContext &Context) : MCStreamer(Context) {}
25 /// @name MCStreamer Interface
26 /// @{
28 virtual void InitSections() {
31 virtual void SwitchSection(const MCSection *Section) {
32 PrevSection = CurSection;
33 CurSection = Section;
36 virtual void EmitLabel(MCSymbol *Symbol) {
37 assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
38 assert(CurSection && "Cannot emit before setting section!");
39 Symbol->setSection(*CurSection);
42 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {}
44 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
45 virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol){}
47 virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute){}
49 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
51 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) {}
52 virtual void EmitCOFFSymbolStorageClass(int StorageClass) {}
53 virtual void EmitCOFFSymbolType(int Type) {}
54 virtual void EndCOFFSymbolDef() {}
56 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
57 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
58 unsigned ByteAlignment) {}
59 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) {}
61 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
62 unsigned Size = 0, unsigned ByteAlignment = 0) {}
63 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
64 uint64_t Size, unsigned ByteAlignment) {}
65 virtual void EmitBytes(StringRef Data, unsigned AddrSpace) {}
67 virtual void EmitValue(const MCExpr *Value, unsigned Size,
68 unsigned AddrSpace) {}
69 virtual void EmitULEB128Value(const MCExpr *Value,
70 unsigned AddrSpace = 0) {}
71 virtual void EmitSLEB128Value(const MCExpr *Value,
72 unsigned AddrSpace = 0) {}
73 virtual void EmitGPRel32Value(const MCExpr *Value) {}
74 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
75 unsigned ValueSize = 1,
76 unsigned MaxBytesToEmit = 0) {}
78 virtual void EmitCodeAlignment(unsigned ByteAlignment,
79 unsigned MaxBytesToEmit = 0) {}
81 virtual void EmitValueToOffset(const MCExpr *Offset,
82 unsigned char Value = 0) {}
84 virtual void EmitFileDirective(StringRef Filename) {}
85 virtual void EmitDwarfFileDirective(unsigned FileNo,StringRef Filename) {}
86 virtual void EmitInstruction(const MCInst &Inst) {}
88 virtual void Finish() {}
90 /// @}
95 MCStreamer *llvm::createNullStreamer(MCContext &Context) {
96 return new MCNullStreamer(Context);