diff options
Diffstat (limited to 'gnu/llvm/lib/Target/Mips/MipsTargetStreamer.h')
-rw-r--r-- | gnu/llvm/lib/Target/Mips/MipsTargetStreamer.h | 117 |
1 files changed, 111 insertions, 6 deletions
diff --git a/gnu/llvm/lib/Target/Mips/MipsTargetStreamer.h b/gnu/llvm/lib/Target/Mips/MipsTargetStreamer.h index b3222f5d89e..5bca0573680 100644 --- a/gnu/llvm/lib/Target/Mips/MipsTargetStreamer.h +++ b/gnu/llvm/lib/Target/Mips/MipsTargetStreamer.h @@ -13,6 +13,7 @@ #include "MCTargetDesc/MipsABIFlagsSection.h" #include "MCTargetDesc/MipsABIInfo.h" #include "llvm/ADT/Optional.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/MC/MCELFStreamer.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCStreamer.h" @@ -24,8 +25,12 @@ struct MipsABIFlagsSection; class MipsTargetStreamer : public MCTargetStreamer { public: MipsTargetStreamer(MCStreamer &S); + + virtual void setPic(bool Value) {} + virtual void emitDirectiveSetMicroMips(); virtual void emitDirectiveSetNoMicroMips(); + virtual void setUsesMicroMips(); virtual void emitDirectiveSetMips16(); virtual void emitDirectiveSetNoMips16(); @@ -35,6 +40,14 @@ public: virtual void emitDirectiveSetNoMacro(); virtual void emitDirectiveSetMsa(); virtual void emitDirectiveSetNoMsa(); + virtual void emitDirectiveSetMt(); + virtual void emitDirectiveSetNoMt(); + virtual void emitDirectiveSetCRC(); + virtual void emitDirectiveSetNoCRC(); + virtual void emitDirectiveSetVirt(); + virtual void emitDirectiveSetNoVirt(); + virtual void emitDirectiveSetGINV(); + virtual void emitDirectiveSetNoGINV(); virtual void emitDirectiveSetAt(); virtual void emitDirectiveSetAtWithArg(unsigned RegNo); virtual void emitDirectiveSetNoAt(); @@ -70,6 +83,7 @@ public: virtual void emitDirectiveSetMips64R5(); virtual void emitDirectiveSetMips64R6(); virtual void emitDirectiveSetDsp(); + virtual void emitDirectiveSetDspr2(); virtual void emitDirectiveSetNoDsp(); virtual void emitDirectiveSetPop(); virtual void emitDirectiveSetPush(); @@ -78,8 +92,9 @@ public: // PIC support virtual void emitDirectiveCpLoad(unsigned RegNo); - virtual void emitDirectiveCpRestore(SmallVector<MCInst, 3> &StoreInsts, - int Offset); + virtual bool emitDirectiveCpRestore(int Offset, + function_ref<unsigned()> GetATReg, + SMLoc IDLoc, const MCSubtargetInfo *STI); virtual void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset, const MCSymbol &Sym, bool IsReg); virtual void emitDirectiveCpreturn(unsigned SaveLocation, @@ -90,9 +105,67 @@ public: virtual void emitDirectiveModuleOddSPReg(); virtual void emitDirectiveModuleSoftFloat(); virtual void emitDirectiveModuleHardFloat(); + virtual void emitDirectiveModuleMT(); virtual void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value); virtual void emitDirectiveSetOddSPReg(); virtual void emitDirectiveSetNoOddSPReg(); + virtual void emitDirectiveModuleCRC(); + virtual void emitDirectiveModuleNoCRC(); + virtual void emitDirectiveModuleVirt(); + virtual void emitDirectiveModuleNoVirt(); + virtual void emitDirectiveModuleGINV(); + virtual void emitDirectiveModuleNoGINV(); + + void emitR(unsigned Opcode, unsigned Reg0, SMLoc IDLoc, + const MCSubtargetInfo *STI); + void emitII(unsigned Opcode, int16_t Imm1, int16_t Imm2, SMLoc IDLoc, + const MCSubtargetInfo *STI); + void emitRX(unsigned Opcode, unsigned Reg0, MCOperand Op1, SMLoc IDLoc, + const MCSubtargetInfo *STI); + void emitRI(unsigned Opcode, unsigned Reg0, int32_t Imm, SMLoc IDLoc, + const MCSubtargetInfo *STI); + void emitRR(unsigned Opcode, unsigned Reg0, unsigned Reg1, SMLoc IDLoc, + const MCSubtargetInfo *STI); + void emitRRX(unsigned Opcode, unsigned Reg0, unsigned Reg1, MCOperand Op2, + SMLoc IDLoc, const MCSubtargetInfo *STI); + void emitRRR(unsigned Opcode, unsigned Reg0, unsigned Reg1, unsigned Reg2, + SMLoc IDLoc, const MCSubtargetInfo *STI); + void emitRRI(unsigned Opcode, unsigned Reg0, unsigned Reg1, int16_t Imm, + SMLoc IDLoc, const MCSubtargetInfo *STI); + void emitRRIII(unsigned Opcode, unsigned Reg0, unsigned Reg1, int16_t Imm0, + int16_t Imm1, int16_t Imm2, SMLoc IDLoc, + const MCSubtargetInfo *STI); + void emitAddu(unsigned DstReg, unsigned SrcReg, unsigned TrgReg, bool Is64Bit, + const MCSubtargetInfo *STI); + void emitDSLL(unsigned DstReg, unsigned SrcReg, int16_t ShiftAmount, + SMLoc IDLoc, const MCSubtargetInfo *STI); + void emitEmptyDelaySlot(bool hasShortDelaySlot, SMLoc IDLoc, + const MCSubtargetInfo *STI); + void emitNop(SMLoc IDLoc, const MCSubtargetInfo *STI); + + /// Emit a store instruction with an offset. If the offset is out of range + /// then it will be synthesized using the assembler temporary. + /// + /// GetATReg() is a callback that can be used to obtain the current assembler + /// temporary and is only called when the assembler temporary is required. It + /// must handle the case where no assembler temporary is available (typically + /// by reporting an error). + void emitStoreWithImmOffset(unsigned Opcode, unsigned SrcReg, + unsigned BaseReg, int64_t Offset, + function_ref<unsigned()> GetATReg, SMLoc IDLoc, + const MCSubtargetInfo *STI); + void emitStoreWithSymOffset(unsigned Opcode, unsigned SrcReg, + unsigned BaseReg, MCOperand &HiOperand, + MCOperand &LoOperand, unsigned ATReg, SMLoc IDLoc, + const MCSubtargetInfo *STI); + void emitLoadWithImmOffset(unsigned Opcode, unsigned DstReg, unsigned BaseReg, + int64_t Offset, unsigned TmpReg, SMLoc IDLoc, + const MCSubtargetInfo *STI); + void emitLoadWithSymOffset(unsigned Opcode, unsigned DstReg, unsigned BaseReg, + MCOperand &HiOperand, MCOperand &LoOperand, + unsigned ATReg, SMLoc IDLoc, + const MCSubtargetInfo *STI); + void emitGPRestore(int Offset, SMLoc IDLoc, const MCSubtargetInfo *STI); void forbidModuleDirective() { ModuleDirectiveAllowed = false; } void reallowModuleDirective() { ModuleDirectiveAllowed = true; } @@ -112,6 +185,10 @@ public: return *ABI; } + void setGPReg(unsigned GPReg) { + this->GPReg = GPReg; + } + protected: llvm::Optional<MipsABIInfo> ABI; MipsABIFlagsSection ABIFlagsSection; @@ -126,6 +203,7 @@ protected: bool FrameInfoSet; int FrameOffset; + unsigned GPReg; unsigned FrameReg; unsigned ReturnReg; @@ -150,6 +228,14 @@ public: void emitDirectiveSetNoMacro() override; void emitDirectiveSetMsa() override; void emitDirectiveSetNoMsa() override; + void emitDirectiveSetMt() override; + void emitDirectiveSetNoMt() override; + void emitDirectiveSetCRC() override; + void emitDirectiveSetNoCRC() override; + void emitDirectiveSetVirt() override; + void emitDirectiveSetNoVirt() override; + void emitDirectiveSetGINV() override; + void emitDirectiveSetNoGINV() override; void emitDirectiveSetAt() override; void emitDirectiveSetAtWithArg(unsigned RegNo) override; void emitDirectiveSetNoAt() override; @@ -185,6 +271,7 @@ public: void emitDirectiveSetMips64R5() override; void emitDirectiveSetMips64R6() override; void emitDirectiveSetDsp() override; + void emitDirectiveSetDspr2() override; void emitDirectiveSetNoDsp() override; void emitDirectiveSetPop() override; void emitDirectiveSetPush() override; @@ -193,8 +280,16 @@ public: // PIC support void emitDirectiveCpLoad(unsigned RegNo) override; - void emitDirectiveCpRestore(SmallVector<MCInst, 3> &StoreInsts, - int Offset) override; + + /// Emit a .cprestore directive. If the offset is out of range then it will + /// be synthesized using the assembler temporary. + /// + /// GetATReg() is a callback that can be used to obtain the current assembler + /// temporary and is only called when the assembler temporary is required. It + /// must handle the case where no assembler temporary is available (typically + /// by reporting an error). + bool emitDirectiveCpRestore(int Offset, function_ref<unsigned()> GetATReg, + SMLoc IDLoc, const MCSubtargetInfo *STI) override; void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset, const MCSymbol &Sym, bool IsReg) override; void emitDirectiveCpreturn(unsigned SaveLocation, @@ -205,6 +300,13 @@ public: void emitDirectiveModuleOddSPReg() override; void emitDirectiveModuleSoftFloat() override; void emitDirectiveModuleHardFloat() override; + void emitDirectiveModuleMT() override; + void emitDirectiveModuleCRC() override; + void emitDirectiveModuleNoCRC() override; + void emitDirectiveModuleVirt() override; + void emitDirectiveModuleNoVirt() override; + void emitDirectiveModuleGINV() override; + void emitDirectiveModuleNoGINV() override; void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value) override; void emitDirectiveSetOddSPReg() override; void emitDirectiveSetNoOddSPReg() override; @@ -221,12 +323,15 @@ public: MCELFStreamer &getStreamer(); MipsTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI); + void setPic(bool Value) override { Pic = Value; } + void emitLabel(MCSymbol *Symbol) override; void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override; void finish() override; void emitDirectiveSetMicroMips() override; void emitDirectiveSetNoMicroMips() override; + void setUsesMicroMips() override; void emitDirectiveSetMips16() override; void emitDirectiveSetNoReorder() override; @@ -246,8 +351,8 @@ public: // PIC support void emitDirectiveCpLoad(unsigned RegNo) override; - void emitDirectiveCpRestore(SmallVector<MCInst, 3> &StoreInsts, - int Offset) override; + bool emitDirectiveCpRestore(int Offset, function_ref<unsigned()> GetATReg, + SMLoc IDLoc, const MCSubtargetInfo *STI) override; void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset, const MCSymbol &Sym, bool IsReg) override; void emitDirectiveCpreturn(unsigned SaveLocation, |