28#define DEBUG_TYPE "Xtensa-disassembler"
41 bool hasDensity()
const {
return STI.
hasFeature(Xtensa::FeatureDensity); }
52 return new XtensaDisassembler(STI, Ctx,
true);
61 Xtensa::A0, Xtensa::SP, Xtensa::A2, Xtensa::A3, Xtensa::A4, Xtensa::A5,
62 Xtensa::A6, Xtensa::A7, Xtensa::A8, Xtensa::A9, Xtensa::A10, Xtensa::A11,
63 Xtensa::A12, Xtensa::A13, Xtensa::A14, Xtensa::A15};
67 const void *Decoder) {
77 Xtensa::SAR, 3, Xtensa::WINDOWBASE, 72, Xtensa::WINDOWSTART, 73};
104 const void *Decoder) {
111 int64_t Address,
const void *Decoder) {
112 assert(isUInt<18>(Imm) &&
"Invalid immediate");
118 int64_t Address,
const void *Decoder) {
119 assert(isUInt<18>(Imm) &&
"Invalid immediate");
125 int64_t Address,
const void *Decoder) {
131 assert(isUInt<12>(Imm) &&
"Invalid immediate");
137 assert(isUInt<8>(Imm) &&
"Invalid immediate");
146 int64_t Address,
const void *Decoder) {
148 assert(isUInt<16>(Imm) &&
"Invalid immediate");
150 SignExtend64<17>((Imm << 2) + 0x40000 + (
Address & 0x3))));
155 int64_t Address,
const void *Decoder) {
156 assert(isUInt<8>(Imm) &&
"Invalid immediate");
163 const void *Decoder) {
164 assert(isUInt<8>(Imm) &&
"Invalid immediate");
170 int64_t Address,
const void *Decoder) {
171 assert(isUInt<12>(Imm) &&
"Invalid immediate");
177 int64_t Address,
const void *Decoder) {
178 assert(isUInt<4>(Imm) &&
"Invalid immediate");
184 int64_t Address,
const void *Decoder) {
185 assert(isUInt<5>(Imm) &&
"Invalid immediate");
191 int64_t Address,
const void *Decoder) {
192 assert(isUInt<4>(Imm) &&
"Invalid immediate");
199 const void *Decoder) {
200 assert(isUInt<4>(Imm) &&
"Invalid immediate");
210 const void *Decoder) {
211 assert(isUInt<7>(Imm) &&
"Invalid immediate");
212 if ((Imm & 0x60) == 0x60)
220 int64_t Address,
const void *Decoder) {
221 assert(isUInt<4>(Imm) &&
"Invalid immediate");
228 const void *Decoder) {
229 assert(isUInt<6>(Imm) && ((Imm & 0x3) == 0) &&
"Invalid immediate");
236 const void *Decoder) {
237 assert(isUInt<15>(Imm) && ((Imm & 0x7) == 0) &&
"Invalid immediate");
244 const void *Decoder) {
245 assert(isUInt<5>(Imm) &&
"Invalid immediate");
251 8, 10, 12, 16, 32, 64, 128, 256};
253 int64_t Address,
const void *Decoder) {
254 assert(isUInt<4>(Imm) &&
"Invalid immediate");
261 8, 10, 12, 16, 32, 64, 128, 256};
264 const void *Decoder) {
265 assert(isUInt<4>(Imm) &&
"Invalid immediate");
272 int64_t Address,
const void *Decoder) {
273 assert(isUInt<12>(Imm) &&
"Invalid immediate");
280 int64_t Address,
const void *Decoder) {
281 assert(isUInt<12>(Imm) &&
"Invalid immediate");
288 int64_t Address,
const void *Decoder) {
289 assert(isUInt<12>(Imm) &&
"Invalid immediate");
296 int64_t Address,
const void *Decoder) {
297 assert(isUInt<8>(Imm) &&
"Invalid immediate");
307 bool IsLittleEndian) {
309 if (Bytes.
size() < 2) {
314 if (!IsLittleEndian) {
317 Insn = (Bytes[1] << 8) | Bytes[0];
326 bool IsLittleEndian) {
328 if (Bytes.
size() < 3) {
333 if (!IsLittleEndian) {
336 Insn = (Bytes[2] << 16) | (Bytes[1] << 8) | (Bytes[0] << 0);
342#include "XtensaGenDisassemblerTables.inc"
356 LLVM_DEBUG(
dbgs() <<
"Trying Xtensa 16-bit instruction table :\n");
357 Result = decodeInstruction(DecoderTable16,
MI,
Insn, Address,
this, STI);
368 LLVM_DEBUG(
dbgs() <<
"Trying Xtensa 24-bit instruction table :\n");
369 Result = decodeInstruction(DecoderTable24,
MI,
Insn, Address,
this, STI);
SmallVector< AArch64_IMM::ImmInsnModel, 4 > Insn
#define LLVM_EXTERNAL_VISIBILITY
static bool isBranch(unsigned Opcode)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static DecodeStatus decodeMem16Operand(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)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeXtensaDisassembler()
static DecodeStatus readInstruction24(ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint64_t &Insn, bool IsLittleEndian)
Read three bytes from the ArrayRef and return 24 bit data.
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)
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)
const unsigned SRDecoderTable[]
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 decodeMem8Operand(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 MCDisassembler * createXtensaDisassembler(const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
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)
const unsigned ARDecoderTable[]
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 decodeShimm1_31Operand(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)
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.
bool tryAddingSymbolicOperand(MCInst &Inst, int64_t Value, uint64_t Address, bool IsBranch, uint64_t Offset, uint64_t OpSize, uint64_t InstSize) const
const MCSubtargetInfo & getSubtargetInfo() const
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.
unsigned getOpcode() const
void addOperand(const MCOperand Op)
static MCOperand createReg(MCRegister Reg)
static MCOperand createImm(int64_t Val)
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.
This class implements an extremely fast bulk output stream that can only output to a stream.
bool checkRegister(MCRegister RegNo, const FeatureBitset &FeatureBits)
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Target & getTheXtensaTarget()
static void RegisterMCDisassembler(Target &T, Target::MCDisassemblerCtorTy Fn)
RegisterMCDisassembler - Register a MCDisassembler implementation for the given target.