1//===- MipsDisassembler.cpp - Disassembler for Mips -----------------------===//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//===----------------------------------------------------------------------===//
9// This file is part of the Mips Disassembler.
11//===----------------------------------------------------------------------===//
35 #define DEBUG_TYPE "mips-disassembler"
48 IsMicroMips(STI.
hasFeature(Mips::FeatureMicroMips)),
49 IsBigEndian(IsBigEndian) {}
51 bool hasMips2()
const {
return STI.
hasFeature(Mips::FeatureMips2); }
52 bool hasMips3()
const {
return STI.
hasFeature(Mips::FeatureMips3); }
53 bool hasMips32()
const {
return STI.
hasFeature(Mips::FeatureMips32); }
55 bool hasMips32r6()
const {
59 bool isFP64()
const {
return STI.
hasFeature(Mips::FeatureFP64Bit); }
61 bool isGP64()
const {
return STI.
hasFeature(Mips::FeatureGP64Bit); }
63 bool isPTR64()
const {
return STI.
hasFeature(Mips::FeaturePTR64Bit); }
65 bool hasCnMips()
const {
return STI.
hasFeature(Mips::FeatureCnMips); }
67 bool hasCnMipsP()
const {
return STI.
hasFeature(Mips::FeatureCnMipsP); }
69 bool hasCOP3()
const {
70 // Only present in MIPS-I and MIPS-II
71 return !hasMips32() && !hasMips3();
79}
// end anonymous namespace
84 return new MipsDisassembler(STI, Ctx,
true);
90 return new MipsDisassembler(STI, Ctx,
false);
95 // Register the disassembler.
108 return RegInfo->getRegClass(RC).getRegister(RegNo);
113 // Currently only hardware register 29 is supported.
123 if (RegNo > 30 || RegNo % 2)
126 unsigned Reg =
getReg(Decoder, Mips::AFGR64RegClassID, RegNo / 2);
137 unsigned Reg =
getReg(Decoder, Mips::ACC64DSPRegClassID, RegNo);
148 unsigned Reg =
getReg(Decoder, Mips::HI32DSPRegClassID, RegNo);
159 unsigned Reg =
getReg(Decoder, Mips::LO32DSPRegClassID, RegNo);
170 unsigned Reg =
getReg(Decoder, Mips::MSA128BRegClassID, RegNo);
181 unsigned Reg =
getReg(Decoder, Mips::MSA128HRegClassID, RegNo);
192 unsigned Reg =
getReg(Decoder, Mips::MSA128WRegClassID, RegNo);
203 unsigned Reg =
getReg(Decoder, Mips::MSA128DRegClassID, RegNo);
214 unsigned Reg =
getReg(Decoder, Mips::MSACtrlRegClassID, RegNo);
225 unsigned Reg =
getReg(Decoder, Mips::COP0RegClassID, RegNo);
236 unsigned Reg =
getReg(Decoder, Mips::COP2RegClassID, RegNo);
244 unsigned Regs[] = {Mips::S0, Mips::S1, Mips::S2, Mips::S3, Mips::S4,
245 Mips::S5, Mips::S6, Mips::S7, Mips::FP};
250 // Empty register lists are not allowed.
254 RegNum = RegLst & 0xf;
256 // RegLst values 10-15, and 26-31 are reserved.
260 for (
unsigned i = 0; i < RegNum; i++)
272 unsigned Regs[] = {Mips::S0, Mips::S1, Mips::S2, Mips::S3};
278 case Mips::LWM16_MMR6:
279 case Mips::SWM16_MMR6:
283 unsigned RegNum = RegLst & 0x3;
285 for (
unsigned i = 0; i <= RegNum; i++)
293template <
typename InsnType>
299 // The size of the n field depends on the element size
300 // The register class also depends on this.
303 DecodeFN RegDecoder =
nullptr;
304 if ((tmp & 0x18) == 0x00) {
// INSVE_B
307 }
else if ((tmp & 0x1c) == 0x10) {
// INSVE_H
310 }
else if ((tmp & 0x1e) == 0x18) {
// INSVE_W
313 }
else if ((tmp & 0x1f) == 0x1c) {
// INSVE_D
319 assert(NSize != 0 && RegDecoder !=
nullptr);
341template <
typename InsnType>
356template <
typename InsnType>
370template <
typename InsnType>
374 // If we are called then we can assume that MIPS32r6/MIPS64r6 is enabled
375 // (otherwise we would have matched the ADDI instruction from the earlier
379 // 0b001000 sssss ttttt iiiiiiiiiiiiiiii
381 // BEQZALC if rs == 0 && rt != 0
382 // BEQC if rs < rt && rs != 0
390 MI.setOpcode(Mips::BOVC);
392 }
else if (Rs != 0 && Rs < Rt) {
393 MI.setOpcode(Mips::BEQC);
396 MI.setOpcode(Mips::BEQZALC);
409template <
typename InsnType>
418 MI.setOpcode(Mips::BOVC_MMR6);
424 }
else if (Rs != 0 && Rs < Rt) {
425 MI.setOpcode(Mips::BEQC_MMR6);
432 MI.setOpcode(Mips::BEQZALC_MMR6);
443template <
typename InsnType>
447 // If we are called then we can assume that MIPS32r6/MIPS64r6 is enabled
448 // (otherwise we would have matched the ADDI instruction from the earlier
452 // 0b011000 sssss ttttt iiiiiiiiiiiiiiii
454 // BNEZALC if rs == 0 && rt != 0
455 // BNEC if rs < rt && rs != 0
463 MI.setOpcode(Mips::BNVC);
465 }
else if (Rs != 0 && Rs < Rt) {
466 MI.setOpcode(Mips::BNEC);
469 MI.setOpcode(Mips::BNEZALC);
482template <
typename InsnType>
491 MI.setOpcode(Mips::BNVC_MMR6);
497 }
else if (Rs != 0 && Rs < Rt) {
498 MI.setOpcode(Mips::BNEC_MMR6);
505 MI.setOpcode(Mips::BNEZALC_MMR6);
516template <
typename InsnType>
521 // 0b110101 ttttt sssss iiiiiiiiiiiiiiii
522 // Invalid if rt == 0
523 // BGTZC_MMR6 if rs == 0 && rt != 0
524 // BLTZC_MMR6 if rs == rt && rt != 0
525 // BLTC_MMR6 if rs != rt && rs != 0 && rt != 0
535 MI.setOpcode(Mips::BGTZC_MMR6);
537 MI.setOpcode(Mips::BLTZC_MMR6);
539 MI.setOpcode(Mips::BLTC_MMR6);
555template <
typename InsnType>
560 // 0b111101 ttttt sssss iiiiiiiiiiiiiiii
561 // Invalid if rt == 0
562 // BLEZC_MMR6 if rs == 0 && rt != 0
563 // BGEZC_MMR6 if rs == rt && rt != 0
564 // BGEC_MMR6 if rs != rt && rs != 0 && rt != 0
574 MI.setOpcode(Mips::BLEZC_MMR6);
576 MI.setOpcode(Mips::BGEZC_MMR6);
579 MI.setOpcode(Mips::BGEC_MMR6);
594template <
typename InsnType>
598 // If we are called then we can assume that MIPS32r6/MIPS64r6 is enabled
599 // (otherwise we would have matched the BLEZL instruction from the earlier
603 // 0b010110 sssss ttttt iiiiiiiiiiiiiiii
604 // Invalid if rs == 0
605 // BLEZC if rs == 0 && rt != 0
606 // BGEZC if rs == rt && rt != 0
607 // BGEC if rs != rt && rs != 0 && rt != 0
617 MI.setOpcode(Mips::BLEZC);
619 MI.setOpcode(Mips::BGEZC);
622 MI.setOpcode(Mips::BGEC);
637template <
typename InsnType>
641 // If we are called then we can assume that MIPS32r6/MIPS64r6 is enabled
642 // (otherwise we would have matched the BGTZL instruction from the earlier
646 // 0b010111 sssss ttttt iiiiiiiiiiiiiiii
647 // Invalid if rs == 0
648 // BGTZC if rs == 0 && rt != 0
649 // BLTZC if rs == rt && rt != 0
650 // BLTC if rs != rt && rs != 0 && rt != 0
661 MI.setOpcode(Mips::BGTZC);
663 MI.setOpcode(Mips::BLTZC);
665 MI.setOpcode(Mips::BLTC);
681template <
typename InsnType>
685 // If we are called then we can assume that MIPS32r6/MIPS64r6 is enabled
686 // (otherwise we would have matched the BGTZ instruction from the earlier
690 // 0b000111 sssss ttttt iiiiiiiiiiiiiiii
692 // BGTZALC if rs == 0 && rt != 0
693 // BLTZALC if rs != 0 && rs == rt
694 // BLTUC if rs != 0 && rs != rt
703 MI.setOpcode(Mips::BGTZ);
705 }
else if (Rs == 0) {
706 MI.setOpcode(Mips::BGTZALC);
708 }
else if (Rs == Rt) {
709 MI.setOpcode(Mips::BLTZALC);
712 MI.setOpcode(Mips::BLTUC);
730template <
typename InsnType>
734 // If we are called then we can assume that MIPS32r6/MIPS64r6 is enabled
735 // (otherwise we would have matched the BLEZL instruction from the earlier
739 // 0b000110 sssss ttttt iiiiiiiiiiiiiiii
740 // Invalid if rs == 0
741 // BLEZALC if rs == 0 && rt != 0
742 // BGEZALC if rs == rt && rt != 0
743 // BGEUC if rs != rt && rs != 0 && rt != 0
753 MI.setOpcode(Mips::BLEZALC);
755 MI.setOpcode(Mips::BGEZALC);
758 MI.setOpcode(Mips::BGEUC);
772// Override the generated disassembler to produce DEXT all the time. This is
773// for feature / behaviour parity with binutils.
774template <
typename InsnType>
782 switch (
MI.getOpcode()) {
789 Size = Msbd + 1 + 32;
799 MI.setOpcode(Mips::DEXT);
814// Override the generated disassembler to produce DINS all the time. This is
815// for feature / behaviour parity with binutils.
816template <
typename InsnType>
824 switch (
MI.getOpcode()) {
827 Size = Msbd + 1 - Pos;
831 Size = Msbd + 33 - Pos;
835 // mbsd = pos + size - 33
836 // mbsd - pos + 33 = size
837 Size = Msbd + 33 - Pos;
846 MI.setOpcode(Mips::DINS);
857// Auto-generated decoder wouldn't add the third operand for CRC32*.
858template <
typename InsnType>
884 unsigned Reg =
getReg(Decoder, Mips::GPR64RegClassID, RegNo);
894 unsigned Reg =
getReg(Decoder, Mips::GPRMM16RegClassID, RegNo);
904 unsigned Reg =
getReg(Decoder, Mips::GPRMM16ZeroRegClassID, RegNo);
914 unsigned Reg =
getReg(Decoder, Mips::GPRMM16MovePRegClassID, RegNo);
919// Tablegen emits references to these unimplemented functions due to usage of
920// RegClassByHwMode - it does not detect that the RegClassByHwMode decoders are
921// unused, which in turn use these register class decoders.
951 unsigned Reg =
getReg(Decoder, Mips::GPR32RegClassID, RegNo);
959 if (
static_cast<const MipsDisassembler *
>(Decoder)->isGP64())
977 unsigned Reg =
getReg(Decoder, Mips::FGR64RegClassID, RegNo);
988 unsigned Reg =
getReg(Decoder, Mips::FGR32RegClassID, RegNo);
998 unsigned Reg =
getReg(Decoder, Mips::CCRRegClassID, RegNo);
1008 unsigned Reg =
getReg(Decoder, Mips::FCCRegClassID, RegNo);
1019 unsigned Reg =
getReg(Decoder, Mips::FGRCCRegClassID, RegNo);
1196 // The immediate field of an LD/ST instruction is scaled which means it must
1197 // be multiplied (when decoding) by the size (in bytes) of the instructions'
1206 assert(
false &&
"Unexpected instruction");
1233 unsigned Offset = Insn & 0xf;
1238 case Mips::LBU16_MM:
1239 case Mips::LHU16_MM:
1246 case Mips::SB16_MMR6:
1248 case Mips::SH16_MMR6:
1250 case Mips::SW16_MMR6:
1262 case Mips::LBU16_MM:
1269 case Mips::SB16_MMR6:
1272 case Mips::LHU16_MM:
1274 case Mips::SH16_MMR6:
1279 case Mips::SW16_MMR6:
1290 unsigned Offset = Insn & 0x1F;
1305 unsigned Offset = Insn & 0x7F;
1322 case Mips::LWM16_MMR6:
1323 case Mips::SWM16_MMR6:
1372 case Mips::SWM32_MM:
1373 case Mips::LWM32_MM:
1431 // This function is the same as DecodeFMem but with the Reg and Base fields
1432 // swapped according to microMIPS spec.
1520 Rt =
getReg(Decoder, Mips::GPR32RegClassID, Rt);
1639 else if (
Value == 0x7)
1663template <
unsigned Bits,
int Offset,
int Scale>
1667 Value &= ((1 << Bits) - 1);
1673template <
unsigned Bits,
int Offset = 0,
int ScaleBy = 1>
1682template <
unsigned Bits,
int Offset>
1692 // First we need to grab the pos(lsb) from MCInst.
1693 // This function only handles the 32 bit variants of ins, as dins
1694 // variants are handled differently.
1696 int Size = (int) Insn - Pos + 1;
1717 int32_t DecodedValue;
1719 case 0: DecodedValue = 256;
break;
1720 case 1: DecodedValue = 257;
break;
1721 case 510: DecodedValue = -258;
break;
1722 case 511: DecodedValue = -257;
break;
1732 // Insn must be >= 0, since it is unsigned that condition is always true.
1734 int32_t DecodedValues[] = {128, 1, 2, 3, 4, 7, 8, 15,
1735 16, 31, 32, 63, 64, 255, 32768, 65535};
1792 if (
static_cast<const MipsDisassembler *
>(Decoder)->hasMips32r6())
1816template <
typename InsnType>
1821 // 0b000111 ttttt sssss iiiiiiiiiiiiiiii
1822 // Invalid if rt == 0
1823 // BGTZALC_MMR6 if rs == 0 && rt != 0
1824 // BLTZALC_MMR6 if rs != 0 && rs == rt
1825 // BLTUC_MMR6 if rs != 0 && rs != rt
1836 MI.setOpcode(Mips::BGTZALC_MMR6);
1840 else if (Rs == Rt) {
1841 MI.setOpcode(Mips::BLTZALC_MMR6);
1846 MI.setOpcode(Mips::BLTUC_MMR6);
1865template <
typename InsnType>
1870 // 0b000110 ttttt sssss iiiiiiiiiiiiiiii
1871 // Invalid if rt == 0
1872 // BLEZALC_MMR6 if rs == 0 && rt != 0
1873 // BGEZALC_MMR6 if rs == rt && rt != 0
1874 // BGEUC_MMR6 if rs != rt && rs != 0 && rt != 0
1884 MI.setOpcode(Mips::BLEZALC_MMR6);
1887 else if (Rs == Rt) {
1888 MI.setOpcode(Mips::BGEZALC_MMR6);
1893 MI.setOpcode(Mips::BGEUC_MMR6);
1908// This instruction does not have a working decoder, and needs to be
1909// fixed. This "fixme" function was introduced to keep the backend compiling,
1910// while making changes to tablegen code.
1917#include "MipsGenDisassemblerTables.inc"
1919/// Read two bytes from the ArrayRef and return 16 bit halfword sorted
1920/// according to the given endianness.
1924 // We want to read exactly 2 Bytes of data.
1925 if (Bytes.
size() < 2) {
1931 Insn = (Bytes[0] << 8) | Bytes[1];
1933 Insn = (Bytes[1] << 8) | Bytes[0];
1939/// Read four bytes from the ArrayRef and return 32 bit word sorted
1940/// according to the given endianness.
1943 bool IsBigEndian,
bool IsMicroMips) {
1944 // We want to read exactly 4 Bytes of data.
1945 if (Bytes.
size() < 4) {
1950 // High 16 bits of a 32-bit microMIPS instruction (where the opcode is)
1951 // always precede the low 16 bits in the instruction stream (that is, they
1952 // are placed at lower addresses in the instruction stream).
1954 // microMIPS byte ordering:
1955 // Big-endian: 0 | 1 | 2 | 3
1956 // Little-endian: 1 | 0 | 3 | 2
1959 // Encoded as a big-endian 32-bit word in the stream.
1961 (Bytes[3] << 0) | (Bytes[2] << 8) | (Bytes[1] << 16) | (Bytes[0] << 24);
1964 Insn = (Bytes[2] << 0) | (Bytes[3] << 8) | (Bytes[0] << 16) |
1967 Insn = (Bytes[0] << 0) | (Bytes[1] << 8) | (Bytes[2] << 16) |
1988 if (hasMips32r6()) {
1990 dbgs() <<
"Trying MicroMipsR616 table (16-bit instructions):\n");
1991 // Calling the auto-generated decoder function for microMIPS32R6
1992 // 16-bit instructions.
1993 Result = decodeInstruction(DecoderTableMicroMipsR616, Instr, Insn,
2001 LLVM_DEBUG(
dbgs() <<
"Trying MicroMips16 table (16-bit instructions):\n");
2002 // Calling the auto-generated decoder function for microMIPS 16-bit
2004 Result = decodeInstruction(DecoderTableMicroMips16, Instr, Insn,
Address,
2015 if (hasMips32r6()) {
2017 dbgs() <<
"Trying MicroMips32r632 table (32-bit instructions):\n");
2018 // Calling the auto-generated decoder function.
2019 Result = decodeInstruction(DecoderTableMicroMipsR632, Instr, Insn,
2027 LLVM_DEBUG(
dbgs() <<
"Trying MicroMips32 table (32-bit instructions):\n");
2028 // Calling the auto-generated decoder function.
2029 Result = decodeInstruction(DecoderTableMicroMips32, Instr, Insn,
Address,
2037 LLVM_DEBUG(
dbgs() <<
"Trying MicroMipsFP64 table (32-bit opcodes):\n");
2038 Result = decodeInstruction(DecoderTableMicroMipsFP6432, Instr, Insn,
2046 // This is an invalid instruction. Claim that the Size is 2 bytes. Since
2047 // microMIPS instructions have a minimum alignment of 2, the next 2 bytes
2048 // could form a valid instruction. The two bytes we rejected as an
2049 // instruction could have actually beeen an inline constant pool that is
2050 // unconditionally branched over.
2055 // Attempt to read the instruction so that we can attempt to decode it. If
2056 // the buffer is not 4 bytes long, let the higher level logic figure out
2057 // what to do with a size of zero and MCDisassembler::Fail.
2062 // The only instruction size for standard encoded MIPS.
2068 decodeInstruction(DecoderTableCOP3_32, Instr, Insn,
Address,
this, STI);
2073 if (hasMips32r6() && isGP64()) {
2075 dbgs() <<
"Trying Mips32r6_64r6 (GPR64) table (32-bit opcodes):\n");
2076 Result = decodeInstruction(DecoderTableMips32r6_64r6_GP6432, Instr, Insn,
2082 if (hasMips32r6() && isPTR64()) {
2084 dbgs() <<
"Trying Mips32r6_64r6 (PTR64) table (32-bit opcodes):\n");
2085 Result = decodeInstruction(DecoderTableMips32r6_64r6_PTR6432, Instr, Insn,
2091 if (hasMips32r6()) {
2092 LLVM_DEBUG(
dbgs() <<
"Trying Mips32r6_64r6 table (32-bit opcodes):\n");
2093 Result = decodeInstruction(DecoderTableMips32r6_64r632, Instr, Insn,
2099 if (hasMips2() && isPTR64()) {
2101 dbgs() <<
"Trying Mips32r6_64r6 (PTR64) table (32-bit opcodes):\n");
2102 Result = decodeInstruction(DecoderTableMips32_64_PTR6432, Instr, Insn,
2110 Result = decodeInstruction(DecoderTableCnMips32, Instr, Insn,
Address,
this,
2117 LLVM_DEBUG(
dbgs() <<
"Trying CnMipsP table (32-bit opcodes):\n");
2118 Result = decodeInstruction(DecoderTableCnMipsP32, Instr, Insn,
Address,
2125 LLVM_DEBUG(
dbgs() <<
"Trying Mips64 (GPR64) table (32-bit opcodes):\n");
2126 Result = decodeInstruction(DecoderTableMips6432, Instr, Insn,
Address,
this,
2134 dbgs() <<
"Trying MipsFP64 (64 bit FPU) table (32-bit opcodes):\n");
2135 Result = decodeInstruction(DecoderTableMipsFP6432, Instr, Insn,
Address,
2142 // Calling the auto-generated decoder function.
2144 decodeInstruction(DecoderTableMips32, Instr, Insn,
Address,
this, STI);
MCDisassembler::DecodeStatus DecodeStatus
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool readInstruction16(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint32_t &Insn)
static bool readInstruction32(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint32_t &Insn)
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
#define LLVM_EXTERNAL_VISIBILITY
static DecodeStatus DecodePOOL16BEncodedField(MCInst &Inst, unsigned Value, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeFMemCop2MMR6(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeSimm19Lsl2(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMemEVA(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBgtzlGroupBranch(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeRegListOperand(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus readInstruction32(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint32_t &Insn, bool IsBigEndian, bool IsMicroMips)
Read four bytes from the ArrayRef and return 32 bit word sorted according to the given endianness.
static DecodeStatus DecodeBranchTarget21(MCInst &Inst, unsigned Offset, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeJumpTargetXMM(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeFGR32RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeCCRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeCOP2RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static unsigned getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo)
static DecodeStatus DecodeFCCRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeCacheOpMM(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus readInstruction16(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint32_t &Insn, bool IsBigEndian)
Read two bytes from the ArrayRef and return 16 bit halfword sorted according to the given endianness.
static DecodeStatus DecodeGPRMM16RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeSImmWithOffsetAndScale(MCInst &Inst, unsigned Value, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeSimm23Lsl2(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGPRMM16MovePRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBranchTarget1SImm16(MCInst &Inst, unsigned Offset, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMemMMImm9(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMovePOperands(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeCRC(MCInst &MI, InsnType Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodePOP75GroupBranchMMR6(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeDINS(MCInst &MI, InsnType Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMSA128Mem(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodePrefeOpMM(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeCPU16RegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMSA128WRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBranchTarget26(MCInst &Inst, unsigned Offset, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeHWRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeFMem(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeCacheOp(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeSyncI_MM(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeLoadByte15(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeSimm9SP(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeFMem2(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeUImmWithOffsetAndScale(MCInst &Inst, unsigned Value, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMemMMImm12(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeDEXT(MCInst &MI, InsnType Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGPRMM16ZeroRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeLi16Imm(MCInst &Inst, unsigned Value, uint64_t Address, const MCDisassembler *Decoder)
static MCDisassembler * createMipselDisassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
static DecodeStatus DecodeSimm18Lsl3(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeFMem3(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeSP64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBlezlGroupBranch(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeCOP0RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBranchTarget(MCInst &Inst, unsigned Offset, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMemMMReglistImm4Lsl2(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBgtzGroupBranch(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBranchTargetMM(MCInst &Inst, unsigned Offset, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodePOP35GroupBranchMMR6(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeFIXMEInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBranchTarget10MM(MCInst &Inst, unsigned Offset, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeANDI16Imm(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMSA128DRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeSP32RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMemMMImm4(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static MCDisassembler * createMipsDisassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
static DecodeStatus DecodeGPR32RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMSA128BRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeDaddiGroupBranch(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMovePRegPair(MCInst &Inst, unsigned RegPair, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeDAHIDATIMMR6(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBranchTarget21MM(MCInst &Inst, unsigned Offset, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBranchTarget26MM(MCInst &Inst, unsigned Offset, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeAFGR64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeDAHIDATI(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeLO32DSPRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeSpecial3LlSc(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeHI32DSPRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeSynciR6(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodePtrRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeUImmWithOffset(MCInst &Inst, unsigned Value, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeRegListOperand16(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeAddiGroupBranch(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMemMMSPImm5Lsl2(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeAddiur2Simm7(MCInst &Inst, unsigned Value, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMSACtrlRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMSA128HRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeFMemMMR2(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeCacheeOp_CacheOpR6(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMemMMImm16(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGP64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBranchTarget7MM(MCInst &Inst, unsigned Offset, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeFGR64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGPR64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBlezGroupBranchMMR6(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeJumpTargetMM(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodePOP37GroupBranchMMR6(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeSyncI(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeJumpTarget(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeACC64DSPRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeFMemCop2R6(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBgtzGroupBranchMMR6(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodePOP65GroupBranchMMR6(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeDSPRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeInsSize(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBlezGroupBranch(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMem(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeFGRCCRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGP32RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeINSVE_DF(MCInst &MI, InsnType insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeMemMMGPImm7Lsl2(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMipsDisassembler()
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
Context object for machine code objects.
Superclass for all disassemblers.
DecodeStatus
Ternary decode status.
Instances of this class represent a single low-level machine instruction.
unsigned getOpcode() const
void addOperand(const MCOperand Op)
const MCOperand & getOperand(unsigned i) const
static MCOperand createReg(MCRegister Reg)
static MCOperand createImm(int64_t Val)
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
Target - Wrapper for Target specific information.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::enable_if_t< std::is_integral_v< IntType >, IntType > fieldFromInstruction(const IntType &Insn, unsigned StartBit, unsigned NumBits)
This is an optimization pass for GlobalISel generic memory operations.
Target & getTheMips64Target()
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Target & getTheMips64elTarget()
Target & getTheMipselTarget()
constexpr int32_t SignExtend32(uint32_t X)
Sign-extend the number in the bottom B bits of X to a 32-bit integer.
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
Target & getTheMipsTarget()
static void RegisterMCDisassembler(Target &T, Target::MCDisassemblerCtorTy Fn)
RegisterMCDisassembler - Register a MCDisassembler implementation for the given target.