1 /* mmix.h -- Header file for MMIX opcode table
2 Copyright (C) 2001-2024 Free Software Foundation, Inc.
3 Written by Hans-Peter Nilsson (hp@bitrange.com)
5 This file is part of GDB, GAS, and the GNU binutils.
7 GDB, GAS, and the GNU binutils are free software; you can redistribute
8 them and/or modify them under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either version 3,
10 or (at your option) any later version.
12 GDB, GAS, and the GNU binutils are distributed in the hope that they
13 will be useful, but WITHOUT ANY WARRANTY; without even the implied
14 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
15 the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this file; see the file COPYING3. If not, write to the Free
19 Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
20 MA 02110-1301, USA. */
22 /* We could have just a char*[] table indexed by the register number, but
23 that would not allow for synonyms. The table is terminated with an
24 entry with a NULL name. */
31 /* General indication of the type of instruction. */
38 mmix_type_memaccess_octa
,
39 mmix_type_memaccess_tetra
,
40 mmix_type_memaccess_wyde
,
41 mmix_type_memaccess_byte
,
42 mmix_type_memaccess_block
,
46 /* Type of operands an instruction takes. Use when parsing assembly code
48 enum mmix_operands_type
50 mmix_operands_none
= 0,
52 /* All operands are registers: "$X,$Y,$Z". */
55 /* "$X,YZ", like SETH. */
58 /* The regular "$X,$Y,$Z|Z".
59 The Z is optional; if only "$X,$Y" is given, then "$X,$Y,0" is
61 mmix_operands_regs_z_opt
,
63 /* The regular "$X,$Y,$Z|Z". */
66 /* "Address"; only JMP. Zero operands allowed unless GNU syntax. */
69 /* "$X|X,$Y,$Z|Z": PUSHGO; like "3", but X can be expressed as an
73 /* Two registers or a register and a byte, like FLOT, possibly with
74 rounding: "$X,$Z|Z" or "$X,ROUND_MODE,$Z|Z". */
75 mmix_operands_roundregs_z
,
77 /* "X,YZ", POP. Unless GNU syntax, zero or one operand is allowed. */
80 /* Two registers, possibly with rounding: "$X,$Z" or
81 "$X,ROUND_MODE,$Z". */
82 mmix_operands_roundregs
,
84 /* "XYZ", like SYNC. */
87 /* "X,$Y,$Z|Z", like SYNCD. */
88 mmix_operands_x_regs_z
,
90 /* "$X,Y,$Z|Z", like NEG and NEGU. The Y field is optional, default 0. */
93 /* "$X,Address, like GETA or branches. */
94 mmix_operands_regaddr
,
96 /* "$X|X,Address, like PUSHJ. */
99 /* "$X,spec_reg"; GET. */
102 /* "spec_reg,$Z|Z"; PUT. */
105 /* Two registers, "$X,$Y". */
111 /* "0,$Z"; UNSAVE. */
112 mmix_operands_unsave
,
114 /* "X,Y,Z"; like SWYM or TRAP. Zero (or 1 if GNU syntax) to three
115 operands, interpreted as 0; XYZ; X, YZ and X, Y, Z. */
116 mmix_operands_xyz_opt
,
118 /* Just "Z", like RESUME. Unless GNU syntax, the operand can be omitted
119 and will then be assumed zero. */
120 mmix_operands_resume
,
122 /* These are specials to handle that pseudo-directives are specified
123 like ordinary insns when being mmixal-compatible. They signify the
124 specific pseudo-directive rather than the operands type. */
130 mmix_operands_prefix
,
159 enum mmix_operands_type operands
;
161 /* This is used by the disassembly function. */
162 enum mmix_insn_type type
;
165 /* Declare the actual tables. */
166 extern const struct mmix_opcode mmix_opcodes
[];
168 /* This one is terminated with an entry with a NULL name. */
169 extern const struct mmix_spec_reg mmix_spec_regs
[];
171 /* Some insn values we use when padding and synthesizing address loads. */
172 #define IMM_OFFSET_BIT 1
173 #define COND_INV_BIT 0x8
174 #define PRED_INV_BIT 0x10
176 #define PUSHGO_INSN_BYTE 0xbeu
177 #define GO_INSN_BYTE 0x9eu
178 #define SETL_INSN_BYTE 0xe3u
179 #define INCML_INSN_BYTE 0xe6u
180 #define INCMH_INSN_BYTE 0xe5u
181 #define INCH_INSN_BYTE 0xe4u
182 #define SWYM_INSN_BYTE 0xfdu
183 #define JMP_INSN_BYTE 0xf0u
185 /* We can have 256 - 32 (local registers) - 1 ($255 is not allocatable)
187 #define MAX_GREGS 223