26#define DEBUG_TYPE "xcore-disassembler"
47 if (Bytes.
size() < 2) {
52 Insn = (Bytes[0] << 0) | (Bytes[1] << 8);
59 if (Bytes.
size() < 4) {
65 (Bytes[0] << 0) | (Bytes[1] << 8) | (Bytes[2] << 16) | (Bytes[3] << 24);
71 return *(
RegInfo->getRegClass(RC).begin() + RegNo);
174#include "XCoreGenDisassemblerTables.inc"
181 unsigned Reg =
getReg(Decoder, XCore::GRRegsRegClassID, RegNo);
191 unsigned Reg =
getReg(Decoder, XCore::RRegsRegClassID, RegNo);
201 static const unsigned Values[] = {
202 32 , 1, 2, 3, 4, 5, 6, 7, 8, 16, 24, 32
217 unsigned Combined = fieldFromInstruction(
Insn, 6, 5);
220 if (fieldFromInstruction(
Insn, 5, 1)) {
226 unsigned Op1High = Combined % 3;
227 unsigned Op2High = Combined / 3;
228 Op1 = (Op1High << 2) | fieldFromInstruction(
Insn, 2, 2);
229 Op2 = (Op2High << 2) | fieldFromInstruction(
Insn, 0, 2);
236 unsigned Combined = fieldFromInstruction(
Insn, 6, 5);
240 unsigned Op1High = Combined % 3;
241 unsigned Op2High = (Combined / 3) % 3;
242 unsigned Op3High = Combined / 9;
243 Op1 = (Op1High << 2) | fieldFromInstruction(
Insn, 4, 2);
244 Op2 = (Op2High << 2) | fieldFromInstruction(
Insn, 2, 2);
245 Op3 = (Op3High << 2) | fieldFromInstruction(
Insn, 0, 2);
253 unsigned Opcode = fieldFromInstruction(
Insn, 11, 5);
416 unsigned Opcode = fieldFromInstruction(
Insn, 16, 4) |
417 fieldFromInstruction(
Insn, 27, 5) << 4;
514 unsigned Op1, Op2, Op3;
527 unsigned Op1, Op2, Op3;
540 unsigned Op1, Op2, Op3;
553 unsigned Op1, Op2, Op3;
566 unsigned Op1, Op2, Op3;
580 unsigned Op1, Op2, Op3;
595 unsigned Op1, Op2, Op3;
609 unsigned Op1, Op2, Op3;
623 unsigned Op1, Op2, Op3, Op4, Op5, Op6;
645 unsigned Opcode = fieldFromInstruction(
Insn, 27, 5);
657 unsigned Op1, Op2, Op3, Op4, Op5;
677 unsigned Op1, Op2, Op3;
678 unsigned Op4 = fieldFromInstruction(
Insn, 16, 4);
696 unsigned Op1, Op2, Op3;
697 unsigned Op4 = fieldFromInstruction(
Insn, 16, 4);
726 if (Result !=
Fail) {
738 Result = decodeInstruction(DecoderTable32,
instr, insn32, Address,
this, STI);
739 if (Result !=
Fail) {
750 return new XCoreDisassembler(STI, Ctx);
SmallVector< AArch64_IMM::ImmInsnModel, 4 > Insn
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
#define LLVM_EXTERNAL_VISIBILITY
static MCDisassembler * createXCoreDisassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
static DecodeStatus Decode2RUSBitpInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeL2RUSBitpInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeRUSInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeLR2RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static unsigned getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo)
MCDisassembler::DecodeStatus DecodeStatus
static DecodeStatus DecodeL4RSrcDstSrcDstInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeRUSSrcDstBitpInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeL2RUSInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeL4RSrcDstInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeBitpOperand(MCInst &Inst, unsigned Val, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeL3RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeL2OpInstructionFail(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus Decode2RUSInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeL3RSrcDstInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeL5RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeR2RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus Decode3OpInstruction(unsigned Insn, unsigned &Op1, unsigned &Op2, unsigned &Op3)
static DecodeStatus DecodeL2RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus Decode3RImmInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus Decode2RImmInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeRRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGRRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const MCDisassembler *Decoder)
static bool readInstruction32(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint32_t &Insn)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeXCoreDisassembler()
static DecodeStatus DecodeL5RInstructionFail(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus Decode2RSrcDstInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeRUSBitpInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeL6RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus Decode2OpInstructionFail(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus Decode2OpInstruction(unsigned Insn, unsigned &Op1, unsigned &Op2)
static DecodeStatus DecodeNegImmOperand(MCInst &Inst, unsigned Val, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus Decode2RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
static bool readInstruction16(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint16_t &Insn)
static DecodeStatus Decode3RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const MCDisassembler *Decoder)
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.
virtual DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size, ArrayRef< uint8_t > Bytes, uint64_t Address, raw_ostream &CStream) const =0
Returns the disassembly of a single instruction.
Instances of this class represent a single low-level machine instruction.
void addOperand(const MCOperand Op)
void setOpcode(unsigned Op)
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.
Target - Wrapper for Target specific information.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
Target & getTheXCoreTarget()
static void RegisterMCDisassembler(Target &T, Target::MCDisassemblerCtorTy Fn)
RegisterMCDisassembler - Register a MCDisassembler implementation for the given target.