blob: 697a5c4193ea2454a5dc4a3c5dd5f9046d7715fd [file] [log] [blame]
Rafael Espindolaa17151a2013-10-08 13:08:17 +00001//===-- MipsTargetStreamer.h - Mips Target Streamer ------------*- C++ -*--===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Rafael Espindolaa17151a2013-10-08 13:08:17 +00006//
7//===----------------------------------------------------------------------===//
8
Benjamin Kramera7c40ef2014-08-13 16:26:38 +00009#ifndef LLVM_LIB_TARGET_MIPS_MIPSTARGETSTREAMER_H
10#define LLVM_LIB_TARGET_MIPS_MIPSTARGETSTREAMER_H
Rafael Espindolaa17151a2013-10-08 13:08:17 +000011
Chandler Carruthd9903882015-01-14 11:23:27 +000012#include "MCTargetDesc/MipsABIFlagsSection.h"
Eric Christophera5762812015-01-26 17:33:46 +000013#include "MCTargetDesc/MipsABIInfo.h"
Simon Atanasyan4d45c762015-09-14 11:18:03 +000014#include "llvm/ADT/Optional.h"
Benjamin Kramerd3f4c052016-06-12 16:13:55 +000015#include "llvm/ADT/STLExtras.h"
Jack Carter86ac5c12013-11-18 23:55:27 +000016#include "llvm/MC/MCELFStreamer.h"
Daniel Sandersd97a6342014-08-13 10:07:34 +000017#include "llvm/MC/MCRegisterInfo.h"
Rafael Espindolaa17151a2013-10-08 13:08:17 +000018#include "llvm/MC/MCStreamer.h"
19
20namespace llvm {
Vladimir Medicfb8a2a92014-07-08 08:59:22 +000021
Daniel Sanders324ad952014-07-08 13:13:42 +000022struct MipsABIFlagsSection;
Vladimir Medicfb8a2a92014-07-08 08:59:22 +000023
Rafael Espindolaa17151a2013-10-08 13:08:17 +000024class MipsTargetStreamer : public MCTargetStreamer {
Rafael Espindolaa17151a2013-10-08 13:08:17 +000025public:
Rafael Espindola24ea09e2014-01-26 06:06:37 +000026 MipsTargetStreamer(MCStreamer &S);
Daniel Sanders8de3d3c2016-05-06 14:37:24 +000027
28 virtual void setPic(bool Value) {}
29
Rafael Espindola60890b82014-06-23 19:43:40 +000030 virtual void emitDirectiveSetMicroMips();
31 virtual void emitDirectiveSetNoMicroMips();
Daniel Sanderscda908a2016-05-16 09:10:13 +000032 virtual void setUsesMicroMips();
Rafael Espindola60890b82014-06-23 19:43:40 +000033 virtual void emitDirectiveSetMips16();
34 virtual void emitDirectiveSetNoMips16();
Rafael Espindolaeb0a8af2014-01-26 05:06:48 +000035
Rafael Espindola60890b82014-06-23 19:43:40 +000036 virtual void emitDirectiveSetReorder();
37 virtual void emitDirectiveSetNoReorder();
38 virtual void emitDirectiveSetMacro();
39 virtual void emitDirectiveSetNoMacro();
Daniel Sanders44934432014-08-07 12:03:36 +000040 virtual void emitDirectiveSetMsa();
41 virtual void emitDirectiveSetNoMsa();
Simon Dardis805f1e02017-07-11 21:28:36 +000042 virtual void emitDirectiveSetMt();
43 virtual void emitDirectiveSetNoMt();
Petar Jovanovic3408caf2018-03-14 14:13:31 +000044 virtual void emitDirectiveSetCRC();
45 virtual void emitDirectiveSetNoCRC();
Petar Jovanovicd4349f32018-04-27 09:12:08 +000046 virtual void emitDirectiveSetVirt();
47 virtual void emitDirectiveSetNoVirt();
Petar Jovanovicdaf51692018-05-17 16:30:32 +000048 virtual void emitDirectiveSetGINV();
49 virtual void emitDirectiveSetNoGINV();
Rafael Espindola60890b82014-06-23 19:43:40 +000050 virtual void emitDirectiveSetAt();
Toma Tabacu16a74492015-02-13 10:30:57 +000051 virtual void emitDirectiveSetAtWithArg(unsigned RegNo);
Rafael Espindola60890b82014-06-23 19:43:40 +000052 virtual void emitDirectiveSetNoAt();
53 virtual void emitDirectiveEnd(StringRef Name);
Rafael Espindolaeb0a8af2014-01-26 05:06:48 +000054
Rafael Espindola60890b82014-06-23 19:43:40 +000055 virtual void emitDirectiveEnt(const MCSymbol &Symbol);
56 virtual void emitDirectiveAbiCalls();
57 virtual void emitDirectiveNaN2008();
58 virtual void emitDirectiveNaNLegacy();
59 virtual void emitDirectiveOptionPic0();
60 virtual void emitDirectiveOptionPic2();
Toma Tabacu9ca50962015-04-16 09:53:47 +000061 virtual void emitDirectiveInsn();
Rafael Espindola054234f2014-01-27 03:53:56 +000062 virtual void emitFrame(unsigned StackReg, unsigned StackSize,
Rafael Espindola60890b82014-06-23 19:43:40 +000063 unsigned ReturnReg);
64 virtual void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff);
65 virtual void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff);
Vladimir Medic615b26e2014-03-04 09:54:09 +000066
Toma Tabacu85618b32014-08-19 14:22:52 +000067 virtual void emitDirectiveSetArch(StringRef Arch);
Toma Tabacu26647792014-09-09 12:52:14 +000068 virtual void emitDirectiveSetMips0();
Daniel Sandersf0df2212014-08-04 12:20:00 +000069 virtual void emitDirectiveSetMips1();
70 virtual void emitDirectiveSetMips2();
71 virtual void emitDirectiveSetMips3();
72 virtual void emitDirectiveSetMips4();
73 virtual void emitDirectiveSetMips5();
74 virtual void emitDirectiveSetMips32();
Rafael Espindola60890b82014-06-23 19:43:40 +000075 virtual void emitDirectiveSetMips32R2();
Daniel Sanders17793142015-02-18 16:24:50 +000076 virtual void emitDirectiveSetMips32R3();
77 virtual void emitDirectiveSetMips32R5();
Daniel Sandersf0df2212014-08-04 12:20:00 +000078 virtual void emitDirectiveSetMips32R6();
Rafael Espindola60890b82014-06-23 19:43:40 +000079 virtual void emitDirectiveSetMips64();
80 virtual void emitDirectiveSetMips64R2();
Daniel Sanders17793142015-02-18 16:24:50 +000081 virtual void emitDirectiveSetMips64R3();
82 virtual void emitDirectiveSetMips64R5();
Daniel Sandersf0df2212014-08-04 12:20:00 +000083 virtual void emitDirectiveSetMips64R6();
Rafael Espindola60890b82014-06-23 19:43:40 +000084 virtual void emitDirectiveSetDsp();
Petar Jovanovic65f10242017-10-05 17:40:32 +000085 virtual void emitDirectiveSetDspr2();
Toma Tabacu351b2fe2014-09-17 09:01:54 +000086 virtual void emitDirectiveSetNoDsp();
Toma Tabacu9db22db2014-09-09 10:15:38 +000087 virtual void emitDirectiveSetPop();
88 virtual void emitDirectiveSetPush();
Toma Tabacu29696502015-06-02 09:48:04 +000089 virtual void emitDirectiveSetSoftFloat();
90 virtual void emitDirectiveSetHardFloat();
Matheus Almeida525bc4f2014-04-30 11:28:42 +000091
92 // PIC support
Toma Tabacuc4c202a2014-10-01 14:53:19 +000093 virtual void emitDirectiveCpLoad(unsigned RegNo);
Daniel Sandersdf8510d2016-05-11 12:48:19 +000094 virtual bool emitDirectiveCpRestore(int Offset,
Benjamin Kramerd3f4c052016-06-12 16:13:55 +000095 function_ref<unsigned()> GetATReg,
Daniel Sandersdf8510d2016-05-11 12:48:19 +000096 SMLoc IDLoc, const MCSubtargetInfo *STI);
Matheus Almeidad92a3fa2014-05-01 10:24:46 +000097 virtual void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
Rafael Espindola60890b82014-06-23 19:43:40 +000098 const MCSymbol &Sym, bool IsReg);
Daniel Sandersf173dda2015-09-22 10:50:09 +000099 virtual void emitDirectiveCpreturn(unsigned SaveLocation,
100 bool SaveLocationIsRegister);
Daniel Sanders7e527422014-07-10 13:38:23 +0000101
Toma Tabacua64e5402015-06-25 12:44:38 +0000102 // FP abiflags directives
103 virtual void emitDirectiveModuleFP();
Toma Tabacu3c499582015-06-25 10:56:57 +0000104 virtual void emitDirectiveModuleOddSPReg();
Toma Tabacu0f093132015-06-30 13:46:03 +0000105 virtual void emitDirectiveModuleSoftFloat();
106 virtual void emitDirectiveModuleHardFloat();
Simon Dardis805f1e02017-07-11 21:28:36 +0000107 virtual void emitDirectiveModuleMT();
Toma Tabacu4e0cf8e2015-03-06 12:15:12 +0000108 virtual void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value);
Toma Tabacu32c72aa2015-06-30 09:36:50 +0000109 virtual void emitDirectiveSetOddSPReg();
110 virtual void emitDirectiveSetNoOddSPReg();
Petar Jovanovic3408caf2018-03-14 14:13:31 +0000111 virtual void emitDirectiveModuleCRC();
112 virtual void emitDirectiveModuleNoCRC();
Petar Jovanovicd4349f32018-04-27 09:12:08 +0000113 virtual void emitDirectiveModuleVirt();
114 virtual void emitDirectiveModuleNoVirt();
Petar Jovanovicdaf51692018-05-17 16:30:32 +0000115 virtual void emitDirectiveModuleGINV();
116 virtual void emitDirectiveModuleNoGINV();
Toma Tabacua64e5402015-06-25 12:44:38 +0000117
Daniel Sandersa736b372016-04-29 13:33:12 +0000118 void emitR(unsigned Opcode, unsigned Reg0, SMLoc IDLoc,
119 const MCSubtargetInfo *STI);
120 void emitII(unsigned Opcode, int16_t Imm1, int16_t Imm2, SMLoc IDLoc,
121 const MCSubtargetInfo *STI);
122 void emitRX(unsigned Opcode, unsigned Reg0, MCOperand Op1, SMLoc IDLoc,
123 const MCSubtargetInfo *STI);
124 void emitRI(unsigned Opcode, unsigned Reg0, int32_t Imm, SMLoc IDLoc,
125 const MCSubtargetInfo *STI);
126 void emitRR(unsigned Opcode, unsigned Reg0, unsigned Reg1, SMLoc IDLoc,
127 const MCSubtargetInfo *STI);
128 void emitRRX(unsigned Opcode, unsigned Reg0, unsigned Reg1, MCOperand Op2,
129 SMLoc IDLoc, const MCSubtargetInfo *STI);
130 void emitRRR(unsigned Opcode, unsigned Reg0, unsigned Reg1, unsigned Reg2,
131 SMLoc IDLoc, const MCSubtargetInfo *STI);
132 void emitRRI(unsigned Opcode, unsigned Reg0, unsigned Reg1, int16_t Imm,
133 SMLoc IDLoc, const MCSubtargetInfo *STI);
Simon Dardisde5ed0c2017-11-14 22:26:42 +0000134 void emitRRIII(unsigned Opcode, unsigned Reg0, unsigned Reg1, int16_t Imm0,
135 int16_t Imm1, int16_t Imm2, SMLoc IDLoc,
136 const MCSubtargetInfo *STI);
Daniel Sandersa736b372016-04-29 13:33:12 +0000137 void emitAddu(unsigned DstReg, unsigned SrcReg, unsigned TrgReg, bool Is64Bit,
138 const MCSubtargetInfo *STI);
139 void emitDSLL(unsigned DstReg, unsigned SrcReg, int16_t ShiftAmount,
140 SMLoc IDLoc, const MCSubtargetInfo *STI);
141 void emitEmptyDelaySlot(bool hasShortDelaySlot, SMLoc IDLoc,
142 const MCSubtargetInfo *STI);
143 void emitNop(SMLoc IDLoc, const MCSubtargetInfo *STI);
Daniel Sanders241c6792016-05-12 14:01:50 +0000144
145 /// Emit a store instruction with an offset. If the offset is out of range
146 /// then it will be synthesized using the assembler temporary.
147 ///
148 /// GetATReg() is a callback that can be used to obtain the current assembler
149 /// temporary and is only called when the assembler temporary is required. It
150 /// must handle the case where no assembler temporary is available (typically
151 /// by reporting an error).
Daniel Sandersfba875f2016-04-29 13:43:45 +0000152 void emitStoreWithImmOffset(unsigned Opcode, unsigned SrcReg,
Daniel Sanders241c6792016-05-12 14:01:50 +0000153 unsigned BaseReg, int64_t Offset,
Benjamin Kramerd3f4c052016-06-12 16:13:55 +0000154 function_ref<unsigned()> GetATReg, SMLoc IDLoc,
Daniel Sanders241c6792016-05-12 14:01:50 +0000155 const MCSubtargetInfo *STI);
Daniel Sandersfba875f2016-04-29 13:43:45 +0000156 void emitStoreWithSymOffset(unsigned Opcode, unsigned SrcReg,
157 unsigned BaseReg, MCOperand &HiOperand,
158 MCOperand &LoOperand, unsigned ATReg, SMLoc IDLoc,
159 const MCSubtargetInfo *STI);
160 void emitLoadWithImmOffset(unsigned Opcode, unsigned DstReg, unsigned BaseReg,
161 int64_t Offset, unsigned TmpReg, SMLoc IDLoc,
162 const MCSubtargetInfo *STI);
163 void emitLoadWithSymOffset(unsigned Opcode, unsigned DstReg, unsigned BaseReg,
164 MCOperand &HiOperand, MCOperand &LoOperand,
165 unsigned ATReg, SMLoc IDLoc,
166 const MCSubtargetInfo *STI);
Daniel Sanders7225cd52016-04-29 16:16:49 +0000167 void emitGPRestore(int Offset, SMLoc IDLoc, const MCSubtargetInfo *STI);
Daniel Sandersa736b372016-04-29 13:33:12 +0000168
Daniel Sanderscdb45fa2014-08-14 09:18:14 +0000169 void forbidModuleDirective() { ModuleDirectiveAllowed = false; }
Toma Tabacu4e0cf8e2015-03-06 12:15:12 +0000170 void reallowModuleDirective() { ModuleDirectiveAllowed = true; }
Daniel Sanderscdb45fa2014-08-14 09:18:14 +0000171 bool isModuleDirectiveAllowed() { return ModuleDirectiveAllowed; }
Vladimir Medicfb8a2a92014-07-08 08:59:22 +0000172
Vladimir Medicfb8a2a92014-07-08 08:59:22 +0000173 // This method enables template classes to set internal abi flags
174 // structure values.
175 template <class PredicateLibrary>
176 void updateABIInfo(const PredicateLibrary &P) {
Simon Atanasyan4d45c762015-09-14 11:18:03 +0000177 ABI = P.getABI();
Daniel Sandersc7dbc632014-07-08 10:11:38 +0000178 ABIFlagsSection.setAllFromPredicates(P);
Vladimir Medicfb8a2a92014-07-08 08:59:22 +0000179 }
180
Daniel Sandersc7dbc632014-07-08 10:11:38 +0000181 MipsABIFlagsSection &getABIFlagsSection() { return ABIFlagsSection; }
Eric Christophera5762812015-01-26 17:33:46 +0000182 const MipsABIInfo &getABI() const {
Simon Atanasyan4d45c762015-09-14 11:18:03 +0000183 assert(ABI.hasValue() && "ABI hasn't been set!");
Eric Christophera5762812015-01-26 17:33:46 +0000184 return *ABI;
185 }
Daniel Sandersc7dbc632014-07-08 10:11:38 +0000186
Vladimir Medicfb8a2a92014-07-08 08:59:22 +0000187protected:
Simon Atanasyan4d45c762015-09-14 11:18:03 +0000188 llvm::Optional<MipsABIInfo> ABI;
Daniel Sandersc7dbc632014-07-08 10:11:38 +0000189 MipsABIFlagsSection ABIFlagsSection;
Vladimir Medicfb8a2a92014-07-08 08:59:22 +0000190
Daniel Sandersd97a6342014-08-13 10:07:34 +0000191 bool GPRInfoSet;
192 unsigned GPRBitMask;
193 int GPROffset;
194
195 bool FPRInfoSet;
196 unsigned FPRBitMask;
197 int FPROffset;
198
199 bool FrameInfoSet;
200 int FrameOffset;
201 unsigned FrameReg;
202 unsigned ReturnReg;
203
Vladimir Medicfb8a2a92014-07-08 08:59:22 +0000204private:
Daniel Sanderscdb45fa2014-08-14 09:18:14 +0000205 bool ModuleDirectiveAllowed;
Rafael Espindolaa17151a2013-10-08 13:08:17 +0000206};
Jack Carter86ac5c12013-11-18 23:55:27 +0000207
208// This part is for ascii assembly output
209class MipsTargetAsmStreamer : public MipsTargetStreamer {
Jack Carter6ef6cc52013-11-19 20:53:28 +0000210 formatted_raw_ostream &OS;
211
Jack Carter86ac5c12013-11-18 23:55:27 +0000212public:
Rafael Espindola24ea09e2014-01-26 06:06:37 +0000213 MipsTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS);
Craig Topper56c590a2014-04-29 07:58:02 +0000214 void emitDirectiveSetMicroMips() override;
215 void emitDirectiveSetNoMicroMips() override;
216 void emitDirectiveSetMips16() override;
217 void emitDirectiveSetNoMips16() override;
Rafael Espindolaeb0a8af2014-01-26 05:06:48 +0000218
Craig Topper56c590a2014-04-29 07:58:02 +0000219 void emitDirectiveSetReorder() override;
220 void emitDirectiveSetNoReorder() override;
221 void emitDirectiveSetMacro() override;
222 void emitDirectiveSetNoMacro() override;
Daniel Sanders44934432014-08-07 12:03:36 +0000223 void emitDirectiveSetMsa() override;
224 void emitDirectiveSetNoMsa() override;
Simon Dardis805f1e02017-07-11 21:28:36 +0000225 void emitDirectiveSetMt() override;
226 void emitDirectiveSetNoMt() override;
Petar Jovanovic3408caf2018-03-14 14:13:31 +0000227 void emitDirectiveSetCRC() override;
228 void emitDirectiveSetNoCRC() override;
Petar Jovanovicd4349f32018-04-27 09:12:08 +0000229 void emitDirectiveSetVirt() override;
230 void emitDirectiveSetNoVirt() override;
Petar Jovanovicdaf51692018-05-17 16:30:32 +0000231 void emitDirectiveSetGINV() override;
232 void emitDirectiveSetNoGINV() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000233 void emitDirectiveSetAt() override;
Toma Tabacu16a74492015-02-13 10:30:57 +0000234 void emitDirectiveSetAtWithArg(unsigned RegNo) override;
Craig Topper56c590a2014-04-29 07:58:02 +0000235 void emitDirectiveSetNoAt() override;
236 void emitDirectiveEnd(StringRef Name) override;
Rafael Espindolaeb0a8af2014-01-26 05:06:48 +0000237
Craig Topper56c590a2014-04-29 07:58:02 +0000238 void emitDirectiveEnt(const MCSymbol &Symbol) override;
239 void emitDirectiveAbiCalls() override;
240 void emitDirectiveNaN2008() override;
241 void emitDirectiveNaNLegacy() override;
242 void emitDirectiveOptionPic0() override;
243 void emitDirectiveOptionPic2() override;
Toma Tabacu9ca50962015-04-16 09:53:47 +0000244 void emitDirectiveInsn() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000245 void emitFrame(unsigned StackReg, unsigned StackSize,
246 unsigned ReturnReg) override;
247 void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff) override;
248 void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff) override;
Vladimir Medic615b26e2014-03-04 09:54:09 +0000249
Toma Tabacu85618b32014-08-19 14:22:52 +0000250 void emitDirectiveSetArch(StringRef Arch) override;
Toma Tabacu26647792014-09-09 12:52:14 +0000251 void emitDirectiveSetMips0() override;
Daniel Sandersf0df2212014-08-04 12:20:00 +0000252 void emitDirectiveSetMips1() override;
253 void emitDirectiveSetMips2() override;
254 void emitDirectiveSetMips3() override;
255 void emitDirectiveSetMips4() override;
256 void emitDirectiveSetMips5() override;
257 void emitDirectiveSetMips32() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000258 void emitDirectiveSetMips32R2() override;
Daniel Sanders17793142015-02-18 16:24:50 +0000259 void emitDirectiveSetMips32R3() override;
260 void emitDirectiveSetMips32R5() override;
Daniel Sandersf0df2212014-08-04 12:20:00 +0000261 void emitDirectiveSetMips32R6() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000262 void emitDirectiveSetMips64() override;
263 void emitDirectiveSetMips64R2() override;
Daniel Sanders17793142015-02-18 16:24:50 +0000264 void emitDirectiveSetMips64R3() override;
265 void emitDirectiveSetMips64R5() override;
Daniel Sandersf0df2212014-08-04 12:20:00 +0000266 void emitDirectiveSetMips64R6() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000267 void emitDirectiveSetDsp() override;
Petar Jovanovic65f10242017-10-05 17:40:32 +0000268 void emitDirectiveSetDspr2() override;
Toma Tabacu351b2fe2014-09-17 09:01:54 +0000269 void emitDirectiveSetNoDsp() override;
Toma Tabacu9db22db2014-09-09 10:15:38 +0000270 void emitDirectiveSetPop() override;
271 void emitDirectiveSetPush() override;
Toma Tabacu29696502015-06-02 09:48:04 +0000272 void emitDirectiveSetSoftFloat() override;
273 void emitDirectiveSetHardFloat() override;
Matheus Almeida525bc4f2014-04-30 11:28:42 +0000274
275 // PIC support
Toma Tabacuc4c202a2014-10-01 14:53:19 +0000276 void emitDirectiveCpLoad(unsigned RegNo) override;
Daniel Sanders241c6792016-05-12 14:01:50 +0000277
278 /// Emit a .cprestore directive. If the offset is out of range then it will
279 /// be synthesized using the assembler temporary.
280 ///
281 /// GetATReg() is a callback that can be used to obtain the current assembler
282 /// temporary and is only called when the assembler temporary is required. It
283 /// must handle the case where no assembler temporary is available (typically
284 /// by reporting an error).
Benjamin Kramerd3f4c052016-06-12 16:13:55 +0000285 bool emitDirectiveCpRestore(int Offset, function_ref<unsigned()> GetATReg,
Daniel Sandersdf8510d2016-05-11 12:48:19 +0000286 SMLoc IDLoc, const MCSubtargetInfo *STI) override;
Matheus Almeidad92a3fa2014-05-01 10:24:46 +0000287 void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
288 const MCSymbol &Sym, bool IsReg) override;
Daniel Sandersf173dda2015-09-22 10:50:09 +0000289 void emitDirectiveCpreturn(unsigned SaveLocation,
290 bool SaveLocationIsRegister) override;
Vladimir Medicfb8a2a92014-07-08 08:59:22 +0000291
Toma Tabacua64e5402015-06-25 12:44:38 +0000292 // FP abiflags directives
293 void emitDirectiveModuleFP() override;
Toma Tabacu3c499582015-06-25 10:56:57 +0000294 void emitDirectiveModuleOddSPReg() override;
Toma Tabacu0f093132015-06-30 13:46:03 +0000295 void emitDirectiveModuleSoftFloat() override;
296 void emitDirectiveModuleHardFloat() override;
Simon Dardis805f1e02017-07-11 21:28:36 +0000297 void emitDirectiveModuleMT() override;
Petar Jovanovic3408caf2018-03-14 14:13:31 +0000298 void emitDirectiveModuleCRC() override;
299 void emitDirectiveModuleNoCRC() override;
Petar Jovanovicd4349f32018-04-27 09:12:08 +0000300 void emitDirectiveModuleVirt() override;
301 void emitDirectiveModuleNoVirt() override;
Petar Jovanovicdaf51692018-05-17 16:30:32 +0000302 void emitDirectiveModuleGINV() override;
303 void emitDirectiveModuleNoGINV() override;
Daniel Sanders7e527422014-07-10 13:38:23 +0000304 void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value) override;
Toma Tabacu32c72aa2015-06-30 09:36:50 +0000305 void emitDirectiveSetOddSPReg() override;
306 void emitDirectiveSetNoOddSPReg() override;
Jack Carter86ac5c12013-11-18 23:55:27 +0000307};
308
309// This part is for ELF object output
310class MipsTargetELFStreamer : public MipsTargetStreamer {
Rafael Espindola6d5f7ce2014-01-14 04:25:13 +0000311 bool MicroMipsEnabled;
Rafael Espindola972e71a2014-01-31 23:10:26 +0000312 const MCSubtargetInfo &STI;
Matheus Almeidaf79b2812014-03-26 13:40:29 +0000313 bool Pic;
Jack Carter39536722014-01-22 23:08:42 +0000314
Jack Carter86ac5c12013-11-18 23:55:27 +0000315public:
Rafael Espindola6d5f7ce2014-01-14 04:25:13 +0000316 bool isMicroMipsEnabled() const { return MicroMipsEnabled; }
Jack Carter86ac5c12013-11-18 23:55:27 +0000317 MCELFStreamer &getStreamer();
Rafael Espindolacb1953f2014-01-26 06:57:13 +0000318 MipsTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI);
Rafael Espindola6d5f7ce2014-01-14 04:25:13 +0000319
Daniel Sanders8de3d3c2016-05-06 14:37:24 +0000320 void setPic(bool Value) override { Pic = Value; }
321
Craig Topper56c590a2014-04-29 07:58:02 +0000322 void emitLabel(MCSymbol *Symbol) override;
323 void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
Craig Topper73156022014-03-02 09:09:27 +0000324 void finish() override;
Rafael Espindola6d5f7ce2014-01-14 04:25:13 +0000325
Craig Topper56c590a2014-04-29 07:58:02 +0000326 void emitDirectiveSetMicroMips() override;
327 void emitDirectiveSetNoMicroMips() override;
Daniel Sanderscda908a2016-05-16 09:10:13 +0000328 void setUsesMicroMips() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000329 void emitDirectiveSetMips16() override;
Rafael Espindolaeb0a8af2014-01-26 05:06:48 +0000330
Craig Topper56c590a2014-04-29 07:58:02 +0000331 void emitDirectiveSetNoReorder() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000332 void emitDirectiveEnd(StringRef Name) override;
Rafael Espindolaeb0a8af2014-01-26 05:06:48 +0000333
Craig Topper56c590a2014-04-29 07:58:02 +0000334 void emitDirectiveEnt(const MCSymbol &Symbol) override;
335 void emitDirectiveAbiCalls() override;
336 void emitDirectiveNaN2008() override;
337 void emitDirectiveNaNLegacy() override;
338 void emitDirectiveOptionPic0() override;
339 void emitDirectiveOptionPic2() override;
Toma Tabacu9ca50962015-04-16 09:53:47 +0000340 void emitDirectiveInsn() override;
Craig Topper56c590a2014-04-29 07:58:02 +0000341 void emitFrame(unsigned StackReg, unsigned StackSize,
342 unsigned ReturnReg) override;
343 void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff) override;
344 void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff) override;
Vladimir Medic615b26e2014-03-04 09:54:09 +0000345
Matheus Almeida525bc4f2014-04-30 11:28:42 +0000346 // PIC support
Toma Tabacuc4c202a2014-10-01 14:53:19 +0000347 void emitDirectiveCpLoad(unsigned RegNo) override;
Benjamin Kramerd3f4c052016-06-12 16:13:55 +0000348 bool emitDirectiveCpRestore(int Offset, function_ref<unsigned()> GetATReg,
Daniel Sandersdf8510d2016-05-11 12:48:19 +0000349 SMLoc IDLoc, const MCSubtargetInfo *STI) override;
Matheus Almeidad92a3fa2014-05-01 10:24:46 +0000350 void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
351 const MCSymbol &Sym, bool IsReg) override;
Daniel Sandersf173dda2015-09-22 10:50:09 +0000352 void emitDirectiveCpreturn(unsigned SaveLocation,
353 bool SaveLocationIsRegister) override;
Matheus Almeida525bc4f2014-04-30 11:28:42 +0000354
Toma Tabacue95a4912015-03-13 11:40:01 +0000355 void emitMipsAbiFlags();
Jack Carter86ac5c12013-11-18 23:55:27 +0000356};
Alexander Kornienkof00654e2015-06-23 09:49:53 +0000357}
Rafael Espindolaa17151a2013-10-08 13:08:17 +0000358#endif