1 //===-- MipsTargetStreamer.h - Mips Target Streamer ------------*- C++ -*--===//
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 #ifndef MIPSTARGETSTREAMER_H
11 #define MIPSTARGETSTREAMER_H
13 #include "llvm/MC/MCELFStreamer.h"
14 #include "llvm/MC/MCStreamer.h"
17 class MipsTargetStreamer : public MCTargetStreamer {
18 virtual void anchor();
21 MipsTargetStreamer(MCStreamer &S);
22 virtual void emitDirectiveSetMicroMips() = 0;
23 virtual void emitDirectiveSetNoMicroMips() = 0;
24 virtual void emitDirectiveSetMips16() = 0;
25 virtual void emitDirectiveSetNoMips16() = 0;
27 virtual void emitDirectiveSetReorder() = 0;
28 virtual void emitDirectiveSetNoReorder() = 0;
29 virtual void emitDirectiveSetMacro() = 0;
30 virtual void emitDirectiveSetNoMacro() = 0;
31 virtual void emitDirectiveSetAt() = 0;
32 virtual void emitDirectiveSetNoAt() = 0;
33 virtual void emitDirectiveEnd(StringRef Name) = 0;
35 virtual void emitDirectiveEnt(const MCSymbol &Symbol) = 0;
36 virtual void emitDirectiveAbiCalls() = 0;
37 virtual void emitDirectiveNaN2008() = 0;
38 virtual void emitDirectiveNaNLegacy() = 0;
39 virtual void emitDirectiveOptionPic0() = 0;
40 virtual void emitDirectiveOptionPic2() = 0;
41 virtual void emitFrame(unsigned StackReg, unsigned StackSize,
42 unsigned ReturnReg) = 0;
43 virtual void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff) = 0;
44 virtual void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff) = 0;
46 virtual void emitDirectiveSetMips32R2() = 0;
47 virtual void emitDirectiveSetMips64() = 0;
48 virtual void emitDirectiveSetMips64R2() = 0;
49 virtual void emitDirectiveSetDsp() = 0;
52 // This part is for ascii assembly output
53 class MipsTargetAsmStreamer : public MipsTargetStreamer {
54 formatted_raw_ostream &OS;
57 MipsTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS);
58 virtual void emitDirectiveSetMicroMips();
59 virtual void emitDirectiveSetNoMicroMips();
60 virtual void emitDirectiveSetMips16();
61 virtual void emitDirectiveSetNoMips16();
63 virtual void emitDirectiveSetReorder();
64 virtual void emitDirectiveSetNoReorder();
65 virtual void emitDirectiveSetMacro();
66 virtual void emitDirectiveSetNoMacro();
67 virtual void emitDirectiveSetAt();
68 virtual void emitDirectiveSetNoAt();
69 virtual void emitDirectiveEnd(StringRef Name);
71 virtual void emitDirectiveEnt(const MCSymbol &Symbol);
72 virtual void emitDirectiveAbiCalls();
73 virtual void emitDirectiveNaN2008();
74 virtual void emitDirectiveNaNLegacy();
75 virtual void emitDirectiveOptionPic0();
76 virtual void emitDirectiveOptionPic2();
77 virtual void emitFrame(unsigned StackReg, unsigned StackSize,
79 virtual void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff);
80 virtual void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff);
82 virtual void emitDirectiveSetMips32R2();
83 virtual void emitDirectiveSetMips64();
84 virtual void emitDirectiveSetMips64R2();
85 virtual void emitDirectiveSetDsp();
88 // This part is for ELF object output
89 class MipsTargetELFStreamer : public MipsTargetStreamer {
90 bool MicroMipsEnabled;
91 const MCSubtargetInfo &STI;
95 bool isMicroMipsEnabled() const { return MicroMipsEnabled; }
96 MCELFStreamer &getStreamer();
97 MipsTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI);
99 virtual void emitLabel(MCSymbol *Symbol) override;
100 virtual void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
101 void finish() override;
103 virtual void emitDirectiveSetMicroMips();
104 virtual void emitDirectiveSetNoMicroMips();
105 virtual void emitDirectiveSetMips16();
106 virtual void emitDirectiveSetNoMips16();
108 virtual void emitDirectiveSetReorder();
109 virtual void emitDirectiveSetNoReorder();
110 virtual void emitDirectiveSetMacro();
111 virtual void emitDirectiveSetNoMacro();
112 virtual void emitDirectiveSetAt();
113 virtual void emitDirectiveSetNoAt();
114 virtual void emitDirectiveEnd(StringRef Name);
116 virtual void emitDirectiveEnt(const MCSymbol &Symbol);
117 virtual void emitDirectiveAbiCalls();
118 virtual void emitDirectiveNaN2008();
119 virtual void emitDirectiveNaNLegacy();
120 virtual void emitDirectiveOptionPic0();
121 virtual void emitDirectiveOptionPic2();
122 virtual void emitFrame(unsigned StackReg, unsigned StackSize,
124 virtual void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff);
125 virtual void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff);
127 virtual void emitDirectiveSetMips32R2();
128 virtual void emitDirectiveSetMips64();
129 virtual void emitDirectiveSetMips64R2();
130 virtual void emitDirectiveSetDsp();