LLVM 24.0.0git
XtensaDisassembler.cpp
Go to the documentation of this file.
1//===-- XtensaDisassembler.cpp - Disassembler for Xtensa ------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6// See https://llvm.org/LICENSE.txt for license information.
7// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8//
9//===----------------------------------------------------------------------===//
10//
11// This file implements the XtensaDisassembler class.
12//
13//===----------------------------------------------------------------------===//
14
17#include "llvm/MC/MCContext.h"
18#include "llvm/MC/MCDecoder.h"
21#include "llvm/MC/MCInst.h"
25#include "llvm/Support/Endian.h"
26
27using namespace llvm;
28using namespace llvm::MCD;
29
30#define DEBUG_TYPE "Xtensa-disassembler"
31
33
34namespace {
35
36class XtensaDisassembler : public MCDisassembler {
37 bool IsLittleEndian;
38
39public:
40 XtensaDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx, bool isLE)
41 : MCDisassembler(STI, Ctx), IsLittleEndian(isLE) {}
42
43 bool hasDensity() const { return STI.hasFeature(Xtensa::FeatureDensity); }
44
45 bool hasESP32S3Ops() const {
46 return STI.getFeatureBits()[Xtensa::FeatureESP32S3Ops];
47 }
48
49 DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size,
50 ArrayRef<uint8_t> Bytes, uint64_t Address,
51 raw_ostream &CStream) const override;
52};
53} // end anonymous namespace
54
56 const MCSubtargetInfo &STI,
57 MCContext &Ctx) {
58 return new XtensaDisassembler(STI, Ctx, true);
59}
60
65
67 Xtensa::A0, Xtensa::SP, Xtensa::A2, Xtensa::A3, Xtensa::A4, Xtensa::A5,
68 Xtensa::A6, Xtensa::A7, Xtensa::A8, Xtensa::A9, Xtensa::A10, Xtensa::A11,
69 Xtensa::A12, Xtensa::A13, Xtensa::A14, Xtensa::A15};
70
72 uint64_t Address,
73 const void *Decoder) {
74 if (RegNo >= std::size(ARDecoderTable))
76
80}
81
83 uint64_t Address,
84 const void *Decoder) {
85 if (RegNo > 3)
87
88 MCPhysReg Reg = Xtensa::M0 + RegNo;
91}
92
94 uint64_t Address,
95 const void *Decoder) {
96 if (RegNo > 1)
98
99 MCPhysReg Reg = Xtensa::M0 + RegNo;
102}
103
105 uint64_t Address,
106 const void *Decoder) {
107 if (RegNo > 1)
109
110 MCPhysReg Reg = Xtensa::M2 + RegNo;
113}
114
115static const unsigned QRDecoderTable[] = {Xtensa::Q0, Xtensa::Q1, Xtensa::Q2,
116 Xtensa::Q3, Xtensa::Q4, Xtensa::Q5,
117 Xtensa::Q6, Xtensa::Q7};
118
120 uint64_t Address,
121 const void *Decoder) {
122 if (RegNo >= std::size(QRDecoderTable))
124
125 unsigned Reg = QRDecoderTable[RegNo];
128}
129
131 uint64_t Address,
132 const void *Decoder) {
133 if (RegNo > 15)
135
136 MCPhysReg Reg = Xtensa::F0 + RegNo;
139}
140
142 uint64_t Address,
143 const MCDisassembler *Decoder) {
144 if (RegNo > 255)
146
147 Xtensa::RegisterAccessType RAType = Inst.getOpcode() == Xtensa::WUR
150
151 const XtensaDisassembler *Dis =
152 static_cast<const XtensaDisassembler *>(Decoder);
153 const MCRegisterInfo *MRI = Dis->getContext().getRegisterInfo();
155 if (!Xtensa::checkRegister(Reg, Decoder->getSubtargetInfo().getFeatureBits(),
156 RAType))
158
161}
162
167
169 {Xtensa::LBEG, 0}, {Xtensa::LEND, 1},
170 {Xtensa::LCOUNT, 2}, {Xtensa::SAR, 3},
171 {Xtensa::BREG, 4}, {Xtensa::LITBASE, 5},
172 {Xtensa::SCOMPARE1, 12}, {Xtensa::ACCLO, 16},
173 {Xtensa::ACCHI, 17}, {Xtensa::M0, 32},
174 {Xtensa::M1, 33}, {Xtensa::M2, 34},
175 {Xtensa::M3, 35}, {Xtensa::WINDOWBASE, 72},
176 {Xtensa::WINDOWSTART, 73}, {Xtensa::IBREAKENABLE, 96},
177 {Xtensa::MEMCTL, 97}, {Xtensa::ATOMCTL, 99},
178 {Xtensa::DDR, 104}, {Xtensa::IBREAKA0, 128},
179 {Xtensa::IBREAKA1, 129}, {Xtensa::DBREAKA0, 144},
180 {Xtensa::DBREAKA1, 145}, {Xtensa::DBREAKC0, 160},
181 {Xtensa::DBREAKC1, 161}, {Xtensa::CONFIGID0, 176},
182 {Xtensa::EPC1, 177}, {Xtensa::EPC2, 178},
183 {Xtensa::EPC3, 179}, {Xtensa::EPC4, 180},
184 {Xtensa::EPC5, 181}, {Xtensa::EPC6, 182},
185 {Xtensa::EPC7, 183}, {Xtensa::DEPC, 192},
186 {Xtensa::EPS2, 194}, {Xtensa::EPS3, 195},
187 {Xtensa::EPS4, 196}, {Xtensa::EPS5, 197},
188 {Xtensa::EPS6, 198}, {Xtensa::EPS7, 199},
189 {Xtensa::CONFIGID1, 208}, {Xtensa::EXCSAVE1, 209},
190 {Xtensa::EXCSAVE2, 210}, {Xtensa::EXCSAVE3, 211},
191 {Xtensa::EXCSAVE4, 212}, {Xtensa::EXCSAVE5, 213},
192 {Xtensa::EXCSAVE6, 214}, {Xtensa::EXCSAVE7, 215},
193 {Xtensa::CPENABLE, 224}, {Xtensa::INTERRUPT, 226},
194 {Xtensa::INTCLEAR, 227}, {Xtensa::INTENABLE, 228},
195 {Xtensa::PS, 230}, {Xtensa::VECBASE, 231},
196 {Xtensa::EXCCAUSE, 232}, {Xtensa::DEBUGCAUSE, 233},
197 {Xtensa::CCOUNT, 234}, {Xtensa::PRID, 235},
198 {Xtensa::ICOUNT, 236}, {Xtensa::ICOUNTLEVEL, 237},
199 {Xtensa::EXCVADDR, 238}, {Xtensa::CCOMPARE0, 240},
200 {Xtensa::CCOMPARE1, 241}, {Xtensa::CCOMPARE2, 242},
201 {Xtensa::MISC0, 244}, {Xtensa::MISC1, 245},
202 {Xtensa::MISC2, 246}, {Xtensa::MISC3, 247}};
203
205 uint64_t Address,
206 const MCDisassembler *Decoder) {
207 if (RegNo > 255)
209
211 Inst.getOpcode() == Xtensa::WSR
213 : (Inst.getOpcode() == Xtensa::RSR ? Xtensa::REGISTER_READ
215
216 for (unsigned i = 0; i < std::size(SRDecoderTable); i++) {
217 if (SRDecoderTable[i].RegNo == RegNo) {
219
220 // Handle special case. The INTERRUPT/INTSET registers use the same
221 // encoding, but INTERRUPT used for read and INTSET for write.
222 if (Reg == Xtensa::INTERRUPT && RAType == Xtensa::REGISTER_WRITE) {
223 Reg = Xtensa::INTSET;
224 }
225
227 Reg, Decoder->getSubtargetInfo().getFeatureBits(), RAType))
229
232 }
233 }
234
236}
237
239 uint64_t Address,
240 const void *Decoder) {
241 if (RegNo > 15)
243
244 MCPhysReg Reg = Xtensa::B0 + RegNo;
247}
248
249static bool tryAddingSymbolicOperand(int64_t Value, bool isBranch,
250 uint64_t Address, uint64_t Offset,
251 uint64_t InstSize, MCInst &MI,
252 const void *Decoder) {
253 const MCDisassembler *Dis = static_cast<const MCDisassembler *>(Decoder);
254 return Dis->tryAddingSymbolicOperand(MI, Value, Address, isBranch, Offset,
255 /*OpSize=*/0, InstSize);
256}
257
259 int64_t Address, const void *Decoder) {
260 assert(isUInt<18>(Imm) && "Invalid immediate");
261 Inst.addOperand(
262 MCOperand::createImm(SignExtend64<20>(Imm << 2) + (Address & 0x3)));
264}
265
267 int64_t Address, const void *Decoder) {
268 assert(isUInt<18>(Imm) && "Invalid immediate");
271}
272
274 int64_t Address, const void *Decoder) {
275 switch (Inst.getOpcode()) {
276 case Xtensa::BEQZ:
277 case Xtensa::BGEZ:
278 case Xtensa::BLTZ:
279 case Xtensa::BNEZ:
280 assert(isUInt<12>(Imm) && "Invalid immediate");
281 if (!tryAddingSymbolicOperand(SignExtend64<12>(Imm) + 4 + Address, true,
282 Address, 0, 3, Inst, Decoder))
284 break;
285 default:
286 assert(isUInt<8>(Imm) && "Invalid immediate");
287 if (!tryAddingSymbolicOperand(SignExtend64<8>(Imm) + 4 + Address, true,
288 Address, 0, 3, Inst, Decoder))
290 }
292}
293
295 int64_t Address, const void *Decoder) {
296
297 assert(isUInt<8>(Imm) && "Invalid immediate");
298 if (!tryAddingSymbolicOperand(Imm + 4 + Address, true, Address, 0, 3, Inst,
299 Decoder))
302}
303
305 int64_t Address, const void *Decoder) {
306
307 assert(isUInt<16>(Imm) && "Invalid immediate");
309 SignExtend64<17>((Imm << 2) + 0x40000 + (Address & 0x3))));
311}
312
314 int64_t Address, const void *Decoder) {
315 assert(isUInt<8>(Imm) && "Invalid immediate");
318}
319
321 int64_t Address,
322 const void *Decoder) {
323 assert(isUInt<8>(Imm) && "Invalid immediate");
326}
327
329 int64_t Address, const void *Decoder) {
330 assert(isUInt<12>(Imm) && "Invalid immediate");
333}
334
336 int64_t Address, const void *Decoder) {
337 assert(isUInt<4>(Imm) && "Invalid immediate");
340}
341
343 int64_t Address, const void *Decoder) {
344 assert(isUInt<5>(Imm) && "Invalid immediate");
347}
348
350 int64_t Address, const void *Decoder) {
351 assert(isUInt<4>(Imm) && "Invalid immediate");
354}
355
357 int64_t Address,
358 const void *Decoder) {
359 assert(isUInt<4>(Imm) && "Invalid immediate");
360 if (!Imm)
362 else
365}
366
368 int64_t Address,
369 const void *Decoder) {
370 assert(isUInt<7>(Imm) && "Invalid immediate");
371 if ((Imm & 0x60) == 0x60)
372 Inst.addOperand(MCOperand::createImm((~0x1f) | Imm));
373 else
376}
377
379 int64_t Address, const void *Decoder) {
380 assert(isUInt<4>(Imm) && "Invalid immediate");
381 Inst.addOperand(MCOperand::createImm(Imm > 7 ? Imm - 16 : Imm));
383}
384
386 int64_t Address,
387 const void *Decoder) {
388 assert(isUInt<6>(Imm) && ((Imm & 0x3) == 0) && "Invalid immediate");
389 Inst.addOperand(MCOperand::createImm((~0x3f) | (Imm)));
391}
392
394 int64_t Address,
395 const void *Decoder) {
396 assert(isUInt<15>(Imm) && ((Imm & 0x7) == 0) && "Invalid immediate");
399}
400
402 int64_t Address,
403 const void *Decoder) {
404 assert(isUInt<5>(Imm) && "Invalid immediate");
407}
408
409static int64_t TableB4const[16] = {-1, 1, 2, 3, 4, 5, 6, 7,
410 8, 10, 12, 16, 32, 64, 128, 256};
412 int64_t Address, const void *Decoder) {
413 assert(isUInt<4>(Imm) && "Invalid immediate");
414
417}
418
419static int64_t TableB4constu[16] = {32768, 65536, 2, 3, 4, 5, 6, 7,
420 8, 10, 12, 16, 32, 64, 128, 256};
422 int64_t Address,
423 const void *Decoder) {
424 assert(isUInt<4>(Imm) && "Invalid immediate");
425
428}
429
431 int64_t Address, const void *Decoder) {
432 assert(isUInt<4>(Imm) && "Invalid immediate");
435}
436
438 int64_t Address,
439 const void *Decoder) {
440 assert(isUInt<8>(Imm) && "Invalid immediate");
443}
444
446 int64_t Address,
447 const void *Decoder) {
448 assert(isUInt<8>(Imm) && "Invalid immediate");
451}
452
454 int64_t Address,
455 const void *Decoder) {
456 assert(isUInt<8>(Imm) && "Invalid immediate");
459}
460
462 int64_t Address,
463 const void *Decoder) {
464 assert(isUInt<8>(Imm) && "Invalid immediate");
467}
468
470 int64_t Address,
471 const void *Decoder) {
472 assert(isUInt<8>(Imm) && "Invalid immediate");
475}
476
478 int64_t Address,
479 const void *Decoder) {
480 assert(isInt<8>(Imm) && "Invalid immediate");
481 if ((Imm & 0xf) != 0)
483 else
486}
487
489 int64_t Address,
490 const void *Decoder) {
491 assert(isInt<16>(Imm) && "Invalid immediate");
492 if ((Imm & 0x7) != 0)
494 else
497}
498
500 int64_t Address,
501 const void *Decoder) {
502 assert(isInt<16>(Imm) && "Invalid immediate");
503 if ((Imm & 0xf) != 0)
505 else
508}
509
511 int64_t Address,
512 const void *Decoder) {
513 assert(isInt<16>(Imm) && "Invalid immediate");
514 if ((Imm & 0x2) != 0)
516 else
519}
520
522 int64_t Address,
523 const void *Decoder) {
524 assert(isUInt<8>(Imm) && "Invalid immediate");
525 if ((Imm & 0x1) != 0)
527 else
530}
531
533 int64_t Address,
534 const void *Decoder) {
535 assert(isUInt<8>(Imm) && "Invalid immediate");
538}
539
541 int64_t Address,
542 const void *Decoder) {
543 assert(isInt<16>(Imm) && "Invalid immediate");
544 if ((Imm & 0xf) != 0)
546 else
549}
550
552 int64_t Address, const void *Decoder) {
553 assert(isUInt<12>(Imm) && "Invalid immediate");
554 DecodeARRegisterClass(Inst, Imm & 0xf, Address, Decoder);
555 Inst.addOperand(MCOperand::createImm((Imm >> 4) & 0xff));
557}
558
560 int64_t Address, const void *Decoder) {
561 assert(isUInt<12>(Imm) && "Invalid immediate");
562 DecodeARRegisterClass(Inst, Imm & 0xf, Address, Decoder);
563 Inst.addOperand(MCOperand::createImm((Imm >> 3) & 0x1fe));
565}
566
568 int64_t Address, const void *Decoder) {
569 assert(isUInt<12>(Imm) && "Invalid immediate");
570 DecodeARRegisterClass(Inst, Imm & 0xf, Address, Decoder);
571 Inst.addOperand(MCOperand::createImm((Imm >> 2) & 0x3fc));
573}
574
576 int64_t Address, const void *Decoder) {
577 assert(isUInt<8>(Imm) && "Invalid immediate");
578 DecodeARRegisterClass(Inst, Imm & 0xf, Address, Decoder);
579 Inst.addOperand(MCOperand::createImm((Imm >> 2) & 0x3c));
581}
582
583/// Read two bytes from the ArrayRef and return 16 bit data sorted
584/// according to the given endianness.
586 uint64_t &Size, uint64_t &Insn,
587 bool IsLittleEndian) {
588 // We want to read exactly 2 Bytes of data.
589 if (Bytes.size() < 2) {
590 Size = 0;
592 }
593
594 if (!IsLittleEndian) {
595 report_fatal_error("Big-endian mode currently is not supported!");
596 } else {
597 Insn = (Bytes[1] << 8) | Bytes[0];
598 }
599
601}
602
603/// Read three bytes from the ArrayRef and return 24 bit data
605 uint64_t &Size, uint64_t &Insn,
606 bool IsLittleEndian,
607 bool CheckTIE = false) {
608 // We want to read exactly 3 Bytes of data.
609 if (Bytes.size() < 3) {
610 Size = 0;
612 }
613
614 if (!IsLittleEndian) {
615 report_fatal_error("Big-endian mode currently is not supported!");
616 } else {
617 if (CheckTIE && (Bytes[0] & 0x8) != 0)
619 Insn = (Bytes[2] << 16) | (Bytes[1] << 8) | (Bytes[0] << 0);
620 }
621
623}
624
625/// Read four bytes from the ArrayRef and return 32 bit data
627 uint64_t &Size, uint64_t &Insn,
628 bool IsLittleEndian) {
629 // We want to read exactly 4 Bytes of data.
630 if (Bytes.size() < 4) {
631 Size = 0;
633 }
634
635 if (!IsLittleEndian) {
636 report_fatal_error("Big-endian mode currently is not supported!");
637 } else {
638 if ((Bytes[0] & 0x8) == 0)
640 Insn =
641 (Bytes[3] << 24) | (Bytes[2] << 16) | (Bytes[1] << 8) | (Bytes[0] << 0);
642 }
643
645}
646
647#include "XtensaGenDisassemblerTables.inc"
648
649DecodeStatus XtensaDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
650 ArrayRef<uint8_t> Bytes,
651 uint64_t Address,
652 raw_ostream &CS) const {
653 uint64_t Insn;
655
656 // Parse 16-bit instructions
657 if (hasDensity()) {
658 Result = readInstruction16(Bytes, Address, Size, Insn, IsLittleEndian);
659 if (Result == MCDisassembler::Fail)
661 LLVM_DEBUG(dbgs() << "Trying Xtensa 16-bit instruction table :\n");
662 Result = decodeInstruction(DecoderTable16, MI, Insn, Address, this, STI);
663 if (Result != MCDisassembler::Fail) {
664 Size = 2;
665 return Result;
666 }
667 }
668
669 // Parse Core 24-bit instructions
670 Result = readInstruction24(Bytes, Address, Size, Insn, IsLittleEndian);
671 if (Result == MCDisassembler::Fail)
673 LLVM_DEBUG(dbgs() << "Trying Xtensa 24-bit instruction table :\n");
674 Result = decodeInstruction(DecoderTable24, MI, Insn, Address, this, STI);
675 if (Result != MCDisassembler::Fail) {
676 Size = 3;
677 return Result;
678 }
679
680 if (hasESP32S3Ops()) {
681 // Parse ESP32S3 24-bit instructions
682 Result =
683 readInstruction24(Bytes, Address, Size, Insn, IsLittleEndian, true);
684 if (Result != MCDisassembler::Fail) {
685 LLVM_DEBUG(dbgs() << "Trying ESP32S3 table (24-bit opcodes):\n");
686 Result = decodeInstruction(DecoderTableESP32S324, MI, Insn, Address, this,
687 STI);
688 if (Result != MCDisassembler::Fail) {
689 Size = 3;
690 return Result;
691 }
692 }
693
694 // Parse ESP32S3 32-bit instructions
695 Result = readInstruction32(Bytes, Address, Size, Insn, IsLittleEndian);
696 if (Result == MCDisassembler::Fail)
698 LLVM_DEBUG(dbgs() << "Trying ESP32S3 table (32-bit opcodes):\n");
699 Result =
700 decodeInstruction(DecoderTableESP32S332, MI, Insn, Address, this, STI);
701 if (Result != MCDisassembler::Fail) {
702 Size = 4;
703 return Result;
704 }
705 }
706
707 return Result;
708}
MCDisassembler::DecodeStatus DecodeStatus
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
unsigned Imm
unsigned uint64_t
unsigned const MCDisassembler * Decoder
static bool readInstruction16(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint32_t &Insn)
static bool readInstruction32(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint32_t &Insn)
#define LLVM_EXTERNAL_VISIBILITY
Definition Compiler.h:132
IRTranslator LLVM IR MI
Register Reg
#define T
static bool isBranch(unsigned Opcode)
#define LLVM_DEBUG(...)
Definition Debug.h:119
static DecodeStatus decodeMem16Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeOffset_16_16Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeOffset_128_2Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeSelect_2Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus DecodeMR23RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus DecodeMRRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
static const unsigned QRDecoderTable[]
static DecodeStatus decodeOffset_256_16Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static int64_t TableB4const[16]
static DecodeStatus decodeImm1n_15Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeOffset_128_1Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeSelect_16Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeOffset_256_4Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus DecodeFPRRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeXtensaDisassembler()
static DecodeStatus DecodeMR01RegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus decodeImm8_sh8Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeImm8Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeL32ROperand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeEntry_Imm12OpValue(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeMem32nOperand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeImm12Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus DecodeARRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
static bool tryAddingSymbolicOperand(int64_t Value, bool isBranch, uint64_t Address, uint64_t Offset, uint64_t InstSize, MCInst &MI, const void *Decoder)
const MCPhysReg ARDecoderTable[]
static DecodeStatus decodeMem32Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeUimm4Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus DecodeURRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodeSelect_256Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeImm64n_4nOperand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeImm1_16Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus readInstruction24(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint64_t &Insn, bool IsLittleEndian, bool CheckTIE=false)
Read three bytes from the ArrayRef and return 24 bit data.
static DecodeStatus decodeMem8Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus DecodeQRRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus decodeImm7_22Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeUimm5Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeImm32n_95Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus readInstruction16(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint64_t &Insn, bool IsLittleEndian)
Read two bytes from the ArrayRef and return 16 bit data sorted according to the given endianness.
static DecodeStatus decodeSelect_4Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static MCDisassembler * createXtensaDisassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
static DecodeStatus decodeOffset_256_8Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeCallOperand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeB4constuOperand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeB4constOperand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeImm8n_7Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static int64_t TableB4constu[16]
static DecodeStatus DecodeSRRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodeOffset_64_16Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus DecodeBRRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
static DecodeStatus decodeShimm1_31Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeSelect_8Operand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeLoopOperand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeJumpOperand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
static DecodeStatus decodeBranchOperand(MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
const DecodeRegister SRDecoderTable[]
static DecodeStatus readInstruction32(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint64_t &Insn, bool IsLittleEndian)
Read four bytes from the ArrayRef and return 32 bit data.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
size_t size() const
Get the array size.
Definition ArrayRef.h:141
Context object for machine code objects.
Definition MCContext.h:83
Superclass for all disassemblers.
bool tryAddingSymbolicOperand(MCInst &Inst, int64_t Value, uint64_t Address, bool IsBranch, uint64_t Offset, uint64_t OpSize, uint64_t InstSize) const
DecodeStatus
Ternary decode status.
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
unsigned getOpcode() const
Definition MCInst.h:202
void addOperand(const MCOperand Op)
Definition MCInst.h:215
static MCOperand createReg(MCRegister Reg)
Definition MCInst.h:138
static MCOperand createImm(int64_t Val)
Definition MCInst.h:145
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
const FeatureBitset & getFeatureBits() const
Target - Wrapper for Target specific information.
LLVM Value Representation.
Definition Value.h:75
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
bool checkRegister(MCRegister RegNo, const FeatureBitset &FeatureBits, RegisterAccessType RA)
MCRegister getUserRegister(unsigned Code, const MCRegisterInfo &MRI)
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
Definition MathExtras.h:166
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:209
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Definition Error.cpp:163
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.
Definition MathExtras.h:190
Target & getTheXtensaTarget()
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Definition MCRegister.h:21
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
Definition MathExtras.h:567
static void RegisterMCDisassembler(Target &T, Target::MCDisassemblerCtorTy Fn)
RegisterMCDisassembler - Register a MCDisassembler implementation for the given target.