aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC/MCNullStreamer.cpp
blob: 894eada57d6b10653b9db5db4f7ac7999f972797 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//===- lib/MC/MCNullStreamer.cpp - Dummy Streamer Implementation ----------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCSymbol.h"

using namespace llvm;

namespace {

  class MCNullStreamer : public MCStreamer {
  public:
    MCNullStreamer(MCContext &Context) : MCStreamer(Context) {}

    /// @name MCStreamer Interface
    /// @{

    void ChangeSection(const MCSection *Section,
                       const MCExpr *Subsection) override {
    }

    void EmitLabel(MCSymbol *Symbol) override {
      assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
      assert(getCurrentSection().first &&"Cannot emit before setting section!");
      AssignSection(Symbol, getCurrentSection().first);
    }
    void EmitDebugLabel(MCSymbol *Symbol) override {
      EmitLabel(Symbol);
    }
    void EmitAssemblerFlag(MCAssemblerFlag Flag) override {}
    void EmitThumbFunc(MCSymbol *Func) override {}

    void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override {}
    void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override {}
    void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
                                  const MCSymbol *LastLabel,
                                  const MCSymbol *Label,
                                  unsigned PointerSize) override {}

    bool EmitSymbolAttribute(MCSymbol *Symbol,
                             MCSymbolAttr Attribute) override {
      return true;
    }

    void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override {}

    void BeginCOFFSymbolDef(const MCSymbol *Symbol) override {}
    void EmitCOFFSymbolStorageClass(int StorageClass) override {}
    void EmitCOFFSymbolType(int Type) override {}
    void EndCOFFSymbolDef() override {}
    void EmitCOFFSecRel32(MCSymbol const *Symbol) override {}

    void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) override {}
    void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
                          unsigned ByteAlignment) override {}
    void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
                               unsigned ByteAlignment) override {}
    void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
                      uint64_t Size = 0, unsigned ByteAlignment = 0) override {}
    void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
                        uint64_t Size, unsigned ByteAlignment) override {}
    void EmitBytes(StringRef Data) override {}

    void EmitValueImpl(const MCExpr *Value, unsigned Size) override {}
    void EmitULEB128Value(const MCExpr *Value) override {}
    void EmitSLEB128Value(const MCExpr *Value) override {}
    void EmitGPRel32Value(const MCExpr *Value) override {}
    void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
                              unsigned ValueSize = 1,
                              unsigned MaxBytesToEmit = 0) override {}

    void EmitCodeAlignment(unsigned ByteAlignment,
                           unsigned MaxBytesToEmit = 0) override {}

    bool EmitValueToOffset(const MCExpr *Offset,
                           unsigned char Value = 0) override { return false; }

    void EmitFileDirective(StringRef Filename) override {}
    unsigned EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
                                    StringRef Filename,
                                    unsigned CUID = 0) override {
      return 0;
    }
    void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
                               unsigned Column, unsigned Flags,
                               unsigned Isa, unsigned Discriminator,
                               StringRef FileName) override {}
    void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo&) override {}

    void EmitBundleAlignMode(unsigned AlignPow2) override {}
    void EmitBundleLock(bool AlignToEnd) override {}
    void EmitBundleUnlock() override {}

    void FinishImpl() override {}

    void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) override {
      RecordProcEnd(Frame);
    }
  };

}

MCStreamer *llvm::createNullStreamer(MCContext &Context) {
  return new MCNullStreamer(Context);
}