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);
69 static unsigned getReg(
const void *
D,
unsigned RC,
unsigned RegNo) {
70 const XCoreDisassembler *Dis =
static_cast<const XCoreDisassembler*
>(
D);
71 const MCRegisterInfo *RegInfo = Dis->getContext().getRegisterInfo();
86 uint64_t
Address,
const void *Decoder);
89 uint64_t
Address,
const void *Decoder);
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);
144 const void *Decoder);
149 const void *Decoder);
154 const void *Decoder);
159 const void *Decoder);
164 const void *Decoder);
169 const void *Decoder);
174 const void *Decoder);
179 const void *Decoder);
184 const void *Decoder);
189 const void *Decoder);
194 const void *Decoder);
196 #include "XCoreGenDisassemblerTables.inc" 205 unsigned Reg =
getReg(Decoder, XCore::GRRegsRegClassID, RegNo);
217 unsigned Reg =
getReg(Decoder, XCore::RRegsRegClassID, RegNo);
223 uint64_t
Address,
const void *Decoder) {
226 static const unsigned Values[] = {
227 32 , 1, 2, 3, 4, 5, 6, 7, 8, 16, 24, 32
234 uint64_t
Address,
const void *Decoder) {
241 unsigned Combined = fieldFromInstruction(Insn, 6, 5);
244 if (fieldFromInstruction(Insn, 5, 1)) {
250 unsigned Op1High = Combined % 3;
251 unsigned Op2High = Combined / 3;
252 Op1 = (Op1High << 2) | fieldFromInstruction(Insn, 2, 2);
253 Op2 = (Op2High << 2) | fieldFromInstruction(Insn, 0, 2);
260 unsigned Combined = fieldFromInstruction(Insn, 6, 5);
264 unsigned Op1High = Combined % 3;
265 unsigned Op2High = (Combined / 3) % 3;
266 unsigned Op3High = Combined / 9;
267 Op1 = (Op1High << 2) | fieldFromInstruction(Insn, 4, 2);
268 Op2 = (Op2High << 2) | fieldFromInstruction(Insn, 2, 2);
269 Op3 = (Op3High << 2) | fieldFromInstruction(Insn, 0, 2);
275 const void *Decoder) {
277 unsigned Opcode = fieldFromInstruction(Insn, 11, 5);
345 const void *Decoder) {
358 const void *Decoder) {
371 const void *Decoder) {
384 const void *Decoder) {
398 const void *Decoder) {
411 const void *Decoder) {
424 const void *Decoder) {
438 const void *Decoder) {
440 unsigned Opcode = fieldFromInstruction(Insn, 16, 4) |
441 fieldFromInstruction(Insn, 27, 5) << 4;
509 const void *Decoder) {
523 const void *Decoder) {
537 const void *Decoder) {
538 unsigned Op1, Op2, Op3;
550 const void *Decoder) {
551 unsigned Op1, Op2, Op3;
563 const void *Decoder) {
564 unsigned Op1, Op2, Op3;
576 const void *Decoder) {
577 unsigned Op1, Op2, Op3;
589 const void *Decoder) {
590 unsigned Op1, Op2, Op3;
603 const void *Decoder) {
604 unsigned Op1, Op2, Op3;
618 const void *Decoder) {
619 unsigned Op1, Op2, Op3;
632 const void *Decoder) {
633 unsigned Op1, Op2, Op3;
646 const void *Decoder) {
647 unsigned Op1, Op2, Op3, Op4, Op5, Op6;
666 const void *Decoder) {
669 unsigned Opcode = fieldFromInstruction(Insn, 27, 5);
680 const void *Decoder) {
681 unsigned Op1, Op2, Op3, Op4, Op5;
700 const void *Decoder) {
701 unsigned Op1, Op2, Op3;
702 unsigned Op4 = fieldFromInstruction(Insn, 16, 4);
719 const void *Decoder) {
720 unsigned Op1, Op2, Op3;
721 unsigned Op4 = fieldFromInstruction(Insn, 16, 4);
738 XCoreDisassembler::getInstruction(
MCInst &instr, uint64_t &
Size,
748 DecodeStatus Result = decodeInstruction(DecoderTable16, instr, insn16,
750 if (Result !=
Fail) {
762 Result = decodeInstruction(DecoderTable32, instr, insn32,
Address,
this, STI);
763 if (Result !=
Fail) {
774 return new XCoreDisassembler(STI, Ctx);
static DecodeStatus DecodeRRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
iterator begin() const
begin/end - Return all of the registers in this class.
static DecodeStatus DecodeL6RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
This class represents lattice values for constants.
DecodeStatus
Ternary decode status.
Superclass for all disassemblers.
static DecodeStatus DecodeL2RUSInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeXCoreDisassembler()
static DecodeStatus DecodeL4RSrcDstInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeRUSInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static void RegisterMCDisassembler(Target &T, Target::MCDisassemblerCtorTy Fn)
RegisterMCDisassembler - Register a MCDisassembler implementation for the given target.
static DecodeStatus DecodeL3RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static MCDisassembler * createXCoreDisassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
static MCOperand createReg(unsigned Reg)
static DecodeStatus DecodeGRRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeL3RSrcDstInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus Decode3OpInstruction(unsigned Insn, unsigned &Op1, unsigned &Op2, unsigned &Op3)
static DecodeStatus DecodeNegImmOperand(MCInst &Inst, unsigned Val, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeBitpOperand(MCInst &Inst, unsigned Val, uint64_t Address, const void *Decoder)
static DecodeStatus Decode3RImmInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
Context object for machine code objects.
static DecodeStatus Decode2RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus Decode2RUSInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
Instances of this class represent a single low-level machine instruction.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
static bool readInstruction32(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint32_t &Insn)
size_t size() const
size - Get the array size.
static DecodeStatus DecodeL2RUSBitpInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeRUSBitpInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeL2OpInstructionFail(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus Decode2RSrcDstInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus Decode2RImmInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeL5RInstructionFail(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
Target & getTheXCoreTarget()
void setOpcode(unsigned Op)
static DecodeStatus Decode2OpInstructionFail(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus Decode2OpInstruction(unsigned Insn, unsigned &Op1, unsigned &Op2)
static DecodeStatus DecodeL4RSrcDstSrcDstInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
#define LLVM_EXTERNAL_VISIBILITY
static DecodeStatus DecodeL5RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
Target - Wrapper for Target specific information.
static DecodeStatus DecodeRUSSrcDstBitpInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus Decode2RUSBitpInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static bool readInstruction16(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint16_t &Insn)
static DecodeStatus DecodeR2RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
Generic base class for all target subtargets.
static DecodeStatus DecodeLR2RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
MCDisassembler::DecodeStatus DecodeStatus
static DecodeStatus Decode3RInstruction(MCInst &Inst, unsigned Insn, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeL2RInstruction(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...
void addOperand(const MCOperand &Op)
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
static MCOperand createImm(int64_t Val)
const MCRegisterClass & getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.