| 1 | /* Instruction opcode header for epiphany. |
| 2 | |
| 3 | THIS FILE IS MACHINE GENERATED WITH CGEN. |
| 4 | |
| 5 | Copyright (C) 1996-2017 Free Software Foundation, Inc. |
| 6 | |
| 7 | This file is part of the GNU Binutils and/or GDB, the GNU debugger. |
| 8 | |
| 9 | This file is free software; you can redistribute it and/or modify |
| 10 | it under the terms of the GNU General Public License as published by |
| 11 | the Free Software Foundation; either version 3, or (at your option) |
| 12 | any later version. |
| 13 | |
| 14 | It is distributed in the hope that it will be useful, but WITHOUT |
| 15 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 16 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 17 | License for more details. |
| 18 | |
| 19 | You should have received a copy of the GNU General Public License along |
| 20 | with this program; if not, write to the Free Software Foundation, Inc., |
| 21 | 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. |
| 22 | |
| 23 | */ |
| 24 | |
| 25 | #ifndef EPIPHANY_OPC_H |
| 26 | #define EPIPHANY_OPC_H |
| 27 | |
| 28 | #ifdef __cplusplus |
| 29 | extern "C" { |
| 30 | #endif |
| 31 | |
| 32 | /* -- opc.h */ |
| 33 | |
| 34 | /* enumerate relaxation types for gas. */ |
| 35 | typedef enum epiphany_relax_types |
| 36 | { |
| 37 | EPIPHANY_RELAX_NONE=0, |
| 38 | EPIPHANY_RELAX_NEED_RELAXING, |
| 39 | |
| 40 | EPIPHANY_RELAX_BRANCH_SHORT, /* Fits into +127..-128 */ |
| 41 | EPIPHANY_RELAX_BRANCH_LONG, /* b/bl/b<cond> +-2*16 */ |
| 42 | |
| 43 | EPIPHANY_RELAX_ARITH_SIMM3, /* add/sub -7..3 */ |
| 44 | EPIPHANY_RELAX_ARITH_SIMM11, /* add/sub -2**11-1 .. 2**10-1 */ |
| 45 | |
| 46 | EPIPHANY_RELAX_MOV_IMM8, /* mov r,imm8 */ |
| 47 | EPIPHANY_RELAX_MOV_IMM16, /* mov r,imm16 */ |
| 48 | |
| 49 | EPIPHANY_RELAX_LDST_IMM3, /* (ldr|str)* r,[r,disp3] */ |
| 50 | EPIPHANY_RELAX_LDST_IMM11 /* (ldr|str)* r,[r,disp11] */ |
| 51 | |
| 52 | } EPIPHANY_RELAX_TYPES; |
| 53 | |
| 54 | /* Override disassembly hashing... */ |
| 55 | |
| 56 | /* Can only depend on instruction having 4 decode bits which gets us to the |
| 57 | major groups of 16/32 instructions. */ |
| 58 | #undef CGEN_DIS_HASH_SIZE |
| 59 | #if 1 |
| 60 | |
| 61 | /* hash code on the 4 LSBs */ |
| 62 | #define CGEN_DIS_HASH_SIZE 16 |
| 63 | |
| 64 | #define CGEN_DIS_HASH(buf, value) ((*buf) & 0xf) |
| 65 | #else |
| 66 | #define CGEN_DIS_HASH_SIZE 1 |
| 67 | #define CGEN_DIS_HASH(buf, value) 0 |
| 68 | #endif |
| 69 | |
| 70 | extern const char * parse_shortregs (CGEN_CPU_DESC cd, |
| 71 | const char ** strp, |
| 72 | CGEN_KEYWORD * keywords, |
| 73 | long * valuep); |
| 74 | |
| 75 | extern const char * parse_branch_addr (CGEN_CPU_DESC cd, |
| 76 | const char ** strp, |
| 77 | int opindex, |
| 78 | int opinfo, |
| 79 | enum cgen_parse_operand_result * resultp, |
| 80 | bfd_vma *valuep); |
| 81 | |
| 82 | /* Allows reason codes to be output when assembler errors occur. */ |
| 83 | #define CGEN_VERBOSE_ASSEMBLER_ERRORS |
| 84 | |
| 85 | \f |
| 86 | /* -- opc.c */ |
| 87 | /* Enum declaration for epiphany instruction types. */ |
| 88 | typedef enum cgen_insn_type { |
| 89 | EPIPHANY_INSN_INVALID, EPIPHANY_INSN_BEQ16, EPIPHANY_INSN_BEQ, EPIPHANY_INSN_BNE16 |
| 90 | , EPIPHANY_INSN_BNE, EPIPHANY_INSN_BGTU16, EPIPHANY_INSN_BGTU, EPIPHANY_INSN_BGTEU16 |
| 91 | , EPIPHANY_INSN_BGTEU, EPIPHANY_INSN_BLTEU16, EPIPHANY_INSN_BLTEU, EPIPHANY_INSN_BLTU16 |
| 92 | , EPIPHANY_INSN_BLTU, EPIPHANY_INSN_BGT16, EPIPHANY_INSN_BGT, EPIPHANY_INSN_BGTE16 |
| 93 | , EPIPHANY_INSN_BGTE, EPIPHANY_INSN_BLT16, EPIPHANY_INSN_BLT, EPIPHANY_INSN_BLTE16 |
| 94 | , EPIPHANY_INSN_BLTE, EPIPHANY_INSN_BBEQ16, EPIPHANY_INSN_BBEQ, EPIPHANY_INSN_BBNE16 |
| 95 | , EPIPHANY_INSN_BBNE, EPIPHANY_INSN_BBLT16, EPIPHANY_INSN_BBLT, EPIPHANY_INSN_BBLTE16 |
| 96 | , EPIPHANY_INSN_BBLTE, EPIPHANY_INSN_B16, EPIPHANY_INSN_B, EPIPHANY_INSN_BL16 |
| 97 | , EPIPHANY_INSN_BL, EPIPHANY_INSN_JR16, EPIPHANY_INSN_RTS, EPIPHANY_INSN_JR |
| 98 | , EPIPHANY_INSN_JALR16, EPIPHANY_INSN_JALR, EPIPHANY_INSN_LDRBX16_S, EPIPHANY_INSN_LDRBP16_S |
| 99 | , EPIPHANY_INSN_LDRBX_L, EPIPHANY_INSN_LDRBP_L, EPIPHANY_INSN_LDRBD16_S, EPIPHANY_INSN_LDRBD_L |
| 100 | , EPIPHANY_INSN_LDRBDPM_L, EPIPHANY_INSN_LDRHX16_S, EPIPHANY_INSN_LDRHP16_S, EPIPHANY_INSN_LDRHX_L |
| 101 | , EPIPHANY_INSN_LDRHP_L, EPIPHANY_INSN_LDRHD16_S, EPIPHANY_INSN_LDRHD_L, EPIPHANY_INSN_LDRHDPM_L |
| 102 | , EPIPHANY_INSN_LDRX16_S, EPIPHANY_INSN_LDRP16_S, EPIPHANY_INSN_LDRX_L, EPIPHANY_INSN_LDRP_L |
| 103 | , EPIPHANY_INSN_LDRD16_S, EPIPHANY_INSN_LDRD_L, EPIPHANY_INSN_LDRDPM_L, EPIPHANY_INSN_LDRDX16_S |
| 104 | , EPIPHANY_INSN_LDRDP16_S, EPIPHANY_INSN_LDRDX_L, EPIPHANY_INSN_LDRDP_L, EPIPHANY_INSN_LDRDD16_S |
| 105 | , EPIPHANY_INSN_LDRDD_L, EPIPHANY_INSN_LDRDDPM_L, EPIPHANY_INSN_TESTSETBT, EPIPHANY_INSN_TESTSETHT |
| 106 | , EPIPHANY_INSN_TESTSETT, EPIPHANY_INSN_STRBX16, EPIPHANY_INSN_STRBX, EPIPHANY_INSN_STRBP16 |
| 107 | , EPIPHANY_INSN_STRBP, EPIPHANY_INSN_STRBD16, EPIPHANY_INSN_STRBD, EPIPHANY_INSN_STRBDPM |
| 108 | , EPIPHANY_INSN_STRHX16, EPIPHANY_INSN_STRHX, EPIPHANY_INSN_STRHP16, EPIPHANY_INSN_STRHP |
| 109 | , EPIPHANY_INSN_STRHD16, EPIPHANY_INSN_STRHD, EPIPHANY_INSN_STRHDPM, EPIPHANY_INSN_STRX16 |
| 110 | , EPIPHANY_INSN_STRX, EPIPHANY_INSN_STRP16, EPIPHANY_INSN_STRP, EPIPHANY_INSN_STRD16 |
| 111 | , EPIPHANY_INSN_STRD, EPIPHANY_INSN_STRDPM, EPIPHANY_INSN_STRDX16, EPIPHANY_INSN_STRDX |
| 112 | , EPIPHANY_INSN_STRDP16, EPIPHANY_INSN_STRDP, EPIPHANY_INSN_STRDD16, EPIPHANY_INSN_STRDD |
| 113 | , EPIPHANY_INSN_STRDDPM, EPIPHANY_INSN_CMOV16EQ, EPIPHANY_INSN_CMOVEQ, EPIPHANY_INSN_CMOV16NE |
| 114 | , EPIPHANY_INSN_CMOVNE, EPIPHANY_INSN_CMOV16GTU, EPIPHANY_INSN_CMOVGTU, EPIPHANY_INSN_CMOV16GTEU |
| 115 | , EPIPHANY_INSN_CMOVGTEU, EPIPHANY_INSN_CMOV16LTEU, EPIPHANY_INSN_CMOVLTEU, EPIPHANY_INSN_CMOV16LTU |
| 116 | , EPIPHANY_INSN_CMOVLTU, EPIPHANY_INSN_CMOV16GT, EPIPHANY_INSN_CMOVGT, EPIPHANY_INSN_CMOV16GTE |
| 117 | , EPIPHANY_INSN_CMOVGTE, EPIPHANY_INSN_CMOV16LT, EPIPHANY_INSN_CMOVLT, EPIPHANY_INSN_CMOV16LTE |
| 118 | , EPIPHANY_INSN_CMOVLTE, EPIPHANY_INSN_CMOV16B, EPIPHANY_INSN_CMOVB, EPIPHANY_INSN_CMOV16BEQ |
| 119 | , EPIPHANY_INSN_CMOVBEQ, EPIPHANY_INSN_CMOV16BNE, EPIPHANY_INSN_CMOVBNE, EPIPHANY_INSN_CMOV16BLT |
| 120 | , EPIPHANY_INSN_CMOVBLT, EPIPHANY_INSN_CMOV16BLTE, EPIPHANY_INSN_CMOVBLTE, EPIPHANY_INSN_MOVTS16 |
| 121 | , EPIPHANY_INSN_MOVTS6, EPIPHANY_INSN_MOVTSDMA, EPIPHANY_INSN_MOVTSMEM, EPIPHANY_INSN_MOVTSMESH |
| 122 | , EPIPHANY_INSN_MOVFS16, EPIPHANY_INSN_MOVFS6, EPIPHANY_INSN_MOVFSDMA, EPIPHANY_INSN_MOVFSMEM |
| 123 | , EPIPHANY_INSN_MOVFSMESH, EPIPHANY_INSN_NOP, EPIPHANY_INSN_SNOP, EPIPHANY_INSN_UNIMPL |
| 124 | , EPIPHANY_INSN_IDLE, EPIPHANY_INSN_BKPT, EPIPHANY_INSN_MBKPT, EPIPHANY_INSN_RTI |
| 125 | , EPIPHANY_INSN_WAND, EPIPHANY_INSN_SYNC, EPIPHANY_INSN_GIEN, EPIPHANY_INSN_GIDIS |
| 126 | , EPIPHANY_INSN_SWI_NUM, EPIPHANY_INSN_SWI, EPIPHANY_INSN_TRAP16, EPIPHANY_INSN_ADD16 |
| 127 | , EPIPHANY_INSN_ADD, EPIPHANY_INSN_SUB16, EPIPHANY_INSN_SUB, EPIPHANY_INSN_AND16 |
| 128 | , EPIPHANY_INSN_AND, EPIPHANY_INSN_ORR16, EPIPHANY_INSN_ORR, EPIPHANY_INSN_EOR16 |
| 129 | , EPIPHANY_INSN_EOR, EPIPHANY_INSN_ADDI16, EPIPHANY_INSN_ADDI, EPIPHANY_INSN_SUBI16 |
| 130 | , EPIPHANY_INSN_SUBI, EPIPHANY_INSN_ASR16, EPIPHANY_INSN_ASR, EPIPHANY_INSN_LSR16 |
| 131 | , EPIPHANY_INSN_LSR, EPIPHANY_INSN_LSL16, EPIPHANY_INSN_LSL, EPIPHANY_INSN_LSRI16 |
| 132 | , EPIPHANY_INSN_LSRI32, EPIPHANY_INSN_LSLI16, EPIPHANY_INSN_LSLI32, EPIPHANY_INSN_ASRI16 |
| 133 | , EPIPHANY_INSN_ASRI32, EPIPHANY_INSN_BITR16, EPIPHANY_INSN_BITR, EPIPHANY_INSN_FEXT |
| 134 | , EPIPHANY_INSN_FDEP, EPIPHANY_INSN_LFSR, EPIPHANY_INSN_MOV8, EPIPHANY_INSN_MOV16 |
| 135 | , EPIPHANY_INSN_MOVT, EPIPHANY_INSN_F_ADDF16, EPIPHANY_INSN_F_ADDF32, EPIPHANY_INSN_F_SUBF16 |
| 136 | , EPIPHANY_INSN_F_SUBF32, EPIPHANY_INSN_F_MULF16, EPIPHANY_INSN_F_MULF32, EPIPHANY_INSN_F_MADDF16 |
| 137 | , EPIPHANY_INSN_F_MADDF32, EPIPHANY_INSN_F_MSUBF16, EPIPHANY_INSN_F_MSUBF32, EPIPHANY_INSN_F_ABSF16 |
| 138 | , EPIPHANY_INSN_F_ABSF32, EPIPHANY_INSN_F_LOATF16, EPIPHANY_INSN_F_LOATF32, EPIPHANY_INSN_F_IXF16 |
| 139 | , EPIPHANY_INSN_F_IXF32, EPIPHANY_INSN_F_RECIPF32, EPIPHANY_INSN_F_SQRTF32 |
| 140 | } CGEN_INSN_TYPE; |
| 141 | |
| 142 | /* Index of `invalid' insn place holder. */ |
| 143 | #define CGEN_INSN_INVALID EPIPHANY_INSN_INVALID |
| 144 | |
| 145 | /* Total number of insns in table. */ |
| 146 | #define MAX_INSNS ((int) EPIPHANY_INSN_F_SQRTF32 + 1) |
| 147 | |
| 148 | /* This struct records data prior to insertion or after extraction. */ |
| 149 | struct cgen_fields |
| 150 | { |
| 151 | int length; |
| 152 | long f_nil; |
| 153 | long f_anyof; |
| 154 | long f_opc; |
| 155 | long f_opc_4_1; |
| 156 | long f_opc_6_3; |
| 157 | long f_opc_8_5; |
| 158 | long f_opc_19_4; |
| 159 | long f_condcode; |
| 160 | long f_secondary_ccs; |
| 161 | long f_shift; |
| 162 | long f_wordsize; |
| 163 | long f_store; |
| 164 | long f_opc_8_1; |
| 165 | long f_opc_31_32; |
| 166 | long f_simm8; |
| 167 | long f_simm24; |
| 168 | long f_sdisp3; |
| 169 | long f_disp3; |
| 170 | long f_disp8; |
| 171 | long f_imm8; |
| 172 | long f_imm_27_8; |
| 173 | long f_addsubx; |
| 174 | long f_subd; |
| 175 | long f_pm; |
| 176 | long f_rm; |
| 177 | long f_rn; |
| 178 | long f_rd; |
| 179 | long f_rm_x; |
| 180 | long f_rn_x; |
| 181 | long f_rd_x; |
| 182 | long f_dc_9_1; |
| 183 | long f_sn; |
| 184 | long f_sd; |
| 185 | long f_sn_x; |
| 186 | long f_sd_x; |
| 187 | long f_dc_7_4; |
| 188 | long f_trap_swi_9_1; |
| 189 | long f_gien_gidis_9_1; |
| 190 | long f_dc_15_3; |
| 191 | long f_dc_15_7; |
| 192 | long f_dc_15_6; |
| 193 | long f_trap_num; |
| 194 | long f_dc_20_1; |
| 195 | long f_dc_21_1; |
| 196 | long f_dc_21_2; |
| 197 | long f_dc_22_3; |
| 198 | long f_dc_22_2; |
| 199 | long f_dc_22_1; |
| 200 | long f_dc_25_6; |
| 201 | long f_dc_25_4; |
| 202 | long f_dc_25_2; |
| 203 | long f_dc_25_1; |
| 204 | long f_dc_28_1; |
| 205 | long f_dc_31_3; |
| 206 | long f_disp11; |
| 207 | long f_sdisp11; |
| 208 | long f_imm16; |
| 209 | long f_rd6; |
| 210 | long f_rn6; |
| 211 | long f_rm6; |
| 212 | long f_sd6; |
| 213 | long f_sn6; |
| 214 | }; |
| 215 | |
| 216 | #define CGEN_INIT_PARSE(od) \ |
| 217 | {\ |
| 218 | } |
| 219 | #define CGEN_INIT_INSERT(od) \ |
| 220 | {\ |
| 221 | } |
| 222 | #define CGEN_INIT_EXTRACT(od) \ |
| 223 | {\ |
| 224 | } |
| 225 | #define CGEN_INIT_PRINT(od) \ |
| 226 | {\ |
| 227 | } |
| 228 | |
| 229 | |
| 230 | #ifdef __cplusplus |
| 231 | } |
| 232 | #endif |
| 233 | |
| 234 | #endif /* EPIPHANY_OPC_H */ |