1 //===- AArch64Disassembler.cpp - Disassembler for AArch64 -----------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
12 #include "AArch64Disassembler.h"
13 #include "AArch64ExternalSymbolizer.h"
14 #include "MCTargetDesc/AArch64AddressingModes.h"
15 #include "MCTargetDesc/AArch64MCTargetDesc.h"
16 #include "TargetInfo/AArch64TargetInfo.h"
17 #include "Utils/AArch64BaseInfo.h"
18 #include "llvm-c/Disassembler.h"
19 #include "llvm/MC/MCDisassembler/MCRelocationInfo.h"
20 #include "llvm/MC/MCFixedLenDisassembler.h"
21 #include "llvm/MC/MCInst.h"
22 #include "llvm/MC/MCRegisterInfo.h"
23 #include "llvm/MC/MCSubtargetInfo.h"
24 #include "llvm/Support/Compiler.h"
25 #include "llvm/Support/Debug.h"
26 #include "llvm/Support/ErrorHandling.h"
27 #include "llvm/Support/TargetRegistry.h"
33 #define DEBUG_TYPE "aarch64-disassembler"
35 // Pull DecodeStatus and its enum values into the global namespace.
36 using DecodeStatus
= MCDisassembler::DecodeStatus
;
38 // Forward declare these because the autogenerated code will reference them.
39 // Definitions are further down.
40 static DecodeStatus
DecodeFPR128RegisterClass(MCInst
&Inst
,
41 unsigned RegNo
, uint64_t Address
,
43 static DecodeStatus
DecodeFPR128_loRegisterClass(MCInst
&Inst
,
47 static DecodeStatus
DecodeFPR64RegisterClass(MCInst
&Inst
, unsigned RegNo
,
50 static DecodeStatus
DecodeFPR32RegisterClass(MCInst
&Inst
, unsigned RegNo
,
53 static DecodeStatus
DecodeFPR16RegisterClass(MCInst
&Inst
, unsigned RegNo
,
56 static DecodeStatus
DecodeFPR8RegisterClass(MCInst
&Inst
, unsigned RegNo
,
59 static DecodeStatus
DecodeGPR64commonRegisterClass(MCInst
&Inst
, unsigned RegNo
,
62 static DecodeStatus
DecodeGPR64RegisterClass(MCInst
&Inst
, unsigned RegNo
,
65 static DecodeStatus
DecodeGPR64x8ClassRegisterClass(MCInst
&Inst
,
69 static DecodeStatus
DecodeGPR64spRegisterClass(MCInst
&Inst
,
70 unsigned RegNo
, uint64_t Address
,
72 static DecodeStatus
DecodeMatrixIndexGPR32_12_15RegisterClass(MCInst
&Inst
,
76 static DecodeStatus
DecodeGPR32RegisterClass(MCInst
&Inst
, unsigned RegNo
,
79 static DecodeStatus
DecodeGPR32spRegisterClass(MCInst
&Inst
,
80 unsigned RegNo
, uint64_t Address
,
82 static DecodeStatus
DecodeQQRegisterClass(MCInst
&Inst
, unsigned RegNo
,
85 static DecodeStatus
DecodeQQQRegisterClass(MCInst
&Inst
, unsigned RegNo
,
88 static DecodeStatus
DecodeQQQQRegisterClass(MCInst
&Inst
, unsigned RegNo
,
91 static DecodeStatus
DecodeDDRegisterClass(MCInst
&Inst
, unsigned RegNo
,
94 static DecodeStatus
DecodeDDDRegisterClass(MCInst
&Inst
, unsigned RegNo
,
97 static DecodeStatus
DecodeDDDDRegisterClass(MCInst
&Inst
, unsigned RegNo
,
100 static DecodeStatus
DecodeZPRRegisterClass(MCInst
&Inst
, unsigned RegNo
,
102 const void *Decoder
);
103 static DecodeStatus
DecodeZPR_4bRegisterClass(MCInst
&Inst
, unsigned RegNo
,
105 const void *Decoder
);
106 static DecodeStatus
DecodeZPR_3bRegisterClass(MCInst
&Inst
, unsigned RegNo
,
108 const void *Decoder
);
109 static DecodeStatus
DecodeZPR2RegisterClass(MCInst
&Inst
, unsigned RegNo
,
111 const void *Decoder
);
112 static DecodeStatus
DecodeZPR3RegisterClass(MCInst
&Inst
, unsigned RegNo
,
114 const void *Decoder
);
115 static DecodeStatus
DecodeZPR4RegisterClass(MCInst
&Inst
, unsigned RegNo
,
117 const void *Decoder
);
118 template <unsigned NumBitsForTile
>
119 static DecodeStatus
DecodeMatrixTile(MCInst
&Inst
, unsigned RegNo
,
120 uint64_t Address
, const void *Decoder
);
121 static DecodeStatus
DecodeMatrixTileListRegisterClass(MCInst
&Inst
,
124 const void *Decoder
);
125 static DecodeStatus
DecodePPRRegisterClass(MCInst
&Inst
, unsigned RegNo
,
127 const void *Decoder
);
128 static DecodeStatus
DecodePPR_3bRegisterClass(MCInst
&Inst
, unsigned RegNo
,
130 const void *Decoder
);
132 static DecodeStatus
DecodeFixedPointScaleImm32(MCInst
&Inst
, unsigned Imm
,
134 const void *Decoder
);
135 static DecodeStatus
DecodeFixedPointScaleImm64(MCInst
&Inst
, unsigned Imm
,
137 const void *Decoder
);
138 static DecodeStatus
DecodePCRelLabel19(MCInst
&Inst
, unsigned Imm
,
139 uint64_t Address
, const void *Decoder
);
140 static DecodeStatus
DecodeMemExtend(MCInst
&Inst
, unsigned Imm
,
141 uint64_t Address
, const void *Decoder
);
142 static DecodeStatus
DecodeMRSSystemRegister(MCInst
&Inst
, unsigned Imm
,
143 uint64_t Address
, const void *Decoder
);
144 static DecodeStatus
DecodeMSRSystemRegister(MCInst
&Inst
, unsigned Imm
,
145 uint64_t Address
, const void *Decoder
);
146 static DecodeStatus
DecodeThreeAddrSRegInstruction(MCInst
&Inst
, uint32_t insn
,
148 const void *Decoder
);
149 static DecodeStatus
DecodeMoveImmInstruction(MCInst
&Inst
, uint32_t insn
,
151 const void *Decoder
);
152 static DecodeStatus
DecodeUnsignedLdStInstruction(MCInst
&Inst
, uint32_t insn
,
154 const void *Decoder
);
155 static DecodeStatus
DecodeSignedLdStInstruction(MCInst
&Inst
, uint32_t insn
,
157 const void *Decoder
);
158 static DecodeStatus
DecodeExclusiveLdStInstruction(MCInst
&Inst
, uint32_t insn
,
160 const void *Decoder
);
161 static DecodeStatus
DecodePairLdStInstruction(MCInst
&Inst
, uint32_t insn
,
163 const void *Decoder
);
164 static DecodeStatus
DecodeAuthLoadInstruction(MCInst
&Inst
, uint32_t insn
,
166 const void *Decoder
);
167 static DecodeStatus
DecodeAddSubERegInstruction(MCInst
&Inst
, uint32_t insn
,
169 const void *Decoder
);
170 static DecodeStatus
DecodeLogicalImmInstruction(MCInst
&Inst
, uint32_t insn
,
172 const void *Decoder
);
173 static DecodeStatus
DecodeModImmInstruction(MCInst
&Inst
, uint32_t insn
,
175 const void *Decoder
);
176 static DecodeStatus
DecodeModImmTiedInstruction(MCInst
&Inst
, uint32_t insn
,
178 const void *Decoder
);
179 static DecodeStatus
DecodeAdrInstruction(MCInst
&Inst
, uint32_t insn
,
180 uint64_t Address
, const void *Decoder
);
181 static DecodeStatus
DecodeAddSubImmShift(MCInst
&Inst
, uint32_t insn
,
182 uint64_t Address
, const void *Decoder
);
183 static DecodeStatus
DecodeUnconditionalBranch(MCInst
&Inst
, uint32_t insn
,
185 const void *Decoder
);
186 static DecodeStatus
DecodeSystemPStateInstruction(MCInst
&Inst
, uint32_t insn
,
188 const void *Decoder
);
189 static DecodeStatus
DecodeTestAndBranch(MCInst
&Inst
, uint32_t insn
,
190 uint64_t Address
, const void *Decoder
);
192 static DecodeStatus
DecodeFMOVLaneInstruction(MCInst
&Inst
, unsigned Insn
,
194 const void *Decoder
);
195 static DecodeStatus
DecodeVecShiftR64Imm(MCInst
&Inst
, unsigned Imm
,
196 uint64_t Addr
, const void *Decoder
);
197 static DecodeStatus
DecodeVecShiftR64ImmNarrow(MCInst
&Inst
, unsigned Imm
,
199 const void *Decoder
);
200 static DecodeStatus
DecodeVecShiftR32Imm(MCInst
&Inst
, unsigned Imm
,
201 uint64_t Addr
, const void *Decoder
);
202 static DecodeStatus
DecodeVecShiftR32ImmNarrow(MCInst
&Inst
, unsigned Imm
,
204 const void *Decoder
);
205 static DecodeStatus
DecodeVecShiftR16Imm(MCInst
&Inst
, unsigned Imm
,
206 uint64_t Addr
, const void *Decoder
);
207 static DecodeStatus
DecodeVecShiftR16ImmNarrow(MCInst
&Inst
, unsigned Imm
,
209 const void *Decoder
);
210 static DecodeStatus
DecodeVecShiftR8Imm(MCInst
&Inst
, unsigned Imm
,
211 uint64_t Addr
, const void *Decoder
);
212 static DecodeStatus
DecodeVecShiftL64Imm(MCInst
&Inst
, unsigned Imm
,
213 uint64_t Addr
, const void *Decoder
);
214 static DecodeStatus
DecodeVecShiftL32Imm(MCInst
&Inst
, unsigned Imm
,
215 uint64_t Addr
, const void *Decoder
);
216 static DecodeStatus
DecodeVecShiftL16Imm(MCInst
&Inst
, unsigned Imm
,
217 uint64_t Addr
, const void *Decoder
);
218 static DecodeStatus
DecodeVecShiftL8Imm(MCInst
&Inst
, unsigned Imm
,
219 uint64_t Addr
, const void *Decoder
);
220 static DecodeStatus
DecodeWSeqPairsClassRegisterClass(MCInst
&Inst
,
223 const void *Decoder
);
224 static DecodeStatus
DecodeXSeqPairsClassRegisterClass(MCInst
&Inst
,
227 const void *Decoder
);
228 static DecodeStatus
DecodeSVELogicalImmInstruction(MCInst
&Inst
, uint32_t insn
,
230 const void *Decoder
);
232 static DecodeStatus
DecodeSImm(MCInst
&Inst
, uint64_t Imm
, uint64_t Address
,
233 const void *Decoder
);
234 template <int ElementWidth
>
235 static DecodeStatus
DecodeImm8OptLsl(MCInst
&Inst
, unsigned Imm
,
236 uint64_t Addr
, const void *Decoder
);
237 static DecodeStatus
DecodeSVEIncDecImm(MCInst
&Inst
, unsigned Imm
,
238 uint64_t Addr
, const void *Decoder
);
239 static DecodeStatus
DecodeSVCROp(MCInst
&Inst
, unsigned Imm
, uint64_t Address
,
240 const void *Decoder
);
242 static bool Check(DecodeStatus
&Out
, DecodeStatus In
) {
244 case MCDisassembler::Success
:
245 // Out stays the same.
247 case MCDisassembler::SoftFail
:
250 case MCDisassembler::Fail
:
254 llvm_unreachable("Invalid DecodeStatus!");
257 #include "AArch64GenDisassemblerTables.inc"
258 #include "AArch64GenInstrInfo.inc"
260 #define Success MCDisassembler::Success
261 #define Fail MCDisassembler::Fail
262 #define SoftFail MCDisassembler::SoftFail
264 static MCDisassembler
*createAArch64Disassembler(const Target
&T
,
265 const MCSubtargetInfo
&STI
,
267 return new AArch64Disassembler(STI
, Ctx
);
270 DecodeStatus
AArch64Disassembler::getInstruction(MCInst
&MI
, uint64_t &Size
,
271 ArrayRef
<uint8_t> Bytes
,
273 raw_ostream
&CS
) const {
277 // We want to read exactly 4 bytes of data.
278 if (Bytes
.size() < 4)
282 // Encoded as a small-endian 32-bit word in the stream.
284 (Bytes
[3] << 24) | (Bytes
[2] << 16) | (Bytes
[1] << 8) | (Bytes
[0] << 0);
286 const uint8_t *Tables
[] = {DecoderTable32
, DecoderTableFallback32
};
288 for (auto Table
: Tables
) {
289 DecodeStatus Result
=
290 decodeInstruction(Table
, MI
, Insn
, Address
, this, STI
);
292 switch (MI
.getOpcode()) {
295 // For Scalable Matrix Extension (SME) instructions that have an implicit
296 // operand for the accumulator (ZA) which isn't encoded, manually insert
298 case AArch64::LDR_ZA
:
299 case AArch64::STR_ZA
: {
300 MI
.insert(MI
.begin(), MCOperand::createReg(AArch64::ZA
));
301 // Spill and fill instructions have a single immediate used for both the
302 // vector select offset and optional memory offset. Replicate the decoded
304 const MCOperand
&Imm4Op
= MI
.getOperand(2);
305 assert(Imm4Op
.isImm() && "Unexpected operand type!");
306 MI
.addOperand(Imm4Op
);
309 case AArch64::LD1_MXIPXX_H_B
:
310 case AArch64::LD1_MXIPXX_V_B
:
311 case AArch64::ST1_MXIPXX_H_B
:
312 case AArch64::ST1_MXIPXX_V_B
:
313 case AArch64::INSERT_MXIPZ_H_B
:
314 case AArch64::INSERT_MXIPZ_V_B
:
316 // MOVA ZA0<HV>.B[<Ws>, <imm>], <Pg>/M, <Zn>.B
317 // ^ insert implicit 8-bit element tile
318 MI
.insert(MI
.begin(), MCOperand::createReg(AArch64::ZAB0
));
320 case AArch64::EXTRACT_ZPMXI_H_B
:
321 case AArch64::EXTRACT_ZPMXI_V_B
:
322 // MOVA <Zd>.B, <Pg>/M, ZA0<HV>.B[<Ws>, <imm>]
323 // ^ insert implicit 8-bit element tile
324 MI
.insert(MI
.begin()+2, MCOperand::createReg(AArch64::ZAB0
));
328 if (Result
!= MCDisassembler::Fail
)
332 return MCDisassembler::Fail
;
335 static MCSymbolizer
*
336 createAArch64ExternalSymbolizer(const Triple
&TT
, LLVMOpInfoCallback GetOpInfo
,
337 LLVMSymbolLookupCallback SymbolLookUp
,
338 void *DisInfo
, MCContext
*Ctx
,
339 std::unique_ptr
<MCRelocationInfo
> &&RelInfo
) {
340 return new AArch64ExternalSymbolizer(*Ctx
, std::move(RelInfo
), GetOpInfo
,
341 SymbolLookUp
, DisInfo
);
344 extern "C" LLVM_EXTERNAL_VISIBILITY
void LLVMInitializeAArch64Disassembler() {
345 TargetRegistry::RegisterMCDisassembler(getTheAArch64leTarget(),
346 createAArch64Disassembler
);
347 TargetRegistry::RegisterMCDisassembler(getTheAArch64beTarget(),
348 createAArch64Disassembler
);
349 TargetRegistry::RegisterMCSymbolizer(getTheAArch64leTarget(),
350 createAArch64ExternalSymbolizer
);
351 TargetRegistry::RegisterMCSymbolizer(getTheAArch64beTarget(),
352 createAArch64ExternalSymbolizer
);
353 TargetRegistry::RegisterMCDisassembler(getTheAArch64_32Target(),
354 createAArch64Disassembler
);
355 TargetRegistry::RegisterMCSymbolizer(getTheAArch64_32Target(),
356 createAArch64ExternalSymbolizer
);
358 TargetRegistry::RegisterMCDisassembler(getTheARM64Target(),
359 createAArch64Disassembler
);
360 TargetRegistry::RegisterMCSymbolizer(getTheARM64Target(),
361 createAArch64ExternalSymbolizer
);
362 TargetRegistry::RegisterMCDisassembler(getTheARM64_32Target(),
363 createAArch64Disassembler
);
364 TargetRegistry::RegisterMCSymbolizer(getTheARM64_32Target(),
365 createAArch64ExternalSymbolizer
);
368 static DecodeStatus
DecodeFPR128RegisterClass(MCInst
&Inst
, unsigned RegNo
,
370 const void *Decoder
) {
375 AArch64MCRegisterClasses
[AArch64::FPR128RegClassID
].getRegister(RegNo
);
376 Inst
.addOperand(MCOperand::createReg(Register
));
380 static DecodeStatus
DecodeFPR128_loRegisterClass(MCInst
&Inst
, unsigned RegNo
,
382 const void *Decoder
) {
385 return DecodeFPR128RegisterClass(Inst
, RegNo
, Addr
, Decoder
);
388 static DecodeStatus
DecodeFPR64RegisterClass(MCInst
&Inst
, unsigned RegNo
,
390 const void *Decoder
) {
395 AArch64MCRegisterClasses
[AArch64::FPR64RegClassID
].getRegister(RegNo
);
396 Inst
.addOperand(MCOperand::createReg(Register
));
400 static DecodeStatus
DecodeFPR32RegisterClass(MCInst
&Inst
, unsigned RegNo
,
402 const void *Decoder
) {
407 AArch64MCRegisterClasses
[AArch64::FPR32RegClassID
].getRegister(RegNo
);
408 Inst
.addOperand(MCOperand::createReg(Register
));
412 static DecodeStatus
DecodeFPR16RegisterClass(MCInst
&Inst
, unsigned RegNo
,
414 const void *Decoder
) {
419 AArch64MCRegisterClasses
[AArch64::FPR16RegClassID
].getRegister(RegNo
);
420 Inst
.addOperand(MCOperand::createReg(Register
));
424 static DecodeStatus
DecodeFPR8RegisterClass(MCInst
&Inst
, unsigned RegNo
,
426 const void *Decoder
) {
431 AArch64MCRegisterClasses
[AArch64::FPR8RegClassID
].getRegister(RegNo
);
432 Inst
.addOperand(MCOperand::createReg(Register
));
436 static DecodeStatus
DecodeGPR64commonRegisterClass(MCInst
&Inst
, unsigned RegNo
,
438 const void *Decoder
) {
443 AArch64MCRegisterClasses
[AArch64::GPR64commonRegClassID
].getRegister(
445 Inst
.addOperand(MCOperand::createReg(Register
));
449 static DecodeStatus
DecodeGPR64RegisterClass(MCInst
&Inst
, unsigned RegNo
,
451 const void *Decoder
) {
456 AArch64MCRegisterClasses
[AArch64::GPR64RegClassID
].getRegister(RegNo
);
457 Inst
.addOperand(MCOperand::createReg(Register
));
461 static DecodeStatus
DecodeGPR64x8ClassRegisterClass(MCInst
&Inst
,
464 const void *Decoder
) {
471 AArch64MCRegisterClasses
[AArch64::GPR64x8ClassRegClassID
].getRegister(
473 Inst
.addOperand(MCOperand::createReg(Register
));
477 static DecodeStatus
DecodeGPR64spRegisterClass(MCInst
&Inst
, unsigned RegNo
,
479 const void *Decoder
) {
483 AArch64MCRegisterClasses
[AArch64::GPR64spRegClassID
].getRegister(RegNo
);
484 Inst
.addOperand(MCOperand::createReg(Register
));
488 static DecodeStatus
DecodeMatrixIndexGPR32_12_15RegisterClass(MCInst
&Inst
,
491 const void *Decoder
) {
496 AArch64MCRegisterClasses
[AArch64::MatrixIndexGPR32_12_15RegClassID
]
498 Inst
.addOperand(MCOperand::createReg(Register
));
502 static DecodeStatus
DecodeGPR32RegisterClass(MCInst
&Inst
, unsigned RegNo
,
504 const void *Decoder
) {
509 AArch64MCRegisterClasses
[AArch64::GPR32RegClassID
].getRegister(RegNo
);
510 Inst
.addOperand(MCOperand::createReg(Register
));
514 static DecodeStatus
DecodeGPR32spRegisterClass(MCInst
&Inst
, unsigned RegNo
,
516 const void *Decoder
) {
521 AArch64MCRegisterClasses
[AArch64::GPR32spRegClassID
].getRegister(RegNo
);
522 Inst
.addOperand(MCOperand::createReg(Register
));
526 static DecodeStatus
DecodeZPRRegisterClass(MCInst
&Inst
, unsigned RegNo
,
528 const void* Decoder
) {
533 AArch64MCRegisterClasses
[AArch64::ZPRRegClassID
].getRegister(RegNo
);
534 Inst
.addOperand(MCOperand::createReg(Register
));
538 static DecodeStatus
DecodeZPR_4bRegisterClass(MCInst
&Inst
, unsigned RegNo
,
540 const void *Decoder
) {
543 return DecodeZPRRegisterClass(Inst
, RegNo
, Address
, Decoder
);
546 static DecodeStatus
DecodeZPR_3bRegisterClass(MCInst
&Inst
, unsigned RegNo
,
548 const void *Decoder
) {
551 return DecodeZPRRegisterClass(Inst
, RegNo
, Address
, Decoder
);
554 static DecodeStatus
DecodeZPR2RegisterClass(MCInst
&Inst
, unsigned RegNo
,
556 const void* Decoder
) {
560 AArch64MCRegisterClasses
[AArch64::ZPR2RegClassID
].getRegister(RegNo
);
561 Inst
.addOperand(MCOperand::createReg(Register
));
565 static DecodeStatus
DecodeZPR3RegisterClass(MCInst
&Inst
, unsigned RegNo
,
567 const void* Decoder
) {
571 AArch64MCRegisterClasses
[AArch64::ZPR3RegClassID
].getRegister(RegNo
);
572 Inst
.addOperand(MCOperand::createReg(Register
));
576 static DecodeStatus
DecodeZPR4RegisterClass(MCInst
&Inst
, unsigned RegNo
,
578 const void* Decoder
) {
582 AArch64MCRegisterClasses
[AArch64::ZPR4RegClassID
].getRegister(RegNo
);
583 Inst
.addOperand(MCOperand::createReg(Register
));
587 static DecodeStatus
DecodeMatrixTileListRegisterClass(MCInst
&Inst
,
590 const void *Decoder
) {
593 Inst
.addOperand(MCOperand::createImm(RegMask
));
597 static const SmallVector
<SmallVector
<unsigned, 16>, 5>
598 MatrixZATileDecoderTable
= {
600 {AArch64::ZAH0
, AArch64::ZAH1
},
601 {AArch64::ZAS0
, AArch64::ZAS1
, AArch64::ZAS2
, AArch64::ZAS3
},
602 {AArch64::ZAD0
, AArch64::ZAD1
, AArch64::ZAD2
, AArch64::ZAD3
,
603 AArch64::ZAD4
, AArch64::ZAD5
, AArch64::ZAD6
, AArch64::ZAD7
},
604 {AArch64::ZAQ0
, AArch64::ZAQ1
, AArch64::ZAQ2
, AArch64::ZAQ3
,
605 AArch64::ZAQ4
, AArch64::ZAQ5
, AArch64::ZAQ6
, AArch64::ZAQ7
,
606 AArch64::ZAQ8
, AArch64::ZAQ9
, AArch64::ZAQ10
, AArch64::ZAQ11
,
607 AArch64::ZAQ12
, AArch64::ZAQ13
, AArch64::ZAQ14
, AArch64::ZAQ15
}};
609 template <unsigned NumBitsForTile
>
610 static DecodeStatus
DecodeMatrixTile(MCInst
&Inst
, unsigned RegNo
,
611 uint64_t Address
, const void *Decoder
) {
612 unsigned LastReg
= (1 << NumBitsForTile
) - 1;
616 MCOperand::createReg(MatrixZATileDecoderTable
[NumBitsForTile
][RegNo
]));
620 static DecodeStatus
DecodePPRRegisterClass(MCInst
&Inst
, unsigned RegNo
,
621 uint64_t Addr
, const void *Decoder
) {
626 AArch64MCRegisterClasses
[AArch64::PPRRegClassID
].getRegister(RegNo
);
627 Inst
.addOperand(MCOperand::createReg(Register
));
631 static DecodeStatus
DecodePPR_3bRegisterClass(MCInst
&Inst
, unsigned RegNo
,
633 const void* Decoder
) {
637 // Just reuse the PPR decode table
638 return DecodePPRRegisterClass(Inst
, RegNo
, Addr
, Decoder
);
641 static DecodeStatus
DecodeQQRegisterClass(MCInst
&Inst
, unsigned RegNo
,
642 uint64_t Addr
, const void *Decoder
) {
646 AArch64MCRegisterClasses
[AArch64::QQRegClassID
].getRegister(RegNo
);
647 Inst
.addOperand(MCOperand::createReg(Register
));
651 static DecodeStatus
DecodeQQQRegisterClass(MCInst
&Inst
, unsigned RegNo
,
652 uint64_t Addr
, const void *Decoder
) {
656 AArch64MCRegisterClasses
[AArch64::QQQRegClassID
].getRegister(RegNo
);
657 Inst
.addOperand(MCOperand::createReg(Register
));
661 static DecodeStatus
DecodeQQQQRegisterClass(MCInst
&Inst
, unsigned RegNo
,
663 const void *Decoder
) {
667 AArch64MCRegisterClasses
[AArch64::QQQQRegClassID
].getRegister(RegNo
);
668 Inst
.addOperand(MCOperand::createReg(Register
));
672 static DecodeStatus
DecodeDDRegisterClass(MCInst
&Inst
, unsigned RegNo
,
673 uint64_t Addr
, const void *Decoder
) {
677 AArch64MCRegisterClasses
[AArch64::DDRegClassID
].getRegister(RegNo
);
678 Inst
.addOperand(MCOperand::createReg(Register
));
682 static DecodeStatus
DecodeDDDRegisterClass(MCInst
&Inst
, unsigned RegNo
,
683 uint64_t Addr
, const void *Decoder
) {
687 AArch64MCRegisterClasses
[AArch64::DDDRegClassID
].getRegister(RegNo
);
688 Inst
.addOperand(MCOperand::createReg(Register
));
692 static DecodeStatus
DecodeDDDDRegisterClass(MCInst
&Inst
, unsigned RegNo
,
694 const void *Decoder
) {
698 AArch64MCRegisterClasses
[AArch64::DDDDRegClassID
].getRegister(RegNo
);
699 Inst
.addOperand(MCOperand::createReg(Register
));
703 static DecodeStatus
DecodeFixedPointScaleImm32(MCInst
&Inst
, unsigned Imm
,
705 const void *Decoder
) {
706 // scale{5} is asserted as 1 in tblgen.
708 Inst
.addOperand(MCOperand::createImm(64 - Imm
));
712 static DecodeStatus
DecodeFixedPointScaleImm64(MCInst
&Inst
, unsigned Imm
,
714 const void *Decoder
) {
715 Inst
.addOperand(MCOperand::createImm(64 - Imm
));
719 static DecodeStatus
DecodePCRelLabel19(MCInst
&Inst
, unsigned Imm
,
720 uint64_t Addr
, const void *Decoder
) {
721 int64_t ImmVal
= Imm
;
722 const AArch64Disassembler
*Dis
=
723 static_cast<const AArch64Disassembler
*>(Decoder
);
725 // Sign-extend 19-bit immediate.
726 if (ImmVal
& (1 << (19 - 1)))
727 ImmVal
|= ~((1LL << 19) - 1);
729 if (!Dis
->tryAddingSymbolicOperand(Inst
, ImmVal
* 4, Addr
,
730 Inst
.getOpcode() != AArch64::LDRXl
, 0, 4))
731 Inst
.addOperand(MCOperand::createImm(ImmVal
));
735 static DecodeStatus
DecodeMemExtend(MCInst
&Inst
, unsigned Imm
,
736 uint64_t Address
, const void *Decoder
) {
737 Inst
.addOperand(MCOperand::createImm((Imm
>> 1) & 1));
738 Inst
.addOperand(MCOperand::createImm(Imm
& 1));
742 static DecodeStatus
DecodeMRSSystemRegister(MCInst
&Inst
, unsigned Imm
,
744 const void *Decoder
) {
745 Inst
.addOperand(MCOperand::createImm(Imm
));
747 // Every system register in the encoding space is valid with the syntax
748 // S<op0>_<op1>_<Cn>_<Cm>_<op2>, so decoding system registers always succeeds.
752 static DecodeStatus
DecodeMSRSystemRegister(MCInst
&Inst
, unsigned Imm
,
754 const void *Decoder
) {
755 Inst
.addOperand(MCOperand::createImm(Imm
));
760 static DecodeStatus
DecodeFMOVLaneInstruction(MCInst
&Inst
, unsigned Insn
,
762 const void *Decoder
) {
763 // This decoder exists to add the dummy Lane operand to the MCInst, which must
764 // be 1 in assembly but has no other real manifestation.
765 unsigned Rd
= fieldFromInstruction(Insn
, 0, 5);
766 unsigned Rn
= fieldFromInstruction(Insn
, 5, 5);
767 unsigned IsToVec
= fieldFromInstruction(Insn
, 16, 1);
770 DecodeFPR128RegisterClass(Inst
, Rd
, Address
, Decoder
);
771 DecodeGPR64RegisterClass(Inst
, Rn
, Address
, Decoder
);
773 DecodeGPR64RegisterClass(Inst
, Rd
, Address
, Decoder
);
774 DecodeFPR128RegisterClass(Inst
, Rn
, Address
, Decoder
);
778 Inst
.addOperand(MCOperand::createImm(1));
783 static DecodeStatus
DecodeVecShiftRImm(MCInst
&Inst
, unsigned Imm
,
785 Inst
.addOperand(MCOperand::createImm(Add
- Imm
));
789 static DecodeStatus
DecodeVecShiftLImm(MCInst
&Inst
, unsigned Imm
,
791 Inst
.addOperand(MCOperand::createImm((Imm
+ Add
) & (Add
- 1)));
795 static DecodeStatus
DecodeVecShiftR64Imm(MCInst
&Inst
, unsigned Imm
,
796 uint64_t Addr
, const void *Decoder
) {
797 return DecodeVecShiftRImm(Inst
, Imm
, 64);
800 static DecodeStatus
DecodeVecShiftR64ImmNarrow(MCInst
&Inst
, unsigned Imm
,
802 const void *Decoder
) {
803 return DecodeVecShiftRImm(Inst
, Imm
| 0x20, 64);
806 static DecodeStatus
DecodeVecShiftR32Imm(MCInst
&Inst
, unsigned Imm
,
807 uint64_t Addr
, const void *Decoder
) {
808 return DecodeVecShiftRImm(Inst
, Imm
, 32);
811 static DecodeStatus
DecodeVecShiftR32ImmNarrow(MCInst
&Inst
, unsigned Imm
,
813 const void *Decoder
) {
814 return DecodeVecShiftRImm(Inst
, Imm
| 0x10, 32);
817 static DecodeStatus
DecodeVecShiftR16Imm(MCInst
&Inst
, unsigned Imm
,
818 uint64_t Addr
, const void *Decoder
) {
819 return DecodeVecShiftRImm(Inst
, Imm
, 16);
822 static DecodeStatus
DecodeVecShiftR16ImmNarrow(MCInst
&Inst
, unsigned Imm
,
824 const void *Decoder
) {
825 return DecodeVecShiftRImm(Inst
, Imm
| 0x8, 16);
828 static DecodeStatus
DecodeVecShiftR8Imm(MCInst
&Inst
, unsigned Imm
,
829 uint64_t Addr
, const void *Decoder
) {
830 return DecodeVecShiftRImm(Inst
, Imm
, 8);
833 static DecodeStatus
DecodeVecShiftL64Imm(MCInst
&Inst
, unsigned Imm
,
834 uint64_t Addr
, const void *Decoder
) {
835 return DecodeVecShiftLImm(Inst
, Imm
, 64);
838 static DecodeStatus
DecodeVecShiftL32Imm(MCInst
&Inst
, unsigned Imm
,
839 uint64_t Addr
, const void *Decoder
) {
840 return DecodeVecShiftLImm(Inst
, Imm
, 32);
843 static DecodeStatus
DecodeVecShiftL16Imm(MCInst
&Inst
, unsigned Imm
,
844 uint64_t Addr
, const void *Decoder
) {
845 return DecodeVecShiftLImm(Inst
, Imm
, 16);
848 static DecodeStatus
DecodeVecShiftL8Imm(MCInst
&Inst
, unsigned Imm
,
849 uint64_t Addr
, const void *Decoder
) {
850 return DecodeVecShiftLImm(Inst
, Imm
, 8);
853 static DecodeStatus
DecodeThreeAddrSRegInstruction(MCInst
&Inst
, uint32_t insn
,
855 const void *Decoder
) {
856 unsigned Rd
= fieldFromInstruction(insn
, 0, 5);
857 unsigned Rn
= fieldFromInstruction(insn
, 5, 5);
858 unsigned Rm
= fieldFromInstruction(insn
, 16, 5);
859 unsigned shiftHi
= fieldFromInstruction(insn
, 22, 2);
860 unsigned shiftLo
= fieldFromInstruction(insn
, 10, 6);
861 unsigned shift
= (shiftHi
<< 6) | shiftLo
;
862 switch (Inst
.getOpcode()) {
865 case AArch64::ADDWrs
:
866 case AArch64::ADDSWrs
:
867 case AArch64::SUBWrs
:
868 case AArch64::SUBSWrs
:
869 // if shift == '11' then ReservedValue()
873 case AArch64::ANDWrs
:
874 case AArch64::ANDSWrs
:
875 case AArch64::BICWrs
:
876 case AArch64::BICSWrs
:
877 case AArch64::ORRWrs
:
878 case AArch64::ORNWrs
:
879 case AArch64::EORWrs
:
880 case AArch64::EONWrs
: {
881 // if sf == '0' and imm6<5> == '1' then ReservedValue()
882 if (shiftLo
>> 5 == 1)
884 DecodeGPR32RegisterClass(Inst
, Rd
, Addr
, Decoder
);
885 DecodeGPR32RegisterClass(Inst
, Rn
, Addr
, Decoder
);
886 DecodeGPR32RegisterClass(Inst
, Rm
, Addr
, Decoder
);
889 case AArch64::ADDXrs
:
890 case AArch64::ADDSXrs
:
891 case AArch64::SUBXrs
:
892 case AArch64::SUBSXrs
:
893 // if shift == '11' then ReservedValue()
897 case AArch64::ANDXrs
:
898 case AArch64::ANDSXrs
:
899 case AArch64::BICXrs
:
900 case AArch64::BICSXrs
:
901 case AArch64::ORRXrs
:
902 case AArch64::ORNXrs
:
903 case AArch64::EORXrs
:
904 case AArch64::EONXrs
:
905 DecodeGPR64RegisterClass(Inst
, Rd
, Addr
, Decoder
);
906 DecodeGPR64RegisterClass(Inst
, Rn
, Addr
, Decoder
);
907 DecodeGPR64RegisterClass(Inst
, Rm
, Addr
, Decoder
);
911 Inst
.addOperand(MCOperand::createImm(shift
));
915 static DecodeStatus
DecodeMoveImmInstruction(MCInst
&Inst
, uint32_t insn
,
917 const void *Decoder
) {
918 unsigned Rd
= fieldFromInstruction(insn
, 0, 5);
919 unsigned imm
= fieldFromInstruction(insn
, 5, 16);
920 unsigned shift
= fieldFromInstruction(insn
, 21, 2);
922 switch (Inst
.getOpcode()) {
925 case AArch64::MOVZWi
:
926 case AArch64::MOVNWi
:
927 case AArch64::MOVKWi
:
928 if (shift
& (1U << 5))
930 DecodeGPR32RegisterClass(Inst
, Rd
, Addr
, Decoder
);
932 case AArch64::MOVZXi
:
933 case AArch64::MOVNXi
:
934 case AArch64::MOVKXi
:
935 DecodeGPR64RegisterClass(Inst
, Rd
, Addr
, Decoder
);
939 if (Inst
.getOpcode() == AArch64::MOVKWi
||
940 Inst
.getOpcode() == AArch64::MOVKXi
)
941 Inst
.addOperand(Inst
.getOperand(0));
943 Inst
.addOperand(MCOperand::createImm(imm
));
944 Inst
.addOperand(MCOperand::createImm(shift
));
948 static DecodeStatus
DecodeUnsignedLdStInstruction(MCInst
&Inst
, uint32_t insn
,
950 const void *Decoder
) {
951 unsigned Rt
= fieldFromInstruction(insn
, 0, 5);
952 unsigned Rn
= fieldFromInstruction(insn
, 5, 5);
953 unsigned offset
= fieldFromInstruction(insn
, 10, 12);
954 const AArch64Disassembler
*Dis
=
955 static_cast<const AArch64Disassembler
*>(Decoder
);
957 switch (Inst
.getOpcode()) {
960 case AArch64::PRFMui
:
961 // Rt is an immediate in prefetch.
962 Inst
.addOperand(MCOperand::createImm(Rt
));
964 case AArch64::STRBBui
:
965 case AArch64::LDRBBui
:
966 case AArch64::LDRSBWui
:
967 case AArch64::STRHHui
:
968 case AArch64::LDRHHui
:
969 case AArch64::LDRSHWui
:
970 case AArch64::STRWui
:
971 case AArch64::LDRWui
:
972 DecodeGPR32RegisterClass(Inst
, Rt
, Addr
, Decoder
);
974 case AArch64::LDRSBXui
:
975 case AArch64::LDRSHXui
:
976 case AArch64::LDRSWui
:
977 case AArch64::STRXui
:
978 case AArch64::LDRXui
:
979 DecodeGPR64RegisterClass(Inst
, Rt
, Addr
, Decoder
);
981 case AArch64::LDRQui
:
982 case AArch64::STRQui
:
983 DecodeFPR128RegisterClass(Inst
, Rt
, Addr
, Decoder
);
985 case AArch64::LDRDui
:
986 case AArch64::STRDui
:
987 DecodeFPR64RegisterClass(Inst
, Rt
, Addr
, Decoder
);
989 case AArch64::LDRSui
:
990 case AArch64::STRSui
:
991 DecodeFPR32RegisterClass(Inst
, Rt
, Addr
, Decoder
);
993 case AArch64::LDRHui
:
994 case AArch64::STRHui
:
995 DecodeFPR16RegisterClass(Inst
, Rt
, Addr
, Decoder
);
997 case AArch64::LDRBui
:
998 case AArch64::STRBui
:
999 DecodeFPR8RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1003 DecodeGPR64spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1004 if (!Dis
->tryAddingSymbolicOperand(Inst
, offset
, Addr
, Fail
, 0, 4))
1005 Inst
.addOperand(MCOperand::createImm(offset
));
1009 static DecodeStatus
DecodeSignedLdStInstruction(MCInst
&Inst
, uint32_t insn
,
1011 const void *Decoder
) {
1012 unsigned Rt
= fieldFromInstruction(insn
, 0, 5);
1013 unsigned Rn
= fieldFromInstruction(insn
, 5, 5);
1014 int64_t offset
= fieldFromInstruction(insn
, 12, 9);
1016 // offset is a 9-bit signed immediate, so sign extend it to
1017 // fill the unsigned.
1018 if (offset
& (1 << (9 - 1)))
1019 offset
|= ~((1LL << 9) - 1);
1021 // First operand is always the writeback to the address register, if needed.
1022 switch (Inst
.getOpcode()) {
1025 case AArch64::LDRSBWpre
:
1026 case AArch64::LDRSHWpre
:
1027 case AArch64::STRBBpre
:
1028 case AArch64::LDRBBpre
:
1029 case AArch64::STRHHpre
:
1030 case AArch64::LDRHHpre
:
1031 case AArch64::STRWpre
:
1032 case AArch64::LDRWpre
:
1033 case AArch64::LDRSBWpost
:
1034 case AArch64::LDRSHWpost
:
1035 case AArch64::STRBBpost
:
1036 case AArch64::LDRBBpost
:
1037 case AArch64::STRHHpost
:
1038 case AArch64::LDRHHpost
:
1039 case AArch64::STRWpost
:
1040 case AArch64::LDRWpost
:
1041 case AArch64::LDRSBXpre
:
1042 case AArch64::LDRSHXpre
:
1043 case AArch64::STRXpre
:
1044 case AArch64::LDRSWpre
:
1045 case AArch64::LDRXpre
:
1046 case AArch64::LDRSBXpost
:
1047 case AArch64::LDRSHXpost
:
1048 case AArch64::STRXpost
:
1049 case AArch64::LDRSWpost
:
1050 case AArch64::LDRXpost
:
1051 case AArch64::LDRQpre
:
1052 case AArch64::STRQpre
:
1053 case AArch64::LDRQpost
:
1054 case AArch64::STRQpost
:
1055 case AArch64::LDRDpre
:
1056 case AArch64::STRDpre
:
1057 case AArch64::LDRDpost
:
1058 case AArch64::STRDpost
:
1059 case AArch64::LDRSpre
:
1060 case AArch64::STRSpre
:
1061 case AArch64::LDRSpost
:
1062 case AArch64::STRSpost
:
1063 case AArch64::LDRHpre
:
1064 case AArch64::STRHpre
:
1065 case AArch64::LDRHpost
:
1066 case AArch64::STRHpost
:
1067 case AArch64::LDRBpre
:
1068 case AArch64::STRBpre
:
1069 case AArch64::LDRBpost
:
1070 case AArch64::STRBpost
:
1071 DecodeGPR64spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1075 switch (Inst
.getOpcode()) {
1078 case AArch64::PRFUMi
:
1079 // Rt is an immediate in prefetch.
1080 Inst
.addOperand(MCOperand::createImm(Rt
));
1082 case AArch64::STURBBi
:
1083 case AArch64::LDURBBi
:
1084 case AArch64::LDURSBWi
:
1085 case AArch64::STURHHi
:
1086 case AArch64::LDURHHi
:
1087 case AArch64::LDURSHWi
:
1088 case AArch64::STURWi
:
1089 case AArch64::LDURWi
:
1090 case AArch64::LDTRSBWi
:
1091 case AArch64::LDTRSHWi
:
1092 case AArch64::STTRWi
:
1093 case AArch64::LDTRWi
:
1094 case AArch64::STTRHi
:
1095 case AArch64::LDTRHi
:
1096 case AArch64::LDTRBi
:
1097 case AArch64::STTRBi
:
1098 case AArch64::LDRSBWpre
:
1099 case AArch64::LDRSHWpre
:
1100 case AArch64::STRBBpre
:
1101 case AArch64::LDRBBpre
:
1102 case AArch64::STRHHpre
:
1103 case AArch64::LDRHHpre
:
1104 case AArch64::STRWpre
:
1105 case AArch64::LDRWpre
:
1106 case AArch64::LDRSBWpost
:
1107 case AArch64::LDRSHWpost
:
1108 case AArch64::STRBBpost
:
1109 case AArch64::LDRBBpost
:
1110 case AArch64::STRHHpost
:
1111 case AArch64::LDRHHpost
:
1112 case AArch64::STRWpost
:
1113 case AArch64::LDRWpost
:
1114 case AArch64::STLURBi
:
1115 case AArch64::STLURHi
:
1116 case AArch64::STLURWi
:
1117 case AArch64::LDAPURBi
:
1118 case AArch64::LDAPURSBWi
:
1119 case AArch64::LDAPURHi
:
1120 case AArch64::LDAPURSHWi
:
1121 case AArch64::LDAPURi
:
1122 DecodeGPR32RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1124 case AArch64::LDURSBXi
:
1125 case AArch64::LDURSHXi
:
1126 case AArch64::LDURSWi
:
1127 case AArch64::STURXi
:
1128 case AArch64::LDURXi
:
1129 case AArch64::LDTRSBXi
:
1130 case AArch64::LDTRSHXi
:
1131 case AArch64::LDTRSWi
:
1132 case AArch64::STTRXi
:
1133 case AArch64::LDTRXi
:
1134 case AArch64::LDRSBXpre
:
1135 case AArch64::LDRSHXpre
:
1136 case AArch64::STRXpre
:
1137 case AArch64::LDRSWpre
:
1138 case AArch64::LDRXpre
:
1139 case AArch64::LDRSBXpost
:
1140 case AArch64::LDRSHXpost
:
1141 case AArch64::STRXpost
:
1142 case AArch64::LDRSWpost
:
1143 case AArch64::LDRXpost
:
1144 case AArch64::LDAPURSWi
:
1145 case AArch64::LDAPURSHXi
:
1146 case AArch64::LDAPURSBXi
:
1147 case AArch64::STLURXi
:
1148 case AArch64::LDAPURXi
:
1149 DecodeGPR64RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1151 case AArch64::LDURQi
:
1152 case AArch64::STURQi
:
1153 case AArch64::LDRQpre
:
1154 case AArch64::STRQpre
:
1155 case AArch64::LDRQpost
:
1156 case AArch64::STRQpost
:
1157 DecodeFPR128RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1159 case AArch64::LDURDi
:
1160 case AArch64::STURDi
:
1161 case AArch64::LDRDpre
:
1162 case AArch64::STRDpre
:
1163 case AArch64::LDRDpost
:
1164 case AArch64::STRDpost
:
1165 DecodeFPR64RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1167 case AArch64::LDURSi
:
1168 case AArch64::STURSi
:
1169 case AArch64::LDRSpre
:
1170 case AArch64::STRSpre
:
1171 case AArch64::LDRSpost
:
1172 case AArch64::STRSpost
:
1173 DecodeFPR32RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1175 case AArch64::LDURHi
:
1176 case AArch64::STURHi
:
1177 case AArch64::LDRHpre
:
1178 case AArch64::STRHpre
:
1179 case AArch64::LDRHpost
:
1180 case AArch64::STRHpost
:
1181 DecodeFPR16RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1183 case AArch64::LDURBi
:
1184 case AArch64::STURBi
:
1185 case AArch64::LDRBpre
:
1186 case AArch64::STRBpre
:
1187 case AArch64::LDRBpost
:
1188 case AArch64::STRBpost
:
1189 DecodeFPR8RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1193 DecodeGPR64spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1194 Inst
.addOperand(MCOperand::createImm(offset
));
1196 bool IsLoad
= fieldFromInstruction(insn
, 22, 1);
1197 bool IsIndexed
= fieldFromInstruction(insn
, 10, 2) != 0;
1198 bool IsFP
= fieldFromInstruction(insn
, 26, 1);
1200 // Cannot write back to a transfer register (but xzr != sp).
1201 if (IsLoad
&& IsIndexed
&& !IsFP
&& Rn
!= 31 && Rt
== Rn
)
1207 static DecodeStatus
DecodeExclusiveLdStInstruction(MCInst
&Inst
, uint32_t insn
,
1209 const void *Decoder
) {
1210 unsigned Rt
= fieldFromInstruction(insn
, 0, 5);
1211 unsigned Rn
= fieldFromInstruction(insn
, 5, 5);
1212 unsigned Rt2
= fieldFromInstruction(insn
, 10, 5);
1213 unsigned Rs
= fieldFromInstruction(insn
, 16, 5);
1215 unsigned Opcode
= Inst
.getOpcode();
1219 case AArch64::STLXRW
:
1220 case AArch64::STLXRB
:
1221 case AArch64::STLXRH
:
1222 case AArch64::STXRW
:
1223 case AArch64::STXRB
:
1224 case AArch64::STXRH
:
1225 DecodeGPR32RegisterClass(Inst
, Rs
, Addr
, Decoder
);
1227 case AArch64::LDARW
:
1228 case AArch64::LDARB
:
1229 case AArch64::LDARH
:
1230 case AArch64::LDAXRW
:
1231 case AArch64::LDAXRB
:
1232 case AArch64::LDAXRH
:
1233 case AArch64::LDXRW
:
1234 case AArch64::LDXRB
:
1235 case AArch64::LDXRH
:
1236 case AArch64::STLRW
:
1237 case AArch64::STLRB
:
1238 case AArch64::STLRH
:
1239 case AArch64::STLLRW
:
1240 case AArch64::STLLRB
:
1241 case AArch64::STLLRH
:
1242 case AArch64::LDLARW
:
1243 case AArch64::LDLARB
:
1244 case AArch64::LDLARH
:
1245 DecodeGPR32RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1247 case AArch64::STLXRX
:
1248 case AArch64::STXRX
:
1249 DecodeGPR32RegisterClass(Inst
, Rs
, Addr
, Decoder
);
1251 case AArch64::LDARX
:
1252 case AArch64::LDAXRX
:
1253 case AArch64::LDXRX
:
1254 case AArch64::STLRX
:
1255 case AArch64::LDLARX
:
1256 case AArch64::STLLRX
:
1257 DecodeGPR64RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1259 case AArch64::STLXPW
:
1260 case AArch64::STXPW
:
1261 DecodeGPR32RegisterClass(Inst
, Rs
, Addr
, Decoder
);
1263 case AArch64::LDAXPW
:
1264 case AArch64::LDXPW
:
1265 DecodeGPR32RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1266 DecodeGPR32RegisterClass(Inst
, Rt2
, Addr
, Decoder
);
1268 case AArch64::STLXPX
:
1269 case AArch64::STXPX
:
1270 DecodeGPR32RegisterClass(Inst
, Rs
, Addr
, Decoder
);
1272 case AArch64::LDAXPX
:
1273 case AArch64::LDXPX
:
1274 DecodeGPR64RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1275 DecodeGPR64RegisterClass(Inst
, Rt2
, Addr
, Decoder
);
1279 DecodeGPR64spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1281 // You shouldn't load to the same register twice in an instruction...
1282 if ((Opcode
== AArch64::LDAXPW
|| Opcode
== AArch64::LDXPW
||
1283 Opcode
== AArch64::LDAXPX
|| Opcode
== AArch64::LDXPX
) &&
1290 static DecodeStatus
DecodePairLdStInstruction(MCInst
&Inst
, uint32_t insn
,
1292 const void *Decoder
) {
1293 unsigned Rt
= fieldFromInstruction(insn
, 0, 5);
1294 unsigned Rn
= fieldFromInstruction(insn
, 5, 5);
1295 unsigned Rt2
= fieldFromInstruction(insn
, 10, 5);
1296 int64_t offset
= fieldFromInstruction(insn
, 15, 7);
1297 bool IsLoad
= fieldFromInstruction(insn
, 22, 1);
1299 // offset is a 7-bit signed immediate, so sign extend it to
1300 // fill the unsigned.
1301 if (offset
& (1 << (7 - 1)))
1302 offset
|= ~((1LL << 7) - 1);
1304 unsigned Opcode
= Inst
.getOpcode();
1305 bool NeedsDisjointWritebackTransfer
= false;
1307 // First operand is always writeback of base register.
1311 case AArch64::LDPXpost
:
1312 case AArch64::STPXpost
:
1313 case AArch64::LDPSWpost
:
1314 case AArch64::LDPXpre
:
1315 case AArch64::STPXpre
:
1316 case AArch64::LDPSWpre
:
1317 case AArch64::LDPWpost
:
1318 case AArch64::STPWpost
:
1319 case AArch64::LDPWpre
:
1320 case AArch64::STPWpre
:
1321 case AArch64::LDPQpost
:
1322 case AArch64::STPQpost
:
1323 case AArch64::LDPQpre
:
1324 case AArch64::STPQpre
:
1325 case AArch64::LDPDpost
:
1326 case AArch64::STPDpost
:
1327 case AArch64::LDPDpre
:
1328 case AArch64::STPDpre
:
1329 case AArch64::LDPSpost
:
1330 case AArch64::STPSpost
:
1331 case AArch64::LDPSpre
:
1332 case AArch64::STPSpre
:
1333 case AArch64::STGPpre
:
1334 case AArch64::STGPpost
:
1335 DecodeGPR64spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1342 case AArch64::LDPXpost
:
1343 case AArch64::STPXpost
:
1344 case AArch64::LDPSWpost
:
1345 case AArch64::LDPXpre
:
1346 case AArch64::STPXpre
:
1347 case AArch64::LDPSWpre
:
1348 case AArch64::STGPpre
:
1349 case AArch64::STGPpost
:
1350 NeedsDisjointWritebackTransfer
= true;
1352 case AArch64::LDNPXi
:
1353 case AArch64::STNPXi
:
1354 case AArch64::LDPXi
:
1355 case AArch64::STPXi
:
1356 case AArch64::LDPSWi
:
1357 case AArch64::STGPi
:
1358 DecodeGPR64RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1359 DecodeGPR64RegisterClass(Inst
, Rt2
, Addr
, Decoder
);
1361 case AArch64::LDPWpost
:
1362 case AArch64::STPWpost
:
1363 case AArch64::LDPWpre
:
1364 case AArch64::STPWpre
:
1365 NeedsDisjointWritebackTransfer
= true;
1367 case AArch64::LDNPWi
:
1368 case AArch64::STNPWi
:
1369 case AArch64::LDPWi
:
1370 case AArch64::STPWi
:
1371 DecodeGPR32RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1372 DecodeGPR32RegisterClass(Inst
, Rt2
, Addr
, Decoder
);
1374 case AArch64::LDNPQi
:
1375 case AArch64::STNPQi
:
1376 case AArch64::LDPQpost
:
1377 case AArch64::STPQpost
:
1378 case AArch64::LDPQi
:
1379 case AArch64::STPQi
:
1380 case AArch64::LDPQpre
:
1381 case AArch64::STPQpre
:
1382 DecodeFPR128RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1383 DecodeFPR128RegisterClass(Inst
, Rt2
, Addr
, Decoder
);
1385 case AArch64::LDNPDi
:
1386 case AArch64::STNPDi
:
1387 case AArch64::LDPDpost
:
1388 case AArch64::STPDpost
:
1389 case AArch64::LDPDi
:
1390 case AArch64::STPDi
:
1391 case AArch64::LDPDpre
:
1392 case AArch64::STPDpre
:
1393 DecodeFPR64RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1394 DecodeFPR64RegisterClass(Inst
, Rt2
, Addr
, Decoder
);
1396 case AArch64::LDNPSi
:
1397 case AArch64::STNPSi
:
1398 case AArch64::LDPSpost
:
1399 case AArch64::STPSpost
:
1400 case AArch64::LDPSi
:
1401 case AArch64::STPSi
:
1402 case AArch64::LDPSpre
:
1403 case AArch64::STPSpre
:
1404 DecodeFPR32RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1405 DecodeFPR32RegisterClass(Inst
, Rt2
, Addr
, Decoder
);
1409 DecodeGPR64spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1410 Inst
.addOperand(MCOperand::createImm(offset
));
1412 // You shouldn't load to the same register twice in an instruction...
1413 if (IsLoad
&& Rt
== Rt2
)
1416 // ... or do any operation that writes-back to a transfer register. But note
1417 // that "stp xzr, xzr, [sp], #4" is fine because xzr and sp are different.
1418 if (NeedsDisjointWritebackTransfer
&& Rn
!= 31 && (Rt
== Rn
|| Rt2
== Rn
))
1424 static DecodeStatus
DecodeAuthLoadInstruction(MCInst
&Inst
, uint32_t insn
,
1426 const void *Decoder
) {
1427 unsigned Rt
= fieldFromInstruction(insn
, 0, 5);
1428 unsigned Rn
= fieldFromInstruction(insn
, 5, 5);
1429 uint64_t offset
= fieldFromInstruction(insn
, 22, 1) << 9 |
1430 fieldFromInstruction(insn
, 12, 9);
1431 unsigned writeback
= fieldFromInstruction(insn
, 11, 1);
1433 switch (Inst
.getOpcode()) {
1436 case AArch64::LDRAAwriteback
:
1437 case AArch64::LDRABwriteback
:
1438 DecodeGPR64spRegisterClass(Inst
, Rn
/* writeback register */, Addr
,
1441 case AArch64::LDRAAindexed
:
1442 case AArch64::LDRABindexed
:
1446 DecodeGPR64RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1447 DecodeGPR64spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1448 DecodeSImm
<10>(Inst
, offset
, Addr
, Decoder
);
1450 if (writeback
&& Rt
== Rn
&& Rn
!= 31) {
1457 static DecodeStatus
DecodeAddSubERegInstruction(MCInst
&Inst
, uint32_t insn
,
1459 const void *Decoder
) {
1460 unsigned Rd
= fieldFromInstruction(insn
, 0, 5);
1461 unsigned Rn
= fieldFromInstruction(insn
, 5, 5);
1462 unsigned Rm
= fieldFromInstruction(insn
, 16, 5);
1463 unsigned extend
= fieldFromInstruction(insn
, 10, 6);
1465 unsigned shift
= extend
& 0x7;
1469 switch (Inst
.getOpcode()) {
1472 case AArch64::ADDWrx
:
1473 case AArch64::SUBWrx
:
1474 DecodeGPR32spRegisterClass(Inst
, Rd
, Addr
, Decoder
);
1475 DecodeGPR32spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1476 DecodeGPR32RegisterClass(Inst
, Rm
, Addr
, Decoder
);
1478 case AArch64::ADDSWrx
:
1479 case AArch64::SUBSWrx
:
1480 DecodeGPR32RegisterClass(Inst
, Rd
, Addr
, Decoder
);
1481 DecodeGPR32spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1482 DecodeGPR32RegisterClass(Inst
, Rm
, Addr
, Decoder
);
1484 case AArch64::ADDXrx
:
1485 case AArch64::SUBXrx
:
1486 DecodeGPR64spRegisterClass(Inst
, Rd
, Addr
, Decoder
);
1487 DecodeGPR64spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1488 DecodeGPR32RegisterClass(Inst
, Rm
, Addr
, Decoder
);
1490 case AArch64::ADDSXrx
:
1491 case AArch64::SUBSXrx
:
1492 DecodeGPR64RegisterClass(Inst
, Rd
, Addr
, Decoder
);
1493 DecodeGPR64spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1494 DecodeGPR32RegisterClass(Inst
, Rm
, Addr
, Decoder
);
1496 case AArch64::ADDXrx64
:
1497 case AArch64::SUBXrx64
:
1498 DecodeGPR64spRegisterClass(Inst
, Rd
, Addr
, Decoder
);
1499 DecodeGPR64spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1500 DecodeGPR64RegisterClass(Inst
, Rm
, Addr
, Decoder
);
1502 case AArch64::SUBSXrx64
:
1503 case AArch64::ADDSXrx64
:
1504 DecodeGPR64RegisterClass(Inst
, Rd
, Addr
, Decoder
);
1505 DecodeGPR64spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1506 DecodeGPR64RegisterClass(Inst
, Rm
, Addr
, Decoder
);
1510 Inst
.addOperand(MCOperand::createImm(extend
));
1514 static DecodeStatus
DecodeLogicalImmInstruction(MCInst
&Inst
, uint32_t insn
,
1516 const void *Decoder
) {
1517 unsigned Rd
= fieldFromInstruction(insn
, 0, 5);
1518 unsigned Rn
= fieldFromInstruction(insn
, 5, 5);
1519 unsigned Datasize
= fieldFromInstruction(insn
, 31, 1);
1523 if (Inst
.getOpcode() == AArch64::ANDSXri
)
1524 DecodeGPR64RegisterClass(Inst
, Rd
, Addr
, Decoder
);
1526 DecodeGPR64spRegisterClass(Inst
, Rd
, Addr
, Decoder
);
1527 DecodeGPR64RegisterClass(Inst
, Rn
, Addr
, Decoder
);
1528 imm
= fieldFromInstruction(insn
, 10, 13);
1529 if (!AArch64_AM::isValidDecodeLogicalImmediate(imm
, 64))
1532 if (Inst
.getOpcode() == AArch64::ANDSWri
)
1533 DecodeGPR32RegisterClass(Inst
, Rd
, Addr
, Decoder
);
1535 DecodeGPR32spRegisterClass(Inst
, Rd
, Addr
, Decoder
);
1536 DecodeGPR32RegisterClass(Inst
, Rn
, Addr
, Decoder
);
1537 imm
= fieldFromInstruction(insn
, 10, 12);
1538 if (!AArch64_AM::isValidDecodeLogicalImmediate(imm
, 32))
1541 Inst
.addOperand(MCOperand::createImm(imm
));
1545 static DecodeStatus
DecodeModImmInstruction(MCInst
&Inst
, uint32_t insn
,
1547 const void *Decoder
) {
1548 unsigned Rd
= fieldFromInstruction(insn
, 0, 5);
1549 unsigned cmode
= fieldFromInstruction(insn
, 12, 4);
1550 unsigned imm
= fieldFromInstruction(insn
, 16, 3) << 5;
1551 imm
|= fieldFromInstruction(insn
, 5, 5);
1553 if (Inst
.getOpcode() == AArch64::MOVID
)
1554 DecodeFPR64RegisterClass(Inst
, Rd
, Addr
, Decoder
);
1556 DecodeFPR128RegisterClass(Inst
, Rd
, Addr
, Decoder
);
1558 Inst
.addOperand(MCOperand::createImm(imm
));
1560 switch (Inst
.getOpcode()) {
1563 case AArch64::MOVIv4i16
:
1564 case AArch64::MOVIv8i16
:
1565 case AArch64::MVNIv4i16
:
1566 case AArch64::MVNIv8i16
:
1567 case AArch64::MOVIv2i32
:
1568 case AArch64::MOVIv4i32
:
1569 case AArch64::MVNIv2i32
:
1570 case AArch64::MVNIv4i32
:
1571 Inst
.addOperand(MCOperand::createImm((cmode
& 6) << 2));
1573 case AArch64::MOVIv2s_msl
:
1574 case AArch64::MOVIv4s_msl
:
1575 case AArch64::MVNIv2s_msl
:
1576 case AArch64::MVNIv4s_msl
:
1577 Inst
.addOperand(MCOperand::createImm((cmode
& 1) ? 0x110 : 0x108));
1584 static DecodeStatus
DecodeModImmTiedInstruction(MCInst
&Inst
, uint32_t insn
,
1586 const void *Decoder
) {
1587 unsigned Rd
= fieldFromInstruction(insn
, 0, 5);
1588 unsigned cmode
= fieldFromInstruction(insn
, 12, 4);
1589 unsigned imm
= fieldFromInstruction(insn
, 16, 3) << 5;
1590 imm
|= fieldFromInstruction(insn
, 5, 5);
1592 // Tied operands added twice.
1593 DecodeFPR128RegisterClass(Inst
, Rd
, Addr
, Decoder
);
1594 DecodeFPR128RegisterClass(Inst
, Rd
, Addr
, Decoder
);
1596 Inst
.addOperand(MCOperand::createImm(imm
));
1597 Inst
.addOperand(MCOperand::createImm((cmode
& 6) << 2));
1602 static DecodeStatus
DecodeAdrInstruction(MCInst
&Inst
, uint32_t insn
,
1603 uint64_t Addr
, const void *Decoder
) {
1604 unsigned Rd
= fieldFromInstruction(insn
, 0, 5);
1605 int64_t imm
= fieldFromInstruction(insn
, 5, 19) << 2;
1606 imm
|= fieldFromInstruction(insn
, 29, 2);
1607 const AArch64Disassembler
*Dis
=
1608 static_cast<const AArch64Disassembler
*>(Decoder
);
1610 // Sign-extend the 21-bit immediate.
1611 if (imm
& (1 << (21 - 1)))
1612 imm
|= ~((1LL << 21) - 1);
1614 DecodeGPR64RegisterClass(Inst
, Rd
, Addr
, Decoder
);
1615 if (!Dis
->tryAddingSymbolicOperand(Inst
, imm
, Addr
, Fail
, 0, 4))
1616 Inst
.addOperand(MCOperand::createImm(imm
));
1621 static DecodeStatus
DecodeAddSubImmShift(MCInst
&Inst
, uint32_t insn
,
1622 uint64_t Addr
, const void *Decoder
) {
1623 unsigned Rd
= fieldFromInstruction(insn
, 0, 5);
1624 unsigned Rn
= fieldFromInstruction(insn
, 5, 5);
1625 unsigned Imm
= fieldFromInstruction(insn
, 10, 14);
1626 unsigned S
= fieldFromInstruction(insn
, 29, 1);
1627 unsigned Datasize
= fieldFromInstruction(insn
, 31, 1);
1629 unsigned ShifterVal
= (Imm
>> 12) & 3;
1630 unsigned ImmVal
= Imm
& 0xFFF;
1631 const AArch64Disassembler
*Dis
=
1632 static_cast<const AArch64Disassembler
*>(Decoder
);
1634 if (ShifterVal
!= 0 && ShifterVal
!= 1)
1639 DecodeGPR64spRegisterClass(Inst
, Rd
, Addr
, Decoder
);
1641 DecodeGPR64RegisterClass(Inst
, Rd
, Addr
, Decoder
);
1642 DecodeGPR64spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1645 DecodeGPR32spRegisterClass(Inst
, Rd
, Addr
, Decoder
);
1647 DecodeGPR32RegisterClass(Inst
, Rd
, Addr
, Decoder
);
1648 DecodeGPR32spRegisterClass(Inst
, Rn
, Addr
, Decoder
);
1651 if (!Dis
->tryAddingSymbolicOperand(Inst
, Imm
, Addr
, Fail
, 0, 4))
1652 Inst
.addOperand(MCOperand::createImm(ImmVal
));
1653 Inst
.addOperand(MCOperand::createImm(12 * ShifterVal
));
1657 static DecodeStatus
DecodeUnconditionalBranch(MCInst
&Inst
, uint32_t insn
,
1659 const void *Decoder
) {
1660 int64_t imm
= fieldFromInstruction(insn
, 0, 26);
1661 const AArch64Disassembler
*Dis
=
1662 static_cast<const AArch64Disassembler
*>(Decoder
);
1664 // Sign-extend the 26-bit immediate.
1665 if (imm
& (1 << (26 - 1)))
1666 imm
|= ~((1LL << 26) - 1);
1668 if (!Dis
->tryAddingSymbolicOperand(Inst
, imm
* 4, Addr
, true, 0, 4))
1669 Inst
.addOperand(MCOperand::createImm(imm
));
1674 static DecodeStatus
DecodeSystemPStateInstruction(MCInst
&Inst
, uint32_t insn
,
1676 const void *Decoder
) {
1677 uint64_t op1
= fieldFromInstruction(insn
, 16, 3);
1678 uint64_t op2
= fieldFromInstruction(insn
, 5, 3);
1679 uint64_t crm
= fieldFromInstruction(insn
, 8, 4);
1680 uint64_t pstate_field
= (op1
<< 3) | op2
;
1682 switch (pstate_field
) {
1683 case 0x01: // XAFlag
1684 case 0x02: // AXFlag
1688 if ((pstate_field
== AArch64PState::PAN
||
1689 pstate_field
== AArch64PState::UAO
||
1690 pstate_field
== AArch64PState::SSBS
) && crm
> 1)
1693 Inst
.addOperand(MCOperand::createImm(pstate_field
));
1694 Inst
.addOperand(MCOperand::createImm(crm
));
1696 const AArch64Disassembler
*Dis
=
1697 static_cast<const AArch64Disassembler
*>(Decoder
);
1698 auto PState
= AArch64PState::lookupPStateByEncoding(pstate_field
);
1699 if (PState
&& PState
->haveFeatures(Dis
->getSubtargetInfo().getFeatureBits()))
1704 static DecodeStatus
DecodeTestAndBranch(MCInst
&Inst
, uint32_t insn
,
1705 uint64_t Addr
, const void *Decoder
) {
1706 uint64_t Rt
= fieldFromInstruction(insn
, 0, 5);
1707 uint64_t bit
= fieldFromInstruction(insn
, 31, 1) << 5;
1708 bit
|= fieldFromInstruction(insn
, 19, 5);
1709 int64_t dst
= fieldFromInstruction(insn
, 5, 14);
1710 const AArch64Disassembler
*Dis
=
1711 static_cast<const AArch64Disassembler
*>(Decoder
);
1713 // Sign-extend 14-bit immediate.
1714 if (dst
& (1 << (14 - 1)))
1715 dst
|= ~((1LL << 14) - 1);
1717 if (fieldFromInstruction(insn
, 31, 1) == 0)
1718 DecodeGPR32RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1720 DecodeGPR64RegisterClass(Inst
, Rt
, Addr
, Decoder
);
1721 Inst
.addOperand(MCOperand::createImm(bit
));
1722 if (!Dis
->tryAddingSymbolicOperand(Inst
, dst
* 4, Addr
, true, 0, 4))
1723 Inst
.addOperand(MCOperand::createImm(dst
));
1728 static DecodeStatus
DecodeGPRSeqPairsClassRegisterClass(MCInst
&Inst
,
1729 unsigned RegClassID
,
1732 const void *Decoder
) {
1733 // Register number must be even (see CASP instruction)
1737 unsigned Reg
= AArch64MCRegisterClasses
[RegClassID
].getRegister(RegNo
/ 2);
1738 Inst
.addOperand(MCOperand::createReg(Reg
));
1742 static DecodeStatus
DecodeWSeqPairsClassRegisterClass(MCInst
&Inst
,
1745 const void *Decoder
) {
1746 return DecodeGPRSeqPairsClassRegisterClass(Inst
,
1747 AArch64::WSeqPairsClassRegClassID
,
1748 RegNo
, Addr
, Decoder
);
1751 static DecodeStatus
DecodeXSeqPairsClassRegisterClass(MCInst
&Inst
,
1754 const void *Decoder
) {
1755 return DecodeGPRSeqPairsClassRegisterClass(Inst
,
1756 AArch64::XSeqPairsClassRegClassID
,
1757 RegNo
, Addr
, Decoder
);
1760 static DecodeStatus
DecodeSVELogicalImmInstruction(MCInst
&Inst
, uint32_t insn
,
1762 const void *Decoder
) {
1763 unsigned Zdn
= fieldFromInstruction(insn
, 0, 5);
1764 unsigned imm
= fieldFromInstruction(insn
, 5, 13);
1765 if (!AArch64_AM::isValidDecodeLogicalImmediate(imm
, 64))
1768 // The same (tied) operand is added twice to the instruction.
1769 DecodeZPRRegisterClass(Inst
, Zdn
, Addr
, Decoder
);
1770 if (Inst
.getOpcode() != AArch64::DUPM_ZI
)
1771 DecodeZPRRegisterClass(Inst
, Zdn
, Addr
, Decoder
);
1772 Inst
.addOperand(MCOperand::createImm(imm
));
1777 static DecodeStatus
DecodeSImm(MCInst
&Inst
, uint64_t Imm
, uint64_t Address
,
1778 const void *Decoder
) {
1779 if (Imm
& ~((1LL << Bits
) - 1))
1782 // Imm is a signed immediate, so sign extend it.
1783 if (Imm
& (1 << (Bits
- 1)))
1784 Imm
|= ~((1LL << Bits
) - 1);
1786 Inst
.addOperand(MCOperand::createImm(Imm
));
1790 // Decode 8-bit signed/unsigned immediate for a given element width.
1791 template <int ElementWidth
>
1792 static DecodeStatus
DecodeImm8OptLsl(MCInst
&Inst
, unsigned Imm
,
1793 uint64_t Addr
, const void *Decoder
) {
1794 unsigned Val
= (uint8_t)Imm
;
1795 unsigned Shift
= (Imm
& 0x100) ? 8 : 0;
1796 if (ElementWidth
== 8 && Shift
)
1798 Inst
.addOperand(MCOperand::createImm(Val
));
1799 Inst
.addOperand(MCOperand::createImm(Shift
));
1803 // Decode uimm4 ranged from 1-16.
1804 static DecodeStatus
DecodeSVEIncDecImm(MCInst
&Inst
, unsigned Imm
,
1805 uint64_t Addr
, const void *Decoder
) {
1806 Inst
.addOperand(MCOperand::createImm(Imm
+ 1));
1810 static DecodeStatus
DecodeSVCROp(MCInst
&Inst
, unsigned Imm
, uint64_t Address
,
1811 const void *Decoder
) {
1812 if (AArch64SVCR::lookupSVCRByEncoding(Imm
)) {
1813 Inst
.addOperand(MCOperand::createImm(Imm
));