* cache.c (cache_bread): Cast void * pointer before performing
[binutils.git] / include / opcode / mmix.h
blob7f561c6393ba5258bc67daf5c375171d7087757e
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)
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 2,
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 COPYING. If not, write to the Free
19 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
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
26 const char *name;
27 unsigned int number;
30 /* General indication of the type of instruction. */
31 enum mmix_insn_type
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
45 /* Type of operands an instruction takes. Use when parsing assembly code
46 and disassembling. */
47 enum mmix_operands_type
49 mmix_operands_none = 0,
51 /* All operands are registers: "$X,$Y,$Z". */
52 mmix_operands_regs,
54 /* "$X,YZ", like SETH. */
55 mmix_operands_reg_yz,
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,
62 /* The regular "$X,$Y,$Z|Z". */
63 mmix_operands_regs_z,
65 /* "Address"; only JMP. Zero operands allowed unless GNU syntax. */
66 mmix_operands_jmp,
68 /* "$X|X,$Y,$Z|Z": PUSHGO; like "3", but X can be expressed as an
69 integer. */
70 mmix_operands_pushgo,
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,
76 /* "X,YZ", POP. Unless GNU syntax, zero or one operand is allowed. */
77 mmix_operands_pop,
79 /* Two registers, possibly with rounding: "$X,$Z" or
80 "$X,ROUND_MODE,$Z". */
81 mmix_operands_roundregs,
83 /* "XYZ", like SYNC. */
84 mmix_operands_sync,
86 /* "X,$Y,$Z|Z", like SYNCD. */
87 mmix_operands_x_regs_z,
89 /* "$X,Y,$Z|Z", like NEG and NEGU. The Y field is optional, default 0. */
90 mmix_operands_neg,
92 /* "$X,Address, like GETA or branches. */
93 mmix_operands_regaddr,
95 /* "$X|X,Address, like PUSHJ. */
96 mmix_operands_pushj,
98 /* "$X,spec_reg"; GET. */
99 mmix_operands_get,
101 /* "spec_reg,$Z|Z"; PUT. */
102 mmix_operands_put,
104 /* Two registers, "$X,$Y". */
105 mmix_operands_set,
107 /* "$X,0"; SAVE. */
108 mmix_operands_save,
110 /* "0,$Z"; UNSAVE. */
111 mmix_operands_unsave,
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,
117 /* Just "Z", like RESUME. Unless GNU syntax, the operand can be omitted
118 and will then be assumed zero. */
119 mmix_operands_resume,
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. */
125 /* LOC. */
126 mmix_operands_loc,
128 /* PREFIX. */
129 mmix_operands_prefix,
131 /* BYTE. */
132 mmix_operands_byte,
134 /* WYDE. */
135 mmix_operands_wyde,
137 /* TETRA. */
138 mmix_operands_tetra,
140 /* OCTA. */
141 mmix_operands_octa,
143 /* LOCAL. */
144 mmix_operands_local,
146 /* BSPEC. */
147 mmix_operands_bspec,
149 /* ESPEC. */
150 mmix_operands_espec,
153 struct mmix_opcode
155 const char *name;
156 unsigned long match;
157 unsigned long lose;
158 enum mmix_operands_type operands;
160 /* This is used by the disassembly function. */
161 enum mmix_insn_type type;
164 /* Declare the actual tables. */
165 extern const struct mmix_opcode mmix_opcodes[];
167 /* This one is terminated with an entry with a NULL name. */
168 extern const struct mmix_spec_reg mmix_spec_regs[];
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
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
184 /* We can have 256 - 32 (local registers) - 1 ($255 is not allocatable)
185 global registers. */
186 #define MAX_GREGS 223