10b57cec5SDimitry Andric //===-- MipsTargetStreamer.h - Mips Target Streamer ------------*- C++ -*--===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_MIPS_MIPSTARGETSTREAMER_H 100b57cec5SDimitry Andric #define LLVM_LIB_TARGET_MIPS_MIPSTARGETSTREAMER_H 110b57cec5SDimitry Andric 120b57cec5SDimitry Andric #include "MCTargetDesc/MipsABIFlagsSection.h" 130b57cec5SDimitry Andric #include "MCTargetDesc/MipsABIInfo.h" 140b57cec5SDimitry Andric #include "llvm/ADT/STLExtras.h" 150b57cec5SDimitry Andric #include "llvm/MC/MCELFStreamer.h" 160b57cec5SDimitry Andric #include "llvm/MC/MCRegisterInfo.h" 170b57cec5SDimitry Andric #include "llvm/MC/MCStreamer.h" 180b57cec5SDimitry Andric 190b57cec5SDimitry Andric namespace llvm { 200b57cec5SDimitry Andric 21fe6060f1SDimitry Andric class formatted_raw_ostream; 22fe6060f1SDimitry Andric 230b57cec5SDimitry Andric class MipsTargetStreamer : public MCTargetStreamer { 240b57cec5SDimitry Andric public: 250b57cec5SDimitry Andric MipsTargetStreamer(MCStreamer &S); 260b57cec5SDimitry Andric setPic(bool Value)270b57cec5SDimitry Andric virtual void setPic(bool Value) {} 280b57cec5SDimitry Andric 290b57cec5SDimitry Andric virtual void emitDirectiveSetMicroMips(); 300b57cec5SDimitry Andric virtual void emitDirectiveSetNoMicroMips(); 310b57cec5SDimitry Andric virtual void setUsesMicroMips(); 320b57cec5SDimitry Andric virtual void emitDirectiveSetMips16(); 330b57cec5SDimitry Andric virtual void emitDirectiveSetNoMips16(); 340b57cec5SDimitry Andric 350b57cec5SDimitry Andric virtual void emitDirectiveSetReorder(); 360b57cec5SDimitry Andric virtual void emitDirectiveSetNoReorder(); 370b57cec5SDimitry Andric virtual void emitDirectiveSetMacro(); 380b57cec5SDimitry Andric virtual void emitDirectiveSetNoMacro(); 390b57cec5SDimitry Andric virtual void emitDirectiveSetMsa(); 400b57cec5SDimitry Andric virtual void emitDirectiveSetNoMsa(); 410b57cec5SDimitry Andric virtual void emitDirectiveSetMt(); 420b57cec5SDimitry Andric virtual void emitDirectiveSetNoMt(); 430b57cec5SDimitry Andric virtual void emitDirectiveSetCRC(); 440b57cec5SDimitry Andric virtual void emitDirectiveSetNoCRC(); 450b57cec5SDimitry Andric virtual void emitDirectiveSetVirt(); 460b57cec5SDimitry Andric virtual void emitDirectiveSetNoVirt(); 470b57cec5SDimitry Andric virtual void emitDirectiveSetGINV(); 480b57cec5SDimitry Andric virtual void emitDirectiveSetNoGINV(); 490b57cec5SDimitry Andric virtual void emitDirectiveSetAt(); 500b57cec5SDimitry Andric virtual void emitDirectiveSetAtWithArg(unsigned RegNo); 510b57cec5SDimitry Andric virtual void emitDirectiveSetNoAt(); 520b57cec5SDimitry Andric virtual void emitDirectiveEnd(StringRef Name); 530b57cec5SDimitry Andric 540b57cec5SDimitry Andric virtual void emitDirectiveEnt(const MCSymbol &Symbol); 550b57cec5SDimitry Andric virtual void emitDirectiveAbiCalls(); 560b57cec5SDimitry Andric virtual void emitDirectiveNaN2008(); 570b57cec5SDimitry Andric virtual void emitDirectiveNaNLegacy(); 580b57cec5SDimitry Andric virtual void emitDirectiveOptionPic0(); 590b57cec5SDimitry Andric virtual void emitDirectiveOptionPic2(); 600b57cec5SDimitry Andric virtual void emitDirectiveInsn(); 610b57cec5SDimitry Andric virtual void emitFrame(unsigned StackReg, unsigned StackSize, 620b57cec5SDimitry Andric unsigned ReturnReg); 630b57cec5SDimitry Andric virtual void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff); 640b57cec5SDimitry Andric virtual void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff); 650b57cec5SDimitry Andric 660b57cec5SDimitry Andric virtual void emitDirectiveSetArch(StringRef Arch); 670b57cec5SDimitry Andric virtual void emitDirectiveSetMips0(); 680b57cec5SDimitry Andric virtual void emitDirectiveSetMips1(); 690b57cec5SDimitry Andric virtual void emitDirectiveSetMips2(); 700b57cec5SDimitry Andric virtual void emitDirectiveSetMips3(); 710b57cec5SDimitry Andric virtual void emitDirectiveSetMips4(); 720b57cec5SDimitry Andric virtual void emitDirectiveSetMips5(); 730b57cec5SDimitry Andric virtual void emitDirectiveSetMips32(); 740b57cec5SDimitry Andric virtual void emitDirectiveSetMips32R2(); 750b57cec5SDimitry Andric virtual void emitDirectiveSetMips32R3(); 760b57cec5SDimitry Andric virtual void emitDirectiveSetMips32R5(); 770b57cec5SDimitry Andric virtual void emitDirectiveSetMips32R6(); 780b57cec5SDimitry Andric virtual void emitDirectiveSetMips64(); 790b57cec5SDimitry Andric virtual void emitDirectiveSetMips64R2(); 800b57cec5SDimitry Andric virtual void emitDirectiveSetMips64R3(); 810b57cec5SDimitry Andric virtual void emitDirectiveSetMips64R5(); 820b57cec5SDimitry Andric virtual void emitDirectiveSetMips64R6(); 830b57cec5SDimitry Andric virtual void emitDirectiveSetDsp(); 840b57cec5SDimitry Andric virtual void emitDirectiveSetDspr2(); 850b57cec5SDimitry Andric virtual void emitDirectiveSetNoDsp(); 865ffd83dbSDimitry Andric virtual void emitDirectiveSetMips3D(); 875ffd83dbSDimitry Andric virtual void emitDirectiveSetNoMips3D(); 880b57cec5SDimitry Andric virtual void emitDirectiveSetPop(); 890b57cec5SDimitry Andric virtual void emitDirectiveSetPush(); 900b57cec5SDimitry Andric virtual void emitDirectiveSetSoftFloat(); 910b57cec5SDimitry Andric virtual void emitDirectiveSetHardFloat(); 920b57cec5SDimitry Andric 930b57cec5SDimitry Andric // PIC support 945ffd83dbSDimitry Andric virtual void emitDirectiveCpAdd(unsigned RegNo); 950b57cec5SDimitry Andric virtual void emitDirectiveCpLoad(unsigned RegNo); 960b57cec5SDimitry Andric virtual void emitDirectiveCpLocal(unsigned RegNo); 970b57cec5SDimitry Andric virtual bool emitDirectiveCpRestore(int Offset, 980b57cec5SDimitry Andric function_ref<unsigned()> GetATReg, 990b57cec5SDimitry Andric SMLoc IDLoc, const MCSubtargetInfo *STI); 1000b57cec5SDimitry Andric virtual void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset, 1010b57cec5SDimitry Andric const MCSymbol &Sym, bool IsReg); 1020b57cec5SDimitry Andric virtual void emitDirectiveCpreturn(unsigned SaveLocation, 1030b57cec5SDimitry Andric bool SaveLocationIsRegister); 1040b57cec5SDimitry Andric 1050b57cec5SDimitry Andric // FP abiflags directives 1060b57cec5SDimitry Andric virtual void emitDirectiveModuleFP(); 1070b57cec5SDimitry Andric virtual void emitDirectiveModuleOddSPReg(); 1080b57cec5SDimitry Andric virtual void emitDirectiveModuleSoftFloat(); 1090b57cec5SDimitry Andric virtual void emitDirectiveModuleHardFloat(); 1100b57cec5SDimitry Andric virtual void emitDirectiveModuleMT(); 1110b57cec5SDimitry Andric virtual void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value); 1120b57cec5SDimitry Andric virtual void emitDirectiveSetOddSPReg(); 1130b57cec5SDimitry Andric virtual void emitDirectiveSetNoOddSPReg(); 1140b57cec5SDimitry Andric virtual void emitDirectiveModuleCRC(); 1150b57cec5SDimitry Andric virtual void emitDirectiveModuleNoCRC(); 1160b57cec5SDimitry Andric virtual void emitDirectiveModuleVirt(); 1170b57cec5SDimitry Andric virtual void emitDirectiveModuleNoVirt(); 1180b57cec5SDimitry Andric virtual void emitDirectiveModuleGINV(); 1190b57cec5SDimitry Andric virtual void emitDirectiveModuleNoGINV(); 1200b57cec5SDimitry Andric 1210b57cec5SDimitry Andric void emitR(unsigned Opcode, unsigned Reg0, SMLoc IDLoc, 1220b57cec5SDimitry Andric const MCSubtargetInfo *STI); 1230b57cec5SDimitry Andric void emitII(unsigned Opcode, int16_t Imm1, int16_t Imm2, SMLoc IDLoc, 1240b57cec5SDimitry Andric const MCSubtargetInfo *STI); 1250b57cec5SDimitry Andric void emitRX(unsigned Opcode, unsigned Reg0, MCOperand Op1, SMLoc IDLoc, 1260b57cec5SDimitry Andric const MCSubtargetInfo *STI); 1270b57cec5SDimitry Andric void emitRI(unsigned Opcode, unsigned Reg0, int32_t Imm, SMLoc IDLoc, 1280b57cec5SDimitry Andric const MCSubtargetInfo *STI); 1290b57cec5SDimitry Andric void emitRR(unsigned Opcode, unsigned Reg0, unsigned Reg1, SMLoc IDLoc, 1300b57cec5SDimitry Andric const MCSubtargetInfo *STI); 1310b57cec5SDimitry Andric void emitRRX(unsigned Opcode, unsigned Reg0, unsigned Reg1, MCOperand Op2, 1320b57cec5SDimitry Andric SMLoc IDLoc, const MCSubtargetInfo *STI); 1330b57cec5SDimitry Andric void emitRRR(unsigned Opcode, unsigned Reg0, unsigned Reg1, unsigned Reg2, 1340b57cec5SDimitry Andric SMLoc IDLoc, const MCSubtargetInfo *STI); 1358bcb0991SDimitry Andric void emitRRRX(unsigned Opcode, unsigned Reg0, unsigned Reg1, unsigned Reg2, 1368bcb0991SDimitry Andric MCOperand Op3, SMLoc IDLoc, const MCSubtargetInfo *STI); 1370b57cec5SDimitry Andric void emitRRI(unsigned Opcode, unsigned Reg0, unsigned Reg1, int16_t Imm, 1380b57cec5SDimitry Andric SMLoc IDLoc, const MCSubtargetInfo *STI); 1390b57cec5SDimitry Andric void emitRRIII(unsigned Opcode, unsigned Reg0, unsigned Reg1, int16_t Imm0, 1400b57cec5SDimitry Andric int16_t Imm1, int16_t Imm2, SMLoc IDLoc, 1410b57cec5SDimitry Andric const MCSubtargetInfo *STI); 1420b57cec5SDimitry Andric void emitAddu(unsigned DstReg, unsigned SrcReg, unsigned TrgReg, bool Is64Bit, 1430b57cec5SDimitry Andric const MCSubtargetInfo *STI); 1440b57cec5SDimitry Andric void emitDSLL(unsigned DstReg, unsigned SrcReg, int16_t ShiftAmount, 1450b57cec5SDimitry Andric SMLoc IDLoc, const MCSubtargetInfo *STI); 1460b57cec5SDimitry Andric void emitEmptyDelaySlot(bool hasShortDelaySlot, SMLoc IDLoc, 1470b57cec5SDimitry Andric const MCSubtargetInfo *STI); 1480b57cec5SDimitry Andric void emitNop(SMLoc IDLoc, const MCSubtargetInfo *STI); 1490b57cec5SDimitry Andric 1500b57cec5SDimitry Andric /// Emit a store instruction with an offset. If the offset is out of range 1510b57cec5SDimitry Andric /// then it will be synthesized using the assembler temporary. 1520b57cec5SDimitry Andric /// 1530b57cec5SDimitry Andric /// GetATReg() is a callback that can be used to obtain the current assembler 1540b57cec5SDimitry Andric /// temporary and is only called when the assembler temporary is required. It 1550b57cec5SDimitry Andric /// must handle the case where no assembler temporary is available (typically 1560b57cec5SDimitry Andric /// by reporting an error). 1570b57cec5SDimitry Andric void emitStoreWithImmOffset(unsigned Opcode, unsigned SrcReg, 1580b57cec5SDimitry Andric unsigned BaseReg, int64_t Offset, 1590b57cec5SDimitry Andric function_ref<unsigned()> GetATReg, SMLoc IDLoc, 1600b57cec5SDimitry Andric const MCSubtargetInfo *STI); 1610b57cec5SDimitry Andric void emitLoadWithImmOffset(unsigned Opcode, unsigned DstReg, unsigned BaseReg, 1620b57cec5SDimitry Andric int64_t Offset, unsigned TmpReg, SMLoc IDLoc, 1630b57cec5SDimitry Andric const MCSubtargetInfo *STI); 1640b57cec5SDimitry Andric void emitGPRestore(int Offset, SMLoc IDLoc, const MCSubtargetInfo *STI); 1650b57cec5SDimitry Andric forbidModuleDirective()1660b57cec5SDimitry Andric void forbidModuleDirective() { ModuleDirectiveAllowed = false; } reallowModuleDirective()1670b57cec5SDimitry Andric void reallowModuleDirective() { ModuleDirectiveAllowed = true; } isModuleDirectiveAllowed()1680b57cec5SDimitry Andric bool isModuleDirectiveAllowed() { return ModuleDirectiveAllowed; } 1690b57cec5SDimitry Andric 1700b57cec5SDimitry Andric // This method enables template classes to set internal abi flags 1710b57cec5SDimitry Andric // structure values. 1720b57cec5SDimitry Andric template <class PredicateLibrary> updateABIInfo(const PredicateLibrary & P)1730b57cec5SDimitry Andric void updateABIInfo(const PredicateLibrary &P) { 1740b57cec5SDimitry Andric ABI = P.getABI(); 1750b57cec5SDimitry Andric ABIFlagsSection.setAllFromPredicates(P); 1760b57cec5SDimitry Andric } 1770b57cec5SDimitry Andric getABIFlagsSection()1780b57cec5SDimitry Andric MipsABIFlagsSection &getABIFlagsSection() { return ABIFlagsSection; } getABI()1790b57cec5SDimitry Andric const MipsABIInfo &getABI() const { 18081ad6265SDimitry Andric assert(ABI && "ABI hasn't been set!"); 1810b57cec5SDimitry Andric return *ABI; 1820b57cec5SDimitry Andric } 1830b57cec5SDimitry Andric 1840b57cec5SDimitry Andric protected: 185*bdd1243dSDimitry Andric std::optional<MipsABIInfo> ABI; 1860b57cec5SDimitry Andric MipsABIFlagsSection ABIFlagsSection; 1870b57cec5SDimitry Andric 1880b57cec5SDimitry Andric bool GPRInfoSet; 1890b57cec5SDimitry Andric unsigned GPRBitMask; 1900b57cec5SDimitry Andric int GPROffset; 1910b57cec5SDimitry Andric 1920b57cec5SDimitry Andric bool FPRInfoSet; 1930b57cec5SDimitry Andric unsigned FPRBitMask; 1940b57cec5SDimitry Andric int FPROffset; 1950b57cec5SDimitry Andric 1960b57cec5SDimitry Andric bool FrameInfoSet; 1970b57cec5SDimitry Andric int FrameOffset; 1980b57cec5SDimitry Andric unsigned FrameReg; 1990b57cec5SDimitry Andric unsigned GPReg; 2000b57cec5SDimitry Andric unsigned ReturnReg; 2010b57cec5SDimitry Andric 2020b57cec5SDimitry Andric private: 2030b57cec5SDimitry Andric bool ModuleDirectiveAllowed; 2040b57cec5SDimitry Andric }; 2050b57cec5SDimitry Andric 2060b57cec5SDimitry Andric // This part is for ascii assembly output 2070b57cec5SDimitry Andric class MipsTargetAsmStreamer : public MipsTargetStreamer { 2080b57cec5SDimitry Andric formatted_raw_ostream &OS; 2090b57cec5SDimitry Andric 2100b57cec5SDimitry Andric public: 2110b57cec5SDimitry Andric MipsTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS); 2120b57cec5SDimitry Andric void emitDirectiveSetMicroMips() override; 2130b57cec5SDimitry Andric void emitDirectiveSetNoMicroMips() override; 2140b57cec5SDimitry Andric void emitDirectiveSetMips16() override; 2150b57cec5SDimitry Andric void emitDirectiveSetNoMips16() override; 2160b57cec5SDimitry Andric 2170b57cec5SDimitry Andric void emitDirectiveSetReorder() override; 2180b57cec5SDimitry Andric void emitDirectiveSetNoReorder() override; 2190b57cec5SDimitry Andric void emitDirectiveSetMacro() override; 2200b57cec5SDimitry Andric void emitDirectiveSetNoMacro() override; 2210b57cec5SDimitry Andric void emitDirectiveSetMsa() override; 2220b57cec5SDimitry Andric void emitDirectiveSetNoMsa() override; 2230b57cec5SDimitry Andric void emitDirectiveSetMt() override; 2240b57cec5SDimitry Andric void emitDirectiveSetNoMt() override; 2250b57cec5SDimitry Andric void emitDirectiveSetCRC() override; 2260b57cec5SDimitry Andric void emitDirectiveSetNoCRC() override; 2270b57cec5SDimitry Andric void emitDirectiveSetVirt() override; 2280b57cec5SDimitry Andric void emitDirectiveSetNoVirt() override; 2290b57cec5SDimitry Andric void emitDirectiveSetGINV() override; 2300b57cec5SDimitry Andric void emitDirectiveSetNoGINV() override; 2310b57cec5SDimitry Andric void emitDirectiveSetAt() override; 2320b57cec5SDimitry Andric void emitDirectiveSetAtWithArg(unsigned RegNo) override; 2330b57cec5SDimitry Andric void emitDirectiveSetNoAt() override; 2340b57cec5SDimitry Andric void emitDirectiveEnd(StringRef Name) override; 2350b57cec5SDimitry Andric 2360b57cec5SDimitry Andric void emitDirectiveEnt(const MCSymbol &Symbol) override; 2370b57cec5SDimitry Andric void emitDirectiveAbiCalls() override; 2380b57cec5SDimitry Andric void emitDirectiveNaN2008() override; 2390b57cec5SDimitry Andric void emitDirectiveNaNLegacy() override; 2400b57cec5SDimitry Andric void emitDirectiveOptionPic0() override; 2410b57cec5SDimitry Andric void emitDirectiveOptionPic2() override; 2420b57cec5SDimitry Andric void emitDirectiveInsn() override; 2430b57cec5SDimitry Andric void emitFrame(unsigned StackReg, unsigned StackSize, 2440b57cec5SDimitry Andric unsigned ReturnReg) override; 2450b57cec5SDimitry Andric void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff) override; 2460b57cec5SDimitry Andric void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff) override; 2470b57cec5SDimitry Andric 2480b57cec5SDimitry Andric void emitDirectiveSetArch(StringRef Arch) override; 2490b57cec5SDimitry Andric void emitDirectiveSetMips0() override; 2500b57cec5SDimitry Andric void emitDirectiveSetMips1() override; 2510b57cec5SDimitry Andric void emitDirectiveSetMips2() override; 2520b57cec5SDimitry Andric void emitDirectiveSetMips3() override; 2530b57cec5SDimitry Andric void emitDirectiveSetMips4() override; 2540b57cec5SDimitry Andric void emitDirectiveSetMips5() override; 2550b57cec5SDimitry Andric void emitDirectiveSetMips32() override; 2560b57cec5SDimitry Andric void emitDirectiveSetMips32R2() override; 2570b57cec5SDimitry Andric void emitDirectiveSetMips32R3() override; 2580b57cec5SDimitry Andric void emitDirectiveSetMips32R5() override; 2590b57cec5SDimitry Andric void emitDirectiveSetMips32R6() override; 2600b57cec5SDimitry Andric void emitDirectiveSetMips64() override; 2610b57cec5SDimitry Andric void emitDirectiveSetMips64R2() override; 2620b57cec5SDimitry Andric void emitDirectiveSetMips64R3() override; 2630b57cec5SDimitry Andric void emitDirectiveSetMips64R5() override; 2640b57cec5SDimitry Andric void emitDirectiveSetMips64R6() override; 2650b57cec5SDimitry Andric void emitDirectiveSetDsp() override; 2660b57cec5SDimitry Andric void emitDirectiveSetDspr2() override; 2670b57cec5SDimitry Andric void emitDirectiveSetNoDsp() override; 2685ffd83dbSDimitry Andric void emitDirectiveSetMips3D() override; 2695ffd83dbSDimitry Andric void emitDirectiveSetNoMips3D() override; 2700b57cec5SDimitry Andric void emitDirectiveSetPop() override; 2710b57cec5SDimitry Andric void emitDirectiveSetPush() override; 2720b57cec5SDimitry Andric void emitDirectiveSetSoftFloat() override; 2730b57cec5SDimitry Andric void emitDirectiveSetHardFloat() override; 2740b57cec5SDimitry Andric 2750b57cec5SDimitry Andric // PIC support 2765ffd83dbSDimitry Andric void emitDirectiveCpAdd(unsigned RegNo) override; 2770b57cec5SDimitry Andric void emitDirectiveCpLoad(unsigned RegNo) override; 2780b57cec5SDimitry Andric void emitDirectiveCpLocal(unsigned RegNo) override; 2790b57cec5SDimitry Andric 2800b57cec5SDimitry Andric /// Emit a .cprestore directive. If the offset is out of range then it will 2810b57cec5SDimitry Andric /// be synthesized using the assembler temporary. 2820b57cec5SDimitry Andric /// 2830b57cec5SDimitry Andric /// GetATReg() is a callback that can be used to obtain the current assembler 2840b57cec5SDimitry Andric /// temporary and is only called when the assembler temporary is required. It 2850b57cec5SDimitry Andric /// must handle the case where no assembler temporary is available (typically 2860b57cec5SDimitry Andric /// by reporting an error). 2870b57cec5SDimitry Andric bool emitDirectiveCpRestore(int Offset, function_ref<unsigned()> GetATReg, 2880b57cec5SDimitry Andric SMLoc IDLoc, const MCSubtargetInfo *STI) override; 2890b57cec5SDimitry Andric void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset, 2900b57cec5SDimitry Andric const MCSymbol &Sym, bool IsReg) override; 2910b57cec5SDimitry Andric void emitDirectiveCpreturn(unsigned SaveLocation, 2920b57cec5SDimitry Andric bool SaveLocationIsRegister) override; 2930b57cec5SDimitry Andric 2940b57cec5SDimitry Andric // FP abiflags directives 2950b57cec5SDimitry Andric void emitDirectiveModuleFP() override; 2960b57cec5SDimitry Andric void emitDirectiveModuleOddSPReg() override; 2970b57cec5SDimitry Andric void emitDirectiveModuleSoftFloat() override; 2980b57cec5SDimitry Andric void emitDirectiveModuleHardFloat() override; 2990b57cec5SDimitry Andric void emitDirectiveModuleMT() override; 3000b57cec5SDimitry Andric void emitDirectiveModuleCRC() override; 3010b57cec5SDimitry Andric void emitDirectiveModuleNoCRC() override; 3020b57cec5SDimitry Andric void emitDirectiveModuleVirt() override; 3030b57cec5SDimitry Andric void emitDirectiveModuleNoVirt() override; 3040b57cec5SDimitry Andric void emitDirectiveModuleGINV() override; 3050b57cec5SDimitry Andric void emitDirectiveModuleNoGINV() override; 3060b57cec5SDimitry Andric void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value) override; 3070b57cec5SDimitry Andric void emitDirectiveSetOddSPReg() override; 3080b57cec5SDimitry Andric void emitDirectiveSetNoOddSPReg() override; 3090b57cec5SDimitry Andric }; 3100b57cec5SDimitry Andric 3110b57cec5SDimitry Andric // This part is for ELF object output 3120b57cec5SDimitry Andric class MipsTargetELFStreamer : public MipsTargetStreamer { 3130b57cec5SDimitry Andric bool MicroMipsEnabled; 3140b57cec5SDimitry Andric const MCSubtargetInfo &STI; 3150b57cec5SDimitry Andric bool Pic; 3160b57cec5SDimitry Andric 3170b57cec5SDimitry Andric public: isMicroMipsEnabled()3180b57cec5SDimitry Andric bool isMicroMipsEnabled() const { return MicroMipsEnabled; } 3190b57cec5SDimitry Andric MCELFStreamer &getStreamer(); 3200b57cec5SDimitry Andric MipsTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI); 3210b57cec5SDimitry Andric setPic(bool Value)3220b57cec5SDimitry Andric void setPic(bool Value) override { Pic = Value; } 3230b57cec5SDimitry Andric 3240b57cec5SDimitry Andric void emitLabel(MCSymbol *Symbol) override; 3250b57cec5SDimitry Andric void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override; 3260b57cec5SDimitry Andric void finish() override; 3270b57cec5SDimitry Andric 3280b57cec5SDimitry Andric void emitDirectiveSetMicroMips() override; 3290b57cec5SDimitry Andric void emitDirectiveSetNoMicroMips() override; 3300b57cec5SDimitry Andric void setUsesMicroMips() override; 3310b57cec5SDimitry Andric void emitDirectiveSetMips16() override; 3320b57cec5SDimitry Andric 3330b57cec5SDimitry Andric void emitDirectiveSetNoReorder() override; 3340b57cec5SDimitry Andric void emitDirectiveEnd(StringRef Name) override; 3350b57cec5SDimitry Andric 3360b57cec5SDimitry Andric void emitDirectiveEnt(const MCSymbol &Symbol) override; 3370b57cec5SDimitry Andric void emitDirectiveAbiCalls() override; 3380b57cec5SDimitry Andric void emitDirectiveNaN2008() override; 3390b57cec5SDimitry Andric void emitDirectiveNaNLegacy() override; 3400b57cec5SDimitry Andric void emitDirectiveOptionPic0() override; 3410b57cec5SDimitry Andric void emitDirectiveOptionPic2() override; 3420b57cec5SDimitry Andric void emitDirectiveInsn() override; 3430b57cec5SDimitry Andric void emitFrame(unsigned StackReg, unsigned StackSize, 3440b57cec5SDimitry Andric unsigned ReturnReg) override; 3450b57cec5SDimitry Andric void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff) override; 3460b57cec5SDimitry Andric void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff) override; 3470b57cec5SDimitry Andric 3480b57cec5SDimitry Andric // PIC support 3495ffd83dbSDimitry Andric void emitDirectiveCpAdd(unsigned RegNo) override; 3500b57cec5SDimitry Andric void emitDirectiveCpLoad(unsigned RegNo) override; 3510b57cec5SDimitry Andric void emitDirectiveCpLocal(unsigned RegNo) override; 3520b57cec5SDimitry Andric bool emitDirectiveCpRestore(int Offset, function_ref<unsigned()> GetATReg, 3530b57cec5SDimitry Andric SMLoc IDLoc, const MCSubtargetInfo *STI) override; 3540b57cec5SDimitry Andric void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset, 3550b57cec5SDimitry Andric const MCSymbol &Sym, bool IsReg) override; 3560b57cec5SDimitry Andric void emitDirectiveCpreturn(unsigned SaveLocation, 3570b57cec5SDimitry Andric bool SaveLocationIsRegister) override; 3580b57cec5SDimitry Andric 3590b57cec5SDimitry Andric void emitMipsAbiFlags(); 3600b57cec5SDimitry Andric }; 3610b57cec5SDimitry Andric } 3620b57cec5SDimitry Andric #endif 363