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