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