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