2013-10-08 21:08:17 +08:00
|
|
|
//===-- MipsTargetStreamer.h - Mips Target Streamer ------------*- C++ -*--===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2013-10-08 21:08:17 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_MIPS_MIPSTARGETSTREAMER_H
|
|
|
|
#define LLVM_LIB_TARGET_MIPS_MIPSTARGETSTREAMER_H
|
2013-10-08 21:08:17 +08:00
|
|
|
|
2015-01-14 19:23:27 +08:00
|
|
|
#include "MCTargetDesc/MipsABIFlagsSection.h"
|
2015-01-27 01:33:46 +08:00
|
|
|
#include "MCTargetDesc/MipsABIInfo.h"
|
2015-09-14 19:18:03 +08:00
|
|
|
#include "llvm/ADT/Optional.h"
|
2016-06-13 00:13:55 +08:00
|
|
|
#include "llvm/ADT/STLExtras.h"
|
2013-11-19 07:55:27 +08:00
|
|
|
#include "llvm/MC/MCELFStreamer.h"
|
2014-08-13 18:07:34 +08:00
|
|
|
#include "llvm/MC/MCRegisterInfo.h"
|
2013-10-08 21:08:17 +08:00
|
|
|
#include "llvm/MC/MCStreamer.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
2014-07-08 16:59:22 +08:00
|
|
|
|
2014-07-08 21:13:42 +08:00
|
|
|
struct MipsABIFlagsSection;
|
2014-07-08 16:59:22 +08:00
|
|
|
|
2013-10-08 21:08:17 +08:00
|
|
|
class MipsTargetStreamer : public MCTargetStreamer {
|
|
|
|
public:
|
2014-01-26 14:06:37 +08:00
|
|
|
MipsTargetStreamer(MCStreamer &S);
|
2016-05-06 22:37:24 +08:00
|
|
|
|
|
|
|
virtual void setPic(bool Value) {}
|
|
|
|
|
2014-06-24 03:43:40 +08:00
|
|
|
virtual void emitDirectiveSetMicroMips();
|
|
|
|
virtual void emitDirectiveSetNoMicroMips();
|
2016-05-16 17:10:13 +08:00
|
|
|
virtual void setUsesMicroMips();
|
2014-06-24 03:43:40 +08:00
|
|
|
virtual void emitDirectiveSetMips16();
|
|
|
|
virtual void emitDirectiveSetNoMips16();
|
2014-01-26 13:06:48 +08:00
|
|
|
|
2014-06-24 03:43:40 +08:00
|
|
|
virtual void emitDirectiveSetReorder();
|
|
|
|
virtual void emitDirectiveSetNoReorder();
|
|
|
|
virtual void emitDirectiveSetMacro();
|
|
|
|
virtual void emitDirectiveSetNoMacro();
|
2014-08-07 20:03:36 +08:00
|
|
|
virtual void emitDirectiveSetMsa();
|
|
|
|
virtual void emitDirectiveSetNoMsa();
|
2017-07-12 05:28:36 +08:00
|
|
|
virtual void emitDirectiveSetMt();
|
|
|
|
virtual void emitDirectiveSetNoMt();
|
[mips] Add support for CRC ASE
This includes
Instructions: crc32b, crc32h, crc32w, crc32d,
crc32cb, crc32ch, crc32cw, crc32cd
Assembler directives: .set crc, .set nocrc, .module crc, .module nocrc
Attribute: crc
.MIPS.abiflags: CRC (0x8000)
Patch by Vladimir Stefanovic.
Differential Revision: https://reviews.llvm.org/D44176
llvm-svn: 327511
2018-03-14 22:13:31 +08:00
|
|
|
virtual void emitDirectiveSetCRC();
|
|
|
|
virtual void emitDirectiveSetNoCRC();
|
[mips] Add support for Virtualization ASE
This includes
Instructions: tlbginv, tlbginvf, tlbgp, tlbgr, tlbgwi, tlbgwr, hypcall
mfgc0, mtgc0, mfhgc0, mthgc0, dmfgc0, dmtgc0,
Assembler directives: .set virt, .set novirt, .module virt, .module novirt
Attribute: virt
.MIPS.abiflags: VZ (0x100)
Patch by Vladimir Stefanovic.
Differential Revision: https://reviews.llvm.org/D44905
llvm-svn: 331024
2018-04-27 17:12:08 +08:00
|
|
|
virtual void emitDirectiveSetVirt();
|
|
|
|
virtual void emitDirectiveSetNoVirt();
|
2018-05-18 00:30:32 +08:00
|
|
|
virtual void emitDirectiveSetGINV();
|
|
|
|
virtual void emitDirectiveSetNoGINV();
|
2014-06-24 03:43:40 +08:00
|
|
|
virtual void emitDirectiveSetAt();
|
2015-02-13 18:30:57 +08:00
|
|
|
virtual void emitDirectiveSetAtWithArg(unsigned RegNo);
|
2014-06-24 03:43:40 +08:00
|
|
|
virtual void emitDirectiveSetNoAt();
|
|
|
|
virtual void emitDirectiveEnd(StringRef Name);
|
2014-01-26 13:06:48 +08:00
|
|
|
|
2014-06-24 03:43:40 +08:00
|
|
|
virtual void emitDirectiveEnt(const MCSymbol &Symbol);
|
|
|
|
virtual void emitDirectiveAbiCalls();
|
|
|
|
virtual void emitDirectiveNaN2008();
|
|
|
|
virtual void emitDirectiveNaNLegacy();
|
|
|
|
virtual void emitDirectiveOptionPic0();
|
|
|
|
virtual void emitDirectiveOptionPic2();
|
2015-04-16 17:53:47 +08:00
|
|
|
virtual void emitDirectiveInsn();
|
2014-01-27 11:53:56 +08:00
|
|
|
virtual void emitFrame(unsigned StackReg, unsigned StackSize,
|
2014-06-24 03:43:40 +08:00
|
|
|
unsigned ReturnReg);
|
|
|
|
virtual void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff);
|
|
|
|
virtual void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff);
|
2014-03-04 17:54:09 +08:00
|
|
|
|
2014-08-19 22:22:52 +08:00
|
|
|
virtual void emitDirectiveSetArch(StringRef Arch);
|
2014-09-09 20:52:14 +08:00
|
|
|
virtual void emitDirectiveSetMips0();
|
2014-08-04 20:20:00 +08:00
|
|
|
virtual void emitDirectiveSetMips1();
|
|
|
|
virtual void emitDirectiveSetMips2();
|
|
|
|
virtual void emitDirectiveSetMips3();
|
|
|
|
virtual void emitDirectiveSetMips4();
|
|
|
|
virtual void emitDirectiveSetMips5();
|
|
|
|
virtual void emitDirectiveSetMips32();
|
2014-06-24 03:43:40 +08:00
|
|
|
virtual void emitDirectiveSetMips32R2();
|
2015-02-19 00:24:50 +08:00
|
|
|
virtual void emitDirectiveSetMips32R3();
|
|
|
|
virtual void emitDirectiveSetMips32R5();
|
2014-08-04 20:20:00 +08:00
|
|
|
virtual void emitDirectiveSetMips32R6();
|
2014-06-24 03:43:40 +08:00
|
|
|
virtual void emitDirectiveSetMips64();
|
|
|
|
virtual void emitDirectiveSetMips64R2();
|
2015-02-19 00:24:50 +08:00
|
|
|
virtual void emitDirectiveSetMips64R3();
|
|
|
|
virtual void emitDirectiveSetMips64R5();
|
2014-08-04 20:20:00 +08:00
|
|
|
virtual void emitDirectiveSetMips64R6();
|
2014-06-24 03:43:40 +08:00
|
|
|
virtual void emitDirectiveSetDsp();
|
2017-10-06 01:40:32 +08:00
|
|
|
virtual void emitDirectiveSetDspr2();
|
2014-09-17 17:01:54 +08:00
|
|
|
virtual void emitDirectiveSetNoDsp();
|
2014-09-09 18:15:38 +08:00
|
|
|
virtual void emitDirectiveSetPop();
|
|
|
|
virtual void emitDirectiveSetPush();
|
2015-06-02 17:48:04 +08:00
|
|
|
virtual void emitDirectiveSetSoftFloat();
|
|
|
|
virtual void emitDirectiveSetHardFloat();
|
2014-04-30 19:28:42 +08:00
|
|
|
|
|
|
|
// PIC support
|
2014-10-01 22:53:19 +08:00
|
|
|
virtual void emitDirectiveCpLoad(unsigned RegNo);
|
2019-07-17 16:11:31 +08:00
|
|
|
virtual void emitDirectiveCpLocal(unsigned RegNo);
|
2016-05-11 20:48:19 +08:00
|
|
|
virtual bool emitDirectiveCpRestore(int Offset,
|
2016-06-13 00:13:55 +08:00
|
|
|
function_ref<unsigned()> GetATReg,
|
2016-05-11 20:48:19 +08:00
|
|
|
SMLoc IDLoc, const MCSubtargetInfo *STI);
|
2014-05-01 18:24:46 +08:00
|
|
|
virtual void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
|
2014-06-24 03:43:40 +08:00
|
|
|
const MCSymbol &Sym, bool IsReg);
|
2015-09-22 18:50:09 +08:00
|
|
|
virtual void emitDirectiveCpreturn(unsigned SaveLocation,
|
|
|
|
bool SaveLocationIsRegister);
|
2014-07-10 21:38:23 +08:00
|
|
|
|
2015-06-25 20:44:38 +08:00
|
|
|
// FP abiflags directives
|
|
|
|
virtual void emitDirectiveModuleFP();
|
2015-06-25 18:56:57 +08:00
|
|
|
virtual void emitDirectiveModuleOddSPReg();
|
2015-06-30 21:46:03 +08:00
|
|
|
virtual void emitDirectiveModuleSoftFloat();
|
|
|
|
virtual void emitDirectiveModuleHardFloat();
|
2017-07-12 05:28:36 +08:00
|
|
|
virtual void emitDirectiveModuleMT();
|
2015-03-06 20:15:12 +08:00
|
|
|
virtual void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value);
|
2015-06-30 17:36:50 +08:00
|
|
|
virtual void emitDirectiveSetOddSPReg();
|
|
|
|
virtual void emitDirectiveSetNoOddSPReg();
|
[mips] Add support for CRC ASE
This includes
Instructions: crc32b, crc32h, crc32w, crc32d,
crc32cb, crc32ch, crc32cw, crc32cd
Assembler directives: .set crc, .set nocrc, .module crc, .module nocrc
Attribute: crc
.MIPS.abiflags: CRC (0x8000)
Patch by Vladimir Stefanovic.
Differential Revision: https://reviews.llvm.org/D44176
llvm-svn: 327511
2018-03-14 22:13:31 +08:00
|
|
|
virtual void emitDirectiveModuleCRC();
|
|
|
|
virtual void emitDirectiveModuleNoCRC();
|
[mips] Add support for Virtualization ASE
This includes
Instructions: tlbginv, tlbginvf, tlbgp, tlbgr, tlbgwi, tlbgwr, hypcall
mfgc0, mtgc0, mfhgc0, mthgc0, dmfgc0, dmtgc0,
Assembler directives: .set virt, .set novirt, .module virt, .module novirt
Attribute: virt
.MIPS.abiflags: VZ (0x100)
Patch by Vladimir Stefanovic.
Differential Revision: https://reviews.llvm.org/D44905
llvm-svn: 331024
2018-04-27 17:12:08 +08:00
|
|
|
virtual void emitDirectiveModuleVirt();
|
|
|
|
virtual void emitDirectiveModuleNoVirt();
|
2018-05-18 00:30:32 +08:00
|
|
|
virtual void emitDirectiveModuleGINV();
|
|
|
|
virtual void emitDirectiveModuleNoGINV();
|
2015-06-25 20:44:38 +08:00
|
|
|
|
2016-04-29 21:33:12 +08:00
|
|
|
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);
|
2019-08-07 20:21:26 +08:00
|
|
|
void emitRRRX(unsigned Opcode, unsigned Reg0, unsigned Reg1, unsigned Reg2,
|
|
|
|
MCOperand Op3, SMLoc IDLoc, const MCSubtargetInfo *STI);
|
2016-04-29 21:33:12 +08:00
|
|
|
void emitRRI(unsigned Opcode, unsigned Reg0, unsigned Reg1, int16_t Imm,
|
|
|
|
SMLoc IDLoc, const MCSubtargetInfo *STI);
|
2017-11-15 06:26:42 +08:00
|
|
|
void emitRRIII(unsigned Opcode, unsigned Reg0, unsigned Reg1, int16_t Imm0,
|
|
|
|
int16_t Imm1, int16_t Imm2, SMLoc IDLoc,
|
|
|
|
const MCSubtargetInfo *STI);
|
2016-04-29 21:33:12 +08:00
|
|
|
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);
|
2016-05-12 22:01:50 +08:00
|
|
|
|
|
|
|
/// 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).
|
2016-04-29 21:43:45 +08:00
|
|
|
void emitStoreWithImmOffset(unsigned Opcode, unsigned SrcReg,
|
2016-05-12 22:01:50 +08:00
|
|
|
unsigned BaseReg, int64_t Offset,
|
2016-06-13 00:13:55 +08:00
|
|
|
function_ref<unsigned()> GetATReg, SMLoc IDLoc,
|
2016-05-12 22:01:50 +08:00
|
|
|
const MCSubtargetInfo *STI);
|
2019-08-07 20:21:26 +08:00
|
|
|
void emitSCWithSymOffset(unsigned Opcode, unsigned SrcReg, unsigned BaseReg,
|
|
|
|
MCOperand &HiOperand, MCOperand &LoOperand,
|
|
|
|
unsigned ATReg, SMLoc IDLoc,
|
|
|
|
const MCSubtargetInfo *STI);
|
2016-04-29 21:43:45 +08:00
|
|
|
void emitLoadWithImmOffset(unsigned Opcode, unsigned DstReg, unsigned BaseReg,
|
|
|
|
int64_t Offset, unsigned TmpReg, SMLoc IDLoc,
|
|
|
|
const MCSubtargetInfo *STI);
|
2016-04-30 00:16:49 +08:00
|
|
|
void emitGPRestore(int Offset, SMLoc IDLoc, const MCSubtargetInfo *STI);
|
2016-04-29 21:33:12 +08:00
|
|
|
|
2014-08-14 17:18:14 +08:00
|
|
|
void forbidModuleDirective() { ModuleDirectiveAllowed = false; }
|
2015-03-06 20:15:12 +08:00
|
|
|
void reallowModuleDirective() { ModuleDirectiveAllowed = true; }
|
2014-08-14 17:18:14 +08:00
|
|
|
bool isModuleDirectiveAllowed() { return ModuleDirectiveAllowed; }
|
2014-07-08 16:59:22 +08:00
|
|
|
|
|
|
|
// This method enables template classes to set internal abi flags
|
|
|
|
// structure values.
|
|
|
|
template <class PredicateLibrary>
|
|
|
|
void updateABIInfo(const PredicateLibrary &P) {
|
2015-09-14 19:18:03 +08:00
|
|
|
ABI = P.getABI();
|
2014-07-08 18:11:38 +08:00
|
|
|
ABIFlagsSection.setAllFromPredicates(P);
|
2014-07-08 16:59:22 +08:00
|
|
|
}
|
|
|
|
|
2014-07-08 18:11:38 +08:00
|
|
|
MipsABIFlagsSection &getABIFlagsSection() { return ABIFlagsSection; }
|
2015-01-27 01:33:46 +08:00
|
|
|
const MipsABIInfo &getABI() const {
|
2015-09-14 19:18:03 +08:00
|
|
|
assert(ABI.hasValue() && "ABI hasn't been set!");
|
2015-01-27 01:33:46 +08:00
|
|
|
return *ABI;
|
|
|
|
}
|
2014-07-08 18:11:38 +08:00
|
|
|
|
2014-07-08 16:59:22 +08:00
|
|
|
protected:
|
2015-09-14 19:18:03 +08:00
|
|
|
llvm::Optional<MipsABIInfo> ABI;
|
2014-07-08 18:11:38 +08:00
|
|
|
MipsABIFlagsSection ABIFlagsSection;
|
2014-07-08 16:59:22 +08:00
|
|
|
|
2014-08-13 18:07:34 +08:00
|
|
|
bool GPRInfoSet;
|
|
|
|
unsigned GPRBitMask;
|
|
|
|
int GPROffset;
|
|
|
|
|
|
|
|
bool FPRInfoSet;
|
|
|
|
unsigned FPRBitMask;
|
|
|
|
int FPROffset;
|
|
|
|
|
|
|
|
bool FrameInfoSet;
|
|
|
|
int FrameOffset;
|
|
|
|
unsigned FrameReg;
|
2019-07-17 16:11:31 +08:00
|
|
|
unsigned GPReg;
|
2014-08-13 18:07:34 +08:00
|
|
|
unsigned ReturnReg;
|
|
|
|
|
2014-07-08 16:59:22 +08:00
|
|
|
private:
|
2014-08-14 17:18:14 +08:00
|
|
|
bool ModuleDirectiveAllowed;
|
2013-10-08 21:08:17 +08:00
|
|
|
};
|
2013-11-19 07:55:27 +08:00
|
|
|
|
|
|
|
// This part is for ascii assembly output
|
|
|
|
class MipsTargetAsmStreamer : public MipsTargetStreamer {
|
2013-11-20 04:53:28 +08:00
|
|
|
formatted_raw_ostream &OS;
|
|
|
|
|
2013-11-19 07:55:27 +08:00
|
|
|
public:
|
2014-01-26 14:06:37 +08:00
|
|
|
MipsTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS);
|
2014-04-29 15:58:02 +08:00
|
|
|
void emitDirectiveSetMicroMips() override;
|
|
|
|
void emitDirectiveSetNoMicroMips() override;
|
|
|
|
void emitDirectiveSetMips16() override;
|
|
|
|
void emitDirectiveSetNoMips16() override;
|
|
|
|
|
|
|
|
void emitDirectiveSetReorder() override;
|
|
|
|
void emitDirectiveSetNoReorder() override;
|
|
|
|
void emitDirectiveSetMacro() override;
|
|
|
|
void emitDirectiveSetNoMacro() override;
|
2014-08-07 20:03:36 +08:00
|
|
|
void emitDirectiveSetMsa() override;
|
|
|
|
void emitDirectiveSetNoMsa() override;
|
2017-07-12 05:28:36 +08:00
|
|
|
void emitDirectiveSetMt() override;
|
|
|
|
void emitDirectiveSetNoMt() override;
|
[mips] Add support for CRC ASE
This includes
Instructions: crc32b, crc32h, crc32w, crc32d,
crc32cb, crc32ch, crc32cw, crc32cd
Assembler directives: .set crc, .set nocrc, .module crc, .module nocrc
Attribute: crc
.MIPS.abiflags: CRC (0x8000)
Patch by Vladimir Stefanovic.
Differential Revision: https://reviews.llvm.org/D44176
llvm-svn: 327511
2018-03-14 22:13:31 +08:00
|
|
|
void emitDirectiveSetCRC() override;
|
|
|
|
void emitDirectiveSetNoCRC() override;
|
[mips] Add support for Virtualization ASE
This includes
Instructions: tlbginv, tlbginvf, tlbgp, tlbgr, tlbgwi, tlbgwr, hypcall
mfgc0, mtgc0, mfhgc0, mthgc0, dmfgc0, dmtgc0,
Assembler directives: .set virt, .set novirt, .module virt, .module novirt
Attribute: virt
.MIPS.abiflags: VZ (0x100)
Patch by Vladimir Stefanovic.
Differential Revision: https://reviews.llvm.org/D44905
llvm-svn: 331024
2018-04-27 17:12:08 +08:00
|
|
|
void emitDirectiveSetVirt() override;
|
|
|
|
void emitDirectiveSetNoVirt() override;
|
2018-05-18 00:30:32 +08:00
|
|
|
void emitDirectiveSetGINV() override;
|
|
|
|
void emitDirectiveSetNoGINV() override;
|
2014-04-29 15:58:02 +08:00
|
|
|
void emitDirectiveSetAt() override;
|
2015-02-13 18:30:57 +08:00
|
|
|
void emitDirectiveSetAtWithArg(unsigned RegNo) override;
|
2014-04-29 15:58:02 +08:00
|
|
|
void emitDirectiveSetNoAt() override;
|
|
|
|
void emitDirectiveEnd(StringRef Name) override;
|
|
|
|
|
|
|
|
void emitDirectiveEnt(const MCSymbol &Symbol) override;
|
|
|
|
void emitDirectiveAbiCalls() override;
|
|
|
|
void emitDirectiveNaN2008() override;
|
|
|
|
void emitDirectiveNaNLegacy() override;
|
|
|
|
void emitDirectiveOptionPic0() override;
|
|
|
|
void emitDirectiveOptionPic2() override;
|
2015-04-16 17:53:47 +08:00
|
|
|
void emitDirectiveInsn() override;
|
2014-04-29 15:58:02 +08:00
|
|
|
void emitFrame(unsigned StackReg, unsigned StackSize,
|
|
|
|
unsigned ReturnReg) override;
|
|
|
|
void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff) override;
|
|
|
|
void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff) override;
|
|
|
|
|
2014-08-19 22:22:52 +08:00
|
|
|
void emitDirectiveSetArch(StringRef Arch) override;
|
2014-09-09 20:52:14 +08:00
|
|
|
void emitDirectiveSetMips0() override;
|
2014-08-04 20:20:00 +08:00
|
|
|
void emitDirectiveSetMips1() override;
|
|
|
|
void emitDirectiveSetMips2() override;
|
|
|
|
void emitDirectiveSetMips3() override;
|
|
|
|
void emitDirectiveSetMips4() override;
|
|
|
|
void emitDirectiveSetMips5() override;
|
|
|
|
void emitDirectiveSetMips32() override;
|
2014-04-29 15:58:02 +08:00
|
|
|
void emitDirectiveSetMips32R2() override;
|
2015-02-19 00:24:50 +08:00
|
|
|
void emitDirectiveSetMips32R3() override;
|
|
|
|
void emitDirectiveSetMips32R5() override;
|
2014-08-04 20:20:00 +08:00
|
|
|
void emitDirectiveSetMips32R6() override;
|
2014-04-29 15:58:02 +08:00
|
|
|
void emitDirectiveSetMips64() override;
|
|
|
|
void emitDirectiveSetMips64R2() override;
|
2015-02-19 00:24:50 +08:00
|
|
|
void emitDirectiveSetMips64R3() override;
|
|
|
|
void emitDirectiveSetMips64R5() override;
|
2014-08-04 20:20:00 +08:00
|
|
|
void emitDirectiveSetMips64R6() override;
|
2014-04-29 15:58:02 +08:00
|
|
|
void emitDirectiveSetDsp() override;
|
2017-10-06 01:40:32 +08:00
|
|
|
void emitDirectiveSetDspr2() override;
|
2014-09-17 17:01:54 +08:00
|
|
|
void emitDirectiveSetNoDsp() override;
|
2014-09-09 18:15:38 +08:00
|
|
|
void emitDirectiveSetPop() override;
|
|
|
|
void emitDirectiveSetPush() override;
|
2015-06-02 17:48:04 +08:00
|
|
|
void emitDirectiveSetSoftFloat() override;
|
|
|
|
void emitDirectiveSetHardFloat() override;
|
2014-04-30 19:28:42 +08:00
|
|
|
|
|
|
|
// PIC support
|
2014-10-01 22:53:19 +08:00
|
|
|
void emitDirectiveCpLoad(unsigned RegNo) override;
|
2019-07-17 16:11:31 +08:00
|
|
|
void emitDirectiveCpLocal(unsigned RegNo) override;
|
2016-05-12 22:01:50 +08:00
|
|
|
|
|
|
|
/// 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).
|
2016-06-13 00:13:55 +08:00
|
|
|
bool emitDirectiveCpRestore(int Offset, function_ref<unsigned()> GetATReg,
|
2016-05-11 20:48:19 +08:00
|
|
|
SMLoc IDLoc, const MCSubtargetInfo *STI) override;
|
2014-05-01 18:24:46 +08:00
|
|
|
void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
|
|
|
|
const MCSymbol &Sym, bool IsReg) override;
|
2015-09-22 18:50:09 +08:00
|
|
|
void emitDirectiveCpreturn(unsigned SaveLocation,
|
|
|
|
bool SaveLocationIsRegister) override;
|
2014-07-08 16:59:22 +08:00
|
|
|
|
2015-06-25 20:44:38 +08:00
|
|
|
// FP abiflags directives
|
|
|
|
void emitDirectiveModuleFP() override;
|
2015-06-25 18:56:57 +08:00
|
|
|
void emitDirectiveModuleOddSPReg() override;
|
2015-06-30 21:46:03 +08:00
|
|
|
void emitDirectiveModuleSoftFloat() override;
|
|
|
|
void emitDirectiveModuleHardFloat() override;
|
2017-07-12 05:28:36 +08:00
|
|
|
void emitDirectiveModuleMT() override;
|
[mips] Add support for CRC ASE
This includes
Instructions: crc32b, crc32h, crc32w, crc32d,
crc32cb, crc32ch, crc32cw, crc32cd
Assembler directives: .set crc, .set nocrc, .module crc, .module nocrc
Attribute: crc
.MIPS.abiflags: CRC (0x8000)
Patch by Vladimir Stefanovic.
Differential Revision: https://reviews.llvm.org/D44176
llvm-svn: 327511
2018-03-14 22:13:31 +08:00
|
|
|
void emitDirectiveModuleCRC() override;
|
|
|
|
void emitDirectiveModuleNoCRC() override;
|
[mips] Add support for Virtualization ASE
This includes
Instructions: tlbginv, tlbginvf, tlbgp, tlbgr, tlbgwi, tlbgwr, hypcall
mfgc0, mtgc0, mfhgc0, mthgc0, dmfgc0, dmtgc0,
Assembler directives: .set virt, .set novirt, .module virt, .module novirt
Attribute: virt
.MIPS.abiflags: VZ (0x100)
Patch by Vladimir Stefanovic.
Differential Revision: https://reviews.llvm.org/D44905
llvm-svn: 331024
2018-04-27 17:12:08 +08:00
|
|
|
void emitDirectiveModuleVirt() override;
|
|
|
|
void emitDirectiveModuleNoVirt() override;
|
2018-05-18 00:30:32 +08:00
|
|
|
void emitDirectiveModuleGINV() override;
|
|
|
|
void emitDirectiveModuleNoGINV() override;
|
2014-07-10 21:38:23 +08:00
|
|
|
void emitDirectiveSetFp(MipsABIFlagsSection::FpABIKind Value) override;
|
2015-06-30 17:36:50 +08:00
|
|
|
void emitDirectiveSetOddSPReg() override;
|
|
|
|
void emitDirectiveSetNoOddSPReg() override;
|
2013-11-19 07:55:27 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// This part is for ELF object output
|
|
|
|
class MipsTargetELFStreamer : public MipsTargetStreamer {
|
2014-01-14 12:25:13 +08:00
|
|
|
bool MicroMipsEnabled;
|
2014-02-01 07:10:26 +08:00
|
|
|
const MCSubtargetInfo &STI;
|
2014-03-26 21:40:29 +08:00
|
|
|
bool Pic;
|
2014-01-23 07:08:42 +08:00
|
|
|
|
2013-11-19 07:55:27 +08:00
|
|
|
public:
|
2014-01-14 12:25:13 +08:00
|
|
|
bool isMicroMipsEnabled() const { return MicroMipsEnabled; }
|
2013-11-19 07:55:27 +08:00
|
|
|
MCELFStreamer &getStreamer();
|
2014-01-26 14:57:13 +08:00
|
|
|
MipsTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI);
|
2014-01-14 12:25:13 +08:00
|
|
|
|
2016-05-06 22:37:24 +08:00
|
|
|
void setPic(bool Value) override { Pic = Value; }
|
|
|
|
|
2014-04-29 15:58:02 +08:00
|
|
|
void emitLabel(MCSymbol *Symbol) override;
|
|
|
|
void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
|
2014-03-02 17:09:27 +08:00
|
|
|
void finish() override;
|
2014-01-14 12:25:13 +08:00
|
|
|
|
2014-04-29 15:58:02 +08:00
|
|
|
void emitDirectiveSetMicroMips() override;
|
|
|
|
void emitDirectiveSetNoMicroMips() override;
|
2016-05-16 17:10:13 +08:00
|
|
|
void setUsesMicroMips() override;
|
2014-04-29 15:58:02 +08:00
|
|
|
void emitDirectiveSetMips16() override;
|
|
|
|
|
|
|
|
void emitDirectiveSetNoReorder() override;
|
|
|
|
void emitDirectiveEnd(StringRef Name) override;
|
|
|
|
|
|
|
|
void emitDirectiveEnt(const MCSymbol &Symbol) override;
|
|
|
|
void emitDirectiveAbiCalls() override;
|
|
|
|
void emitDirectiveNaN2008() override;
|
|
|
|
void emitDirectiveNaNLegacy() override;
|
|
|
|
void emitDirectiveOptionPic0() override;
|
|
|
|
void emitDirectiveOptionPic2() override;
|
2015-04-16 17:53:47 +08:00
|
|
|
void emitDirectiveInsn() override;
|
2014-04-29 15:58:02 +08:00
|
|
|
void emitFrame(unsigned StackReg, unsigned StackSize,
|
|
|
|
unsigned ReturnReg) override;
|
|
|
|
void emitMask(unsigned CPUBitmask, int CPUTopSavedRegOff) override;
|
|
|
|
void emitFMask(unsigned FPUBitmask, int FPUTopSavedRegOff) override;
|
|
|
|
|
2014-04-30 19:28:42 +08:00
|
|
|
// PIC support
|
2014-10-01 22:53:19 +08:00
|
|
|
void emitDirectiveCpLoad(unsigned RegNo) override;
|
2019-07-17 16:11:31 +08:00
|
|
|
void emitDirectiveCpLocal(unsigned RegNo) override;
|
2016-06-13 00:13:55 +08:00
|
|
|
bool emitDirectiveCpRestore(int Offset, function_ref<unsigned()> GetATReg,
|
2016-05-11 20:48:19 +08:00
|
|
|
SMLoc IDLoc, const MCSubtargetInfo *STI) override;
|
2014-05-01 18:24:46 +08:00
|
|
|
void emitDirectiveCpsetup(unsigned RegNo, int RegOrOffset,
|
|
|
|
const MCSymbol &Sym, bool IsReg) override;
|
2015-09-22 18:50:09 +08:00
|
|
|
void emitDirectiveCpreturn(unsigned SaveLocation,
|
|
|
|
bool SaveLocationIsRegister) override;
|
2014-04-30 19:28:42 +08:00
|
|
|
|
2015-03-13 19:40:01 +08:00
|
|
|
void emitMipsAbiFlags();
|
2013-11-19 07:55:27 +08:00
|
|
|
};
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
2013-10-08 21:08:17 +08:00
|
|
|
#endif
|