Coverage Report

Created: 2026-10-17 07:17

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/capstonenext/arch/RISCV/RISCVDisassembler.c
Line
Count
Source
1
/* Capstone Disassembly Engine, http://www.capstone-engine.org */
2
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
3
/*    Rot127 <unisono@quyllur.org> 2022-2023 */
4
/* Automatically translated source file from LLVM. */
5
6
/* LLVM-commit: <commit> */
7
/* LLVM-tag: <tag> */
8
9
/* Only small edits allowed. */
10
/* For multiple similar edits, please create a Patch for the translator. */
11
12
/* Capstone's C++ file translator: */
13
/* https://github.com/capstone-engine/capstone/tree/next/suite/auto-sync */
14
15
//===-- RISCVDisassembler.cpp - Disassembler for RISC-V -------------------===//
16
//
17
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
18
// See https://llvm.org/LICENSE.txt for license information.
19
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
20
//
21
//===----------------------------------------------------------------------===//
22
//
23
// This file implements the RISCVDisassembler class.
24
//
25
//===----------------------------------------------------------------------===//
26
27
#include <stdio.h>
28
#include <string.h>
29
#include <stdlib.h>
30
#include <capstone/platform.h>
31
32
#include "../../MCInst.h"
33
#include "../../MathExtras.h"
34
#include "../../MCInstPrinter.h"
35
#include "../../MCDisassembler.h"
36
#include "../../MCFixedLenDisassembler.h"
37
#include "../../cs_priv.h"
38
#include "../../utils.h"
39
#include "RISCVDisassemblerExtension.h"
40
#include "RISCVBaseInfo.h"
41
#include "RISCVMapping.h"
42
43
#define GET_SUBTARGETINFO_ENUM
44
#include "RISCVGenSubtargetInfo.inc"
45
46
#define GET_REGINFO_ENUM
47
#include "RISCVGenRegisterInfo.inc"
48
49
#define GET_INSTRINFO_ENUM
50
#define GET_INSTRINFO_MC_DESC
51
#include "RISCVGenInstrInfo.inc"
52
53
9.34k
#define CONCAT(a, b) CONCAT_(a, b)
54
9.34k
#define CONCAT_(a, b) a##_##b
55
56
#define DEBUG_TYPE "riscv-disassembler"
57
58
DecodeStatus RISCV_getInstruction(MCInst *Instr, uint16_t *Size,
59
          const uint8_t *Bytes, size_t BytesLen,
60
          uint64_t Address, SStream *CStream);
61
void addSPOperands(MCInst *MI);
62
;
63
// end anonymous namespace
64
65
static DecodeStatus DecodeGPRRegisterClass(MCInst *Inst, uint32_t RegNo,
66
             uint64_t Address,
67
             const void *Decoder)
68
64.9k
{
69
64.9k
  bool IsRVE = RISCV_getFeatureBits(Inst->csh->mode, RISCV_FeatureRVE);
70
71
64.9k
  if (RegNo >= 32 || (IsRVE && RegNo >= 16))
72
0
    return MCDisassembler_Fail;
73
74
64.9k
  MCRegister Reg = RISCV_X0 + RegNo;
75
64.9k
  MCOperand_CreateReg0(Inst, (Reg));
76
64.9k
  return MCDisassembler_Success;
77
64.9k
}
78
79
static DecodeStatus DecodeGPRX1X5RegisterClass(MCInst *Inst, uint32_t RegNo,
80
                 uint64_t Address,
81
                 const void *Decoder)
82
0
{
83
0
  MCRegister Reg = RISCV_X0 + RegNo;
84
0
  if (Reg != RISCV_X1 && Reg != RISCV_X5)
85
0
    return MCDisassembler_Fail;
86
87
0
  MCOperand_CreateReg0(Inst, (Reg));
88
0
  return MCDisassembler_Success;
89
0
}
90
91
static DecodeStatus DecodeFPR16RegisterClass(MCInst *Inst, uint32_t RegNo,
92
               uint64_t Address,
93
               const void *Decoder)
94
7.32k
{
95
7.32k
  if (RegNo >= 32)
96
0
    return MCDisassembler_Fail;
97
98
7.32k
  MCRegister Reg = RISCV_F0_H + RegNo;
99
7.32k
  MCOperand_CreateReg0(Inst, (Reg));
100
7.32k
  return MCDisassembler_Success;
101
7.32k
}
102
103
static DecodeStatus DecodeFPR32RegisterClass(MCInst *Inst, uint32_t RegNo,
104
               uint64_t Address,
105
               const void *Decoder)
106
3.60k
{
107
3.60k
  if (RegNo >= 32)
108
0
    return MCDisassembler_Fail;
109
110
3.60k
  MCRegister Reg = RISCV_F0_F + RegNo;
111
3.60k
  MCOperand_CreateReg0(Inst, (Reg));
112
3.60k
  return MCDisassembler_Success;
113
3.60k
}
114
115
static DecodeStatus DecodeFPR32CRegisterClass(MCInst *Inst, uint32_t RegNo,
116
                uint64_t Address,
117
                const void *Decoder)
118
0
{
119
0
  if (RegNo >= 8) {
120
0
    return MCDisassembler_Fail;
121
0
  }
122
0
  MCRegister Reg = RISCV_F8_F + RegNo;
123
0
  MCOperand_CreateReg0(Inst, (Reg));
124
0
  return MCDisassembler_Success;
125
0
}
126
127
static DecodeStatus DecodeFPR64RegisterClass(MCInst *Inst, uint32_t RegNo,
128
               uint64_t Address,
129
               const void *Decoder)
130
0
{
131
0
  if (RegNo >= 32)
132
0
    return MCDisassembler_Fail;
133
134
0
  MCRegister Reg = RISCV_F0_D + RegNo;
135
0
  MCOperand_CreateReg0(Inst, (Reg));
136
0
  return MCDisassembler_Success;
137
0
}
138
139
static DecodeStatus DecodeFPR64CRegisterClass(MCInst *Inst, uint32_t RegNo,
140
                uint64_t Address,
141
                const void *Decoder)
142
0
{
143
0
  if (RegNo >= 8) {
144
0
    return MCDisassembler_Fail;
145
0
  }
146
0
  MCRegister Reg = RISCV_F8_D + RegNo;
147
0
  MCOperand_CreateReg0(Inst, (Reg));
148
0
  return MCDisassembler_Success;
149
0
}
150
151
static DecodeStatus DecodeGPRNoX0RegisterClass(MCInst *Inst, uint32_t RegNo,
152
                 uint64_t Address,
153
                 const void *Decoder)
154
18.5k
{
155
18.5k
  if (RegNo == 0) {
156
7
    return MCDisassembler_Fail;
157
7
  }
158
159
18.5k
  return DecodeGPRRegisterClass(Inst, RegNo, Address, Decoder);
160
18.5k
}
161
162
static DecodeStatus DecodeGPRNoX0X2RegisterClass(MCInst *Inst, uint64_t RegNo,
163
             uint32_t Address,
164
             const void *Decoder)
165
2.13k
{
166
2.13k
  if (RegNo == 2) {
167
0
    return MCDisassembler_Fail;
168
0
  }
169
170
2.13k
  return DecodeGPRNoX0RegisterClass(Inst, RegNo, Address, Decoder);
171
2.13k
}
172
173
static DecodeStatus DecodeGPRCRegisterClass(MCInst *Inst, uint32_t RegNo,
174
              uint64_t Address,
175
              const void *Decoder)
176
30.7k
{
177
30.7k
  if (RegNo >= 8)
178
0
    return MCDisassembler_Fail;
179
180
30.7k
  MCRegister Reg = RISCV_X8 + RegNo;
181
30.7k
  MCOperand_CreateReg0(Inst, (Reg));
182
30.7k
  return MCDisassembler_Success;
183
30.7k
}
184
185
static DecodeStatus DecodeGPRPairRegisterClass(MCInst *Inst, uint32_t RegNo,
186
                 uint64_t Address,
187
                 const void *Decoder)
188
649
{
189
649
  if (RegNo >= 32 || RegNo & 1)
190
3
    return MCDisassembler_Fail;
191
192
646
  MCRegister Reg = RISCV_X0 + RegNo;
193
646
  MCOperand_CreateReg0(Inst, (Reg));
194
646
  return MCDisassembler_Success;
195
649
}
196
197
static DecodeStatus DecodeSR07RegisterClass(MCInst *Inst, uint64_t RegNo,
198
              uint64_t Address,
199
              const void *Decoder)
200
0
{
201
0
  if (RegNo >= 8)
202
0
    return MCDisassembler_Fail;
203
204
0
  MCRegister Reg = (RegNo < 2) ? (RegNo + RISCV_X8) :
205
0
               (RegNo - 2 + RISCV_X18);
206
0
  MCOperand_CreateReg0(Inst, (Reg));
207
0
  return MCDisassembler_Success;
208
0
}
209
210
static DecodeStatus DecodeVRRegisterClass(MCInst *Inst, uint32_t RegNo,
211
            uint64_t Address, const void *Decoder)
212
17.0k
{
213
17.0k
  if (RegNo >= 32)
214
0
    return MCDisassembler_Fail;
215
216
17.0k
  MCRegister Reg = RISCV_V0 + RegNo;
217
17.0k
  MCOperand_CreateReg0(Inst, (Reg));
218
17.0k
  return MCDisassembler_Success;
219
17.0k
}
220
221
static DecodeStatus DecodeVRM2RegisterClass(MCInst *Inst, uint32_t RegNo,
222
              uint64_t Address,
223
              const void *Decoder)
224
781
{
225
781
  if (RegNo >= 32 || RegNo % 2)
226
3
    return MCDisassembler_Fail;
227
228
778
  MCRegister Reg = MCRegisterInfo_getMatchingSuperReg(
229
778
    Inst->MRI, RISCV_V0 + RegNo, RISCV_sub_vrm1_0,
230
778
    MCRegisterInfo_getRegClass(Inst->MRI, RISCV_VRM2RegClassID));
231
232
778
  MCOperand_CreateReg0(Inst, (Reg));
233
778
  return MCDisassembler_Success;
234
781
}
235
236
static DecodeStatus DecodeVRM4RegisterClass(MCInst *Inst, uint32_t RegNo,
237
              uint64_t Address,
238
              const void *Decoder)
239
381
{
240
381
  if (RegNo >= 32 || RegNo % 4)
241
5
    return MCDisassembler_Fail;
242
243
376
  MCRegister Reg = MCRegisterInfo_getMatchingSuperReg(
244
376
    Inst->MRI, RISCV_V0 + RegNo, RISCV_sub_vrm1_0,
245
376
    MCRegisterInfo_getRegClass(Inst->MRI, RISCV_VRM4RegClassID));
246
247
376
  MCOperand_CreateReg0(Inst, (Reg));
248
376
  return MCDisassembler_Success;
249
381
}
250
251
static DecodeStatus DecodeVRM8RegisterClass(MCInst *Inst, uint32_t RegNo,
252
              uint64_t Address,
253
              const void *Decoder)
254
605
{
255
605
  if (RegNo >= 32 || RegNo % 8)
256
5
    return MCDisassembler_Fail;
257
258
600
  MCRegister Reg = MCRegisterInfo_getMatchingSuperReg(
259
600
    Inst->MRI, RISCV_V0 + RegNo, RISCV_sub_vrm1_0,
260
600
    MCRegisterInfo_getRegClass(Inst->MRI, RISCV_VRM8RegClassID));
261
262
600
  MCOperand_CreateReg0(Inst, (Reg));
263
600
  return MCDisassembler_Success;
264
605
}
265
266
static DecodeStatus decodeVMaskReg(MCInst *Inst, uint64_t RegNo,
267
           uint64_t Address, const void *Decoder)
268
5.40k
{
269
5.40k
  if (RegNo > 2) {
270
0
    return MCDisassembler_Fail;
271
0
  }
272
5.40k
  MCRegister Reg = (RegNo == 0) ? RISCV_V0 : RISCV_NoRegister;
273
274
5.40k
  MCOperand_CreateReg0(Inst, (Reg));
275
5.40k
  return MCDisassembler_Success;
276
5.40k
}
277
278
#define DEFINE_decodeUImmOperand(N) \
279
  static DecodeStatus CONCAT(decodeUImmOperand, \
280
           N)(MCInst * Inst, uint32_t Imm, \
281
              int64_t Address, const void *Decoder) \
282
35.0k
  { \
283
35.0k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
35.0k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
35.0k
    return MCDisassembler_Success; \
286
35.0k
  }
RISCVDisassembler.c:decodeUImmOperand_8
Line
Count
Source
282
5.24k
  { \
283
5.24k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
5.24k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
5.24k
    return MCDisassembler_Success; \
286
5.24k
  }
RISCVDisassembler.c:decodeUImmOperand_9
Line
Count
Source
282
1.95k
  { \
283
1.95k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
1.95k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
1.95k
    return MCDisassembler_Success; \
286
1.95k
  }
RISCVDisassembler.c:decodeUImmOperand_7
Line
Count
Source
282
2.95k
  { \
283
2.95k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
2.95k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
2.95k
    return MCDisassembler_Success; \
286
2.95k
  }
RISCVDisassembler.c:decodeUImmOperand_2
Line
Count
Source
282
2.79k
  { \
283
2.79k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
2.79k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
2.79k
    return MCDisassembler_Success; \
286
2.79k
  }
RISCVDisassembler.c:decodeUImmOperand_4
Line
Count
Source
282
4.32k
  { \
283
4.32k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
4.32k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
4.32k
    return MCDisassembler_Success; \
286
4.32k
  }
RISCVDisassembler.c:decodeUImmOperand_20
Line
Count
Source
282
1.27k
  { \
283
1.27k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
1.27k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
1.27k
    return MCDisassembler_Success; \
286
1.27k
  }
RISCVDisassembler.c:decodeUImmOperand_5
Line
Count
Source
282
4.88k
  { \
283
4.88k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
4.88k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
4.88k
    return MCDisassembler_Success; \
286
4.88k
  }
RISCVDisassembler.c:decodeUImmOperand_6
Line
Count
Source
282
940
  { \
283
940
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
940
    MCOperand_CreateImm0(Inst, (Imm)); \
285
940
    return MCDisassembler_Success; \
286
940
  }
RISCVDisassembler.c:decodeUImmOperand_11
Line
Count
Source
282
2.47k
  { \
283
2.47k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
2.47k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
2.47k
    return MCDisassembler_Success; \
286
2.47k
  }
RISCVDisassembler.c:decodeUImmOperand_10
Line
Count
Source
282
5.92k
  { \
283
5.92k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
5.92k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
5.92k
    return MCDisassembler_Success; \
286
5.92k
  }
RISCVDisassembler.c:decodeUImmOperand_12
Line
Count
Source
282
2.21k
  { \
283
2.21k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
2.21k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
2.21k
    return MCDisassembler_Success; \
286
2.21k
  }
RISCVDisassembler.c:decodeUImmOperand_3
Line
Count
Source
282
88
  { \
283
88
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
88
    MCOperand_CreateImm0(Inst, (Imm)); \
285
88
    return MCDisassembler_Success; \
286
88
  }
Unexecuted instantiation: RISCVDisassembler.c:decodeUImmOperand_1
287
DEFINE_decodeUImmOperand(6);
288
DEFINE_decodeUImmOperand(2);
289
DEFINE_decodeUImmOperand(8);
290
DEFINE_decodeUImmOperand(9);
291
DEFINE_decodeUImmOperand(7);
292
DEFINE_decodeUImmOperand(4);
293
DEFINE_decodeUImmOperand(20);
294
DEFINE_decodeUImmOperand(5);
295
DEFINE_decodeUImmOperand(11);
296
DEFINE_decodeUImmOperand(10);
297
DEFINE_decodeUImmOperand(12);
298
DEFINE_decodeUImmOperand(3);
299
DEFINE_decodeUImmOperand(1);
300
301
#define DEFINE_decodeUImmNonZeroOperand(N) \
302
  static DecodeStatus CONCAT(decodeUImmNonZeroOperand, \
303
           N)(MCInst * Inst, uint32_t Imm, \
304
              int64_t Address, const void *Decoder) \
305
5.27k
  { \
306
5.27k
    if (Imm == 0) \
307
5.27k
      return MCDisassembler_Fail; \
308
5.27k
    return CONCAT(decodeUImmOperand, N)(Inst, Imm, Address, \
309
5.27k
                Decoder); \
310
5.27k
  }
311
DEFINE_decodeUImmNonZeroOperand(10);
312
313
#define DEFINE_decodeSImmOperand(N) \
314
  static DecodeStatus CONCAT(decodeSImmOperand, \
315
           N)(MCInst * Inst, uint32_t Imm, \
316
              int64_t Address, const void *Decoder) \
317
12.4k
  { \
318
12.4k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
319
12.4k
\
320
12.4k
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm), N))); \
321
12.4k
    return MCDisassembler_Success; \
322
12.4k
  }
RISCVDisassembler.c:decodeSImmOperand_6
Line
Count
Source
317
7.09k
  { \
318
7.09k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
319
7.09k
\
320
7.09k
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm), N))); \
321
7.09k
    return MCDisassembler_Success; \
322
7.09k
  }
RISCVDisassembler.c:decodeSImmOperand_10
Line
Count
Source
317
216
  { \
318
216
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
319
216
\
320
216
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm), N))); \
321
216
    return MCDisassembler_Success; \
322
216
  }
RISCVDisassembler.c:decodeSImmOperand_12
Line
Count
Source
317
4.16k
  { \
318
4.16k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
319
4.16k
\
320
4.16k
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm), N))); \
321
4.16k
    return MCDisassembler_Success; \
322
4.16k
  }
RISCVDisassembler.c:decodeSImmOperand_5
Line
Count
Source
317
968
  { \
318
968
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
319
968
\
320
968
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm), N))); \
321
968
    return MCDisassembler_Success; \
322
968
  }
323
DEFINE_decodeSImmOperand(6);
324
DEFINE_decodeSImmOperand(12);
325
DEFINE_decodeSImmOperand(5);
326
DEFINE_decodeSImmOperand(10);
327
328
#define DEFINE_decodeSImmNonZeroOperand(N) \
329
  static DecodeStatus CONCAT(decodeSImmNonZeroOperand, \
330
           N)(MCInst * Inst, uint32_t Imm, \
331
              int64_t Address, const void *Decoder) \
332
3.02k
  { \
333
3.02k
    if (Imm == 0) \
334
3.02k
      return MCDisassembler_Fail; \
335
3.02k
    return CONCAT(decodeSImmOperand, N)(Inst, Imm, Address, \
336
3.02k
                Decoder); \
337
3.02k
  }
RISCVDisassembler.c:decodeSImmNonZeroOperand_6
Line
Count
Source
332
2.80k
  { \
333
2.80k
    if (Imm == 0) \
334
2.80k
      return MCDisassembler_Fail; \
335
2.80k
    return CONCAT(decodeSImmOperand, N)(Inst, Imm, Address, \
336
2.80k
                Decoder); \
337
2.80k
  }
RISCVDisassembler.c:decodeSImmNonZeroOperand_10
Line
Count
Source
332
217
  { \
333
217
    if (Imm == 0) \
334
217
      return MCDisassembler_Fail; \
335
217
    return CONCAT(decodeSImmOperand, N)(Inst, Imm, Address, \
336
216
                Decoder); \
337
217
  }
338
DEFINE_decodeSImmNonZeroOperand(6);
339
DEFINE_decodeSImmNonZeroOperand(10);
340
341
#define DEFINE_decodeSImmOperandAndLsl1(N) \
342
  static DecodeStatus CONCAT(decodeSImmOperandAndLsl1, \
343
           N)(MCInst * Inst, uint32_t Imm, \
344
              int64_t Address, const void *Decoder) \
345
5.24k
  { \
346
5.24k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
347
5.24k
\
348
5.24k
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm << 1), N))); \
349
5.24k
    return MCDisassembler_Success; \
350
5.24k
  }
RISCVDisassembler.c:decodeSImmOperandAndLsl1_12
Line
Count
Source
345
1.96k
  { \
346
1.96k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
347
1.96k
\
348
1.96k
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm << 1), N))); \
349
1.96k
    return MCDisassembler_Success; \
350
1.96k
  }
RISCVDisassembler.c:decodeSImmOperandAndLsl1_9
Line
Count
Source
345
2.07k
  { \
346
2.07k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
347
2.07k
\
348
2.07k
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm << 1), N))); \
349
2.07k
    return MCDisassembler_Success; \
350
2.07k
  }
RISCVDisassembler.c:decodeSImmOperandAndLsl1_13
Line
Count
Source
345
509
  { \
346
509
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
347
509
\
348
509
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm << 1), N))); \
349
509
    return MCDisassembler_Success; \
350
509
  }
RISCVDisassembler.c:decodeSImmOperandAndLsl1_21
Line
Count
Source
345
701
  { \
346
701
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
347
701
\
348
701
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm << 1), N))); \
349
701
    return MCDisassembler_Success; \
350
701
  }
351
DEFINE_decodeSImmOperandAndLsl1(12);
352
DEFINE_decodeSImmOperandAndLsl1(9);
353
DEFINE_decodeSImmOperandAndLsl1(13);
354
DEFINE_decodeSImmOperandAndLsl1(21);
355
356
static DecodeStatus decodeCLUIImmOperand(MCInst *Inst, uint32_t Imm,
357
           int64_t Address, const void *Decoder)
358
2.13k
{
359
2.13k
  CS_ASSERT(isUIntN(6, Imm) && "Invalid immediate");
360
2.13k
  if (Imm > 31) {
361
1.38k
    Imm = (SignExtend64((Imm), 6) & 0xfffff);
362
1.38k
  }
363
2.13k
  MCOperand_CreateImm0(Inst, (Imm));
364
2.13k
  return MCDisassembler_Success;
365
2.13k
}
366
367
static DecodeStatus decodeFRMArg(MCInst *Inst, uint32_t Imm, int64_t Address,
368
         const void *Decoder)
369
2.93k
{
370
2.93k
  CS_ASSERT(isUIntN(3, Imm) && "Invalid immediate");
371
2.93k
  if (!RISCVFPRndMode_isValidRoundingMode(Imm))
372
11
    return MCDisassembler_Fail;
373
374
2.92k
  MCOperand_CreateImm0(Inst, (Imm));
375
2.92k
  return MCDisassembler_Success;
376
2.93k
}
377
378
static DecodeStatus decodeRVCInstrRdRs1ImmZero(MCInst *Inst, uint32_t Insn,
379
                 uint64_t Address,
380
                 const void *Decoder);
381
382
static DecodeStatus decodeRVCInstrRdSImm(MCInst *Inst, uint32_t Insn,
383
           uint64_t Address, const void *Decoder);
384
385
static DecodeStatus decodeRVCInstrRdRs1UImm(MCInst *Inst, uint32_t Insn,
386
              uint64_t Address,
387
              const void *Decoder);
388
389
static DecodeStatus decodeRVCInstrRdRs2(MCInst *Inst, uint32_t Insn,
390
          uint64_t Address, const void *Decoder);
391
392
static DecodeStatus decodeRVCInstrRdRs1Rs2(MCInst *Inst, uint32_t Insn,
393
             uint64_t Address,
394
             const void *Decoder);
395
396
static DecodeStatus decodeXTHeadMemPair(MCInst *Inst, uint32_t Insn,
397
          uint64_t Address, const void *Decoder);
398
399
static DecodeStatus decodeZcmpRlist(MCInst *Inst, unsigned Imm,
400
            uint64_t Address, const void *Decoder);
401
402
static DecodeStatus decodeRegReg(MCInst *Inst, uint32_t Insn, uint64_t Address,
403
         const void *Decoder);
404
405
static DecodeStatus decodeZcmpSpimm(MCInst *Inst, unsigned Imm,
406
            uint64_t Address, const void *Decoder);
407
408
static DecodeStatus decodeCSSPushPopchk(MCInst *Inst, uint32_t Insn,
409
          uint64_t Address, const void *Decoder);
410
411
static DecodeStatus decodeUImmLog2XLenOperand(MCInst *Inst, uint32_t Imm,
412
                int64_t Address,
413
                const void *Decoder)
414
3.10k
{
415
3.10k
  CS_ASSERT(isUIntN(6, Imm) && "Invalid immediate");
416
417
3.10k
  if (!RISCV_getFeatureBits(Inst->csh->mode, RISCV_Feature64Bit) &&
418
849
      !isUIntN(5, Imm))
419
9
    return MCDisassembler_Fail;
420
421
3.09k
  MCOperand_CreateImm0(Inst, (Imm));
422
3.09k
  return MCDisassembler_Success;
423
3.10k
}
424
425
static DecodeStatus decodeUImmLog2XLenNonZeroOperand(MCInst *Inst, uint32_t Imm,
426
                 int64_t Address,
427
                 const void *Decoder)
428
2.70k
{
429
2.70k
  if (Imm == 0)
430
0
    return MCDisassembler_Fail;
431
2.70k
  return decodeUImmLog2XLenOperand(Inst, Imm, Address, Decoder);
432
2.70k
}
433
434
#include "RISCVGenDisassemblerTables.inc"
435
436
static DecodeStatus decodeRVCInstrRdRs1ImmZero(MCInst *Inst, uint32_t Insn,
437
                 uint64_t Address,
438
                 const void *Decoder)
439
749
{
440
749
  uint32_t Rd = fieldFromInstruction_4(Insn, 7, 5);
441
749
  if (DecodeGPRNoX0RegisterClass(Inst, Rd, Address, Decoder) ==
442
749
      MCDisassembler_Fail)
443
0
    return MCDisassembler_Fail;
444
749
  MCInst_addOperand2(Inst, (MCInst_getOperand(Inst, (0))));
445
749
  MCOperand_CreateImm0(Inst, (0));
446
749
  return MCDisassembler_Success;
447
749
}
448
449
static DecodeStatus decodeCSSPushPopchk(MCInst *Inst, uint32_t Insn,
450
          uint64_t Address, const void *Decoder)
451
0
{
452
0
  uint32_t Rs1 = fieldFromInstruction_4(Insn, 7, 5);
453
0
  if (DecodeGPRX1X5RegisterClass(Inst, Rs1, Address, Decoder) ==
454
0
      MCDisassembler_Fail)
455
0
    return MCDisassembler_Fail;
456
0
  return MCDisassembler_Success;
457
0
}
458
459
static DecodeStatus decodeRVCInstrRdSImm(MCInst *Inst, uint32_t Insn,
460
           uint64_t Address, const void *Decoder)
461
738
{
462
738
  MCOperand_CreateReg0(Inst, (RISCV_X0));
463
738
  uint32_t SImm6 = fieldFromInstruction_4(Insn, 12, 1) << 5 |
464
738
       fieldFromInstruction_4(Insn, 2, 5);
465
738
  DecodeStatus Result =
466
738
    CONCAT(decodeSImmOperand, 6)(Inst, SImm6, Address, Decoder);
467
738
  (void)Result;
468
738
  CS_ASSERT(Result == MCDisassembler_Success && "Invalid immediate");
469
738
  return MCDisassembler_Success;
470
738
}
471
472
static DecodeStatus decodeRVCInstrRdRs1UImm(MCInst *Inst, uint32_t Insn,
473
              uint64_t Address,
474
              const void *Decoder)
475
316
{
476
316
  MCOperand_CreateReg0(Inst, (RISCV_X0));
477
316
  MCInst_addOperand2(Inst, (MCInst_getOperand(Inst, (0))));
478
316
  uint32_t UImm6 = fieldFromInstruction_4(Insn, 12, 1) << 5 |
479
316
       fieldFromInstruction_4(Insn, 2, 5);
480
316
  DecodeStatus Result =
481
316
    CONCAT(decodeUImmOperand, 6)(Inst, UImm6, Address, Decoder);
482
316
  (void)Result;
483
316
  CS_ASSERT(Result == MCDisassembler_Success && "Invalid immediate");
484
316
  return MCDisassembler_Success;
485
316
}
486
487
static DecodeStatus decodeRVCInstrRdRs2(MCInst *Inst, uint32_t Insn,
488
          uint64_t Address, const void *Decoder)
489
79
{
490
79
  uint32_t Rd = fieldFromInstruction_4(Insn, 7, 5);
491
79
  uint32_t Rs2 = fieldFromInstruction_4(Insn, 2, 5);
492
79
  if (DecodeGPRRegisterClass(Inst, Rd, Address, Decoder) ==
493
79
      MCDisassembler_Fail)
494
0
    return MCDisassembler_Fail;
495
79
  if (DecodeGPRRegisterClass(Inst, Rs2, Address, Decoder) ==
496
79
      MCDisassembler_Fail)
497
0
    return MCDisassembler_Fail;
498
79
  return MCDisassembler_Success;
499
79
}
500
501
static DecodeStatus decodeRVCInstrRdRs1Rs2(MCInst *Inst, uint32_t Insn,
502
             uint64_t Address,
503
             const void *Decoder)
504
128
{
505
128
  uint32_t Rd = fieldFromInstruction_4(Insn, 7, 5);
506
128
  uint32_t Rs2 = fieldFromInstruction_4(Insn, 2, 5);
507
128
  if (DecodeGPRRegisterClass(Inst, Rd, Address, Decoder) ==
508
128
      MCDisassembler_Fail)
509
0
    return MCDisassembler_Fail;
510
128
  MCInst_addOperand2(Inst, (MCInst_getOperand(Inst, (0))));
511
128
  if (DecodeGPRRegisterClass(Inst, Rs2, Address, Decoder) ==
512
128
      MCDisassembler_Fail)
513
0
    return MCDisassembler_Fail;
514
128
  return MCDisassembler_Success;
515
128
}
516
517
static DecodeStatus decodeXTHeadMemPair(MCInst *Inst, uint32_t Insn,
518
          uint64_t Address, const void *Decoder)
519
0
{
520
0
  uint32_t Rd1 = fieldFromInstruction_4(Insn, 7, 5);
521
0
  uint32_t Rs1 = fieldFromInstruction_4(Insn, 15, 5);
522
0
  uint32_t Rd2 = fieldFromInstruction_4(Insn, 20, 5);
523
0
  uint32_t UImm2 = fieldFromInstruction_4(Insn, 25, 2);
524
0
  if (DecodeGPRRegisterClass(Inst, Rd1, Address, Decoder) ==
525
0
      MCDisassembler_Fail)
526
0
    return MCDisassembler_Fail;
527
0
  if (DecodeGPRRegisterClass(Inst, Rd2, Address, Decoder) ==
528
0
      MCDisassembler_Fail)
529
0
    return MCDisassembler_Fail;
530
0
  if (DecodeGPRRegisterClass(Inst, Rs1, Address, Decoder) ==
531
0
      MCDisassembler_Fail)
532
0
    return MCDisassembler_Fail;
533
0
  DecodeStatus Result =
534
0
    CONCAT(decodeUImmOperand, 2)(Inst, UImm2, Address, Decoder);
535
0
  (void)Result;
536
0
  CS_ASSERT(Result == MCDisassembler_Success && "Invalid immediate");
537
538
  // Disassemble the final operand which is implicit.
539
0
  unsigned Opcode = MCInst_getOpcode(Inst);
540
0
  bool IsWordOp = (Opcode == RISCV_TH_LWD || Opcode == RISCV_TH_LWUD ||
541
0
       Opcode == RISCV_TH_SWD);
542
0
  if (IsWordOp)
543
0
    MCOperand_CreateImm0(Inst, (3));
544
0
  else
545
0
    MCOperand_CreateImm0(Inst, (4));
546
547
0
  return MCDisassembler_Success;
548
0
}
549
550
static DecodeStatus decodeZcmpRlist(MCInst *Inst, unsigned Imm,
551
            uint64_t Address, const void *Decoder)
552
0
{
553
0
  if (Imm <= 3)
554
0
    return MCDisassembler_Fail;
555
0
  MCOperand_CreateImm0(Inst, (Imm));
556
0
  return MCDisassembler_Success;
557
0
}
558
559
static DecodeStatus decodeRegReg(MCInst *Inst, uint32_t Insn, uint64_t Address,
560
         const void *Decoder)
561
286
{
562
286
  uint32_t Rs1 = fieldFromInstruction_4(Insn, 0, 5);
563
286
  uint32_t Rs2 = fieldFromInstruction_4(Insn, 5, 5);
564
286
  if (DecodeGPRRegisterClass(Inst, Rs1, Address, Decoder) ==
565
286
      MCDisassembler_Fail)
566
0
    return MCDisassembler_Fail;
567
286
  if (DecodeGPRRegisterClass(Inst, Rs2, Address, Decoder) ==
568
286
      MCDisassembler_Fail)
569
0
    return MCDisassembler_Fail;
570
286
  return MCDisassembler_Success;
571
286
}
572
573
static DecodeStatus decodeZcmpSpimm(MCInst *Inst, unsigned Imm,
574
            uint64_t Address, const void *Decoder)
575
0
{
576
0
  MCOperand_CreateImm0(Inst, (Imm));
577
0
  return MCDisassembler_Success;
578
0
}
579
580
// Add implied SP operand for C.*SP compressed instructions. The SP operand
581
// isn't explicitly encoded in the instruction.
582
void addSPOperands(MCInst *MI)
583
42.8k
{
584
42.8k
  const MCInstrDesc *MCID = MCInstrDesc_get(MCInst_getOpcode(MI),
585
42.8k
              RISCVDescs.Insts,
586
42.8k
              ARR_SIZE(RISCVDescs.Insts));
587
42.8k
  MCOperand SPReg;
588
42.8k
  SPReg.MachineOperandType = kRegister;
589
42.8k
  SPReg.Kind = kRegister;
590
42.8k
  SPReg.RegVal = RISCV_X2;
591
141k
  for (unsigned i = 0; i < MCID->NumOperands; i++)
592
98.9k
    if (MCID->OpInfo[i].RegClass == RISCV_SPRegClassID)
593
10.1k
      MCInst_insert0(MI, i, &SPReg);
594
42.8k
}
595
596
DecodeStatus RISCV_getInstruction(MCInst *MI, uint16_t *Size,
597
          const uint8_t *Bytes, size_t BytesLen,
598
          uint64_t Address, SStream *CS)
599
80.9k
{
600
  // TODO: This will need modification when supporting instruction set
601
  // extensions with instructions > 32-bits (up to 176 bits wide).
602
80.9k
  uint32_t Insn;
603
80.9k
  DecodeStatus Result;
604
605
80.9k
#define TRY_TO_DECODE_WITH_ADDITIONAL_OPERATION( \
606
80.9k
  width, FEATURE_CHECKS, DECODER_TABLE, DESC, ADDITIONAL_OPERATION) \
607
1.23M
  do { \
608
1.35M
    if (FEATURE_CHECKS) { \
609
320k
      Result = decodeInstruction_##width( \
610
320k
        DECODER_TABLE, MI, Insn, Address, NULL); \
611
320k
      if (Result != MCDisassembler_Fail) { \
612
80.0k
        ADDITIONAL_OPERATION; \
613
80.0k
        return Result; \
614
80.0k
      } \
615
320k
    } \
616
1.23M
  } while (false)
617
80.9k
#define TRY_TO_DECODE_AND_ADD_SP(width, FEATURE_CHECKS, DECODER_TABLE, DESC) \
618
84.7k
  TRY_TO_DECODE_WITH_ADDITIONAL_OPERATION( \
619
84.7k
    width, FEATURE_CHECKS, DECODER_TABLE, DESC, addSPOperands(MI))
620
80.9k
#define TRY_TO_DECODE(width, FEATURE_CHECKS, DECODER_TABLE, DESC) \
621
1.15M
  TRY_TO_DECODE_WITH_ADDITIONAL_OPERATION( \
622
1.15M
    width, FEATURE_CHECKS, DECODER_TABLE, DESC, (void)NULL)
623
80.9k
#define TRY_TO_DECODE_FEATURE(width, FEATURE, DECODER_TABLE, DESC) \
624
1.04M
  TRY_TO_DECODE(width, RISCV_getFeatureBits(MI->csh->mode, FEATURE), \
625
1.04M
          DECODER_TABLE, DESC)
626
627
  // It's a 32 bit instruction if bit 0 and 1 are 1.
628
80.9k
  if ((Bytes[0] & 0x3) == 0x3) {
629
37.6k
    if (BytesLen < 4) {
630
216
      *Size = 0;
631
216
      return MCDisassembler_Fail;
632
216
    }
633
37.4k
    *Size = 4;
634
635
37.4k
    Insn = readBytes32(MI, Bytes);
636
637
37.4k
    TRY_TO_DECODE(4,
638
37.4k
            RISCV_getFeatureBits(MI->csh->mode,
639
37.4k
               RISCV_FeatureStdExtZdinx) &&
640
37.4k
              !RISCV_getFeatureBits(MI->csh->mode,
641
37.4k
                  RISCV_Feature64Bit),
642
37.4k
            DecoderTableRV32Zdinx32,
643
37.4k
            "RV32Zdinx table (Double in Integer and rv32)");
644
37.4k
    TRY_TO_DECODE(4,
645
37.4k
            RISCV_getFeatureBits(MI->csh->mode,
646
37.4k
               RISCV_FeatureStdExtZacas) &&
647
37.4k
              !RISCV_getFeatureBits(MI->csh->mode,
648
37.4k
                  RISCV_Feature64Bit),
649
37.4k
            DecoderTableRV32Zacas32,
650
37.4k
            "RV32Zacas table (Compare-And-Swap and rv32)");
651
37.4k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureStdExtZfinx,
652
37.4k
              DecoderTableRVZfinx32,
653
37.4k
              "RVZfinx table (Float in Integer)");
654
37.4k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXVentanaCondOps,
655
37.4k
              DecoderTableXVentana32,
656
37.4k
              "Ventana custom opcode table");
657
37.4k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadBa,
658
37.4k
              DecoderTableXTHeadBa32,
659
37.4k
              "XTHeadBa custom opcode table");
660
37.4k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadBb,
661
37.4k
              DecoderTableXTHeadBb32,
662
37.4k
              "XTHeadBb custom opcode table");
663
37.4k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadBs,
664
37.4k
              DecoderTableXTHeadBs32,
665
37.4k
              "XTHeadBs custom opcode table");
666
37.4k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadCondMov,
667
37.4k
              DecoderTableXTHeadCondMov32,
668
37.4k
              "XTHeadCondMov custom opcode table");
669
37.4k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadCmo,
670
37.4k
              DecoderTableXTHeadCmo32,
671
37.4k
              "XTHeadCmo custom opcode table");
672
37.4k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadFMemIdx,
673
37.4k
              DecoderTableXTHeadFMemIdx32,
674
37.4k
              "XTHeadFMemIdx custom opcode table");
675
37.4k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadMac,
676
37.4k
              DecoderTableXTHeadMac32,
677
37.4k
              "XTHeadMac custom opcode table");
678
37.4k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadMemIdx,
679
37.4k
              DecoderTableXTHeadMemIdx32,
680
37.4k
              "XTHeadMemIdx custom opcode table");
681
37.4k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadMemPair,
682
37.4k
              DecoderTableXTHeadMemPair32,
683
37.4k
              "XTHeadMemPair custom opcode table");
684
37.4k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadSync,
685
37.4k
              DecoderTableXTHeadSync32,
686
37.4k
              "XTHeadSync custom opcode table");
687
37.4k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadVdot,
688
37.4k
              DecoderTableXTHeadVdot32,
689
37.4k
              "XTHeadVdot custom opcode table");
690
37.4k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXSfvcp,
691
37.4k
              DecoderTableXSfvcp32,
692
37.4k
              "SiFive VCIX custom opcode table");
693
37.4k
    TRY_TO_DECODE_FEATURE(
694
37.4k
      4, RISCV_FeatureVendorXSfvqmaccdod,
695
37.4k
      DecoderTableXSfvqmaccdod32,
696
37.4k
      "SiFive Matrix Multiplication (2x8 and 8x2) Instruction opcode table");
697
37.4k
    TRY_TO_DECODE_FEATURE(
698
37.4k
      4, RISCV_FeatureVendorXSfvqmaccqoq,
699
37.4k
      DecoderTableXSfvqmaccqoq32,
700
37.4k
      "SiFive Matrix Multiplication (4x8 and 8x4) Instruction opcode table");
701
37.4k
    TRY_TO_DECODE_FEATURE(
702
37.4k
      4, RISCV_FeatureVendorXSfvfwmaccqqq,
703
37.4k
      DecoderTableXSfvfwmaccqqq32,
704
37.4k
      "SiFive Matrix Multiplication Instruction opcode table");
705
37.4k
    TRY_TO_DECODE_FEATURE(
706
37.4k
      4, RISCV_FeatureVendorXSfvfnrclipxfqf,
707
37.4k
      DecoderTableXSfvfnrclipxfqf32,
708
37.4k
      "SiFive FP32-to-int8 Ranged Clip Instructions opcode table");
709
37.4k
    TRY_TO_DECODE_FEATURE(
710
36.2k
      4, RISCV_FeatureVendorXCVbitmanip,
711
36.2k
      DecoderTableXCVbitmanip32,
712
36.2k
      "CORE-V Bit Manipulation custom opcode table");
713
36.2k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXCVelw,
714
36.2k
              DecoderTableXCVelw32,
715
36.2k
              "CORE-V Event load custom opcode table");
716
36.2k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXCVmac,
717
35.8k
              DecoderTableXCVmac32,
718
35.8k
              "CORE-V MAC custom opcode table");
719
35.8k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXCVmem,
720
34.7k
              DecoderTableXCVmem32,
721
34.7k
              "CORE-V MEM custom opcode table");
722
34.7k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXCValu,
723
34.5k
              DecoderTableXCValu32,
724
34.5k
              "CORE-V ALU custom opcode table");
725
34.5k
    TRY_TO_DECODE_FEATURE(
726
33.1k
      4, RISCV_FeatureVendorXCVsimd, DecoderTableXCVsimd32,
727
33.1k
      "CORE-V SIMD extensions custom opcode table");
728
33.1k
    TRY_TO_DECODE_FEATURE(
729
32.9k
      4, RISCV_FeatureVendorXCVbi, DecoderTableXCVbi32,
730
32.9k
      "CORE-V Immediate Branching custom opcode table");
731
32.9k
    TRY_TO_DECODE(4, true, DecoderTable32, "RISCV32 table");
732
733
234
    return MCDisassembler_Fail;
734
32.9k
  }
735
736
43.2k
  if (BytesLen < 2) {
737
311
    *Size = 0;
738
311
    return MCDisassembler_Fail;
739
311
  }
740
42.9k
  *Size = 2;
741
742
42.9k
  Insn = readBytes16(MI, Bytes);
743
42.9k
  TRY_TO_DECODE_AND_ADD_SP(
744
41.7k
    2, !RISCV_getFeatureBits(MI->csh->mode, RISCV_Feature64Bit),
745
41.7k
    DecoderTableRISCV32Only_16,
746
41.7k
    "RISCV32Only_16 table (16-bit Instruction)");
747
41.7k
  TRY_TO_DECODE_FEATURE(2, RISCV_FeatureStdExtZicfiss,
748
41.7k
            DecoderTableZicfiss16,
749
41.7k
            "RVZicfiss table (Shadow Stack)");
750
41.7k
  TRY_TO_DECODE_FEATURE(2, RISCV_FeatureStdExtZcmt, DecoderTableRVZcmt16,
751
41.7k
            "Zcmt table (16-bit Table Jump Instructions)");
752
41.7k
  TRY_TO_DECODE_FEATURE(
753
41.7k
    2, RISCV_FeatureStdExtZcmp, DecoderTableRVZcmp16,
754
41.7k
    "Zcmp table (16-bit Push/Pop & Double Move Instructions)");
755
41.7k
  TRY_TO_DECODE_AND_ADD_SP(2, true, DecoderTable16,
756
177
         "RISCV_C table (16-bit Instruction)");
757
758
177
  return MCDisassembler_Fail;
759
41.7k
}
760
761
bool RISCV_LLVM_getInstruction(csh handle, const uint8_t *Bytes, size_t ByteLen,
762
             MCInst *MI, uint16_t *Size, uint64_t Address,
763
             void *Info)
764
80.9k
{
765
80.9k
  RISCV_init_cs_detail(MI);
766
80.9k
  MI->MRI = (MCRegisterInfo *)Info;
767
80.9k
  DecodeStatus ret =
768
80.9k
    RISCV_getInstruction(MI, Size, Bytes, ByteLen, Address, NULL);
769
770
80.9k
  MCInst_handleWriteback(MI, RISCVDescs.Insts,
771
80.9k
             ARR_SIZE(RISCVDescs.Insts));
772
773
80.9k
  return ret != MCDisassembler_Fail;
774
80.9k
}