34 #define DEBUG_TYPE "mips-disassembler" 48 IsBigEndian(IsBigEndian) {}
50 bool hasMips2()
const {
return STI.
getFeatureBits()[Mips::FeatureMips2]; }
51 bool hasMips3()
const {
return STI.
getFeatureBits()[Mips::FeatureMips3]; }
52 bool hasMips32()
const {
return STI.
getFeatureBits()[Mips::FeatureMips32]; }
54 bool hasMips32r6()
const {
58 bool isFP64()
const {
return STI.
getFeatureBits()[Mips::FeatureFP64Bit]; }
60 bool isGP64()
const {
return STI.
getFeatureBits()[Mips::FeatureGP64Bit]; }
62 bool isPTR64()
const {
return STI.
getFeatureBits()[Mips::FeaturePTR64Bit]; }
64 bool hasCnMips()
const {
return STI.
getFeatureBits()[Mips::FeatureCnMips]; }
66 bool hasCOP3()
const {
68 return !hasMips32() && !hasMips3();
104 const void *Decoder);
109 const void *Decoder);
114 const void *Decoder);
119 const void *Decoder);
124 const void *Decoder);
129 const void *Decoder);
134 const void *Decoder);
139 const void *Decoder);
143 const void *Decoder);
148 const void *Decoder);
153 const void *Decoder);
158 const void *Decoder);
163 const void *Decoder);
168 const void *Decoder);
173 const void *Decoder);
178 const void *Decoder);
183 const void *Decoder);
188 const void *Decoder);
193 const void *Decoder);
198 const void *Decoder);
203 const void *Decoder);
208 const void *Decoder);
213 const void *Decoder);
218 const void *Decoder);
223 const void *Decoder);
228 const void *Decoder);
233 const void *Decoder);
240 const void *Decoder);
247 const void *Decoder);
254 const void *Decoder);
261 const void *Decoder);
268 const void *Decoder);
273 const void *Decoder);
278 const void *Decoder);
283 const void *Decoder);
286 const void *Decoder);
291 const void *Decoder);
296 const void *Decoder);
301 const void *Decoder);
306 const void *Decoder);
311 const void *Decoder);
316 const void *Decoder);
319 uint64_t
Address,
const void *Decoder);
324 const void *Decoder);
329 const void *Decoder);
334 const void *Decoder);
339 const void *Decoder);
344 const void *Decoder);
349 const void *Decoder);
354 const void *Decoder);
358 const void *Decoder);
362 const void *Decoder);
365 const void *Decoder);
368 const void *Decoder);
371 uint64_t
Address,
const void *Decoder);
375 const void *Decoder);
380 const void *Decoder);
385 const void *Decoder);
390 const void *Decoder);
395 const void *Decoder);
397 template <
unsigned Bits,
int Offset,
int Scale>
400 const void *Decoder);
402 template <
unsigned Bits,
int Offset>
405 const void *Decoder) {
406 return DecodeUImmWithOffsetAndScale<Bits, Offset, 1>(Inst, Value,
Address,
410 template <
unsigned Bits,
int Offset = 0,
int ScaleBy = 1>
413 const void *Decoder);
418 const void *Decoder);
421 uint64_t
Address,
const void *Decoder);
424 uint64_t
Address,
const void *Decoder);
427 uint64_t
Address,
const void *Decoder);
430 uint64_t
Address,
const void *Decoder);
433 uint64_t
Address,
const void *Decoder);
437 template <
typename InsnType>
439 const void *Decoder);
441 template <
typename InsnType>
443 const void *Decoder);
445 template <
typename InsnType>
447 const void *Decoder);
449 template <
typename InsnType>
451 const void *Decoder);
453 template <
typename InsnType>
455 const void *Decoder);
457 template <
typename InsnType>
460 const void *Decoder);
462 template <
typename InsnType>
465 const void *Decoder);
467 template <
typename InsnType>
470 const void *Decoder);
472 template <
typename InsnType>
475 const void *Decoder);
477 template <
typename InsnType>
480 const void *Decoder);
482 template <
typename InsnType>
485 const void *Decoder);
487 template <
typename InsnType>
490 const void *Decoder);
492 template <
typename InsnType>
495 const void *Decoder);
497 template <
typename InsnType>
500 const void *Decoder);
502 template <
typename InsnType>
505 const void *Decoder);
507 template <
typename InsnType>
510 const void *Decoder);
512 template <
typename InsnType>
515 const void *Decoder);
517 template <
typename InsnType>
519 const void *Decoder);
521 template <
typename InsnType>
523 const void *Decoder);
525 template <
typename InsnType>
527 const void *Decoder);
531 const void *Decoder);
535 const void *Decoder);
539 const void *Decoder);
554 return new MipsDisassembler(STI, Ctx,
true);
561 return new MipsDisassembler(STI, Ctx,
false);
576 #include "MipsGenDisassemblerTables.inc" 578 static unsigned getReg(
const void *
D,
unsigned RC,
unsigned RegNo) {
579 const MipsDisassembler *Dis =
static_cast<const MipsDisassembler*
>(
D);
580 const MCRegisterInfo *RegInfo = Dis->getContext().getRegisterInfo();
584 template <
typename InsnType>
586 const void *Decoder) {
591 InsnType tmp = fieldFromInstruction(insn, 17, 5);
593 DecodeFN RegDecoder =
nullptr;
594 if ((tmp & 0x18) == 0x00) {
597 }
else if ((tmp & 0x1c) == 0x10) {
600 }
else if ((tmp & 0x1e) == 0x18) {
603 }
else if ((tmp & 0x1f) == 0x1c) {
609 assert(NSize != 0 && RegDecoder !=
nullptr);
612 tmp = fieldFromInstruction(insn, 6, 5);
619 tmp = fieldFromInstruction(insn, 16, NSize);
622 tmp = fieldFromInstruction(insn, 11, 5);
631 template <
typename InsnType>
633 const void *Decoder) {
634 InsnType Rs = fieldFromInstruction(insn, 16, 5);
635 InsnType Imm = fieldFromInstruction(insn, 0, 16);
645 template <
typename InsnType>
647 const void *Decoder) {
648 InsnType Rs = fieldFromInstruction(insn, 21, 5);
649 InsnType Imm = fieldFromInstruction(insn, 0, 16);
659 template <
typename InsnType>
662 const void *Decoder) {
673 InsnType Rs = fieldFromInstruction(insn, 21, 5);
674 InsnType Rt = fieldFromInstruction(insn, 16, 5);
675 int64_t Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4 + 4;
681 }
else if (Rs != 0 && Rs < Rt) {
698 template <
typename InsnType>
701 const void *Decoder) {
702 InsnType Rt = fieldFromInstruction(insn, 21, 5);
703 InsnType Rs = fieldFromInstruction(insn, 16, 5);
712 Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 2 + 4;
713 }
else if (Rs != 0 && Rs < Rt) {
719 Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4 + 4;
724 Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 2 + 4;
732 template <
typename InsnType>
735 const void *Decoder) {
746 InsnType Rs = fieldFromInstruction(insn, 21, 5);
747 InsnType Rt = fieldFromInstruction(insn, 16, 5);
748 int64_t Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4 + 4;
754 }
else if (Rs != 0 && Rs < Rt) {
771 template <
typename InsnType>
774 const void *Decoder) {
775 InsnType Rt = fieldFromInstruction(insn, 21, 5);
776 InsnType Rs = fieldFromInstruction(insn, 16, 5);
785 Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 2 + 4;
786 }
else if (Rs != 0 && Rs < Rt) {
792 Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4 + 4;
797 Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 2 + 4;
805 template <
typename InsnType>
808 const void *Decoder) {
816 InsnType Rt = fieldFromInstruction(insn, 21, 5);
817 InsnType Rs = fieldFromInstruction(insn, 16, 5);
818 int64_t Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4 + 4;
844 template <
typename InsnType>
847 const void *Decoder) {
855 InsnType Rt = fieldFromInstruction(insn, 21, 5);
856 InsnType Rs = fieldFromInstruction(insn, 16, 5);
857 int64_t Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4 + 4;
883 template <
typename InsnType>
886 const void *Decoder) {
898 InsnType Rs = fieldFromInstruction(insn, 21, 5);
899 InsnType Rt = fieldFromInstruction(insn, 16, 5);
900 int64_t Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4 + 4;
926 template <
typename InsnType>
929 const void *Decoder) {
943 InsnType Rs = fieldFromInstruction(insn, 21, 5);
944 InsnType Rt = fieldFromInstruction(insn, 16, 5);
945 int64_t Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4 + 4;
970 template <
typename InsnType>
973 const void *Decoder) {
985 InsnType Rs = fieldFromInstruction(insn, 21, 5);
986 InsnType Rt = fieldFromInstruction(insn, 16, 5);
987 int64_t Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4 + 4;
994 }
else if (Rs == 0) {
997 }
else if (Rs == Rt) {
1019 template <
typename InsnType>
1022 const void *Decoder) {
1034 InsnType Rs = fieldFromInstruction(insn, 21, 5);
1035 InsnType Rt = fieldFromInstruction(insn, 16, 5);
1036 int64_t Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4 + 4;
1063 template <
typename InsnType>
1065 const void *Decoder) {
1066 unsigned Msbd = fieldFromInstruction(Insn, 11, 5);
1067 unsigned Lsb = fieldFromInstruction(Insn, 6, 5);
1078 Size = Msbd + 1 + 32;
1090 InsnType Rs = fieldFromInstruction(Insn, 21, 5);
1091 InsnType Rt = fieldFromInstruction(Insn, 16, 5);
1103 template <
typename InsnType>
1105 const void *Decoder) {
1106 unsigned Msbd = fieldFromInstruction(Insn, 11, 5);
1107 unsigned Lsb = fieldFromInstruction(Insn, 6, 5);
1114 Size = Msbd + 1 - Pos;
1118 Size = Msbd + 33 - Pos;
1124 Size = Msbd + 33 - Pos;
1130 InsnType Rs = fieldFromInstruction(Insn, 21, 5);
1131 InsnType Rt = fieldFromInstruction(Insn, 16, 5);
1143 template <
typename InsnType>
1145 const void *Decoder) {
1146 InsnType Rs = fieldFromInstruction(Insn, 21, 5);
1147 InsnType Rt = fieldFromInstruction(Insn, 16, 5);
1163 if (Bytes.
size() < 2) {
1169 Insn = (Bytes[0] << 8) | Bytes[1];
1171 Insn = (Bytes[1] << 8) | Bytes[0];
1181 bool IsBigEndian,
bool IsMicroMips) {
1183 if (Bytes.
size() < 4) {
1199 (Bytes[3] << 0) | (Bytes[2] << 8) | (Bytes[1] << 16) | (Bytes[0] << 24);
1202 Insn = (Bytes[2] << 0) | (Bytes[3] << 8) | (Bytes[0] << 16) |
1205 Insn = (Bytes[0] << 0) | (Bytes[1] << 8) | (Bytes[2] << 16) |
1227 if (hasMips32r6()) {
1229 dbgs() <<
"Trying MicroMipsR616 table (16-bit instructions):\n");
1240 LLVM_DEBUG(
dbgs() <<
"Trying MicroMips16 table (16-bit instructions):\n");
1254 if (hasMips32r6()) {
1256 dbgs() <<
"Trying MicroMips32r632 table (32-bit instructions):\n");
1266 LLVM_DEBUG(
dbgs() <<
"Trying MicroMips32 table (32-bit instructions):\n");
1276 LLVM_DEBUG(
dbgs() <<
"Trying MicroMipsFP64 table (32-bit opcodes):\n");
1312 if (hasMips32r6() && isGP64()) {
1314 dbgs() <<
"Trying Mips32r6_64r6 (GPR64) table (32-bit opcodes):\n");
1321 if (hasMips32r6() && isPTR64()) {
1323 dbgs() <<
"Trying Mips32r6_64r6 (PTR64) table (32-bit opcodes):\n");
1330 if (hasMips32r6()) {
1331 LLVM_DEBUG(
dbgs() <<
"Trying Mips32r6_64r6 table (32-bit opcodes):\n");
1338 if (hasMips2() && isPTR64()) {
1340 dbgs() <<
"Trying Mips32r6_64r6 (PTR64) table (32-bit opcodes):\n");
1356 LLVM_DEBUG(
dbgs() <<
"Trying Mips64 (GPR64) table (32-bit opcodes):\n");
1365 dbgs() <<
"Trying MipsFP64 (64 bit FPU) table (32-bit opcodes):\n");
1385 const void *Decoder) {
1392 const void *Decoder) {
1396 unsigned Reg =
getReg(Decoder, Mips::GPR64RegClassID, RegNo);
1404 const void *Decoder) {
1407 unsigned Reg =
getReg(Decoder, Mips::GPRMM16RegClassID, RegNo);
1415 const void *Decoder) {
1418 unsigned Reg =
getReg(Decoder, Mips::GPRMM16ZeroRegClassID, RegNo);
1426 const void *Decoder) {
1429 unsigned Reg =
getReg(Decoder, Mips::GPRMM16MovePRegClassID, RegNo);
1437 const void *Decoder) {
1440 unsigned Reg =
getReg(Decoder, Mips::GPR32RegClassID, RegNo);
1448 const void *Decoder) {
1449 if (static_cast<const MipsDisassembler *>(Decoder)->isGP64())
1458 const void *Decoder) {
1465 const void *Decoder) {
1469 unsigned Reg =
getReg(Decoder, Mips::FGR64RegClassID, RegNo);
1477 const void *Decoder) {
1481 unsigned Reg =
getReg(Decoder, Mips::FGR32RegClassID, RegNo);
1489 const void *Decoder) {
1492 unsigned Reg =
getReg(Decoder, Mips::CCRRegClassID, RegNo);
1500 const void *Decoder) {
1503 unsigned Reg =
getReg(Decoder, Mips::FCCRegClassID, RegNo);
1510 const void *Decoder) {
1514 unsigned Reg =
getReg(Decoder, Mips::FGRCCRegClassID, RegNo);
1522 const void *Decoder) {
1523 int Offset = SignExtend32<16>(Insn & 0xffff);
1524 unsigned Reg = fieldFromInstruction(Insn, 16, 5);
1525 unsigned Base = fieldFromInstruction(Insn, 21, 5);
1527 Reg =
getReg(Decoder, Mips::GPR32RegClassID, Reg);
1528 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1544 const void *Decoder) {
1545 int Offset = SignExtend32<9>(Insn >> 7);
1546 unsigned Reg = fieldFromInstruction(Insn, 16, 5);
1547 unsigned Base = fieldFromInstruction(Insn, 21, 5);
1549 Reg =
getReg(Decoder, Mips::GPR32RegClassID, Reg);
1550 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1565 const void *Decoder) {
1566 int Offset = SignExtend32<16>(Insn & 0xffff);
1567 unsigned Base = fieldFromInstruction(Insn, 16, 5);
1568 unsigned Reg = fieldFromInstruction(Insn, 21, 5);
1570 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1571 Reg =
getReg(Decoder, Mips::GPR32RegClassID, Reg);
1583 const void *Decoder) {
1584 int Offset = SignExtend32<16>(Insn & 0xffff);
1585 unsigned Hint = fieldFromInstruction(Insn, 16, 5);
1586 unsigned Base = fieldFromInstruction(Insn, 21, 5);
1588 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1600 const void *Decoder) {
1601 int Offset = SignExtend32<12>(Insn & 0xfff);
1602 unsigned Base = fieldFromInstruction(Insn, 16, 5);
1603 unsigned Hint = fieldFromInstruction(Insn, 21, 5);
1605 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1617 const void *Decoder) {
1618 int Offset = SignExtend32<9>(Insn & 0x1ff);
1619 unsigned Base = fieldFromInstruction(Insn, 16, 5);
1620 unsigned Hint = fieldFromInstruction(Insn, 21, 5);
1622 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1634 const void *Decoder) {
1635 int Offset = SignExtend32<9>(Insn >> 7);
1636 unsigned Hint = fieldFromInstruction(Insn, 16, 5);
1637 unsigned Base = fieldFromInstruction(Insn, 21, 5);
1639 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1651 const void *Decoder) {
1652 int Offset = SignExtend32<16>(Insn & 0xffff);
1653 unsigned Base = fieldFromInstruction(Insn, 21, 5);
1655 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1664 uint64_t
Address,
const void *Decoder) {
1665 int Offset = SignExtend32<16>(Insn & 0xffff);
1666 unsigned Base = fieldFromInstruction(Insn, 16, 5);
1668 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1679 const void *Decoder) {
1680 int Immediate = SignExtend32<16>(Insn & 0xffff);
1681 unsigned Base = fieldFromInstruction(Insn, 16, 5);
1683 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1692 uint64_t
Address,
const void *Decoder) {
1693 int Offset = SignExtend32<10>(fieldFromInstruction(Insn, 16, 10));
1694 unsigned Reg = fieldFromInstruction(Insn, 6, 5);
1695 unsigned Base = fieldFromInstruction(Insn, 11, 5);
1697 Reg =
getReg(Decoder, Mips::MSA128BRegClassID, Reg);
1698 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1713 assert(
false &&
"Unexpected instruction");
1740 const void *Decoder) {
1741 unsigned Offset = Insn & 0xf;
1742 unsigned Reg = fieldFromInstruction(Insn, 7, 3);
1743 unsigned Base = fieldFromInstruction(Insn, 4, 3);
1746 case Mips::LBU16_MM:
1747 case Mips::LHU16_MM:
1754 case Mips::SB16_MMR6:
1756 case Mips::SH16_MMR6:
1758 case Mips::SW16_MMR6:
1770 case Mips::LBU16_MM:
1777 case Mips::SB16_MMR6:
1780 case Mips::LHU16_MM:
1782 case Mips::SH16_MMR6:
1787 case Mips::SW16_MMR6:
1798 const void *Decoder) {
1799 unsigned Offset = Insn & 0x1F;
1800 unsigned Reg = fieldFromInstruction(Insn, 5, 5);
1802 Reg =
getReg(Decoder, Mips::GPR32RegClassID, Reg);
1814 const void *Decoder) {
1815 unsigned Offset = Insn & 0x7F;
1816 unsigned Reg = fieldFromInstruction(Insn, 7, 3);
1818 Reg =
getReg(Decoder, Mips::GPR32RegClassID, Reg);
1830 const void *Decoder) {
1833 case Mips::LWM16_MMR6:
1834 case Mips::SWM16_MMR6:
1835 Offset = fieldFromInstruction(Insn, 4, 4);
1838 Offset = SignExtend32<4>(Insn & 0xf);
1855 const void *Decoder) {
1856 int Offset = SignExtend32<9>(Insn & 0x1ff);
1857 unsigned Reg = fieldFromInstruction(Insn, 21, 5);
1858 unsigned Base = fieldFromInstruction(Insn, 16, 5);
1860 Reg =
getReg(Decoder, Mips::GPR32RegClassID, Reg);
1861 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1876 const void *Decoder) {
1877 int Offset = SignExtend32<12>(Insn & 0x0fff);
1878 unsigned Reg = fieldFromInstruction(Insn, 21, 5);
1879 unsigned Base = fieldFromInstruction(Insn, 16, 5);
1881 Reg =
getReg(Decoder, Mips::GPR32RegClassID, Reg);
1882 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1885 case Mips::SWM32_MM:
1886 case Mips::LWM32_MM:
1911 const void *Decoder) {
1912 int Offset = SignExtend32<16>(Insn & 0xffff);
1913 unsigned Reg = fieldFromInstruction(Insn, 21, 5);
1914 unsigned Base = fieldFromInstruction(Insn, 16, 5);
1916 Reg =
getReg(Decoder, Mips::GPR32RegClassID, Reg);
1917 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1929 const void *Decoder) {
1930 int Offset = SignExtend32<16>(Insn & 0xffff);
1931 unsigned Reg = fieldFromInstruction(Insn, 16, 5);
1932 unsigned Base = fieldFromInstruction(Insn, 21, 5);
1934 Reg =
getReg(Decoder, Mips::FGR64RegClassID, Reg);
1935 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1945 uint64_t
Address,
const void *Decoder) {
1948 int Offset = SignExtend32<16>(Insn & 0xffff);
1949 unsigned Base = fieldFromInstruction(Insn, 16, 5);
1950 unsigned Reg = fieldFromInstruction(Insn, 21, 5);
1952 Reg =
getReg(Decoder, Mips::FGR64RegClassID, Reg);
1953 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1965 const void *Decoder) {
1966 int Offset = SignExtend32<16>(Insn & 0xffff);
1967 unsigned Reg = fieldFromInstruction(Insn, 16, 5);
1968 unsigned Base = fieldFromInstruction(Insn, 21, 5);
1970 Reg =
getReg(Decoder, Mips::COP2RegClassID, Reg);
1971 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
1983 const void *Decoder) {
1984 int Offset = SignExtend32<16>(Insn & 0xffff);
1985 unsigned Reg = fieldFromInstruction(Insn, 16, 5);
1986 unsigned Base = fieldFromInstruction(Insn, 21, 5);
1988 Reg =
getReg(Decoder, Mips::COP3RegClassID, Reg);
1989 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
2001 const void *Decoder) {
2002 int Offset = SignExtend32<11>(Insn & 0x07ff);
2003 unsigned Reg = fieldFromInstruction(Insn, 16, 5);
2004 unsigned Base = fieldFromInstruction(Insn, 11, 5);
2006 Reg =
getReg(Decoder, Mips::COP2RegClassID, Reg);
2007 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
2017 uint64_t
Address,
const void *Decoder) {
2018 int Offset = SignExtend32<11>(Insn & 0x07ff);
2019 unsigned Reg = fieldFromInstruction(Insn, 21, 5);
2020 unsigned Base = fieldFromInstruction(Insn, 16, 5);
2022 Reg =
getReg(Decoder, Mips::COP2RegClassID, Reg);
2023 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
2035 const void *Decoder) {
2036 int64_t Offset = SignExtend64<9>((Insn >> 7) & 0x1ff);
2037 unsigned Rt = fieldFromInstruction(Insn, 16, 5);
2038 unsigned Base = fieldFromInstruction(Insn, 21, 5);
2040 Rt =
getReg(Decoder, Mips::GPR32RegClassID, Rt);
2041 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
2057 const void *Decoder) {
2068 const void *Decoder) {
2069 if (RegNo > 30 || RegNo %2)
2072 unsigned Reg =
getReg(Decoder, Mips::AFGR64RegClassID, RegNo /2);
2080 const void *Decoder) {
2084 unsigned Reg =
getReg(Decoder, Mips::ACC64DSPRegClassID, RegNo);
2092 const void *Decoder) {
2096 unsigned Reg =
getReg(Decoder, Mips::HI32DSPRegClassID, RegNo);
2104 const void *Decoder) {
2108 unsigned Reg =
getReg(Decoder, Mips::LO32DSPRegClassID, RegNo);
2116 const void *Decoder) {
2120 unsigned Reg =
getReg(Decoder, Mips::MSA128BRegClassID, RegNo);
2128 const void *Decoder) {
2132 unsigned Reg =
getReg(Decoder, Mips::MSA128HRegClassID, RegNo);
2140 const void *Decoder) {
2144 unsigned Reg =
getReg(Decoder, Mips::MSA128WRegClassID, RegNo);
2152 const void *Decoder) {
2156 unsigned Reg =
getReg(Decoder, Mips::MSA128DRegClassID, RegNo);
2164 const void *Decoder) {
2168 unsigned Reg =
getReg(Decoder, Mips::MSACtrlRegClassID, RegNo);
2176 const void *Decoder) {
2180 unsigned Reg =
getReg(Decoder, Mips::COP0RegClassID, RegNo);
2188 const void *Decoder) {
2192 unsigned Reg =
getReg(Decoder, Mips::COP2RegClassID, RegNo);
2200 const void *Decoder) {
2201 int32_t BranchOffset = (SignExtend32<16>(
Offset) * 4) + 4;
2209 const void *Decoder) {
2210 int32_t BranchOffset = (SignExtend32<16>(
Offset) * 2);
2218 const void *Decoder) {
2219 unsigned JumpOffset = fieldFromInstruction(Insn, 0, 26) << 2;
2227 const void *Decoder) {
2228 int32_t BranchOffset = SignExtend32<21>(
Offset) * 4 + 4;
2237 const void *Decoder) {
2238 int32_t BranchOffset = SignExtend32<21>(
Offset) * 4 + 4;
2247 const void *Decoder) {
2248 int32_t BranchOffset = SignExtend32<26>(
Offset) * 4 + 4;
2257 const void *Decoder) {
2258 int32_t BranchOffset = SignExtend32<8>(Offset << 1);
2266 const void *Decoder) {
2267 int32_t BranchOffset = SignExtend32<11>(Offset << 1);
2275 const void *Decoder) {
2276 int32_t BranchOffset = SignExtend32<16>(
Offset) * 2 + 4;
2284 const void *Decoder) {
2285 int32_t BranchOffset = SignExtend32<27>(Offset << 1);
2294 const void *Decoder) {
2295 unsigned JumpOffset = fieldFromInstruction(Insn, 0, 26) << 1;
2303 const void *Decoder) {
2306 else if (Value == 0x7)
2316 const void *Decoder) {
2327 const void *Decoder) {
2332 template <
unsigned Bits,
int Offset,
int Scale>
2335 const void *Decoder) {
2336 Value &= ((1 <<
Bits) - 1);
2342 template <
unsigned Bits,
int Offset,
int ScaleBy>
2345 const void *Decoder) {
2346 int32_t Imm = SignExtend32<Bits>(Value) * ScaleBy;
2354 const void *Decoder) {
2359 int Size = (int) Insn - Pos + 1;
2365 uint64_t
Address,
const void *Decoder) {
2371 uint64_t
Address,
const void *Decoder) {
2377 uint64_t
Address,
const void *Decoder) {
2378 int32_t DecodedValue;
2380 case 0: DecodedValue = 256;
break;
2381 case 1: DecodedValue = 257;
break;
2382 case 510: DecodedValue = -258;
break;
2383 case 511: DecodedValue = -257;
break;
2384 default: DecodedValue = SignExtend32<9>(Insn);
break;
2391 uint64_t
Address,
const void *Decoder) {
2394 int32_t DecodedValues[] = {128, 1, 2, 3, 4, 7, 8, 15, 16, 31, 32, 63, 64,
2403 const void *Decoder) {
2404 unsigned Regs[] = {Mips::S0, Mips::S1, Mips::S2, Mips::S3, Mips::S4, Mips::S5,
2405 Mips::S6, Mips::S7, Mips::FP};
2408 unsigned RegLst = fieldFromInstruction(Insn, 21, 5);
2414 RegNum = RegLst & 0xf;
2420 for (
unsigned i = 0; i < RegNum; i++)
2431 const void *Decoder) {
2432 unsigned Regs[] = {Mips::S0, Mips::S1, Mips::S2, Mips::S3};
2436 RegLst = fieldFromInstruction(Insn, 4, 2);
2438 case Mips::LWM16_MMR6:
2439 case Mips::SWM16_MMR6:
2440 RegLst = fieldFromInstruction(Insn, 8, 2);
2443 unsigned RegNum = RegLst & 0x3;
2445 for (
unsigned i = 0; i <= RegNum; i++)
2454 uint64_t
Address,
const void *Decoder) {
2496 uint64_t
Address,
const void *Decoder) {
2501 template <
typename InsnType>
2504 const void *Decoder) {
2512 InsnType Rt = fieldFromInstruction(insn, 21, 5);
2513 InsnType Rs = fieldFromInstruction(insn, 16, 5);
2523 Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 2 + 4;
2525 else if (Rs == Rt) {
2528 Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 2 + 4;
2534 Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4 + 4;
2550 template <
typename InsnType>
2553 const void *Decoder) {
2561 InsnType Rt = fieldFromInstruction(insn, 21, 5);
2562 InsnType Rs = fieldFromInstruction(insn, 16, 5);
2570 Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 2 + 4;
2572 else if (Rs == Rt) {
2574 Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 2 + 4;
2579 Imm =
SignExtend64(fieldFromInstruction(insn, 0, 16), 16) * 4 + 4;
static DecodeStatus DecodeCacheOp(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeJumpTargetMM(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeLi16Imm(MCInst &Inst, unsigned Value, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeFMemCop2MMR6(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeBranchTarget21(MCInst &Inst, unsigned Offset, uint64_t Address, const void *Decoder)
iterator begin() const
begin/end - Return all of the registers in this class.
Compute iterated dominance frontiers using a linear time algorithm.
static DecodeStatus DecodeINSVE_DF(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
INSVE_[BHWD] have an implicit operand that the generated decoder doesn't handle.
DecodeStatus
Ternary decode status.
static DecodeStatus DecodeCPU16RegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeCOP2RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
Superclass for all disassemblers.
static DecodeStatus DecodeFMemCop2R6(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeBranchTarget(MCInst &Inst, unsigned Offset, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeBgtzGroupBranchMMR6(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeSyncI(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeGPR64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeInsSize(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeDaddiGroupBranch(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeBranchTargetMM(MCInst &Inst, unsigned Offset, uint64_t Address, const void *Decoder)
Target & getTheMipselTarget()
static DecodeStatus DecodeAFGR64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeSimm19Lsl2(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeFCCRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static MCDisassembler * createMipsDisassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
static void RegisterMCDisassembler(Target &T, Target::MCDisassemblerCtorTy Fn)
RegisterMCDisassembler - Register a MCDisassembler implementation for the given target.
static DecodeStatus DecodeBlezlGroupBranch(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeFMemMMR2(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMSA128Mem(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMemMMImm4(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
SI optimize exec mask operations pre RA
static DecodeStatus DecodeSImmWithOffsetAndScale(MCInst &Inst, unsigned Value, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeGPR32RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodePOP75GroupBranchMMR6(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeRegListOperand16(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMemMMReglistImm4Lsl2(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static MCOperand createReg(unsigned Reg)
const FeatureBitset & getFeatureBits() const
static DecodeStatus DecodeDAHIDATIMMR6(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeFMem(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMemMMSPImm5Lsl2(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeLO32DSPRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodePOP65GroupBranchMMR6(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMSA128DRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeSyncI_MM(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
Context object for machine code objects.
static DecodeStatus DecodeDEXT(MCInst &MI, InsnType Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMemMMImm12(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeCacheeOp_CacheOpR6(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
int decodeInstruction(InternalInstruction *insn, byteReader_t reader, const void *readerArg, dlog_t logger, void *loggerArg, const void *miiArg, uint64_t startLoc, DisassemblerMode mode)
Decode one instruction and store the decoding results in a buffer provided by the consumer...
static DecodeStatus DecodeUImmWithOffsetAndScale(MCInst &Inst, unsigned Value, uint64_t Address, const void *Decoder)
Target & getTheMips64Target()
static DecodeStatus DecodeRegListOperand(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMovePRegPair(MCInst &Inst, unsigned RegPair, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeHWRegsRegisterClass(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeBlezGroupBranchMMR6(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
Instances of this class represent a single low-level machine instruction.
static DecodeStatus DecodePOP35GroupBranchMMR6(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
static DecodeStatus DecodeMemMMImm9(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeGPRMM16RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static MCDisassembler * createMipselDisassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
static DecodeStatus DecodePOP37GroupBranchMMR6(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
Target & getTheMips64elTarget()
static DecodeStatus DecodeBgtzlGroupBranch(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeSimm18Lsl3(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
size_t size() const
size - Get the array size.
static DecodeStatus DecodeFGR64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
void LLVMInitializeMipsDisassembler()
static DecodeStatus DecodePtrRegisterClass(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeSimm23Lsl2(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeDINS(MCInst &MI, InsnType Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeCacheOpMM(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static DecodeStatus DecodeBranchTarget7MM(MCInst &Inst, unsigned Offset, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeDAHIDATI(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
MCDisassembler::DecodeStatus DecodeStatus
void setOpcode(unsigned Op)
static DecodeStatus DecodeSpecial3LlSc(MCInst &Inst, unsigned Insn, uint64_t Address, const void *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 DecodeBranchTarget26MM(MCInst &Inst, unsigned Offset, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMemEVA(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
const MCOperand & getOperand(unsigned i) const
static DecodeStatus DecodeMSA128BRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeSynciR6(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMem(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
CHAIN = SC CHAIN, Imm128 - System call.
static DecodeStatus DecodeACC64DSPRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Target - Wrapper for Target specific information.
static DecodeStatus DecodeCOP0RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
static DecodeStatus DecodePOOL16BEncodedField(MCInst &Inst, unsigned Value, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeFGR32RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
Target & getTheMipsTarget()
static DecodeStatus DecodeGPRMM16ZeroRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeCCRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeBgtzGroupBranch(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeBranchTarget10MM(MCInst &Inst, unsigned Offset, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMSA128WRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeANDI16Imm(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeFMem2(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeBranchTarget1SImm16(MCInst &Inst, unsigned Offset, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeBranchTarget21MM(MCInst &Inst, unsigned Offset, uint64_t Address, const void *Decoder)
Generic base class for all target subtargets.
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
static DecodeStatus DecodeBranchTarget26(MCInst &Inst, unsigned Offset, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeCRC(MCInst &MI, InsnType Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeAddiGroupBranch(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static DecodeStatus DecodeGPRMM16MovePRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodePrefeOpMM(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
LLVM Value Representation.
static DecodeStatus DecodeFGRCCRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static DecodeStatus DecodeHI32DSPRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeJumpTarget(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
This class implements an extremely fast bulk output stream that can only output to a stream...
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
static DecodeStatus DecodeSimm9SP(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
void addOperand(const MCOperand &Op)
static DecodeStatus DecodeMemMMGPImm7Lsl2(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
unsigned getOpcode() const
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 DecodeMSACtrlRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeAddiur2Simm7(MCInst &Inst, unsigned Value, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMSA128HRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static MCOperand createImm(int64_t Val)
static DecodeStatus DecodeFMem3(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeDSPRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
const MCRegisterClass & getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.
static DecodeStatus DecodeMemMMImm16(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeBlezGroupBranch(MCInst &MI, InsnType insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeUImmWithOffset(MCInst &Inst, unsigned Value, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeLoadByte15(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)