xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/Xtensa/Disassembler/XtensaDisassembler.cpp (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
1bdd1243dSDimitry Andric //===-- XtensaDisassembler.cpp - Disassembler for Xtensa ------------------===//
2bdd1243dSDimitry Andric //
3bdd1243dSDimitry Andric //                     The LLVM Compiler Infrastructure
4bdd1243dSDimitry Andric //
5bdd1243dSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6bdd1243dSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
7bdd1243dSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8bdd1243dSDimitry Andric //
9bdd1243dSDimitry Andric //===----------------------------------------------------------------------===//
10bdd1243dSDimitry Andric //
11bdd1243dSDimitry Andric // This file implements the XtensaDisassembler class.
12bdd1243dSDimitry Andric //
13bdd1243dSDimitry Andric //===----------------------------------------------------------------------===//
14bdd1243dSDimitry Andric 
15bdd1243dSDimitry Andric #include "MCTargetDesc/XtensaMCTargetDesc.h"
16bdd1243dSDimitry Andric #include "TargetInfo/XtensaTargetInfo.h"
17bdd1243dSDimitry Andric #include "llvm/MC/MCContext.h"
18bdd1243dSDimitry Andric #include "llvm/MC/MCDecoderOps.h"
19bdd1243dSDimitry Andric #include "llvm/MC/MCDisassembler/MCDisassembler.h"
20bdd1243dSDimitry Andric #include "llvm/MC/MCInst.h"
21bdd1243dSDimitry Andric #include "llvm/MC/MCRegisterInfo.h"
22bdd1243dSDimitry Andric #include "llvm/MC/MCSubtargetInfo.h"
23bdd1243dSDimitry Andric #include "llvm/MC/TargetRegistry.h"
24bdd1243dSDimitry Andric #include "llvm/Support/Endian.h"
25bdd1243dSDimitry Andric 
26bdd1243dSDimitry Andric using namespace llvm;
27bdd1243dSDimitry Andric 
28bdd1243dSDimitry Andric #define DEBUG_TYPE "Xtensa-disassembler"
29bdd1243dSDimitry Andric 
30bdd1243dSDimitry Andric using DecodeStatus = MCDisassembler::DecodeStatus;
31bdd1243dSDimitry Andric 
32bdd1243dSDimitry Andric namespace {
33bdd1243dSDimitry Andric 
34bdd1243dSDimitry Andric class XtensaDisassembler : public MCDisassembler {
35bdd1243dSDimitry Andric   bool IsLittleEndian;
36bdd1243dSDimitry Andric 
37bdd1243dSDimitry Andric public:
XtensaDisassembler(const MCSubtargetInfo & STI,MCContext & Ctx,bool isLE)38bdd1243dSDimitry Andric   XtensaDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx, bool isLE)
39bdd1243dSDimitry Andric       : MCDisassembler(STI, Ctx), IsLittleEndian(isLE) {}
40bdd1243dSDimitry Andric 
hasDensity() const41bdd1243dSDimitry Andric   bool hasDensity() const {
42*06c3fb27SDimitry Andric     return STI.hasFeature(Xtensa::FeatureDensity);
43bdd1243dSDimitry Andric   }
44bdd1243dSDimitry Andric 
45bdd1243dSDimitry Andric   DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size,
46bdd1243dSDimitry Andric                               ArrayRef<uint8_t> Bytes, uint64_t Address,
47bdd1243dSDimitry Andric                               raw_ostream &CStream) const override;
48bdd1243dSDimitry Andric };
49bdd1243dSDimitry Andric } // end anonymous namespace
50bdd1243dSDimitry Andric 
createXtensaDisassembler(const Target & T,const MCSubtargetInfo & STI,MCContext & Ctx)51bdd1243dSDimitry Andric static MCDisassembler *createXtensaDisassembler(const Target &T,
52bdd1243dSDimitry Andric                                                 const MCSubtargetInfo &STI,
53bdd1243dSDimitry Andric                                                 MCContext &Ctx) {
54bdd1243dSDimitry Andric   return new XtensaDisassembler(STI, Ctx, true);
55bdd1243dSDimitry Andric }
56bdd1243dSDimitry Andric 
LLVMInitializeXtensaDisassembler()57bdd1243dSDimitry Andric extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeXtensaDisassembler() {
58bdd1243dSDimitry Andric   TargetRegistry::RegisterMCDisassembler(getTheXtensaTarget(),
59bdd1243dSDimitry Andric                                          createXtensaDisassembler);
60bdd1243dSDimitry Andric }
61bdd1243dSDimitry Andric 
62bdd1243dSDimitry Andric static const unsigned ARDecoderTable[] = {
63bdd1243dSDimitry Andric     Xtensa::A0,  Xtensa::SP,  Xtensa::A2,  Xtensa::A3, Xtensa::A4,  Xtensa::A5,
64bdd1243dSDimitry Andric     Xtensa::A6,  Xtensa::A7,  Xtensa::A8,  Xtensa::A9, Xtensa::A10, Xtensa::A11,
65bdd1243dSDimitry Andric     Xtensa::A12, Xtensa::A13, Xtensa::A14, Xtensa::A15};
66bdd1243dSDimitry Andric 
DecodeARRegisterClass(MCInst & Inst,uint64_t RegNo,uint64_t Address,const void * Decoder)67bdd1243dSDimitry Andric static DecodeStatus DecodeARRegisterClass(MCInst &Inst, uint64_t RegNo,
68bdd1243dSDimitry Andric                                           uint64_t Address,
69bdd1243dSDimitry Andric                                           const void *Decoder) {
70bdd1243dSDimitry Andric   if (RegNo >= std::size(ARDecoderTable))
71bdd1243dSDimitry Andric     return MCDisassembler::Fail;
72bdd1243dSDimitry Andric 
73bdd1243dSDimitry Andric   unsigned Reg = ARDecoderTable[RegNo];
74bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createReg(Reg));
75bdd1243dSDimitry Andric   return MCDisassembler::Success;
76bdd1243dSDimitry Andric }
77bdd1243dSDimitry Andric 
78bdd1243dSDimitry Andric static const unsigned SRDecoderTable[] = {Xtensa::SAR, 3};
79bdd1243dSDimitry Andric 
DecodeSRRegisterClass(MCInst & Inst,uint64_t RegNo,uint64_t Address,const void * Decoder)80bdd1243dSDimitry Andric static DecodeStatus DecodeSRRegisterClass(MCInst &Inst, uint64_t RegNo,
81bdd1243dSDimitry Andric                                           uint64_t Address,
82bdd1243dSDimitry Andric                                           const void *Decoder) {
83bdd1243dSDimitry Andric   if (RegNo > 255)
84bdd1243dSDimitry Andric     return MCDisassembler::Fail;
85bdd1243dSDimitry Andric 
86bdd1243dSDimitry Andric   for (unsigned i = 0; i < std::size(SRDecoderTable); i += 2) {
87bdd1243dSDimitry Andric     if (SRDecoderTable[i + 1] == RegNo) {
88bdd1243dSDimitry Andric       unsigned Reg = SRDecoderTable[i];
89bdd1243dSDimitry Andric       Inst.addOperand(MCOperand::createReg(Reg));
90bdd1243dSDimitry Andric       return MCDisassembler::Success;
91bdd1243dSDimitry Andric     }
92bdd1243dSDimitry Andric   }
93bdd1243dSDimitry Andric 
94bdd1243dSDimitry Andric   return MCDisassembler::Fail;
95bdd1243dSDimitry Andric }
96bdd1243dSDimitry Andric 
tryAddingSymbolicOperand(int64_t Value,bool isBranch,uint64_t Address,uint64_t Offset,uint64_t InstSize,MCInst & MI,const void * Decoder)97bdd1243dSDimitry Andric static bool tryAddingSymbolicOperand(int64_t Value, bool isBranch,
98bdd1243dSDimitry Andric                                      uint64_t Address, uint64_t Offset,
99bdd1243dSDimitry Andric                                      uint64_t InstSize, MCInst &MI,
100bdd1243dSDimitry Andric                                      const void *Decoder) {
101bdd1243dSDimitry Andric   const MCDisassembler *Dis = static_cast<const MCDisassembler *>(Decoder);
102bdd1243dSDimitry Andric   return Dis->tryAddingSymbolicOperand(MI, Value, Address, isBranch, Offset, /*OpSize=*/0,
103bdd1243dSDimitry Andric                                        InstSize);
104bdd1243dSDimitry Andric }
105bdd1243dSDimitry Andric 
decodeCallOperand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)106bdd1243dSDimitry Andric static DecodeStatus decodeCallOperand(MCInst &Inst, uint64_t Imm,
107bdd1243dSDimitry Andric                                       int64_t Address, const void *Decoder) {
108bdd1243dSDimitry Andric   assert(isUInt<18>(Imm) && "Invalid immediate");
109bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm(SignExtend64<20>(Imm << 2)));
110bdd1243dSDimitry Andric   return MCDisassembler::Success;
111bdd1243dSDimitry Andric }
112bdd1243dSDimitry Andric 
decodeJumpOperand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)113bdd1243dSDimitry Andric static DecodeStatus decodeJumpOperand(MCInst &Inst, uint64_t Imm,
114bdd1243dSDimitry Andric                                       int64_t Address, const void *Decoder) {
115bdd1243dSDimitry Andric   assert(isUInt<18>(Imm) && "Invalid immediate");
116bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm(SignExtend64<18>(Imm)));
117bdd1243dSDimitry Andric   return MCDisassembler::Success;
118bdd1243dSDimitry Andric }
119bdd1243dSDimitry Andric 
decodeBranchOperand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)120bdd1243dSDimitry Andric static DecodeStatus decodeBranchOperand(MCInst &Inst, uint64_t Imm,
121bdd1243dSDimitry Andric                                         int64_t Address, const void *Decoder) {
122bdd1243dSDimitry Andric   switch (Inst.getOpcode()) {
123bdd1243dSDimitry Andric   case Xtensa::BEQZ:
124bdd1243dSDimitry Andric   case Xtensa::BGEZ:
125bdd1243dSDimitry Andric   case Xtensa::BLTZ:
126bdd1243dSDimitry Andric   case Xtensa::BNEZ:
127bdd1243dSDimitry Andric     assert(isUInt<12>(Imm) && "Invalid immediate");
128bdd1243dSDimitry Andric     if (!tryAddingSymbolicOperand(SignExtend64<12>(Imm) + 4 + Address, true,
129bdd1243dSDimitry Andric                                   Address, 0, 3, Inst, Decoder))
130bdd1243dSDimitry Andric       Inst.addOperand(MCOperand::createImm(SignExtend64<12>(Imm)));
131bdd1243dSDimitry Andric     break;
132bdd1243dSDimitry Andric   default:
133bdd1243dSDimitry Andric     assert(isUInt<8>(Imm) && "Invalid immediate");
134bdd1243dSDimitry Andric     if (!tryAddingSymbolicOperand(SignExtend64<8>(Imm) + 4 + Address, true,
135bdd1243dSDimitry Andric                                   Address, 0, 3, Inst, Decoder))
136bdd1243dSDimitry Andric       Inst.addOperand(MCOperand::createImm(SignExtend64<8>(Imm)));
137bdd1243dSDimitry Andric   }
138bdd1243dSDimitry Andric   return MCDisassembler::Success;
139bdd1243dSDimitry Andric }
140bdd1243dSDimitry Andric 
decodeL32ROperand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)141bdd1243dSDimitry Andric static DecodeStatus decodeL32ROperand(MCInst &Inst, uint64_t Imm,
142bdd1243dSDimitry Andric                                       int64_t Address, const void *Decoder) {
143bdd1243dSDimitry Andric 
144bdd1243dSDimitry Andric   assert(isUInt<16>(Imm) && "Invalid immediate");
145bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm(
146bdd1243dSDimitry Andric       SignExtend64<17>((Imm << 2) + 0x40000 + (Address & 0x3))));
147bdd1243dSDimitry Andric   return MCDisassembler::Success;
148bdd1243dSDimitry Andric }
149bdd1243dSDimitry Andric 
decodeImm8Operand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)150bdd1243dSDimitry Andric static DecodeStatus decodeImm8Operand(MCInst &Inst, uint64_t Imm,
151bdd1243dSDimitry Andric                                       int64_t Address, const void *Decoder) {
152bdd1243dSDimitry Andric   assert(isUInt<8>(Imm) && "Invalid immediate");
153bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm(SignExtend64<8>(Imm)));
154bdd1243dSDimitry Andric   return MCDisassembler::Success;
155bdd1243dSDimitry Andric }
156bdd1243dSDimitry Andric 
decodeImm8_sh8Operand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)157bdd1243dSDimitry Andric static DecodeStatus decodeImm8_sh8Operand(MCInst &Inst, uint64_t Imm,
158bdd1243dSDimitry Andric                                           int64_t Address,
159bdd1243dSDimitry Andric                                           const void *Decoder) {
160bdd1243dSDimitry Andric   assert(isUInt<8>(Imm) && "Invalid immediate");
161bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm(SignExtend64<16>(Imm << 8)));
162bdd1243dSDimitry Andric   return MCDisassembler::Success;
163bdd1243dSDimitry Andric }
164bdd1243dSDimitry Andric 
decodeImm12Operand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)165bdd1243dSDimitry Andric static DecodeStatus decodeImm12Operand(MCInst &Inst, uint64_t Imm,
166bdd1243dSDimitry Andric                                        int64_t Address, const void *Decoder) {
167bdd1243dSDimitry Andric   assert(isUInt<12>(Imm) && "Invalid immediate");
168bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm(SignExtend64<12>(Imm)));
169bdd1243dSDimitry Andric   return MCDisassembler::Success;
170bdd1243dSDimitry Andric }
171bdd1243dSDimitry Andric 
decodeUimm4Operand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)172bdd1243dSDimitry Andric static DecodeStatus decodeUimm4Operand(MCInst &Inst, uint64_t Imm,
173bdd1243dSDimitry Andric                                        int64_t Address, const void *Decoder) {
174bdd1243dSDimitry Andric   assert(isUInt<4>(Imm) && "Invalid immediate");
175bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm(Imm));
176bdd1243dSDimitry Andric   return MCDisassembler::Success;
177bdd1243dSDimitry Andric }
178bdd1243dSDimitry Andric 
decodeUimm5Operand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)179bdd1243dSDimitry Andric static DecodeStatus decodeUimm5Operand(MCInst &Inst, uint64_t Imm,
180bdd1243dSDimitry Andric                                        int64_t Address, const void *Decoder) {
181bdd1243dSDimitry Andric   assert(isUInt<5>(Imm) && "Invalid immediate");
182bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm(Imm));
183bdd1243dSDimitry Andric   return MCDisassembler::Success;
184bdd1243dSDimitry Andric }
185bdd1243dSDimitry Andric 
decodeImm1_16Operand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)186bdd1243dSDimitry Andric static DecodeStatus decodeImm1_16Operand(MCInst &Inst, uint64_t Imm,
187bdd1243dSDimitry Andric                                          int64_t Address, const void *Decoder) {
188bdd1243dSDimitry Andric   assert(isUInt<4>(Imm) && "Invalid immediate");
189bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm(Imm + 1));
190bdd1243dSDimitry Andric   return MCDisassembler::Success;
191bdd1243dSDimitry Andric }
192bdd1243dSDimitry Andric 
decodeShimm1_31Operand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)193bdd1243dSDimitry Andric static DecodeStatus decodeShimm1_31Operand(MCInst &Inst, uint64_t Imm,
194bdd1243dSDimitry Andric                                            int64_t Address,
195bdd1243dSDimitry Andric                                            const void *Decoder) {
196bdd1243dSDimitry Andric   assert(isUInt<5>(Imm) && "Invalid immediate");
197bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm(32 - Imm));
198bdd1243dSDimitry Andric   return MCDisassembler::Success;
199bdd1243dSDimitry Andric }
200bdd1243dSDimitry Andric 
201bdd1243dSDimitry Andric static int64_t TableB4const[16] = {-1, 1,  2,  3,  4,  5,  6,   7,
202bdd1243dSDimitry Andric                                    8,  10, 12, 16, 32, 64, 128, 256};
decodeB4constOperand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)203bdd1243dSDimitry Andric static DecodeStatus decodeB4constOperand(MCInst &Inst, uint64_t Imm,
204bdd1243dSDimitry Andric                                          int64_t Address, const void *Decoder) {
205bdd1243dSDimitry Andric   assert(isUInt<4>(Imm) && "Invalid immediate");
206bdd1243dSDimitry Andric 
207bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm(TableB4const[Imm]));
208bdd1243dSDimitry Andric   return MCDisassembler::Success;
209bdd1243dSDimitry Andric }
210bdd1243dSDimitry Andric 
211bdd1243dSDimitry Andric static int64_t TableB4constu[16] = {32768, 65536, 2,  3,  4,  5,  6,   7,
212bdd1243dSDimitry Andric                                     8,     10,    12, 16, 32, 64, 128, 256};
decodeB4constuOperand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)213bdd1243dSDimitry Andric static DecodeStatus decodeB4constuOperand(MCInst &Inst, uint64_t Imm,
214bdd1243dSDimitry Andric                                           int64_t Address,
215bdd1243dSDimitry Andric                                           const void *Decoder) {
216bdd1243dSDimitry Andric   assert(isUInt<4>(Imm) && "Invalid immediate");
217bdd1243dSDimitry Andric 
218bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm(TableB4constu[Imm]));
219bdd1243dSDimitry Andric   return MCDisassembler::Success;
220bdd1243dSDimitry Andric }
221bdd1243dSDimitry Andric 
decodeMem8Operand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)222bdd1243dSDimitry Andric static DecodeStatus decodeMem8Operand(MCInst &Inst, uint64_t Imm,
223bdd1243dSDimitry Andric                                       int64_t Address, const void *Decoder) {
224bdd1243dSDimitry Andric   assert(isUInt<12>(Imm) && "Invalid immediate");
225bdd1243dSDimitry Andric   DecodeARRegisterClass(Inst, Imm & 0xf, Address, Decoder);
226bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm((Imm >> 4) & 0xff));
227bdd1243dSDimitry Andric   return MCDisassembler::Success;
228bdd1243dSDimitry Andric }
229bdd1243dSDimitry Andric 
decodeMem16Operand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)230bdd1243dSDimitry Andric static DecodeStatus decodeMem16Operand(MCInst &Inst, uint64_t Imm,
231bdd1243dSDimitry Andric                                        int64_t Address, const void *Decoder) {
232bdd1243dSDimitry Andric   assert(isUInt<12>(Imm) && "Invalid immediate");
233bdd1243dSDimitry Andric   DecodeARRegisterClass(Inst, Imm & 0xf, Address, Decoder);
234bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm((Imm >> 3) & 0x1fe));
235bdd1243dSDimitry Andric   return MCDisassembler::Success;
236bdd1243dSDimitry Andric }
237bdd1243dSDimitry Andric 
decodeMem32Operand(MCInst & Inst,uint64_t Imm,int64_t Address,const void * Decoder)238bdd1243dSDimitry Andric static DecodeStatus decodeMem32Operand(MCInst &Inst, uint64_t Imm,
239bdd1243dSDimitry Andric                                        int64_t Address, const void *Decoder) {
240bdd1243dSDimitry Andric   assert(isUInt<12>(Imm) && "Invalid immediate");
241bdd1243dSDimitry Andric   DecodeARRegisterClass(Inst, Imm & 0xf, Address, Decoder);
242bdd1243dSDimitry Andric   Inst.addOperand(MCOperand::createImm((Imm >> 2) & 0x3fc));
243bdd1243dSDimitry Andric   return MCDisassembler::Success;
244bdd1243dSDimitry Andric }
245bdd1243dSDimitry Andric 
246bdd1243dSDimitry Andric /// Read three bytes from the ArrayRef and return 24 bit data
readInstruction24(ArrayRef<uint8_t> Bytes,uint64_t Address,uint64_t & Size,uint32_t & Insn,bool IsLittleEndian)247bdd1243dSDimitry Andric static DecodeStatus readInstruction24(ArrayRef<uint8_t> Bytes, uint64_t Address,
248bdd1243dSDimitry Andric                                       uint64_t &Size, uint32_t &Insn,
249bdd1243dSDimitry Andric                                       bool IsLittleEndian) {
250bdd1243dSDimitry Andric   // We want to read exactly 3 Bytes of data.
251bdd1243dSDimitry Andric   if (Bytes.size() < 3) {
252bdd1243dSDimitry Andric     Size = 0;
253bdd1243dSDimitry Andric     return MCDisassembler::Fail;
254bdd1243dSDimitry Andric   }
255bdd1243dSDimitry Andric 
256bdd1243dSDimitry Andric   if (!IsLittleEndian) {
257bdd1243dSDimitry Andric     report_fatal_error("Big-endian mode currently is not supported!");
258bdd1243dSDimitry Andric   } else {
259bdd1243dSDimitry Andric     Insn = (Bytes[2] << 16) | (Bytes[1] << 8) | (Bytes[0] << 0);
260bdd1243dSDimitry Andric   }
261bdd1243dSDimitry Andric 
262bdd1243dSDimitry Andric   Size = 3;
263bdd1243dSDimitry Andric   return MCDisassembler::Success;
264bdd1243dSDimitry Andric }
265bdd1243dSDimitry Andric 
266bdd1243dSDimitry Andric #include "XtensaGenDisassemblerTables.inc"
267bdd1243dSDimitry Andric 
getInstruction(MCInst & MI,uint64_t & Size,ArrayRef<uint8_t> Bytes,uint64_t Address,raw_ostream & CS) const268bdd1243dSDimitry Andric DecodeStatus XtensaDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
269bdd1243dSDimitry Andric                                                 ArrayRef<uint8_t> Bytes,
270bdd1243dSDimitry Andric                                                 uint64_t Address,
271bdd1243dSDimitry Andric                                                 raw_ostream &CS) const {
272bdd1243dSDimitry Andric   uint32_t Insn;
273bdd1243dSDimitry Andric   DecodeStatus Result;
274bdd1243dSDimitry Andric 
275bdd1243dSDimitry Andric   Result = readInstruction24(Bytes, Address, Size, Insn, IsLittleEndian);
276bdd1243dSDimitry Andric   if (Result == MCDisassembler::Fail)
277bdd1243dSDimitry Andric     return MCDisassembler::Fail;
278bdd1243dSDimitry Andric   LLVM_DEBUG(dbgs() << "Trying Xtensa 24-bit instruction table :\n");
279bdd1243dSDimitry Andric   Result = decodeInstruction(DecoderTable24, MI, Insn, Address, this, STI);
280bdd1243dSDimitry Andric   return Result;
281bdd1243dSDimitry Andric }
282