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