1 1.1 skrll /* mmix.h -- Header file for MMIX opcode table 2 1.1.1.10 christos Copyright (C) 2001-2026 Free Software Foundation, Inc. 3 1.1 skrll Written by Hans-Peter Nilsson (hp (at) bitrange.com) 4 1.1 skrll 5 1.1.1.2 christos This file is part of GDB, GAS, and the GNU binutils. 6 1.1 skrll 7 1.1.1.2 christos GDB, GAS, and the GNU binutils are free software; you can redistribute 8 1.1.1.2 christos them and/or modify them under the terms of the GNU General Public 9 1.1.1.2 christos License as published by the Free Software Foundation; either version 3, 10 1.1.1.2 christos or (at your option) any later version. 11 1.1.1.2 christos 12 1.1.1.2 christos GDB, GAS, and the GNU binutils are distributed in the hope that they 13 1.1.1.2 christos will be useful, but WITHOUT ANY WARRANTY; without even the implied 14 1.1.1.2 christos warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 15 1.1.1.2 christos the GNU General Public License for more details. 16 1.1.1.2 christos 17 1.1.1.2 christos You should have received a copy of the GNU General Public License 18 1.1.1.2 christos along with this file; see the file COPYING3. If not, write to the Free 19 1.1.1.2 christos Software Foundation, 51 Franklin Street - Fifth Floor, Boston, 20 1.1.1.2 christos MA 02110-1301, USA. */ 21 1.1 skrll 22 1.1 skrll /* We could have just a char*[] table indexed by the register number, but 23 1.1 skrll that would not allow for synonyms. The table is terminated with an 24 1.1 skrll entry with a NULL name. */ 25 1.1 skrll struct mmix_spec_reg 26 1.1 skrll { 27 1.1 skrll const char *name; 28 1.1 skrll unsigned int number; 29 1.1 skrll }; 30 1.1 skrll 31 1.1 skrll /* General indication of the type of instruction. */ 32 1.1 skrll enum mmix_insn_type 33 1.1 skrll { 34 1.1 skrll mmix_type_pseudo, 35 1.1 skrll mmix_type_normal, 36 1.1 skrll mmix_type_branch, 37 1.1 skrll mmix_type_condbranch, 38 1.1 skrll mmix_type_memaccess_octa, 39 1.1 skrll mmix_type_memaccess_tetra, 40 1.1 skrll mmix_type_memaccess_wyde, 41 1.1 skrll mmix_type_memaccess_byte, 42 1.1 skrll mmix_type_memaccess_block, 43 1.1 skrll mmix_type_jsr 44 1.1 skrll }; 45 1.1 skrll 46 1.1 skrll /* Type of operands an instruction takes. Use when parsing assembly code 47 1.1 skrll and disassembling. */ 48 1.1 skrll enum mmix_operands_type 49 1.1 skrll { 50 1.1 skrll mmix_operands_none = 0, 51 1.1 skrll 52 1.1 skrll /* All operands are registers: "$X,$Y,$Z". */ 53 1.1 skrll mmix_operands_regs, 54 1.1 skrll 55 1.1 skrll /* "$X,YZ", like SETH. */ 56 1.1 skrll mmix_operands_reg_yz, 57 1.1 skrll 58 1.1 skrll /* The regular "$X,$Y,$Z|Z". 59 1.1 skrll The Z is optional; if only "$X,$Y" is given, then "$X,$Y,0" is 60 1.1 skrll assumed. */ 61 1.1 skrll mmix_operands_regs_z_opt, 62 1.1 skrll 63 1.1 skrll /* The regular "$X,$Y,$Z|Z". */ 64 1.1 skrll mmix_operands_regs_z, 65 1.1 skrll 66 1.1 skrll /* "Address"; only JMP. Zero operands allowed unless GNU syntax. */ 67 1.1 skrll mmix_operands_jmp, 68 1.1 skrll 69 1.1 skrll /* "$X|X,$Y,$Z|Z": PUSHGO; like "3", but X can be expressed as an 70 1.1 skrll integer. */ 71 1.1 skrll mmix_operands_pushgo, 72 1.1 skrll 73 1.1 skrll /* Two registers or a register and a byte, like FLOT, possibly with 74 1.1 skrll rounding: "$X,$Z|Z" or "$X,ROUND_MODE,$Z|Z". */ 75 1.1 skrll mmix_operands_roundregs_z, 76 1.1 skrll 77 1.1 skrll /* "X,YZ", POP. Unless GNU syntax, zero or one operand is allowed. */ 78 1.1 skrll mmix_operands_pop, 79 1.1 skrll 80 1.1 skrll /* Two registers, possibly with rounding: "$X,$Z" or 81 1.1 skrll "$X,ROUND_MODE,$Z". */ 82 1.1 skrll mmix_operands_roundregs, 83 1.1 skrll 84 1.1 skrll /* "XYZ", like SYNC. */ 85 1.1 skrll mmix_operands_sync, 86 1.1 skrll 87 1.1 skrll /* "X,$Y,$Z|Z", like SYNCD. */ 88 1.1 skrll mmix_operands_x_regs_z, 89 1.1 skrll 90 1.1 skrll /* "$X,Y,$Z|Z", like NEG and NEGU. The Y field is optional, default 0. */ 91 1.1 skrll mmix_operands_neg, 92 1.1 skrll 93 1.1 skrll /* "$X,Address, like GETA or branches. */ 94 1.1 skrll mmix_operands_regaddr, 95 1.1 skrll 96 1.1 skrll /* "$X|X,Address, like PUSHJ. */ 97 1.1 skrll mmix_operands_pushj, 98 1.1 skrll 99 1.1 skrll /* "$X,spec_reg"; GET. */ 100 1.1 skrll mmix_operands_get, 101 1.1 skrll 102 1.1 skrll /* "spec_reg,$Z|Z"; PUT. */ 103 1.1 skrll mmix_operands_put, 104 1.1 skrll 105 1.1 skrll /* Two registers, "$X,$Y". */ 106 1.1 skrll mmix_operands_set, 107 1.1 skrll 108 1.1 skrll /* "$X,0"; SAVE. */ 109 1.1 skrll mmix_operands_save, 110 1.1 skrll 111 1.1 skrll /* "0,$Z"; UNSAVE. */ 112 1.1 skrll mmix_operands_unsave, 113 1.1 skrll 114 1.1 skrll /* "X,Y,Z"; like SWYM or TRAP. Zero (or 1 if GNU syntax) to three 115 1.1 skrll operands, interpreted as 0; XYZ; X, YZ and X, Y, Z. */ 116 1.1 skrll mmix_operands_xyz_opt, 117 1.1 skrll 118 1.1 skrll /* Just "Z", like RESUME. Unless GNU syntax, the operand can be omitted 119 1.1 skrll and will then be assumed zero. */ 120 1.1 skrll mmix_operands_resume, 121 1.1 skrll 122 1.1 skrll /* These are specials to handle that pseudo-directives are specified 123 1.1 skrll like ordinary insns when being mmixal-compatible. They signify the 124 1.1 skrll specific pseudo-directive rather than the operands type. */ 125 1.1 skrll 126 1.1 skrll /* LOC. */ 127 1.1 skrll mmix_operands_loc, 128 1.1 skrll 129 1.1 skrll /* PREFIX. */ 130 1.1 skrll mmix_operands_prefix, 131 1.1 skrll 132 1.1 skrll /* BYTE. */ 133 1.1 skrll mmix_operands_byte, 134 1.1 skrll 135 1.1 skrll /* WYDE. */ 136 1.1 skrll mmix_operands_wyde, 137 1.1 skrll 138 1.1 skrll /* TETRA. */ 139 1.1 skrll mmix_operands_tetra, 140 1.1 skrll 141 1.1 skrll /* OCTA. */ 142 1.1 skrll mmix_operands_octa, 143 1.1 skrll 144 1.1 skrll /* LOCAL. */ 145 1.1 skrll mmix_operands_local, 146 1.1 skrll 147 1.1 skrll /* BSPEC. */ 148 1.1 skrll mmix_operands_bspec, 149 1.1 skrll 150 1.1 skrll /* ESPEC. */ 151 1.1 skrll mmix_operands_espec, 152 1.1 skrll }; 153 1.1 skrll 154 1.1 skrll struct mmix_opcode 155 1.1 skrll { 156 1.1 skrll const char *name; 157 1.1 skrll unsigned long match; 158 1.1 skrll unsigned long lose; 159 1.1 skrll enum mmix_operands_type operands; 160 1.1 skrll 161 1.1 skrll /* This is used by the disassembly function. */ 162 1.1 skrll enum mmix_insn_type type; 163 1.1 skrll }; 164 1.1 skrll 165 1.1 skrll /* Declare the actual tables. */ 166 1.1 skrll extern const struct mmix_opcode mmix_opcodes[]; 167 1.1 skrll 168 1.1 skrll /* This one is terminated with an entry with a NULL name. */ 169 1.1 skrll extern const struct mmix_spec_reg mmix_spec_regs[]; 170 1.1 skrll 171 1.1 skrll /* Some insn values we use when padding and synthesizing address loads. */ 172 1.1 skrll #define IMM_OFFSET_BIT 1 173 1.1 skrll #define COND_INV_BIT 0x8 174 1.1 skrll #define PRED_INV_BIT 0x10 175 1.1 skrll 176 1.1.1.6 christos #define PUSHGO_INSN_BYTE 0xbeu 177 1.1.1.6 christos #define GO_INSN_BYTE 0x9eu 178 1.1.1.6 christos #define SETL_INSN_BYTE 0xe3u 179 1.1.1.6 christos #define INCML_INSN_BYTE 0xe6u 180 1.1.1.6 christos #define INCMH_INSN_BYTE 0xe5u 181 1.1.1.6 christos #define INCH_INSN_BYTE 0xe4u 182 1.1.1.6 christos #define SWYM_INSN_BYTE 0xfdu 183 1.1.1.6 christos #define JMP_INSN_BYTE 0xf0u 184 1.1 skrll 185 1.1 skrll /* We can have 256 - 32 (local registers) - 1 ($255 is not allocatable) 186 1.1 skrll global registers. */ 187 1.1 skrll #define MAX_GREGS 223 188