Home | History | Annotate | Download | only in XCore
      1 /* Capstone Disassembly Engine */
      2 /* By Nguyen Anh Quynh <aquynh (at) gmail.com>, 2013-2014 */
      3 
      4 #ifdef CAPSTONE_HAS_XCORE
      5 
      6 #include <stdio.h>	// debug
      7 #include <string.h>
      8 
      9 #include "../../utils.h"
     10 
     11 #include "XCoreMapping.h"
     12 
     13 #define GET_INSTRINFO_ENUM
     14 #include "XCoreGenInstrInfo.inc"
     15 
     16 static name_map reg_name_maps[] = {
     17 	{ XCORE_REG_INVALID, NULL },
     18 
     19 	{ XCORE_REG_CP, "cp" },
     20 	{ XCORE_REG_DP, "dp" },
     21 	{ XCORE_REG_LR, "lr" },
     22 	{ XCORE_REG_SP, "sp" },
     23 	{ XCORE_REG_R0, "r0" },
     24 	{ XCORE_REG_R1, "r1" },
     25 	{ XCORE_REG_R2, "r2" },
     26 	{ XCORE_REG_R3, "r3" },
     27 	{ XCORE_REG_R4, "r4" },
     28 	{ XCORE_REG_R5, "r5" },
     29 	{ XCORE_REG_R6, "r6" },
     30 	{ XCORE_REG_R7, "r7" },
     31 	{ XCORE_REG_R8, "r8" },
     32 	{ XCORE_REG_R9, "r9" },
     33 	{ XCORE_REG_R10, "r10" },
     34 	{ XCORE_REG_R11, "r11" },
     35 
     36 	// pseudo registers
     37 	{ XCORE_REG_PC, "pc" },
     38 
     39 	{ XCORE_REG_SCP, "scp" },
     40 	{ XCORE_REG_SSR, "ssr" },
     41 	{ XCORE_REG_ET, "et" },
     42 	{ XCORE_REG_ED, "ed" },
     43 	{ XCORE_REG_SED, "sed" },
     44 	{ XCORE_REG_KEP, "kep" },
     45 	{ XCORE_REG_KSP, "ksp" },
     46 	{ XCORE_REG_ID, "id" },
     47 };
     48 
     49 const char *XCore_reg_name(csh handle, unsigned int reg)
     50 {
     51 #ifndef CAPSTONE_DIET
     52 	if (reg >= XCORE_REG_ENDING)
     53 		return NULL;
     54 
     55 	return reg_name_maps[reg].name;
     56 #else
     57 	return NULL;
     58 #endif
     59 }
     60 
     61 xcore_reg XCore_reg_id(char *name)
     62 {
     63 	int i;
     64 
     65 	for(i = 1; i < ARR_SIZE(reg_name_maps); i++) {
     66 		if (!strcmp(name, reg_name_maps[i].name))
     67 			return reg_name_maps[i].id;
     68 	}
     69 
     70 	// not found
     71 	return 0;
     72 }
     73 
     74 static insn_map insns[] = {
     75 	// dummy item
     76 	{
     77 		0, 0,
     78 #ifndef CAPSTONE_DIET
     79 		{ 0 }, { 0 }, { 0 }, 0, 0
     80 #endif
     81 	},
     82 
     83 	{
     84 		XCore_ADD_2rus, XCORE_INS_ADD,
     85 #ifndef CAPSTONE_DIET
     86 		{ 0 }, { 0 }, { 0 }, 0, 0
     87 #endif
     88 	},
     89 	{
     90 		XCore_ADD_3r, XCORE_INS_ADD,
     91 #ifndef CAPSTONE_DIET
     92 		{ 0 }, { 0 }, { 0 }, 0, 0
     93 #endif
     94 	},
     95 	{
     96 		XCore_ANDNOT_2r, XCORE_INS_ANDNOT,
     97 #ifndef CAPSTONE_DIET
     98 		{ 0 }, { 0 }, { 0 }, 0, 0
     99 #endif
    100 	},
    101 	{
    102 		XCore_AND_3r, XCORE_INS_AND,
    103 #ifndef CAPSTONE_DIET
    104 		{ 0 }, { 0 }, { 0 }, 0, 0
    105 #endif
    106 	},
    107 	{
    108 		XCore_ASHR_l2rus, XCORE_INS_ASHR,
    109 #ifndef CAPSTONE_DIET
    110 		{ 0 }, { 0 }, { 0 }, 0, 0
    111 #endif
    112 	},
    113 	{
    114 		XCore_ASHR_l3r, XCORE_INS_ASHR,
    115 #ifndef CAPSTONE_DIET
    116 		{ 0 }, { 0 }, { 0 }, 0, 0
    117 #endif
    118 	},
    119 	{
    120 		XCore_BAU_1r, XCORE_INS_BAU,
    121 #ifndef CAPSTONE_DIET
    122 		{ 0 }, { 0 }, { 0 }, 1, 1
    123 #endif
    124 	},
    125 	{
    126 		XCore_BITREV_l2r, XCORE_INS_BITREV,
    127 #ifndef CAPSTONE_DIET
    128 		{ 0 }, { 0 }, { 0 }, 0, 0
    129 #endif
    130 	},
    131 	{
    132 		XCore_BLACP_lu10, XCORE_INS_BLA,
    133 #ifndef CAPSTONE_DIET
    134 		{ XCORE_REG_SP, 0 }, { XCORE_REG_R0, XCORE_REG_R1, XCORE_REG_R2, XCORE_REG_R3, XCORE_REG_R11, XCORE_REG_LR, 0 }, { 0 }, 0, 0
    135 #endif
    136 	},
    137 	{
    138 		XCore_BLACP_u10, XCORE_INS_BLA,
    139 #ifndef CAPSTONE_DIET
    140 		{ XCORE_REG_SP, 0 }, { XCORE_REG_R0, XCORE_REG_R1, XCORE_REG_R2, XCORE_REG_R3, XCORE_REG_R11, XCORE_REG_LR, 0 }, { 0 }, 0, 0
    141 #endif
    142 	},
    143 	{
    144 		XCore_BLAT_lu6, XCORE_INS_BLAT,
    145 #ifndef CAPSTONE_DIET
    146 		{ XCORE_REG_R11, 0 }, { 0 }, { 0 }, 0, 0
    147 #endif
    148 	},
    149 	{
    150 		XCore_BLAT_u6, XCORE_INS_BLAT,
    151 #ifndef CAPSTONE_DIET
    152 		{ XCORE_REG_R11, 0 }, { 0 }, { 0 }, 0, 0
    153 #endif
    154 	},
    155 	{
    156 		XCore_BLA_1r, XCORE_INS_BLA,
    157 #ifndef CAPSTONE_DIET
    158 		{ XCORE_REG_SP, 0 }, { XCORE_REG_R0, XCORE_REG_R1, XCORE_REG_R2, XCORE_REG_R3, XCORE_REG_R11, XCORE_REG_LR, 0 }, { 0 }, 0, 0
    159 #endif
    160 	},
    161 	{
    162 		XCore_BLRB_lu10, XCORE_INS_BL,
    163 #ifndef CAPSTONE_DIET
    164 		{ XCORE_REG_SP, 0 }, { XCORE_REG_R0, XCORE_REG_R1, XCORE_REG_R2, XCORE_REG_R3, XCORE_REG_R11, XCORE_REG_LR, 0 }, { 0 }, 0, 0
    165 #endif
    166 	},
    167 	{
    168 		XCore_BLRB_u10, XCORE_INS_BL,
    169 #ifndef CAPSTONE_DIET
    170 		{ XCORE_REG_SP, 0 }, { XCORE_REG_R0, XCORE_REG_R1, XCORE_REG_R2, XCORE_REG_R3, XCORE_REG_R11, XCORE_REG_LR, 0 }, { 0 }, 0, 0
    171 #endif
    172 	},
    173 	{
    174 		XCore_BLRF_lu10, XCORE_INS_BL,
    175 #ifndef CAPSTONE_DIET
    176 		{ XCORE_REG_SP, 0 }, { XCORE_REG_R0, XCORE_REG_R1, XCORE_REG_R2, XCORE_REG_R3, XCORE_REG_R11, XCORE_REG_LR, 0 }, { 0 }, 0, 0
    177 #endif
    178 	},
    179 	{
    180 		XCore_BLRF_u10, XCORE_INS_BL,
    181 #ifndef CAPSTONE_DIET
    182 		{ XCORE_REG_SP, 0 }, { XCORE_REG_R0, XCORE_REG_R1, XCORE_REG_R2, XCORE_REG_R3, XCORE_REG_R11, XCORE_REG_LR, 0 }, { 0 }, 0, 0
    183 #endif
    184 	},
    185 	{
    186 		XCore_BRBF_lru6, XCORE_INS_BF,
    187 #ifndef CAPSTONE_DIET
    188 		{ 0 }, { 0 }, { 0 }, 1, 0
    189 #endif
    190 	},
    191 	{
    192 		XCore_BRBF_ru6, XCORE_INS_BF,
    193 #ifndef CAPSTONE_DIET
    194 		{ 0 }, { 0 }, { 0 }, 1, 0
    195 #endif
    196 	},
    197 	{
    198 		XCore_BRBT_lru6, XCORE_INS_BT,
    199 #ifndef CAPSTONE_DIET
    200 		{ 0 }, { 0 }, { 0 }, 1, 0
    201 #endif
    202 	},
    203 	{
    204 		XCore_BRBT_ru6, XCORE_INS_BT,
    205 #ifndef CAPSTONE_DIET
    206 		{ 0 }, { 0 }, { 0 }, 1, 0
    207 #endif
    208 	},
    209 	{
    210 		XCore_BRBU_lu6, XCORE_INS_BU,
    211 #ifndef CAPSTONE_DIET
    212 		{ 0 }, { 0 }, { 0 }, 1, 0
    213 #endif
    214 	},
    215 	{
    216 		XCore_BRBU_u6, XCORE_INS_BU,
    217 #ifndef CAPSTONE_DIET
    218 		{ 0 }, { 0 }, { 0 }, 1, 0
    219 #endif
    220 	},
    221 	{
    222 		XCore_BRFF_lru6, XCORE_INS_BF,
    223 #ifndef CAPSTONE_DIET
    224 		{ 0 }, { 0 }, { 0 }, 1, 0
    225 #endif
    226 	},
    227 	{
    228 		XCore_BRFF_ru6, XCORE_INS_BF,
    229 #ifndef CAPSTONE_DIET
    230 		{ 0 }, { 0 }, { 0 }, 1, 0
    231 #endif
    232 	},
    233 	{
    234 		XCore_BRFT_lru6, XCORE_INS_BT,
    235 #ifndef CAPSTONE_DIET
    236 		{ 0 }, { 0 }, { 0 }, 1, 0
    237 #endif
    238 	},
    239 	{
    240 		XCore_BRFT_ru6, XCORE_INS_BT,
    241 #ifndef CAPSTONE_DIET
    242 		{ 0 }, { 0 }, { 0 }, 1, 0
    243 #endif
    244 	},
    245 	{
    246 		XCore_BRFU_lu6, XCORE_INS_BU,
    247 #ifndef CAPSTONE_DIET
    248 		{ 0 }, { 0 }, { 0 }, 1, 0
    249 #endif
    250 	},
    251 	{
    252 		XCore_BRFU_u6, XCORE_INS_BU,
    253 #ifndef CAPSTONE_DIET
    254 		{ 0 }, { 0 }, { 0 }, 1, 0
    255 #endif
    256 	},
    257 	{
    258 		XCore_BRU_1r, XCORE_INS_BRU,
    259 #ifndef CAPSTONE_DIET
    260 		{ 0 }, { 0 }, { 0 }, 1, 1
    261 #endif
    262 	},
    263 	{
    264 		XCore_BYTEREV_l2r, XCORE_INS_BYTEREV,
    265 #ifndef CAPSTONE_DIET
    266 		{ 0 }, { 0 }, { 0 }, 0, 0
    267 #endif
    268 	},
    269 	{
    270 		XCore_CHKCT_2r, XCORE_INS_CHKCT,
    271 #ifndef CAPSTONE_DIET
    272 		{ 0 }, { 0 }, { 0 }, 0, 0
    273 #endif
    274 	},
    275 	{
    276 		XCore_CHKCT_rus, XCORE_INS_CHKCT,
    277 #ifndef CAPSTONE_DIET
    278 		{ 0 }, { 0 }, { 0 }, 0, 0
    279 #endif
    280 	},
    281 	{
    282 		XCore_CLRE_0R, XCORE_INS_CLRE,
    283 #ifndef CAPSTONE_DIET
    284 		{ 0 }, { 0 }, { 0 }, 0, 0
    285 #endif
    286 	},
    287 	{
    288 		XCore_CLRPT_1R, XCORE_INS_CLRPT,
    289 #ifndef CAPSTONE_DIET
    290 		{ 0 }, { 0 }, { 0 }, 0, 0
    291 #endif
    292 	},
    293 	{
    294 		XCore_CLRSR_branch_lu6, XCORE_INS_CLRSR,
    295 #ifndef CAPSTONE_DIET
    296 		{ 0 }, { 0 }, { 0 }, 1, 1
    297 #endif
    298 	},
    299 	{
    300 		XCore_CLRSR_branch_u6, XCORE_INS_CLRSR,
    301 #ifndef CAPSTONE_DIET
    302 		{ 0 }, { 0 }, { 0 }, 1, 1
    303 #endif
    304 	},
    305 	{
    306 		XCore_CLRSR_lu6, XCORE_INS_CLRSR,
    307 #ifndef CAPSTONE_DIET
    308 		{ 0 }, { 0 }, { 0 }, 0, 0
    309 #endif
    310 	},
    311 	{
    312 		XCore_CLRSR_u6, XCORE_INS_CLRSR,
    313 #ifndef CAPSTONE_DIET
    314 		{ 0 }, { 0 }, { 0 }, 0, 0
    315 #endif
    316 	},
    317 	{
    318 		XCore_CLZ_l2r, XCORE_INS_CLZ,
    319 #ifndef CAPSTONE_DIET
    320 		{ 0 }, { 0 }, { 0 }, 0, 0
    321 #endif
    322 	},
    323 	{
    324 		XCore_CRC8_l4r, XCORE_INS_CRC8,
    325 #ifndef CAPSTONE_DIET
    326 		{ 0 }, { 0 }, { 0 }, 0, 0
    327 #endif
    328 	},
    329 	{
    330 		XCore_CRC_l3r, XCORE_INS_CRC32,
    331 #ifndef CAPSTONE_DIET
    332 		{ 0 }, { 0 }, { 0 }, 0, 0
    333 #endif
    334 	},
    335 	{
    336 		XCore_DCALL_0R, XCORE_INS_DCALL,
    337 #ifndef CAPSTONE_DIET
    338 		{ 0 }, { 0 }, { 0 }, 0, 0
    339 #endif
    340 	},
    341 	{
    342 		XCore_DENTSP_0R, XCORE_INS_DENTSP,
    343 #ifndef CAPSTONE_DIET
    344 		{ XCORE_REG_SP, 0 }, { XCORE_REG_SP, 0 }, { 0 }, 0, 0
    345 #endif
    346 	},
    347 	{
    348 		XCore_DGETREG_1r, XCORE_INS_DGETREG,
    349 #ifndef CAPSTONE_DIET
    350 		{ 0 }, { 0 }, { 0 }, 0, 0
    351 #endif
    352 	},
    353 	{
    354 		XCore_DIVS_l3r, XCORE_INS_DIVS,
    355 #ifndef CAPSTONE_DIET
    356 		{ 0 }, { 0 }, { 0 }, 0, 0
    357 #endif
    358 	},
    359 	{
    360 		XCore_DIVU_l3r, XCORE_INS_DIVU,
    361 #ifndef CAPSTONE_DIET
    362 		{ 0 }, { 0 }, { 0 }, 0, 0
    363 #endif
    364 	},
    365 	{
    366 		XCore_DRESTSP_0R, XCORE_INS_DRESTSP,
    367 #ifndef CAPSTONE_DIET
    368 		{ 0 }, { XCORE_REG_SP, 0 }, { 0 }, 0, 0
    369 #endif
    370 	},
    371 	{
    372 		XCore_DRET_0R, XCORE_INS_DRET,
    373 #ifndef CAPSTONE_DIET
    374 		{ 0 }, { 0 }, { 0 }, 0, 0
    375 #endif
    376 	},
    377 	{
    378 		XCore_ECALLF_1r, XCORE_INS_ECALLF,
    379 #ifndef CAPSTONE_DIET
    380 		{ 0 }, { 0 }, { 0 }, 0, 0
    381 #endif
    382 	},
    383 	{
    384 		XCore_ECALLT_1r, XCORE_INS_ECALLT,
    385 #ifndef CAPSTONE_DIET
    386 		{ 0 }, { 0 }, { 0 }, 0, 0
    387 #endif
    388 	},
    389 	{
    390 		XCore_EDU_1r, XCORE_INS_EDU,
    391 #ifndef CAPSTONE_DIET
    392 		{ 0 }, { 0 }, { 0 }, 0, 0
    393 #endif
    394 	},
    395 	{
    396 		XCore_EEF_2r, XCORE_INS_EEF,
    397 #ifndef CAPSTONE_DIET
    398 		{ 0 }, { 0 }, { 0 }, 0, 0
    399 #endif
    400 	},
    401 	{
    402 		XCore_EET_2r, XCORE_INS_EET,
    403 #ifndef CAPSTONE_DIET
    404 		{ 0 }, { 0 }, { 0 }, 0, 0
    405 #endif
    406 	},
    407 	{
    408 		XCore_EEU_1r, XCORE_INS_EEU,
    409 #ifndef CAPSTONE_DIET
    410 		{ 0 }, { 0 }, { 0 }, 0, 0
    411 #endif
    412 	},
    413 	{
    414 		XCore_ENDIN_2r, XCORE_INS_ENDIN,
    415 #ifndef CAPSTONE_DIET
    416 		{ 0 }, { 0 }, { 0 }, 0, 0
    417 #endif
    418 	},
    419 	{
    420 		XCore_ENTSP_lu6, XCORE_INS_ENTSP,
    421 #ifndef CAPSTONE_DIET
    422 		{ XCORE_REG_SP, 0 }, { XCORE_REG_SP, 0 }, { 0 }, 0, 0
    423 #endif
    424 	},
    425 	{
    426 		XCore_ENTSP_u6, XCORE_INS_ENTSP,
    427 #ifndef CAPSTONE_DIET
    428 		{ XCORE_REG_SP, 0 }, { XCORE_REG_SP, 0 }, { 0 }, 0, 0
    429 #endif
    430 	},
    431 	{
    432 		XCore_EQ_2rus, XCORE_INS_EQ,
    433 #ifndef CAPSTONE_DIET
    434 		{ 0 }, { 0 }, { 0 }, 0, 0
    435 #endif
    436 	},
    437 	{
    438 		XCore_EQ_3r, XCORE_INS_EQ,
    439 #ifndef CAPSTONE_DIET
    440 		{ 0 }, { 0 }, { 0 }, 0, 0
    441 #endif
    442 	},
    443 	{
    444 		XCore_EXTDP_lu6, XCORE_INS_EXTDP,
    445 #ifndef CAPSTONE_DIET
    446 		{ 0 }, { 0 }, { 0 }, 0, 0
    447 #endif
    448 	},
    449 	{
    450 		XCore_EXTDP_u6, XCORE_INS_EXTDP,
    451 #ifndef CAPSTONE_DIET
    452 		{ 0 }, { 0 }, { 0 }, 0, 0
    453 #endif
    454 	},
    455 	{
    456 		XCore_EXTSP_lu6, XCORE_INS_EXTSP,
    457 #ifndef CAPSTONE_DIET
    458 		{ XCORE_REG_SP, 0 }, { XCORE_REG_SP, 0 }, { 0 }, 0, 0
    459 #endif
    460 	},
    461 	{
    462 		XCore_EXTSP_u6, XCORE_INS_EXTSP,
    463 #ifndef CAPSTONE_DIET
    464 		{ XCORE_REG_SP, 0 }, { XCORE_REG_SP, 0 }, { 0 }, 0, 0
    465 #endif
    466 	},
    467 	{
    468 		XCore_FREER_1r, XCORE_INS_FREER,
    469 #ifndef CAPSTONE_DIET
    470 		{ 0 }, { 0 }, { 0 }, 0, 0
    471 #endif
    472 	},
    473 	{
    474 		XCore_FREET_0R, XCORE_INS_FREET,
    475 #ifndef CAPSTONE_DIET
    476 		{ 0 }, { 0 }, { 0 }, 0, 0
    477 #endif
    478 	},
    479 	{
    480 		XCore_GETD_l2r, XCORE_INS_GETD,
    481 #ifndef CAPSTONE_DIET
    482 		{ 0 }, { 0 }, { 0 }, 0, 0
    483 #endif
    484 	},
    485 	{
    486 		XCore_GETED_0R, XCORE_INS_GET,
    487 #ifndef CAPSTONE_DIET
    488 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    489 #endif
    490 	},
    491 	{
    492 		XCore_GETET_0R, XCORE_INS_GET,
    493 #ifndef CAPSTONE_DIET
    494 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    495 #endif
    496 	},
    497 	{
    498 		XCore_GETID_0R, XCORE_INS_GET,
    499 #ifndef CAPSTONE_DIET
    500 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    501 #endif
    502 	},
    503 	{
    504 		XCore_GETKEP_0R, XCORE_INS_GET,
    505 #ifndef CAPSTONE_DIET
    506 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    507 #endif
    508 	},
    509 	{
    510 		XCore_GETKSP_0R, XCORE_INS_GET,
    511 #ifndef CAPSTONE_DIET
    512 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    513 #endif
    514 	},
    515 	{
    516 		XCore_GETN_l2r, XCORE_INS_GETN,
    517 #ifndef CAPSTONE_DIET
    518 		{ 0 }, { 0 }, { 0 }, 0, 0
    519 #endif
    520 	},
    521 	{
    522 		XCore_GETPS_l2r, XCORE_INS_GET,
    523 #ifndef CAPSTONE_DIET
    524 		{ 0 }, { 0 }, { 0 }, 0, 0
    525 #endif
    526 	},
    527 	{
    528 		XCore_GETR_rus, XCORE_INS_GETR,
    529 #ifndef CAPSTONE_DIET
    530 		{ 0 }, { 0 }, { 0 }, 0, 0
    531 #endif
    532 	},
    533 	{
    534 		XCore_GETSR_lu6, XCORE_INS_GETSR,
    535 #ifndef CAPSTONE_DIET
    536 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    537 #endif
    538 	},
    539 	{
    540 		XCore_GETSR_u6, XCORE_INS_GETSR,
    541 #ifndef CAPSTONE_DIET
    542 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    543 #endif
    544 	},
    545 	{
    546 		XCore_GETST_2r, XCORE_INS_GETST,
    547 #ifndef CAPSTONE_DIET
    548 		{ 0 }, { 0 }, { 0 }, 0, 0
    549 #endif
    550 	},
    551 	{
    552 		XCore_GETTS_2r, XCORE_INS_GETTS,
    553 #ifndef CAPSTONE_DIET
    554 		{ 0 }, { 0 }, { 0 }, 0, 0
    555 #endif
    556 	},
    557 	{
    558 		XCore_INCT_2r, XCORE_INS_INCT,
    559 #ifndef CAPSTONE_DIET
    560 		{ 0 }, { 0 }, { 0 }, 0, 0
    561 #endif
    562 	},
    563 	{
    564 		XCore_INITCP_2r, XCORE_INS_INIT,
    565 #ifndef CAPSTONE_DIET
    566 		{ 0 }, { 0 }, { 0 }, 0, 0
    567 #endif
    568 	},
    569 	{
    570 		XCore_INITDP_2r, XCORE_INS_INIT,
    571 #ifndef CAPSTONE_DIET
    572 		{ 0 }, { 0 }, { 0 }, 0, 0
    573 #endif
    574 	},
    575 	{
    576 		XCore_INITLR_l2r, XCORE_INS_INIT,
    577 #ifndef CAPSTONE_DIET
    578 		{ 0 }, { 0 }, { 0 }, 0, 0
    579 #endif
    580 	},
    581 	{
    582 		XCore_INITPC_2r, XCORE_INS_INIT,
    583 #ifndef CAPSTONE_DIET
    584 		{ 0 }, { 0 }, { 0 }, 0, 0
    585 #endif
    586 	},
    587 	{
    588 		XCore_INITSP_2r, XCORE_INS_INIT,
    589 #ifndef CAPSTONE_DIET
    590 		{ 0 }, { 0 }, { 0 }, 0, 0
    591 #endif
    592 	},
    593 	{
    594 		XCore_INPW_l2rus, XCORE_INS_INPW,
    595 #ifndef CAPSTONE_DIET
    596 		{ 0 }, { 0 }, { 0 }, 0, 0
    597 #endif
    598 	},
    599 	{
    600 		XCore_INSHR_2r, XCORE_INS_INSHR,
    601 #ifndef CAPSTONE_DIET
    602 		{ 0 }, { 0 }, { 0 }, 0, 0
    603 #endif
    604 	},
    605 	{
    606 		XCore_INT_2r, XCORE_INS_INT,
    607 #ifndef CAPSTONE_DIET
    608 		{ 0 }, { 0 }, { 0 }, 0, 0
    609 #endif
    610 	},
    611 	{
    612 		XCore_IN_2r, XCORE_INS_IN,
    613 #ifndef CAPSTONE_DIET
    614 		{ 0 }, { 0 }, { 0 }, 0, 0
    615 #endif
    616 	},
    617 	{
    618 		XCore_KCALL_1r, XCORE_INS_KCALL,
    619 #ifndef CAPSTONE_DIET
    620 		{ 0 }, { 0 }, { 0 }, 0, 0
    621 #endif
    622 	},
    623 	{
    624 		XCore_KCALL_lu6, XCORE_INS_KCALL,
    625 #ifndef CAPSTONE_DIET
    626 		{ 0 }, { 0 }, { 0 }, 0, 0
    627 #endif
    628 	},
    629 	{
    630 		XCore_KCALL_u6, XCORE_INS_KCALL,
    631 #ifndef CAPSTONE_DIET
    632 		{ 0 }, { 0 }, { 0 }, 0, 0
    633 #endif
    634 	},
    635 	{
    636 		XCore_KENTSP_lu6, XCORE_INS_KENTSP,
    637 #ifndef CAPSTONE_DIET
    638 		{ XCORE_REG_SP, 0 }, { XCORE_REG_SP, 0 }, { 0 }, 0, 0
    639 #endif
    640 	},
    641 	{
    642 		XCore_KENTSP_u6, XCORE_INS_KENTSP,
    643 #ifndef CAPSTONE_DIET
    644 		{ XCORE_REG_SP, 0 }, { XCORE_REG_SP, 0 }, { 0 }, 0, 0
    645 #endif
    646 	},
    647 	{
    648 		XCore_KRESTSP_lu6, XCORE_INS_KRESTSP,
    649 #ifndef CAPSTONE_DIET
    650 		{ XCORE_REG_SP, 0 }, { XCORE_REG_SP, 0 }, { 0 }, 0, 0
    651 #endif
    652 	},
    653 	{
    654 		XCore_KRESTSP_u6, XCORE_INS_KRESTSP,
    655 #ifndef CAPSTONE_DIET
    656 		{ XCORE_REG_SP, 0 }, { XCORE_REG_SP, 0 }, { 0 }, 0, 0
    657 #endif
    658 	},
    659 	{
    660 		XCore_KRET_0R, XCORE_INS_KRET,
    661 #ifndef CAPSTONE_DIET
    662 		{ 0 }, { XCORE_REG_SP, 0 }, { 0 }, 0, 0
    663 #endif
    664 	},
    665 	{
    666 		XCore_LADD_l5r, XCORE_INS_LADD,
    667 #ifndef CAPSTONE_DIET
    668 		{ 0 }, { 0 }, { 0 }, 0, 0
    669 #endif
    670 	},
    671 	{
    672 		XCore_LD16S_3r, XCORE_INS_LD16S,
    673 #ifndef CAPSTONE_DIET
    674 		{ 0 }, { 0 }, { 0 }, 0, 0
    675 #endif
    676 	},
    677 	{
    678 		XCore_LD8U_3r, XCORE_INS_LD8U,
    679 #ifndef CAPSTONE_DIET
    680 		{ 0 }, { 0 }, { 0 }, 0, 0
    681 #endif
    682 	},
    683 	{
    684 		XCore_LDA16B_l3r, XCORE_INS_LDA16,
    685 #ifndef CAPSTONE_DIET
    686 		{ 0 }, { 0 }, { 0 }, 0, 0
    687 #endif
    688 	},
    689 	{
    690 		XCore_LDA16F_l3r, XCORE_INS_LDA16,
    691 #ifndef CAPSTONE_DIET
    692 		{ 0 }, { 0 }, { 0 }, 0, 0
    693 #endif
    694 	},
    695 	{
    696 		XCore_LDAPB_lu10, XCORE_INS_LDAP,
    697 #ifndef CAPSTONE_DIET
    698 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    699 #endif
    700 	},
    701 	{
    702 		XCore_LDAPB_u10, XCORE_INS_LDAP,
    703 #ifndef CAPSTONE_DIET
    704 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    705 #endif
    706 	},
    707 	{
    708 		XCore_LDAPF_lu10, XCORE_INS_LDAP,
    709 #ifndef CAPSTONE_DIET
    710 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    711 #endif
    712 	},
    713 	{
    714 		XCore_LDAPF_lu10_ba, XCORE_INS_LDAP,
    715 #ifndef CAPSTONE_DIET
    716 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    717 #endif
    718 	},
    719 	{
    720 		XCore_LDAPF_u10, XCORE_INS_LDAP,
    721 #ifndef CAPSTONE_DIET
    722 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    723 #endif
    724 	},
    725 	{
    726 		XCore_LDAWB_l2rus, XCORE_INS_LDAW,
    727 #ifndef CAPSTONE_DIET
    728 		{ 0 }, { 0 }, { 0 }, 0, 0
    729 #endif
    730 	},
    731 	{
    732 		XCore_LDAWB_l3r, XCORE_INS_LDAW,
    733 #ifndef CAPSTONE_DIET
    734 		{ 0 }, { 0 }, { 0 }, 0, 0
    735 #endif
    736 	},
    737 	{
    738 		XCore_LDAWCP_lu6, XCORE_INS_LDAW,
    739 #ifndef CAPSTONE_DIET
    740 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    741 #endif
    742 	},
    743 	{
    744 		XCore_LDAWCP_u6, XCORE_INS_LDAW,
    745 #ifndef CAPSTONE_DIET
    746 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    747 #endif
    748 	},
    749 	{
    750 		XCore_LDAWDP_lru6, XCORE_INS_LDAW,
    751 #ifndef CAPSTONE_DIET
    752 		{ 0 }, { 0 }, { 0 }, 0, 0
    753 #endif
    754 	},
    755 	{
    756 		XCore_LDAWDP_ru6, XCORE_INS_LDAW,
    757 #ifndef CAPSTONE_DIET
    758 		{ 0 }, { 0 }, { 0 }, 0, 0
    759 #endif
    760 	},
    761 	{
    762 		XCore_LDAWF_l2rus, XCORE_INS_LDAW,
    763 #ifndef CAPSTONE_DIET
    764 		{ 0 }, { 0 }, { 0 }, 0, 0
    765 #endif
    766 	},
    767 	{
    768 		XCore_LDAWF_l3r, XCORE_INS_LDAW,
    769 #ifndef CAPSTONE_DIET
    770 		{ 0 }, { 0 }, { 0 }, 0, 0
    771 #endif
    772 	},
    773 	{
    774 		XCore_LDAWSP_lru6, XCORE_INS_LDAW,
    775 #ifndef CAPSTONE_DIET
    776 		{ XCORE_REG_SP, 0 }, { 0 }, { 0 }, 0, 0
    777 #endif
    778 	},
    779 	{
    780 		XCore_LDAWSP_ru6, XCORE_INS_LDAW,
    781 #ifndef CAPSTONE_DIET
    782 		{ XCORE_REG_SP, 0 }, { 0 }, { 0 }, 0, 0
    783 #endif
    784 	},
    785 	{
    786 		XCore_LDC_lru6, XCORE_INS_LDC,
    787 #ifndef CAPSTONE_DIET
    788 		{ 0 }, { 0 }, { 0 }, 0, 0
    789 #endif
    790 	},
    791 	{
    792 		XCore_LDC_ru6, XCORE_INS_LDC,
    793 #ifndef CAPSTONE_DIET
    794 		{ 0 }, { 0 }, { 0 }, 0, 0
    795 #endif
    796 	},
    797 	{
    798 		XCore_LDET_0R, XCORE_INS_LDW,
    799 #ifndef CAPSTONE_DIET
    800 		{ XCORE_REG_SP, 0 }, { 0 }, { 0 }, 0, 0
    801 #endif
    802 	},
    803 	{
    804 		XCore_LDIVU_l5r, XCORE_INS_LDIVU,
    805 #ifndef CAPSTONE_DIET
    806 		{ 0 }, { 0 }, { 0 }, 0, 0
    807 #endif
    808 	},
    809 	{
    810 		XCore_LDSED_0R, XCORE_INS_LDW,
    811 #ifndef CAPSTONE_DIET
    812 		{ XCORE_REG_SP, 0 }, { 0 }, { 0 }, 0, 0
    813 #endif
    814 	},
    815 	{
    816 		XCore_LDSPC_0R, XCORE_INS_LDW,
    817 #ifndef CAPSTONE_DIET
    818 		{ XCORE_REG_SP, 0 }, { 0 }, { 0 }, 0, 0
    819 #endif
    820 	},
    821 	{
    822 		XCore_LDSSR_0R, XCORE_INS_LDW,
    823 #ifndef CAPSTONE_DIET
    824 		{ XCORE_REG_SP, 0 }, { 0 }, { 0 }, 0, 0
    825 #endif
    826 	},
    827 	{
    828 		XCore_LDWCP_lru6, XCORE_INS_LDW,
    829 #ifndef CAPSTONE_DIET
    830 		{ 0 }, { 0 }, { 0 }, 0, 0
    831 #endif
    832 	},
    833 	{
    834 		XCore_LDWCP_lu10, XCORE_INS_LDW,
    835 #ifndef CAPSTONE_DIET
    836 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    837 #endif
    838 	},
    839 	{
    840 		XCore_LDWCP_ru6, XCORE_INS_LDW,
    841 #ifndef CAPSTONE_DIET
    842 		{ 0 }, { 0 }, { 0 }, 0, 0
    843 #endif
    844 	},
    845 	{
    846 		XCore_LDWCP_u10, XCORE_INS_LDW,
    847 #ifndef CAPSTONE_DIET
    848 		{ 0 }, { XCORE_REG_R11, 0 }, { 0 }, 0, 0
    849 #endif
    850 	},
    851 	{
    852 		XCore_LDWDP_lru6, XCORE_INS_LDW,
    853 #ifndef CAPSTONE_DIET
    854 		{ 0 }, { 0 }, { 0 }, 0, 0
    855 #endif
    856 	},
    857 	{
    858 		XCore_LDWDP_ru6, XCORE_INS_LDW,
    859 #ifndef CAPSTONE_DIET
    860 		{ 0 }, { 0 }, { 0 }, 0, 0
    861 #endif
    862 	},
    863 	{
    864 		XCore_LDWSP_lru6, XCORE_INS_LDW,
    865 #ifndef CAPSTONE_DIET
    866 		{ XCORE_REG_SP, 0 }, { 0 }, { 0 }, 0, 0
    867 #endif
    868 	},
    869 	{
    870 		XCore_LDWSP_ru6, XCORE_INS_LDW,
    871 #ifndef CAPSTONE_DIET
    872 		{ XCORE_REG_SP, 0 }, { 0 }, { 0 }, 0, 0
    873 #endif
    874 	},
    875 	{
    876 		XCore_LDW_2rus, XCORE_INS_LDW,
    877 #ifndef CAPSTONE_DIET
    878 		{ 0 }, { 0 }, { 0 }, 0, 0
    879 #endif
    880 	},
    881 	{
    882 		XCore_LDW_3r, XCORE_INS_LDW,
    883 #ifndef CAPSTONE_DIET
    884 		{ 0 }, { 0 }, { 0 }, 0, 0
    885 #endif
    886 	},
    887 	{
    888 		XCore_LMUL_l6r, XCORE_INS_LMUL,
    889 #ifndef CAPSTONE_DIET
    890 		{ 0 }, { 0 }, { 0 }, 0, 0
    891 #endif
    892 	},
    893 	{
    894 		XCore_LSS_3r, XCORE_INS_LSS,
    895 #ifndef CAPSTONE_DIET
    896 		{ 0 }, { 0 }, { 0 }, 0, 0
    897 #endif
    898 	},
    899 	{
    900 		XCore_LSUB_l5r, XCORE_INS_LSUB,
    901 #ifndef CAPSTONE_DIET
    902 		{ 0 }, { 0 }, { 0 }, 0, 0
    903 #endif
    904 	},
    905 	{
    906 		XCore_LSU_3r, XCORE_INS_LSU,
    907 #ifndef CAPSTONE_DIET
    908 		{ 0 }, { 0 }, { 0 }, 0, 0
    909 #endif
    910 	},
    911 	{
    912 		XCore_MACCS_l4r, XCORE_INS_MACCS,
    913 #ifndef CAPSTONE_DIET
    914 		{ 0 }, { 0 }, { 0 }, 0, 0
    915 #endif
    916 	},
    917 	{
    918 		XCore_MACCU_l4r, XCORE_INS_MACCU,
    919 #ifndef CAPSTONE_DIET
    920 		{ 0 }, { 0 }, { 0 }, 0, 0
    921 #endif
    922 	},
    923 	{
    924 		XCore_MJOIN_1r, XCORE_INS_MJOIN,
    925 #ifndef CAPSTONE_DIET
    926 		{ 0 }, { 0 }, { 0 }, 0, 0
    927 #endif
    928 	},
    929 	{
    930 		XCore_MKMSK_2r, XCORE_INS_MKMSK,
    931 #ifndef CAPSTONE_DIET
    932 		{ 0 }, { 0 }, { 0 }, 0, 0
    933 #endif
    934 	},
    935 	{
    936 		XCore_MKMSK_rus, XCORE_INS_MKMSK,
    937 #ifndef CAPSTONE_DIET
    938 		{ 0 }, { 0 }, { 0 }, 0, 0
    939 #endif
    940 	},
    941 	{
    942 		XCore_MSYNC_1r, XCORE_INS_MSYNC,
    943 #ifndef CAPSTONE_DIET
    944 		{ 0 }, { 0 }, { 0 }, 0, 0
    945 #endif
    946 	},
    947 	{
    948 		XCore_MUL_l3r, XCORE_INS_MUL,
    949 #ifndef CAPSTONE_DIET
    950 		{ 0 }, { 0 }, { 0 }, 0, 0
    951 #endif
    952 	},
    953 	{
    954 		XCore_NEG, XCORE_INS_NEG,
    955 #ifndef CAPSTONE_DIET
    956 		{ 0 }, { 0 }, { 0 }, 0, 0
    957 #endif
    958 	},
    959 	{
    960 		XCore_NOT, XCORE_INS_NOT,
    961 #ifndef CAPSTONE_DIET
    962 		{ 0 }, { 0 }, { 0 }, 0, 0
    963 #endif
    964 	},
    965 	{
    966 		XCore_OR_3r, XCORE_INS_OR,
    967 #ifndef CAPSTONE_DIET
    968 		{ 0 }, { 0 }, { 0 }, 0, 0
    969 #endif
    970 	},
    971 	{
    972 		XCore_OUTCT_2r, XCORE_INS_OUTCT,
    973 #ifndef CAPSTONE_DIET
    974 		{ 0 }, { 0 }, { 0 }, 0, 0
    975 #endif
    976 	},
    977 	{
    978 		XCore_OUTCT_rus, XCORE_INS_OUTCT,
    979 #ifndef CAPSTONE_DIET
    980 		{ 0 }, { 0 }, { 0 }, 0, 0
    981 #endif
    982 	},
    983 	{
    984 		XCore_OUTPW_l2rus, XCORE_INS_OUTPW,
    985 #ifndef CAPSTONE_DIET
    986 		{ 0 }, { 0 }, { 0 }, 0, 0
    987 #endif
    988 	},
    989 	{
    990 		XCore_OUTSHR_2r, XCORE_INS_OUTSHR,
    991 #ifndef CAPSTONE_DIET
    992 		{ 0 }, { 0 }, { 0 }, 0, 0
    993 #endif
    994 	},
    995 	{
    996 		XCore_OUTT_2r, XCORE_INS_OUTT,
    997 #ifndef CAPSTONE_DIET
    998 		{ 0 }, { 0 }, { 0 }, 0, 0
    999 #endif
   1000 	},
   1001 	{
   1002 		XCore_OUT_2r, XCORE_INS_OUT,
   1003 #ifndef CAPSTONE_DIET
   1004 		{ 0 }, { 0 }, { 0 }, 0, 0
   1005 #endif
   1006 	},
   1007 	{
   1008 		XCore_PEEK_2r, XCORE_INS_PEEK,
   1009 #ifndef CAPSTONE_DIET
   1010 		{ 0 }, { 0 }, { 0 }, 0, 0
   1011 #endif
   1012 	},
   1013 	{
   1014 		XCore_REMS_l3r, XCORE_INS_REMS,
   1015 #ifndef CAPSTONE_DIET
   1016 		{ 0 }, { 0 }, { 0 }, 0, 0
   1017 #endif
   1018 	},
   1019 	{
   1020 		XCore_REMU_l3r, XCORE_INS_REMU,
   1021 #ifndef CAPSTONE_DIET
   1022 		{ 0 }, { 0 }, { 0 }, 0, 0
   1023 #endif
   1024 	},
   1025 	{
   1026 		XCore_RETSP_lu6, XCORE_INS_RETSP,
   1027 #ifndef CAPSTONE_DIET
   1028 		{ XCORE_REG_SP, 0 }, { XCORE_REG_SP, 0 }, { 0 }, 0, 0
   1029 #endif
   1030 	},
   1031 	{
   1032 		XCore_RETSP_u6, XCORE_INS_RETSP,
   1033 #ifndef CAPSTONE_DIET
   1034 		{ XCORE_REG_SP, 0 }, { XCORE_REG_SP, 0 }, { 0 }, 0, 0
   1035 #endif
   1036 	},
   1037 	{
   1038 		XCore_SETCLK_l2r, XCORE_INS_SETCLK,
   1039 #ifndef CAPSTONE_DIET
   1040 		{ 0 }, { 0 }, { 0 }, 0, 0
   1041 #endif
   1042 	},
   1043 	{
   1044 		XCore_SETCP_1r, XCORE_INS_SET,
   1045 #ifndef CAPSTONE_DIET
   1046 		{ 0 }, { 0 }, { 0 }, 0, 0
   1047 #endif
   1048 	},
   1049 	{
   1050 		XCore_SETC_l2r, XCORE_INS_SETC,
   1051 #ifndef CAPSTONE_DIET
   1052 		{ 0 }, { 0 }, { 0 }, 0, 0
   1053 #endif
   1054 	},
   1055 	{
   1056 		XCore_SETC_lru6, XCORE_INS_SETC,
   1057 #ifndef CAPSTONE_DIET
   1058 		{ 0 }, { 0 }, { 0 }, 0, 0
   1059 #endif
   1060 	},
   1061 	{
   1062 		XCore_SETC_ru6, XCORE_INS_SETC,
   1063 #ifndef CAPSTONE_DIET
   1064 		{ 0 }, { 0 }, { 0 }, 0, 0
   1065 #endif
   1066 	},
   1067 	{
   1068 		XCore_SETDP_1r, XCORE_INS_SET,
   1069 #ifndef CAPSTONE_DIET
   1070 		{ 0 }, { 0 }, { 0 }, 0, 0
   1071 #endif
   1072 	},
   1073 	{
   1074 		XCore_SETD_2r, XCORE_INS_SETD,
   1075 #ifndef CAPSTONE_DIET
   1076 		{ 0 }, { 0 }, { 0 }, 0, 0
   1077 #endif
   1078 	},
   1079 	{
   1080 		XCore_SETEV_1r, XCORE_INS_SETEV,
   1081 #ifndef CAPSTONE_DIET
   1082 		{ XCORE_REG_R11, 0 }, { 0 }, { 0 }, 0, 0
   1083 #endif
   1084 	},
   1085 	{
   1086 		XCore_SETKEP_0R, XCORE_INS_SET,
   1087 #ifndef CAPSTONE_DIET
   1088 		{ XCORE_REG_R11, 0 }, { 0 }, { 0 }, 0, 0
   1089 #endif
   1090 	},
   1091 	{
   1092 		XCore_SETN_l2r, XCORE_INS_SETN,
   1093 #ifndef CAPSTONE_DIET
   1094 		{ 0 }, { 0 }, { 0 }, 0, 0
   1095 #endif
   1096 	},
   1097 	{
   1098 		XCore_SETPSC_2r, XCORE_INS_SETPSC,
   1099 #ifndef CAPSTONE_DIET
   1100 		{ 0 }, { 0 }, { 0 }, 0, 0
   1101 #endif
   1102 	},
   1103 	{
   1104 		XCore_SETPS_l2r, XCORE_INS_SET,
   1105 #ifndef CAPSTONE_DIET
   1106 		{ 0 }, { 0 }, { 0 }, 0, 0
   1107 #endif
   1108 	},
   1109 	{
   1110 		XCore_SETPT_2r, XCORE_INS_SETPT,
   1111 #ifndef CAPSTONE_DIET
   1112 		{ 0 }, { 0 }, { 0 }, 0, 0
   1113 #endif
   1114 	},
   1115 	{
   1116 		XCore_SETRDY_l2r, XCORE_INS_SETRDY,
   1117 #ifndef CAPSTONE_DIET
   1118 		{ 0 }, { 0 }, { 0 }, 0, 0
   1119 #endif
   1120 	},
   1121 	{
   1122 		XCore_SETSP_1r, XCORE_INS_SET,
   1123 #ifndef CAPSTONE_DIET
   1124 		{ 0 }, { XCORE_REG_SP, 0 }, { 0 }, 0, 0
   1125 #endif
   1126 	},
   1127 	{
   1128 		XCore_SETSR_branch_lu6, XCORE_INS_SETSR,
   1129 #ifndef CAPSTONE_DIET
   1130 		{ 0 }, { 0 }, { 0 }, 1, 1
   1131 #endif
   1132 	},
   1133 	{
   1134 		XCore_SETSR_branch_u6, XCORE_INS_SETSR,
   1135 #ifndef CAPSTONE_DIET
   1136 		{ 0 }, { 0 }, { 0 }, 1, 1
   1137 #endif
   1138 	},
   1139 	{
   1140 		XCore_SETSR_lu6, XCORE_INS_SETSR,
   1141 #ifndef CAPSTONE_DIET
   1142 		{ 0 }, { 0 }, { 0 }, 0, 0
   1143 #endif
   1144 	},
   1145 	{
   1146 		XCore_SETSR_u6, XCORE_INS_SETSR,
   1147 #ifndef CAPSTONE_DIET
   1148 		{ 0 }, { 0 }, { 0 }, 0, 0
   1149 #endif
   1150 	},
   1151 	{
   1152 		XCore_SETTW_l2r, XCORE_INS_SETTW,
   1153 #ifndef CAPSTONE_DIET
   1154 		{ 0 }, { 0 }, { 0 }, 0, 0
   1155 #endif
   1156 	},
   1157 	{
   1158 		XCore_SETV_1r, XCORE_INS_SETV,
   1159 #ifndef CAPSTONE_DIET
   1160 		{ XCORE_REG_R11, 0 }, { 0 }, { 0 }, 0, 0
   1161 #endif
   1162 	},
   1163 	{
   1164 		XCore_SEXT_2r, XCORE_INS_SEXT,
   1165 #ifndef CAPSTONE_DIET
   1166 		{ 0 }, { 0 }, { 0 }, 0, 0
   1167 #endif
   1168 	},
   1169 	{
   1170 		XCore_SEXT_rus, XCORE_INS_SEXT,
   1171 #ifndef CAPSTONE_DIET
   1172 		{ 0 }, { 0 }, { 0 }, 0, 0
   1173 #endif
   1174 	},
   1175 	{
   1176 		XCore_SHL_2rus, XCORE_INS_SHL,
   1177 #ifndef CAPSTONE_DIET
   1178 		{ 0 }, { 0 }, { 0 }, 0, 0
   1179 #endif
   1180 	},
   1181 	{
   1182 		XCore_SHL_3r, XCORE_INS_SHL,
   1183 #ifndef CAPSTONE_DIET
   1184 		{ 0 }, { 0 }, { 0 }, 0, 0
   1185 #endif
   1186 	},
   1187 	{
   1188 		XCore_SHR_2rus, XCORE_INS_SHR,
   1189 #ifndef CAPSTONE_DIET
   1190 		{ 0 }, { 0 }, { 0 }, 0, 0
   1191 #endif
   1192 	},
   1193 	{
   1194 		XCore_SHR_3r, XCORE_INS_SHR,
   1195 #ifndef CAPSTONE_DIET
   1196 		{ 0 }, { 0 }, { 0 }, 0, 0
   1197 #endif
   1198 	},
   1199 	{
   1200 		XCore_SSYNC_0r, XCORE_INS_SSYNC,
   1201 #ifndef CAPSTONE_DIET
   1202 		{ 0 }, { 0 }, { 0 }, 0, 0
   1203 #endif
   1204 	},
   1205 	{
   1206 		XCore_ST16_l3r, XCORE_INS_ST16,
   1207 #ifndef CAPSTONE_DIET
   1208 		{ 0 }, { 0 }, { 0 }, 0, 0
   1209 #endif
   1210 	},
   1211 	{
   1212 		XCore_ST8_l3r, XCORE_INS_ST8,
   1213 #ifndef CAPSTONE_DIET
   1214 		{ 0 }, { 0 }, { 0 }, 0, 0
   1215 #endif
   1216 	},
   1217 	{
   1218 		XCore_STET_0R, XCORE_INS_STW,
   1219 #ifndef CAPSTONE_DIET
   1220 		{ XCORE_REG_SP, 0 }, { 0 }, { 0 }, 0, 0
   1221 #endif
   1222 	},
   1223 	{
   1224 		XCore_STSED_0R, XCORE_INS_STW,
   1225 #ifndef CAPSTONE_DIET
   1226 		{ XCORE_REG_SP, 0 }, { 0 }, { 0 }, 0, 0
   1227 #endif
   1228 	},
   1229 	{
   1230 		XCore_STSPC_0R, XCORE_INS_STW,
   1231 #ifndef CAPSTONE_DIET
   1232 		{ XCORE_REG_SP, 0 }, { 0 }, { 0 }, 0, 0
   1233 #endif
   1234 	},
   1235 	{
   1236 		XCore_STSSR_0R, XCORE_INS_STW,
   1237 #ifndef CAPSTONE_DIET
   1238 		{ XCORE_REG_SP, 0 }, { 0 }, { 0 }, 0, 0
   1239 #endif
   1240 	},
   1241 	{
   1242 		XCore_STWDP_lru6, XCORE_INS_STW,
   1243 #ifndef CAPSTONE_DIET
   1244 		{ 0 }, { 0 }, { 0 }, 0, 0
   1245 #endif
   1246 	},
   1247 	{
   1248 		XCore_STWDP_ru6, XCORE_INS_STW,
   1249 #ifndef CAPSTONE_DIET
   1250 		{ 0 }, { 0 }, { 0 }, 0, 0
   1251 #endif
   1252 	},
   1253 	{
   1254 		XCore_STWSP_lru6, XCORE_INS_STW,
   1255 #ifndef CAPSTONE_DIET
   1256 		{ XCORE_REG_SP, 0 }, { 0 }, { 0 }, 0, 0
   1257 #endif
   1258 	},
   1259 	{
   1260 		XCore_STWSP_ru6, XCORE_INS_STW,
   1261 #ifndef CAPSTONE_DIET
   1262 		{ XCORE_REG_SP, 0 }, { 0 }, { 0 }, 0, 0
   1263 #endif
   1264 	},
   1265 	{
   1266 		XCore_STW_2rus, XCORE_INS_STW,
   1267 #ifndef CAPSTONE_DIET
   1268 		{ 0 }, { 0 }, { 0 }, 0, 0
   1269 #endif
   1270 	},
   1271 	{
   1272 		XCore_STW_l3r, XCORE_INS_STW,
   1273 #ifndef CAPSTONE_DIET
   1274 		{ 0 }, { 0 }, { 0 }, 0, 0
   1275 #endif
   1276 	},
   1277 	{
   1278 		XCore_SUB_2rus, XCORE_INS_SUB,
   1279 #ifndef CAPSTONE_DIET
   1280 		{ 0 }, { 0 }, { 0 }, 0, 0
   1281 #endif
   1282 	},
   1283 	{
   1284 		XCore_SUB_3r, XCORE_INS_SUB,
   1285 #ifndef CAPSTONE_DIET
   1286 		{ 0 }, { 0 }, { 0 }, 0, 0
   1287 #endif
   1288 	},
   1289 	{
   1290 		XCore_SYNCR_1r, XCORE_INS_SYNCR,
   1291 #ifndef CAPSTONE_DIET
   1292 		{ 0 }, { 0 }, { 0 }, 0, 0
   1293 #endif
   1294 	},
   1295 	{
   1296 		XCore_TESTCT_2r, XCORE_INS_TESTCT,
   1297 #ifndef CAPSTONE_DIET
   1298 		{ 0 }, { 0 }, { 0 }, 0, 0
   1299 #endif
   1300 	},
   1301 	{
   1302 		XCore_TESTLCL_l2r, XCORE_INS_TESTLCL,
   1303 #ifndef CAPSTONE_DIET
   1304 		{ 0 }, { 0 }, { 0 }, 0, 0
   1305 #endif
   1306 	},
   1307 	{
   1308 		XCore_TESTWCT_2r, XCORE_INS_TESTWCT,
   1309 #ifndef CAPSTONE_DIET
   1310 		{ 0 }, { 0 }, { 0 }, 0, 0
   1311 #endif
   1312 	},
   1313 	{
   1314 		XCore_TSETMR_2r, XCORE_INS_TSETMR,
   1315 #ifndef CAPSTONE_DIET
   1316 		{ 0 }, { 0 }, { 0 }, 0, 0
   1317 #endif
   1318 	},
   1319 	{
   1320 		XCore_TSETR_3r, XCORE_INS_SET,
   1321 #ifndef CAPSTONE_DIET
   1322 		{ 0 }, { 0 }, { 0 }, 0, 0
   1323 #endif
   1324 	},
   1325 	{
   1326 		XCore_TSTART_1R, XCORE_INS_START,
   1327 #ifndef CAPSTONE_DIET
   1328 		{ 0 }, { 0 }, { 0 }, 0, 0
   1329 #endif
   1330 	},
   1331 	{
   1332 		XCore_WAITEF_1R, XCORE_INS_WAITEF,
   1333 #ifndef CAPSTONE_DIET
   1334 		{ 0 }, { 0 }, { 0 }, 0, 0
   1335 #endif
   1336 	},
   1337 	{
   1338 		XCore_WAITET_1R, XCORE_INS_WAITET,
   1339 #ifndef CAPSTONE_DIET
   1340 		{ 0 }, { 0 }, { 0 }, 0, 0
   1341 #endif
   1342 	},
   1343 	{
   1344 		XCore_WAITEU_0R, XCORE_INS_WAITEU,
   1345 #ifndef CAPSTONE_DIET
   1346 		{ 0 }, { 0 }, { 0 }, 1, 1
   1347 #endif
   1348 	},
   1349 	{
   1350 		XCore_XOR_l3r, XCORE_INS_XOR,
   1351 #ifndef CAPSTONE_DIET
   1352 		{ 0 }, { 0 }, { 0 }, 0, 0
   1353 #endif
   1354 	},
   1355 	{
   1356 		XCore_ZEXT_2r, XCORE_INS_ZEXT,
   1357 #ifndef CAPSTONE_DIET
   1358 		{ 0 }, { 0 }, { 0 }, 0, 0
   1359 #endif
   1360 	},
   1361 	{
   1362 		XCore_ZEXT_rus, XCORE_INS_ZEXT,
   1363 #ifndef CAPSTONE_DIET
   1364 		{ 0 }, { 0 }, { 0 }, 0, 0
   1365 #endif
   1366 	},
   1367 };
   1368 
   1369 // given internal insn id, return public instruction info
   1370 void XCore_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
   1371 {
   1372 	unsigned short i;
   1373 
   1374 	i = insn_find(insns, ARR_SIZE(insns), id, &h->insn_cache);
   1375 	if (i != 0) {
   1376 		insn->id = insns[i].mapid;
   1377 
   1378 		if (h->detail) {
   1379 #ifndef CAPSTONE_DIET
   1380 			memcpy(insn->detail->regs_read, insns[i].regs_use, sizeof(insns[i].regs_use));
   1381 			insn->detail->regs_read_count = (uint8_t)count_positive(insns[i].regs_use);
   1382 
   1383 			memcpy(insn->detail->regs_write, insns[i].regs_mod, sizeof(insns[i].regs_mod));
   1384 			insn->detail->regs_write_count = (uint8_t)count_positive(insns[i].regs_mod);
   1385 
   1386 			memcpy(insn->detail->groups, insns[i].groups, sizeof(insns[i].groups));
   1387 			insn->detail->groups_count = (uint8_t)count_positive(insns[i].groups);
   1388 
   1389 			if (insns[i].branch || insns[i].indirect_branch) {
   1390 				// this insn also belongs to JUMP group. add JUMP group
   1391 				insn->detail->groups[insn->detail->groups_count] = XCORE_GRP_JUMP;
   1392 				insn->detail->groups_count++;
   1393 			}
   1394 #endif
   1395 		}
   1396 	}
   1397 }
   1398 
   1399 #ifndef CAPSTONE_DIET
   1400 static name_map insn_name_maps[] = {
   1401 	{ XCORE_INS_INVALID, NULL },
   1402 
   1403 	{ XCORE_INS_ADD, "add" },
   1404 	{ XCORE_INS_ANDNOT, "andnot" },
   1405 	{ XCORE_INS_AND, "and" },
   1406 	{ XCORE_INS_ASHR, "ashr" },
   1407 	{ XCORE_INS_BAU, "bau" },
   1408 	{ XCORE_INS_BITREV, "bitrev" },
   1409 	{ XCORE_INS_BLA, "bla" },
   1410 	{ XCORE_INS_BLAT, "blat" },
   1411 	{ XCORE_INS_BL, "bl" },
   1412 	{ XCORE_INS_BF, "bf" },
   1413 	{ XCORE_INS_BT, "bt" },
   1414 	{ XCORE_INS_BU, "bu" },
   1415 	{ XCORE_INS_BRU, "bru" },
   1416 	{ XCORE_INS_BYTEREV, "byterev" },
   1417 	{ XCORE_INS_CHKCT, "chkct" },
   1418 	{ XCORE_INS_CLRE, "clre" },
   1419 	{ XCORE_INS_CLRPT, "clrpt" },
   1420 	{ XCORE_INS_CLRSR, "clrsr" },
   1421 	{ XCORE_INS_CLZ, "clz" },
   1422 	{ XCORE_INS_CRC8, "crc8" },
   1423 	{ XCORE_INS_CRC32, "crc32" },
   1424 	{ XCORE_INS_DCALL, "dcall" },
   1425 	{ XCORE_INS_DENTSP, "dentsp" },
   1426 	{ XCORE_INS_DGETREG, "dgetreg" },
   1427 	{ XCORE_INS_DIVS, "divs" },
   1428 	{ XCORE_INS_DIVU, "divu" },
   1429 	{ XCORE_INS_DRESTSP, "drestsp" },
   1430 	{ XCORE_INS_DRET, "dret" },
   1431 	{ XCORE_INS_ECALLF, "ecallf" },
   1432 	{ XCORE_INS_ECALLT, "ecallt" },
   1433 	{ XCORE_INS_EDU, "edu" },
   1434 	{ XCORE_INS_EEF, "eef" },
   1435 	{ XCORE_INS_EET, "eet" },
   1436 	{ XCORE_INS_EEU, "eeu" },
   1437 	{ XCORE_INS_ENDIN, "endin" },
   1438 	{ XCORE_INS_ENTSP, "entsp" },
   1439 	{ XCORE_INS_EQ, "eq" },
   1440 	{ XCORE_INS_EXTDP, "extdp" },
   1441 	{ XCORE_INS_EXTSP, "extsp" },
   1442 	{ XCORE_INS_FREER, "freer" },
   1443 	{ XCORE_INS_FREET, "freet" },
   1444 	{ XCORE_INS_GETD, "getd" },
   1445 	{ XCORE_INS_GET, "get" },
   1446 	{ XCORE_INS_GETN, "getn" },
   1447 	{ XCORE_INS_GETR, "getr" },
   1448 	{ XCORE_INS_GETSR, "getsr" },
   1449 	{ XCORE_INS_GETST, "getst" },
   1450 	{ XCORE_INS_GETTS, "getts" },
   1451 	{ XCORE_INS_INCT, "inct" },
   1452 	{ XCORE_INS_INIT, "init" },
   1453 	{ XCORE_INS_INPW, "inpw" },
   1454 	{ XCORE_INS_INSHR, "inshr" },
   1455 	{ XCORE_INS_INT, "int" },
   1456 	{ XCORE_INS_IN, "in" },
   1457 	{ XCORE_INS_KCALL, "kcall" },
   1458 	{ XCORE_INS_KENTSP, "kentsp" },
   1459 	{ XCORE_INS_KRESTSP, "krestsp" },
   1460 	{ XCORE_INS_KRET, "kret" },
   1461 	{ XCORE_INS_LADD, "ladd" },
   1462 	{ XCORE_INS_LD16S, "ld16s" },
   1463 	{ XCORE_INS_LD8U, "ld8u" },
   1464 	{ XCORE_INS_LDA16, "lda16" },
   1465 	{ XCORE_INS_LDAP, "ldap" },
   1466 	{ XCORE_INS_LDAW, "ldaw" },
   1467 	{ XCORE_INS_LDC, "ldc" },
   1468 	{ XCORE_INS_LDW, "ldw" },
   1469 	{ XCORE_INS_LDIVU, "ldivu" },
   1470 	{ XCORE_INS_LMUL, "lmul" },
   1471 	{ XCORE_INS_LSS, "lss" },
   1472 	{ XCORE_INS_LSUB, "lsub" },
   1473 	{ XCORE_INS_LSU, "lsu" },
   1474 	{ XCORE_INS_MACCS, "maccs" },
   1475 	{ XCORE_INS_MACCU, "maccu" },
   1476 	{ XCORE_INS_MJOIN, "mjoin" },
   1477 	{ XCORE_INS_MKMSK, "mkmsk" },
   1478 	{ XCORE_INS_MSYNC, "msync" },
   1479 	{ XCORE_INS_MUL, "mul" },
   1480 	{ XCORE_INS_NEG, "neg" },
   1481 	{ XCORE_INS_NOT, "not" },
   1482 	{ XCORE_INS_OR, "or" },
   1483 	{ XCORE_INS_OUTCT, "outct" },
   1484 	{ XCORE_INS_OUTPW, "outpw" },
   1485 	{ XCORE_INS_OUTSHR, "outshr" },
   1486 	{ XCORE_INS_OUTT, "outt" },
   1487 	{ XCORE_INS_OUT, "out" },
   1488 	{ XCORE_INS_PEEK, "peek" },
   1489 	{ XCORE_INS_REMS, "rems" },
   1490 	{ XCORE_INS_REMU, "remu" },
   1491 	{ XCORE_INS_RETSP, "retsp" },
   1492 	{ XCORE_INS_SETCLK, "setclk" },
   1493 	{ XCORE_INS_SET, "set" },
   1494 	{ XCORE_INS_SETC, "setc" },
   1495 	{ XCORE_INS_SETD, "setd" },
   1496 	{ XCORE_INS_SETEV, "setev" },
   1497 	{ XCORE_INS_SETN, "setn" },
   1498 	{ XCORE_INS_SETPSC, "setpsc" },
   1499 	{ XCORE_INS_SETPT, "setpt" },
   1500 	{ XCORE_INS_SETRDY, "setrdy" },
   1501 	{ XCORE_INS_SETSR, "setsr" },
   1502 	{ XCORE_INS_SETTW, "settw" },
   1503 	{ XCORE_INS_SETV, "setv" },
   1504 	{ XCORE_INS_SEXT, "sext" },
   1505 	{ XCORE_INS_SHL, "shl" },
   1506 	{ XCORE_INS_SHR, "shr" },
   1507 	{ XCORE_INS_SSYNC, "ssync" },
   1508 	{ XCORE_INS_ST16, "st16" },
   1509 	{ XCORE_INS_ST8, "st8" },
   1510 	{ XCORE_INS_STW, "stw" },
   1511 	{ XCORE_INS_SUB, "sub" },
   1512 	{ XCORE_INS_SYNCR, "syncr" },
   1513 	{ XCORE_INS_TESTCT, "testct" },
   1514 	{ XCORE_INS_TESTLCL, "testlcl" },
   1515 	{ XCORE_INS_TESTWCT, "testwct" },
   1516 	{ XCORE_INS_TSETMR, "tsetmr" },
   1517 	{ XCORE_INS_START, "start" },
   1518 	{ XCORE_INS_WAITEF, "waitef" },
   1519 	{ XCORE_INS_WAITET, "waitet" },
   1520 	{ XCORE_INS_WAITEU, "waiteu" },
   1521 	{ XCORE_INS_XOR, "xor" },
   1522 	{ XCORE_INS_ZEXT, "zext" },
   1523 };
   1524 
   1525 // special alias insn
   1526 static name_map alias_insn_names[] = {
   1527 	{ 0, NULL }
   1528 };
   1529 #endif
   1530 
   1531 const char *XCore_insn_name(csh handle, unsigned int id)
   1532 {
   1533 #ifndef CAPSTONE_DIET
   1534 	unsigned int i;
   1535 
   1536 	if (id >= XCORE_INS_ENDING)
   1537 		return NULL;
   1538 
   1539 	// handle special alias first
   1540 	for (i = 0; i < ARR_SIZE(alias_insn_names); i++) {
   1541 		if (alias_insn_names[i].id == id)
   1542 			return alias_insn_names[i].name;
   1543 	}
   1544 
   1545 	return insn_name_maps[id].name;
   1546 #else
   1547 	return NULL;
   1548 #endif
   1549 }
   1550 
   1551 #ifndef CAPSTONE_DIET
   1552 static name_map group_name_maps[] = {
   1553 	{ XCORE_GRP_INVALID, NULL },
   1554 	{ XCORE_GRP_JUMP, "jump" },
   1555 };
   1556 #endif
   1557 
   1558 const char *XCore_group_name(csh handle, unsigned int id)
   1559 {
   1560 #ifndef CAPSTONE_DIET
   1561 	if (id >= XCORE_GRP_ENDING)
   1562 		return NULL;
   1563 
   1564 	return group_name_maps[id].name;
   1565 #else
   1566 	return NULL;
   1567 #endif
   1568 }
   1569 
   1570 // map internal raw register to 'public' register
   1571 xcore_reg XCore_map_register(unsigned int r)
   1572 {
   1573 	static unsigned int map[] = { 0,
   1574 	};
   1575 
   1576 	if (r < ARR_SIZE(map))
   1577 		return map[r];
   1578 
   1579 	// cannot find this register
   1580 	return 0;
   1581 }
   1582 
   1583 #endif
   1584