No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gdb6 / opcodes / mt-desc.c
blob4bda146e59e5aad879f78d4a529bffaf69b7d442
1 /* CPU data for mt.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996-2005 Free Software Foundation, Inc.
7 This file is part of the GNU Binutils and/or GDB, the GNU debugger.
9 This program 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 2, or (at your option)
12 any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
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.
25 #include "sysdep.h"
26 #include <stdio.h>
27 #include <stdarg.h>
28 #include "ansidecl.h"
29 #include "bfd.h"
30 #include "symcat.h"
31 #include "mt-desc.h"
32 #include "mt-opc.h"
33 #include "opintl.h"
34 #include "libiberty.h"
35 #include "xregex.h"
37 /* Attributes. */
39 static const CGEN_ATTR_ENTRY bool_attr[] =
41 { "#f", 0 },
42 { "#t", 1 },
43 { 0, 0 }
46 static const CGEN_ATTR_ENTRY MACH_attr[] ATTRIBUTE_UNUSED =
48 { "base", MACH_BASE },
49 { "ms1", MACH_MS1 },
50 { "ms1_003", MACH_MS1_003 },
51 { "ms2", MACH_MS2 },
52 { "max", MACH_MAX },
53 { 0, 0 }
56 static const CGEN_ATTR_ENTRY ISA_attr[] ATTRIBUTE_UNUSED =
58 { "mt", ISA_MT },
59 { "max", ISA_MAX },
60 { 0, 0 }
63 const CGEN_ATTR_TABLE mt_cgen_ifield_attr_table[] =
65 { "MACH", & MACH_attr[0], & MACH_attr[0] },
66 { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
67 { "PCREL-ADDR", &bool_attr[0], &bool_attr[0] },
68 { "ABS-ADDR", &bool_attr[0], &bool_attr[0] },
69 { "RESERVED", &bool_attr[0], &bool_attr[0] },
70 { "SIGN-OPT", &bool_attr[0], &bool_attr[0] },
71 { "SIGNED", &bool_attr[0], &bool_attr[0] },
72 { 0, 0, 0 }
75 const CGEN_ATTR_TABLE mt_cgen_hardware_attr_table[] =
77 { "MACH", & MACH_attr[0], & MACH_attr[0] },
78 { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
79 { "CACHE-ADDR", &bool_attr[0], &bool_attr[0] },
80 { "PC", &bool_attr[0], &bool_attr[0] },
81 { "PROFILE", &bool_attr[0], &bool_attr[0] },
82 { 0, 0, 0 }
85 const CGEN_ATTR_TABLE mt_cgen_operand_attr_table[] =
87 { "MACH", & MACH_attr[0], & MACH_attr[0] },
88 { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
89 { "PCREL-ADDR", &bool_attr[0], &bool_attr[0] },
90 { "ABS-ADDR", &bool_attr[0], &bool_attr[0] },
91 { "SIGN-OPT", &bool_attr[0], &bool_attr[0] },
92 { "SIGNED", &bool_attr[0], &bool_attr[0] },
93 { "NEGATIVE", &bool_attr[0], &bool_attr[0] },
94 { "RELAX", &bool_attr[0], &bool_attr[0] },
95 { "SEM-ONLY", &bool_attr[0], &bool_attr[0] },
96 { 0, 0, 0 }
99 const CGEN_ATTR_TABLE mt_cgen_insn_attr_table[] =
101 { "MACH", & MACH_attr[0], & MACH_attr[0] },
102 { "ALIAS", &bool_attr[0], &bool_attr[0] },
103 { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
104 { "UNCOND-CTI", &bool_attr[0], &bool_attr[0] },
105 { "COND-CTI", &bool_attr[0], &bool_attr[0] },
106 { "SKIP-CTI", &bool_attr[0], &bool_attr[0] },
107 { "DELAY-SLOT", &bool_attr[0], &bool_attr[0] },
108 { "RELAXABLE", &bool_attr[0], &bool_attr[0] },
109 { "RELAXED", &bool_attr[0], &bool_attr[0] },
110 { "NO-DIS", &bool_attr[0], &bool_attr[0] },
111 { "PBB", &bool_attr[0], &bool_attr[0] },
112 { "LOAD-DELAY", &bool_attr[0], &bool_attr[0] },
113 { "MEMORY-ACCESS", &bool_attr[0], &bool_attr[0] },
114 { "AL-INSN", &bool_attr[0], &bool_attr[0] },
115 { "IO-INSN", &bool_attr[0], &bool_attr[0] },
116 { "BR-INSN", &bool_attr[0], &bool_attr[0] },
117 { "JAL-HAZARD", &bool_attr[0], &bool_attr[0] },
118 { "USES-FRDR", &bool_attr[0], &bool_attr[0] },
119 { "USES-FRDRRR", &bool_attr[0], &bool_attr[0] },
120 { "USES-FRSR1", &bool_attr[0], &bool_attr[0] },
121 { "USES-FRSR2", &bool_attr[0], &bool_attr[0] },
122 { "SKIPA", &bool_attr[0], &bool_attr[0] },
123 { 0, 0, 0 }
126 /* Instruction set variants. */
128 static const CGEN_ISA mt_cgen_isa_table[] = {
129 { "mt", 32, 32, 32, 32 },
130 { 0, 0, 0, 0, 0 }
133 /* Machine variants. */
135 static const CGEN_MACH mt_cgen_mach_table[] = {
136 { "ms1", "ms1", MACH_MS1, 0 },
137 { "ms1-003", "ms1-003", MACH_MS1_003, 0 },
138 { "ms2", "ms2", MACH_MS2, 0 },
139 { 0, 0, 0, 0 }
142 static CGEN_KEYWORD_ENTRY mt_cgen_opval_msys_syms_entries[] =
144 { "DUP", 1, {0, {{{0, 0}}}}, 0, 0 },
145 { "XX", 0, {0, {{{0, 0}}}}, 0, 0 }
148 CGEN_KEYWORD mt_cgen_opval_msys_syms =
150 & mt_cgen_opval_msys_syms_entries[0],
152 0, 0, 0, 0, ""
155 static CGEN_KEYWORD_ENTRY mt_cgen_opval_h_spr_entries[] =
157 { "R0", 0, {0, {{{0, 0}}}}, 0, 0 },
158 { "R1", 1, {0, {{{0, 0}}}}, 0, 0 },
159 { "R2", 2, {0, {{{0, 0}}}}, 0, 0 },
160 { "R3", 3, {0, {{{0, 0}}}}, 0, 0 },
161 { "R4", 4, {0, {{{0, 0}}}}, 0, 0 },
162 { "R5", 5, {0, {{{0, 0}}}}, 0, 0 },
163 { "R6", 6, {0, {{{0, 0}}}}, 0, 0 },
164 { "R7", 7, {0, {{{0, 0}}}}, 0, 0 },
165 { "R8", 8, {0, {{{0, 0}}}}, 0, 0 },
166 { "R9", 9, {0, {{{0, 0}}}}, 0, 0 },
167 { "R10", 10, {0, {{{0, 0}}}}, 0, 0 },
168 { "R11", 11, {0, {{{0, 0}}}}, 0, 0 },
169 { "R12", 12, {0, {{{0, 0}}}}, 0, 0 },
170 { "fp", 12, {0, {{{0, 0}}}}, 0, 0 },
171 { "R13", 13, {0, {{{0, 0}}}}, 0, 0 },
172 { "sp", 13, {0, {{{0, 0}}}}, 0, 0 },
173 { "R14", 14, {0, {{{0, 0}}}}, 0, 0 },
174 { "ra", 14, {0, {{{0, 0}}}}, 0, 0 },
175 { "R15", 15, {0, {{{0, 0}}}}, 0, 0 },
176 { "ira", 15, {0, {{{0, 0}}}}, 0, 0 }
179 CGEN_KEYWORD mt_cgen_opval_h_spr =
181 & mt_cgen_opval_h_spr_entries[0],
183 0, 0, 0, 0, ""
187 /* The hardware table. */
189 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
190 #define A(a) (1 << CGEN_HW_##a)
191 #else
192 #define A(a) (1 << CGEN_HW_/**/a)
193 #endif
195 const CGEN_HW_ENTRY mt_cgen_hw_table[] =
197 { "h-memory", HW_H_MEMORY, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
198 { "h-sint", HW_H_SINT, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
199 { "h-uint", HW_H_UINT, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
200 { "h-addr", HW_H_ADDR, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
201 { "h-iaddr", HW_H_IADDR, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
202 { "h-spr", HW_H_SPR, CGEN_ASM_KEYWORD, (PTR) & mt_cgen_opval_h_spr, { 0, { { { (1<<MACH_BASE), 0 } } } } },
203 { "h-pc", HW_H_PC, CGEN_ASM_NONE, 0, { 0|A(PROFILE)|A(PC), { { { (1<<MACH_BASE), 0 } } } } },
204 { 0, 0, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } }
207 #undef A
210 /* The instruction field table. */
212 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
213 #define A(a) (1 << CGEN_IFLD_##a)
214 #else
215 #define A(a) (1 << CGEN_IFLD_/**/a)
216 #endif
218 const CGEN_IFLD mt_cgen_ifld_table[] =
220 { MT_F_NIL, "f-nil", 0, 0, 0, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
221 { MT_F_ANYOF, "f-anyof", 0, 0, 0, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
222 { MT_F_MSYS, "f-msys", 0, 32, 31, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
223 { MT_F_OPC, "f-opc", 0, 32, 30, 6, { 0, { { { (1<<MACH_BASE), 0 } } } } },
224 { MT_F_IMM, "f-imm", 0, 32, 24, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
225 { MT_F_UU24, "f-uu24", 0, 32, 23, 24, { 0, { { { (1<<MACH_BASE), 0 } } } } },
226 { MT_F_SR1, "f-sr1", 0, 32, 23, 4, { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
227 { MT_F_SR2, "f-sr2", 0, 32, 19, 4, { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
228 { MT_F_DR, "f-dr", 0, 32, 19, 4, { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
229 { MT_F_DRRR, "f-drrr", 0, 32, 15, 4, { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
230 { MT_F_IMM16U, "f-imm16u", 0, 32, 15, 16, { 0, { { { (1<<MACH_BASE), 0 } } } } },
231 { MT_F_IMM16S, "f-imm16s", 0, 32, 15, 16, { 0, { { { (1<<MACH_BASE), 0 } } } } },
232 { MT_F_IMM16A, "f-imm16a", 0, 32, 15, 16, { 0|A(PCREL_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
233 { MT_F_UU4A, "f-uu4a", 0, 32, 19, 4, { 0, { { { (1<<MACH_BASE), 0 } } } } },
234 { MT_F_UU4B, "f-uu4b", 0, 32, 23, 4, { 0, { { { (1<<MACH_BASE), 0 } } } } },
235 { MT_F_UU12, "f-uu12", 0, 32, 11, 12, { 0, { { { (1<<MACH_BASE), 0 } } } } },
236 { MT_F_UU8, "f-uu8", 0, 32, 15, 8, { 0, { { { (1<<MACH_BASE), 0 } } } } },
237 { MT_F_UU16, "f-uu16", 0, 32, 15, 16, { 0, { { { (1<<MACH_BASE), 0 } } } } },
238 { MT_F_UU1, "f-uu1", 0, 32, 7, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
239 { MT_F_MSOPC, "f-msopc", 0, 32, 30, 5, { 0, { { { (1<<MACH_BASE), 0 } } } } },
240 { MT_F_UU_26_25, "f-uu-26-25", 0, 32, 25, 26, { 0, { { { (1<<MACH_BASE), 0 } } } } },
241 { MT_F_MASK, "f-mask", 0, 32, 25, 16, { 0, { { { (1<<MACH_BASE), 0 } } } } },
242 { MT_F_BANKADDR, "f-bankaddr", 0, 32, 25, 13, { 0, { { { (1<<MACH_BASE), 0 } } } } },
243 { MT_F_RDA, "f-rda", 0, 32, 25, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
244 { MT_F_UU_2_25, "f-uu-2-25", 0, 32, 25, 2, { 0, { { { (1<<MACH_BASE), 0 } } } } },
245 { MT_F_RBBC, "f-rbbc", 0, 32, 25, 2, { 0, { { { (1<<MACH_BASE), 0 } } } } },
246 { MT_F_PERM, "f-perm", 0, 32, 25, 2, { 0, { { { (1<<MACH_BASE), 0 } } } } },
247 { MT_F_MODE, "f-mode", 0, 32, 25, 2, { 0, { { { (1<<MACH_BASE), 0 } } } } },
248 { MT_F_UU_1_24, "f-uu-1-24", 0, 32, 24, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
249 { MT_F_WR, "f-wr", 0, 32, 24, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
250 { MT_F_FBINCR, "f-fbincr", 0, 32, 23, 4, { 0, { { { (1<<MACH_BASE), 0 } } } } },
251 { MT_F_UU_2_23, "f-uu-2-23", 0, 32, 23, 2, { 0, { { { (1<<MACH_BASE), 0 } } } } },
252 { MT_F_XMODE, "f-xmode", 0, 32, 23, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
253 { MT_F_A23, "f-a23", 0, 32, 23, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
254 { MT_F_MASK1, "f-mask1", 0, 32, 22, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
255 { MT_F_CR, "f-cr", 0, 32, 22, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
256 { MT_F_TYPE, "f-type", 0, 32, 21, 2, { 0, { { { (1<<MACH_BASE), 0 } } } } },
257 { MT_F_INCAMT, "f-incamt", 0, 32, 19, 8, { 0, { { { (1<<MACH_BASE), 0 } } } } },
258 { MT_F_CBS, "f-cbs", 0, 32, 19, 2, { 0, { { { (1<<MACH_BASE), 0 } } } } },
259 { MT_F_UU_1_19, "f-uu-1-19", 0, 32, 19, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
260 { MT_F_BALL, "f-ball", 0, 32, 19, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
261 { MT_F_COLNUM, "f-colnum", 0, 32, 18, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
262 { MT_F_BRC, "f-brc", 0, 32, 18, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
263 { MT_F_INCR, "f-incr", 0, 32, 17, 6, { 0, { { { (1<<MACH_BASE), 0 } } } } },
264 { MT_F_FBDISP, "f-fbdisp", 0, 32, 15, 6, { 0, { { { (1<<MACH_BASE), 0 } } } } },
265 { MT_F_UU_4_15, "f-uu-4-15", 0, 32, 15, 4, { 0, { { { (1<<MACH_BASE), 0 } } } } },
266 { MT_F_LENGTH, "f-length", 0, 32, 15, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
267 { MT_F_UU_1_15, "f-uu-1-15", 0, 32, 15, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
268 { MT_F_RC, "f-rc", 0, 32, 15, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
269 { MT_F_RCNUM, "f-rcnum", 0, 32, 14, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
270 { MT_F_ROWNUM, "f-rownum", 0, 32, 14, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
271 { MT_F_CBX, "f-cbx", 0, 32, 14, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
272 { MT_F_ID, "f-id", 0, 32, 14, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
273 { MT_F_SIZE, "f-size", 0, 32, 13, 14, { 0, { { { (1<<MACH_BASE), 0 } } } } },
274 { MT_F_ROWNUM1, "f-rownum1", 0, 32, 12, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
275 { MT_F_UU_3_11, "f-uu-3-11", 0, 32, 11, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
276 { MT_F_RC1, "f-rc1", 0, 32, 11, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
277 { MT_F_CCB, "f-ccb", 0, 32, 11, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
278 { MT_F_CBRB, "f-cbrb", 0, 32, 10, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
279 { MT_F_CDB, "f-cdb", 0, 32, 10, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
280 { MT_F_ROWNUM2, "f-rownum2", 0, 32, 9, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
281 { MT_F_CELL, "f-cell", 0, 32, 9, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
282 { MT_F_UU_3_9, "f-uu-3-9", 0, 32, 9, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
283 { MT_F_CONTNUM, "f-contnum", 0, 32, 8, 9, { 0, { { { (1<<MACH_BASE), 0 } } } } },
284 { MT_F_UU_1_6, "f-uu-1-6", 0, 32, 6, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
285 { MT_F_DUP, "f-dup", 0, 32, 6, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
286 { MT_F_RC2, "f-rc2", 0, 32, 6, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
287 { MT_F_CTXDISP, "f-ctxdisp", 0, 32, 5, 6, { 0, { { { (1<<MACH_BASE), 0 } } } } },
288 { MT_F_IMM16L, "f-imm16l", 0, 32, 23, 16, { 0, { { { (1<<MACH_BASE), 0 } } } } },
289 { MT_F_LOOPO, "f-loopo", 0, 32, 7, 8, { 0, { { { (1<<MACH_BASE), 0 } } } } },
290 { MT_F_CB1SEL, "f-cb1sel", 0, 32, 25, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
291 { MT_F_CB2SEL, "f-cb2sel", 0, 32, 22, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
292 { MT_F_CB1INCR, "f-cb1incr", 0, 32, 19, 6, { 0|A(SIGNED), { { { (1<<MACH_BASE), 0 } } } } },
293 { MT_F_CB2INCR, "f-cb2incr", 0, 32, 13, 6, { 0|A(SIGNED), { { { (1<<MACH_BASE), 0 } } } } },
294 { MT_F_RC3, "f-rc3", 0, 32, 7, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
295 { MT_F_MSYSFRSR2, "f-msysfrsr2", 0, 32, 19, 4, { 0, { { { (1<<MACH_BASE), 0 } } } } },
296 { MT_F_BRC2, "f-brc2", 0, 32, 14, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
297 { MT_F_BALL2, "f-ball2", 0, 32, 15, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
298 { 0, 0, 0, 0, 0, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } }
301 #undef A
305 /* multi ifield declarations */
309 /* multi ifield definitions */
312 /* The operand table. */
314 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
315 #define A(a) (1 << CGEN_OPERAND_##a)
316 #else
317 #define A(a) (1 << CGEN_OPERAND_/**/a)
318 #endif
319 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
320 #define OPERAND(op) MT_OPERAND_##op
321 #else
322 #define OPERAND(op) MT_OPERAND_/**/op
323 #endif
325 const CGEN_OPERAND mt_cgen_operand_table[] =
327 /* pc: program counter */
328 { "pc", MT_OPERAND_PC, HW_H_PC, 0, 0,
329 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_NIL] } },
330 { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } } },
331 /* frsr1: register */
332 { "frsr1", MT_OPERAND_FRSR1, HW_H_SPR, 23, 4,
333 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_SR1] } },
334 { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
335 /* frsr2: register */
336 { "frsr2", MT_OPERAND_FRSR2, HW_H_SPR, 19, 4,
337 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_SR2] } },
338 { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
339 /* frdr: register */
340 { "frdr", MT_OPERAND_FRDR, HW_H_SPR, 19, 4,
341 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_DR] } },
342 { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
343 /* frdrrr: register */
344 { "frdrrr", MT_OPERAND_FRDRRR, HW_H_SPR, 15, 4,
345 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_DRRR] } },
346 { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
347 /* imm16: immediate value - sign extd */
348 { "imm16", MT_OPERAND_IMM16, HW_H_SINT, 15, 16,
349 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_IMM16S] } },
350 { 0, { { { (1<<MACH_BASE), 0 } } } } },
351 /* imm16z: immediate value - zero extd */
352 { "imm16z", MT_OPERAND_IMM16Z, HW_H_UINT, 15, 16,
353 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_IMM16U] } },
354 { 0, { { { (1<<MACH_BASE), 0 } } } } },
355 /* imm16o: immediate value */
356 { "imm16o", MT_OPERAND_IMM16O, HW_H_UINT, 15, 16,
357 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_IMM16S] } },
358 { 0|A(PCREL_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
359 /* rc: rc */
360 { "rc", MT_OPERAND_RC, HW_H_UINT, 15, 1,
361 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_RC] } },
362 { 0, { { { (1<<MACH_BASE), 0 } } } } },
363 /* rcnum: rcnum */
364 { "rcnum", MT_OPERAND_RCNUM, HW_H_UINT, 14, 3,
365 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_RCNUM] } },
366 { 0, { { { (1<<MACH_BASE), 0 } } } } },
367 /* contnum: context number */
368 { "contnum", MT_OPERAND_CONTNUM, HW_H_UINT, 8, 9,
369 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_CONTNUM] } },
370 { 0, { { { (1<<MACH_BASE), 0 } } } } },
371 /* rbbc: omega network configuration */
372 { "rbbc", MT_OPERAND_RBBC, HW_H_UINT, 25, 2,
373 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_RBBC] } },
374 { 0, { { { (1<<MACH_BASE), 0 } } } } },
375 /* colnum: column number */
376 { "colnum", MT_OPERAND_COLNUM, HW_H_UINT, 18, 3,
377 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_COLNUM] } },
378 { 0, { { { (1<<MACH_BASE), 0 } } } } },
379 /* rownum: row number */
380 { "rownum", MT_OPERAND_ROWNUM, HW_H_UINT, 14, 3,
381 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_ROWNUM] } },
382 { 0, { { { (1<<MACH_BASE), 0 } } } } },
383 /* rownum1: row number */
384 { "rownum1", MT_OPERAND_ROWNUM1, HW_H_UINT, 12, 3,
385 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_ROWNUM1] } },
386 { 0, { { { (1<<MACH_BASE), 0 } } } } },
387 /* rownum2: row number */
388 { "rownum2", MT_OPERAND_ROWNUM2, HW_H_UINT, 9, 3,
389 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_ROWNUM2] } },
390 { 0, { { { (1<<MACH_BASE), 0 } } } } },
391 /* rc1: rc1 */
392 { "rc1", MT_OPERAND_RC1, HW_H_UINT, 11, 1,
393 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_RC1] } },
394 { 0, { { { (1<<MACH_BASE), 0 } } } } },
395 /* rc2: rc2 */
396 { "rc2", MT_OPERAND_RC2, HW_H_UINT, 6, 1,
397 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_RC2] } },
398 { 0, { { { (1<<MACH_BASE), 0 } } } } },
399 /* cbrb: data-bus orientation */
400 { "cbrb", MT_OPERAND_CBRB, HW_H_UINT, 10, 1,
401 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_CBRB] } },
402 { 0, { { { (1<<MACH_BASE), 0 } } } } },
403 /* cell: cell */
404 { "cell", MT_OPERAND_CELL, HW_H_UINT, 9, 3,
405 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_CELL] } },
406 { 0, { { { (1<<MACH_BASE), 0 } } } } },
407 /* dup: dup */
408 { "dup", MT_OPERAND_DUP, HW_H_UINT, 6, 1,
409 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_DUP] } },
410 { 0, { { { (1<<MACH_BASE), 0 } } } } },
411 /* ctxdisp: context displacement */
412 { "ctxdisp", MT_OPERAND_CTXDISP, HW_H_UINT, 5, 6,
413 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_CTXDISP] } },
414 { 0, { { { (1<<MACH_BASE), 0 } } } } },
415 /* fbdisp: frame buffer displacement */
416 { "fbdisp", MT_OPERAND_FBDISP, HW_H_UINT, 15, 6,
417 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_FBDISP] } },
418 { 0, { { { (1<<MACH_BASE), 0 } } } } },
419 /* type: type */
420 { "type", MT_OPERAND_TYPE, HW_H_UINT, 21, 2,
421 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_TYPE] } },
422 { 0, { { { (1<<MACH_BASE), 0 } } } } },
423 /* mask: mask */
424 { "mask", MT_OPERAND_MASK, HW_H_UINT, 25, 16,
425 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_MASK] } },
426 { 0, { { { (1<<MACH_BASE), 0 } } } } },
427 /* bankaddr: bank address */
428 { "bankaddr", MT_OPERAND_BANKADDR, HW_H_UINT, 25, 13,
429 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_BANKADDR] } },
430 { 0, { { { (1<<MACH_BASE), 0 } } } } },
431 /* incamt: increment amount */
432 { "incamt", MT_OPERAND_INCAMT, HW_H_UINT, 19, 8,
433 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_INCAMT] } },
434 { 0, { { { (1<<MACH_BASE), 0 } } } } },
435 /* xmode: xmode */
436 { "xmode", MT_OPERAND_XMODE, HW_H_UINT, 23, 1,
437 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_XMODE] } },
438 { 0, { { { (1<<MACH_BASE), 0 } } } } },
439 /* mask1: mask1 */
440 { "mask1", MT_OPERAND_MASK1, HW_H_UINT, 22, 3,
441 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_MASK1] } },
442 { 0, { { { (1<<MACH_BASE), 0 } } } } },
443 /* ball: b_all */
444 { "ball", MT_OPERAND_BALL, HW_H_UINT, 19, 1,
445 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_BALL] } },
446 { 0, { { { (1<<MACH_BASE), 0 } } } } },
447 /* brc: b_r_c */
448 { "brc", MT_OPERAND_BRC, HW_H_UINT, 18, 3,
449 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_BRC] } },
450 { 0, { { { (1<<MACH_BASE), 0 } } } } },
451 /* rda: rd */
452 { "rda", MT_OPERAND_RDA, HW_H_UINT, 25, 1,
453 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_RDA] } },
454 { 0, { { { (1<<MACH_BASE), 0 } } } } },
455 /* wr: wr */
456 { "wr", MT_OPERAND_WR, HW_H_UINT, 24, 1,
457 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_WR] } },
458 { 0, { { { (1<<MACH_BASE), 0 } } } } },
459 /* ball2: b_all2 */
460 { "ball2", MT_OPERAND_BALL2, HW_H_UINT, 15, 1,
461 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_BALL2] } },
462 { 0, { { { (1<<MACH_BASE), 0 } } } } },
463 /* brc2: b_r_c2 */
464 { "brc2", MT_OPERAND_BRC2, HW_H_UINT, 14, 3,
465 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_BRC2] } },
466 { 0, { { { (1<<MACH_BASE), 0 } } } } },
467 /* perm: perm */
468 { "perm", MT_OPERAND_PERM, HW_H_UINT, 25, 2,
469 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_PERM] } },
470 { 0, { { { (1<<MACH_BASE), 0 } } } } },
471 /* a23: a23 */
472 { "a23", MT_OPERAND_A23, HW_H_UINT, 23, 1,
473 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_A23] } },
474 { 0, { { { (1<<MACH_BASE), 0 } } } } },
475 /* cr: c-r */
476 { "cr", MT_OPERAND_CR, HW_H_UINT, 22, 3,
477 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_CR] } },
478 { 0, { { { (1<<MACH_BASE), 0 } } } } },
479 /* cbs: cbs */
480 { "cbs", MT_OPERAND_CBS, HW_H_UINT, 19, 2,
481 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_CBS] } },
482 { 0, { { { (1<<MACH_BASE), 0 } } } } },
483 /* incr: incr */
484 { "incr", MT_OPERAND_INCR, HW_H_UINT, 17, 6,
485 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_INCR] } },
486 { 0, { { { (1<<MACH_BASE), 0 } } } } },
487 /* length: length */
488 { "length", MT_OPERAND_LENGTH, HW_H_UINT, 15, 3,
489 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_LENGTH] } },
490 { 0, { { { (1<<MACH_BASE), 0 } } } } },
491 /* cbx: cbx */
492 { "cbx", MT_OPERAND_CBX, HW_H_UINT, 14, 3,
493 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_CBX] } },
494 { 0, { { { (1<<MACH_BASE), 0 } } } } },
495 /* ccb: ccb */
496 { "ccb", MT_OPERAND_CCB, HW_H_UINT, 11, 1,
497 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_CCB] } },
498 { 0, { { { (1<<MACH_BASE), 0 } } } } },
499 /* cdb: cdb */
500 { "cdb", MT_OPERAND_CDB, HW_H_UINT, 10, 1,
501 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_CDB] } },
502 { 0, { { { (1<<MACH_BASE), 0 } } } } },
503 /* mode: mode */
504 { "mode", MT_OPERAND_MODE, HW_H_UINT, 25, 2,
505 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_MODE] } },
506 { 0, { { { (1<<MACH_BASE), 0 } } } } },
507 /* id: i/d */
508 { "id", MT_OPERAND_ID, HW_H_UINT, 14, 1,
509 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_ID] } },
510 { 0, { { { (1<<MACH_BASE), 0 } } } } },
511 /* size: size */
512 { "size", MT_OPERAND_SIZE, HW_H_UINT, 13, 14,
513 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_SIZE] } },
514 { 0, { { { (1<<MACH_BASE), 0 } } } } },
515 /* fbincr: fb incr */
516 { "fbincr", MT_OPERAND_FBINCR, HW_H_UINT, 23, 4,
517 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_FBINCR] } },
518 { 0, { { { (1<<MACH_BASE), 0 } } } } },
519 /* loopsize: immediate value */
520 { "loopsize", MT_OPERAND_LOOPSIZE, HW_H_UINT, 7, 8,
521 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_LOOPO] } },
522 { 0|A(PCREL_ADDR), { { { (1<<MACH_MS2), 0 } } } } },
523 /* imm16l: immediate value */
524 { "imm16l", MT_OPERAND_IMM16L, HW_H_UINT, 23, 16,
525 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_IMM16L] } },
526 { 0, { { { (1<<MACH_MS2), 0 } } } } },
527 /* rc3: rc3 */
528 { "rc3", MT_OPERAND_RC3, HW_H_UINT, 7, 1,
529 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_RC3] } },
530 { 0, { { { (1<<MACH_MS2), 0 } } } } },
531 /* cb1sel: cb1sel */
532 { "cb1sel", MT_OPERAND_CB1SEL, HW_H_UINT, 25, 3,
533 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_CB1SEL] } },
534 { 0, { { { (1<<MACH_MS2), 0 } } } } },
535 /* cb2sel: cb2sel */
536 { "cb2sel", MT_OPERAND_CB2SEL, HW_H_UINT, 22, 3,
537 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_CB2SEL] } },
538 { 0, { { { (1<<MACH_MS2), 0 } } } } },
539 /* cb1incr: cb1incr */
540 { "cb1incr", MT_OPERAND_CB1INCR, HW_H_SINT, 19, 6,
541 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_CB1INCR] } },
542 { 0|A(SIGNED), { { { (1<<MACH_MS2), 0 } } } } },
543 /* cb2incr: cb2incr */
544 { "cb2incr", MT_OPERAND_CB2INCR, HW_H_SINT, 13, 6,
545 { 0, { (const PTR) &mt_cgen_ifld_table[MT_F_CB2INCR] } },
546 { 0|A(SIGNED), { { { (1<<MACH_MS2), 0 } } } } },
547 /* sentinel */
548 { 0, 0, 0, 0, 0,
549 { 0, { (const PTR) 0 } },
550 { 0, { { { (1<<MACH_BASE), 0 } } } } }
553 #undef A
556 /* The instruction table. */
558 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
559 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
560 #define A(a) (1 << CGEN_INSN_##a)
561 #else
562 #define A(a) (1 << CGEN_INSN_/**/a)
563 #endif
565 static const CGEN_IBASE mt_cgen_insn_table[MAX_INSNS] =
567 /* Special null first entry.
568 A `num' value of zero is thus invalid.
569 Also, the special `invalid' insn resides here. */
570 { 0, 0, 0, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
571 /* add $frdrrr,$frsr1,$frsr2 */
573 MT_INSN_ADD, "add", "add", 32,
574 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
576 /* addu $frdrrr,$frsr1,$frsr2 */
578 MT_INSN_ADDU, "addu", "addu", 32,
579 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
581 /* addi $frdr,$frsr1,#$imm16 */
583 MT_INSN_ADDI, "addi", "addi", 32,
584 { 0|A(USES_FRSR1)|A(USES_FRDR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
586 /* addui $frdr,$frsr1,#$imm16z */
588 MT_INSN_ADDUI, "addui", "addui", 32,
589 { 0|A(USES_FRSR1)|A(USES_FRDR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
591 /* sub $frdrrr,$frsr1,$frsr2 */
593 MT_INSN_SUB, "sub", "sub", 32,
594 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
596 /* subu $frdrrr,$frsr1,$frsr2 */
598 MT_INSN_SUBU, "subu", "subu", 32,
599 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
601 /* subi $frdr,$frsr1,#$imm16 */
603 MT_INSN_SUBI, "subi", "subi", 32,
604 { 0|A(USES_FRSR1)|A(USES_FRDR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
606 /* subui $frdr,$frsr1,#$imm16z */
608 MT_INSN_SUBUI, "subui", "subui", 32,
609 { 0|A(USES_FRSR1)|A(USES_FRDR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
611 /* mul $frdrrr,$frsr1,$frsr2 */
613 MT_INSN_MUL, "mul", "mul", 32,
614 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR)|A(AL_INSN), { { { (1<<MACH_MS1_003)|(1<<MACH_MS2), 0 } } } }
616 /* muli $frdr,$frsr1,#$imm16 */
618 MT_INSN_MULI, "muli", "muli", 32,
619 { 0|A(USES_FRSR1)|A(USES_FRDR)|A(AL_INSN), { { { (1<<MACH_MS1_003)|(1<<MACH_MS2), 0 } } } }
621 /* and $frdrrr,$frsr1,$frsr2 */
623 MT_INSN_AND, "and", "and", 32,
624 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
626 /* andi $frdr,$frsr1,#$imm16z */
628 MT_INSN_ANDI, "andi", "andi", 32,
629 { 0|A(USES_FRSR1)|A(USES_FRDR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
631 /* or $frdrrr,$frsr1,$frsr2 */
633 MT_INSN_OR, "or", "or", 32,
634 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
636 /* nop */
638 MT_INSN_NOP, "nop", "nop", 32,
639 { 0, { { { (1<<MACH_BASE), 0 } } } }
641 /* ori $frdr,$frsr1,#$imm16z */
643 MT_INSN_ORI, "ori", "ori", 32,
644 { 0|A(USES_FRSR1)|A(USES_FRDR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
646 /* xor $frdrrr,$frsr1,$frsr2 */
648 MT_INSN_XOR, "xor", "xor", 32,
649 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
651 /* xori $frdr,$frsr1,#$imm16z */
653 MT_INSN_XORI, "xori", "xori", 32,
654 { 0|A(USES_FRSR1)|A(USES_FRDR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
656 /* nand $frdrrr,$frsr1,$frsr2 */
658 MT_INSN_NAND, "nand", "nand", 32,
659 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
661 /* nandi $frdr,$frsr1,#$imm16z */
663 MT_INSN_NANDI, "nandi", "nandi", 32,
664 { 0|A(USES_FRSR1)|A(USES_FRDR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
666 /* nor $frdrrr,$frsr1,$frsr2 */
668 MT_INSN_NOR, "nor", "nor", 32,
669 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
671 /* nori $frdr,$frsr1,#$imm16z */
673 MT_INSN_NORI, "nori", "nori", 32,
674 { 0|A(USES_FRSR1)|A(USES_FRDR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
676 /* xnor $frdrrr,$frsr1,$frsr2 */
678 MT_INSN_XNOR, "xnor", "xnor", 32,
679 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
681 /* xnori $frdr,$frsr1,#$imm16z */
683 MT_INSN_XNORI, "xnori", "xnori", 32,
684 { 0|A(USES_FRSR1)|A(USES_FRDR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
686 /* ldui $frdr,#$imm16z */
688 MT_INSN_LDUI, "ldui", "ldui", 32,
689 { 0|A(USES_FRDR)|A(AL_INSN), { { { (1<<MACH_BASE), 0 } } } }
691 /* lsl $frdrrr,$frsr1,$frsr2 */
693 MT_INSN_LSL, "lsl", "lsl", 32,
694 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR), { { { (1<<MACH_BASE), 0 } } } }
696 /* lsli $frdr,$frsr1,#$imm16 */
698 MT_INSN_LSLI, "lsli", "lsli", 32,
699 { 0|A(USES_FRSR1)|A(USES_FRDR), { { { (1<<MACH_BASE), 0 } } } }
701 /* lsr $frdrrr,$frsr1,$frsr2 */
703 MT_INSN_LSR, "lsr", "lsr", 32,
704 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR), { { { (1<<MACH_BASE), 0 } } } }
706 /* lsri $frdr,$frsr1,#$imm16 */
708 MT_INSN_LSRI, "lsri", "lsri", 32,
709 { 0|A(USES_FRSR1)|A(USES_FRDR), { { { (1<<MACH_BASE), 0 } } } }
711 /* asr $frdrrr,$frsr1,$frsr2 */
713 MT_INSN_ASR, "asr", "asr", 32,
714 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR), { { { (1<<MACH_BASE), 0 } } } }
716 /* asri $frdr,$frsr1,#$imm16 */
718 MT_INSN_ASRI, "asri", "asri", 32,
719 { 0|A(USES_FRSR1)|A(USES_FRDR), { { { (1<<MACH_BASE), 0 } } } }
721 /* brlt $frsr1,$frsr2,$imm16o */
723 MT_INSN_BRLT, "brlt", "brlt", 32,
724 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(USES_FRDRRR)|A(DELAY_SLOT)|A(BR_INSN), { { { (1<<MACH_BASE), 0 } } } }
726 /* brle $frsr1,$frsr2,$imm16o */
728 MT_INSN_BRLE, "brle", "brle", 32,
729 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(DELAY_SLOT)|A(BR_INSN), { { { (1<<MACH_BASE), 0 } } } }
731 /* breq $frsr1,$frsr2,$imm16o */
733 MT_INSN_BREQ, "breq", "breq", 32,
734 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(DELAY_SLOT)|A(BR_INSN), { { { (1<<MACH_BASE), 0 } } } }
736 /* brne $frsr1,$frsr2,$imm16o */
738 MT_INSN_BRNE, "brne", "brne", 32,
739 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(DELAY_SLOT)|A(BR_INSN), { { { (1<<MACH_BASE), 0 } } } }
741 /* jmp $imm16o */
743 MT_INSN_JMP, "jmp", "jmp", 32,
744 { 0|A(BR_INSN)|A(DELAY_SLOT), { { { (1<<MACH_BASE), 0 } } } }
746 /* jal $frdrrr,$frsr1 */
748 MT_INSN_JAL, "jal", "jal", 32,
749 { 0|A(JAL_HAZARD)|A(USES_FRSR1)|A(USES_FRDR)|A(BR_INSN)|A(DELAY_SLOT), { { { (1<<MACH_BASE), 0 } } } }
751 /* dbnz $frsr1,$imm16o */
753 MT_INSN_DBNZ, "dbnz", "dbnz", 32,
754 { 0|A(USES_FRSR1)|A(DELAY_SLOT)|A(BR_INSN), { { { (1<<MACH_MS1_003)|(1<<MACH_MS2), 0 } } } }
756 /* ei */
758 MT_INSN_EI, "ei", "ei", 32,
759 { 0, { { { (1<<MACH_BASE), 0 } } } }
761 /* di */
763 MT_INSN_DI, "di", "di", 32,
764 { 0, { { { (1<<MACH_BASE), 0 } } } }
766 /* si $frdrrr */
768 MT_INSN_SI, "si", "si", 32,
769 { 0|A(USES_FRDR)|A(BR_INSN)|A(DELAY_SLOT), { { { (1<<MACH_BASE), 0 } } } }
771 /* reti $frsr1 */
773 MT_INSN_RETI, "reti", "reti", 32,
774 { 0|A(JAL_HAZARD)|A(USES_FRSR1)|A(BR_INSN)|A(DELAY_SLOT), { { { (1<<MACH_BASE), 0 } } } }
776 /* ldw $frdr,$frsr1,#$imm16 */
778 MT_INSN_LDW, "ldw", "ldw", 32,
779 { 0|A(USES_FRSR1)|A(USES_FRDR)|A(MEMORY_ACCESS)|A(LOAD_DELAY), { { { (1<<MACH_BASE), 0 } } } }
781 /* stw $frsr2,$frsr1,#$imm16 */
783 MT_INSN_STW, "stw", "stw", 32,
784 { 0|A(USES_FRSR2)|A(USES_FRSR1)|A(MEMORY_ACCESS), { { { (1<<MACH_BASE), 0 } } } }
786 /* break */
788 MT_INSN_BREAK, "break", "break", 32,
789 { 0, { { { (1<<MACH_BASE), 0 } } } }
791 /* iflush */
793 MT_INSN_IFLUSH, "iflush", "iflush", 32,
794 { 0, { { { (1<<MACH_MS1_003)|(1<<MACH_MS2), 0 } } } }
796 /* ldctxt $frsr1,$frsr2,#$rc,#$rcnum,#$contnum */
798 MT_INSN_LDCTXT, "ldctxt", "ldctxt", 32,
799 { 0, { { { (1<<MACH_MS1), 0 } } } }
801 /* ldfb $frsr1,$frsr2,#$imm16z */
803 MT_INSN_LDFB, "ldfb", "ldfb", 32,
804 { 0, { { { (1<<MACH_MS1), 0 } } } }
806 /* stfb $frsr1,$frsr2,#$imm16z */
808 MT_INSN_STFB, "stfb", "stfb", 32,
809 { 0, { { { (1<<MACH_MS1), 0 } } } }
811 /* fbcb $frsr1,#$rbbc,#$ball,#$brc,#$rc1,#$cbrb,#$cell,#$dup,#$ctxdisp */
813 MT_INSN_FBCB, "fbcb", "fbcb", 32,
814 { 0, { { { (1<<MACH_MS1)|(1<<MACH_MS1_003), 0 } } } }
816 /* mfbcb $frsr1,#$rbbc,$frsr2,#$rc1,#$cbrb,#$cell,#$dup,#$ctxdisp */
818 MT_INSN_MFBCB, "mfbcb", "mfbcb", 32,
819 { 0, { { { (1<<MACH_BASE), 0 } } } }
821 /* fbcci $frsr1,#$rbbc,#$ball,#$brc,#$fbdisp,#$cell,#$dup,#$ctxdisp */
823 MT_INSN_FBCCI, "fbcci", "fbcci", 32,
824 { 0, { { { (1<<MACH_BASE), 0 } } } }
826 /* fbrci $frsr1,#$rbbc,#$ball,#$brc,#$fbdisp,#$cell,#$dup,#$ctxdisp */
828 MT_INSN_FBRCI, "fbrci", "fbrci", 32,
829 { 0, { { { (1<<MACH_BASE), 0 } } } }
831 /* fbcri $frsr1,#$rbbc,#$ball,#$brc,#$fbdisp,#$cell,#$dup,#$ctxdisp */
833 MT_INSN_FBCRI, "fbcri", "fbcri", 32,
834 { 0, { { { (1<<MACH_BASE), 0 } } } }
836 /* fbrri $frsr1,#$rbbc,#$ball,#$brc,#$fbdisp,#$cell,#$dup,#$ctxdisp */
838 MT_INSN_FBRRI, "fbrri", "fbrri", 32,
839 { 0, { { { (1<<MACH_BASE), 0 } } } }
841 /* mfbcci $frsr1,#$rbbc,$frsr2,#$fbdisp,#$cell,#$dup,#$ctxdisp */
843 MT_INSN_MFBCCI, "mfbcci", "mfbcci", 32,
844 { 0, { { { (1<<MACH_BASE), 0 } } } }
846 /* mfbrci $frsr1,#$rbbc,$frsr2,#$fbdisp,#$cell,#$dup,#$ctxdisp */
848 MT_INSN_MFBRCI, "mfbrci", "mfbrci", 32,
849 { 0, { { { (1<<MACH_BASE), 0 } } } }
851 /* mfbcri $frsr1,#$rbbc,$frsr2,#$fbdisp,#$cell,#$dup,#$ctxdisp */
853 MT_INSN_MFBCRI, "mfbcri", "mfbcri", 32,
854 { 0, { { { (1<<MACH_BASE), 0 } } } }
856 /* mfbrri $frsr1,#$rbbc,$frsr2,#$fbdisp,#$cell,#$dup,#$ctxdisp */
858 MT_INSN_MFBRRI, "mfbrri", "mfbrri", 32,
859 { 0, { { { (1<<MACH_BASE), 0 } } } }
861 /* fbcbdr $frsr1,#$rbbc,$frsr2,#$ball2,#$brc2,#$rc1,#$cbrb,#$cell,#$dup,#$ctxdisp */
863 MT_INSN_FBCBDR, "fbcbdr", "fbcbdr", 32,
864 { 0, { { { (1<<MACH_BASE), 0 } } } }
866 /* rcfbcb #$rbbc,#$type,#$ball,#$brc,#$rownum,#$rc1,#$cbrb,#$cell,#$dup,#$ctxdisp */
868 MT_INSN_RCFBCB, "rcfbcb", "rcfbcb", 32,
869 { 0, { { { (1<<MACH_BASE), 0 } } } }
871 /* mrcfbcb $frsr2,#$rbbc,#$type,#$rownum,#$rc1,#$cbrb,#$cell,#$dup,#$ctxdisp */
873 MT_INSN_MRCFBCB, "mrcfbcb", "mrcfbcb", 32,
874 { 0, { { { (1<<MACH_BASE), 0 } } } }
876 /* cbcast #$mask,#$rc2,#$ctxdisp */
878 MT_INSN_CBCAST, "cbcast", "cbcast", 32,
879 { 0, { { { (1<<MACH_BASE), 0 } } } }
881 /* dupcbcast #$mask,#$cell,#$rc2,#$ctxdisp */
883 MT_INSN_DUPCBCAST, "dupcbcast", "dupcbcast", 32,
884 { 0, { { { (1<<MACH_BASE), 0 } } } }
886 /* wfbi #$bankaddr,#$rownum1,#$cell,#$dup,#$ctxdisp */
888 MT_INSN_WFBI, "wfbi", "wfbi", 32,
889 { 0, { { { (1<<MACH_BASE), 0 } } } }
891 /* wfb $frsr1,$frsr2,#$fbdisp,#$rownum2,#$ctxdisp */
893 MT_INSN_WFB, "wfb", "wfb", 32,
894 { 0, { { { (1<<MACH_BASE), 0 } } } }
896 /* rcrisc $frdrrr,#$rbbc,$frsr1,#$colnum,#$rc1,#$cbrb,#$cell,#$dup,#$ctxdisp */
898 MT_INSN_RCRISC, "rcrisc", "rcrisc", 32,
899 { 0, { { { (1<<MACH_BASE), 0 } } } }
901 /* fbcbinc $frsr1,#$rbbc,#$incamt,#$rc1,#$cbrb,#$cell,#$dup,#$ctxdisp */
903 MT_INSN_FBCBINC, "fbcbinc", "fbcbinc", 32,
904 { 0, { { { (1<<MACH_BASE), 0 } } } }
906 /* rcxmode $frsr2,#$rda,#$wr,#$xmode,#$mask1,#$fbdisp,#$rownum2,#$rc2,#$ctxdisp */
908 MT_INSN_RCXMODE, "rcxmode", "rcxmode", 32,
909 { 0, { { { (1<<MACH_BASE), 0 } } } }
911 /* intlvr $frsr1,#$mode,$frsr2,#$id,#$size */
913 MT_INSN_INTERLEAVER, "interleaver", "intlvr", 32,
914 { 0, { { { (1<<MACH_BASE), 0 } } } }
916 /* wfbinc #$rda,#$wr,#$fbincr,#$ball,#$colnum,#$length,#$rownum1,#$rownum2,#$dup,#$ctxdisp */
918 MT_INSN_WFBINC, "wfbinc", "wfbinc", 32,
919 { 0, { { { (1<<MACH_MS1_003)|(1<<MACH_MS2), 0 } } } }
921 /* mwfbinc $frsr2,#$rda,#$wr,#$fbincr,#$length,#$rownum1,#$rownum2,#$dup,#$ctxdisp */
923 MT_INSN_MWFBINC, "mwfbinc", "mwfbinc", 32,
924 { 0, { { { (1<<MACH_MS1_003)|(1<<MACH_MS2), 0 } } } }
926 /* wfbincr $frsr1,#$rda,#$wr,#$ball,#$colnum,#$length,#$rownum1,#$rownum2,#$dup,#$ctxdisp */
928 MT_INSN_WFBINCR, "wfbincr", "wfbincr", 32,
929 { 0, { { { (1<<MACH_MS1_003)|(1<<MACH_MS2), 0 } } } }
931 /* mwfbincr $frsr1,$frsr2,#$rda,#$wr,#$length,#$rownum1,#$rownum2,#$dup,#$ctxdisp */
933 MT_INSN_MWFBINCR, "mwfbincr", "mwfbincr", 32,
934 { 0, { { { (1<<MACH_MS1_003)|(1<<MACH_MS2), 0 } } } }
936 /* fbcbincs #$perm,#$a23,#$cr,#$cbs,#$incr,#$ccb,#$cdb,#$rownum2,#$dup,#$ctxdisp */
938 MT_INSN_FBCBINCS, "fbcbincs", "fbcbincs", 32,
939 { 0, { { { (1<<MACH_MS1_003)|(1<<MACH_MS2), 0 } } } }
941 /* mfbcbincs $frsr1,#$perm,#$cbs,#$incr,#$ccb,#$cdb,#$rownum2,#$dup,#$ctxdisp */
943 MT_INSN_MFBCBINCS, "mfbcbincs", "mfbcbincs", 32,
944 { 0, { { { (1<<MACH_MS1_003)|(1<<MACH_MS2), 0 } } } }
946 /* fbcbincrs $frsr1,#$perm,#$ball,#$colnum,#$cbx,#$ccb,#$cdb,#$rownum2,#$dup,#$ctxdisp */
948 MT_INSN_FBCBINCRS, "fbcbincrs", "fbcbincrs", 32,
949 { 0, { { { (1<<MACH_MS1_003)|(1<<MACH_MS2), 0 } } } }
951 /* mfbcbincrs $frsr1,$frsr2,#$perm,#$cbx,#$ccb,#$cdb,#$rownum2,#$dup,#$ctxdisp */
953 MT_INSN_MFBCBINCRS, "mfbcbincrs", "mfbcbincrs", 32,
954 { 0, { { { (1<<MACH_MS1_003)|(1<<MACH_MS2), 0 } } } }
956 /* loop $frsr1,$loopsize */
958 MT_INSN_LOOP, "loop", "loop", 32,
959 { 0|A(USES_FRSR1)|A(DELAY_SLOT), { { { (1<<MACH_MS2), 0 } } } }
961 /* loopi #$imm16l,$loopsize */
963 MT_INSN_LOOPI, "loopi", "loopi", 32,
964 { 0|A(DELAY_SLOT), { { { (1<<MACH_MS2), 0 } } } }
966 /* dfbc #$cb1sel,#$cb2sel,#$cb1incr,#$cb2incr,#$rc3,#$rc2,#$ctxdisp */
968 MT_INSN_DFBC, "dfbc", "dfbc", 32,
969 { 0, { { { (1<<MACH_MS2), 0 } } } }
971 /* dwfb #$cb1sel,#$cb2sel,#$cb1incr,#$cb2incr,#$rc2,#$ctxdisp */
973 MT_INSN_DWFB, "dwfb", "dwfb", 32,
974 { 0, { { { (1<<MACH_MS2), 0 } } } }
976 /* fbwfb #$cb1sel,#$cb2sel,#$cb1incr,#$cb2incr,#$rc3,#$rc2,#$ctxdisp */
978 MT_INSN_FBWFB, "fbwfb", "fbwfb", 32,
979 { 0, { { { (1<<MACH_MS2), 0 } } } }
981 /* dfbr #$cb1sel,#$cb2sel,$frsr2,#$length,#$rownum1,#$rownum2,#$rc2,#$ctxdisp */
983 MT_INSN_DFBR, "dfbr", "dfbr", 32,
984 { 0|A(USES_FRSR2), { { { (1<<MACH_MS2), 0 } } } }
988 #undef OP
989 #undef A
991 /* Initialize anything needed to be done once, before any cpu_open call. */
993 static void
994 init_tables (void)
998 static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
999 static void build_hw_table (CGEN_CPU_TABLE *);
1000 static void build_ifield_table (CGEN_CPU_TABLE *);
1001 static void build_operand_table (CGEN_CPU_TABLE *);
1002 static void build_insn_table (CGEN_CPU_TABLE *);
1003 static void mt_cgen_rebuild_tables (CGEN_CPU_TABLE *);
1005 /* Subroutine of mt_cgen_cpu_open to look up a mach via its bfd name. */
1007 static const CGEN_MACH *
1008 lookup_mach_via_bfd_name (const CGEN_MACH *table, const char *name)
1010 while (table->name)
1012 if (strcmp (name, table->bfd_name) == 0)
1013 return table;
1014 ++table;
1016 abort ();
1019 /* Subroutine of mt_cgen_cpu_open to build the hardware table. */
1021 static void
1022 build_hw_table (CGEN_CPU_TABLE *cd)
1024 int i;
1025 int machs = cd->machs;
1026 const CGEN_HW_ENTRY *init = & mt_cgen_hw_table[0];
1027 /* MAX_HW is only an upper bound on the number of selected entries.
1028 However each entry is indexed by it's enum so there can be holes in
1029 the table. */
1030 const CGEN_HW_ENTRY **selected =
1031 (const CGEN_HW_ENTRY **) xmalloc (MAX_HW * sizeof (CGEN_HW_ENTRY *));
1033 cd->hw_table.init_entries = init;
1034 cd->hw_table.entry_size = sizeof (CGEN_HW_ENTRY);
1035 memset (selected, 0, MAX_HW * sizeof (CGEN_HW_ENTRY *));
1036 /* ??? For now we just use machs to determine which ones we want. */
1037 for (i = 0; init[i].name != NULL; ++i)
1038 if (CGEN_HW_ATTR_VALUE (&init[i], CGEN_HW_MACH)
1039 & machs)
1040 selected[init[i].type] = &init[i];
1041 cd->hw_table.entries = selected;
1042 cd->hw_table.num_entries = MAX_HW;
1045 /* Subroutine of mt_cgen_cpu_open to build the hardware table. */
1047 static void
1048 build_ifield_table (CGEN_CPU_TABLE *cd)
1050 cd->ifld_table = & mt_cgen_ifld_table[0];
1053 /* Subroutine of mt_cgen_cpu_open to build the hardware table. */
1055 static void
1056 build_operand_table (CGEN_CPU_TABLE *cd)
1058 int i;
1059 int machs = cd->machs;
1060 const CGEN_OPERAND *init = & mt_cgen_operand_table[0];
1061 /* MAX_OPERANDS is only an upper bound on the number of selected entries.
1062 However each entry is indexed by it's enum so there can be holes in
1063 the table. */
1064 const CGEN_OPERAND **selected = xmalloc (MAX_OPERANDS * sizeof (* selected));
1066 cd->operand_table.init_entries = init;
1067 cd->operand_table.entry_size = sizeof (CGEN_OPERAND);
1068 memset (selected, 0, MAX_OPERANDS * sizeof (CGEN_OPERAND *));
1069 /* ??? For now we just use mach to determine which ones we want. */
1070 for (i = 0; init[i].name != NULL; ++i)
1071 if (CGEN_OPERAND_ATTR_VALUE (&init[i], CGEN_OPERAND_MACH)
1072 & machs)
1073 selected[init[i].type] = &init[i];
1074 cd->operand_table.entries = selected;
1075 cd->operand_table.num_entries = MAX_OPERANDS;
1078 /* Subroutine of mt_cgen_cpu_open to build the hardware table.
1079 ??? This could leave out insns not supported by the specified mach/isa,
1080 but that would cause errors like "foo only supported by bar" to become
1081 "unknown insn", so for now we include all insns and require the app to
1082 do the checking later.
1083 ??? On the other hand, parsing of such insns may require their hardware or
1084 operand elements to be in the table [which they mightn't be]. */
1086 static void
1087 build_insn_table (CGEN_CPU_TABLE *cd)
1089 int i;
1090 const CGEN_IBASE *ib = & mt_cgen_insn_table[0];
1091 CGEN_INSN *insns = xmalloc (MAX_INSNS * sizeof (CGEN_INSN));
1093 memset (insns, 0, MAX_INSNS * sizeof (CGEN_INSN));
1094 for (i = 0; i < MAX_INSNS; ++i)
1095 insns[i].base = &ib[i];
1096 cd->insn_table.init_entries = insns;
1097 cd->insn_table.entry_size = sizeof (CGEN_IBASE);
1098 cd->insn_table.num_init_entries = MAX_INSNS;
1101 /* Subroutine of mt_cgen_cpu_open to rebuild the tables. */
1103 static void
1104 mt_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
1106 int i;
1107 CGEN_BITSET *isas = cd->isas;
1108 unsigned int machs = cd->machs;
1110 cd->int_insn_p = CGEN_INT_INSN_P;
1112 /* Data derived from the isa spec. */
1113 #define UNSET (CGEN_SIZE_UNKNOWN + 1)
1114 cd->default_insn_bitsize = UNSET;
1115 cd->base_insn_bitsize = UNSET;
1116 cd->min_insn_bitsize = 65535; /* Some ridiculously big number. */
1117 cd->max_insn_bitsize = 0;
1118 for (i = 0; i < MAX_ISAS; ++i)
1119 if (cgen_bitset_contains (isas, i))
1121 const CGEN_ISA *isa = & mt_cgen_isa_table[i];
1123 /* Default insn sizes of all selected isas must be
1124 equal or we set the result to 0, meaning "unknown". */
1125 if (cd->default_insn_bitsize == UNSET)
1126 cd->default_insn_bitsize = isa->default_insn_bitsize;
1127 else if (isa->default_insn_bitsize == cd->default_insn_bitsize)
1128 ; /* This is ok. */
1129 else
1130 cd->default_insn_bitsize = CGEN_SIZE_UNKNOWN;
1132 /* Base insn sizes of all selected isas must be equal
1133 or we set the result to 0, meaning "unknown". */
1134 if (cd->base_insn_bitsize == UNSET)
1135 cd->base_insn_bitsize = isa->base_insn_bitsize;
1136 else if (isa->base_insn_bitsize == cd->base_insn_bitsize)
1137 ; /* This is ok. */
1138 else
1139 cd->base_insn_bitsize = CGEN_SIZE_UNKNOWN;
1141 /* Set min,max insn sizes. */
1142 if (isa->min_insn_bitsize < cd->min_insn_bitsize)
1143 cd->min_insn_bitsize = isa->min_insn_bitsize;
1144 if (isa->max_insn_bitsize > cd->max_insn_bitsize)
1145 cd->max_insn_bitsize = isa->max_insn_bitsize;
1148 /* Data derived from the mach spec. */
1149 for (i = 0; i < MAX_MACHS; ++i)
1150 if (((1 << i) & machs) != 0)
1152 const CGEN_MACH *mach = & mt_cgen_mach_table[i];
1154 if (mach->insn_chunk_bitsize != 0)
1156 if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
1158 fprintf (stderr, "mt_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
1159 cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
1160 abort ();
1163 cd->insn_chunk_bitsize = mach->insn_chunk_bitsize;
1167 /* Determine which hw elements are used by MACH. */
1168 build_hw_table (cd);
1170 /* Build the ifield table. */
1171 build_ifield_table (cd);
1173 /* Determine which operands are used by MACH/ISA. */
1174 build_operand_table (cd);
1176 /* Build the instruction table. */
1177 build_insn_table (cd);
1180 /* Initialize a cpu table and return a descriptor.
1181 It's much like opening a file, and must be the first function called.
1182 The arguments are a set of (type/value) pairs, terminated with
1183 CGEN_CPU_OPEN_END.
1185 Currently supported values:
1186 CGEN_CPU_OPEN_ISAS: bitmap of values in enum isa_attr
1187 CGEN_CPU_OPEN_MACHS: bitmap of values in enum mach_attr
1188 CGEN_CPU_OPEN_BFDMACH: specify 1 mach using bfd name
1189 CGEN_CPU_OPEN_ENDIAN: specify endian choice
1190 CGEN_CPU_OPEN_END: terminates arguments
1192 ??? Simultaneous multiple isas might not make sense, but it's not (yet)
1193 precluded.
1195 ??? We only support ISO C stdargs here, not K&R.
1196 Laziness, plus experiment to see if anything requires K&R - eventually
1197 K&R will no longer be supported - e.g. GDB is currently trying this. */
1199 CGEN_CPU_DESC
1200 mt_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
1202 CGEN_CPU_TABLE *cd = (CGEN_CPU_TABLE *) xmalloc (sizeof (CGEN_CPU_TABLE));
1203 static int init_p;
1204 CGEN_BITSET *isas = 0; /* 0 = "unspecified" */
1205 unsigned int machs = 0; /* 0 = "unspecified" */
1206 enum cgen_endian endian = CGEN_ENDIAN_UNKNOWN;
1207 va_list ap;
1209 if (! init_p)
1211 init_tables ();
1212 init_p = 1;
1215 memset (cd, 0, sizeof (*cd));
1217 va_start (ap, arg_type);
1218 while (arg_type != CGEN_CPU_OPEN_END)
1220 switch (arg_type)
1222 case CGEN_CPU_OPEN_ISAS :
1223 isas = va_arg (ap, CGEN_BITSET *);
1224 break;
1225 case CGEN_CPU_OPEN_MACHS :
1226 machs = va_arg (ap, unsigned int);
1227 break;
1228 case CGEN_CPU_OPEN_BFDMACH :
1230 const char *name = va_arg (ap, const char *);
1231 const CGEN_MACH *mach =
1232 lookup_mach_via_bfd_name (mt_cgen_mach_table, name);
1234 machs |= 1 << mach->num;
1235 break;
1237 case CGEN_CPU_OPEN_ENDIAN :
1238 endian = va_arg (ap, enum cgen_endian);
1239 break;
1240 default :
1241 fprintf (stderr, "mt_cgen_cpu_open: unsupported argument `%d'\n",
1242 arg_type);
1243 abort (); /* ??? return NULL? */
1245 arg_type = va_arg (ap, enum cgen_cpu_open_arg);
1247 va_end (ap);
1249 /* Mach unspecified means "all". */
1250 if (machs == 0)
1251 machs = (1 << MAX_MACHS) - 1;
1252 /* Base mach is always selected. */
1253 machs |= 1;
1254 if (endian == CGEN_ENDIAN_UNKNOWN)
1256 /* ??? If target has only one, could have a default. */
1257 fprintf (stderr, "mt_cgen_cpu_open: no endianness specified\n");
1258 abort ();
1261 cd->isas = cgen_bitset_copy (isas);
1262 cd->machs = machs;
1263 cd->endian = endian;
1264 /* FIXME: for the sparc case we can determine insn-endianness statically.
1265 The worry here is where both data and insn endian can be independently
1266 chosen, in which case this function will need another argument.
1267 Actually, will want to allow for more arguments in the future anyway. */
1268 cd->insn_endian = endian;
1270 /* Table (re)builder. */
1271 cd->rebuild_tables = mt_cgen_rebuild_tables;
1272 mt_cgen_rebuild_tables (cd);
1274 /* Default to not allowing signed overflow. */
1275 cd->signed_overflow_ok_p = 0;
1277 return (CGEN_CPU_DESC) cd;
1280 /* Cover fn to mt_cgen_cpu_open to handle the simple case of 1 isa, 1 mach.
1281 MACH_NAME is the bfd name of the mach. */
1283 CGEN_CPU_DESC
1284 mt_cgen_cpu_open_1 (const char *mach_name, enum cgen_endian endian)
1286 return mt_cgen_cpu_open (CGEN_CPU_OPEN_BFDMACH, mach_name,
1287 CGEN_CPU_OPEN_ENDIAN, endian,
1288 CGEN_CPU_OPEN_END);
1291 /* Close a cpu table.
1292 ??? This can live in a machine independent file, but there's currently
1293 no place to put this file (there's no libcgen). libopcodes is the wrong
1294 place as some simulator ports use this but they don't use libopcodes. */
1296 void
1297 mt_cgen_cpu_close (CGEN_CPU_DESC cd)
1299 unsigned int i;
1300 const CGEN_INSN *insns;
1302 if (cd->macro_insn_table.init_entries)
1304 insns = cd->macro_insn_table.init_entries;
1305 for (i = 0; i < cd->macro_insn_table.num_init_entries; ++i, ++insns)
1306 if (CGEN_INSN_RX ((insns)))
1307 regfree (CGEN_INSN_RX (insns));
1310 if (cd->insn_table.init_entries)
1312 insns = cd->insn_table.init_entries;
1313 for (i = 0; i < cd->insn_table.num_init_entries; ++i, ++insns)
1314 if (CGEN_INSN_RX (insns))
1315 regfree (CGEN_INSN_RX (insns));
1318 if (cd->macro_insn_table.init_entries)
1319 free ((CGEN_INSN *) cd->macro_insn_table.init_entries);
1321 if (cd->insn_table.init_entries)
1322 free ((CGEN_INSN *) cd->insn_table.init_entries);
1324 if (cd->hw_table.entries)
1325 free ((CGEN_HW_ENTRY *) cd->hw_table.entries);
1327 if (cd->operand_table.entries)
1328 free ((CGEN_HW_ENTRY *) cd->operand_table.entries);
1330 free (cd);