| 1 | //===-- XCoreInstPrinter.cpp - Convert XCore MCInst to assembly syntax --------===//cxx . . $ `<file>/arch/XCore/XCoreInstPrinter.c`/ |
| 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 XCore MCInst to a .s file. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | /* Capstone Disassembly Engine */ |
| 15 | /* By Nguyen Anh Quynh <[email protected]>, 2013-2015 */ |
| 16 | |
| 17 | #ifdef CAPSTONE_HAS_XCOREcxx . . $ `<built-in>:421:9`! |
| 18 | |
| 19 | #if defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64) |
| 20 | #pragma warning(disable : 4996) // disable MSVC's warning on strcpy() |
| 21 | #pragma warning(disable : 28719) // disable MSVC's warning on strcpy() |
| 22 | #endif |
| 23 | |
| 24 | #include <stdio.h> |
| 25 | #include <stdlib.h> |
| 26 | #include <string.h> |
| 27 | #include <capstone/platform.h>cxx . . $ `<file>/include/capstone/platform.h`/ |
| 28 | |
| 29 | #include "XCoreInstPrinter.h"cxx . . $ `<file>/arch/XCore/XCoreInstPrinter.h`/ |
| 30 | #include "../../MCInst.h"cxx . . $ `<file>/MCInst.h`/ |
| 31 | #include "../../utils.h"cxx . . $ `<file>/utils.h`/ |
| 32 | #include "../../SStream.h"cxx . . $ `<file>/SStream.h`/ |
| 33 | #include "../../MCRegisterInfo.h"cxx . . $ `<file>/MCRegisterInfo.h`/ |
| 34 | #include "../../MathExtras.h"cxx . . $ `<file>/MathExtras.h`/ |
| 35 | #include "XCoreMapping.h"cxx . . $ `<file>/arch/XCore/XCoreMapping.h`/ |
| 36 | |
| 37 | static const char *getRegisterNamecxx . . $ getRegisterName(81a3ae90da26a711).(unsigned RegNo); |
| 38 | |
| 39 | void XCore_post_printercxx . . $ XCore_post_printer(1e4eab0813f35322).(cshcxx . . $ csh# ud, cs_insncxx . . $ cs_insn# *insn, char *insn_asm, MCInstcxx . . $ MCInst# *mci) |
| 40 | { |
| 41 | /* |
| 42 | if (((cs_struct *)ud)->detail != CS_OPT_ON) |
| 43 | return; |
| 44 | */ |
| 45 | } |
| 46 | |
| 47 | // stw sed, sp[3] |
| 48 | void XCore_insn_extractcxx . . $ XCore_insn_extract(2f514d21ae73b00e).(MCInstcxx . . $ MCInst# *MI, const char *code) |
| 49 | { |
| 50 | int id; |
| 51 | char *p, *p2; |
| 52 | char tmp[128]; |
| 53 | |
| 54 | strcpycxx . . $ strcpy(b7b3a83273496486).(tmp, code); // safe because code is way shorter than 128 bytes |
| 55 | |
| 56 | // find the first space |
| 57 | p = strchrcxx . . $ strchr(2050848944e00d54).(tmp, ' '); |
| 58 | if (p) { |
| 59 | p++; |
| 60 | // find the next ',' |
| 61 | p2 = strchrcxx . . $ strchr(2050848944e00d54).(p, ','); |
| 62 | if (p2) { |
| 63 | *p2 = '\0'; |
| 64 | id = XCore_reg_idcxx . . $ XCore_reg_id(fbc3349276a8bd32).(p); |
| 65 | if (id) { |
| 66 | // register |
| 67 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 68 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].typecxx . . $ cs_xcore_op#type. = XCORE_OP_REGcxx . . $ XCORE_OP_REG.; |
| 69 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].regcxx . . $ cs_xcore_op#$anonymous_type_0#reg. = id; |
| 70 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.++; |
| 71 | } |
| 72 | } |
| 73 | // next should be register, or memory? |
| 74 | // skip space |
| 75 | p2++; |
| 76 | while(*p2 && *p2 == ' ') |
| 77 | p2++; |
| 78 | if (*p2) { |
| 79 | // find '[' |
| 80 | p = p2; |
| 81 | while(*p && *p != '[') |
| 82 | p++; |
| 83 | if (*p) { |
| 84 | // this is '[' |
| 85 | *p = '\0'; |
| 86 | id = XCore_reg_idcxx . . $ XCore_reg_id(fbc3349276a8bd32).(p2); |
| 87 | if (id) { |
| 88 | // base register |
| 89 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 90 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].typecxx . . $ cs_xcore_op#type. = XCORE_OP_MEMcxx . . $ XCORE_OP_MEM.; |
| 91 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..basecxx . . $ xcore_op_mem#base. = (uint8_tcxx . . $ uint8_t#)id; |
| 92 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..indexcxx . . $ xcore_op_mem#index. = XCORE_REG_INVALIDcxx . . $ XCORE_REG_INVALID.; |
| 93 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..dispcxx . . $ xcore_op_mem#disp. = 0; |
| 94 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..directcxx . . $ xcore_op_mem#direct. = 1; |
| 95 | } |
| 96 | |
| 97 | p++; |
| 98 | p2 = p; |
| 99 | // until ']' |
| 100 | while(*p && *p != ']') |
| 101 | p++; |
| 102 | if (*p) { |
| 103 | *p = '\0'; |
| 104 | // p2 is either index, or disp |
| 105 | id = XCore_reg_idcxx . . $ XCore_reg_id(fbc3349276a8bd32).(p2); |
| 106 | if (id) { |
| 107 | // index register |
| 108 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 109 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..indexcxx . . $ xcore_op_mem#index. = (uint8_tcxx . . $ uint8_t#)id; |
| 110 | } |
| 111 | } else { |
| 112 | // a number means disp |
| 113 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 114 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..dispcxx . . $ xcore_op_mem#disp. = atoicxx . . $ atoi(5c4306d8553b3696).(p2); |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 120 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.++; |
| 121 | } |
| 122 | } |
| 123 | } else { |
| 124 | // a register? |
| 125 | id = XCore_reg_idcxx . . $ XCore_reg_id(fbc3349276a8bd32).(p2); |
| 126 | if (id) { |
| 127 | // register |
| 128 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 129 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].typecxx . . $ cs_xcore_op#type. = XCORE_OP_REGcxx . . $ XCORE_OP_REG.; |
| 130 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].regcxx . . $ cs_xcore_op#$anonymous_type_0#reg. = id; |
| 131 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.++; |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | } else { |
| 137 | id = XCore_reg_idcxx . . $ XCore_reg_id(fbc3349276a8bd32).(p); |
| 138 | if (id) { |
| 139 | // register |
| 140 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 141 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].typecxx . . $ cs_xcore_op#type. = XCORE_OP_REGcxx . . $ XCORE_OP_REG.; |
| 142 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].regcxx . . $ cs_xcore_op#$anonymous_type_0#reg. = id; |
| 143 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.++; |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | static void set_mem_accesscxx . . $ set_mem_access(b7616935d5486c42).(MCInstcxx . . $ MCInst# *MI, boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! status, int reg) |
| 151 | { |
| 152 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail. != CS_OPT_ONcxx . . $ CS_OPT_ON.) |
| 153 | return; |
| 154 | |
| 155 | MI->cshcxx . . $ MCInst#csh.->doing_memcxx . . $ cs_struct#doing_mem. = status; |
| 156 | if (status) { |
| 157 | if (reg != 0xffff && reg != -0xffff) { |
| 158 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].typecxx . . $ cs_xcore_op#type. = XCORE_OP_MEMcxx . . $ XCORE_OP_MEM.; |
| 159 | if (reg) { |
| 160 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..basecxx . . $ xcore_op_mem#base. = (uint8_tcxx . . $ uint8_t#)reg; |
| 161 | } else { |
| 162 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..basecxx . . $ xcore_op_mem#base. = XCORE_REG_INVALIDcxx . . $ XCORE_REG_INVALID.; |
| 163 | } |
| 164 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..indexcxx . . $ xcore_op_mem#index. = XCORE_REG_INVALIDcxx . . $ XCORE_REG_INVALID.; |
| 165 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..dispcxx . . $ xcore_op_mem#disp. = 0; |
| 166 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..directcxx . . $ xcore_op_mem#direct. = 1; |
| 167 | } else { |
| 168 | // the last op should be the memory base |
| 169 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.--; |
| 170 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].typecxx . . $ cs_xcore_op#type. = XCORE_OP_MEMcxx . . $ XCORE_OP_MEM.; |
| 171 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..basecxx . . $ xcore_op_mem#base. = (uint8_tcxx . . $ uint8_t#)MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].regcxx . . $ cs_xcore_op#$anonymous_type_0#reg.; |
| 172 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..indexcxx . . $ xcore_op_mem#index. = XCORE_REG_INVALIDcxx . . $ XCORE_REG_INVALID.; |
| 173 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..dispcxx . . $ xcore_op_mem#disp. = 0; |
| 174 | if (reg > 0) |
| 175 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..directcxx . . $ xcore_op_mem#direct. = 1; |
| 176 | else |
| 177 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..directcxx . . $ xcore_op_mem#direct. = -1; |
| 178 | } |
| 179 | } else { |
| 180 | if (reg) { |
| 181 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..indexcxx . . $ xcore_op_mem#index. = (uint8_tcxx . . $ uint8_t#)reg; |
| 182 | // done, create the next operand slot |
| 183 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.++; |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | static void _printOperandcxx . . $ _printOperand(38fa567fd85e5fad).(MCInstcxx . . $ MCInst# *MI, MCOperandcxx . . $ MCOperand# *MO, SStreamcxx . . $ SStream# *O) |
| 189 | { |
| 190 | if (MCOperand_isRegcxx . . $ MCOperand_isReg(8be14e8515538be0).(MO)) { |
| 191 | unsigned reg; |
| 192 | |
| 193 | reg = MCOperand_getRegcxx . . $ MCOperand_getReg(2f0d38ead81b409a).(MO); |
| 194 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, getRegisterNamecxx . . $ getRegisterName(81a3ae90da26a711).(reg)); |
| 195 | |
| 196 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 197 | if (MI->cshcxx . . $ MCInst#csh.->doing_memcxx . . $ cs_struct#doing_mem.) { |
| 198 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..basecxx . . $ xcore_op_mem#base. == ARM_REG_INVALIDcxx . . $ ARM_REG_INVALID.) |
| 199 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..basecxx . . $ xcore_op_mem#base. = (uint8_tcxx . . $ uint8_t#)reg; |
| 200 | else |
| 201 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..indexcxx . . $ xcore_op_mem#index. = (uint8_tcxx . . $ uint8_t#)reg; |
| 202 | } else { |
| 203 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].typecxx . . $ cs_xcore_op#type. = XCORE_OP_REGcxx . . $ XCORE_OP_REG.; |
| 204 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].regcxx . . $ cs_xcore_op#$anonymous_type_0#reg. = reg; |
| 205 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.++; |
| 206 | } |
| 207 | } |
| 208 | } else if (MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MO)) { |
| 209 | int32_tcxx . . $ int32_t# Imm = (int32_tcxx . . $ int32_t#)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MO); |
| 210 | |
| 211 | printInt32cxx . . $ printInt32(42251ac09f06cabf).(O, Imm); |
| 212 | |
| 213 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 214 | if (MI->cshcxx . . $ MCInst#csh.->doing_memcxx . . $ cs_struct#doing_mem.) { |
| 215 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].memcxx . . $ cs_xcore_op#$anonymous_type_0#mem..dispcxx . . $ xcore_op_mem#disp. = Imm; |
| 216 | } else { |
| 217 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].typecxx . . $ cs_xcore_op#type. = XCORE_OP_IMMcxx . . $ XCORE_OP_IMM.; |
| 218 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..operandscxx . . $ cs_xcore#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.].immcxx . . $ cs_xcore_op#$anonymous_type_0#imm. = Imm; |
| 219 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->xcorecxx . . $ cs_detail#$anonymous_type_0#xcore..op_countcxx . . $ cs_xcore#op_count.++; |
| 220 | } |
| 221 | } |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | static void printOperandcxx . . $ printOperand(3697f441d84167e5).(MCInstcxx . . $ MCInst# *MI, int OpNum, SStreamcxx . . $ SStream# *O) |
| 226 | { |
| 227 | if (OpNum >= MI->sizecxx . . $ MCInst#size.) |
| 228 | return; |
| 229 | |
| 230 | _printOperandcxx . . $ _printOperand(38fa567fd85e5fad).(MI, MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNum), O); |
| 231 | } |
| 232 | |
| 233 | static void printInlineJTcxx . . $ printInlineJT(3697f441d84167e5).(MCInstcxx . . $ MCInst# *MI, int OpNum, SStreamcxx . . $ SStream# *O) |
| 234 | { |
| 235 | } |
| 236 | |
| 237 | static void printInlineJT32cxx . . $ printInlineJT32(3697f441d84167e5).(MCInstcxx . . $ MCInst# *MI, int OpNum, SStreamcxx . . $ SStream# *O) |
| 238 | { |
| 239 | } |
| 240 | |
| 241 | #define PRINT_ALIAS_INSTRcxx . . $ `arch/XCore/XCoreInstPrinter.c:241:9`! |
| 242 | #include "XCoreGenAsmWriter.inc"cxx . . $ `<file>/arch/XCore/XCoreGenAsmWriter.inc`/ |
| 243 | |
| 244 | void XCore_printInstcxx . . $ XCore_printInst(6238f66e5ea10f57).(MCInstcxx . . $ MCInst# *MI, SStreamcxx . . $ SStream# *O, void *Info) |
| 245 | { |
| 246 | printInstructioncxx . . $ printInstruction(d9e99caf10670d9f).(MI, O, Info); |
| 247 | set_mem_accesscxx . . $ set_mem_access(b7616935d5486c42).(MI, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, 0); |
| 248 | } |
| 249 | |
| 250 | #endif |