| 1 | //===-- PPCInstPrinter.cpp - Convert PPC MCInst to assembly syntax --------===//cxx . . $ `<file>/arch/PowerPC/PPCInstPrinter.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 PPC 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_POWERPCcxx . . $ `<built-in>:417:9`! |
| 18 | |
| 19 | #include <stdio.h> |
| 20 | #include <stdlib.h> |
| 21 | #include <string.h> |
| 22 | |
| 23 | #include "PPCInstPrinter.h"cxx . . $ `<file>/arch/PowerPC/PPCInstPrinter.h`/ |
| 24 | #include "PPCPredicates.h"cxx . . $ `<file>/arch/PowerPC/PPCPredicates.h`/ |
| 25 | #include "../../MCInst.h"cxx . . $ `<file>/MCInst.h`/ |
| 26 | #include "../../utils.h"cxx . . $ `<file>/utils.h`/ |
| 27 | #include "../../SStream.h"cxx . . $ `<file>/SStream.h`/ |
| 28 | #include "../../MCRegisterInfo.h"cxx . . $ `<file>/MCRegisterInfo.h`/ |
| 29 | #include "../../MathExtras.h"cxx . . $ `<file>/MathExtras.h`/ |
| 30 | #include "PPCMapping.h"cxx . . $ `<file>/arch/PowerPC/PPCMapping.h`/ |
| 31 | |
| 32 | #ifndef CAPSTONE_DIET |
| 33 | static const char *getRegisterNamecxx . . $ getRegisterName(81a3ae90da26a711).(unsigned RegNo); |
| 34 | #endif |
| 35 | |
| 36 | static void printOperandcxx . . $ printOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O); |
| 37 | static void printInstructioncxx . . $ printInstruction(a4713f772b1223df).(MCInstcxx . . $ MCInst# *MI, SStreamcxx . . $ SStream# *O); |
| 38 | static void printAbsBranchOperandcxx . . $ printAbsBranchOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O); |
| 39 | static char *printAliasInstrcxx . . $ printAliasInstr(137f7c0757b438a3).(MCInstcxx . . $ MCInst# *MI, SStreamcxx . . $ SStream# *OS, MCRegisterInfocxx . . $ MCRegisterInfo# *MRI); |
| 40 | static char *printAliasBcccxx . . $ printAliasBcc(880ad24b2950696a).(MCInstcxx . . $ MCInst# *MI, SStreamcxx . . $ SStream# *OS, void *info); |
| 41 | static void printCustomAliasOperandcxx . . $ printCustomAliasOperand(cd93bebea1f4dc2e).(MCInstcxx . . $ MCInst# *MI, unsigned OpIdx, |
| 42 | unsigned PrintMethodIdx, SStreamcxx . . $ SStream# *OS); |
| 43 | |
| 44 | #if 0 |
| 45 | static void printRegName(SStream *OS, unsigned RegNo) |
| 46 | { |
| 47 | char *RegName = getRegisterName(RegNo); |
| 48 | |
| 49 | if (RegName[0] == 'q' /* QPX */) { |
| 50 | // The system toolchain on the BG/Q does not understand QPX register names |
| 51 | // in .cfi_* directives, so print the name of the floating-point |
| 52 | // subregister instead. |
| 53 | RegName[0] = 'f'; |
| 54 | } |
| 55 | |
| 56 | SStream_concat0(OS, RegName); |
| 57 | } |
| 58 | #endif |
| 59 | |
| 60 | static void set_mem_accesscxx . . $ set_mem_access(512db92e0bcb52df).(MCInstcxx . . $ MCInst# *MI, boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! status) |
| 61 | { |
| 62 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail. != CS_OPT_ONcxx . . $ CS_OPT_ON.) |
| 63 | return; |
| 64 | |
| 65 | MI->cshcxx . . $ MCInst#csh.->doing_memcxx . . $ cs_struct#doing_mem. = status; |
| 66 | |
| 67 | if (status) { |
| 68 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_MEMcxx . . $ PPC_OP_MEM.; |
| 69 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].memcxx . . $ cs_ppc_op#$anonymous_type_0#mem..basecxx . . $ ppc_op_mem#base. = PPC_REG_INVALIDcxx . . $ PPC_REG_INVALID.; |
| 70 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].memcxx . . $ cs_ppc_op#$anonymous_type_0#mem..dispcxx . . $ ppc_op_mem#disp. = 0; |
| 71 | } else { |
| 72 | // done, create the next operand slot |
| 73 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | void PPC_post_printercxx . . $ PPC_post_printer(1e4eab0813f35322).(cshcxx . . $ csh# ud, cs_insncxx . . $ cs_insn# *insn, char *insn_asm, MCInstcxx . . $ MCInst# *mci) |
| 78 | { |
| 79 | if (((cs_structcxx . . $ cs_struct# *)ud)->detailcxx . . $ cs_struct#detail. != CS_OPT_ONcxx . . $ CS_OPT_ON.) |
| 80 | return; |
| 81 | |
| 82 | // check if this insn has branch hint |
| 83 | if (strrchrcxx . . $ strrchr(2050848944e00d54).(insn->mnemoniccxx . . $ cs_insn#mnemonic., '+') != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! && !strstrcxx . . $ strstr(a713fe7b9a57cf96).(insn_asm, ".+")) { |
| 84 | insn->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..bhcxx . . $ cs_ppc#bh. = PPC_BH_PLUScxx . . $ PPC_BH_PLUS.; |
| 85 | } else if (strrchrcxx . . $ strrchr(2050848944e00d54).(insn->mnemoniccxx . . $ cs_insn#mnemonic., '-') != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 86 | insn->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..bhcxx . . $ cs_ppc#bh. = PPC_BH_MINUScxx . . $ PPC_BH_MINUS.; |
| 87 | } |
| 88 | |
| 89 | if (strrchrcxx . . $ strrchr(2050848944e00d54).(insn->mnemoniccxx . . $ cs_insn#mnemonic., '.') != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 90 | insn->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..update_cr0cxx . . $ cs_ppc#update_cr0. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | #define GET_INSTRINFO_ENUMcxx . . $ `arch/PowerPC/PPCInstPrinter.c:94:9`! |
| 95 | #include "PPCGenInstrInfo.inc"cxx . . $ `<file>/arch/PowerPC/PPCGenInstrInfo.inc`/ |
| 96 | |
| 97 | #define GET_REGINFO_ENUMcxx . . $ `arch/PowerPC/PPCInstPrinter.c:97:9`! |
| 98 | #include "PPCGenRegisterInfo.inc"cxx . . $ `<file>/arch/PowerPC/PPCGenRegisterInfo.inc`/ |
| 99 | |
| 100 | static void op_addBCcxx . . $ op_addBC(1d3fdd902ae43da2).(MCInstcxx . . $ MCInst# *MI, unsigned int bc) |
| 101 | { |
| 102 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 103 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..bccxx . . $ cs_ppc#bc. = (ppc_bccxx . . $ ppc_bc#)bc; |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | #define CREQcxx . . $ `arch/PowerPC/PPCInstPrinter.c:107:9`! (0) |
| 108 | #define CRGTcxx . . $ `arch/PowerPC/PPCInstPrinter.c:108:9`! (1) |
| 109 | #define CRLTcxx . . $ `arch/PowerPC/PPCInstPrinter.c:109:9`! (2) |
| 110 | #define CRUNcxx . . $ `arch/PowerPC/PPCInstPrinter.c:110:9`! (3) |
| 111 | |
| 112 | static int getBICRCondcxx . . $ getBICRCond(7864480464b09eea).(int bi) |
| 113 | { |
| 114 | return (bi - PPC_CR0EQcxx . . $ PPC_CR0EQ.) >> 3; |
| 115 | } |
| 116 | |
| 117 | static int getBICRcxx . . $ getBICR(7864480464b09eea).(int bi) |
| 118 | { |
| 119 | return ((bi - PPC_CR0EQcxx . . $ PPC_CR0EQ.) & 7) + PPC_CR0cxx . . $ PPC_CR0.; |
| 120 | } |
| 121 | |
| 122 | static void op_addRegcxx . . $ op_addReg(1d3fdd902ae43da2).(MCInstcxx . . $ MCInst# *MI, unsigned int reg) |
| 123 | { |
| 124 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 125 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_REGcxx . . $ PPC_OP_REG.; |
| 126 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].regcxx . . $ cs_ppc_op#$anonymous_type_0#reg. = reg; |
| 127 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | static void add_CRxxcxx . . $ add_CRxx(6983fab5c328f2c).(MCInstcxx . . $ MCInst# *MI, ppc_regcxx . . $ ppc_reg# reg) |
| 132 | { |
| 133 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 134 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_REGcxx . . $ PPC_OP_REG.; |
| 135 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].regcxx . . $ cs_ppc_op#$anonymous_type_0#reg. = reg; |
| 136 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | static char *printAliasBcccxx . . $ printAliasBcc(880ad24b2950696a).(MCInstcxx . . $ MCInst# *MI, SStreamcxx . . $ SStream# *OS, void *info) |
| 141 | { |
| 142 | #define GETREGCLASS_CONTAINcxx . . $ `arch/PowerPC/PPCInstPrinter.c:142:9`!(_class, _reg) MCRegisterClass_contains(MCRegisterInfo_getRegClass(MRI, _class), MCOperand_getReg(MCInst_getOperand(MI, _reg))) |
| 143 | SStreamcxx . . $ SStream# ss; |
| 144 | const char *opCode; |
| 145 | char *tmp, *AsmMnem, *AsmOps, *c; |
| 146 | int OpIdx, PrintMethodIdx; |
| 147 | int decCtr = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, needComma = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 148 | MCRegisterInfocxx . . $ MCRegisterInfo# *MRI = (MCRegisterInfocxx . . $ MCRegisterInfo# *)info; |
| 149 | |
| 150 | SStream_Initcxx . . $ SStream_Init(6fb1d15c8294cb37).(&ss); |
| 151 | |
| 152 | switch (MCInst_getOpcodecxx . . $ MCInst_getOpcode(66549afbf0596d6c).(MI)) { |
| 153 | default: return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 154 | case PPC_gBCcxx . . $ PPC_gBC.: |
| 155 | opCode = "b%s"; |
| 156 | break; |
| 157 | case PPC_gBCAcxx . . $ PPC_gBCA.: |
| 158 | opCode = "b%sa"; |
| 159 | break; |
| 160 | case PPC_gBCCTRcxx . . $ PPC_gBCCTR.: |
| 161 | opCode = "b%sctr"; |
| 162 | break; |
| 163 | case PPC_gBCCTRLcxx . . $ PPC_gBCCTRL.: |
| 164 | opCode = "b%sctrl"; |
| 165 | break; |
| 166 | case PPC_gBCLcxx . . $ PPC_gBCL.: |
| 167 | opCode = "b%sl"; |
| 168 | break; |
| 169 | case PPC_gBCLAcxx . . $ PPC_gBCLA.: |
| 170 | opCode = "b%sla"; |
| 171 | break; |
| 172 | case PPC_gBCLRcxx . . $ PPC_gBCLR.: |
| 173 | opCode = "b%slr"; |
| 174 | break; |
| 175 | case PPC_gBCLRLcxx . . $ PPC_gBCLRL.: |
| 176 | opCode = "b%slrl"; |
| 177 | break; |
| 178 | } |
| 179 | |
| 180 | if (MCInst_getNumOperandscxx . . $ MCInst_getNumOperands(66549afbf0596d6c).(MI) == 3 && |
| 181 | MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) && |
| 182 | (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) >= 0) && |
| 183 | (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) <= 1)) { |
| 184 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, opCode, "dnzf"); |
| 185 | decCtr = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 186 | } |
| 187 | |
| 188 | if (MCInst_getNumOperandscxx . . $ MCInst_getNumOperands(66549afbf0596d6c).(MI) == 3 && |
| 189 | MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) && |
| 190 | (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) >= 2) && |
| 191 | (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) <= 3)) { |
| 192 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, opCode, "dzf"); |
| 193 | decCtr = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 194 | } |
| 195 | |
| 196 | if (MCInst_getNumOperandscxx . . $ MCInst_getNumOperands(66549afbf0596d6c).(MI) == 3 && |
| 197 | MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) && |
| 198 | (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) >= 4) && |
| 199 | (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) <= 7) && |
| 200 | MCOperand_isRegcxx . . $ MCOperand_isReg(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 1)) && |
| 201 | GETREGCLASS_CONTAINcxx . . $ `arch/PowerPC/PPCInstPrinter.c:142:9`!(PPC_CRBITRCRegClassID, 1)) { |
| 202 | int cr = getBICRCondcxx . . $ getBICRCond(7864480464b09eea).(MCOperand_getRegcxx . . $ MCOperand_getReg(2f0d38ead81b409a).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 1))); |
| 203 | |
| 204 | switch(cr) { |
| 205 | case CREQcxx . . $ `arch/PowerPC/PPCInstPrinter.c:107:9`!: |
| 206 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, opCode, "ne"); |
| 207 | break; |
| 208 | case CRGTcxx . . $ `arch/PowerPC/PPCInstPrinter.c:108:9`!: |
| 209 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, opCode, "le"); |
| 210 | break; |
| 211 | case CRLTcxx . . $ `arch/PowerPC/PPCInstPrinter.c:109:9`!: |
| 212 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, opCode, "ge"); |
| 213 | break; |
| 214 | case CRUNcxx . . $ `arch/PowerPC/PPCInstPrinter.c:110:9`!: |
| 215 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, opCode, "ns"); |
| 216 | break; |
| 217 | } |
| 218 | |
| 219 | if (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) == 6) |
| 220 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, "-"); |
| 221 | |
| 222 | if (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) == 7) |
| 223 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, "+"); |
| 224 | |
| 225 | decCtr = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 226 | } |
| 227 | |
| 228 | if (MCInst_getNumOperandscxx . . $ MCInst_getNumOperands(66549afbf0596d6c).(MI) == 3 && |
| 229 | MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) && |
| 230 | (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) >= 8) && |
| 231 | (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) <= 9)) { |
| 232 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, opCode, "dnzt"); |
| 233 | decCtr = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 234 | } |
| 235 | |
| 236 | if (MCInst_getNumOperandscxx . . $ MCInst_getNumOperands(66549afbf0596d6c).(MI) == 3 && |
| 237 | MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) && |
| 238 | (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) >= 10) && |
| 239 | (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) <= 11)) { |
| 240 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, opCode, "dzt"); |
| 241 | decCtr = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 242 | } |
| 243 | |
| 244 | if (MCInst_getNumOperandscxx . . $ MCInst_getNumOperands(66549afbf0596d6c).(MI) == 3 && |
| 245 | MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) && |
| 246 | (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) >= 12) && |
| 247 | (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) <= 15) && |
| 248 | MCOperand_isRegcxx . . $ MCOperand_isReg(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 1)) && |
| 249 | GETREGCLASS_CONTAINcxx . . $ `arch/PowerPC/PPCInstPrinter.c:142:9`!(PPC_CRBITRCRegClassID, 1)) { |
| 250 | int cr = getBICRCondcxx . . $ getBICRCond(7864480464b09eea).(MCOperand_getRegcxx . . $ MCOperand_getReg(2f0d38ead81b409a).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 1))); |
| 251 | |
| 252 | switch(cr) { |
| 253 | case CREQcxx . . $ `arch/PowerPC/PPCInstPrinter.c:107:9`!: |
| 254 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, opCode, "eq"); |
| 255 | break; |
| 256 | case CRGTcxx . . $ `arch/PowerPC/PPCInstPrinter.c:108:9`!: |
| 257 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, opCode, "gt"); |
| 258 | break; |
| 259 | case CRLTcxx . . $ `arch/PowerPC/PPCInstPrinter.c:109:9`!: |
| 260 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, opCode, "lt"); |
| 261 | break; |
| 262 | case CRUNcxx . . $ `arch/PowerPC/PPCInstPrinter.c:110:9`!: |
| 263 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, opCode, "so"); |
| 264 | break; |
| 265 | } |
| 266 | |
| 267 | if (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) == 14) |
| 268 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, "-"); |
| 269 | |
| 270 | if (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) == 15) |
| 271 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, "+"); |
| 272 | |
| 273 | decCtr = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 274 | } |
| 275 | |
| 276 | if (MCInst_getNumOperandscxx . . $ MCInst_getNumOperands(66549afbf0596d6c).(MI) == 3 && |
| 277 | MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) && |
| 278 | ((MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) & 0x12)== 16)) { |
| 279 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, opCode, "dnz"); |
| 280 | |
| 281 | if (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) == 24) |
| 282 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, "-"); |
| 283 | |
| 284 | if (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) == 25) |
| 285 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, "+"); |
| 286 | |
| 287 | needComma = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 288 | } |
| 289 | |
| 290 | if (MCInst_getNumOperandscxx . . $ MCInst_getNumOperands(66549afbf0596d6c).(MI) == 3 && |
| 291 | MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) && |
| 292 | ((MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) & 0x12)== 18)) { |
| 293 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, opCode, "dz"); |
| 294 | |
| 295 | if (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) == 26) |
| 296 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, "-"); |
| 297 | |
| 298 | if (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) == 27) |
| 299 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, "+"); |
| 300 | |
| 301 | needComma = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 302 | } |
| 303 | |
| 304 | if (MCOperand_isRegcxx . . $ MCOperand_isReg(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 1)) && |
| 305 | GETREGCLASS_CONTAINcxx . . $ `arch/PowerPC/PPCInstPrinter.c:142:9`!(PPC_CRBITRCRegClassID, 1) && |
| 306 | MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) && |
| 307 | (MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)) < 16)) { |
| 308 | int cr = getBICRcxx . . $ getBICR(7864480464b09eea).(MCOperand_getRegcxx . . $ MCOperand_getReg(2f0d38ead81b409a).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 1))); |
| 309 | |
| 310 | if (decCtr) { |
| 311 | int cd; |
| 312 | needComma = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 313 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, " "); |
| 314 | |
| 315 | if (cr > PPC_CR0cxx . . $ PPC_CR0.) { |
| 316 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, "4*cr%d+", cr - PPC_CR0cxx . . $ PPC_CR0.); |
| 317 | } |
| 318 | |
| 319 | cd = getBICRCondcxx . . $ getBICRCond(7864480464b09eea).(MCOperand_getRegcxx . . $ MCOperand_getReg(2f0d38ead81b409a).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 1))); |
| 320 | switch(cd) { |
| 321 | case CREQcxx . . $ `arch/PowerPC/PPCInstPrinter.c:107:9`!: |
| 322 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, "eq"); |
| 323 | if (cr <= PPC_CR0cxx . . $ PPC_CR0.) |
| 324 | add_CRxxcxx . . $ add_CRxx(6983fab5c328f2c).(MI, PPC_REG_CR0EQcxx . . $ PPC_REG_CR0EQ.); |
| 325 | op_addBCcxx . . $ op_addBC(1d3fdd902ae43da2).(MI, PPC_BC_EQcxx . . $ PPC_BC_EQ.); |
| 326 | break; |
| 327 | case CRGTcxx . . $ `arch/PowerPC/PPCInstPrinter.c:108:9`!: |
| 328 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, "gt"); |
| 329 | if (cr <= PPC_CR0cxx . . $ PPC_CR0.) |
| 330 | add_CRxxcxx . . $ add_CRxx(6983fab5c328f2c).(MI, PPC_REG_CR0GTcxx . . $ PPC_REG_CR0GT.); |
| 331 | op_addBCcxx . . $ op_addBC(1d3fdd902ae43da2).(MI, PPC_BC_GTcxx . . $ PPC_BC_GT.); |
| 332 | break; |
| 333 | case CRLTcxx . . $ `arch/PowerPC/PPCInstPrinter.c:109:9`!: |
| 334 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, "lt"); |
| 335 | if (cr <= PPC_CR0cxx . . $ PPC_CR0.) |
| 336 | add_CRxxcxx . . $ add_CRxx(6983fab5c328f2c).(MI, PPC_REG_CR0LTcxx . . $ PPC_REG_CR0LT.); |
| 337 | op_addBCcxx . . $ op_addBC(1d3fdd902ae43da2).(MI, PPC_BC_LTcxx . . $ PPC_BC_LT.); |
| 338 | break; |
| 339 | case CRUNcxx . . $ `arch/PowerPC/PPCInstPrinter.c:110:9`!: |
| 340 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, "so"); |
| 341 | if (cr <= PPC_CR0cxx . . $ PPC_CR0.) |
| 342 | add_CRxxcxx . . $ add_CRxx(6983fab5c328f2c).(MI, PPC_REG_CR0UNcxx . . $ PPC_REG_CR0UN.); |
| 343 | op_addBCcxx . . $ op_addBC(1d3fdd902ae43da2).(MI, PPC_BC_SOcxx . . $ PPC_BC_SO.); |
| 344 | break; |
| 345 | } |
| 346 | |
| 347 | if (cr > PPC_CR0cxx . . $ PPC_CR0.) { |
| 348 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 349 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_REGcxx . . $ PPC_OP_REG.; |
| 350 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].regcxx . . $ cs_ppc_op#$anonymous_type_0#reg. = MCOperand_getRegcxx . . $ MCOperand_getReg(2f0d38ead81b409a).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 1)); |
| 351 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 352 | } |
| 353 | } |
| 354 | } else { |
| 355 | if (cr > PPC_CR0cxx . . $ PPC_CR0.) { |
| 356 | needComma = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 357 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(&ss, " cr%d", cr - PPC_CR0cxx . . $ PPC_CR0.); |
| 358 | op_addRegcxx . . $ op_addReg(1d3fdd902ae43da2).(MI, PPC_REG_CR0cxx . . $ PPC_REG_CR0. + cr - PPC_CR0cxx . . $ PPC_CR0.); |
| 359 | } |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | if (MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 2)) && |
| 364 | MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 2)) != 0) { |
| 365 | if (needComma) |
| 366 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, ","); |
| 367 | |
| 368 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(&ss, " $\xFF\x03\x01"); |
| 369 | } |
| 370 | |
| 371 | tmp = cs_strdupcxx . . $ cs_strdup(a8b8e32347182212).(ss.buffercxx . . $ SStream#buffer.); |
| 372 | AsmMnem = tmp; |
| 373 | for(AsmOps = tmp; *AsmOps; AsmOps++) { |
| 374 | if (*AsmOps == ' ' || *AsmOps == '\t') { |
| 375 | *AsmOps = '\0'; |
| 376 | AsmOps++; |
| 377 | break; |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(OS, AsmMnem); |
| 382 | if (*AsmOps) { |
| 383 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(OS, "\t"); |
| 384 | for (c = AsmOps; *c; c++) { |
| 385 | if (*c == '$') { |
| 386 | c += 1; |
| 387 | if (*c == (char)0xff) { |
| 388 | c += 1; |
| 389 | OpIdx = *c - 1; |
| 390 | c += 1; |
| 391 | PrintMethodIdx = *c - 1; |
| 392 | printCustomAliasOperandcxx . . $ printCustomAliasOperand(cd93bebea1f4dc2e).(MI, OpIdx, PrintMethodIdx, OS); |
| 393 | } else |
| 394 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, *c - 1, OS); |
| 395 | } else { |
| 396 | SStream_concat1cxx . . $ SStream_concat1(1d48f8b1fa4749c8).(OS, *c); |
| 397 | } |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | return tmp; |
| 402 | } |
| 403 | |
| 404 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! isBOCTRBranchcxx . . $ isBOCTRBranch(dfa6e707f7696010).(unsigned int op) |
| 405 | { |
| 406 | return ((op >= PPC_BDNZcxx . . $ PPC_BDNZ.) && (op <= PPC_BDZpcxx . . $ PPC_BDZp.)); |
| 407 | } |
| 408 | |
| 409 | void PPC_printInstcxx . . $ PPC_printInst(6238f66e5ea10f57).(MCInstcxx . . $ MCInst# *MI, SStreamcxx . . $ SStream# *O, void *Info) |
| 410 | { |
| 411 | char *mnem; |
| 412 | unsigned int opcode = MCInst_getOpcodecxx . . $ MCInst_getOpcode(66549afbf0596d6c).(MI); |
| 413 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(O->buffercxx . . $ SStream#buffer., 0, sizeof(O->buffercxx . . $ SStream#buffer.)); |
| 414 | |
| 415 | // printf("opcode = %u\n", opcode); |
| 416 | |
| 417 | // Check for slwi/srwi mnemonics. |
| 418 | if (opcode == PPC_RLWINMcxx . . $ PPC_RLWINM.) { |
| 419 | unsigned char SH = (unsigned char)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 2)); |
| 420 | unsigned char MB = (unsigned char)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 3)); |
| 421 | unsigned char ME = (unsigned char)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 4)); |
| 422 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! useSubstituteMnemonic = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 423 | |
| 424 | if (SH <= 31 && MB == 0 && ME == (31 - SH)) { |
| 425 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "slwi\t"); |
| 426 | MCInst_setOpcodePubcxx . . $ MCInst_setOpcodePub(1d3fdd902ae43da2).(MI, PPC_INS_SLWIcxx . . $ PPC_INS_SLWI.); |
| 427 | useSubstituteMnemonic = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 428 | } |
| 429 | |
| 430 | if (SH <= 31 && MB == (32 - SH) && ME == 31) { |
| 431 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "srwi\t"); |
| 432 | MCInst_setOpcodePubcxx . . $ MCInst_setOpcodePub(1d3fdd902ae43da2).(MI, PPC_INS_SRWIcxx . . $ PPC_INS_SRWI.); |
| 433 | useSubstituteMnemonic = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 434 | SH = 32 - SH; |
| 435 | } |
| 436 | |
| 437 | if (useSubstituteMnemonic) { |
| 438 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, 0, O); |
| 439 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, ", "); |
| 440 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, 1, O); |
| 441 | |
| 442 | if (SH > HEX_THRESHOLDcxx . . $ `utils.h:17:9`!) |
| 443 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(O, ", 0x%x", (unsigned int)SH); |
| 444 | else |
| 445 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(O, ", %u", (unsigned int)SH); |
| 446 | |
| 447 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 448 | cs_ppccxx . . $ cs_ppc# *ppc = &MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc.; |
| 449 | |
| 450 | ppc->operandscxx . . $ cs_ppc#operands.[ppc->op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 451 | ppc->operandscxx . . $ cs_ppc#operands.[ppc->op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = SH; |
| 452 | ++ppc->op_countcxx . . $ cs_ppc#op_count.; |
| 453 | } |
| 454 | |
| 455 | return; |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | if ((opcode == PPC_ORcxx . . $ PPC_OR. || opcode == PPC_OR8cxx . . $ PPC_OR8.) && |
| 460 | MCOperand_getRegcxx . . $ MCOperand_getReg(2f0d38ead81b409a).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 1)) == MCOperand_getRegcxx . . $ MCOperand_getReg(2f0d38ead81b409a).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 2))) { |
| 461 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "mr\t"); |
| 462 | MCInst_setOpcodePubcxx . . $ MCInst_setOpcodePub(1d3fdd902ae43da2).(MI, PPC_INS_MRcxx . . $ PPC_INS_MR.); |
| 463 | |
| 464 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, 0, O); |
| 465 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, ", "); |
| 466 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, 1, O); |
| 467 | |
| 468 | return; |
| 469 | } |
| 470 | |
| 471 | if (opcode == PPC_RLDICRcxx . . $ PPC_RLDICR. || |
| 472 | opcode == PPC_RLDICR_32cxx . . $ PPC_RLDICR_32.) { |
| 473 | unsigned char SH = (unsigned char)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 2)); |
| 474 | unsigned char ME = (unsigned char)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 3)); |
| 475 | |
| 476 | // rldicr RA, RS, SH, 63-SH == sldi RA, RS, SH |
| 477 | if (63 - SH == ME) { |
| 478 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "sldi\t"); |
| 479 | MCInst_setOpcodePubcxx . . $ MCInst_setOpcodePub(1d3fdd902ae43da2).(MI, PPC_INS_SLDIcxx . . $ PPC_INS_SLDI.); |
| 480 | |
| 481 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, 0, O); |
| 482 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, ", "); |
| 483 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, 1, O); |
| 484 | |
| 485 | if (SH > HEX_THRESHOLDcxx . . $ `utils.h:17:9`!) |
| 486 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(O, ", 0x%x", (unsigned int)SH); |
| 487 | else |
| 488 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(O, ", %u", (unsigned int)SH); |
| 489 | |
| 490 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 491 | cs_ppccxx . . $ cs_ppc# *ppc = &MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc.; |
| 492 | |
| 493 | ppc->operandscxx . . $ cs_ppc#operands.[ppc->op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 494 | ppc->operandscxx . . $ cs_ppc#operands.[ppc->op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = SH; |
| 495 | ++ppc->op_countcxx . . $ cs_ppc#op_count.; |
| 496 | } |
| 497 | |
| 498 | |
| 499 | return; |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | // dcbt[st] is printed manually here because: |
| 504 | // 1. The assembly syntax is different between embedded and server targets |
| 505 | // 2. We must print the short mnemonics for TH == 0 because the |
| 506 | // embedded/server syntax default will not be stable across assemblers |
| 507 | // The syntax for dcbt is: |
| 508 | // dcbt ra, rb, th [server] |
| 509 | // dcbt th, ra, rb [embedded] |
| 510 | // where th can be omitted when it is 0. dcbtst is the same. |
| 511 | if (opcode == PPC_DCBTcxx . . $ PPC_DCBT. || opcode == PPC_DCBTSTcxx . . $ PPC_DCBTST.) { |
| 512 | unsigned char TH = (unsigned char)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)); |
| 513 | |
| 514 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "dcbt"); |
| 515 | MCInst_setOpcodePubcxx . . $ MCInst_setOpcodePub(1d3fdd902ae43da2).(MI, PPC_INS_DCBTcxx . . $ PPC_INS_DCBT.); |
| 516 | |
| 517 | if (opcode == PPC_DCBTSTcxx . . $ PPC_DCBTST.) { |
| 518 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "st"); |
| 519 | MCInst_setOpcodePubcxx . . $ MCInst_setOpcodePub(1d3fdd902ae43da2).(MI, PPC_INS_DCBTSTcxx . . $ PPC_INS_DCBTST.); |
| 520 | } |
| 521 | |
| 522 | if (TH == 16) { |
| 523 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "t"); |
| 524 | MCInst_setOpcodePubcxx . . $ MCInst_setOpcodePub(1d3fdd902ae43da2).(MI, PPC_INS_DCBTSTTcxx . . $ PPC_INS_DCBTSTT.); |
| 525 | } |
| 526 | |
| 527 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "\t"); |
| 528 | |
| 529 | if (MI->cshcxx . . $ MCInst#csh.->modecxx . . $ cs_struct#mode. & CS_MODE_BOOKEcxx . . $ CS_MODE_BOOKE. && TH != 0 && TH != 16) { |
| 530 | if (TH > HEX_THRESHOLDcxx . . $ `utils.h:17:9`!) |
| 531 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(O, "0x%x, ", (unsigned int)TH); |
| 532 | else |
| 533 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(O, "%u, ", (unsigned int)TH); |
| 534 | |
| 535 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 536 | cs_ppccxx . . $ cs_ppc# *ppc = &MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc.; |
| 537 | |
| 538 | ppc->operandscxx . . $ cs_ppc#operands.[ppc->op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 539 | ppc->operandscxx . . $ cs_ppc#operands.[ppc->op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = TH; |
| 540 | ++ppc->op_countcxx . . $ cs_ppc#op_count.; |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, 1, O); |
| 545 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, ", "); |
| 546 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, 2, O); |
| 547 | |
| 548 | if (!(MI->cshcxx . . $ MCInst#csh.->modecxx . . $ cs_struct#mode. & CS_MODE_BOOKEcxx . . $ CS_MODE_BOOKE.) && TH != 0 && TH != 16) { |
| 549 | if (TH > HEX_THRESHOLDcxx . . $ `utils.h:17:9`!) |
| 550 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(O, ", 0x%x", (unsigned int)TH); |
| 551 | else |
| 552 | SStream_concatcxx . . $ SStream_concat(72515e07697b04b4).(O, ", %u", (unsigned int)TH); |
| 553 | |
| 554 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 555 | cs_ppccxx . . $ cs_ppc# *ppc = &MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc.; |
| 556 | |
| 557 | ppc->operandscxx . . $ cs_ppc#operands.[ppc->op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 558 | ppc->operandscxx . . $ cs_ppc#operands.[ppc->op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = TH; |
| 559 | ++ppc->op_countcxx . . $ cs_ppc#op_count.; |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | return; |
| 564 | } |
| 565 | |
| 566 | if (opcode == PPC_DCBFcxx . . $ PPC_DCBF.) { |
| 567 | unsigned char L = (unsigned char)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)); |
| 568 | |
| 569 | if (!L || L == 1 || L == 3) { |
| 570 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "dcbf"); |
| 571 | MCInst_setOpcodePubcxx . . $ MCInst_setOpcodePub(1d3fdd902ae43da2).(MI, PPC_INS_DCBFcxx . . $ PPC_INS_DCBF.); |
| 572 | |
| 573 | if (L == 1 || L == 3) { |
| 574 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "l"); |
| 575 | MCInst_setOpcodePubcxx . . $ MCInst_setOpcodePub(1d3fdd902ae43da2).(MI, PPC_INS_DCBFLcxx . . $ PPC_INS_DCBFL.); |
| 576 | } |
| 577 | |
| 578 | if (L == 3) { |
| 579 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "p"); |
| 580 | MCInst_setOpcodePubcxx . . $ MCInst_setOpcodePub(1d3fdd902ae43da2).(MI, PPC_INS_DCBFLPcxx . . $ PPC_INS_DCBFLP.); |
| 581 | } |
| 582 | |
| 583 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "\t"); |
| 584 | |
| 585 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, 1, O); |
| 586 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, ", "); |
| 587 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, 2, O); |
| 588 | |
| 589 | return; |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | if (opcode == PPC_Bcxx . . $ PPC_B. || opcode == PPC_BAcxx . . $ PPC_BA. || opcode == PPC_BLcxx . . $ PPC_BL. || |
| 594 | opcode == PPC_BLAcxx . . $ PPC_BLA.) { |
| 595 | int64_tcxx . . $ int64_t# bd = MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)); |
| 596 | bd = SignExtend64cxx . . $ SignExtend64(2a41822c65b512db).(bd, 24); |
| 597 | MCOperand_setImmcxx . . $ MCOperand_setImm(6062e6a57a403332).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0), bd); |
| 598 | } |
| 599 | |
| 600 | if (opcode == PPC_gBCcxx . . $ PPC_gBC. || opcode == PPC_gBCAcxx . . $ PPC_gBCA. || opcode == PPC_gBCLcxx . . $ PPC_gBCL. || |
| 601 | opcode == PPC_gBCLAcxx . . $ PPC_gBCLA.) { |
| 602 | int64_tcxx . . $ int64_t# bd = MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 2)); |
| 603 | bd = SignExtend64cxx . . $ SignExtend64(2a41822c65b512db).(bd, 14); |
| 604 | MCOperand_setImmcxx . . $ MCOperand_setImm(6062e6a57a403332).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 2), bd); |
| 605 | } |
| 606 | |
| 607 | if (isBOCTRBranchcxx . . $ isBOCTRBranch(dfa6e707f7696010).(MCInst_getOpcodecxx . . $ MCInst_getOpcode(66549afbf0596d6c).(MI))) { |
| 608 | if (MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI,0))) { |
| 609 | int64_tcxx . . $ int64_t# bd = MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0)); |
| 610 | bd = SignExtend64cxx . . $ SignExtend64(2a41822c65b512db).(bd, 14); |
| 611 | MCOperand_setImmcxx . . $ MCOperand_setImm(6062e6a57a403332).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, 0), bd); |
| 612 | } |
| 613 | } |
| 614 | |
| 615 | mnem = printAliasBcccxx . . $ printAliasBcc(880ad24b2950696a).(MI, O, Info); |
| 616 | if (!mnem) |
| 617 | mnem = printAliasInstrcxx . . $ printAliasInstr(137f7c0757b438a3).(MI, O, Info); |
| 618 | |
| 619 | if (mnem != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 620 | if (strlencxx . . $ strlen(751346f8406fd082).(mnem) > 0) { |
| 621 | // check to remove the last letter of ('.', '-', '+') |
| 622 | if (mnem[strlencxx . . $ strlen(751346f8406fd082).(mnem) - 1] == '-' || mnem[strlencxx . . $ strlen(751346f8406fd082).(mnem) - 1] == '+' || mnem[strlencxx . . $ strlen(751346f8406fd082).(mnem) - 1] == '.') |
| 623 | mnem[strlencxx . . $ strlen(751346f8406fd082).(mnem) - 1] = '\0'; |
| 624 | |
| 625 | MCInst_setOpcodePubcxx . . $ MCInst_setOpcodePub(1d3fdd902ae43da2).(MI, PPC_map_insncxx . . $ PPC_map_insn(f6f8a50103cb1f83).(mnem)); |
| 626 | |
| 627 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 628 | struct ppc_aliascxx . . $ ppc_alias# alias; |
| 629 | |
| 630 | if (PPC_alias_insncxx . . $ PPC_alias_insn(f2a763a00d1136be).(mnem, &alias)) { |
| 631 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..bccxx . . $ cs_ppc#bc. = (ppc_bccxx . . $ ppc_bc#)alias.cccxx . . $ ppc_alias#cc.; |
| 632 | } |
| 633 | } |
| 634 | } |
| 635 | |
| 636 | cs_mem_freecxx . . $ cs_mem_free.(mnem); |
| 637 | } else |
| 638 | printInstructioncxx . . $ printInstruction(a4713f772b1223df).(MI, O); |
| 639 | |
| 640 | const char *mnem_end = strchrcxx . . $ strchr(2050848944e00d54).(O->buffercxx . . $ SStream#buffer., ' '); |
| 641 | unsigned mnem_len = 0; |
| 642 | if (mnem_end) |
| 643 | mnem_len = mnem_end - O->buffercxx . . $ SStream#buffer.; |
| 644 | if (!mnem_end || mnem_len >= sizeof(MI->flat_insncxx . . $ MCInst#flat_insn.->mnemoniccxx . . $ cs_insn#mnemonic.)) |
| 645 | mnem_len = sizeof(MI->flat_insncxx . . $ MCInst#flat_insn.->mnemoniccxx . . $ cs_insn#mnemonic.) - 1; |
| 646 | |
| 647 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(MI->flat_insncxx . . $ MCInst#flat_insn.->mnemoniccxx . . $ cs_insn#mnemonic., 0, sizeof(MI->flat_insncxx . . $ MCInst#flat_insn.->mnemoniccxx . . $ cs_insn#mnemonic.)); |
| 648 | memcpycxx . . $ memcpy(cc817cb175f282d).(MI->flat_insncxx . . $ MCInst#flat_insn.->mnemoniccxx . . $ cs_insn#mnemonic., O->buffercxx . . $ SStream#buffer., mnem_len); |
| 649 | } |
| 650 | |
| 651 | // FIXME |
| 652 | enum ppc_bc_hintcxx . . $ ppc_bc_hint# { |
| 653 | PPC_BC_LT_MINUScxx . . $ PPC_BC_LT_MINUS. = (0 << 5) | 14, |
| 654 | PPC_BC_LE_MINUScxx . . $ PPC_BC_LE_MINUS. = (1 << 5) | 6, |
| 655 | PPC_BC_EQ_MINUScxx . . $ PPC_BC_EQ_MINUS. = (2 << 5) | 14, |
| 656 | PPC_BC_GE_MINUScxx . . $ PPC_BC_GE_MINUS. = (0 << 5) | 6, |
| 657 | PPC_BC_GT_MINUScxx . . $ PPC_BC_GT_MINUS. = (1 << 5) | 14, |
| 658 | PPC_BC_NE_MINUScxx . . $ PPC_BC_NE_MINUS. = (2 << 5) | 6, |
| 659 | PPC_BC_UN_MINUScxx . . $ PPC_BC_UN_MINUS. = (3 << 5) | 14, |
| 660 | PPC_BC_NU_MINUScxx . . $ PPC_BC_NU_MINUS. = (3 << 5) | 6, |
| 661 | PPC_BC_LT_PLUScxx . . $ PPC_BC_LT_PLUS. = (0 << 5) | 15, |
| 662 | PPC_BC_LE_PLUScxx . . $ PPC_BC_LE_PLUS. = (1 << 5) | 7, |
| 663 | PPC_BC_EQ_PLUScxx . . $ PPC_BC_EQ_PLUS. = (2 << 5) | 15, |
| 664 | PPC_BC_GE_PLUScxx . . $ PPC_BC_GE_PLUS. = (0 << 5) | 7, |
| 665 | PPC_BC_GT_PLUScxx . . $ PPC_BC_GT_PLUS. = (1 << 5) | 15, |
| 666 | PPC_BC_NE_PLUScxx . . $ PPC_BC_NE_PLUS. = (2 << 5) | 7, |
| 667 | PPC_BC_UN_PLUScxx . . $ PPC_BC_UN_PLUS. = (3 << 5) | 15, |
| 668 | PPC_BC_NU_PLUScxx . . $ PPC_BC_NU_PLUS. = (3 << 5) | 7, |
| 669 | }; |
| 670 | |
| 671 | // FIXME |
| 672 | // normalize CC to remove _MINUS & _PLUS |
| 673 | static int cc_normalizecxx . . $ cc_normalize(7864480464b09eea).(int cc) |
| 674 | { |
| 675 | switch(cc) { |
| 676 | default: return cc; |
| 677 | case PPC_BC_LT_MINUScxx . . $ PPC_BC_LT_MINUS.: return PPC_BC_LTcxx . . $ PPC_BC_LT.; |
| 678 | case PPC_BC_LE_MINUScxx . . $ PPC_BC_LE_MINUS.: return PPC_BC_LEcxx . . $ PPC_BC_LE.; |
| 679 | case PPC_BC_EQ_MINUScxx . . $ PPC_BC_EQ_MINUS.: return PPC_BC_EQcxx . . $ PPC_BC_EQ.; |
| 680 | case PPC_BC_GE_MINUScxx . . $ PPC_BC_GE_MINUS.: return PPC_BC_GEcxx . . $ PPC_BC_GE.; |
| 681 | case PPC_BC_GT_MINUScxx . . $ PPC_BC_GT_MINUS.: return PPC_BC_GTcxx . . $ PPC_BC_GT.; |
| 682 | case PPC_BC_NE_MINUScxx . . $ PPC_BC_NE_MINUS.: return PPC_BC_NEcxx . . $ PPC_BC_NE.; |
| 683 | case PPC_BC_UN_MINUScxx . . $ PPC_BC_UN_MINUS.: return PPC_BC_UNcxx . . $ PPC_BC_UN.; |
| 684 | case PPC_BC_NU_MINUScxx . . $ PPC_BC_NU_MINUS.: return PPC_BC_NUcxx . . $ PPC_BC_NU.; |
| 685 | case PPC_BC_LT_PLUScxx . . $ PPC_BC_LT_PLUS. : return PPC_BC_LTcxx . . $ PPC_BC_LT.; |
| 686 | case PPC_BC_LE_PLUScxx . . $ PPC_BC_LE_PLUS. : return PPC_BC_LEcxx . . $ PPC_BC_LE.; |
| 687 | case PPC_BC_EQ_PLUScxx . . $ PPC_BC_EQ_PLUS. : return PPC_BC_EQcxx . . $ PPC_BC_EQ.; |
| 688 | case PPC_BC_GE_PLUScxx . . $ PPC_BC_GE_PLUS. : return PPC_BC_GEcxx . . $ PPC_BC_GE.; |
| 689 | case PPC_BC_GT_PLUScxx . . $ PPC_BC_GT_PLUS. : return PPC_BC_GTcxx . . $ PPC_BC_GT.; |
| 690 | case PPC_BC_NE_PLUScxx . . $ PPC_BC_NE_PLUS. : return PPC_BC_NEcxx . . $ PPC_BC_NE.; |
| 691 | case PPC_BC_UN_PLUScxx . . $ PPC_BC_UN_PLUS. : return PPC_BC_UNcxx . . $ PPC_BC_UN.; |
| 692 | case PPC_BC_NU_PLUScxx . . $ PPC_BC_NU_PLUS. : return PPC_BC_NUcxx . . $ PPC_BC_NU.; |
| 693 | } |
| 694 | } |
| 695 | |
| 696 | static void printPredicateOperandcxx . . $ printPredicateOperand(8ecce08687479c6e).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, |
| 697 | SStreamcxx . . $ SStream# *O, const char *Modifier) |
| 698 | { |
| 699 | unsigned Code = (unsigned int)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 700 | |
| 701 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..bccxx . . $ cs_ppc#bc. = (ppc_bccxx . . $ ppc_bc#)cc_normalizecxx . . $ cc_normalize(7864480464b09eea).(Code); |
| 702 | |
| 703 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(Modifier, "cc")) { |
| 704 | switch ((ppc_predicatecxx . . $ ppc_predicate#)Code) { |
| 705 | default: // unreachable |
| 706 | case PPC_PRED_LT_MINUScxx . . $ PPC_PRED_LT_MINUS.: |
| 707 | case PPC_PRED_LT_PLUScxx . . $ PPC_PRED_LT_PLUS.: |
| 708 | case PPC_PRED_LTcxx . . $ PPC_PRED_LT.: |
| 709 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "lt"); |
| 710 | return; |
| 711 | case PPC_PRED_LE_MINUScxx . . $ PPC_PRED_LE_MINUS.: |
| 712 | case PPC_PRED_LE_PLUScxx . . $ PPC_PRED_LE_PLUS.: |
| 713 | case PPC_PRED_LEcxx . . $ PPC_PRED_LE.: |
| 714 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "le"); |
| 715 | return; |
| 716 | case PPC_PRED_EQ_MINUScxx . . $ PPC_PRED_EQ_MINUS.: |
| 717 | case PPC_PRED_EQ_PLUScxx . . $ PPC_PRED_EQ_PLUS.: |
| 718 | case PPC_PRED_EQcxx . . $ PPC_PRED_EQ.: |
| 719 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "eq"); |
| 720 | return; |
| 721 | case PPC_PRED_GE_MINUScxx . . $ PPC_PRED_GE_MINUS.: |
| 722 | case PPC_PRED_GE_PLUScxx . . $ PPC_PRED_GE_PLUS.: |
| 723 | case PPC_PRED_GEcxx . . $ PPC_PRED_GE.: |
| 724 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "ge"); |
| 725 | return; |
| 726 | case PPC_PRED_GT_MINUScxx . . $ PPC_PRED_GT_MINUS.: |
| 727 | case PPC_PRED_GT_PLUScxx . . $ PPC_PRED_GT_PLUS.: |
| 728 | case PPC_PRED_GTcxx . . $ PPC_PRED_GT.: |
| 729 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "gt"); |
| 730 | return; |
| 731 | case PPC_PRED_NE_MINUScxx . . $ PPC_PRED_NE_MINUS.: |
| 732 | case PPC_PRED_NE_PLUScxx . . $ PPC_PRED_NE_PLUS.: |
| 733 | case PPC_PRED_NEcxx . . $ PPC_PRED_NE.: |
| 734 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "ne"); |
| 735 | return; |
| 736 | case PPC_PRED_UN_MINUScxx . . $ PPC_PRED_UN_MINUS.: |
| 737 | case PPC_PRED_UN_PLUScxx . . $ PPC_PRED_UN_PLUS.: |
| 738 | case PPC_PRED_UNcxx . . $ PPC_PRED_UN.: |
| 739 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "un"); |
| 740 | return; |
| 741 | case PPC_PRED_NU_MINUScxx . . $ PPC_PRED_NU_MINUS.: |
| 742 | case PPC_PRED_NU_PLUScxx . . $ PPC_PRED_NU_PLUS.: |
| 743 | case PPC_PRED_NUcxx . . $ PPC_PRED_NU.: |
| 744 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "nu"); |
| 745 | return; |
| 746 | case PPC_PRED_BIT_SETcxx . . $ PPC_PRED_BIT_SET.: |
| 747 | case PPC_PRED_BIT_UNSETcxx . . $ PPC_PRED_BIT_UNSET.: |
| 748 | // llvm_unreachable("Invalid use of bit predicate code"); |
| 749 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "invalid-predicate"); |
| 750 | return; |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(Modifier, "pm")) { |
| 755 | switch ((ppc_predicatecxx . . $ ppc_predicate#)Code) { |
| 756 | case PPC_PRED_LTcxx . . $ PPC_PRED_LT.: |
| 757 | case PPC_PRED_LEcxx . . $ PPC_PRED_LE.: |
| 758 | case PPC_PRED_EQcxx . . $ PPC_PRED_EQ.: |
| 759 | case PPC_PRED_GEcxx . . $ PPC_PRED_GE.: |
| 760 | case PPC_PRED_GTcxx . . $ PPC_PRED_GT.: |
| 761 | case PPC_PRED_NEcxx . . $ PPC_PRED_NE.: |
| 762 | case PPC_PRED_UNcxx . . $ PPC_PRED_UN.: |
| 763 | case PPC_PRED_NUcxx . . $ PPC_PRED_NU.: |
| 764 | return; |
| 765 | case PPC_PRED_LT_MINUScxx . . $ PPC_PRED_LT_MINUS.: |
| 766 | case PPC_PRED_LE_MINUScxx . . $ PPC_PRED_LE_MINUS.: |
| 767 | case PPC_PRED_EQ_MINUScxx . . $ PPC_PRED_EQ_MINUS.: |
| 768 | case PPC_PRED_GE_MINUScxx . . $ PPC_PRED_GE_MINUS.: |
| 769 | case PPC_PRED_GT_MINUScxx . . $ PPC_PRED_GT_MINUS.: |
| 770 | case PPC_PRED_NE_MINUScxx . . $ PPC_PRED_NE_MINUS.: |
| 771 | case PPC_PRED_UN_MINUScxx . . $ PPC_PRED_UN_MINUS.: |
| 772 | case PPC_PRED_NU_MINUScxx . . $ PPC_PRED_NU_MINUS.: |
| 773 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "-"); |
| 774 | return; |
| 775 | case PPC_PRED_LT_PLUScxx . . $ PPC_PRED_LT_PLUS.: |
| 776 | case PPC_PRED_LE_PLUScxx . . $ PPC_PRED_LE_PLUS.: |
| 777 | case PPC_PRED_EQ_PLUScxx . . $ PPC_PRED_EQ_PLUS.: |
| 778 | case PPC_PRED_GE_PLUScxx . . $ PPC_PRED_GE_PLUS.: |
| 779 | case PPC_PRED_GT_PLUScxx . . $ PPC_PRED_GT_PLUS.: |
| 780 | case PPC_PRED_NE_PLUScxx . . $ PPC_PRED_NE_PLUS.: |
| 781 | case PPC_PRED_UN_PLUScxx . . $ PPC_PRED_UN_PLUS.: |
| 782 | case PPC_PRED_NU_PLUScxx . . $ PPC_PRED_NU_PLUS.: |
| 783 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "+"); |
| 784 | return; |
| 785 | case PPC_PRED_BIT_SETcxx . . $ PPC_PRED_BIT_SET.: |
| 786 | case PPC_PRED_BIT_UNSETcxx . . $ PPC_PRED_BIT_UNSET.: |
| 787 | // llvm_unreachable("Invalid use of bit predicate code"); |
| 788 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "invalid-predicate"); |
| 789 | return; |
| 790 | default: // unreachable |
| 791 | return; |
| 792 | } |
| 793 | // llvm_unreachable("Invalid predicate code"); |
| 794 | } |
| 795 | |
| 796 | //assert(StringRef(Modifier) == "reg" && |
| 797 | // "Need to specify 'cc', 'pm' or 'reg' as predicate op modifier!"); |
| 798 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, OpNo + 1, O); |
| 799 | } |
| 800 | |
| 801 | static void printATBitsAsHintcxx . . $ printATBitsAsHint(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 802 | { |
| 803 | unsigned Code = (unsigned int)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 804 | |
| 805 | if (Code == 2) { |
| 806 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "-"); |
| 807 | } else if (Code == 3) { |
| 808 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "+"); |
| 809 | } |
| 810 | } |
| 811 | |
| 812 | static void printU1ImmOperandcxx . . $ printU1ImmOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 813 | { |
| 814 | unsigned int Value = (unsigned int)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 815 | |
| 816 | // assert(Value <= 1 && "Invalid u1imm argument!"); |
| 817 | |
| 818 | printUInt32cxx . . $ printUInt32(2cfdcacebbcb5657).(O, Value); |
| 819 | |
| 820 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 821 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 822 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = Value; |
| 823 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 824 | } |
| 825 | } |
| 826 | |
| 827 | static void printU2ImmOperandcxx . . $ printU2ImmOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 828 | { |
| 829 | unsigned int Value = (int)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 830 | //assert(Value <= 3 && "Invalid u2imm argument!"); |
| 831 | |
| 832 | printUInt32cxx . . $ printUInt32(2cfdcacebbcb5657).(O, Value); |
| 833 | |
| 834 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 835 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 836 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = Value; |
| 837 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 838 | } |
| 839 | } |
| 840 | |
| 841 | static void printU3ImmOperandcxx . . $ printU3ImmOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 842 | { |
| 843 | unsigned int Value = (int)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 844 | //assert(Value <= 8 && "Invalid u3imm argument!"); |
| 845 | |
| 846 | printUInt32cxx . . $ printUInt32(2cfdcacebbcb5657).(O, Value); |
| 847 | |
| 848 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 849 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 850 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = Value; |
| 851 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 852 | } |
| 853 | } |
| 854 | |
| 855 | static void printU4ImmOperandcxx . . $ printU4ImmOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 856 | { |
| 857 | unsigned int Value = (int)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 858 | //assert(Value <= 15 && "Invalid u4imm argument!"); |
| 859 | |
| 860 | printUInt32cxx . . $ printUInt32(2cfdcacebbcb5657).(O, Value); |
| 861 | |
| 862 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 863 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 864 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = Value; |
| 865 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 866 | } |
| 867 | } |
| 868 | |
| 869 | static void printS5ImmOperandcxx . . $ printS5ImmOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 870 | { |
| 871 | int Value = (int)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 872 | Value = SignExtend32cxx . . $ SignExtend32(21cb2064190e2a90).(Value, 5); |
| 873 | |
| 874 | printInt32cxx . . $ printInt32(42251ac09f06cabf).(O, Value); |
| 875 | |
| 876 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 877 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 878 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = Value; |
| 879 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 880 | } |
| 881 | } |
| 882 | |
| 883 | static void printU5ImmOperandcxx . . $ printU5ImmOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 884 | { |
| 885 | unsigned int Value = (unsigned int)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 886 | |
| 887 | //assert(Value <= 31 && "Invalid u5imm argument!"); |
| 888 | printUInt32cxx . . $ printUInt32(2cfdcacebbcb5657).(O, Value); |
| 889 | |
| 890 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 891 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 892 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = Value; |
| 893 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | static void printU6ImmOperandcxx . . $ printU6ImmOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 898 | { |
| 899 | unsigned int Value = (unsigned int)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 900 | |
| 901 | //assert(Value <= 63 && "Invalid u6imm argument!"); |
| 902 | printUInt32cxx . . $ printUInt32(2cfdcacebbcb5657).(O, Value); |
| 903 | |
| 904 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 905 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 906 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = Value; |
| 907 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 908 | } |
| 909 | } |
| 910 | |
| 911 | static void printU7ImmOperandcxx . . $ printU7ImmOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 912 | { |
| 913 | unsigned int Value = (unsigned int)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 914 | |
| 915 | //assert(Value <= 127 && "Invalid u7imm argument!"); |
| 916 | printUInt32cxx . . $ printUInt32(2cfdcacebbcb5657).(O, Value); |
| 917 | |
| 918 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 919 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 920 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = Value; |
| 921 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 922 | } |
| 923 | } |
| 924 | |
| 925 | // Operands of BUILD_VECTOR are signed and we use this to print operands |
| 926 | // of XXSPLTIB which are unsigned. So we simply truncate to 8 bits and |
| 927 | // print as unsigned. |
| 928 | static void printU8ImmOperandcxx . . $ printU8ImmOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 929 | { |
| 930 | unsigned int Value = (unsigned int)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 931 | |
| 932 | printUInt32cxx . . $ printUInt32(2cfdcacebbcb5657).(O, Value); |
| 933 | |
| 934 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 935 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 936 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = Value; |
| 937 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 938 | } |
| 939 | } |
| 940 | |
| 941 | static void printU10ImmOperandcxx . . $ printU10ImmOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 942 | { |
| 943 | unsigned int Value = (unsigned int)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 944 | |
| 945 | //assert(Value <= 1023 && "Invalid u10imm argument!"); |
| 946 | printUInt32cxx . . $ printUInt32(2cfdcacebbcb5657).(O, Value); |
| 947 | |
| 948 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 949 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 950 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = Value; |
| 951 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 952 | } |
| 953 | } |
| 954 | |
| 955 | static void printS12ImmOperandcxx . . $ printS12ImmOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 956 | { |
| 957 | if (MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo))) { |
| 958 | int Imm = (int)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 959 | Imm = SignExtend32cxx . . $ SignExtend32(21cb2064190e2a90).(Imm, 12); |
| 960 | |
| 961 | printInt32cxx . . $ printInt32(42251ac09f06cabf).(O, Imm); |
| 962 | |
| 963 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 964 | if (MI->cshcxx . . $ MCInst#csh.->doing_memcxx . . $ cs_struct#doing_mem.) { |
| 965 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].memcxx . . $ cs_ppc_op#$anonymous_type_0#mem..dispcxx . . $ ppc_op_mem#disp. = Imm; |
| 966 | } else { |
| 967 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 968 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = Imm; |
| 969 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 970 | } |
| 971 | } |
| 972 | } else |
| 973 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, OpNo, O); |
| 974 | } |
| 975 | |
| 976 | static void printU12ImmOperandcxx . . $ printU12ImmOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 977 | { |
| 978 | unsigned short Value = (unsigned short)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 979 | |
| 980 | // assert(Value <= 4095 && "Invalid u12imm argument!"); |
| 981 | |
| 982 | printUInt32cxx . . $ printUInt32(2cfdcacebbcb5657).(O, Value); |
| 983 | |
| 984 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 985 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 986 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = Value; |
| 987 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 988 | } |
| 989 | } |
| 990 | |
| 991 | static void printS16ImmOperandcxx . . $ printS16ImmOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 992 | { |
| 993 | if (MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo))) { |
| 994 | short Imm = (short)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 995 | printInt32cxx . . $ printInt32(42251ac09f06cabf).(O, Imm); |
| 996 | |
| 997 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 998 | if (MI->cshcxx . . $ MCInst#csh.->doing_memcxx . . $ cs_struct#doing_mem.) { |
| 999 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].memcxx . . $ cs_ppc_op#$anonymous_type_0#mem..dispcxx . . $ ppc_op_mem#disp. = Imm; |
| 1000 | } else { |
| 1001 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 1002 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = Imm; |
| 1003 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 1004 | } |
| 1005 | } |
| 1006 | } else |
| 1007 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, OpNo, O); |
| 1008 | } |
| 1009 | |
| 1010 | static void printU16ImmOperandcxx . . $ printU16ImmOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 1011 | { |
| 1012 | if (MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo))) { |
| 1013 | unsigned short Imm = (unsigned short)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 1014 | printUInt32cxx . . $ printUInt32(2cfdcacebbcb5657).(O, Imm); |
| 1015 | |
| 1016 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 1017 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 1018 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = Imm; |
| 1019 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 1020 | } |
| 1021 | } else |
| 1022 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, OpNo, O); |
| 1023 | } |
| 1024 | |
| 1025 | static void printBranchOperandcxx . . $ printBranchOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 1026 | { |
| 1027 | if (!MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo))) { |
| 1028 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, OpNo, O); |
| 1029 | |
| 1030 | return; |
| 1031 | } |
| 1032 | |
| 1033 | // Branches can take an immediate operand. This is used by the branch |
| 1034 | // selection pass to print .+8, an eight byte displacement from the PC. |
| 1035 | // O << ".+"; |
| 1036 | printAbsBranchOperandcxx . . $ printAbsBranchOperand(2c3fef4aec20445).(MI, OpNo, O); |
| 1037 | } |
| 1038 | |
| 1039 | static void printAbsBranchOperandcxx . . $ printAbsBranchOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 1040 | { |
| 1041 | int64_tcxx . . $ int64_t# imm; |
| 1042 | |
| 1043 | if (!MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo))) { |
| 1044 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, OpNo, O); |
| 1045 | |
| 1046 | return; |
| 1047 | } |
| 1048 | |
| 1049 | imm = SignExtend32cxx . . $ SignExtend32(21cb2064190e2a90).(MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)) * 4, 32); |
| 1050 | //imm = MCOperand_getImm(MCInst_getOperand(MI, OpNo)) * 4; |
| 1051 | |
| 1052 | if (!PPC_abs_branchcxx . . $ PPC_abs_branch(39412e1dc8bf7218).(MI->cshcxx . . $ MCInst#csh., MCInst_getOpcodecxx . . $ MCInst_getOpcode(66549afbf0596d6c).(MI))) { |
| 1053 | imm += MI->addresscxx . . $ MCInst#address.; |
| 1054 | } |
| 1055 | |
| 1056 | printUInt64cxx . . $ printUInt64(b8e8c809409ad2ab).(O, imm); |
| 1057 | |
| 1058 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 1059 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 1060 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = imm; |
| 1061 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 1062 | } |
| 1063 | } |
| 1064 | |
| 1065 | static void printcrbitmcxx . . $ printcrbitm(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 1066 | { |
| 1067 | unsigned RegNo; |
| 1068 | unsigned CCReg = MCOperand_getRegcxx . . $ MCOperand_getReg(2f0d38ead81b409a).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)); |
| 1069 | |
| 1070 | switch (CCReg) { |
| 1071 | default: // llvm_unreachable("Unknown CR register"); |
| 1072 | case PPC_CR0cxx . . $ PPC_CR0.: RegNo = 0; break; |
| 1073 | case PPC_CR1cxx . . $ PPC_CR1.: RegNo = 1; break; |
| 1074 | case PPC_CR2cxx . . $ PPC_CR2.: RegNo = 2; break; |
| 1075 | case PPC_CR3cxx . . $ PPC_CR3.: RegNo = 3; break; |
| 1076 | case PPC_CR4cxx . . $ PPC_CR4.: RegNo = 4; break; |
| 1077 | case PPC_CR5cxx . . $ PPC_CR5.: RegNo = 5; break; |
| 1078 | case PPC_CR6cxx . . $ PPC_CR6.: RegNo = 6; break; |
| 1079 | case PPC_CR7cxx . . $ PPC_CR7.: RegNo = 7; break; |
| 1080 | } |
| 1081 | |
| 1082 | printUInt32cxx . . $ printUInt32(2cfdcacebbcb5657).(O, 0x80 >> RegNo); |
| 1083 | } |
| 1084 | |
| 1085 | static void printMemRegImmcxx . . $ printMemRegImm(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 1086 | { |
| 1087 | set_mem_accesscxx . . $ set_mem_access(512db92e0bcb52df).(MI, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!); |
| 1088 | |
| 1089 | printS16ImmOperandcxx . . $ printS16ImmOperand(2c3fef4aec20445).(MI, OpNo, O); |
| 1090 | |
| 1091 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "("); |
| 1092 | |
| 1093 | if (MCOperand_getRegcxx . . $ MCOperand_getReg(2f0d38ead81b409a).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo + 1)) == PPC_R0cxx . . $ PPC_R0.) |
| 1094 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "0"); |
| 1095 | else |
| 1096 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, OpNo + 1, O); |
| 1097 | |
| 1098 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, ")"); |
| 1099 | |
| 1100 | set_mem_accesscxx . . $ set_mem_access(512db92e0bcb52df).(MI, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!); |
| 1101 | } |
| 1102 | |
| 1103 | static void printPSMemRegImmcxx . . $ printPSMemRegImm(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 1104 | { |
| 1105 | set_mem_accesscxx . . $ set_mem_access(512db92e0bcb52df).(MI, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!); |
| 1106 | |
| 1107 | printS12ImmOperandcxx . . $ printS12ImmOperand(2c3fef4aec20445).(MI, OpNo, O); |
| 1108 | |
| 1109 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "("); |
| 1110 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, OpNo + 1, O); |
| 1111 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, ")"); |
| 1112 | |
| 1113 | set_mem_accesscxx . . $ set_mem_access(512db92e0bcb52df).(MI, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!); |
| 1114 | } |
| 1115 | |
| 1116 | static void printMemRegRegcxx . . $ printMemRegReg(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 1117 | { |
| 1118 | // When used as the base register, r0 reads constant zero rather than |
| 1119 | // the value contained in the register. For this reason, the darwin |
| 1120 | // assembler requires that we print r0 as 0 (no r) when used as the base. |
| 1121 | if (MCOperand_getRegcxx . . $ MCOperand_getReg(2f0d38ead81b409a).(MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo)) == PPC_R0cxx . . $ PPC_R0.) |
| 1122 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "0"); |
| 1123 | else |
| 1124 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, OpNo, O); |
| 1125 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, ", "); |
| 1126 | |
| 1127 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, OpNo + 1, O); |
| 1128 | } |
| 1129 | |
| 1130 | static void printTLSCallcxx . . $ printTLSCall(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 1131 | { |
| 1132 | set_mem_accesscxx . . $ set_mem_access(512db92e0bcb52df).(MI, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!); |
| 1133 | //printBranchOperand(MI, OpNo, O); |
| 1134 | |
| 1135 | // On PPC64, VariantKind is VK_None, but on PPC32, it's VK_PLT, and it must |
| 1136 | // come at the _end_ of the expression. |
| 1137 | |
| 1138 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, "("); |
| 1139 | printOperandcxx . . $ printOperand(2c3fef4aec20445).(MI, OpNo + 1, O); |
| 1140 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, ")"); |
| 1141 | |
| 1142 | set_mem_accesscxx . . $ set_mem_access(512db92e0bcb52df).(MI, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!); |
| 1143 | } |
| 1144 | |
| 1145 | /// stripRegisterPrefix - This method strips the character prefix from a |
| 1146 | /// register name so that only the number is left. Used by for linux asm. |
| 1147 | static char *stripRegisterPrefixcxx . . $ stripRegisterPrefix(a8b8e32347182212).(const char *RegName) |
| 1148 | { |
| 1149 | switch (RegName[0]) { |
| 1150 | case 'r': |
| 1151 | case 'f': |
| 1152 | case 'q': // for QPX |
| 1153 | case 'v': |
| 1154 | if (RegName[1] == 's') |
| 1155 | return cs_strdupcxx . . $ cs_strdup(a8b8e32347182212).(RegName + 2); |
| 1156 | |
| 1157 | return cs_strdupcxx . . $ cs_strdup(a8b8e32347182212).(RegName + 1); |
| 1158 | case 'c': |
| 1159 | if (RegName[1] == 'r') { |
| 1160 | // skip the first 2 letters "cr" |
| 1161 | char *name = cs_strdupcxx . . $ cs_strdup(a8b8e32347182212).(RegName + 2); |
| 1162 | |
| 1163 | // also strip the last 2 letters |
| 1164 | if(strlencxx . . $ strlen(751346f8406fd082).(name) > 2) |
| 1165 | name[strlencxx . . $ strlen(751346f8406fd082).(name) - 2] = '\0'; |
| 1166 | |
| 1167 | return name; |
| 1168 | } |
| 1169 | } |
| 1170 | |
| 1171 | return cs_strdupcxx . . $ cs_strdup(a8b8e32347182212).(RegName); |
| 1172 | } |
| 1173 | |
| 1174 | static void printOperandcxx . . $ printOperand(2c3fef4aec20445).(MCInstcxx . . $ MCInst# *MI, unsigned OpNo, SStreamcxx . . $ SStream# *O) |
| 1175 | { |
| 1176 | MCOperandcxx . . $ MCOperand# *Op = MCInst_getOperandcxx . . $ MCInst_getOperand(4687f87e75986a5b).(MI, OpNo); |
| 1177 | if (MCOperand_isRegcxx . . $ MCOperand_isReg(8be14e8515538be0).(Op)) { |
| 1178 | unsigned reg = MCOperand_getRegcxx . . $ MCOperand_getReg(2f0d38ead81b409a).(Op); |
| 1179 | #ifndef CAPSTONE_DIET |
| 1180 | const char *RegName = getRegisterNamecxx . . $ getRegisterName(81a3ae90da26a711).(reg); |
| 1181 | |
| 1182 | // printf("reg = %u (%s)\n", reg, RegName); |
| 1183 | |
| 1184 | // convert internal register ID to public register ID |
| 1185 | reg = PPC_name_regcxx . . $ PPC_name_reg(4780a8c9a5635c0).(RegName); |
| 1186 | |
| 1187 | // The linux and AIX assembler does not take register prefixes. |
| 1188 | if (MI->cshcxx . . $ MCInst#csh.->syntaxcxx . . $ cs_struct#syntax. == CS_OPT_SYNTAX_NOREGNAMEcxx . . $ CS_OPT_SYNTAX_NOREGNAME.) { |
| 1189 | char *name = stripRegisterPrefixcxx . . $ stripRegisterPrefix(a8b8e32347182212).(RegName); |
| 1190 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, name); |
| 1191 | cs_mem_freecxx . . $ cs_mem_free.(name); |
| 1192 | } else |
| 1193 | SStream_concat0cxx . . $ SStream_concat0(a720692b9b1c0c27).(O, RegName); |
| 1194 | #endif |
| 1195 | |
| 1196 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 1197 | if (MI->cshcxx . . $ MCInst#csh.->doing_memcxx . . $ cs_struct#doing_mem.) { |
| 1198 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].memcxx . . $ cs_ppc_op#$anonymous_type_0#mem..basecxx . . $ ppc_op_mem#base. = reg; |
| 1199 | } else { |
| 1200 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_REGcxx . . $ PPC_OP_REG.; |
| 1201 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].regcxx . . $ cs_ppc_op#$anonymous_type_0#reg. = reg; |
| 1202 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 1203 | } |
| 1204 | } |
| 1205 | |
| 1206 | return; |
| 1207 | } |
| 1208 | |
| 1209 | if (MCOperand_isImmcxx . . $ MCOperand_isImm(8be14e8515538be0).(Op)) { |
| 1210 | int32_tcxx . . $ int32_t# imm = (int32_tcxx . . $ int32_t#)MCOperand_getImmcxx . . $ MCOperand_getImm(e2e9552a97d88948).(Op); |
| 1211 | printInt32cxx . . $ printInt32(42251ac09f06cabf).(O, imm); |
| 1212 | |
| 1213 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 1214 | if (MI->cshcxx . . $ MCInst#csh.->doing_memcxx . . $ cs_struct#doing_mem.) { |
| 1215 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].memcxx . . $ cs_ppc_op#$anonymous_type_0#mem..dispcxx . . $ ppc_op_mem#disp. = (int32_tcxx . . $ int32_t#)imm; |
| 1216 | } else { |
| 1217 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 1218 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = imm; |
| 1219 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 1220 | } |
| 1221 | } |
| 1222 | } |
| 1223 | } |
| 1224 | |
| 1225 | static void op_addImmcxx . . $ op_addImm(cff03ea8bb8460e7).(MCInstcxx . . $ MCInst# *MI, int v) |
| 1226 | { |
| 1227 | if (MI->cshcxx . . $ MCInst#csh.->detailcxx . . $ cs_struct#detail.) { |
| 1228 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].typecxx . . $ cs_ppc_op#type. = PPC_OP_IMMcxx . . $ PPC_OP_IMM.; |
| 1229 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..operandscxx . . $ cs_ppc#operands.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.].immcxx . . $ cs_ppc_op#$anonymous_type_0#imm. = v; |
| 1230 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->ppccxx . . $ cs_detail#$anonymous_type_0#ppc..op_countcxx . . $ cs_ppc#op_count.++; |
| 1231 | } |
| 1232 | } |
| 1233 | |
| 1234 | #define PRINT_ALIAS_INSTRcxx . . $ `arch/PowerPC/PPCInstPrinter.c:1234:9`! |
| 1235 | #include "PPCGenRegisterName.inc"cxx . . $ `<file>/arch/PowerPC/PPCGenRegisterName.inc`/ |
| 1236 | #include "PPCGenAsmWriter.inc"cxx . . $ `<file>/arch/PowerPC/PPCGenAsmWriter.inc`/ |
| 1237 | |
| 1238 | #endif |