Rafael Espindola | a17151a | 2013-10-08 13:08:17 +0000 | [diff] [blame] | 1 | //===-- 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 Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 10 | #ifndef LLVM_LIB_TARGET_MIPS_MIPSTARGETSTREAMER_H |
| 11 | #define LLVM_LIB_TARGET_MIPS_MIPSTARGETSTREAMER_H |
Rafael Espindola | a17151a | 2013-10-08 13:08:17 +0000 | [diff] [blame] | 12 | |
Chandler Carruth | d990388 | 2015-01-14 11:23:27 +0000 | [diff] [blame] | 13 | #include "MCTargetDesc/MipsABIFlagsSection.h" |
Eric Christopher | a576281 | 2015-01-26 17:33:46 +0000 | [diff] [blame] | 14 | #include "MCTargetDesc/MipsABIInfo.h" |
Simon Atanasyan | 4d45c76 | 2015-09-14 11:18:03 +0000 | [diff] [blame] | 15 | #include "llvm/ADT/Optional.h" |
Jack Carter | 86ac5c1 | 2013-11-18 23:55:27 +0000 | [diff] [blame] | 16 | #include "llvm/MC/MCELFStreamer.h" |
Daniel Sanders | d97a634 | 2014-08-13 10:07:34 +0000 | [diff] [blame] | 17 | #include "llvm/MC/MCRegisterInfo.h" |
Rafael Espindola | a17151a | 2013-10-08 13:08:17 +0000 | [diff] [blame] | 18 | #include "llvm/MC/MCStreamer.h" |
| 19 | |
| 20 | namespace llvm { |
Vladimir Medic | fb8a2a9 | 2014-07-08 08:59:22 +0000 | [diff] [blame] | 21 | |
Daniel Sanders | 324ad95 | 2014-07-08 13:13:42 +0000 | [diff] [blame] | 22 | struct MipsABIFlagsSection; |
Vladimir Medic | fb8a2a9 | 2014-07-08 08:59:22 +0000 | [diff] [blame] | 23 | |
Rafael Espindola | a17151a | 2013-10-08 13:08:17 +0000 | [diff] [blame] | 24 | class MipsTargetStreamer : public MCTargetStreamer { |
Rafael Espindola | a17151a | 2013-10-08 13:08:17 +0000 | [diff] [blame] | 25 | public: |
Rafael Espindola | 24ea09e | 2014-01-26 06:06:37 +0000 | [diff] [blame] | 26 | MipsTargetStreamer(MCStreamer &S); |
Rafael Espindola | 60890b8 | 2014-06-23 19:43:40 +0000 | [diff] [blame] | 27 | virtual void emitDirectiveSetMicroMips(); |
| 28 | virtual void emitDirectiveSetNoMicroMips(); |
| 29 | virtual void emitDirectiveSetMips16(); |
| 30 | virtual void emitDirectiveSetNoMips16(); |
Rafael Espindola | eb0a8af | 2014-01-26 05:06:48 +0000 | [diff] [blame] | 31 | |
Rafael Espindola | 60890b8 | 2014-06-23 19:43:40 +0000 | [diff] [blame] | 32 | virtual void emitDirectiveSetReorder(); |
| 33 | virtual void emitDirectiveSetNoReorder(); |
| 34 | virtual void emitDirectiveSetMacro(); |
| 35 | virtual void emitDirectiveSetNoMacro(); |
Daniel Sanders | 4493443 | 2014-08-07 12:03:36 +0000 | [diff] [blame] | 36 | virtual void emitDirectiveSetMsa(); |
| 37 | virtual void emitDirectiveSetNoMsa(); |
Rafael Espindola | 60890b8 | 2014-06-23 19:43:40 +0000 | [diff] [blame] | 38 | virtual void emitDirectiveSetAt(); |
Toma Tabacu | 16a7449 | 2015-02-13 10:30:57 +0000 | [diff] [blame] | 39 | virtual void emitDirectiveSetAtWithArg(unsigned RegNo); |
Rafael Espindola | 60890b8 | 2014-06-23 19:43:40 +0000 | [diff] [blame] | 40 | virtual void emitDirectiveSetNoAt(); |
| 41 | virtual void emitDirectiveEnd(StringRef Name); |
Rafael Espindola | eb0a8af | 2014-01-26 05:06:48 +0000 | [diff] [blame] | 42 | |
Rafael Espindola | 60890b8 | 2014-06-23 19:43:40 +0000 | [diff] [blame] | 43 | virtual void emitDirectiveEnt(const MCSymbol &Symbol); |
| 44 | virtual void emitDirectiveAbiCalls(); |
| 45 | virtual void emitDirectiveNaN2008(); |
| 46 | virtual void emitDirectiveNaNLegacy(); |
| 47 | virtual void emitDirectiveOptionPic0(); |
| 48 | virtual void emitDirectiveOptionPic2(); |
Toma Tabacu | 9ca5096 | 2015-04-16 09:53:47 +0000 | [diff] [blame] | 49 | virtual void emitDirectiveInsn(); |
Rafael Espindola | 054234f | 2014-01-27 03:53:56 +0000 | [diff] [blame] | 50 | virtual void emitFrame(unsigned StackReg, unsigned StackSize, |
Rafael Espindola | 60890b8 | 2014-06-23 19:43:40 +0000 | [diff] [blame] | 51 | unsigned ReturnReg); |
| 52 | virtual void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff); |
| 53 | virtual void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff); |
Vladimir Medic | 615b26e | 2014-03-04 09:54:09 +0000 | [diff] [blame] | 54 | |
Toma Tabacu | 85618b3 | 2014-08-19 14:22:52 +0000 | [diff] [blame] | 55 | virtual void emitDirectiveSetArch(StringRef Arch); |
Toma Tabacu | 2664779 | 2014-09-09 12:52:14 +0000 | [diff] [blame] | 56 | virtual void emitDirectiveSetMips0(); |
Daniel Sanders | f0df221 | 2014-08-04 12:20:00 +0000 | [diff] [blame] | 57 | virtual void emitDirectiveSetMips1(); |
| 58 | virtual void emitDirectiveSetMips2(); |
| 59 | virtual void emitDirectiveSetMips3(); |
| 60 | virtual void emitDirectiveSetMips4(); |
| 61 | virtual void emitDirectiveSetMips5(); |
| 62 | virtual void emitDirectiveSetMips32(); |
Rafael Espindola | 60890b8 | 2014-06-23 19:43:40 +0000 | [diff] [blame] | 63 | virtual void emitDirectiveSetMips32R2(); |
Daniel Sanders | 1779314 | 2015-02-18 16:24:50 +0000 | [diff] [blame] | 64 | virtual void emitDirectiveSetMips32R3(); |
| 65 | virtual void emitDirectiveSetMips32R5(); |
Daniel Sanders | f0df221 | 2014-08-04 12:20:00 +0000 | [diff] [blame] | 66 | virtual void emitDirectiveSetMips32R6(); |
Rafael Espindola | 60890b8 | 2014-06-23 19:43:40 +0000 | [diff] [blame] | 67 | virtual void emitDirectiveSetMips64(); |
| 68 | virtual void emitDirectiveSetMips64R2(); |
Daniel Sanders | 1779314 | 2015-02-18 16:24:50 +0000 | [diff] [blame] | 69 | virtual void emitDirectiveSetMips64R3(); |
| 70 | virtual void emitDirectiveSetMips64R5(); |
Daniel Sanders | f0df221 | 2014-08-04 12:20:00 +0000 | [diff] [blame] | 71 | virtual void emitDirectiveSetMips64R6(); |
Rafael Espindola | 60890b8 | 2014-06-23 19:43:40 +0000 | [diff] [blame] | 72 | virtual void emitDirectiveSetDsp(); |
Toma Tabacu | 351b2fe | 2014-09-17 09:01:54 +0000 | [diff] [blame] | 73 | virtual void emitDirectiveSetNoDsp(); |
Toma Tabacu | 9db22db | 2014-09-09 10:15:38 +0000 | [diff] [blame] | 74 | virtual void emitDirectiveSetPop(); |
| 75 | virtual void emitDirectiveSetPush(); |
Toma Tabacu | 2969650 | 2015-06-02 09:48:04 +0000 | [diff] [blame] | 76 | virtual void emitDirectiveSetSoftFloat(); |
| 77 | virtual void emitDirectiveSetHardFloat(); |
Matheus Almeida | 525bc4f | 2014-04-30 11:28:42 +0000 | [diff] [blame] | 78 | |
| 79 | // PIC support |
Toma Tabacu | c4c202a | 2014-10-01 14:53:19 +0000 | [diff] [blame] | 80 | virtual void emitDirectiveCpLoad(unsigned RegNo); |
Daniel Sanders | 7225cd5 | 2016-04-29 16:16:49 +0000 | [diff] [blame^] | 81 | virtual void emitDirectiveCpRestore(int Offset, unsigned ATReg, SMLoc IDLoc, |
| 82 | const MCSubtargetInfo *STI); |
Matheus Almeida | d92a3fa | 2014-05-01 10:24:46 +0000 | [diff] [blame] | 83 | virtual void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset, |
Rafael Espindola | 60890b8 | 2014-06-23 19:43:40 +0000 | [diff] [blame] | 84 | const MCSymbol &Sym, bool IsReg); |
Daniel Sanders | f173dda | 2015-09-22 10:50:09 +0000 | [diff] [blame] | 85 | virtual void emitDirectiveCpreturn(unsigned SaveLocation, |
| 86 | bool SaveLocationIsRegister); |
Daniel Sanders | 7e52742 | 2014-07-10 13:38:23 +0000 | [diff] [blame] | 87 | |
Toma Tabacu | a64e540 | 2015-06-25 12:44:38 +0000 | [diff] [blame] | 88 | // FP abiflags directives |
| 89 | virtual void emitDirectiveModuleFP(); |
Toma Tabacu | 3c49958 | 2015-06-25 10:56:57 +0000 | [diff] [blame] | 90 | virtual void emitDirectiveModuleOddSPReg(); |
Toma Tabacu | 0f09313 | 2015-06-30 13:46:03 +0000 | [diff] [blame] | 91 | virtual void emitDirectiveModuleSoftFloat(); |
| 92 | virtual void emitDirectiveModuleHardFloat(); |
Toma Tabacu | 4e0cf8e | 2015-03-06 12:15:12 +0000 | [diff] [blame] | 93 | virtual void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value); |
Toma Tabacu | 32c72aa | 2015-06-30 09:36:50 +0000 | [diff] [blame] | 94 | virtual void emitDirectiveSetOddSPReg(); |
| 95 | virtual void emitDirectiveSetNoOddSPReg(); |
Toma Tabacu | a64e540 | 2015-06-25 12:44:38 +0000 | [diff] [blame] | 96 | |
Daniel Sanders | a736b37 | 2016-04-29 13:33:12 +0000 | [diff] [blame] | 97 | void emitR(unsigned Opcode, unsigned Reg0, SMLoc IDLoc, |
| 98 | const MCSubtargetInfo *STI); |
| 99 | void emitII(unsigned Opcode, int16_t Imm1, int16_t Imm2, SMLoc IDLoc, |
| 100 | const MCSubtargetInfo *STI); |
| 101 | void emitRX(unsigned Opcode, unsigned Reg0, MCOperand Op1, SMLoc IDLoc, |
| 102 | const MCSubtargetInfo *STI); |
| 103 | void emitRI(unsigned Opcode, unsigned Reg0, int32_t Imm, SMLoc IDLoc, |
| 104 | const MCSubtargetInfo *STI); |
| 105 | void emitRR(unsigned Opcode, unsigned Reg0, unsigned Reg1, SMLoc IDLoc, |
| 106 | const MCSubtargetInfo *STI); |
| 107 | void emitRRX(unsigned Opcode, unsigned Reg0, unsigned Reg1, MCOperand Op2, |
| 108 | SMLoc IDLoc, const MCSubtargetInfo *STI); |
| 109 | void emitRRR(unsigned Opcode, unsigned Reg0, unsigned Reg1, unsigned Reg2, |
| 110 | SMLoc IDLoc, const MCSubtargetInfo *STI); |
| 111 | void emitRRI(unsigned Opcode, unsigned Reg0, unsigned Reg1, int16_t Imm, |
| 112 | SMLoc IDLoc, const MCSubtargetInfo *STI); |
| 113 | void emitAddu(unsigned DstReg, unsigned SrcReg, unsigned TrgReg, bool Is64Bit, |
| 114 | const MCSubtargetInfo *STI); |
| 115 | void emitDSLL(unsigned DstReg, unsigned SrcReg, int16_t ShiftAmount, |
| 116 | SMLoc IDLoc, const MCSubtargetInfo *STI); |
| 117 | void emitEmptyDelaySlot(bool hasShortDelaySlot, SMLoc IDLoc, |
| 118 | const MCSubtargetInfo *STI); |
| 119 | void emitNop(SMLoc IDLoc, const MCSubtargetInfo *STI); |
Daniel Sanders | fba875f | 2016-04-29 13:43:45 +0000 | [diff] [blame] | 120 | void emitStoreWithImmOffset(unsigned Opcode, unsigned SrcReg, |
| 121 | unsigned BaseReg, int64_t Offset, unsigned ATReg, |
| 122 | SMLoc IDLoc, const MCSubtargetInfo *STI); |
| 123 | void emitStoreWithSymOffset(unsigned Opcode, unsigned SrcReg, |
| 124 | unsigned BaseReg, MCOperand &HiOperand, |
| 125 | MCOperand &LoOperand, unsigned ATReg, SMLoc IDLoc, |
| 126 | const MCSubtargetInfo *STI); |
| 127 | void emitLoadWithImmOffset(unsigned Opcode, unsigned DstReg, unsigned BaseReg, |
| 128 | int64_t Offset, unsigned TmpReg, SMLoc IDLoc, |
| 129 | const MCSubtargetInfo *STI); |
| 130 | void emitLoadWithSymOffset(unsigned Opcode, unsigned DstReg, unsigned BaseReg, |
| 131 | MCOperand &HiOperand, MCOperand &LoOperand, |
| 132 | unsigned ATReg, SMLoc IDLoc, |
| 133 | const MCSubtargetInfo *STI); |
Daniel Sanders | 7225cd5 | 2016-04-29 16:16:49 +0000 | [diff] [blame^] | 134 | void emitGPRestore(int Offset, SMLoc IDLoc, const MCSubtargetInfo *STI); |
Daniel Sanders | a736b37 | 2016-04-29 13:33:12 +0000 | [diff] [blame] | 135 | |
Daniel Sanders | cdb45fa | 2014-08-14 09:18:14 +0000 | [diff] [blame] | 136 | void forbidModuleDirective() { ModuleDirectiveAllowed = false; } |
Toma Tabacu | 4e0cf8e | 2015-03-06 12:15:12 +0000 | [diff] [blame] | 137 | void reallowModuleDirective() { ModuleDirectiveAllowed = true; } |
Daniel Sanders | cdb45fa | 2014-08-14 09:18:14 +0000 | [diff] [blame] | 138 | bool isModuleDirectiveAllowed() { return ModuleDirectiveAllowed; } |
Vladimir Medic | fb8a2a9 | 2014-07-08 08:59:22 +0000 | [diff] [blame] | 139 | |
Vladimir Medic | fb8a2a9 | 2014-07-08 08:59:22 +0000 | [diff] [blame] | 140 | // This method enables template classes to set internal abi flags |
| 141 | // structure values. |
| 142 | template <class PredicateLibrary> |
| 143 | void updateABIInfo(const PredicateLibrary &P) { |
Simon Atanasyan | 4d45c76 | 2015-09-14 11:18:03 +0000 | [diff] [blame] | 144 | ABI = P.getABI(); |
Daniel Sanders | c7dbc63 | 2014-07-08 10:11:38 +0000 | [diff] [blame] | 145 | ABIFlagsSection.setAllFromPredicates(P); |
Vladimir Medic | fb8a2a9 | 2014-07-08 08:59:22 +0000 | [diff] [blame] | 146 | } |
| 147 | |
Daniel Sanders | c7dbc63 | 2014-07-08 10:11:38 +0000 | [diff] [blame] | 148 | MipsABIFlagsSection &getABIFlagsSection() { return ABIFlagsSection; } |
Eric Christopher | a576281 | 2015-01-26 17:33:46 +0000 | [diff] [blame] | 149 | const MipsABIInfo &getABI() const { |
Simon Atanasyan | 4d45c76 | 2015-09-14 11:18:03 +0000 | [diff] [blame] | 150 | assert(ABI.hasValue() && "ABI hasn't been set!"); |
Eric Christopher | a576281 | 2015-01-26 17:33:46 +0000 | [diff] [blame] | 151 | return *ABI; |
| 152 | } |
Daniel Sanders | c7dbc63 | 2014-07-08 10:11:38 +0000 | [diff] [blame] | 153 | |
Vladimir Medic | fb8a2a9 | 2014-07-08 08:59:22 +0000 | [diff] [blame] | 154 | protected: |
Simon Atanasyan | 4d45c76 | 2015-09-14 11:18:03 +0000 | [diff] [blame] | 155 | llvm::Optional<MipsABIInfo> ABI; |
Daniel Sanders | c7dbc63 | 2014-07-08 10:11:38 +0000 | [diff] [blame] | 156 | MipsABIFlagsSection ABIFlagsSection; |
Vladimir Medic | fb8a2a9 | 2014-07-08 08:59:22 +0000 | [diff] [blame] | 157 | |
Daniel Sanders | d97a634 | 2014-08-13 10:07:34 +0000 | [diff] [blame] | 158 | bool GPRInfoSet; |
| 159 | unsigned GPRBitMask; |
| 160 | int GPROffset; |
| 161 | |
| 162 | bool FPRInfoSet; |
| 163 | unsigned FPRBitMask; |
| 164 | int FPROffset; |
| 165 | |
| 166 | bool FrameInfoSet; |
| 167 | int FrameOffset; |
| 168 | unsigned FrameReg; |
| 169 | unsigned ReturnReg; |
| 170 | |
Vladimir Medic | fb8a2a9 | 2014-07-08 08:59:22 +0000 | [diff] [blame] | 171 | private: |
Daniel Sanders | cdb45fa | 2014-08-14 09:18:14 +0000 | [diff] [blame] | 172 | bool ModuleDirectiveAllowed; |
Rafael Espindola | a17151a | 2013-10-08 13:08:17 +0000 | [diff] [blame] | 173 | }; |
Jack Carter | 86ac5c1 | 2013-11-18 23:55:27 +0000 | [diff] [blame] | 174 | |
| 175 | // This part is for ascii assembly output |
| 176 | class MipsTargetAsmStreamer : public MipsTargetStreamer { |
Jack Carter | 6ef6cc5 | 2013-11-19 20:53:28 +0000 | [diff] [blame] | 177 | formatted_raw_ostream &OS; |
| 178 | |
Jack Carter | 86ac5c1 | 2013-11-18 23:55:27 +0000 | [diff] [blame] | 179 | public: |
Rafael Espindola | 24ea09e | 2014-01-26 06:06:37 +0000 | [diff] [blame] | 180 | MipsTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS); |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 181 | void emitDirectiveSetMicroMips() override; |
| 182 | void emitDirectiveSetNoMicroMips() override; |
| 183 | void emitDirectiveSetMips16() override; |
| 184 | void emitDirectiveSetNoMips16() override; |
Rafael Espindola | eb0a8af | 2014-01-26 05:06:48 +0000 | [diff] [blame] | 185 | |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 186 | void emitDirectiveSetReorder() override; |
| 187 | void emitDirectiveSetNoReorder() override; |
| 188 | void emitDirectiveSetMacro() override; |
| 189 | void emitDirectiveSetNoMacro() override; |
Daniel Sanders | 4493443 | 2014-08-07 12:03:36 +0000 | [diff] [blame] | 190 | void emitDirectiveSetMsa() override; |
| 191 | void emitDirectiveSetNoMsa() override; |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 192 | void emitDirectiveSetAt() override; |
Toma Tabacu | 16a7449 | 2015-02-13 10:30:57 +0000 | [diff] [blame] | 193 | void emitDirectiveSetAtWithArg(unsigned RegNo) override; |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 194 | void emitDirectiveSetNoAt() override; |
| 195 | void emitDirectiveEnd(StringRef Name) override; |
Rafael Espindola | eb0a8af | 2014-01-26 05:06:48 +0000 | [diff] [blame] | 196 | |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 197 | void emitDirectiveEnt(const MCSymbol &Symbol) override; |
| 198 | void emitDirectiveAbiCalls() override; |
| 199 | void emitDirectiveNaN2008() override; |
| 200 | void emitDirectiveNaNLegacy() override; |
| 201 | void emitDirectiveOptionPic0() override; |
| 202 | void emitDirectiveOptionPic2() override; |
Toma Tabacu | 9ca5096 | 2015-04-16 09:53:47 +0000 | [diff] [blame] | 203 | void emitDirectiveInsn() override; |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 204 | void emitFrame(unsigned StackReg, unsigned StackSize, |
| 205 | unsigned ReturnReg) override; |
| 206 | void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff) override; |
| 207 | void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff) override; |
Vladimir Medic | 615b26e | 2014-03-04 09:54:09 +0000 | [diff] [blame] | 208 | |
Toma Tabacu | 85618b3 | 2014-08-19 14:22:52 +0000 | [diff] [blame] | 209 | void emitDirectiveSetArch(StringRef Arch) override; |
Toma Tabacu | 2664779 | 2014-09-09 12:52:14 +0000 | [diff] [blame] | 210 | void emitDirectiveSetMips0() override; |
Daniel Sanders | f0df221 | 2014-08-04 12:20:00 +0000 | [diff] [blame] | 211 | void emitDirectiveSetMips1() override; |
| 212 | void emitDirectiveSetMips2() override; |
| 213 | void emitDirectiveSetMips3() override; |
| 214 | void emitDirectiveSetMips4() override; |
| 215 | void emitDirectiveSetMips5() override; |
| 216 | void emitDirectiveSetMips32() override; |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 217 | void emitDirectiveSetMips32R2() override; |
Daniel Sanders | 1779314 | 2015-02-18 16:24:50 +0000 | [diff] [blame] | 218 | void emitDirectiveSetMips32R3() override; |
| 219 | void emitDirectiveSetMips32R5() override; |
Daniel Sanders | f0df221 | 2014-08-04 12:20:00 +0000 | [diff] [blame] | 220 | void emitDirectiveSetMips32R6() override; |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 221 | void emitDirectiveSetMips64() override; |
| 222 | void emitDirectiveSetMips64R2() override; |
Daniel Sanders | 1779314 | 2015-02-18 16:24:50 +0000 | [diff] [blame] | 223 | void emitDirectiveSetMips64R3() override; |
| 224 | void emitDirectiveSetMips64R5() override; |
Daniel Sanders | f0df221 | 2014-08-04 12:20:00 +0000 | [diff] [blame] | 225 | void emitDirectiveSetMips64R6() override; |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 226 | void emitDirectiveSetDsp() override; |
Toma Tabacu | 351b2fe | 2014-09-17 09:01:54 +0000 | [diff] [blame] | 227 | void emitDirectiveSetNoDsp() override; |
Toma Tabacu | 9db22db | 2014-09-09 10:15:38 +0000 | [diff] [blame] | 228 | void emitDirectiveSetPop() override; |
| 229 | void emitDirectiveSetPush() override; |
Toma Tabacu | 2969650 | 2015-06-02 09:48:04 +0000 | [diff] [blame] | 230 | void emitDirectiveSetSoftFloat() override; |
| 231 | void emitDirectiveSetHardFloat() override; |
Matheus Almeida | 525bc4f | 2014-04-30 11:28:42 +0000 | [diff] [blame] | 232 | |
| 233 | // PIC support |
Toma Tabacu | c4c202a | 2014-10-01 14:53:19 +0000 | [diff] [blame] | 234 | void emitDirectiveCpLoad(unsigned RegNo) override; |
Daniel Sanders | 7225cd5 | 2016-04-29 16:16:49 +0000 | [diff] [blame^] | 235 | void emitDirectiveCpRestore(int Offset, unsigned ATReg, SMLoc IDLoc, |
| 236 | const MCSubtargetInfo *STI) override; |
Matheus Almeida | d92a3fa | 2014-05-01 10:24:46 +0000 | [diff] [blame] | 237 | void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset, |
| 238 | const MCSymbol &Sym, bool IsReg) override; |
Daniel Sanders | f173dda | 2015-09-22 10:50:09 +0000 | [diff] [blame] | 239 | void emitDirectiveCpreturn(unsigned SaveLocation, |
| 240 | bool SaveLocationIsRegister) override; |
Vladimir Medic | fb8a2a9 | 2014-07-08 08:59:22 +0000 | [diff] [blame] | 241 | |
Toma Tabacu | a64e540 | 2015-06-25 12:44:38 +0000 | [diff] [blame] | 242 | // FP abiflags directives |
| 243 | void emitDirectiveModuleFP() override; |
Toma Tabacu | 3c49958 | 2015-06-25 10:56:57 +0000 | [diff] [blame] | 244 | void emitDirectiveModuleOddSPReg() override; |
Toma Tabacu | 0f09313 | 2015-06-30 13:46:03 +0000 | [diff] [blame] | 245 | void emitDirectiveModuleSoftFloat() override; |
| 246 | void emitDirectiveModuleHardFloat() override; |
Daniel Sanders | 7e52742 | 2014-07-10 13:38:23 +0000 | [diff] [blame] | 247 | void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value) override; |
Toma Tabacu | 32c72aa | 2015-06-30 09:36:50 +0000 | [diff] [blame] | 248 | void emitDirectiveSetOddSPReg() override; |
| 249 | void emitDirectiveSetNoOddSPReg() override; |
Jack Carter | 86ac5c1 | 2013-11-18 23:55:27 +0000 | [diff] [blame] | 250 | }; |
| 251 | |
| 252 | // This part is for ELF object output |
| 253 | class MipsTargetELFStreamer : public MipsTargetStreamer { |
Rafael Espindola | 6d5f7ce | 2014-01-14 04:25:13 +0000 | [diff] [blame] | 254 | bool MicroMipsEnabled; |
Rafael Espindola | 972e71a | 2014-01-31 23:10:26 +0000 | [diff] [blame] | 255 | const MCSubtargetInfo &STI; |
Matheus Almeida | f79b281 | 2014-03-26 13:40:29 +0000 | [diff] [blame] | 256 | bool Pic; |
Jack Carter | 3953672 | 2014-01-22 23:08:42 +0000 | [diff] [blame] | 257 | |
Jack Carter | 86ac5c1 | 2013-11-18 23:55:27 +0000 | [diff] [blame] | 258 | public: |
Rafael Espindola | 6d5f7ce | 2014-01-14 04:25:13 +0000 | [diff] [blame] | 259 | bool isMicroMipsEnabled() const { return MicroMipsEnabled; } |
Jack Carter | 86ac5c1 | 2013-11-18 23:55:27 +0000 | [diff] [blame] | 260 | MCELFStreamer &getStreamer(); |
Rafael Espindola | cb1953f | 2014-01-26 06:57:13 +0000 | [diff] [blame] | 261 | MipsTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI); |
Rafael Espindola | 6d5f7ce | 2014-01-14 04:25:13 +0000 | [diff] [blame] | 262 | |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 263 | void emitLabel(MCSymbol *Symbol) override; |
| 264 | void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override; |
Craig Topper | 7315602 | 2014-03-02 09:09:27 +0000 | [diff] [blame] | 265 | void finish() override; |
Rafael Espindola | 6d5f7ce | 2014-01-14 04:25:13 +0000 | [diff] [blame] | 266 | |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 267 | void emitDirectiveSetMicroMips() override; |
| 268 | void emitDirectiveSetNoMicroMips() override; |
| 269 | void emitDirectiveSetMips16() override; |
Rafael Espindola | eb0a8af | 2014-01-26 05:06:48 +0000 | [diff] [blame] | 270 | |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 271 | void emitDirectiveSetNoReorder() override; |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 272 | void emitDirectiveEnd(StringRef Name) override; |
Rafael Espindola | eb0a8af | 2014-01-26 05:06:48 +0000 | [diff] [blame] | 273 | |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 274 | void emitDirectiveEnt(const MCSymbol &Symbol) override; |
| 275 | void emitDirectiveAbiCalls() override; |
| 276 | void emitDirectiveNaN2008() override; |
| 277 | void emitDirectiveNaNLegacy() override; |
| 278 | void emitDirectiveOptionPic0() override; |
| 279 | void emitDirectiveOptionPic2() override; |
Toma Tabacu | 9ca5096 | 2015-04-16 09:53:47 +0000 | [diff] [blame] | 280 | void emitDirectiveInsn() override; |
Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 281 | void emitFrame(unsigned StackReg, unsigned StackSize, |
| 282 | unsigned ReturnReg) override; |
| 283 | void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff) override; |
| 284 | void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff) override; |
Vladimir Medic | 615b26e | 2014-03-04 09:54:09 +0000 | [diff] [blame] | 285 | |
Matheus Almeida | 525bc4f | 2014-04-30 11:28:42 +0000 | [diff] [blame] | 286 | // PIC support |
Toma Tabacu | c4c202a | 2014-10-01 14:53:19 +0000 | [diff] [blame] | 287 | void emitDirectiveCpLoad(unsigned RegNo) override; |
Daniel Sanders | 7225cd5 | 2016-04-29 16:16:49 +0000 | [diff] [blame^] | 288 | void emitDirectiveCpRestore(int Offset, unsigned ATReg, SMLoc IDLoc, |
| 289 | const MCSubtargetInfo *STI) override; |
Matheus Almeida | d92a3fa | 2014-05-01 10:24:46 +0000 | [diff] [blame] | 290 | void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset, |
| 291 | const MCSymbol &Sym, bool IsReg) override; |
Daniel Sanders | f173dda | 2015-09-22 10:50:09 +0000 | [diff] [blame] | 292 | void emitDirectiveCpreturn(unsigned SaveLocation, |
| 293 | bool SaveLocationIsRegister) override; |
Matheus Almeida | 525bc4f | 2014-04-30 11:28:42 +0000 | [diff] [blame] | 294 | |
Toma Tabacu | e95a491 | 2015-03-13 11:40:01 +0000 | [diff] [blame] | 295 | void emitMipsAbiFlags(); |
Jack Carter | 86ac5c1 | 2013-11-18 23:55:27 +0000 | [diff] [blame] | 296 | }; |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 297 | } |
Rafael Espindola | a17151a | 2013-10-08 13:08:17 +0000 | [diff] [blame] | 298 | #endif |