39 IsN64(STI.
getFeatureBits() & Mips::FeatureN64), isBigEndian(bigEndian) {}
41 virtual ~MipsDisassemblerBase() {}
45 bool isN64()
const {
return IsN64; }
55 class MipsDisassembler :
public MipsDisassemblerBase {
62 MipsDisassemblerBase(STI, Info, bigEndian) {
77 class Mips64Disassembler :
public MipsDisassemblerBase {
83 MipsDisassemblerBase(STI, Info, bigEndian) {}
101 const void *Decoder);
106 const void *Decoder);
111 const void *Decoder);
116 const void *Decoder);
121 const void *Decoder);
126 const void *Decoder);
131 const void *Decoder);
136 const void *Decoder);
141 const void *Decoder);
146 const void *Decoder);
151 const void *Decoder);
156 const void *Decoder);
161 const void *Decoder);
166 const void *Decoder);
171 const void *Decoder);
176 const void *Decoder);
181 const void *Decoder);
186 const void *Decoder);
191 const void *Decoder);
196 const void *Decoder);
201 const void *Decoder);
206 const void *Decoder);
213 const void *Decoder);
220 const void *Decoder);
225 const void *Decoder);
228 uint64_t Address,
const void *Decoder);
233 const void *Decoder);
238 const void *Decoder);
242 const void *Decoder);
247 const void *Decoder);
254 const void *Decoder);
259 const void *Decoder);
264 const void *Decoder);
308 #include "MipsGenDisassemblerTables.inc"
321 if (region.
readBytes(address, 4, Bytes) == -1) {
328 insn = (Bytes[3] << 0) |
339 insn = (Bytes[2] << 0) |
344 insn = (Bytes[0] << 0) |
355 MipsDisassembler::getInstruction(
MCInst &instr,
364 Insn, isBigEndian, IsMicroMips);
391 Mips64Disassembler::getInstruction(
MCInst &instr,
400 Insn, isBigEndian,
false);
422 static unsigned getReg(
const void *D,
unsigned RC,
unsigned RegNo) {
423 const MipsDisassemblerBase *Dis =
static_cast<const MipsDisassemblerBase*
>(D);
424 return *(Dis->getRegInfo()->getRegClass(RC).begin() + RegNo);
430 const void *Decoder) {
439 const void *Decoder) {
444 unsigned Reg =
getReg(Decoder, Mips::GPR64RegClassID, RegNo);
452 const void *Decoder) {
455 unsigned Reg =
getReg(Decoder, Mips::GPR32RegClassID, RegNo);
463 const void *Decoder) {
464 if (static_cast<const MipsDisassembler *>(Decoder)->isN64())
473 const void *Decoder) {
480 const void *Decoder) {
484 unsigned Reg =
getReg(Decoder, Mips::FGR64RegClassID, RegNo);
492 const void *Decoder) {
496 unsigned Reg =
getReg(Decoder, Mips::FGR32RegClassID, RegNo);
504 const void *Decoder) {
508 unsigned Reg =
getReg(Decoder, Mips::FGRH32RegClassID, RegNo);
516 const void *Decoder) {
519 unsigned Reg =
getReg(Decoder, Mips::CCRRegClassID, RegNo);
527 const void *Decoder) {
530 unsigned Reg =
getReg(Decoder, Mips::FCCRegClassID, RegNo);
538 const void *Decoder) {
539 int Offset = SignExtend32<16>(Insn & 0xffff);
540 unsigned Reg = fieldFromInstruction(Insn, 16, 5);
541 unsigned Base = fieldFromInstruction(Insn, 21, 5);
543 Reg =
getReg(Decoder, Mips::GPR32RegClassID, Reg);
544 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
558 uint64_t Address,
const void *Decoder) {
559 int Offset = SignExtend32<10>(fieldFromInstruction(Insn, 16, 10));
560 unsigned Reg = fieldFromInstruction(Insn, 6, 5);
561 unsigned Base = fieldFromInstruction(Insn, 11, 5);
563 Reg =
getReg(Decoder, Mips::MSA128BRegClassID, Reg);
564 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
576 const void *Decoder) {
577 int Offset = SignExtend32<12>(Insn & 0x0fff);
578 unsigned Reg = fieldFromInstruction(Insn, 21, 5);
579 unsigned Base = fieldFromInstruction(Insn, 16, 5);
581 Reg =
getReg(Decoder, Mips::GPR32RegClassID, Reg);
582 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
594 const void *Decoder) {
595 int Offset = SignExtend32<16>(Insn & 0xffff);
596 unsigned Reg = fieldFromInstruction(Insn, 21, 5);
597 unsigned Base = fieldFromInstruction(Insn, 16, 5);
599 Reg =
getReg(Decoder, Mips::GPR32RegClassID, Reg);
600 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
612 const void *Decoder) {
613 int Offset = SignExtend32<16>(Insn & 0xffff);
614 unsigned Reg = fieldFromInstruction(Insn, 16, 5);
615 unsigned Base = fieldFromInstruction(Insn, 21, 5);
617 Reg =
getReg(Decoder, Mips::FGR64RegClassID, Reg);
618 Base =
getReg(Decoder, Mips::GPR32RegClassID, Base);
631 const void *Decoder) {
642 const void *Decoder) {
643 if (RegNo > 30 || RegNo %2)
647 unsigned Reg =
getReg(Decoder, Mips::AFGR64RegClassID, RegNo /2);
655 const void *Decoder) {
659 unsigned Reg =
getReg(Decoder, Mips::ACC64DSPRegClassID, RegNo);
667 const void *Decoder) {
671 unsigned Reg =
getReg(Decoder, Mips::HI32DSPRegClassID, RegNo);
679 const void *Decoder) {
683 unsigned Reg =
getReg(Decoder, Mips::LO32DSPRegClassID, RegNo);
691 const void *Decoder) {
695 unsigned Reg =
getReg(Decoder, Mips::MSA128BRegClassID, RegNo);
703 const void *Decoder) {
707 unsigned Reg =
getReg(Decoder, Mips::MSA128HRegClassID, RegNo);
715 const void *Decoder) {
719 unsigned Reg =
getReg(Decoder, Mips::MSA128WRegClassID, RegNo);
727 const void *Decoder) {
731 unsigned Reg =
getReg(Decoder, Mips::MSA128DRegClassID, RegNo);
739 const void *Decoder) {
743 unsigned Reg =
getReg(Decoder, Mips::MSACtrlRegClassID, RegNo);
751 const void *Decoder) {
752 unsigned BranchOffset = Offset & 0xffff;
753 BranchOffset = SignExtend32<18>(BranchOffset << 2) + 4;
761 const void *Decoder) {
763 unsigned JumpOffset = fieldFromInstruction(Insn, 0, 26) << 2;
771 const void *Decoder) {
772 unsigned BranchOffset = Offset & 0xffff;
773 BranchOffset = SignExtend32<18>(BranchOffset << 1);
781 const void *Decoder) {
782 unsigned JumpOffset = fieldFromInstruction(Insn, 0, 26) << 1;
790 const void *Decoder) {
798 const void *Decoder) {
807 const void *Decoder) {
810 int Size = (int) Insn - Pos + 1;
818 const void *Decoder) {
819 int Size = (int) Insn + 1;
static MCDisassembler * createMips64elDisassembler(const Target &T, const MCSubtargetInfo &STI)
static DecodeStatus DecodeJumpTargetMM(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeSimm16(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
const MCRegisterDesc & get(unsigned RegNo) const
Provide a get method, equivalent to [], but more useful with a pointer to this object.
static MCDisassembler * createMipselDisassembler(const Target &T, const MCSubtargetInfo &STI)
static MCOperand CreateReg(unsigned Reg)
static DecodeStatus DecodeCPU16RegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeBranchTarget(MCInst &Inst, unsigned Offset, 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 DecodeBranchTargetMM(MCInst &Inst, unsigned Offset, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeAFGR64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeFCCRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static void RegisterMCDisassembler(Target &T, Target::MCDisassemblerCtorTy Fn)
static DecodeStatus readInstruction32(const MemoryObject ®ion, uint64_t address, uint64_t &size, uint32_t &insn, bool isBigEndian, bool IsMicroMips)
static DecodeStatus DecodeMSA128Mem(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeGPR32RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
virtual int readBytes(uint64_t address, uint64_t size, uint8_t *buf) const
static DecodeStatus DecodeFMem(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 DecodeMSA128DRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMemMMImm12(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeHWRegsRegisterClass(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeExtSize(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
A single entry single exit Region.
static DecodeStatus DecodeFGR64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
void LLVMInitializeMipsDisassembler()
static DecodeStatus DecodeFGRH32RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodePtrRegisterClass(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static MCDisassembler * createMipsDisassembler(const Target &T, const MCSubtargetInfo &STI)
uint64_t getFeatureBits() const
static MCDisassembler * createMips64Disassembler(const Target &T, const MCSubtargetInfo &STI)
static DecodeStatus DecodeMSA128BRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMem(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeACC64DSPRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
unsigned getOpcode() const
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
static DecodeStatus DecodeFGR32RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
MCDisassembler::DecodeStatus DecodeStatus
static DecodeStatus DecodeCCRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeLSAImm(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMSA128WRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static MCOperand CreateImm(int64_t Val)
MCRegisterInfo * createMCRegInfo(StringRef Triple) const
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)
void addOperand(const MCOperand &Op)
static DecodeStatus DecodeMSACtrlRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMSA128HRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
const MCOperand & getOperand(unsigned i) const
static DecodeStatus DecodeDSPRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMemMMImm16(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
int decodeInstruction(struct InternalInstruction *insn, byteReader_t reader, const void *readerArg, dlog_t logger, void *loggerArg, const void *miiArg, uint64_t startLoc, DisassemblerMode mode)