/src/capstonenext/arch/AArch64/AArch64InstPrinter.c
| Line | Count | Source (jump to first uncovered line) | 
| 1 |  | //==-- AArch64InstPrinter.cpp - Convert AArch64 MCInst to assembly syntax --==// | 
| 2 |  | // | 
| 3 |  | //                     The LLVM Compiler Infrastructure | 
| 4 |  | // | 
| 5 |  | // This file is distributed under the University of Illinois Open Source | 
| 6 |  | // License. See LICENSE.TXT for details. | 
| 7 |  | // | 
| 8 |  | //===----------------------------------------------------------------------===// | 
| 9 |  | // | 
| 10 |  | // This class prints an AArch64 MCInst to a .s file. | 
| 11 |  | // | 
| 12 |  | //===----------------------------------------------------------------------===// | 
| 13 |  |  | 
| 14 |  | /* Capstone Disassembly Engine */ | 
| 15 |  | /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2016 */ | 
| 16 |  |  | 
| 17 |  | #ifdef CAPSTONE_HAS_ARM64 | 
| 18 |  |  | 
| 19 |  | #include <capstone/platform.h> | 
| 20 |  | #include <stdio.h> | 
| 21 |  | #include <stdlib.h> | 
| 22 |  |  | 
| 23 |  | #include "AArch64InstPrinter.h" | 
| 24 |  | #include "AArch64Disassembler.h" | 
| 25 |  | #include "AArch64BaseInfo.h" | 
| 26 |  | #include "../../utils.h" | 
| 27 |  | #include "../../MCInst.h" | 
| 28 |  | #include "../../SStream.h" | 
| 29 |  | #include "../../MCRegisterInfo.h" | 
| 30 |  | #include "../../MathExtras.h" | 
| 31 |  |  | 
| 32 |  | #include "AArch64Mapping.h" | 
| 33 |  | #include "AArch64AddressingModes.h" | 
| 34 |  |  | 
| 35 |  | #define GET_REGINFO_ENUM | 
| 36 |  | #include "AArch64GenRegisterInfo.inc" | 
| 37 |  |  | 
| 38 |  | #define GET_INSTRINFO_ENUM | 
| 39 |  | #include "AArch64GenInstrInfo.inc" | 
| 40 |  |  | 
| 41 |  | #include "AArch64GenSubtargetInfo.inc" | 
| 42 |  |  | 
| 43 |  |  | 
| 44 |  | static const char *getRegisterName(unsigned RegNo, unsigned AltIdx); | 
| 45 |  | static void printOperand(MCInst *MI, unsigned OpNum, SStream *O); | 
| 46 |  | static bool printSysAlias(MCInst *MI, SStream *O); | 
| 47 |  | static char *printAliasInstr(MCInst *MI, SStream *OS, MCRegisterInfo *MRI); | 
| 48 |  | static void printInstruction(MCInst *MI, SStream *O); | 
| 49 |  | static void printShifter(MCInst *MI, unsigned OpNum, SStream *O); | 
| 50 |  | static void printCustomAliasOperand(MCInst *MI, uint64_t Address, unsigned OpIdx, | 
| 51 |  |     unsigned PrintMethodIdx, SStream *OS); | 
| 52 |  |  | 
| 53 |  |  | 
| 54 |  | static cs_ac_type get_op_access(cs_struct *h, unsigned int id, unsigned int index) | 
| 55 | 1.00M | { | 
| 56 | 1.00M | #ifndef CAPSTONE_DIET | 
| 57 | 1.00M |   const uint8_t *arr = AArch64_get_op_access(h, id); | 
| 58 |  |  | 
| 59 | 1.00M |   if (arr[index] == CS_AC_IGNORE) | 
| 60 | 0 |     return 0; | 
| 61 |  |  | 
| 62 | 1.00M |   return arr[index]; | 
| 63 |  | #else | 
| 64 |  |   return 0; | 
| 65 |  | #endif | 
| 66 | 1.00M | } | 
| 67 |  |  | 
| 68 |  | static void op_addImm(MCInst *MI, int v) | 
| 69 | 2.58k | { | 
| 70 | 2.58k |   if (MI->csh->detail_opt) { | 
| 71 | 2.58k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 72 | 2.58k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = v; | 
| 73 | 2.58k |     MI->flat_insn->detail->arm64.op_count++; | 
| 74 | 2.58k |   } | 
| 75 | 2.58k | } | 
| 76 |  |  | 
| 77 |  | static void set_sme_index(MCInst *MI, bool status) | 
| 78 | 9.71k | { | 
| 79 |  |   // Doing SME Index operand | 
| 80 | 9.71k |   MI->csh->doing_SME_Index = status; | 
| 81 |  |  | 
| 82 | 9.71k |   if (MI->csh->detail_opt != CS_OPT_ON) | 
| 83 | 0 |     return; | 
| 84 |  |  | 
| 85 | 9.71k |   if (status) { | 
| 86 | 7.44k |     unsigned prevOpNum = MI->flat_insn->detail->arm64.op_count - 1;  | 
| 87 | 7.44k |     unsigned Reg = MCOperand_getReg(MCInst_getOperand(MI, prevOpNum)); | 
| 88 |  |     // Replace previous SME register operand with an OP_SME_INDEX operand | 
| 89 | 7.44k |     MI->flat_insn->detail->arm64.operands[prevOpNum].type = ARM64_OP_SME_INDEX; | 
| 90 | 7.44k |     MI->flat_insn->detail->arm64.operands[prevOpNum].sme_index.reg = Reg; | 
| 91 | 7.44k |     MI->flat_insn->detail->arm64.operands[prevOpNum].sme_index.base = ARM64_REG_INVALID; | 
| 92 | 7.44k |     MI->flat_insn->detail->arm64.operands[prevOpNum].sme_index.disp = 0; | 
| 93 | 7.44k |   } | 
| 94 | 9.71k | } | 
| 95 |  |  | 
| 96 |  | static void set_mem_access(MCInst *MI, bool status) | 
| 97 | 342k | { | 
| 98 |  |   // If status == false, check if this is meant for SME_index | 
| 99 | 342k |   if(!status && MI->csh->doing_SME_Index) { | 
| 100 | 5.16k |     MI->csh->doing_SME_Index = status; | 
| 101 | 5.16k |     return; | 
| 102 | 5.16k |   } | 
| 103 |  |  | 
| 104 |  |   // Doing Memory Operation | 
| 105 | 337k |   MI->csh->doing_mem = status; | 
| 106 |  |  | 
| 107 |  |  | 
| 108 | 337k |   if (MI->csh->detail_opt != CS_OPT_ON) | 
| 109 | 0 |     return; | 
| 110 |  |  | 
| 111 | 337k |   if (status) { | 
| 112 | 168k | #ifndef CAPSTONE_DIET | 
| 113 | 168k |     uint8_t access; | 
| 114 | 168k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 115 | 168k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 116 | 168k |     MI->ac_idx++; | 
| 117 | 168k | #endif | 
| 118 | 168k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_MEM; | 
| 119 | 168k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].mem.base = ARM64_REG_INVALID; | 
| 120 | 168k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].mem.index = ARM64_REG_INVALID; | 
| 121 | 168k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].mem.disp = 0; | 
| 122 | 168k |   } else { | 
| 123 |  |     // done, create the next operand slot | 
| 124 | 168k |     MI->flat_insn->detail->arm64.op_count++; | 
| 125 | 168k |   } | 
| 126 | 337k | } | 
| 127 |  |  | 
| 128 |  | void AArch64_printInst(MCInst *MI, SStream *O, void *Info) | 
| 129 | 353k | { | 
| 130 |  |   // Check for special encodings and print the canonical alias instead. | 
| 131 | 353k |   unsigned Opcode = MCInst_getOpcode(MI); | 
| 132 | 353k |   int LSB, Width; | 
| 133 | 353k |   char *mnem; | 
| 134 |  |  | 
| 135 |  |   // printf(">>> opcode = %u\n", MCInst_getOpcode(MI)); | 
| 136 |  |  | 
| 137 | 353k |   if (Opcode == AArch64_SYSxt && printSysAlias(MI, O)) | 
| 138 | 1.00k |     return; | 
| 139 |  |  | 
| 140 |  |   // SBFM/UBFM should print to a nicer aliased form if possible. | 
| 141 | 352k |   if (Opcode == AArch64_SBFMXri || Opcode == AArch64_SBFMWri || | 
| 142 | 352k |       Opcode == AArch64_UBFMXri || Opcode == AArch64_UBFMWri) { | 
| 143 | 7.15k |     bool IsSigned = (Opcode == AArch64_SBFMXri || Opcode == AArch64_SBFMWri); | 
| 144 | 7.15k |     bool Is64Bit = (Opcode == AArch64_SBFMXri || Opcode == AArch64_UBFMXri); | 
| 145 |  |  | 
| 146 | 7.15k |     MCOperand *Op0 = MCInst_getOperand(MI, 0); | 
| 147 | 7.15k |     MCOperand *Op1 = MCInst_getOperand(MI, 1); | 
| 148 | 7.15k |     MCOperand *Op2 = MCInst_getOperand(MI, 2); | 
| 149 | 7.15k |     MCOperand *Op3 = MCInst_getOperand(MI, 3); | 
| 150 |  |  | 
| 151 | 7.15k |     if (MCOperand_isImm(Op2) && MCOperand_getImm(Op2) == 0 && MCOperand_isImm(Op3)) { | 
| 152 | 6.38k |       const char *AsmMnemonic = NULL; | 
| 153 |  |  | 
| 154 | 6.38k |       switch (MCOperand_getImm(Op3)) { | 
| 155 | 1.86k |         default: | 
| 156 | 1.86k |           break; | 
| 157 |  |  | 
| 158 | 1.86k |         case 7: | 
| 159 | 597 |           if (IsSigned) | 
| 160 | 521 |             AsmMnemonic = "sxtb"; | 
| 161 | 76 |           else if (!Is64Bit) | 
| 162 | 66 |             AsmMnemonic = "uxtb"; | 
| 163 | 597 |           break; | 
| 164 |  |  | 
| 165 | 3.60k |         case 15: | 
| 166 | 3.60k |           if (IsSigned) | 
| 167 | 2.83k |             AsmMnemonic = "sxth"; | 
| 168 | 773 |           else if (!Is64Bit) | 
| 169 | 479 |             AsmMnemonic = "uxth"; | 
| 170 | 3.60k |           break; | 
| 171 |  |  | 
| 172 | 310 |         case 31: | 
| 173 |  |           // *xtw is only valid for signed 64-bit operations. | 
| 174 | 310 |           if (Is64Bit && IsSigned) | 
| 175 | 162 |             AsmMnemonic = "sxtw"; | 
| 176 | 310 |           break; | 
| 177 | 6.38k |       } | 
| 178 |  |  | 
| 179 | 6.38k |       if (AsmMnemonic) { | 
| 180 | 4.06k |         SStream_concat(O, "%s\t%s, %s", AsmMnemonic, | 
| 181 | 4.06k |             getRegisterName(MCOperand_getReg(Op0), AArch64_NoRegAltName), | 
| 182 | 4.06k |             getRegisterName(getWRegFromXReg(MCOperand_getReg(Op1)), AArch64_NoRegAltName)); | 
| 183 |  |  | 
| 184 | 4.06k |         if (MI->csh->detail_opt) { | 
| 185 | 4.06k | #ifndef CAPSTONE_DIET | 
| 186 | 4.06k |           uint8_t access; | 
| 187 | 4.06k |           access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 188 | 4.06k |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 189 | 4.06k |           MI->ac_idx++; | 
| 190 | 4.06k | #endif | 
| 191 | 4.06k |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 192 | 4.06k |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(Op0); | 
| 193 | 4.06k |           MI->flat_insn->detail->arm64.op_count++; | 
| 194 | 4.06k | #ifndef CAPSTONE_DIET | 
| 195 | 4.06k |           access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 196 | 4.06k |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 197 | 4.06k |           MI->ac_idx++; | 
| 198 | 4.06k | #endif | 
| 199 | 4.06k |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 200 | 4.06k |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = getWRegFromXReg(MCOperand_getReg(Op1)); | 
| 201 | 4.06k |           MI->flat_insn->detail->arm64.op_count++; | 
| 202 | 4.06k |         } | 
| 203 |  |  | 
| 204 | 4.06k |         MCInst_setOpcodePub(MI, AArch64_map_insn(AsmMnemonic)); | 
| 205 |  |  | 
| 206 | 4.06k |         return; | 
| 207 | 4.06k |       } | 
| 208 | 6.38k |     } | 
| 209 |  |  | 
| 210 |  |     // All immediate shifts are aliases, implemented using the Bitfield | 
| 211 |  |     // instruction. In all cases the immediate shift amount shift must be in | 
| 212 |  |     // the range 0 to (reg.size -1). | 
| 213 | 3.09k |     if (MCOperand_isImm(Op2) && MCOperand_isImm(Op3)) { | 
| 214 | 3.09k |       const char *AsmMnemonic = NULL; | 
| 215 | 3.09k |       int shift = 0; | 
| 216 | 3.09k |       int immr = (int)MCOperand_getImm(Op2); | 
| 217 | 3.09k |       int imms = (int)MCOperand_getImm(Op3); | 
| 218 |  |  | 
| 219 | 3.09k |       if (Opcode == AArch64_UBFMWri && imms != 0x1F && ((imms + 1) == immr)) { | 
| 220 | 21 |         AsmMnemonic = "lsl"; | 
| 221 | 21 |         shift = 31 - imms; | 
| 222 | 3.07k |       } else if (Opcode == AArch64_UBFMXri && imms != 0x3f && | 
| 223 | 3.07k |           ((imms + 1 == immr))) { | 
| 224 | 14 |         AsmMnemonic = "lsl"; | 
| 225 | 14 |         shift = 63 - imms; | 
| 226 | 3.05k |       } else if (Opcode == AArch64_UBFMWri && imms == 0x1f) { | 
| 227 | 36 |         AsmMnemonic = "lsr"; | 
| 228 | 36 |         shift = immr; | 
| 229 | 3.02k |       } else if (Opcode == AArch64_UBFMXri && imms == 0x3f) { | 
| 230 | 18 |         AsmMnemonic = "lsr"; | 
| 231 | 18 |         shift = immr; | 
| 232 | 3.00k |       } else if (Opcode == AArch64_SBFMWri && imms == 0x1f) { | 
| 233 | 104 |         AsmMnemonic = "asr"; | 
| 234 | 104 |         shift = immr; | 
| 235 | 2.89k |       } else if (Opcode == AArch64_SBFMXri && imms == 0x3f) { | 
| 236 | 557 |         AsmMnemonic = "asr"; | 
| 237 | 557 |         shift = immr; | 
| 238 | 557 |       } | 
| 239 |  |  | 
| 240 | 3.09k |       if (AsmMnemonic) { | 
| 241 | 750 |         SStream_concat(O, "%s\t%s, %s, ", AsmMnemonic, | 
| 242 | 750 |             getRegisterName(MCOperand_getReg(Op0), AArch64_NoRegAltName), | 
| 243 | 750 |             getRegisterName(MCOperand_getReg(Op1), AArch64_NoRegAltName)); | 
| 244 |  |  | 
| 245 | 750 |         printInt32Bang(O, shift); | 
| 246 |  |  | 
| 247 | 750 |         MCInst_setOpcodePub(MI, AArch64_map_insn(AsmMnemonic)); | 
| 248 |  |  | 
| 249 | 750 |         if (MI->csh->detail_opt) { | 
| 250 | 750 | #ifndef CAPSTONE_DIET | 
| 251 | 750 |           uint8_t access; | 
| 252 | 750 |           access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 253 | 750 |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 254 | 750 |           MI->ac_idx++; | 
| 255 | 750 | #endif | 
| 256 | 750 |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 257 | 750 |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(Op0); | 
| 258 | 750 |           MI->flat_insn->detail->arm64.op_count++; | 
| 259 | 750 | #ifndef CAPSTONE_DIET | 
| 260 | 750 |           access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 261 | 750 |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 262 | 750 |           MI->ac_idx++; | 
| 263 | 750 | #endif | 
| 264 | 750 |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 265 | 750 |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(Op1); | 
| 266 | 750 |           MI->flat_insn->detail->arm64.op_count++; | 
| 267 | 750 | #ifndef CAPSTONE_DIET | 
| 268 | 750 |           access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 269 | 750 |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 270 | 750 |           MI->ac_idx++; | 
| 271 | 750 | #endif | 
| 272 | 750 |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 273 | 750 |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = shift; | 
| 274 | 750 |           MI->flat_insn->detail->arm64.op_count++; | 
| 275 | 750 |         } | 
| 276 |  |  | 
| 277 | 750 |         return; | 
| 278 | 750 |       } | 
| 279 | 3.09k |     } | 
| 280 |  |  | 
| 281 |  |     // SBFIZ/UBFIZ aliases | 
| 282 | 2.34k |     if (MCOperand_getImm(Op2) > MCOperand_getImm(Op3)) { | 
| 283 | 457 |       SStream_concat(O, "%s\t%s, %s, ", (IsSigned ? "sbfiz" : "ubfiz"), | 
| 284 | 457 |           getRegisterName(MCOperand_getReg(Op0), AArch64_NoRegAltName), | 
| 285 | 457 |           getRegisterName(MCOperand_getReg(Op1), AArch64_NoRegAltName)); | 
| 286 |  |  | 
| 287 | 457 |       printInt32Bang(O, (int)((Is64Bit ? 64 : 32) - MCOperand_getImm(Op2))); | 
| 288 |  |  | 
| 289 | 457 |       SStream_concat0(O, ", "); | 
| 290 |  |  | 
| 291 | 457 |       printInt32Bang(O, (int)MCOperand_getImm(Op3) + 1); | 
| 292 |  |  | 
| 293 | 457 |       MCInst_setOpcodePub(MI, AArch64_map_insn(IsSigned ? "sbfiz" : "ubfiz")); | 
| 294 |  |  | 
| 295 | 457 |       if (MI->csh->detail_opt) { | 
| 296 | 457 | #ifndef CAPSTONE_DIET | 
| 297 | 457 |         uint8_t access; | 
| 298 | 457 |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 299 | 457 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 300 | 457 |         MI->ac_idx++; | 
| 301 | 457 | #endif | 
| 302 | 457 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 303 | 457 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(Op0); | 
| 304 | 457 |         MI->flat_insn->detail->arm64.op_count++; | 
| 305 | 457 | #ifndef CAPSTONE_DIET | 
| 306 | 457 |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 307 | 457 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 308 | 457 |         MI->ac_idx++; | 
| 309 | 457 | #endif | 
| 310 | 457 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 311 | 457 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(Op1); | 
| 312 | 457 |         MI->flat_insn->detail->arm64.op_count++; | 
| 313 | 457 | #ifndef CAPSTONE_DIET | 
| 314 | 457 |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 315 | 457 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 316 | 457 |         MI->ac_idx++; | 
| 317 | 457 | #endif | 
| 318 | 457 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 319 | 457 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = (Is64Bit ? 64 : 32) - (int)MCOperand_getImm(Op2); | 
| 320 | 457 |         MI->flat_insn->detail->arm64.op_count++; | 
| 321 | 457 | #ifndef CAPSTONE_DIET | 
| 322 | 457 |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 323 | 457 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 324 | 457 |         MI->ac_idx++; | 
| 325 | 457 | #endif | 
| 326 | 457 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 327 | 457 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = MCOperand_getImm(Op3) + 1; | 
| 328 | 457 |         MI->flat_insn->detail->arm64.op_count++; | 
| 329 | 457 |       } | 
| 330 |  |  | 
| 331 | 457 |       return; | 
| 332 | 457 |     } | 
| 333 |  |  | 
| 334 |  |     // Otherwise SBFX/UBFX is the preferred form | 
| 335 | 1.88k |     SStream_concat(O, "%s\t%s, %s, ", (IsSigned ? "sbfx" : "ubfx"), | 
| 336 | 1.88k |         getRegisterName(MCOperand_getReg(Op0), AArch64_NoRegAltName), | 
| 337 | 1.88k |         getRegisterName(MCOperand_getReg(Op1), AArch64_NoRegAltName)); | 
| 338 |  |  | 
| 339 | 1.88k |     printInt32Bang(O, (int)MCOperand_getImm(Op2)); | 
| 340 | 1.88k |     SStream_concat0(O, ", "); | 
| 341 | 1.88k |     printInt32Bang(O, (int)MCOperand_getImm(Op3) - (int)MCOperand_getImm(Op2) + 1); | 
| 342 |  |  | 
| 343 | 1.88k |     MCInst_setOpcodePub(MI, AArch64_map_insn(IsSigned ? "sbfx" : "ubfx")); | 
| 344 |  |  | 
| 345 | 1.88k |     if (MI->csh->detail_opt) { | 
| 346 | 1.88k | #ifndef CAPSTONE_DIET | 
| 347 | 1.88k |       uint8_t access; | 
| 348 | 1.88k |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 349 | 1.88k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 350 | 1.88k |       MI->ac_idx++; | 
| 351 | 1.88k | #endif | 
| 352 | 1.88k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 353 | 1.88k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(Op0); | 
| 354 | 1.88k |       MI->flat_insn->detail->arm64.op_count++; | 
| 355 | 1.88k | #ifndef CAPSTONE_DIET | 
| 356 | 1.88k |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 357 | 1.88k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 358 | 1.88k |       MI->ac_idx++; | 
| 359 | 1.88k | #endif | 
| 360 | 1.88k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 361 | 1.88k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(Op1); | 
| 362 | 1.88k |       MI->flat_insn->detail->arm64.op_count++; | 
| 363 | 1.88k | #ifndef CAPSTONE_DIET | 
| 364 | 1.88k |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 365 | 1.88k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 366 | 1.88k |       MI->ac_idx++; | 
| 367 | 1.88k | #endif | 
| 368 | 1.88k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 369 | 1.88k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = MCOperand_getImm(Op2); | 
| 370 | 1.88k |       MI->flat_insn->detail->arm64.op_count++; | 
| 371 | 1.88k | #ifndef CAPSTONE_DIET | 
| 372 | 1.88k |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 373 | 1.88k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 374 | 1.88k |       MI->ac_idx++; | 
| 375 | 1.88k | #endif | 
| 376 | 1.88k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 377 | 1.88k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = MCOperand_getImm(Op3) - MCOperand_getImm(Op2) + 1; | 
| 378 | 1.88k |       MI->flat_insn->detail->arm64.op_count++; | 
| 379 | 1.88k |     } | 
| 380 |  |  | 
| 381 | 1.88k |     return; | 
| 382 | 2.34k |   } | 
| 383 |  |  | 
| 384 | 345k |   if (Opcode == AArch64_BFMXri || Opcode == AArch64_BFMWri) { | 
| 385 | 2.55k |     MCOperand *Op0 = MCInst_getOperand(MI, 0); // Op1 == Op0 | 
| 386 | 2.55k |     MCOperand *Op2 = MCInst_getOperand(MI, 2); | 
| 387 | 2.55k |     int ImmR = (int)MCOperand_getImm(MCInst_getOperand(MI, 3)); | 
| 388 | 2.55k |     int ImmS = (int)MCOperand_getImm(MCInst_getOperand(MI, 4)); | 
| 389 |  |  | 
| 390 | 2.55k |     if ((MCOperand_getReg(Op2) == AArch64_WZR || MCOperand_getReg(Op2) == AArch64_XZR) && | 
| 391 | 2.55k |         (ImmR == 0 || ImmS < ImmR)) { | 
| 392 |  |       // BFC takes precedence over its entire range, sligtly differently to BFI. | 
| 393 | 1.55k |       int BitWidth = Opcode == AArch64_BFMXri ? 64 : 32; | 
| 394 | 1.55k |       int LSB = (BitWidth - ImmR) % BitWidth; | 
| 395 | 1.55k |       int Width = ImmS + 1; | 
| 396 |  |  | 
| 397 | 1.55k |       SStream_concat(O, "bfc\t%s, ", | 
| 398 | 1.55k |           getRegisterName(MCOperand_getReg(Op0), AArch64_NoRegAltName)); | 
| 399 |  |  | 
| 400 | 1.55k |       printInt32Bang(O, LSB); | 
| 401 | 1.55k |       SStream_concat0(O, ", "); | 
| 402 | 1.55k |       printInt32Bang(O, Width); | 
| 403 | 1.55k |       MCInst_setOpcodePub(MI, AArch64_map_insn("bfc")); | 
| 404 |  |  | 
| 405 | 1.55k |       if (MI->csh->detail_opt) { | 
| 406 | 1.55k | #ifndef CAPSTONE_DIET | 
| 407 | 1.55k |         uint8_t access; | 
| 408 | 1.55k |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 409 | 1.55k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 410 | 1.55k |         MI->ac_idx++; | 
| 411 | 1.55k | #endif | 
| 412 | 1.55k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 413 | 1.55k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(Op0); | 
| 414 | 1.55k |         MI->flat_insn->detail->arm64.op_count++; | 
| 415 |  |  | 
| 416 | 1.55k | #ifndef CAPSTONE_DIET | 
| 417 | 1.55k |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 418 | 1.55k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 419 | 1.55k |         MI->ac_idx++; | 
| 420 | 1.55k | #endif | 
| 421 | 1.55k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 422 | 1.55k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = LSB; | 
| 423 | 1.55k |         MI->flat_insn->detail->arm64.op_count++; | 
| 424 | 1.55k | #ifndef CAPSTONE_DIET | 
| 425 | 1.55k |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 426 | 1.55k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 427 | 1.55k |         MI->ac_idx++; | 
| 428 | 1.55k | #endif | 
| 429 | 1.55k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 430 | 1.55k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = Width; | 
| 431 | 1.55k |         MI->flat_insn->detail->arm64.op_count++; | 
| 432 | 1.55k |       } | 
| 433 |  |  | 
| 434 | 1.55k |       return; | 
| 435 | 1.55k |     } else if (ImmS < ImmR) { | 
| 436 |  |       // BFI alias | 
| 437 | 280 |       int BitWidth = Opcode == AArch64_BFMXri ? 64 : 32; | 
| 438 | 280 |       LSB = (BitWidth - ImmR) % BitWidth; | 
| 439 | 280 |       Width = ImmS + 1; | 
| 440 |  |  | 
| 441 | 280 |       SStream_concat(O, "bfi\t%s, %s, ", | 
| 442 | 280 |           getRegisterName(MCOperand_getReg(Op0), AArch64_NoRegAltName), | 
| 443 | 280 |           getRegisterName(MCOperand_getReg(Op2), AArch64_NoRegAltName)); | 
| 444 |  |  | 
| 445 | 280 |       printInt32Bang(O, LSB); | 
| 446 | 280 |       SStream_concat0(O, ", "); | 
| 447 | 280 |       printInt32Bang(O, Width); | 
| 448 |  |  | 
| 449 | 280 |       MCInst_setOpcodePub(MI, AArch64_map_insn("bfi")); | 
| 450 |  |  | 
| 451 | 280 |       if (MI->csh->detail_opt) { | 
| 452 | 280 | #ifndef CAPSTONE_DIET | 
| 453 | 280 |         uint8_t access; | 
| 454 | 280 |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 455 | 280 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 456 | 280 |         MI->ac_idx++; | 
| 457 | 280 | #endif | 
| 458 | 280 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 459 | 280 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(Op0); | 
| 460 | 280 |         MI->flat_insn->detail->arm64.op_count++; | 
| 461 | 280 | #ifndef CAPSTONE_DIET | 
| 462 | 280 |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 463 | 280 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 464 | 280 |         MI->ac_idx++; | 
| 465 | 280 | #endif | 
| 466 | 280 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 467 | 280 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(Op2); | 
| 468 | 280 |         MI->flat_insn->detail->arm64.op_count++; | 
| 469 | 280 | #ifndef CAPSTONE_DIET | 
| 470 | 280 |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 471 | 280 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 472 | 280 |         MI->ac_idx++; | 
| 473 | 280 | #endif | 
| 474 | 280 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 475 | 280 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = LSB; | 
| 476 | 280 |         MI->flat_insn->detail->arm64.op_count++; | 
| 477 | 280 | #ifndef CAPSTONE_DIET | 
| 478 | 280 |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 479 | 280 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 480 | 280 |         MI->ac_idx++; | 
| 481 | 280 | #endif | 
| 482 | 280 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 483 | 280 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = Width; | 
| 484 | 280 |         MI->flat_insn->detail->arm64.op_count++; | 
| 485 | 280 |       } | 
| 486 |  |  | 
| 487 | 280 |       return; | 
| 488 | 280 |     } | 
| 489 |  |  | 
| 490 | 721 |     LSB = ImmR; | 
| 491 | 721 |     Width = ImmS - ImmR + 1; | 
| 492 |  |     // Otherwise BFXIL the preferred form | 
| 493 | 721 |     SStream_concat(O, "bfxil\t%s, %s, ", | 
| 494 | 721 |         getRegisterName(MCOperand_getReg(Op0), AArch64_NoRegAltName), | 
| 495 | 721 |         getRegisterName(MCOperand_getReg(Op2), AArch64_NoRegAltName)); | 
| 496 |  |  | 
| 497 | 721 |     printInt32Bang(O, LSB); | 
| 498 | 721 |     SStream_concat0(O, ", "); | 
| 499 | 721 |     printInt32Bang(O, Width); | 
| 500 |  |  | 
| 501 | 721 |     MCInst_setOpcodePub(MI, AArch64_map_insn("bfxil")); | 
| 502 |  |  | 
| 503 | 721 |     if (MI->csh->detail_opt) { | 
| 504 | 721 | #ifndef CAPSTONE_DIET | 
| 505 | 721 |       uint8_t access; | 
| 506 | 721 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 507 | 721 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 508 | 721 |       MI->ac_idx++; | 
| 509 | 721 | #endif | 
| 510 | 721 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 511 | 721 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(Op0); | 
| 512 | 721 |       MI->flat_insn->detail->arm64.op_count++; | 
| 513 | 721 | #ifndef CAPSTONE_DIET | 
| 514 | 721 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 515 | 721 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 516 | 721 |       MI->ac_idx++; | 
| 517 | 721 | #endif | 
| 518 | 721 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 519 | 721 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(Op2); | 
| 520 | 721 |       MI->flat_insn->detail->arm64.op_count++; | 
| 521 | 721 | #ifndef CAPSTONE_DIET | 
| 522 | 721 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 523 | 721 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 524 | 721 |       MI->ac_idx++; | 
| 525 | 721 | #endif | 
| 526 | 721 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 527 | 721 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = LSB; | 
| 528 | 721 |       MI->flat_insn->detail->arm64.op_count++; | 
| 529 | 721 | #ifndef CAPSTONE_DIET | 
| 530 | 721 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 531 | 721 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 532 | 721 |       MI->ac_idx++; | 
| 533 | 721 | #endif | 
| 534 | 721 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 535 | 721 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = Width; | 
| 536 | 721 |       MI->flat_insn->detail->arm64.op_count++; | 
| 537 | 721 |     } | 
| 538 |  |  | 
| 539 | 721 |     return; | 
| 540 | 2.55k |   } | 
| 541 |  |  | 
| 542 |  |   // MOVZ, MOVN and "ORR wzr, #imm" instructions are aliases for MOV, but their | 
| 543 |  |   // domains overlap so they need to be prioritized. The chain is "MOVZ lsl #0 > | 
| 544 |  |   // MOVZ lsl #N > MOVN lsl #0 > MOVN lsl #N > ORR". The highest instruction | 
| 545 |  |   // that can represent the move is the MOV alias, and the rest get printed | 
| 546 |  |   // normally. | 
| 547 | 342k |   if ((Opcode == AArch64_MOVZXi || Opcode == AArch64_MOVZWi) && | 
| 548 | 342k |       MCOperand_isImm(MCInst_getOperand(MI, 1)) && MCOperand_isImm(MCInst_getOperand(MI, 2))) { | 
| 549 | 743 |     int RegWidth = Opcode == AArch64_MOVZXi ? 64 : 32; | 
| 550 | 743 |     int Shift = MCOperand_getImm(MCInst_getOperand(MI, 2)); | 
| 551 | 743 |     uint64_t Value = (uint64_t)MCOperand_getImm(MCInst_getOperand(MI, 1)) << Shift; | 
| 552 |  |  | 
| 553 | 743 |     if (isMOVZMovAlias(Value, Shift, | 
| 554 | 743 |           Opcode == AArch64_MOVZXi ? 64 : 32)) { | 
| 555 | 700 |       SStream_concat(O, "mov\t%s, ", getRegisterName(MCOperand_getReg(MCInst_getOperand(MI, 0)), AArch64_NoRegAltName)); | 
| 556 |  |  | 
| 557 | 700 |       printInt64Bang(O, SignExtend64(Value, RegWidth)); | 
| 558 |  |  | 
| 559 | 700 |       if (MI->csh->detail_opt) { | 
| 560 | 700 | #ifndef CAPSTONE_DIET | 
| 561 | 700 |         uint8_t access; | 
| 562 | 700 |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 563 | 700 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 564 | 700 |         MI->ac_idx++; | 
| 565 | 700 | #endif | 
| 566 | 700 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 567 | 700 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(MCInst_getOperand(MI, 0)); | 
| 568 | 700 |         MI->flat_insn->detail->arm64.op_count++; | 
| 569 |  |  | 
| 570 | 700 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 571 | 700 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = SignExtend64(Value, RegWidth); | 
| 572 | 700 |         MI->flat_insn->detail->arm64.op_count++; | 
| 573 | 700 |       } | 
| 574 |  |  | 
| 575 | 700 |       MCInst_setOpcodePub(MI, AArch64_map_insn("mov")); | 
| 576 |  |  | 
| 577 | 700 |       return; | 
| 578 | 700 |     } | 
| 579 | 743 |   } | 
| 580 |  |  | 
| 581 | 342k |   if ((Opcode == AArch64_MOVNXi || Opcode == AArch64_MOVNWi) && | 
| 582 | 342k |       MCOperand_isImm(MCInst_getOperand(MI, 1)) && MCOperand_isImm(MCInst_getOperand(MI, 2))) { | 
| 583 | 2.42k |     int RegWidth = Opcode == AArch64_MOVNXi ? 64 : 32; | 
| 584 | 2.42k |     int Shift = MCOperand_getImm(MCInst_getOperand(MI, 2)); | 
| 585 | 2.42k |     uint64_t Value = ~((uint64_t)MCOperand_getImm(MCInst_getOperand(MI, 1)) << Shift); | 
| 586 |  |  | 
| 587 | 2.42k |     if (RegWidth == 32) | 
| 588 | 2.02k |       Value = Value & 0xffffffff; | 
| 589 |  |  | 
| 590 | 2.42k |     if (AArch64_AM_isMOVNMovAlias(Value, Shift, RegWidth)) { | 
| 591 | 851 |       SStream_concat(O, "mov\t%s, ", getRegisterName(MCOperand_getReg(MCInst_getOperand(MI, 0)), AArch64_NoRegAltName)); | 
| 592 |  |  | 
| 593 | 851 |       printInt64Bang(O, SignExtend64(Value, RegWidth)); | 
| 594 |  |  | 
| 595 | 851 |       if (MI->csh->detail_opt) { | 
| 596 | 851 | #ifndef CAPSTONE_DIET | 
| 597 | 851 |         uint8_t access; | 
| 598 | 851 |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 599 | 851 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 600 | 851 |         MI->ac_idx++; | 
| 601 | 851 | #endif | 
| 602 | 851 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 603 | 851 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(MCInst_getOperand(MI, 0)); | 
| 604 | 851 |         MI->flat_insn->detail->arm64.op_count++; | 
| 605 |  |  | 
| 606 | 851 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 607 | 851 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = SignExtend64(Value, RegWidth); | 
| 608 | 851 |         MI->flat_insn->detail->arm64.op_count++; | 
| 609 | 851 |       } | 
| 610 |  |  | 
| 611 | 851 |       MCInst_setOpcodePub(MI, AArch64_map_insn("mov")); | 
| 612 |  |  | 
| 613 | 851 |       return; | 
| 614 | 851 |     } | 
| 615 | 2.42k |   } | 
| 616 |  |  | 
| 617 | 341k |   if ((Opcode == AArch64_ORRXri || Opcode == AArch64_ORRWri) && | 
| 618 | 341k |       (MCOperand_getReg(MCInst_getOperand(MI, 1)) == AArch64_XZR || | 
| 619 | 3.05k |        MCOperand_getReg(MCInst_getOperand(MI, 1)) == AArch64_WZR) && | 
| 620 | 341k |       MCOperand_isImm(MCInst_getOperand(MI, 2))) { | 
| 621 | 984 |     int RegWidth = Opcode == AArch64_ORRXri ? 64 : 32; | 
| 622 | 984 |     uint64_t Value = AArch64_AM_decodeLogicalImmediate( | 
| 623 | 984 |         MCOperand_getImm(MCInst_getOperand(MI, 2)), RegWidth); | 
| 624 | 984 |     SStream_concat(O, "mov\t%s, ", getRegisterName(MCOperand_getReg(MCInst_getOperand(MI, 0)), AArch64_NoRegAltName)); | 
| 625 |  |  | 
| 626 | 984 |     printInt64Bang(O, SignExtend64(Value, RegWidth)); | 
| 627 |  |  | 
| 628 | 984 |     if (MI->csh->detail_opt) { | 
| 629 | 984 | #ifndef CAPSTONE_DIET | 
| 630 | 984 |       uint8_t access; | 
| 631 | 984 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 632 | 984 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 633 | 984 |       MI->ac_idx++; | 
| 634 | 984 | #endif | 
| 635 | 984 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 636 | 984 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(MCInst_getOperand(MI, 0)); | 
| 637 | 984 |       MI->flat_insn->detail->arm64.op_count++; | 
| 638 |  |  | 
| 639 | 984 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 640 | 984 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = SignExtend64(Value, RegWidth); | 
| 641 | 984 |       MI->flat_insn->detail->arm64.op_count++; | 
| 642 | 984 |     } | 
| 643 |  |  | 
| 644 | 984 |     MCInst_setOpcodePub(MI, AArch64_map_insn("mov")); | 
| 645 |  |  | 
| 646 | 984 |     return; | 
| 647 | 984 |   } | 
| 648 |  |  | 
| 649 |  |   // Instruction TSB is specified as a one operand instruction, but 'csync' is | 
| 650 |  |   // not encoded, so for printing it is treated as a special case here: | 
| 651 | 340k |   if (Opcode == AArch64_TSB) { | 
| 652 | 10 |     SStream_concat0(O, "tsb\tcsync"); | 
| 653 | 10 |     MCInst_setOpcodePub(MI, AArch64_map_insn("tsb")); | 
| 654 | 10 |     return; | 
| 655 | 10 |   } | 
| 656 |  |  | 
| 657 | 340k |   MI->MRI = Info; | 
| 658 |  |  | 
| 659 | 340k |   mnem = printAliasInstr(MI, O, (MCRegisterInfo *)Info); | 
| 660 | 340k |   if (mnem) { | 
| 661 | 51.7k |     MCInst_setOpcodePub(MI, AArch64_map_insn(mnem)); | 
| 662 | 51.7k |     cs_mem_free(mnem); | 
| 663 |  |  | 
| 664 | 51.7k |     switch(MCInst_getOpcode(MI)) { | 
| 665 | 29.5k |       default: break; | 
| 666 | 29.5k |       case AArch64_LD1i8_POST: | 
| 667 | 524 |         arm64_op_addImm(MI, 1); | 
| 668 | 524 |         break; | 
| 669 | 19 |       case AArch64_LD1i16_POST: | 
| 670 | 19 |         arm64_op_addImm(MI, 2); | 
| 671 | 19 |         break; | 
| 672 | 1.17k |       case AArch64_LD1i32_POST: | 
| 673 | 1.17k |         arm64_op_addImm(MI, 4); | 
| 674 | 1.17k |         break; | 
| 675 | 230 |       case AArch64_LD1Onev1d_POST: | 
| 676 | 1.48k |       case AArch64_LD1Onev2s_POST: | 
| 677 | 1.65k |       case AArch64_LD1Onev4h_POST: | 
| 678 | 3.13k |       case AArch64_LD1Onev8b_POST: | 
| 679 | 3.41k |       case AArch64_LD1i64_POST: | 
| 680 | 3.41k |         arm64_op_addImm(MI, 8); | 
| 681 | 3.41k |         break; | 
| 682 | 474 |       case AArch64_LD1Onev16b_POST: | 
| 683 | 654 |       case AArch64_LD1Onev2d_POST: | 
| 684 | 698 |       case AArch64_LD1Onev4s_POST: | 
| 685 | 1.01k |       case AArch64_LD1Onev8h_POST: | 
| 686 | 2.36k |       case AArch64_LD1Twov1d_POST: | 
| 687 | 2.38k |       case AArch64_LD1Twov2s_POST: | 
| 688 | 2.52k |       case AArch64_LD1Twov4h_POST: | 
| 689 | 2.54k |       case AArch64_LD1Twov8b_POST: | 
| 690 | 2.54k |         arm64_op_addImm(MI, 16); | 
| 691 | 2.54k |         break; | 
| 692 | 73 |       case AArch64_LD1Threev1d_POST: | 
| 693 | 83 |       case AArch64_LD1Threev2s_POST: | 
| 694 | 101 |       case AArch64_LD1Threev4h_POST: | 
| 695 | 203 |       case AArch64_LD1Threev8b_POST: | 
| 696 | 203 |         arm64_op_addImm(MI, 24); | 
| 697 | 203 |         break; | 
| 698 | 75 |       case AArch64_LD1Fourv1d_POST: | 
| 699 | 346 |       case AArch64_LD1Fourv2s_POST: | 
| 700 | 388 |       case AArch64_LD1Fourv4h_POST: | 
| 701 | 673 |       case AArch64_LD1Fourv8b_POST: | 
| 702 | 708 |       case AArch64_LD1Twov16b_POST: | 
| 703 | 809 |       case AArch64_LD1Twov2d_POST: | 
| 704 | 909 |       case AArch64_LD1Twov4s_POST: | 
| 705 | 991 |       case AArch64_LD1Twov8h_POST: | 
| 706 | 991 |         arm64_op_addImm(MI, 32); | 
| 707 | 991 |         break; | 
| 708 | 49 |       case AArch64_LD1Threev16b_POST: | 
| 709 | 87 |       case AArch64_LD1Threev2d_POST: | 
| 710 | 112 |       case AArch64_LD1Threev4s_POST: | 
| 711 | 338 |       case AArch64_LD1Threev8h_POST: | 
| 712 | 338 |          arm64_op_addImm(MI, 48); | 
| 713 | 338 |          break; | 
| 714 | 387 |       case AArch64_LD1Fourv16b_POST: | 
| 715 | 514 |       case AArch64_LD1Fourv2d_POST: | 
| 716 | 942 |       case AArch64_LD1Fourv4s_POST: | 
| 717 | 1.43k |       case AArch64_LD1Fourv8h_POST: | 
| 718 | 1.43k |         arm64_op_addImm(MI, 64); | 
| 719 | 1.43k |         break; | 
| 720 | 262 |       case AArch64_UMOVvi64: | 
| 721 | 262 |         arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_1D); | 
| 722 | 262 |         break; | 
| 723 | 272 |       case AArch64_UMOVvi32: | 
| 724 | 272 |         arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_1S); | 
| 725 | 272 |         break; | 
| 726 | 20 |       case AArch64_INSvi8gpr: | 
| 727 | 193 |       case AArch64_DUP_ZI_B: | 
| 728 | 228 |       case AArch64_CPY_ZPmI_B: | 
| 729 | 315 |       case AArch64_CPY_ZPzI_B: | 
| 730 | 333 |       case AArch64_CPY_ZPmV_B: | 
| 731 | 368 |       case AArch64_CPY_ZPmR_B: | 
| 732 | 770 |       case AArch64_DUP_ZR_B: | 
| 733 | 770 |         if (MI->csh->detail_opt) { | 
| 734 | 770 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1B; | 
| 735 | 770 |         } | 
| 736 | 770 |         break; | 
| 737 | 38 |       case AArch64_INSvi16gpr: | 
| 738 | 74 |       case AArch64_DUP_ZI_H: | 
| 739 | 98 |       case AArch64_CPY_ZPmI_H: | 
| 740 | 396 |       case AArch64_CPY_ZPzI_H: | 
| 741 | 430 |       case AArch64_CPY_ZPmV_H: | 
| 742 | 448 |       case AArch64_CPY_ZPmR_H: | 
| 743 | 687 |       case AArch64_DUP_ZR_H: | 
| 744 | 754 |       case AArch64_FCPY_ZPmI_H: | 
| 745 | 791 |       case AArch64_FDUP_ZI_H: | 
| 746 | 791 |         if (MI->csh->detail_opt) { | 
| 747 | 791 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1H; | 
| 748 | 791 |         } | 
| 749 | 791 |         break; | 
| 750 | 107 |       case AArch64_INSvi32gpr: | 
| 751 | 141 |       case AArch64_DUP_ZI_S: | 
| 752 | 319 |       case AArch64_CPY_ZPmI_S: | 
| 753 | 672 |       case AArch64_CPY_ZPzI_S: | 
| 754 | 1.16k |       case AArch64_CPY_ZPmV_S: | 
| 755 | 1.19k |       case AArch64_CPY_ZPmR_S: | 
| 756 | 1.20k |       case AArch64_DUP_ZR_S: | 
| 757 | 1.22k |       case AArch64_FCPY_ZPmI_S: | 
| 758 | 1.26k |       case AArch64_FDUP_ZI_S: | 
| 759 | 1.26k |         if (MI->csh->detail_opt) { | 
| 760 | 1.26k |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1S; | 
| 761 | 1.26k |         } | 
| 762 | 1.26k |         break; | 
| 763 | 21 |       case AArch64_INSvi64gpr: | 
| 764 | 199 |       case AArch64_DUP_ZI_D: | 
| 765 | 956 |       case AArch64_CPY_ZPmI_D: | 
| 766 | 1.88k |       case AArch64_CPY_ZPzI_D: | 
| 767 | 1.92k |       case AArch64_CPY_ZPmV_D: | 
| 768 | 2.00k |       case AArch64_CPY_ZPmR_D: | 
| 769 | 2.11k |       case AArch64_DUP_ZR_D: | 
| 770 | 2.98k |       case AArch64_FCPY_ZPmI_D: | 
| 771 | 3.00k |       case AArch64_FDUP_ZI_D: | 
| 772 | 3.00k |         if (MI->csh->detail_opt) { | 
| 773 | 3.00k |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1D; | 
| 774 | 3.00k |         } | 
| 775 | 3.00k |         break; | 
| 776 | 24 |       case AArch64_INSvi8lane: | 
| 777 | 1.28k |       case AArch64_ORR_PPzPP: | 
| 778 | 1.40k |       case AArch64_ORRS_PPzPP: | 
| 779 | 1.40k |         if (MI->csh->detail_opt) { | 
| 780 | 1.40k |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1B; | 
| 781 | 1.40k |           MI->flat_insn->detail->arm64.operands[1].vas = ARM64_VAS_1B; | 
| 782 | 1.40k |         } | 
| 783 | 1.40k |         break; | 
| 784 | 22 |       case AArch64_INSvi16lane: | 
| 785 | 22 |         if (MI->csh->detail_opt) { | 
| 786 | 22 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1H; | 
| 787 | 22 |           MI->flat_insn->detail->arm64.operands[1].vas = ARM64_VAS_1H; | 
| 788 | 22 |         } | 
| 789 | 22 |          break; | 
| 790 | 19 |       case AArch64_INSvi32lane: | 
| 791 | 19 |         if (MI->csh->detail_opt) { | 
| 792 | 19 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1S; | 
| 793 | 19 |           MI->flat_insn->detail->arm64.operands[1].vas = ARM64_VAS_1S; | 
| 794 | 19 |         } | 
| 795 | 19 |         break; | 
| 796 | 239 |       case AArch64_INSvi64lane: | 
| 797 | 305 |       case AArch64_ORR_ZZZ: | 
| 798 | 305 |         if (MI->csh->detail_opt) { | 
| 799 | 305 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1D; | 
| 800 | 305 |           MI->flat_insn->detail->arm64.operands[1].vas = ARM64_VAS_1D; | 
| 801 | 305 |         } | 
| 802 | 305 |         break; | 
| 803 | 368 |       case AArch64_ORRv16i8: | 
| 804 | 425 |       case AArch64_NOTv16i8: | 
| 805 | 425 |         if (MI->csh->detail_opt) { | 
| 806 | 425 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_16B; | 
| 807 | 425 |           MI->flat_insn->detail->arm64.operands[1].vas = ARM64_VAS_16B; | 
| 808 | 425 |         } | 
| 809 | 425 |         break; | 
| 810 | 922 |       case AArch64_ORRv8i8: | 
| 811 | 940 |       case AArch64_NOTv8i8: | 
| 812 | 940 |         if (MI->csh->detail_opt) { | 
| 813 | 940 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_8B; | 
| 814 | 940 |           MI->flat_insn->detail->arm64.operands[1].vas = ARM64_VAS_8B; | 
| 815 | 940 |         } | 
| 816 | 940 |         break; | 
| 817 | 18 |       case AArch64_AND_PPzPP: | 
| 818 | 28 |       case AArch64_ANDS_PPzPP: | 
| 819 | 38 |       case AArch64_EOR_PPzPP: | 
| 820 | 56 |       case AArch64_EORS_PPzPP: | 
| 821 | 74 |       case AArch64_SEL_PPPP: | 
| 822 | 84 |       case AArch64_SEL_ZPZZ_B: | 
| 823 | 84 |         if (MI->csh->detail_opt) { | 
| 824 | 84 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1B; | 
| 825 | 84 |           MI->flat_insn->detail->arm64.operands[2].vas = ARM64_VAS_1B; | 
| 826 | 84 |         } | 
| 827 | 84 |         break; | 
| 828 | 139 |       case AArch64_SEL_ZPZZ_D: | 
| 829 | 139 |         if (MI->csh->detail_opt) { | 
| 830 | 139 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1D; | 
| 831 | 139 |           MI->flat_insn->detail->arm64.operands[2].vas = ARM64_VAS_1D; | 
| 832 | 139 |         } | 
| 833 | 139 |         break; | 
| 834 | 700 |       case AArch64_SEL_ZPZZ_H: | 
| 835 | 700 |         if (MI->csh->detail_opt) { | 
| 836 | 700 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1H; | 
| 837 | 700 |           MI->flat_insn->detail->arm64.operands[2].vas = ARM64_VAS_1H; | 
| 838 | 700 |         } | 
| 839 | 700 |         break; | 
| 840 | 374 |       case AArch64_SEL_ZPZZ_S: | 
| 841 | 374 |         if (MI->csh->detail_opt) { | 
| 842 | 374 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1S; | 
| 843 | 374 |           MI->flat_insn->detail->arm64.operands[2].vas = ARM64_VAS_1S; | 
| 844 | 374 |         } | 
| 845 | 374 |         break; | 
| 846 | 75 |       case AArch64_DUP_ZZI_B: | 
| 847 | 75 |         if (MI->csh->detail_opt) { | 
| 848 | 75 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1B; | 
| 849 | 75 |           if (MI->flat_insn->detail->arm64.op_count == 1) { | 
| 850 | 0 |             arm64_op_addReg(MI, ARM64_REG_B0 + MCOperand_getReg(MCInst_getOperand(MI, 1)) - ARM64_REG_Z0); | 
| 851 | 75 |           } else { | 
| 852 | 75 |             MI->flat_insn->detail->arm64.operands[1].vas = ARM64_VAS_1B; | 
| 853 | 75 |           } | 
| 854 | 75 |         } | 
| 855 | 75 |         break; | 
| 856 | 35 |       case AArch64_DUP_ZZI_D: | 
| 857 | 35 |         if (MI->csh->detail_opt) { | 
| 858 | 35 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1D; | 
| 859 | 35 |           if (MI->flat_insn->detail->arm64.op_count == 1) { | 
| 860 | 0 |             arm64_op_addReg(MI, ARM64_REG_D0 + MCOperand_getReg(MCInst_getOperand(MI, 1)) - ARM64_REG_Z0); | 
| 861 | 35 |           } else { | 
| 862 | 35 |             MI->flat_insn->detail->arm64.operands[1].vas = ARM64_VAS_1D; | 
| 863 | 35 |           } | 
| 864 | 35 |         } | 
| 865 | 35 |         break; | 
| 866 | 156 |       case AArch64_DUP_ZZI_H: | 
| 867 | 156 |         if (MI->csh->detail_opt) { | 
| 868 | 156 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1H; | 
| 869 | 156 |           if (MI->flat_insn->detail->arm64.op_count == 1) { | 
| 870 | 0 |             arm64_op_addReg(MI, ARM64_REG_H0 + MCOperand_getReg(MCInst_getOperand(MI, 1)) - ARM64_REG_Z0); | 
| 871 | 156 |           } else { | 
| 872 | 156 |             MI->flat_insn->detail->arm64.operands[1].vas = ARM64_VAS_1H; | 
| 873 | 156 |           } | 
| 874 | 156 |         } | 
| 875 | 156 |         break; | 
| 876 | 354 |       case AArch64_DUP_ZZI_Q: | 
| 877 | 354 |         if (MI->csh->detail_opt) { | 
| 878 | 354 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1Q; | 
| 879 | 354 |           if (MI->flat_insn->detail->arm64.op_count == 1) { | 
| 880 | 0 |             arm64_op_addReg(MI, ARM64_REG_Q0 + MCOperand_getReg(MCInst_getOperand(MI, 1)) - ARM64_REG_Z0); | 
| 881 | 354 |           } else { | 
| 882 | 354 |             MI->flat_insn->detail->arm64.operands[1].vas = ARM64_VAS_1Q; | 
| 883 | 354 |           } | 
| 884 | 354 |          } | 
| 885 | 354 |          break; | 
| 886 | 78 |       case AArch64_DUP_ZZI_S: | 
| 887 | 78 |         if (MI->csh->detail_opt) { | 
| 888 | 78 |           MI->flat_insn->detail->arm64.operands[0].vas = ARM64_VAS_1S; | 
| 889 | 78 |           if (MI->flat_insn->detail->arm64.op_count == 1) { | 
| 890 | 0 |             arm64_op_addReg(MI, ARM64_REG_S0 + MCOperand_getReg(MCInst_getOperand(MI, 1)) - ARM64_REG_Z0); | 
| 891 | 78 |           } else { | 
| 892 | 78 |              MI->flat_insn->detail->arm64.operands[1].vas = ARM64_VAS_1S; | 
| 893 | 78 |           } | 
| 894 | 78 |         } | 
| 895 | 78 |         break; | 
| 896 |  |       // Hacky detail filling of SMSTART and SMSTOP alias' | 
| 897 | 75 |       case AArch64_MSRpstatesvcrImm1:{ | 
| 898 | 75 |         if(MI->csh->detail_opt){ | 
| 899 | 75 |           MI->flat_insn->detail->arm64.op_count = 2; | 
| 900 | 75 | #ifndef CAPSTONE_DIET | 
| 901 | 75 |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 902 | 75 |           MI->ac_idx++; | 
| 903 | 75 |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 904 | 75 |           MI->ac_idx++; | 
| 905 | 75 | #endif | 
| 906 | 75 |           MI->flat_insn->detail->arm64.operands[0].type = ARM64_OP_SVCR; | 
| 907 | 75 |           MI->flat_insn->detail->arm64.operands[0].sys = (unsigned)ARM64_SYSREG_SVCR; | 
| 908 | 75 |           MI->flat_insn->detail->arm64.operands[0].svcr = lookupSVCRByEncoding(MCOperand_getImm(MCInst_getOperand(MI, 0)))->Encoding; | 
| 909 | 75 |           MI->flat_insn->detail->arm64.operands[1].type = ARM64_OP_IMM; | 
| 910 | 75 |           MI->flat_insn->detail->arm64.operands[1].imm = MCOperand_getImm(MCInst_getOperand(MI, 1)); | 
| 911 | 75 |         } | 
| 912 | 75 |         break; | 
| 913 | 74 |       } | 
| 914 | 51.7k |     } | 
| 915 | 288k |   } else { | 
| 916 | 288k |     printInstruction(MI, O); | 
| 917 | 288k |   } | 
| 918 | 340k | } | 
| 919 |  |  | 
| 920 |  | static bool printSysAlias(MCInst *MI, SStream *O) | 
| 921 | 3.86k | { | 
| 922 |  |   // unsigned Opcode = MCInst_getOpcode(MI); | 
| 923 |  |   //assert(Opcode == AArch64_SYSxt && "Invalid opcode for SYS alias!"); | 
| 924 |  |  | 
| 925 | 3.86k |   const char *Ins; | 
| 926 | 3.86k |   uint16_t Encoding; | 
| 927 | 3.86k |   bool NeedsReg; | 
| 928 | 3.86k |   char Name[64]; | 
| 929 | 3.86k |   MCOperand *Op1 = MCInst_getOperand(MI, 0); | 
| 930 | 3.86k |   MCOperand *Cn = MCInst_getOperand(MI, 1); | 
| 931 | 3.86k |   MCOperand *Cm = MCInst_getOperand(MI, 2); | 
| 932 | 3.86k |   MCOperand *Op2 = MCInst_getOperand(MI, 3); | 
| 933 |  |  | 
| 934 | 3.86k |   unsigned Op1Val = (unsigned)MCOperand_getImm(Op1); | 
| 935 | 3.86k |   unsigned CnVal = (unsigned)MCOperand_getImm(Cn); | 
| 936 | 3.86k |   unsigned CmVal = (unsigned)MCOperand_getImm(Cm); | 
| 937 | 3.86k |   unsigned Op2Val = (unsigned)MCOperand_getImm(Op2); | 
| 938 |  |  | 
| 939 | 3.86k |   Encoding = Op2Val; | 
| 940 | 3.86k |   Encoding |= CmVal << 3; | 
| 941 | 3.86k |   Encoding |= CnVal << 7; | 
| 942 | 3.86k |   Encoding |= Op1Val << 11; | 
| 943 |  |  | 
| 944 | 3.86k |   if (CnVal == 7) { | 
| 945 | 2.84k |     switch (CmVal) { | 
| 946 | 654 |       default: | 
| 947 | 654 |         return false; | 
| 948 |  |  | 
| 949 |  |       // IC aliases | 
| 950 | 637 |       case 1: case 5: { | 
| 951 | 637 |         const IC *IC = lookupICByEncoding(Encoding); | 
| 952 |  |         // if (!IC || !IC->haveFeatures(STI.getFeatureBits())) | 
| 953 | 637 |         if (!IC) | 
| 954 | 107 |           return false; | 
| 955 |  |  | 
| 956 | 530 |         NeedsReg = IC->NeedsReg; | 
| 957 | 530 |         Ins = "ic"; | 
| 958 | 530 |         strncpy(Name, IC->Name, sizeof(Name) - 1); | 
| 959 | 530 |       } | 
| 960 | 0 |       break; | 
| 961 |  |  | 
| 962 |  |       // DC aliases | 
| 963 | 1.24k |       case 4: case 6: case 10: case 11: case 12: case 14: { | 
| 964 | 1.24k |         const DC *DC = lookupDCByEncoding(Encoding); | 
| 965 |  |         // if (!DC || !DC->haveFeatures(STI.getFeatureBits())) | 
| 966 | 1.24k |         if (!DC) | 
| 967 | 1.11k |           return false; | 
| 968 |  |  | 
| 969 | 137 |         NeedsReg = true; | 
| 970 | 137 |         Ins = "dc"; | 
| 971 | 137 |         strncpy(Name, DC->Name, sizeof(Name) - 1); | 
| 972 | 137 |       } | 
| 973 | 0 |       break; | 
| 974 |  |  | 
| 975 |  |       // AT aliases | 
| 976 | 309 |       case 8: case 9: { | 
| 977 | 309 |         const AT *AT = lookupATByEncoding(Encoding); | 
| 978 |  |         // if (!AT || !AT->haveFeatures(STI.getFeatureBits())) | 
| 979 | 309 |         if (!AT) | 
| 980 | 187 |           return false; | 
| 981 |  |  | 
| 982 | 122 |         NeedsReg = true; | 
| 983 | 122 |         Ins = "at"; | 
| 984 | 122 |         strncpy(Name, AT->Name, sizeof(Name) - 1); | 
| 985 | 122 |       } | 
| 986 | 0 |       break; | 
| 987 | 2.84k |     } | 
| 988 | 2.84k |   } else if (CnVal == 8) { | 
| 989 |  |     // TLBI aliases | 
| 990 | 532 |     const TLBI *TLBI = lookupTLBIByEncoding(Encoding); | 
| 991 |  |     // if (!TLBI || !TLBI->haveFeatures(STI.getFeatureBits())) | 
| 992 | 532 |     if (!TLBI) | 
| 993 | 312 |       return false; | 
| 994 |  |  | 
| 995 | 220 |     NeedsReg = TLBI->NeedsReg; | 
| 996 | 220 |     Ins = "tlbi"; | 
| 997 | 220 |     strncpy(Name, TLBI->Name, sizeof(Name) - 1); | 
| 998 | 220 |   } else | 
| 999 | 486 |     return false; | 
| 1000 |  |  | 
| 1001 | 1.00k |   SStream_concat(O, "%s\t%s", Ins, Name); | 
| 1002 |  |  | 
| 1003 | 1.00k |   if (NeedsReg) { | 
| 1004 | 285 |     SStream_concat(O, ", %s", getRegisterName(MCOperand_getReg(MCInst_getOperand(MI, 4)), AArch64_NoRegAltName)); | 
| 1005 | 285 |   } | 
| 1006 |  |  | 
| 1007 | 1.00k |   MCInst_setOpcodePub(MI, AArch64_map_insn(Ins)); | 
| 1008 |  |  | 
| 1009 | 1.00k |   if (MI->csh->detail_opt) { | 
| 1010 |  | #if 0 | 
| 1011 |  | #ifndef CAPSTONE_DIET | 
| 1012 |  |     uint8_t access; | 
| 1013 |  |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1014 |  |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1015 |  |     MI->ac_idx++; | 
| 1016 |  | #endif | 
| 1017 |  | #endif | 
| 1018 | 1.00k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_SYS; | 
| 1019 | 1.00k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].sys = AArch64_map_sys_op(Name); | 
| 1020 | 1.00k |     MI->flat_insn->detail->arm64.op_count++; | 
| 1021 |  |  | 
| 1022 | 1.00k |     if (NeedsReg) { | 
| 1023 | 285 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 1024 | 285 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(MCInst_getOperand(MI, 4)); | 
| 1025 | 285 |       MI->flat_insn->detail->arm64.op_count++; | 
| 1026 | 285 |     } | 
| 1027 | 1.00k |   } | 
| 1028 |  |  | 
| 1029 | 1.00k |   return true; | 
| 1030 | 3.86k | } | 
| 1031 |  |  | 
| 1032 |  | static void printOperand(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1033 | 487k | { | 
| 1034 | 487k |   MCOperand *Op = MCInst_getOperand(MI, OpNum); | 
| 1035 |  |  | 
| 1036 | 487k |   if (MCOperand_isReg(Op)) { | 
| 1037 | 428k |     unsigned Reg = MCOperand_getReg(Op); | 
| 1038 |  |  | 
| 1039 | 428k |     SStream_concat0(O, getRegisterName(Reg, AArch64_NoRegAltName)); | 
| 1040 |  |  | 
| 1041 | 428k |     if (MI->csh->detail_opt) { | 
| 1042 | 428k |       if (MI->csh->doing_mem) { | 
| 1043 | 188k |         if (MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].mem.base == ARM64_REG_INVALID) { | 
| 1044 | 167k |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].mem.base = Reg; | 
| 1045 | 167k |         } | 
| 1046 | 21.7k |         else if (MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].mem.index == ARM64_REG_INVALID) { | 
| 1047 | 21.7k |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].mem.index = Reg; | 
| 1048 | 21.7k |         } | 
| 1049 | 239k |       } else if (MI->csh->doing_SME_Index) { | 
| 1050 |  |         // Access op_count-1 as We want to add info to previous operand, not create a new one | 
| 1051 | 7.44k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count-1].sme_index.base = Reg; | 
| 1052 | 232k |       } else { | 
| 1053 | 232k | #ifndef CAPSTONE_DIET | 
| 1054 | 232k |         uint8_t access; | 
| 1055 |  |  | 
| 1056 | 232k |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1057 | 232k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1058 | 232k |         MI->ac_idx++; | 
| 1059 | 232k | #endif | 
| 1060 | 232k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 1061 | 232k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = Reg; | 
| 1062 | 232k |         MI->flat_insn->detail->arm64.op_count++; | 
| 1063 | 232k |       } | 
| 1064 | 428k |     } | 
| 1065 | 428k |   } else if (MCOperand_isImm(Op)) { | 
| 1066 | 58.9k |     int64_t imm = MCOperand_getImm(Op); | 
| 1067 |  |  | 
| 1068 | 58.9k |     if (MI->Opcode == AArch64_ADR) { | 
| 1069 | 5.16k |       imm += MI->address; | 
| 1070 | 5.16k |       printUInt64Bang(O, imm); | 
| 1071 | 53.7k |     } else { | 
| 1072 | 53.7k |       if (MI->csh->doing_mem) { | 
| 1073 | 17.1k |         if (MI->csh->imm_unsigned) { | 
| 1074 | 0 |           printUInt64Bang(O, imm); | 
| 1075 | 17.1k |         } else { | 
| 1076 | 17.1k |           printInt64Bang(O, imm); | 
| 1077 | 17.1k |         } | 
| 1078 | 17.1k |       } else | 
| 1079 | 36.6k |         printUInt64Bang(O, imm); | 
| 1080 | 53.7k |     } | 
| 1081 |  |  | 
| 1082 | 58.9k |     if (MI->csh->detail_opt) { | 
| 1083 | 58.9k |       if (MI->csh->doing_mem) { | 
| 1084 | 17.1k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].mem.disp = (int32_t)imm; | 
| 1085 | 41.7k |       } else if (MI->csh->doing_SME_Index) { | 
| 1086 |  |         // Access op_count-1 as We want to add info to previous operand, not create a new one | 
| 1087 | 0 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count-1].sme_index.disp = (int32_t)imm;  | 
| 1088 | 41.7k |       } else { | 
| 1089 | 41.7k | #ifndef CAPSTONE_DIET | 
| 1090 | 41.7k |         uint8_t access; | 
| 1091 |  |  | 
| 1092 | 41.7k |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1093 | 41.7k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1094 | 41.7k | #endif | 
| 1095 | 41.7k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 1096 | 41.7k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = imm; | 
| 1097 | 41.7k |         MI->flat_insn->detail->arm64.op_count++; | 
| 1098 | 41.7k |       } | 
| 1099 | 58.9k |     } | 
| 1100 | 58.9k |   } | 
| 1101 | 487k | } | 
| 1102 |  |  | 
| 1103 |  | static void printImm(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1104 | 6.71k | { | 
| 1105 | 6.71k |   MCOperand *Op = MCInst_getOperand(MI, OpNum); | 
| 1106 | 6.71k |   printUInt64Bang(O, MCOperand_getImm(Op)); | 
| 1107 |  |  | 
| 1108 | 6.71k |   if (MI->csh->detail_opt) { | 
| 1109 | 6.71k | #ifndef CAPSTONE_DIET | 
| 1110 | 6.71k |     uint8_t access; | 
| 1111 | 6.71k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1112 | 6.71k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1113 | 6.71k |     MI->ac_idx++; | 
| 1114 | 6.71k | #endif | 
| 1115 | 6.71k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 1116 | 6.71k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = MCOperand_getImm(Op); | 
| 1117 | 6.71k |     MI->flat_insn->detail->arm64.op_count++; | 
| 1118 | 6.71k |   } | 
| 1119 | 6.71k | } | 
| 1120 |  |  | 
| 1121 |  | static void printImmHex(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1122 | 68 | { | 
| 1123 | 68 |   MCOperand *Op = MCInst_getOperand(MI, OpNum); | 
| 1124 | 68 |   printUInt64Bang(O, MCOperand_getImm(Op)); | 
| 1125 |  |  | 
| 1126 | 68 |   if (MI->csh->detail_opt) { | 
| 1127 | 68 | #ifndef CAPSTONE_DIET | 
| 1128 | 68 |     uint8_t access; | 
| 1129 | 68 |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1130 | 68 |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1131 | 68 |     MI->ac_idx++; | 
| 1132 | 68 | #endif | 
| 1133 | 68 |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 1134 | 68 |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = MCOperand_getImm(Op); | 
| 1135 | 68 |     MI->flat_insn->detail->arm64.op_count++; | 
| 1136 | 68 |   } | 
| 1137 | 68 | } | 
| 1138 |  |  | 
| 1139 | 3.40k | static void printSImm(MCInst *MI, unsigned OpNo, SStream *O, int Size) { | 
| 1140 | 3.40k |   MCOperand *Op = MCInst_getOperand(MI, OpNo); | 
| 1141 | 3.40k |   if (Size == 8) | 
| 1142 | 3.01k |   printInt64Bang(O, (signed char) MCOperand_getImm(Op)); | 
| 1143 | 390 |   else if (Size == 16) | 
| 1144 | 390 |   printInt64Bang(O, (signed short) MCOperand_getImm(Op)); | 
| 1145 | 0 |   else | 
| 1146 | 0 |     printInt64Bang(O, MCOperand_getImm(Op)); | 
| 1147 |  |  | 
| 1148 | 3.40k |   if (MI->csh->detail_opt) { | 
| 1149 | 3.40k | #ifndef CAPSTONE_DIET | 
| 1150 | 3.40k |     uint8_t access; | 
| 1151 | 3.40k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1152 | 3.40k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1153 | 3.40k |     MI->ac_idx++; | 
| 1154 | 3.40k | #endif | 
| 1155 | 3.40k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 1156 | 3.40k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = MCOperand_getImm(Op); | 
| 1157 | 3.40k |     MI->flat_insn->detail->arm64.op_count++; | 
| 1158 | 3.40k |   } | 
| 1159 | 3.40k | } | 
| 1160 |  |  | 
| 1161 |  | static void printPostIncOperand(MCInst *MI, unsigned OpNum, SStream *O, | 
| 1162 |  |     unsigned Imm) | 
| 1163 | 32.8k | { | 
| 1164 | 32.8k |   MCOperand *Op = MCInst_getOperand(MI, OpNum); | 
| 1165 |  |  | 
| 1166 | 32.8k |   if (MCOperand_isReg(Op)) { | 
| 1167 | 32.8k |     unsigned Reg = MCOperand_getReg(Op); | 
| 1168 | 32.8k |     if (Reg == AArch64_XZR) { | 
| 1169 | 0 |       printInt32Bang(O, Imm); | 
| 1170 |  | 
 | 
| 1171 | 0 |       if (MI->csh->detail_opt) { | 
| 1172 | 0 | #ifndef CAPSTONE_DIET | 
| 1173 | 0 |         uint8_t access; | 
| 1174 |  | 
 | 
| 1175 | 0 |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1176 | 0 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1177 | 0 |         MI->ac_idx++; | 
| 1178 | 0 | #endif | 
| 1179 | 0 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 1180 | 0 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = Imm; | 
| 1181 | 0 |         MI->flat_insn->detail->arm64.op_count++; | 
| 1182 | 0 |       } | 
| 1183 | 32.8k |     } else { | 
| 1184 | 32.8k |       SStream_concat0(O, getRegisterName(Reg, AArch64_NoRegAltName)); | 
| 1185 |  |  | 
| 1186 | 32.8k |       if (MI->csh->detail_opt) { | 
| 1187 | 32.8k | #ifndef CAPSTONE_DIET | 
| 1188 | 32.8k |         uint8_t access; | 
| 1189 |  |  | 
| 1190 | 32.8k |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1191 | 32.8k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1192 | 32.8k |         MI->ac_idx++; | 
| 1193 | 32.8k | #endif | 
| 1194 | 32.8k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 1195 | 32.8k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = Reg; | 
| 1196 | 32.8k |         MI->flat_insn->detail->arm64.op_count++; | 
| 1197 | 32.8k |       } | 
| 1198 | 32.8k |     } | 
| 1199 | 32.8k |   } | 
| 1200 |  |   //llvm_unreachable("unknown operand kind in printPostIncOperand64"); | 
| 1201 | 32.8k | } | 
| 1202 |  |  | 
| 1203 |  | static void printVRegOperand(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1204 | 59.7k | { | 
| 1205 | 59.7k |   MCOperand *Op = MCInst_getOperand(MI, OpNum); | 
| 1206 |  |   //assert(Op.isReg() && "Non-register vreg operand!"); | 
| 1207 | 59.7k |   unsigned Reg = MCOperand_getReg(Op); | 
| 1208 |  |  | 
| 1209 | 59.7k |   SStream_concat0(O, getRegisterName(Reg, AArch64_vreg)); | 
| 1210 |  |  | 
| 1211 | 59.7k |   if (MI->csh->detail_opt) { | 
| 1212 | 59.7k | #ifndef CAPSTONE_DIET | 
| 1213 | 59.7k |     uint8_t access; | 
| 1214 | 59.7k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1215 | 59.7k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1216 | 59.7k |     MI->ac_idx++; | 
| 1217 | 59.7k | #endif | 
| 1218 | 59.7k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 1219 | 59.7k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = AArch64_map_vregister(Reg); | 
| 1220 | 59.7k |     MI->flat_insn->detail->arm64.op_count++; | 
| 1221 | 59.7k |   } | 
| 1222 | 59.7k | } | 
| 1223 |  |  | 
| 1224 |  | static void printSysCROperand(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1225 | 5.79k | { | 
| 1226 | 5.79k |   MCOperand *Op = MCInst_getOperand(MI, OpNum); | 
| 1227 |  |   //assert(Op.isImm() && "System instruction C[nm] operands must be immediates!"); | 
| 1228 | 5.79k |   SStream_concat(O, "c%u", MCOperand_getImm(Op)); | 
| 1229 |  |  | 
| 1230 | 5.79k |   if (MI->csh->detail_opt) { | 
| 1231 | 5.79k | #ifndef CAPSTONE_DIET | 
| 1232 | 5.79k |     uint8_t access; | 
| 1233 |  |  | 
| 1234 | 5.79k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1235 | 5.79k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1236 | 5.79k |     MI->ac_idx++; | 
| 1237 | 5.79k | #endif | 
| 1238 | 5.79k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_CIMM; | 
| 1239 | 5.79k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = MCOperand_getImm(Op); | 
| 1240 | 5.79k |     MI->flat_insn->detail->arm64.op_count++; | 
| 1241 | 5.79k |   } | 
| 1242 | 5.79k | } | 
| 1243 |  |  | 
| 1244 |  | static void printAddSubImm(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1245 | 4.64k | { | 
| 1246 | 4.64k |   MCOperand *MO = MCInst_getOperand(MI, OpNum); | 
| 1247 | 4.64k |   if (MCOperand_isImm(MO)) { | 
| 1248 | 4.64k |     unsigned Val = (MCOperand_getImm(MO) & 0xfff); | 
| 1249 |  |     //assert(Val == MO.getImm() && "Add/sub immediate out of range!"); | 
| 1250 | 4.64k |     unsigned Shift = AArch64_AM_getShiftValue((int)MCOperand_getImm(MCInst_getOperand(MI, OpNum + 1))); | 
| 1251 |  |  | 
| 1252 | 4.64k |     printInt32Bang(O, Val); | 
| 1253 |  |  | 
| 1254 | 4.64k |     if (MI->csh->detail_opt) { | 
| 1255 | 4.64k | #ifndef CAPSTONE_DIET | 
| 1256 | 4.64k |       uint8_t access; | 
| 1257 |  |  | 
| 1258 | 4.64k |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1259 | 4.64k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1260 | 4.64k |       MI->ac_idx++; | 
| 1261 | 4.64k | #endif | 
| 1262 | 4.64k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 1263 | 4.64k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = Val; | 
| 1264 | 4.64k |       MI->flat_insn->detail->arm64.op_count++; | 
| 1265 | 4.64k |     } | 
| 1266 |  |  | 
| 1267 | 4.64k |     if (Shift != 0) | 
| 1268 | 1.56k |       printShifter(MI, OpNum + 1, O); | 
| 1269 | 4.64k |   } | 
| 1270 | 4.64k | } | 
| 1271 |  |  | 
| 1272 |  | static void printLogicalImm32(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1273 | 5.36k | { | 
| 1274 | 5.36k |   int64_t Val = MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 1275 |  |  | 
| 1276 | 5.36k |   Val = AArch64_AM_decodeLogicalImmediate(Val, 32); | 
| 1277 | 5.36k |   printUInt32Bang(O, (int)Val); | 
| 1278 |  |  | 
| 1279 | 5.36k |   if (MI->csh->detail_opt) { | 
| 1280 | 5.36k | #ifndef CAPSTONE_DIET | 
| 1281 | 5.36k |     uint8_t access; | 
| 1282 |  |  | 
| 1283 | 5.36k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1284 | 5.36k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1285 | 5.36k |     MI->ac_idx++; | 
| 1286 | 5.36k | #endif | 
| 1287 | 5.36k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 1288 | 5.36k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = Val; | 
| 1289 | 5.36k |     MI->flat_insn->detail->arm64.op_count++; | 
| 1290 | 5.36k |   } | 
| 1291 | 5.36k | } | 
| 1292 |  |  | 
| 1293 |  | static void printLogicalImm64(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1294 | 3.42k | { | 
| 1295 | 3.42k |   int64_t Val = MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 1296 | 3.42k |   Val = AArch64_AM_decodeLogicalImmediate(Val, 64); | 
| 1297 |  |  | 
| 1298 | 3.42k |   switch(MI->flat_insn->id) { | 
| 1299 | 919 |     default: | 
| 1300 | 919 |       printInt64Bang(O, Val); | 
| 1301 | 919 |       break; | 
| 1302 |  |  | 
| 1303 | 571 |     case ARM64_INS_ORR: | 
| 1304 | 731 |     case ARM64_INS_AND: | 
| 1305 | 2.50k |     case ARM64_INS_EOR: | 
| 1306 | 2.50k |     case ARM64_INS_TST: | 
| 1307 |  |       // do not print number in negative form | 
| 1308 | 2.50k |       if (Val >= 0 && Val <= HEX_THRESHOLD) | 
| 1309 | 295 |         SStream_concat(O, "#%u", (int)Val); | 
| 1310 | 2.21k |       else | 
| 1311 | 2.21k |         SStream_concat(O, "#0x%"PRIx64, Val); | 
| 1312 | 2.50k |       break; | 
| 1313 | 3.42k |   } | 
| 1314 |  |  | 
| 1315 | 3.42k |   if (MI->csh->detail_opt) { | 
| 1316 | 3.42k | #ifndef CAPSTONE_DIET | 
| 1317 | 3.42k |     uint8_t access; | 
| 1318 |  |  | 
| 1319 | 3.42k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1320 | 3.42k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1321 | 3.42k |     MI->ac_idx++; | 
| 1322 | 3.42k | #endif | 
| 1323 | 3.42k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 1324 | 3.42k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = (int64_t)Val; | 
| 1325 | 3.42k |     MI->flat_insn->detail->arm64.op_count++; | 
| 1326 | 3.42k |   } | 
| 1327 | 3.42k | } | 
| 1328 |  |  | 
| 1329 |  | static void printShifter(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1330 | 16.7k | { | 
| 1331 | 16.7k |   unsigned Val = (unsigned)MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 1332 |  |  | 
| 1333 |  |   // LSL #0 should not be printed. | 
| 1334 | 16.7k |   if (AArch64_AM_getShiftType(Val) == AArch64_AM_LSL && | 
| 1335 | 16.7k |       AArch64_AM_getShiftValue(Val) == 0) | 
| 1336 | 1.84k |     return; | 
| 1337 |  |  | 
| 1338 | 14.9k |   SStream_concat(O, ", %s ", AArch64_AM_getShiftExtendName(AArch64_AM_getShiftType(Val))); | 
| 1339 | 14.9k |   printInt32BangDec(O, AArch64_AM_getShiftValue(Val)); | 
| 1340 |  |  | 
| 1341 | 14.9k |   if (MI->csh->detail_opt) { | 
| 1342 | 14.9k |     arm64_shifter shifter = ARM64_SFT_INVALID; | 
| 1343 |  |  | 
| 1344 | 14.9k |     switch(AArch64_AM_getShiftType(Val)) { | 
| 1345 | 0 |       default:  // never reach | 
| 1346 | 7.23k |       case AArch64_AM_LSL: | 
| 1347 | 7.23k |         shifter = ARM64_SFT_LSL; | 
| 1348 | 7.23k |         break; | 
| 1349 |  |  | 
| 1350 | 2.47k |       case AArch64_AM_LSR: | 
| 1351 | 2.47k |         shifter = ARM64_SFT_LSR; | 
| 1352 | 2.47k |         break; | 
| 1353 |  |  | 
| 1354 | 2.04k |       case AArch64_AM_ASR: | 
| 1355 | 2.04k |         shifter = ARM64_SFT_ASR; | 
| 1356 | 2.04k |         break; | 
| 1357 |  |  | 
| 1358 | 1.71k |       case AArch64_AM_ROR: | 
| 1359 | 1.71k |         shifter = ARM64_SFT_ROR; | 
| 1360 | 1.71k |         break; | 
| 1361 |  |  | 
| 1362 | 1.46k |       case AArch64_AM_MSL: | 
| 1363 | 1.46k |         shifter = ARM64_SFT_MSL; | 
| 1364 | 1.46k |         break; | 
| 1365 | 14.9k |     } | 
| 1366 |  |  | 
| 1367 | 14.9k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count - 1].shift.type = shifter; | 
| 1368 | 14.9k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count - 1].shift.value = AArch64_AM_getShiftValue(Val); | 
| 1369 | 14.9k |   } | 
| 1370 | 14.9k | } | 
| 1371 |  |  | 
| 1372 |  | static void printShiftedRegister(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1373 | 9.18k | { | 
| 1374 | 9.18k |   SStream_concat0(O, getRegisterName(MCOperand_getReg(MCInst_getOperand(MI, OpNum)), AArch64_NoRegAltName)); | 
| 1375 |  |  | 
| 1376 | 9.18k |   if (MI->csh->detail_opt) { | 
| 1377 | 9.18k | #ifndef CAPSTONE_DIET | 
| 1378 | 9.18k |     uint8_t access; | 
| 1379 | 9.18k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1380 | 9.18k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1381 | 9.18k |     MI->ac_idx++; | 
| 1382 | 9.18k | #endif | 
| 1383 | 9.18k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 1384 | 9.18k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MCOperand_getReg(MCInst_getOperand(MI, OpNum)); | 
| 1385 | 9.18k |     MI->flat_insn->detail->arm64.op_count++; | 
| 1386 | 9.18k |   } | 
| 1387 |  |  | 
| 1388 | 9.18k |   printShifter(MI, OpNum + 1, O); | 
| 1389 | 9.18k | } | 
| 1390 |  |  | 
| 1391 |  | static void printArithExtend(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1392 | 11.9k | { | 
| 1393 | 11.9k |   unsigned Val = (unsigned)MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 1394 | 11.9k |   AArch64_AM_ShiftExtendType ExtType = AArch64_AM_getArithExtendType(Val); | 
| 1395 | 11.9k |   unsigned ShiftVal = AArch64_AM_getArithShiftValue(Val); | 
| 1396 |  |  | 
| 1397 |  |   // If the destination or first source register operand is [W]SP, print | 
| 1398 |  |   // UXTW/UXTX as LSL, and if the shift amount is also zero, print nothing at | 
| 1399 |  |   // all. | 
| 1400 | 11.9k |   if (ExtType == AArch64_AM_UXTW || ExtType == AArch64_AM_UXTX) { | 
| 1401 | 4.37k |     unsigned Dest = MCOperand_getReg(MCInst_getOperand(MI, 0)); | 
| 1402 | 4.37k |     unsigned Src1 = MCOperand_getReg(MCInst_getOperand(MI, 1)); | 
| 1403 |  |  | 
| 1404 | 4.37k |     if (((Dest == AArch64_SP || Src1 == AArch64_SP) && | 
| 1405 | 4.37k |           ExtType == AArch64_AM_UXTX) || | 
| 1406 | 4.37k |         ((Dest == AArch64_WSP || Src1 == AArch64_WSP) && | 
| 1407 | 2.93k |          ExtType == AArch64_AM_UXTW)) { | 
| 1408 | 1.50k |       if (ShiftVal != 0) { | 
| 1409 | 1.50k |         SStream_concat0(O, ", lsl "); | 
| 1410 | 1.50k |         printInt32Bang(O, ShiftVal); | 
| 1411 |  |  | 
| 1412 | 1.50k |         if (MI->csh->detail_opt) { | 
| 1413 | 1.50k |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count - 1].shift.type = ARM64_SFT_LSL; | 
| 1414 | 1.50k |           MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count - 1].shift.value = ShiftVal; | 
| 1415 | 1.50k |         } | 
| 1416 | 1.50k |       } | 
| 1417 |  |  | 
| 1418 | 1.50k |       return; | 
| 1419 | 1.50k |     } | 
| 1420 | 4.37k |   } | 
| 1421 |  |  | 
| 1422 | 10.4k |   SStream_concat(O, ", %s", AArch64_AM_getShiftExtendName(ExtType)); | 
| 1423 |  |  | 
| 1424 | 10.4k |   if (MI->csh->detail_opt) { | 
| 1425 | 10.4k |     arm64_extender ext = ARM64_EXT_INVALID; | 
| 1426 | 10.4k |     switch(ExtType) { | 
| 1427 | 0 |       default:  // never reach | 
| 1428 |  | 
 | 
| 1429 | 355 |       case AArch64_AM_UXTB: | 
| 1430 | 355 |         ext = ARM64_EXT_UXTB; | 
| 1431 | 355 |         break; | 
| 1432 |  |  | 
| 1433 | 2.00k |       case AArch64_AM_UXTH: | 
| 1434 | 2.00k |         ext = ARM64_EXT_UXTH; | 
| 1435 | 2.00k |         break; | 
| 1436 |  |  | 
| 1437 | 1.51k |       case AArch64_AM_UXTW: | 
| 1438 | 1.51k |         ext = ARM64_EXT_UXTW; | 
| 1439 | 1.51k |         break; | 
| 1440 |  |  | 
| 1441 | 1.34k |       case AArch64_AM_UXTX: | 
| 1442 | 1.34k |         ext = ARM64_EXT_UXTX; | 
| 1443 | 1.34k |         break; | 
| 1444 |  |  | 
| 1445 | 990 |       case AArch64_AM_SXTB: | 
| 1446 | 990 |         ext = ARM64_EXT_SXTB; | 
| 1447 | 990 |         break; | 
| 1448 |  |  | 
| 1449 | 844 |       case AArch64_AM_SXTH: | 
| 1450 | 844 |         ext = ARM64_EXT_SXTH; | 
| 1451 | 844 |         break; | 
| 1452 |  |  | 
| 1453 | 448 |       case AArch64_AM_SXTW: | 
| 1454 | 448 |         ext = ARM64_EXT_SXTW; | 
| 1455 | 448 |         break; | 
| 1456 |  |  | 
| 1457 | 2.94k |       case AArch64_AM_SXTX: | 
| 1458 | 2.94k |         ext = ARM64_EXT_SXTX; | 
| 1459 | 2.94k |         break; | 
| 1460 | 10.4k |     } | 
| 1461 |  |  | 
| 1462 | 10.4k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count - 1].ext = ext; | 
| 1463 | 10.4k |   } | 
| 1464 |  |  | 
| 1465 | 10.4k |   if (ShiftVal != 0) { | 
| 1466 | 7.06k |     SStream_concat0(O, " "); | 
| 1467 | 7.06k |     printInt32Bang(O, ShiftVal); | 
| 1468 |  |  | 
| 1469 | 7.06k |     if (MI->csh->detail_opt) { | 
| 1470 | 7.06k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count - 1].shift.type = ARM64_SFT_LSL; | 
| 1471 | 7.06k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count - 1].shift.value = ShiftVal; | 
| 1472 | 7.06k |     } | 
| 1473 | 7.06k |   } | 
| 1474 | 10.4k | } | 
| 1475 |  |  | 
| 1476 |  | static void printExtendedRegister(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1477 | 6.08k | { | 
| 1478 | 6.08k |   unsigned Reg = MCOperand_getReg(MCInst_getOperand(MI, OpNum)); | 
| 1479 |  |  | 
| 1480 | 6.08k |   SStream_concat0(O, getRegisterName(Reg, AArch64_NoRegAltName)); | 
| 1481 |  |  | 
| 1482 | 6.08k |   if (MI->csh->detail_opt) { | 
| 1483 | 6.08k | #ifndef CAPSTONE_DIET | 
| 1484 | 6.08k |     uint8_t access; | 
| 1485 | 6.08k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1486 | 6.08k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1487 | 6.08k |     MI->ac_idx++; | 
| 1488 | 6.08k | #endif | 
| 1489 | 6.08k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 1490 | 6.08k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = Reg; | 
| 1491 | 6.08k |     MI->flat_insn->detail->arm64.op_count++; | 
| 1492 | 6.08k |   } | 
| 1493 |  |  | 
| 1494 | 6.08k |   printArithExtend(MI, OpNum + 1, O); | 
| 1495 | 6.08k | } | 
| 1496 |  |  | 
| 1497 |  | static void printMemExtendImpl(MCInst *MI, bool SignExtend, bool DoShift, unsigned Width, | 
| 1498 |  |              char SrcRegKind, SStream *O) | 
| 1499 | 19.3k | { | 
| 1500 |  |   // sxtw, sxtx, uxtw or lsl (== uxtx) | 
| 1501 | 19.3k |   bool IsLSL = !SignExtend && SrcRegKind == 'x'; | 
| 1502 | 19.3k |   if (IsLSL) { | 
| 1503 | 6.69k |     SStream_concat0(O, "lsl"); | 
| 1504 |  |  | 
| 1505 | 6.69k |     if (MI->csh->detail_opt) { | 
| 1506 | 6.69k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].shift.type = ARM64_SFT_LSL; | 
| 1507 | 6.69k |     } | 
| 1508 | 12.6k |   } else { | 
| 1509 | 12.6k |     SStream_concat(O, "%cxt%c", (SignExtend ? 's' : 'u'), SrcRegKind); | 
| 1510 |  |  | 
| 1511 | 12.6k |     if (MI->csh->detail_opt) { | 
| 1512 | 12.6k |       if (!SignExtend) { | 
| 1513 | 4.30k |         switch(SrcRegKind) { | 
| 1514 | 0 |           default: break; | 
| 1515 | 0 |           case 'b': | 
| 1516 | 0 |                MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].ext = ARM64_EXT_UXTB; | 
| 1517 | 0 |                break; | 
| 1518 | 0 |           case 'h': | 
| 1519 | 0 |                MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].ext = ARM64_EXT_UXTH; | 
| 1520 | 0 |                break; | 
| 1521 | 4.30k |           case 'w': | 
| 1522 | 4.30k |                MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].ext = ARM64_EXT_UXTW; | 
| 1523 | 4.30k |                break; | 
| 1524 | 4.30k |         } | 
| 1525 | 8.29k |       } else { | 
| 1526 | 8.29k |           switch(SrcRegKind) { | 
| 1527 | 0 |             default: break; | 
| 1528 | 0 |             case 'b': | 
| 1529 | 0 |               MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].ext = ARM64_EXT_SXTB; | 
| 1530 | 0 |               break; | 
| 1531 | 0 |             case 'h': | 
| 1532 | 0 |               MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].ext = ARM64_EXT_SXTH; | 
| 1533 | 0 |               break; | 
| 1534 | 4.22k |             case 'w': | 
| 1535 | 4.22k |               MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].ext = ARM64_EXT_SXTW; | 
| 1536 | 4.22k |               break; | 
| 1537 | 4.06k |             case 'x': | 
| 1538 | 4.06k |               MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].ext = ARM64_EXT_SXTX; | 
| 1539 | 4.06k |               break; | 
| 1540 | 8.29k |           } | 
| 1541 | 8.29k |       } | 
| 1542 | 12.6k |     } | 
| 1543 | 12.6k |   } | 
| 1544 |  |  | 
| 1545 | 19.3k |   if (DoShift || IsLSL) { | 
| 1546 | 16.0k |     SStream_concat(O, " #%u", Log2_32(Width / 8)); | 
| 1547 |  |  | 
| 1548 | 16.0k |     if (MI->csh->detail_opt) { | 
| 1549 | 16.0k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].shift.type = ARM64_SFT_LSL; | 
| 1550 | 16.0k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].shift.value = Log2_32(Width / 8); | 
| 1551 | 16.0k |     } | 
| 1552 | 16.0k |   } | 
| 1553 | 19.3k | } | 
| 1554 |  |  | 
| 1555 |  | static void printMemExtend(MCInst *MI, unsigned OpNum, SStream *O, char SrcRegKind, unsigned Width) | 
| 1556 | 6.30k | { | 
| 1557 | 6.30k |   unsigned SignExtend = (unsigned)MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 1558 | 6.30k |   unsigned DoShift = (unsigned)MCOperand_getImm(MCInst_getOperand(MI, OpNum + 1)); | 
| 1559 |  |  | 
| 1560 | 6.30k |   printMemExtendImpl(MI, SignExtend, DoShift, Width, SrcRegKind, O); | 
| 1561 | 6.30k | } | 
| 1562 |  |  | 
| 1563 |  | static void printRegWithShiftExtend(MCInst *MI, unsigned OpNum, SStream *O, | 
| 1564 |  |             bool SignExtend, int ExtWidth, | 
| 1565 |  |             char SrcRegKind, char Suffix) | 
| 1566 | 17.9k | { | 
| 1567 | 17.9k |   bool DoShift; | 
| 1568 |  |  | 
| 1569 | 17.9k |   printOperand(MI, OpNum, O); | 
| 1570 |  |  | 
| 1571 | 17.9k |   if (Suffix == 's' || Suffix == 'd') | 
| 1572 | 10.7k |     SStream_concat(O, ".%c", Suffix); | 
| 1573 |  |  | 
| 1574 | 17.9k |   DoShift = ExtWidth != 8; | 
| 1575 | 17.9k |   if (SignExtend || DoShift || SrcRegKind == 'w') { | 
| 1576 | 12.9k |     SStream_concat0(O, ", "); | 
| 1577 | 12.9k |     printMemExtendImpl(MI, SignExtend, DoShift, ExtWidth, SrcRegKind, O); | 
| 1578 | 12.9k |   } | 
| 1579 | 17.9k | } | 
| 1580 |  |  | 
| 1581 |  | static void printCondCode(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1582 | 2.96k | { | 
| 1583 | 2.96k |   AArch64CC_CondCode CC = (AArch64CC_CondCode)MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 1584 | 2.96k |   SStream_concat0(O, getCondCodeName(CC)); | 
| 1585 |  |  | 
| 1586 | 2.96k |   if (MI->csh->detail_opt) | 
| 1587 | 2.96k |     MI->flat_insn->detail->arm64.cc = (arm64_cc)(CC + 1); | 
| 1588 | 2.96k | } | 
| 1589 |  |  | 
| 1590 |  | static void printInverseCondCode(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1591 | 245 | { | 
| 1592 | 245 |   AArch64CC_CondCode CC = (AArch64CC_CondCode)MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 1593 | 245 |   SStream_concat0(O, getCondCodeName(getInvertedCondCode(CC))); | 
| 1594 |  |  | 
| 1595 | 245 |   if (MI->csh->detail_opt) { | 
| 1596 | 245 |     MI->flat_insn->detail->arm64.cc = (arm64_cc)(getInvertedCondCode(CC) + 1); | 
| 1597 | 245 |   } | 
| 1598 | 245 | } | 
| 1599 |  |  | 
| 1600 |  | static void printImmScale(MCInst *MI, unsigned OpNum, SStream *O, int Scale) | 
| 1601 | 30.9k | { | 
| 1602 | 30.9k |   int64_t val = Scale * MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 1603 |  |  | 
| 1604 | 30.9k |   printInt64Bang(O, val); | 
| 1605 |  |  | 
| 1606 | 30.9k |   if (MI->csh->detail_opt) { | 
| 1607 | 30.9k |     if (MI->csh->doing_mem) { | 
| 1608 | 24.7k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].mem.disp = (int32_t)val; | 
| 1609 | 24.7k |     } else { | 
| 1610 | 6.17k | #ifndef CAPSTONE_DIET | 
| 1611 | 6.17k |       uint8_t access; | 
| 1612 |  |  | 
| 1613 | 6.17k |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1614 | 6.17k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1615 | 6.17k |       MI->ac_idx++; | 
| 1616 | 6.17k | #endif | 
| 1617 | 6.17k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 1618 | 6.17k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = val; | 
| 1619 | 6.17k |       MI->flat_insn->detail->arm64.op_count++; | 
| 1620 | 6.17k |     } | 
| 1621 | 30.9k |   } | 
| 1622 | 30.9k | } | 
| 1623 |  |  | 
| 1624 |  | static void printUImm12Offset(MCInst *MI, unsigned OpNum, SStream *O, unsigned Scale) | 
| 1625 | 7.24k | { | 
| 1626 | 7.24k |   MCOperand *MO = MCInst_getOperand(MI, OpNum); | 
| 1627 |  |  | 
| 1628 | 7.24k |   if (MCOperand_isImm(MO)) { | 
| 1629 | 7.24k |     int64_t val = Scale * MCOperand_getImm(MO); | 
| 1630 | 7.24k |     printInt64Bang(O, val); | 
| 1631 |  |  | 
| 1632 | 7.24k |     if (MI->csh->detail_opt) { | 
| 1633 | 7.24k |       if (MI->csh->doing_mem) { | 
| 1634 | 7.24k |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].mem.disp = (int32_t)val; | 
| 1635 | 7.24k |       } else { | 
| 1636 | 0 | #ifndef CAPSTONE_DIET | 
| 1637 | 0 |         uint8_t access; | 
| 1638 |  | 
 | 
| 1639 | 0 |         access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1640 | 0 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1641 | 0 |         MI->ac_idx++; | 
| 1642 | 0 | #endif | 
| 1643 | 0 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 1644 | 0 |         MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = (int)val; | 
| 1645 | 0 |         MI->flat_insn->detail->arm64.op_count++; | 
| 1646 | 0 |       } | 
| 1647 | 7.24k |     } | 
| 1648 | 7.24k |   } | 
| 1649 | 7.24k | } | 
| 1650 |  |  | 
| 1651 |  | #if 0 | 
| 1652 |  | static void printAMIndexedWB(MCInst *MI, unsigned OpNum, SStream *O, unsigned int Scale) | 
| 1653 |  | { | 
| 1654 |  |   MCOperand *MO = MCInst_getOperand(MI, OpNum + 1); | 
| 1655 |  |  | 
| 1656 |  |   SStream_concat(O, "[%s", getRegisterName(MCOperand_getReg(MCInst_getOperand(MI, OpNum)), AArch64_NoRegAltName)); | 
| 1657 |  |  | 
| 1658 |  |   if (MCOperand_isImm(MO)) { | 
| 1659 |  |     int64_t val = Scale * MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 1660 |  |     printInt64Bang(O, val); | 
| 1661 |  |   // } else { | 
| 1662 |  |   //   // assert(MO1.isExpr() && "Unexpected operand type!"); | 
| 1663 |  |   //   SStream_concat0(O, ", "); | 
| 1664 |  |   //   MO1.getExpr()->print(O, &MAI); | 
| 1665 |  |   } | 
| 1666 |  |  | 
| 1667 |  |   SStream_concat0(O, "]"); | 
| 1668 |  | } | 
| 1669 |  | #endif | 
| 1670 |  |  | 
| 1671 |  | // IsSVEPrefetch = false | 
| 1672 |  | static void printPrefetchOp(MCInst *MI, unsigned OpNum, SStream *O, bool IsSVEPrefetch) | 
| 1673 | 7.05k | { | 
| 1674 | 7.05k |   unsigned prfop = (unsigned)MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 1675 |  |  | 
| 1676 | 7.05k |   if (IsSVEPrefetch) { | 
| 1677 | 4.77k |     const SVEPRFM *PRFM = lookupSVEPRFMByEncoding(prfop); | 
| 1678 | 4.77k |     if (PRFM) | 
| 1679 | 4.18k |       SStream_concat0(O, PRFM->Name); | 
| 1680 |  |  | 
| 1681 | 4.77k |     return; | 
| 1682 | 4.77k |   } else { | 
| 1683 | 2.28k |     const PRFM *PRFM = lookupPRFMByEncoding(prfop); | 
| 1684 | 2.28k |     if (PRFM) | 
| 1685 | 806 |       SStream_concat0(O, PRFM->Name); | 
| 1686 |  |  | 
| 1687 | 2.28k |     return; | 
| 1688 | 2.28k |   } | 
| 1689 |  |  | 
| 1690 |  |   // FIXME: set OpcodePub? | 
| 1691 |  |  | 
| 1692 | 0 |   printInt32Bang(O, prfop); | 
| 1693 |  | 
 | 
| 1694 | 0 |   if (MI->csh->detail_opt) { | 
| 1695 | 0 | #ifndef CAPSTONE_DIET | 
| 1696 | 0 |     uint8_t access; | 
| 1697 | 0 |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1698 | 0 |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1699 | 0 |     MI->ac_idx++; | 
| 1700 | 0 | #endif | 
| 1701 | 0 |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 1702 | 0 |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = prfop; | 
| 1703 | 0 |     MI->flat_insn->detail->arm64.op_count++; | 
| 1704 | 0 |   } | 
| 1705 | 0 | } | 
| 1706 |  |  | 
| 1707 |  | static void printPSBHintOp(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1708 | 138 | { | 
| 1709 | 138 |   MCOperand *Op = MCInst_getOperand(MI, OpNum); | 
| 1710 | 138 |   unsigned int psbhintop = MCOperand_getImm(Op); | 
| 1711 |  |  | 
| 1712 | 138 |   const PSB *PSB = lookupPSBByEncoding(psbhintop); | 
| 1713 | 138 |   if (PSB) | 
| 1714 | 138 |     SStream_concat0(O, PSB->Name); | 
| 1715 | 0 |   else | 
| 1716 | 0 |     printUInt32Bang(O, psbhintop); | 
| 1717 | 138 | } | 
| 1718 |  |  | 
| 1719 | 11 | static void printBTIHintOp(MCInst *MI, unsigned OpNum, SStream *O) { | 
| 1720 | 11 |   unsigned btihintop = MCOperand_getImm(MCInst_getOperand(MI, OpNum)) ^ 32; | 
| 1721 |  |  | 
| 1722 | 11 |   const BTI *BTI = lookupBTIByEncoding(btihintop); | 
| 1723 | 11 |   if (BTI) | 
| 1724 | 11 |   SStream_concat0(O, BTI->Name); | 
| 1725 | 0 |   else | 
| 1726 | 0 |   printUInt32Bang(O, btihintop); | 
| 1727 | 11 | } | 
| 1728 |  |  | 
| 1729 |  | static void printFPImmOperand(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1730 | 3.36k | { | 
| 1731 | 3.36k |   MCOperand *MO = MCInst_getOperand(MI, OpNum); | 
| 1732 | 3.36k |   float FPImm = MCOperand_isFPImm(MO) ? MCOperand_getFPImm(MO) : AArch64_AM_getFPImmFloat((int)MCOperand_getImm(MO)); | 
| 1733 |  |  | 
| 1734 |  |   // 8 decimal places are enough to perfectly represent permitted floats. | 
| 1735 |  | #if defined(_KERNEL_MODE) | 
| 1736 |  |   // Issue #681: Windows kernel does not support formatting float point | 
| 1737 |  |   SStream_concat0(O, "#<float_point_unsupported>"); | 
| 1738 |  | #else | 
| 1739 | 3.36k |   SStream_concat(O, "#%.8f", FPImm); | 
| 1740 | 3.36k | #endif | 
| 1741 |  |  | 
| 1742 | 3.36k |   if (MI->csh->detail_opt) { | 
| 1743 | 3.36k | #ifndef CAPSTONE_DIET | 
| 1744 | 3.36k |     uint8_t access; | 
| 1745 |  |  | 
| 1746 | 3.36k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1747 | 3.36k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1748 | 3.36k |     MI->ac_idx++; | 
| 1749 | 3.36k | #endif | 
| 1750 | 3.36k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_FP; | 
| 1751 | 3.36k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].fp = FPImm; | 
| 1752 | 3.36k |     MI->flat_insn->detail->arm64.op_count++; | 
| 1753 | 3.36k |   } | 
| 1754 | 3.36k | } | 
| 1755 |  |  | 
| 1756 |  | //static unsigned getNextVectorRegister(unsigned Reg, unsigned Stride = 1) | 
| 1757 |  | static unsigned getNextVectorRegister(unsigned Reg, unsigned Stride) | 
| 1758 | 203k | { | 
| 1759 | 407k |   while (Stride--) { | 
| 1760 | 203k |     if (Reg >= AArch64_Q0 && Reg <= AArch64_Q30) // AArch64_Q0 .. AArch64_Q30 | 
| 1761 | 168k |       Reg += 1; | 
| 1762 | 35.2k |     else if (Reg == AArch64_Q31) // Vector lists can wrap around. | 
| 1763 | 10.6k |       Reg = AArch64_Q0; | 
| 1764 | 24.6k |     else if (Reg >= AArch64_Z0 && Reg <= AArch64_Z30) // AArch64_Z0 .. AArch64_Z30 | 
| 1765 | 24.2k |       Reg += 1; | 
| 1766 | 403 |     else if (Reg == AArch64_Z31) // Vector lists can wrap around. | 
| 1767 | 403 |       Reg = AArch64_Z0; | 
| 1768 | 203k |   } | 
| 1769 |  |  | 
| 1770 | 203k |   return Reg; | 
| 1771 | 203k | } | 
| 1772 |  |  | 
| 1773 |  | static void printGPRSeqPairsClassOperand(MCInst *MI, unsigned OpNum, SStream *O, unsigned int size) | 
| 1774 | 2.07k | { | 
| 1775 |  |   // static_assert(size == 64 || size == 32, | 
| 1776 |  |   //    "Template parameter must be either 32 or 64"); | 
| 1777 | 2.07k |   unsigned Reg = MCOperand_getReg(MCInst_getOperand(MI, OpNum)); | 
| 1778 | 2.07k |   unsigned Sube = (size == 32) ? AArch64_sube32 : AArch64_sube64; | 
| 1779 | 2.07k |   unsigned Subo = (size == 32) ? AArch64_subo32 : AArch64_subo64; | 
| 1780 | 2.07k |   unsigned Even = MCRegisterInfo_getSubReg(MI->MRI, Reg, Sube); | 
| 1781 | 2.07k |   unsigned Odd = MCRegisterInfo_getSubReg(MI->MRI, Reg, Subo); | 
| 1782 |  |  | 
| 1783 | 2.07k |   SStream_concat(O, "%s, %s", getRegisterName(Even, AArch64_NoRegAltName), | 
| 1784 | 2.07k |       getRegisterName(Odd, AArch64_NoRegAltName)); | 
| 1785 |  |  | 
| 1786 | 2.07k |   if (MI->csh->detail_opt) { | 
| 1787 | 2.07k | #ifndef CAPSTONE_DIET | 
| 1788 | 2.07k |     uint8_t access; | 
| 1789 |  |  | 
| 1790 | 2.07k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1791 | 2.07k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1792 | 2.07k |     MI->ac_idx++; | 
| 1793 | 2.07k | #endif | 
| 1794 |  |  | 
| 1795 | 2.07k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 1796 | 2.07k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = Even; | 
| 1797 | 2.07k |     MI->flat_insn->detail->arm64.op_count++; | 
| 1798 |  |  | 
| 1799 | 2.07k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 1800 | 2.07k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = Odd; | 
| 1801 | 2.07k |     MI->flat_insn->detail->arm64.op_count++; | 
| 1802 | 2.07k |   } | 
| 1803 | 2.07k | } | 
| 1804 |  |  | 
| 1805 |  | static void printVectorList(MCInst *MI, unsigned OpNum, SStream *O, | 
| 1806 |  |     char *LayoutSuffix, MCRegisterInfo *MRI, arm64_vas vas) | 
| 1807 | 92.8k | { | 
| 1808 | 1.35M | #define GETREGCLASS_CONTAIN0(_class, _reg) MCRegisterClass_contains(MCRegisterInfo_getRegClass(MRI, _class), _reg) | 
| 1809 | 92.8k |   unsigned Reg = MCOperand_getReg(MCInst_getOperand(MI, OpNum)); | 
| 1810 | 92.8k |   unsigned NumRegs = 1, FirstReg, i; | 
| 1811 |  |  | 
| 1812 | 92.8k |   SStream_concat0(O, "{"); | 
| 1813 |  |  | 
| 1814 |  |   // Work out how many registers there are in the list (if there is an actual | 
| 1815 |  |   // list). | 
| 1816 | 92.8k |   if (GETREGCLASS_CONTAIN0(AArch64_DDRegClassID , Reg) || | 
| 1817 | 92.8k |       GETREGCLASS_CONTAIN0(AArch64_ZPR2RegClassID, Reg) || | 
| 1818 | 92.8k |       GETREGCLASS_CONTAIN0(AArch64_QQRegClassID, Reg)) | 
| 1819 | 23.3k |     NumRegs = 2; | 
| 1820 | 69.5k |   else if (GETREGCLASS_CONTAIN0(AArch64_DDDRegClassID, Reg) || | 
| 1821 | 69.5k |       GETREGCLASS_CONTAIN0(AArch64_ZPR3RegClassID, Reg) || | 
| 1822 | 69.5k |       GETREGCLASS_CONTAIN0(AArch64_QQQRegClassID, Reg)) | 
| 1823 | 15.0k |     NumRegs = 3; | 
| 1824 | 54.4k |   else if (GETREGCLASS_CONTAIN0(AArch64_DDDDRegClassID, Reg) || | 
| 1825 | 54.4k |       GETREGCLASS_CONTAIN0(AArch64_ZPR4RegClassID, Reg) || | 
| 1826 | 54.4k |       GETREGCLASS_CONTAIN0(AArch64_QQQQRegClassID, Reg)) | 
| 1827 | 19.2k |     NumRegs = 4; | 
| 1828 |  |  | 
| 1829 |  |   // Now forget about the list and find out what the first register is. | 
| 1830 | 92.8k |   if ((FirstReg = MCRegisterInfo_getSubReg(MRI, Reg, AArch64_dsub0))) | 
| 1831 | 12.4k |     Reg = FirstReg; | 
| 1832 | 80.4k |   else if ((FirstReg = MCRegisterInfo_getSubReg(MRI, Reg, AArch64_qsub0))) | 
| 1833 | 40.9k |     Reg = FirstReg; | 
| 1834 | 39.4k |   else if ((FirstReg = MCRegisterInfo_getSubReg(MRI, Reg, AArch64_zsub0))) | 
| 1835 | 4.22k |     Reg = FirstReg; | 
| 1836 |  |  | 
| 1837 |  |   // If it's a D-reg, we need to promote it to the equivalent Q-reg before | 
| 1838 |  |   // printing (otherwise getRegisterName fails). | 
| 1839 | 92.8k |   if (GETREGCLASS_CONTAIN0(AArch64_FPR64RegClassID, Reg)) { | 
| 1840 | 19.6k |     const MCRegisterClass *FPR128RC = MCRegisterInfo_getRegClass(MRI, AArch64_FPR128RegClassID); | 
| 1841 | 19.6k |     Reg = MCRegisterInfo_getMatchingSuperReg(MRI, Reg, AArch64_dsub, FPR128RC); | 
| 1842 | 19.6k |   } | 
| 1843 |  |  | 
| 1844 | 296k |   for (i = 0; i < NumRegs; ++i, Reg = getNextVectorRegister(Reg, 1)) { | 
| 1845 | 203k |     bool isZReg = GETREGCLASS_CONTAIN0(AArch64_ZPRRegClassID, Reg); | 
| 1846 | 203k |     if (isZReg) | 
| 1847 | 24.6k |       SStream_concat(O, "%s%s", getRegisterName(Reg, AArch64_NoRegAltName), LayoutSuffix); | 
| 1848 | 179k |     else | 
| 1849 | 179k |       SStream_concat(O, "%s%s", getRegisterName(Reg, AArch64_vreg), LayoutSuffix); | 
| 1850 |  |  | 
| 1851 | 203k |     if (MI->csh->detail_opt) { | 
| 1852 | 203k | #ifndef CAPSTONE_DIET | 
| 1853 | 203k |       uint8_t access; | 
| 1854 |  |  | 
| 1855 | 203k |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 1856 | 203k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 1857 | 203k |       MI->ac_idx++; | 
| 1858 | 203k | #endif | 
| 1859 | 203k |       unsigned regForDetail = isZReg ? Reg : AArch64_map_vregister(Reg); | 
| 1860 | 203k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 1861 | 203k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = regForDetail; | 
| 1862 | 203k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].vas = vas; | 
| 1863 | 203k |       MI->flat_insn->detail->arm64.op_count++; | 
| 1864 | 203k |     } | 
| 1865 |  |  | 
| 1866 | 203k |     if (i + 1 != NumRegs) | 
| 1867 | 111k |       SStream_concat0(O, ", "); | 
| 1868 | 203k |   } | 
| 1869 |  |  | 
| 1870 | 92.8k |   SStream_concat0(O, "}"); | 
| 1871 | 92.8k | } | 
| 1872 |  |  | 
| 1873 |  | static void printTypedVectorList(MCInst *MI, unsigned OpNum, SStream *O, unsigned NumLanes, char LaneKind) | 
| 1874 | 92.8k | { | 
| 1875 | 92.8k |   char Suffix[32]; | 
| 1876 | 92.8k |   arm64_vas vas = 0; | 
| 1877 |  |  | 
| 1878 | 92.8k |   if (NumLanes) { | 
| 1879 | 42.1k |     cs_snprintf(Suffix, sizeof(Suffix), ".%u%c", NumLanes, LaneKind); | 
| 1880 |  |  | 
| 1881 | 42.1k |     switch(LaneKind) { | 
| 1882 | 0 |       default: break; | 
| 1883 | 12.4k |       case 'b': | 
| 1884 | 12.4k |         switch(NumLanes) { | 
| 1885 | 0 |           default: break; | 
| 1886 | 0 |           case 1: | 
| 1887 | 0 |                vas = ARM64_VAS_1B; | 
| 1888 | 0 |                break; | 
| 1889 | 0 |           case 4: | 
| 1890 | 0 |                vas = ARM64_VAS_4B; | 
| 1891 | 0 |                break; | 
| 1892 | 5.53k |           case 8: | 
| 1893 | 5.53k |                vas = ARM64_VAS_8B; | 
| 1894 | 5.53k |                break; | 
| 1895 | 6.88k |           case 16: | 
| 1896 | 6.88k |                vas = ARM64_VAS_16B; | 
| 1897 | 6.88k |                break; | 
| 1898 | 12.4k |         } | 
| 1899 | 12.4k |         break; | 
| 1900 | 12.4k |       case 'h': | 
| 1901 | 8.99k |         switch(NumLanes) { | 
| 1902 | 0 |           default: break; | 
| 1903 | 0 |           case 1: | 
| 1904 | 0 |                vas = ARM64_VAS_1H; | 
| 1905 | 0 |                break; | 
| 1906 | 0 |           case 2: | 
| 1907 | 0 |                vas = ARM64_VAS_2H; | 
| 1908 | 0 |                break; | 
| 1909 | 3.92k |           case 4: | 
| 1910 | 3.92k |                vas = ARM64_VAS_4H; | 
| 1911 | 3.92k |                break; | 
| 1912 | 5.06k |           case 8: | 
| 1913 | 5.06k |                vas = ARM64_VAS_8H; | 
| 1914 | 5.06k |                break; | 
| 1915 | 8.99k |         } | 
| 1916 | 8.99k |         break; | 
| 1917 | 12.2k |       case 's': | 
| 1918 | 12.2k |         switch(NumLanes) { | 
| 1919 | 0 |           default: break; | 
| 1920 | 0 |           case 1: | 
| 1921 | 0 |                vas = ARM64_VAS_1S; | 
| 1922 | 0 |                break; | 
| 1923 | 5.94k |           case 2: | 
| 1924 | 5.94k |                vas = ARM64_VAS_2S; | 
| 1925 | 5.94k |                break; | 
| 1926 | 6.28k |           case 4: | 
| 1927 | 6.28k |                vas = ARM64_VAS_4S; | 
| 1928 | 6.28k |                break; | 
| 1929 | 12.2k |         } | 
| 1930 | 12.2k |         break; | 
| 1931 | 12.2k |       case 'd': | 
| 1932 | 8.52k |         switch(NumLanes) { | 
| 1933 | 0 |           default: break; | 
| 1934 | 4.29k |           case 1: | 
| 1935 | 4.29k |                vas = ARM64_VAS_1D; | 
| 1936 | 4.29k |                break; | 
| 1937 | 4.22k |           case 2: | 
| 1938 | 4.22k |                vas = ARM64_VAS_2D; | 
| 1939 | 4.22k |                break; | 
| 1940 | 8.52k |         } | 
| 1941 | 8.52k |         break; | 
| 1942 | 8.52k |       case 'q': | 
| 1943 | 0 |         switch(NumLanes) { | 
| 1944 | 0 |           default: break; | 
| 1945 | 0 |           case 1: | 
| 1946 | 0 |                vas = ARM64_VAS_1Q; | 
| 1947 | 0 |                break; | 
| 1948 | 0 |         } | 
| 1949 | 0 |         break; | 
| 1950 | 42.1k |     } | 
| 1951 | 50.6k |   } else { | 
| 1952 | 50.6k |     cs_snprintf(Suffix, sizeof(Suffix), ".%c", LaneKind); | 
| 1953 |  |  | 
| 1954 | 50.6k |     switch(LaneKind) { | 
| 1955 | 0 |       default: break; | 
| 1956 | 8.99k |       case 'b': | 
| 1957 | 8.99k |            vas = ARM64_VAS_1B; | 
| 1958 | 8.99k |            break; | 
| 1959 | 11.2k |       case 'h': | 
| 1960 | 11.2k |            vas = ARM64_VAS_1H; | 
| 1961 | 11.2k |            break; | 
| 1962 | 11.6k |       case 's': | 
| 1963 | 11.6k |            vas = ARM64_VAS_1S; | 
| 1964 | 11.6k |            break; | 
| 1965 | 18.7k |       case 'd': | 
| 1966 | 18.7k |            vas = ARM64_VAS_1D; | 
| 1967 | 18.7k |            break; | 
| 1968 | 0 |       case 'q': | 
| 1969 | 0 |            vas = ARM64_VAS_1Q; | 
| 1970 | 0 |            break; | 
| 1971 | 50.6k |     } | 
| 1972 | 50.6k |   } | 
| 1973 |  |  | 
| 1974 | 92.8k |   printVectorList(MI, OpNum, O, Suffix, MI->MRI, vas); | 
| 1975 | 92.8k | } | 
| 1976 |  |  | 
| 1977 |  | static void printVectorIndex(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1978 | 43.8k | { | 
| 1979 | 43.8k |   SStream_concat0(O, "["); | 
| 1980 | 43.8k |   printInt32(O, (int)MCOperand_getImm(MCInst_getOperand(MI, OpNum))); | 
| 1981 | 43.8k |   SStream_concat0(O, "]"); | 
| 1982 |  |  | 
| 1983 | 43.8k |   if (MI->csh->detail_opt) { | 
| 1984 | 43.8k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count - 1].vector_index = (int)MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 1985 | 43.8k |   } | 
| 1986 | 43.8k | } | 
| 1987 |  |  | 
| 1988 |  | static void printAlignedLabel(MCInst *MI, unsigned OpNum, SStream *O) | 
| 1989 | 13.9k | { | 
| 1990 | 13.9k |   MCOperand *Op = MCInst_getOperand(MI, OpNum); | 
| 1991 |  |  | 
| 1992 |  |   // If the label has already been resolved to an immediate offset (say, when | 
| 1993 |  |   // we're running the disassembler), just print the immediate. | 
| 1994 | 13.9k |   if (MCOperand_isImm(Op)) { | 
| 1995 | 13.9k |     uint64_t imm = (MCOperand_getImm(Op) * 4) + MI->address; | 
| 1996 | 13.9k |     printUInt64Bang(O, imm); | 
| 1997 |  |  | 
| 1998 | 13.9k |     if (MI->csh->detail_opt) { | 
| 1999 | 13.9k | #ifndef CAPSTONE_DIET | 
| 2000 | 13.9k |       uint8_t access; | 
| 2001 |  |  | 
| 2002 | 13.9k |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2003 | 13.9k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2004 | 13.9k |       MI->ac_idx++; | 
| 2005 | 13.9k | #endif | 
| 2006 | 13.9k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 2007 | 13.9k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = imm; | 
| 2008 | 13.9k |       MI->flat_insn->detail->arm64.op_count++; | 
| 2009 | 13.9k |     } | 
| 2010 | 13.9k |   } | 
| 2011 | 13.9k | } | 
| 2012 |  |  | 
| 2013 |  | static void printAdrpLabel(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2014 | 1.96k | { | 
| 2015 | 1.96k |   MCOperand *Op = MCInst_getOperand(MI, OpNum); | 
| 2016 |  |  | 
| 2017 | 1.96k |   if (MCOperand_isImm(Op)) { | 
| 2018 |  |     // ADRP sign extends a 21-bit offset, shifts it left by 12 | 
| 2019 |  |     // and adds it to the value of the PC with its bottom 12 bits cleared | 
| 2020 | 1.96k |     uint64_t imm = (MCOperand_getImm(Op) * 0x1000) + (MI->address & ~0xfff); | 
| 2021 | 1.96k |     printUInt64Bang(O, imm); | 
| 2022 |  |  | 
| 2023 | 1.96k |     if (MI->csh->detail_opt) { | 
| 2024 | 1.96k | #ifndef CAPSTONE_DIET | 
| 2025 | 1.96k |       uint8_t access; | 
| 2026 |  |  | 
| 2027 | 1.96k |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2028 | 1.96k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2029 | 1.96k |       MI->ac_idx++; | 
| 2030 | 1.96k | #endif | 
| 2031 | 1.96k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 2032 | 1.96k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = imm; | 
| 2033 | 1.96k |       MI->flat_insn->detail->arm64.op_count++; | 
| 2034 | 1.96k |     } | 
| 2035 | 1.96k |   } | 
| 2036 | 1.96k | } | 
| 2037 |  |  | 
| 2038 |  | static void printBarrierOption(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2039 | 102 | { | 
| 2040 | 102 |   unsigned Val = (unsigned)MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2041 | 102 |   unsigned Opcode = MCInst_getOpcode(MI); | 
| 2042 | 102 |   const char *Name = NULL; | 
| 2043 |  |  | 
| 2044 | 102 |   if (Opcode == AArch64_ISB) { | 
| 2045 | 18 |     const ISB *ISB = lookupISBByEncoding(Val); | 
| 2046 | 18 |     Name = ISB ? ISB->Name : NULL; | 
| 2047 | 84 |   } else if (Opcode == AArch64_TSB) { | 
| 2048 | 0 |     const TSB *TSB = lookupTSBByEncoding(Val); | 
| 2049 | 0 |     Name = TSB ? TSB->Name : NULL; | 
| 2050 | 84 |   } else { | 
| 2051 | 84 |     const DB *DB = lookupDBByEncoding(Val); | 
| 2052 | 84 |     Name = DB ? DB->Name : NULL; | 
| 2053 | 84 |   } | 
| 2054 |  |  | 
| 2055 | 102 |   if (Name) { | 
| 2056 | 38 |     SStream_concat0(O, Name); | 
| 2057 |  |  | 
| 2058 | 38 |     if (MI->csh->detail_opt) { | 
| 2059 | 38 | #ifndef CAPSTONE_DIET | 
| 2060 | 38 |       uint8_t access; | 
| 2061 |  |  | 
| 2062 | 38 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2063 | 38 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2064 | 38 |       MI->ac_idx++; | 
| 2065 | 38 | #endif | 
| 2066 | 38 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_BARRIER; | 
| 2067 | 38 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].barrier = Val; | 
| 2068 | 38 |       MI->flat_insn->detail->arm64.op_count++; | 
| 2069 | 38 |     } | 
| 2070 | 64 |   } else { | 
| 2071 | 64 |     printUInt32Bang(O, Val); | 
| 2072 |  |  | 
| 2073 | 64 |     if (MI->csh->detail_opt) { | 
| 2074 | 64 | #ifndef CAPSTONE_DIET | 
| 2075 | 64 |       uint8_t access; | 
| 2076 |  |  | 
| 2077 | 64 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2078 | 64 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2079 | 64 |       MI->ac_idx++; | 
| 2080 | 64 | #endif | 
| 2081 | 64 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 2082 | 64 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = Val; | 
| 2083 | 64 |       MI->flat_insn->detail->arm64.op_count++; | 
| 2084 | 64 |     } | 
| 2085 | 64 |   } | 
| 2086 | 102 | } | 
| 2087 |  |  | 
| 2088 | 17 | static void printBarriernXSOption(MCInst *MI, unsigned OpNo, SStream *O) { | 
| 2089 | 17 |   unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, OpNo)); | 
| 2090 |  |   // assert(MI->getOpcode() == AArch64::DSBnXS); | 
| 2091 |  |  | 
| 2092 | 17 |   const char *Name = NULL; | 
| 2093 | 17 |   const DBnXS *DB = lookupDBnXSByEncoding(Val); | 
| 2094 | 17 |   Name = DB ? DB->Name : NULL; | 
| 2095 |  |  | 
| 2096 | 17 |   if (Name) { | 
| 2097 | 17 |     SStream_concat0(O, Name); | 
| 2098 |  |  | 
| 2099 | 17 |     if (MI->csh->detail_opt) { | 
| 2100 | 17 | #ifndef CAPSTONE_DIET | 
| 2101 | 17 |       uint8_t access; | 
| 2102 |  |  | 
| 2103 | 17 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2104 | 17 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2105 | 17 |       MI->ac_idx++; | 
| 2106 | 17 | #endif | 
| 2107 | 17 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_BARRIER; | 
| 2108 | 17 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].barrier = Val; | 
| 2109 | 17 |       MI->flat_insn->detail->arm64.op_count++; | 
| 2110 | 17 |     } | 
| 2111 | 17 |   } | 
| 2112 | 0 |   else { | 
| 2113 | 0 |     printUInt32Bang(O, Val); | 
| 2114 |  | 
 | 
| 2115 | 0 |     if (MI->csh->detail_opt) { | 
| 2116 | 0 | #ifndef CAPSTONE_DIET | 
| 2117 | 0 |       uint8_t access; | 
| 2118 |  | 
 | 
| 2119 | 0 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2120 | 0 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2121 | 0 |       MI->ac_idx++; | 
| 2122 | 0 | #endif | 
| 2123 | 0 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 2124 | 0 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = Val; | 
| 2125 | 0 |       MI->flat_insn->detail->arm64.op_count++; | 
| 2126 | 0 |     } | 
| 2127 | 0 |   } | 
| 2128 | 17 | } | 
| 2129 |  |  | 
| 2130 |  | static void printMRSSystemRegister(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2131 | 2.32k | { | 
| 2132 | 2.32k |   unsigned Val = (unsigned)MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2133 | 2.32k |   const SysReg *Reg = lookupSysRegByEncoding(Val); | 
| 2134 |  |  | 
| 2135 |  |   // Horrible hack for the one register that has identical encodings but | 
| 2136 |  |   // different names in MSR and MRS. Because of this, one of MRS and MSR is | 
| 2137 |  |   // going to get the wrong entry | 
| 2138 | 2.32k |   if (Val == ARM64_SYSREG_DBGDTRRX_EL0) { | 
| 2139 | 18 |     SStream_concat0(O, "dbgdtrrx_el0"); | 
| 2140 |  |  | 
| 2141 | 18 |     if (MI->csh->detail_opt) { | 
| 2142 | 18 | #ifndef CAPSTONE_DIET | 
| 2143 | 18 |       uint8_t access; | 
| 2144 |  |  | 
| 2145 | 18 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2146 | 18 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2147 | 18 |       MI->ac_idx++; | 
| 2148 | 18 | #endif | 
| 2149 |  |  | 
| 2150 | 18 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_SYS; | 
| 2151 | 18 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].sys = Val; | 
| 2152 | 18 |       MI->flat_insn->detail->arm64.op_count++; | 
| 2153 | 18 |     } | 
| 2154 |  |  | 
| 2155 | 18 |     return; | 
| 2156 | 18 |   } | 
| 2157 |  |  | 
| 2158 |  |   // Another hack for a register which has an alternative name which is not an alias, | 
| 2159 |  |   // and is not in the Armv9-A documentation. | 
| 2160 | 2.30k |   if( Val == ARM64_SYSREG_VSCTLR_EL2){ | 
| 2161 | 24 |     SStream_concat0(O, "ttbr0_el2"); | 
| 2162 |  |  | 
| 2163 | 24 |     if (MI->csh->detail_opt) { | 
| 2164 | 24 | #ifndef CAPSTONE_DIET | 
| 2165 | 24 |       uint8_t access; | 
| 2166 |  |  | 
| 2167 | 24 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2168 | 24 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2169 | 24 |       MI->ac_idx++; | 
| 2170 | 24 | #endif | 
| 2171 |  |  | 
| 2172 | 24 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_SYS; | 
| 2173 | 24 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].sys = Val; | 
| 2174 | 24 |       MI->flat_insn->detail->arm64.op_count++; | 
| 2175 | 24 |     } | 
| 2176 |  |  | 
| 2177 | 24 |     return; | 
| 2178 | 24 |   } | 
| 2179 |  |  | 
| 2180 |  |   // if (Reg && Reg->Readable && Reg->haveFeatures(STI.getFeatureBits())) | 
| 2181 | 2.28k |   if (Reg && Reg->Readable) { | 
| 2182 | 265 |     SStream_concat0(O, Reg->Name); | 
| 2183 |  |  | 
| 2184 | 265 |     if (MI->csh->detail_opt) { | 
| 2185 | 265 | #ifndef CAPSTONE_DIET | 
| 2186 | 265 |       uint8_t access; | 
| 2187 |  |  | 
| 2188 | 265 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2189 | 265 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2190 | 265 |       MI->ac_idx++; | 
| 2191 | 265 | #endif | 
| 2192 |  |  | 
| 2193 | 265 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_SYS; | 
| 2194 | 265 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].sys = Reg->Encoding; | 
| 2195 | 265 |       MI->flat_insn->detail->arm64.op_count++; | 
| 2196 | 265 |     } | 
| 2197 | 2.01k |   } else { | 
| 2198 | 2.01k |     char result[128]; | 
| 2199 |  |  | 
| 2200 | 2.01k |     AArch64SysReg_genericRegisterString(Val, result); | 
| 2201 | 2.01k |     SStream_concat0(O, result); | 
| 2202 |  |  | 
| 2203 | 2.01k |     if (MI->csh->detail_opt) { | 
| 2204 | 2.01k | #ifndef CAPSTONE_DIET | 
| 2205 | 2.01k |       uint8_t access; | 
| 2206 | 2.01k |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2207 | 2.01k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2208 | 2.01k |       MI->ac_idx++; | 
| 2209 | 2.01k | #endif | 
| 2210 | 2.01k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG_MRS; | 
| 2211 | 2.01k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = Val; | 
| 2212 | 2.01k |       MI->flat_insn->detail->arm64.op_count++; | 
| 2213 | 2.01k |     } | 
| 2214 | 2.01k |   } | 
| 2215 | 2.28k | } | 
| 2216 |  |  | 
| 2217 |  | static void printMSRSystemRegister(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2218 | 1.23k | { | 
| 2219 | 1.23k |   unsigned Val = (unsigned)MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2220 | 1.23k |   const SysReg *Reg = lookupSysRegByEncoding(Val); | 
| 2221 |  |  | 
| 2222 |  |   // Horrible hack for the one register that has identical encodings but | 
| 2223 |  |   // different names in MSR and MRS. Because of this, one of MRS and MSR is | 
| 2224 |  |   // going to get the wrong entry | 
| 2225 | 1.23k |   if (Val == ARM64_SYSREG_DBGDTRTX_EL0) { | 
| 2226 | 37 |     SStream_concat0(O, "dbgdtrtx_el0"); | 
| 2227 |  |  | 
| 2228 | 37 |     if (MI->csh->detail_opt) { | 
| 2229 | 37 | #ifndef CAPSTONE_DIET | 
| 2230 | 37 |       uint8_t access; | 
| 2231 |  |  | 
| 2232 | 37 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2233 | 37 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2234 | 37 |       MI->ac_idx++; | 
| 2235 | 37 | #endif | 
| 2236 |  |  | 
| 2237 | 37 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_SYS; | 
| 2238 | 37 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].sys = Val; | 
| 2239 | 37 |       MI->flat_insn->detail->arm64.op_count++; | 
| 2240 | 37 |     } | 
| 2241 |  |  | 
| 2242 | 37 |     return; | 
| 2243 | 37 |   } | 
| 2244 |  |  | 
| 2245 |  |   // Another hack for a register which has an alternative name which is not an alias, | 
| 2246 |  |   // and is not in the Armv9-A documentation. | 
| 2247 | 1.19k |   if( Val == ARM64_SYSREG_VSCTLR_EL2){ | 
| 2248 | 16 |     SStream_concat0(O, "ttbr0_el2"); | 
| 2249 |  |  | 
| 2250 | 16 |     if (MI->csh->detail_opt) { | 
| 2251 | 16 | #ifndef CAPSTONE_DIET | 
| 2252 | 16 |       uint8_t access; | 
| 2253 |  |  | 
| 2254 | 16 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2255 | 16 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2256 | 16 |       MI->ac_idx++; | 
| 2257 | 16 | #endif | 
| 2258 |  |  | 
| 2259 | 16 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_SYS; | 
| 2260 | 16 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].sys = Val; | 
| 2261 | 16 |       MI->flat_insn->detail->arm64.op_count++; | 
| 2262 | 16 |     } | 
| 2263 |  |  | 
| 2264 | 16 |     return; | 
| 2265 | 16 |   } | 
| 2266 |  |  | 
| 2267 |  |   // if (Reg && Reg->Writeable && Reg->haveFeatures(STI.getFeatureBits())) | 
| 2268 | 1.17k |   if (Reg && Reg->Writeable) { | 
| 2269 | 50 |     SStream_concat0(O, Reg->Name); | 
| 2270 |  |  | 
| 2271 | 50 |     if (MI->csh->detail_opt) { | 
| 2272 | 50 | #ifndef CAPSTONE_DIET | 
| 2273 | 50 |       uint8_t access; | 
| 2274 |  |  | 
| 2275 | 50 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2276 | 50 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2277 | 50 |       MI->ac_idx++; | 
| 2278 | 50 | #endif | 
| 2279 |  |  | 
| 2280 | 50 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_SYS; | 
| 2281 | 50 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].sys = Reg->Encoding; | 
| 2282 | 50 |       MI->flat_insn->detail->arm64.op_count++; | 
| 2283 | 50 |     } | 
| 2284 | 1.12k |   } else { | 
| 2285 | 1.12k |     char result[128]; | 
| 2286 |  |  | 
| 2287 | 1.12k |     AArch64SysReg_genericRegisterString(Val, result); | 
| 2288 | 1.12k |     SStream_concat0(O, result); | 
| 2289 |  |  | 
| 2290 | 1.12k |     if (MI->csh->detail_opt) { | 
| 2291 | 1.12k | #ifndef CAPSTONE_DIET | 
| 2292 | 1.12k |       uint8_t access; | 
| 2293 | 1.12k |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2294 | 1.12k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2295 | 1.12k |       MI->ac_idx++; | 
| 2296 | 1.12k | #endif | 
| 2297 | 1.12k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG_MRS; | 
| 2298 | 1.12k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = Val; | 
| 2299 | 1.12k |       MI->flat_insn->detail->arm64.op_count++; | 
| 2300 | 1.12k |     } | 
| 2301 | 1.12k |   } | 
| 2302 | 1.17k | } | 
| 2303 |  |  | 
| 2304 |  | static void printSystemPStateField(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2305 | 41 | { | 
| 2306 | 41 |   unsigned Val = (unsigned)MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2307 |  |  | 
| 2308 | 41 |   const PState *PState = lookupPStateByEncoding(Val); | 
| 2309 |  |  | 
| 2310 | 41 |   if (PState) { | 
| 2311 | 41 |     SStream_concat0(O, PState->Name); | 
| 2312 |  |  | 
| 2313 | 41 |     if (MI->csh->detail_opt) { | 
| 2314 | 41 | #ifndef CAPSTONE_DIET | 
| 2315 | 41 |       uint8_t access; | 
| 2316 | 41 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2317 | 41 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2318 | 41 |       MI->ac_idx++; | 
| 2319 | 41 | #endif | 
| 2320 | 41 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_PSTATE; | 
| 2321 | 41 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].pstate = Val; | 
| 2322 | 41 |       MI->flat_insn->detail->arm64.op_count++; | 
| 2323 | 41 |     } | 
| 2324 | 41 |   } else { | 
| 2325 | 0 |     printUInt32Bang(O, Val); | 
| 2326 |  | 
 | 
| 2327 | 0 |     if (MI->csh->detail_opt) { | 
| 2328 | 0 | #ifndef CAPSTONE_DIET | 
| 2329 | 0 |       unsigned char access; | 
| 2330 |  | 
 | 
| 2331 | 0 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2332 | 0 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2333 | 0 |       MI->ac_idx++; | 
| 2334 | 0 | #endif | 
| 2335 |  | 
 | 
| 2336 | 0 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 2337 | 0 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = Val; | 
| 2338 | 0 |       MI->flat_insn->detail->arm64.op_count++; | 
| 2339 | 0 |     } | 
| 2340 | 0 |   } | 
| 2341 | 41 | } | 
| 2342 |  |  | 
| 2343 |  | static void printSIMDType10Operand(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2344 | 2.23k | { | 
| 2345 | 2.23k |   uint8_t RawVal = (uint8_t)MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2346 | 2.23k |   uint64_t Val = AArch64_AM_decodeAdvSIMDModImmType10(RawVal); | 
| 2347 |  |  | 
| 2348 | 2.23k |   SStream_concat(O, "#%#016llx", Val); | 
| 2349 |  |  | 
| 2350 | 2.23k |   if (MI->csh->detail_opt) { | 
| 2351 | 2.23k | #ifndef CAPSTONE_DIET | 
| 2352 | 2.23k |     unsigned char access; | 
| 2353 |  |  | 
| 2354 | 2.23k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2355 | 2.23k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2356 | 2.23k |     MI->ac_idx++; | 
| 2357 | 2.23k | #endif | 
| 2358 | 2.23k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM; | 
| 2359 | 2.23k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].imm = Val; | 
| 2360 | 2.23k |     MI->flat_insn->detail->arm64.op_count++; | 
| 2361 | 2.23k |   } | 
| 2362 | 2.23k | } | 
| 2363 |  |  | 
| 2364 |  | static void printComplexRotationOp(MCInst *MI, unsigned OpNum, SStream *O, int64_t Angle, int64_t Remainder) | 
| 2365 | 2.51k | { | 
| 2366 | 2.51k |   unsigned int Val = MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2367 | 2.51k |   printInt64Bang(O, (Val * Angle) + Remainder); | 
| 2368 | 2.51k |   op_addImm(MI, (Val * Angle) + Remainder); | 
| 2369 | 2.51k | } | 
| 2370 |  |  | 
| 2371 |  | static void printSVCROp(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2372 | 0 | { | 
| 2373 | 0 |   MCOperand *MO = MCInst_getOperand(MI, OpNum); | 
| 2374 |  |     // assert(MCOperand_isImm(MO) && "Unexpected operand type!"); | 
| 2375 | 0 |     unsigned svcrop = MCOperand_getImm(MO); | 
| 2376 | 0 |   const SVCR *svcr = lookupSVCRByEncoding(svcrop); | 
| 2377 |  |     // assert(svcr && "Unexpected SVCR operand!"); | 
| 2378 | 0 |   SStream_concat0(O, svcr->Name); | 
| 2379 |  | 
 | 
| 2380 | 0 |   if (MI->csh->detail_opt) { | 
| 2381 | 0 | #ifndef CAPSTONE_DIET | 
| 2382 | 0 |     uint8_t access; | 
| 2383 |  | 
 | 
| 2384 | 0 |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2385 | 0 |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2386 | 0 |     MI->ac_idx++; | 
| 2387 | 0 | #endif | 
| 2388 |  | 
 | 
| 2389 | 0 |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_SVCR; | 
| 2390 | 0 |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].sys = (unsigned)ARM64_SYSREG_SVCR; | 
| 2391 | 0 |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].svcr = svcr->Encoding; | 
| 2392 | 0 |     MI->flat_insn->detail->arm64.op_count++; | 
| 2393 | 0 |   } | 
| 2394 | 0 | } | 
| 2395 |  |  | 
| 2396 |  | static void printMatrix(MCInst *MI, unsigned OpNum, SStream *O, int EltSize) | 
| 2397 | 185 | { | 
| 2398 | 185 |   MCOperand *RegOp = MCInst_getOperand(MI, OpNum); | 
| 2399 |  |     // assert(MCOperand_isReg(RegOp) && "Unexpected operand type!"); | 
| 2400 | 185 |   unsigned Reg = MCOperand_getReg(RegOp); | 
| 2401 |  |  | 
| 2402 | 185 |   SStream_concat0(O, getRegisterName(Reg, AArch64_NoRegAltName)); | 
| 2403 | 185 |   const char *sizeStr = ""; | 
| 2404 | 185 |     switch (EltSize) { | 
| 2405 | 185 |     case 0: | 
| 2406 | 185 |     sizeStr = ""; | 
| 2407 | 185 |       break; | 
| 2408 | 0 |     case 8: | 
| 2409 | 0 |       sizeStr = ".b"; | 
| 2410 | 0 |       break; | 
| 2411 | 0 |     case 16: | 
| 2412 | 0 |       sizeStr = ".h"; | 
| 2413 | 0 |       break; | 
| 2414 | 0 |     case 32: | 
| 2415 | 0 |       sizeStr = ".s"; | 
| 2416 | 0 |       break; | 
| 2417 | 0 |     case 64: | 
| 2418 | 0 |       sizeStr = ".d"; | 
| 2419 | 0 |       break; | 
| 2420 | 0 |     case 128: | 
| 2421 | 0 |       sizeStr = ".q"; | 
| 2422 | 0 |       break; | 
| 2423 | 0 |     default: | 
| 2424 | 0 |     break; | 
| 2425 |  |     //   llvm_unreachable("Unsupported element size"); | 
| 2426 | 185 |     } | 
| 2427 | 185 |   SStream_concat0(O, sizeStr); | 
| 2428 |  |  | 
| 2429 | 185 |   if (MI->csh->detail_opt) { | 
| 2430 | 185 | #ifndef CAPSTONE_DIET | 
| 2431 | 185 |     uint8_t access; | 
| 2432 |  |  | 
| 2433 | 185 |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2434 | 185 |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2435 | 185 |     MI->ac_idx++; | 
| 2436 | 185 | #endif | 
| 2437 |  |  | 
| 2438 | 185 |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 2439 | 185 |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = Reg; | 
| 2440 | 185 |     MI->flat_insn->detail->arm64.op_count++; | 
| 2441 | 185 |   } | 
| 2442 | 185 | } | 
| 2443 |  |  | 
| 2444 |  | static void printMatrixIndex(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2445 | 7.44k | { | 
| 2446 | 7.44k |   int64_t imm = MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2447 | 7.44k |   printInt64(O, imm); | 
| 2448 |  |  | 
| 2449 | 7.44k |   if (MI->csh->detail_opt) { | 
| 2450 | 7.44k |     if (MI->csh->doing_SME_Index) { | 
| 2451 |  |       // Access op_count-1 as We want to add info to previous operand, not create a new one | 
| 2452 | 7.44k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count-1].sme_index.disp = imm; | 
| 2453 | 7.44k |     } | 
| 2454 | 7.44k |   } | 
| 2455 | 7.44k | } | 
| 2456 |  |  | 
| 2457 |  | static void printMatrixTile(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2458 | 1.66k | { | 
| 2459 | 1.66k |   MCOperand *RegOp = MCInst_getOperand(MI, OpNum); | 
| 2460 |  |     // assert(MCOperand_isReg(RegOp) && "Unexpected operand type!"); | 
| 2461 | 1.66k |   unsigned Reg = MCOperand_getReg(RegOp); | 
| 2462 | 1.66k |     SStream_concat0(O, getRegisterName(Reg, AArch64_NoRegAltName)); | 
| 2463 |  |  | 
| 2464 | 1.66k |   if (MI->csh->detail_opt) { | 
| 2465 | 1.66k | #ifndef CAPSTONE_DIET | 
| 2466 | 1.66k |     uint8_t access; | 
| 2467 |  |  | 
| 2468 | 1.66k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2469 | 1.66k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2470 | 1.66k |     MI->ac_idx++; | 
| 2471 | 1.66k | #endif | 
| 2472 |  |  | 
| 2473 | 1.66k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 2474 | 1.66k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = Reg; | 
| 2475 | 1.66k |     MI->flat_insn->detail->arm64.op_count++; | 
| 2476 | 1.66k |   } | 
| 2477 | 1.66k | } | 
| 2478 |  |  | 
| 2479 |  | static void printMatrixTileVector(MCInst *MI, unsigned OpNum, SStream *O, bool IsVertical) | 
| 2480 | 6.83k | { | 
| 2481 | 6.83k |   MCOperand *RegOp = MCInst_getOperand(MI, OpNum); | 
| 2482 |  |     // assert(MCOperand_isReg(RegOp) && "Unexpected operand type!"); | 
| 2483 | 6.83k |   unsigned Reg = MCOperand_getReg(RegOp); | 
| 2484 | 6.83k | #ifndef CAPSTONE_DIET | 
| 2485 | 6.83k |   const char *RegName = getRegisterName(Reg, AArch64_NoRegAltName); | 
| 2486 |  |  | 
| 2487 | 6.83k |   const size_t strLn = strlen(RegName); | 
| 2488 |  |   // +2 for extra chars, + 1 for null char \0 | 
| 2489 | 6.83k |   char *RegNameNew = cs_mem_malloc(sizeof(char) * (strLn + 2 + 1)); | 
| 2490 | 6.83k |   int index = 0, i; | 
| 2491 | 54.9k |   for (i = 0; i < (strLn + 2); i++){ | 
| 2492 | 48.1k |     if(RegName[i] != '.'){ | 
| 2493 | 41.3k |       RegNameNew[index] = RegName[i]; | 
| 2494 | 41.3k |       index++; | 
| 2495 | 41.3k |     } | 
| 2496 | 6.83k |     else{ | 
| 2497 | 6.83k |       RegNameNew[index] = IsVertical ? 'v' : 'h'; | 
| 2498 | 6.83k |       RegNameNew[index + 1] = '.'; | 
| 2499 | 6.83k |       index += 2; | 
| 2500 | 6.83k |     } | 
| 2501 | 48.1k |   } | 
| 2502 | 6.83k |   SStream_concat0(O, RegNameNew); | 
| 2503 | 6.83k | #endif | 
| 2504 |  |  | 
| 2505 | 6.83k |   if (MI->csh->detail_opt) { | 
| 2506 | 6.83k | #ifndef CAPSTONE_DIET | 
| 2507 | 6.83k |     uint8_t access; | 
| 2508 |  |  | 
| 2509 | 6.83k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2510 | 6.83k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2511 | 6.83k |     MI->ac_idx++; | 
| 2512 | 6.83k | #endif | 
| 2513 |  |  | 
| 2514 | 6.83k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 2515 | 6.83k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = Reg; | 
| 2516 | 6.83k |     MI->flat_insn->detail->arm64.op_count++; | 
| 2517 | 6.83k |   } | 
| 2518 | 6.83k | #ifndef CAPSTONE_DIET | 
| 2519 | 6.83k |   cs_mem_free(RegNameNew); | 
| 2520 | 6.83k | #endif | 
| 2521 | 6.83k | } | 
| 2522 |  |  | 
| 2523 |  | static const unsigned MatrixZADRegisterTable[] = { | 
| 2524 |  |   AArch64_ZAD0, AArch64_ZAD1, AArch64_ZAD2, AArch64_ZAD3, | 
| 2525 |  |   AArch64_ZAD4, AArch64_ZAD5, AArch64_ZAD6, AArch64_ZAD7 | 
| 2526 |  | }; | 
| 2527 |  |  | 
| 2528 | 192 | static void printMatrixTileList(MCInst *MI, unsigned OpNum, SStream *O){ | 
| 2529 | 192 |   unsigned MaxRegs = 8; | 
| 2530 | 192 |   unsigned RegMask = MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2531 |  |  | 
| 2532 | 192 |   unsigned NumRegs = 0, I; | 
| 2533 | 1.72k |   for (I = 0; I < MaxRegs; ++I) | 
| 2534 | 1.53k |     if ((RegMask & (1 << I)) != 0) | 
| 2535 | 576 |       ++NumRegs; | 
| 2536 |  |  | 
| 2537 | 192 |   SStream_concat0(O, "{"); | 
| 2538 | 192 |   unsigned Printed = 0, J; | 
| 2539 | 1.72k |   for (J = 0; J < MaxRegs; ++J) { | 
| 2540 | 1.53k |     unsigned Reg = RegMask & (1 << J); | 
| 2541 | 1.53k |     if (Reg == 0) | 
| 2542 | 960 |       continue; | 
| 2543 | 576 |     SStream_concat0(O, getRegisterName(MatrixZADRegisterTable[J], AArch64_NoRegAltName)); | 
| 2544 |  |  | 
| 2545 | 576 |     if (MI->csh->detail_opt) { | 
| 2546 | 576 | #ifndef CAPSTONE_DIET | 
| 2547 | 576 |       uint8_t access; | 
| 2548 |  |  | 
| 2549 | 576 |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2550 | 576 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2551 | 576 |       MI->ac_idx++; | 
| 2552 | 576 | #endif | 
| 2553 |  |  | 
| 2554 | 576 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 2555 | 576 |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = MatrixZADRegisterTable[J]; | 
| 2556 | 576 |       MI->flat_insn->detail->arm64.op_count++; | 
| 2557 | 576 |     } | 
| 2558 |  |  | 
| 2559 | 576 |     if (Printed + 1 != NumRegs) | 
| 2560 | 385 |       SStream_concat0(O, ", "); | 
| 2561 | 576 |     ++Printed; | 
| 2562 | 576 |   } | 
| 2563 | 192 |   SStream_concat0(O, "}"); | 
| 2564 | 192 | } | 
| 2565 |  |  | 
| 2566 |  | static void printSVEPattern(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2567 | 2.65k | { | 
| 2568 | 2.65k |   unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2569 |  |  | 
| 2570 | 2.65k |   const SVEPREDPAT *Pat = lookupSVEPREDPATByEncoding(Val); | 
| 2571 | 2.65k |   if (Pat) | 
| 2572 | 1.30k |     SStream_concat0(O, Pat->Name); | 
| 2573 | 1.34k |   else | 
| 2574 | 1.34k |     printUInt32Bang(O, Val); | 
| 2575 | 2.65k | } | 
| 2576 |  |  | 
| 2577 |  | // default suffix = 0 | 
| 2578 |  | static void printSVERegOp(MCInst *MI, unsigned OpNum, SStream *O, char suffix) | 
| 2579 | 144k | { | 
| 2580 | 144k |   unsigned int Reg; | 
| 2581 |  |  | 
| 2582 |  | #if 0 | 
| 2583 |  |   switch (suffix) { | 
| 2584 |  |     case 0: | 
| 2585 |  |     case 'b': | 
| 2586 |  |     case 'h': | 
| 2587 |  |     case 's': | 
| 2588 |  |     case 'd': | 
| 2589 |  |     case 'q': | 
| 2590 |  |       break; | 
| 2591 |  |     default: | 
| 2592 |  |       // llvm_unreachable("Invalid kind specifier."); | 
| 2593 |  |   } | 
| 2594 |  | #endif | 
| 2595 |  |  | 
| 2596 | 144k |   Reg = MCOperand_getReg(MCInst_getOperand(MI, OpNum)); | 
| 2597 |  |  | 
| 2598 | 144k |   if (MI->csh->detail_opt) { | 
| 2599 | 144k | #ifndef CAPSTONE_DIET | 
| 2600 | 144k |       uint8_t access; | 
| 2601 |  |  | 
| 2602 | 144k |       access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2603 | 144k |       MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2604 | 144k |       MI->ac_idx++; | 
| 2605 | 144k | #endif | 
| 2606 | 144k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 2607 | 144k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = Reg; | 
| 2608 | 144k |     MI->flat_insn->detail->arm64.op_count++; | 
| 2609 | 144k |   } | 
| 2610 |  |  | 
| 2611 | 144k |   SStream_concat0(O, getRegisterName(Reg, AArch64_NoRegAltName)); | 
| 2612 |  |  | 
| 2613 | 144k |   if (suffix != '\0') | 
| 2614 | 93.6k |     SStream_concat(O, ".%c", suffix); | 
| 2615 | 144k | } | 
| 2616 |  |  | 
| 2617 |  | static void printImmSVE16(int16_t Val, SStream *O) | 
| 2618 | 3.50k | { | 
| 2619 | 3.50k |   printUInt32Bang(O, Val); | 
| 2620 | 3.50k | } | 
| 2621 |  |  | 
| 2622 |  | static void printImmSVE32(int32_t Val, SStream *O) | 
| 2623 | 1.07k | { | 
| 2624 | 1.07k |   printUInt32Bang(O, Val); | 
| 2625 | 1.07k | } | 
| 2626 |  |  | 
| 2627 |  | static void printImmSVE64(int64_t Val, SStream *O) | 
| 2628 | 2.04k | { | 
| 2629 | 2.04k |   printUInt64Bang(O, Val); | 
| 2630 | 2.04k | } | 
| 2631 |  |  | 
| 2632 |  | static void printImm8OptLsl32(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2633 | 1.44k | { | 
| 2634 | 1.44k |   unsigned UnscaledVal = MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2635 | 1.44k |   unsigned Shift = MCOperand_getImm(MCInst_getOperand(MI, OpNum + 1)); | 
| 2636 | 1.44k |   uint32_t Val; | 
| 2637 |  |  | 
| 2638 |  |   // assert(AArch64_AM::getShiftType(Shift) == AArch64_AM::LSL && | 
| 2639 |  |   //  "Unexepected shift type!"); | 
| 2640 |  |  | 
| 2641 |  |   // #0 lsl #8 is never pretty printed | 
| 2642 | 1.44k |   if ((UnscaledVal == 0) && (AArch64_AM_getShiftValue(Shift) != 0)) { | 
| 2643 | 362 |     printUInt32Bang(O, UnscaledVal); | 
| 2644 | 362 |     printShifter(MI, OpNum + 1, O); | 
| 2645 | 362 |     return; | 
| 2646 | 362 |   } | 
| 2647 |  |  | 
| 2648 | 1.07k |   Val = UnscaledVal * (1 << AArch64_AM_getShiftValue(Shift)); | 
| 2649 | 1.07k |   printImmSVE32(Val, O); | 
| 2650 | 1.07k | } | 
| 2651 |  |  | 
| 2652 |  | static void printImm8OptLsl64(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2653 | 1.95k | { | 
| 2654 | 1.95k |   unsigned UnscaledVal = MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2655 | 1.95k |   unsigned Shift = MCOperand_getImm(MCInst_getOperand(MI, OpNum + 1)); | 
| 2656 | 1.95k |   uint64_t Val; | 
| 2657 |  |  | 
| 2658 |  |   // assert(AArch64_AM::getShiftType(Shift) == AArch64_AM::LSL && | 
| 2659 |  |   //  "Unexepected shift type!"); | 
| 2660 |  |  | 
| 2661 |  |   // #0 lsl #8 is never pretty printed | 
| 2662 | 1.95k |   if ((UnscaledVal == 0) && (AArch64_AM_getShiftValue(Shift) != 0)) { | 
| 2663 | 329 |     printUInt32Bang(O, UnscaledVal); | 
| 2664 | 329 |     printShifter(MI, OpNum + 1, O); | 
| 2665 | 329 |     return; | 
| 2666 | 329 |   } | 
| 2667 |  |  | 
| 2668 | 1.62k |   Val = UnscaledVal * (1 << AArch64_AM_getShiftValue(Shift)); | 
| 2669 | 1.62k |   printImmSVE64(Val, O); | 
| 2670 | 1.62k | } | 
| 2671 |  |  | 
| 2672 |  | static void printSVELogicalImm16(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2673 | 3.37k | { | 
| 2674 | 3.37k |   uint64_t Val = MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2675 | 3.37k |   uint64_t PrintVal = AArch64_AM_decodeLogicalImmediate(Val, 64); | 
| 2676 |  |  | 
| 2677 |  |   // Prefer the default format for 16bit values, hex otherwise. | 
| 2678 | 3.37k |   printImmSVE16(PrintVal, O); | 
| 2679 | 3.37k | } | 
| 2680 |  |  | 
| 2681 |  | static void printSVELogicalImm32(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2682 | 916 | { | 
| 2683 | 916 |   uint64_t Val = MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2684 | 916 |   uint64_t PrintVal = AArch64_AM_decodeLogicalImmediate(Val, 64); | 
| 2685 |  |  | 
| 2686 |  |   // Prefer the default format for 16bit values, hex otherwise. | 
| 2687 | 916 |   if ((uint16_t)PrintVal == (uint32_t)PrintVal) | 
| 2688 | 126 |     printImmSVE16(PrintVal, O); | 
| 2689 | 790 |   else | 
| 2690 | 790 |     printUInt64Bang(O, PrintVal); | 
| 2691 | 916 | } | 
| 2692 |  |  | 
| 2693 |  | static void printSVELogicalImm64(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2694 | 425 | { | 
| 2695 | 425 |   uint64_t Val = MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2696 | 425 |   uint64_t PrintVal = AArch64_AM_decodeLogicalImmediate(Val, 64); | 
| 2697 |  |  | 
| 2698 | 425 |   printImmSVE64(PrintVal, O); | 
| 2699 | 425 | } | 
| 2700 |  |  | 
| 2701 |  | static void printZPRasFPR(MCInst *MI, unsigned OpNum, SStream *O, int Width) | 
| 2702 | 2.10k | { | 
| 2703 | 2.10k |   unsigned int Base, Reg; | 
| 2704 |  |  | 
| 2705 | 2.10k |   switch (Width) { | 
| 2706 | 0 |     default: // llvm_unreachable("Unsupported width"); | 
| 2707 | 83 |     case 8:   Base = AArch64_B0; break; | 
| 2708 | 938 |     case 16:  Base = AArch64_H0; break; | 
| 2709 | 651 |     case 32:  Base = AArch64_S0; break; | 
| 2710 | 414 |     case 64:  Base = AArch64_D0; break; | 
| 2711 | 19 |     case 128: Base = AArch64_Q0; break; | 
| 2712 | 2.10k |   } | 
| 2713 |  |  | 
| 2714 | 2.10k |   Reg = MCOperand_getReg(MCInst_getOperand(MI, OpNum)) - AArch64_Z0 + Base; | 
| 2715 |  |  | 
| 2716 | 2.10k |   SStream_concat0(O, getRegisterName(Reg, AArch64_NoRegAltName)); | 
| 2717 |  |  | 
| 2718 | 2.10k |   if (MI->csh->detail_opt) { | 
| 2719 | 2.10k | #ifndef CAPSTONE_DIET | 
| 2720 | 2.10k |     uint8_t access; | 
| 2721 |  |  | 
| 2722 | 2.10k |     access = get_op_access(MI->csh, MCInst_getOpcode(MI), MI->ac_idx); | 
| 2723 | 2.10k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].access = access; | 
| 2724 | 2.10k |     MI->ac_idx++; | 
| 2725 | 2.10k | #endif | 
| 2726 | 2.10k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_REG; | 
| 2727 | 2.10k |     MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].reg = Reg; | 
| 2728 | 2.10k |     MI->flat_insn->detail->arm64.op_count++; | 
| 2729 | 2.10k |   } | 
| 2730 | 2.10k | } | 
| 2731 |  |  | 
| 2732 |  | static void printExactFPImm(MCInst *MI, unsigned OpNum, SStream *O, unsigned ImmIs0, unsigned ImmIs1) | 
| 2733 | 601 | { | 
| 2734 | 601 |   const ExactFPImm *Imm0Desc = lookupExactFPImmByEnum(ImmIs0); | 
| 2735 | 601 |   const ExactFPImm *Imm1Desc = lookupExactFPImmByEnum(ImmIs1); | 
| 2736 | 601 |   unsigned Val = MCOperand_getImm(MCInst_getOperand(MI, OpNum)); | 
| 2737 |  |  | 
| 2738 | 601 |   SStream_concat0(O, Val ? Imm1Desc->Repr : Imm0Desc->Repr); | 
| 2739 | 601 | } | 
| 2740 |  |  | 
| 2741 |  | static void printGPR64as32(MCInst *MI, unsigned OpNum, SStream *O) | 
| 2742 | 2.14k | { | 
| 2743 | 2.14k |   unsigned int Reg = MCOperand_getReg(MCInst_getOperand(MI, OpNum)); | 
| 2744 |  |  | 
| 2745 | 2.14k |   SStream_concat0(O, getRegisterName(getWRegFromXReg(Reg), AArch64_NoRegAltName)); | 
| 2746 | 2.14k | } | 
| 2747 |  |  | 
| 2748 |  | static void printGPR64x8(MCInst *MI, unsigned OpNum, SStream *O)  | 
| 2749 | 392 | { | 
| 2750 | 392 |     unsigned int Reg = MCOperand_getReg(MCInst_getOperand(MI, OpNum)); | 
| 2751 |  |  | 
| 2752 | 392 |     SStream_concat0(O, getRegisterName(MCRegisterInfo_getSubReg(MI->MRI, Reg, AArch64_x8sub_0), AArch64_NoRegAltName)); | 
| 2753 | 392 | } | 
| 2754 |  |  | 
| 2755 |  | #define PRINT_ALIAS_INSTR | 
| 2756 |  | #include "AArch64GenAsmWriter.inc" | 
| 2757 |  | #include "AArch64GenRegisterName.inc" | 
| 2758 |  |  | 
| 2759 |  | void AArch64_post_printer(csh handle, cs_insn *flat_insn, char *insn_asm, MCInst *mci) | 
| 2760 | 353k | { | 
| 2761 | 353k |   if (((cs_struct *)handle)->detail_opt != CS_OPT_ON) | 
| 2762 | 0 |     return; | 
| 2763 |  |  | 
| 2764 | 353k |   if (mci->csh->detail_opt) { | 
| 2765 | 353k |     unsigned opcode = MCInst_getOpcode(mci); | 
| 2766 |  |  | 
| 2767 | 353k |     switch (opcode) { | 
| 2768 | 280k |       default: | 
| 2769 | 280k |         break; | 
| 2770 | 280k |       case AArch64_LD1Fourv16b_POST: | 
| 2771 | 505 |       case AArch64_LD1Fourv1d_POST: | 
| 2772 | 638 |       case AArch64_LD1Fourv2d_POST: | 
| 2773 | 1.29k |       case AArch64_LD1Fourv2s_POST: | 
| 2774 | 1.33k |       case AArch64_LD1Fourv4h_POST: | 
| 2775 | 1.92k |       case AArch64_LD1Fourv4s_POST: | 
| 2776 | 2.23k |       case AArch64_LD1Fourv8b_POST: | 
| 2777 | 3.07k |       case AArch64_LD1Fourv8h_POST: | 
| 2778 | 3.58k |       case AArch64_LD1Onev16b_POST: | 
| 2779 | 3.82k |       case AArch64_LD1Onev1d_POST: | 
| 2780 | 4.00k |       case AArch64_LD1Onev2d_POST: | 
| 2781 | 5.26k |       case AArch64_LD1Onev2s_POST: | 
| 2782 | 5.43k |       case AArch64_LD1Onev4h_POST: | 
| 2783 | 5.55k |       case AArch64_LD1Onev4s_POST: | 
| 2784 | 7.04k |       case AArch64_LD1Onev8b_POST: | 
| 2785 | 7.36k |       case AArch64_LD1Onev8h_POST: | 
| 2786 | 7.40k |       case AArch64_LD1Rv16b_POST: | 
| 2787 | 7.47k |       case AArch64_LD1Rv1d_POST: | 
| 2788 | 7.69k |       case AArch64_LD1Rv2d_POST: | 
| 2789 | 7.95k |       case AArch64_LD1Rv2s_POST: | 
| 2790 | 8.02k |       case AArch64_LD1Rv4h_POST: | 
| 2791 | 8.17k |       case AArch64_LD1Rv4s_POST: | 
| 2792 | 8.24k |       case AArch64_LD1Rv8b_POST: | 
| 2793 | 8.66k |       case AArch64_LD1Rv8h_POST: | 
| 2794 | 8.93k |       case AArch64_LD1Threev16b_POST: | 
| 2795 | 9.01k |       case AArch64_LD1Threev1d_POST: | 
| 2796 | 9.05k |       case AArch64_LD1Threev2d_POST: | 
| 2797 | 9.06k |       case AArch64_LD1Threev2s_POST: | 
| 2798 | 9.09k |       case AArch64_LD1Threev4h_POST: | 
| 2799 | 9.12k |       case AArch64_LD1Threev4s_POST: | 
| 2800 | 9.24k |       case AArch64_LD1Threev8b_POST: | 
| 2801 | 9.47k |       case AArch64_LD1Threev8h_POST: | 
| 2802 | 9.51k |       case AArch64_LD1Twov16b_POST: | 
| 2803 | 10.8k |       case AArch64_LD1Twov1d_POST: | 
| 2804 | 10.9k |       case AArch64_LD1Twov2d_POST: | 
| 2805 | 10.9k |       case AArch64_LD1Twov2s_POST: | 
| 2806 | 11.1k |       case AArch64_LD1Twov4h_POST: | 
| 2807 | 11.4k |       case AArch64_LD1Twov4s_POST: | 
| 2808 | 11.5k |       case AArch64_LD1Twov8b_POST: | 
| 2809 | 11.6k |       case AArch64_LD1Twov8h_POST: | 
| 2810 | 11.7k |       case AArch64_LD1i16_POST: | 
| 2811 | 12.9k |       case AArch64_LD1i32_POST: | 
| 2812 | 13.7k |       case AArch64_LD1i64_POST: | 
| 2813 | 14.5k |       case AArch64_LD1i8_POST: | 
| 2814 | 14.9k |       case AArch64_LD2Rv16b_POST: | 
| 2815 | 14.9k |       case AArch64_LD2Rv1d_POST: | 
| 2816 | 15.3k |       case AArch64_LD2Rv2d_POST: | 
| 2817 | 15.5k |       case AArch64_LD2Rv2s_POST: | 
| 2818 | 15.5k |       case AArch64_LD2Rv4h_POST: | 
| 2819 | 17.9k |       case AArch64_LD2Rv4s_POST: | 
| 2820 | 17.9k |       case AArch64_LD2Rv8b_POST: | 
| 2821 | 17.9k |       case AArch64_LD2Rv8h_POST: | 
| 2822 | 18.2k |       case AArch64_LD2Twov16b_POST: | 
| 2823 | 18.2k |       case AArch64_LD2Twov2d_POST: | 
| 2824 | 18.2k |       case AArch64_LD2Twov2s_POST: | 
| 2825 | 19.2k |       case AArch64_LD2Twov4h_POST: | 
| 2826 | 19.3k |       case AArch64_LD2Twov4s_POST: | 
| 2827 | 19.7k |       case AArch64_LD2Twov8b_POST: | 
| 2828 | 20.2k |       case AArch64_LD2Twov8h_POST: | 
| 2829 | 20.5k |       case AArch64_LD2i16_POST: | 
| 2830 | 20.6k |       case AArch64_LD2i32_POST: | 
| 2831 | 22.2k |       case AArch64_LD2i64_POST: | 
| 2832 | 22.3k |       case AArch64_LD2i8_POST: | 
| 2833 | 22.9k |       case AArch64_LD3Rv16b_POST: | 
| 2834 | 23.1k |       case AArch64_LD3Rv1d_POST: | 
| 2835 | 23.2k |       case AArch64_LD3Rv2d_POST: | 
| 2836 | 23.2k |       case AArch64_LD3Rv2s_POST: | 
| 2837 | 23.2k |       case AArch64_LD3Rv4h_POST: | 
| 2838 | 23.2k |       case AArch64_LD3Rv4s_POST: | 
| 2839 | 23.2k |       case AArch64_LD3Rv8b_POST: | 
| 2840 | 23.3k |       case AArch64_LD3Rv8h_POST: | 
| 2841 | 23.5k |       case AArch64_LD3Threev16b_POST: | 
| 2842 | 23.6k |       case AArch64_LD3Threev2d_POST: | 
| 2843 | 23.7k |       case AArch64_LD3Threev2s_POST: | 
| 2844 | 23.8k |       case AArch64_LD3Threev4h_POST: | 
| 2845 | 23.8k |       case AArch64_LD3Threev4s_POST: | 
| 2846 | 23.8k |       case AArch64_LD3Threev8b_POST: | 
| 2847 | 23.9k |       case AArch64_LD3Threev8h_POST: | 
| 2848 | 24.5k |       case AArch64_LD3i16_POST: | 
| 2849 | 24.8k |       case AArch64_LD3i32_POST: | 
| 2850 | 25.1k |       case AArch64_LD3i64_POST: | 
| 2851 | 26.2k |       case AArch64_LD3i8_POST: | 
| 2852 | 26.3k |       case AArch64_LD4Fourv16b_POST: | 
| 2853 | 26.4k |       case AArch64_LD4Fourv2d_POST: | 
| 2854 | 26.8k |       case AArch64_LD4Fourv2s_POST: | 
| 2855 | 26.8k |       case AArch64_LD4Fourv4h_POST: | 
| 2856 | 26.9k |       case AArch64_LD4Fourv4s_POST: | 
| 2857 | 27.6k |       case AArch64_LD4Fourv8b_POST: | 
| 2858 | 27.7k |       case AArch64_LD4Fourv8h_POST: | 
| 2859 | 27.8k |       case AArch64_LD4Rv16b_POST: | 
| 2860 | 27.9k |       case AArch64_LD4Rv1d_POST: | 
| 2861 | 28.0k |       case AArch64_LD4Rv2d_POST: | 
| 2862 | 28.0k |       case AArch64_LD4Rv2s_POST: | 
| 2863 | 28.1k |       case AArch64_LD4Rv4h_POST: | 
| 2864 | 28.2k |       case AArch64_LD4Rv4s_POST: | 
| 2865 | 28.3k |       case AArch64_LD4Rv8b_POST: | 
| 2866 | 28.5k |       case AArch64_LD4Rv8h_POST: | 
| 2867 | 28.8k |       case AArch64_LD4i16_POST: | 
| 2868 | 29.4k |       case AArch64_LD4i32_POST: | 
| 2869 | 29.7k |       case AArch64_LD4i64_POST: | 
| 2870 | 29.8k |       case AArch64_LD4i8_POST: | 
| 2871 | 29.9k |       case AArch64_LDRBBpost: | 
| 2872 | 29.9k |       case AArch64_LDRBpost: | 
| 2873 | 30.0k |       case AArch64_LDRDpost: | 
| 2874 | 30.2k |       case AArch64_LDRHHpost: | 
| 2875 | 30.4k |       case AArch64_LDRHpost: | 
| 2876 | 30.5k |       case AArch64_LDRQpost: | 
| 2877 | 30.9k |       case AArch64_LDPDpost: | 
| 2878 | 31.0k |       case AArch64_LDPQpost: | 
| 2879 | 31.1k |       case AArch64_LDPSWpost: | 
| 2880 | 31.2k |       case AArch64_LDPSpost: | 
| 2881 | 31.5k |       case AArch64_LDPWpost: | 
| 2882 | 31.8k |       case AArch64_LDPXpost: | 
| 2883 | 32.0k |       case AArch64_ST1Fourv16b_POST: | 
| 2884 | 32.0k |       case AArch64_ST1Fourv1d_POST: | 
| 2885 | 32.1k |       case AArch64_ST1Fourv2d_POST: | 
| 2886 | 32.3k |       case AArch64_ST1Fourv2s_POST: | 
| 2887 | 32.3k |       case AArch64_ST1Fourv4h_POST: | 
| 2888 | 32.3k |       case AArch64_ST1Fourv4s_POST: | 
| 2889 | 32.4k |       case AArch64_ST1Fourv8b_POST: | 
| 2890 | 32.5k |       case AArch64_ST1Fourv8h_POST: | 
| 2891 | 32.7k |       case AArch64_ST1Onev16b_POST: | 
| 2892 | 33.2k |       case AArch64_ST1Onev1d_POST: | 
| 2893 | 33.2k |       case AArch64_ST1Onev2d_POST: | 
| 2894 | 33.2k |       case AArch64_ST1Onev2s_POST: | 
| 2895 | 34.7k |       case AArch64_ST1Onev4h_POST: | 
| 2896 | 34.8k |       case AArch64_ST1Onev4s_POST: | 
| 2897 | 34.8k |       case AArch64_ST1Onev8b_POST: | 
| 2898 | 35.0k |       case AArch64_ST1Onev8h_POST: | 
| 2899 | 35.1k |       case AArch64_ST1Threev16b_POST: | 
| 2900 | 35.4k |       case AArch64_ST1Threev1d_POST: | 
| 2901 | 35.7k |       case AArch64_ST1Threev2d_POST: | 
| 2902 | 35.8k |       case AArch64_ST1Threev2s_POST: | 
| 2903 | 35.8k |       case AArch64_ST1Threev4h_POST: | 
| 2904 | 36.0k |       case AArch64_ST1Threev4s_POST: | 
| 2905 | 36.0k |       case AArch64_ST1Threev8b_POST: | 
| 2906 | 36.3k |       case AArch64_ST1Threev8h_POST: | 
| 2907 | 36.3k |       case AArch64_ST1Twov16b_POST: | 
| 2908 | 37.5k |       case AArch64_ST1Twov1d_POST: | 
| 2909 | 37.6k |       case AArch64_ST1Twov2d_POST: | 
| 2910 | 37.8k |       case AArch64_ST1Twov2s_POST: | 
| 2911 | 38.0k |       case AArch64_ST1Twov4h_POST: | 
| 2912 | 38.5k |       case AArch64_ST1Twov4s_POST: | 
| 2913 | 38.5k |       case AArch64_ST1Twov8b_POST: | 
| 2914 | 39.2k |       case AArch64_ST1Twov8h_POST: | 
| 2915 | 39.6k |       case AArch64_ST1i16_POST: | 
| 2916 | 39.7k |       case AArch64_ST1i32_POST: | 
| 2917 | 42.5k |       case AArch64_ST1i64_POST: | 
| 2918 | 43.7k |       case AArch64_ST1i8_POST: | 
| 2919 | 43.8k |       case AArch64_ST2GPostIndex: | 
| 2920 | 43.8k |       case AArch64_ST2Twov16b_POST: | 
| 2921 | 43.9k |       case AArch64_ST2Twov2d_POST: | 
| 2922 | 44.0k |       case AArch64_ST2Twov2s_POST: | 
| 2923 | 44.0k |       case AArch64_ST2Twov4h_POST: | 
| 2924 | 44.2k |       case AArch64_ST2Twov4s_POST: | 
| 2925 | 44.7k |       case AArch64_ST2Twov8b_POST: | 
| 2926 | 45.0k |       case AArch64_ST2Twov8h_POST: | 
| 2927 | 45.1k |       case AArch64_ST2i16_POST: | 
| 2928 | 45.6k |       case AArch64_ST2i32_POST: | 
| 2929 | 45.8k |       case AArch64_ST2i64_POST: | 
| 2930 | 46.6k |       case AArch64_ST2i8_POST: | 
| 2931 | 46.7k |       case AArch64_ST3Threev16b_POST: | 
| 2932 | 47.4k |       case AArch64_ST3Threev2d_POST: | 
| 2933 | 47.5k |       case AArch64_ST3Threev2s_POST: | 
| 2934 | 47.6k |       case AArch64_ST3Threev4h_POST: | 
| 2935 | 47.6k |       case AArch64_ST3Threev4s_POST: | 
| 2936 | 48.1k |       case AArch64_ST3Threev8b_POST: | 
| 2937 | 48.1k |       case AArch64_ST3Threev8h_POST: | 
| 2938 | 48.7k |       case AArch64_ST3i16_POST: | 
| 2939 | 48.9k |       case AArch64_ST3i32_POST: | 
| 2940 | 49.0k |       case AArch64_ST3i64_POST: | 
| 2941 | 49.5k |       case AArch64_ST3i8_POST: | 
| 2942 | 49.7k |       case AArch64_ST4Fourv16b_POST: | 
| 2943 | 49.8k |       case AArch64_ST4Fourv2d_POST: | 
| 2944 | 50.0k |       case AArch64_ST4Fourv2s_POST: | 
| 2945 | 50.1k |       case AArch64_ST4Fourv4h_POST: | 
| 2946 | 50.8k |       case AArch64_ST4Fourv4s_POST: | 
| 2947 | 51.6k |       case AArch64_ST4Fourv8b_POST: | 
| 2948 | 51.7k |       case AArch64_ST4Fourv8h_POST: | 
| 2949 | 54.6k |       case AArch64_ST4i16_POST: | 
| 2950 | 54.8k |       case AArch64_ST4i32_POST: | 
| 2951 | 56.2k |       case AArch64_ST4i64_POST: | 
| 2952 | 56.2k |       case AArch64_ST4i8_POST: | 
| 2953 | 56.8k |       case AArch64_STPDpost: | 
| 2954 | 57.6k |       case AArch64_STPQpost: | 
| 2955 | 57.9k |       case AArch64_STPSpost: | 
| 2956 | 58.3k |       case AArch64_STPWpost: | 
| 2957 | 59.0k |       case AArch64_STPXpost: | 
| 2958 | 59.1k |       case AArch64_STRBBpost: | 
| 2959 | 59.1k |       case AArch64_STRBpost: | 
| 2960 | 59.2k |       case AArch64_STRDpost: | 
| 2961 | 59.3k |       case AArch64_STRHHpost: | 
| 2962 | 59.4k |       case AArch64_STRHpost: | 
| 2963 | 59.5k |       case AArch64_STRQpost: | 
| 2964 | 59.5k |       case AArch64_STRSpost: | 
| 2965 | 59.6k |       case AArch64_STRWpost: | 
| 2966 | 59.8k |       case AArch64_STRXpost: | 
| 2967 | 59.9k |       case AArch64_STZ2GPostIndex: | 
| 2968 | 60.1k |       case AArch64_STZGPostIndex: | 
| 2969 | 60.1k |       case AArch64_STGPostIndex: | 
| 2970 | 60.1k |       case AArch64_STGPpost: | 
| 2971 | 60.4k |       case AArch64_LDRSBWpost: | 
| 2972 | 60.4k |       case AArch64_LDRSBXpost: | 
| 2973 | 60.5k |       case AArch64_LDRSHWpost: | 
| 2974 | 60.8k |       case AArch64_LDRSHXpost: | 
| 2975 | 60.9k |       case AArch64_LDRSWpost: | 
| 2976 | 60.9k |       case AArch64_LDRSpost: | 
| 2977 | 61.0k |       case AArch64_LDRWpost: | 
| 2978 | 61.0k |       case AArch64_LDRXpost: | 
| 2979 | 61.0k |         flat_insn->detail->arm64.writeback = true; | 
| 2980 | 61.0k |           flat_insn->detail->arm64.post_index = true; | 
| 2981 | 61.0k |         break; | 
| 2982 | 1.34k |       case AArch64_LDRAAwriteback: | 
| 2983 | 2.29k |       case AArch64_LDRABwriteback: | 
| 2984 | 3.09k |       case AArch64_ST2GPreIndex: | 
| 2985 | 3.45k |       case AArch64_LDPDpre: | 
| 2986 | 3.67k |       case AArch64_LDPQpre: | 
| 2987 | 4.11k |       case AArch64_LDPSWpre: | 
| 2988 | 4.25k |       case AArch64_LDPSpre: | 
| 2989 | 4.63k |       case AArch64_LDPWpre: | 
| 2990 | 5.23k |       case AArch64_LDPXpre: | 
| 2991 | 5.28k |       case AArch64_LDRBBpre: | 
| 2992 | 5.37k |       case AArch64_LDRBpre: | 
| 2993 | 5.56k |       case AArch64_LDRDpre: | 
| 2994 | 5.81k |       case AArch64_LDRHHpre: | 
| 2995 | 5.85k |       case AArch64_LDRHpre: | 
| 2996 | 5.98k |       case AArch64_LDRQpre: | 
| 2997 | 6.97k |       case AArch64_LDRSBWpre: | 
| 2998 | 7.20k |       case AArch64_LDRSBXpre: | 
| 2999 | 7.27k |       case AArch64_LDRSHWpre: | 
| 3000 | 7.32k |       case AArch64_LDRSHXpre: | 
| 3001 | 7.33k |       case AArch64_LDRSWpre: | 
| 3002 | 7.40k |       case AArch64_LDRSpre: | 
| 3003 | 7.44k |       case AArch64_LDRWpre: | 
| 3004 | 7.57k |       case AArch64_LDRXpre: | 
| 3005 | 7.70k |       case AArch64_STGPreIndex: | 
| 3006 | 8.17k |       case AArch64_STPDpre: | 
| 3007 | 8.44k |       case AArch64_STPQpre: | 
| 3008 | 8.72k |       case AArch64_STPSpre: | 
| 3009 | 8.84k |       case AArch64_STPWpre: | 
| 3010 | 9.19k |       case AArch64_STPXpre: | 
| 3011 | 9.25k |       case AArch64_STRBBpre: | 
| 3012 | 9.29k |       case AArch64_STRBpre: | 
| 3013 | 9.49k |       case AArch64_STRDpre: | 
| 3014 | 9.52k |       case AArch64_STRHHpre: | 
| 3015 | 9.87k |       case AArch64_STRHpre: | 
| 3016 | 10.2k |       case AArch64_STRQpre: | 
| 3017 | 10.3k |       case AArch64_STRSpre: | 
| 3018 | 10.3k |       case AArch64_STRWpre: | 
| 3019 | 11.1k |       case AArch64_STRXpre: | 
| 3020 | 11.2k |       case AArch64_STZ2GPreIndex: | 
| 3021 | 11.5k |       case AArch64_STZGPreIndex: | 
| 3022 | 11.5k |       case AArch64_STGPpre: | 
| 3023 | 11.5k |         flat_insn->detail->arm64.writeback = true; | 
| 3024 | 11.5k |         break; | 
| 3025 | 353k |     } | 
| 3026 | 353k |   } | 
| 3027 | 353k | } | 
| 3028 |  |  | 
| 3029 |  | #endif |