26 #define DEBUG_TYPE "xcore-disassembler" 46 uint64_t &
Size, uint16_t &Insn) {
48 if (Bytes.
size() < 2) {
53 Insn = (Bytes[0] << 0) | (Bytes[1] << 8);
60 if (Bytes.
size() < 4) {
66 (Bytes[0] << 0) | (Bytes[1] << 8) | (Bytes[2] << 16) | (Bytes[3] << 24);
70 static unsigned getReg(
const void *
D,
unsigned RC,
unsigned RegNo) {
71 const XCoreDisassembler *Dis =
static_cast<const XCoreDisassembler*
>(
D);
72 const MCRegisterInfo *RegInfo = Dis->getContext().getRegisterInfo();
87 uint64_t
Address,
const void *Decoder);
90 uint64_t
Address,
const void *Decoder);
100 const void *Decoder);
105 const void *Decoder);
110 const void *Decoder);
115 const void *Decoder);
120 const void *Decoder);
125 const void *Decoder);
130 const void *Decoder);
135 const void *Decoder);
140 const void *Decoder);
145 const void *Decoder);
150 const void *Decoder);
155 const void *Decoder);
160 const void *Decoder);
165 const void *Decoder);
170 const void *Decoder);
175 const void *Decoder);
180 const void *Decoder);
185 const void *Decoder);
190 const void *Decoder);
195 const void *Decoder);
197 #include "XCoreGenDisassemblerTables.inc" 206 unsigned Reg =
getReg(Decoder, XCore::GRRegsRegClassID, RegNo);
218 unsigned Reg =
getReg(Decoder, XCore::RRegsRegClassID, RegNo);
224 uint64_t
Address,
const void *Decoder) {
227 static const unsigned Values[] = {
228 32 , 1, 2, 3, 4, 5, 6, 7, 8, 16, 24, 32
235 uint64_t
Address,
const void *Decoder) {
242 unsigned Combined = fieldFromInstruction(Insn, 6, 5);
245 if (fieldFromInstruction(Insn, 5, 1)) {
251 unsigned Op1High = Combined % 3;
252 unsigned Op2High = Combined / 3;
253 Op1 = (Op1High << 2) | fieldFromInstruction(Insn, 2, 2);
254 Op2 = (Op2High << 2) | fieldFromInstruction(Insn, 0, 2);
261 unsigned Combined = fieldFromInstruction(Insn, 6, 5);
265 unsigned Op1High = Combined % 3;
266 unsigned Op2High = (Combined / 3) % 3;
267 unsigned Op3High = Combined / 9;
268 Op1 = (Op1High << 2) | fieldFromInstruction(Insn, 4, 2);
269 Op2 = (Op2High << 2) | fieldFromInstruction(Insn, 2, 2);
270 Op3 = (Op3High << 2) | fieldFromInstruction(Insn, 0, 2);
276 const void *Decoder) {
278 unsigned Opcode = fieldFromInstruction(Insn, 11, 5);
346 const void *Decoder) {
359 const void *Decoder) {
372 const void *Decoder) {
385 const void *Decoder) {
399 const void *Decoder) {
412 const void *Decoder) {
425 const void *Decoder) {
439 const void *Decoder) {
441 unsigned Opcode = fieldFromInstruction(Insn, 16, 4) |
442 fieldFromInstruction(Insn, 27, 5) << 4;
510 const void *Decoder) {
524 const void *Decoder) {
538 const void *Decoder) {
539 unsigned Op1, Op2, Op3;
551 const void *Decoder) {
552 unsigned Op1, Op2, Op3;
564 const void *Decoder) {
565 unsigned Op1, Op2, Op3;
577 const void *Decoder) {
578 unsigned Op1, Op2, Op3;
590 const void *Decoder) {
591 unsigned Op1, Op2, Op3;
604 const void *Decoder) {
605 unsigned Op1, Op2, Op3;
619 const void *Decoder) {
620 unsigned Op1, Op2, Op3;
633 const void *Decoder) {
634 unsigned Op1, Op2, Op3;
647 const void *Decoder) {
648 unsigned Op1, Op2, Op3, Op4, Op5, Op6;
667 const void *Decoder) {
670 unsigned Opcode = fieldFromInstruction(Insn, 27, 5);
681 const void *Decoder) {
682 unsigned Op1, Op2, Op3, Op4, Op5;
701 const void *Decoder) {
702 unsigned Op1, Op2, Op3;
703 unsigned Op4 = fieldFromInstruction(Insn, 16, 4);
720 const void *Decoder) {
721 unsigned Op1, Op2, Op3;
722 unsigned Op4 = fieldFromInstruction(Insn, 16, 4);
750 if (Result !=
Fail) {
763 if (Result !=
Fail) {
778 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)
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.
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 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")
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)
void LLVMInitializeXCoreDisassembler()
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.