/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 | 387k | #define CONCAT(a, b) CONCAT_(a, b) |
49 | 387k | #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 | 592k | { |
81 | 592k | SStream_concat(OS, "%s%s", markup("<reg:"), |
82 | 592k | getRegisterName(Reg, AArch64_NoRegAltName)); |
83 | 592k | SStream_concat0(OS, markup(">")); |
84 | 592k | } |
85 | | |
86 | | void printRegNameAlt(SStream *OS, unsigned Reg, unsigned AltIdx) |
87 | 106k | { |
88 | 106k | SStream_concat(OS, "%s%s", markup("<reg:"), |
89 | 106k | getRegisterName(Reg, AltIdx)); |
90 | 106k | SStream_concat0(OS, markup(">")); |
91 | 106k | } |
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 | 275k | { |
100 | 275k | bool isAlias = false; |
101 | 275k | bool useAliasDetails = map_use_alias_details(MI); |
102 | 275k | map_set_fill_detail_ops(MI, useAliasDetails); |
103 | | |
104 | 275k | unsigned Opcode = MCInst_getOpcode(MI); |
105 | | |
106 | 275k | if (Opcode == AArch64_SYSxt) { |
107 | 3.96k | if (printSysAlias(MI, O)) { |
108 | 1.78k | isAlias = true; |
109 | 1.78k | MCInst_setIsAlias(MI, isAlias); |
110 | 1.78k | if (useAliasDetails) |
111 | 1.78k | return; |
112 | 1.78k | } |
113 | 3.96k | } |
114 | | |
115 | 273k | if (Opcode == AArch64_SYSPxt || Opcode == AArch64_SYSPxt_XZR) { |
116 | 981 | if (printSyspAlias(MI, O)) { |
117 | 613 | isAlias = true; |
118 | 613 | MCInst_setIsAlias(MI, isAlias); |
119 | 613 | if (useAliasDetails) |
120 | 613 | return; |
121 | 613 | } |
122 | 981 | } |
123 | | |
124 | | // RPRFM overlaps PRFM (reg), so try to print it as RPRFM here. |
125 | 272k | if ((Opcode == AArch64_PRFMroX) || (Opcode == AArch64_PRFMroW)) { |
126 | 261 | 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 | 261 | } |
133 | | |
134 | | // SBFM/UBFM should print to a nicer aliased form if possible. |
135 | 272k | if (Opcode == AArch64_SBFMXri || Opcode == AArch64_SBFMWri || |
136 | 272k | Opcode == AArch64_UBFMXri || Opcode == AArch64_UBFMWri) { |
137 | 2.55k | MCOperand *Op0 = MCInst_getOperand(MI, (0)); |
138 | 2.55k | MCOperand *Op1 = MCInst_getOperand(MI, (1)); |
139 | 2.55k | MCOperand *Op2 = MCInst_getOperand(MI, (2)); |
140 | 2.55k | MCOperand *Op3 = MCInst_getOperand(MI, (3)); |
141 | | |
142 | 2.55k | bool IsSigned = (Opcode == AArch64_SBFMXri || |
143 | 2.55k | Opcode == AArch64_SBFMWri); |
144 | 2.55k | bool Is64Bit = (Opcode == AArch64_SBFMXri || |
145 | 2.55k | Opcode == AArch64_UBFMXri); |
146 | 2.55k | if (MCOperand_isImm(Op2) && MCOperand_getImm(Op2) == 0 && |
147 | 2.55k | MCOperand_isImm(Op3)) { |
148 | 1.72k | const char *AsmMnemonic = NULL; |
149 | | |
150 | 1.72k | switch (MCOperand_getImm(Op3)) { |
151 | 685 | default: |
152 | 685 | break; |
153 | 685 | case 7: |
154 | 469 | if (IsSigned) |
155 | 136 | AsmMnemonic = "sxtb"; |
156 | 333 | else if (!Is64Bit) |
157 | 38 | AsmMnemonic = "uxtb"; |
158 | 469 | break; |
159 | 516 | case 15: |
160 | 516 | if (IsSigned) |
161 | 147 | AsmMnemonic = "sxth"; |
162 | 369 | else if (!Is64Bit) |
163 | 46 | AsmMnemonic = "uxth"; |
164 | 516 | break; |
165 | 55 | case 31: |
166 | | // *xtw is only valid for signed 64-bit operations. |
167 | 55 | if (Is64Bit && IsSigned) |
168 | 36 | AsmMnemonic = "sxtw"; |
169 | 55 | break; |
170 | 1.72k | } |
171 | | |
172 | 1.72k | if (AsmMnemonic) { |
173 | 403 | SStream_concat(O, "%s", AsmMnemonic); |
174 | 403 | SStream_concat0(O, " "); |
175 | | |
176 | 403 | printRegName(O, MCOperand_getReg(Op0)); |
177 | 403 | SStream_concat0(O, ", "); |
178 | 403 | printRegName(O, getWRegFromXReg( |
179 | 403 | MCOperand_getReg(Op1))); |
180 | 403 | if (detail_is_set(MI) && useAliasDetails) { |
181 | 403 | AArch64_set_detail_op_reg( |
182 | 403 | MI, 0, MCOperand_getReg(Op0)); |
183 | 403 | AArch64_set_detail_op_reg( |
184 | 403 | MI, 1, |
185 | 403 | getWRegFromXReg( |
186 | 403 | MCOperand_getReg(Op1))); |
187 | 403 | if (strings_match(AsmMnemonic, "uxtb")) |
188 | 38 | AArch64_get_detail_op(MI, -1) |
189 | 38 | ->ext = |
190 | 38 | AARCH64_EXT_UXTB; |
191 | 365 | else if (strings_match(AsmMnemonic, |
192 | 365 | "sxtb")) |
193 | 136 | AArch64_get_detail_op(MI, -1) |
194 | 136 | ->ext = |
195 | 136 | AARCH64_EXT_SXTB; |
196 | 229 | else if (strings_match(AsmMnemonic, |
197 | 229 | "uxth")) |
198 | 46 | AArch64_get_detail_op(MI, -1) |
199 | 46 | ->ext = |
200 | 46 | AARCH64_EXT_UXTH; |
201 | 183 | else if (strings_match(AsmMnemonic, |
202 | 183 | "sxth")) |
203 | 147 | AArch64_get_detail_op(MI, -1) |
204 | 147 | ->ext = |
205 | 147 | AARCH64_EXT_SXTH; |
206 | 36 | else if (strings_match(AsmMnemonic, |
207 | 36 | "sxtw")) |
208 | 36 | AArch64_get_detail_op(MI, -1) |
209 | 36 | ->ext = |
210 | 36 | AARCH64_EXT_SXTW; |
211 | 0 | else |
212 | 0 | AArch64_get_detail_op(MI, -1) |
213 | 0 | ->ext = |
214 | 0 | AARCH64_EXT_INVALID; |
215 | 403 | } |
216 | 403 | isAlias = true; |
217 | 403 | MCInst_setIsAlias(MI, isAlias); |
218 | 403 | if (useAliasDetails) |
219 | 403 | return; |
220 | 0 | else |
221 | 0 | goto add_real_detail; |
222 | 403 | } |
223 | 1.72k | } |
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 | 2.14k | if (MCOperand_isImm(Op2) && MCOperand_isImm(Op3)) { |
229 | 2.14k | const char *AsmMnemonic = NULL; |
230 | 2.14k | int shift = 0; |
231 | 2.14k | int64_t immr = MCOperand_getImm(Op2); |
232 | 2.14k | int64_t imms = MCOperand_getImm(Op3); |
233 | 2.14k | if (Opcode == AArch64_UBFMWri && imms != 0x1F && |
234 | 2.14k | ((imms + 1) == immr)) { |
235 | 79 | AsmMnemonic = "lsl"; |
236 | 79 | shift = 31 - imms; |
237 | 2.07k | } else if (Opcode == AArch64_UBFMXri && imms != 0x3f && |
238 | 2.07k | ((imms + 1 == immr))) { |
239 | 18 | AsmMnemonic = "lsl"; |
240 | 18 | shift = 63 - imms; |
241 | 2.05k | } else if (Opcode == AArch64_UBFMWri && imms == 0x1f) { |
242 | 10 | AsmMnemonic = "lsr"; |
243 | 10 | shift = immr; |
244 | 2.04k | } else if (Opcode == AArch64_UBFMXri && imms == 0x3f) { |
245 | 15 | AsmMnemonic = "lsr"; |
246 | 15 | shift = immr; |
247 | 2.02k | } else if (Opcode == AArch64_SBFMWri && imms == 0x1f) { |
248 | 34 | AsmMnemonic = "asr"; |
249 | 34 | shift = immr; |
250 | 1.99k | } else if (Opcode == AArch64_SBFMXri && imms == 0x3f) { |
251 | 403 | AsmMnemonic = "asr"; |
252 | 403 | shift = immr; |
253 | 403 | } |
254 | 2.14k | if (AsmMnemonic) { |
255 | 559 | SStream_concat(O, "%s", AsmMnemonic); |
256 | 559 | SStream_concat0(O, " "); |
257 | | |
258 | 559 | printRegName(O, MCOperand_getReg(Op0)); |
259 | 559 | SStream_concat0(O, ", "); |
260 | 559 | printRegName(O, MCOperand_getReg(Op1)); |
261 | 559 | SStream_concat(O, "%s%s#%d", ", ", |
262 | 559 | markup("<imm:"), shift); |
263 | 559 | SStream_concat0(O, markup(">")); |
264 | 559 | if (detail_is_set(MI) && useAliasDetails) { |
265 | 559 | AArch64_set_detail_op_reg( |
266 | 559 | MI, 0, MCOperand_getReg(Op0)); |
267 | 559 | AArch64_set_detail_op_reg( |
268 | 559 | MI, 1, MCOperand_getReg(Op1)); |
269 | 559 | if (strings_match(AsmMnemonic, "lsl")) |
270 | 97 | AArch64_get_detail_op(MI, -1) |
271 | 97 | ->shift.type = |
272 | 97 | AARCH64_SFT_LSL; |
273 | 462 | else if (strings_match(AsmMnemonic, |
274 | 462 | "lsr")) |
275 | 25 | AArch64_get_detail_op(MI, -1) |
276 | 25 | ->shift.type = |
277 | 25 | AARCH64_SFT_LSR; |
278 | 437 | else if (strings_match(AsmMnemonic, |
279 | 437 | "asr")) |
280 | 437 | AArch64_get_detail_op(MI, -1) |
281 | 437 | ->shift.type = |
282 | 437 | AARCH64_SFT_ASR; |
283 | 0 | else |
284 | 0 | AArch64_get_detail_op(MI, -1) |
285 | 0 | ->shift.type = |
286 | 0 | AARCH64_SFT_INVALID; |
287 | 559 | AArch64_get_detail_op(MI, -1) |
288 | 559 | ->shift.value = shift; |
289 | 559 | } |
290 | 559 | isAlias = true; |
291 | 559 | MCInst_setIsAlias(MI, isAlias); |
292 | 559 | if (useAliasDetails) |
293 | 559 | return; |
294 | 0 | else |
295 | 0 | goto add_real_detail; |
296 | 559 | } |
297 | 2.14k | } |
298 | | |
299 | | // SBFIZ/UBFIZ aliases |
300 | 1.59k | if (MCOperand_getImm(Op2) > MCOperand_getImm(Op3)) { |
301 | 471 | SStream_concat(O, "%s", (IsSigned ? "sbfiz" : "ubfiz")); |
302 | 471 | SStream_concat0(O, " "); |
303 | | |
304 | 471 | printRegName(O, MCOperand_getReg(Op0)); |
305 | 471 | SStream_concat0(O, ", "); |
306 | 471 | printRegName(O, MCOperand_getReg(Op1)); |
307 | 471 | SStream_concat(O, "%s%s", ", ", markup("<imm:")); |
308 | 471 | printUInt32Bang(O, (Is64Bit ? 64 : 32) - |
309 | 471 | MCOperand_getImm(Op2)); |
310 | 471 | SStream_concat(O, "%s%s%s", markup(">"), ", ", |
311 | 471 | markup("<imm:")); |
312 | 471 | printInt64Bang(O, MCOperand_getImm(Op3) + 1); |
313 | 471 | SStream_concat0(O, markup(">")); |
314 | 471 | if (detail_is_set(MI) && useAliasDetails) { |
315 | 471 | AArch64_set_detail_op_reg( |
316 | 471 | MI, 0, MCOperand_getReg(Op0)); |
317 | 471 | AArch64_set_detail_op_reg( |
318 | 471 | MI, 1, MCOperand_getReg(Op1)); |
319 | 471 | AArch64_set_detail_op_imm( |
320 | 471 | MI, 2, AARCH64_OP_IMM, |
321 | 471 | (Is64Bit ? 64 : 32) - |
322 | 471 | MCOperand_getImm(Op2)); |
323 | 471 | AArch64_set_detail_op_imm( |
324 | 471 | MI, 3, AARCH64_OP_IMM, |
325 | 471 | MCOperand_getImm(Op3) + 1); |
326 | 471 | } |
327 | 471 | isAlias = true; |
328 | 471 | MCInst_setIsAlias(MI, isAlias); |
329 | 471 | if (useAliasDetails) |
330 | 471 | return; |
331 | 0 | else |
332 | 0 | goto add_real_detail; |
333 | 471 | } |
334 | | |
335 | | // Otherwise SBFX/UBFX is the preferred form |
336 | 1.11k | SStream_concat(O, "%s", (IsSigned ? "sbfx" : "ubfx")); |
337 | 1.11k | SStream_concat0(O, " "); |
338 | | |
339 | 1.11k | printRegName(O, MCOperand_getReg(Op0)); |
340 | 1.11k | SStream_concat0(O, ", "); |
341 | 1.11k | printRegName(O, MCOperand_getReg(Op1)); |
342 | 1.11k | SStream_concat(O, "%s%s", ", ", markup("<imm:")); |
343 | 1.11k | printInt64Bang(O, MCOperand_getImm(Op2)); |
344 | 1.11k | SStream_concat(O, "%s%s%s", markup(">"), ", ", markup("<imm:")); |
345 | 1.11k | printInt64Bang(O, MCOperand_getImm(Op3) - |
346 | 1.11k | MCOperand_getImm(Op2) + 1); |
347 | 1.11k | SStream_concat0(O, markup(">")); |
348 | 1.11k | if (detail_is_set(MI) && useAliasDetails) { |
349 | 1.11k | AArch64_set_detail_op_reg(MI, 0, MCOperand_getReg(Op0)); |
350 | 1.11k | AArch64_set_detail_op_reg(MI, 1, MCOperand_getReg(Op1)); |
351 | 1.11k | AArch64_set_detail_op_imm(MI, 2, AARCH64_OP_IMM, |
352 | 1.11k | MCOperand_getImm(Op2)); |
353 | 1.11k | AArch64_set_detail_op_imm( |
354 | 1.11k | MI, 3, AARCH64_OP_IMM, |
355 | 1.11k | MCOperand_getImm(Op3) - MCOperand_getImm(Op2) + |
356 | 1.11k | 1); |
357 | 1.11k | } |
358 | 1.11k | isAlias = true; |
359 | 1.11k | MCInst_setIsAlias(MI, isAlias); |
360 | 1.11k | if (useAliasDetails) |
361 | 1.11k | return; |
362 | 0 | else |
363 | 0 | goto add_real_detail; |
364 | 1.11k | } |
365 | | |
366 | 270k | if (Opcode == AArch64_BFMXri || Opcode == AArch64_BFMWri) { |
367 | 1.39k | isAlias = true; |
368 | 1.39k | MCInst_setIsAlias(MI, isAlias); |
369 | 1.39k | MCOperand *Op0 = MCInst_getOperand(MI, (0)); // Op1 == Op0 |
370 | 1.39k | MCOperand *Op2 = MCInst_getOperand(MI, (2)); |
371 | 1.39k | int ImmR = MCOperand_getImm(MCInst_getOperand(MI, (3))); |
372 | 1.39k | int ImmS = MCOperand_getImm(MCInst_getOperand(MI, (4))); |
373 | | |
374 | 1.39k | if ((MCOperand_getReg(Op2) == AArch64_WZR || |
375 | 1.39k | MCOperand_getReg(Op2) == AArch64_XZR) && |
376 | 1.39k | (ImmR == 0 || ImmS < ImmR) && |
377 | 1.39k | (AArch64_getFeatureBits(MI->csh->mode, |
378 | 567 | AArch64_FeatureAll) || |
379 | 567 | AArch64_getFeatureBits(MI->csh->mode, |
380 | 567 | AArch64_HasV8_2aOps))) { |
381 | | // BFC takes precedence over its entire range, sligtly differently |
382 | | // to BFI. |
383 | 567 | int BitWidth = Opcode == AArch64_BFMXri ? 64 : 32; |
384 | 567 | int LSB = (BitWidth - ImmR) % BitWidth; |
385 | 567 | int Width = ImmS + 1; |
386 | | |
387 | 567 | SStream_concat0(O, "bfc "); |
388 | 567 | printRegName(O, MCOperand_getReg(Op0)); |
389 | 567 | SStream_concat(O, "%s%s#%d", ", ", markup("<imm:"), |
390 | 567 | LSB); |
391 | 567 | SStream_concat(O, "%s%s%s#%d", markup(">"), ", ", |
392 | 567 | markup("<imm:"), Width); |
393 | 567 | SStream_concat0(O, markup(">")); |
394 | 567 | if (detail_is_set(MI) && useAliasDetails) { |
395 | 567 | AArch64_set_detail_op_reg( |
396 | 567 | MI, 0, MCOperand_getReg(Op0)); |
397 | 567 | AArch64_set_detail_op_imm(MI, 3, AARCH64_OP_IMM, |
398 | 567 | LSB); |
399 | 567 | AArch64_set_detail_op_imm(MI, 4, AARCH64_OP_IMM, |
400 | 567 | Width); |
401 | 567 | } |
402 | | |
403 | 567 | if (useAliasDetails) |
404 | 567 | return; |
405 | 0 | else |
406 | 0 | goto add_real_detail; |
407 | 825 | } else if (ImmS < ImmR) { |
408 | | // BFI alias |
409 | 236 | int BitWidth = Opcode == AArch64_BFMXri ? 64 : 32; |
410 | 236 | int LSB = (BitWidth - ImmR) % BitWidth; |
411 | 236 | int Width = ImmS + 1; |
412 | | |
413 | 236 | SStream_concat0(O, "bfi "); |
414 | 236 | printRegName(O, MCOperand_getReg(Op0)); |
415 | 236 | SStream_concat0(O, ", "); |
416 | 236 | printRegName(O, MCOperand_getReg(Op2)); |
417 | 236 | SStream_concat(O, "%s%s#%d", ", ", markup("<imm:"), |
418 | 236 | LSB); |
419 | 236 | SStream_concat(O, "%s%s%s#%d", markup(">"), ", ", |
420 | 236 | markup("<imm:"), Width); |
421 | 236 | SStream_concat0(O, markup(">")); |
422 | 236 | if (detail_is_set(MI) && useAliasDetails) { |
423 | 236 | AArch64_set_detail_op_reg( |
424 | 236 | MI, 0, MCOperand_getReg(Op0)); |
425 | 236 | AArch64_set_detail_op_reg( |
426 | 236 | MI, 2, MCOperand_getReg(Op2)); |
427 | 236 | AArch64_set_detail_op_imm(MI, 3, AARCH64_OP_IMM, |
428 | 236 | LSB); |
429 | 236 | AArch64_set_detail_op_imm(MI, 4, AARCH64_OP_IMM, |
430 | 236 | Width); |
431 | 236 | } |
432 | 236 | if (useAliasDetails) |
433 | 236 | return; |
434 | 0 | else |
435 | 0 | goto add_real_detail; |
436 | 236 | } |
437 | | |
438 | 589 | int LSB = ImmR; |
439 | 589 | int Width = ImmS - ImmR + 1; |
440 | | // Otherwise BFXIL the preferred form |
441 | 589 | SStream_concat0(O, "bfxil "); |
442 | 589 | printRegName(O, MCOperand_getReg(Op0)); |
443 | 589 | SStream_concat0(O, ", "); |
444 | 589 | printRegName(O, MCOperand_getReg(Op2)); |
445 | 589 | SStream_concat(O, "%s%s#%d", ", ", markup("<imm:"), LSB); |
446 | 589 | SStream_concat(O, "%s%s%s#%d", markup(">"), ", ", |
447 | 589 | markup("<imm:"), Width); |
448 | 589 | SStream_concat0(O, markup(">")); |
449 | 589 | if (detail_is_set(MI) && useAliasDetails) { |
450 | 589 | AArch64_set_detail_op_reg(MI, 0, MCOperand_getReg(Op0)); |
451 | 589 | AArch64_set_detail_op_reg(MI, 2, MCOperand_getReg(Op2)); |
452 | 589 | AArch64_set_detail_op_imm(MI, 3, AARCH64_OP_IMM, LSB); |
453 | 589 | AArch64_set_detail_op_imm(MI, 4, AARCH64_OP_IMM, Width); |
454 | 589 | } |
455 | 589 | if (useAliasDetails) |
456 | 589 | return; |
457 | 589 | } |
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 | 268k | if ((Opcode == AArch64_MOVZXi || Opcode == AArch64_MOVZWi || |
463 | 268k | Opcode == AArch64_MOVNXi || Opcode == AArch64_MOVNWi) && |
464 | 268k | 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 | 268k | if ((Opcode == AArch64_MOVKXi || Opcode == AArch64_MOVKWi) && |
472 | 268k | 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 | 268k | if ((Opcode == AArch64_MOVZXi || Opcode == AArch64_MOVZWi) && |
485 | 268k | MCOperand_isImm(MCInst_getOperand(MI, (1))) && |
486 | 268k | MCOperand_isImm(MCInst_getOperand(MI, (2)))) { |
487 | 793 | int RegWidth = Opcode == AArch64_MOVZXi ? 64 : 32; |
488 | 793 | int Shift = MCOperand_getImm(MCInst_getOperand(MI, (2))); |
489 | 793 | uint64_t Value = |
490 | 793 | (uint64_t)MCOperand_getImm(MCInst_getOperand(MI, (1))) |
491 | 793 | << Shift; |
492 | | |
493 | 793 | if (AArch64_AM_isMOVZMovAlias( |
494 | 793 | Value, Shift, Opcode == AArch64_MOVZXi ? 64 : 32)) { |
495 | 783 | isAlias = true; |
496 | 783 | MCInst_setIsAlias(MI, isAlias); |
497 | 783 | SStream_concat0(O, "mov "); |
498 | 783 | printRegName(O, MCOperand_getReg( |
499 | 783 | MCInst_getOperand(MI, (0)))); |
500 | 783 | SStream_concat(O, "%s%s", ", ", markup("<imm:")); |
501 | 783 | printInt64Bang(O, SignExtend64(Value, RegWidth)); |
502 | 783 | SStream_concat0(O, markup(">")); |
503 | 783 | if (detail_is_set(MI) && useAliasDetails) { |
504 | 783 | AArch64_set_detail_op_reg( |
505 | 783 | MI, 0, MCInst_getOpVal(MI, 0)); |
506 | 783 | AArch64_set_detail_op_imm( |
507 | 783 | MI, 1, AARCH64_OP_IMM, |
508 | 783 | SignExtend64(Value, RegWidth)); |
509 | 783 | } |
510 | 783 | if (useAliasDetails) |
511 | 783 | return; |
512 | 783 | } |
513 | 793 | } |
514 | | |
515 | 267k | if ((Opcode == AArch64_MOVNXi || Opcode == AArch64_MOVNWi) && |
516 | 267k | MCOperand_isImm(MCInst_getOperand(MI, (1))) && |
517 | 267k | MCOperand_isImm(MCInst_getOperand(MI, (2)))) { |
518 | 1.03k | int RegWidth = Opcode == AArch64_MOVNXi ? 64 : 32; |
519 | 1.03k | int Shift = MCOperand_getImm(MCInst_getOperand(MI, (2))); |
520 | 1.03k | uint64_t Value = |
521 | 1.03k | ~((uint64_t)MCOperand_getImm(MCInst_getOperand(MI, (1))) |
522 | 1.03k | << Shift); |
523 | 1.03k | if (RegWidth == 32) |
524 | 347 | Value = Value & 0xffffffff; |
525 | | |
526 | 1.03k | if (AArch64_AM_isMOVNMovAlias(Value, Shift, RegWidth)) { |
527 | 928 | isAlias = true; |
528 | 928 | MCInst_setIsAlias(MI, isAlias); |
529 | 928 | SStream_concat0(O, "mov "); |
530 | 928 | printRegName(O, MCOperand_getReg( |
531 | 928 | MCInst_getOperand(MI, (0)))); |
532 | 928 | SStream_concat(O, "%s%s", ", ", markup("<imm:")); |
533 | 928 | printInt64Bang(O, SignExtend64(Value, RegWidth)); |
534 | 928 | SStream_concat0(O, markup(">")); |
535 | 928 | if (detail_is_set(MI) && useAliasDetails) { |
536 | 928 | AArch64_set_detail_op_reg( |
537 | 928 | MI, 0, MCInst_getOpVal(MI, 0)); |
538 | 928 | AArch64_set_detail_op_imm( |
539 | 928 | MI, 1, AARCH64_OP_IMM, |
540 | 928 | SignExtend64(Value, RegWidth)); |
541 | 928 | } |
542 | 928 | if (useAliasDetails) |
543 | 928 | return; |
544 | 928 | } |
545 | 1.03k | } |
546 | | |
547 | 267k | if ((Opcode == AArch64_ORRXri || Opcode == AArch64_ORRWri) && |
548 | 267k | (MCOperand_getReg(MCInst_getOperand(MI, (1))) == AArch64_XZR || |
549 | 3.56k | MCOperand_getReg(MCInst_getOperand(MI, (1))) == AArch64_WZR) && |
550 | 267k | MCOperand_isImm(MCInst_getOperand(MI, (2)))) { |
551 | 2.51k | int RegWidth = Opcode == AArch64_ORRXri ? 64 : 32; |
552 | 2.51k | uint64_t Value = AArch64_AM_decodeLogicalImmediate( |
553 | 2.51k | MCOperand_getImm(MCInst_getOperand(MI, (2))), RegWidth); |
554 | 2.51k | if (!AArch64_AM_isAnyMOVWMovAlias(Value, RegWidth)) { |
555 | 1.25k | isAlias = true; |
556 | 1.25k | MCInst_setIsAlias(MI, isAlias); |
557 | 1.25k | SStream_concat0(O, "mov "); |
558 | 1.25k | printRegName(O, MCOperand_getReg( |
559 | 1.25k | MCInst_getOperand(MI, (0)))); |
560 | 1.25k | SStream_concat(O, "%s%s", ", ", markup("<imm:")); |
561 | 1.25k | printInt64Bang(O, SignExtend64(Value, RegWidth)); |
562 | 1.25k | SStream_concat0(O, markup(">")); |
563 | 1.25k | if (detail_is_set(MI) && useAliasDetails) { |
564 | 1.25k | AArch64_set_detail_op_reg( |
565 | 1.25k | MI, 0, MCInst_getOpVal(MI, 0)); |
566 | 1.25k | AArch64_set_detail_op_imm( |
567 | 1.25k | MI, 2, AARCH64_OP_IMM, |
568 | 1.25k | SignExtend64(Value, RegWidth)); |
569 | 1.25k | } |
570 | 1.25k | if (useAliasDetails) |
571 | 1.25k | return; |
572 | 1.25k | } |
573 | 2.51k | } |
574 | | |
575 | 265k | 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 | 265k | if (!isAlias) |
590 | 265k | isAlias |= printAliasInstr(MI, Address, O); |
591 | | |
592 | 265k | add_real_detail: |
593 | 265k | MCInst_setIsAlias(MI, isAlias); |
594 | | |
595 | 265k | if (!isAlias || !useAliasDetails) { |
596 | 234k | map_set_fill_detail_ops(MI, !(isAlias && useAliasDetails)); |
597 | 234k | if (isAlias) |
598 | 0 | SStream_Close(O); |
599 | 234k | printInstruction(MI, Address, O); |
600 | 234k | if (isAlias) |
601 | 0 | SStream_Open(O); |
602 | 234k | } |
603 | 265k | } |
604 | | |
605 | | bool printRangePrefetchAlias(MCInst *MI, SStream *O, const char *Annot) |
606 | 261 | { |
607 | 261 | unsigned Opcode = MCInst_getOpcode(MI); |
608 | | |
609 | 261 | #ifndef NDEBUG |
610 | | |
611 | 261 | #endif |
612 | | |
613 | 261 | unsigned PRFOp = MCOperand_getImm(MCInst_getOperand(MI, (0))); |
614 | 261 | unsigned Mask = 0x18; // 0b11000 |
615 | 261 | if ((PRFOp & Mask) != Mask) |
616 | 261 | 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 | 261 | } |
653 | | |
654 | | bool printSysAlias(MCInst *MI, SStream *O) |
655 | 3.96k | { |
656 | 3.96k | MCOperand *Op1 = MCInst_getOperand(MI, (0)); |
657 | 3.96k | MCOperand *Cn = MCInst_getOperand(MI, (1)); |
658 | 3.96k | MCOperand *Cm = MCInst_getOperand(MI, (2)); |
659 | 3.96k | MCOperand *Op2 = MCInst_getOperand(MI, (3)); |
660 | | |
661 | 3.96k | unsigned Op1Val = MCOperand_getImm(Op1); |
662 | 3.96k | unsigned CnVal = MCOperand_getImm(Cn); |
663 | 3.96k | unsigned CmVal = MCOperand_getImm(Cm); |
664 | 3.96k | unsigned Op2Val = MCOperand_getImm(Op2); |
665 | | |
666 | 3.96k | uint16_t Encoding = Op2Val; |
667 | 3.96k | Encoding |= CmVal << 3; |
668 | 3.96k | Encoding |= CnVal << 7; |
669 | 3.96k | Encoding |= Op1Val << 11; |
670 | | |
671 | 3.96k | bool NeedsReg; |
672 | 3.96k | const char *Ins; |
673 | 3.96k | const char *Name; |
674 | | |
675 | 3.96k | if (CnVal == 7) { |
676 | 2.79k | switch (CmVal) { |
677 | 88 | default: |
678 | 88 | return false; |
679 | | // Maybe IC, maybe Prediction Restriction |
680 | 401 | case 1: |
681 | 401 | switch (Op1Val) { |
682 | 43 | default: |
683 | 43 | return false; |
684 | 342 | case 0: |
685 | 342 | goto Search_IC; |
686 | 16 | case 3: |
687 | 16 | goto Search_PRCTX; |
688 | 401 | } |
689 | | // Prediction Restriction aliases |
690 | 276 | case 3: { |
691 | 292 | Search_PRCTX: |
692 | 292 | if (Op1Val != 3 || CnVal != 7 || CmVal != 3) |
693 | 35 | return false; |
694 | | |
695 | 257 | unsigned int Requires = |
696 | 257 | Op2Val == 6 ? AArch64_FeatureSPECRES2 : |
697 | 257 | AArch64_FeaturePredRes; |
698 | 257 | if (!(AArch64_getFeatureBits(MI->csh->mode, |
699 | 257 | AArch64_FeatureAll) || |
700 | 257 | AArch64_getFeatureBits(MI->csh->mode, Requires))) |
701 | 0 | return false; |
702 | | |
703 | 257 | NeedsReg = true; |
704 | 257 | switch (Op2Val) { |
705 | 13 | default: |
706 | 13 | return false; |
707 | 9 | case 4: |
708 | 9 | Ins = "cfp "; |
709 | 9 | break; |
710 | 18 | case 5: |
711 | 18 | Ins = "dvp "; |
712 | 18 | break; |
713 | 110 | case 6: |
714 | 110 | Ins = "cosp "; |
715 | 110 | break; |
716 | 107 | case 7: |
717 | 107 | Ins = "cpp "; |
718 | 107 | break; |
719 | 257 | } |
720 | 244 | Name = "RCTX"; |
721 | 244 | } break; |
722 | | // IC aliases |
723 | 113 | case 5: { |
724 | 455 | Search_IC: { |
725 | 455 | const AArch64IC_IC *IC = AArch64IC_lookupICByEncoding(Encoding); |
726 | 455 | if (!IC || |
727 | 455 | !AArch64_testFeatureList(MI->csh->mode, IC->FeaturesRequired)) |
728 | 274 | return false; |
729 | 181 | if (detail_is_set(MI)) { |
730 | 181 | aarch64_sysop sysop = { 0 }; |
731 | 181 | sysop.reg = IC->SysReg; |
732 | 181 | sysop.sub_type = AARCH64_OP_IC; |
733 | 181 | AArch64_get_detail_op(MI, 0)->type = AARCH64_OP_SYSREG; |
734 | 181 | AArch64_get_detail_op(MI, 0)->sysop = sysop; |
735 | 181 | AArch64_inc_op_count(MI); |
736 | 181 | } |
737 | | |
738 | 181 | NeedsReg = IC->NeedsReg; |
739 | 181 | Ins = "ic "; |
740 | 181 | Name = IC->Name; |
741 | 181 | } |
742 | 181 | } break; |
743 | | // DC aliases |
744 | 123 | case 4: |
745 | 163 | case 6: |
746 | 369 | case 10: |
747 | 391 | case 11: |
748 | 401 | case 12: |
749 | 594 | case 13: |
750 | 637 | case 14: { |
751 | 637 | const AArch64DC_DC *DC = |
752 | 637 | AArch64DC_lookupDCByEncoding(Encoding); |
753 | 637 | if (!DC || !AArch64_testFeatureList( |
754 | 174 | MI->csh->mode, DC->FeaturesRequired)) |
755 | 463 | return false; |
756 | 174 | if (detail_is_set(MI)) { |
757 | 174 | aarch64_sysop sysop = { 0 }; |
758 | 174 | sysop.alias = DC->SysAlias; |
759 | 174 | sysop.sub_type = AARCH64_OP_DC; |
760 | 174 | AArch64_get_detail_op(MI, 0)->type = |
761 | 174 | AARCH64_OP_SYSALIAS; |
762 | 174 | AArch64_get_detail_op(MI, 0)->sysop = sysop; |
763 | 174 | AArch64_inc_op_count(MI); |
764 | 174 | } |
765 | | |
766 | 174 | NeedsReg = true; |
767 | 174 | Ins = "dc "; |
768 | 174 | Name = DC->Name; |
769 | 174 | } break; |
770 | | // AT aliases |
771 | 406 | case 8: |
772 | 1.28k | case 9: { |
773 | 1.28k | const AArch64AT_AT *AT = |
774 | 1.28k | AArch64AT_lookupATByEncoding(Encoding); |
775 | 1.28k | if (!AT || !AArch64_testFeatureList( |
776 | 557 | MI->csh->mode, AT->FeaturesRequired)) |
777 | 724 | return false; |
778 | | |
779 | 557 | if (detail_is_set(MI)) { |
780 | 557 | aarch64_sysop sysop = { 0 }; |
781 | 557 | sysop.alias = AT->SysAlias; |
782 | 557 | sysop.sub_type = AARCH64_OP_AT; |
783 | 557 | AArch64_get_detail_op(MI, 0)->type = |
784 | 557 | AARCH64_OP_SYSALIAS; |
785 | 557 | AArch64_get_detail_op(MI, 0)->sysop = sysop; |
786 | 557 | AArch64_inc_op_count(MI); |
787 | 557 | } |
788 | 557 | NeedsReg = true; |
789 | 557 | Ins = "at "; |
790 | 557 | Name = AT->Name; |
791 | 557 | } break; |
792 | 2.79k | } |
793 | 2.79k | } else if (CnVal == 8 || CnVal == 9) { |
794 | | // TLBI aliases |
795 | 877 | const AArch64TLBI_TLBI *TLBI = |
796 | 877 | AArch64TLBI_lookupTLBIByEncoding(Encoding); |
797 | 877 | if (!TLBI || !AArch64_testFeatureList(MI->csh->mode, |
798 | 632 | TLBI->FeaturesRequired)) |
799 | 245 | return false; |
800 | | |
801 | 632 | if (detail_is_set(MI)) { |
802 | 632 | aarch64_sysop sysop = { 0 }; |
803 | 632 | sysop.reg = TLBI->SysReg; |
804 | 632 | sysop.sub_type = AARCH64_OP_TLBI; |
805 | 632 | AArch64_get_detail_op(MI, 0)->type = AARCH64_OP_SYSREG; |
806 | 632 | AArch64_get_detail_op(MI, 0)->sysop = sysop; |
807 | 632 | AArch64_inc_op_count(MI); |
808 | 632 | } |
809 | 632 | NeedsReg = TLBI->NeedsReg; |
810 | 632 | Ins = "tlbi "; |
811 | 632 | Name = TLBI->Name; |
812 | 632 | } else |
813 | 289 | return false; |
814 | | |
815 | 3.57k | #define TMP_STR_LEN 32 |
816 | 1.78k | char Str[TMP_STR_LEN] = { 0 }; |
817 | 1.78k | append_to_str_lower(Str, TMP_STR_LEN, Ins); |
818 | 1.78k | append_to_str_lower(Str, TMP_STR_LEN, Name); |
819 | 1.78k | #undef TMP_STR_LEN |
820 | | |
821 | 1.78k | SStream_concat1(O, ' '); |
822 | 1.78k | SStream_concat0(O, Str); |
823 | 1.78k | if (NeedsReg) { |
824 | 1.45k | SStream_concat0(O, ", "); |
825 | 1.45k | printRegName(O, MCOperand_getReg(MCInst_getOperand(MI, (4)))); |
826 | 1.45k | AArch64_set_detail_op_reg(MI, 4, MCInst_getOpVal(MI, 4)); |
827 | 1.45k | } |
828 | | |
829 | 1.78k | return true; |
830 | 3.96k | } |
831 | | |
832 | | bool printSyspAlias(MCInst *MI, SStream *O) |
833 | 981 | { |
834 | 981 | MCOperand *Op1 = MCInst_getOperand(MI, (0)); |
835 | 981 | MCOperand *Cn = MCInst_getOperand(MI, (1)); |
836 | 981 | MCOperand *Cm = MCInst_getOperand(MI, (2)); |
837 | 981 | MCOperand *Op2 = MCInst_getOperand(MI, (3)); |
838 | | |
839 | 981 | unsigned Op1Val = MCOperand_getImm(Op1); |
840 | 981 | unsigned CnVal = MCOperand_getImm(Cn); |
841 | 981 | unsigned CmVal = MCOperand_getImm(Cm); |
842 | 981 | unsigned Op2Val = MCOperand_getImm(Op2); |
843 | | |
844 | 981 | uint16_t Encoding = Op2Val; |
845 | 981 | Encoding |= CmVal << 3; |
846 | 981 | Encoding |= CnVal << 7; |
847 | 981 | Encoding |= Op1Val << 11; |
848 | | |
849 | 981 | const char *Ins; |
850 | 981 | const char *Name; |
851 | | |
852 | 981 | if (CnVal == 8 || CnVal == 9) { |
853 | | // TLBIP aliases |
854 | | |
855 | 734 | if (CnVal == 9) { |
856 | 371 | if (!AArch64_getFeatureBits(MI->csh->mode, |
857 | 371 | AArch64_FeatureAll) || |
858 | 371 | !AArch64_getFeatureBits(MI->csh->mode, |
859 | 371 | AArch64_FeatureXS)) |
860 | 0 | return false; |
861 | 371 | Encoding &= ~(1 << 7); |
862 | 371 | } |
863 | | |
864 | 734 | const AArch64TLBI_TLBI *TLBI = |
865 | 734 | AArch64TLBI_lookupTLBIByEncoding(Encoding); |
866 | 734 | if (!TLBI || !AArch64_testFeatureList(MI->csh->mode, |
867 | 613 | TLBI->FeaturesRequired)) |
868 | 121 | return false; |
869 | | |
870 | 613 | if (detail_is_set(MI)) { |
871 | 613 | aarch64_sysop sysop = { 0 }; |
872 | 613 | sysop.reg = TLBI->SysReg; |
873 | 613 | sysop.sub_type = AARCH64_OP_TLBI; |
874 | 613 | AArch64_get_detail_op(MI, 0)->type = AARCH64_OP_SYSREG; |
875 | 613 | AArch64_get_detail_op(MI, 0)->sysop = sysop; |
876 | 613 | AArch64_inc_op_count(MI); |
877 | 613 | } |
878 | 613 | Ins = "tlbip "; |
879 | 613 | Name = TLBI->Name; |
880 | 613 | } else |
881 | 247 | return false; |
882 | | |
883 | 1.58k | #define TMP_STR_LEN 32 |
884 | 613 | char Str[TMP_STR_LEN] = { 0 }; |
885 | 613 | append_to_str_lower(Str, TMP_STR_LEN, Ins); |
886 | 613 | append_to_str_lower(Str, TMP_STR_LEN, Name); |
887 | | |
888 | 613 | if (CnVal == 9) { |
889 | 361 | append_to_str_lower(Str, TMP_STR_LEN, "nxs"); |
890 | 361 | } |
891 | 613 | #undef TMP_STR_LEN |
892 | | |
893 | 613 | SStream_concat1(O, ' '); |
894 | 613 | SStream_concat0(O, Str); |
895 | 613 | SStream_concat0(O, ", "); |
896 | 613 | if (MCOperand_getReg(MCInst_getOperand(MI, (4))) == AArch64_XZR) |
897 | 244 | printSyspXzrPair(MI, 4, O); |
898 | 369 | else |
899 | 369 | CONCAT(printGPRSeqPairsClassOperand, 64)(MI, 4, O); |
900 | | |
901 | 613 | return true; |
902 | 981 | } |
903 | | |
904 | | #define DEFINE_printMatrix(EltSize) \ |
905 | | void CONCAT(printMatrix, EltSize)(MCInst * MI, unsigned OpNum, \ |
906 | | SStream *O) \ |
907 | 10.3k | { \ |
908 | 10.3k | AArch64_add_cs_detail_1( \ |
909 | 10.3k | MI, CONCAT(AArch64_OP_GROUP_Matrix, EltSize), OpNum, \ |
910 | 10.3k | EltSize); \ |
911 | 10.3k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ |
912 | 10.3k | \ |
913 | 10.3k | printRegName(O, MCOperand_getReg(RegOp)); \ |
914 | 10.3k | switch (EltSize) { \ |
915 | 78 | case 0: \ |
916 | 78 | break; \ |
917 | 0 | case 8: \ |
918 | 0 | SStream_concat0(O, ".b"); \ |
919 | 0 | break; \ |
920 | 2.32k | case 16: \ |
921 | 2.32k | SStream_concat0(O, ".h"); \ |
922 | 2.32k | break; \ |
923 | 4.43k | case 32: \ |
924 | 4.43k | SStream_concat0(O, ".s"); \ |
925 | 4.43k | break; \ |
926 | 3.56k | case 64: \ |
927 | 3.56k | SStream_concat0(O, ".d"); \ |
928 | 3.56k | 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 | 10.3k | } \ |
935 | 10.3k | } Line | Count | Source | 907 | 3.56k | { \ | 908 | 3.56k | AArch64_add_cs_detail_1( \ | 909 | 3.56k | MI, CONCAT(AArch64_OP_GROUP_Matrix, EltSize), OpNum, \ | 910 | 3.56k | EltSize); \ | 911 | 3.56k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ | 912 | 3.56k | \ | 913 | 3.56k | printRegName(O, MCOperand_getReg(RegOp)); \ | 914 | 3.56k | 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 | 3.56k | case 64: \ | 927 | 3.56k | SStream_concat0(O, ".d"); \ | 928 | 3.56k | 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.56k | } \ | 935 | 3.56k | } |
Line | Count | Source | 907 | 4.43k | { \ | 908 | 4.43k | AArch64_add_cs_detail_1( \ | 909 | 4.43k | MI, CONCAT(AArch64_OP_GROUP_Matrix, EltSize), OpNum, \ | 910 | 4.43k | EltSize); \ | 911 | 4.43k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ | 912 | 4.43k | \ | 913 | 4.43k | printRegName(O, MCOperand_getReg(RegOp)); \ | 914 | 4.43k | 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 | 4.43k | case 32: \ | 924 | 4.43k | SStream_concat0(O, ".s"); \ | 925 | 4.43k | 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 | 4.43k | } \ | 935 | 4.43k | } |
Line | Count | Source | 907 | 2.32k | { \ | 908 | 2.32k | AArch64_add_cs_detail_1( \ | 909 | 2.32k | MI, CONCAT(AArch64_OP_GROUP_Matrix, EltSize), OpNum, \ | 910 | 2.32k | EltSize); \ | 911 | 2.32k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ | 912 | 2.32k | \ | 913 | 2.32k | printRegName(O, MCOperand_getReg(RegOp)); \ | 914 | 2.32k | switch (EltSize) { \ | 915 | 0 | case 0: \ | 916 | 0 | break; \ | 917 | 0 | case 8: \ | 918 | 0 | SStream_concat0(O, ".b"); \ | 919 | 0 | break; \ | 920 | 2.32k | case 16: \ | 921 | 2.32k | SStream_concat0(O, ".h"); \ | 922 | 2.32k | 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.32k | } \ | 935 | 2.32k | } |
Line | Count | Source | 907 | 78 | { \ | 908 | 78 | AArch64_add_cs_detail_1( \ | 909 | 78 | MI, CONCAT(AArch64_OP_GROUP_Matrix, EltSize), OpNum, \ | 910 | 78 | EltSize); \ | 911 | 78 | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ | 912 | 78 | \ | 913 | 78 | printRegName(O, MCOperand_getReg(RegOp)); \ | 914 | 78 | switch (EltSize) { \ | 915 | 78 | case 0: \ | 916 | 78 | 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 | 78 | } \ | 935 | 78 | } |
|
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.53k | { \ |
945 | 6.53k | AArch64_add_cs_detail_1( \ |
946 | 6.53k | MI, \ |
947 | 6.53k | CONCAT(AArch64_OP_GROUP_MatrixTileVector, IsVertical), \ |
948 | 6.53k | OpNum, IsVertical); \ |
949 | 6.53k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ |
950 | 6.53k | \ |
951 | 6.53k | const char *RegName = getRegisterName(MCOperand_getReg(RegOp), \ |
952 | 6.53k | AArch64_NoRegAltName); \ |
953 | 6.53k | \ |
954 | 6.53k | unsigned buf_len = strlen(RegName) + 1; \ |
955 | 6.53k | char *Base = cs_mem_calloc(1, buf_len); \ |
956 | 6.53k | memcpy(Base, RegName, buf_len); \ |
957 | 6.53k | char *Dot = strchr(Base, '.'); \ |
958 | 6.53k | if (!Dot) { \ |
959 | 0 | SStream_concat0(O, RegName); \ |
960 | 0 | return; \ |
961 | 0 | } \ |
962 | 6.53k | *Dot = '\0'; /* Split string */ \ |
963 | 6.53k | char *Suffix = Dot + 1; \ |
964 | 6.53k | SStream_concat(O, "%s%s", Base, (IsVertical ? "v" : "h")); \ |
965 | 6.53k | SStream_concat1(O, '.'); \ |
966 | 6.53k | SStream_concat0(O, Suffix); \ |
967 | 6.53k | cs_mem_free(Base); \ |
968 | 6.53k | } Line | Count | Source | 944 | 3.62k | { \ | 945 | 3.62k | AArch64_add_cs_detail_1( \ | 946 | 3.62k | MI, \ | 947 | 3.62k | CONCAT(AArch64_OP_GROUP_MatrixTileVector, IsVertical), \ | 948 | 3.62k | OpNum, IsVertical); \ | 949 | 3.62k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ | 950 | 3.62k | \ | 951 | 3.62k | const char *RegName = getRegisterName(MCOperand_getReg(RegOp), \ | 952 | 3.62k | AArch64_NoRegAltName); \ | 953 | 3.62k | \ | 954 | 3.62k | unsigned buf_len = strlen(RegName) + 1; \ | 955 | 3.62k | char *Base = cs_mem_calloc(1, buf_len); \ | 956 | 3.62k | memcpy(Base, RegName, buf_len); \ | 957 | 3.62k | char *Dot = strchr(Base, '.'); \ | 958 | 3.62k | if (!Dot) { \ | 959 | 0 | SStream_concat0(O, RegName); \ | 960 | 0 | return; \ | 961 | 0 | } \ | 962 | 3.62k | *Dot = '\0'; /* Split string */ \ | 963 | 3.62k | char *Suffix = Dot + 1; \ | 964 | 3.62k | SStream_concat(O, "%s%s", Base, (IsVertical ? "v" : "h")); \ | 965 | 3.62k | SStream_concat1(O, '.'); \ | 966 | 3.62k | SStream_concat0(O, Suffix); \ | 967 | 3.62k | cs_mem_free(Base); \ | 968 | 3.62k | } |
Line | Count | Source | 944 | 2.91k | { \ | 945 | 2.91k | AArch64_add_cs_detail_1( \ | 946 | 2.91k | MI, \ | 947 | 2.91k | CONCAT(AArch64_OP_GROUP_MatrixTileVector, IsVertical), \ | 948 | 2.91k | OpNum, IsVertical); \ | 949 | 2.91k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); \ | 950 | 2.91k | \ | 951 | 2.91k | const char *RegName = getRegisterName(MCOperand_getReg(RegOp), \ | 952 | 2.91k | AArch64_NoRegAltName); \ | 953 | 2.91k | \ | 954 | 2.91k | unsigned buf_len = strlen(RegName) + 1; \ | 955 | 2.91k | char *Base = cs_mem_calloc(1, buf_len); \ | 956 | 2.91k | memcpy(Base, RegName, buf_len); \ | 957 | 2.91k | char *Dot = strchr(Base, '.'); \ | 958 | 2.91k | if (!Dot) { \ | 959 | 0 | SStream_concat0(O, RegName); \ | 960 | 0 | return; \ | 961 | 0 | } \ | 962 | 2.91k | *Dot = '\0'; /* Split string */ \ | 963 | 2.91k | char *Suffix = Dot + 1; \ | 964 | 2.91k | SStream_concat(O, "%s%s", Base, (IsVertical ? "v" : "h")); \ | 965 | 2.91k | SStream_concat1(O, '.'); \ | 966 | 2.91k | SStream_concat0(O, Suffix); \ | 967 | 2.91k | cs_mem_free(Base); \ | 968 | 2.91k | } |
|
969 | | DEFINE_printMatrixTileVector(0); |
970 | | DEFINE_printMatrixTileVector(1); |
971 | | |
972 | | void printMatrixTile(MCInst *MI, unsigned OpNum, SStream *O) |
973 | 1.98k | { |
974 | 1.98k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_MatrixTile, OpNum); |
975 | 1.98k | MCOperand *RegOp = MCInst_getOperand(MI, (OpNum)); |
976 | | |
977 | 1.98k | printRegName(O, MCOperand_getReg(RegOp)); |
978 | 1.98k | } |
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 | 345k | { |
993 | 345k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_Operand, OpNo); |
994 | 345k | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); |
995 | 345k | if (MCOperand_isReg(Op)) { |
996 | 295k | unsigned Reg = MCOperand_getReg(Op); |
997 | 295k | printRegName(O, Reg); |
998 | 295k | } else if (MCOperand_isImm(Op)) { |
999 | 49.3k | Op = MCInst_getOperand(MI, (OpNo)); |
1000 | 49.3k | SStream_concat(O, "%s", markup("<imm:")); |
1001 | 49.3k | printInt64Bang(O, MCOperand_getImm(Op)); |
1002 | 49.3k | SStream_concat0(O, markup(">")); |
1003 | 49.3k | } else { |
1004 | 0 | printUInt64Bang(O, MCInst_getOpVal(MI, OpNo)); |
1005 | 0 | } |
1006 | 345k | } |
1007 | | |
1008 | | void printImm(MCInst *MI, unsigned OpNo, SStream *O) |
1009 | 3.85k | { |
1010 | 3.85k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_Imm, OpNo); |
1011 | 3.85k | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); |
1012 | 3.85k | SStream_concat(O, "%s", markup("<imm:")); |
1013 | 3.85k | printInt64Bang(O, MCOperand_getImm(Op)); |
1014 | 3.85k | SStream_concat0(O, markup(">")); |
1015 | 3.85k | } |
1016 | | |
1017 | | void printImmHex(MCInst *MI, unsigned OpNo, SStream *O) |
1018 | 60 | { |
1019 | 60 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_ImmHex, OpNo); |
1020 | 60 | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); |
1021 | 60 | SStream_concat(O, "%s", markup("<imm:")); |
1022 | 60 | printInt64Bang(O, MCOperand_getImm(Op)); |
1023 | 60 | SStream_concat0(O, markup(">")); |
1024 | 60 | } |
1025 | | |
1026 | | #define DEFINE_printSImm(Size) \ |
1027 | | void CONCAT(printSImm, Size)(MCInst * MI, unsigned OpNo, SStream *O) \ |
1028 | 739 | { \ |
1029 | 739 | AArch64_add_cs_detail_1( \ |
1030 | 739 | MI, CONCAT(AArch64_OP_GROUP_SImm, Size), OpNo, Size); \ |
1031 | 739 | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); \ |
1032 | 739 | if (Size == 8) { \ |
1033 | 317 | SStream_concat(O, "%s", markup("<imm:")); \ |
1034 | 317 | printInt32Bang(O, MCOperand_getImm(Op)); \ |
1035 | 317 | SStream_concat0(O, markup(">")); \ |
1036 | 422 | } else if (Size == 16) { \ |
1037 | 422 | SStream_concat(O, "%s", markup("<imm:")); \ |
1038 | 422 | printInt32Bang(O, MCOperand_getImm(Op)); \ |
1039 | 422 | SStream_concat0(O, markup(">")); \ |
1040 | 422 | } 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 | 739 | } Line | Count | Source | 1028 | 422 | { \ | 1029 | 422 | AArch64_add_cs_detail_1( \ | 1030 | 422 | MI, CONCAT(AArch64_OP_GROUP_SImm, Size), OpNo, Size); \ | 1031 | 422 | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); \ | 1032 | 422 | 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 | 422 | } else if (Size == 16) { \ | 1037 | 422 | SStream_concat(O, "%s", markup("<imm:")); \ | 1038 | 422 | printInt32Bang(O, MCOperand_getImm(Op)); \ | 1039 | 422 | SStream_concat0(O, markup(">")); \ | 1040 | 422 | } 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 | 422 | } |
Line | Count | Source | 1028 | 317 | { \ | 1029 | 317 | AArch64_add_cs_detail_1( \ | 1030 | 317 | MI, CONCAT(AArch64_OP_GROUP_SImm, Size), OpNo, Size); \ | 1031 | 317 | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); \ | 1032 | 317 | if (Size == 8) { \ | 1033 | 317 | SStream_concat(O, "%s", markup("<imm:")); \ | 1034 | 317 | printInt32Bang(O, MCOperand_getImm(Op)); \ | 1035 | 317 | SStream_concat0(O, markup(">")); \ | 1036 | 317 | } 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 | 317 | } |
|
1046 | | DEFINE_printSImm(16); |
1047 | | DEFINE_printSImm(8); |
1048 | | |
1049 | | void printPostIncOperand(MCInst *MI, unsigned OpNo, unsigned Imm, SStream *O) |
1050 | 7.41k | { |
1051 | 7.41k | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); |
1052 | 7.41k | if (MCOperand_isReg(Op)) { |
1053 | 7.41k | unsigned Reg = MCOperand_getReg(Op); |
1054 | 7.41k | 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 | 7.41k | printRegName(O, Reg); |
1060 | 7.41k | } else |
1061 | 0 | CS_ASSERT_RET(0 && "unknown operand kind in printPostIncOperand64"); |
1062 | 7.41k | } |
1063 | | |
1064 | | void printVRegOperand(MCInst *MI, unsigned OpNo, SStream *O) |
1065 | 57.9k | { |
1066 | 57.9k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_VRegOperand, OpNo); |
1067 | 57.9k | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); |
1068 | | |
1069 | 57.9k | unsigned Reg = MCOperand_getReg(Op); |
1070 | 57.9k | printRegNameAlt(O, Reg, AArch64_vreg); |
1071 | 57.9k | } |
1072 | | |
1073 | | void printSysCROperand(MCInst *MI, unsigned OpNo, SStream *O) |
1074 | 5.63k | { |
1075 | 5.63k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_SysCROperand, OpNo); |
1076 | 5.63k | MCOperand *Op = MCInst_getOperand(MI, (OpNo)); |
1077 | | |
1078 | 5.63k | SStream_concat(O, "%s", "c"); |
1079 | 5.63k | printUInt32(O, MCOperand_getImm(Op)); |
1080 | 5.63k | SStream_concat1(O, '\0'); |
1081 | 5.63k | } |
1082 | | |
1083 | | void printAddSubImm(MCInst *MI, unsigned OpNum, SStream *O) |
1084 | 2.48k | { |
1085 | 2.48k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_AddSubImm, OpNum); |
1086 | 2.48k | MCOperand *MO = MCInst_getOperand(MI, (OpNum)); |
1087 | 2.48k | if (MCOperand_isImm(MO)) { |
1088 | 2.48k | unsigned Val = (MCOperand_getImm(MO) & 0xfff); |
1089 | | |
1090 | 2.48k | unsigned Shift = AArch64_AM_getShiftValue( |
1091 | 2.48k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1)))); |
1092 | 2.48k | SStream_concat(O, "%s", markup("<imm:")); |
1093 | 2.48k | printUInt32Bang(O, (Val)); |
1094 | 2.48k | SStream_concat0(O, markup(">")); |
1095 | 2.48k | if (Shift != 0) { |
1096 | 1.17k | printShifter(MI, OpNum + 1, O); |
1097 | 1.17k | } |
1098 | 2.48k | } else { |
1099 | 0 | printShifter(MI, OpNum + 1, O); |
1100 | 0 | } |
1101 | 2.48k | } |
1102 | | |
1103 | | #define DEFINE_printLogicalImm(T) \ |
1104 | | void CONCAT(printLogicalImm, T)(MCInst * MI, unsigned OpNum, \ |
1105 | | SStream *O) \ |
1106 | 9.55k | { \ |
1107 | 9.55k | AArch64_add_cs_detail_1( \ |
1108 | 9.55k | MI, CONCAT(AArch64_OP_GROUP_LogicalImm, T), OpNum, sizeof(T)); \ |
1109 | 9.55k | uint64_t Val = \ |
1110 | 9.55k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ |
1111 | 9.55k | SStream_concat(O, "%s", markup("<imm:")); \ |
1112 | 9.55k | printUInt64Bang(O, (AArch64_AM_decodeLogicalImmediate( \ |
1113 | 9.55k | Val, 8 * sizeof(T)))); \ |
1114 | 9.55k | SStream_concat0(O, markup(">")); \ |
1115 | 9.55k | } Line | Count | Source | 1106 | 2.78k | { \ | 1107 | 2.78k | AArch64_add_cs_detail_1( \ | 1108 | 2.78k | MI, CONCAT(AArch64_OP_GROUP_LogicalImm, T), OpNum, sizeof(T)); \ | 1109 | 2.78k | uint64_t Val = \ | 1110 | 2.78k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1111 | 2.78k | SStream_concat(O, "%s", markup("<imm:")); \ | 1112 | 2.78k | printUInt64Bang(O, (AArch64_AM_decodeLogicalImmediate( \ | 1113 | 2.78k | Val, 8 * sizeof(T)))); \ | 1114 | 2.78k | SStream_concat0(O, markup(">")); \ | 1115 | 2.78k | } |
Line | Count | Source | 1106 | 2.29k | { \ | 1107 | 2.29k | AArch64_add_cs_detail_1( \ | 1108 | 2.29k | MI, CONCAT(AArch64_OP_GROUP_LogicalImm, T), OpNum, sizeof(T)); \ | 1109 | 2.29k | uint64_t Val = \ | 1110 | 2.29k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1111 | 2.29k | SStream_concat(O, "%s", markup("<imm:")); \ | 1112 | 2.29k | printUInt64Bang(O, (AArch64_AM_decodeLogicalImmediate( \ | 1113 | 2.29k | Val, 8 * sizeof(T)))); \ | 1114 | 2.29k | SStream_concat0(O, markup(">")); \ | 1115 | 2.29k | } |
Line | Count | Source | 1106 | 3.12k | { \ | 1107 | 3.12k | AArch64_add_cs_detail_1( \ | 1108 | 3.12k | MI, CONCAT(AArch64_OP_GROUP_LogicalImm, T), OpNum, sizeof(T)); \ | 1109 | 3.12k | uint64_t Val = \ | 1110 | 3.12k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1111 | 3.12k | SStream_concat(O, "%s", markup("<imm:")); \ | 1112 | 3.12k | printUInt64Bang(O, (AArch64_AM_decodeLogicalImmediate( \ | 1113 | 3.12k | Val, 8 * sizeof(T)))); \ | 1114 | 3.12k | SStream_concat0(O, markup(">")); \ | 1115 | 3.12k | } |
Line | Count | Source | 1106 | 1.35k | { \ | 1107 | 1.35k | AArch64_add_cs_detail_1( \ | 1108 | 1.35k | MI, CONCAT(AArch64_OP_GROUP_LogicalImm, T), OpNum, sizeof(T)); \ | 1109 | 1.35k | uint64_t Val = \ | 1110 | 1.35k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1111 | 1.35k | SStream_concat(O, "%s", markup("<imm:")); \ | 1112 | 1.35k | printUInt64Bang(O, (AArch64_AM_decodeLogicalImmediate( \ | 1113 | 1.35k | Val, 8 * sizeof(T)))); \ | 1114 | 1.35k | SStream_concat0(O, markup(">")); \ | 1115 | 1.35k | } |
|
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 | 9.90k | { |
1123 | 9.90k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_Shifter, OpNum); |
1124 | 9.90k | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
1125 | | // LSL #0 should not be printed. |
1126 | 9.90k | if (AArch64_AM_getShiftType(Val) == AArch64_AM_LSL && |
1127 | 9.90k | AArch64_AM_getShiftValue(Val) == 0) |
1128 | 845 | return; |
1129 | 9.05k | SStream_concat( |
1130 | 9.05k | O, "%s%s%s%s#%d", ", ", |
1131 | 9.05k | AArch64_AM_getShiftExtendName(AArch64_AM_getShiftType(Val)), |
1132 | 9.05k | " ", markup("<imm:"), AArch64_AM_getShiftValue(Val)); |
1133 | 9.05k | SStream_concat0(O, markup(">")); |
1134 | 9.05k | } |
1135 | | |
1136 | | void printShiftedRegister(MCInst *MI, unsigned OpNum, SStream *O) |
1137 | 5.21k | { |
1138 | 5.21k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_ShiftedRegister, OpNum); |
1139 | 5.21k | printRegName(O, MCOperand_getReg(MCInst_getOperand(MI, (OpNum)))); |
1140 | 5.21k | printShifter(MI, OpNum + 1, O); |
1141 | 5.21k | } |
1142 | | |
1143 | | void printExtendedRegister(MCInst *MI, unsigned OpNum, SStream *O) |
1144 | 2.72k | { |
1145 | 2.72k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_ExtendedRegister, OpNum); |
1146 | 2.72k | printRegName(O, MCOperand_getReg(MCInst_getOperand(MI, (OpNum)))); |
1147 | 2.72k | printArithExtend(MI, OpNum + 1, O); |
1148 | 2.72k | } |
1149 | | |
1150 | | void printArithExtend(MCInst *MI, unsigned OpNum, SStream *O) |
1151 | 3.24k | { |
1152 | 3.24k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_ArithExtend, OpNum); |
1153 | 3.24k | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
1154 | 3.24k | AArch64_AM_ShiftExtendType ExtType = AArch64_AM_getArithExtendType(Val); |
1155 | 3.24k | 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.24k | if (ExtType == AArch64_AM_UXTW || ExtType == AArch64_AM_UXTX) { |
1161 | 1.54k | unsigned Dest = MCOperand_getReg(MCInst_getOperand(MI, (0))); |
1162 | 1.54k | unsigned Src1 = MCOperand_getReg(MCInst_getOperand(MI, (1))); |
1163 | 1.54k | if (((Dest == AArch64_SP || Src1 == AArch64_SP) && |
1164 | 1.54k | ExtType == AArch64_AM_UXTX) || |
1165 | 1.54k | ((Dest == AArch64_WSP || Src1 == AArch64_WSP) && |
1166 | 1.53k | ExtType == AArch64_AM_UXTW)) { |
1167 | 460 | if (ShiftVal != 0) { |
1168 | 460 | SStream_concat(O, "%s%s", ", lsl ", |
1169 | 460 | markup("<imm:")); |
1170 | 460 | printUInt32Bang(O, ShiftVal); |
1171 | 460 | SStream_concat0(O, markup(">")); |
1172 | 460 | } |
1173 | 460 | return; |
1174 | 460 | } |
1175 | 1.54k | } |
1176 | 2.78k | SStream_concat(O, "%s", ", "); |
1177 | 2.78k | SStream_concat0(O, AArch64_AM_getShiftExtendName(ExtType)); |
1178 | 2.78k | if (ShiftVal != 0) { |
1179 | 2.32k | SStream_concat(O, "%s%s#%d", " ", markup("<imm:"), ShiftVal); |
1180 | 2.32k | SStream_concat0(O, markup(">")); |
1181 | 2.32k | } |
1182 | 2.78k | } |
1183 | | |
1184 | | static void printMemExtendImpl(bool SignExtend, bool DoShift, unsigned Width, |
1185 | | char SrcRegKind, SStream *O, bool getUseMarkup) |
1186 | 17.6k | { |
1187 | | // sxtw, sxtx, uxtw or lsl (== uxtx) |
1188 | 17.6k | bool IsLSL = !SignExtend && SrcRegKind == 'x'; |
1189 | 17.6k | if (IsLSL) |
1190 | 7.40k | SStream_concat0(O, "lsl"); |
1191 | 10.2k | else { |
1192 | 10.2k | SStream_concat(O, "%c%s", (SignExtend ? 's' : 'u'), "xt"); |
1193 | 10.2k | SStream_concat1(O, SrcRegKind); |
1194 | 10.2k | } |
1195 | | |
1196 | 17.6k | if (DoShift || IsLSL) { |
1197 | 12.1k | SStream_concat0(O, " "); |
1198 | 12.1k | if (getUseMarkup) |
1199 | 0 | SStream_concat0(O, "<imm:"); |
1200 | 12.1k | unsigned ShiftAmount = DoShift ? Log2_32(Width / 8) : 0; |
1201 | 12.1k | SStream_concat(O, "%s%d", "#", ShiftAmount); |
1202 | 12.1k | if (getUseMarkup) |
1203 | 0 | SStream_concat0(O, ">"); |
1204 | 12.1k | } |
1205 | 17.6k | } |
1206 | | |
1207 | | void printMemExtend(MCInst *MI, unsigned OpNum, SStream *O, char SrcRegKind, |
1208 | | unsigned Width) |
1209 | 2.00k | { |
1210 | 2.00k | bool SignExtend = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
1211 | 2.00k | bool DoShift = MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); |
1212 | 2.00k | printMemExtendImpl(SignExtend, DoShift, Width, SrcRegKind, O, |
1213 | 2.00k | getUseMarkup()); |
1214 | 2.00k | } |
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 | 20.4k | { \ |
1223 | 20.4k | AArch64_add_cs_detail_4( \ |
1224 | 20.4k | MI, \ |
1225 | 20.4k | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ |
1226 | 20.4k | SignExtend), \ |
1227 | 20.4k | ExtWidth), \ |
1228 | 20.4k | SrcRegKind), \ |
1229 | 20.4k | Suffix), \ |
1230 | 20.4k | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ |
1231 | 20.4k | CHAR(Suffix)); \ |
1232 | 20.4k | printOperand(MI, OpNum, O); \ |
1233 | 20.4k | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ |
1234 | 12.9k | SStream_concat1(O, '.'); \ |
1235 | 12.9k | SStream_concat1(O, CHAR(Suffix)); \ |
1236 | 12.9k | SStream_concat1(O, '\0'); \ |
1237 | 12.9k | } else \ |
1238 | 20.4k | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ |
1239 | 20.4k | "Unsupported suffix size"); \ |
1240 | 20.4k | bool DoShift = ExtWidth != 8; \ |
1241 | 20.4k | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ |
1242 | 15.6k | SStream_concat0(O, ", "); \ |
1243 | 15.6k | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ |
1244 | 15.6k | CHAR(SrcRegKind), O, \ |
1245 | 15.6k | getUseMarkup()); \ |
1246 | 15.6k | } \ |
1247 | 20.4k | } printRegWithShiftExtend_0_8_x_d Line | Count | Source | 1222 | 1.64k | { \ | 1223 | 1.64k | AArch64_add_cs_detail_4( \ | 1224 | 1.64k | MI, \ | 1225 | 1.64k | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 1.64k | SignExtend), \ | 1227 | 1.64k | ExtWidth), \ | 1228 | 1.64k | SrcRegKind), \ | 1229 | 1.64k | Suffix), \ | 1230 | 1.64k | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 1.64k | CHAR(Suffix)); \ | 1232 | 1.64k | printOperand(MI, OpNum, O); \ | 1233 | 1.64k | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 1.64k | SStream_concat1(O, '.'); \ | 1235 | 1.64k | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 1.64k | SStream_concat1(O, '\0'); \ | 1237 | 1.64k | } else \ | 1238 | 1.64k | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 1.64k | "Unsupported suffix size"); \ | 1240 | 1.64k | bool DoShift = ExtWidth != 8; \ | 1241 | 1.64k | 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 | 1.64k | } |
printRegWithShiftExtend_1_8_w_d Line | Count | Source | 1222 | 1.28k | { \ | 1223 | 1.28k | AArch64_add_cs_detail_4( \ | 1224 | 1.28k | MI, \ | 1225 | 1.28k | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 1.28k | SignExtend), \ | 1227 | 1.28k | ExtWidth), \ | 1228 | 1.28k | SrcRegKind), \ | 1229 | 1.28k | Suffix), \ | 1230 | 1.28k | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 1.28k | CHAR(Suffix)); \ | 1232 | 1.28k | printOperand(MI, OpNum, O); \ | 1233 | 1.28k | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 1.28k | SStream_concat1(O, '.'); \ | 1235 | 1.28k | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 1.28k | SStream_concat1(O, '\0'); \ | 1237 | 1.28k | } else \ | 1238 | 1.28k | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 1.28k | "Unsupported suffix size"); \ | 1240 | 1.28k | bool DoShift = ExtWidth != 8; \ | 1241 | 1.28k | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 1.28k | SStream_concat0(O, ", "); \ | 1243 | 1.28k | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 1.28k | CHAR(SrcRegKind), O, \ | 1245 | 1.28k | getUseMarkup()); \ | 1246 | 1.28k | } \ | 1247 | 1.28k | } |
printRegWithShiftExtend_0_8_w_d Line | Count | Source | 1222 | 2.10k | { \ | 1223 | 2.10k | AArch64_add_cs_detail_4( \ | 1224 | 2.10k | MI, \ | 1225 | 2.10k | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 2.10k | SignExtend), \ | 1227 | 2.10k | ExtWidth), \ | 1228 | 2.10k | SrcRegKind), \ | 1229 | 2.10k | Suffix), \ | 1230 | 2.10k | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 2.10k | CHAR(Suffix)); \ | 1232 | 2.10k | printOperand(MI, OpNum, O); \ | 1233 | 2.10k | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 2.10k | SStream_concat1(O, '.'); \ | 1235 | 2.10k | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 2.10k | SStream_concat1(O, '\0'); \ | 1237 | 2.10k | } else \ | 1238 | 2.10k | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 2.10k | "Unsupported suffix size"); \ | 1240 | 2.10k | bool DoShift = ExtWidth != 8; \ | 1241 | 2.10k | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 2.10k | SStream_concat0(O, ", "); \ | 1243 | 2.10k | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 2.10k | CHAR(SrcRegKind), O, \ | 1245 | 2.10k | getUseMarkup()); \ | 1246 | 2.10k | } \ | 1247 | 2.10k | } |
printRegWithShiftExtend_0_8_x_0 Line | Count | Source | 1222 | 3.13k | { \ | 1223 | 3.13k | AArch64_add_cs_detail_4( \ | 1224 | 3.13k | MI, \ | 1225 | 3.13k | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 3.13k | SignExtend), \ | 1227 | 3.13k | ExtWidth), \ | 1228 | 3.13k | SrcRegKind), \ | 1229 | 3.13k | Suffix), \ | 1230 | 3.13k | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 3.13k | CHAR(Suffix)); \ | 1232 | 3.13k | printOperand(MI, OpNum, O); \ | 1233 | 3.13k | 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 | 3.13k | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 3.13k | "Unsupported suffix size"); \ | 1240 | 3.13k | bool DoShift = ExtWidth != 8; \ | 1241 | 3.13k | 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 | 3.13k | } |
printRegWithShiftExtend_1_8_w_s Line | Count | Source | 1222 | 820 | { \ | 1223 | 820 | AArch64_add_cs_detail_4( \ | 1224 | 820 | MI, \ | 1225 | 820 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 820 | SignExtend), \ | 1227 | 820 | ExtWidth), \ | 1228 | 820 | SrcRegKind), \ | 1229 | 820 | Suffix), \ | 1230 | 820 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 820 | CHAR(Suffix)); \ | 1232 | 820 | printOperand(MI, OpNum, O); \ | 1233 | 820 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 820 | SStream_concat1(O, '.'); \ | 1235 | 820 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 820 | SStream_concat1(O, '\0'); \ | 1237 | 820 | } else \ | 1238 | 820 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 820 | "Unsupported suffix size"); \ | 1240 | 820 | bool DoShift = ExtWidth != 8; \ | 1241 | 820 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 820 | SStream_concat0(O, ", "); \ | 1243 | 820 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 820 | CHAR(SrcRegKind), O, \ | 1245 | 820 | getUseMarkup()); \ | 1246 | 820 | } \ | 1247 | 820 | } |
printRegWithShiftExtend_0_8_w_s Line | Count | Source | 1222 | 677 | { \ | 1223 | 677 | AArch64_add_cs_detail_4( \ | 1224 | 677 | MI, \ | 1225 | 677 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 677 | SignExtend), \ | 1227 | 677 | ExtWidth), \ | 1228 | 677 | SrcRegKind), \ | 1229 | 677 | Suffix), \ | 1230 | 677 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 677 | CHAR(Suffix)); \ | 1232 | 677 | printOperand(MI, OpNum, O); \ | 1233 | 677 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 677 | SStream_concat1(O, '.'); \ | 1235 | 677 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 677 | SStream_concat1(O, '\0'); \ | 1237 | 677 | } else \ | 1238 | 677 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 677 | "Unsupported suffix size"); \ | 1240 | 677 | bool DoShift = ExtWidth != 8; \ | 1241 | 677 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 677 | SStream_concat0(O, ", "); \ | 1243 | 677 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 677 | CHAR(SrcRegKind), O, \ | 1245 | 677 | getUseMarkup()); \ | 1246 | 677 | } \ | 1247 | 677 | } |
printRegWithShiftExtend_0_64_x_d Line | Count | Source | 1222 | 781 | { \ | 1223 | 781 | AArch64_add_cs_detail_4( \ | 1224 | 781 | MI, \ | 1225 | 781 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 781 | SignExtend), \ | 1227 | 781 | ExtWidth), \ | 1228 | 781 | SrcRegKind), \ | 1229 | 781 | Suffix), \ | 1230 | 781 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 781 | CHAR(Suffix)); \ | 1232 | 781 | printOperand(MI, OpNum, O); \ | 1233 | 781 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 781 | SStream_concat1(O, '.'); \ | 1235 | 781 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 781 | SStream_concat1(O, '\0'); \ | 1237 | 781 | } else \ | 1238 | 781 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 781 | "Unsupported suffix size"); \ | 1240 | 781 | bool DoShift = ExtWidth != 8; \ | 1241 | 781 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 781 | SStream_concat0(O, ", "); \ | 1243 | 781 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 781 | CHAR(SrcRegKind), O, \ | 1245 | 781 | getUseMarkup()); \ | 1246 | 781 | } \ | 1247 | 781 | } |
printRegWithShiftExtend_1_64_w_d Line | Count | Source | 1222 | 290 | { \ | 1223 | 290 | AArch64_add_cs_detail_4( \ | 1224 | 290 | MI, \ | 1225 | 290 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 290 | SignExtend), \ | 1227 | 290 | ExtWidth), \ | 1228 | 290 | SrcRegKind), \ | 1229 | 290 | Suffix), \ | 1230 | 290 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 290 | CHAR(Suffix)); \ | 1232 | 290 | printOperand(MI, OpNum, O); \ | 1233 | 290 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 290 | SStream_concat1(O, '.'); \ | 1235 | 290 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 290 | SStream_concat1(O, '\0'); \ | 1237 | 290 | } else \ | 1238 | 290 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 290 | "Unsupported suffix size"); \ | 1240 | 290 | bool DoShift = ExtWidth != 8; \ | 1241 | 290 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 290 | SStream_concat0(O, ", "); \ | 1243 | 290 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 290 | CHAR(SrcRegKind), O, \ | 1245 | 290 | getUseMarkup()); \ | 1246 | 290 | } \ | 1247 | 290 | } |
printRegWithShiftExtend_0_64_w_d Line | Count | Source | 1222 | 829 | { \ | 1223 | 829 | AArch64_add_cs_detail_4( \ | 1224 | 829 | MI, \ | 1225 | 829 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 829 | SignExtend), \ | 1227 | 829 | ExtWidth), \ | 1228 | 829 | SrcRegKind), \ | 1229 | 829 | Suffix), \ | 1230 | 829 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 829 | CHAR(Suffix)); \ | 1232 | 829 | printOperand(MI, OpNum, O); \ | 1233 | 829 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 829 | SStream_concat1(O, '.'); \ | 1235 | 829 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 829 | SStream_concat1(O, '\0'); \ | 1237 | 829 | } else \ | 1238 | 829 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 829 | "Unsupported suffix size"); \ | 1240 | 829 | bool DoShift = ExtWidth != 8; \ | 1241 | 829 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 829 | SStream_concat0(O, ", "); \ | 1243 | 829 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 829 | CHAR(SrcRegKind), O, \ | 1245 | 829 | getUseMarkup()); \ | 1246 | 829 | } \ | 1247 | 829 | } |
printRegWithShiftExtend_0_64_x_0 Line | Count | Source | 1222 | 920 | { \ | 1223 | 920 | AArch64_add_cs_detail_4( \ | 1224 | 920 | MI, \ | 1225 | 920 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 920 | SignExtend), \ | 1227 | 920 | ExtWidth), \ | 1228 | 920 | SrcRegKind), \ | 1229 | 920 | Suffix), \ | 1230 | 920 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 920 | CHAR(Suffix)); \ | 1232 | 920 | printOperand(MI, OpNum, O); \ | 1233 | 920 | 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 | 920 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 920 | "Unsupported suffix size"); \ | 1240 | 920 | bool DoShift = ExtWidth != 8; \ | 1241 | 920 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 920 | SStream_concat0(O, ", "); \ | 1243 | 920 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 920 | CHAR(SrcRegKind), O, \ | 1245 | 920 | getUseMarkup()); \ | 1246 | 920 | } \ | 1247 | 920 | } |
printRegWithShiftExtend_1_64_w_s Line | Count | Source | 1222 | 79 | { \ | 1223 | 79 | AArch64_add_cs_detail_4( \ | 1224 | 79 | MI, \ | 1225 | 79 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 79 | SignExtend), \ | 1227 | 79 | ExtWidth), \ | 1228 | 79 | SrcRegKind), \ | 1229 | 79 | Suffix), \ | 1230 | 79 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 79 | CHAR(Suffix)); \ | 1232 | 79 | printOperand(MI, OpNum, O); \ | 1233 | 79 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 79 | SStream_concat1(O, '.'); \ | 1235 | 79 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 79 | SStream_concat1(O, '\0'); \ | 1237 | 79 | } else \ | 1238 | 79 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 79 | "Unsupported suffix size"); \ | 1240 | 79 | bool DoShift = ExtWidth != 8; \ | 1241 | 79 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 79 | SStream_concat0(O, ", "); \ | 1243 | 79 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 79 | CHAR(SrcRegKind), O, \ | 1245 | 79 | getUseMarkup()); \ | 1246 | 79 | } \ | 1247 | 79 | } |
printRegWithShiftExtend_0_64_w_s Line | Count | Source | 1222 | 40 | { \ | 1223 | 40 | AArch64_add_cs_detail_4( \ | 1224 | 40 | MI, \ | 1225 | 40 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 40 | SignExtend), \ | 1227 | 40 | ExtWidth), \ | 1228 | 40 | SrcRegKind), \ | 1229 | 40 | Suffix), \ | 1230 | 40 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 40 | CHAR(Suffix)); \ | 1232 | 40 | printOperand(MI, OpNum, O); \ | 1233 | 40 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 40 | SStream_concat1(O, '.'); \ | 1235 | 40 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 40 | SStream_concat1(O, '\0'); \ | 1237 | 40 | } else \ | 1238 | 40 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 40 | "Unsupported suffix size"); \ | 1240 | 40 | bool DoShift = ExtWidth != 8; \ | 1241 | 40 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 40 | SStream_concat0(O, ", "); \ | 1243 | 40 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 40 | CHAR(SrcRegKind), O, \ | 1245 | 40 | getUseMarkup()); \ | 1246 | 40 | } \ | 1247 | 40 | } |
printRegWithShiftExtend_0_16_x_d Line | Count | Source | 1222 | 435 | { \ | 1223 | 435 | AArch64_add_cs_detail_4( \ | 1224 | 435 | MI, \ | 1225 | 435 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 435 | SignExtend), \ | 1227 | 435 | ExtWidth), \ | 1228 | 435 | SrcRegKind), \ | 1229 | 435 | Suffix), \ | 1230 | 435 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 435 | CHAR(Suffix)); \ | 1232 | 435 | printOperand(MI, OpNum, O); \ | 1233 | 435 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 435 | SStream_concat1(O, '.'); \ | 1235 | 435 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 435 | SStream_concat1(O, '\0'); \ | 1237 | 435 | } else \ | 1238 | 435 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 435 | "Unsupported suffix size"); \ | 1240 | 435 | bool DoShift = ExtWidth != 8; \ | 1241 | 435 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 435 | SStream_concat0(O, ", "); \ | 1243 | 435 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 435 | CHAR(SrcRegKind), O, \ | 1245 | 435 | getUseMarkup()); \ | 1246 | 435 | } \ | 1247 | 435 | } |
printRegWithShiftExtend_1_16_w_d Line | Count | Source | 1222 | 449 | { \ | 1223 | 449 | AArch64_add_cs_detail_4( \ | 1224 | 449 | MI, \ | 1225 | 449 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 449 | SignExtend), \ | 1227 | 449 | ExtWidth), \ | 1228 | 449 | SrcRegKind), \ | 1229 | 449 | Suffix), \ | 1230 | 449 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 449 | CHAR(Suffix)); \ | 1232 | 449 | printOperand(MI, OpNum, O); \ | 1233 | 449 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 449 | SStream_concat1(O, '.'); \ | 1235 | 449 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 449 | SStream_concat1(O, '\0'); \ | 1237 | 449 | } else \ | 1238 | 449 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 449 | "Unsupported suffix size"); \ | 1240 | 449 | bool DoShift = ExtWidth != 8; \ | 1241 | 449 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 449 | SStream_concat0(O, ", "); \ | 1243 | 449 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 449 | CHAR(SrcRegKind), O, \ | 1245 | 449 | getUseMarkup()); \ | 1246 | 449 | } \ | 1247 | 449 | } |
printRegWithShiftExtend_0_16_w_d Line | Count | Source | 1222 | 196 | { \ | 1223 | 196 | AArch64_add_cs_detail_4( \ | 1224 | 196 | MI, \ | 1225 | 196 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 196 | SignExtend), \ | 1227 | 196 | ExtWidth), \ | 1228 | 196 | SrcRegKind), \ | 1229 | 196 | Suffix), \ | 1230 | 196 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 196 | CHAR(Suffix)); \ | 1232 | 196 | printOperand(MI, OpNum, O); \ | 1233 | 196 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 196 | SStream_concat1(O, '.'); \ | 1235 | 196 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 196 | SStream_concat1(O, '\0'); \ | 1237 | 196 | } else \ | 1238 | 196 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 196 | "Unsupported suffix size"); \ | 1240 | 196 | bool DoShift = ExtWidth != 8; \ | 1241 | 196 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 196 | SStream_concat0(O, ", "); \ | 1243 | 196 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 196 | CHAR(SrcRegKind), O, \ | 1245 | 196 | getUseMarkup()); \ | 1246 | 196 | } \ | 1247 | 196 | } |
printRegWithShiftExtend_0_16_x_0 Line | Count | Source | 1222 | 1.48k | { \ | 1223 | 1.48k | AArch64_add_cs_detail_4( \ | 1224 | 1.48k | MI, \ | 1225 | 1.48k | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 1.48k | SignExtend), \ | 1227 | 1.48k | ExtWidth), \ | 1228 | 1.48k | SrcRegKind), \ | 1229 | 1.48k | Suffix), \ | 1230 | 1.48k | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 1.48k | CHAR(Suffix)); \ | 1232 | 1.48k | printOperand(MI, OpNum, O); \ | 1233 | 1.48k | 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.48k | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 1.48k | "Unsupported suffix size"); \ | 1240 | 1.48k | bool DoShift = ExtWidth != 8; \ | 1241 | 1.48k | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 1.48k | SStream_concat0(O, ", "); \ | 1243 | 1.48k | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 1.48k | CHAR(SrcRegKind), O, \ | 1245 | 1.48k | getUseMarkup()); \ | 1246 | 1.48k | } \ | 1247 | 1.48k | } |
printRegWithShiftExtend_1_16_w_s Line | Count | Source | 1222 | 140 | { \ | 1223 | 140 | AArch64_add_cs_detail_4( \ | 1224 | 140 | MI, \ | 1225 | 140 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 140 | SignExtend), \ | 1227 | 140 | ExtWidth), \ | 1228 | 140 | SrcRegKind), \ | 1229 | 140 | Suffix), \ | 1230 | 140 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 140 | CHAR(Suffix)); \ | 1232 | 140 | printOperand(MI, OpNum, O); \ | 1233 | 140 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 140 | SStream_concat1(O, '.'); \ | 1235 | 140 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 140 | SStream_concat1(O, '\0'); \ | 1237 | 140 | } else \ | 1238 | 140 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 140 | "Unsupported suffix size"); \ | 1240 | 140 | bool DoShift = ExtWidth != 8; \ | 1241 | 140 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 140 | SStream_concat0(O, ", "); \ | 1243 | 140 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 140 | CHAR(SrcRegKind), O, \ | 1245 | 140 | getUseMarkup()); \ | 1246 | 140 | } \ | 1247 | 140 | } |
printRegWithShiftExtend_0_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_32_x_d Line | Count | Source | 1222 | 561 | { \ | 1223 | 561 | AArch64_add_cs_detail_4( \ | 1224 | 561 | MI, \ | 1225 | 561 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 561 | SignExtend), \ | 1227 | 561 | ExtWidth), \ | 1228 | 561 | SrcRegKind), \ | 1229 | 561 | Suffix), \ | 1230 | 561 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 561 | CHAR(Suffix)); \ | 1232 | 561 | printOperand(MI, OpNum, O); \ | 1233 | 561 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 561 | SStream_concat1(O, '.'); \ | 1235 | 561 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 561 | SStream_concat1(O, '\0'); \ | 1237 | 561 | } else \ | 1238 | 561 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 561 | "Unsupported suffix size"); \ | 1240 | 561 | bool DoShift = ExtWidth != 8; \ | 1241 | 561 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 561 | SStream_concat0(O, ", "); \ | 1243 | 561 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 561 | CHAR(SrcRegKind), O, \ | 1245 | 561 | getUseMarkup()); \ | 1246 | 561 | } \ | 1247 | 561 | } |
printRegWithShiftExtend_1_32_w_d Line | Count | Source | 1222 | 908 | { \ | 1223 | 908 | AArch64_add_cs_detail_4( \ | 1224 | 908 | MI, \ | 1225 | 908 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 908 | SignExtend), \ | 1227 | 908 | ExtWidth), \ | 1228 | 908 | SrcRegKind), \ | 1229 | 908 | Suffix), \ | 1230 | 908 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 908 | CHAR(Suffix)); \ | 1232 | 908 | printOperand(MI, OpNum, O); \ | 1233 | 908 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 908 | SStream_concat1(O, '.'); \ | 1235 | 908 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 908 | SStream_concat1(O, '\0'); \ | 1237 | 908 | } else \ | 1238 | 908 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 908 | "Unsupported suffix size"); \ | 1240 | 908 | bool DoShift = ExtWidth != 8; \ | 1241 | 908 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 908 | SStream_concat0(O, ", "); \ | 1243 | 908 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 908 | CHAR(SrcRegKind), O, \ | 1245 | 908 | getUseMarkup()); \ | 1246 | 908 | } \ | 1247 | 908 | } |
printRegWithShiftExtend_0_32_w_d Line | Count | Source | 1222 | 646 | { \ | 1223 | 646 | AArch64_add_cs_detail_4( \ | 1224 | 646 | MI, \ | 1225 | 646 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 646 | SignExtend), \ | 1227 | 646 | ExtWidth), \ | 1228 | 646 | SrcRegKind), \ | 1229 | 646 | Suffix), \ | 1230 | 646 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 646 | CHAR(Suffix)); \ | 1232 | 646 | printOperand(MI, OpNum, O); \ | 1233 | 646 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 646 | SStream_concat1(O, '.'); \ | 1235 | 646 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 646 | SStream_concat1(O, '\0'); \ | 1237 | 646 | } else \ | 1238 | 646 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 646 | "Unsupported suffix size"); \ | 1240 | 646 | bool DoShift = ExtWidth != 8; \ | 1241 | 646 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 646 | SStream_concat0(O, ", "); \ | 1243 | 646 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 646 | CHAR(SrcRegKind), O, \ | 1245 | 646 | getUseMarkup()); \ | 1246 | 646 | } \ | 1247 | 646 | } |
printRegWithShiftExtend_0_32_x_0 Line | Count | Source | 1222 | 1.19k | { \ | 1223 | 1.19k | AArch64_add_cs_detail_4( \ | 1224 | 1.19k | MI, \ | 1225 | 1.19k | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 1.19k | SignExtend), \ | 1227 | 1.19k | ExtWidth), \ | 1228 | 1.19k | SrcRegKind), \ | 1229 | 1.19k | Suffix), \ | 1230 | 1.19k | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 1.19k | CHAR(Suffix)); \ | 1232 | 1.19k | printOperand(MI, OpNum, O); \ | 1233 | 1.19k | 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.19k | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 1.19k | "Unsupported suffix size"); \ | 1240 | 1.19k | bool DoShift = ExtWidth != 8; \ | 1241 | 1.19k | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 1.19k | SStream_concat0(O, ", "); \ | 1243 | 1.19k | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 1.19k | CHAR(SrcRegKind), O, \ | 1245 | 1.19k | getUseMarkup()); \ | 1246 | 1.19k | } \ | 1247 | 1.19k | } |
printRegWithShiftExtend_1_32_w_s Line | Count | Source | 1222 | 305 | { \ | 1223 | 305 | AArch64_add_cs_detail_4( \ | 1224 | 305 | MI, \ | 1225 | 305 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 305 | SignExtend), \ | 1227 | 305 | ExtWidth), \ | 1228 | 305 | SrcRegKind), \ | 1229 | 305 | Suffix), \ | 1230 | 305 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 305 | CHAR(Suffix)); \ | 1232 | 305 | printOperand(MI, OpNum, O); \ | 1233 | 305 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 305 | SStream_concat1(O, '.'); \ | 1235 | 305 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 305 | SStream_concat1(O, '\0'); \ | 1237 | 305 | } else \ | 1238 | 305 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 305 | "Unsupported suffix size"); \ | 1240 | 305 | bool DoShift = ExtWidth != 8; \ | 1241 | 305 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 305 | SStream_concat0(O, ", "); \ | 1243 | 305 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 305 | CHAR(SrcRegKind), O, \ | 1245 | 305 | getUseMarkup()); \ | 1246 | 305 | } \ | 1247 | 305 | } |
printRegWithShiftExtend_0_32_w_s Line | Count | Source | 1222 | 35 | { \ | 1223 | 35 | AArch64_add_cs_detail_4( \ | 1224 | 35 | MI, \ | 1225 | 35 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 35 | SignExtend), \ | 1227 | 35 | ExtWidth), \ | 1228 | 35 | SrcRegKind), \ | 1229 | 35 | Suffix), \ | 1230 | 35 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 35 | CHAR(Suffix)); \ | 1232 | 35 | printOperand(MI, OpNum, O); \ | 1233 | 35 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 35 | SStream_concat1(O, '.'); \ | 1235 | 35 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 35 | SStream_concat1(O, '\0'); \ | 1237 | 35 | } else \ | 1238 | 35 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 35 | "Unsupported suffix size"); \ | 1240 | 35 | bool DoShift = ExtWidth != 8; \ | 1241 | 35 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 35 | SStream_concat0(O, ", "); \ | 1243 | 35 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 35 | CHAR(SrcRegKind), O, \ | 1245 | 35 | getUseMarkup()); \ | 1246 | 35 | } \ | 1247 | 35 | } |
printRegWithShiftExtend_0_8_x_s Line | Count | Source | 1222 | 37 | { \ | 1223 | 37 | AArch64_add_cs_detail_4( \ | 1224 | 37 | MI, \ | 1225 | 37 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 37 | SignExtend), \ | 1227 | 37 | ExtWidth), \ | 1228 | 37 | SrcRegKind), \ | 1229 | 37 | Suffix), \ | 1230 | 37 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 37 | CHAR(Suffix)); \ | 1232 | 37 | printOperand(MI, OpNum, O); \ | 1233 | 37 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 37 | SStream_concat1(O, '.'); \ | 1235 | 37 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 37 | SStream_concat1(O, '\0'); \ | 1237 | 37 | } else \ | 1238 | 37 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 37 | "Unsupported suffix size"); \ | 1240 | 37 | bool DoShift = ExtWidth != 8; \ | 1241 | 37 | 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 | 37 | } |
printRegWithShiftExtend_0_16_x_s Line | Count | Source | 1222 | 77 | { \ | 1223 | 77 | AArch64_add_cs_detail_4( \ | 1224 | 77 | MI, \ | 1225 | 77 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 77 | SignExtend), \ | 1227 | 77 | ExtWidth), \ | 1228 | 77 | SrcRegKind), \ | 1229 | 77 | Suffix), \ | 1230 | 77 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 77 | CHAR(Suffix)); \ | 1232 | 77 | printOperand(MI, OpNum, O); \ | 1233 | 77 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 77 | SStream_concat1(O, '.'); \ | 1235 | 77 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 77 | SStream_concat1(O, '\0'); \ | 1237 | 77 | } else \ | 1238 | 77 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 77 | "Unsupported suffix size"); \ | 1240 | 77 | bool DoShift = ExtWidth != 8; \ | 1241 | 77 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 77 | SStream_concat0(O, ", "); \ | 1243 | 77 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 77 | CHAR(SrcRegKind), O, \ | 1245 | 77 | getUseMarkup()); \ | 1246 | 77 | } \ | 1247 | 77 | } |
printRegWithShiftExtend_0_32_x_s Line | Count | Source | 1222 | 425 | { \ | 1223 | 425 | AArch64_add_cs_detail_4( \ | 1224 | 425 | MI, \ | 1225 | 425 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 425 | SignExtend), \ | 1227 | 425 | ExtWidth), \ | 1228 | 425 | SrcRegKind), \ | 1229 | 425 | Suffix), \ | 1230 | 425 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 425 | CHAR(Suffix)); \ | 1232 | 425 | printOperand(MI, OpNum, O); \ | 1233 | 425 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 425 | SStream_concat1(O, '.'); \ | 1235 | 425 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 425 | SStream_concat1(O, '\0'); \ | 1237 | 425 | } else \ | 1238 | 425 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 425 | "Unsupported suffix size"); \ | 1240 | 425 | bool DoShift = ExtWidth != 8; \ | 1241 | 425 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 425 | SStream_concat0(O, ", "); \ | 1243 | 425 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 425 | CHAR(SrcRegKind), O, \ | 1245 | 425 | getUseMarkup()); \ | 1246 | 425 | } \ | 1247 | 425 | } |
printRegWithShiftExtend_0_64_x_s Line | Count | Source | 1222 | 67 | { \ | 1223 | 67 | AArch64_add_cs_detail_4( \ | 1224 | 67 | MI, \ | 1225 | 67 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 67 | SignExtend), \ | 1227 | 67 | ExtWidth), \ | 1228 | 67 | SrcRegKind), \ | 1229 | 67 | Suffix), \ | 1230 | 67 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 67 | CHAR(Suffix)); \ | 1232 | 67 | printOperand(MI, OpNum, O); \ | 1233 | 67 | if (CHAR(Suffix) == 's' || CHAR(Suffix) == 'd') { \ | 1234 | 67 | SStream_concat1(O, '.'); \ | 1235 | 67 | SStream_concat1(O, CHAR(Suffix)); \ | 1236 | 67 | SStream_concat1(O, '\0'); \ | 1237 | 67 | } else \ | 1238 | 67 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 67 | "Unsupported suffix size"); \ | 1240 | 67 | bool DoShift = ExtWidth != 8; \ | 1241 | 67 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 67 | SStream_concat0(O, ", "); \ | 1243 | 67 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 67 | CHAR(SrcRegKind), O, \ | 1245 | 67 | getUseMarkup()); \ | 1246 | 67 | } \ | 1247 | 67 | } |
printRegWithShiftExtend_0_128_x_0 Line | Count | Source | 1222 | 733 | { \ | 1223 | 733 | AArch64_add_cs_detail_4( \ | 1224 | 733 | MI, \ | 1225 | 733 | CONCAT(CONCAT(CONCAT(CONCAT(AArch64_OP_GROUP_RegWithShiftExtend, \ | 1226 | 733 | SignExtend), \ | 1227 | 733 | ExtWidth), \ | 1228 | 733 | SrcRegKind), \ | 1229 | 733 | Suffix), \ | 1230 | 733 | OpNum, SignExtend, ExtWidth, CHAR(SrcRegKind), \ | 1231 | 733 | CHAR(Suffix)); \ | 1232 | 733 | printOperand(MI, OpNum, O); \ | 1233 | 733 | 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 | 733 | CS_ASSERT_RET((CHAR(Suffix) == '0') && \ | 1239 | 733 | "Unsupported suffix size"); \ | 1240 | 733 | bool DoShift = ExtWidth != 8; \ | 1241 | 733 | if (SignExtend || DoShift || CHAR(SrcRegKind) == 'w') { \ | 1242 | 733 | SStream_concat0(O, ", "); \ | 1243 | 733 | printMemExtendImpl(SignExtend, DoShift, ExtWidth, \ | 1244 | 733 | CHAR(SrcRegKind), O, \ | 1245 | 733 | getUseMarkup()); \ | 1246 | 733 | } \ | 1247 | 733 | } |
|
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 | 8.02k | { \ |
1282 | 8.02k | AArch64_add_cs_detail_1( \ |
1283 | 8.02k | MI, \ |
1284 | 8.02k | CONCAT(AArch64_OP_GROUP_PredicateAsCounter, EltSize), \ |
1285 | 8.02k | OpNum, EltSize); \ |
1286 | 8.02k | unsigned Reg = \ |
1287 | 8.02k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ |
1288 | 8.02k | if (Reg < AArch64_PN0 || Reg > AArch64_PN15) \ |
1289 | 8.02k | CS_ASSERT_RET(0 && \ |
1290 | 8.02k | "Unsupported predicate-as-counter register"); \ |
1291 | 8.02k | SStream_concat(O, "%s", "pn"); \ |
1292 | 8.02k | printUInt32(O, (Reg - AArch64_PN0)); \ |
1293 | 8.02k | switch (EltSize) { \ |
1294 | 7.11k | case 0: \ |
1295 | 7.11k | break; \ |
1296 | 306 | case 8: \ |
1297 | 306 | SStream_concat0(O, ".b"); \ |
1298 | 306 | break; \ |
1299 | 78 | case 16: \ |
1300 | 78 | SStream_concat0(O, ".h"); \ |
1301 | 78 | break; \ |
1302 | 36 | case 32: \ |
1303 | 36 | SStream_concat0(O, ".s"); \ |
1304 | 36 | break; \ |
1305 | 490 | case 64: \ |
1306 | 490 | SStream_concat0(O, ".d"); \ |
1307 | 490 | break; \ |
1308 | 0 | default: \ |
1309 | 0 | CS_ASSERT_RET(0 && "Unsupported element size"); \ |
1310 | 8.02k | } \ |
1311 | 8.02k | } printPredicateAsCounter_8 Line | Count | Source | 1281 | 306 | { \ | 1282 | 306 | AArch64_add_cs_detail_1( \ | 1283 | 306 | MI, \ | 1284 | 306 | CONCAT(AArch64_OP_GROUP_PredicateAsCounter, EltSize), \ | 1285 | 306 | OpNum, EltSize); \ | 1286 | 306 | unsigned Reg = \ | 1287 | 306 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 1288 | 306 | if (Reg < AArch64_PN0 || Reg > AArch64_PN15) \ | 1289 | 306 | CS_ASSERT_RET(0 && \ | 1290 | 306 | "Unsupported predicate-as-counter register"); \ | 1291 | 306 | SStream_concat(O, "%s", "pn"); \ | 1292 | 306 | printUInt32(O, (Reg - AArch64_PN0)); \ | 1293 | 306 | switch (EltSize) { \ | 1294 | 0 | case 0: \ | 1295 | 0 | break; \ | 1296 | 306 | case 8: \ | 1297 | 306 | SStream_concat0(O, ".b"); \ | 1298 | 306 | 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 | 306 | } \ | 1311 | 306 | } |
printPredicateAsCounter_64 Line | Count | Source | 1281 | 490 | { \ | 1282 | 490 | AArch64_add_cs_detail_1( \ | 1283 | 490 | MI, \ | 1284 | 490 | CONCAT(AArch64_OP_GROUP_PredicateAsCounter, EltSize), \ | 1285 | 490 | OpNum, EltSize); \ | 1286 | 490 | unsigned Reg = \ | 1287 | 490 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 1288 | 490 | if (Reg < AArch64_PN0 || Reg > AArch64_PN15) \ | 1289 | 490 | CS_ASSERT_RET(0 && \ | 1290 | 490 | "Unsupported predicate-as-counter register"); \ | 1291 | 490 | SStream_concat(O, "%s", "pn"); \ | 1292 | 490 | printUInt32(O, (Reg - AArch64_PN0)); \ | 1293 | 490 | 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 | 490 | case 64: \ | 1306 | 490 | SStream_concat0(O, ".d"); \ | 1307 | 490 | break; \ | 1308 | 0 | default: \ | 1309 | 0 | CS_ASSERT_RET(0 && "Unsupported element size"); \ | 1310 | 490 | } \ | 1311 | 490 | } |
printPredicateAsCounter_16 Line | Count | Source | 1281 | 78 | { \ | 1282 | 78 | AArch64_add_cs_detail_1( \ | 1283 | 78 | MI, \ | 1284 | 78 | CONCAT(AArch64_OP_GROUP_PredicateAsCounter, EltSize), \ | 1285 | 78 | OpNum, EltSize); \ | 1286 | 78 | unsigned Reg = \ | 1287 | 78 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 1288 | 78 | if (Reg < AArch64_PN0 || Reg > AArch64_PN15) \ | 1289 | 78 | CS_ASSERT_RET(0 && \ | 1290 | 78 | "Unsupported predicate-as-counter register"); \ | 1291 | 78 | SStream_concat(O, "%s", "pn"); \ | 1292 | 78 | printUInt32(O, (Reg - AArch64_PN0)); \ | 1293 | 78 | switch (EltSize) { \ | 1294 | 0 | case 0: \ | 1295 | 0 | break; \ | 1296 | 0 | case 8: \ | 1297 | 0 | SStream_concat0(O, ".b"); \ | 1298 | 0 | break; \ | 1299 | 78 | case 16: \ | 1300 | 78 | SStream_concat0(O, ".h"); \ | 1301 | 78 | 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 | 78 | } \ | 1311 | 78 | } |
printPredicateAsCounter_32 Line | Count | Source | 1281 | 36 | { \ | 1282 | 36 | AArch64_add_cs_detail_1( \ | 1283 | 36 | MI, \ | 1284 | 36 | CONCAT(AArch64_OP_GROUP_PredicateAsCounter, EltSize), \ | 1285 | 36 | OpNum, EltSize); \ | 1286 | 36 | unsigned Reg = \ | 1287 | 36 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 1288 | 36 | if (Reg < AArch64_PN0 || Reg > AArch64_PN15) \ | 1289 | 36 | CS_ASSERT_RET(0 && \ | 1290 | 36 | "Unsupported predicate-as-counter register"); \ | 1291 | 36 | SStream_concat(O, "%s", "pn"); \ | 1292 | 36 | printUInt32(O, (Reg - AArch64_PN0)); \ | 1293 | 36 | 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 | 36 | case 32: \ | 1303 | 36 | SStream_concat0(O, ".s"); \ | 1304 | 36 | 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 | 36 | } \ | 1311 | 36 | } |
printPredicateAsCounter_0 Line | Count | Source | 1281 | 7.11k | { \ | 1282 | 7.11k | AArch64_add_cs_detail_1( \ | 1283 | 7.11k | MI, \ | 1284 | 7.11k | CONCAT(AArch64_OP_GROUP_PredicateAsCounter, EltSize), \ | 1285 | 7.11k | OpNum, EltSize); \ | 1286 | 7.11k | unsigned Reg = \ | 1287 | 7.11k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 1288 | 7.11k | if (Reg < AArch64_PN0 || Reg > AArch64_PN15) \ | 1289 | 7.11k | CS_ASSERT_RET(0 && \ | 1290 | 7.11k | "Unsupported predicate-as-counter register"); \ | 1291 | 7.11k | SStream_concat(O, "%s", "pn"); \ | 1292 | 7.11k | printUInt32(O, (Reg - AArch64_PN0)); \ | 1293 | 7.11k | switch (EltSize) { \ | 1294 | 7.11k | case 0: \ | 1295 | 7.11k | 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 | 7.11k | } \ | 1311 | 7.11k | } |
|
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.88k | { |
1320 | 2.88k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_CondCode, OpNum); |
1321 | 2.88k | AArch64CC_CondCode CC = (AArch64CC_CondCode)MCOperand_getImm( |
1322 | 2.88k | MCInst_getOperand(MI, (OpNum))); |
1323 | 2.88k | SStream_concat0(O, AArch64CC_getCondCodeName(CC)); |
1324 | 2.88k | } |
1325 | | |
1326 | | void printInverseCondCode(MCInst *MI, unsigned OpNum, SStream *O) |
1327 | 81 | { |
1328 | 81 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_InverseCondCode, OpNum); |
1329 | 81 | AArch64CC_CondCode CC = (AArch64CC_CondCode)MCOperand_getImm( |
1330 | 81 | MCInst_getOperand(MI, (OpNum))); |
1331 | 81 | SStream_concat0(O, AArch64CC_getCondCodeName( |
1332 | 81 | AArch64CC_getInvertedCondCode(CC))); |
1333 | 81 | } |
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 | 19.2k | { \ |
1348 | 19.2k | AArch64_add_cs_detail_1( \ |
1349 | 19.2k | MI, CONCAT(AArch64_OP_GROUP_ImmScale, Scale), OpNum, \ |
1350 | 19.2k | Scale); \ |
1351 | 19.2k | SStream_concat(O, "%s", markup("<imm:")); \ |
1352 | 19.2k | printInt32Bang(O, Scale *MCOperand_getImm( \ |
1353 | 19.2k | MCInst_getOperand(MI, (OpNum)))); \ |
1354 | 19.2k | SStream_concat0(O, markup(">")); \ |
1355 | 19.2k | } Line | Count | Source | 1347 | 5.87k | { \ | 1348 | 5.87k | AArch64_add_cs_detail_1( \ | 1349 | 5.87k | MI, CONCAT(AArch64_OP_GROUP_ImmScale, Scale), OpNum, \ | 1350 | 5.87k | Scale); \ | 1351 | 5.87k | SStream_concat(O, "%s", markup("<imm:")); \ | 1352 | 5.87k | printInt32Bang(O, Scale *MCOperand_getImm( \ | 1353 | 5.87k | MCInst_getOperand(MI, (OpNum)))); \ | 1354 | 5.87k | SStream_concat0(O, markup(">")); \ | 1355 | 5.87k | } |
Line | Count | Source | 1347 | 2.02k | { \ | 1348 | 2.02k | AArch64_add_cs_detail_1( \ | 1349 | 2.02k | MI, CONCAT(AArch64_OP_GROUP_ImmScale, Scale), OpNum, \ | 1350 | 2.02k | Scale); \ | 1351 | 2.02k | SStream_concat(O, "%s", markup("<imm:")); \ | 1352 | 2.02k | printInt32Bang(O, Scale *MCOperand_getImm( \ | 1353 | 2.02k | MCInst_getOperand(MI, (OpNum)))); \ | 1354 | 2.02k | SStream_concat0(O, markup(">")); \ | 1355 | 2.02k | } |
Line | Count | Source | 1347 | 7.47k | { \ | 1348 | 7.47k | AArch64_add_cs_detail_1( \ | 1349 | 7.47k | MI, CONCAT(AArch64_OP_GROUP_ImmScale, Scale), OpNum, \ | 1350 | 7.47k | Scale); \ | 1351 | 7.47k | SStream_concat(O, "%s", markup("<imm:")); \ | 1352 | 7.47k | printInt32Bang(O, Scale *MCOperand_getImm( \ | 1353 | 7.47k | MCInst_getOperand(MI, (OpNum)))); \ | 1354 | 7.47k | SStream_concat0(O, markup(">")); \ | 1355 | 7.47k | } |
Line | Count | Source | 1347 | 3.67k | { \ | 1348 | 3.67k | AArch64_add_cs_detail_1( \ | 1349 | 3.67k | MI, CONCAT(AArch64_OP_GROUP_ImmScale, Scale), OpNum, \ | 1350 | 3.67k | Scale); \ | 1351 | 3.67k | SStream_concat(O, "%s", markup("<imm:")); \ | 1352 | 3.67k | printInt32Bang(O, Scale *MCOperand_getImm( \ | 1353 | 3.67k | MCInst_getOperand(MI, (OpNum)))); \ | 1354 | 3.67k | SStream_concat0(O, markup(">")); \ | 1355 | 3.67k | } |
Line | Count | Source | 1347 | 50 | { \ | 1348 | 50 | AArch64_add_cs_detail_1( \ | 1349 | 50 | MI, CONCAT(AArch64_OP_GROUP_ImmScale, Scale), OpNum, \ | 1350 | 50 | Scale); \ | 1351 | 50 | SStream_concat(O, "%s", markup("<imm:")); \ | 1352 | 50 | printInt32Bang(O, Scale *MCOperand_getImm( \ | 1353 | 50 | MCInst_getOperand(MI, (OpNum)))); \ | 1354 | 50 | SStream_concat0(O, markup(">")); \ | 1355 | 50 | } |
Line | Count | Source | 1347 | 138 | { \ | 1348 | 138 | AArch64_add_cs_detail_1( \ | 1349 | 138 | MI, CONCAT(AArch64_OP_GROUP_ImmScale, Scale), OpNum, \ | 1350 | 138 | Scale); \ | 1351 | 138 | SStream_concat(O, "%s", markup("<imm:")); \ | 1352 | 138 | printInt32Bang(O, Scale *MCOperand_getImm( \ | 1353 | 138 | MCInst_getOperand(MI, (OpNum)))); \ | 1354 | 138 | SStream_concat0(O, markup(">")); \ | 1355 | 138 | } |
|
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 | 6.20k | { \ |
1367 | 6.20k | AArch64_add_cs_detail_2( \ |
1368 | 6.20k | MI, \ |
1369 | 6.20k | CONCAT(CONCAT(AArch64_OP_GROUP_ImmRangeScale, Scale), \ |
1370 | 6.20k | Offset), \ |
1371 | 6.20k | OpNum, Scale, Offset); \ |
1372 | 6.20k | unsigned FirstImm = \ |
1373 | 6.20k | Scale * \ |
1374 | 6.20k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ |
1375 | 6.20k | printUInt32(O, (FirstImm)); \ |
1376 | 6.20k | SStream_concat(O, "%s", ":"); \ |
1377 | 6.20k | printUInt32(O, (FirstImm + Offset)); \ |
1378 | 6.20k | SStream_concat1(O, '\0'); \ |
1379 | 6.20k | } Line | Count | Source | 1366 | 3.01k | { \ | 1367 | 3.01k | AArch64_add_cs_detail_2( \ | 1368 | 3.01k | MI, \ | 1369 | 3.01k | CONCAT(CONCAT(AArch64_OP_GROUP_ImmRangeScale, Scale), \ | 1370 | 3.01k | Offset), \ | 1371 | 3.01k | OpNum, Scale, Offset); \ | 1372 | 3.01k | unsigned FirstImm = \ | 1373 | 3.01k | Scale * \ | 1374 | 3.01k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1375 | 3.01k | printUInt32(O, (FirstImm)); \ | 1376 | 3.01k | SStream_concat(O, "%s", ":"); \ | 1377 | 3.01k | printUInt32(O, (FirstImm + Offset)); \ | 1378 | 3.01k | SStream_concat1(O, '\0'); \ | 1379 | 3.01k | } |
Line | Count | Source | 1366 | 3.19k | { \ | 1367 | 3.19k | AArch64_add_cs_detail_2( \ | 1368 | 3.19k | MI, \ | 1369 | 3.19k | CONCAT(CONCAT(AArch64_OP_GROUP_ImmRangeScale, Scale), \ | 1370 | 3.19k | Offset), \ | 1371 | 3.19k | OpNum, Scale, Offset); \ | 1372 | 3.19k | unsigned FirstImm = \ | 1373 | 3.19k | Scale * \ | 1374 | 3.19k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1375 | 3.19k | printUInt32(O, (FirstImm)); \ | 1376 | 3.19k | SStream_concat(O, "%s", ":"); \ | 1377 | 3.19k | printUInt32(O, (FirstImm + Offset)); \ | 1378 | 3.19k | SStream_concat1(O, '\0'); \ | 1379 | 3.19k | } |
|
1380 | | DEFINE_printImmRangeScale(2, 1); |
1381 | | DEFINE_printImmRangeScale(4, 3); |
1382 | | |
1383 | | void printUImm12Offset(MCInst *MI, unsigned OpNum, unsigned Scale, SStream *O) |
1384 | 5.41k | { |
1385 | 5.41k | MCOperand *MO = MCInst_getOperand(MI, (OpNum)); |
1386 | 5.41k | if (MCOperand_isImm(MO)) { |
1387 | 5.41k | SStream_concat(O, "%s", markup("<imm:")); |
1388 | 5.41k | printUInt32Bang(O, (MCOperand_getImm(MO) * Scale)); |
1389 | 5.41k | SStream_concat0(O, markup(">")); |
1390 | 5.41k | } else { |
1391 | 0 | printUInt64Bang(O, MCOperand_getImm(MO)); |
1392 | 0 | } |
1393 | 5.41k | } |
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 | 1.19k | { |
1413 | 1.19k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_RPRFMOperand, OpNum); |
1414 | 1.19k | unsigned prfop = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
1415 | 1.19k | const AArch64PRFM_PRFM *PRFM = |
1416 | 1.19k | AArch64RPRFM_lookupRPRFMByEncoding(prfop); |
1417 | 1.19k | if (PRFM) { |
1418 | 937 | SStream_concat0(O, PRFM->Name); |
1419 | 937 | return; |
1420 | 937 | } |
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.58k | { \ |
1430 | 5.58k | AArch64_add_cs_detail_1(MI, \ |
1431 | 5.58k | CONCAT(AArch64_OP_GROUP_PrefetchOp, \ |
1432 | 5.58k | IsSVEPrefetch), \ |
1433 | 5.58k | OpNum, IsSVEPrefetch); \ |
1434 | 5.58k | unsigned prfop = \ |
1435 | 5.58k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ |
1436 | 5.58k | if (IsSVEPrefetch) { \ |
1437 | 4.38k | const AArch64SVEPRFM_SVEPRFM *PRFM = \ |
1438 | 4.38k | AArch64SVEPRFM_lookupSVEPRFMByEncoding(prfop); \ |
1439 | 4.38k | if (PRFM) { \ |
1440 | 3.76k | SStream_concat0(O, PRFM->Name); \ |
1441 | 3.76k | return; \ |
1442 | 3.76k | } \ |
1443 | 4.38k | } else { \ |
1444 | 1.20k | const AArch64PRFM_PRFM *PRFM = \ |
1445 | 1.20k | AArch64PRFM_lookupPRFMByEncoding(prfop); \ |
1446 | 1.20k | if (PRFM && \ |
1447 | 1.20k | AArch64_testFeatureList(MI->csh->mode, \ |
1448 | 768 | PRFM->FeaturesRequired)) { \ |
1449 | 768 | SStream_concat0(O, PRFM->Name); \ |
1450 | 768 | return; \ |
1451 | 768 | } \ |
1452 | 1.20k | } \ |
1453 | 5.58k | \ |
1454 | 5.58k | SStream_concat(O, "%s", markup("<imm:")); \ |
1455 | 1.05k | printUInt32Bang(O, (prfop)); \ |
1456 | 1.05k | SStream_concat0(O, markup(">")); \ |
1457 | 1.05k | } Line | Count | Source | 1429 | 1.20k | { \ | 1430 | 1.20k | AArch64_add_cs_detail_1(MI, \ | 1431 | 1.20k | CONCAT(AArch64_OP_GROUP_PrefetchOp, \ | 1432 | 1.20k | IsSVEPrefetch), \ | 1433 | 1.20k | OpNum, IsSVEPrefetch); \ | 1434 | 1.20k | unsigned prfop = \ | 1435 | 1.20k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1436 | 1.20k | 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.20k | } else { \ | 1444 | 1.20k | const AArch64PRFM_PRFM *PRFM = \ | 1445 | 1.20k | AArch64PRFM_lookupPRFMByEncoding(prfop); \ | 1446 | 1.20k | if (PRFM && \ | 1447 | 1.20k | AArch64_testFeatureList(MI->csh->mode, \ | 1448 | 768 | PRFM->FeaturesRequired)) { \ | 1449 | 768 | SStream_concat0(O, PRFM->Name); \ | 1450 | 768 | return; \ | 1451 | 768 | } \ | 1452 | 1.20k | } \ | 1453 | 1.20k | \ | 1454 | 1.20k | SStream_concat(O, "%s", markup("<imm:")); \ | 1455 | 438 | printUInt32Bang(O, (prfop)); \ | 1456 | 438 | SStream_concat0(O, markup(">")); \ | 1457 | 438 | } |
Line | Count | Source | 1429 | 4.38k | { \ | 1430 | 4.38k | AArch64_add_cs_detail_1(MI, \ | 1431 | 4.38k | CONCAT(AArch64_OP_GROUP_PrefetchOp, \ | 1432 | 4.38k | IsSVEPrefetch), \ | 1433 | 4.38k | OpNum, IsSVEPrefetch); \ | 1434 | 4.38k | unsigned prfop = \ | 1435 | 4.38k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 1436 | 4.38k | if (IsSVEPrefetch) { \ | 1437 | 4.38k | const AArch64SVEPRFM_SVEPRFM *PRFM = \ | 1438 | 4.38k | AArch64SVEPRFM_lookupSVEPRFMByEncoding(prfop); \ | 1439 | 4.38k | if (PRFM) { \ | 1440 | 3.76k | SStream_concat0(O, PRFM->Name); \ | 1441 | 3.76k | return; \ | 1442 | 3.76k | } \ | 1443 | 4.38k | } 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.38k | \ | 1454 | 4.38k | SStream_concat(O, "%s", markup("<imm:")); \ | 1455 | 620 | printUInt32Bang(O, (prfop)); \ | 1456 | 620 | SStream_concat0(O, markup(">")); \ | 1457 | 620 | } |
|
1458 | | DEFINE_printPrefetchOp(false); |
1459 | | DEFINE_printPrefetchOp(true); |
1460 | | |
1461 | | void printPSBHintOp(MCInst *MI, unsigned OpNum, SStream *O) |
1462 | 212 | { |
1463 | 212 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_PSBHintOp, OpNum); |
1464 | 212 | unsigned psbhintop = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
1465 | 212 | const AArch64PSBHint_PSB *PSB = |
1466 | 212 | AArch64PSBHint_lookupPSBByEncoding(psbhintop); |
1467 | 212 | if (PSB) |
1468 | 212 | 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 | 212 | } |
1476 | | |
1477 | | void printBTIHintOp(MCInst *MI, unsigned OpNum, SStream *O) |
1478 | 380 | { |
1479 | 380 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_BTIHintOp, OpNum); |
1480 | 380 | unsigned btihintop = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))) ^ |
1481 | 380 | 32; |
1482 | 380 | const AArch64BTIHint_BTI *BTI = |
1483 | 380 | AArch64BTIHint_lookupBTIByEncoding(btihintop); |
1484 | 380 | if (BTI) |
1485 | 380 | 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 | 380 | } |
1492 | | |
1493 | | static void printFPImmOperand(MCInst *MI, unsigned OpNum, SStream *O) |
1494 | 383 | { |
1495 | 383 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_FPImmOperand, OpNum); |
1496 | 383 | MCOperand *MO = MCInst_getOperand(MI, (OpNum)); |
1497 | 383 | float FPImm = MCOperand_isDFPImm(MO) ? |
1498 | 0 | BitsToDouble(MCOperand_getImm(MO)) : |
1499 | 383 | AArch64_AM_getFPImmFloat(MCOperand_getImm(MO)); |
1500 | | |
1501 | | // 8 decimal places are enough to perfectly represent permitted floats. |
1502 | 383 | SStream_concat(O, "%s", markup("<imm:")); |
1503 | 383 | SStream_concat(O, "#%.8f", FPImm); |
1504 | 383 | SStream_concat0(O, markup(">")); |
1505 | 383 | } |
1506 | | |
1507 | | static unsigned getNextVectorRegister(unsigned Reg, unsigned Stride /* = 1 */) |
1508 | 120k | { |
1509 | 324k | while (Stride--) { |
1510 | 203k | switch (Reg) { |
1511 | 0 | default: |
1512 | 0 | CS_ASSERT_RET_VAL(0 && "Vector register expected!", 0); |
1513 | 4.16k | case AArch64_Q0: |
1514 | 4.16k | Reg = AArch64_Q1; |
1515 | 4.16k | break; |
1516 | 3.49k | case AArch64_Q1: |
1517 | 3.49k | Reg = AArch64_Q2; |
1518 | 3.49k | break; |
1519 | 1.54k | case AArch64_Q2: |
1520 | 1.54k | Reg = AArch64_Q3; |
1521 | 1.54k | break; |
1522 | 791 | case AArch64_Q3: |
1523 | 791 | Reg = AArch64_Q4; |
1524 | 791 | break; |
1525 | 609 | case AArch64_Q4: |
1526 | 609 | Reg = AArch64_Q5; |
1527 | 609 | break; |
1528 | 1.38k | case AArch64_Q5: |
1529 | 1.38k | Reg = AArch64_Q6; |
1530 | 1.38k | break; |
1531 | 1.32k | case AArch64_Q6: |
1532 | 1.32k | Reg = AArch64_Q7; |
1533 | 1.32k | break; |
1534 | 1.27k | case AArch64_Q7: |
1535 | 1.27k | Reg = AArch64_Q8; |
1536 | 1.27k | break; |
1537 | 1.29k | case AArch64_Q8: |
1538 | 1.29k | Reg = AArch64_Q9; |
1539 | 1.29k | break; |
1540 | 795 | case AArch64_Q9: |
1541 | 795 | Reg = AArch64_Q10; |
1542 | 795 | break; |
1543 | 462 | case AArch64_Q10: |
1544 | 462 | Reg = AArch64_Q11; |
1545 | 462 | break; |
1546 | 1.10k | case AArch64_Q11: |
1547 | 1.10k | Reg = AArch64_Q12; |
1548 | 1.10k | break; |
1549 | 1.06k | case AArch64_Q12: |
1550 | 1.06k | Reg = AArch64_Q13; |
1551 | 1.06k | break; |
1552 | 1.57k | case AArch64_Q13: |
1553 | 1.57k | Reg = AArch64_Q14; |
1554 | 1.57k | break; |
1555 | 788 | case AArch64_Q14: |
1556 | 788 | Reg = AArch64_Q15; |
1557 | 788 | break; |
1558 | 846 | case AArch64_Q15: |
1559 | 846 | Reg = AArch64_Q16; |
1560 | 846 | break; |
1561 | 841 | case AArch64_Q16: |
1562 | 841 | Reg = AArch64_Q17; |
1563 | 841 | break; |
1564 | 975 | case AArch64_Q17: |
1565 | 975 | Reg = AArch64_Q18; |
1566 | 975 | break; |
1567 | 1.07k | case AArch64_Q18: |
1568 | 1.07k | Reg = AArch64_Q19; |
1569 | 1.07k | break; |
1570 | 1.52k | case AArch64_Q19: |
1571 | 1.52k | Reg = AArch64_Q20; |
1572 | 1.52k | break; |
1573 | 4.66k | case AArch64_Q20: |
1574 | 4.66k | Reg = AArch64_Q21; |
1575 | 4.66k | break; |
1576 | 2.32k | case AArch64_Q21: |
1577 | 2.32k | Reg = AArch64_Q22; |
1578 | 2.32k | break; |
1579 | 3.08k | case AArch64_Q22: |
1580 | 3.08k | Reg = AArch64_Q23; |
1581 | 3.08k | break; |
1582 | 2.40k | case AArch64_Q23: |
1583 | 2.40k | Reg = AArch64_Q24; |
1584 | 2.40k | break; |
1585 | 1.84k | case AArch64_Q24: |
1586 | 1.84k | Reg = AArch64_Q25; |
1587 | 1.84k | break; |
1588 | 1.82k | case AArch64_Q25: |
1589 | 1.82k | Reg = AArch64_Q26; |
1590 | 1.82k | break; |
1591 | 932 | case AArch64_Q26: |
1592 | 932 | Reg = AArch64_Q27; |
1593 | 932 | break; |
1594 | 925 | case AArch64_Q27: |
1595 | 925 | Reg = AArch64_Q28; |
1596 | 925 | break; |
1597 | 612 | case AArch64_Q28: |
1598 | 612 | Reg = AArch64_Q29; |
1599 | 612 | break; |
1600 | 851 | case AArch64_Q29: |
1601 | 851 | Reg = AArch64_Q30; |
1602 | 851 | break; |
1603 | 784 | case AArch64_Q30: |
1604 | 784 | Reg = AArch64_Q31; |
1605 | 784 | break; |
1606 | | // Vector lists can wrap around. |
1607 | 1.54k | case AArch64_Q31: |
1608 | 1.54k | Reg = AArch64_Q0; |
1609 | 1.54k | break; |
1610 | 12.4k | case AArch64_Z0: |
1611 | 12.4k | Reg = AArch64_Z1; |
1612 | 12.4k | break; |
1613 | 8.77k | case AArch64_Z1: |
1614 | 8.77k | Reg = AArch64_Z2; |
1615 | 8.77k | break; |
1616 | 9.33k | case AArch64_Z2: |
1617 | 9.33k | Reg = AArch64_Z3; |
1618 | 9.33k | break; |
1619 | 2.41k | case AArch64_Z3: |
1620 | 2.41k | Reg = AArch64_Z4; |
1621 | 2.41k | break; |
1622 | 10.4k | case AArch64_Z4: |
1623 | 10.4k | Reg = AArch64_Z5; |
1624 | 10.4k | break; |
1625 | 8.76k | case AArch64_Z5: |
1626 | 8.76k | Reg = AArch64_Z6; |
1627 | 8.76k | break; |
1628 | 9.39k | case AArch64_Z6: |
1629 | 9.39k | Reg = AArch64_Z7; |
1630 | 9.39k | break; |
1631 | 2.79k | case AArch64_Z7: |
1632 | 2.79k | Reg = AArch64_Z8; |
1633 | 2.79k | break; |
1634 | 7.16k | case AArch64_Z8: |
1635 | 7.16k | Reg = AArch64_Z9; |
1636 | 7.16k | break; |
1637 | 7.52k | case AArch64_Z9: |
1638 | 7.52k | Reg = AArch64_Z10; |
1639 | 7.52k | break; |
1640 | 6.82k | case AArch64_Z10: |
1641 | 6.82k | Reg = AArch64_Z11; |
1642 | 6.82k | break; |
1643 | 3.39k | case AArch64_Z11: |
1644 | 3.39k | Reg = AArch64_Z12; |
1645 | 3.39k | break; |
1646 | 3.61k | case AArch64_Z12: |
1647 | 3.61k | Reg = AArch64_Z13; |
1648 | 3.61k | break; |
1649 | 3.31k | case AArch64_Z13: |
1650 | 3.31k | Reg = AArch64_Z14; |
1651 | 3.31k | break; |
1652 | 4.61k | case AArch64_Z14: |
1653 | 4.61k | Reg = AArch64_Z15; |
1654 | 4.61k | break; |
1655 | 3.12k | case AArch64_Z15: |
1656 | 3.12k | Reg = AArch64_Z16; |
1657 | 3.12k | break; |
1658 | 3.18k | case AArch64_Z16: |
1659 | 3.18k | Reg = AArch64_Z17; |
1660 | 3.18k | break; |
1661 | 1.17k | case AArch64_Z17: |
1662 | 1.17k | Reg = AArch64_Z18; |
1663 | 1.17k | break; |
1664 | 1.62k | case AArch64_Z18: |
1665 | 1.62k | Reg = AArch64_Z19; |
1666 | 1.62k | break; |
1667 | 2.03k | case AArch64_Z19: |
1668 | 2.03k | Reg = AArch64_Z20; |
1669 | 2.03k | break; |
1670 | 5.46k | case AArch64_Z20: |
1671 | 5.46k | Reg = AArch64_Z21; |
1672 | 5.46k | break; |
1673 | 3.73k | case AArch64_Z21: |
1674 | 3.73k | Reg = AArch64_Z22; |
1675 | 3.73k | break; |
1676 | 3.70k | case AArch64_Z22: |
1677 | 3.70k | Reg = AArch64_Z23; |
1678 | 3.70k | break; |
1679 | 1.29k | case AArch64_Z23: |
1680 | 1.29k | Reg = AArch64_Z24; |
1681 | 1.29k | break; |
1682 | 9.26k | case AArch64_Z24: |
1683 | 9.26k | Reg = AArch64_Z25; |
1684 | 9.26k | break; |
1685 | 2.78k | case AArch64_Z25: |
1686 | 2.78k | Reg = AArch64_Z26; |
1687 | 2.78k | break; |
1688 | 3.02k | case AArch64_Z26: |
1689 | 3.02k | Reg = AArch64_Z27; |
1690 | 3.02k | break; |
1691 | 1.49k | case AArch64_Z27: |
1692 | 1.49k | Reg = AArch64_Z28; |
1693 | 1.49k | break; |
1694 | 2.25k | case AArch64_Z28: |
1695 | 2.25k | Reg = AArch64_Z29; |
1696 | 2.25k | break; |
1697 | 1.69k | case AArch64_Z29: |
1698 | 1.69k | Reg = AArch64_Z30; |
1699 | 1.69k | break; |
1700 | 3.53k | case AArch64_Z30: |
1701 | 3.53k | Reg = AArch64_Z31; |
1702 | 3.53k | break; |
1703 | | // Vector lists can wrap around. |
1704 | 2.35k | case AArch64_Z31: |
1705 | 2.35k | Reg = AArch64_Z0; |
1706 | 2.35k | break; |
1707 | 38 | case AArch64_P0: |
1708 | 38 | Reg = AArch64_P1; |
1709 | 38 | break; |
1710 | 38 | case AArch64_P1: |
1711 | 38 | Reg = AArch64_P2; |
1712 | 38 | break; |
1713 | 404 | case AArch64_P2: |
1714 | 404 | Reg = AArch64_P3; |
1715 | 404 | break; |
1716 | 50 | case AArch64_P3: |
1717 | 50 | Reg = AArch64_P4; |
1718 | 50 | break; |
1719 | 36 | case AArch64_P4: |
1720 | 36 | Reg = AArch64_P5; |
1721 | 36 | break; |
1722 | 446 | case AArch64_P5: |
1723 | 446 | Reg = AArch64_P6; |
1724 | 446 | break; |
1725 | 68 | case AArch64_P6: |
1726 | 68 | Reg = AArch64_P7; |
1727 | 68 | break; |
1728 | 32 | case AArch64_P7: |
1729 | 32 | Reg = AArch64_P8; |
1730 | 32 | break; |
1731 | 28 | case AArch64_P8: |
1732 | 28 | Reg = AArch64_P9; |
1733 | 28 | break; |
1734 | 6 | case AArch64_P9: |
1735 | 6 | Reg = AArch64_P10; |
1736 | 6 | break; |
1737 | 22 | case AArch64_P10: |
1738 | 22 | Reg = AArch64_P11; |
1739 | 22 | break; |
1740 | 42 | case AArch64_P11: |
1741 | 42 | Reg = AArch64_P12; |
1742 | 42 | break; |
1743 | 100 | case AArch64_P12: |
1744 | 100 | Reg = AArch64_P13; |
1745 | 100 | break; |
1746 | 952 | case AArch64_P13: |
1747 | 952 | Reg = AArch64_P14; |
1748 | 952 | break; |
1749 | 74 | case AArch64_P14: |
1750 | 74 | Reg = AArch64_P15; |
1751 | 74 | break; |
1752 | | // Vector lists can wrap around. |
1753 | 44 | case AArch64_P15: |
1754 | 44 | Reg = AArch64_P0; |
1755 | 44 | break; |
1756 | 203k | } |
1757 | 203k | } |
1758 | 120k | return Reg; |
1759 | 120k | } |
1760 | | |
1761 | | #define DEFINE_printGPRSeqPairsClassOperand(size) \ |
1762 | | void CONCAT(printGPRSeqPairsClassOperand, \ |
1763 | | size)(MCInst * MI, unsigned OpNum, SStream *O) \ |
1764 | 2.03k | { \ |
1765 | 2.03k | AArch64_add_cs_detail_1( \ |
1766 | 2.03k | MI, \ |
1767 | 2.03k | CONCAT(AArch64_OP_GROUP_GPRSeqPairsClassOperand, \ |
1768 | 2.03k | size), \ |
1769 | 2.03k | OpNum, size); \ |
1770 | 2.03k | CS_ASSERT_RET((size == 64 || size == 32) && \ |
1771 | 2.03k | "Template parameter must be either 32 or 64"); \ |
1772 | 2.03k | unsigned Reg = \ |
1773 | 2.03k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ |
1774 | 2.03k | \ |
1775 | 2.03k | unsigned Sube = (size == 32) ? AArch64_sube32 : \ |
1776 | 2.03k | AArch64_sube64; \ |
1777 | 2.03k | unsigned Subo = (size == 32) ? AArch64_subo32 : \ |
1778 | 2.03k | AArch64_subo64; \ |
1779 | 2.03k | \ |
1780 | 2.03k | unsigned Even = MCRegisterInfo_getSubReg(MI->MRI, Reg, Sube); \ |
1781 | 2.03k | unsigned Odd = MCRegisterInfo_getSubReg(MI->MRI, Reg, Subo); \ |
1782 | 2.03k | printRegName(O, Even); \ |
1783 | 2.03k | SStream_concat0(O, ", "); \ |
1784 | 2.03k | printRegName(O, Odd); \ |
1785 | 2.03k | } printGPRSeqPairsClassOperand_32 Line | Count | Source | 1764 | 136 | { \ | 1765 | 136 | AArch64_add_cs_detail_1( \ | 1766 | 136 | MI, \ | 1767 | 136 | CONCAT(AArch64_OP_GROUP_GPRSeqPairsClassOperand, \ | 1768 | 136 | size), \ | 1769 | 136 | OpNum, size); \ | 1770 | 136 | CS_ASSERT_RET((size == 64 || size == 32) && \ | 1771 | 136 | "Template parameter must be either 32 or 64"); \ | 1772 | 136 | unsigned Reg = \ | 1773 | 136 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 1774 | 136 | \ | 1775 | 136 | unsigned Sube = (size == 32) ? AArch64_sube32 : \ | 1776 | 136 | AArch64_sube64; \ | 1777 | 136 | unsigned Subo = (size == 32) ? AArch64_subo32 : \ | 1778 | 136 | AArch64_subo64; \ | 1779 | 136 | \ | 1780 | 136 | unsigned Even = MCRegisterInfo_getSubReg(MI->MRI, Reg, Sube); \ | 1781 | 136 | unsigned Odd = MCRegisterInfo_getSubReg(MI->MRI, Reg, Subo); \ | 1782 | 136 | printRegName(O, Even); \ | 1783 | 136 | SStream_concat0(O, ", "); \ | 1784 | 136 | printRegName(O, Odd); \ | 1785 | 136 | } |
printGPRSeqPairsClassOperand_64 Line | Count | Source | 1764 | 1.89k | { \ | 1765 | 1.89k | AArch64_add_cs_detail_1( \ | 1766 | 1.89k | MI, \ | 1767 | 1.89k | CONCAT(AArch64_OP_GROUP_GPRSeqPairsClassOperand, \ | 1768 | 1.89k | size), \ | 1769 | 1.89k | OpNum, size); \ | 1770 | 1.89k | CS_ASSERT_RET((size == 64 || size == 32) && \ | 1771 | 1.89k | "Template parameter must be either 32 or 64"); \ | 1772 | 1.89k | unsigned Reg = \ | 1773 | 1.89k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 1774 | 1.89k | \ | 1775 | 1.89k | unsigned Sube = (size == 32) ? AArch64_sube32 : \ | 1776 | 1.89k | AArch64_sube64; \ | 1777 | 1.89k | unsigned Subo = (size == 32) ? AArch64_subo32 : \ | 1778 | 1.89k | AArch64_subo64; \ | 1779 | 1.89k | \ | 1780 | 1.89k | unsigned Even = MCRegisterInfo_getSubReg(MI->MRI, Reg, Sube); \ | 1781 | 1.89k | unsigned Odd = MCRegisterInfo_getSubReg(MI->MRI, Reg, Subo); \ | 1782 | 1.89k | printRegName(O, Even); \ | 1783 | 1.89k | SStream_concat0(O, ", "); \ | 1784 | 1.89k | printRegName(O, Odd); \ | 1785 | 1.89k | } |
|
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 | 12.1k | { \ |
1793 | 12.1k | AArch64_add_cs_detail_1(MI, CONCAT(AArch64_OP_GROUP_MatrixIndex, Scale), \ |
1794 | 12.1k | OpNum, Scale); \ |
1795 | 12.1k | printInt64(O, Scale *MCOperand_getImm( \ |
1796 | 12.1k | MCInst_getOperand(MI, (OpNum)))); \ |
1797 | 12.1k | } Line | Count | Source | 1792 | 864 | { \ | 1793 | 864 | AArch64_add_cs_detail_1(MI, CONCAT(AArch64_OP_GROUP_MatrixIndex, Scale), \ | 1794 | 864 | OpNum, Scale); \ | 1795 | 864 | printInt64(O, Scale *MCOperand_getImm( \ | 1796 | 864 | MCInst_getOperand(MI, (OpNum)))); \ | 1797 | 864 | } |
Unexecuted instantiation: printMatrixIndex_0 Line | Count | Source | 1792 | 11.2k | { \ | 1793 | 11.2k | AArch64_add_cs_detail_1(MI, CONCAT(AArch64_OP_GROUP_MatrixIndex, Scale), \ | 1794 | 11.2k | OpNum, Scale); \ | 1795 | 11.2k | printInt64(O, Scale *MCOperand_getImm( \ | 1796 | 11.2k | MCInst_getOperand(MI, (OpNum)))); \ | 1797 | 11.2k | } |
|
1798 | | DEFINE_printMatrixIndex(8); |
1799 | | DEFINE_printMatrixIndex(0); |
1800 | | DEFINE_printMatrixIndex(1); |
1801 | | |
1802 | | void printMatrixTileList(MCInst *MI, unsigned OpNum, SStream *O) |
1803 | 826 | { |
1804 | 826 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_MatrixTileList, OpNum); |
1805 | 826 | unsigned MaxRegs = 8; |
1806 | 826 | unsigned RegMask = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
1807 | | |
1808 | 826 | unsigned NumRegs = 0; |
1809 | 7.43k | for (unsigned I = 0; I < MaxRegs; ++I) |
1810 | 6.60k | if ((RegMask & (1 << I)) != 0) |
1811 | 4.11k | ++NumRegs; |
1812 | | |
1813 | 826 | SStream_concat0(O, "{"); |
1814 | 826 | unsigned Printed = 0; |
1815 | 7.43k | for (unsigned I = 0; I < MaxRegs; ++I) { |
1816 | 6.60k | unsigned Reg = RegMask & (1 << I); |
1817 | 6.60k | if (Reg == 0) |
1818 | 2.49k | continue; |
1819 | 4.11k | printRegName(O, AArch64_ZAD0 + I); |
1820 | 4.11k | if (Printed + 1 != NumRegs) |
1821 | 3.30k | SStream_concat0(O, ", "); |
1822 | 4.11k | ++Printed; |
1823 | 4.11k | } |
1824 | 826 | SStream_concat0(O, "}"); |
1825 | 826 | } |
1826 | | |
1827 | | void printVectorList(MCInst *MI, unsigned OpNum, SStream *O, |
1828 | | const char *LayoutSuffix) |
1829 | 59.8k | { |
1830 | 59.8k | unsigned Reg = MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); |
1831 | | |
1832 | 59.8k | SStream_concat0(O, "{ "); |
1833 | | |
1834 | | // Work out how many registers there are in the list (if there is an actual |
1835 | | // list). |
1836 | 59.8k | unsigned NumRegs = 1; |
1837 | 59.8k | if (MCRegisterClass_contains( |
1838 | 59.8k | MCRegisterInfo_getRegClass(MI->MRI, AArch64_DDRegClassID), |
1839 | 59.8k | Reg) || |
1840 | 59.8k | MCRegisterClass_contains( |
1841 | 59.5k | MCRegisterInfo_getRegClass(MI->MRI, AArch64_ZPR2RegClassID), |
1842 | 59.5k | Reg) || |
1843 | 59.8k | MCRegisterClass_contains( |
1844 | 45.6k | MCRegisterInfo_getRegClass(MI->MRI, AArch64_QQRegClassID), |
1845 | 45.6k | Reg) || |
1846 | 59.8k | MCRegisterClass_contains( |
1847 | 41.1k | MCRegisterInfo_getRegClass(MI->MRI, AArch64_PPR2RegClassID), |
1848 | 41.1k | Reg) || |
1849 | 59.8k | MCRegisterClass_contains( |
1850 | 39.9k | MCRegisterInfo_getRegClass(MI->MRI, |
1851 | 39.9k | AArch64_ZPR2StridedRegClassID), |
1852 | 39.9k | Reg)) |
1853 | 22.6k | NumRegs = 2; |
1854 | 37.2k | else if (MCRegisterClass_contains( |
1855 | 37.2k | MCRegisterInfo_getRegClass(MI->MRI, |
1856 | 37.2k | AArch64_DDDRegClassID), |
1857 | 37.2k | Reg) || |
1858 | 37.2k | MCRegisterClass_contains( |
1859 | 36.8k | MCRegisterInfo_getRegClass(MI->MRI, |
1860 | 36.8k | AArch64_ZPR3RegClassID), |
1861 | 36.8k | Reg) || |
1862 | 37.2k | MCRegisterClass_contains( |
1863 | 36.5k | MCRegisterInfo_getRegClass(MI->MRI, |
1864 | 36.5k | AArch64_QQQRegClassID), |
1865 | 36.5k | Reg)) |
1866 | 4.47k | NumRegs = 3; |
1867 | 32.7k | else if (MCRegisterClass_contains( |
1868 | 32.7k | MCRegisterInfo_getRegClass(MI->MRI, |
1869 | 32.7k | AArch64_DDDDRegClassID), |
1870 | 32.7k | Reg) || |
1871 | 32.7k | MCRegisterClass_contains( |
1872 | 32.4k | MCRegisterInfo_getRegClass(MI->MRI, |
1873 | 32.4k | AArch64_ZPR4RegClassID), |
1874 | 32.4k | Reg) || |
1875 | 32.7k | MCRegisterClass_contains( |
1876 | 24.3k | MCRegisterInfo_getRegClass(MI->MRI, |
1877 | 24.3k | AArch64_QQQQRegClassID), |
1878 | 24.3k | Reg) || |
1879 | 32.7k | MCRegisterClass_contains( |
1880 | 19.0k | MCRegisterInfo_getRegClass( |
1881 | 19.0k | MI->MRI, AArch64_ZPR4StridedRegClassID), |
1882 | 19.0k | Reg)) |
1883 | 14.7k | NumRegs = 4; |
1884 | | |
1885 | 59.8k | unsigned Stride = 1; |
1886 | 59.8k | if (MCRegisterClass_contains( |
1887 | 59.8k | MCRegisterInfo_getRegClass(MI->MRI, |
1888 | 59.8k | AArch64_ZPR2StridedRegClassID), |
1889 | 59.8k | Reg)) |
1890 | 2.74k | Stride = 8; |
1891 | 57.1k | else if (MCRegisterClass_contains( |
1892 | 57.1k | MCRegisterInfo_getRegClass( |
1893 | 57.1k | MI->MRI, AArch64_ZPR4StridedRegClassID), |
1894 | 57.1k | Reg)) |
1895 | 1.06k | Stride = 4; |
1896 | | |
1897 | | // Now forget about the list and find out what the first register is. |
1898 | 59.8k | if (MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_dsub0)) |
1899 | 1.06k | Reg = MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_dsub0); |
1900 | 58.8k | else if (MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_qsub0)) |
1901 | 13.5k | Reg = MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_qsub0); |
1902 | 45.2k | else if (MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_zsub0)) |
1903 | 26.0k | Reg = MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_zsub0); |
1904 | 19.1k | else if (MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_psub0)) |
1905 | 1.17k | 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.8k | if (MCRegisterClass_contains(MCRegisterInfo_getRegClass( |
1910 | 59.8k | MI->MRI, AArch64_FPR64RegClassID), |
1911 | 59.8k | Reg)) { |
1912 | 1.29k | const MCRegisterClass *FPR128RC = MCRegisterInfo_getRegClass( |
1913 | 1.29k | MI->MRI, AArch64_FPR128RegClassID); |
1914 | 1.29k | Reg = MCRegisterInfo_getMatchingSuperReg( |
1915 | 1.29k | MI->MRI, Reg, AArch64_dsub, FPR128RC); |
1916 | 1.29k | } |
1917 | | |
1918 | 59.8k | if ((MCRegisterClass_contains( |
1919 | 59.8k | MCRegisterInfo_getRegClass(MI->MRI, AArch64_ZPRRegClassID), |
1920 | 59.8k | Reg) || |
1921 | 59.8k | MCRegisterClass_contains( |
1922 | 19.9k | MCRegisterInfo_getRegClass(MI->MRI, AArch64_PPRRegClassID), |
1923 | 19.9k | Reg)) && |
1924 | 59.8k | 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.8k | Reg < getNextVectorRegister(Reg, NumRegs - 1)) { |
1928 | 22.9k | printRegName(O, Reg); |
1929 | 22.9k | SStream_concat0(O, LayoutSuffix); |
1930 | 22.9k | if (NumRegs > 1) { |
1931 | | // Set of two sve registers should be separated by ',' |
1932 | 22.9k | const char *split_char = NumRegs == 2 ? ", " : " - "; |
1933 | 22.9k | SStream_concat0(O, split_char); |
1934 | 22.9k | printRegName(O, |
1935 | 22.9k | (getNextVectorRegister(Reg, NumRegs - 1))); |
1936 | 22.9k | SStream_concat0(O, LayoutSuffix); |
1937 | 22.9k | } |
1938 | 36.8k | } else { |
1939 | 110k | for (unsigned i = 0; i < NumRegs; |
1940 | 74.0k | ++i, Reg = getNextVectorRegister(Reg, Stride)) { |
1941 | | // wrap-around sve register |
1942 | 74.0k | if (MCRegisterClass_contains( |
1943 | 74.0k | MCRegisterInfo_getRegClass( |
1944 | 74.0k | MI->MRI, AArch64_ZPRRegClassID), |
1945 | 74.0k | Reg) || |
1946 | 74.0k | MCRegisterClass_contains( |
1947 | 48.7k | MCRegisterInfo_getRegClass( |
1948 | 48.7k | MI->MRI, AArch64_PPRRegClassID), |
1949 | 48.7k | Reg)) |
1950 | 25.3k | printRegName(O, Reg); |
1951 | 48.7k | else |
1952 | 48.7k | printRegNameAlt(O, Reg, AArch64_vreg); |
1953 | 74.0k | SStream_concat0(O, LayoutSuffix); |
1954 | 74.0k | if (i + 1 != NumRegs) |
1955 | 37.2k | SStream_concat0(O, ", "); |
1956 | 74.0k | } |
1957 | 36.8k | } |
1958 | 59.8k | SStream_concat0(O, " }"); |
1959 | 59.8k | } |
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.8k | { \ |
1972 | 59.8k | AArch64_add_cs_detail_2( \ |
1973 | 59.8k | MI, \ |
1974 | 59.8k | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ |
1975 | 59.8k | NumLanes), \ |
1976 | 59.8k | LaneKind), \ |
1977 | 59.8k | OpNum, NumLanes, CHAR(LaneKind)); \ |
1978 | 59.8k | if (CHAR(LaneKind) == '0') { \ |
1979 | 24 | printVectorList(MI, OpNum, O, ""); \ |
1980 | 24 | return; \ |
1981 | 24 | } \ |
1982 | 59.8k | char Suffix[32]; \ |
1983 | 59.8k | if (NumLanes) \ |
1984 | 59.8k | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ |
1985 | 5.22k | CHAR(LaneKind)); \ |
1986 | 59.8k | else \ |
1987 | 59.8k | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ |
1988 | 54.6k | CHAR(LaneKind)); \ |
1989 | 59.8k | \ |
1990 | 59.8k | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ |
1991 | 59.8k | } Line | Count | Source | 1971 | 13.1k | { \ | 1972 | 13.1k | AArch64_add_cs_detail_2( \ | 1973 | 13.1k | MI, \ | 1974 | 13.1k | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 13.1k | NumLanes), \ | 1976 | 13.1k | LaneKind), \ | 1977 | 13.1k | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 13.1k | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 13.1k | char Suffix[32]; \ | 1983 | 13.1k | if (NumLanes) \ | 1984 | 13.1k | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 0 | CHAR(LaneKind)); \ | 1986 | 13.1k | else \ | 1987 | 13.1k | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 13.1k | CHAR(LaneKind)); \ | 1989 | 13.1k | \ | 1990 | 13.1k | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 13.1k | } |
Line | Count | Source | 1971 | 15.7k | { \ | 1972 | 15.7k | AArch64_add_cs_detail_2( \ | 1973 | 15.7k | MI, \ | 1974 | 15.7k | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 15.7k | NumLanes), \ | 1976 | 15.7k | LaneKind), \ | 1977 | 15.7k | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 15.7k | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 15.7k | char Suffix[32]; \ | 1983 | 15.7k | if (NumLanes) \ | 1984 | 15.7k | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 0 | CHAR(LaneKind)); \ | 1986 | 15.7k | else \ | 1987 | 15.7k | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 15.7k | CHAR(LaneKind)); \ | 1989 | 15.7k | \ | 1990 | 15.7k | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 15.7k | } |
Line | Count | Source | 1971 | 12.3k | { \ | 1972 | 12.3k | AArch64_add_cs_detail_2( \ | 1973 | 12.3k | MI, \ | 1974 | 12.3k | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 12.3k | NumLanes), \ | 1976 | 12.3k | LaneKind), \ | 1977 | 12.3k | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 12.3k | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 12.3k | char Suffix[32]; \ | 1983 | 12.3k | if (NumLanes) \ | 1984 | 12.3k | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 0 | CHAR(LaneKind)); \ | 1986 | 12.3k | else \ | 1987 | 12.3k | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 12.3k | CHAR(LaneKind)); \ | 1989 | 12.3k | \ | 1990 | 12.3k | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 12.3k | } |
Line | Count | Source | 1971 | 11.8k | { \ | 1972 | 11.8k | AArch64_add_cs_detail_2( \ | 1973 | 11.8k | MI, \ | 1974 | 11.8k | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 11.8k | NumLanes), \ | 1976 | 11.8k | LaneKind), \ | 1977 | 11.8k | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 11.8k | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 11.8k | char Suffix[32]; \ | 1983 | 11.8k | if (NumLanes) \ | 1984 | 11.8k | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 0 | CHAR(LaneKind)); \ | 1986 | 11.8k | else \ | 1987 | 11.8k | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 11.8k | CHAR(LaneKind)); \ | 1989 | 11.8k | \ | 1990 | 11.8k | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 11.8k | } |
Line | Count | Source | 1971 | 1.53k | { \ | 1972 | 1.53k | AArch64_add_cs_detail_2( \ | 1973 | 1.53k | MI, \ | 1974 | 1.53k | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 1.53k | NumLanes), \ | 1976 | 1.53k | LaneKind), \ | 1977 | 1.53k | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 1.53k | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 1.53k | char Suffix[32]; \ | 1983 | 1.53k | if (NumLanes) \ | 1984 | 1.53k | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 0 | CHAR(LaneKind)); \ | 1986 | 1.53k | else \ | 1987 | 1.53k | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 1.53k | CHAR(LaneKind)); \ | 1989 | 1.53k | \ | 1990 | 1.53k | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 1.53k | } |
printTypedVectorList_16_b Line | Count | Source | 1971 | 2.06k | { \ | 1972 | 2.06k | AArch64_add_cs_detail_2( \ | 1973 | 2.06k | MI, \ | 1974 | 2.06k | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 2.06k | NumLanes), \ | 1976 | 2.06k | LaneKind), \ | 1977 | 2.06k | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 2.06k | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 2.06k | char Suffix[32]; \ | 1983 | 2.06k | if (NumLanes) \ | 1984 | 2.06k | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 2.06k | CHAR(LaneKind)); \ | 1986 | 2.06k | else \ | 1987 | 2.06k | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 2.06k | \ | 1990 | 2.06k | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 2.06k | } |
Line | Count | Source | 1971 | 156 | { \ | 1972 | 156 | AArch64_add_cs_detail_2( \ | 1973 | 156 | MI, \ | 1974 | 156 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 156 | NumLanes), \ | 1976 | 156 | LaneKind), \ | 1977 | 156 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 156 | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 156 | char Suffix[32]; \ | 1983 | 156 | if (NumLanes) \ | 1984 | 156 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 156 | CHAR(LaneKind)); \ | 1986 | 156 | else \ | 1987 | 156 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 156 | \ | 1990 | 156 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 156 | } |
Line | Count | Source | 1971 | 693 | { \ | 1972 | 693 | AArch64_add_cs_detail_2( \ | 1973 | 693 | MI, \ | 1974 | 693 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 693 | NumLanes), \ | 1976 | 693 | LaneKind), \ | 1977 | 693 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 693 | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 693 | char Suffix[32]; \ | 1983 | 693 | if (NumLanes) \ | 1984 | 693 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 693 | CHAR(LaneKind)); \ | 1986 | 693 | else \ | 1987 | 693 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 693 | \ | 1990 | 693 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 693 | } |
Line | Count | Source | 1971 | 641 | { \ | 1972 | 641 | AArch64_add_cs_detail_2( \ | 1973 | 641 | MI, \ | 1974 | 641 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 641 | NumLanes), \ | 1976 | 641 | LaneKind), \ | 1977 | 641 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 641 | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 641 | char Suffix[32]; \ | 1983 | 641 | if (NumLanes) \ | 1984 | 641 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 641 | CHAR(LaneKind)); \ | 1986 | 641 | else \ | 1987 | 641 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 641 | \ | 1990 | 641 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 641 | } |
Line | Count | Source | 1971 | 115 | { \ | 1972 | 115 | AArch64_add_cs_detail_2( \ | 1973 | 115 | MI, \ | 1974 | 115 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 115 | NumLanes), \ | 1976 | 115 | LaneKind), \ | 1977 | 115 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 115 | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 115 | char Suffix[32]; \ | 1983 | 115 | if (NumLanes) \ | 1984 | 115 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 115 | CHAR(LaneKind)); \ | 1986 | 115 | else \ | 1987 | 115 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 115 | \ | 1990 | 115 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 115 | } |
Line | Count | Source | 1971 | 180 | { \ | 1972 | 180 | AArch64_add_cs_detail_2( \ | 1973 | 180 | MI, \ | 1974 | 180 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 180 | NumLanes), \ | 1976 | 180 | LaneKind), \ | 1977 | 180 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 180 | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 180 | char Suffix[32]; \ | 1983 | 180 | if (NumLanes) \ | 1984 | 180 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 180 | CHAR(LaneKind)); \ | 1986 | 180 | else \ | 1987 | 180 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 180 | \ | 1990 | 180 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 180 | } |
Line | Count | Source | 1971 | 382 | { \ | 1972 | 382 | AArch64_add_cs_detail_2( \ | 1973 | 382 | MI, \ | 1974 | 382 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 382 | NumLanes), \ | 1976 | 382 | LaneKind), \ | 1977 | 382 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 382 | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 382 | char Suffix[32]; \ | 1983 | 382 | if (NumLanes) \ | 1984 | 382 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 382 | CHAR(LaneKind)); \ | 1986 | 382 | else \ | 1987 | 382 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 382 | \ | 1990 | 382 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 382 | } |
Line | Count | Source | 1971 | 991 | { \ | 1972 | 991 | AArch64_add_cs_detail_2( \ | 1973 | 991 | MI, \ | 1974 | 991 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 991 | NumLanes), \ | 1976 | 991 | LaneKind), \ | 1977 | 991 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 991 | if (CHAR(LaneKind) == '0') { \ | 1979 | 0 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 0 | return; \ | 1981 | 0 | } \ | 1982 | 991 | char Suffix[32]; \ | 1983 | 991 | if (NumLanes) \ | 1984 | 991 | cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, \ | 1985 | 991 | CHAR(LaneKind)); \ | 1986 | 991 | else \ | 1987 | 991 | cs_snprintf(Suffix, sizeof(Suffix), ".%c", \ | 1988 | 0 | CHAR(LaneKind)); \ | 1989 | 991 | \ | 1990 | 991 | printVectorList(MI, OpNum, O, ((const char *)&Suffix)); \ | 1991 | 991 | } |
Line | Count | Source | 1971 | 24 | { \ | 1972 | 24 | AArch64_add_cs_detail_2( \ | 1973 | 24 | MI, \ | 1974 | 24 | CONCAT(CONCAT(AArch64_OP_GROUP_TypedVectorList, \ | 1975 | 24 | NumLanes), \ | 1976 | 24 | LaneKind), \ | 1977 | 24 | OpNum, NumLanes, CHAR(LaneKind)); \ | 1978 | 24 | if (CHAR(LaneKind) == '0') { \ | 1979 | 24 | printVectorList(MI, OpNum, O, ""); \ | 1980 | 24 | return; \ | 1981 | 24 | } \ | 1982 | 24 | 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 | 29.4k | { \ |
2011 | 29.4k | AArch64_add_cs_detail_1( \ |
2012 | 29.4k | MI, CONCAT(AArch64_OP_GROUP_VectorIndex, Scale), \ |
2013 | 29.4k | OpNum, Scale); \ |
2014 | 29.4k | SStream_concat(O, "%s", "["); \ |
2015 | 29.4k | printUInt64(O, Scale *MCOperand_getImm( \ |
2016 | 29.4k | MCInst_getOperand(MI, (OpNum)))); \ |
2017 | 29.4k | SStream_concat0(O, "]"); \ |
2018 | 29.4k | } Line | Count | Source | 2010 | 29.4k | { \ | 2011 | 29.4k | AArch64_add_cs_detail_1( \ | 2012 | 29.4k | MI, CONCAT(AArch64_OP_GROUP_VectorIndex, Scale), \ | 2013 | 29.4k | OpNum, Scale); \ | 2014 | 29.4k | SStream_concat(O, "%s", "["); \ | 2015 | 29.4k | printUInt64(O, Scale *MCOperand_getImm( \ | 2016 | 29.4k | MCInst_getOperand(MI, (OpNum)))); \ | 2017 | 29.4k | SStream_concat0(O, "]"); \ | 2018 | 29.4k | } |
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 | 10.2k | { |
2024 | 10.2k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_AlignedLabel, OpNum); |
2025 | 10.2k | 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 | 10.2k | if (MCOperand_isImm(Op)) { |
2030 | 10.0k | SStream_concat0(O, markup("<imm:")); |
2031 | 10.0k | int64_t Offset = MCOperand_getImm(Op) * 4; |
2032 | 10.0k | if (MI->csh->PrintBranchImmAsAddress) |
2033 | 10.0k | printUInt64(O, (Address + Offset)); |
2034 | 0 | else { |
2035 | 0 | printUInt64Bang(O, (Offset)); |
2036 | 0 | } |
2037 | 10.0k | SStream_concat0(O, markup(">")); |
2038 | 10.0k | return; |
2039 | 10.0k | } |
2040 | | |
2041 | 226 | printUInt64Bang(O, MCOperand_getImm(Op)); |
2042 | 226 | } |
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 | 4.06k | void printAdrAdrpLabel(MCInst *MI, uint64_t Address, unsigned OpNum, SStream *O) { |
2089 | 4.06k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_AdrAdrpLabel, OpNum); |
2090 | 4.06k | 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 | 4.06k | if (MCOperand_isImm(Op)) { |
2095 | 4.06k | int64_t Offset = MCOperand_getImm(Op); |
2096 | 4.06k | if (MCInst_getOpcode(MI) == AArch64_ADRP) { |
2097 | 1.93k | Offset = Offset * 4096; |
2098 | 1.93k | Address = Address & -4096; |
2099 | 1.93k | } |
2100 | 4.06k | SStream_concat0(O, markup(">")); |
2101 | 4.06k | if (MI->csh->PrintBranchImmAsAddress) |
2102 | 4.06k | printUInt64(O, (Address + Offset)); |
2103 | 0 | else { |
2104 | 0 | printUInt64Bang(O, Offset); |
2105 | 0 | } |
2106 | 4.06k | SStream_concat0(O, markup(">")); |
2107 | 4.06k | return; |
2108 | 4.06k | } |
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 | 177 | { |
2118 | 177 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_AppleSysBarrierOption, OpNo); |
2119 | 177 | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); |
2120 | 177 | switch (Val) { |
2121 | 76 | default: |
2122 | 76 | SStream_concat0(O, "<undefined>"); |
2123 | 76 | break; |
2124 | 5 | case 0: |
2125 | 5 | SStream_concat0(O, "osh"); |
2126 | 5 | break; |
2127 | 64 | case 1: |
2128 | 64 | SStream_concat0(O, "nsh"); |
2129 | 64 | break; |
2130 | 20 | case 2: |
2131 | 20 | SStream_concat0(O, "ish"); |
2132 | 20 | break; |
2133 | 12 | case 3: |
2134 | 12 | SStream_concat0(O, "sy"); |
2135 | 12 | break; |
2136 | 177 | } |
2137 | 177 | } |
2138 | | |
2139 | | void printBarrierOption(MCInst *MI, unsigned OpNo, SStream *O) |
2140 | 350 | { |
2141 | 350 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_BarrierOption, OpNo); |
2142 | 350 | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); |
2143 | 350 | unsigned Opcode = MCInst_getOpcode(MI); |
2144 | | |
2145 | 350 | const char *Name; |
2146 | 350 | if (Opcode == AArch64_ISB) { |
2147 | 20 | const AArch64ISB_ISB *ISB = AArch64ISB_lookupISBByEncoding(Val); |
2148 | 20 | Name = ISB ? ISB->Name : ""; |
2149 | 330 | } else if (Opcode == AArch64_TSB) { |
2150 | 21 | const AArch64TSB_TSB *TSB = AArch64TSB_lookupTSBByEncoding(Val); |
2151 | 21 | Name = TSB ? TSB->Name : ""; |
2152 | 309 | } else { |
2153 | 309 | const AArch64DB_DB *DB = AArch64DB_lookupDBByEncoding(Val); |
2154 | 309 | Name = DB ? DB->Name : ""; |
2155 | 309 | } |
2156 | 350 | if (Name[0] != '\0') |
2157 | 66 | SStream_concat0(O, Name); |
2158 | 284 | else { |
2159 | 284 | SStream_concat(O, "%s", markup("<imm:")); |
2160 | 284 | printUInt32Bang(O, Val); |
2161 | 284 | SStream_concat0(O, markup(">")); |
2162 | 284 | } |
2163 | 350 | } |
2164 | | |
2165 | | void printBarriernXSOption(MCInst *MI, unsigned OpNo, SStream *O) |
2166 | 74 | { |
2167 | 74 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_BarriernXSOption, OpNo); |
2168 | 74 | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); |
2169 | | |
2170 | 74 | const char *Name; |
2171 | 74 | const AArch64DBnXS_DBnXS *DB = AArch64DBnXS_lookupDBnXSByEncoding(Val); |
2172 | 74 | Name = DB ? DB->Name : ""; |
2173 | | |
2174 | 74 | if (Name[0] != '\0') |
2175 | 74 | 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 | 74 | } |
2181 | | |
2182 | | static bool isValidSysReg(const AArch64SysReg_SysReg *Reg, bool Read, |
2183 | | unsigned mode) |
2184 | 6.60k | { |
2185 | 6.60k | return (Reg && (Read ? Reg->Readable : Reg->Writeable) && |
2186 | 6.60k | AArch64_testFeatureList(mode, Reg->FeaturesRequired)); |
2187 | 6.60k | } |
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 | 5.43k | { |
2198 | 5.43k | const AArch64SysReg_SysReg *Reg = |
2199 | 5.43k | AArch64SysReg_lookupSysRegByEncoding(Val); |
2200 | | |
2201 | 5.43k | if (Reg && !isValidSysReg(Reg, Read, mode)) |
2202 | 503 | Reg = AArch64SysReg_lookupSysRegByName(Reg->AltName); |
2203 | | |
2204 | 5.43k | return Reg; |
2205 | 5.43k | } |
2206 | | |
2207 | | void printMRSSystemRegister(MCInst *MI, unsigned OpNo, SStream *O) |
2208 | 1.19k | { |
2209 | 1.19k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_MRSSystemRegister, OpNo); |
2210 | 1.19k | 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 | 1.19k | if (Val == AARCH64_SYSREG_DBGDTRRX_EL0) { |
2216 | 73 | SStream_concat0(O, "DBGDTRRX_EL0"); |
2217 | 73 | return; |
2218 | 73 | } |
2219 | | |
2220 | | // Horrible hack for two different registers having the same encoding. |
2221 | 1.11k | if (Val == AARCH64_SYSREG_TRCEXTINSELR) { |
2222 | 19 | SStream_concat0(O, "TRCEXTINSELR"); |
2223 | 19 | return; |
2224 | 19 | } |
2225 | | |
2226 | 1.10k | const AArch64SysReg_SysReg *Reg = |
2227 | 1.10k | lookupSysReg(Val, true /*Read*/, MI->csh->mode); |
2228 | | |
2229 | 1.10k | if (isValidSysReg(Reg, true /*Read*/, MI->csh->mode)) |
2230 | 142 | SStream_concat0(O, Reg->Name); |
2231 | 958 | else { |
2232 | 958 | char result[AARCH64_GRS_LEN + 1] = { 0 }; |
2233 | 958 | AArch64SysReg_genericRegisterString(Val, result); |
2234 | 958 | SStream_concat0(O, result); |
2235 | 958 | } |
2236 | 1.10k | } |
2237 | | |
2238 | | void printMSRSystemRegister(MCInst *MI, unsigned OpNo, SStream *O) |
2239 | 4.46k | { |
2240 | 4.46k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_MSRSystemRegister, OpNo); |
2241 | 4.46k | 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.46k | if (Val == AARCH64_SYSREG_DBGDTRTX_EL0) { |
2247 | 119 | SStream_concat0(O, "DBGDTRTX_EL0"); |
2248 | 119 | return; |
2249 | 119 | } |
2250 | | |
2251 | | // Horrible hack for two different registers having the same encoding. |
2252 | 4.34k | if (Val == AARCH64_SYSREG_TRCEXTINSELR) { |
2253 | 10 | SStream_concat0(O, "TRCEXTINSELR"); |
2254 | 10 | return; |
2255 | 10 | } |
2256 | | |
2257 | 4.33k | const AArch64SysReg_SysReg *Reg = |
2258 | 4.33k | lookupSysReg(Val, false /*Read*/, MI->csh->mode); |
2259 | | |
2260 | 4.33k | if (isValidSysReg(Reg, false /*Read*/, MI->csh->mode)) |
2261 | 517 | SStream_concat0(O, Reg->Name); |
2262 | 3.82k | else { |
2263 | 3.82k | char result[AARCH64_GRS_LEN + 1] = { 0 }; |
2264 | 3.82k | AArch64SysReg_genericRegisterString(Val, result); |
2265 | 3.82k | SStream_concat0(O, result); |
2266 | 3.82k | } |
2267 | 4.33k | } |
2268 | | |
2269 | | void printSystemPStateField(MCInst *MI, unsigned OpNo, SStream *O) |
2270 | 498 | { |
2271 | 498 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_SystemPStateField, OpNo); |
2272 | 498 | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); |
2273 | | |
2274 | 498 | const AArch64PState_PStateImm0_15 *PStateImm15 = |
2275 | 498 | AArch64PState_lookupPStateImm0_15ByEncoding(Val); |
2276 | 498 | const AArch64PState_PStateImm0_1 *PStateImm1 = |
2277 | 498 | AArch64PState_lookupPStateImm0_1ByEncoding(Val); |
2278 | 498 | if (PStateImm15 && |
2279 | 498 | AArch64_testFeatureList(MI->csh->mode, |
2280 | 448 | PStateImm15->FeaturesRequired)) |
2281 | 448 | SStream_concat0(O, PStateImm15->Name); |
2282 | 50 | else if (PStateImm1 && |
2283 | 50 | AArch64_testFeatureList(MI->csh->mode, |
2284 | 50 | PStateImm1->FeaturesRequired)) |
2285 | 50 | SStream_concat0(O, PStateImm1->Name); |
2286 | 0 | else { |
2287 | 0 | printUInt32Bang(O, (Val)); |
2288 | 0 | SStream_concat1(O, '\0'); |
2289 | 0 | } |
2290 | 498 | } |
2291 | | |
2292 | | void printSIMDType10Operand(MCInst *MI, unsigned OpNo, SStream *O) |
2293 | 801 | { |
2294 | 801 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_SIMDType10Operand, OpNo); |
2295 | 801 | unsigned RawVal = MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); |
2296 | 801 | uint64_t Val = AArch64_AM_decodeAdvSIMDModImmType10(RawVal); |
2297 | 801 | SStream_concat(O, "%s#%#016llx", markup("<imm:"), Val); |
2298 | 801 | SStream_concat0(O, markup(">")); |
2299 | 801 | } |
2300 | | |
2301 | | #define DEFINE_printComplexRotationOp(Angle, Remainder) \ |
2302 | | static void CONCAT(printComplexRotationOp, CONCAT(Angle, Remainder))( \ |
2303 | | MCInst * MI, unsigned OpNo, SStream *O) \ |
2304 | 2.17k | { \ |
2305 | 2.17k | AArch64_add_cs_detail_2( \ |
2306 | 2.17k | MI, \ |
2307 | 2.17k | CONCAT(CONCAT(AArch64_OP_GROUP_ComplexRotationOp, \ |
2308 | 2.17k | Angle), \ |
2309 | 2.17k | Remainder), \ |
2310 | 2.17k | OpNo, Angle, Remainder); \ |
2311 | 2.17k | unsigned Val = \ |
2312 | 2.17k | MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); \ |
2313 | 2.17k | SStream_concat(O, "%s", markup("<imm:")); \ |
2314 | 2.17k | SStream_concat(O, "#%d", (Val * Angle) + Remainder); \ |
2315 | 2.17k | SStream_concat0(O, markup(">")); \ |
2316 | 2.17k | } AArch64InstPrinter.c:printComplexRotationOp_180_90 Line | Count | Source | 2304 | 585 | { \ | 2305 | 585 | AArch64_add_cs_detail_2( \ | 2306 | 585 | MI, \ | 2307 | 585 | CONCAT(CONCAT(AArch64_OP_GROUP_ComplexRotationOp, \ | 2308 | 585 | Angle), \ | 2309 | 585 | Remainder), \ | 2310 | 585 | OpNo, Angle, Remainder); \ | 2311 | 585 | unsigned Val = \ | 2312 | 585 | MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); \ | 2313 | 585 | SStream_concat(O, "%s", markup("<imm:")); \ | 2314 | 585 | SStream_concat(O, "#%d", (Val * Angle) + Remainder); \ | 2315 | 585 | SStream_concat0(O, markup(">")); \ | 2316 | 585 | } |
AArch64InstPrinter.c:printComplexRotationOp_90_0 Line | Count | Source | 2304 | 1.59k | { \ | 2305 | 1.59k | AArch64_add_cs_detail_2( \ | 2306 | 1.59k | MI, \ | 2307 | 1.59k | CONCAT(CONCAT(AArch64_OP_GROUP_ComplexRotationOp, \ | 2308 | 1.59k | Angle), \ | 2309 | 1.59k | Remainder), \ | 2310 | 1.59k | OpNo, Angle, Remainder); \ | 2311 | 1.59k | unsigned Val = \ | 2312 | 1.59k | MCOperand_getImm(MCInst_getOperand(MI, (OpNo))); \ | 2313 | 1.59k | SStream_concat(O, "%s", markup("<imm:")); \ | 2314 | 1.59k | SStream_concat(O, "#%d", (Val * Angle) + Remainder); \ | 2315 | 1.59k | SStream_concat0(O, markup(">")); \ | 2316 | 1.59k | } |
|
2317 | | DEFINE_printComplexRotationOp(180, 90); |
2318 | | DEFINE_printComplexRotationOp(90, 0); |
2319 | | |
2320 | | void printSVEPattern(MCInst *MI, unsigned OpNum, SStream *O) |
2321 | 8.08k | { |
2322 | 8.08k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_SVEPattern, OpNum); |
2323 | 8.08k | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
2324 | 8.08k | const AArch64SVEPredPattern_SVEPREDPAT *Pat = |
2325 | 8.08k | AArch64SVEPredPattern_lookupSVEPREDPATByEncoding(Val); |
2326 | 8.08k | if (Pat) |
2327 | 4.97k | SStream_concat0(O, Pat->Name); |
2328 | 3.11k | else |
2329 | 3.11k | printUInt32Bang(O, Val); |
2330 | 8.08k | } |
2331 | | |
2332 | | void printSVEVecLenSpecifier(MCInst *MI, unsigned OpNum, SStream *O) |
2333 | 900 | { |
2334 | 900 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_SVEVecLenSpecifier, OpNum); |
2335 | 900 | unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); |
2336 | | // Pattern has only 1 bit |
2337 | 900 | if (Val > 1) |
2338 | 0 | CS_ASSERT_RET(0 && "Invalid vector length specifier"); |
2339 | 900 | const AArch64SVEVecLenSpecifier_SVEVECLENSPECIFIER *Pat = |
2340 | 900 | AArch64SVEVecLenSpecifier_lookupSVEVECLENSPECIFIERByEncoding( |
2341 | 900 | Val); |
2342 | 900 | if (Pat) |
2343 | 900 | SStream_concat0(O, Pat->Name); |
2344 | 900 | } |
2345 | | |
2346 | | #define DEFINE_printSVERegOp(suffix) \ |
2347 | | void CONCAT(printSVERegOp, suffix)(MCInst * MI, unsigned OpNum, \ |
2348 | | SStream *O) \ |
2349 | 169k | { \ |
2350 | 169k | AArch64_add_cs_detail_1( \ |
2351 | 169k | MI, CONCAT(AArch64_OP_GROUP_SVERegOp, suffix), OpNum, \ |
2352 | 169k | CHAR(suffix)); \ |
2353 | 169k | switch (CHAR(suffix)) { \ |
2354 | 50.7k | case '0': \ |
2355 | 83.2k | case 'b': \ |
2356 | 113k | case 'h': \ |
2357 | 141k | case 's': \ |
2358 | 167k | case 'd': \ |
2359 | 169k | case 'q': \ |
2360 | 169k | break; \ |
2361 | 167k | default: \ |
2362 | 0 | CS_ASSERT_RET(0 && "Invalid kind specifier."); \ |
2363 | 169k | } \ |
2364 | 169k | \ |
2365 | 169k | unsigned Reg = \ |
2366 | 169k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ |
2367 | 169k | printRegName(O, Reg); \ |
2368 | 169k | if (CHAR(suffix) != '0') { \ |
2369 | 118k | SStream_concat1(O, '.'); \ |
2370 | 118k | SStream_concat1(O, CHAR(suffix)); \ |
2371 | 118k | } \ |
2372 | 169k | } Line | Count | Source | 2349 | 32.5k | { \ | 2350 | 32.5k | AArch64_add_cs_detail_1( \ | 2351 | 32.5k | MI, CONCAT(AArch64_OP_GROUP_SVERegOp, suffix), OpNum, \ | 2352 | 32.5k | CHAR(suffix)); \ | 2353 | 32.5k | switch (CHAR(suffix)) { \ | 2354 | 0 | case '0': \ | 2355 | 32.5k | case 'b': \ | 2356 | 32.5k | case 'h': \ | 2357 | 32.5k | case 's': \ | 2358 | 32.5k | case 'd': \ | 2359 | 32.5k | case 'q': \ | 2360 | 32.5k | break; \ | 2361 | 32.5k | default: \ | 2362 | 0 | CS_ASSERT_RET(0 && "Invalid kind specifier."); \ | 2363 | 32.5k | } \ | 2364 | 32.5k | \ | 2365 | 32.5k | unsigned Reg = \ | 2366 | 32.5k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2367 | 32.5k | printRegName(O, Reg); \ | 2368 | 32.5k | if (CHAR(suffix) != '0') { \ | 2369 | 32.5k | SStream_concat1(O, '.'); \ | 2370 | 32.5k | SStream_concat1(O, CHAR(suffix)); \ | 2371 | 32.5k | } \ | 2372 | 32.5k | } |
Line | Count | Source | 2349 | 26.3k | { \ | 2350 | 26.3k | AArch64_add_cs_detail_1( \ | 2351 | 26.3k | MI, CONCAT(AArch64_OP_GROUP_SVERegOp, suffix), OpNum, \ | 2352 | 26.3k | CHAR(suffix)); \ | 2353 | 26.3k | switch (CHAR(suffix)) { \ | 2354 | 0 | case '0': \ | 2355 | 0 | case 'b': \ | 2356 | 0 | case 'h': \ | 2357 | 0 | case 's': \ | 2358 | 26.3k | case 'd': \ | 2359 | 26.3k | case 'q': \ | 2360 | 26.3k | break; \ | 2361 | 26.3k | default: \ | 2362 | 0 | CS_ASSERT_RET(0 && "Invalid kind specifier."); \ | 2363 | 26.3k | } \ | 2364 | 26.3k | \ | 2365 | 26.3k | unsigned Reg = \ | 2366 | 26.3k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2367 | 26.3k | printRegName(O, Reg); \ | 2368 | 26.3k | if (CHAR(suffix) != '0') { \ | 2369 | 26.3k | SStream_concat1(O, '.'); \ | 2370 | 26.3k | SStream_concat1(O, CHAR(suffix)); \ | 2371 | 26.3k | } \ | 2372 | 26.3k | } |
Line | Count | Source | 2349 | 30.2k | { \ | 2350 | 30.2k | AArch64_add_cs_detail_1( \ | 2351 | 30.2k | MI, CONCAT(AArch64_OP_GROUP_SVERegOp, suffix), OpNum, \ | 2352 | 30.2k | CHAR(suffix)); \ | 2353 | 30.2k | switch (CHAR(suffix)) { \ | 2354 | 0 | case '0': \ | 2355 | 0 | case 'b': \ | 2356 | 30.2k | case 'h': \ | 2357 | 30.2k | case 's': \ | 2358 | 30.2k | case 'd': \ | 2359 | 30.2k | case 'q': \ | 2360 | 30.2k | break; \ | 2361 | 30.2k | default: \ | 2362 | 0 | CS_ASSERT_RET(0 && "Invalid kind specifier."); \ | 2363 | 30.2k | } \ | 2364 | 30.2k | \ | 2365 | 30.2k | unsigned Reg = \ | 2366 | 30.2k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2367 | 30.2k | printRegName(O, Reg); \ | 2368 | 30.2k | if (CHAR(suffix) != '0') { \ | 2369 | 30.2k | SStream_concat1(O, '.'); \ | 2370 | 30.2k | SStream_concat1(O, CHAR(suffix)); \ | 2371 | 30.2k | } \ | 2372 | 30.2k | } |
Line | Count | Source | 2349 | 27.9k | { \ | 2350 | 27.9k | AArch64_add_cs_detail_1( \ | 2351 | 27.9k | MI, CONCAT(AArch64_OP_GROUP_SVERegOp, suffix), OpNum, \ | 2352 | 27.9k | CHAR(suffix)); \ | 2353 | 27.9k | switch (CHAR(suffix)) { \ | 2354 | 0 | case '0': \ | 2355 | 0 | case 'b': \ | 2356 | 0 | case 'h': \ | 2357 | 27.9k | case 's': \ | 2358 | 27.9k | case 'd': \ | 2359 | 27.9k | case 'q': \ | 2360 | 27.9k | break; \ | 2361 | 27.9k | default: \ | 2362 | 0 | CS_ASSERT_RET(0 && "Invalid kind specifier."); \ | 2363 | 27.9k | } \ | 2364 | 27.9k | \ | 2365 | 27.9k | unsigned Reg = \ | 2366 | 27.9k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2367 | 27.9k | printRegName(O, Reg); \ | 2368 | 27.9k | if (CHAR(suffix) != '0') { \ | 2369 | 27.9k | SStream_concat1(O, '.'); \ | 2370 | 27.9k | SStream_concat1(O, CHAR(suffix)); \ | 2371 | 27.9k | } \ | 2372 | 27.9k | } |
Line | Count | Source | 2349 | 50.7k | { \ | 2350 | 50.7k | AArch64_add_cs_detail_1( \ | 2351 | 50.7k | MI, CONCAT(AArch64_OP_GROUP_SVERegOp, suffix), OpNum, \ | 2352 | 50.7k | CHAR(suffix)); \ | 2353 | 50.7k | switch (CHAR(suffix)) { \ | 2354 | 50.7k | case '0': \ | 2355 | 50.7k | case 'b': \ | 2356 | 50.7k | case 'h': \ | 2357 | 50.7k | case 's': \ | 2358 | 50.7k | case 'd': \ | 2359 | 50.7k | case 'q': \ | 2360 | 50.7k | break; \ | 2361 | 50.7k | default: \ | 2362 | 0 | CS_ASSERT_RET(0 && "Invalid kind specifier."); \ | 2363 | 50.7k | } \ | 2364 | 50.7k | \ | 2365 | 50.7k | unsigned Reg = \ | 2366 | 50.7k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2367 | 50.7k | printRegName(O, Reg); \ | 2368 | 50.7k | if (CHAR(suffix) != '0') { \ | 2369 | 0 | SStream_concat1(O, '.'); \ | 2370 | 0 | SStream_concat1(O, CHAR(suffix)); \ | 2371 | 0 | } \ | 2372 | 50.7k | } |
Line | Count | Source | 2349 | 1.60k | { \ | 2350 | 1.60k | AArch64_add_cs_detail_1( \ | 2351 | 1.60k | MI, CONCAT(AArch64_OP_GROUP_SVERegOp, suffix), OpNum, \ | 2352 | 1.60k | CHAR(suffix)); \ | 2353 | 1.60k | switch (CHAR(suffix)) { \ | 2354 | 0 | case '0': \ | 2355 | 0 | case 'b': \ | 2356 | 0 | case 'h': \ | 2357 | 0 | case 's': \ | 2358 | 0 | case 'd': \ | 2359 | 1.60k | case 'q': \ | 2360 | 1.60k | break; \ | 2361 | 0 | default: \ | 2362 | 0 | CS_ASSERT_RET(0 && "Invalid kind specifier."); \ | 2363 | 1.60k | } \ | 2364 | 1.60k | \ | 2365 | 1.60k | unsigned Reg = \ | 2366 | 1.60k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2367 | 1.60k | printRegName(O, Reg); \ | 2368 | 1.60k | if (CHAR(suffix) != '0') { \ | 2369 | 1.60k | SStream_concat1(O, '.'); \ | 2370 | 1.60k | SStream_concat1(O, CHAR(suffix)); \ | 2371 | 1.60k | } \ | 2372 | 1.60k | } |
|
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 | 4.91k | { \ |
2383 | 4.91k | printInt32Bang(O, Val); \ |
2384 | 4.91k | } Line | Count | Source | 2382 | 1.70k | { \ | 2383 | 1.70k | printInt32Bang(O, Val); \ | 2384 | 1.70k | } |
Line | Count | Source | 2382 | 1.13k | { \ | 2383 | 1.13k | printInt32Bang(O, Val); \ | 2384 | 1.13k | } |
Line | Count | Source | 2382 | 2.07k | { \ | 2383 | 2.07k | printInt32Bang(O, Val); \ | 2384 | 2.07k | } |
|
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.22k | { \ |
2392 | 1.22k | printUInt32Bang(O, Val); \ |
2393 | 1.22k | } Line | Count | Source | 2391 | 59 | { \ | 2392 | 59 | printUInt32Bang(O, Val); \ | 2393 | 59 | } |
Line | Count | Source | 2391 | 424 | { \ | 2392 | 424 | printUInt32Bang(O, Val); \ | 2393 | 424 | } |
Line | Count | Source | 2391 | 742 | { \ | 2392 | 742 | printUInt32Bang(O, Val); \ | 2393 | 742 | } |
|
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 | 675 | { \ |
2401 | 675 | printInt64Bang(O, Val); \ |
2402 | 675 | } |
2403 | | DECLARE_printImmSVE_S64(int64_t); |
2404 | | |
2405 | | #define DECLARE_printImmSVE_U64(T) \ |
2406 | | void CONCAT(printImmSVE, T)(T Val, SStream * O) \ |
2407 | 204 | { \ |
2408 | 204 | printUInt64Bang(O, Val); \ |
2409 | 204 | } |
2410 | | DECLARE_printImmSVE_U64(uint64_t); |
2411 | | |
2412 | | #define DEFINE_isSignedType(T) \ |
2413 | | static inline bool CONCAT(isSignedType, T)() \ |
2414 | 5.57k | { \ |
2415 | 5.57k | return CHAR(T) == 'i'; \ |
2416 | 5.57k | } AArch64InstPrinter.c:isSignedType_int16_t Line | Count | Source | 2414 | 897 | { \ | 2415 | 897 | return CHAR(T) == 'i'; \ | 2416 | 897 | } |
AArch64InstPrinter.c:isSignedType_int8_t Line | Count | Source | 2414 | 1.13k | { \ | 2415 | 1.13k | return CHAR(T) == 'i'; \ | 2416 | 1.13k | } |
AArch64InstPrinter.c:isSignedType_int64_t Line | Count | Source | 2414 | 511 | { \ | 2415 | 511 | return CHAR(T) == 'i'; \ | 2416 | 511 | } |
AArch64InstPrinter.c:isSignedType_int32_t Line | Count | Source | 2414 | 1.59k | { \ | 2415 | 1.59k | return CHAR(T) == 'i'; \ | 2416 | 1.59k | } |
AArch64InstPrinter.c:isSignedType_uint16_t Line | Count | Source | 2414 | 59 | { \ | 2415 | 59 | return CHAR(T) == 'i'; \ | 2416 | 59 | } |
AArch64InstPrinter.c:isSignedType_uint8_t Line | Count | Source | 2414 | 424 | { \ | 2415 | 424 | return CHAR(T) == 'i'; \ | 2416 | 424 | } |
AArch64InstPrinter.c:isSignedType_uint64_t Line | Count | Source | 2414 | 204 | { \ | 2415 | 204 | return CHAR(T) == 'i'; \ | 2416 | 204 | } |
AArch64InstPrinter.c:isSignedType_uint32_t Line | Count | Source | 2414 | 742 | { \ | 2415 | 742 | return CHAR(T) == 'i'; \ | 2416 | 742 | } |
|
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 | 6.21k | { \ |
2430 | 6.21k | AArch64_add_cs_detail_1( \ |
2431 | 6.21k | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ |
2432 | 6.21k | unsigned UnscaledVal = \ |
2433 | 6.21k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ |
2434 | 6.21k | unsigned Shift = \ |
2435 | 6.21k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ |
2436 | 6.21k | \ |
2437 | 6.21k | if ((UnscaledVal == 0) && \ |
2438 | 6.21k | (AArch64_AM_getShiftValue(Shift) != 0)) { \ |
2439 | 644 | SStream_concat(O, "%s", markup("<imm:")); \ |
2440 | 644 | SStream_concat1(O, '#'); \ |
2441 | 644 | printUInt64(O, (UnscaledVal)); \ |
2442 | 644 | SStream_concat0(O, markup(">")); \ |
2443 | 644 | printShifter(MI, OpNum + 1, O); \ |
2444 | 644 | return; \ |
2445 | 644 | } \ |
2446 | 6.21k | \ |
2447 | 6.21k | T Val; \ |
2448 | 5.57k | if (CONCAT(isSignedType, T)()) \ |
2449 | 5.57k | Val = (int8_t)UnscaledVal * \ |
2450 | 4.14k | (1 << AArch64_AM_getShiftValue(Shift)); \ |
2451 | 5.57k | else \ |
2452 | 5.57k | Val = (uint8_t)UnscaledVal * \ |
2453 | 1.42k | (1 << AArch64_AM_getShiftValue(Shift)); \ |
2454 | 5.57k | \ |
2455 | 5.57k | CONCAT(printImmSVE, T)(Val, O); \ |
2456 | 5.57k | } Line | Count | Source | 2429 | 909 | { \ | 2430 | 909 | AArch64_add_cs_detail_1( \ | 2431 | 909 | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 909 | unsigned UnscaledVal = \ | 2433 | 909 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 909 | unsigned Shift = \ | 2435 | 909 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 909 | \ | 2437 | 909 | if ((UnscaledVal == 0) && \ | 2438 | 909 | (AArch64_AM_getShiftValue(Shift) != 0)) { \ | 2439 | 12 | SStream_concat(O, "%s", markup("<imm:")); \ | 2440 | 12 | SStream_concat1(O, '#'); \ | 2441 | 12 | printUInt64(O, (UnscaledVal)); \ | 2442 | 12 | SStream_concat0(O, markup(">")); \ | 2443 | 12 | printShifter(MI, OpNum + 1, O); \ | 2444 | 12 | return; \ | 2445 | 12 | } \ | 2446 | 909 | \ | 2447 | 909 | T Val; \ | 2448 | 897 | if (CONCAT(isSignedType, T)()) \ | 2449 | 897 | Val = (int8_t)UnscaledVal * \ | 2450 | 897 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 897 | else \ | 2452 | 897 | Val = (uint8_t)UnscaledVal * \ | 2453 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 897 | \ | 2455 | 897 | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 897 | } |
Line | Count | Source | 2429 | 1.13k | { \ | 2430 | 1.13k | AArch64_add_cs_detail_1( \ | 2431 | 1.13k | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 1.13k | unsigned UnscaledVal = \ | 2433 | 1.13k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 1.13k | unsigned Shift = \ | 2435 | 1.13k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 1.13k | \ | 2437 | 1.13k | if ((UnscaledVal == 0) && \ | 2438 | 1.13k | (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 | 1.13k | \ | 2447 | 1.13k | T Val; \ | 2448 | 1.13k | if (CONCAT(isSignedType, T)()) \ | 2449 | 1.13k | Val = (int8_t)UnscaledVal * \ | 2450 | 1.13k | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 1.13k | else \ | 2452 | 1.13k | Val = (uint8_t)UnscaledVal * \ | 2453 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 1.13k | \ | 2455 | 1.13k | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 1.13k | } |
Line | Count | Source | 2429 | 535 | { \ | 2430 | 535 | AArch64_add_cs_detail_1( \ | 2431 | 535 | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 535 | unsigned UnscaledVal = \ | 2433 | 535 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 535 | unsigned Shift = \ | 2435 | 535 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 535 | \ | 2437 | 535 | if ((UnscaledVal == 0) && \ | 2438 | 535 | (AArch64_AM_getShiftValue(Shift) != 0)) { \ | 2439 | 24 | SStream_concat(O, "%s", markup("<imm:")); \ | 2440 | 24 | SStream_concat1(O, '#'); \ | 2441 | 24 | printUInt64(O, (UnscaledVal)); \ | 2442 | 24 | SStream_concat0(O, markup(">")); \ | 2443 | 24 | printShifter(MI, OpNum + 1, O); \ | 2444 | 24 | return; \ | 2445 | 24 | } \ | 2446 | 535 | \ | 2447 | 535 | T Val; \ | 2448 | 511 | if (CONCAT(isSignedType, T)()) \ | 2449 | 511 | Val = (int8_t)UnscaledVal * \ | 2450 | 511 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 511 | else \ | 2452 | 511 | Val = (uint8_t)UnscaledVal * \ | 2453 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 511 | \ | 2455 | 511 | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 511 | } |
Line | Count | Source | 2429 | 1.62k | { \ | 2430 | 1.62k | AArch64_add_cs_detail_1( \ | 2431 | 1.62k | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 1.62k | unsigned UnscaledVal = \ | 2433 | 1.62k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 1.62k | unsigned Shift = \ | 2435 | 1.62k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 1.62k | \ | 2437 | 1.62k | if ((UnscaledVal == 0) && \ | 2438 | 1.62k | (AArch64_AM_getShiftValue(Shift) != 0)) { \ | 2439 | 31 | SStream_concat(O, "%s", markup("<imm:")); \ | 2440 | 31 | SStream_concat1(O, '#'); \ | 2441 | 31 | printUInt64(O, (UnscaledVal)); \ | 2442 | 31 | SStream_concat0(O, markup(">")); \ | 2443 | 31 | printShifter(MI, OpNum + 1, O); \ | 2444 | 31 | return; \ | 2445 | 31 | } \ | 2446 | 1.62k | \ | 2447 | 1.62k | T Val; \ | 2448 | 1.59k | if (CONCAT(isSignedType, T)()) \ | 2449 | 1.59k | Val = (int8_t)UnscaledVal * \ | 2450 | 1.59k | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 1.59k | else \ | 2452 | 1.59k | Val = (uint8_t)UnscaledVal * \ | 2453 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 1.59k | \ | 2455 | 1.59k | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 1.59k | } |
Line | Count | Source | 2429 | 216 | { \ | 2430 | 216 | AArch64_add_cs_detail_1( \ | 2431 | 216 | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 216 | unsigned UnscaledVal = \ | 2433 | 216 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 216 | unsigned Shift = \ | 2435 | 216 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 216 | \ | 2437 | 216 | if ((UnscaledVal == 0) && \ | 2438 | 216 | (AArch64_AM_getShiftValue(Shift) != 0)) { \ | 2439 | 157 | SStream_concat(O, "%s", markup("<imm:")); \ | 2440 | 157 | SStream_concat1(O, '#'); \ | 2441 | 157 | printUInt64(O, (UnscaledVal)); \ | 2442 | 157 | SStream_concat0(O, markup(">")); \ | 2443 | 157 | printShifter(MI, OpNum + 1, O); \ | 2444 | 157 | return; \ | 2445 | 157 | } \ | 2446 | 216 | \ | 2447 | 216 | T Val; \ | 2448 | 59 | if (CONCAT(isSignedType, T)()) \ | 2449 | 59 | Val = (int8_t)UnscaledVal * \ | 2450 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 59 | else \ | 2452 | 59 | Val = (uint8_t)UnscaledVal * \ | 2453 | 59 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 59 | \ | 2455 | 59 | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 59 | } |
Line | Count | Source | 2429 | 424 | { \ | 2430 | 424 | AArch64_add_cs_detail_1( \ | 2431 | 424 | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 424 | unsigned UnscaledVal = \ | 2433 | 424 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 424 | unsigned Shift = \ | 2435 | 424 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 424 | \ | 2437 | 424 | if ((UnscaledVal == 0) && \ | 2438 | 424 | (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 | 424 | \ | 2447 | 424 | T Val; \ | 2448 | 424 | if (CONCAT(isSignedType, T)()) \ | 2449 | 424 | Val = (int8_t)UnscaledVal * \ | 2450 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 424 | else \ | 2452 | 424 | Val = (uint8_t)UnscaledVal * \ | 2453 | 424 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 424 | \ | 2455 | 424 | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 424 | } |
Line | Count | Source | 2429 | 602 | { \ | 2430 | 602 | AArch64_add_cs_detail_1( \ | 2431 | 602 | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 602 | unsigned UnscaledVal = \ | 2433 | 602 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 602 | unsigned Shift = \ | 2435 | 602 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 602 | \ | 2437 | 602 | if ((UnscaledVal == 0) && \ | 2438 | 602 | (AArch64_AM_getShiftValue(Shift) != 0)) { \ | 2439 | 398 | SStream_concat(O, "%s", markup("<imm:")); \ | 2440 | 398 | SStream_concat1(O, '#'); \ | 2441 | 398 | printUInt64(O, (UnscaledVal)); \ | 2442 | 398 | SStream_concat0(O, markup(">")); \ | 2443 | 398 | printShifter(MI, OpNum + 1, O); \ | 2444 | 398 | return; \ | 2445 | 398 | } \ | 2446 | 602 | \ | 2447 | 602 | T Val; \ | 2448 | 204 | if (CONCAT(isSignedType, T)()) \ | 2449 | 204 | Val = (int8_t)UnscaledVal * \ | 2450 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 204 | else \ | 2452 | 204 | Val = (uint8_t)UnscaledVal * \ | 2453 | 204 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 204 | \ | 2455 | 204 | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 204 | } |
Line | Count | Source | 2429 | 764 | { \ | 2430 | 764 | AArch64_add_cs_detail_1( \ | 2431 | 764 | MI, CONCAT(AArch64_OP_GROUP_Imm8OptLsl, T), OpNum, sizeof(T)); \ | 2432 | 764 | unsigned UnscaledVal = \ | 2433 | 764 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2434 | 764 | unsigned Shift = \ | 2435 | 764 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum + 1))); \ | 2436 | 764 | \ | 2437 | 764 | if ((UnscaledVal == 0) && \ | 2438 | 764 | (AArch64_AM_getShiftValue(Shift) != 0)) { \ | 2439 | 22 | SStream_concat(O, "%s", markup("<imm:")); \ | 2440 | 22 | SStream_concat1(O, '#'); \ | 2441 | 22 | printUInt64(O, (UnscaledVal)); \ | 2442 | 22 | SStream_concat0(O, markup(">")); \ | 2443 | 22 | printShifter(MI, OpNum + 1, O); \ | 2444 | 22 | return; \ | 2445 | 22 | } \ | 2446 | 764 | \ | 2447 | 764 | T Val; \ | 2448 | 742 | if (CONCAT(isSignedType, T)()) \ | 2449 | 742 | Val = (int8_t)UnscaledVal * \ | 2450 | 0 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2451 | 742 | else \ | 2452 | 742 | Val = (uint8_t)UnscaledVal * \ | 2453 | 742 | (1 << AArch64_AM_getShiftValue(Shift)); \ | 2454 | 742 | \ | 2455 | 742 | CONCAT(printImmSVE, T)(Val, O); \ | 2456 | 742 | } |
|
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.92k | { \ |
2470 | 3.92k | AArch64_add_cs_detail_1( \ |
2471 | 3.92k | MI, CONCAT(AArch64_OP_GROUP_SVELogicalImm, T), OpNum, \ |
2472 | 3.92k | sizeof(T)); \ |
2473 | 3.92k | typedef T SignedT; \ |
2474 | 3.92k | typedef CONCATS(u, T) UnsignedT; \ |
2475 | 3.92k | \ |
2476 | 3.92k | uint64_t Val = \ |
2477 | 3.92k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ |
2478 | 3.92k | UnsignedT PrintVal = \ |
2479 | 3.92k | AArch64_AM_decodeLogicalImmediate(Val, 64); \ |
2480 | 3.92k | \ |
2481 | 3.92k | if ((int16_t)PrintVal == (SignedT)PrintVal) \ |
2482 | 3.92k | CONCAT(printImmSVE, T)((T)PrintVal, O); \ |
2483 | 3.92k | else if ((uint16_t)PrintVal == PrintVal) \ |
2484 | 2.84k | CONCAT(printImmSVE, T)(PrintVal, O); \ |
2485 | 2.84k | else { \ |
2486 | 2.47k | SStream_concat(O, "%s", markup("<imm:")); \ |
2487 | 2.47k | printUInt64Bang(O, ((uint64_t)PrintVal)); \ |
2488 | 2.47k | SStream_concat0(O, markup(">")); \ |
2489 | 2.47k | } \ |
2490 | 3.92k | } printSVELogicalImm_int16_t Line | Count | Source | 2469 | 806 | { \ | 2470 | 806 | AArch64_add_cs_detail_1( \ | 2471 | 806 | MI, CONCAT(AArch64_OP_GROUP_SVELogicalImm, T), OpNum, \ | 2472 | 806 | sizeof(T)); \ | 2473 | 806 | typedef T SignedT; \ | 2474 | 806 | typedef CONCATS(u, T) UnsignedT; \ | 2475 | 806 | \ | 2476 | 806 | uint64_t Val = \ | 2477 | 806 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2478 | 806 | UnsignedT PrintVal = \ | 2479 | 806 | AArch64_AM_decodeLogicalImmediate(Val, 64); \ | 2480 | 806 | \ | 2481 | 806 | if ((int16_t)PrintVal == (SignedT)PrintVal) \ | 2482 | 806 | CONCAT(printImmSVE, T)((T)PrintVal, O); \ | 2483 | 806 | 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 | 806 | } |
printSVELogicalImm_int32_t Line | Count | Source | 2469 | 2.43k | { \ | 2470 | 2.43k | AArch64_add_cs_detail_1( \ | 2471 | 2.43k | MI, CONCAT(AArch64_OP_GROUP_SVELogicalImm, T), OpNum, \ | 2472 | 2.43k | sizeof(T)); \ | 2473 | 2.43k | typedef T SignedT; \ | 2474 | 2.43k | typedef CONCATS(u, T) UnsignedT; \ | 2475 | 2.43k | \ | 2476 | 2.43k | uint64_t Val = \ | 2477 | 2.43k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2478 | 2.43k | UnsignedT PrintVal = \ | 2479 | 2.43k | AArch64_AM_decodeLogicalImmediate(Val, 64); \ | 2480 | 2.43k | \ | 2481 | 2.43k | if ((int16_t)PrintVal == (SignedT)PrintVal) \ | 2482 | 2.43k | CONCAT(printImmSVE, T)((T)PrintVal, O); \ | 2483 | 2.43k | else if ((uint16_t)PrintVal == PrintVal) \ | 2484 | 2.30k | CONCAT(printImmSVE, T)(PrintVal, O); \ | 2485 | 2.30k | else { \ | 2486 | 1.95k | SStream_concat(O, "%s", markup("<imm:")); \ | 2487 | 1.95k | printUInt64Bang(O, ((uint64_t)PrintVal)); \ | 2488 | 1.95k | SStream_concat0(O, markup(">")); \ | 2489 | 1.95k | } \ | 2490 | 2.43k | } |
printSVELogicalImm_int64_t Line | Count | Source | 2469 | 689 | { \ | 2470 | 689 | AArch64_add_cs_detail_1( \ | 2471 | 689 | MI, CONCAT(AArch64_OP_GROUP_SVELogicalImm, T), OpNum, \ | 2472 | 689 | sizeof(T)); \ | 2473 | 689 | typedef T SignedT; \ | 2474 | 689 | typedef CONCATS(u, T) UnsignedT; \ | 2475 | 689 | \ | 2476 | 689 | uint64_t Val = \ | 2477 | 689 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2478 | 689 | UnsignedT PrintVal = \ | 2479 | 689 | AArch64_AM_decodeLogicalImmediate(Val, 64); \ | 2480 | 689 | \ | 2481 | 689 | if ((int16_t)PrintVal == (SignedT)PrintVal) \ | 2482 | 689 | CONCAT(printImmSVE, T)((T)PrintVal, O); \ | 2483 | 689 | else if ((uint16_t)PrintVal == PrintVal) \ | 2484 | 546 | CONCAT(printImmSVE, T)(PrintVal, O); \ | 2485 | 546 | else { \ | 2486 | 525 | SStream_concat(O, "%s", markup("<imm:")); \ | 2487 | 525 | printUInt64Bang(O, ((uint64_t)PrintVal)); \ | 2488 | 525 | SStream_concat0(O, markup(">")); \ | 2489 | 525 | } \ | 2490 | 689 | } |
|
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.32k | { \ |
2499 | 1.32k | AArch64_add_cs_detail_1( \ |
2500 | 1.32k | MI, CONCAT(AArch64_OP_GROUP_ZPRasFPR, Width), OpNum, \ |
2501 | 1.32k | Width); \ |
2502 | 1.32k | unsigned Base; \ |
2503 | 1.32k | switch (Width) { \ |
2504 | 112 | case 8: \ |
2505 | 112 | Base = AArch64_B0; \ |
2506 | 112 | break; \ |
2507 | 560 | case 16: \ |
2508 | 560 | Base = AArch64_H0; \ |
2509 | 560 | break; \ |
2510 | 193 | case 32: \ |
2511 | 193 | Base = AArch64_S0; \ |
2512 | 193 | break; \ |
2513 | 447 | case 64: \ |
2514 | 447 | Base = AArch64_D0; \ |
2515 | 447 | break; \ |
2516 | 12 | case 128: \ |
2517 | 12 | Base = AArch64_Q0; \ |
2518 | 12 | break; \ |
2519 | 0 | default: \ |
2520 | 0 | CS_ASSERT_RET(0 && "Unsupported width"); \ |
2521 | 1.32k | } \ |
2522 | 1.32k | unsigned Reg = \ |
2523 | 1.32k | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ |
2524 | 1.32k | printRegName(O, Reg - AArch64_Z0 + Base); \ |
2525 | 1.32k | } Line | Count | Source | 2498 | 112 | { \ | 2499 | 112 | AArch64_add_cs_detail_1( \ | 2500 | 112 | MI, CONCAT(AArch64_OP_GROUP_ZPRasFPR, Width), OpNum, \ | 2501 | 112 | Width); \ | 2502 | 112 | unsigned Base; \ | 2503 | 112 | switch (Width) { \ | 2504 | 112 | case 8: \ | 2505 | 112 | Base = AArch64_B0; \ | 2506 | 112 | 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 | 112 | } \ | 2522 | 112 | unsigned Reg = \ | 2523 | 112 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2524 | 112 | printRegName(O, Reg - AArch64_Z0 + Base); \ | 2525 | 112 | } |
Line | Count | Source | 2498 | 447 | { \ | 2499 | 447 | AArch64_add_cs_detail_1( \ | 2500 | 447 | MI, CONCAT(AArch64_OP_GROUP_ZPRasFPR, Width), OpNum, \ | 2501 | 447 | Width); \ | 2502 | 447 | unsigned Base; \ | 2503 | 447 | 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 | 447 | case 64: \ | 2514 | 447 | Base = AArch64_D0; \ | 2515 | 447 | 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 | 447 | } \ | 2522 | 447 | unsigned Reg = \ | 2523 | 447 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2524 | 447 | printRegName(O, Reg - AArch64_Z0 + Base); \ | 2525 | 447 | } |
Line | Count | Source | 2498 | 560 | { \ | 2499 | 560 | AArch64_add_cs_detail_1( \ | 2500 | 560 | MI, CONCAT(AArch64_OP_GROUP_ZPRasFPR, Width), OpNum, \ | 2501 | 560 | Width); \ | 2502 | 560 | unsigned Base; \ | 2503 | 560 | switch (Width) { \ | 2504 | 0 | case 8: \ | 2505 | 0 | Base = AArch64_B0; \ | 2506 | 0 | break; \ | 2507 | 560 | case 16: \ | 2508 | 560 | Base = AArch64_H0; \ | 2509 | 560 | 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 | 560 | } \ | 2522 | 560 | unsigned Reg = \ | 2523 | 560 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2524 | 560 | printRegName(O, Reg - AArch64_Z0 + Base); \ | 2525 | 560 | } |
Line | Count | Source | 2498 | 193 | { \ | 2499 | 193 | AArch64_add_cs_detail_1( \ | 2500 | 193 | MI, CONCAT(AArch64_OP_GROUP_ZPRasFPR, Width), OpNum, \ | 2501 | 193 | Width); \ | 2502 | 193 | unsigned Base; \ | 2503 | 193 | 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 | 193 | case 32: \ | 2511 | 193 | Base = AArch64_S0; \ | 2512 | 193 | 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 | 193 | } \ | 2522 | 193 | unsigned Reg = \ | 2523 | 193 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2524 | 193 | printRegName(O, Reg - AArch64_Z0 + Base); \ | 2525 | 193 | } |
Line | Count | Source | 2498 | 12 | { \ | 2499 | 12 | AArch64_add_cs_detail_1( \ | 2500 | 12 | MI, CONCAT(AArch64_OP_GROUP_ZPRasFPR, Width), OpNum, \ | 2501 | 12 | Width); \ | 2502 | 12 | unsigned Base; \ | 2503 | 12 | 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 | 12 | case 128: \ | 2517 | 12 | Base = AArch64_Q0; \ | 2518 | 12 | break; \ | 2519 | 0 | default: \ | 2520 | 0 | CS_ASSERT_RET(0 && "Unsupported width"); \ | 2521 | 12 | } \ | 2522 | 12 | unsigned Reg = \ | 2523 | 12 | MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); \ | 2524 | 12 | printRegName(O, Reg - AArch64_Z0 + Base); \ | 2525 | 12 | } |
|
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 | 1.70k | { \ |
2536 | 1.70k | AArch64_add_cs_detail_2( \ |
2537 | 1.70k | MI, \ |
2538 | 1.70k | CONCAT(CONCAT(AArch64_OP_GROUP_ExactFPImm, ImmIs0), \ |
2539 | 1.70k | ImmIs1), \ |
2540 | 1.70k | OpNum, ImmIs0, ImmIs1); \ |
2541 | 1.70k | const AArch64ExactFPImm_ExactFPImm *Imm0Desc = \ |
2542 | 1.70k | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs0); \ |
2543 | 1.70k | const AArch64ExactFPImm_ExactFPImm *Imm1Desc = \ |
2544 | 1.70k | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs1); \ |
2545 | 1.70k | unsigned Val = \ |
2546 | 1.70k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ |
2547 | 1.70k | SStream_concat(O, "%s%s%s", markup("<imm:"), "#", \ |
2548 | 1.70k | (Val ? Imm1Desc->Repr : Imm0Desc->Repr)); \ |
2549 | 1.70k | SStream_concat0(O, markup(">")); \ |
2550 | 1.70k | } printExactFPImm_AArch64ExactFPImm_half_AArch64ExactFPImm_one Line | Count | Source | 2535 | 117 | { \ | 2536 | 117 | AArch64_add_cs_detail_2( \ | 2537 | 117 | MI, \ | 2538 | 117 | CONCAT(CONCAT(AArch64_OP_GROUP_ExactFPImm, ImmIs0), \ | 2539 | 117 | ImmIs1), \ | 2540 | 117 | OpNum, ImmIs0, ImmIs1); \ | 2541 | 117 | const AArch64ExactFPImm_ExactFPImm *Imm0Desc = \ | 2542 | 117 | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs0); \ | 2543 | 117 | const AArch64ExactFPImm_ExactFPImm *Imm1Desc = \ | 2544 | 117 | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs1); \ | 2545 | 117 | unsigned Val = \ | 2546 | 117 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2547 | 117 | SStream_concat(O, "%s%s%s", markup("<imm:"), "#", \ | 2548 | 117 | (Val ? Imm1Desc->Repr : Imm0Desc->Repr)); \ | 2549 | 117 | SStream_concat0(O, markup(">")); \ | 2550 | 117 | } |
printExactFPImm_AArch64ExactFPImm_zero_AArch64ExactFPImm_one Line | Count | Source | 2535 | 1.15k | { \ | 2536 | 1.15k | AArch64_add_cs_detail_2( \ | 2537 | 1.15k | MI, \ | 2538 | 1.15k | CONCAT(CONCAT(AArch64_OP_GROUP_ExactFPImm, ImmIs0), \ | 2539 | 1.15k | ImmIs1), \ | 2540 | 1.15k | OpNum, ImmIs0, ImmIs1); \ | 2541 | 1.15k | const AArch64ExactFPImm_ExactFPImm *Imm0Desc = \ | 2542 | 1.15k | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs0); \ | 2543 | 1.15k | const AArch64ExactFPImm_ExactFPImm *Imm1Desc = \ | 2544 | 1.15k | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs1); \ | 2545 | 1.15k | unsigned Val = \ | 2546 | 1.15k | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2547 | 1.15k | SStream_concat(O, "%s%s%s", markup("<imm:"), "#", \ | 2548 | 1.15k | (Val ? Imm1Desc->Repr : Imm0Desc->Repr)); \ | 2549 | 1.15k | SStream_concat0(O, markup(">")); \ | 2550 | 1.15k | } |
printExactFPImm_AArch64ExactFPImm_half_AArch64ExactFPImm_two Line | Count | Source | 2535 | 436 | { \ | 2536 | 436 | AArch64_add_cs_detail_2( \ | 2537 | 436 | MI, \ | 2538 | 436 | CONCAT(CONCAT(AArch64_OP_GROUP_ExactFPImm, ImmIs0), \ | 2539 | 436 | ImmIs1), \ | 2540 | 436 | OpNum, ImmIs0, ImmIs1); \ | 2541 | 436 | const AArch64ExactFPImm_ExactFPImm *Imm0Desc = \ | 2542 | 436 | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs0); \ | 2543 | 436 | const AArch64ExactFPImm_ExactFPImm *Imm1Desc = \ | 2544 | 436 | AArch64ExactFPImm_lookupExactFPImmByEnum(ImmIs1); \ | 2545 | 436 | unsigned Val = \ | 2546 | 436 | MCOperand_getImm(MCInst_getOperand(MI, (OpNum))); \ | 2547 | 436 | SStream_concat(O, "%s%s%s", markup("<imm:"), "#", \ | 2548 | 436 | (Val ? Imm1Desc->Repr : Imm0Desc->Repr)); \ | 2549 | 436 | SStream_concat0(O, markup(">")); \ | 2550 | 436 | } |
|
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 | 6.47k | { |
2557 | 6.47k | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_GPR64as32, OpNum); |
2558 | 6.47k | unsigned Reg = MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); |
2559 | 6.47k | printRegName(O, getWRegFromXReg(Reg)); |
2560 | 6.47k | } |
2561 | | |
2562 | | void printGPR64x8(MCInst *MI, unsigned OpNum, SStream *O) |
2563 | 88 | { |
2564 | 88 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_GPR64x8, OpNum); |
2565 | 88 | unsigned Reg = MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); |
2566 | 88 | printRegName(O, |
2567 | 88 | MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_x8sub_0)); |
2568 | 88 | } |
2569 | | |
2570 | | void printSyspXzrPair(MCInst *MI, unsigned OpNum, SStream *O) |
2571 | 244 | { |
2572 | 244 | AArch64_add_cs_detail_0(MI, AArch64_OP_GROUP_SyspXzrPair, OpNum); |
2573 | 244 | unsigned Reg = MCOperand_getReg(MCInst_getOperand(MI, (OpNum))); |
2574 | | |
2575 | 244 | SStream_concat(O, "%s%s", getRegisterName(Reg, AArch64_NoRegAltName), |
2576 | 244 | ", "); |
2577 | 244 | SStream_concat0(O, getRegisterName(Reg, AArch64_NoRegAltName)); |
2578 | 244 | } |
2579 | | |
2580 | | const char *AArch64_LLVM_getRegisterName(unsigned RegNo, unsigned AltIdx) |
2581 | 158k | { |
2582 | 158k | return getRegisterName(RegNo, AltIdx); |
2583 | 158k | } |
2584 | | |
2585 | | void AArch64_LLVM_printInstruction(MCInst *MI, SStream *O, |
2586 | | void * /* MCRegisterInfo* */ info) |
2587 | 275k | { |
2588 | 275k | printInst(MI, MI->address, "", O); |
2589 | 275k | } |