blob: b2db410c1119adee6a9ee61eff65dd7f84e29ae6 [file] [log] [blame]
Daniel Dunbar011e4db2009-08-13 23:36:34 +00001//===- 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"
Daniel Dunbar011e4db2009-08-13 23:36:34 +000016
17using namespace llvm;
18
19namespace {
20
21 class MCNullStreamer : public MCStreamer {
22 public:
23 MCNullStreamer(MCContext &Context) : MCStreamer(Context) {}
24
25 /// @name MCStreamer Interface
26 /// @{
27
Rafael Espindolad80781b2010-09-15 21:48:40 +000028 virtual void InitSections() {
29 }
30
Chris Lattner4d35fce2009-08-18 16:46:29 +000031 virtual void SwitchSection(const MCSection *Section) {
Benjamin Kramer1674b0b2010-09-02 18:53:37 +000032 PrevSection = CurSection;
Chris Lattner4d35fce2009-08-18 16:46:29 +000033 CurSection = Section;
34 }
Daniel Dunbar011e4db2009-08-13 23:36:34 +000035
Chris Lattner2e5dd9b2010-03-09 23:12:18 +000036 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);
40 }
Daniel Dunbar011e4db2009-08-13 23:36:34 +000041
Chris Lattnera5ad93a2010-01-23 06:39:22 +000042 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {}
Daniel Dunbar011e4db2009-08-13 23:36:34 +000043
Daniel Dunbar821e3332009-08-31 08:09:28 +000044 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
Daniel Dunbar011e4db2009-08-13 23:36:34 +000045
Chris Lattnera5ad93a2010-01-23 06:39:22 +000046 virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute){}
Daniel Dunbar011e4db2009-08-13 23:36:34 +000047
48 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
Chris Lattnerb54b9dd2010-05-08 19:54:22 +000049
50 virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) {}
51 virtual void EmitCOFFSymbolStorageClass(int StorageClass) {}
52 virtual void EmitCOFFSymbolType(int Type) {}
53 virtual void EndCOFFSymbolDef() {}
54
Chris Lattner99328ad2010-01-25 07:52:13 +000055 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
Chris Lattner9eb158d2010-01-23 07:47:02 +000056 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
Daniel Dunbar7092c7e2009-08-30 06:17:16 +000057 unsigned ByteAlignment) {}
Chris Lattner9eb158d2010-01-23 07:47:02 +000058 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) {}
Daniel Dunbar011e4db2009-08-13 23:36:34 +000059
Daniel Dunbar8751b942009-08-28 05:48:22 +000060 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
Daniel Dunbar7092c7e2009-08-30 06:17:16 +000061 unsigned Size = 0, unsigned ByteAlignment = 0) {}
Eric Christopher4d01cbe2010-05-18 21:16:04 +000062 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
63 uint64_t Size, unsigned ByteAlignment) {}
Chris Lattneraaec2052010-01-19 19:46:13 +000064 virtual void EmitBytes(StringRef Data, unsigned AddrSpace) {}
Daniel Dunbar011e4db2009-08-13 23:36:34 +000065
Chris Lattneraaec2052010-01-19 19:46:13 +000066 virtual void EmitValue(const MCExpr *Value, unsigned Size,
67 unsigned AddrSpace) {}
Chris Lattner718fb592010-01-25 21:28:50 +000068 virtual void EmitGPRel32Value(const MCExpr *Value) {}
Daniel Dunbar011e4db2009-08-13 23:36:34 +000069 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
70 unsigned ValueSize = 1,
71 unsigned MaxBytesToEmit = 0) {}
72
Kevin Enderby6e720482010-02-23 18:26:34 +000073 virtual void EmitCodeAlignment(unsigned ByteAlignment,
74 unsigned MaxBytesToEmit = 0) {}
75
Daniel Dunbar821e3332009-08-31 08:09:28 +000076 virtual void EmitValueToOffset(const MCExpr *Offset,
Daniel Dunbar011e4db2009-08-13 23:36:34 +000077 unsigned char Value = 0) {}
78
Chris Lattnera6594fc2010-01-25 18:58:59 +000079 virtual void EmitFileDirective(StringRef Filename) {}
80 virtual void EmitDwarfFileDirective(unsigned FileNo,StringRef Filename) {}
Daniel Dunbar011e4db2009-08-13 23:36:34 +000081 virtual void EmitInstruction(const MCInst &Inst) {}
82
83 virtual void Finish() {}
84
85 /// @}
86 };
87
88}
89
90MCStreamer *llvm::createNullStreamer(MCContext &Context) {
91 return new MCNullStreamer(Context);
92}