blob: a282366f6d40d948d1d9690e0bcddf77e9f499c8 [file] [log] [blame]
Rafael Espindolaa17151a2013-10-08 13:08:17 +00001//===-- MipsTargetStreamer.h - Mips Target Streamer ------------*- C++ -*--===//
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
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000010#ifndef LLVM_LIB_TARGET_MIPS_MIPSTARGETSTREAMER_H
11#define LLVM_LIB_TARGET_MIPS_MIPSTARGETSTREAMER_H
Rafael Espindolaa17151a2013-10-08 13:08:17 +000012
Chandler Carruthd9903882015-01-14 11:23:27 +000013#include "MCTargetDesc/MipsABIFlagsSection.h"
Eric Christophera5762812015-01-26 17:33:46 +000014#include "MCTargetDesc/MipsABIInfo.h"
Simon Atanasyan4d45c762015-09-14 11:18:03 +000015#include "llvm/ADT/Optional.h"
Benjamin Kramerd3f4c052016-06-12 16:13:55 +000016#include "llvm/ADT/STLExtras.h"
Jack Carter86ac5c12013-11-18 23:55:27 +000017#include "llvm/MC/MCELFStreamer.h"
Daniel Sandersd97a6342014-08-13 10:07:34 +000018#include "llvm/MC/MCRegisterInfo.h"
Rafael Espindolaa17151a2013-10-08 13:08:17 +000019#include "llvm/MC/MCStreamer.h"
20
21namespace llvm {
Vladimir Medicfb8a2a92014-07-08 08:59:22 +000022
Daniel Sanders324ad952014-07-08 13:13:42 +000023struct MipsABIFlagsSection;
Vladimir Medicfb8a2a92014-07-08 08:59:22 +000024
Rafael Espindolaa17151a2013-10-08 13:08:17 +000025class MipsTargetStreamer : public MCTargetStreamer {
Rafael Espindolaa17151a2013-10-08 13:08:17 +000026public:
Rafael Espindola24ea09e2014-01-26 06:06:37 +000027 MipsTargetStreamer(MCStreamer &S);
Daniel Sanders8de3d3c2016-05-06 14:37:24 +000028
29 virtual void setPic(bool Value) {}
30
Rafael Espindola60890b82014-06-23 19:43:40 +000031 virtual void emitDirectiveSetMicroMips();
32 virtual void emitDirectiveSetNoMicroMips();
Daniel Sanderscda908a2016-05-16 09:10:13 +000033 virtual void setUsesMicroMips();
Rafael Espindola60890b82014-06-23 19:43:40 +000034 virtual void emitDirectiveSetMips16();
35 virtual void emitDirectiveSetNoMips16();
Rafael Espindolaeb0a8af2014-01-26 05:06:48 +000036
Rafael Espindola60890b82014-06-23 19:43:40 +000037 virtual void emitDirectiveSetReorder();
38 virtual void emitDirectiveSetNoReorder();
39 virtual void emitDirectiveSetMacro();
40 virtual void emitDirectiveSetNoMacro();
Daniel Sanders44934432014-08-07 12:03:36 +000041 virtual void emitDirectiveSetMsa();
42 virtual void emitDirectiveSetNoMsa();
Simon Dardis805f1e02017-07-11 21:28:36 +000043 virtual void emitDirectiveSetMt();
44 virtual void emitDirectiveSetNoMt();
Petar Jovanovic3408caf2018-03-14 14:13:31 +000045 virtual void emitDirectiveSetCRC();
46 virtual void emitDirectiveSetNoCRC();
Petar Jovanovicd4349f32018-04-27 09:12:08 +000047 virtual void emitDirectiveSetVirt();
48 virtual void emitDirectiveSetNoVirt();
Petar Jovanovicdaf51692018-05-17 16:30:32 +000049 virtual void emitDirectiveSetGINV();
50 virtual void emitDirectiveSetNoGINV();
Rafael Espindola60890b82014-06-23 19:43:40 +000051 virtual void emitDirectiveSetAt();
Toma Tabacu16a74492015-02-13 10:30:57 +000052 virtual void emitDirectiveSetAtWithArg(unsigned RegNo);
Rafael Espindola60890b82014-06-23 19:43:40 +000053 virtual void emitDirectiveSetNoAt();
54 virtual void emitDirectiveEnd(StringRef Name);
Rafael Espindolaeb0a8af2014-01-26 05:06:48 +000055
Rafael Espindola60890b82014-06-23 19:43:40 +000056 virtual void emitDirectiveEnt(const MCSymbol &Symbol);
57 virtual void emitDirectiveAbiCalls();
58 virtual void emitDirectiveNaN2008();
59 virtual void emitDirectiveNaNLegacy();
60 virtual void emitDirectiveOptionPic0();
61 virtual void emitDirectiveOptionPic2();
Toma Tabacu9ca50962015-04-16 09:53:47 +000062 virtual void emitDirectiveInsn();
Rafael Espindola054234f2014-01-27 03:53:56 +000063 virtual void emitFrame(unsigned StackReg, unsigned StackSize,
Rafael Espindola60890b82014-06-23 19:43:40 +000064 unsigned ReturnReg);
65 virtual void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff);
66 virtual void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff);
Vladimir Medic615b26e2014-03-04 09:54:09 +000067
Toma Tabacu85618b32014-08-19 14:22:52 +000068 virtual void emitDirectiveSetArch(StringRef Arch);
Toma Tabacu26647792014-09-09 12:52:14 +000069 virtual void emitDirectiveSetMips0();
Daniel Sandersf0df2212014-08-04 12:20:00 +000070 virtual void emitDirectiveSetMips1();
71 virtual void emitDirectiveSetMips2();
72 virtual void emitDirectiveSetMips3();
73 virtual void emitDirectiveSetMips4();
74 virtual void emitDirectiveSetMips5();
75 virtual void emitDirectiveSetMips32();
Rafael Espindola60890b82014-06-23 19:43:40 +000076 virtual void emitDirectiveSetMips32R2();
Daniel Sanders17793142015-02-18 16:24:50 +000077 virtual void emitDirectiveSetMips32R3();
78 virtual void emitDirectiveSetMips32R5();
Daniel Sandersf0df2212014-08-04 12:20:00 +000079 virtual void emitDirectiveSetMips32R6();
Rafael Espindola60890b82014-06-23 19:43:40 +000080 virtual void emitDirectiveSetMips64();
81 virtual void emitDirectiveSetMips64R2();
Daniel Sanders17793142015-02-18 16:24:50 +000082 virtual void emitDirectiveSetMips64R3();
83 virtual void emitDirectiveSetMips64R5();
Daniel Sandersf0df2212014-08-04 12:20:00 +000084 virtual void emitDirectiveSetMips64R6();
Rafael Espindola60890b82014-06-23 19:43:40 +000085 virtual void emitDirectiveSetDsp();
Petar Jovanovic65f10242017-10-05 17:40:32 +000086 virtual void emitDirectiveSetDspr2();
Toma Tabacu351b2fe2014-09-17 09:01:54 +000087 virtual void emitDirectiveSetNoDsp();
Toma Tabacu9db22db2014-09-09 10:15:38 +000088 virtual void emitDirectiveSetPop();
89 virtual void emitDirectiveSetPush();
Toma Tabacu29696502015-06-02 09:48:04 +000090 virtual void emitDirectiveSetSoftFloat();
91 virtual void emitDirectiveSetHardFloat();
Matheus Almeida525bc4f2014-04-30 11:28:42 +000092
93 // PIC support
Toma Tabacuc4c202a2014-10-01 14:53:19 +000094 virtual void emitDirectiveCpLoad(unsigned RegNo);
Daniel Sandersdf8510d2016-05-11 12:48:19 +000095 virtual bool emitDirectiveCpRestore(int Offset,
Benjamin Kramerd3f4c052016-06-12 16:13:55 +000096 function_ref<unsigned()> GetATReg,
Daniel Sandersdf8510d2016-05-11 12:48:19 +000097 SMLoc IDLoc, const MCSubtargetInfo *STI);
Matheus Almeidad92a3fa2014-05-01 10:24:46 +000098 virtual void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
Rafael Espindola60890b82014-06-23 19:43:40 +000099 const MCSymbol &Sym, bool IsReg);
Daniel Sandersf173dda2015-09-22 10:50:09 +0000100 virtual void emitDirectiveCpreturn(unsigned SaveLocation,
101 bool SaveLocationIsRegister);
Daniel Sanders7e527422014-07-10 13:38:23 +0000102
Toma Tabacua64e5402015-06-25 12:44:38 +0000103 // FP abiflags directives
104 virtual void emitDirectiveModuleFP();
Toma Tabacu3c499582015-06-25 10:56:57 +0000105 virtual void emitDirectiveModuleOddSPReg();
Toma Tabacu0f093132015-06-30 13:46:03 +0000106 virtual void emitDirectiveModuleSoftFloat();
107 virtual void emitDirectiveModuleHardFloat();
Simon Dardis805f1e02017-07-11 21:28:36 +0000108 virtual void emitDirectiveModuleMT();
Toma Tabacu4e0cf8e2015-03-06 12:15:12 +0000109 virtual void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value);
Toma Tabacu32c72aa2015-06-30 09:36:50 +0000110 virtual void emitDirectiveSetOddSPReg();
111 virtual void emitDirectiveSetNoOddSPReg();
Petar Jovanovic3408caf2018-03-14 14:13:31 +0000112 virtual void emitDirectiveModuleCRC();
113 virtual void emitDirectiveModuleNoCRC();
Petar Jovanovicd4349f32018-04-27 09:12:08 +0000114 virtual void emitDirectiveModuleVirt();
115 virtual void emitDirectiveModuleNoVirt();
Petar Jovanovicdaf51692018-05-17 16:30:32 +0000116 virtual void emitDirectiveModuleGINV();
117 virtual void emitDirectiveModuleNoGINV();
Toma Tabacua64e5402015-06-25 12:44:38 +0000118
Daniel Sandersa736b372016-04-29 13:33:12 +0000119 void emitR(unsigned Opcode, unsigned Reg0, SMLoc IDLoc,
120 const MCSubtargetInfo *STI);
121 void emitII(unsigned Opcode, int16_t Imm1, int16_t Imm2, SMLoc IDLoc,
122 const MCSubtargetInfo *STI);
123 void emitRX(unsigned Opcode, unsigned Reg0, MCOperand Op1, SMLoc IDLoc,
124 const MCSubtargetInfo *STI);
125 void emitRI(unsigned Opcode, unsigned Reg0, int32_t Imm, SMLoc IDLoc,
126 const MCSubtargetInfo *STI);
127 void emitRR(unsigned Opcode, unsigned Reg0, unsigned Reg1, SMLoc IDLoc,
128 const MCSubtargetInfo *STI);
129 void emitRRX(unsigned Opcode, unsigned Reg0, unsigned Reg1, MCOperand Op2,
130 SMLoc IDLoc, const MCSubtargetInfo *STI);
131 void emitRRR(unsigned Opcode, unsigned Reg0, unsigned Reg1, unsigned Reg2,
132 SMLoc IDLoc, const MCSubtargetInfo *STI);
133 void emitRRI(unsigned Opcode, unsigned Reg0, unsigned Reg1, int16_t Imm,
134 SMLoc IDLoc, const MCSubtargetInfo *STI);
Simon Dardisde5ed0c2017-11-14 22:26:42 +0000135 void emitRRIII(unsigned Opcode, unsigned Reg0, unsigned Reg1, int16_t Imm0,
136 int16_t Imm1, int16_t Imm2, SMLoc IDLoc,
137 const MCSubtargetInfo *STI);
Daniel Sandersa736b372016-04-29 13:33:12 +0000138 void emitAddu(unsigned DstReg, unsigned SrcReg, unsigned TrgReg, bool Is64Bit,
139 const MCSubtargetInfo *STI);
140 void emitDSLL(unsigned DstReg, unsigned SrcReg, int16_t ShiftAmount,
141 SMLoc IDLoc, const MCSubtargetInfo *STI);
142 void emitEmptyDelaySlot(bool hasShortDelaySlot, SMLoc IDLoc,
143 const MCSubtargetInfo *STI);
144 void emitNop(SMLoc IDLoc, const MCSubtargetInfo *STI);
Daniel Sanders241c6792016-05-12 14:01:50 +0000145
146 /// Emit a store instruction with an offset. If the offset is out of range
147 /// then it will be synthesized using the assembler temporary.
148 ///
149 /// GetATReg() is a callback that can be used to obtain the current assembler
150 /// temporary and is only called when the assembler temporary is required. It
151 /// must handle the case where no assembler temporary is available (typically
152 /// by reporting an error).
Daniel Sandersfba875f2016-04-29 13:43:45 +0000153 void emitStoreWithImmOffset(unsigned Opcode, unsigned SrcReg,
Daniel Sanders241c6792016-05-12 14:01:50 +0000154 unsigned BaseReg, int64_t Offset,
Benjamin Kramerd3f4c052016-06-12 16:13:55 +0000155 function_ref<unsigned()> GetATReg, SMLoc IDLoc,
Daniel Sanders241c6792016-05-12 14:01:50 +0000156 const MCSubtargetInfo *STI);
Daniel Sandersfba875f2016-04-29 13:43:45 +0000157 void emitStoreWithSymOffset(unsigned Opcode, unsigned SrcReg,
158 unsigned BaseReg, MCOperand &HiOperand,
159 MCOperand &LoOperand, unsigned ATReg, SMLoc IDLoc,
160 const MCSubtargetInfo *STI);
161 void emitLoadWithImmOffset(unsigned Opcode, unsigned DstReg, unsigned BaseReg,
162 int64_t Offset, unsigned TmpReg, SMLoc IDLoc,
163 const MCSubtargetInfo *STI);
164 void emitLoadWithSymOffset(unsigned Opcode, unsigned DstReg, unsigned BaseReg,
165 MCOperand &HiOperand, MCOperand &LoOperand,
166 unsigned ATReg, SMLoc IDLoc,
167 const MCSubtargetInfo *STI);
Daniel Sanders7225cd52016-04-29 16:16:49 +0000168 void emitGPRestore(int Offset, SMLoc IDLoc, const MCSubtargetInfo *STI);
Daniel Sandersa736b372016-04-29 13:33:12 +0000169
Daniel Sanderscdb45fa2014-08-14 09:18:14 +0000170 void forbidModuleDirective() { ModuleDirectiveAllowed = false; }
Toma Tabacu4e0cf8e2015-03-06 12:15:12 +0000171 void reallowModuleDirective() { ModuleDirectiveAllowed = true; }
Daniel Sanderscdb45fa2014-08-14 09:18:14 +0000172 bool isModuleDirectiveAllowed() { return ModuleDirectiveAllowed; }
Vladimir Medicfb8a2a92014-07-08 08:59:22 +0000173
Vladimir Medicfb8a2a92014-07-08 08:59:22 +0000174 // This method enables template classes to set internal abi flags
175 // structure values.
176 template <class PredicateLibrary>
177 void updateABIInfo(const PredicateLibrary &P) {
Simon Atanasyan4d45c762015-09-14 11:18:03 +0000178 ABI = P.getABI();
Daniel Sandersc7dbc632014-07-08 10:11:38 +0000179 ABIFlagsSection.setAllFromPredicates(P);
Vladimir Medicfb8a2a92014-07-08 08:59:22 +0000180 }
181
Daniel Sandersc7dbc632014-07-08 10:11:38 +0000182 MipsABIFlagsSection &getABIFlagsSection() { return ABIFlagsSection; }
Eric Christophera5762812015-01-26 17:33:46 +0000183 const MipsABIInfo &getABI() const {
Simon Atanasyan4d45c762015-09-14 11:18:03 +0000184 assert(ABI.hasValue() && "ABI hasn't been set!");
Eric Christophera5762812015-01-26 17:33:46 +0000185 return *ABI;
186 }
Daniel Sandersc7dbc632014-07-08 10:11:38 +0000187
Vladimir Medicfb8a2a92014-07-08 08:59:22 +0000188protected:
Simon Atanasyan4d45c762015-09-14 11:18:03 +0000189 llvm::Optional<MipsABIInfo> ABI;
Daniel Sandersc7dbc632014-07-08 10:11:38 +0000190 MipsABIFlagsSection ABIFlagsSection;
Vladimir Medicfb8a2a92014-07-08 08:59:22 +0000191
Daniel Sandersd97a6342014-08-13 10:07:34 +0000192 bool GPRInfoSet;
193 unsigned GPRBitMask;
194 int GPROffset;
195
196 bool FPRInfoSet;
197 unsigned FPRBitMask;
198 int FPROffset;
199
200 bool FrameInfoSet;
201 int FrameOffset;
202 unsigned FrameReg;
203 unsigned ReturnReg;
204
Vladimir Medicfb8a2a92014-07-08 08:59:22 +0000205private:
Daniel Sanderscdb45fa2014-08-14 09:18:14 +0000206 bool ModuleDirectiveAllowed;
Rafael Espindolaa17151a2013-10-08 13:08:17 +0000207};
Jack Carter86ac5c12013-11-18 23:55:27 +0000208
209// This part is for ascii assembly output
210class MipsTargetAsmStreamer : public MipsTargetStreamer {
Jack Carter6ef6cc52013-11-19 20:53:28 +0000211 formatted_raw_ostream &OS;
212
Jack Carter86ac5c12013-11-18 23:55:27 +0000213public:
Rafael Espindola24ea09e2014-01-26 06:06:37 +0000214 MipsTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS);
Craig Topper56c590a2014-04-29 07:58:02 +0000215 void emitDirectiveSetMicroMips() override;
216 void emitDirectiveSetNoMicroMips() override;
217 void emitDirectiveSetMips16() override;
218 void emitDirectiveSetNoMips16() override;
Rafael Espindolaeb0a8af2014-01-26 05:06:48 +0000219
Craig Topper56c590a2014-04-29 07:58:02 +0000220 void emitDirectiveSetReorder() override;
221 void emitDirectiveSetNoReorder() override;
222 void emitDirectiveSetMacro() override;
223 void emitDirectiveSetNoMacro() override;
Daniel Sanders44934432014-08-07 12:03:36 +0000224 void emitDirectiveSetMsa() override;
225 void emitDirectiveSetNoMsa() override;
Simon Dardis805f1e02017-07-11 21:28:36 +0000226 void emitDirectiveSetMt() override;
227 void emitDirectiveSetNoMt() override;
Petar Jovanovic3408caf2018-03-14 14:13:31 +0000228 void emitDirectiveSetCRC() override;
229 void emitDirectiveSetNoCRC() override;
Petar Jovanovicd4349f32018-04-27 09:12:08 +0000230 void emitDirectiveSetVirt() override;
231 void emitDirectiveSetNoVirt() override;
Petar Jovanovicdaf51692018-05-17 16:30:32 +0000232 void emitDirectiveSetGINV() override;
233 void emitDirectiveSetNoGINV() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000234 void emitDirectiveSetAt() override;
Toma Tabacu16a74492015-02-13 10:30:57 +0000235 void emitDirectiveSetAtWithArg(unsigned RegNo) override;
Craig Topper56c590a2014-04-29 07:58:02 +0000236 void emitDirectiveSetNoAt() override;
237 void emitDirectiveEnd(StringRef Name) override;
Rafael Espindolaeb0a8af2014-01-26 05:06:48 +0000238
Craig Topper56c590a2014-04-29 07:58:02 +0000239 void emitDirectiveEnt(const MCSymbol &Symbol) override;
240 void emitDirectiveAbiCalls() override;
241 void emitDirectiveNaN2008() override;
242 void emitDirectiveNaNLegacy() override;
243 void emitDirectiveOptionPic0() override;
244 void emitDirectiveOptionPic2() override;
Toma Tabacu9ca50962015-04-16 09:53:47 +0000245 void emitDirectiveInsn() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000246 void emitFrame(unsigned StackReg, unsigned StackSize,
247 unsigned ReturnReg) override;
248 void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff) override;
249 void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff) override;
Vladimir Medic615b26e2014-03-04 09:54:09 +0000250
Toma Tabacu85618b32014-08-19 14:22:52 +0000251 void emitDirectiveSetArch(StringRef Arch) override;
Toma Tabacu26647792014-09-09 12:52:14 +0000252 void emitDirectiveSetMips0() override;
Daniel Sandersf0df2212014-08-04 12:20:00 +0000253 void emitDirectiveSetMips1() override;
254 void emitDirectiveSetMips2() override;
255 void emitDirectiveSetMips3() override;
256 void emitDirectiveSetMips4() override;
257 void emitDirectiveSetMips5() override;
258 void emitDirectiveSetMips32() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000259 void emitDirectiveSetMips32R2() override;
Daniel Sanders17793142015-02-18 16:24:50 +0000260 void emitDirectiveSetMips32R3() override;
261 void emitDirectiveSetMips32R5() override;
Daniel Sandersf0df2212014-08-04 12:20:00 +0000262 void emitDirectiveSetMips32R6() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000263 void emitDirectiveSetMips64() override;
264 void emitDirectiveSetMips64R2() override;
Daniel Sanders17793142015-02-18 16:24:50 +0000265 void emitDirectiveSetMips64R3() override;
266 void emitDirectiveSetMips64R5() override;
Daniel Sandersf0df2212014-08-04 12:20:00 +0000267 void emitDirectiveSetMips64R6() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000268 void emitDirectiveSetDsp() override;
Petar Jovanovic65f10242017-10-05 17:40:32 +0000269 void emitDirectiveSetDspr2() override;
Toma Tabacu351b2fe2014-09-17 09:01:54 +0000270 void emitDirectiveSetNoDsp() override;
Toma Tabacu9db22db2014-09-09 10:15:38 +0000271 void emitDirectiveSetPop() override;
272 void emitDirectiveSetPush() override;
Toma Tabacu29696502015-06-02 09:48:04 +0000273 void emitDirectiveSetSoftFloat() override;
274 void emitDirectiveSetHardFloat() override;
Matheus Almeida525bc4f2014-04-30 11:28:42 +0000275
276 // PIC support
Toma Tabacuc4c202a2014-10-01 14:53:19 +0000277 void emitDirectiveCpLoad(unsigned RegNo) override;
Daniel Sanders241c6792016-05-12 14:01:50 +0000278
279 /// Emit a .cprestore directive. If the offset is out of range then it will
280 /// be synthesized using the assembler temporary.
281 ///
282 /// GetATReg() is a callback that can be used to obtain the current assembler
283 /// temporary and is only called when the assembler temporary is required. It
284 /// must handle the case where no assembler temporary is available (typically
285 /// by reporting an error).
Benjamin Kramerd3f4c052016-06-12 16:13:55 +0000286 bool emitDirectiveCpRestore(int Offset, function_ref<unsigned()> GetATReg,
Daniel Sandersdf8510d2016-05-11 12:48:19 +0000287 SMLoc IDLoc, const MCSubtargetInfo *STI) override;
Matheus Almeidad92a3fa2014-05-01 10:24:46 +0000288 void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
289 const MCSymbol &Sym, bool IsReg) override;
Daniel Sandersf173dda2015-09-22 10:50:09 +0000290 void emitDirectiveCpreturn(unsigned SaveLocation,
291 bool SaveLocationIsRegister) override;
Vladimir Medicfb8a2a92014-07-08 08:59:22 +0000292
Toma Tabacua64e5402015-06-25 12:44:38 +0000293 // FP abiflags directives
294 void emitDirectiveModuleFP() override;
Toma Tabacu3c499582015-06-25 10:56:57 +0000295 void emitDirectiveModuleOddSPReg() override;
Toma Tabacu0f093132015-06-30 13:46:03 +0000296 void emitDirectiveModuleSoftFloat() override;
297 void emitDirectiveModuleHardFloat() override;
Simon Dardis805f1e02017-07-11 21:28:36 +0000298 void emitDirectiveModuleMT() override;
Petar Jovanovic3408caf2018-03-14 14:13:31 +0000299 void emitDirectiveModuleCRC() override;
300 void emitDirectiveModuleNoCRC() override;
Petar Jovanovicd4349f32018-04-27 09:12:08 +0000301 void emitDirectiveModuleVirt() override;
302 void emitDirectiveModuleNoVirt() override;
Petar Jovanovicdaf51692018-05-17 16:30:32 +0000303 void emitDirectiveModuleGINV() override;
304 void emitDirectiveModuleNoGINV() override;
Daniel Sanders7e527422014-07-10 13:38:23 +0000305 void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value) override;
Toma Tabacu32c72aa2015-06-30 09:36:50 +0000306 void emitDirectiveSetOddSPReg() override;
307 void emitDirectiveSetNoOddSPReg() override;
Jack Carter86ac5c12013-11-18 23:55:27 +0000308};
309
310// This part is for ELF object output
311class MipsTargetELFStreamer : public MipsTargetStreamer {
Rafael Espindola6d5f7ce2014-01-14 04:25:13 +0000312 bool MicroMipsEnabled;
Rafael Espindola972e71a2014-01-31 23:10:26 +0000313 const MCSubtargetInfo &STI;
Matheus Almeidaf79b2812014-03-26 13:40:29 +0000314 bool Pic;
Jack Carter39536722014-01-22 23:08:42 +0000315
Jack Carter86ac5c12013-11-18 23:55:27 +0000316public:
Rafael Espindola6d5f7ce2014-01-14 04:25:13 +0000317 bool isMicroMipsEnabled() const { return MicroMipsEnabled; }
Jack Carter86ac5c12013-11-18 23:55:27 +0000318 MCELFStreamer &getStreamer();
Rafael Espindolacb1953f2014-01-26 06:57:13 +0000319 MipsTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI);
Rafael Espindola6d5f7ce2014-01-14 04:25:13 +0000320
Daniel Sanders8de3d3c2016-05-06 14:37:24 +0000321 void setPic(bool Value) override { Pic = Value; }
322
Craig Topper56c590a2014-04-29 07:58:02 +0000323 void emitLabel(MCSymbol *Symbol) override;
324 void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
Craig Topper73156022014-03-02 09:09:27 +0000325 void finish() override;
Rafael Espindola6d5f7ce2014-01-14 04:25:13 +0000326
Craig Topper56c590a2014-04-29 07:58:02 +0000327 void emitDirectiveSetMicroMips() override;
328 void emitDirectiveSetNoMicroMips() override;
Daniel Sanderscda908a2016-05-16 09:10:13 +0000329 void setUsesMicroMips() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000330 void emitDirectiveSetMips16() override;
Rafael Espindolaeb0a8af2014-01-26 05:06:48 +0000331
Craig Topper56c590a2014-04-29 07:58:02 +0000332 void emitDirectiveSetNoReorder() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000333 void emitDirectiveEnd(StringRef Name) override;
Rafael Espindolaeb0a8af2014-01-26 05:06:48 +0000334
Craig Topper56c590a2014-04-29 07:58:02 +0000335 void emitDirectiveEnt(const MCSymbol &Symbol) override;
336 void emitDirectiveAbiCalls() override;
337 void emitDirectiveNaN2008() override;
338 void emitDirectiveNaNLegacy() override;
339 void emitDirectiveOptionPic0() override;
340 void emitDirectiveOptionPic2() override;
Toma Tabacu9ca50962015-04-16 09:53:47 +0000341 void emitDirectiveInsn() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000342 void emitFrame(unsigned StackReg, unsigned StackSize,
343 unsigned ReturnReg) override;
344 void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff) override;
345 void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff) override;
Vladimir Medic615b26e2014-03-04 09:54:09 +0000346
Matheus Almeida525bc4f2014-04-30 11:28:42 +0000347 // PIC support
Toma Tabacuc4c202a2014-10-01 14:53:19 +0000348 void emitDirectiveCpLoad(unsigned RegNo) override;
Benjamin Kramerd3f4c052016-06-12 16:13:55 +0000349 bool emitDirectiveCpRestore(int Offset, function_ref<unsigned()> GetATReg,
Daniel Sandersdf8510d2016-05-11 12:48:19 +0000350 SMLoc IDLoc, const MCSubtargetInfo *STI) override;
Matheus Almeidad92a3fa2014-05-01 10:24:46 +0000351 void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
352 const MCSymbol &Sym, bool IsReg) override;
Daniel Sandersf173dda2015-09-22 10:50:09 +0000353 void emitDirectiveCpreturn(unsigned SaveLocation,
354 bool SaveLocationIsRegister) override;
Matheus Almeida525bc4f2014-04-30 11:28:42 +0000355
Toma Tabacue95a4912015-03-13 11:40:01 +0000356 void emitMipsAbiFlags();
Jack Carter86ac5c12013-11-18 23:55:27 +0000357};
Alexander Kornienkof00654e2015-06-23 09:49:53 +0000358}
Rafael Espindolaa17151a2013-10-08 13:08:17 +0000359#endif