/src/capstonenext/arch/AArch64/AArch64InstPrinter.c
Line | Count | Source (jump to first uncovered line) |
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 | | //==-- AArch64InstPrinter.cpp - Convert AArch64 MCInst to assembly syntax --==// |
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 class prints an AArch64 MCInst to a .s file. |
24 | | // |
25 | | //===----------------------------------------------------------------------===// |
26 | | |
27 | | #include <stdio.h> |
28 | | #include <string.h> |
29 | | #include <stdlib.h> |
30 | | #include <capstone/platform.h> |
31 | | |
32 | | #include "../../Mapping.h" |
33 | | #include "../../MCInst.h" |
34 | | #include "../../MCInstPrinter.h" |
35 | | #include "../../MCRegisterInfo.h" |
36 | | #include "../../SStream.h" |
37 | | #include "../../utils.h" |
38 | | #include "AArch64AddressingModes.h" |
39 | | #include "AArch64BaseInfo.h" |
40 | | #include "AArch64DisassemblerExtension.h" |
41 | | #include "AArch64InstPrinter.h" |
42 | | #include "AArch64Linkage.h" |
43 | | #include "AArch64Mapping.h" |
44 | | |
45 | | #define GET_BANKEDREG_IMPL |
46 | | #include "AArch64GenSystemOperands.inc" |
47 | | |
48 | 384k | #define CONCAT(a, b) CONCAT_(a, b) |
49 | 384k | #define CONCAT_(a, b) a##_##b |
50 | | |
51 | | #define CONCATs(a, b) CONCATS(a, b) |
52 | | #define CONCATS(a, b) a##b |
53 | | |
54 | | #define DEBUG_TYPE "asm-printer" |
55 | | |
56 | | // BEGIN Static declarations. |
57 | | // These functions must be declared statically here, because they |
58 | | // are also defined in the ARM module. |
59 | | // If they are not static, we fail during linking. |
60 | | |
61 | | static void printCustomAliasOperand(MCInst *MI, uint64_t Address, |
62 | | unsigned OpIdx, unsigned PrintMethodIdx, |
63 | | SStream *OS); |
64 | | |
65 | | static void printFPImmOperand(MCInst *MI, unsigned OpNum, SStream *O); |
66 | | |
67 | | #define DECLARE_printComplexRotationOp(Angle, Remainder) \ |
68 | | static void CONCAT(printComplexRotationOp, CONCAT(Angle, Remainder))( \ |
69 | | MCInst * MI, unsigned OpNo, SStream *O); |
70 | | DECLARE_printComplexRotationOp(180, 90); |
71 | | DECLARE_printComplexRotationOp(90, 0); |
72 | | |
73 | | // END Static declarations. |
74 | | |
75 | | #define GET_INSTRUCTION_NAME |
76 | | #define PRINT_ALIAS_INSTR |
77 | | #include "AArch64GenAsmWriter.inc" |
78 | | |
79 | | void printRegName(SStream *OS, unsigned Reg) |
80 | 618k | { |
81 | 618k | SStream_concat(OS, "%s%s", markup("<reg:"), |
82 | 618k | getRegisterName(Reg, AArch64_NoRegAltName)); |
83 | 618k | SStream_concat0(OS, markup(">")); |
84 | 618k | } |
85 | | |
86 | | void printRegNameAlt(SStream *OS, unsigned Reg, unsigned AltIdx) |
87 | 127k | { |
88 | 127k | SStream_concat(OS, "%s%s", markup("<reg:"), |
89 | 127k | getRegisterName(Reg, AltIdx)); |
90 | 127k | SStream_concat0(OS, markup(">")); |
91 | 127k | } |
92 | | |
93 | | const char *getRegName(unsigned Reg) |
94 | 0 | { |
95 | 0 | return getRegisterName(Reg, AArch64_NoRegAltName); |
96 | 0 | } |
97 | | |
98 | | void printInst(MCInst *MI, uint64_t Address, const char *Annot, SStream *O) |
99 | 306k | { |
100 | 306k | bool isAlias = false; |
101 | 306k | bool useAliasDetails = map_use_alias_details(MI); |
102 | 306k | map_set_fill_detail_ops(MI, useAliasDetails); |
103 | | |
104 | 306k | unsigned Opcode = MCInst_getOpcode(MI); |
105 | | |
106 | 306k | if (Opcode == AArch64_SYSxt) { |
107 | 7.82k | if (printSysAlias(MI, O)) { |
108 | 2.42k | isAlias = true; |
109 | 2.42k | MCInst_setIsAlias(MI, isAlias); |
110 | 2.42k | if (useAliasDetails) |
111 | 2.42k | return; |
112 | 2.42k | } |
113 | 7.82k | } |
114 | | |
115 | 304k | if (Opcode == AArch64_SYSPxt || Opcode == AArch64_SYSPxt_XZR) { |
116 | 4.35k | if (printSyspAlias(MI, O)) { |
117 | 2.53k | isAlias = true; |
118 | 2.53k | MCInst_setIsAlias(MI, isAlias); |
119 | 2.53k | if (useAliasDetails) |
120 | 2.53k | return; |
121 | 2.53k | } |
122 | 4.35k | } |
123 | | |
124 | | // RPRFM overlaps PRFM (reg), so try to print it as RPRFM here. |
125 | 301k | if ((Opcode == AArch64_PRFMroX) || (Opcode == AArch64_PRFMroW)) { |
126 | 480 | if (printRangePrefetchAlias(MI, O, Annot)) { |
127 | 0 | isAlias = true; |
128 | 0 | MCInst_setIsAlias(MI, isAlias); |
129 | 0 | if (useAliasDetails) |
130 | 0 | return; |
131 | 0 | } |
132 | 480 | } |
133 | | |
134 | | // SBFM/UBFM should print to a nicer aliased form if possible. |
135 | 301k | if (Opcode == AArch64_SBFMXri || Opcode == AArch64_SBFMWri || |
136 | 301k | Opcode == AArch64_UBFMXri || Opcode == AArch64_UBFMWri) { |
137 | 2.02k | MCOperand *Op0 = MCInst_getOperand(MI, (0)); |
138 | 2.02k | MCOperand *Op1 = MCInst_getOperand(MI, (1)); |
139 | 2.02k | MCOperand *Op2 = MCInst_getOperand(MI, (2)); |
140 | 2.02k | MCOperand *Op3 = MCInst_getOperand(MI, (3)); |
141 | | |
142 | 2.02k | bool IsSigned = (Opcode == AArch64_SBFMXri || |
143 | 2.02k | Opcode == AArch64_SBFMWri); |
144 | 2.02k | bool Is64Bit = (Opcode == AArch64_SBFMXri || |
145 | 2.02k | Opcode == AArch64_UBFMXri); |
146 | 2.02k | if (MCOperand_isImm(Op2) && MCOperand_getImm(Op2) == 0 && |
147 | 2.02k | MCOperand_isImm(Op3)) { |
148 | 1.11k | const char *AsmMnemonic = NULL; |
149 | | |
150 | 1.11k | switch (MCOperand_getImm(Op3)) { |
151 | 544 | default: |
152 | 544 | break; |
153 | 544 | case 7: |
154 | 164 | if (IsSigned) |
155 | 49 | AsmMnemonic = "sxtb"; |
156 | 115 | else if (!Is64Bit) |
157 | 35 | AsmMnemonic = "uxtb"; |
158 | 164 | break; |
159 | 252 | case 15: |
160 | 252 | if (IsSigned) |
161 | 97 | AsmMnemonic = "sxth"; |
162 | 155 | else if (!Is64Bit) |
163 | 46 | AsmMnemonic = "uxth"; |
164 | 252 | break; |
165 | 154 | case 31: |
166 | | // *xtw is only valid for signed 64-bit operations. |
167 | 154 | if (Is64Bit && IsSigned) |
168 | 99 | AsmMnemonic = "sxtw"; |
169 | 154 | break; |
170 | 1.11k | } |
171 | | |
172 | 1.11k | if (AsmMnemonic) { |
173 | 326 | SStream_concat(O, "%s", AsmMnemonic); |
174 | 326 | SStream_concat0(O, " "); |
175 | | |
176 | 326 | printRegName(O, MCOperand_getReg(Op0)); |
177 | 326 | SStream_concat0(O, ", "); |
178 | 326 | printRegName(O, getWRegFromXReg( |
179 | 326 | MCOperand_getReg(Op1))); |
180 | 326 | if (detail_is_set(MI) && useAliasDetails) { |
181 | 326 | AArch64_set_detail_op_reg( |
182 | 326 | MI, 0, MCOperand_getReg(Op0)); |
183 | 326 | AArch64_set_detail_op_reg( |
184 | 326 | MI, 1, |
185 | 326 | getWRegFromXReg( |
186 | 326 | MCOperand_getReg(Op1))); |
187 | 326 | if (strings_match(AsmMnemonic, "uxtb")) |
188 | 35 | AArch64_get_detail_op(MI, -1) |
189 | 35 | ->ext = |
190 | 35 | AARCH64_EXT_UXTB; |
191 | 291 | else if (strings_match(AsmMnemonic, |
192 | 291 | "sxtb")) |
193 | 49 | AArch64_get_detail_op(MI, -1) |
194 | 49 | ->ext = |
195 | 49 | AARCH64_EXT_SXTB; |
196 | 242 | else if (strings_match(AsmMnemonic, |
197 | 242 | "uxth")) |
198 | 46 | AArch64_get_detail_op(MI, -1) |
199 | 46 | ->ext = |
200 | 46 | AARCH64_EXT_UXTH; |
201 | 196 | else if (strings_match(AsmMnemonic, |
202 | 196 | "sxth")) |
203 | 97 | AArch64_get_detail_op(MI, -1) |
204 | 97 | ->ext = |
205 | 97 | AARCH64_EXT_SXTH; |
206 | 99 | else if (strings_match(AsmMnemonic, |
207 | 99 | "sxtw")) |
208 | 99 | AArch64_get_detail_op(MI, -1) |
209 | 99 | ->ext = |
210 | 99 | AARCH64_EXT_SXTW; |
211 | 0 | else |
212 | 0 | AArch64_get_detail_op(MI, -1) |
213 | 0 | ->ext = |
214 | 0 | AARCH64_EXT_INVALID; |
215 | 326 | } |
216 | 326 | isAlias = true; |
217 | 326 | MCInst_setIsAlias(MI, isAlias); |
218 | 326 | if (useAliasDetails) |
219 | 326 | return; |
220 | 0 | else |
221 | 0 | goto add_real_detail; |
222 | 326 | } |
223 | 1.11k | } |
224 | | |
225 | | // All immediate shifts are aliases, implemented using the Bitfield |
226 | | // instruction. In all cases the immediate shift amount shift must be in |
227 | | // the range 0 to (reg.size -1). |
228 | 1.69k | if (MCOperand_isImm(Op2) && MCOperand_isImm(Op3)) { |
229 | 1.69k | const char *AsmMnemonic = NULL; |
230 | 1.69k | int shift = 0; |
231 | 1.69k | int64_t immr = MCOperand_getImm(Op2); |
232 | 1.69k | int64_t imms = MCOperand_getImm(Op3); |
233 | 1.69k | if (Opcode == AArch64_UBFMWri && imms != 0x1F && |
234 | 1.69k | ((imms + 1) == immr)) { |
235 | 18 | AsmMnemonic = "lsl"; |
236 | 18 | shift = 31 - imms; |
237 | 1.67k | } else if (Opcode == AArch64_UBFMXri && imms != 0x3f && |
238 | 1.67k | ((imms + 1 == immr))) { |
239 | 18 | AsmMnemonic = "lsl"; |
240 | 18 | shift = 63 - imms; |
241 | 1.66k | } else if (Opcode == AArch64_UBFMWri && imms == 0x1f) { |
242 | 28 | AsmMnemonic = "lsr"; |
243 | 28 | shift = immr; |
244 | 1.63k | } else if (Opcode == AArch64_UBFMXri && imms == 0x3f) { |
245 | 18 | AsmMnemonic = "lsr"; |
246 | 18 | shift = immr; |
247 | 1.61k | } else if (Opcode == AArch64_SBFMWri && imms == 0x1f) { |
248 | 43 | AsmMnemonic = "asr"; |
249 | 43 | shift = immr; |
250 | 1.57k | } else if (Opcode == AArch64_SBFMXri && imms == 0x3f) { |
251 | 281 | AsmMnemonic = "asr"; |
252 | 281 | shift = immr; |
253 | 281 | } |
254 | 1.69k | if (AsmMnemonic) { |
255 | 406 | SStream_concat(O, "%s", AsmMnemonic); |
256 | 406 | SStream_concat0(O, " "); |
257 | | |
258 | 406 | printRegName(O, MCOperand_getReg(Op0)); |
259 | 406 | SStream_concat0(O, ", "); |
260 | 406 | printRegName(O, MCOperand_getReg(Op1)); |
261 | 406 | SStream_concat(O, "%s%s#%d", ", ", |
262 | 406 | markup("<imm:"), shift); |
263 | 406 | SStream_concat0(O, markup(">")); |
264 | 406 | if (detail_is_set(MI) && useAliasDetails) { |
265 | 406 | AArch64_set_detail_op_reg( |
266 | 406 | MI, 0, MCOperand_getReg(Op0)); |
267 | 406 | AArch64_set_detail_op_reg( |
268 | 406 | MI, 1, MCOperand_getReg(Op1)); |
269 | 406 | if (strings_match(AsmMnemonic, "lsl")) |
270 | 36 | AArch64_get_detail_op(MI, -1) |
271 | 36 | ->shift.type = |
272 | 36 | AARCH64_SFT_LSL; |
273 | 370 | else if (strings_match(AsmMnemonic, |
274 | 370 | "lsr")) |
275 | 46 | AArch64_get_detail_op(MI, -1) |
276 | 46 | ->shift.type = |
277 | 46 | AARCH64_SFT_LSR; |
278 | 324 | else if (strings_match(AsmMnemonic, |
279 | 324 | "asr")) |
280 | 324 | AArch64_get_detail_op(MI, -1) |
281 | 324 | ->shift.type = |
282 | 324 | AARCH64_SFT_ASR; |
283 | 0 | else |
284 | 0 | AArch64_get_detail_op(MI, -1) |
285 | 0 | ->shift.type = |
286 | 0 | AARCH64_SFT_INVALID; |
287 | 406 | AArch64_get_detail_op(MI, -1) |
288 | 406 | ->shift.value = shift; |
289 | 406 | } |
290 | 406 | isAlias = true; |
291 | 406 | MCInst_setIsAlias(MI, isAlias); |
292 | 406 | if (useAliasDetails) |
293 | 406 | return; |
294 | 0 | else |
295 | 0 | goto add_real_detail; |
296 | 406 | } |
297 | 1.69k | } |
298 | | |
299 | | // SBFIZ/UBFIZ aliases |
300 | 1.29k | if (MCOperand_getImm(Op2) > MCOperand_getImm(Op3)) { |
301 | 452 | SStream_concat(O, "%s", (IsSigned ? "sbfiz" : "ubfiz")); |
302 | 452 | SStream_concat0(O, " "); |
303 | | |
304 | 452 | printRegName(O, MCOperand_getReg(Op0)); |
305 | 452 | SStream_concat0(O, ", "); |
306 | 452 | printRegName(O, MCOperand_getReg(Op1)); |
307 | 452 | SStream_concat(O, "%s%s", ", ", markup("<imm:")); |
308 | 452 | printUInt32Bang(O, (Is64Bit ? 64 : 32) - |
309 | 452 | MCOperand_getImm(Op2)); |
310 | 452 | SStream_concat(O, "%s%s%s", markup(">"), ", ", |
311 | 452 | markup("<imm:")); |
312 | 452 | printInt64Bang(O, MCOperand_getImm(Op3) + 1); |
313 | 452 | SStream_concat0(O, markup(">")); |
314 | 452 | if (detail_is_set(MI) && useAliasDetails) { |
315 | 452 | AArch64_set_detail_op_reg( |
316 | 452 | MI, 0, MCOperand_getReg(Op0)); |
317 | 452 | AArch64_set_detail_op_reg( |
318 | 452 | MI, 1, MCOperand_getReg(Op1)); |
319 | 452 | AArch64_set_detail_op_imm( |
320 | 452 | MI, 2, AARCH64_OP_IMM, |
321 | 452 | (Is64Bit ? 64 : 32) - |
322 | 452 | MCOperand_getImm(Op2)); |
323 | 452 | AArch64_set_detail_op_imm( |
324 | 452 | MI, 3, AARCH64_OP_IMM, |
325 | 452 | MCOperand_getImm(Op3) + 1); |
326 | 452 | } |
327 | 452 | isAlias = true; |
328 | 452 | MCInst_setIsAlias(MI, isAlias); |
329 | 452 | if (useAliasDetails) |
330 | 452 | return; |
331 | 0 | else |
332 | 0 | goto add_real_detail; |
333 | 452 | } |
334 | | |
335 | | // Otherwise SBFX/UBFX is the preferred form |
336 | 839 | SStream_concat(O, "%s", (IsSigned ? "sbfx" : "ubfx")); |
337 | 839 | SStream_concat0(O, " "); |
338 | | |
339 | 839 | printRegName(O, MCOperand_getReg(Op0)); |
340 | 839 | SStream_concat0(O, ", "); |
341 | 839 | printRegName(O, MCOperand_getReg(Op1)); |
342 | 839 | SStream_concat(O, "%s%s", ", ", markup("<imm:")); |
343 | 839 | printInt64Bang(O, MCOperand_getImm(Op2)); |
344 | 839 | SStream_concat(O, "%s%s%s", markup(">"), ", ", markup("<imm:")); |
345 | 839 | printInt64Bang(O, MCOperand_getImm(Op3) - |
346 | 839 | MCOperand_getImm(Op2) + 1); |
347 | 839 | SStream_concat0(O, markup(">")); |
348 | 839 | if (detail_is_set(MI) && useAliasDetails) { |
349 | 839 | AArch64_set_detail_op_reg(MI, 0, MCOperand_getReg(Op0)); |
350 | 839 | AArch64_set_detail_op_reg(MI, 1, MCOperand_getReg(Op1)); |
351 | 839 | AArch64_set_detail_op_imm(MI, 2, AARCH64_OP_IMM, |
352 | 839 | MCOperand_getImm(Op2)); |
353 | 839 | AArch64_set_detail_op_imm( |
354 | 839 | MI, 3, AARCH64_OP_IMM, |
355 | 839 | MCOperand_getImm(Op3) - MCOperand_getImm(Op2) + |
356 | 839 | 1); |
357 | 839 | } |
358 | 839 | isAlias = true; |
359 | 839 | MCInst_setIsAlias(MI, isAlias); |
360 | 839 | if (useAliasDetails) |
361 | 839 | return; |
362 | 0 | else |
363 | 0 | goto add_real_detail; |
364 | 839 | } |
365 | | |
366 | 299k | if (Opcode == AArch64_BFMXri || Opcode == AArch64_BFMWri) { |
367 | 660 | isAlias = true; |
368 | 660 | MCInst_setIsAlias(MI, isAlias); |
369 | 660 | MCOperand *Op0 = MCInst_getOperand(MI, (0)); // Op1 == Op0 |
370 | 660 | MCOperand *Op2 = MCInst_getOperand(MI, (2)); |
371 | 660 | int ImmR = MCOperand_getImm(MCInst_getOperand(MI, (3))); |
372 | 660 | int ImmS = MCOperand_getImm(MCInst_getOperand(MI, (4))); |
373 | | |
374 | 660 | if ((MCOperand_getReg(Op2) == AArch64_WZR || |
375 | 660 | MCOperand_getReg(Op2) == AArch64_XZR) && |
376 | 660 | (ImmR == 0 || ImmS < ImmR) && |
377 | 660 | (AArch64_getFeatureBits(MI->csh->mode, |
378 | 182 | AArch64_FeatureAll) || |
379 | 182 | AArch64_getFeatureBits(MI->csh->mode, |
380 | 182 | AArch64_HasV8_2aOps))) { |
381 | | // BFC takes precedence over its entire range, sligtly differently |
382 | | // to BFI. |
383 | 182 | int BitWidth = Opcode == AArch64_BFMXri ? 64 : 32; |
384 | 182 | int LSB = (BitWidth - ImmR) % BitWidth; |
385 | 182 | int Width = ImmS + 1; |
386 | | |
387 | 182 | SStream_concat0(O, "bfc "); |
388 | 182 | printRegName(O, MCOperand_getReg(Op0)); |
389 | 182 | SStream_concat(O, "%s%s#%d", ", ", markup("<imm:"), |
390 | 182 | LSB); |
391 | 182 | SStream_concat(O, "%s%s%s#%d", markup(">"), ", ", |
392 | 182 | markup("<imm:"), Width); |
393 | 182 | SStream_concat0(O, markup(">")); |
394 | 182 | if (detail_is_set(MI) && useAliasDetails) { |
395 | 182 | AArch64_set_detail_op_reg( |
396 | 182 | MI, 0, MCOperand_getReg(Op0)); |
397 | 182 | AArch64_set_detail_op_imm(MI, 3, AARCH64_OP_IMM, |
398 | 182 | LSB); |
399 | 182 | AArch64_set_detail_op_imm(MI, 4, AARCH64_OP_IMM, |
400 | 182 | Width); |
401 | 182 | } |
402 | | |
403 | 182 | if (useAliasDetails) |
404 | 182 | return; |
405 | 0 | else |
406 | 0 | goto add_real_detail; |
407 | 478 | } else if (ImmS < ImmR) { |
408 | | // BFI alias |
409 | 271 | int BitWidth = Opcode == AArch64_BFMXri ? 64 : 32; |
410 | 271 | int LSB = (BitWidth - ImmR) % BitWidth; |
411 | 271 | int Width = ImmS + 1; |
412 | | |
413 | 271 | SStream_concat0(O, "bfi "); |
414 | 271 | printRegName(O, MCOperand_getReg(Op0)); |
415 | 271 | SStream_concat0(O, ", "); |
416 | 271 | printRegName(O, MCOperand_getReg(Op2)); |
417 | 271 | SStream_concat(O, "%s%s#%d", ", ", markup("<imm:"), |
418 | 271 | LSB); |
419 | 271 | SStream_concat(O, "%s%s%s#%d", markup(">"), ", ", |
420 | 271 | markup("<imm:"), Width); |
421 | 271 | SStream_concat0(O, markup(">")); |
422 | 271 | if (detail_is_set(MI) && useAliasDetails) { |
423 | 271 | AArch64_set_detail_op_reg( |
424 | 271 | MI, 0, MCOperand_getReg(Op0)); |
425 | 271 | AArch64_set_detail_op_reg( |
426 | 271 | MI, 2, MCOperand_getReg(Op2)); |
427 | 271 | AArch64_set_detail_op_imm(MI, 3, AARCH64_OP_IMM, |
428 | 271 | LSB); |
429 | 271 | AArch64_set_detail_op_imm(MI, 4, AARCH64_OP_IMM, |
430 | 271 | Width); |
431 | 271 | } |
432 | 271 | if (useAliasDetails) |
433 | 271 | return; |
434 | 0 | else |
435 | 0 | goto add_real_detail; |
436 | 271 | } |
437 | | |
438 | 207 | int LSB = ImmR; |
439 | 207 | int Width = ImmS - ImmR + 1; |
440 | | // Otherwise BFXIL the preferred form |
441 | 207 | SStream_concat0(O, "bfxil "); |
442 | 207 | printRegName(O, MCOperand_getReg(Op0)); |
443 | 207 | SStream_concat0(O, ", "); |
444 | 207 | printRegName(O, MCOperand_getReg(Op2)); |
445 | 207 | SStream_concat(O, "%s%s#%d", ", ", markup("<imm:"), LSB); |
446 | 207 | SStream_concat(O, "%s%s%s#%d", markup(">"), ", ", |
447 | 207 | markup("<imm:"), Width); |
448 | 207 | SStream_concat0(O, markup(">")); |
449 | 207 | if (detail_is_set(MI) && useAliasDetails) { |
450 | 207 | AArch64_set_detail_op_reg(MI, 0, MCOperand_getReg(Op0)); |
451 | 207 | AArch64_set_detail_op_reg(MI, 2, MCOperand_getReg(Op2)); |
452 | 207 | AArch64_set_detail_op_imm(MI, 3, AARCH64_OP_IMM, LSB); |
453 | 207 | AArch64_set_detail_op_imm(MI, 4, AARCH64_OP_IMM, Width); |
454 | 207 | } |
455 | 207 | if (useAliasDetails) |
456 | 207 | return; |
457 | 207 | } |
458 | | |
459 | | // Symbolic operands for MOVZ, MOVN and MOVK already imply a shift |
460 | | // (e.g. :gottprel_g1: is always going to be "lsl #16") so it should not be |
461 | | // printed. |
462 | 298k | if ((Opcode == AArch64_MOVZXi || Opcode == AArch64_MOVZWi || |
463 | 298k | Opcode == AArch64_MOVNXi || Opcode == AArch64_MOVNWi) && |
464 | 298k | MCOperand_isExpr(MCInst_getOperand(MI, (1)))) { |
465 | 0 | printUInt64Bang(O, MCInst_getOpVal(MI, 1)); |
466 | 0 | if (detail_is_set(MI) && useAliasDetails) { |
467 | 0 | AArch64_set_detail_op_imm(MI, 1, AARCH64_OP_IMM, MCInst_getOpVal(MI, 1)); |
468 | 0 | } |
469 | 0 | } |
470 | | |
471 | 298k | if ((Opcode == AArch64_MOVKXi || Opcode == AArch64_MOVKWi) && |
472 | 298k | MCOperand_isExpr(MCInst_getOperand(MI, (2)))) { |
473 | 0 | printUInt64Bang(O, MCInst_getOpVal(MI, 2)); |
474 | 0 | if (detail_is_set(MI) && useAliasDetails) { |
475 | 0 | AArch64_set_detail_op_imm(MI, 2, AARCH64_OP_IMM, MCInst_getOpVal(MI, 2)); |
476 | 0 | } |
477 | 0 | } |
478 | | |
479 | | // MOVZ, MOVN and "ORR wzr, #imm" instructions are aliases for MOV, but |
480 | | // their domains overlap so they need to be prioritized. The chain is "MOVZ |
481 | | // lsl #0 > MOVZ lsl #N > MOVN lsl #0 > MOVN lsl #N > ORR". The highest |
482 | | // instruction that can represent the move is the MOV alias, and the rest |
483 | | // get printed normally. |
484 | 298k | if ((Opcode == AArch64_MOVZXi || Opcode == AArch64_MOVZWi) && |
485 | 298k | MCOperand_isImm(MCInst_getOperand(MI, (1))) && |
486 | 298k | MCOperand_isImm(MCInst_getOperand(MI, (2)))) { |
487 | 1.51k | int RegWidth = Opcode == AArch64_MOVZXi ? 64 : 32; |
488 | 1.51k | int Shift = MCOperand_getImm(MCInst_getOperand(MI, (2))); |
489 | 1.51k | uint64_t Value = |
490 | 1.51k | (uint64_t)MCOperand_getImm(MCInst_getOperand(MI, (1))) |
491 | 1.51k | << Shift; |
492 | | |
493 | 1.51k | if (AArch64_AM_isMOVZMovAlias( |
494 | 1.51k | Value, Shift, Opcode == AArch64_MOVZXi ? 64 : 32)) { |
495 | 1.45k | isAlias = true; |
496 | 1.45k | MCInst_setIsAlias(MI, isAlias); |
497 | 1.45k | SStream_concat0(O, "mov "); |
498 | 1.45k | printRegName(O, MCOperand_getReg( |
499 | 1.45k | MCInst_getOperand(MI, (0)))); |
500 | 1.45k | SStream_concat(O, "%s%s", ", ", markup("<imm:")); |
501 | 1.45k | printInt64Bang(O, SignExtend64(Value, RegWidth)); |
502 | 1.45k | SStream_concat0(O, markup(">")); |
503 | 1.45k | if (detail_is_set(MI) && useAliasDetails) { |
504 | 1.45k | AArch64_set_detail_op_reg( |
505 | 1.45k | MI, 0, MCInst_getOpVal(MI, 0)); |
506 | 1.45k | AArch64_set_detail_op_imm( |
507 | 1.45k | MI, 1, AARCH64_OP_IMM, |
508 | 1.45k | SignExtend64(Value, RegWidth)); |
509 | 1.45k | } |
510 | 1.45k | if (useAliasDetails) |
511 | 1.45k | return; |
512 | 1.45k | } |
513 | 1.51k | } |
514 | | |
515 | 297k | if ((Opcode == AArch64_MOVNXi || Opcode == AArch64_MOVNWi) && |
516 | 297k | MCOperand_isImm(MCInst_getOperand(MI, (1))) && |
517 | 297k | MCOperand_isImm(MCInst_getOperand(MI, (2)))) { |
518 | 895 | int RegWidth = Opcode == AArch64_MOVNXi ? 64 : 32; |
519 | 895 | int Shift = MCOperand_getImm(MCInst_getOperand(MI, (2))); |
520 | 895 | uint64_t Value = |
521 | 895 | ~((uint64_t)MCOperand_getImm(MCInst_getOperand(MI, (1))) |
522 | 895 | << Shift); |
523 | 895 | if (RegWidth == 32) |
524 | 199 | Value = Value & 0xffffffff; |
525 | | |
526 | 895 | if (AArch64_AM_isMOVNMovAlias(Value, Shift, RegWidth)) { |
527 | 769 | isAlias = true; |
528 | 769 | MCInst_setIsAlias(MI, isAlias); |
529 | 769 | SStream_concat0(O, "mov "); |
530 | 769 | printRegName(O, MCOperand_getReg( |
531 | 769 | MCInst_getOperand(MI, (0)))); |
532 | 769 | SStream_concat(O, "%s%s", ", ", markup("<imm:")); |
533 | 769 | printInt64Bang(O, SignExtend64(Value, RegWidth)); |
534 | 769 | SStream_concat0(O, markup(">")); |
535 | 769 | if (detail_is_set(MI) && useAliasDetails) { |
536 | 769 | AArch64_set_detail_op_reg( |
537 | 769 | MI, 0, MCInst_getOpVal(MI, 0)); |
538 | 769 | AArch64_set_detail_op_imm( |
539 | 769 | MI, 1, AARCH64_OP_IMM, |
540 | 769 | SignExtend64(Value, RegWidth)); |
541 | 769 | } |
542 | 769 | if (useAliasDetails) |
543 | 769 | return; |
544 | 769 | } |
545 | 895 | } |
546 | | |
547 | 296k | if ((Opcode == AArch64_ORRXri || Opcode == AArch64_ORRWri) && |
548 | 296k | (MCOperand_getReg(MCInst_getOperand(MI, (1))) == AArch64_XZR || |
549 | 4.22k | MCOperand_getReg(MCInst_getOperand(MI, (1))) == AArch64_WZR) && |
550 | 296k | MCOperand_isImm(MCInst_getOperand(MI, (2)))) { |
551 | 3.04k | int RegWidth = Opcode == AArch64_ORRXri ? 64 : 32; |
552 | 3.04k | uint64_t Value = AArch64_AM_decodeLogicalImmediate( |
553 | 3.04k | MCOperand_getImm(MCInst_getOperand(MI, (2))), RegWidth); |
554 | 3.04k | if (!AArch64_AM_isAnyMOVWMovAlias(Value, RegWidth)) { |
555 | 1.33k | isAlias = true; |
556 | 1.33k | MCInst_setIsAlias(MI, isAlias); |
557 | 1.33k | SStream_concat0(O, "mov "); |
558 | 1.33k | printRegName(O, MCOperand_getReg( |
559 | 1.33k | MCInst_getOperand(MI, (0)))); |
560 | 1.33k | SStream_concat(O, "%s%s", ", ", markup("<imm:")); |
561 | 1.33k | printInt64Bang(O, SignExtend64(Value, RegWidth)); |
562 | 1.33k | SStream_concat0(O, markup(">")); |
563 | 1.33k | if (detail_is_set(MI) && useAliasDetails) { |
564 | 1.33k | AArch64_set_detail_op_reg( |
565 | 1.33k | MI, 0, MCInst_getOpVal(MI, 0)); |
566 | 1.33k | AArch64_set_detail_op_imm( |
567 | 1.33k | MI, 2, AARCH64_OP_IMM, |
568 | 1.33k | SignExtend64(Value, RegWidth)); |
569 | 1.33k | } |
570 | 1.33k | if (useAliasDetails) |
571 | 1.33k | return; |
572 | 1.33k | } |
573 | 3.04k | } |
574 | | |
575 | 295k | if (Opcode == AArch64_SPACE) { |
576 | 0 | isAlias = true; |
577 | 0 | MCInst_setIsAlias(MI, isAlias); |
578 | 0 | SStream_concat1(O, ' '); |
579 | 0 | SStream_concat(O, "%s", " SPACE "); |
580 | 0 | printInt64(O, MCOperand_getImm(MCInst_getOperand(MI, (1)))); |
581 | 0 | if (detail_is_set(MI) && useAliasDetails) { |
582 | 0 | AArch64_set_detail_op_imm(MI, 1, AARCH64_OP_IMM, |
583 | 0 | MCInst_getOpVal(MI, 1)); |
584 | 0 | } |
585 | 0 | if (useAliasDetails) |
586 | 0 | return; |
587 | 0 | } |
588 | | |
589 | 295k | if (!isAlias) |
590 | 295k | isAlias |= printAliasInstr(MI, Address, O); |
591 | | |
592 | 295k | add_real_detail: |
593 | 295k | MCInst_setIsAlias(MI, isAlias); |
594 | | |
595 | 295k | if (!isAlias || !useAliasDetails) { |
596 | 261k | map_set_fill_detail_ops(MI, !(isAlias && useAliasDetails)); |
597 | 261k | if (isAlias) |
598 | 0 | SStream_Close(O); |
599 | 261k | printInstruction(MI, Address, O); |
600 | 261k | if (isAlias) |
601 | 0 | SStream_Open(O); |
602 | 261k | } |
603 | 295k | } |
604 | | |
605 | | bool printRangePrefetchAlias(MCInst *MI, SStream *O, const char *Annot) |
606 | 480 | { |
607 | 480 | unsigned Opcode = MCInst_getOpcode(MI); |
608 | | |
609 | 480 | #ifndef NDEBUG |
610 | | |
611 | 480 | #endif |
612 | | |
613 | 480 | unsigned PRFOp = MCOperand_getImm(MCInst_getOperand(MI, (0))); |
614 | 480 | unsigned Mask = 0x18; // 0b11000 |
615 | 480 | if ((PRFOp & Mask) != Mask) |
616 | 480 | return false; // Rt != '11xxx', it's a PRFM instruction. |
617 | | |
618 | 0 | unsigned Rm = MCOperand_getReg(MCInst_getOperand(MI, (2))); |
619 | | |
620 | | // "Rm" must be a 64-bit GPR for RPRFM. |
621 | 0 | if (MCRegisterInfo_getRegClass(MI->MRI, Rm)) |
622 | 0 | Rm = MCRegisterInfo_getMatchingSuperReg( |
623 | 0 | MI->MRI, Rm, AArch64_sub_32, |
624 | 0 | MCRegisterInfo_getRegClass(MI->MRI, Rm)); |
625 | |
|
626 | 0 | unsigned SignExtend = MCOperand_getImm( |
627 | 0 | MCInst_getOperand(MI, (3))); // encoded in "option<2>". |
628 | 0 | unsigned Shift = |
629 | 0 | MCOperand_getImm(MCInst_getOperand(MI, (4))); // encoded in "S". |
630 | |
|
631 | 0 | unsigned Option0 = (Opcode == AArch64_PRFMroX) ? 1 : 0; |
632 | | |
633 | | // encoded in "option<2>:option<0>:S:Rt<2:0>". |
634 | 0 | unsigned RPRFOp = (SignExtend << 5) | (Option0 << 4) | (Shift << 3) | |
635 | 0 | (PRFOp & 0x7); |
636 | |
|
637 | 0 | SStream_concat0(O, "rprfm "); |
638 | 0 | const AArch64RPRFM_RPRFM *RPRFM = |
639 | 0 | AArch64RPRFM_lookupRPRFMByEncoding(RPRFOp); |
640 | 0 | if (RPRFM) { |
641 | 0 | SStream_concat0(O, RPRFM->Name); |
642 | 0 | } else { |
643 | 0 | printUInt32Bang(O, RPRFOp); |
644 | 0 | SStream_concat(O, ", "); |
645 | 0 | } |
646 | 0 | SStream_concat0(O, getRegisterName(Rm, AArch64_NoRegAltName)); |
647 | 0 | SStream_concat0(O, ", ["); |
648 | 0 | printOperand(MI, 1, O); // "Rn". |
649 | 0 | SStream_concat0(O, "]"); |
650 | |
|
651 | 0 | return true; |
652 | 480 | } |
653 | | |
654 | | bool printSysAlias(MCInst *MI, SStream *O) |
655 | 7.82k | { |
656 | 7.82k | MCOperand *Op1 = MCInst_getOperand(MI, (0)); |
657 | 7.82k | MCOperand *Cn = MCInst_getOperand(MI, (1)); |
658 | 7.82k | MCOperand *Cm = MCInst_getOperand(MI, (2)); |
659 | 7.82k | MCOperand *Op2 = MCInst_getOperand(MI, (3)); |
660 | | |
661 | 7.82k | unsigned Op1Val = MCOperand_getImm(Op1); |
662 | 7.82k | unsigned CnVal = MCOperand_getImm(Cn); |
663 | 7.82k | unsigned CmVal = MCOperand_getImm(Cm); |
664 | 7.82k | unsigned Op2Val = MCOperand_getImm(Op2); |
665 | | |
666 | 7.82k | uint16_t Encoding = Op2Val; |
667 | 7.82k | Encoding |= CmVal << 3; |
668 | 7.82k | Encoding |= CnVal << 7; |
669 | 7.82k | Encoding |= Op1Val << 11; |
670 | | |
671 | 7.82k | bool NeedsReg; |
672 | 7.82k | const char *Ins; |
673 | 7.82k | const char *Name; |
674 | | |
675 | 7.82k | if (CnVal == 7) { |
676 | 6.02k | switch (CmVal) { |
677 | 215 | default: |
678 | 215 | return false; |
679 | | // Maybe IC, maybe Prediction Restriction |
680 | 1.76k | case 1: |
681 | 1.76k | switch (Op1Val) { |
682 | 103 | default: |
683 | 103 | return false; |
684 | 1.51k | case 0: |
685 | 1.51k | goto Search_IC; |
686 | 144 | case 3: |
687 | 144 | goto Search_PRCTX; |
688 | 1.76k | } |
689 | | // Prediction Restriction aliases |
690 | 930 | case 3: { |
691 | 1.07k | Search_PRCTX: |
692 | 1.07k | if (Op1Val != 3 || CnVal != 7 || CmVal != 3) |
693 | 158 | return false; |
694 | | |
695 | 916 | unsigned int Requires = |
696 | 916 | Op2Val == 6 ? AArch64_FeatureSPECRES2 : |
697 | 916 | AArch64_FeaturePredRes; |
698 | 916 | if (!(AArch64_getFeatureBits(MI->csh->mode, |
699 | 916 | AArch64_FeatureAll) || |
700 | 916 | AArch64_getFeatureBits(MI->csh->mode, Requires))) |
701 | 0 | return false; |
702 | | |
703 | 916 | NeedsReg = true; |
704 | 916 | switch (Op2Val) { |
705 | 599 | default: |
706 | 599 | return false; |
707 | 266 | case 4: |
708 | 266 | Ins = "cfp "; |
709 | 266 | break; |
710 | 5 | case 5: |
711 | 5 | Ins = "dvp "; |
712 | 5 | break; |
713 | 38 | case 6: |
714 | 38 | Ins = "cosp "; |
715 | 38 | break; |
716 | 8 | case 7: |
717 | 8 | Ins = "cpp "; |
718 | 8 | break; |
719 | 916 | } |
720 | 317 | Name = "RCTX"; |
721 | 317 | } break; |
722 | | // IC aliases |
723 | 53 | case 5: { |
724 | 1.56k | Search_IC: { |
725 | 1.56k | const AArch64IC_IC *IC = AArch64IC_lookupICByEncoding(Encoding); |
726 | 1.56k | if (!IC || |
727 | 1.56k | !AArch64_testFeatureList(MI->csh->mode, IC->FeaturesRequired)) |
728 | 1.19k | return false; |
729 | 374 | if (detail_is_set(MI)) { |
730 | 374 | aarch64_sysop sysop = { 0 }; |
731 | 374 | sysop.reg = IC->SysReg; |
732 | 374 | sysop.sub_type = AARCH64_OP_IC; |
733 | 374 | AArch64_get_detail_op(MI, 0)->type = AARCH64_OP_SYSREG; |
734 | 374 | AArch64_get_detail_op(MI, 0)->sysop = sysop; |
735 | 374 | AArch64_inc_op_count(MI); |
736 | 374 | } |
737 | | |
738 | 374 | NeedsReg = IC->NeedsReg; |
739 | 374 | Ins = "ic "; |
740 | 374 | Name = IC->Name; |
741 | 374 | } |
742 | 374 | } break; |
743 | | // DC aliases |
744 | 456 | case 4: |
745 | 479 | case 6: |
746 | 506 | case 10: |
747 | 517 | case 11: |
748 | 630 | case 12: |
749 | 1.06k | case 13: |
750 | 1.08k | case 14: { |
751 | 1.08k | const AArch64DC_DC *DC = |
752 | 1.08k | AArch64DC_lookupDCByEncoding(Encoding); |
753 | 1.08k | if (!DC || !AArch64_testFeatureList( |
754 | 398 | MI->csh->mode, DC->FeaturesRequired)) |
755 | 682 | return false; |
756 | 398 | if (detail_is_set(MI)) { |
757 | 398 | aarch64_sysop sysop = { 0 }; |
758 | 398 | sysop.alias = DC->SysAlias; |
759 | 398 | sysop.sub_type = AARCH64_OP_DC; |
760 | 398 | AArch64_get_detail_op(MI, 0)->type = |
761 | 398 | AARCH64_OP_SYSALIAS; |
762 | 398 | AArch64_get_detail_op(MI, 0)->sysop = sysop; |
763 | 398 | AArch64_inc_op_count(MI); |
764 | 398 | } |
765 | | |
766 | 398 | NeedsReg = true; |
767 | 398 | Ins = "dc "; |
768 | 398 | Name = DC->Name; |
769 | 398 | } break; |
770 | | // AT aliases |
771 | 639 | case 8: |
772 | 1.98k | case 9: { |
773 | 1.98k | const AArch64AT_AT *AT = |
774 | 1.98k | AArch64AT_lookupATByEncoding(Encoding); |
775 | 1.98k | if (!AT || !AArch64_testFeatureList( |
776 | 906 | MI->csh->mode, AT->FeaturesRequired)) |
777 | 1.08k | return false; |
778 | | |
779 | 906 | if (detail_is_set(MI)) { |
780 | 906 | aarch64_sysop sysop = { 0 }; |
781 | 906 | sysop.alias = AT->SysAlias; |
782 | 906 | sysop.sub_type = AARCH64_OP_AT; |
783 | 906 | AArch64_get_detail_op(MI, 0)->type = |
784 | 906 | AARCH64_OP_SYSALIAS; |
785 | 906 | AArch64_get_detail_op(MI, 0)->sysop = sysop; |
786 | 906 | AArch64_inc_op_count(MI); |
787 | 906 | } |
788 | 906 | NeedsReg = true; |
789 | 906 | Ins = "at "; |
790 | 906 | Name = AT->Name; |
791 | 906 | } break; |
792 | 6.02k | } |
793 | 6.02k | } else if (CnVal == 8 || CnVal == 9) { |
794 | | // TLBI aliases |
795 | 1.08k | const AArch64TLBI_TLBI *TLBI = |
796 | 1.08k | AArch64TLBI_lookupTLBIByEncoding(Encoding); |
797 | 1.08k | if (!TLBI || !AArch64_testFeatureList(MI->csh->mode, |
798 | 434 | TLBI->FeaturesRequired)) |
799 | 646 | return false; |
800 | | |
801 | 434 | if (detail_is_set(MI)) { |
802 | 434 | aarch64_sysop sysop = { 0 }; |
803 | 434 | sysop.reg = TLBI->SysReg; |
804 | 434 | sysop.sub_type = AARCH64_OP_TLBI; |
805 | 434 | AArch64_get_detail_op(MI, 0)->type = AARCH64_OP_SYSREG; |
806 | 434 | AArch64_get_detail_op(MI, 0)->sysop = sysop; |
807 | 434 | AArch64_inc_op_count(MI); |
808 | 434 | } |
809 | 434 | NeedsReg = TLBI->NeedsReg; |
810 | 434 | Ins = "tlbi "; |
811 | 434 | Name = TLBI->Name; |
812 | 434 | } else |
813 | 723 | return false; |
814 | | |
815 | 4.85k | #define TMP_STR_LEN 32 |
816 | 2.42k | char Str[TMP_STR_LEN] = { 0 }; |
817 | 2.42k | append_to_str_lower(Str, TMP_STR_LEN, Ins); |
818 | 2.42k | append_to_str_lower(Str, TMP_STR_LEN, Name); |
819 | 2.42k | #undef TMP_STR_LEN |
820 | | |
821 | 2.42k | SStream_concat1(O, ' '); |
822 | 2.42k | SStream_concat0(O, Str); |
823 | 2.42k | if (NeedsReg) { |
824 | 1.79k | SStream_concat0(O, ", "); |
825 | 1.79k | printRegName(O, MCOperand_getReg(MCInst_getOperand(MI, (4)))); |
826 | 1.79k | AArch64_set_detail_op_reg(MI, 4, MCInst_getOpVal(MI, 4)); |
827 | 1.79k | } |
828 | | |
829 | 2.42k | return true; |
830 | 7.82k | } |
831 | | |
832 | | bool printSyspAlias(MCInst *MI, SStream *O) |
833 | 4.35k | { |
834 | 4.35k | MCOperand *Op1 = MCInst_getOperand(MI, (0)); |
835 | 4.35k | MCOperand *Cn = MCInst_getOperand(MI, (1)); |
836 | 4.35k | MCOperand *Cm = MCInst_getOperand(MI, (2)); |
837 | 4.35k | MCOperand *Op2 = MCInst_getOperand(MI, (3)); |
838 | | |
839 | 4.35k | unsigned Op1Val = MCOperand_getImm(Op1); |
840 | 4.35k | unsigned CnVal = MCOperand_getImm(Cn); |
841 | 4.35k | unsigned CmVal = MCOperand_getImm(Cm); |
842 | 4.35k | unsigned Op2Val = MCOperand_getImm(Op2); |
843 | | |
844 | 4.35k | uint16_t Encoding = Op2Val; |
845 | 4.35k | Encoding |= CmVal << 3; |
846 | 4.35k | Encoding |= CnVal << 7; |
847 | 4.35k | Encoding |= Op1Val << 11; |
848 | | |
849 | 4.35k | const char *Ins; |
850 | 4.35k | const char *Name; |
851 | | |
852 | 4.35k | if (CnVal == 8 || CnVal == 9) { |
853 | | // TLBIP aliases |
854 | | |
855 | 3.14k | if (CnVal == 9) { |
856 | 1.03k | if (!AArch64_getFeatureBits(MI->csh->mode, |
857 | 1.03k | AArch64_FeatureAll) || |
858 | 1.03k | !AArch64_getFeatureBits(MI->csh->mode, |
859 | 1.03k | AArch64_FeatureXS)) |
860 | 0 | return false; |
861 | 1.03k | Encoding &= ~(1 << 7); |
862 | 1.03k | } |
863 | | |
864 | 3.14k | const AArch64TLBI_TLBI *TLBI = |
865 | 3.14k | AArch64TLBI_lookupTLBIByEncoding(Encoding); |
866 | 3.14k | if (!TLBI || !AArch64_testFeatureList(MI->csh->mode, |
867 | 2.53k | TLBI->FeaturesRequired)) |
868 | 607 | return false; |
869 | | |
870 | 2.53k | if (detail_is_set(MI)) { |
871 | 2.53k | aarch64_sysop sysop = { 0 }; |
872 | 2.53k | sysop.reg = TLBI->SysReg; |
873 | 2.53k | sysop.sub_type = AARCH64_OP_TLBI; |
874 | 2.53k | AArch64_get_detail_op(MI, 0)->type = AARCH64_OP_SYSREG; |
875 | 2.53k | AArch64_get_detail_op(MI, 0)->sysop = sysop; |
876 | 2.53k | AArch64_inc_op_count(MI); |
877 | 2.53k | } |
878 | 2.53k | Ins = "tlbip "; |
879 | 2.53k | Name = TLBI->Name; |
880 | 2.53k | } else |
881 | 1.21k | return false; |
882 | | |
883 | 6.03k | #define TMP_STR_LEN 32 |
884 | 2.53k | char Str[TMP_STR_LEN] = { 0 }; |
885 | 2.53k | append_to_str_lower(Str, TMP_STR_LEN, Ins); |
886 | 2.53k | append_to_str_lower(Str, TMP_STR_LEN, Name); |
887 | | |
888 | 2.53k | if (CnVal == 9) { |
889 | 961 | append_to_str_lower(Str, TMP_STR_LEN, "nxs"); |
890 | 961 | } |
891 | 2.53k | #undef TMP_STR_LEN |
892 | | |
893 | 2.53k | SStream_concat1(O, ' '); |
894 | 2.53k | SStream_concat0(O, Str); |
895 | 2.53k | SStream_concat0(O, ", "); |
896 | 2.53k | if (MCOperand_getReg(MCInst_getOperand(MI, (4))) == AArch64_XZR) |
897 | 1.45k | printSyspXzrPair(MI, 4, O); |
898 | 1.07k | else |
899 | 1.07k | CONCAT(printGPRSeqPairsClassOperand, 64)(MI, 4, O); |
900 | | |
901 | 2.53k | return true; |
902 | 4.35k | } |
903 | | |
904 | | #define DEFINE_printMatrix(EltSize) \ |
905 | | void CONCAT(printMatrix, EltSize)(MCInst * MI, unsigned OpNum, \ |
906 | | SStream *O) \ |
907 | 8.62k | { \ |
908 | 8.62k | AArch64_add_cs_detail_1( \ |
909 | 8.62k | MI, CONCAT(AArch64_OP_GROUP_Matrix, EltSize), OpNum, \ |
910 | 8.62k | EltSize); \ |
911 | 8.62k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ |
912 | 8.62k | \ |
913 | 8.62k | printRegName(O, MCOperand_getReg(RegOp)); \ |
914 | 8.62k | switch (EltSize) { \ |
915 | 167 | case 0: \ |
916 | 167 | break; \ |
917 | 0 | case 8: \ |
918 | 0 | SStream_concat0(O, ".b"); \ |
919 | 0 | break; \ |
920 | 2.00k | case 16: \ |
921 | 2.00k | SStream_concat0(O, ".h"); \ |
922 | 2.00k | break; \ |
923 | 3.77k | case 32: \ |
924 | 3.77k | SStream_concat0(O, ".s"); \ |
925 | 3.77k | break; \ |
926 | 2.66k | case 64: \ |
927 | 2.66k | SStream_concat0(O, ".d"); \ |
928 | 2.66k | break; \ |
929 | 0 | case 128: \ |
930 | 0 | SStream_concat0(O, ".q"); \ |
931 | 0 | break; \ |
932 | 0 | default: \ |
933 | 0 | CS_ASSERT_RET(0 && "Unsupported element size"); \ |
934 | 8.62k | } \ |
935 | 8.62k | } Line | Count | Source | 907 | 2.66k | { \ | 908 | 2.66k | AArch64_add_cs_detail_1( \ | 909 | 2.66k | MI, CONCAT(AArch64_OP_GROUP_Matrix, EltSize), OpNum, \ | 910 | 2.66k | EltSize); \ | 911 | 2.66k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ | 912 | 2.66k | \ | 913 | 2.66k | printRegName(O, MCOperand_getReg(RegOp)); \ | 914 | 2.66k | switch (EltSize) { \ | 915 | 0 | case 0: \ | 916 | 0 | break; \ | 917 | 0 | case 8: \ | 918 | 0 | SStream_concat0(O, ".b"); \ | 919 | 0 | break; \ | 920 | 0 | case 16: \ | 921 | 0 | SStream_concat0(O, ".h"); \ | 922 | 0 | break; \ | 923 | 0 | case 32: \ | 924 | 0 | SStream_concat0(O, ".s"); \ | 925 | 0 | break; \ | 926 | 2.66k | case 64: \ | 927 | 2.66k | SStream_concat0(O, ".d"); \ | 928 | 2.66k | break; \ | 929 | 0 | case 128: \ | 930 | 0 | SStream_concat0(O, ".q"); \ | 931 | 0 | break; \ | 932 | 0 | default: \ | 933 | 0 | CS_ASSERT_RET(0 && "Unsupported element size"); \ | 934 | 2.66k | } \ | 935 | 2.66k | } |
Line | Count | Source | 907 | 3.77k | { \ | 908 | 3.77k | AArch64_add_cs_detail_1( \ | 909 | 3.77k | MI, CONCAT(AArch64_OP_GROUP_Matrix, EltSize), OpNum, \ | 910 | 3.77k | EltSize); \ | 911 | 3.77k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ | 912 | 3.77k | \ | 913 | 3.77k | printRegName(O, MCOperand_getReg(RegOp)); \ | 914 | 3.77k | switch (EltSize) { \ | 915 | 0 | case 0: \ | 916 | 0 | break; \ | 917 | 0 | case 8: \ | 918 | 0 | SStream_concat0(O, ".b"); \ | 919 | 0 | break; \ | 920 | 0 | case 16: \ | 921 | 0 | SStream_concat0(O, ".h"); \ | 922 | 0 | break; \ | 923 | 3.77k | case 32: \ | 924 | 3.77k | SStream_concat0(O, ".s"); \ | 925 | 3.77k | break; \ | 926 | 0 | case 64: \ | 927 | 0 | SStream_concat0(O, ".d"); \ | 928 | 0 | break; \ | 929 | 0 | case 128: \ | 930 | 0 | SStream_concat0(O, ".q"); \ | 931 | 0 | break; \ | 932 | 0 | default: \ | 933 | 0 | CS_ASSERT_RET(0 && "Unsupported element size"); \ | 934 | 3.77k | } \ | 935 | 3.77k | } |
Line | Count | Source | 907 | 2.00k | { \ | 908 | 2.00k | AArch64_add_cs_detail_1( \ | 909 | 2.00k | MI, CONCAT(AArch64_OP_GROUP_Matrix, EltSize), OpNum, \ | 910 | 2.00k | EltSize); \ | 911 | 2.00k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ | 912 | 2.00k | \ | 913 | 2.00k | printRegName(O, MCOperand_getReg(RegOp)); \ | 914 | 2.00k | switch (EltSize) { \ | 915 | 0 | case 0: \ | 916 | 0 | break; \ | 917 | 0 | case 8: \ | 918 | 0 | SStream_concat0(O, ".b"); \ | 919 | 0 | break; \ | 920 | 2.00k | case 16: \ | 921 | 2.00k | SStream_concat0(O, ".h"); \ | 922 | 2.00k | break; \ | 923 | 0 | case 32: \ | 924 | 0 | SStream_concat0(O, ".s"); \ | 925 | 0 | break; \ | 926 | 0 | case 64: \ | 927 | 0 | SStream_concat0(O, ".d"); \ | 928 | 0 | break; \ | 929 | 0 | case 128: \ | 930 | 0 | SStream_concat0(O, ".q"); \ | 931 | 0 | break; \ | 932 | 0 | default: \ | 933 | 0 | CS_ASSERT_RET(0 && "Unsupported element size"); \ | 934 | 2.00k | } \ | 935 | 2.00k | } |
Line | Count | Source | 907 | 167 | { \ | 908 | 167 | AArch64_add_cs_detail_1( \ | 909 | 167 | MI, CONCAT(AArch64_OP_GROUP_Matrix, EltSize), OpNum, \ | 910 | 167 | EltSize); \ | 911 | 167 | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ | 912 | 167 | \ | 913 | 167 | printRegName(O, MCOperand_getReg(RegOp)); \ | 914 | 167 | switch (EltSize) { \ | 915 | 167 | case 0: \ | 916 | 167 | break; \ | 917 | 0 | case 8: \ | 918 | 0 | SStream_concat0(O, ".b"); \ | 919 | 0 | break; \ | 920 | 0 | case 16: \ | 921 | 0 | SStream_concat0(O, ".h"); \ | 922 | 0 | break; \ | 923 | 0 | case 32: \ | 924 | 0 | SStream_concat0(O, ".s"); \ | 925 | 0 | break; \ | 926 | 0 | case 64: \ | 927 | 0 | SStream_concat0(O, ".d"); \ | 928 | 0 | break; \ | 929 | 0 | case 128: \ | 930 | 0 | SStream_concat0(O, ".q"); \ | 931 | 0 | break; \ | 932 | 0 | default: \ | 933 | 0 | CS_ASSERT_RET(0 && "Unsupported element size"); \ | 934 | 167 | } \ | 935 | 167 | } |
|
936 | | DEFINE_printMatrix(64); |
937 | | DEFINE_printMatrix(32); |
938 | | DEFINE_printMatrix(16); |
939 | | DEFINE_printMatrix(0); |
940 | | |
941 | | #define DEFINE_printMatrixTileVector(IsVertical) \ |
942 | | void CONCAT(printMatrixTileVector, \ |
943 | | IsVertical)(MCInst * MI, unsigned OpNum, SStream *O) \ |
944 | 6.61k | { \ |
945 | 6.61k | AArch64_add_cs_detail_1( \ |
946 | 6.61k | MI, \ |
947 | 6.61k | CONCAT(AArch64_OP_GROUP_MatrixTileVector, IsVertical), \ |
948 | 6.61k | OpNum, IsVertical); \ |
949 | 6.61k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ |
950 | 6.61k | \ |
951 | 6.61k | const char *RegName = getRegisterName(MCOperand_getReg(RegOp), \ |
952 | 6.61k | AArch64_NoRegAltName); \ |
953 | 6.61k | \ |
954 | 6.61k | unsigned buf_len = strlen(RegName) + 1; \ |
955 | 6.61k | char *Base = cs_mem_calloc(1, buf_len); \ |
956 | 6.61k | memcpy(Base, RegName, buf_len); \ |
957 | 6.61k | char *Dot = strchr(Base, '.'); \ |
958 | 6.61k | if (!Dot) { \ |
959 | 0 | SStream_concat0(O, RegName); \ |
960 | 0 | return; \ |
961 | 0 | } \ |
962 | 6.61k | *Dot = '\0'; /* Split string */ \ |
963 | 6.61k | char *Suffix = Dot + 1; \ |
964 | 6.61k | SStream_concat(O, "%s%s", Base, (IsVertical ? "v" : "h")); \ |
965 | 6.61k | SStream_concat1(O, '.'); \ |
966 | 6.61k | SStream_concat0(O, Suffix); \ |
967 | 6.61k | cs_mem_free(Base); \ |
968 | 6.61k | } Line | Count | Source | 944 | 2.59k | { \ | 945 | 2.59k | AArch64_add_cs_detail_1( \ | 946 | 2.59k | MI, \ | 947 | 2.59k | CONCAT(AArch64_OP_GROUP_MatrixTileVector, IsVertical), \ | 948 | 2.59k | OpNum, IsVertical); \ | 949 | 2.59k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ | 950 | 2.59k | \ | 951 | 2.59k | const char *RegName = getRegisterName(MCOperand_getReg(RegOp), \ | 952 | 2.59k | AArch64_NoRegAltName); \ | 953 | 2.59k | \ | 954 | 2.59k | unsigned buf_len = strlen(RegName) + 1; \ | 955 | 2.59k | char *Base = cs_mem_calloc(1, buf_len); \ | 956 | 2.59k | memcpy(Base, RegName, buf_len); \ | 957 | 2.59k | char *Dot = strchr(Base, '.'); \ | 958 | 2.59k | if (!Dot) { \ | 959 | 0 | SStream_concat0(O, RegName); \ | 960 | 0 | return; \ | 961 | 0 | } \ | 962 | 2.59k | *Dot = '\0'; /* Split string */ \ | 963 | 2.59k | char *Suffix = Dot + 1; \ | 964 | 2.59k | SStream_concat(O, "%s%s", Base, (IsVertical ? "v" : "h")); \ | 965 | 2.59k | SStream_concat1(O, '.'); \ | 966 | 2.59k | SStream_concat0(O, Suffix); \ | 967 | 2.59k | cs_mem_free(Base); \ | 968 | 2.59k | } |
Line | Count | Source | 944 | 4.01k | { \ | 945 | 4.01k | AArch64_add_cs_detail_1( \ | 946 | 4.01k | MI, \ | 947 | 4.01k | CONCAT(AArch64_OP_GROUP_MatrixTileVector, IsVertical), \ | 948 | 4.01k | OpNum, IsVertical); \ | 949 | 4.01k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ | 950 | 4.01k | \ | 951 | 4.01k | const char *RegName = getRegisterName(MCOperand_getReg(RegOp), \ | 952 | 4.01k | AArch64_NoRegAltName); \ | 953 | 4.01k | \ | 954 | 4.01k | unsigned buf_len = strlen(RegName) + 1; \ | 955 | 4.01k | char *Base = cs_mem_calloc(1, buf_len); \ | 956 | 4.01k | memcpy(Base, RegName, buf_len); \ | 957 | 4.01k | char *Dot = strchr(Base, '.'); \ | 958 | 4.01k | if (!Dot) { \ | 959 | 0 | SStream_concat0(O, RegName); \ | 960 | 0 | return; \ | 961 | 0 | } \ | 962 | 4.01k | *Dot = '\0'; /* Split string */ \ | 963 | 4.01k | char *Suffix = Dot + 1; \ | 964 | 4.01k | SStream_concat(O, "%s%s", Base, (IsVertical ? "v" : "h")); \ | 965 | 4.01k | SStream_concat1(O, '.'); \ | 966 | 4.01k | SStream_concat0(O, Suffix); \ | 967 | 4.01k | cs_mem_free(Base); \ | 968 | 4.01k | } |
|
969 | | DEFINE_printMatrixTileVector(0); |
970 | | DEFINE_printMatrixTileVector(1); |
971 | | |
972 | | void printMatrixTile(MCInst *MI, unsigned OpNum, SStream *O) |
973 | 2.10k | { |
974 | 2.10k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_MatrixTile, OpNum); |
975 | 2.10k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); |
976 | | |
977 | 2.10k | printRegName(O, MCOperand_getReg(RegOp)); |
978 | 2.10k | } |
979 | | |
980 | | void printSVCROp(MCInst *MI, unsigned OpNum, SStream *O) |
981 | 0 | { |
982 | 0 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_SVCROp, OpNum); |
983 | 0 | MCOperand *MO = MCInst_getOperand(MI, (OpNum)); |
984 | |
|
985 | 0 | unsigned svcrop = MCOperand_getImm(MO); |
986 | 0 | const AArch64SVCR_SVCR *SVCR = AArch64SVCR_lookupSVCRByEncoding(svcrop); |
987 | |
|
988 | 0 | SStream_concat0(O, SVCR->Name); |
989 | 0 | } |
990 | | |
991 | | void printOperand(MCInst *MI, unsigned OpNo, SStream *O) |
992 | 403k | { |
993 | 403k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_Operand, OpNo); |
994 | 403k | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); |
995 | 403k | if (MCOperand_isReg(Op)) { |
996 | 338k | unsigned Reg = MCOperand_getReg(Op); |
997 | 338k | printRegName(O, Reg); |
998 | 338k | } else if (MCOperand_isImm(Op)) { |
999 | 65.4k | Op = MCInst_getOperand(MI, (OpNo)); |
1000 | 65.4k | SStream_concat(O, "%s", markup("<imm:")); |
1001 | 65.4k | printInt64Bang(O, MCOperand_getImm(Op)); |
1002 | 65.4k | SStream_concat0(O, markup(">")); |
1003 | 65.4k | } else { |
1004 | 0 | printUInt64Bang(O, MCInst_getOpVal(MI, OpNo)); |
1005 | 0 | } |
1006 | 403k | } |
1007 | | |
1008 | | void printImm(MCInst *MI, unsigned OpNo, SStream *O) |
1009 | 5.03k | { |
1010 | 5.03k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_Imm, OpNo); |
1011 | 5.03k | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); |
1012 | 5.03k | SStream_concat(O, "%s", markup("<imm:")); |
1013 | 5.03k | printInt64Bang(O, MCOperand_getImm(Op)); |
1014 | 5.03k | SStream_concat0(O, markup(">")); |
1015 | 5.03k | } |
1016 | | |
1017 | | void printImmHex(MCInst *MI, unsigned OpNo, SStream *O) |
1018 | 94 | { |
1019 | 94 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_ImmHex, OpNo); |
1020 | 94 | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); |
1021 | 94 | SStream_concat(O, "%s", markup("<imm:")); |
1022 | 94 | printInt64Bang(O, MCOperand_getImm(Op)); |
1023 | 94 | SStream_concat0(O, markup(">")); |
1024 | 94 | } |
1025 | | |
1026 | | #define DEFINE_printSImm(Size) \ |
1027 | | void CONCAT(printSImm, Size)(MCInst * MI, unsigned OpNo, SStream *O) \ |
1028 | 678 | { \ |
1029 | 678 | AArch64_add_cs_detail_1( \ |
1030 | 678 | MI, CONCAT(AArch64_OP_GROUP_SImm, Size), OpNo, Size); \ |
1031 | 678 | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); \ |
1032 | 678 | if (Size == 8) { \ |
1033 | 287 | SStream_concat(O, "%s", markup("<imm:")); \ |
1034 | 287 | printInt32Bang(O, MCOperand_getImm(Op)); \ |
1035 | 287 | SStream_concat0(O, markup(">")); \ |
1036 | 391 | } else if (Size == 16) { \ |
1037 | 391 | SStream_concat(O, "%s", markup("<imm:")); \ |
1038 | 391 | printInt32Bang(O, MCOperand_getImm(Op)); \ |
1039 | 391 | SStream_concat0(O, markup(">")); \ |
1040 | 391 | } else { \ |
1041 | 0 | SStream_concat(O, "%s", markup("<imm:")); \ |
1042 | 0 | printInt64Bang(O, MCOperand_getImm(Op)); \ |
1043 | 0 | SStream_concat0(O, markup(">")); \ |
1044 | 0 | } \ |
1045 | 678 | } Line | Count | Source | 1028 | 391 | { \ | 1029 | 391 | AArch64_add_cs_detail_1( \ | 1030 | 391 | MI, CONCAT(AArch64_OP_GROUP_SImm, Size), OpNo, Size); \ | 1031 | 391 | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); \ | 1032 | 391 | if (Size == 8) { \ | 1033 | 0 | SStream_concat(O, "%s", markup("<imm:")); \ | 1034 | 0 | printInt32Bang(O, MCOperand_getImm(Op)); \ | 1035 | 0 | SStream_concat0(O, markup(">")); \ | 1036 | 391 | } else if (Size == 16) { \ | 1037 | 391 | SStream_concat(O, "%s", markup("<imm:")); \ | 1038 | 391 | printInt32Bang(O, MCOperand_getImm(Op)); \ | 1039 | 391 | SStream_concat0(O, markup(">")); \ | 1040 | 391 | } else { \ | 1041 | 0 | SStream_concat(O, "%s", markup("<imm:")); \ | 1042 | 0 | printInt64Bang(O, MCOperand_getImm(Op)); \ | 1043 | 0 | SStream_concat0(O, markup(">")); \ | 1044 | 0 | } \ | 1045 | 391 | } |
Line | Count | Source | 1028 | 287 | { \ | 1029 | 287 | AArch64_add_cs_detail_1( \ | 1030 | 287 | MI, CONCAT(AArch64_OP_GROUP_SImm, Size), OpNo, Size); \ | 1031 | 287 | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); \ | 1032 | 287 | if (Size == 8) { \ | 1033 | 287 | SStream_concat(O, "%s", markup("<imm:")); \ | 1034 | 287 | printInt32Bang(O, MCOperand_getImm(Op)); \ | 1035 | 287 | SStream_concat0(O, markup(">")); \ | 1036 | 287 | } else if (Size == 16) { \ | 1037 | 0 | SStream_concat(O, "%s", markup("<imm:")); \ | 1038 | 0 | printInt32Bang(O, MCOperand_getImm(Op)); \ | 1039 | 0 | SStream_concat0(O, markup(">")); \ | 1040 | 0 | } else { \ | 1041 | 0 | SStream_concat(O, "%s", markup("<imm:")); \ | 1042 | 0 | printInt64Bang(O, MCOperand_getImm(Op)); \ | 1043 | 0 | SStream_concat0(O, markup(">")); \ | 1044 | 0 | } \ | 1045 | 287 | } |
|
1046 | | DEFINE_printSImm(16); |
1047 | | DEFINE_printSImm(8); |
1048 | | |
1049 | | void printPostIncOperand(MCInst *MI, unsigned OpNo, unsigned Imm, SStream *O) |
1050 | 10.5k | { |
1051 | 10.5k | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); |
1052 | 10.5k | if (MCOperand_isReg(Op)) { |
1053 | 10.5k | unsigned Reg = MCOperand_getReg(Op); |
1054 | 10.5k | if (Reg == AArch64_XZR) { |
1055 | 0 | SStream_concat(O, "%s", markup("<imm:")); |
1056 | 0 | printUInt64Bang(O, Imm); |
1057 | 0 | SStream_concat0(O, markup(">")); |
1058 | 0 | } else |
1059 | 10.5k | printRegName(O, Reg); |
1060 | 10.5k | } else |
1061 | 0 | CS_ASSERT_RET(0 && "unknown operand kind in printPostIncOperand64"); |
1062 | 10.5k | } |
1063 | | |
1064 | | void printVRegOperand(MCInst *MI, unsigned OpNo, SStream *O) |
1065 | 56.5k | { |
1066 | 56.5k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_VRegOperand, OpNo); |
1067 | 56.5k | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); |
1068 | | |
1069 | 56.5k | unsigned Reg = MCOperand_getReg(Op); |
1070 | 56.5k | printRegNameAlt(O, Reg, AArch64_vreg); |
1071 | 56.5k | } |
1072 | | |
1073 | | void printSysCROperand(MCInst *MI, unsigned OpNo, SStream *O) |
1074 | 15.3k | { |
1075 | 15.3k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_SysCROperand, OpNo); |
1076 | 15.3k | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); |
1077 | | |
1078 | 15.3k | SStream_concat(O, "%s", "c"); |
1079 | 15.3k | printUInt32(O, MCOperand_getImm(Op)); |
1080 | 15.3k | SStream_concat1(O, '\0'); |
1081 | 15.3k | } |
1082 | | |
1083 | | void printAddSubImm(MCInst *MI, unsigned OpNum, SStream *O) |
1084 | 4.39k | { |
1085 | 4.39k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_AddSubImm, OpNum); |
1086 | 4.39k | MCOperand *MO = MCInst_getOperand(MI, (OpNum)); |
1087 | 4.39k | if (MCOperand_isImm(MO)) { |
1088 | 4.39k | unsigned Val = (MCOperand_getImm(MO) & 0xfff); |
1089 | | |
1090 | 4.39k | unsigned Shift = AArch64_AM_getShiftValue( |
1091 | 4.39k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1)))); |
1092 | 4.39k | SStream_concat(O, "%s", markup("<imm:")); |
1093 | 4.39k | printUInt32Bang(O, (Val)); |
1094 | 4.39k | SStream_concat0(O, markup(">")); |
1095 | 4.39k | if (Shift != 0) { |
1096 | 2.69k | printShifter(MI, OpNum + 1, O); |
1097 | 2.69k | } |
1098 | 4.39k | } else { |
1099 | 0 | printShifter(MI, OpNum + 1, O); |
1100 | 0 | } |
1101 | 4.39k | } |
1102 | | |
1103 | | #define DEFINE_printLogicalImm(T) \ |
1104 | | void CONCAT(printLogicalImm, T)(MCInst * MI, unsigned OpNum, \ |
1105 | | SStream *O) \ |
1106 | 12.2k | { \ |
1107 | 12.2k | AArch64_add_cs_detail_1( \ |
1108 | 12.2k | MI, CONCAT(AArch64_OP_GROUP_LogicalImm, T), OpNum, sizeof(T)); \ |
1109 | 12.2k | uint64_t Val = \ |
1110 | 12.2k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ |
1111 | 12.2k | SStream_concat(O, "%s", markup("<imm:")); \ |
1112 | 12.2k | printUInt64Bang(O, (AArch64_AM_decodeLogicalImmediate( \ |
1113 | 12.2k | Val, 8 * sizeof(T)))); \ |
1114 | 12.2k | SStream_concat0(O, markup(">")); \ |
1115 | 12.2k | } Line | Count | Source | 1106 | 3.30k | { \ | 1107 | 3.30k | AArch64_add_cs_detail_1( \ | 1108 | 3.30k | MI, CONCAT(AArch64_OP_GROUP_LogicalImm, T), OpNum, sizeof(T)); \ | 1109 | 3.30k | uint64_t Val = \ | 1110 | 3.30k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1111 | 3.30k | SStream_concat(O, "%s", markup("<imm:")); \ | 1112 | 3.30k | printUInt64Bang(O, (AArch64_AM_decodeLogicalImmediate( \ | 1113 | 3.30k | Val, 8 * sizeof(T)))); \ | 1114 | 3.30k | SStream_concat0(O, markup(">")); \ | 1115 | 3.30k | } |
Line | Count | Source | 1106 | 3.82k | { \ | 1107 | 3.82k | AArch64_add_cs_detail_1( \ | 1108 | 3.82k | MI, CONCAT(AArch64_OP_GROUP_LogicalImm, T), OpNum, sizeof(T)); \ | 1109 | 3.82k | uint64_t Val = \ | 1110 | 3.82k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1111 | 3.82k | SStream_concat(O, "%s", markup("<imm:")); \ | 1112 | 3.82k | printUInt64Bang(O, (AArch64_AM_decodeLogicalImmediate( \ | 1113 | 3.82k | Val, 8 * sizeof(T)))); \ | 1114 | 3.82k | SStream_concat0(O, markup(">")); \ | 1115 | 3.82k | } |
Line | Count | Source | 1106 | 4.13k | { \ | 1107 | 4.13k | AArch64_add_cs_detail_1( \ | 1108 | 4.13k | MI, CONCAT(AArch64_OP_GROUP_LogicalImm, T), OpNum, sizeof(T)); \ | 1109 | 4.13k | uint64_t Val = \ | 1110 | 4.13k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1111 | 4.13k | SStream_concat(O, "%s", markup("<imm:")); \ | 1112 | 4.13k | printUInt64Bang(O, (AArch64_AM_decodeLogicalImmediate( \ | 1113 | 4.13k | Val, 8 * sizeof(T)))); \ | 1114 | 4.13k | SStream_concat0(O, markup(">")); \ | 1115 | 4.13k | } |
Line | Count | Source | 1106 | 937 | { \ | 1107 | 937 | AArch64_add_cs_detail_1( \ | 1108 | 937 | MI, CONCAT(AArch64_OP_GROUP_LogicalImm, T), OpNum, sizeof(T)); \ | 1109 | 937 | uint64_t Val = \ | 1110 | 937 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1111 | 937 | SStream_concat(O, "%s", markup("<imm:")); \ | 1112 | 937 | printUInt64Bang(O, (AArch64_AM_decodeLogicalImmediate( \ | 1113 | 937 | Val, 8 * sizeof(T)))); \ | 1114 | 937 | SStream_concat0(O, markup(">")); \ | 1115 | 937 | } |
|
1116 | | DEFINE_printLogicalImm(int64_t); |
1117 | | DEFINE_printLogicalImm(int32_t); |
1118 | | DEFINE_printLogicalImm(int8_t); |
1119 | | DEFINE_printLogicalImm(int16_t); |
1120 | | |
1121 | | void printShifter(MCInst *MI, unsigned OpNum, SStream *O) |
1122 | 12.8k | { |
1123 | 12.8k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_Shifter, OpNum); |
1124 | 12.8k | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
1125 | | // LSL #0 should not be printed. |
1126 | 12.8k | if (AArch64_AM_getShiftType(Val) == AArch64_AM_LSL && |
1127 | 12.8k | AArch64_AM_getShiftValue(Val) == 0) |
1128 | 835 | return; |
1129 | 12.0k | SStream_concat( |
1130 | 12.0k | O, "%s%s%s%s#%d", ", ", |
1131 | 12.0k | AArch64_AM_getShiftExtendName(AArch64_AM_getShiftType(Val)), |
1132 | 12.0k | " ", markup("<imm:"), AArch64_AM_getShiftValue(Val)); |
1133 | 12.0k | SStream_concat0(O, markup(">")); |
1134 | 12.0k | } |
1135 | | |
1136 | | void printShiftedRegister(MCInst *MI, unsigned OpNum, SStream *O) |
1137 | 6.99k | { |
1138 | 6.99k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_ShiftedRegister, OpNum); |
1139 | 6.99k | printRegName(O, MCOperand_getReg(MCInst_getOperand(MI, (OpNum)))); |
1140 | 6.99k | printShifter(MI, OpNum + 1, O); |
1141 | 6.99k | } |
1142 | | |
1143 | | void printExtendedRegister(MCInst *MI, unsigned OpNum, SStream *O) |
1144 | 2.00k | { |
1145 | 2.00k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_ExtendedRegister, OpNum); |
1146 | 2.00k | printRegName(O, MCOperand_getReg(MCInst_getOperand(MI, (OpNum)))); |
1147 | 2.00k | printArithExtend(MI, OpNum + 1, O); |
1148 | 2.00k | } |
1149 | | |
1150 | | void printArithExtend(MCInst *MI, unsigned OpNum, SStream *O) |
1151 | 3.08k | { |
1152 | 3.08k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_ArithExtend, OpNum); |
1153 | 3.08k | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
1154 | 3.08k | AArch64_AM_ShiftExtendType ExtType = AArch64_AM_getArithExtendType(Val); |
1155 | 3.08k | unsigned ShiftVal = AArch64_AM_getArithShiftValue(Val); |
1156 | | |
1157 | | // If the destination or first source register operand is [W]SP, print |
1158 | | // UXTW/UXTX as LSL, and if the shift amount is also zero, print nothing at |
1159 | | // all. |
1160 | 3.08k | if (ExtType == AArch64_AM_UXTW || ExtType == AArch64_AM_UXTX) { |
1161 | 1.33k | unsigned Dest = MCOperand_getReg(MCInst_getOperand(MI, (0))); |
1162 | 1.33k | unsigned Src1 = MCOperand_getReg(MCInst_getOperand(MI, (1))); |
1163 | 1.33k | if (((Dest == AArch64_SP || Src1 == AArch64_SP) && |
1164 | 1.33k | ExtType == AArch64_AM_UXTX) || |
1165 | 1.33k | ((Dest == AArch64_WSP || Src1 == AArch64_WSP) && |
1166 | 1.16k | ExtType == AArch64_AM_UXTW)) { |
1167 | 410 | if (ShiftVal != 0) { |
1168 | 410 | SStream_concat(O, "%s%s", ", lsl ", |
1169 | 410 | markup("<imm:")); |
1170 | 410 | printUInt32Bang(O, ShiftVal); |
1171 | 410 | SStream_concat0(O, markup(">")); |
1172 | 410 | } |
1173 | 410 | return; |
1174 | 410 | } |
1175 | 1.33k | } |
1176 | 2.67k | SStream_concat(O, "%s", ", "); |
1177 | 2.67k | SStream_concat0(O, AArch64_AM_getShiftExtendName(ExtType)); |
1178 | 2.67k | if (ShiftVal != 0) { |
1179 | 1.97k | SStream_concat(O, "%s%s#%d", " ", markup("<imm:"), ShiftVal); |
1180 | 1.97k | SStream_concat0(O, markup(">")); |
1181 | 1.97k | } |
1182 | 2.67k | } |
1183 | | |
1184 | | static void printMemExtendImpl(bool SignExtend, bool DoShift, unsigned Width, |
1185 | | char SrcRegKind, SStream *O, bool getUseMarkup) |
1186 | 16.4k | { |
1187 | | // sxtw, sxtx, uxtw or lsl (== uxtx) |
1188 | 16.4k | bool IsLSL = !SignExtend && SrcRegKind == 'x'; |
1189 | 16.4k | if (IsLSL) |
1190 | 5.86k | SStream_concat0(O, "lsl"); |
1191 | 10.6k | else { |
1192 | 10.6k | SStream_concat(O, "%c%s", (SignExtend ? 's' : 'u'), "xt"); |
1193 | 10.6k | SStream_concat1(O, SrcRegKind); |
1194 | 10.6k | } |
1195 | | |
1196 | 16.4k | if (DoShift || IsLSL) { |
1197 | 10.4k | SStream_concat0(O, " "); |
1198 | 10.4k | if (getUseMarkup) |
1199 | 0 | SStream_concat0(O, "<imm:"); |
1200 | 10.4k | unsigned ShiftAmount = DoShift ? Log2_32(Width / 8) : 0; |
1201 | 10.4k | SStream_concat(O, "%s%d", "#", ShiftAmount); |
1202 | 10.4k | if (getUseMarkup) |
1203 | 0 | SStream_concat0(O, ">"); |
1204 | 10.4k | } |
1205 | 16.4k | } |
1206 | | |
1207 | | void printMemExtend(MCInst *MI, unsigned OpNum, SStream *O, char SrcRegKind, |
1208 | | unsigned Width) |
1209 | 3.59k | { |
1210 | 3.59k | bool SignExtend = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
1211 | 3.59k | bool DoShift = MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); |
1212 | 3.59k | printMemExtendImpl(SignExtend, DoShift, Width, SrcRegKind, O, |
1213 | 3.59k | getUseMarkup()); |
1214 | 3.59k | } |
1215 | | |
1216 | | #define DEFINE_printRegWithShiftExtend(SignExtend, ExtWidth, SrcRegKind, \ |
1217 | | Suffix) \ |
1218 | | void CONCAT(printRegWithShiftExtend, \ |
1219 | | CONCAT(SignExtend, \ |
1220 | | CONCAT(ExtWidth, CONCAT(SrcRegKind, Suffix))))( \ |
1221 | | MCInst * MI, unsigned OpNum, SStream *O) \ |
1222 | 16.0k | { \ |
1223 | 16.0k | AArch64_add_cs_detail_4( \ |
1224 | 16.0k | MI, \ |
1225 | 16.0k | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ |
1226 | 16.0k | SignExtend), \ |
1227 | 16.0k | ExtWidth), \ |
1228 | 16.0k | SrcRegKind), \ |
1229 | 16.0k | Suffix), \ |
1230 | 16.0k | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ |
1231 | 16.0k | CHAR(Suffix)); \ |
1232 | 16.0k | printOperand(MI, OpNum, O); \ |
1233 | 16.0k | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ |
1234 | 9.96k | SStream_concat1(O, '.'); \ |
1235 | 9.96k | SStream_concat1(O, CHAR(Suffix)); \ |
1236 | 9.96k | SStream_concat1(O, '\0'); \ |
1237 | 9.96k | } else \ |
1238 | 16.0k | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ |
1239 | 16.0k | "Unsupported suffix size"); \ |
1240 | 16.0k | bool DoShift = ExtWidth != 8; \ |
1241 | 16.0k | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ |
1242 | 12.8k | SStream_concat0(O, ", "); \ |
1243 | 12.8k | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ |
1244 | 12.8k | CHAR(SrcRegKind), O, \ |
1245 | 12.8k | getUseMarkup()); \ |
1246 | 12.8k | } \ |
1247 | 16.0k | } printRegWithShiftExtend_0_8_x_d Line | Count | Source | 1222 | 907 | { \ | 1223 | 907 | AArch64_add_cs_detail_4( \ | 1224 | 907 | MI, \ | 1225 | 907 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 907 | SignExtend), \ | 1227 | 907 | ExtWidth), \ | 1228 | 907 | SrcRegKind), \ | 1229 | 907 | Suffix), \ | 1230 | 907 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 907 | CHAR(Suffix)); \ | 1232 | 907 | printOperand(MI, OpNum, O); \ | 1233 | 907 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 907 | SStream_concat1(O, '.'); \ | 1235 | 907 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 907 | SStream_concat1(O, '\0'); \ | 1237 | 907 | } else \ | 1238 | 907 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 907 | "Unsupported suffix size"); \ | 1240 | 907 | bool DoShift = ExtWidth != 8; \ | 1241 | 907 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 0 | SStream_concat0(O, ", "); \ | 1243 | 0 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 0 | CHAR(SrcRegKind), O, \ | 1245 | 0 | getUseMarkup()); \ | 1246 | 0 | } \ | 1247 | 907 | } |
printRegWithShiftExtend_1_8_w_d Line | Count | Source | 1222 | 1.51k | { \ | 1223 | 1.51k | AArch64_add_cs_detail_4( \ | 1224 | 1.51k | MI, \ | 1225 | 1.51k | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 1.51k | SignExtend), \ | 1227 | 1.51k | ExtWidth), \ | 1228 | 1.51k | SrcRegKind), \ | 1229 | 1.51k | Suffix), \ | 1230 | 1.51k | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 1.51k | CHAR(Suffix)); \ | 1232 | 1.51k | printOperand(MI, OpNum, O); \ | 1233 | 1.51k | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 1.51k | SStream_concat1(O, '.'); \ | 1235 | 1.51k | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 1.51k | SStream_concat1(O, '\0'); \ | 1237 | 1.51k | } else \ | 1238 | 1.51k | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 1.51k | "Unsupported suffix size"); \ | 1240 | 1.51k | bool DoShift = ExtWidth != 8; \ | 1241 | 1.51k | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 1.51k | SStream_concat0(O, ", "); \ | 1243 | 1.51k | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 1.51k | CHAR(SrcRegKind), O, \ | 1245 | 1.51k | getUseMarkup()); \ | 1246 | 1.51k | } \ | 1247 | 1.51k | } |
printRegWithShiftExtend_0_8_w_d Line | Count | Source | 1222 | 1.84k | { \ | 1223 | 1.84k | AArch64_add_cs_detail_4( \ | 1224 | 1.84k | MI, \ | 1225 | 1.84k | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 1.84k | SignExtend), \ | 1227 | 1.84k | ExtWidth), \ | 1228 | 1.84k | SrcRegKind), \ | 1229 | 1.84k | Suffix), \ | 1230 | 1.84k | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 1.84k | CHAR(Suffix)); \ | 1232 | 1.84k | printOperand(MI, OpNum, O); \ | 1233 | 1.84k | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 1.84k | SStream_concat1(O, '.'); \ | 1235 | 1.84k | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 1.84k | SStream_concat1(O, '\0'); \ | 1237 | 1.84k | } else \ | 1238 | 1.84k | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 1.84k | "Unsupported suffix size"); \ | 1240 | 1.84k | bool DoShift = ExtWidth != 8; \ | 1241 | 1.84k | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 1.84k | SStream_concat0(O, ", "); \ | 1243 | 1.84k | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 1.84k | CHAR(SrcRegKind), O, \ | 1245 | 1.84k | getUseMarkup()); \ | 1246 | 1.84k | } \ | 1247 | 1.84k | } |
printRegWithShiftExtend_0_8_x_0 Line | Count | Source | 1222 | 2.20k | { \ | 1223 | 2.20k | AArch64_add_cs_detail_4( \ | 1224 | 2.20k | MI, \ | 1225 | 2.20k | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 2.20k | SignExtend), \ | 1227 | 2.20k | ExtWidth), \ | 1228 | 2.20k | SrcRegKind), \ | 1229 | 2.20k | Suffix), \ | 1230 | 2.20k | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 2.20k | CHAR(Suffix)); \ | 1232 | 2.20k | printOperand(MI, OpNum, O); \ | 1233 | 2.20k | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 0 | SStream_concat1(O, '.'); \ | 1235 | 0 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 0 | SStream_concat1(O, '\0'); \ | 1237 | 0 | } else \ | 1238 | 2.20k | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 2.20k | "Unsupported suffix size"); \ | 1240 | 2.20k | bool DoShift = ExtWidth != 8; \ | 1241 | 2.20k | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 0 | SStream_concat0(O, ", "); \ | 1243 | 0 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 0 | CHAR(SrcRegKind), O, \ | 1245 | 0 | getUseMarkup()); \ | 1246 | 0 | } \ | 1247 | 2.20k | } |
printRegWithShiftExtend_1_8_w_s Line | Count | Source | 1222 | 644 | { \ | 1223 | 644 | AArch64_add_cs_detail_4( \ | 1224 | 644 | MI, \ | 1225 | 644 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 644 | SignExtend), \ | 1227 | 644 | ExtWidth), \ | 1228 | 644 | SrcRegKind), \ | 1229 | 644 | Suffix), \ | 1230 | 644 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 644 | CHAR(Suffix)); \ | 1232 | 644 | printOperand(MI, OpNum, O); \ | 1233 | 644 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 644 | SStream_concat1(O, '.'); \ | 1235 | 644 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 644 | SStream_concat1(O, '\0'); \ | 1237 | 644 | } else \ | 1238 | 644 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 644 | "Unsupported suffix size"); \ | 1240 | 644 | bool DoShift = ExtWidth != 8; \ | 1241 | 644 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 644 | SStream_concat0(O, ", "); \ | 1243 | 644 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 644 | CHAR(SrcRegKind), O, \ | 1245 | 644 | getUseMarkup()); \ | 1246 | 644 | } \ | 1247 | 644 | } |
printRegWithShiftExtend_0_8_w_s Line | Count | Source | 1222 | 560 | { \ | 1223 | 560 | AArch64_add_cs_detail_4( \ | 1224 | 560 | MI, \ | 1225 | 560 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 560 | SignExtend), \ | 1227 | 560 | ExtWidth), \ | 1228 | 560 | SrcRegKind), \ | 1229 | 560 | Suffix), \ | 1230 | 560 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 560 | CHAR(Suffix)); \ | 1232 | 560 | printOperand(MI, OpNum, O); \ | 1233 | 560 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 560 | SStream_concat1(O, '.'); \ | 1235 | 560 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 560 | SStream_concat1(O, '\0'); \ | 1237 | 560 | } else \ | 1238 | 560 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 560 | "Unsupported suffix size"); \ | 1240 | 560 | bool DoShift = ExtWidth != 8; \ | 1241 | 560 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 560 | SStream_concat0(O, ", "); \ | 1243 | 560 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 560 | CHAR(SrcRegKind), O, \ | 1245 | 560 | getUseMarkup()); \ | 1246 | 560 | } \ | 1247 | 560 | } |
printRegWithShiftExtend_0_64_x_d Line | Count | Source | 1222 | 192 | { \ | 1223 | 192 | AArch64_add_cs_detail_4( \ | 1224 | 192 | MI, \ | 1225 | 192 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 192 | SignExtend), \ | 1227 | 192 | ExtWidth), \ | 1228 | 192 | SrcRegKind), \ | 1229 | 192 | Suffix), \ | 1230 | 192 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 192 | CHAR(Suffix)); \ | 1232 | 192 | printOperand(MI, OpNum, O); \ | 1233 | 192 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 192 | SStream_concat1(O, '.'); \ | 1235 | 192 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 192 | SStream_concat1(O, '\0'); \ | 1237 | 192 | } else \ | 1238 | 192 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 192 | "Unsupported suffix size"); \ | 1240 | 192 | bool DoShift = ExtWidth != 8; \ | 1241 | 192 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 192 | SStream_concat0(O, ", "); \ | 1243 | 192 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 192 | CHAR(SrcRegKind), O, \ | 1245 | 192 | getUseMarkup()); \ | 1246 | 192 | } \ | 1247 | 192 | } |
printRegWithShiftExtend_1_64_w_d Line | Count | Source | 1222 | 272 | { \ | 1223 | 272 | AArch64_add_cs_detail_4( \ | 1224 | 272 | MI, \ | 1225 | 272 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 272 | SignExtend), \ | 1227 | 272 | ExtWidth), \ | 1228 | 272 | SrcRegKind), \ | 1229 | 272 | Suffix), \ | 1230 | 272 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 272 | CHAR(Suffix)); \ | 1232 | 272 | printOperand(MI, OpNum, O); \ | 1233 | 272 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 272 | SStream_concat1(O, '.'); \ | 1235 | 272 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 272 | SStream_concat1(O, '\0'); \ | 1237 | 272 | } else \ | 1238 | 272 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 272 | "Unsupported suffix size"); \ | 1240 | 272 | bool DoShift = ExtWidth != 8; \ | 1241 | 272 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 272 | SStream_concat0(O, ", "); \ | 1243 | 272 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 272 | CHAR(SrcRegKind), O, \ | 1245 | 272 | getUseMarkup()); \ | 1246 | 272 | } \ | 1247 | 272 | } |
printRegWithShiftExtend_0_64_w_d Line | Count | Source | 1222 | 502 | { \ | 1223 | 502 | AArch64_add_cs_detail_4( \ | 1224 | 502 | MI, \ | 1225 | 502 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 502 | SignExtend), \ | 1227 | 502 | ExtWidth), \ | 1228 | 502 | SrcRegKind), \ | 1229 | 502 | Suffix), \ | 1230 | 502 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 502 | CHAR(Suffix)); \ | 1232 | 502 | printOperand(MI, OpNum, O); \ | 1233 | 502 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 502 | SStream_concat1(O, '.'); \ | 1235 | 502 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 502 | SStream_concat1(O, '\0'); \ | 1237 | 502 | } else \ | 1238 | 502 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 502 | "Unsupported suffix size"); \ | 1240 | 502 | bool DoShift = ExtWidth != 8; \ | 1241 | 502 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 502 | SStream_concat0(O, ", "); \ | 1243 | 502 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 502 | CHAR(SrcRegKind), O, \ | 1245 | 502 | getUseMarkup()); \ | 1246 | 502 | } \ | 1247 | 502 | } |
printRegWithShiftExtend_0_64_x_0 Line | Count | Source | 1222 | 1.55k | { \ | 1223 | 1.55k | AArch64_add_cs_detail_4( \ | 1224 | 1.55k | MI, \ | 1225 | 1.55k | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 1.55k | SignExtend), \ | 1227 | 1.55k | ExtWidth), \ | 1228 | 1.55k | SrcRegKind), \ | 1229 | 1.55k | Suffix), \ | 1230 | 1.55k | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 1.55k | CHAR(Suffix)); \ | 1232 | 1.55k | printOperand(MI, OpNum, O); \ | 1233 | 1.55k | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 0 | SStream_concat1(O, '.'); \ | 1235 | 0 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 0 | SStream_concat1(O, '\0'); \ | 1237 | 0 | } else \ | 1238 | 1.55k | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 1.55k | "Unsupported suffix size"); \ | 1240 | 1.55k | bool DoShift = ExtWidth != 8; \ | 1241 | 1.55k | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 1.55k | SStream_concat0(O, ", "); \ | 1243 | 1.55k | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 1.55k | CHAR(SrcRegKind), O, \ | 1245 | 1.55k | getUseMarkup()); \ | 1246 | 1.55k | } \ | 1247 | 1.55k | } |
printRegWithShiftExtend_1_64_w_s Line | Count | Source | 1222 | 205 | { \ | 1223 | 205 | AArch64_add_cs_detail_4( \ | 1224 | 205 | MI, \ | 1225 | 205 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 205 | SignExtend), \ | 1227 | 205 | ExtWidth), \ | 1228 | 205 | SrcRegKind), \ | 1229 | 205 | Suffix), \ | 1230 | 205 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 205 | CHAR(Suffix)); \ | 1232 | 205 | printOperand(MI, OpNum, O); \ | 1233 | 205 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 205 | SStream_concat1(O, '.'); \ | 1235 | 205 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 205 | SStream_concat1(O, '\0'); \ | 1237 | 205 | } else \ | 1238 | 205 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 205 | "Unsupported suffix size"); \ | 1240 | 205 | bool DoShift = ExtWidth != 8; \ | 1241 | 205 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 205 | SStream_concat0(O, ", "); \ | 1243 | 205 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 205 | CHAR(SrcRegKind), O, \ | 1245 | 205 | getUseMarkup()); \ | 1246 | 205 | } \ | 1247 | 205 | } |
printRegWithShiftExtend_0_64_w_s Line | Count | Source | 1222 | 26 | { \ | 1223 | 26 | AArch64_add_cs_detail_4( \ | 1224 | 26 | MI, \ | 1225 | 26 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 26 | SignExtend), \ | 1227 | 26 | ExtWidth), \ | 1228 | 26 | SrcRegKind), \ | 1229 | 26 | Suffix), \ | 1230 | 26 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 26 | CHAR(Suffix)); \ | 1232 | 26 | printOperand(MI, OpNum, O); \ | 1233 | 26 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 26 | SStream_concat1(O, '.'); \ | 1235 | 26 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 26 | SStream_concat1(O, '\0'); \ | 1237 | 26 | } else \ | 1238 | 26 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 26 | "Unsupported suffix size"); \ | 1240 | 26 | bool DoShift = ExtWidth != 8; \ | 1241 | 26 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 26 | SStream_concat0(O, ", "); \ | 1243 | 26 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 26 | CHAR(SrcRegKind), O, \ | 1245 | 26 | getUseMarkup()); \ | 1246 | 26 | } \ | 1247 | 26 | } |
printRegWithShiftExtend_0_16_x_d Line | Count | Source | 1222 | 262 | { \ | 1223 | 262 | AArch64_add_cs_detail_4( \ | 1224 | 262 | MI, \ | 1225 | 262 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 262 | SignExtend), \ | 1227 | 262 | ExtWidth), \ | 1228 | 262 | SrcRegKind), \ | 1229 | 262 | Suffix), \ | 1230 | 262 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 262 | CHAR(Suffix)); \ | 1232 | 262 | printOperand(MI, OpNum, O); \ | 1233 | 262 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 262 | SStream_concat1(O, '.'); \ | 1235 | 262 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 262 | SStream_concat1(O, '\0'); \ | 1237 | 262 | } else \ | 1238 | 262 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 262 | "Unsupported suffix size"); \ | 1240 | 262 | bool DoShift = ExtWidth != 8; \ | 1241 | 262 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 262 | SStream_concat0(O, ", "); \ | 1243 | 262 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 262 | CHAR(SrcRegKind), O, \ | 1245 | 262 | getUseMarkup()); \ | 1246 | 262 | } \ | 1247 | 262 | } |
printRegWithShiftExtend_1_16_w_d Line | Count | Source | 1222 | 555 | { \ | 1223 | 555 | AArch64_add_cs_detail_4( \ | 1224 | 555 | MI, \ | 1225 | 555 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 555 | SignExtend), \ | 1227 | 555 | ExtWidth), \ | 1228 | 555 | SrcRegKind), \ | 1229 | 555 | Suffix), \ | 1230 | 555 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 555 | CHAR(Suffix)); \ | 1232 | 555 | printOperand(MI, OpNum, O); \ | 1233 | 555 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 555 | SStream_concat1(O, '.'); \ | 1235 | 555 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 555 | SStream_concat1(O, '\0'); \ | 1237 | 555 | } else \ | 1238 | 555 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 555 | "Unsupported suffix size"); \ | 1240 | 555 | bool DoShift = ExtWidth != 8; \ | 1241 | 555 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 555 | SStream_concat0(O, ", "); \ | 1243 | 555 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 555 | CHAR(SrcRegKind), O, \ | 1245 | 555 | getUseMarkup()); \ | 1246 | 555 | } \ | 1247 | 555 | } |
printRegWithShiftExtend_0_16_w_d Line | Count | Source | 1222 | 231 | { \ | 1223 | 231 | AArch64_add_cs_detail_4( \ | 1224 | 231 | MI, \ | 1225 | 231 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 231 | SignExtend), \ | 1227 | 231 | ExtWidth), \ | 1228 | 231 | SrcRegKind), \ | 1229 | 231 | Suffix), \ | 1230 | 231 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 231 | CHAR(Suffix)); \ | 1232 | 231 | printOperand(MI, OpNum, O); \ | 1233 | 231 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 231 | SStream_concat1(O, '.'); \ | 1235 | 231 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 231 | SStream_concat1(O, '\0'); \ | 1237 | 231 | } else \ | 1238 | 231 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 231 | "Unsupported suffix size"); \ | 1240 | 231 | bool DoShift = ExtWidth != 8; \ | 1241 | 231 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 231 | SStream_concat0(O, ", "); \ | 1243 | 231 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 231 | CHAR(SrcRegKind), O, \ | 1245 | 231 | getUseMarkup()); \ | 1246 | 231 | } \ | 1247 | 231 | } |
printRegWithShiftExtend_0_16_x_0 Line | Count | Source | 1222 | 947 | { \ | 1223 | 947 | AArch64_add_cs_detail_4( \ | 1224 | 947 | MI, \ | 1225 | 947 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 947 | SignExtend), \ | 1227 | 947 | ExtWidth), \ | 1228 | 947 | SrcRegKind), \ | 1229 | 947 | Suffix), \ | 1230 | 947 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 947 | CHAR(Suffix)); \ | 1232 | 947 | printOperand(MI, OpNum, O); \ | 1233 | 947 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 0 | SStream_concat1(O, '.'); \ | 1235 | 0 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 0 | SStream_concat1(O, '\0'); \ | 1237 | 0 | } else \ | 1238 | 947 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 947 | "Unsupported suffix size"); \ | 1240 | 947 | bool DoShift = ExtWidth != 8; \ | 1241 | 947 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 947 | SStream_concat0(O, ", "); \ | 1243 | 947 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 947 | CHAR(SrcRegKind), O, \ | 1245 | 947 | getUseMarkup()); \ | 1246 | 947 | } \ | 1247 | 947 | } |
printRegWithShiftExtend_1_16_w_s Line | Count | Source | 1222 | 134 | { \ | 1223 | 134 | AArch64_add_cs_detail_4( \ | 1224 | 134 | MI, \ | 1225 | 134 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 134 | SignExtend), \ | 1227 | 134 | ExtWidth), \ | 1228 | 134 | SrcRegKind), \ | 1229 | 134 | Suffix), \ | 1230 | 134 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 134 | CHAR(Suffix)); \ | 1232 | 134 | printOperand(MI, OpNum, O); \ | 1233 | 134 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 134 | SStream_concat1(O, '.'); \ | 1235 | 134 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 134 | SStream_concat1(O, '\0'); \ | 1237 | 134 | } else \ | 1238 | 134 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 134 | "Unsupported suffix size"); \ | 1240 | 134 | bool DoShift = ExtWidth != 8; \ | 1241 | 134 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 134 | SStream_concat0(O, ", "); \ | 1243 | 134 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 134 | CHAR(SrcRegKind), O, \ | 1245 | 134 | getUseMarkup()); \ | 1246 | 134 | } \ | 1247 | 134 | } |
printRegWithShiftExtend_0_16_w_s Line | Count | Source | 1222 | 183 | { \ | 1223 | 183 | AArch64_add_cs_detail_4( \ | 1224 | 183 | MI, \ | 1225 | 183 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 183 | SignExtend), \ | 1227 | 183 | ExtWidth), \ | 1228 | 183 | SrcRegKind), \ | 1229 | 183 | Suffix), \ | 1230 | 183 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 183 | CHAR(Suffix)); \ | 1232 | 183 | printOperand(MI, OpNum, O); \ | 1233 | 183 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 183 | SStream_concat1(O, '.'); \ | 1235 | 183 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 183 | SStream_concat1(O, '\0'); \ | 1237 | 183 | } else \ | 1238 | 183 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 183 | "Unsupported suffix size"); \ | 1240 | 183 | bool DoShift = ExtWidth != 8; \ | 1241 | 183 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 183 | SStream_concat0(O, ", "); \ | 1243 | 183 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 183 | CHAR(SrcRegKind), O, \ | 1245 | 183 | getUseMarkup()); \ | 1246 | 183 | } \ | 1247 | 183 | } |
printRegWithShiftExtend_0_32_x_d Line | Count | Source | 1222 | 482 | { \ | 1223 | 482 | AArch64_add_cs_detail_4( \ | 1224 | 482 | MI, \ | 1225 | 482 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 482 | SignExtend), \ | 1227 | 482 | ExtWidth), \ | 1228 | 482 | SrcRegKind), \ | 1229 | 482 | Suffix), \ | 1230 | 482 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 482 | CHAR(Suffix)); \ | 1232 | 482 | printOperand(MI, OpNum, O); \ | 1233 | 482 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 482 | SStream_concat1(O, '.'); \ | 1235 | 482 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 482 | SStream_concat1(O, '\0'); \ | 1237 | 482 | } else \ | 1238 | 482 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 482 | "Unsupported suffix size"); \ | 1240 | 482 | bool DoShift = ExtWidth != 8; \ | 1241 | 482 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 482 | SStream_concat0(O, ", "); \ | 1243 | 482 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 482 | CHAR(SrcRegKind), O, \ | 1245 | 482 | getUseMarkup()); \ | 1246 | 482 | } \ | 1247 | 482 | } |
printRegWithShiftExtend_1_32_w_d Line | Count | Source | 1222 | 572 | { \ | 1223 | 572 | AArch64_add_cs_detail_4( \ | 1224 | 572 | MI, \ | 1225 | 572 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 572 | SignExtend), \ | 1227 | 572 | ExtWidth), \ | 1228 | 572 | SrcRegKind), \ | 1229 | 572 | Suffix), \ | 1230 | 572 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 572 | CHAR(Suffix)); \ | 1232 | 572 | printOperand(MI, OpNum, O); \ | 1233 | 572 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 572 | SStream_concat1(O, '.'); \ | 1235 | 572 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 572 | SStream_concat1(O, '\0'); \ | 1237 | 572 | } else \ | 1238 | 572 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 572 | "Unsupported suffix size"); \ | 1240 | 572 | bool DoShift = ExtWidth != 8; \ | 1241 | 572 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 572 | SStream_concat0(O, ", "); \ | 1243 | 572 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 572 | CHAR(SrcRegKind), O, \ | 1245 | 572 | getUseMarkup()); \ | 1246 | 572 | } \ | 1247 | 572 | } |
printRegWithShiftExtend_0_32_w_d Line | Count | Source | 1222 | 400 | { \ | 1223 | 400 | AArch64_add_cs_detail_4( \ | 1224 | 400 | MI, \ | 1225 | 400 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 400 | SignExtend), \ | 1227 | 400 | ExtWidth), \ | 1228 | 400 | SrcRegKind), \ | 1229 | 400 | Suffix), \ | 1230 | 400 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 400 | CHAR(Suffix)); \ | 1232 | 400 | printOperand(MI, OpNum, O); \ | 1233 | 400 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 400 | SStream_concat1(O, '.'); \ | 1235 | 400 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 400 | SStream_concat1(O, '\0'); \ | 1237 | 400 | } else \ | 1238 | 400 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 400 | "Unsupported suffix size"); \ | 1240 | 400 | bool DoShift = ExtWidth != 8; \ | 1241 | 400 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 400 | SStream_concat0(O, ", "); \ | 1243 | 400 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 400 | CHAR(SrcRegKind), O, \ | 1245 | 400 | getUseMarkup()); \ | 1246 | 400 | } \ | 1247 | 400 | } |
printRegWithShiftExtend_0_32_x_0 Line | Count | Source | 1222 | 932 | { \ | 1223 | 932 | AArch64_add_cs_detail_4( \ | 1224 | 932 | MI, \ | 1225 | 932 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 932 | SignExtend), \ | 1227 | 932 | ExtWidth), \ | 1228 | 932 | SrcRegKind), \ | 1229 | 932 | Suffix), \ | 1230 | 932 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 932 | CHAR(Suffix)); \ | 1232 | 932 | printOperand(MI, OpNum, O); \ | 1233 | 932 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 0 | SStream_concat1(O, '.'); \ | 1235 | 0 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 0 | SStream_concat1(O, '\0'); \ | 1237 | 0 | } else \ | 1238 | 932 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 932 | "Unsupported suffix size"); \ | 1240 | 932 | bool DoShift = ExtWidth != 8; \ | 1241 | 932 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 932 | SStream_concat0(O, ", "); \ | 1243 | 932 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 932 | CHAR(SrcRegKind), O, \ | 1245 | 932 | getUseMarkup()); \ | 1246 | 932 | } \ | 1247 | 932 | } |
printRegWithShiftExtend_1_32_w_s Line | Count | Source | 1222 | 112 | { \ | 1223 | 112 | AArch64_add_cs_detail_4( \ | 1224 | 112 | MI, \ | 1225 | 112 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 112 | SignExtend), \ | 1227 | 112 | ExtWidth), \ | 1228 | 112 | SrcRegKind), \ | 1229 | 112 | Suffix), \ | 1230 | 112 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 112 | CHAR(Suffix)); \ | 1232 | 112 | printOperand(MI, OpNum, O); \ | 1233 | 112 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 112 | SStream_concat1(O, '.'); \ | 1235 | 112 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 112 | SStream_concat1(O, '\0'); \ | 1237 | 112 | } else \ | 1238 | 112 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 112 | "Unsupported suffix size"); \ | 1240 | 112 | bool DoShift = ExtWidth != 8; \ | 1241 | 112 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 112 | SStream_concat0(O, ", "); \ | 1243 | 112 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 112 | CHAR(SrcRegKind), O, \ | 1245 | 112 | getUseMarkup()); \ | 1246 | 112 | } \ | 1247 | 112 | } |
printRegWithShiftExtend_0_32_w_s Line | Count | Source | 1222 | 93 | { \ | 1223 | 93 | AArch64_add_cs_detail_4( \ | 1224 | 93 | MI, \ | 1225 | 93 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 93 | SignExtend), \ | 1227 | 93 | ExtWidth), \ | 1228 | 93 | SrcRegKind), \ | 1229 | 93 | Suffix), \ | 1230 | 93 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 93 | CHAR(Suffix)); \ | 1232 | 93 | printOperand(MI, OpNum, O); \ | 1233 | 93 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 93 | SStream_concat1(O, '.'); \ | 1235 | 93 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 93 | SStream_concat1(O, '\0'); \ | 1237 | 93 | } else \ | 1238 | 93 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 93 | "Unsupported suffix size"); \ | 1240 | 93 | bool DoShift = ExtWidth != 8; \ | 1241 | 93 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 93 | SStream_concat0(O, ", "); \ | 1243 | 93 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 93 | CHAR(SrcRegKind), O, \ | 1245 | 93 | getUseMarkup()); \ | 1246 | 93 | } \ | 1247 | 93 | } |
printRegWithShiftExtend_0_8_x_s Line | Count | Source | 1222 | 24 | { \ | 1223 | 24 | AArch64_add_cs_detail_4( \ | 1224 | 24 | MI, \ | 1225 | 24 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 24 | SignExtend), \ | 1227 | 24 | ExtWidth), \ | 1228 | 24 | SrcRegKind), \ | 1229 | 24 | Suffix), \ | 1230 | 24 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 24 | CHAR(Suffix)); \ | 1232 | 24 | printOperand(MI, OpNum, O); \ | 1233 | 24 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 24 | SStream_concat1(O, '.'); \ | 1235 | 24 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 24 | SStream_concat1(O, '\0'); \ | 1237 | 24 | } else \ | 1238 | 24 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 24 | "Unsupported suffix size"); \ | 1240 | 24 | bool DoShift = ExtWidth != 8; \ | 1241 | 24 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 0 | SStream_concat0(O, ", "); \ | 1243 | 0 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 0 | CHAR(SrcRegKind), O, \ | 1245 | 0 | getUseMarkup()); \ | 1246 | 0 | } \ | 1247 | 24 | } |
printRegWithShiftExtend_0_16_x_s Line | Count | Source | 1222 | 25 | { \ | 1223 | 25 | AArch64_add_cs_detail_4( \ | 1224 | 25 | MI, \ | 1225 | 25 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 25 | SignExtend), \ | 1227 | 25 | ExtWidth), \ | 1228 | 25 | SrcRegKind), \ | 1229 | 25 | Suffix), \ | 1230 | 25 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 25 | CHAR(Suffix)); \ | 1232 | 25 | printOperand(MI, OpNum, O); \ | 1233 | 25 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 25 | SStream_concat1(O, '.'); \ | 1235 | 25 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 25 | SStream_concat1(O, '\0'); \ | 1237 | 25 | } else \ | 1238 | 25 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 25 | "Unsupported suffix size"); \ | 1240 | 25 | bool DoShift = ExtWidth != 8; \ | 1241 | 25 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 25 | SStream_concat0(O, ", "); \ | 1243 | 25 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 25 | CHAR(SrcRegKind), O, \ | 1245 | 25 | getUseMarkup()); \ | 1246 | 25 | } \ | 1247 | 25 | } |
printRegWithShiftExtend_0_32_x_s Line | Count | Source | 1222 | 184 | { \ | 1223 | 184 | AArch64_add_cs_detail_4( \ | 1224 | 184 | MI, \ | 1225 | 184 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 184 | SignExtend), \ | 1227 | 184 | ExtWidth), \ | 1228 | 184 | SrcRegKind), \ | 1229 | 184 | Suffix), \ | 1230 | 184 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 184 | CHAR(Suffix)); \ | 1232 | 184 | printOperand(MI, OpNum, O); \ | 1233 | 184 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 184 | SStream_concat1(O, '.'); \ | 1235 | 184 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 184 | SStream_concat1(O, '\0'); \ | 1237 | 184 | } else \ | 1238 | 184 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 184 | "Unsupported suffix size"); \ | 1240 | 184 | bool DoShift = ExtWidth != 8; \ | 1241 | 184 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 184 | SStream_concat0(O, ", "); \ | 1243 | 184 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 184 | CHAR(SrcRegKind), O, \ | 1245 | 184 | getUseMarkup()); \ | 1246 | 184 | } \ | 1247 | 184 | } |
printRegWithShiftExtend_0_64_x_s Line | Count | Source | 1222 | 41 | { \ | 1223 | 41 | AArch64_add_cs_detail_4( \ | 1224 | 41 | MI, \ | 1225 | 41 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 41 | SignExtend), \ | 1227 | 41 | ExtWidth), \ | 1228 | 41 | SrcRegKind), \ | 1229 | 41 | Suffix), \ | 1230 | 41 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 41 | CHAR(Suffix)); \ | 1232 | 41 | printOperand(MI, OpNum, O); \ | 1233 | 41 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 41 | SStream_concat1(O, '.'); \ | 1235 | 41 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 41 | SStream_concat1(O, '\0'); \ | 1237 | 41 | } else \ | 1238 | 41 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 41 | "Unsupported suffix size"); \ | 1240 | 41 | bool DoShift = ExtWidth != 8; \ | 1241 | 41 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 41 | SStream_concat0(O, ", "); \ | 1243 | 41 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 41 | CHAR(SrcRegKind), O, \ | 1245 | 41 | getUseMarkup()); \ | 1246 | 41 | } \ | 1247 | 41 | } |
printRegWithShiftExtend_0_128_x_0 Line | Count | Source | 1222 | 402 | { \ | 1223 | 402 | AArch64_add_cs_detail_4( \ | 1224 | 402 | MI, \ | 1225 | 402 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 402 | SignExtend), \ | 1227 | 402 | ExtWidth), \ | 1228 | 402 | SrcRegKind), \ | 1229 | 402 | Suffix), \ | 1230 | 402 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 402 | CHAR(Suffix)); \ | 1232 | 402 | printOperand(MI, OpNum, O); \ | 1233 | 402 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 0 | SStream_concat1(O, '.'); \ | 1235 | 0 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 0 | SStream_concat1(O, '\0'); \ | 1237 | 0 | } else \ | 1238 | 402 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 402 | "Unsupported suffix size"); \ | 1240 | 402 | bool DoShift = ExtWidth != 8; \ | 1241 | 402 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 402 | SStream_concat0(O, ", "); \ | 1243 | 402 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 402 | CHAR(SrcRegKind), O, \ | 1245 | 402 | getUseMarkup()); \ | 1246 | 402 | } \ | 1247 | 402 | } |
|
1248 | | DEFINE_printRegWithShiftExtend(false, 8, x, d); |
1249 | | DEFINE_printRegWithShiftExtend(true, 8, w, d); |
1250 | | DEFINE_printRegWithShiftExtend(false, 8, w, d); |
1251 | | DEFINE_printRegWithShiftExtend(false, 8, x, 0); |
1252 | | DEFINE_printRegWithShiftExtend(true, 8, w, s); |
1253 | | DEFINE_printRegWithShiftExtend(false, 8, w, s); |
1254 | | DEFINE_printRegWithShiftExtend(false, 64, x, d); |
1255 | | DEFINE_printRegWithShiftExtend(true, 64, w, d); |
1256 | | DEFINE_printRegWithShiftExtend(false, 64, w, d); |
1257 | | DEFINE_printRegWithShiftExtend(false, 64, x, 0); |
1258 | | DEFINE_printRegWithShiftExtend(true, 64, w, s); |
1259 | | DEFINE_printRegWithShiftExtend(false, 64, w, s); |
1260 | | DEFINE_printRegWithShiftExtend(false, 16, x, d); |
1261 | | DEFINE_printRegWithShiftExtend(true, 16, w, d); |
1262 | | DEFINE_printRegWithShiftExtend(false, 16, w, d); |
1263 | | DEFINE_printRegWithShiftExtend(false, 16, x, 0); |
1264 | | DEFINE_printRegWithShiftExtend(true, 16, w, s); |
1265 | | DEFINE_printRegWithShiftExtend(false, 16, w, s); |
1266 | | DEFINE_printRegWithShiftExtend(false, 32, x, d); |
1267 | | DEFINE_printRegWithShiftExtend(true, 32, w, d); |
1268 | | DEFINE_printRegWithShiftExtend(false, 32, w, d); |
1269 | | DEFINE_printRegWithShiftExtend(false, 32, x, 0); |
1270 | | DEFINE_printRegWithShiftExtend(true, 32, w, s); |
1271 | | DEFINE_printRegWithShiftExtend(false, 32, w, s); |
1272 | | DEFINE_printRegWithShiftExtend(false, 8, x, s); |
1273 | | DEFINE_printRegWithShiftExtend(false, 16, x, s); |
1274 | | DEFINE_printRegWithShiftExtend(false, 32, x, s); |
1275 | | DEFINE_printRegWithShiftExtend(false, 64, x, s); |
1276 | | DEFINE_printRegWithShiftExtend(false, 128, x, 0); |
1277 | | |
1278 | | #define DEFINE_printPredicateAsCounter(EltSize) \ |
1279 | | void CONCAT(printPredicateAsCounter, \ |
1280 | | EltSize)(MCInst * MI, unsigned OpNum, SStream *O) \ |
1281 | 5.79k | { \ |
1282 | 5.79k | AArch64_add_cs_detail_1( \ |
1283 | 5.79k | MI, \ |
1284 | 5.79k | CONCAT(AArch64_OP_GROUP_PredicateAsCounter, EltSize), \ |
1285 | 5.79k | OpNum, EltSize); \ |
1286 | 5.79k | unsigned Reg = \ |
1287 | 5.79k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ |
1288 | 5.79k | if (Reg < AArch64_PN0 || Reg > AArch64_PN15) \ |
1289 | 5.79k | CS_ASSERT_RET(0 && \ |
1290 | 5.79k | "Unsupported predicate-as-counter register"); \ |
1291 | 5.79k | SStream_concat(O, "%s", "pn"); \ |
1292 | 5.79k | printUInt32(O, (Reg - AArch64_PN0)); \ |
1293 | 5.79k | switch (EltSize) { \ |
1294 | 4.16k | case 0: \ |
1295 | 4.16k | break; \ |
1296 | 507 | case 8: \ |
1297 | 507 | SStream_concat0(O, ".b"); \ |
1298 | 507 | break; \ |
1299 | 73 | case 16: \ |
1300 | 73 | SStream_concat0(O, ".h"); \ |
1301 | 73 | break; \ |
1302 | 105 | case 32: \ |
1303 | 105 | SStream_concat0(O, ".s"); \ |
1304 | 105 | break; \ |
1305 | 945 | case 64: \ |
1306 | 945 | SStream_concat0(O, ".d"); \ |
1307 | 945 | break; \ |
1308 | 0 | default: \ |
1309 | 0 | CS_ASSERT_RET(0 && "Unsupported element size"); \ |
1310 | 5.79k | } \ |
1311 | 5.79k | } printPredicateAsCounter_8 Line | Count | Source | 1281 | 507 | { \ | 1282 | 507 | AArch64_add_cs_detail_1( \ | 1283 | 507 | MI, \ | 1284 | 507 | CONCAT(AArch64_OP_GROUP_PredicateAsCounter, EltSize), \ | 1285 | 507 | OpNum, EltSize); \ | 1286 | 507 | unsigned Reg = \ | 1287 | 507 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 1288 | 507 | if (Reg < AArch64_PN0 || Reg > AArch64_PN15) \ | 1289 | 507 | CS_ASSERT_RET(0 && \ | 1290 | 507 | "Unsupported predicate-as-counter register"); \ | 1291 | 507 | SStream_concat(O, "%s", "pn"); \ | 1292 | 507 | printUInt32(O, (Reg - AArch64_PN0)); \ | 1293 | 507 | switch (EltSize) { \ | 1294 | 0 | case 0: \ | 1295 | 0 | break; \ | 1296 | 507 | case 8: \ | 1297 | 507 | SStream_concat0(O, ".b"); \ | 1298 | 507 | break; \ | 1299 | 0 | case 16: \ | 1300 | 0 | SStream_concat0(O, ".h"); \ | 1301 | 0 | break; \ | 1302 | 0 | case 32: \ | 1303 | 0 | SStream_concat0(O, ".s"); \ | 1304 | 0 | break; \ | 1305 | 0 | case 64: \ | 1306 | 0 | SStream_concat0(O, ".d"); \ | 1307 | 0 | break; \ | 1308 | 0 | default: \ | 1309 | 0 | CS_ASSERT_RET(0 && "Unsupported element size"); \ | 1310 | 507 | } \ | 1311 | 507 | } |
printPredicateAsCounter_64 Line | Count | Source | 1281 | 945 | { \ | 1282 | 945 | AArch64_add_cs_detail_1( \ | 1283 | 945 | MI, \ | 1284 | 945 | CONCAT(AArch64_OP_GROUP_PredicateAsCounter, EltSize), \ | 1285 | 945 | OpNum, EltSize); \ | 1286 | 945 | unsigned Reg = \ | 1287 | 945 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 1288 | 945 | if (Reg < AArch64_PN0 || Reg > AArch64_PN15) \ | 1289 | 945 | CS_ASSERT_RET(0 && \ | 1290 | 945 | "Unsupported predicate-as-counter register"); \ | 1291 | 945 | SStream_concat(O, "%s", "pn"); \ | 1292 | 945 | printUInt32(O, (Reg - AArch64_PN0)); \ | 1293 | 945 | switch (EltSize) { \ | 1294 | 0 | case 0: \ | 1295 | 0 | break; \ | 1296 | 0 | case 8: \ | 1297 | 0 | SStream_concat0(O, ".b"); \ | 1298 | 0 | break; \ | 1299 | 0 | case 16: \ | 1300 | 0 | SStream_concat0(O, ".h"); \ | 1301 | 0 | break; \ | 1302 | 0 | case 32: \ | 1303 | 0 | SStream_concat0(O, ".s"); \ | 1304 | 0 | break; \ | 1305 | 945 | case 64: \ | 1306 | 945 | SStream_concat0(O, ".d"); \ | 1307 | 945 | break; \ | 1308 | 0 | default: \ | 1309 | 0 | CS_ASSERT_RET(0 && "Unsupported element size"); \ | 1310 | 945 | } \ | 1311 | 945 | } |
printPredicateAsCounter_16 Line | Count | Source | 1281 | 73 | { \ | 1282 | 73 | AArch64_add_cs_detail_1( \ | 1283 | 73 | MI, \ | 1284 | 73 | CONCAT(AArch64_OP_GROUP_PredicateAsCounter, EltSize), \ | 1285 | 73 | OpNum, EltSize); \ | 1286 | 73 | unsigned Reg = \ | 1287 | 73 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 1288 | 73 | if (Reg < AArch64_PN0 || Reg > AArch64_PN15) \ | 1289 | 73 | CS_ASSERT_RET(0 && \ | 1290 | 73 | "Unsupported predicate-as-counter register"); \ | 1291 | 73 | SStream_concat(O, "%s", "pn"); \ | 1292 | 73 | printUInt32(O, (Reg - AArch64_PN0)); \ | 1293 | 73 | switch (EltSize) { \ | 1294 | 0 | case 0: \ | 1295 | 0 | break; \ | 1296 | 0 | case 8: \ | 1297 | 0 | SStream_concat0(O, ".b"); \ | 1298 | 0 | break; \ | 1299 | 73 | case 16: \ | 1300 | 73 | SStream_concat0(O, ".h"); \ | 1301 | 73 | break; \ | 1302 | 0 | case 32: \ | 1303 | 0 | SStream_concat0(O, ".s"); \ | 1304 | 0 | break; \ | 1305 | 0 | case 64: \ | 1306 | 0 | SStream_concat0(O, ".d"); \ | 1307 | 0 | break; \ | 1308 | 0 | default: \ | 1309 | 0 | CS_ASSERT_RET(0 && "Unsupported element size"); \ | 1310 | 73 | } \ | 1311 | 73 | } |
printPredicateAsCounter_32 Line | Count | Source | 1281 | 105 | { \ | 1282 | 105 | AArch64_add_cs_detail_1( \ | 1283 | 105 | MI, \ | 1284 | 105 | CONCAT(AArch64_OP_GROUP_PredicateAsCounter, EltSize), \ | 1285 | 105 | OpNum, EltSize); \ | 1286 | 105 | unsigned Reg = \ | 1287 | 105 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 1288 | 105 | if (Reg < AArch64_PN0 || Reg > AArch64_PN15) \ | 1289 | 105 | CS_ASSERT_RET(0 && \ | 1290 | 105 | "Unsupported predicate-as-counter register"); \ | 1291 | 105 | SStream_concat(O, "%s", "pn"); \ | 1292 | 105 | printUInt32(O, (Reg - AArch64_PN0)); \ | 1293 | 105 | switch (EltSize) { \ | 1294 | 0 | case 0: \ | 1295 | 0 | break; \ | 1296 | 0 | case 8: \ | 1297 | 0 | SStream_concat0(O, ".b"); \ | 1298 | 0 | break; \ | 1299 | 0 | case 16: \ | 1300 | 0 | SStream_concat0(O, ".h"); \ | 1301 | 0 | break; \ | 1302 | 105 | case 32: \ | 1303 | 105 | SStream_concat0(O, ".s"); \ | 1304 | 105 | break; \ | 1305 | 0 | case 64: \ | 1306 | 0 | SStream_concat0(O, ".d"); \ | 1307 | 0 | break; \ | 1308 | 0 | default: \ | 1309 | 0 | CS_ASSERT_RET(0 && "Unsupported element size"); \ | 1310 | 105 | } \ | 1311 | 105 | } |
printPredicateAsCounter_0 Line | Count | Source | 1281 | 4.16k | { \ | 1282 | 4.16k | AArch64_add_cs_detail_1( \ | 1283 | 4.16k | MI, \ | 1284 | 4.16k | CONCAT(AArch64_OP_GROUP_PredicateAsCounter, EltSize), \ | 1285 | 4.16k | OpNum, EltSize); \ | 1286 | 4.16k | unsigned Reg = \ | 1287 | 4.16k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 1288 | 4.16k | if (Reg < AArch64_PN0 || Reg > AArch64_PN15) \ | 1289 | 4.16k | CS_ASSERT_RET(0 && \ | 1290 | 4.16k | "Unsupported predicate-as-counter register"); \ | 1291 | 4.16k | SStream_concat(O, "%s", "pn"); \ | 1292 | 4.16k | printUInt32(O, (Reg - AArch64_PN0)); \ | 1293 | 4.16k | switch (EltSize) { \ | 1294 | 4.16k | case 0: \ | 1295 | 4.16k | break; \ | 1296 | 0 | case 8: \ | 1297 | 0 | SStream_concat0(O, ".b"); \ | 1298 | 0 | break; \ | 1299 | 0 | case 16: \ | 1300 | 0 | SStream_concat0(O, ".h"); \ | 1301 | 0 | break; \ | 1302 | 0 | case 32: \ | 1303 | 0 | SStream_concat0(O, ".s"); \ | 1304 | 0 | break; \ | 1305 | 0 | case 64: \ | 1306 | 0 | SStream_concat0(O, ".d"); \ | 1307 | 0 | break; \ | 1308 | 0 | default: \ | 1309 | 0 | CS_ASSERT_RET(0 && "Unsupported element size"); \ | 1310 | 4.16k | } \ | 1311 | 4.16k | } |
|
1312 | | DEFINE_printPredicateAsCounter(8); |
1313 | | DEFINE_printPredicateAsCounter(64); |
1314 | | DEFINE_printPredicateAsCounter(16); |
1315 | | DEFINE_printPredicateAsCounter(32); |
1316 | | DEFINE_printPredicateAsCounter(0); |
1317 | | |
1318 | | void printCondCode(MCInst *MI, unsigned OpNum, SStream *O) |
1319 | 2.92k | { |
1320 | 2.92k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_CondCode, OpNum); |
1321 | 2.92k | AArch64CC_CondCode CC = (AArch64CC_CondCode)MCOperand_getImm( |
1322 | 2.92k | MCInst_getOperand(MI, (OpNum))); |
1323 | 2.92k | SStream_concat0(O, AArch64CC_getCondCodeName(CC)); |
1324 | 2.92k | } |
1325 | | |
1326 | | void printInverseCondCode(MCInst *MI, unsigned OpNum, SStream *O) |
1327 | 84 | { |
1328 | 84 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_InverseCondCode, OpNum); |
1329 | 84 | AArch64CC_CondCode CC = (AArch64CC_CondCode)MCOperand_getImm( |
1330 | 84 | MCInst_getOperand(MI, (OpNum))); |
1331 | 84 | SStream_concat0(O, AArch64CC_getCondCodeName( |
1332 | 84 | AArch64CC_getInvertedCondCode(CC))); |
1333 | 84 | } |
1334 | | |
1335 | | void printAMNoIndex(MCInst *MI, unsigned OpNum, SStream *O) |
1336 | 0 | { |
1337 | 0 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_AMNoIndex, OpNum); |
1338 | 0 | SStream_concat0(O, "["); |
1339 | |
|
1340 | 0 | printRegName(O, MCOperand_getReg(MCInst_getOperand(MI, (OpNum)))); |
1341 | 0 | SStream_concat0(O, "]"); |
1342 | 0 | } |
1343 | | |
1344 | | #define DEFINE_printImmScale(Scale) \ |
1345 | | void CONCAT(printImmScale, Scale)(MCInst * MI, unsigned OpNum, \ |
1346 | | SStream *O) \ |
1347 | 21.4k | { \ |
1348 | 21.4k | AArch64_add_cs_detail_1( \ |
1349 | 21.4k | MI, CONCAT(AArch64_OP_GROUP_ImmScale, Scale), OpNum, \ |
1350 | 21.4k | Scale); \ |
1351 | 21.4k | SStream_concat(O, "%s", markup("<imm:")); \ |
1352 | 21.4k | printInt32Bang(O, Scale *MCOperand_getImm( \ |
1353 | 21.4k | MCInst_getOperand(MI, (OpNum)))); \ |
1354 | 21.4k | SStream_concat0(O, markup(">")); \ |
1355 | 21.4k | } Line | Count | Source | 1347 | 6.86k | { \ | 1348 | 6.86k | AArch64_add_cs_detail_1( \ | 1349 | 6.86k | MI, CONCAT(AArch64_OP_GROUP_ImmScale, Scale), OpNum, \ | 1350 | 6.86k | Scale); \ | 1351 | 6.86k | SStream_concat(O, "%s", markup("<imm:")); \ | 1352 | 6.86k | printInt32Bang(O, Scale *MCOperand_getImm( \ | 1353 | 6.86k | MCInst_getOperand(MI, (OpNum)))); \ | 1354 | 6.86k | SStream_concat0(O, markup(">")); \ | 1355 | 6.86k | } |
Line | Count | Source | 1347 | 1.59k | { \ | 1348 | 1.59k | AArch64_add_cs_detail_1( \ | 1349 | 1.59k | MI, CONCAT(AArch64_OP_GROUP_ImmScale, Scale), OpNum, \ | 1350 | 1.59k | Scale); \ | 1351 | 1.59k | SStream_concat(O, "%s", markup("<imm:")); \ | 1352 | 1.59k | printInt32Bang(O, Scale *MCOperand_getImm( \ | 1353 | 1.59k | MCInst_getOperand(MI, (OpNum)))); \ | 1354 | 1.59k | SStream_concat0(O, markup(">")); \ | 1355 | 1.59k | } |
Line | Count | Source | 1347 | 9.69k | { \ | 1348 | 9.69k | AArch64_add_cs_detail_1( \ | 1349 | 9.69k | MI, CONCAT(AArch64_OP_GROUP_ImmScale, Scale), OpNum, \ | 1350 | 9.69k | Scale); \ | 1351 | 9.69k | SStream_concat(O, "%s", markup("<imm:")); \ | 1352 | 9.69k | printInt32Bang(O, Scale *MCOperand_getImm( \ | 1353 | 9.69k | MCInst_getOperand(MI, (OpNum)))); \ | 1354 | 9.69k | SStream_concat0(O, markup(">")); \ | 1355 | 9.69k | } |
Line | Count | Source | 1347 | 3.12k | { \ | 1348 | 3.12k | AArch64_add_cs_detail_1( \ | 1349 | 3.12k | MI, CONCAT(AArch64_OP_GROUP_ImmScale, Scale), OpNum, \ | 1350 | 3.12k | Scale); \ | 1351 | 3.12k | SStream_concat(O, "%s", markup("<imm:")); \ | 1352 | 3.12k | printInt32Bang(O, Scale *MCOperand_getImm( \ | 1353 | 3.12k | MCInst_getOperand(MI, (OpNum)))); \ | 1354 | 3.12k | SStream_concat0(O, markup(">")); \ | 1355 | 3.12k | } |
Line | Count | Source | 1347 | 41 | { \ | 1348 | 41 | AArch64_add_cs_detail_1( \ | 1349 | 41 | MI, CONCAT(AArch64_OP_GROUP_ImmScale, Scale), OpNum, \ | 1350 | 41 | Scale); \ | 1351 | 41 | SStream_concat(O, "%s", markup("<imm:")); \ | 1352 | 41 | printInt32Bang(O, Scale *MCOperand_getImm( \ | 1353 | 41 | MCInst_getOperand(MI, (OpNum)))); \ | 1354 | 41 | SStream_concat0(O, markup(">")); \ | 1355 | 41 | } |
Line | Count | Source | 1347 | 112 | { \ | 1348 | 112 | AArch64_add_cs_detail_1( \ | 1349 | 112 | MI, CONCAT(AArch64_OP_GROUP_ImmScale, Scale), OpNum, \ | 1350 | 112 | Scale); \ | 1351 | 112 | SStream_concat(O, "%s", markup("<imm:")); \ | 1352 | 112 | printInt32Bang(O, Scale *MCOperand_getImm( \ | 1353 | 112 | MCInst_getOperand(MI, (OpNum)))); \ | 1354 | 112 | SStream_concat0(O, markup(">")); \ | 1355 | 112 | } |
|
1356 | | DEFINE_printImmScale(8); |
1357 | | DEFINE_printImmScale(2); |
1358 | | DEFINE_printImmScale(4); |
1359 | | DEFINE_printImmScale(16); |
1360 | | DEFINE_printImmScale(32); |
1361 | | DEFINE_printImmScale(3); |
1362 | | |
1363 | | #define DEFINE_printImmRangeScale(Scale, Offset) \ |
1364 | | void CONCAT(printImmRangeScale, CONCAT(Scale, Offset))( \ |
1365 | | MCInst * MI, unsigned OpNum, SStream *O) \ |
1366 | 5.49k | { \ |
1367 | 5.49k | AArch64_add_cs_detail_2( \ |
1368 | 5.49k | MI, \ |
1369 | 5.49k | CONCAT(CONCAT(AArch64_OP_GROUP_ImmRangeScale, Scale), \ |
1370 | 5.49k | Offset), \ |
1371 | 5.49k | OpNum, Scale, Offset); \ |
1372 | 5.49k | unsigned FirstImm = \ |
1373 | 5.49k | Scale * \ |
1374 | 5.49k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ |
1375 | 5.49k | printUInt32(O, (FirstImm)); \ |
1376 | 5.49k | SStream_concat(O, "%s", ":"); \ |
1377 | 5.49k | printUInt32(O, (FirstImm + Offset)); \ |
1378 | 5.49k | SStream_concat1(O, '\0'); \ |
1379 | 5.49k | } Line | Count | Source | 1366 | 2.68k | { \ | 1367 | 2.68k | AArch64_add_cs_detail_2( \ | 1368 | 2.68k | MI, \ | 1369 | 2.68k | CONCAT(CONCAT(AArch64_OP_GROUP_ImmRangeScale, Scale), \ | 1370 | 2.68k | Offset), \ | 1371 | 2.68k | OpNum, Scale, Offset); \ | 1372 | 2.68k | unsigned FirstImm = \ | 1373 | 2.68k | Scale * \ | 1374 | 2.68k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1375 | 2.68k | printUInt32(O, (FirstImm)); \ | 1376 | 2.68k | SStream_concat(O, "%s", ":"); \ | 1377 | 2.68k | printUInt32(O, (FirstImm + Offset)); \ | 1378 | 2.68k | SStream_concat1(O, '\0'); \ | 1379 | 2.68k | } |
Line | Count | Source | 1366 | 2.81k | { \ | 1367 | 2.81k | AArch64_add_cs_detail_2( \ | 1368 | 2.81k | MI, \ | 1369 | 2.81k | CONCAT(CONCAT(AArch64_OP_GROUP_ImmRangeScale, Scale), \ | 1370 | 2.81k | Offset), \ | 1371 | 2.81k | OpNum, Scale, Offset); \ | 1372 | 2.81k | unsigned FirstImm = \ | 1373 | 2.81k | Scale * \ | 1374 | 2.81k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1375 | 2.81k | printUInt32(O, (FirstImm)); \ | 1376 | 2.81k | SStream_concat(O, "%s", ":"); \ | 1377 | 2.81k | printUInt32(O, (FirstImm + Offset)); \ | 1378 | 2.81k | SStream_concat1(O, '\0'); \ | 1379 | 2.81k | } |
|
1380 | | DEFINE_printImmRangeScale(2, 1); |
1381 | | DEFINE_printImmRangeScale(4, 3); |
1382 | | |
1383 | | void printUImm12Offset(MCInst *MI, unsigned OpNum, unsigned Scale, SStream *O) |
1384 | 4.94k | { |
1385 | 4.94k | MCOperand *MO = MCInst_getOperand(MI, (OpNum)); |
1386 | 4.94k | if (MCOperand_isImm(MO)) { |
1387 | 4.94k | SStream_concat(O, "%s", markup("<imm:")); |
1388 | 4.94k | printUInt32Bang(O, (MCOperand_getImm(MO) * Scale)); |
1389 | 4.94k | SStream_concat0(O, markup(">")); |
1390 | 4.94k | } else { |
1391 | 0 | printUInt64Bang(O, MCOperand_getImm(MO)); |
1392 | 0 | } |
1393 | 4.94k | } |
1394 | | |
1395 | | void printAMIndexedWB(MCInst *MI, unsigned OpNum, unsigned Scale, SStream *O) |
1396 | 0 | { |
1397 | 0 | MCOperand *MO1 = MCInst_getOperand(MI, (OpNum + 1)); |
1398 | 0 | SStream_concat0(O, "["); |
1399 | |
|
1400 | 0 | printRegName(O, MCOperand_getReg(MCInst_getOperand(MI, (OpNum)))); |
1401 | 0 | if (MCOperand_isImm(MO1)) { |
1402 | 0 | SStream_concat(O, "%s%s", ", ", markup("<imm:")); |
1403 | 0 | printUInt32Bang(O, MCOperand_getImm(MO1) * Scale); |
1404 | 0 | SStream_concat0(O, markup(">")); |
1405 | 0 | } else { |
1406 | 0 | printUInt64Bang(O, MCOperand_getImm(MO1)); |
1407 | 0 | } |
1408 | 0 | SStream_concat0(O, "]"); |
1409 | 0 | } |
1410 | | |
1411 | | void printRPRFMOperand(MCInst *MI, unsigned OpNum, SStream *O) |
1412 | 918 | { |
1413 | 918 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_RPRFMOperand, OpNum); |
1414 | 918 | unsigned prfop = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
1415 | 918 | const AArch64PRFM_PRFM *PRFM = |
1416 | 918 | AArch64RPRFM_lookupRPRFMByEncoding(prfop); |
1417 | 918 | if (PRFM) { |
1418 | 657 | SStream_concat0(O, PRFM->Name); |
1419 | 657 | return; |
1420 | 657 | } |
1421 | | |
1422 | 261 | printUInt32Bang(O, (prfop)); |
1423 | 261 | SStream_concat1(O, '\0'); |
1424 | 261 | } |
1425 | | |
1426 | | #define DEFINE_printPrefetchOp(IsSVEPrefetch) \ |
1427 | | void CONCAT(printPrefetchOp, \ |
1428 | | IsSVEPrefetch)(MCInst * MI, unsigned OpNum, SStream *O) \ |
1429 | 5.95k | { \ |
1430 | 5.95k | AArch64_add_cs_detail_1(MI, \ |
1431 | 5.95k | CONCAT(AArch64_OP_GROUP_PrefetchOp, \ |
1432 | 5.95k | IsSVEPrefetch), \ |
1433 | 5.95k | OpNum, IsSVEPrefetch); \ |
1434 | 5.95k | unsigned prfop = \ |
1435 | 5.95k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ |
1436 | 5.95k | if (IsSVEPrefetch) { \ |
1437 | 4.34k | const AArch64SVEPRFM_SVEPRFM *PRFM = \ |
1438 | 4.34k | AArch64SVEPRFM_lookupSVEPRFMByEncoding(prfop); \ |
1439 | 4.34k | if (PRFM) { \ |
1440 | 3.49k | SStream_concat0(O, PRFM->Name); \ |
1441 | 3.49k | return; \ |
1442 | 3.49k | } \ |
1443 | 4.34k | } else { \ |
1444 | 1.60k | const AArch64PRFM_PRFM *PRFM = \ |
1445 | 1.60k | AArch64PRFM_lookupPRFMByEncoding(prfop); \ |
1446 | 1.60k | if (PRFM && \ |
1447 | 1.60k | AArch64_testFeatureList(MI->csh->mode, \ |
1448 | 1.04k | PRFM->FeaturesRequired)) { \ |
1449 | 1.04k | SStream_concat0(O, PRFM->Name); \ |
1450 | 1.04k | return; \ |
1451 | 1.04k | } \ |
1452 | 1.60k | } \ |
1453 | 5.95k | \ |
1454 | 5.95k | SStream_concat(O, "%s", markup("<imm:")); \ |
1455 | 1.40k | printUInt32Bang(O, (prfop)); \ |
1456 | 1.40k | SStream_concat0(O, markup(">")); \ |
1457 | 1.40k | } Line | Count | Source | 1429 | 1.60k | { \ | 1430 | 1.60k | AArch64_add_cs_detail_1(MI, \ | 1431 | 1.60k | CONCAT(AArch64_OP_GROUP_PrefetchOp, \ | 1432 | 1.60k | IsSVEPrefetch), \ | 1433 | 1.60k | OpNum, IsSVEPrefetch); \ | 1434 | 1.60k | unsigned prfop = \ | 1435 | 1.60k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1436 | 1.60k | if (IsSVEPrefetch) { \ | 1437 | 0 | const AArch64SVEPRFM_SVEPRFM *PRFM = \ | 1438 | 0 | AArch64SVEPRFM_lookupSVEPRFMByEncoding(prfop); \ | 1439 | 0 | if (PRFM) { \ | 1440 | 0 | SStream_concat0(O, PRFM->Name); \ | 1441 | 0 | return; \ | 1442 | 0 | } \ | 1443 | 1.60k | } else { \ | 1444 | 1.60k | const AArch64PRFM_PRFM *PRFM = \ | 1445 | 1.60k | AArch64PRFM_lookupPRFMByEncoding(prfop); \ | 1446 | 1.60k | if (PRFM && \ | 1447 | 1.60k | AArch64_testFeatureList(MI->csh->mode, \ | 1448 | 1.04k | PRFM->FeaturesRequired)) { \ | 1449 | 1.04k | SStream_concat0(O, PRFM->Name); \ | 1450 | 1.04k | return; \ | 1451 | 1.04k | } \ | 1452 | 1.60k | } \ | 1453 | 1.60k | \ | 1454 | 1.60k | SStream_concat(O, "%s", markup("<imm:")); \ | 1455 | 561 | printUInt32Bang(O, (prfop)); \ | 1456 | 561 | SStream_concat0(O, markup(">")); \ | 1457 | 561 | } |
Line | Count | Source | 1429 | 4.34k | { \ | 1430 | 4.34k | AArch64_add_cs_detail_1(MI, \ | 1431 | 4.34k | CONCAT(AArch64_OP_GROUP_PrefetchOp, \ | 1432 | 4.34k | IsSVEPrefetch), \ | 1433 | 4.34k | OpNum, IsSVEPrefetch); \ | 1434 | 4.34k | unsigned prfop = \ | 1435 | 4.34k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1436 | 4.34k | if (IsSVEPrefetch) { \ | 1437 | 4.34k | const AArch64SVEPRFM_SVEPRFM *PRFM = \ | 1438 | 4.34k | AArch64SVEPRFM_lookupSVEPRFMByEncoding(prfop); \ | 1439 | 4.34k | if (PRFM) { \ | 1440 | 3.49k | SStream_concat0(O, PRFM->Name); \ | 1441 | 3.49k | return; \ | 1442 | 3.49k | } \ | 1443 | 4.34k | } else { \ | 1444 | 0 | const AArch64PRFM_PRFM *PRFM = \ | 1445 | 0 | AArch64PRFM_lookupPRFMByEncoding(prfop); \ | 1446 | 0 | if (PRFM && \ | 1447 | 0 | AArch64_testFeatureList(MI->csh->mode, \ | 1448 | 0 | PRFM->FeaturesRequired)) { \ | 1449 | 0 | SStream_concat0(O, PRFM->Name); \ | 1450 | 0 | return; \ | 1451 | 0 | } \ | 1452 | 0 | } \ | 1453 | 4.34k | \ | 1454 | 4.34k | SStream_concat(O, "%s", markup("<imm:")); \ | 1455 | 847 | printUInt32Bang(O, (prfop)); \ | 1456 | 847 | SStream_concat0(O, markup(">")); \ | 1457 | 847 | } |
|
1458 | | DEFINE_printPrefetchOp(false); |
1459 | | DEFINE_printPrefetchOp(true); |
1460 | | |
1461 | | void printPSBHintOp(MCInst *MI, unsigned OpNum, SStream *O) |
1462 | 279 | { |
1463 | 279 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_PSBHintOp, OpNum); |
1464 | 279 | unsigned psbhintop = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
1465 | 279 | const AArch64PSBHint_PSB *PSB = |
1466 | 279 | AArch64PSBHint_lookupPSBByEncoding(psbhintop); |
1467 | 279 | if (PSB) |
1468 | 279 | SStream_concat0(O, PSB->Name); |
1469 | 0 | else { |
1470 | 0 | SStream_concat(O, "%s", markup("<imm:")); |
1471 | 0 | SStream_concat1(O, '#'); |
1472 | 0 | printUInt32Bang(O, (psbhintop)); |
1473 | 0 | SStream_concat0(O, markup(">")); |
1474 | 0 | } |
1475 | 279 | } |
1476 | | |
1477 | | void printBTIHintOp(MCInst *MI, unsigned OpNum, SStream *O) |
1478 | 396 | { |
1479 | 396 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_BTIHintOp, OpNum); |
1480 | 396 | unsigned btihintop = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))) ^ |
1481 | 396 | 32; |
1482 | 396 | const AArch64BTIHint_BTI *BTI = |
1483 | 396 | AArch64BTIHint_lookupBTIByEncoding(btihintop); |
1484 | 396 | if (BTI) |
1485 | 396 | SStream_concat0(O, BTI->Name); |
1486 | 0 | else { |
1487 | 0 | SStream_concat(O, "%s", markup("<imm:")); |
1488 | 0 | printUInt32Bang(O, (btihintop)); |
1489 | 0 | SStream_concat0(O, markup(">")); |
1490 | 0 | } |
1491 | 396 | } |
1492 | | |
1493 | | static void printFPImmOperand(MCInst *MI, unsigned OpNum, SStream *O) |
1494 | 206 | { |
1495 | 206 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_FPImmOperand, OpNum); |
1496 | 206 | MCOperand *MO = MCInst_getOperand(MI, (OpNum)); |
1497 | 206 | float FPImm = MCOperand_isDFPImm(MO) ? |
1498 | 0 | BitsToDouble(MCOperand_getImm(MO)) : |
1499 | 206 | AArch64_AM_getFPImmFloat(MCOperand_getImm(MO)); |
1500 | | |
1501 | | // 8 decimal places are enough to perfectly represent permitted floats. |
1502 | 206 | SStream_concat(O, "%s", markup("<imm:")); |
1503 | 206 | SStream_concat(O, "#%.8f", FPImm); |
1504 | 206 | SStream_concat0(O, markup(">")); |
1505 | 206 | } |
1506 | | |
1507 | | static unsigned getNextVectorRegister(unsigned Reg, unsigned Stride /* = 1 */) |
1508 | 124k | { |
1509 | 306k | while (Stride--) { |
1510 | 182k | switch (Reg) { |
1511 | 0 | default: |
1512 | 0 | CS_ASSERT_RET_VAL(0 && "Vector register expected!", 0); |
1513 | 4.47k | case AArch64_Q0: |
1514 | 4.47k | Reg = AArch64_Q1; |
1515 | 4.47k | break; |
1516 | 4.13k | case AArch64_Q1: |
1517 | 4.13k | Reg = AArch64_Q2; |
1518 | 4.13k | break; |
1519 | 1.45k | case AArch64_Q2: |
1520 | 1.45k | Reg = AArch64_Q3; |
1521 | 1.45k | break; |
1522 | 1.01k | case AArch64_Q3: |
1523 | 1.01k | Reg = AArch64_Q4; |
1524 | 1.01k | break; |
1525 | 857 | case AArch64_Q4: |
1526 | 857 | Reg = AArch64_Q5; |
1527 | 857 | break; |
1528 | 1.32k | case AArch64_Q5: |
1529 | 1.32k | Reg = AArch64_Q6; |
1530 | 1.32k | break; |
1531 | 1.54k | case AArch64_Q6: |
1532 | 1.54k | Reg = AArch64_Q7; |
1533 | 1.54k | break; |
1534 | 1.85k | case AArch64_Q7: |
1535 | 1.85k | Reg = AArch64_Q8; |
1536 | 1.85k | break; |
1537 | 2.42k | case AArch64_Q8: |
1538 | 2.42k | Reg = AArch64_Q9; |
1539 | 2.42k | break; |
1540 | 2.44k | case AArch64_Q9: |
1541 | 2.44k | Reg = AArch64_Q10; |
1542 | 2.44k | break; |
1543 | 1.70k | case AArch64_Q10: |
1544 | 1.70k | Reg = AArch64_Q11; |
1545 | 1.70k | break; |
1546 | 1.41k | case AArch64_Q11: |
1547 | 1.41k | Reg = AArch64_Q12; |
1548 | 1.41k | break; |
1549 | 1.36k | case AArch64_Q12: |
1550 | 1.36k | Reg = AArch64_Q13; |
1551 | 1.36k | break; |
1552 | 1.53k | case AArch64_Q13: |
1553 | 1.53k | Reg = AArch64_Q14; |
1554 | 1.53k | break; |
1555 | 466 | case AArch64_Q14: |
1556 | 466 | Reg = AArch64_Q15; |
1557 | 466 | break; |
1558 | 639 | case AArch64_Q15: |
1559 | 639 | Reg = AArch64_Q16; |
1560 | 639 | break; |
1561 | 828 | case AArch64_Q16: |
1562 | 828 | Reg = AArch64_Q17; |
1563 | 828 | break; |
1564 | 1.24k | case AArch64_Q17: |
1565 | 1.24k | Reg = AArch64_Q18; |
1566 | 1.24k | break; |
1567 | 1.63k | case AArch64_Q18: |
1568 | 1.63k | Reg = AArch64_Q19; |
1569 | 1.63k | break; |
1570 | 2.27k | case AArch64_Q19: |
1571 | 2.27k | Reg = AArch64_Q20; |
1572 | 2.27k | break; |
1573 | 6.55k | case AArch64_Q20: |
1574 | 6.55k | Reg = AArch64_Q21; |
1575 | 6.55k | break; |
1576 | 3.34k | case AArch64_Q21: |
1577 | 3.34k | Reg = AArch64_Q22; |
1578 | 3.34k | break; |
1579 | 4.10k | case AArch64_Q22: |
1580 | 4.10k | Reg = AArch64_Q23; |
1581 | 4.10k | break; |
1582 | 3.18k | case AArch64_Q23: |
1583 | 3.18k | Reg = AArch64_Q24; |
1584 | 3.18k | break; |
1585 | 2.06k | case AArch64_Q24: |
1586 | 2.06k | Reg = AArch64_Q25; |
1587 | 2.06k | break; |
1588 | 2.76k | case AArch64_Q25: |
1589 | 2.76k | Reg = AArch64_Q26; |
1590 | 2.76k | break; |
1591 | 1.95k | case AArch64_Q26: |
1592 | 1.95k | Reg = AArch64_Q27; |
1593 | 1.95k | break; |
1594 | 2.69k | case AArch64_Q27: |
1595 | 2.69k | Reg = AArch64_Q28; |
1596 | 2.69k | break; |
1597 | 1.76k | case AArch64_Q28: |
1598 | 1.76k | Reg = AArch64_Q29; |
1599 | 1.76k | break; |
1600 | 3.13k | case AArch64_Q29: |
1601 | 3.13k | Reg = AArch64_Q30; |
1602 | 3.13k | break; |
1603 | 1.79k | case AArch64_Q30: |
1604 | 1.79k | Reg = AArch64_Q31; |
1605 | 1.79k | break; |
1606 | | // Vector lists can wrap around. |
1607 | 2.58k | case AArch64_Q31: |
1608 | 2.58k | Reg = AArch64_Q0; |
1609 | 2.58k | break; |
1610 | 9.59k | case AArch64_Z0: |
1611 | 9.59k | Reg = AArch64_Z1; |
1612 | 9.59k | break; |
1613 | 6.66k | case AArch64_Z1: |
1614 | 6.66k | Reg = AArch64_Z2; |
1615 | 6.66k | break; |
1616 | 7.49k | case AArch64_Z2: |
1617 | 7.49k | Reg = AArch64_Z3; |
1618 | 7.49k | break; |
1619 | 1.86k | case AArch64_Z3: |
1620 | 1.86k | Reg = AArch64_Z4; |
1621 | 1.86k | break; |
1622 | 11.1k | case AArch64_Z4: |
1623 | 11.1k | Reg = AArch64_Z5; |
1624 | 11.1k | break; |
1625 | 4.77k | case AArch64_Z5: |
1626 | 4.77k | Reg = AArch64_Z6; |
1627 | 4.77k | break; |
1628 | 4.82k | case AArch64_Z6: |
1629 | 4.82k | Reg = AArch64_Z7; |
1630 | 4.82k | break; |
1631 | 1.79k | case AArch64_Z7: |
1632 | 1.79k | Reg = AArch64_Z8; |
1633 | 1.79k | break; |
1634 | 5.76k | case AArch64_Z8: |
1635 | 5.76k | Reg = AArch64_Z9; |
1636 | 5.76k | break; |
1637 | 5.29k | case AArch64_Z9: |
1638 | 5.29k | Reg = AArch64_Z10; |
1639 | 5.29k | break; |
1640 | 4.96k | case AArch64_Z10: |
1641 | 4.96k | Reg = AArch64_Z11; |
1642 | 4.96k | break; |
1643 | 2.14k | case AArch64_Z11: |
1644 | 2.14k | Reg = AArch64_Z12; |
1645 | 2.14k | break; |
1646 | 2.26k | case AArch64_Z12: |
1647 | 2.26k | Reg = AArch64_Z13; |
1648 | 2.26k | break; |
1649 | 2.08k | case AArch64_Z13: |
1650 | 2.08k | Reg = AArch64_Z14; |
1651 | 2.08k | break; |
1652 | 3.61k | case AArch64_Z14: |
1653 | 3.61k | Reg = AArch64_Z15; |
1654 | 3.61k | break; |
1655 | 2.04k | case AArch64_Z15: |
1656 | 2.04k | Reg = AArch64_Z16; |
1657 | 2.04k | break; |
1658 | 2.50k | case AArch64_Z16: |
1659 | 2.50k | Reg = AArch64_Z17; |
1660 | 2.50k | break; |
1661 | 1.28k | case AArch64_Z17: |
1662 | 1.28k | Reg = AArch64_Z18; |
1663 | 1.28k | break; |
1664 | 1.99k | case AArch64_Z18: |
1665 | 1.99k | Reg = AArch64_Z19; |
1666 | 1.99k | break; |
1667 | 952 | case AArch64_Z19: |
1668 | 952 | Reg = AArch64_Z20; |
1669 | 952 | break; |
1670 | 4.61k | case AArch64_Z20: |
1671 | 4.61k | Reg = AArch64_Z21; |
1672 | 4.61k | break; |
1673 | 3.31k | case AArch64_Z21: |
1674 | 3.31k | Reg = AArch64_Z22; |
1675 | 3.31k | break; |
1676 | 3.33k | case AArch64_Z22: |
1677 | 3.33k | Reg = AArch64_Z23; |
1678 | 3.33k | break; |
1679 | 658 | case AArch64_Z23: |
1680 | 658 | Reg = AArch64_Z24; |
1681 | 658 | break; |
1682 | 4.59k | case AArch64_Z24: |
1683 | 4.59k | Reg = AArch64_Z25; |
1684 | 4.59k | break; |
1685 | 2.29k | case AArch64_Z25: |
1686 | 2.29k | Reg = AArch64_Z26; |
1687 | 2.29k | break; |
1688 | 2.49k | case AArch64_Z26: |
1689 | 2.49k | Reg = AArch64_Z27; |
1690 | 2.49k | break; |
1691 | 767 | case AArch64_Z27: |
1692 | 767 | Reg = AArch64_Z28; |
1693 | 767 | break; |
1694 | 1.03k | case AArch64_Z28: |
1695 | 1.03k | Reg = AArch64_Z29; |
1696 | 1.03k | break; |
1697 | 1.28k | case AArch64_Z29: |
1698 | 1.28k | Reg = AArch64_Z30; |
1699 | 1.28k | break; |
1700 | 1.99k | case AArch64_Z30: |
1701 | 1.99k | Reg = AArch64_Z31; |
1702 | 1.99k | break; |
1703 | | // Vector lists can wrap around. |
1704 | 1.39k | case AArch64_Z31: |
1705 | 1.39k | Reg = AArch64_Z0; |
1706 | 1.39k | break; |
1707 | 34 | case AArch64_P0: |
1708 | 34 | Reg = AArch64_P1; |
1709 | 34 | break; |
1710 | 48 | case AArch64_P1: |
1711 | 48 | Reg = AArch64_P2; |
1712 | 48 | break; |
1713 | 136 | case AArch64_P2: |
1714 | 136 | Reg = AArch64_P3; |
1715 | 136 | break; |
1716 | 2 | case AArch64_P3: |
1717 | 2 | Reg = AArch64_P4; |
1718 | 2 | break; |
1719 | 78 | case AArch64_P4: |
1720 | 78 | Reg = AArch64_P5; |
1721 | 78 | break; |
1722 | 44 | case AArch64_P5: |
1723 | 44 | Reg = AArch64_P6; |
1724 | 44 | break; |
1725 | 46 | case AArch64_P6: |
1726 | 46 | Reg = AArch64_P7; |
1727 | 46 | break; |
1728 | 14 | case AArch64_P7: |
1729 | 14 | Reg = AArch64_P8; |
1730 | 14 | break; |
1731 | 8 | case AArch64_P8: |
1732 | 8 | Reg = AArch64_P9; |
1733 | 8 | break; |
1734 | 4 | case AArch64_P9: |
1735 | 4 | Reg = AArch64_P10; |
1736 | 4 | break; |
1737 | 6 | case AArch64_P10: |
1738 | 6 | Reg = AArch64_P11; |
1739 | 6 | break; |
1740 | 26 | case AArch64_P11: |
1741 | 26 | Reg = AArch64_P12; |
1742 | 26 | break; |
1743 | 26 | case AArch64_P12: |
1744 | 26 | Reg = AArch64_P13; |
1745 | 26 | break; |
1746 | 80 | case AArch64_P13: |
1747 | 80 | Reg = AArch64_P14; |
1748 | 80 | break; |
1749 | 38 | case AArch64_P14: |
1750 | 38 | Reg = AArch64_P15; |
1751 | 38 | break; |
1752 | | // Vector lists can wrap around. |
1753 | 36 | case AArch64_P15: |
1754 | 36 | Reg = AArch64_P0; |
1755 | 36 | break; |
1756 | 182k | } |
1757 | 182k | } |
1758 | 124k | return Reg; |
1759 | 124k | } |
1760 | | |
1761 | | #define DEFINE_printGPRSeqPairsClassOperand(size) \ |
1762 | | void CONCAT(printGPRSeqPairsClassOperand, \ |
1763 | | size)(MCInst * MI, unsigned OpNum, SStream *O) \ |
1764 | 2.85k | { \ |
1765 | 2.85k | AArch64_add_cs_detail_1( \ |
1766 | 2.85k | MI, \ |
1767 | 2.85k | CONCAT(AArch64_OP_GROUP_GPRSeqPairsClassOperand, \ |
1768 | 2.85k | size), \ |
1769 | 2.85k | OpNum, size); \ |
1770 | 2.85k | CS_ASSERT_RET((size == 64 || size == 32) && \ |
1771 | 2.85k | "Template parameter must be either 32 or 64"); \ |
1772 | 2.85k | unsigned Reg = \ |
1773 | 2.85k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ |
1774 | 2.85k | \ |
1775 | 2.85k | unsigned Sube = (size == 32) ? AArch64_sube32 : \ |
1776 | 2.85k | AArch64_sube64; \ |
1777 | 2.85k | unsigned Subo = (size == 32) ? AArch64_subo32 : \ |
1778 | 2.85k | AArch64_subo64; \ |
1779 | 2.85k | \ |
1780 | 2.85k | unsigned Even = MCRegisterInfo_getSubReg(MI->MRI, Reg, Sube); \ |
1781 | 2.85k | unsigned Odd = MCRegisterInfo_getSubReg(MI->MRI, Reg, Subo); \ |
1782 | 2.85k | printRegName(O, Even); \ |
1783 | 2.85k | SStream_concat0(O, ", "); \ |
1784 | 2.85k | printRegName(O, Odd); \ |
1785 | 2.85k | } printGPRSeqPairsClassOperand_32 Line | Count | Source | 1764 | 132 | { \ | 1765 | 132 | AArch64_add_cs_detail_1( \ | 1766 | 132 | MI, \ | 1767 | 132 | CONCAT(AArch64_OP_GROUP_GPRSeqPairsClassOperand, \ | 1768 | 132 | size), \ | 1769 | 132 | OpNum, size); \ | 1770 | 132 | CS_ASSERT_RET((size == 64 || size == 32) && \ | 1771 | 132 | "Template parameter must be either 32 or 64"); \ | 1772 | 132 | unsigned Reg = \ | 1773 | 132 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 1774 | 132 | \ | 1775 | 132 | unsigned Sube = (size == 32) ? AArch64_sube32 : \ | 1776 | 132 | AArch64_sube64; \ | 1777 | 132 | unsigned Subo = (size == 32) ? AArch64_subo32 : \ | 1778 | 132 | AArch64_subo64; \ | 1779 | 132 | \ | 1780 | 132 | unsigned Even = MCRegisterInfo_getSubReg(MI->MRI, Reg, Sube); \ | 1781 | 132 | unsigned Odd = MCRegisterInfo_getSubReg(MI->MRI, Reg, Subo); \ | 1782 | 132 | printRegName(O, Even); \ | 1783 | 132 | SStream_concat0(O, ", "); \ | 1784 | 132 | printRegName(O, Odd); \ | 1785 | 132 | } |
printGPRSeqPairsClassOperand_64 Line | Count | Source | 1764 | 2.72k | { \ | 1765 | 2.72k | AArch64_add_cs_detail_1( \ | 1766 | 2.72k | MI, \ | 1767 | 2.72k | CONCAT(AArch64_OP_GROUP_GPRSeqPairsClassOperand, \ | 1768 | 2.72k | size), \ | 1769 | 2.72k | OpNum, size); \ | 1770 | 2.72k | CS_ASSERT_RET((size == 64 || size == 32) && \ | 1771 | 2.72k | "Template parameter must be either 32 or 64"); \ | 1772 | 2.72k | unsigned Reg = \ | 1773 | 2.72k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 1774 | 2.72k | \ | 1775 | 2.72k | unsigned Sube = (size == 32) ? AArch64_sube32 : \ | 1776 | 2.72k | AArch64_sube64; \ | 1777 | 2.72k | unsigned Subo = (size == 32) ? AArch64_subo32 : \ | 1778 | 2.72k | AArch64_subo64; \ | 1779 | 2.72k | \ | 1780 | 2.72k | unsigned Even = MCRegisterInfo_getSubReg(MI->MRI, Reg, Sube); \ | 1781 | 2.72k | unsigned Odd = MCRegisterInfo_getSubReg(MI->MRI, Reg, Subo); \ | 1782 | 2.72k | printRegName(O, Even); \ | 1783 | 2.72k | SStream_concat0(O, ", "); \ | 1784 | 2.72k | printRegName(O, Odd); \ | 1785 | 2.72k | } |
|
1786 | | DEFINE_printGPRSeqPairsClassOperand(32); |
1787 | | DEFINE_printGPRSeqPairsClassOperand(64); |
1788 | | |
1789 | | #define DEFINE_printMatrixIndex(Scale) \ |
1790 | | void CONCAT(printMatrixIndex, Scale)(MCInst * MI, unsigned OpNum, \ |
1791 | | SStream *O) \ |
1792 | 10.5k | { \ |
1793 | 10.5k | AArch64_add_cs_detail_1(MI, CONCAT(AArch64_OP_GROUP_MatrixIndex, Scale), \ |
1794 | 10.5k | OpNum, Scale); \ |
1795 | 10.5k | printInt64(O, Scale *MCOperand_getImm( \ |
1796 | 10.5k | MCInst_getOperand(MI, (OpNum)))); \ |
1797 | 10.5k | } Line | Count | Source | 1792 | 473 | { \ | 1793 | 473 | AArch64_add_cs_detail_1(MI, CONCAT(AArch64_OP_GROUP_MatrixIndex, Scale), \ | 1794 | 473 | OpNum, Scale); \ | 1795 | 473 | printInt64(O, Scale *MCOperand_getImm( \ | 1796 | 473 | MCInst_getOperand(MI, (OpNum)))); \ | 1797 | 473 | } |
Unexecuted instantiation: printMatrixIndex_0 Line | Count | Source | 1792 | 10.0k | { \ | 1793 | 10.0k | AArch64_add_cs_detail_1(MI, CONCAT(AArch64_OP_GROUP_MatrixIndex, Scale), \ | 1794 | 10.0k | OpNum, Scale); \ | 1795 | 10.0k | printInt64(O, Scale *MCOperand_getImm( \ | 1796 | 10.0k | MCInst_getOperand(MI, (OpNum)))); \ | 1797 | 10.0k | } |
|
1798 | | DEFINE_printMatrixIndex(8); |
1799 | | DEFINE_printMatrixIndex(0); |
1800 | | DEFINE_printMatrixIndex(1); |
1801 | | |
1802 | | void printMatrixTileList(MCInst *MI, unsigned OpNum, SStream *O) |
1803 | 581 | { |
1804 | 581 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_MatrixTileList, OpNum); |
1805 | 581 | unsigned MaxRegs = 8; |
1806 | 581 | unsigned RegMask = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
1807 | | |
1808 | 581 | unsigned NumRegs = 0; |
1809 | 5.22k | for (unsigned I = 0; I < MaxRegs; ++I) |
1810 | 4.64k | if ((RegMask & (1 << I)) != 0) |
1811 | 2.69k | ++NumRegs; |
1812 | | |
1813 | 581 | SStream_concat0(O, "{"); |
1814 | 581 | unsigned Printed = 0; |
1815 | 5.22k | for (unsigned I = 0; I < MaxRegs; ++I) { |
1816 | 4.64k | unsigned Reg = RegMask & (1 << I); |
1817 | 4.64k | if (Reg == 0) |
1818 | 1.95k | continue; |
1819 | 2.69k | printRegName(O, AArch64_ZAD0 + I); |
1820 | 2.69k | if (Printed + 1 != NumRegs) |
1821 | 2.13k | SStream_concat0(O, ", "); |
1822 | 2.69k | ++Printed; |
1823 | 2.69k | } |
1824 | 581 | SStream_concat0(O, "}"); |
1825 | 581 | } |
1826 | | |
1827 | | void printVectorList(MCInst *MI, unsigned OpNum, SStream *O, |
1828 | | const char *LayoutSuffix) |
1829 | 59.4k | { |
1830 | 59.4k | unsigned Reg = MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); |
1831 | | |
1832 | 59.4k | SStream_concat0(O, "{ "); |
1833 | | |
1834 | | // Work out how many registers there are in the list (if there is an actual |
1835 | | // list). |
1836 | 59.4k | unsigned NumRegs = 1; |
1837 | 59.4k | if (MCRegisterClass_contains( |
1838 | 59.4k | MCRegisterInfo_getRegClass(MI->MRI, AArch64_DDRegClassID), |
1839 | 59.4k | Reg) || |
1840 | 59.4k | MCRegisterClass_contains( |
1841 | 58.5k | MCRegisterInfo_getRegClass(MI->MRI, AArch64_ZPR2RegClassID), |
1842 | 58.5k | Reg) || |
1843 | 59.4k | MCRegisterClass_contains( |
1844 | 49.1k | MCRegisterInfo_getRegClass(MI->MRI, AArch64_QQRegClassID), |
1845 | 49.1k | Reg) || |
1846 | 59.4k | MCRegisterClass_contains( |
1847 | 42.7k | MCRegisterInfo_getRegClass(MI->MRI, AArch64_PPR2RegClassID), |
1848 | 42.7k | Reg) || |
1849 | 59.4k | MCRegisterClass_contains( |
1850 | 42.4k | MCRegisterInfo_getRegClass(MI->MRI, |
1851 | 42.4k | AArch64_ZPR2StridedRegClassID), |
1852 | 42.4k | Reg)) |
1853 | 18.2k | NumRegs = 2; |
1854 | 41.1k | else if (MCRegisterClass_contains( |
1855 | 41.1k | MCRegisterInfo_getRegClass(MI->MRI, |
1856 | 41.1k | AArch64_DDDRegClassID), |
1857 | 41.1k | Reg) || |
1858 | 41.1k | MCRegisterClass_contains( |
1859 | 39.7k | MCRegisterInfo_getRegClass(MI->MRI, |
1860 | 39.7k | AArch64_ZPR3RegClassID), |
1861 | 39.7k | Reg) || |
1862 | 41.1k | MCRegisterClass_contains( |
1863 | 39.4k | MCRegisterInfo_getRegClass(MI->MRI, |
1864 | 39.4k | AArch64_QQQRegClassID), |
1865 | 39.4k | Reg)) |
1866 | 6.64k | NumRegs = 3; |
1867 | 34.5k | else if (MCRegisterClass_contains( |
1868 | 34.5k | MCRegisterInfo_getRegClass(MI->MRI, |
1869 | 34.5k | AArch64_DDDDRegClassID), |
1870 | 34.5k | Reg) || |
1871 | 34.5k | MCRegisterClass_contains( |
1872 | 33.8k | MCRegisterInfo_getRegClass(MI->MRI, |
1873 | 33.8k | AArch64_ZPR4RegClassID), |
1874 | 33.8k | Reg) || |
1875 | 34.5k | MCRegisterClass_contains( |
1876 | 26.4k | MCRegisterInfo_getRegClass(MI->MRI, |
1877 | 26.4k | AArch64_QQQQRegClassID), |
1878 | 26.4k | Reg) || |
1879 | 34.5k | MCRegisterClass_contains( |
1880 | 19.3k | MCRegisterInfo_getRegClass( |
1881 | 19.3k | MI->MRI, AArch64_ZPR4StridedRegClassID), |
1882 | 19.3k | Reg)) |
1883 | 15.9k | NumRegs = 4; |
1884 | | |
1885 | 59.4k | unsigned Stride = 1; |
1886 | 59.4k | if (MCRegisterClass_contains( |
1887 | 59.4k | MCRegisterInfo_getRegClass(MI->MRI, |
1888 | 59.4k | AArch64_ZPR2StridedRegClassID), |
1889 | 59.4k | Reg)) |
1890 | 1.28k | Stride = 8; |
1891 | 58.1k | else if (MCRegisterClass_contains( |
1892 | 58.1k | MCRegisterInfo_getRegClass( |
1893 | 58.1k | MI->MRI, AArch64_ZPR4StridedRegClassID), |
1894 | 58.1k | Reg)) |
1895 | 807 | Stride = 4; |
1896 | | |
1897 | | // Now forget about the list and find out what the first register is. |
1898 | 59.4k | if (MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_dsub0)) |
1899 | 2.93k | Reg = MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_dsub0); |
1900 | 56.4k | else if (MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_qsub0)) |
1901 | 18.3k | Reg = MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_qsub0); |
1902 | 38.1k | else if (MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_zsub0)) |
1903 | 19.2k | Reg = MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_zsub0); |
1904 | 18.8k | else if (MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_psub0)) |
1905 | 304 | Reg = MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_psub0); |
1906 | | |
1907 | | // If it's a D-reg, we need to promote it to the equivalent Q-reg before |
1908 | | // printing (otherwise getRegisterName fails). |
1909 | 59.4k | if (MCRegisterClass_contains(MCRegisterInfo_getRegClass( |
1910 | 59.4k | MI->MRI, AArch64_FPR64RegClassID), |
1911 | 59.4k | Reg)) { |
1912 | 3.06k | const MCRegisterClass *FPR128RC = MCRegisterInfo_getRegClass( |
1913 | 3.06k | MI->MRI, AArch64_FPR128RegClassID); |
1914 | 3.06k | Reg = MCRegisterInfo_getMatchingSuperReg( |
1915 | 3.06k | MI->MRI, Reg, AArch64_dsub, FPR128RC); |
1916 | 3.06k | } |
1917 | | |
1918 | 59.4k | if ((MCRegisterClass_contains( |
1919 | 59.4k | MCRegisterInfo_getRegClass(MI->MRI, AArch64_ZPRRegClassID), |
1920 | 59.4k | Reg) || |
1921 | 59.4k | MCRegisterClass_contains( |
1922 | 27.9k | MCRegisterInfo_getRegClass(MI->MRI, AArch64_PPRRegClassID), |
1923 | 27.9k | Reg)) && |
1924 | 59.4k | NumRegs > 1 && Stride == 1 && |
1925 | | // Do not print the range when the last register is lower than the |
1926 | | // first. Because it is a wrap-around register. |
1927 | 59.4k | Reg < getNextVectorRegister(Reg, NumRegs - 1)) { |
1928 | 17.1k | printRegName(O, Reg); |
1929 | 17.1k | SStream_concat0(O, LayoutSuffix); |
1930 | 17.1k | if (NumRegs > 1) { |
1931 | | // Set of two sve registers should be separated by ',' |
1932 | 17.1k | const char *split_char = NumRegs == 2 ? ", " : " - "; |
1933 | 17.1k | SStream_concat0(O, split_char); |
1934 | 17.1k | printRegName(O, |
1935 | 17.1k | (getNextVectorRegister(Reg, NumRegs - 1))); |
1936 | 17.1k | SStream_concat0(O, LayoutSuffix); |
1937 | 17.1k | } |
1938 | 42.2k | } else { |
1939 | 131k | for (unsigned i = 0; i < NumRegs; |
1940 | 89.7k | ++i, Reg = getNextVectorRegister(Reg, Stride)) { |
1941 | | // wrap-around sve register |
1942 | 89.7k | if (MCRegisterClass_contains( |
1943 | 89.7k | MCRegisterInfo_getRegClass( |
1944 | 89.7k | MI->MRI, AArch64_ZPRRegClassID), |
1945 | 89.7k | Reg) || |
1946 | 89.7k | MCRegisterClass_contains( |
1947 | 70.6k | MCRegisterInfo_getRegClass( |
1948 | 70.6k | MI->MRI, AArch64_PPRRegClassID), |
1949 | 70.6k | Reg)) |
1950 | 19.1k | printRegName(O, Reg); |
1951 | 70.5k | else |
1952 | 70.5k | printRegNameAlt(O, Reg, AArch64_vreg); |
1953 | 89.7k | SStream_concat0(O, LayoutSuffix); |
1954 | 89.7k | if (i + 1 != NumRegs) |
1955 | 47.5k | SStream_concat0(O, ", "); |
1956 | 89.7k | } |
1957 | 42.2k | } |
1958 | 59.4k | SStream_concat0(O, " }"); |
1959 | 59.4k | } |
1960 | | |
1961 | | void printImplicitlyTypedVectorList(MCInst *MI, unsigned OpNum, SStream *O) |
1962 | 0 | { |
1963 | 0 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_ImplicitlyTypedVectorList, |
1964 | 0 | OpNum); |
1965 | 0 | printVectorList(MI, OpNum, O, ""); |
1966 | 0 | } |
1967 | | |
1968 | | #define DEFINE_printTypedVectorList(NumLanes, LaneKind) \ |
1969 | | void CONCAT(printTypedVectorList, CONCAT(NumLanes, LaneKind))( \ |
1970 | | MCInst * MI, unsigned OpNum, SStream *O) \ |
1971 | 59.4k | { \ |
1972 | 59.4k | AArch64_add_cs_detail_2( \ |
1973 | 59.4k | MI, \ |
1974 | 59.4k | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ |
1975 | 59.4k | NumLanes), \ |
1976 | 59.4k | LaneKind), \ |
1977 | 59.4k | OpNum, NumLanes, CHAR(LaneKind)); \ |
1978 | 59.4k | if (CHAR(LaneKind) == '0') { \ |
1979 | 73 | printVectorList(MI, OpNum, O, ""); \ |
1980 | 73 | return; \ |
1981 | 73 | } \ |
1982 | 59.4k | char Suffix[32]; \ |
1983 | 59.3k | if (NumLanes) \ |
1984 | 59.3k | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ |
1985 | 6.60k | CHAR(LaneKind)); \ |
1986 | 59.3k | else \ |
1987 | 59.3k | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ |
1988 | 52.7k | CHAR(LaneKind)); \ |
1989 | 59.3k | \ |
1990 | 59.3k | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ |
1991 | 59.3k | } Line | Count | Source | 1971 | 12.1k | { \ | 1972 | 12.1k | AArch64_add_cs_detail_2( \ | 1973 | 12.1k | MI, \ | 1974 | 12.1k | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 12.1k | NumLanes), \ | 1976 | 12.1k | LaneKind), \ | 1977 | 12.1k | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 12.1k | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 12.1k | char Suffix[32]; \ | 1983 | 12.1k | if (NumLanes) \ | 1984 | 12.1k | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 0 | CHAR(LaneKind)); \ | 1986 | 12.1k | else \ | 1987 | 12.1k | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 12.1k | CHAR(LaneKind)); \ | 1989 | 12.1k | \ | 1990 | 12.1k | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 12.1k | } |
Line | Count | Source | 1971 | 17.8k | { \ | 1972 | 17.8k | AArch64_add_cs_detail_2( \ | 1973 | 17.8k | MI, \ | 1974 | 17.8k | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 17.8k | NumLanes), \ | 1976 | 17.8k | LaneKind), \ | 1977 | 17.8k | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 17.8k | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 17.8k | char Suffix[32]; \ | 1983 | 17.8k | if (NumLanes) \ | 1984 | 17.8k | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 0 | CHAR(LaneKind)); \ | 1986 | 17.8k | else \ | 1987 | 17.8k | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 17.8k | CHAR(LaneKind)); \ | 1989 | 17.8k | \ | 1990 | 17.8k | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 17.8k | } |
Line | Count | Source | 1971 | 11.7k | { \ | 1972 | 11.7k | AArch64_add_cs_detail_2( \ | 1973 | 11.7k | MI, \ | 1974 | 11.7k | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 11.7k | NumLanes), \ | 1976 | 11.7k | LaneKind), \ | 1977 | 11.7k | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 11.7k | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 11.7k | char Suffix[32]; \ | 1983 | 11.7k | if (NumLanes) \ | 1984 | 11.7k | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 0 | CHAR(LaneKind)); \ | 1986 | 11.7k | else \ | 1987 | 11.7k | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 11.7k | CHAR(LaneKind)); \ | 1989 | 11.7k | \ | 1990 | 11.7k | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 11.7k | } |
Line | Count | Source | 1971 | 9.97k | { \ | 1972 | 9.97k | AArch64_add_cs_detail_2( \ | 1973 | 9.97k | MI, \ | 1974 | 9.97k | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 9.97k | NumLanes), \ | 1976 | 9.97k | LaneKind), \ | 1977 | 9.97k | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 9.97k | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 9.97k | char Suffix[32]; \ | 1983 | 9.97k | if (NumLanes) \ | 1984 | 9.97k | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 0 | CHAR(LaneKind)); \ | 1986 | 9.97k | else \ | 1987 | 9.97k | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 9.97k | CHAR(LaneKind)); \ | 1989 | 9.97k | \ | 1990 | 9.97k | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 9.97k | } |
Line | Count | Source | 1971 | 959 | { \ | 1972 | 959 | AArch64_add_cs_detail_2( \ | 1973 | 959 | MI, \ | 1974 | 959 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 959 | NumLanes), \ | 1976 | 959 | LaneKind), \ | 1977 | 959 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 959 | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 959 | char Suffix[32]; \ | 1983 | 959 | if (NumLanes) \ | 1984 | 959 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 0 | CHAR(LaneKind)); \ | 1986 | 959 | else \ | 1987 | 959 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 959 | CHAR(LaneKind)); \ | 1989 | 959 | \ | 1990 | 959 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 959 | } |
printTypedVectorList_16_b Line | Count | Source | 1971 | 1.54k | { \ | 1972 | 1.54k | AArch64_add_cs_detail_2( \ | 1973 | 1.54k | MI, \ | 1974 | 1.54k | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 1.54k | NumLanes), \ | 1976 | 1.54k | LaneKind), \ | 1977 | 1.54k | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 1.54k | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 1.54k | char Suffix[32]; \ | 1983 | 1.54k | if (NumLanes) \ | 1984 | 1.54k | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 1.54k | CHAR(LaneKind)); \ | 1986 | 1.54k | else \ | 1987 | 1.54k | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 1.54k | \ | 1990 | 1.54k | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 1.54k | } |
Line | Count | Source | 1971 | 825 | { \ | 1972 | 825 | AArch64_add_cs_detail_2( \ | 1973 | 825 | MI, \ | 1974 | 825 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 825 | NumLanes), \ | 1976 | 825 | LaneKind), \ | 1977 | 825 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 825 | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 825 | char Suffix[32]; \ | 1983 | 825 | if (NumLanes) \ | 1984 | 825 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 825 | CHAR(LaneKind)); \ | 1986 | 825 | else \ | 1987 | 825 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 825 | \ | 1990 | 825 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 825 | } |
Line | Count | Source | 1971 | 1.03k | { \ | 1972 | 1.03k | AArch64_add_cs_detail_2( \ | 1973 | 1.03k | MI, \ | 1974 | 1.03k | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 1.03k | NumLanes), \ | 1976 | 1.03k | LaneKind), \ | 1977 | 1.03k | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 1.03k | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 1.03k | char Suffix[32]; \ | 1983 | 1.03k | if (NumLanes) \ | 1984 | 1.03k | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 1.03k | CHAR(LaneKind)); \ | 1986 | 1.03k | else \ | 1987 | 1.03k | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 1.03k | \ | 1990 | 1.03k | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 1.03k | } |
Line | Count | Source | 1971 | 848 | { \ | 1972 | 848 | AArch64_add_cs_detail_2( \ | 1973 | 848 | MI, \ | 1974 | 848 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 848 | NumLanes), \ | 1976 | 848 | LaneKind), \ | 1977 | 848 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 848 | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 848 | char Suffix[32]; \ | 1983 | 848 | if (NumLanes) \ | 1984 | 848 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 848 | CHAR(LaneKind)); \ | 1986 | 848 | else \ | 1987 | 848 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 848 | \ | 1990 | 848 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 848 | } |
Line | Count | Source | 1971 | 838 | { \ | 1972 | 838 | AArch64_add_cs_detail_2( \ | 1973 | 838 | MI, \ | 1974 | 838 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 838 | NumLanes), \ | 1976 | 838 | LaneKind), \ | 1977 | 838 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 838 | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 838 | char Suffix[32]; \ | 1983 | 838 | if (NumLanes) \ | 1984 | 838 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 838 | CHAR(LaneKind)); \ | 1986 | 838 | else \ | 1987 | 838 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 838 | \ | 1990 | 838 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 838 | } |
Line | Count | Source | 1971 | 253 | { \ | 1972 | 253 | AArch64_add_cs_detail_2( \ | 1973 | 253 | MI, \ | 1974 | 253 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 253 | NumLanes), \ | 1976 | 253 | LaneKind), \ | 1977 | 253 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 253 | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 253 | char Suffix[32]; \ | 1983 | 253 | if (NumLanes) \ | 1984 | 253 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 253 | CHAR(LaneKind)); \ | 1986 | 253 | else \ | 1987 | 253 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 253 | \ | 1990 | 253 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 253 | } |
Line | Count | Source | 1971 | 554 | { \ | 1972 | 554 | AArch64_add_cs_detail_2( \ | 1973 | 554 | MI, \ | 1974 | 554 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 554 | NumLanes), \ | 1976 | 554 | LaneKind), \ | 1977 | 554 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 554 | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 554 | char Suffix[32]; \ | 1983 | 554 | if (NumLanes) \ | 1984 | 554 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 554 | CHAR(LaneKind)); \ | 1986 | 554 | else \ | 1987 | 554 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 554 | \ | 1990 | 554 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 554 | } |
Line | Count | Source | 1971 | 702 | { \ | 1972 | 702 | AArch64_add_cs_detail_2( \ | 1973 | 702 | MI, \ | 1974 | 702 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 702 | NumLanes), \ | 1976 | 702 | LaneKind), \ | 1977 | 702 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 702 | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 702 | char Suffix[32]; \ | 1983 | 702 | if (NumLanes) \ | 1984 | 702 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 702 | CHAR(LaneKind)); \ | 1986 | 702 | else \ | 1987 | 702 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 702 | \ | 1990 | 702 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 702 | } |
Line | Count | Source | 1971 | 73 | { \ | 1972 | 73 | AArch64_add_cs_detail_2( \ | 1973 | 73 | MI, \ | 1974 | 73 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 73 | NumLanes), \ | 1976 | 73 | LaneKind), \ | 1977 | 73 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 73 | if (CHAR(LaneKind) == '0') { \ | 1979 | 73 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 73 | return; \ | 1981 | 73 | } \ | 1982 | 73 | char Suffix[32]; \ | 1983 | 0 | if (NumLanes) \ | 1984 | 0 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 0 | CHAR(LaneKind)); \ | 1986 | 0 | else \ | 1987 | 0 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 0 | \ | 1990 | 0 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 0 | } |
|
1992 | | DEFINE_printTypedVectorList(0, b); |
1993 | | DEFINE_printTypedVectorList(0, d); |
1994 | | DEFINE_printTypedVectorList(0, h); |
1995 | | DEFINE_printTypedVectorList(0, s); |
1996 | | DEFINE_printTypedVectorList(0, q); |
1997 | | DEFINE_printTypedVectorList(16, b); |
1998 | | DEFINE_printTypedVectorList(1, d); |
1999 | | DEFINE_printTypedVectorList(2, d); |
2000 | | DEFINE_printTypedVectorList(2, s); |
2001 | | DEFINE_printTypedVectorList(4, h); |
2002 | | DEFINE_printTypedVectorList(4, s); |
2003 | | DEFINE_printTypedVectorList(8, b); |
2004 | | DEFINE_printTypedVectorList(8, h); |
2005 | | DEFINE_printTypedVectorList(0, 0); |
2006 | | |
2007 | | #define DEFINE_printVectorIndex(Scale) \ |
2008 | | void CONCAT(printVectorIndex, Scale)(MCInst * MI, unsigned OpNum, \ |
2009 | | SStream *O) \ |
2010 | 36.2k | { \ |
2011 | 36.2k | AArch64_add_cs_detail_1( \ |
2012 | 36.2k | MI, CONCAT(AArch64_OP_GROUP_VectorIndex, Scale), \ |
2013 | 36.2k | OpNum, Scale); \ |
2014 | 36.2k | SStream_concat(O, "%s", "["); \ |
2015 | 36.2k | printUInt64(O, Scale *MCOperand_getImm( \ |
2016 | 36.2k | MCInst_getOperand(MI, (OpNum)))); \ |
2017 | 36.2k | SStream_concat0(O, "]"); \ |
2018 | 36.2k | } Line | Count | Source | 2010 | 36.2k | { \ | 2011 | 36.2k | AArch64_add_cs_detail_1( \ | 2012 | 36.2k | MI, CONCAT(AArch64_OP_GROUP_VectorIndex, Scale), \ | 2013 | 36.2k | OpNum, Scale); \ | 2014 | 36.2k | SStream_concat(O, "%s", "["); \ | 2015 | 36.2k | printUInt64(O, Scale *MCOperand_getImm( \ | 2016 | 36.2k | MCInst_getOperand(MI, (OpNum)))); \ | 2017 | 36.2k | SStream_concat0(O, "]"); \ | 2018 | 36.2k | } |
Unexecuted instantiation: printVectorIndex_8 |
2019 | | DEFINE_printVectorIndex(1); |
2020 | | DEFINE_printVectorIndex(8); |
2021 | | |
2022 | | void printAlignedLabel(MCInst *MI, uint64_t Address, unsigned OpNum, SStream *O) |
2023 | 13.5k | { |
2024 | 13.5k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_AlignedLabel, OpNum); |
2025 | 13.5k | MCOperand *Op = MCInst_getOperand(MI, (OpNum)); |
2026 | | |
2027 | | // If the label has already been resolved to an immediate offset (say, when |
2028 | | // we're running the disassembler), just print the immediate. |
2029 | 13.5k | if (MCOperand_isImm(Op)) { |
2030 | 13.3k | SStream_concat0(O, markup("<imm:")); |
2031 | 13.3k | int64_t Offset = MCOperand_getImm(Op) * 4; |
2032 | 13.3k | if (MI->csh->PrintBranchImmAsAddress) |
2033 | 13.3k | printUInt64(O, (Address + Offset)); |
2034 | 0 | else { |
2035 | 0 | printUInt64Bang(O, (Offset)); |
2036 | 0 | } |
2037 | 13.3k | SStream_concat0(O, markup(">")); |
2038 | 13.3k | return; |
2039 | 13.3k | } |
2040 | | |
2041 | 211 | printUInt64Bang(O, MCOperand_getImm(Op)); |
2042 | 211 | } |
2043 | | |
2044 | | void printAdrLabel(MCInst *MI, uint64_t Address, unsigned OpNum, SStream *O) |
2045 | 0 | { |
2046 | 0 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_AdrLabel, OpNum); |
2047 | 0 | MCOperand *Op = MCInst_getOperand(MI, (OpNum)); |
2048 | | |
2049 | | // If the label has already been resolved to an immediate offset (say, when |
2050 | | // we're running the disassembler), just print the immediate. |
2051 | 0 | if (MCOperand_isImm(Op)) { |
2052 | 0 | const int64_t Offset = MCOperand_getImm(Op); |
2053 | 0 | SStream_concat0(O, markup("<imm:")); |
2054 | 0 | if (MI->csh->PrintBranchImmAsAddress) |
2055 | 0 | printUInt64(O, ((Address & -4) + Offset)); |
2056 | 0 | else { |
2057 | 0 | printUInt64Bang(O, Offset); |
2058 | 0 | } |
2059 | 0 | SStream_concat0(O, markup(">")); |
2060 | 0 | return; |
2061 | 0 | } |
2062 | | |
2063 | 0 | printUInt64Bang(O, MCOperand_getImm(Op)); |
2064 | 0 | } |
2065 | | |
2066 | | void printAdrpLabel(MCInst *MI, uint64_t Address, unsigned OpNum, SStream *O) |
2067 | 0 | { |
2068 | 0 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_AdrpLabel, OpNum); |
2069 | 0 | MCOperand *Op = MCInst_getOperand(MI, (OpNum)); |
2070 | | |
2071 | | // If the label has already been resolved to an immediate offset (say, when |
2072 | | // we're running the disassembler), just print the immediate. |
2073 | 0 | if (MCOperand_isImm(Op)) { |
2074 | 0 | const int64_t Offset = MCOperand_getImm(Op) * 4096; |
2075 | 0 | SStream_concat0(O, markup("<imm:")); |
2076 | 0 | if (MI->csh->PrintBranchImmAsAddress) |
2077 | 0 | printUInt64(O, ((Address & -4096) + Offset)); |
2078 | 0 | else { |
2079 | 0 | printUInt64Bang(O, Offset); |
2080 | 0 | } |
2081 | 0 | SStream_concat0(O, markup(">")); |
2082 | 0 | return; |
2083 | 0 | } |
2084 | | |
2085 | 0 | printUInt64Bang(O, MCOperand_getImm(Op)); |
2086 | 0 | } |
2087 | | |
2088 | 5.10k | void printAdrAdrpLabel(MCInst *MI, uint64_t Address, unsigned OpNum, SStream *O) { |
2089 | 5.10k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_AdrAdrpLabel, OpNum); |
2090 | 5.10k | MCOperand *Op = MCInst_getOperand(MI, (OpNum)); |
2091 | | |
2092 | | // If the label has already been resolved to an immediate offset (say, when |
2093 | | // we're running the disassembler), just print the immediate. |
2094 | 5.10k | if (MCOperand_isImm(Op)) { |
2095 | 5.10k | int64_t Offset = MCOperand_getImm(Op); |
2096 | 5.10k | if (MCInst_getOpcode(MI) == AArch64_ADRP) { |
2097 | 2.74k | Offset = Offset * 4096; |
2098 | 2.74k | Address = Address & -4096; |
2099 | 2.74k | } |
2100 | 5.10k | SStream_concat0(O, markup(">")); |
2101 | 5.10k | if (MI->csh->PrintBranchImmAsAddress) |
2102 | 5.10k | printUInt64(O, (Address + Offset)); |
2103 | 0 | else { |
2104 | 0 | printUInt64Bang(O, Offset); |
2105 | 0 | } |
2106 | 5.10k | SStream_concat0(O, markup(">")); |
2107 | 5.10k | return; |
2108 | 5.10k | } |
2109 | | |
2110 | 0 | printUInt64Bang(O, MCOperand_getImm(Op)); |
2111 | 0 | } |
2112 | | |
2113 | | /// Not part of upstream LLVM. |
2114 | | /// Just prints the barrier options as documented in |
2115 | | /// https://github.com/AsahiLinux/docs/blob/main/docs/hw/cpu/apple-instructions.md |
2116 | | void printAppleSysBarrierOption(MCInst *MI, unsigned OpNo, SStream *O) |
2117 | 184 | { |
2118 | 184 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_AppleSysBarrierOption, OpNo); |
2119 | 184 | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); |
2120 | 184 | switch (Val) { |
2121 | 40 | default: |
2122 | 40 | SStream_concat0(O, "<undefined>"); |
2123 | 40 | break; |
2124 | 0 | case 0: |
2125 | 0 | SStream_concat0(O, "osh"); |
2126 | 0 | break; |
2127 | 134 | case 1: |
2128 | 134 | SStream_concat0(O, "nsh"); |
2129 | 134 | break; |
2130 | 7 | case 2: |
2131 | 7 | SStream_concat0(O, "ish"); |
2132 | 7 | break; |
2133 | 3 | case 3: |
2134 | 3 | SStream_concat0(O, "sy"); |
2135 | 3 | break; |
2136 | 184 | } |
2137 | 184 | } |
2138 | | |
2139 | | void printBarrierOption(MCInst *MI, unsigned OpNo, SStream *O) |
2140 | 135 | { |
2141 | 135 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_BarrierOption, OpNo); |
2142 | 135 | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); |
2143 | 135 | unsigned Opcode = MCInst_getOpcode(MI); |
2144 | | |
2145 | 135 | const char *Name; |
2146 | 135 | if (Opcode == AArch64_ISB) { |
2147 | 17 | const AArch64ISB_ISB *ISB = AArch64ISB_lookupISBByEncoding(Val); |
2148 | 17 | Name = ISB ? ISB->Name : ""; |
2149 | 118 | } else if (Opcode == AArch64_TSB) { |
2150 | 37 | const AArch64TSB_TSB *TSB = AArch64TSB_lookupTSBByEncoding(Val); |
2151 | 37 | Name = TSB ? TSB->Name : ""; |
2152 | 81 | } else { |
2153 | 81 | const AArch64DB_DB *DB = AArch64DB_lookupDBByEncoding(Val); |
2154 | 81 | Name = DB ? DB->Name : ""; |
2155 | 81 | } |
2156 | 135 | if (Name[0] != '\0') |
2157 | 79 | SStream_concat0(O, Name); |
2158 | 56 | else { |
2159 | 56 | SStream_concat(O, "%s", markup("<imm:")); |
2160 | 56 | printUInt32Bang(O, Val); |
2161 | 56 | SStream_concat0(O, markup(">")); |
2162 | 56 | } |
2163 | 135 | } |
2164 | | |
2165 | | void printBarriernXSOption(MCInst *MI, unsigned OpNo, SStream *O) |
2166 | 96 | { |
2167 | 96 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_BarriernXSOption, OpNo); |
2168 | 96 | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); |
2169 | | |
2170 | 96 | const char *Name; |
2171 | 96 | const AArch64DBnXS_DBnXS *DB = AArch64DBnXS_lookupDBnXSByEncoding(Val); |
2172 | 96 | Name = DB ? DB->Name : ""; |
2173 | | |
2174 | 96 | if (Name[0] != '\0') |
2175 | 96 | SStream_concat0(O, Name); |
2176 | 0 | else { |
2177 | 0 | SStream_concat(O, "%s%s%s", markup("<imm:"), "#", Val); |
2178 | 0 | SStream_concat0(O, markup(">")); |
2179 | 0 | } |
2180 | 96 | } |
2181 | | |
2182 | | static bool isValidSysReg(const AArch64SysReg_SysReg *Reg, bool Read, |
2183 | | unsigned mode) |
2184 | 7.83k | { |
2185 | 7.83k | return (Reg && (Read ? Reg->Readable : Reg->Writeable) && |
2186 | 7.83k | AArch64_testFeatureList(mode, Reg->FeaturesRequired)); |
2187 | 7.83k | } |
2188 | | |
2189 | | // Looks up a system register either by encoding or by name. Some system |
2190 | | // registers share the same encoding between different architectures, |
2191 | | // therefore a tablegen lookup by encoding will return an entry regardless |
2192 | | // of the register's predication on a specific subtarget feature. To work |
2193 | | // around this problem we keep an alternative name for such registers and |
2194 | | // look them up by that name if the first lookup was unsuccessful. |
2195 | | static const AArch64SysReg_SysReg *lookupSysReg(unsigned Val, bool Read, |
2196 | | unsigned mode) |
2197 | 6.43k | { |
2198 | 6.43k | const AArch64SysReg_SysReg *Reg = |
2199 | 6.43k | AArch64SysReg_lookupSysRegByEncoding(Val); |
2200 | | |
2201 | 6.43k | if (Reg && !isValidSysReg(Reg, Read, mode)) |
2202 | 1.15k | Reg = AArch64SysReg_lookupSysRegByName(Reg->AltName); |
2203 | | |
2204 | 6.43k | return Reg; |
2205 | 6.43k | } |
2206 | | |
2207 | | void printMRSSystemRegister(MCInst *MI, unsigned OpNo, SStream *O) |
2208 | 2.04k | { |
2209 | 2.04k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_MRSSystemRegister, OpNo); |
2210 | 2.04k | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); |
2211 | | |
2212 | | // Horrible hack for the one register that has identical encodings but |
2213 | | // different names in MSR and MRS. Because of this, one of MRS and MSR is |
2214 | | // going to get the wrong entry |
2215 | 2.04k | if (Val == AARCH64_SYSREG_DBGDTRRX_EL0) { |
2216 | 71 | SStream_concat0(O, "DBGDTRRX_EL0"); |
2217 | 71 | return; |
2218 | 71 | } |
2219 | | |
2220 | | // Horrible hack for two different registers having the same encoding. |
2221 | 1.97k | if (Val == AARCH64_SYSREG_TRCEXTINSELR) { |
2222 | 34 | SStream_concat0(O, "TRCEXTINSELR"); |
2223 | 34 | return; |
2224 | 34 | } |
2225 | | |
2226 | 1.93k | const AArch64SysReg_SysReg *Reg = |
2227 | 1.93k | lookupSysReg(Val, true /*Read*/, MI->csh->mode); |
2228 | | |
2229 | 1.93k | if (isValidSysReg(Reg, true /*Read*/, MI->csh->mode)) |
2230 | 161 | SStream_concat0(O, Reg->Name); |
2231 | 1.77k | else { |
2232 | 1.77k | char result[AARCH64_GRS_LEN + 1] = { 0 }; |
2233 | 1.77k | AArch64SysReg_genericRegisterString(Val, result); |
2234 | 1.77k | SStream_concat0(O, result); |
2235 | 1.77k | } |
2236 | 1.93k | } |
2237 | | |
2238 | | void printMSRSystemRegister(MCInst *MI, unsigned OpNo, SStream *O) |
2239 | 4.61k | { |
2240 | 4.61k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_MSRSystemRegister, OpNo); |
2241 | 4.61k | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); |
2242 | | |
2243 | | // Horrible hack for the one register that has identical encodings but |
2244 | | // different names in MSR and MRS. Because of this, one of MRS and MSR is |
2245 | | // going to get the wrong entry |
2246 | 4.61k | if (Val == AARCH64_SYSREG_DBGDTRTX_EL0) { |
2247 | 104 | SStream_concat0(O, "DBGDTRTX_EL0"); |
2248 | 104 | return; |
2249 | 104 | } |
2250 | | |
2251 | | // Horrible hack for two different registers having the same encoding. |
2252 | 4.51k | if (Val == AARCH64_SYSREG_TRCEXTINSELR) { |
2253 | 19 | SStream_concat0(O, "TRCEXTINSELR"); |
2254 | 19 | return; |
2255 | 19 | } |
2256 | | |
2257 | 4.49k | const AArch64SysReg_SysReg *Reg = |
2258 | 4.49k | lookupSysReg(Val, false /*Read*/, MI->csh->mode); |
2259 | | |
2260 | 4.49k | if (isValidSysReg(Reg, false /*Read*/, MI->csh->mode)) |
2261 | 97 | SStream_concat0(O, Reg->Name); |
2262 | 4.39k | else { |
2263 | 4.39k | char result[AARCH64_GRS_LEN + 1] = { 0 }; |
2264 | 4.39k | AArch64SysReg_genericRegisterString(Val, result); |
2265 | 4.39k | SStream_concat0(O, result); |
2266 | 4.39k | } |
2267 | 4.49k | } |
2268 | | |
2269 | | void printSystemPStateField(MCInst *MI, unsigned OpNo, SStream *O) |
2270 | 1.27k | { |
2271 | 1.27k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_SystemPStateField, OpNo); |
2272 | 1.27k | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); |
2273 | | |
2274 | 1.27k | const AArch64PState_PStateImm0_15 *PStateImm15 = |
2275 | 1.27k | AArch64PState_lookupPStateImm0_15ByEncoding(Val); |
2276 | 1.27k | const AArch64PState_PStateImm0_1 *PStateImm1 = |
2277 | 1.27k | AArch64PState_lookupPStateImm0_1ByEncoding(Val); |
2278 | 1.27k | if (PStateImm15 && |
2279 | 1.27k | AArch64_testFeatureList(MI->csh->mode, |
2280 | 1.20k | PStateImm15->FeaturesRequired)) |
2281 | 1.20k | SStream_concat0(O, PStateImm15->Name); |
2282 | 68 | else if (PStateImm1 && |
2283 | 68 | AArch64_testFeatureList(MI->csh->mode, |
2284 | 68 | PStateImm1->FeaturesRequired)) |
2285 | 68 | SStream_concat0(O, PStateImm1->Name); |
2286 | 0 | else { |
2287 | 0 | printUInt32Bang(O, (Val)); |
2288 | 0 | SStream_concat1(O, '\0'); |
2289 | 0 | } |
2290 | 1.27k | } |
2291 | | |
2292 | | void printSIMDType10Operand(MCInst *MI, unsigned OpNo, SStream *O) |
2293 | 1.55k | { |
2294 | 1.55k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_SIMDType10Operand, OpNo); |
2295 | 1.55k | unsigned RawVal = MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); |
2296 | 1.55k | uint64_t Val = AArch64_AM_decodeAdvSIMDModImmType10(RawVal); |
2297 | 1.55k | SStream_concat(O, "%s#%#016llx", markup("<imm:"), Val); |
2298 | 1.55k | SStream_concat0(O, markup(">")); |
2299 | 1.55k | } |
2300 | | |
2301 | | #define DEFINE_printComplexRotationOp(Angle, Remainder) \ |
2302 | | static void CONCAT(printComplexRotationOp, CONCAT(Angle, Remainder))( \ |
2303 | | MCInst * MI, unsigned OpNo, SStream *O) \ |
2304 | 2.65k | { \ |
2305 | 2.65k | AArch64_add_cs_detail_2( \ |
2306 | 2.65k | MI, \ |
2307 | 2.65k | CONCAT(CONCAT(AArch64_OP_GROUP_ComplexRotationOp, \ |
2308 | 2.65k | Angle), \ |
2309 | 2.65k | Remainder), \ |
2310 | 2.65k | OpNo, Angle, Remainder); \ |
2311 | 2.65k | unsigned Val = \ |
2312 | 2.65k | MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); \ |
2313 | 2.65k | SStream_concat(O, "%s", markup("<imm:")); \ |
2314 | 2.65k | SStream_concat(O, "#%d", (Val * Angle) + Remainder); \ |
2315 | 2.65k | SStream_concat0(O, markup(">")); \ |
2316 | 2.65k | } AArch64InstPrinter.c:printComplexRotationOp_180_90 Line | Count | Source | 2304 | 600 | { \ | 2305 | 600 | AArch64_add_cs_detail_2( \ | 2306 | 600 | MI, \ | 2307 | 600 | CONCAT(CONCAT(AArch64_OP_GROUP_ComplexRotationOp, \ | 2308 | 600 | Angle), \ | 2309 | 600 | Remainder), \ | 2310 | 600 | OpNo, Angle, Remainder); \ | 2311 | 600 | unsigned Val = \ | 2312 | 600 | MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); \ | 2313 | 600 | SStream_concat(O, "%s", markup("<imm:")); \ | 2314 | 600 | SStream_concat(O, "#%d", (Val * Angle) + Remainder); \ | 2315 | 600 | SStream_concat0(O, markup(">")); \ | 2316 | 600 | } |
AArch64InstPrinter.c:printComplexRotationOp_90_0 Line | Count | Source | 2304 | 2.05k | { \ | 2305 | 2.05k | AArch64_add_cs_detail_2( \ | 2306 | 2.05k | MI, \ | 2307 | 2.05k | CONCAT(CONCAT(AArch64_OP_GROUP_ComplexRotationOp, \ | 2308 | 2.05k | Angle), \ | 2309 | 2.05k | Remainder), \ | 2310 | 2.05k | OpNo, Angle, Remainder); \ | 2311 | 2.05k | unsigned Val = \ | 2312 | 2.05k | MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); \ | 2313 | 2.05k | SStream_concat(O, "%s", markup("<imm:")); \ | 2314 | 2.05k | SStream_concat(O, "#%d", (Val * Angle) + Remainder); \ | 2315 | 2.05k | SStream_concat0(O, markup(">")); \ | 2316 | 2.05k | } |
|
2317 | | DEFINE_printComplexRotationOp(180, 90); |
2318 | | DEFINE_printComplexRotationOp(90, 0); |
2319 | | |
2320 | | void printSVEPattern(MCInst *MI, unsigned OpNum, SStream *O) |
2321 | 6.80k | { |
2322 | 6.80k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_SVEPattern, OpNum); |
2323 | 6.80k | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
2324 | 6.80k | const AArch64SVEPredPattern_SVEPREDPAT *Pat = |
2325 | 6.80k | AArch64SVEPredPattern_lookupSVEPREDPATByEncoding(Val); |
2326 | 6.80k | if (Pat) |
2327 | 4.65k | SStream_concat0(O, Pat->Name); |
2328 | 2.15k | else |
2329 | 2.15k | printUInt32Bang(O, Val); |
2330 | 6.80k | } |
2331 | | |
2332 | | void printSVEVecLenSpecifier(MCInst *MI, unsigned OpNum, SStream *O) |
2333 | 1.61k | { |
2334 | 1.61k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_SVEVecLenSpecifier, OpNum); |
2335 | 1.61k | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
2336 | | // Pattern has only 1 bit |
2337 | 1.61k | if (Val > 1) |
2338 | 0 | CS_ASSERT_RET(0 && "Invalid vector length specifier"); |
2339 | 1.61k | const AArch64SVEVecLenSpecifier_SVEVECLENSPECIFIER *Pat = |
2340 | 1.61k | AArch64SVEVecLenSpecifier_lookupSVEVECLENSPECIFIERByEncoding( |
2341 | 1.61k | Val); |
2342 | 1.61k | if (Pat) |
2343 | 1.61k | SStream_concat0(O, Pat->Name); |
2344 | 1.61k | } |
2345 | | |
2346 | | #define DEFINE_printSVERegOp(suffix) \ |
2347 | | void CONCAT(printSVERegOp, suffix)(MCInst * MI, unsigned OpNum, \ |
2348 | | SStream *O) \ |
2349 | 170k | { \ |
2350 | 170k | AArch64_add_cs_detail_1( \ |
2351 | 170k | MI, CONCAT(AArch64_OP_GROUP_SVERegOp, suffix), OpNum, \ |
2352 | 170k | CHAR(suffix)); \ |
2353 | 170k | switch (CHAR(suffix)) { \ |
2354 | 48.1k | case '0': \ |
2355 | 80.4k | case 'b': \ |
2356 | 111k | case 'h': \ |
2357 | 140k | case 's': \ |
2358 | 168k | case 'd': \ |
2359 | 170k | case 'q': \ |
2360 | 170k | break; \ |
2361 | 168k | default: \ |
2362 | 0 | CS_ASSERT_RET(0 && "Invalid kind specifier."); \ |
2363 | 170k | } \ |
2364 | 170k | \ |
2365 | 170k | unsigned Reg = \ |
2366 | 170k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ |
2367 | 170k | printRegName(O, Reg); \ |
2368 | 170k | if (CHAR(suffix) != '0') { \ |
2369 | 122k | SStream_concat1(O, '.'); \ |
2370 | 122k | SStream_concat1(O, CHAR(suffix)); \ |
2371 | 122k | } \ |
2372 | 170k | } Line | Count | Source | 2349 | 32.2k | { \ | 2350 | 32.2k | AArch64_add_cs_detail_1( \ | 2351 | 32.2k | MI, CONCAT(AArch64_OP_GROUP_SVERegOp, suffix), OpNum, \ | 2352 | 32.2k | CHAR(suffix)); \ | 2353 | 32.2k | switch (CHAR(suffix)) { \ | 2354 | 0 | case '0': \ | 2355 | 32.2k | case 'b': \ | 2356 | 32.2k | case 'h': \ | 2357 | 32.2k | case 's': \ | 2358 | 32.2k | case 'd': \ | 2359 | 32.2k | case 'q': \ | 2360 | 32.2k | break; \ | 2361 | 32.2k | default: \ | 2362 | 0 | CS_ASSERT_RET(0 && "Invalid kind specifier."); \ | 2363 | 32.2k | } \ | 2364 | 32.2k | \ | 2365 | 32.2k | unsigned Reg = \ | 2366 | 32.2k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2367 | 32.2k | printRegName(O, Reg); \ | 2368 | 32.2k | if (CHAR(suffix) != '0') { \ | 2369 | 32.2k | SStream_concat1(O, '.'); \ | 2370 | 32.2k | SStream_concat1(O, CHAR(suffix)); \ | 2371 | 32.2k | } \ | 2372 | 32.2k | } |
Line | Count | Source | 2349 | 28.2k | { \ | 2350 | 28.2k | AArch64_add_cs_detail_1( \ | 2351 | 28.2k | MI, CONCAT(AArch64_OP_GROUP_SVERegOp, suffix), OpNum, \ | 2352 | 28.2k | CHAR(suffix)); \ | 2353 | 28.2k | switch (CHAR(suffix)) { \ | 2354 | 0 | case '0': \ | 2355 | 0 | case 'b': \ | 2356 | 0 | case 'h': \ | 2357 | 0 | case 's': \ | 2358 | 28.2k | case 'd': \ | 2359 | 28.2k | case 'q': \ | 2360 | 28.2k | break; \ | 2361 | 28.2k | default: \ | 2362 | 0 | CS_ASSERT_RET(0 && "Invalid kind specifier."); \ | 2363 | 28.2k | } \ | 2364 | 28.2k | \ | 2365 | 28.2k | unsigned Reg = \ | 2366 | 28.2k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2367 | 28.2k | printRegName(O, Reg); \ | 2368 | 28.2k | if (CHAR(suffix) != '0') { \ | 2369 | 28.2k | SStream_concat1(O, '.'); \ | 2370 | 28.2k | SStream_concat1(O, CHAR(suffix)); \ | 2371 | 28.2k | } \ | 2372 | 28.2k | } |
Line | Count | Source | 2349 | 31.1k | { \ | 2350 | 31.1k | AArch64_add_cs_detail_1( \ | 2351 | 31.1k | MI, CONCAT(AArch64_OP_GROUP_SVERegOp, suffix), OpNum, \ | 2352 | 31.1k | CHAR(suffix)); \ | 2353 | 31.1k | switch (CHAR(suffix)) { \ | 2354 | 0 | case '0': \ | 2355 | 0 | case 'b': \ | 2356 | 31.1k | case 'h': \ | 2357 | 31.1k | case 's': \ | 2358 | 31.1k | case 'd': \ | 2359 | 31.1k | case 'q': \ | 2360 | 31.1k | break; \ | 2361 | 31.1k | default: \ | 2362 | 0 | CS_ASSERT_RET(0 && "Invalid kind specifier."); \ | 2363 | 31.1k | } \ | 2364 | 31.1k | \ | 2365 | 31.1k | unsigned Reg = \ | 2366 | 31.1k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2367 | 31.1k | printRegName(O, Reg); \ | 2368 | 31.1k | if (CHAR(suffix) != '0') { \ | 2369 | 31.1k | SStream_concat1(O, '.'); \ | 2370 | 31.1k | SStream_concat1(O, CHAR(suffix)); \ | 2371 | 31.1k | } \ | 2372 | 31.1k | } |
Line | Count | Source | 2349 | 28.5k | { \ | 2350 | 28.5k | AArch64_add_cs_detail_1( \ | 2351 | 28.5k | MI, CONCAT(AArch64_OP_GROUP_SVERegOp, suffix), OpNum, \ | 2352 | 28.5k | CHAR(suffix)); \ | 2353 | 28.5k | switch (CHAR(suffix)) { \ | 2354 | 0 | case '0': \ | 2355 | 0 | case 'b': \ | 2356 | 0 | case 'h': \ | 2357 | 28.5k | case 's': \ | 2358 | 28.5k | case 'd': \ | 2359 | 28.5k | case 'q': \ | 2360 | 28.5k | break; \ | 2361 | 28.5k | default: \ | 2362 | 0 | CS_ASSERT_RET(0 && "Invalid kind specifier."); \ | 2363 | 28.5k | } \ | 2364 | 28.5k | \ | 2365 | 28.5k | unsigned Reg = \ | 2366 | 28.5k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2367 | 28.5k | printRegName(O, Reg); \ | 2368 | 28.5k | if (CHAR(suffix) != '0') { \ | 2369 | 28.5k | SStream_concat1(O, '.'); \ | 2370 | 28.5k | SStream_concat1(O, CHAR(suffix)); \ | 2371 | 28.5k | } \ | 2372 | 28.5k | } |
Line | Count | Source | 2349 | 48.1k | { \ | 2350 | 48.1k | AArch64_add_cs_detail_1( \ | 2351 | 48.1k | MI, CONCAT(AArch64_OP_GROUP_SVERegOp, suffix), OpNum, \ | 2352 | 48.1k | CHAR(suffix)); \ | 2353 | 48.1k | switch (CHAR(suffix)) { \ | 2354 | 48.1k | case '0': \ | 2355 | 48.1k | case 'b': \ | 2356 | 48.1k | case 'h': \ | 2357 | 48.1k | case 's': \ | 2358 | 48.1k | case 'd': \ | 2359 | 48.1k | case 'q': \ | 2360 | 48.1k | break; \ | 2361 | 48.1k | default: \ | 2362 | 0 | CS_ASSERT_RET(0 && "Invalid kind specifier."); \ | 2363 | 48.1k | } \ | 2364 | 48.1k | \ | 2365 | 48.1k | unsigned Reg = \ | 2366 | 48.1k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2367 | 48.1k | printRegName(O, Reg); \ | 2368 | 48.1k | if (CHAR(suffix) != '0') { \ | 2369 | 0 | SStream_concat1(O, '.'); \ | 2370 | 0 | SStream_concat1(O, CHAR(suffix)); \ | 2371 | 0 | } \ | 2372 | 48.1k | } |
Line | Count | Source | 2349 | 2.02k | { \ | 2350 | 2.02k | AArch64_add_cs_detail_1( \ | 2351 | 2.02k | MI, CONCAT(AArch64_OP_GROUP_SVERegOp, suffix), OpNum, \ | 2352 | 2.02k | CHAR(suffix)); \ | 2353 | 2.02k | switch (CHAR(suffix)) { \ | 2354 | 0 | case '0': \ | 2355 | 0 | case 'b': \ | 2356 | 0 | case 'h': \ | 2357 | 0 | case 's': \ | 2358 | 0 | case 'd': \ | 2359 | 2.02k | case 'q': \ | 2360 | 2.02k | break; \ | 2361 | 0 | default: \ | 2362 | 0 | CS_ASSERT_RET(0 && "Invalid kind specifier."); \ | 2363 | 2.02k | } \ | 2364 | 2.02k | \ | 2365 | 2.02k | unsigned Reg = \ | 2366 | 2.02k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2367 | 2.02k | printRegName(O, Reg); \ | 2368 | 2.02k | if (CHAR(suffix) != '0') { \ | 2369 | 2.02k | SStream_concat1(O, '.'); \ | 2370 | 2.02k | SStream_concat1(O, CHAR(suffix)); \ | 2371 | 2.02k | } \ | 2372 | 2.02k | } |
|
2373 | | DEFINE_printSVERegOp(b); |
2374 | | DEFINE_printSVERegOp(d); |
2375 | | DEFINE_printSVERegOp(h); |
2376 | | DEFINE_printSVERegOp(s); |
2377 | | DEFINE_printSVERegOp(0); |
2378 | | DEFINE_printSVERegOp(q); |
2379 | | |
2380 | | #define DECLARE_printImmSVE_S32(T) \ |
2381 | | void CONCAT(printImmSVE, T)(T Val, SStream * O) \ |
2382 | 2.64k | { \ |
2383 | 2.64k | printInt32Bang(O, Val); \ |
2384 | 2.64k | } Line | Count | Source | 2382 | 1.14k | { \ | 2383 | 1.14k | printInt32Bang(O, Val); \ | 2384 | 1.14k | } |
Line | Count | Source | 2382 | 298 | { \ | 2383 | 298 | printInt32Bang(O, Val); \ | 2384 | 298 | } |
Line | Count | Source | 2382 | 1.19k | { \ | 2383 | 1.19k | printInt32Bang(O, Val); \ | 2384 | 1.19k | } |
|
2385 | | DECLARE_printImmSVE_S32(int16_t); |
2386 | | DECLARE_printImmSVE_S32(int8_t); |
2387 | | DECLARE_printImmSVE_S32(int32_t); |
2388 | | |
2389 | | #define DECLARE_printImmSVE_U32(T) \ |
2390 | | void CONCAT(printImmSVE, T)(T Val, SStream * O) \ |
2391 | 1.27k | { \ |
2392 | 1.27k | printUInt32Bang(O, Val); \ |
2393 | 1.27k | } Line | Count | Source | 2391 | 425 | { \ | 2392 | 425 | printUInt32Bang(O, Val); \ | 2393 | 425 | } |
Line | Count | Source | 2391 | 126 | { \ | 2392 | 126 | printUInt32Bang(O, Val); \ | 2393 | 126 | } |
Line | Count | Source | 2391 | 726 | { \ | 2392 | 726 | printUInt32Bang(O, Val); \ | 2393 | 726 | } |
|
2394 | | DECLARE_printImmSVE_U32(uint16_t); |
2395 | | DECLARE_printImmSVE_U32(uint8_t); |
2396 | | DECLARE_printImmSVE_U32(uint32_t); |
2397 | | |
2398 | | #define DECLARE_printImmSVE_S64(T) \ |
2399 | | void CONCAT(printImmSVE, T)(T Val, SStream * O) \ |
2400 | 429 | { \ |
2401 | 429 | printInt64Bang(O, Val); \ |
2402 | 429 | } |
2403 | | DECLARE_printImmSVE_S64(int64_t); |
2404 | | |
2405 | | #define DECLARE_printImmSVE_U64(T) \ |
2406 | | void CONCAT(printImmSVE, T)(T Val, SStream * O) \ |
2407 | 441 | { \ |
2408 | 441 | printUInt64Bang(O, Val); \ |
2409 | 441 | } |
2410 | | DECLARE_printImmSVE_U64(uint64_t); |
2411 | | |
2412 | | #define DEFINE_isSignedType(T) \ |
2413 | | static inline bool CONCAT(isSignedType, T)() \ |
2414 | 3.16k | { \ |
2415 | 3.16k | return CHAR(T) == 'i'; \ |
2416 | 3.16k | } AArch64InstPrinter.c:isSignedType_int16_t Line | Count | Source | 2414 | 542 | { \ | 2415 | 542 | return CHAR(T) == 'i'; \ | 2416 | 542 | } |
AArch64InstPrinter.c:isSignedType_int8_t Line | Count | Source | 2414 | 298 | { \ | 2415 | 298 | return CHAR(T) == 'i'; \ | 2416 | 298 | } |
AArch64InstPrinter.c:isSignedType_int64_t Line | Count | Source | 2414 | 287 | { \ | 2415 | 287 | return CHAR(T) == 'i'; \ | 2416 | 287 | } |
AArch64InstPrinter.c:isSignedType_int32_t Line | Count | Source | 2414 | 316 | { \ | 2415 | 316 | return CHAR(T) == 'i'; \ | 2416 | 316 | } |
AArch64InstPrinter.c:isSignedType_uint16_t Line | Count | Source | 2414 | 425 | { \ | 2415 | 425 | return CHAR(T) == 'i'; \ | 2416 | 425 | } |
AArch64InstPrinter.c:isSignedType_uint8_t Line | Count | Source | 2414 | 126 | { \ | 2415 | 126 | return CHAR(T) == 'i'; \ | 2416 | 126 | } |
AArch64InstPrinter.c:isSignedType_uint64_t Line | Count | Source | 2414 | 441 | { \ | 2415 | 441 | return CHAR(T) == 'i'; \ | 2416 | 441 | } |
AArch64InstPrinter.c:isSignedType_uint32_t Line | Count | Source | 2414 | 726 | { \ | 2415 | 726 | return CHAR(T) == 'i'; \ | 2416 | 726 | } |
|
2417 | | DEFINE_isSignedType(int8_t); |
2418 | | DEFINE_isSignedType(int16_t); |
2419 | | DEFINE_isSignedType(int32_t); |
2420 | | DEFINE_isSignedType(int64_t); |
2421 | | DEFINE_isSignedType(uint8_t); |
2422 | | DEFINE_isSignedType(uint16_t); |
2423 | | DEFINE_isSignedType(uint32_t); |
2424 | | DEFINE_isSignedType(uint64_t); |
2425 | | |
2426 | | #define DEFINE_printImm8OptLsl(T) \ |
2427 | | void CONCAT(printImm8OptLsl, T)(MCInst * MI, unsigned OpNum, \ |
2428 | | SStream *O) \ |
2429 | 3.50k | { \ |
2430 | 3.50k | AArch64_add_cs_detail_1( \ |
2431 | 3.50k | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ |
2432 | 3.50k | unsigned UnscaledVal = \ |
2433 | 3.50k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ |
2434 | 3.50k | unsigned Shift = \ |
2435 | 3.50k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ |
2436 | 3.50k | \ |
2437 | 3.50k | if ((UnscaledVal == 0) && \ |
2438 | 3.50k | (AArch64_AM_getShiftValue(Shift) != 0)) { \ |
2439 | 342 | SStream_concat(O, "%s", markup("<imm:")); \ |
2440 | 342 | SStream_concat1(O, '#'); \ |
2441 | 342 | printUInt64(O, (UnscaledVal)); \ |
2442 | 342 | SStream_concat0(O, markup(">")); \ |
2443 | 342 | printShifter(MI, OpNum + 1, O); \ |
2444 | 342 | return; \ |
2445 | 342 | } \ |
2446 | 3.50k | \ |
2447 | 3.50k | T Val; \ |
2448 | 3.16k | if (CONCAT(isSignedType, T)()) \ |
2449 | 3.16k | Val = (int8_t)UnscaledVal * \ |
2450 | 1.44k | (1 << AArch64_AM_getShiftValue(Shift)); \ |
2451 | 3.16k | else \ |
2452 | 3.16k | Val = (uint8_t)UnscaledVal * \ |
2453 | 1.71k | (1 << AArch64_AM_getShiftValue(Shift)); \ |
2454 | 3.16k | \ |
2455 | 3.16k | CONCAT(printImmSVE, T)(Val, O); \ |
2456 | 3.16k | } Line | Count | Source | 2429 | 580 | { \ | 2430 | 580 | AArch64_add_cs_detail_1( \ | 2431 | 580 | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 580 | unsigned UnscaledVal = \ | 2433 | 580 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 580 | unsigned Shift = \ | 2435 | 580 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 580 | \ | 2437 | 580 | if ((UnscaledVal == 0) && \ | 2438 | 580 | (AArch64_AM_getShiftValue(Shift) != 0)) { \ | 2439 | 38 | SStream_concat(O, "%s", markup("<imm:")); \ | 2440 | 38 | SStream_concat1(O, '#'); \ | 2441 | 38 | printUInt64(O, (UnscaledVal)); \ | 2442 | 38 | SStream_concat0(O, markup(">")); \ | 2443 | 38 | printShifter(MI, OpNum + 1, O); \ | 2444 | 38 | return; \ | 2445 | 38 | } \ | 2446 | 580 | \ | 2447 | 580 | T Val; \ | 2448 | 542 | if (CONCAT(isSignedType, T)()) \ | 2449 | 542 | Val = (int8_t)UnscaledVal * \ | 2450 | 542 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 542 | else \ | 2452 | 542 | Val = (uint8_t)UnscaledVal * \ | 2453 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 542 | \ | 2455 | 542 | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 542 | } |
Line | Count | Source | 2429 | 298 | { \ | 2430 | 298 | AArch64_add_cs_detail_1( \ | 2431 | 298 | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 298 | unsigned UnscaledVal = \ | 2433 | 298 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 298 | unsigned Shift = \ | 2435 | 298 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 298 | \ | 2437 | 298 | if ((UnscaledVal == 0) && \ | 2438 | 298 | (AArch64_AM_getShiftValue(Shift) != 0)) { \ | 2439 | 0 | SStream_concat(O, "%s", markup("<imm:")); \ | 2440 | 0 | SStream_concat1(O, '#'); \ | 2441 | 0 | printUInt64(O, (UnscaledVal)); \ | 2442 | 0 | SStream_concat0(O, markup(">")); \ | 2443 | 0 | printShifter(MI, OpNum + 1, O); \ | 2444 | 0 | return; \ | 2445 | 0 | } \ | 2446 | 298 | \ | 2447 | 298 | T Val; \ | 2448 | 298 | if (CONCAT(isSignedType, T)()) \ | 2449 | 298 | Val = (int8_t)UnscaledVal * \ | 2450 | 298 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 298 | else \ | 2452 | 298 | Val = (uint8_t)UnscaledVal * \ | 2453 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 298 | \ | 2455 | 298 | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 298 | } |
Line | Count | Source | 2429 | 303 | { \ | 2430 | 303 | AArch64_add_cs_detail_1( \ | 2431 | 303 | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 303 | unsigned UnscaledVal = \ | 2433 | 303 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 303 | unsigned Shift = \ | 2435 | 303 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 303 | \ | 2437 | 303 | if ((UnscaledVal == 0) && \ | 2438 | 303 | (AArch64_AM_getShiftValue(Shift) != 0)) { \ | 2439 | 16 | SStream_concat(O, "%s", markup("<imm:")); \ | 2440 | 16 | SStream_concat1(O, '#'); \ | 2441 | 16 | printUInt64(O, (UnscaledVal)); \ | 2442 | 16 | SStream_concat0(O, markup(">")); \ | 2443 | 16 | printShifter(MI, OpNum + 1, O); \ | 2444 | 16 | return; \ | 2445 | 16 | } \ | 2446 | 303 | \ | 2447 | 303 | T Val; \ | 2448 | 287 | if (CONCAT(isSignedType, T)()) \ | 2449 | 287 | Val = (int8_t)UnscaledVal * \ | 2450 | 287 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 287 | else \ | 2452 | 287 | Val = (uint8_t)UnscaledVal * \ | 2453 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 287 | \ | 2455 | 287 | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 287 | } |
Line | Count | Source | 2429 | 335 | { \ | 2430 | 335 | AArch64_add_cs_detail_1( \ | 2431 | 335 | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 335 | unsigned UnscaledVal = \ | 2433 | 335 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 335 | unsigned Shift = \ | 2435 | 335 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 335 | \ | 2437 | 335 | if ((UnscaledVal == 0) && \ | 2438 | 335 | (AArch64_AM_getShiftValue(Shift) != 0)) { \ | 2439 | 19 | SStream_concat(O, "%s", markup("<imm:")); \ | 2440 | 19 | SStream_concat1(O, '#'); \ | 2441 | 19 | printUInt64(O, (UnscaledVal)); \ | 2442 | 19 | SStream_concat0(O, markup(">")); \ | 2443 | 19 | printShifter(MI, OpNum + 1, O); \ | 2444 | 19 | return; \ | 2445 | 19 | } \ | 2446 | 335 | \ | 2447 | 335 | T Val; \ | 2448 | 316 | if (CONCAT(isSignedType, T)()) \ | 2449 | 316 | Val = (int8_t)UnscaledVal * \ | 2450 | 316 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 316 | else \ | 2452 | 316 | Val = (uint8_t)UnscaledVal * \ | 2453 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 316 | \ | 2455 | 316 | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 316 | } |
Line | Count | Source | 2429 | 489 | { \ | 2430 | 489 | AArch64_add_cs_detail_1( \ | 2431 | 489 | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 489 | unsigned UnscaledVal = \ | 2433 | 489 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 489 | unsigned Shift = \ | 2435 | 489 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 489 | \ | 2437 | 489 | if ((UnscaledVal == 0) && \ | 2438 | 489 | (AArch64_AM_getShiftValue(Shift) != 0)) { \ | 2439 | 64 | SStream_concat(O, "%s", markup("<imm:")); \ | 2440 | 64 | SStream_concat1(O, '#'); \ | 2441 | 64 | printUInt64(O, (UnscaledVal)); \ | 2442 | 64 | SStream_concat0(O, markup(">")); \ | 2443 | 64 | printShifter(MI, OpNum + 1, O); \ | 2444 | 64 | return; \ | 2445 | 64 | } \ | 2446 | 489 | \ | 2447 | 489 | T Val; \ | 2448 | 425 | if (CONCAT(isSignedType, T)()) \ | 2449 | 425 | Val = (int8_t)UnscaledVal * \ | 2450 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 425 | else \ | 2452 | 425 | Val = (uint8_t)UnscaledVal * \ | 2453 | 425 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 425 | \ | 2455 | 425 | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 425 | } |
Line | Count | Source | 2429 | 126 | { \ | 2430 | 126 | AArch64_add_cs_detail_1( \ | 2431 | 126 | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 126 | unsigned UnscaledVal = \ | 2433 | 126 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 126 | unsigned Shift = \ | 2435 | 126 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 126 | \ | 2437 | 126 | if ((UnscaledVal == 0) && \ | 2438 | 126 | (AArch64_AM_getShiftValue(Shift) != 0)) { \ | 2439 | 0 | SStream_concat(O, "%s", markup("<imm:")); \ | 2440 | 0 | SStream_concat1(O, '#'); \ | 2441 | 0 | printUInt64(O, (UnscaledVal)); \ | 2442 | 0 | SStream_concat0(O, markup(">")); \ | 2443 | 0 | printShifter(MI, OpNum + 1, O); \ | 2444 | 0 | return; \ | 2445 | 0 | } \ | 2446 | 126 | \ | 2447 | 126 | T Val; \ | 2448 | 126 | if (CONCAT(isSignedType, T)()) \ | 2449 | 126 | Val = (int8_t)UnscaledVal * \ | 2450 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 126 | else \ | 2452 | 126 | Val = (uint8_t)UnscaledVal * \ | 2453 | 126 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 126 | \ | 2455 | 126 | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 126 | } |
Line | Count | Source | 2429 | 611 | { \ | 2430 | 611 | AArch64_add_cs_detail_1( \ | 2431 | 611 | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 611 | unsigned UnscaledVal = \ | 2433 | 611 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 611 | unsigned Shift = \ | 2435 | 611 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 611 | \ | 2437 | 611 | if ((UnscaledVal == 0) && \ | 2438 | 611 | (AArch64_AM_getShiftValue(Shift) != 0)) { \ | 2439 | 170 | SStream_concat(O, "%s", markup("<imm:")); \ | 2440 | 170 | SStream_concat1(O, '#'); \ | 2441 | 170 | printUInt64(O, (UnscaledVal)); \ | 2442 | 170 | SStream_concat0(O, markup(">")); \ | 2443 | 170 | printShifter(MI, OpNum + 1, O); \ | 2444 | 170 | return; \ | 2445 | 170 | } \ | 2446 | 611 | \ | 2447 | 611 | T Val; \ | 2448 | 441 | if (CONCAT(isSignedType, T)()) \ | 2449 | 441 | Val = (int8_t)UnscaledVal * \ | 2450 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 441 | else \ | 2452 | 441 | Val = (uint8_t)UnscaledVal * \ | 2453 | 441 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 441 | \ | 2455 | 441 | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 441 | } |
Line | Count | Source | 2429 | 761 | { \ | 2430 | 761 | AArch64_add_cs_detail_1( \ | 2431 | 761 | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 761 | unsigned UnscaledVal = \ | 2433 | 761 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 761 | unsigned Shift = \ | 2435 | 761 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 761 | \ | 2437 | 761 | if ((UnscaledVal == 0) && \ | 2438 | 761 | (AArch64_AM_getShiftValue(Shift) != 0)) { \ | 2439 | 35 | SStream_concat(O, "%s", markup("<imm:")); \ | 2440 | 35 | SStream_concat1(O, '#'); \ | 2441 | 35 | printUInt64(O, (UnscaledVal)); \ | 2442 | 35 | SStream_concat0(O, markup(">")); \ | 2443 | 35 | printShifter(MI, OpNum + 1, O); \ | 2444 | 35 | return; \ | 2445 | 35 | } \ | 2446 | 761 | \ | 2447 | 761 | T Val; \ | 2448 | 726 | if (CONCAT(isSignedType, T)()) \ | 2449 | 726 | Val = (int8_t)UnscaledVal * \ | 2450 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 726 | else \ | 2452 | 726 | Val = (uint8_t)UnscaledVal * \ | 2453 | 726 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 726 | \ | 2455 | 726 | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 726 | } |
|
2457 | | DEFINE_printImm8OptLsl(int16_t); |
2458 | | DEFINE_printImm8OptLsl(int8_t); |
2459 | | DEFINE_printImm8OptLsl(int64_t); |
2460 | | DEFINE_printImm8OptLsl(int32_t); |
2461 | | DEFINE_printImm8OptLsl(uint16_t); |
2462 | | DEFINE_printImm8OptLsl(uint8_t); |
2463 | | DEFINE_printImm8OptLsl(uint64_t); |
2464 | | DEFINE_printImm8OptLsl(uint32_t); |
2465 | | |
2466 | | #define DEFINE_printSVELogicalImm(T) \ |
2467 | | void CONCAT(printSVELogicalImm, T)(MCInst * MI, unsigned OpNum, \ |
2468 | | SStream *O) \ |
2469 | 3.64k | { \ |
2470 | 3.64k | AArch64_add_cs_detail_1( \ |
2471 | 3.64k | MI, CONCAT(AArch64_OP_GROUP_SVELogicalImm, T), OpNum, \ |
2472 | 3.64k | sizeof(T)); \ |
2473 | 3.64k | typedef T SignedT; \ |
2474 | 3.64k | typedef CONCATS(u, T) UnsignedT; \ |
2475 | 3.64k | \ |
2476 | 3.64k | uint64_t Val = \ |
2477 | 3.64k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ |
2478 | 3.64k | UnsignedT PrintVal = \ |
2479 | 3.64k | AArch64_AM_decodeLogicalImmediate(Val, 64); \ |
2480 | 3.64k | \ |
2481 | 3.64k | if ((int16_t)PrintVal == (SignedT)PrintVal) \ |
2482 | 3.64k | CONCAT(printImmSVE, T)((T)PrintVal, O); \ |
2483 | 3.64k | else if ((uint16_t)PrintVal == PrintVal) \ |
2484 | 2.39k | CONCAT(printImmSVE, T)(PrintVal, O); \ |
2485 | 2.39k | else { \ |
2486 | 2.01k | SStream_concat(O, "%s", markup("<imm:")); \ |
2487 | 2.01k | printUInt64Bang(O, ((uint64_t)PrintVal)); \ |
2488 | 2.01k | SStream_concat0(O, markup(">")); \ |
2489 | 2.01k | } \ |
2490 | 3.64k | } printSVELogicalImm_int16_t Line | Count | Source | 2469 | 607 | { \ | 2470 | 607 | AArch64_add_cs_detail_1( \ | 2471 | 607 | MI, CONCAT(AArch64_OP_GROUP_SVELogicalImm, T), OpNum, \ | 2472 | 607 | sizeof(T)); \ | 2473 | 607 | typedef T SignedT; \ | 2474 | 607 | typedef CONCATS(u, T) UnsignedT; \ | 2475 | 607 | \ | 2476 | 607 | uint64_t Val = \ | 2477 | 607 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2478 | 607 | UnsignedT PrintVal = \ | 2479 | 607 | AArch64_AM_decodeLogicalImmediate(Val, 64); \ | 2480 | 607 | \ | 2481 | 607 | if ((int16_t)PrintVal == (SignedT)PrintVal) \ | 2482 | 607 | CONCAT(printImmSVE, T)((T)PrintVal, O); \ | 2483 | 607 | else if ((uint16_t)PrintVal == PrintVal) \ | 2484 | 0 | CONCAT(printImmSVE, T)(PrintVal, O); \ | 2485 | 0 | else { \ | 2486 | 0 | SStream_concat(O, "%s", markup("<imm:")); \ | 2487 | 0 | printUInt64Bang(O, ((uint64_t)PrintVal)); \ | 2488 | 0 | SStream_concat0(O, markup(">")); \ | 2489 | 0 | } \ | 2490 | 607 | } |
printSVELogicalImm_int32_t Line | Count | Source | 2469 | 1.88k | { \ | 2470 | 1.88k | AArch64_add_cs_detail_1( \ | 2471 | 1.88k | MI, CONCAT(AArch64_OP_GROUP_SVELogicalImm, T), OpNum, \ | 2472 | 1.88k | sizeof(T)); \ | 2473 | 1.88k | typedef T SignedT; \ | 2474 | 1.88k | typedef CONCATS(u, T) UnsignedT; \ | 2475 | 1.88k | \ | 2476 | 1.88k | uint64_t Val = \ | 2477 | 1.88k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2478 | 1.88k | UnsignedT PrintVal = \ | 2479 | 1.88k | AArch64_AM_decodeLogicalImmediate(Val, 64); \ | 2480 | 1.88k | \ | 2481 | 1.88k | if ((int16_t)PrintVal == (SignedT)PrintVal) \ | 2482 | 1.88k | CONCAT(printImmSVE, T)((T)PrintVal, O); \ | 2483 | 1.88k | else if ((uint16_t)PrintVal == PrintVal) \ | 2484 | 1.35k | CONCAT(printImmSVE, T)(PrintVal, O); \ | 2485 | 1.35k | else { \ | 2486 | 1.00k | SStream_concat(O, "%s", markup("<imm:")); \ | 2487 | 1.00k | printUInt64Bang(O, ((uint64_t)PrintVal)); \ | 2488 | 1.00k | SStream_concat0(O, markup(">")); \ | 2489 | 1.00k | } \ | 2490 | 1.88k | } |
printSVELogicalImm_int64_t Line | Count | Source | 2469 | 1.15k | { \ | 2470 | 1.15k | AArch64_add_cs_detail_1( \ | 2471 | 1.15k | MI, CONCAT(AArch64_OP_GROUP_SVELogicalImm, T), OpNum, \ | 2472 | 1.15k | sizeof(T)); \ | 2473 | 1.15k | typedef T SignedT; \ | 2474 | 1.15k | typedef CONCATS(u, T) UnsignedT; \ | 2475 | 1.15k | \ | 2476 | 1.15k | uint64_t Val = \ | 2477 | 1.15k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2478 | 1.15k | UnsignedT PrintVal = \ | 2479 | 1.15k | AArch64_AM_decodeLogicalImmediate(Val, 64); \ | 2480 | 1.15k | \ | 2481 | 1.15k | if ((int16_t)PrintVal == (SignedT)PrintVal) \ | 2482 | 1.15k | CONCAT(printImmSVE, T)((T)PrintVal, O); \ | 2483 | 1.15k | else if ((uint16_t)PrintVal == PrintVal) \ | 2484 | 1.04k | CONCAT(printImmSVE, T)(PrintVal, O); \ | 2485 | 1.04k | else { \ | 2486 | 1.01k | SStream_concat(O, "%s", markup("<imm:")); \ | 2487 | 1.01k | printUInt64Bang(O, ((uint64_t)PrintVal)); \ | 2488 | 1.01k | SStream_concat0(O, markup(">")); \ | 2489 | 1.01k | } \ | 2490 | 1.15k | } |
|
2491 | | DEFINE_printSVELogicalImm(int16_t); |
2492 | | DEFINE_printSVELogicalImm(int32_t); |
2493 | | DEFINE_printSVELogicalImm(int64_t); |
2494 | | |
2495 | | #define DEFINE_printZPRasFPR(Width) \ |
2496 | | void CONCAT(printZPRasFPR, Width)(MCInst * MI, unsigned OpNum, \ |
2497 | | SStream *O) \ |
2498 | 1.06k | { \ |
2499 | 1.06k | AArch64_add_cs_detail_1( \ |
2500 | 1.06k | MI, CONCAT(AArch64_OP_GROUP_ZPRasFPR, Width), OpNum, \ |
2501 | 1.06k | Width); \ |
2502 | 1.06k | unsigned Base; \ |
2503 | 1.06k | switch (Width) { \ |
2504 | 52 | case 8: \ |
2505 | 52 | Base = AArch64_B0; \ |
2506 | 52 | break; \ |
2507 | 361 | case 16: \ |
2508 | 361 | Base = AArch64_H0; \ |
2509 | 361 | break; \ |
2510 | 227 | case 32: \ |
2511 | 227 | Base = AArch64_S0; \ |
2512 | 227 | break; \ |
2513 | 402 | case 64: \ |
2514 | 402 | Base = AArch64_D0; \ |
2515 | 402 | break; \ |
2516 | 22 | case 128: \ |
2517 | 22 | Base = AArch64_Q0; \ |
2518 | 22 | break; \ |
2519 | 0 | default: \ |
2520 | 0 | CS_ASSERT_RET(0 && "Unsupported width"); \ |
2521 | 1.06k | } \ |
2522 | 1.06k | unsigned Reg = \ |
2523 | 1.06k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ |
2524 | 1.06k | printRegName(O, Reg - AArch64_Z0 + Base); \ |
2525 | 1.06k | } Line | Count | Source | 2498 | 52 | { \ | 2499 | 52 | AArch64_add_cs_detail_1( \ | 2500 | 52 | MI, CONCAT(AArch64_OP_GROUP_ZPRasFPR, Width), OpNum, \ | 2501 | 52 | Width); \ | 2502 | 52 | unsigned Base; \ | 2503 | 52 | switch (Width) { \ | 2504 | 52 | case 8: \ | 2505 | 52 | Base = AArch64_B0; \ | 2506 | 52 | break; \ | 2507 | 0 | case 16: \ | 2508 | 0 | Base = AArch64_H0; \ | 2509 | 0 | break; \ | 2510 | 0 | case 32: \ | 2511 | 0 | Base = AArch64_S0; \ | 2512 | 0 | break; \ | 2513 | 0 | case 64: \ | 2514 | 0 | Base = AArch64_D0; \ | 2515 | 0 | break; \ | 2516 | 0 | case 128: \ | 2517 | 0 | Base = AArch64_Q0; \ | 2518 | 0 | break; \ | 2519 | 0 | default: \ | 2520 | 0 | CS_ASSERT_RET(0 && "Unsupported width"); \ | 2521 | 52 | } \ | 2522 | 52 | unsigned Reg = \ | 2523 | 52 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2524 | 52 | printRegName(O, Reg - AArch64_Z0 + Base); \ | 2525 | 52 | } |
Line | Count | Source | 2498 | 402 | { \ | 2499 | 402 | AArch64_add_cs_detail_1( \ | 2500 | 402 | MI, CONCAT(AArch64_OP_GROUP_ZPRasFPR, Width), OpNum, \ | 2501 | 402 | Width); \ | 2502 | 402 | unsigned Base; \ | 2503 | 402 | switch (Width) { \ | 2504 | 0 | case 8: \ | 2505 | 0 | Base = AArch64_B0; \ | 2506 | 0 | break; \ | 2507 | 0 | case 16: \ | 2508 | 0 | Base = AArch64_H0; \ | 2509 | 0 | break; \ | 2510 | 0 | case 32: \ | 2511 | 0 | Base = AArch64_S0; \ | 2512 | 0 | break; \ | 2513 | 402 | case 64: \ | 2514 | 402 | Base = AArch64_D0; \ | 2515 | 402 | break; \ | 2516 | 0 | case 128: \ | 2517 | 0 | Base = AArch64_Q0; \ | 2518 | 0 | break; \ | 2519 | 0 | default: \ | 2520 | 0 | CS_ASSERT_RET(0 && "Unsupported width"); \ | 2521 | 402 | } \ | 2522 | 402 | unsigned Reg = \ | 2523 | 402 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2524 | 402 | printRegName(O, Reg - AArch64_Z0 + Base); \ | 2525 | 402 | } |
Line | Count | Source | 2498 | 361 | { \ | 2499 | 361 | AArch64_add_cs_detail_1( \ | 2500 | 361 | MI, CONCAT(AArch64_OP_GROUP_ZPRasFPR, Width), OpNum, \ | 2501 | 361 | Width); \ | 2502 | 361 | unsigned Base; \ | 2503 | 361 | switch (Width) { \ | 2504 | 0 | case 8: \ | 2505 | 0 | Base = AArch64_B0; \ | 2506 | 0 | break; \ | 2507 | 361 | case 16: \ | 2508 | 361 | Base = AArch64_H0; \ | 2509 | 361 | break; \ | 2510 | 0 | case 32: \ | 2511 | 0 | Base = AArch64_S0; \ | 2512 | 0 | break; \ | 2513 | 0 | case 64: \ | 2514 | 0 | Base = AArch64_D0; \ | 2515 | 0 | break; \ | 2516 | 0 | case 128: \ | 2517 | 0 | Base = AArch64_Q0; \ | 2518 | 0 | break; \ | 2519 | 0 | default: \ | 2520 | 0 | CS_ASSERT_RET(0 && "Unsupported width"); \ | 2521 | 361 | } \ | 2522 | 361 | unsigned Reg = \ | 2523 | 361 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2524 | 361 | printRegName(O, Reg - AArch64_Z0 + Base); \ | 2525 | 361 | } |
Line | Count | Source | 2498 | 227 | { \ | 2499 | 227 | AArch64_add_cs_detail_1( \ | 2500 | 227 | MI, CONCAT(AArch64_OP_GROUP_ZPRasFPR, Width), OpNum, \ | 2501 | 227 | Width); \ | 2502 | 227 | unsigned Base; \ | 2503 | 227 | switch (Width) { \ | 2504 | 0 | case 8: \ | 2505 | 0 | Base = AArch64_B0; \ | 2506 | 0 | break; \ | 2507 | 0 | case 16: \ | 2508 | 0 | Base = AArch64_H0; \ | 2509 | 0 | break; \ | 2510 | 227 | case 32: \ | 2511 | 227 | Base = AArch64_S0; \ | 2512 | 227 | break; \ | 2513 | 0 | case 64: \ | 2514 | 0 | Base = AArch64_D0; \ | 2515 | 0 | break; \ | 2516 | 0 | case 128: \ | 2517 | 0 | Base = AArch64_Q0; \ | 2518 | 0 | break; \ | 2519 | 0 | default: \ | 2520 | 0 | CS_ASSERT_RET(0 && "Unsupported width"); \ | 2521 | 227 | } \ | 2522 | 227 | unsigned Reg = \ | 2523 | 227 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2524 | 227 | printRegName(O, Reg - AArch64_Z0 + Base); \ | 2525 | 227 | } |
Line | Count | Source | 2498 | 22 | { \ | 2499 | 22 | AArch64_add_cs_detail_1( \ | 2500 | 22 | MI, CONCAT(AArch64_OP_GROUP_ZPRasFPR, Width), OpNum, \ | 2501 | 22 | Width); \ | 2502 | 22 | unsigned Base; \ | 2503 | 22 | switch (Width) { \ | 2504 | 0 | case 8: \ | 2505 | 0 | Base = AArch64_B0; \ | 2506 | 0 | break; \ | 2507 | 0 | case 16: \ | 2508 | 0 | Base = AArch64_H0; \ | 2509 | 0 | break; \ | 2510 | 0 | case 32: \ | 2511 | 0 | Base = AArch64_S0; \ | 2512 | 0 | break; \ | 2513 | 0 | case 64: \ | 2514 | 0 | Base = AArch64_D0; \ | 2515 | 0 | break; \ | 2516 | 22 | case 128: \ | 2517 | 22 | Base = AArch64_Q0; \ | 2518 | 22 | break; \ | 2519 | 0 | default: \ | 2520 | 0 | CS_ASSERT_RET(0 && "Unsupported width"); \ | 2521 | 22 | } \ | 2522 | 22 | unsigned Reg = \ | 2523 | 22 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2524 | 22 | printRegName(O, Reg - AArch64_Z0 + Base); \ | 2525 | 22 | } |
|
2526 | | DEFINE_printZPRasFPR(8); |
2527 | | DEFINE_printZPRasFPR(64); |
2528 | | DEFINE_printZPRasFPR(16); |
2529 | | DEFINE_printZPRasFPR(32); |
2530 | | DEFINE_printZPRasFPR(128); |
2531 | | |
2532 | | #define DEFINE_printExactFPImm(ImmIs0, ImmIs1) \ |
2533 | | void CONCAT(printExactFPImm, CONCAT(ImmIs0, ImmIs1))( \ |
2534 | | MCInst * MI, unsigned OpNum, SStream *O) \ |
2535 | 2.67k | { \ |
2536 | 2.67k | AArch64_add_cs_detail_2( \ |
2537 | 2.67k | MI, \ |
2538 | 2.67k | CONCAT(CONCAT(AArch64_OP_GROUP_ExactFPImm, ImmIs0), \ |
2539 | 2.67k | ImmIs1), \ |
2540 | 2.67k | OpNum, ImmIs0, ImmIs1); \ |
2541 | 2.67k | const AArch64ExactFPImm_ExactFPImm *Imm0Desc = \ |
2542 | 2.67k | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs0); \ |
2543 | 2.67k | const AArch64ExactFPImm_ExactFPImm *Imm1Desc = \ |
2544 | 2.67k | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs1); \ |
2545 | 2.67k | unsigned Val = \ |
2546 | 2.67k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ |
2547 | 2.67k | SStream_concat(O, "%s%s%s", markup("<imm:"), "#", \ |
2548 | 2.67k | (Val ? Imm1Desc->Repr : Imm0Desc->Repr)); \ |
2549 | 2.67k | SStream_concat0(O, markup(">")); \ |
2550 | 2.67k | } printExactFPImm_AArch64ExactFPImm_half_AArch64ExactFPImm_one Line | Count | Source | 2535 | 156 | { \ | 2536 | 156 | AArch64_add_cs_detail_2( \ | 2537 | 156 | MI, \ | 2538 | 156 | CONCAT(CONCAT(AArch64_OP_GROUP_ExactFPImm, ImmIs0), \ | 2539 | 156 | ImmIs1), \ | 2540 | 156 | OpNum, ImmIs0, ImmIs1); \ | 2541 | 156 | const AArch64ExactFPImm_ExactFPImm *Imm0Desc = \ | 2542 | 156 | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs0); \ | 2543 | 156 | const AArch64ExactFPImm_ExactFPImm *Imm1Desc = \ | 2544 | 156 | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs1); \ | 2545 | 156 | unsigned Val = \ | 2546 | 156 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2547 | 156 | SStream_concat(O, "%s%s%s", markup("<imm:"), "#", \ | 2548 | 156 | (Val ? Imm1Desc->Repr : Imm0Desc->Repr)); \ | 2549 | 156 | SStream_concat0(O, markup(">")); \ | 2550 | 156 | } |
printExactFPImm_AArch64ExactFPImm_zero_AArch64ExactFPImm_one Line | Count | Source | 2535 | 796 | { \ | 2536 | 796 | AArch64_add_cs_detail_2( \ | 2537 | 796 | MI, \ | 2538 | 796 | CONCAT(CONCAT(AArch64_OP_GROUP_ExactFPImm, ImmIs0), \ | 2539 | 796 | ImmIs1), \ | 2540 | 796 | OpNum, ImmIs0, ImmIs1); \ | 2541 | 796 | const AArch64ExactFPImm_ExactFPImm *Imm0Desc = \ | 2542 | 796 | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs0); \ | 2543 | 796 | const AArch64ExactFPImm_ExactFPImm *Imm1Desc = \ | 2544 | 796 | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs1); \ | 2545 | 796 | unsigned Val = \ | 2546 | 796 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2547 | 796 | SStream_concat(O, "%s%s%s", markup("<imm:"), "#", \ | 2548 | 796 | (Val ? Imm1Desc->Repr : Imm0Desc->Repr)); \ | 2549 | 796 | SStream_concat0(O, markup(">")); \ | 2550 | 796 | } |
printExactFPImm_AArch64ExactFPImm_half_AArch64ExactFPImm_two Line | Count | Source | 2535 | 1.72k | { \ | 2536 | 1.72k | AArch64_add_cs_detail_2( \ | 2537 | 1.72k | MI, \ | 2538 | 1.72k | CONCAT(CONCAT(AArch64_OP_GROUP_ExactFPImm, ImmIs0), \ | 2539 | 1.72k | ImmIs1), \ | 2540 | 1.72k | OpNum, ImmIs0, ImmIs1); \ | 2541 | 1.72k | const AArch64ExactFPImm_ExactFPImm *Imm0Desc = \ | 2542 | 1.72k | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs0); \ | 2543 | 1.72k | const AArch64ExactFPImm_ExactFPImm *Imm1Desc = \ | 2544 | 1.72k | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs1); \ | 2545 | 1.72k | unsigned Val = \ | 2546 | 1.72k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2547 | 1.72k | SStream_concat(O, "%s%s%s", markup("<imm:"), "#", \ | 2548 | 1.72k | (Val ? Imm1Desc->Repr : Imm0Desc->Repr)); \ | 2549 | 1.72k | SStream_concat0(O, markup(">")); \ | 2550 | 1.72k | } |
|
2551 | | DEFINE_printExactFPImm(AArch64ExactFPImm_half, AArch64ExactFPImm_one); |
2552 | | DEFINE_printExactFPImm(AArch64ExactFPImm_zero, AArch64ExactFPImm_one); |
2553 | | DEFINE_printExactFPImm(AArch64ExactFPImm_half, AArch64ExactFPImm_two); |
2554 | | |
2555 | | void printGPR64as32(MCInst *MI, unsigned OpNum, SStream *O) |
2556 | 5.64k | { |
2557 | 5.64k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_GPR64as32, OpNum); |
2558 | 5.64k | unsigned Reg = MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); |
2559 | 5.64k | printRegName(O, getWRegFromXReg(Reg)); |
2560 | 5.64k | } |
2561 | | |
2562 | | void printGPR64x8(MCInst *MI, unsigned OpNum, SStream *O) |
2563 | 143 | { |
2564 | 143 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_GPR64x8, OpNum); |
2565 | 143 | unsigned Reg = MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); |
2566 | 143 | printRegName(O, |
2567 | 143 | MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_x8sub_0)); |
2568 | 143 | } |
2569 | | |
2570 | | void printSyspXzrPair(MCInst *MI, unsigned OpNum, SStream *O) |
2571 | 1.45k | { |
2572 | 1.45k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_SyspXzrPair, OpNum); |
2573 | 1.45k | unsigned Reg = MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); |
2574 | | |
2575 | 1.45k | SStream_concat(O, "%s%s", getRegisterName(Reg, AArch64_NoRegAltName), |
2576 | 1.45k | ", "); |
2577 | 1.45k | SStream_concat0(O, getRegisterName(Reg, AArch64_NoRegAltName)); |
2578 | 1.45k | } |
2579 | | |
2580 | | const char *AArch64_LLVM_getRegisterName(unsigned RegNo, unsigned AltIdx) |
2581 | 179k | { |
2582 | 179k | return getRegisterName(RegNo, AltIdx); |
2583 | 179k | } |
2584 | | |
2585 | | void AArch64_LLVM_printInstruction(MCInst *MI, SStream *O, |
2586 | | void * /* MCRegisterInfo* */ info) |
2587 | 306k | { |
2588 | 306k | printInst(MI, MI->address, "", O); |
2589 | 306k | } |