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