| 1 | /* CPU data header for xc16x. |
| 2 | |
| 3 | THIS FILE IS MACHINE GENERATED WITH CGEN. |
| 4 | |
| 5 | Copyright 1996-2010 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 XC16X_CPU_H |
| 26 | #define XC16X_CPU_H |
| 27 | |
| 28 | #define CGEN_ARCH xc16x |
| 29 | |
| 30 | /* Given symbol S, return xc16x_cgen_<S>. */ |
| 31 | #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) |
| 32 | #define CGEN_SYM(s) xc16x##_cgen_##s |
| 33 | #else |
| 34 | #define CGEN_SYM(s) xc16x/**/_cgen_/**/s |
| 35 | #endif |
| 36 | |
| 37 | |
| 38 | /* Selected cpu families. */ |
| 39 | #define HAVE_CPU_XC16XBF |
| 40 | |
| 41 | #define CGEN_INSN_LSB0_P 1 |
| 42 | |
| 43 | /* Minimum size of any insn (in bytes). */ |
| 44 | #define CGEN_MIN_INSN_SIZE 2 |
| 45 | |
| 46 | /* Maximum size of any insn (in bytes). */ |
| 47 | #define CGEN_MAX_INSN_SIZE 4 |
| 48 | |
| 49 | #define CGEN_INT_INSN_P 1 |
| 50 | |
| 51 | /* Maximum number of syntax elements in an instruction. */ |
| 52 | #define CGEN_ACTUAL_MAX_SYNTAX_ELEMENTS 15 |
| 53 | |
| 54 | /* CGEN_MNEMONIC_OPERANDS is defined if mnemonics have operands. |
| 55 | e.g. In "b,a foo" the ",a" is an operand. If mnemonics have operands |
| 56 | we can't hash on everything up to the space. */ |
| 57 | #define CGEN_MNEMONIC_OPERANDS |
| 58 | |
| 59 | /* Maximum number of fields in an instruction. */ |
| 60 | #define CGEN_ACTUAL_MAX_IFMT_OPERANDS 8 |
| 61 | |
| 62 | /* Enums. */ |
| 63 | |
| 64 | /* Enum declaration for insn format enums. */ |
| 65 | typedef enum insn_op1 { |
| 66 | OP1_0, OP1_1, OP1_2, OP1_3 |
| 67 | , OP1_4, OP1_5, OP1_6, OP1_7 |
| 68 | , OP1_8, OP1_9, OP1_10, OP1_11 |
| 69 | , OP1_12, OP1_13, OP1_14, OP1_15 |
| 70 | } INSN_OP1; |
| 71 | |
| 72 | /* Enum declaration for op2 enums. */ |
| 73 | typedef enum insn_op2 { |
| 74 | OP2_0, OP2_1, OP2_2, OP2_3 |
| 75 | , OP2_4, OP2_5, OP2_6, OP2_7 |
| 76 | , OP2_8, OP2_9, OP2_10, OP2_11 |
| 77 | , OP2_12, OP2_13, OP2_14, OP2_15 |
| 78 | } INSN_OP2; |
| 79 | |
| 80 | /* Enum declaration for bit set/clear enums. */ |
| 81 | typedef enum insn_qcond { |
| 82 | QBIT_0, QBIT_1, QBIT_2, QBIT_3 |
| 83 | , QBIT_4, QBIT_5, QBIT_6, QBIT_7 |
| 84 | , QBIT_8, QBIT_9, QBIT_10, QBIT_11 |
| 85 | , QBIT_12, QBIT_13, QBIT_14, QBIT_15 |
| 86 | } INSN_QCOND; |
| 87 | |
| 88 | /* Enum declaration for relative jump condition code op2 enums. */ |
| 89 | typedef enum insn_rcond { |
| 90 | COND_UC = 0, COND_NET = 1, COND_Z = 2, COND_NE_NZ = 3 |
| 91 | , COND_V = 4, COND_NV = 5, COND_N = 6, COND_NN = 7 |
| 92 | , COND_C = 8, COND_NC = 9, COND_SGT = 10, COND_SLE = 11 |
| 93 | , COND_SLT = 12, COND_SGE = 13, COND_UGT = 14, COND_ULE = 15 |
| 94 | , COND_EQ = 2, COND_NE = 3, COND_ULT = 8, COND_UGE = 9 |
| 95 | } INSN_RCOND; |
| 96 | |
| 97 | /* Enum declaration for . */ |
| 98 | typedef enum gr_names { |
| 99 | H_GR_R0, H_GR_R1, H_GR_R2, H_GR_R3 |
| 100 | , H_GR_R4, H_GR_R5, H_GR_R6, H_GR_R7 |
| 101 | , H_GR_R8, H_GR_R9, H_GR_R10, H_GR_R11 |
| 102 | , H_GR_R12, H_GR_R13, H_GR_R14, H_GR_R15 |
| 103 | } GR_NAMES; |
| 104 | |
| 105 | /* Enum declaration for . */ |
| 106 | typedef enum ext_names { |
| 107 | H_EXT_0X1 = 0, H_EXT_0X2 = 1, H_EXT_0X3 = 2, H_EXT_0X4 = 3 |
| 108 | , H_EXT_1 = 0, H_EXT_2 = 1, H_EXT_3 = 2, H_EXT_4 = 3 |
| 109 | } EXT_NAMES; |
| 110 | |
| 111 | /* Enum declaration for . */ |
| 112 | typedef enum psw_names { |
| 113 | H_PSW_IEN = 136, H_PSW_R0_11 = 240, H_PSW_R1_11 = 241, H_PSW_R2_11 = 242 |
| 114 | , H_PSW_R3_11 = 243, H_PSW_R4_11 = 244, H_PSW_R5_11 = 245, H_PSW_R6_11 = 246 |
| 115 | , H_PSW_R7_11 = 247, H_PSW_R8_11 = 248, H_PSW_R9_11 = 249, H_PSW_R10_11 = 250 |
| 116 | , H_PSW_R11_11 = 251, H_PSW_R12_11 = 252, H_PSW_R13_11 = 253, H_PSW_R14_11 = 254 |
| 117 | , H_PSW_R15_11 = 255 |
| 118 | } PSW_NAMES; |
| 119 | |
| 120 | /* Enum declaration for . */ |
| 121 | typedef enum grb_names { |
| 122 | H_GRB_RL0, H_GRB_RH0, H_GRB_RL1, H_GRB_RH1 |
| 123 | , H_GRB_RL2, H_GRB_RH2, H_GRB_RL3, H_GRB_RH3 |
| 124 | , H_GRB_RL4, H_GRB_RH4, H_GRB_RL5, H_GRB_RH5 |
| 125 | , H_GRB_RL6, H_GRB_RH6, H_GRB_RL7, H_GRB_RH7 |
| 126 | } GRB_NAMES; |
| 127 | |
| 128 | /* Enum declaration for . */ |
| 129 | typedef enum conditioncode_names { |
| 130 | H_CC_CC_UC = 0, H_CC_CC_NET = 1, H_CC_CC_Z = 2, H_CC_CC_EQ = 2 |
| 131 | , H_CC_CC_NZ = 3, H_CC_CC_NE = 3, H_CC_CC_V = 4, H_CC_CC_NV = 5 |
| 132 | , H_CC_CC_N = 6, H_CC_CC_NN = 7, H_CC_CC_ULT = 8, H_CC_CC_UGE = 9 |
| 133 | , H_CC_CC_C = 8, H_CC_CC_NC = 9, H_CC_CC_SGT = 10, H_CC_CC_SLE = 11 |
| 134 | , H_CC_CC_SLT = 12, H_CC_CC_SGE = 13, H_CC_CC_UGT = 14, H_CC_CC_ULE = 15 |
| 135 | } CONDITIONCODE_NAMES; |
| 136 | |
| 137 | /* Enum declaration for . */ |
| 138 | typedef enum extconditioncode_names { |
| 139 | H_ECC_CC_UC = 0, H_ECC_CC_NET = 2, H_ECC_CC_Z = 4, H_ECC_CC_EQ = 4 |
| 140 | , H_ECC_CC_NZ = 6, H_ECC_CC_NE = 6, H_ECC_CC_V = 8, H_ECC_CC_NV = 10 |
| 141 | , H_ECC_CC_N = 12, H_ECC_CC_NN = 14, H_ECC_CC_ULT = 16, H_ECC_CC_UGE = 18 |
| 142 | , H_ECC_CC_C = 16, H_ECC_CC_NC = 18, H_ECC_CC_SGT = 20, H_ECC_CC_SLE = 22 |
| 143 | , H_ECC_CC_SLT = 24, H_ECC_CC_SGE = 26, H_ECC_CC_UGT = 28, H_ECC_CC_ULE = 30 |
| 144 | , H_ECC_CC_NUSR0 = 1, H_ECC_CC_NUSR1 = 3, H_ECC_CC_USR0 = 5, H_ECC_CC_USR1 = 7 |
| 145 | } EXTCONDITIONCODE_NAMES; |
| 146 | |
| 147 | /* Enum declaration for . */ |
| 148 | typedef enum grb8_names { |
| 149 | H_GRB8_DPP0 = 0, H_GRB8_DPP1 = 1, H_GRB8_DPP2 = 2, H_GRB8_DPP3 = 3 |
| 150 | , H_GRB8_PSW = 136, H_GRB8_CP = 8, H_GRB8_MDL = 7, H_GRB8_MDH = 6 |
| 151 | , H_GRB8_MDC = 135, H_GRB8_SP = 9, H_GRB8_CSP = 4, H_GRB8_VECSEG = 137 |
| 152 | , H_GRB8_STKOV = 10, H_GRB8_STKUN = 11, H_GRB8_CPUCON1 = 12, H_GRB8_CPUCON2 = 13 |
| 153 | , H_GRB8_ZEROS = 142, H_GRB8_ONES = 143, H_GRB8_SPSEG = 134, H_GRB8_TFR = 214 |
| 154 | , H_GRB8_RL0 = 240, H_GRB8_RH0 = 241, H_GRB8_RL1 = 242, H_GRB8_RH1 = 243 |
| 155 | , H_GRB8_RL2 = 244, H_GRB8_RH2 = 245, H_GRB8_RL3 = 246, H_GRB8_RH3 = 247 |
| 156 | , H_GRB8_RL4 = 248, H_GRB8_RH4 = 249, H_GRB8_RL5 = 250, H_GRB8_RH5 = 251 |
| 157 | , H_GRB8_RL6 = 252, H_GRB8_RH6 = 253, H_GRB8_RL7 = 254, H_GRB8_RH7 = 255 |
| 158 | } GRB8_NAMES; |
| 159 | |
| 160 | /* Enum declaration for . */ |
| 161 | typedef enum r8_names { |
| 162 | H_R8_DPP0 = 0, H_R8_DPP1 = 1, H_R8_DPP2 = 2, H_R8_DPP3 = 3 |
| 163 | , H_R8_PSW = 136, H_R8_CP = 8, H_R8_MDL = 7, H_R8_MDH = 6 |
| 164 | , H_R8_MDC = 135, H_R8_SP = 9, H_R8_CSP = 4, H_R8_VECSEG = 137 |
| 165 | , H_R8_STKOV = 10, H_R8_STKUN = 11, H_R8_CPUCON1 = 12, H_R8_CPUCON2 = 13 |
| 166 | , H_R8_ZEROS = 142, H_R8_ONES = 143, H_R8_SPSEG = 134, H_R8_TFR = 214 |
| 167 | , H_R8_R0 = 240, H_R8_R1 = 241, H_R8_R2 = 242, H_R8_R3 = 243 |
| 168 | , H_R8_R4 = 244, H_R8_R5 = 245, H_R8_R6 = 246, H_R8_R7 = 247 |
| 169 | , H_R8_R8 = 248, H_R8_R9 = 249, H_R8_R10 = 250, H_R8_R11 = 251 |
| 170 | , H_R8_R12 = 252, H_R8_R13 = 253, H_R8_R14 = 254, H_R8_R15 = 255 |
| 171 | } R8_NAMES; |
| 172 | |
| 173 | /* Enum declaration for . */ |
| 174 | typedef enum regmem8_names { |
| 175 | H_REGMEM8_DPP0 = 0, H_REGMEM8_DPP1 = 1, H_REGMEM8_DPP2 = 2, H_REGMEM8_DPP3 = 3 |
| 176 | , H_REGMEM8_PSW = 136, H_REGMEM8_CP = 8, H_REGMEM8_MDL = 7, H_REGMEM8_MDH = 6 |
| 177 | , H_REGMEM8_MDC = 135, H_REGMEM8_SP = 9, H_REGMEM8_CSP = 4, H_REGMEM8_VECSEG = 137 |
| 178 | , H_REGMEM8_STKOV = 10, H_REGMEM8_STKUN = 11, H_REGMEM8_CPUCON1 = 12, H_REGMEM8_CPUCON2 = 13 |
| 179 | , H_REGMEM8_ZEROS = 142, H_REGMEM8_ONES = 143, H_REGMEM8_SPSEG = 134, H_REGMEM8_TFR = 214 |
| 180 | , H_REGMEM8_R0 = 240, H_REGMEM8_R1 = 241, H_REGMEM8_R2 = 242, H_REGMEM8_R3 = 243 |
| 181 | , H_REGMEM8_R4 = 244, H_REGMEM8_R5 = 245, H_REGMEM8_R6 = 246, H_REGMEM8_R7 = 247 |
| 182 | , H_REGMEM8_R8 = 248, H_REGMEM8_R9 = 249, H_REGMEM8_R10 = 250, H_REGMEM8_R11 = 251 |
| 183 | , H_REGMEM8_R12 = 252, H_REGMEM8_R13 = 253, H_REGMEM8_R14 = 254, H_REGMEM8_R15 = 255 |
| 184 | } REGMEM8_NAMES; |
| 185 | |
| 186 | /* Enum declaration for . */ |
| 187 | typedef enum regdiv8_names { |
| 188 | H_REGDIV8_R0 = 0, H_REGDIV8_R1 = 17, H_REGDIV8_R2 = 34, H_REGDIV8_R3 = 51 |
| 189 | , H_REGDIV8_R4 = 68, H_REGDIV8_R5 = 85, H_REGDIV8_R6 = 102, H_REGDIV8_R7 = 119 |
| 190 | , H_REGDIV8_R8 = 136, H_REGDIV8_R9 = 153, H_REGDIV8_R10 = 170, H_REGDIV8_R11 = 187 |
| 191 | , H_REGDIV8_R12 = 204, H_REGDIV8_R13 = 221, H_REGDIV8_R14 = 238, H_REGDIV8_R15 = 255 |
| 192 | } REGDIV8_NAMES; |
| 193 | |
| 194 | /* Enum declaration for . */ |
| 195 | typedef enum reg0_name { |
| 196 | H_REG0_0X1 = 1, H_REG0_0X2 = 2, H_REG0_0X3 = 3, H_REG0_0X4 = 4 |
| 197 | , H_REG0_0X5 = 5, H_REG0_0X6 = 6, H_REG0_0X7 = 7, H_REG0_0X8 = 8 |
| 198 | , H_REG0_0X9 = 9, H_REG0_0XA = 10, H_REG0_0XB = 11, H_REG0_0XC = 12 |
| 199 | , H_REG0_0XD = 13, H_REG0_0XE = 14, H_REG0_0XF = 15, H_REG0_1 = 1 |
| 200 | , H_REG0_2 = 2, H_REG0_3 = 3, H_REG0_4 = 4, H_REG0_5 = 5 |
| 201 | , H_REG0_6 = 6, H_REG0_7 = 7, H_REG0_8 = 8, H_REG0_9 = 9 |
| 202 | , H_REG0_10 = 10, H_REG0_11 = 11, H_REG0_12 = 12, H_REG0_13 = 13 |
| 203 | , H_REG0_14 = 14, H_REG0_15 = 15 |
| 204 | } REG0_NAME; |
| 205 | |
| 206 | /* Enum declaration for . */ |
| 207 | typedef enum reg0_name1 { |
| 208 | H_REG01_0X1 = 1, H_REG01_0X2 = 2, H_REG01_0X3 = 3, H_REG01_0X4 = 4 |
| 209 | , H_REG01_0X5 = 5, H_REG01_0X6 = 6, H_REG01_0X7 = 7, H_REG01_1 = 1 |
| 210 | , H_REG01_2 = 2, H_REG01_3 = 3, H_REG01_4 = 4, H_REG01_5 = 5 |
| 211 | , H_REG01_6 = 6, H_REG01_7 = 7 |
| 212 | } REG0_NAME1; |
| 213 | |
| 214 | /* Enum declaration for . */ |
| 215 | typedef enum regbmem8_names { |
| 216 | H_REGBMEM8_DPP0 = 0, H_REGBMEM8_DPP1 = 1, H_REGBMEM8_DPP2 = 2, H_REGBMEM8_DPP3 = 3 |
| 217 | , H_REGBMEM8_PSW = 136, H_REGBMEM8_CP = 8, H_REGBMEM8_MDL = 7, H_REGBMEM8_MDH = 6 |
| 218 | , H_REGBMEM8_MDC = 135, H_REGBMEM8_SP = 9, H_REGBMEM8_CSP = 4, H_REGBMEM8_VECSEG = 137 |
| 219 | , H_REGBMEM8_STKOV = 10, H_REGBMEM8_STKUN = 11, H_REGBMEM8_CPUCON1 = 12, H_REGBMEM8_CPUCON2 = 13 |
| 220 | , H_REGBMEM8_ZEROS = 142, H_REGBMEM8_ONES = 143, H_REGBMEM8_SPSEG = 134, H_REGBMEM8_TFR = 214 |
| 221 | , H_REGBMEM8_RL0 = 240, H_REGBMEM8_RH0 = 241, H_REGBMEM8_RL1 = 242, H_REGBMEM8_RH1 = 243 |
| 222 | , H_REGBMEM8_RL2 = 244, H_REGBMEM8_RH2 = 245, H_REGBMEM8_RL3 = 246, H_REGBMEM8_RH3 = 247 |
| 223 | , H_REGBMEM8_RL4 = 248, H_REGBMEM8_RH4 = 249, H_REGBMEM8_RL5 = 250, H_REGBMEM8_RH5 = 251 |
| 224 | , H_REGBMEM8_RL6 = 252, H_REGBMEM8_RH6 = 253, H_REGBMEM8_RL7 = 254, H_REGBMEM8_RH7 = 255 |
| 225 | } REGBMEM8_NAMES; |
| 226 | |
| 227 | /* Enum declaration for . */ |
| 228 | typedef enum memgr8_names { |
| 229 | H_MEMGR8_DPP0 = 65024, H_MEMGR8_DPP1 = 65026, H_MEMGR8_DPP2 = 65028, H_MEMGR8_DPP3 = 65030 |
| 230 | , H_MEMGR8_PSW = 65296, H_MEMGR8_CP = 65040, H_MEMGR8_MDL = 65038, H_MEMGR8_MDH = 65036 |
| 231 | , H_MEMGR8_MDC = 65294, H_MEMGR8_SP = 65042, H_MEMGR8_CSP = 65032, H_MEMGR8_VECSEG = 65298 |
| 232 | , H_MEMGR8_STKOV = 65044, H_MEMGR8_STKUN = 65046, H_MEMGR8_CPUCON1 = 65048, H_MEMGR8_CPUCON2 = 65050 |
| 233 | , H_MEMGR8_ZEROS = 65308, H_MEMGR8_ONES = 65310, H_MEMGR8_SPSEG = 65292, H_MEMGR8_TFR = 65452 |
| 234 | } MEMGR8_NAMES; |
| 235 | |
| 236 | /* Attributes. */ |
| 237 | |
| 238 | /* Enum declaration for machine type selection. */ |
| 239 | typedef enum mach_attr { |
| 240 | MACH_BASE, MACH_XC16X, MACH_MAX |
| 241 | } MACH_ATTR; |
| 242 | |
| 243 | /* Enum declaration for instruction set selection. */ |
| 244 | typedef enum isa_attr { |
| 245 | ISA_XC16X, ISA_MAX |
| 246 | } ISA_ATTR; |
| 247 | |
| 248 | /* Enum declaration for parallel execution pipeline selection. */ |
| 249 | typedef enum pipe_attr { |
| 250 | PIPE_NONE, PIPE_OS |
| 251 | } PIPE_ATTR; |
| 252 | |
| 253 | /* Number of architecture variants. */ |
| 254 | #define MAX_ISAS 1 |
| 255 | #define MAX_MACHS ((int) MACH_MAX) |
| 256 | |
| 257 | /* Ifield support. */ |
| 258 | |
| 259 | /* Ifield attribute indices. */ |
| 260 | |
| 261 | /* Enum declaration for cgen_ifld attrs. */ |
| 262 | typedef enum cgen_ifld_attr { |
| 263 | CGEN_IFLD_VIRTUAL, CGEN_IFLD_PCREL_ADDR, CGEN_IFLD_ABS_ADDR, CGEN_IFLD_RESERVED |
| 264 | , CGEN_IFLD_SIGN_OPT, CGEN_IFLD_SIGNED, CGEN_IFLD_RELOC, CGEN_IFLD_END_BOOLS |
| 265 | , CGEN_IFLD_START_NBOOLS = 31, CGEN_IFLD_MACH, CGEN_IFLD_END_NBOOLS |
| 266 | } CGEN_IFLD_ATTR; |
| 267 | |
| 268 | /* Number of non-boolean elements in cgen_ifld_attr. */ |
| 269 | #define CGEN_IFLD_NBOOL_ATTRS (CGEN_IFLD_END_NBOOLS - CGEN_IFLD_START_NBOOLS - 1) |
| 270 | |
| 271 | /* cgen_ifld attribute accessor macros. */ |
| 272 | #define CGEN_ATTR_CGEN_IFLD_MACH_VALUE(attrs) ((attrs)->nonbool[CGEN_IFLD_MACH-CGEN_IFLD_START_NBOOLS-1].nonbitset) |
| 273 | #define CGEN_ATTR_CGEN_IFLD_VIRTUAL_VALUE(attrs) (((attrs)->bool & (1 << CGEN_IFLD_VIRTUAL)) != 0) |
| 274 | #define CGEN_ATTR_CGEN_IFLD_PCREL_ADDR_VALUE(attrs) (((attrs)->bool & (1 << CGEN_IFLD_PCREL_ADDR)) != 0) |
| 275 | #define CGEN_ATTR_CGEN_IFLD_ABS_ADDR_VALUE(attrs) (((attrs)->bool & (1 << CGEN_IFLD_ABS_ADDR)) != 0) |
| 276 | #define CGEN_ATTR_CGEN_IFLD_RESERVED_VALUE(attrs) (((attrs)->bool & (1 << CGEN_IFLD_RESERVED)) != 0) |
| 277 | #define CGEN_ATTR_CGEN_IFLD_SIGN_OPT_VALUE(attrs) (((attrs)->bool & (1 << CGEN_IFLD_SIGN_OPT)) != 0) |
| 278 | #define CGEN_ATTR_CGEN_IFLD_SIGNED_VALUE(attrs) (((attrs)->bool & (1 << CGEN_IFLD_SIGNED)) != 0) |
| 279 | #define CGEN_ATTR_CGEN_IFLD_RELOC_VALUE(attrs) (((attrs)->bool & (1 << CGEN_IFLD_RELOC)) != 0) |
| 280 | |
| 281 | /* Enum declaration for xc16x ifield types. */ |
| 282 | typedef enum ifield_type { |
| 283 | XC16X_F_NIL, XC16X_F_ANYOF, XC16X_F_OP1, XC16X_F_OP2 |
| 284 | , XC16X_F_CONDCODE, XC16X_F_ICONDCODE, XC16X_F_RCOND, XC16X_F_QCOND |
| 285 | , XC16X_F_EXTCCODE, XC16X_F_R0, XC16X_F_R1, XC16X_F_R2 |
| 286 | , XC16X_F_R3, XC16X_F_R4, XC16X_F_UIMM2, XC16X_F_UIMM3 |
| 287 | , XC16X_F_UIMM4, XC16X_F_UIMM7, XC16X_F_UIMM8, XC16X_F_UIMM16 |
| 288 | , XC16X_F_MEMORY, XC16X_F_MEMGR8, XC16X_F_REL8, XC16X_F_RELHI8 |
| 289 | , XC16X_F_REG8, XC16X_F_REGMEM8, XC16X_F_REGOFF8, XC16X_F_REGHI8 |
| 290 | , XC16X_F_REGB8, XC16X_F_SEG8, XC16X_F_SEGNUM8, XC16X_F_MASK8 |
| 291 | , XC16X_F_PAGENUM, XC16X_F_DATAHI8, XC16X_F_DATA8, XC16X_F_OFFSET16 |
| 292 | , XC16X_F_OP_BIT1, XC16X_F_OP_BIT2, XC16X_F_OP_BIT4, XC16X_F_OP_BIT3 |
| 293 | , XC16X_F_OP_2BIT, XC16X_F_OP_BITONE, XC16X_F_OP_ONEBIT, XC16X_F_OP_1BIT |
| 294 | , XC16X_F_OP_LBIT4, XC16X_F_OP_LBIT2, XC16X_F_OP_BIT8, XC16X_F_OP_BIT16 |
| 295 | , XC16X_F_QBIT, XC16X_F_QLOBIT, XC16X_F_QHIBIT, XC16X_F_QLOBIT2 |
| 296 | , XC16X_F_POF, XC16X_F_MAX |
| 297 | } IFIELD_TYPE; |
| 298 | |
| 299 | #define MAX_IFLD ((int) XC16X_F_MAX) |
| 300 | |
| 301 | /* Hardware attribute indices. */ |
| 302 | |
| 303 | /* Enum declaration for cgen_hw attrs. */ |
| 304 | typedef enum cgen_hw_attr { |
| 305 | CGEN_HW_VIRTUAL, CGEN_HW_CACHE_ADDR, CGEN_HW_PC, CGEN_HW_PROFILE |
| 306 | , CGEN_HW_END_BOOLS, CGEN_HW_START_NBOOLS = 31, CGEN_HW_MACH, CGEN_HW_END_NBOOLS |
| 307 | } CGEN_HW_ATTR; |
| 308 | |
| 309 | /* Number of non-boolean elements in cgen_hw_attr. */ |
| 310 | #define CGEN_HW_NBOOL_ATTRS (CGEN_HW_END_NBOOLS - CGEN_HW_START_NBOOLS - 1) |
| 311 | |
| 312 | /* cgen_hw attribute accessor macros. */ |
| 313 | #define CGEN_ATTR_CGEN_HW_MACH_VALUE(attrs) ((attrs)->nonbool[CGEN_HW_MACH-CGEN_HW_START_NBOOLS-1].nonbitset) |
| 314 | #define CGEN_ATTR_CGEN_HW_VIRTUAL_VALUE(attrs) (((attrs)->bool & (1 << CGEN_HW_VIRTUAL)) != 0) |
| 315 | #define CGEN_ATTR_CGEN_HW_CACHE_ADDR_VALUE(attrs) (((attrs)->bool & (1 << CGEN_HW_CACHE_ADDR)) != 0) |
| 316 | #define CGEN_ATTR_CGEN_HW_PC_VALUE(attrs) (((attrs)->bool & (1 << CGEN_HW_PC)) != 0) |
| 317 | #define CGEN_ATTR_CGEN_HW_PROFILE_VALUE(attrs) (((attrs)->bool & (1 << CGEN_HW_PROFILE)) != 0) |
| 318 | |
| 319 | /* Enum declaration for xc16x hardware types. */ |
| 320 | typedef enum cgen_hw_type { |
| 321 | HW_H_MEMORY, HW_H_SINT, HW_H_UINT, HW_H_ADDR |
| 322 | , HW_H_IADDR, HW_H_PC, HW_H_GR, HW_H_CR |
| 323 | , HW_H_EXT, HW_H_PSW, HW_H_GRB, HW_H_CC |
| 324 | , HW_H_ECC, HW_H_GRB8, HW_H_R8, HW_H_REGMEM8 |
| 325 | , HW_H_REGDIV8, HW_H_R0, HW_H_R01, HW_H_REGBMEM8 |
| 326 | , HW_H_MEMGR8, HW_H_COND, HW_H_CBIT, HW_H_SGTDIS |
| 327 | , HW_MAX |
| 328 | } CGEN_HW_TYPE; |
| 329 | |
| 330 | #define MAX_HW ((int) HW_MAX) |
| 331 | |
| 332 | /* Operand attribute indices. */ |
| 333 | |
| 334 | /* Enum declaration for cgen_operand attrs. */ |
| 335 | typedef enum cgen_operand_attr { |
| 336 | CGEN_OPERAND_VIRTUAL, CGEN_OPERAND_PCREL_ADDR, CGEN_OPERAND_ABS_ADDR, CGEN_OPERAND_SIGN_OPT |
| 337 | , CGEN_OPERAND_SIGNED, CGEN_OPERAND_NEGATIVE, CGEN_OPERAND_RELAX, CGEN_OPERAND_SEM_ONLY |
| 338 | , CGEN_OPERAND_RELOC, CGEN_OPERAND_HASH_PREFIX, CGEN_OPERAND_DOT_PREFIX, CGEN_OPERAND_POF_PREFIX |
| 339 | , CGEN_OPERAND_PAG_PREFIX, CGEN_OPERAND_SOF_PREFIX, CGEN_OPERAND_SEG_PREFIX, CGEN_OPERAND_END_BOOLS |
| 340 | , CGEN_OPERAND_START_NBOOLS = 31, CGEN_OPERAND_MACH, CGEN_OPERAND_END_NBOOLS |
| 341 | } CGEN_OPERAND_ATTR; |
| 342 | |
| 343 | /* Number of non-boolean elements in cgen_operand_attr. */ |
| 344 | #define CGEN_OPERAND_NBOOL_ATTRS (CGEN_OPERAND_END_NBOOLS - CGEN_OPERAND_START_NBOOLS - 1) |
| 345 | |
| 346 | /* cgen_operand attribute accessor macros. */ |
| 347 | #define CGEN_ATTR_CGEN_OPERAND_MACH_VALUE(attrs) ((attrs)->nonbool[CGEN_OPERAND_MACH-CGEN_OPERAND_START_NBOOLS-1].nonbitset) |
| 348 | #define CGEN_ATTR_CGEN_OPERAND_VIRTUAL_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_VIRTUAL)) != 0) |
| 349 | #define CGEN_ATTR_CGEN_OPERAND_PCREL_ADDR_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_PCREL_ADDR)) != 0) |
| 350 | #define CGEN_ATTR_CGEN_OPERAND_ABS_ADDR_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_ABS_ADDR)) != 0) |
| 351 | #define CGEN_ATTR_CGEN_OPERAND_SIGN_OPT_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_SIGN_OPT)) != 0) |
| 352 | #define CGEN_ATTR_CGEN_OPERAND_SIGNED_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_SIGNED)) != 0) |
| 353 | #define CGEN_ATTR_CGEN_OPERAND_NEGATIVE_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_NEGATIVE)) != 0) |
| 354 | #define CGEN_ATTR_CGEN_OPERAND_RELAX_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_RELAX)) != 0) |
| 355 | #define CGEN_ATTR_CGEN_OPERAND_SEM_ONLY_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_SEM_ONLY)) != 0) |
| 356 | #define CGEN_ATTR_CGEN_OPERAND_RELOC_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_RELOC)) != 0) |
| 357 | #define CGEN_ATTR_CGEN_OPERAND_HASH_PREFIX_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_HASH_PREFIX)) != 0) |
| 358 | #define CGEN_ATTR_CGEN_OPERAND_DOT_PREFIX_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_DOT_PREFIX)) != 0) |
| 359 | #define CGEN_ATTR_CGEN_OPERAND_POF_PREFIX_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_POF_PREFIX)) != 0) |
| 360 | #define CGEN_ATTR_CGEN_OPERAND_PAG_PREFIX_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_PAG_PREFIX)) != 0) |
| 361 | #define CGEN_ATTR_CGEN_OPERAND_SOF_PREFIX_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_SOF_PREFIX)) != 0) |
| 362 | #define CGEN_ATTR_CGEN_OPERAND_SEG_PREFIX_VALUE(attrs) (((attrs)->bool & (1 << CGEN_OPERAND_SEG_PREFIX)) != 0) |
| 363 | |
| 364 | /* Enum declaration for xc16x operand types. */ |
| 365 | typedef enum cgen_operand_type { |
| 366 | XC16X_OPERAND_PC, XC16X_OPERAND_SR, XC16X_OPERAND_DR, XC16X_OPERAND_DRI |
| 367 | , XC16X_OPERAND_SRB, XC16X_OPERAND_DRB, XC16X_OPERAND_SR2, XC16X_OPERAND_SRC1 |
| 368 | , XC16X_OPERAND_SRC2, XC16X_OPERAND_SRDIV, XC16X_OPERAND_REGNAM, XC16X_OPERAND_UIMM2 |
| 369 | , XC16X_OPERAND_UIMM3, XC16X_OPERAND_UIMM4, XC16X_OPERAND_UIMM7, XC16X_OPERAND_UIMM8 |
| 370 | , XC16X_OPERAND_UIMM16, XC16X_OPERAND_UPOF16, XC16X_OPERAND_REG8, XC16X_OPERAND_REGMEM8 |
| 371 | , XC16X_OPERAND_REGBMEM8, XC16X_OPERAND_REGOFF8, XC16X_OPERAND_REGHI8, XC16X_OPERAND_REGB8 |
| 372 | , XC16X_OPERAND_GENREG, XC16X_OPERAND_SEG, XC16X_OPERAND_SEGHI8, XC16X_OPERAND_CADDR |
| 373 | , XC16X_OPERAND_REL, XC16X_OPERAND_RELHI, XC16X_OPERAND_CONDBIT, XC16X_OPERAND_BIT1 |
| 374 | , XC16X_OPERAND_BIT2, XC16X_OPERAND_BIT4, XC16X_OPERAND_LBIT4, XC16X_OPERAND_LBIT2 |
| 375 | , XC16X_OPERAND_BIT8, XC16X_OPERAND_U4, XC16X_OPERAND_BITONE, XC16X_OPERAND_BIT01 |
| 376 | , XC16X_OPERAND_COND, XC16X_OPERAND_ICOND, XC16X_OPERAND_EXTCOND, XC16X_OPERAND_MEMORY |
| 377 | , XC16X_OPERAND_MEMGR8, XC16X_OPERAND_CBIT, XC16X_OPERAND_QBIT, XC16X_OPERAND_QLOBIT |
| 378 | , XC16X_OPERAND_QHIBIT, XC16X_OPERAND_MASK8, XC16X_OPERAND_MASKLO8, XC16X_OPERAND_PAGENUM |
| 379 | , XC16X_OPERAND_DATA8, XC16X_OPERAND_DATAHI8, XC16X_OPERAND_SGTDISBIT, XC16X_OPERAND_UPAG16 |
| 380 | , XC16X_OPERAND_USEG8, XC16X_OPERAND_USEG16, XC16X_OPERAND_USOF16, XC16X_OPERAND_HASH |
| 381 | , XC16X_OPERAND_DOT, XC16X_OPERAND_POF, XC16X_OPERAND_PAG, XC16X_OPERAND_SOF |
| 382 | , XC16X_OPERAND_SEGM, XC16X_OPERAND_MAX |
| 383 | } CGEN_OPERAND_TYPE; |
| 384 | |
| 385 | /* Number of operands types. */ |
| 386 | #define MAX_OPERANDS 65 |
| 387 | |
| 388 | /* Maximum number of operands referenced by any insn. */ |
| 389 | #define MAX_OPERAND_INSTANCES 8 |
| 390 | |
| 391 | /* Insn attribute indices. */ |
| 392 | |
| 393 | /* Enum declaration for cgen_insn attrs. */ |
| 394 | typedef enum cgen_insn_attr { |
| 395 | CGEN_INSN_ALIAS, CGEN_INSN_VIRTUAL, CGEN_INSN_UNCOND_CTI, CGEN_INSN_COND_CTI |
| 396 | , CGEN_INSN_SKIP_CTI, CGEN_INSN_DELAY_SLOT, CGEN_INSN_RELAXABLE, CGEN_INSN_RELAXED |
| 397 | , CGEN_INSN_NO_DIS, CGEN_INSN_PBB, CGEN_INSN_END_BOOLS, CGEN_INSN_START_NBOOLS = 31 |
| 398 | , CGEN_INSN_MACH, CGEN_INSN_PIPE, CGEN_INSN_END_NBOOLS |
| 399 | } CGEN_INSN_ATTR; |
| 400 | |
| 401 | /* Number of non-boolean elements in cgen_insn_attr. */ |
| 402 | #define CGEN_INSN_NBOOL_ATTRS (CGEN_INSN_END_NBOOLS - CGEN_INSN_START_NBOOLS - 1) |
| 403 | |
| 404 | /* cgen_insn attribute accessor macros. */ |
| 405 | #define CGEN_ATTR_CGEN_INSN_MACH_VALUE(attrs) ((attrs)->nonbool[CGEN_INSN_MACH-CGEN_INSN_START_NBOOLS-1].nonbitset) |
| 406 | #define CGEN_ATTR_CGEN_INSN_PIPE_VALUE(attrs) ((attrs)->nonbool[CGEN_INSN_PIPE-CGEN_INSN_START_NBOOLS-1].nonbitset) |
| 407 | #define CGEN_ATTR_CGEN_INSN_ALIAS_VALUE(attrs) (((attrs)->bool & (1 << CGEN_INSN_ALIAS)) != 0) |
| 408 | #define CGEN_ATTR_CGEN_INSN_VIRTUAL_VALUE(attrs) (((attrs)->bool & (1 << CGEN_INSN_VIRTUAL)) != 0) |
| 409 | #define CGEN_ATTR_CGEN_INSN_UNCOND_CTI_VALUE(attrs) (((attrs)->bool & (1 << CGEN_INSN_UNCOND_CTI)) != 0) |
| 410 | #define CGEN_ATTR_CGEN_INSN_COND_CTI_VALUE(attrs) (((attrs)->bool & (1 << CGEN_INSN_COND_CTI)) != 0) |
| 411 | #define CGEN_ATTR_CGEN_INSN_SKIP_CTI_VALUE(attrs) (((attrs)->bool & (1 << CGEN_INSN_SKIP_CTI)) != 0) |
| 412 | #define CGEN_ATTR_CGEN_INSN_DELAY_SLOT_VALUE(attrs) (((attrs)->bool & (1 << CGEN_INSN_DELAY_SLOT)) != 0) |
| 413 | #define CGEN_ATTR_CGEN_INSN_RELAXABLE_VALUE(attrs) (((attrs)->bool & (1 << CGEN_INSN_RELAXABLE)) != 0) |
| 414 | #define CGEN_ATTR_CGEN_INSN_RELAXED_VALUE(attrs) (((attrs)->bool & (1 << CGEN_INSN_RELAXED)) != 0) |
| 415 | #define CGEN_ATTR_CGEN_INSN_NO_DIS_VALUE(attrs) (((attrs)->bool & (1 << CGEN_INSN_NO_DIS)) != 0) |
| 416 | #define CGEN_ATTR_CGEN_INSN_PBB_VALUE(attrs) (((attrs)->bool & (1 << CGEN_INSN_PBB)) != 0) |
| 417 | |
| 418 | /* cgen.h uses things we just defined. */ |
| 419 | #include "opcode/cgen.h" |
| 420 | |
| 421 | extern const struct cgen_ifld xc16x_cgen_ifld_table[]; |
| 422 | |
| 423 | /* Attributes. */ |
| 424 | extern const CGEN_ATTR_TABLE xc16x_cgen_hardware_attr_table[]; |
| 425 | extern const CGEN_ATTR_TABLE xc16x_cgen_ifield_attr_table[]; |
| 426 | extern const CGEN_ATTR_TABLE xc16x_cgen_operand_attr_table[]; |
| 427 | extern const CGEN_ATTR_TABLE xc16x_cgen_insn_attr_table[]; |
| 428 | |
| 429 | /* Hardware decls. */ |
| 430 | |
| 431 | extern CGEN_KEYWORD xc16x_cgen_opval_gr_names; |
| 432 | extern CGEN_KEYWORD xc16x_cgen_opval_gr_names; |
| 433 | extern CGEN_KEYWORD xc16x_cgen_opval_ext_names; |
| 434 | extern CGEN_KEYWORD xc16x_cgen_opval_psw_names; |
| 435 | extern CGEN_KEYWORD xc16x_cgen_opval_grb_names; |
| 436 | extern CGEN_KEYWORD xc16x_cgen_opval_conditioncode_names; |
| 437 | extern CGEN_KEYWORD xc16x_cgen_opval_extconditioncode_names; |
| 438 | extern CGEN_KEYWORD xc16x_cgen_opval_grb8_names; |
| 439 | extern CGEN_KEYWORD xc16x_cgen_opval_r8_names; |
| 440 | extern CGEN_KEYWORD xc16x_cgen_opval_regmem8_names; |
| 441 | extern CGEN_KEYWORD xc16x_cgen_opval_regdiv8_names; |
| 442 | extern CGEN_KEYWORD xc16x_cgen_opval_reg0_name; |
| 443 | extern CGEN_KEYWORD xc16x_cgen_opval_reg0_name1; |
| 444 | extern CGEN_KEYWORD xc16x_cgen_opval_regbmem8_names; |
| 445 | extern CGEN_KEYWORD xc16x_cgen_opval_memgr8_names; |
| 446 | |
| 447 | extern const CGEN_HW_ENTRY xc16x_cgen_hw_table[]; |
| 448 | |
| 449 | |
| 450 | |
| 451 | #endif /* XC16X_CPU_H */ |