1*3d8817e4Smiod /* CPU data for xstormy16.
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 "xstormy16-desc.h"
32*3d8817e4Smiod #include "xstormy16-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   { "xstormy16", MACH_XSTORMY16 },
50*3d8817e4Smiod   { "max", MACH_MAX },
51*3d8817e4Smiod   { 0, 0 }
52*3d8817e4Smiod };
53*3d8817e4Smiod 
54*3d8817e4Smiod static const CGEN_ATTR_ENTRY ISA_attr[] ATTRIBUTE_UNUSED =
55*3d8817e4Smiod {
56*3d8817e4Smiod   { "xstormy16", ISA_XSTORMY16 },
57*3d8817e4Smiod   { "max", ISA_MAX },
58*3d8817e4Smiod   { 0, 0 }
59*3d8817e4Smiod };
60*3d8817e4Smiod 
61*3d8817e4Smiod const CGEN_ATTR_TABLE xstormy16_cgen_ifield_attr_table[] =
62*3d8817e4Smiod {
63*3d8817e4Smiod   { "MACH", & MACH_attr[0], & MACH_attr[0] },
64*3d8817e4Smiod   { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
65*3d8817e4Smiod   { "PCREL-ADDR", &bool_attr[0], &bool_attr[0] },
66*3d8817e4Smiod   { "ABS-ADDR", &bool_attr[0], &bool_attr[0] },
67*3d8817e4Smiod   { "RESERVED", &bool_attr[0], &bool_attr[0] },
68*3d8817e4Smiod   { "SIGN-OPT", &bool_attr[0], &bool_attr[0] },
69*3d8817e4Smiod   { "SIGNED", &bool_attr[0], &bool_attr[0] },
70*3d8817e4Smiod   { 0, 0, 0 }
71*3d8817e4Smiod };
72*3d8817e4Smiod 
73*3d8817e4Smiod const CGEN_ATTR_TABLE xstormy16_cgen_hardware_attr_table[] =
74*3d8817e4Smiod {
75*3d8817e4Smiod   { "MACH", & MACH_attr[0], & MACH_attr[0] },
76*3d8817e4Smiod   { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
77*3d8817e4Smiod   { "CACHE-ADDR", &bool_attr[0], &bool_attr[0] },
78*3d8817e4Smiod   { "PC", &bool_attr[0], &bool_attr[0] },
79*3d8817e4Smiod   { "PROFILE", &bool_attr[0], &bool_attr[0] },
80*3d8817e4Smiod   { 0, 0, 0 }
81*3d8817e4Smiod };
82*3d8817e4Smiod 
83*3d8817e4Smiod const CGEN_ATTR_TABLE xstormy16_cgen_operand_attr_table[] =
84*3d8817e4Smiod {
85*3d8817e4Smiod   { "MACH", & MACH_attr[0], & MACH_attr[0] },
86*3d8817e4Smiod   { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
87*3d8817e4Smiod   { "PCREL-ADDR", &bool_attr[0], &bool_attr[0] },
88*3d8817e4Smiod   { "ABS-ADDR", &bool_attr[0], &bool_attr[0] },
89*3d8817e4Smiod   { "SIGN-OPT", &bool_attr[0], &bool_attr[0] },
90*3d8817e4Smiod   { "SIGNED", &bool_attr[0], &bool_attr[0] },
91*3d8817e4Smiod   { "NEGATIVE", &bool_attr[0], &bool_attr[0] },
92*3d8817e4Smiod   { "RELAX", &bool_attr[0], &bool_attr[0] },
93*3d8817e4Smiod   { "SEM-ONLY", &bool_attr[0], &bool_attr[0] },
94*3d8817e4Smiod   { 0, 0, 0 }
95*3d8817e4Smiod };
96*3d8817e4Smiod 
97*3d8817e4Smiod const CGEN_ATTR_TABLE xstormy16_cgen_insn_attr_table[] =
98*3d8817e4Smiod {
99*3d8817e4Smiod   { "MACH", & MACH_attr[0], & MACH_attr[0] },
100*3d8817e4Smiod   { "ALIAS", &bool_attr[0], &bool_attr[0] },
101*3d8817e4Smiod   { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
102*3d8817e4Smiod   { "UNCOND-CTI", &bool_attr[0], &bool_attr[0] },
103*3d8817e4Smiod   { "COND-CTI", &bool_attr[0], &bool_attr[0] },
104*3d8817e4Smiod   { "SKIP-CTI", &bool_attr[0], &bool_attr[0] },
105*3d8817e4Smiod   { "DELAY-SLOT", &bool_attr[0], &bool_attr[0] },
106*3d8817e4Smiod   { "RELAXABLE", &bool_attr[0], &bool_attr[0] },
107*3d8817e4Smiod   { "RELAXED", &bool_attr[0], &bool_attr[0] },
108*3d8817e4Smiod   { "NO-DIS", &bool_attr[0], &bool_attr[0] },
109*3d8817e4Smiod   { "PBB", &bool_attr[0], &bool_attr[0] },
110*3d8817e4Smiod   { 0, 0, 0 }
111*3d8817e4Smiod };
112*3d8817e4Smiod 
113*3d8817e4Smiod /* Instruction set variants.  */
114*3d8817e4Smiod 
115*3d8817e4Smiod static const CGEN_ISA xstormy16_cgen_isa_table[] = {
116*3d8817e4Smiod   { "xstormy16", 32, 32, 16, 32 },
117*3d8817e4Smiod   { 0, 0, 0, 0, 0 }
118*3d8817e4Smiod };
119*3d8817e4Smiod 
120*3d8817e4Smiod /* Machine variants.  */
121*3d8817e4Smiod 
122*3d8817e4Smiod static const CGEN_MACH xstormy16_cgen_mach_table[] = {
123*3d8817e4Smiod   { "xstormy16", "xstormy16", MACH_XSTORMY16, 16 },
124*3d8817e4Smiod   { 0, 0, 0, 0 }
125*3d8817e4Smiod };
126*3d8817e4Smiod 
127*3d8817e4Smiod static CGEN_KEYWORD_ENTRY xstormy16_cgen_opval_gr_names_entries[] =
128*3d8817e4Smiod {
129*3d8817e4Smiod   { "r0", 0, {0, {{{0, 0}}}}, 0, 0 },
130*3d8817e4Smiod   { "r1", 1, {0, {{{0, 0}}}}, 0, 0 },
131*3d8817e4Smiod   { "r2", 2, {0, {{{0, 0}}}}, 0, 0 },
132*3d8817e4Smiod   { "r3", 3, {0, {{{0, 0}}}}, 0, 0 },
133*3d8817e4Smiod   { "r4", 4, {0, {{{0, 0}}}}, 0, 0 },
134*3d8817e4Smiod   { "r5", 5, {0, {{{0, 0}}}}, 0, 0 },
135*3d8817e4Smiod   { "r6", 6, {0, {{{0, 0}}}}, 0, 0 },
136*3d8817e4Smiod   { "r7", 7, {0, {{{0, 0}}}}, 0, 0 },
137*3d8817e4Smiod   { "r8", 8, {0, {{{0, 0}}}}, 0, 0 },
138*3d8817e4Smiod   { "r9", 9, {0, {{{0, 0}}}}, 0, 0 },
139*3d8817e4Smiod   { "r10", 10, {0, {{{0, 0}}}}, 0, 0 },
140*3d8817e4Smiod   { "r11", 11, {0, {{{0, 0}}}}, 0, 0 },
141*3d8817e4Smiod   { "r12", 12, {0, {{{0, 0}}}}, 0, 0 },
142*3d8817e4Smiod   { "r13", 13, {0, {{{0, 0}}}}, 0, 0 },
143*3d8817e4Smiod   { "r14", 14, {0, {{{0, 0}}}}, 0, 0 },
144*3d8817e4Smiod   { "r15", 15, {0, {{{0, 0}}}}, 0, 0 },
145*3d8817e4Smiod   { "psw", 14, {0, {{{0, 0}}}}, 0, 0 },
146*3d8817e4Smiod   { "sp", 15, {0, {{{0, 0}}}}, 0, 0 }
147*3d8817e4Smiod };
148*3d8817e4Smiod 
149*3d8817e4Smiod CGEN_KEYWORD xstormy16_cgen_opval_gr_names =
150*3d8817e4Smiod {
151*3d8817e4Smiod   & xstormy16_cgen_opval_gr_names_entries[0],
152*3d8817e4Smiod   18,
153*3d8817e4Smiod   0, 0, 0, 0, ""
154*3d8817e4Smiod };
155*3d8817e4Smiod 
156*3d8817e4Smiod static CGEN_KEYWORD_ENTRY xstormy16_cgen_opval_gr_Rb_names_entries[] =
157*3d8817e4Smiod {
158*3d8817e4Smiod   { "r8", 0, {0, {{{0, 0}}}}, 0, 0 },
159*3d8817e4Smiod   { "r9", 1, {0, {{{0, 0}}}}, 0, 0 },
160*3d8817e4Smiod   { "r10", 2, {0, {{{0, 0}}}}, 0, 0 },
161*3d8817e4Smiod   { "r11", 3, {0, {{{0, 0}}}}, 0, 0 },
162*3d8817e4Smiod   { "r12", 4, {0, {{{0, 0}}}}, 0, 0 },
163*3d8817e4Smiod   { "r13", 5, {0, {{{0, 0}}}}, 0, 0 },
164*3d8817e4Smiod   { "r14", 6, {0, {{{0, 0}}}}, 0, 0 },
165*3d8817e4Smiod   { "r15", 7, {0, {{{0, 0}}}}, 0, 0 },
166*3d8817e4Smiod   { "psw", 6, {0, {{{0, 0}}}}, 0, 0 },
167*3d8817e4Smiod   { "sp", 7, {0, {{{0, 0}}}}, 0, 0 }
168*3d8817e4Smiod };
169*3d8817e4Smiod 
170*3d8817e4Smiod CGEN_KEYWORD xstormy16_cgen_opval_gr_Rb_names =
171*3d8817e4Smiod {
172*3d8817e4Smiod   & xstormy16_cgen_opval_gr_Rb_names_entries[0],
173*3d8817e4Smiod   10,
174*3d8817e4Smiod   0, 0, 0, 0, ""
175*3d8817e4Smiod };
176*3d8817e4Smiod 
177*3d8817e4Smiod static CGEN_KEYWORD_ENTRY xstormy16_cgen_opval_h_branchcond_entries[] =
178*3d8817e4Smiod {
179*3d8817e4Smiod   { "ge", 0, {0, {{{0, 0}}}}, 0, 0 },
180*3d8817e4Smiod   { "nc", 1, {0, {{{0, 0}}}}, 0, 0 },
181*3d8817e4Smiod   { "lt", 2, {0, {{{0, 0}}}}, 0, 0 },
182*3d8817e4Smiod   { "c", 3, {0, {{{0, 0}}}}, 0, 0 },
183*3d8817e4Smiod   { "gt", 4, {0, {{{0, 0}}}}, 0, 0 },
184*3d8817e4Smiod   { "hi", 5, {0, {{{0, 0}}}}, 0, 0 },
185*3d8817e4Smiod   { "le", 6, {0, {{{0, 0}}}}, 0, 0 },
186*3d8817e4Smiod   { "ls", 7, {0, {{{0, 0}}}}, 0, 0 },
187*3d8817e4Smiod   { "pl", 8, {0, {{{0, 0}}}}, 0, 0 },
188*3d8817e4Smiod   { "nv", 9, {0, {{{0, 0}}}}, 0, 0 },
189*3d8817e4Smiod   { "mi", 10, {0, {{{0, 0}}}}, 0, 0 },
190*3d8817e4Smiod   { "v", 11, {0, {{{0, 0}}}}, 0, 0 },
191*3d8817e4Smiod   { "nz.b", 12, {0, {{{0, 0}}}}, 0, 0 },
192*3d8817e4Smiod   { "nz", 13, {0, {{{0, 0}}}}, 0, 0 },
193*3d8817e4Smiod   { "z.b", 14, {0, {{{0, 0}}}}, 0, 0 },
194*3d8817e4Smiod   { "z", 15, {0, {{{0, 0}}}}, 0, 0 }
195*3d8817e4Smiod };
196*3d8817e4Smiod 
197*3d8817e4Smiod CGEN_KEYWORD xstormy16_cgen_opval_h_branchcond =
198*3d8817e4Smiod {
199*3d8817e4Smiod   & xstormy16_cgen_opval_h_branchcond_entries[0],
200*3d8817e4Smiod   16,
201*3d8817e4Smiod   0, 0, 0, 0, ""
202*3d8817e4Smiod };
203*3d8817e4Smiod 
204*3d8817e4Smiod static CGEN_KEYWORD_ENTRY xstormy16_cgen_opval_h_wordsize_entries[] =
205*3d8817e4Smiod {
206*3d8817e4Smiod   { ".b", 0, {0, {{{0, 0}}}}, 0, 0 },
207*3d8817e4Smiod   { ".w", 1, {0, {{{0, 0}}}}, 0, 0 },
208*3d8817e4Smiod   { "", 1, {0, {{{0, 0}}}}, 0, 0 }
209*3d8817e4Smiod };
210*3d8817e4Smiod 
211*3d8817e4Smiod CGEN_KEYWORD xstormy16_cgen_opval_h_wordsize =
212*3d8817e4Smiod {
213*3d8817e4Smiod   & xstormy16_cgen_opval_h_wordsize_entries[0],
214*3d8817e4Smiod   3,
215*3d8817e4Smiod   0, 0, 0, 0, ""
216*3d8817e4Smiod };
217*3d8817e4Smiod 
218*3d8817e4Smiod 
219*3d8817e4Smiod /* The hardware table.  */
220*3d8817e4Smiod 
221*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
222*3d8817e4Smiod #define A(a) (1 << CGEN_HW_##a)
223*3d8817e4Smiod #else
224*3d8817e4Smiod #define A(a) (1 << CGEN_HW_/**/a)
225*3d8817e4Smiod #endif
226*3d8817e4Smiod 
227*3d8817e4Smiod const CGEN_HW_ENTRY xstormy16_cgen_hw_table[] =
228*3d8817e4Smiod {
229*3d8817e4Smiod   { "h-memory", HW_H_MEMORY, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
230*3d8817e4Smiod   { "h-sint", HW_H_SINT, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
231*3d8817e4Smiod   { "h-uint", HW_H_UINT, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
232*3d8817e4Smiod   { "h-addr", HW_H_ADDR, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
233*3d8817e4Smiod   { "h-iaddr", HW_H_IADDR, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
234*3d8817e4Smiod   { "h-pc", HW_H_PC, CGEN_ASM_NONE, 0, { 0|A(PC), { { { (1<<MACH_BASE), 0 } } } } },
235*3d8817e4Smiod   { "h-gr", HW_H_GR, CGEN_ASM_KEYWORD, (PTR) & xstormy16_cgen_opval_gr_names, { 0, { { { (1<<MACH_BASE), 0 } } } } },
236*3d8817e4Smiod   { "h-Rb", HW_H_RB, CGEN_ASM_KEYWORD, (PTR) & xstormy16_cgen_opval_gr_Rb_names, { 0|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } } } } },
237*3d8817e4Smiod   { "h-Rbj", HW_H_RBJ, CGEN_ASM_KEYWORD, (PTR) & xstormy16_cgen_opval_gr_Rb_names, { 0|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } } } } },
238*3d8817e4Smiod   { "h-Rpsw", HW_H_RPSW, CGEN_ASM_NONE, 0, { 0|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } } } } },
239*3d8817e4Smiod   { "h-z8", HW_H_Z8, CGEN_ASM_NONE, 0, { 0|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } } } } },
240*3d8817e4Smiod   { "h-z16", HW_H_Z16, CGEN_ASM_NONE, 0, { 0|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } } } } },
241*3d8817e4Smiod   { "h-cy", HW_H_CY, CGEN_ASM_NONE, 0, { 0|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } } } } },
242*3d8817e4Smiod   { "h-hc", HW_H_HC, CGEN_ASM_NONE, 0, { 0|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } } } } },
243*3d8817e4Smiod   { "h-ov", HW_H_OV, CGEN_ASM_NONE, 0, { 0|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } } } } },
244*3d8817e4Smiod   { "h-pt", HW_H_PT, CGEN_ASM_NONE, 0, { 0|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } } } } },
245*3d8817e4Smiod   { "h-s", HW_H_S, CGEN_ASM_NONE, 0, { 0|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } } } } },
246*3d8817e4Smiod   { "h-branchcond", HW_H_BRANCHCOND, CGEN_ASM_KEYWORD, (PTR) & xstormy16_cgen_opval_h_branchcond, { 0, { { { (1<<MACH_BASE), 0 } } } } },
247*3d8817e4Smiod   { "h-wordsize", HW_H_WORDSIZE, CGEN_ASM_KEYWORD, (PTR) & xstormy16_cgen_opval_h_wordsize, { 0, { { { (1<<MACH_BASE), 0 } } } } },
248*3d8817e4Smiod   { 0, 0, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } }
249*3d8817e4Smiod };
250*3d8817e4Smiod 
251*3d8817e4Smiod #undef A
252*3d8817e4Smiod 
253*3d8817e4Smiod 
254*3d8817e4Smiod /* The instruction field table.  */
255*3d8817e4Smiod 
256*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
257*3d8817e4Smiod #define A(a) (1 << CGEN_IFLD_##a)
258*3d8817e4Smiod #else
259*3d8817e4Smiod #define A(a) (1 << CGEN_IFLD_/**/a)
260*3d8817e4Smiod #endif
261*3d8817e4Smiod 
262*3d8817e4Smiod const CGEN_IFLD xstormy16_cgen_ifld_table[] =
263*3d8817e4Smiod {
264*3d8817e4Smiod   { XSTORMY16_F_NIL, "f-nil", 0, 0, 0, 0, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
265*3d8817e4Smiod   { XSTORMY16_F_ANYOF, "f-anyof", 0, 0, 0, 0, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
266*3d8817e4Smiod   { XSTORMY16_F_RD, "f-Rd", 0, 32, 12, 4, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
267*3d8817e4Smiod   { XSTORMY16_F_RDM, "f-Rdm", 0, 32, 13, 3, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
268*3d8817e4Smiod   { XSTORMY16_F_RM, "f-Rm", 0, 32, 4, 3, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
269*3d8817e4Smiod   { XSTORMY16_F_RS, "f-Rs", 0, 32, 8, 4, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
270*3d8817e4Smiod   { XSTORMY16_F_RB, "f-Rb", 0, 32, 17, 3, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
271*3d8817e4Smiod   { XSTORMY16_F_RBJ, "f-Rbj", 0, 32, 11, 1, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
272*3d8817e4Smiod   { XSTORMY16_F_OP1, "f-op1", 0, 32, 0, 4, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
273*3d8817e4Smiod   { XSTORMY16_F_OP2, "f-op2", 0, 32, 4, 4, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
274*3d8817e4Smiod   { XSTORMY16_F_OP2A, "f-op2a", 0, 32, 4, 3, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
275*3d8817e4Smiod   { XSTORMY16_F_OP2M, "f-op2m", 0, 32, 7, 1, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
276*3d8817e4Smiod   { XSTORMY16_F_OP3, "f-op3", 0, 32, 8, 4, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
277*3d8817e4Smiod   { XSTORMY16_F_OP3A, "f-op3a", 0, 32, 8, 2, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
278*3d8817e4Smiod   { XSTORMY16_F_OP3B, "f-op3b", 0, 32, 8, 3, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
279*3d8817e4Smiod   { XSTORMY16_F_OP4, "f-op4", 0, 32, 12, 4, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
280*3d8817e4Smiod   { XSTORMY16_F_OP4M, "f-op4m", 0, 32, 12, 1, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
281*3d8817e4Smiod   { XSTORMY16_F_OP4B, "f-op4b", 0, 32, 15, 1, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
282*3d8817e4Smiod   { XSTORMY16_F_OP5, "f-op5", 0, 32, 16, 4, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
283*3d8817e4Smiod   { XSTORMY16_F_OP5A, "f-op5a", 0, 32, 16, 1, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
284*3d8817e4Smiod   { XSTORMY16_F_OP, "f-op", 0, 32, 0, 16, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
285*3d8817e4Smiod   { XSTORMY16_F_IMM2, "f-imm2", 0, 32, 10, 2, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
286*3d8817e4Smiod   { XSTORMY16_F_IMM3, "f-imm3", 0, 32, 4, 3, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
287*3d8817e4Smiod   { XSTORMY16_F_IMM3B, "f-imm3b", 0, 32, 17, 3, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
288*3d8817e4Smiod   { XSTORMY16_F_IMM4, "f-imm4", 0, 32, 8, 4, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
289*3d8817e4Smiod   { XSTORMY16_F_IMM8, "f-imm8", 0, 32, 8, 8, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
290*3d8817e4Smiod   { XSTORMY16_F_IMM12, "f-imm12", 0, 32, 20, 12, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
291*3d8817e4Smiod   { XSTORMY16_F_IMM16, "f-imm16", 0, 32, 16, 16, { 0|A(SIGN_OPT), { { { (1<<MACH_BASE), 0 } } } }  },
292*3d8817e4Smiod   { XSTORMY16_F_LMEM8, "f-lmem8", 0, 32, 8, 8, { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } }  },
293*3d8817e4Smiod   { XSTORMY16_F_HMEM8, "f-hmem8", 0, 32, 8, 8, { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } }  },
294*3d8817e4Smiod   { XSTORMY16_F_REL8_2, "f-rel8-2", 0, 32, 8, 8, { 0|A(PCREL_ADDR), { { { (1<<MACH_BASE), 0 } } } }  },
295*3d8817e4Smiod   { XSTORMY16_F_REL8_4, "f-rel8-4", 0, 32, 8, 8, { 0|A(PCREL_ADDR), { { { (1<<MACH_BASE), 0 } } } }  },
296*3d8817e4Smiod   { XSTORMY16_F_REL12, "f-rel12", 0, 32, 20, 12, { 0|A(PCREL_ADDR), { { { (1<<MACH_BASE), 0 } } } }  },
297*3d8817e4Smiod   { XSTORMY16_F_REL12A, "f-rel12a", 0, 32, 4, 11, { 0|A(PCREL_ADDR), { { { (1<<MACH_BASE), 0 } } } }  },
298*3d8817e4Smiod   { XSTORMY16_F_ABS24_1, "f-abs24-1", 0, 32, 8, 8, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
299*3d8817e4Smiod   { XSTORMY16_F_ABS24_2, "f-abs24-2", 0, 32, 16, 16, { 0, { { { (1<<MACH_BASE), 0 } } } }  },
300*3d8817e4Smiod   { XSTORMY16_F_ABS24, "f-abs24", 0, 0, 0, 0,{ 0|A(ABS_ADDR)|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } } } }  },
301*3d8817e4Smiod   { 0, 0, 0, 0, 0, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } }
302*3d8817e4Smiod };
303*3d8817e4Smiod 
304*3d8817e4Smiod #undef A
305*3d8817e4Smiod 
306*3d8817e4Smiod 
307*3d8817e4Smiod 
308*3d8817e4Smiod /* multi ifield declarations */
309*3d8817e4Smiod 
310*3d8817e4Smiod const CGEN_MAYBE_MULTI_IFLD XSTORMY16_F_ABS24_MULTI_IFIELD [];
311*3d8817e4Smiod 
312*3d8817e4Smiod 
313*3d8817e4Smiod /* multi ifield definitions */
314*3d8817e4Smiod 
315*3d8817e4Smiod const CGEN_MAYBE_MULTI_IFLD XSTORMY16_F_ABS24_MULTI_IFIELD [] =
316*3d8817e4Smiod {
317*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_ABS24_1] } },
318*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_ABS24_2] } },
319*3d8817e4Smiod     { 0, { (const PTR) 0 } }
320*3d8817e4Smiod };
321*3d8817e4Smiod 
322*3d8817e4Smiod /* The operand table.  */
323*3d8817e4Smiod 
324*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
325*3d8817e4Smiod #define A(a) (1 << CGEN_OPERAND_##a)
326*3d8817e4Smiod #else
327*3d8817e4Smiod #define A(a) (1 << CGEN_OPERAND_/**/a)
328*3d8817e4Smiod #endif
329*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
330*3d8817e4Smiod #define OPERAND(op) XSTORMY16_OPERAND_##op
331*3d8817e4Smiod #else
332*3d8817e4Smiod #define OPERAND(op) XSTORMY16_OPERAND_/**/op
333*3d8817e4Smiod #endif
334*3d8817e4Smiod 
335*3d8817e4Smiod const CGEN_OPERAND xstormy16_cgen_operand_table[] =
336*3d8817e4Smiod {
337*3d8817e4Smiod /* pc: program counter */
338*3d8817e4Smiod   { "pc", XSTORMY16_OPERAND_PC, HW_H_PC, 0, 0,
339*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_NIL] } },
340*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
341*3d8817e4Smiod /* psw-z8:  */
342*3d8817e4Smiod   { "psw-z8", XSTORMY16_OPERAND_PSW_Z8, HW_H_Z8, 0, 0,
343*3d8817e4Smiod     { 0, { (const PTR) 0 } },
344*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
345*3d8817e4Smiod /* psw-z16:  */
346*3d8817e4Smiod   { "psw-z16", XSTORMY16_OPERAND_PSW_Z16, HW_H_Z16, 0, 0,
347*3d8817e4Smiod     { 0, { (const PTR) 0 } },
348*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
349*3d8817e4Smiod /* psw-cy:  */
350*3d8817e4Smiod   { "psw-cy", XSTORMY16_OPERAND_PSW_CY, HW_H_CY, 0, 0,
351*3d8817e4Smiod     { 0, { (const PTR) 0 } },
352*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
353*3d8817e4Smiod /* psw-hc:  */
354*3d8817e4Smiod   { "psw-hc", XSTORMY16_OPERAND_PSW_HC, HW_H_HC, 0, 0,
355*3d8817e4Smiod     { 0, { (const PTR) 0 } },
356*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
357*3d8817e4Smiod /* psw-ov:  */
358*3d8817e4Smiod   { "psw-ov", XSTORMY16_OPERAND_PSW_OV, HW_H_OV, 0, 0,
359*3d8817e4Smiod     { 0, { (const PTR) 0 } },
360*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
361*3d8817e4Smiod /* psw-pt:  */
362*3d8817e4Smiod   { "psw-pt", XSTORMY16_OPERAND_PSW_PT, HW_H_PT, 0, 0,
363*3d8817e4Smiod     { 0, { (const PTR) 0 } },
364*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
365*3d8817e4Smiod /* psw-s:  */
366*3d8817e4Smiod   { "psw-s", XSTORMY16_OPERAND_PSW_S, HW_H_S, 0, 0,
367*3d8817e4Smiod     { 0, { (const PTR) 0 } },
368*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
369*3d8817e4Smiod /* Rd: general register destination */
370*3d8817e4Smiod   { "Rd", XSTORMY16_OPERAND_RD, HW_H_GR, 12, 4,
371*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_RD] } },
372*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
373*3d8817e4Smiod /* Rdm: general register destination */
374*3d8817e4Smiod   { "Rdm", XSTORMY16_OPERAND_RDM, HW_H_GR, 13, 3,
375*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_RDM] } },
376*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
377*3d8817e4Smiod /* Rm: general register for memory */
378*3d8817e4Smiod   { "Rm", XSTORMY16_OPERAND_RM, HW_H_GR, 4, 3,
379*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_RM] } },
380*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
381*3d8817e4Smiod /* Rs: general register source */
382*3d8817e4Smiod   { "Rs", XSTORMY16_OPERAND_RS, HW_H_GR, 8, 4,
383*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_RS] } },
384*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
385*3d8817e4Smiod /* Rb: base register */
386*3d8817e4Smiod   { "Rb", XSTORMY16_OPERAND_RB, HW_H_RB, 17, 3,
387*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_RB] } },
388*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
389*3d8817e4Smiod /* Rbj: base register for jump */
390*3d8817e4Smiod   { "Rbj", XSTORMY16_OPERAND_RBJ, HW_H_RBJ, 11, 1,
391*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_RBJ] } },
392*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
393*3d8817e4Smiod /* bcond2: branch condition opcode */
394*3d8817e4Smiod   { "bcond2", XSTORMY16_OPERAND_BCOND2, HW_H_BRANCHCOND, 4, 4,
395*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_OP2] } },
396*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
397*3d8817e4Smiod /* ws2: word size opcode */
398*3d8817e4Smiod   { "ws2", XSTORMY16_OPERAND_WS2, HW_H_WORDSIZE, 7, 1,
399*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_OP2M] } },
400*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
401*3d8817e4Smiod /* bcond5: branch condition opcode */
402*3d8817e4Smiod   { "bcond5", XSTORMY16_OPERAND_BCOND5, HW_H_BRANCHCOND, 16, 4,
403*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_OP5] } },
404*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
405*3d8817e4Smiod /* imm2: 2 bit unsigned immediate */
406*3d8817e4Smiod   { "imm2", XSTORMY16_OPERAND_IMM2, HW_H_UINT, 10, 2,
407*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM2] } },
408*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
409*3d8817e4Smiod /* imm3: 3 bit unsigned immediate */
410*3d8817e4Smiod   { "imm3", XSTORMY16_OPERAND_IMM3, HW_H_UINT, 4, 3,
411*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM3] } },
412*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
413*3d8817e4Smiod /* imm3b: 3 bit unsigned immediate for bit tests */
414*3d8817e4Smiod   { "imm3b", XSTORMY16_OPERAND_IMM3B, HW_H_UINT, 17, 3,
415*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM3B] } },
416*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
417*3d8817e4Smiod /* imm4: 4 bit unsigned immediate */
418*3d8817e4Smiod   { "imm4", XSTORMY16_OPERAND_IMM4, HW_H_UINT, 8, 4,
419*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM4] } },
420*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
421*3d8817e4Smiod /* imm8: 8 bit unsigned immediate */
422*3d8817e4Smiod   { "imm8", XSTORMY16_OPERAND_IMM8, HW_H_UINT, 8, 8,
423*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM8] } },
424*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
425*3d8817e4Smiod /* imm8small: 8 bit unsigned immediate */
426*3d8817e4Smiod   { "imm8small", XSTORMY16_OPERAND_IMM8SMALL, HW_H_UINT, 8, 8,
427*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM8] } },
428*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
429*3d8817e4Smiod /* imm12: 12 bit signed immediate */
430*3d8817e4Smiod   { "imm12", XSTORMY16_OPERAND_IMM12, HW_H_SINT, 20, 12,
431*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM12] } },
432*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }  },
433*3d8817e4Smiod /* imm16: 16 bit immediate */
434*3d8817e4Smiod   { "imm16", XSTORMY16_OPERAND_IMM16, HW_H_UINT, 16, 16,
435*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM16] } },
436*3d8817e4Smiod     { 0|A(SIGN_OPT), { { { (1<<MACH_BASE), 0 } } } }  },
437*3d8817e4Smiod /* lmem8: 8 bit unsigned immediate low memory */
438*3d8817e4Smiod   { "lmem8", XSTORMY16_OPERAND_LMEM8, HW_H_UINT, 8, 8,
439*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_LMEM8] } },
440*3d8817e4Smiod     { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } }  },
441*3d8817e4Smiod /* hmem8: 8 bit unsigned immediate high memory */
442*3d8817e4Smiod   { "hmem8", XSTORMY16_OPERAND_HMEM8, HW_H_UINT, 8, 8,
443*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_HMEM8] } },
444*3d8817e4Smiod     { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } }  },
445*3d8817e4Smiod /* rel8-2: 8 bit relative address */
446*3d8817e4Smiod   { "rel8-2", XSTORMY16_OPERAND_REL8_2, HW_H_UINT, 8, 8,
447*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_REL8_2] } },
448*3d8817e4Smiod     { 0|A(PCREL_ADDR), { { { (1<<MACH_BASE), 0 } } } }  },
449*3d8817e4Smiod /* rel8-4: 8 bit relative address */
450*3d8817e4Smiod   { "rel8-4", XSTORMY16_OPERAND_REL8_4, HW_H_UINT, 8, 8,
451*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_REL8_4] } },
452*3d8817e4Smiod     { 0|A(PCREL_ADDR), { { { (1<<MACH_BASE), 0 } } } }  },
453*3d8817e4Smiod /* rel12: 12 bit relative address */
454*3d8817e4Smiod   { "rel12", XSTORMY16_OPERAND_REL12, HW_H_UINT, 20, 12,
455*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_REL12] } },
456*3d8817e4Smiod     { 0|A(PCREL_ADDR), { { { (1<<MACH_BASE), 0 } } } }  },
457*3d8817e4Smiod /* rel12a: 12 bit relative address */
458*3d8817e4Smiod   { "rel12a", XSTORMY16_OPERAND_REL12A, HW_H_UINT, 4, 11,
459*3d8817e4Smiod     { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_REL12A] } },
460*3d8817e4Smiod     { 0|A(PCREL_ADDR), { { { (1<<MACH_BASE), 0 } } } }  },
461*3d8817e4Smiod /* abs24: 24 bit absolute address */
462*3d8817e4Smiod   { "abs24", XSTORMY16_OPERAND_ABS24, HW_H_UINT, 8, 24,
463*3d8817e4Smiod     { 2, { (const PTR) &XSTORMY16_F_ABS24_MULTI_IFIELD[0] } },
464*3d8817e4Smiod     { 0|A(ABS_ADDR)|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } } } }  },
465*3d8817e4Smiod /* psw: program status word */
466*3d8817e4Smiod   { "psw", XSTORMY16_OPERAND_PSW, HW_H_GR, 0, 0,
467*3d8817e4Smiod     { 0, { (const PTR) 0 } },
468*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
469*3d8817e4Smiod /* Rpsw: N0-N3 of the program status word */
470*3d8817e4Smiod   { "Rpsw", XSTORMY16_OPERAND_RPSW, HW_H_RPSW, 0, 0,
471*3d8817e4Smiod     { 0, { (const PTR) 0 } },
472*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
473*3d8817e4Smiod /* sp: stack pointer */
474*3d8817e4Smiod   { "sp", XSTORMY16_OPERAND_SP, HW_H_GR, 0, 0,
475*3d8817e4Smiod     { 0, { (const PTR) 0 } },
476*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
477*3d8817e4Smiod /* R0: R0 */
478*3d8817e4Smiod   { "R0", XSTORMY16_OPERAND_R0, HW_H_GR, 0, 0,
479*3d8817e4Smiod     { 0, { (const PTR) 0 } },
480*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
481*3d8817e4Smiod /* R1: R1 */
482*3d8817e4Smiod   { "R1", XSTORMY16_OPERAND_R1, HW_H_GR, 0, 0,
483*3d8817e4Smiod     { 0, { (const PTR) 0 } },
484*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
485*3d8817e4Smiod /* R2: R2 */
486*3d8817e4Smiod   { "R2", XSTORMY16_OPERAND_R2, HW_H_GR, 0, 0,
487*3d8817e4Smiod     { 0, { (const PTR) 0 } },
488*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
489*3d8817e4Smiod /* R8: R8 */
490*3d8817e4Smiod   { "R8", XSTORMY16_OPERAND_R8, HW_H_GR, 0, 0,
491*3d8817e4Smiod     { 0, { (const PTR) 0 } },
492*3d8817e4Smiod     { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } }  },
493*3d8817e4Smiod /* sentinel */
494*3d8817e4Smiod   { 0, 0, 0, 0, 0,
495*3d8817e4Smiod     { 0, { (const PTR) 0 } },
496*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } } }
497*3d8817e4Smiod };
498*3d8817e4Smiod 
499*3d8817e4Smiod #undef A
500*3d8817e4Smiod 
501*3d8817e4Smiod 
502*3d8817e4Smiod /* The instruction table.  */
503*3d8817e4Smiod 
504*3d8817e4Smiod #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
505*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
506*3d8817e4Smiod #define A(a) (1 << CGEN_INSN_##a)
507*3d8817e4Smiod #else
508*3d8817e4Smiod #define A(a) (1 << CGEN_INSN_/**/a)
509*3d8817e4Smiod #endif
510*3d8817e4Smiod 
511*3d8817e4Smiod static const CGEN_IBASE xstormy16_cgen_insn_table[MAX_INSNS] =
512*3d8817e4Smiod {
513*3d8817e4Smiod   /* Special null first entry.
514*3d8817e4Smiod      A `num' value of zero is thus invalid.
515*3d8817e4Smiod      Also, the special `invalid' insn resides here.  */
516*3d8817e4Smiod   { 0, 0, 0, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
517*3d8817e4Smiod /* mov$ws2 $lmem8,#$imm16 */
518*3d8817e4Smiod   {
519*3d8817e4Smiod     XSTORMY16_INSN_MOVLMEMIMM, "movlmemimm", "mov", 32,
520*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
521*3d8817e4Smiod   },
522*3d8817e4Smiod /* mov$ws2 $hmem8,#$imm16 */
523*3d8817e4Smiod   {
524*3d8817e4Smiod     XSTORMY16_INSN_MOVHMEMIMM, "movhmemimm", "mov", 32,
525*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
526*3d8817e4Smiod   },
527*3d8817e4Smiod /* mov$ws2 $Rm,$lmem8 */
528*3d8817e4Smiod   {
529*3d8817e4Smiod     XSTORMY16_INSN_MOVLGRMEM, "movlgrmem", "mov", 16,
530*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
531*3d8817e4Smiod   },
532*3d8817e4Smiod /* mov$ws2 $Rm,$hmem8 */
533*3d8817e4Smiod   {
534*3d8817e4Smiod     XSTORMY16_INSN_MOVHGRMEM, "movhgrmem", "mov", 16,
535*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
536*3d8817e4Smiod   },
537*3d8817e4Smiod /* mov$ws2 $lmem8,$Rm */
538*3d8817e4Smiod   {
539*3d8817e4Smiod     XSTORMY16_INSN_MOVLMEMGR, "movlmemgr", "mov", 16,
540*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
541*3d8817e4Smiod   },
542*3d8817e4Smiod /* mov$ws2 $hmem8,$Rm */
543*3d8817e4Smiod   {
544*3d8817e4Smiod     XSTORMY16_INSN_MOVHMEMGR, "movhmemgr", "mov", 16,
545*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
546*3d8817e4Smiod   },
547*3d8817e4Smiod /* mov$ws2 $Rdm,($Rs) */
548*3d8817e4Smiod   {
549*3d8817e4Smiod     XSTORMY16_INSN_MOVGRGRI, "movgrgri", "mov", 16,
550*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
551*3d8817e4Smiod   },
552*3d8817e4Smiod /* mov$ws2 $Rdm,($Rs++) */
553*3d8817e4Smiod   {
554*3d8817e4Smiod     XSTORMY16_INSN_MOVGRGRIPOSTINC, "movgrgripostinc", "mov", 16,
555*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
556*3d8817e4Smiod   },
557*3d8817e4Smiod /* mov$ws2 $Rdm,(--$Rs) */
558*3d8817e4Smiod   {
559*3d8817e4Smiod     XSTORMY16_INSN_MOVGRGRIPREDEC, "movgrgripredec", "mov", 16,
560*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
561*3d8817e4Smiod   },
562*3d8817e4Smiod /* mov$ws2 ($Rs),$Rdm */
563*3d8817e4Smiod   {
564*3d8817e4Smiod     XSTORMY16_INSN_MOVGRIGR, "movgrigr", "mov", 16,
565*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
566*3d8817e4Smiod   },
567*3d8817e4Smiod /* mov$ws2 ($Rs++),$Rdm */
568*3d8817e4Smiod   {
569*3d8817e4Smiod     XSTORMY16_INSN_MOVGRIPOSTINCGR, "movgripostincgr", "mov", 16,
570*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
571*3d8817e4Smiod   },
572*3d8817e4Smiod /* mov$ws2 (--$Rs),$Rdm */
573*3d8817e4Smiod   {
574*3d8817e4Smiod     XSTORMY16_INSN_MOVGRIPREDECGR, "movgripredecgr", "mov", 16,
575*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
576*3d8817e4Smiod   },
577*3d8817e4Smiod /* mov$ws2 $Rdm,($Rs,$imm12) */
578*3d8817e4Smiod   {
579*3d8817e4Smiod     XSTORMY16_INSN_MOVGRGRII, "movgrgrii", "mov", 32,
580*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
581*3d8817e4Smiod   },
582*3d8817e4Smiod /* mov$ws2 $Rdm,($Rs++,$imm12) */
583*3d8817e4Smiod   {
584*3d8817e4Smiod     XSTORMY16_INSN_MOVGRGRIIPOSTINC, "movgrgriipostinc", "mov", 32,
585*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
586*3d8817e4Smiod   },
587*3d8817e4Smiod /* mov$ws2 $Rdm,(--$Rs,$imm12) */
588*3d8817e4Smiod   {
589*3d8817e4Smiod     XSTORMY16_INSN_MOVGRGRIIPREDEC, "movgrgriipredec", "mov", 32,
590*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
591*3d8817e4Smiod   },
592*3d8817e4Smiod /* mov$ws2 ($Rs,$imm12),$Rdm */
593*3d8817e4Smiod   {
594*3d8817e4Smiod     XSTORMY16_INSN_MOVGRIIGR, "movgriigr", "mov", 32,
595*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
596*3d8817e4Smiod   },
597*3d8817e4Smiod /* mov$ws2 ($Rs++,$imm12),$Rdm */
598*3d8817e4Smiod   {
599*3d8817e4Smiod     XSTORMY16_INSN_MOVGRIIPOSTINCGR, "movgriipostincgr", "mov", 32,
600*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
601*3d8817e4Smiod   },
602*3d8817e4Smiod /* mov$ws2 (--$Rs,$imm12),$Rdm */
603*3d8817e4Smiod   {
604*3d8817e4Smiod     XSTORMY16_INSN_MOVGRIIPREDECGR, "movgriipredecgr", "mov", 32,
605*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
606*3d8817e4Smiod   },
607*3d8817e4Smiod /* mov $Rd,$Rs */
608*3d8817e4Smiod   {
609*3d8817e4Smiod     XSTORMY16_INSN_MOVGRGR, "movgrgr", "mov", 16,
610*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
611*3d8817e4Smiod   },
612*3d8817e4Smiod /* mov.w Rx,#$imm8 */
613*3d8817e4Smiod   {
614*3d8817e4Smiod     XSTORMY16_INSN_MOVWIMM8, "movwimm8", "mov.w", 16,
615*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
616*3d8817e4Smiod   },
617*3d8817e4Smiod /* mov.w $Rm,#$imm8small */
618*3d8817e4Smiod   {
619*3d8817e4Smiod     XSTORMY16_INSN_MOVWGRIMM8, "movwgrimm8", "mov.w", 16,
620*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
621*3d8817e4Smiod   },
622*3d8817e4Smiod /* mov.w $Rd,#$imm16 */
623*3d8817e4Smiod   {
624*3d8817e4Smiod     XSTORMY16_INSN_MOVWGRIMM16, "movwgrimm16", "mov.w", 32,
625*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
626*3d8817e4Smiod   },
627*3d8817e4Smiod /* mov.b $Rd,RxL */
628*3d8817e4Smiod   {
629*3d8817e4Smiod     XSTORMY16_INSN_MOVLOWGR, "movlowgr", "mov.b", 16,
630*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
631*3d8817e4Smiod   },
632*3d8817e4Smiod /* mov.b $Rd,RxH */
633*3d8817e4Smiod   {
634*3d8817e4Smiod     XSTORMY16_INSN_MOVHIGHGR, "movhighgr", "mov.b", 16,
635*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
636*3d8817e4Smiod   },
637*3d8817e4Smiod /* movf$ws2 $Rdm,($Rs) */
638*3d8817e4Smiod   {
639*3d8817e4Smiod     XSTORMY16_INSN_MOVFGRGRI, "movfgrgri", "movf", 16,
640*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
641*3d8817e4Smiod   },
642*3d8817e4Smiod /* movf$ws2 $Rdm,($Rs++) */
643*3d8817e4Smiod   {
644*3d8817e4Smiod     XSTORMY16_INSN_MOVFGRGRIPOSTINC, "movfgrgripostinc", "movf", 16,
645*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
646*3d8817e4Smiod   },
647*3d8817e4Smiod /* movf$ws2 $Rdm,(--$Rs) */
648*3d8817e4Smiod   {
649*3d8817e4Smiod     XSTORMY16_INSN_MOVFGRGRIPREDEC, "movfgrgripredec", "movf", 16,
650*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
651*3d8817e4Smiod   },
652*3d8817e4Smiod /* movf$ws2 ($Rs),$Rdm */
653*3d8817e4Smiod   {
654*3d8817e4Smiod     XSTORMY16_INSN_MOVFGRIGR, "movfgrigr", "movf", 16,
655*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
656*3d8817e4Smiod   },
657*3d8817e4Smiod /* movf$ws2 ($Rs++),$Rdm */
658*3d8817e4Smiod   {
659*3d8817e4Smiod     XSTORMY16_INSN_MOVFGRIPOSTINCGR, "movfgripostincgr", "movf", 16,
660*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
661*3d8817e4Smiod   },
662*3d8817e4Smiod /* movf$ws2 (--$Rs),$Rdm */
663*3d8817e4Smiod   {
664*3d8817e4Smiod     XSTORMY16_INSN_MOVFGRIPREDECGR, "movfgripredecgr", "movf", 16,
665*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
666*3d8817e4Smiod   },
667*3d8817e4Smiod /* movf$ws2 $Rdm,($Rb,$Rs,$imm12) */
668*3d8817e4Smiod   {
669*3d8817e4Smiod     XSTORMY16_INSN_MOVFGRGRII, "movfgrgrii", "movf", 32,
670*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
671*3d8817e4Smiod   },
672*3d8817e4Smiod /* movf$ws2 $Rdm,($Rb,$Rs++,$imm12) */
673*3d8817e4Smiod   {
674*3d8817e4Smiod     XSTORMY16_INSN_MOVFGRGRIIPOSTINC, "movfgrgriipostinc", "movf", 32,
675*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
676*3d8817e4Smiod   },
677*3d8817e4Smiod /* movf$ws2 $Rdm,($Rb,--$Rs,$imm12) */
678*3d8817e4Smiod   {
679*3d8817e4Smiod     XSTORMY16_INSN_MOVFGRGRIIPREDEC, "movfgrgriipredec", "movf", 32,
680*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
681*3d8817e4Smiod   },
682*3d8817e4Smiod /* movf$ws2 ($Rb,$Rs,$imm12),$Rdm */
683*3d8817e4Smiod   {
684*3d8817e4Smiod     XSTORMY16_INSN_MOVFGRIIGR, "movfgriigr", "movf", 32,
685*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
686*3d8817e4Smiod   },
687*3d8817e4Smiod /* movf$ws2 ($Rb,$Rs++,$imm12),$Rdm */
688*3d8817e4Smiod   {
689*3d8817e4Smiod     XSTORMY16_INSN_MOVFGRIIPOSTINCGR, "movfgriipostincgr", "movf", 32,
690*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
691*3d8817e4Smiod   },
692*3d8817e4Smiod /* movf$ws2 ($Rb,--$Rs,$imm12),$Rdm */
693*3d8817e4Smiod   {
694*3d8817e4Smiod     XSTORMY16_INSN_MOVFGRIIPREDECGR, "movfgriipredecgr", "movf", 32,
695*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
696*3d8817e4Smiod   },
697*3d8817e4Smiod /* mask $Rd,$Rs */
698*3d8817e4Smiod   {
699*3d8817e4Smiod     XSTORMY16_INSN_MASKGRGR, "maskgrgr", "mask", 16,
700*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
701*3d8817e4Smiod   },
702*3d8817e4Smiod /* mask $Rd,#$imm16 */
703*3d8817e4Smiod   {
704*3d8817e4Smiod     XSTORMY16_INSN_MASKGRIMM16, "maskgrimm16", "mask", 32,
705*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
706*3d8817e4Smiod   },
707*3d8817e4Smiod /* push $Rd */
708*3d8817e4Smiod   {
709*3d8817e4Smiod     XSTORMY16_INSN_PUSHGR, "pushgr", "push", 16,
710*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
711*3d8817e4Smiod   },
712*3d8817e4Smiod /* pop $Rd */
713*3d8817e4Smiod   {
714*3d8817e4Smiod     XSTORMY16_INSN_POPGR, "popgr", "pop", 16,
715*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
716*3d8817e4Smiod   },
717*3d8817e4Smiod /* swpn $Rd */
718*3d8817e4Smiod   {
719*3d8817e4Smiod     XSTORMY16_INSN_SWPN, "swpn", "swpn", 16,
720*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
721*3d8817e4Smiod   },
722*3d8817e4Smiod /* swpb $Rd */
723*3d8817e4Smiod   {
724*3d8817e4Smiod     XSTORMY16_INSN_SWPB, "swpb", "swpb", 16,
725*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
726*3d8817e4Smiod   },
727*3d8817e4Smiod /* swpw $Rd,$Rs */
728*3d8817e4Smiod   {
729*3d8817e4Smiod     XSTORMY16_INSN_SWPW, "swpw", "swpw", 16,
730*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
731*3d8817e4Smiod   },
732*3d8817e4Smiod /* and $Rd,$Rs */
733*3d8817e4Smiod   {
734*3d8817e4Smiod     XSTORMY16_INSN_ANDGRGR, "andgrgr", "and", 16,
735*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
736*3d8817e4Smiod   },
737*3d8817e4Smiod /* and Rx,#$imm8 */
738*3d8817e4Smiod   {
739*3d8817e4Smiod     XSTORMY16_INSN_ANDIMM8, "andimm8", "and", 16,
740*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
741*3d8817e4Smiod   },
742*3d8817e4Smiod /* and $Rd,#$imm16 */
743*3d8817e4Smiod   {
744*3d8817e4Smiod     XSTORMY16_INSN_ANDGRIMM16, "andgrimm16", "and", 32,
745*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
746*3d8817e4Smiod   },
747*3d8817e4Smiod /* or $Rd,$Rs */
748*3d8817e4Smiod   {
749*3d8817e4Smiod     XSTORMY16_INSN_ORGRGR, "orgrgr", "or", 16,
750*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
751*3d8817e4Smiod   },
752*3d8817e4Smiod /* or Rx,#$imm8 */
753*3d8817e4Smiod   {
754*3d8817e4Smiod     XSTORMY16_INSN_ORIMM8, "orimm8", "or", 16,
755*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
756*3d8817e4Smiod   },
757*3d8817e4Smiod /* or $Rd,#$imm16 */
758*3d8817e4Smiod   {
759*3d8817e4Smiod     XSTORMY16_INSN_ORGRIMM16, "orgrimm16", "or", 32,
760*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
761*3d8817e4Smiod   },
762*3d8817e4Smiod /* xor $Rd,$Rs */
763*3d8817e4Smiod   {
764*3d8817e4Smiod     XSTORMY16_INSN_XORGRGR, "xorgrgr", "xor", 16,
765*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
766*3d8817e4Smiod   },
767*3d8817e4Smiod /* xor Rx,#$imm8 */
768*3d8817e4Smiod   {
769*3d8817e4Smiod     XSTORMY16_INSN_XORIMM8, "xorimm8", "xor", 16,
770*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
771*3d8817e4Smiod   },
772*3d8817e4Smiod /* xor $Rd,#$imm16 */
773*3d8817e4Smiod   {
774*3d8817e4Smiod     XSTORMY16_INSN_XORGRIMM16, "xorgrimm16", "xor", 32,
775*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
776*3d8817e4Smiod   },
777*3d8817e4Smiod /* not $Rd */
778*3d8817e4Smiod   {
779*3d8817e4Smiod     XSTORMY16_INSN_NOTGR, "notgr", "not", 16,
780*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
781*3d8817e4Smiod   },
782*3d8817e4Smiod /* add $Rd,$Rs */
783*3d8817e4Smiod   {
784*3d8817e4Smiod     XSTORMY16_INSN_ADDGRGR, "addgrgr", "add", 16,
785*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
786*3d8817e4Smiod   },
787*3d8817e4Smiod /* add $Rd,#$imm4 */
788*3d8817e4Smiod   {
789*3d8817e4Smiod     XSTORMY16_INSN_ADDGRIMM4, "addgrimm4", "add", 16,
790*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
791*3d8817e4Smiod   },
792*3d8817e4Smiod /* add Rx,#$imm8 */
793*3d8817e4Smiod   {
794*3d8817e4Smiod     XSTORMY16_INSN_ADDIMM8, "addimm8", "add", 16,
795*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
796*3d8817e4Smiod   },
797*3d8817e4Smiod /* add $Rd,#$imm16 */
798*3d8817e4Smiod   {
799*3d8817e4Smiod     XSTORMY16_INSN_ADDGRIMM16, "addgrimm16", "add", 32,
800*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
801*3d8817e4Smiod   },
802*3d8817e4Smiod /* adc $Rd,$Rs */
803*3d8817e4Smiod   {
804*3d8817e4Smiod     XSTORMY16_INSN_ADCGRGR, "adcgrgr", "adc", 16,
805*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
806*3d8817e4Smiod   },
807*3d8817e4Smiod /* adc $Rd,#$imm4 */
808*3d8817e4Smiod   {
809*3d8817e4Smiod     XSTORMY16_INSN_ADCGRIMM4, "adcgrimm4", "adc", 16,
810*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
811*3d8817e4Smiod   },
812*3d8817e4Smiod /* adc Rx,#$imm8 */
813*3d8817e4Smiod   {
814*3d8817e4Smiod     XSTORMY16_INSN_ADCIMM8, "adcimm8", "adc", 16,
815*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
816*3d8817e4Smiod   },
817*3d8817e4Smiod /* adc $Rd,#$imm16 */
818*3d8817e4Smiod   {
819*3d8817e4Smiod     XSTORMY16_INSN_ADCGRIMM16, "adcgrimm16", "adc", 32,
820*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
821*3d8817e4Smiod   },
822*3d8817e4Smiod /* sub $Rd,$Rs */
823*3d8817e4Smiod   {
824*3d8817e4Smiod     XSTORMY16_INSN_SUBGRGR, "subgrgr", "sub", 16,
825*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
826*3d8817e4Smiod   },
827*3d8817e4Smiod /* sub $Rd,#$imm4 */
828*3d8817e4Smiod   {
829*3d8817e4Smiod     XSTORMY16_INSN_SUBGRIMM4, "subgrimm4", "sub", 16,
830*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
831*3d8817e4Smiod   },
832*3d8817e4Smiod /* sub Rx,#$imm8 */
833*3d8817e4Smiod   {
834*3d8817e4Smiod     XSTORMY16_INSN_SUBIMM8, "subimm8", "sub", 16,
835*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
836*3d8817e4Smiod   },
837*3d8817e4Smiod /* sub $Rd,#$imm16 */
838*3d8817e4Smiod   {
839*3d8817e4Smiod     XSTORMY16_INSN_SUBGRIMM16, "subgrimm16", "sub", 32,
840*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
841*3d8817e4Smiod   },
842*3d8817e4Smiod /* sbc $Rd,$Rs */
843*3d8817e4Smiod   {
844*3d8817e4Smiod     XSTORMY16_INSN_SBCGRGR, "sbcgrgr", "sbc", 16,
845*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
846*3d8817e4Smiod   },
847*3d8817e4Smiod /* sbc $Rd,#$imm4 */
848*3d8817e4Smiod   {
849*3d8817e4Smiod     XSTORMY16_INSN_SBCGRIMM4, "sbcgrimm4", "sbc", 16,
850*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
851*3d8817e4Smiod   },
852*3d8817e4Smiod /* sbc Rx,#$imm8 */
853*3d8817e4Smiod   {
854*3d8817e4Smiod     XSTORMY16_INSN_SBCGRIMM8, "sbcgrimm8", "sbc", 16,
855*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
856*3d8817e4Smiod   },
857*3d8817e4Smiod /* sbc $Rd,#$imm16 */
858*3d8817e4Smiod   {
859*3d8817e4Smiod     XSTORMY16_INSN_SBCGRIMM16, "sbcgrimm16", "sbc", 32,
860*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
861*3d8817e4Smiod   },
862*3d8817e4Smiod /* inc $Rd,#$imm2 */
863*3d8817e4Smiod   {
864*3d8817e4Smiod     XSTORMY16_INSN_INCGRIMM2, "incgrimm2", "inc", 16,
865*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
866*3d8817e4Smiod   },
867*3d8817e4Smiod /* dec $Rd,#$imm2 */
868*3d8817e4Smiod   {
869*3d8817e4Smiod     XSTORMY16_INSN_DECGRIMM2, "decgrimm2", "dec", 16,
870*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
871*3d8817e4Smiod   },
872*3d8817e4Smiod /* rrc $Rd,$Rs */
873*3d8817e4Smiod   {
874*3d8817e4Smiod     XSTORMY16_INSN_RRCGRGR, "rrcgrgr", "rrc", 16,
875*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
876*3d8817e4Smiod   },
877*3d8817e4Smiod /* rrc $Rd,#$imm4 */
878*3d8817e4Smiod   {
879*3d8817e4Smiod     XSTORMY16_INSN_RRCGRIMM4, "rrcgrimm4", "rrc", 16,
880*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
881*3d8817e4Smiod   },
882*3d8817e4Smiod /* rlc $Rd,$Rs */
883*3d8817e4Smiod   {
884*3d8817e4Smiod     XSTORMY16_INSN_RLCGRGR, "rlcgrgr", "rlc", 16,
885*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
886*3d8817e4Smiod   },
887*3d8817e4Smiod /* rlc $Rd,#$imm4 */
888*3d8817e4Smiod   {
889*3d8817e4Smiod     XSTORMY16_INSN_RLCGRIMM4, "rlcgrimm4", "rlc", 16,
890*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
891*3d8817e4Smiod   },
892*3d8817e4Smiod /* shr $Rd,$Rs */
893*3d8817e4Smiod   {
894*3d8817e4Smiod     XSTORMY16_INSN_SHRGRGR, "shrgrgr", "shr", 16,
895*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
896*3d8817e4Smiod   },
897*3d8817e4Smiod /* shr $Rd,#$imm4 */
898*3d8817e4Smiod   {
899*3d8817e4Smiod     XSTORMY16_INSN_SHRGRIMM, "shrgrimm", "shr", 16,
900*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
901*3d8817e4Smiod   },
902*3d8817e4Smiod /* shl $Rd,$Rs */
903*3d8817e4Smiod   {
904*3d8817e4Smiod     XSTORMY16_INSN_SHLGRGR, "shlgrgr", "shl", 16,
905*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
906*3d8817e4Smiod   },
907*3d8817e4Smiod /* shl $Rd,#$imm4 */
908*3d8817e4Smiod   {
909*3d8817e4Smiod     XSTORMY16_INSN_SHLGRIMM, "shlgrimm", "shl", 16,
910*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
911*3d8817e4Smiod   },
912*3d8817e4Smiod /* asr $Rd,$Rs */
913*3d8817e4Smiod   {
914*3d8817e4Smiod     XSTORMY16_INSN_ASRGRGR, "asrgrgr", "asr", 16,
915*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
916*3d8817e4Smiod   },
917*3d8817e4Smiod /* asr $Rd,#$imm4 */
918*3d8817e4Smiod   {
919*3d8817e4Smiod     XSTORMY16_INSN_ASRGRIMM, "asrgrimm", "asr", 16,
920*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
921*3d8817e4Smiod   },
922*3d8817e4Smiod /* set1 $Rd,#$imm4 */
923*3d8817e4Smiod   {
924*3d8817e4Smiod     XSTORMY16_INSN_SET1GRIMM, "set1grimm", "set1", 16,
925*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
926*3d8817e4Smiod   },
927*3d8817e4Smiod /* set1 $Rd,$Rs */
928*3d8817e4Smiod   {
929*3d8817e4Smiod     XSTORMY16_INSN_SET1GRGR, "set1grgr", "set1", 16,
930*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
931*3d8817e4Smiod   },
932*3d8817e4Smiod /* set1 $lmem8,#$imm3 */
933*3d8817e4Smiod   {
934*3d8817e4Smiod     XSTORMY16_INSN_SET1LMEMIMM, "set1lmemimm", "set1", 16,
935*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
936*3d8817e4Smiod   },
937*3d8817e4Smiod /* set1 $hmem8,#$imm3 */
938*3d8817e4Smiod   {
939*3d8817e4Smiod     XSTORMY16_INSN_SET1HMEMIMM, "set1hmemimm", "set1", 16,
940*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
941*3d8817e4Smiod   },
942*3d8817e4Smiod /* clr1 $Rd,#$imm4 */
943*3d8817e4Smiod   {
944*3d8817e4Smiod     XSTORMY16_INSN_CLR1GRIMM, "clr1grimm", "clr1", 16,
945*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
946*3d8817e4Smiod   },
947*3d8817e4Smiod /* clr1 $Rd,$Rs */
948*3d8817e4Smiod   {
949*3d8817e4Smiod     XSTORMY16_INSN_CLR1GRGR, "clr1grgr", "clr1", 16,
950*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
951*3d8817e4Smiod   },
952*3d8817e4Smiod /* clr1 $lmem8,#$imm3 */
953*3d8817e4Smiod   {
954*3d8817e4Smiod     XSTORMY16_INSN_CLR1LMEMIMM, "clr1lmemimm", "clr1", 16,
955*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
956*3d8817e4Smiod   },
957*3d8817e4Smiod /* clr1 $hmem8,#$imm3 */
958*3d8817e4Smiod   {
959*3d8817e4Smiod     XSTORMY16_INSN_CLR1HMEMIMM, "clr1hmemimm", "clr1", 16,
960*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
961*3d8817e4Smiod   },
962*3d8817e4Smiod /* cbw $Rd */
963*3d8817e4Smiod   {
964*3d8817e4Smiod     XSTORMY16_INSN_CBWGR, "cbwgr", "cbw", 16,
965*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
966*3d8817e4Smiod   },
967*3d8817e4Smiod /* rev $Rd */
968*3d8817e4Smiod   {
969*3d8817e4Smiod     XSTORMY16_INSN_REVGR, "revgr", "rev", 16,
970*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
971*3d8817e4Smiod   },
972*3d8817e4Smiod /* b$bcond5 $Rd,$Rs,$rel12 */
973*3d8817e4Smiod   {
974*3d8817e4Smiod     XSTORMY16_INSN_BCCGRGR, "bccgrgr", "b", 32,
975*3d8817e4Smiod     { 0|A(COND_CTI), { { { (1<<MACH_BASE), 0 } } } }
976*3d8817e4Smiod   },
977*3d8817e4Smiod /* b$bcond5 $Rm,#$imm8,$rel12 */
978*3d8817e4Smiod   {
979*3d8817e4Smiod     XSTORMY16_INSN_BCCGRIMM8, "bccgrimm8", "b", 32,
980*3d8817e4Smiod     { 0|A(COND_CTI), { { { (1<<MACH_BASE), 0 } } } }
981*3d8817e4Smiod   },
982*3d8817e4Smiod /* b$bcond2 Rx,#$imm16,${rel8-4} */
983*3d8817e4Smiod   {
984*3d8817e4Smiod     XSTORMY16_INSN_BCCIMM16, "bccimm16", "b", 32,
985*3d8817e4Smiod     { 0|A(COND_CTI), { { { (1<<MACH_BASE), 0 } } } }
986*3d8817e4Smiod   },
987*3d8817e4Smiod /* bn $Rd,#$imm4,$rel12 */
988*3d8817e4Smiod   {
989*3d8817e4Smiod     XSTORMY16_INSN_BNGRIMM4, "bngrimm4", "bn", 32,
990*3d8817e4Smiod     { 0|A(COND_CTI), { { { (1<<MACH_BASE), 0 } } } }
991*3d8817e4Smiod   },
992*3d8817e4Smiod /* bn $Rd,$Rs,$rel12 */
993*3d8817e4Smiod   {
994*3d8817e4Smiod     XSTORMY16_INSN_BNGRGR, "bngrgr", "bn", 32,
995*3d8817e4Smiod     { 0|A(COND_CTI), { { { (1<<MACH_BASE), 0 } } } }
996*3d8817e4Smiod   },
997*3d8817e4Smiod /* bn $lmem8,#$imm3b,$rel12 */
998*3d8817e4Smiod   {
999*3d8817e4Smiod     XSTORMY16_INSN_BNLMEMIMM, "bnlmemimm", "bn", 32,
1000*3d8817e4Smiod     { 0|A(COND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1001*3d8817e4Smiod   },
1002*3d8817e4Smiod /* bn $hmem8,#$imm3b,$rel12 */
1003*3d8817e4Smiod   {
1004*3d8817e4Smiod     XSTORMY16_INSN_BNHMEMIMM, "bnhmemimm", "bn", 32,
1005*3d8817e4Smiod     { 0|A(COND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1006*3d8817e4Smiod   },
1007*3d8817e4Smiod /* bp $Rd,#$imm4,$rel12 */
1008*3d8817e4Smiod   {
1009*3d8817e4Smiod     XSTORMY16_INSN_BPGRIMM4, "bpgrimm4", "bp", 32,
1010*3d8817e4Smiod     { 0|A(COND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1011*3d8817e4Smiod   },
1012*3d8817e4Smiod /* bp $Rd,$Rs,$rel12 */
1013*3d8817e4Smiod   {
1014*3d8817e4Smiod     XSTORMY16_INSN_BPGRGR, "bpgrgr", "bp", 32,
1015*3d8817e4Smiod     { 0|A(COND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1016*3d8817e4Smiod   },
1017*3d8817e4Smiod /* bp $lmem8,#$imm3b,$rel12 */
1018*3d8817e4Smiod   {
1019*3d8817e4Smiod     XSTORMY16_INSN_BPLMEMIMM, "bplmemimm", "bp", 32,
1020*3d8817e4Smiod     { 0|A(COND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1021*3d8817e4Smiod   },
1022*3d8817e4Smiod /* bp $hmem8,#$imm3b,$rel12 */
1023*3d8817e4Smiod   {
1024*3d8817e4Smiod     XSTORMY16_INSN_BPHMEMIMM, "bphmemimm", "bp", 32,
1025*3d8817e4Smiod     { 0|A(COND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1026*3d8817e4Smiod   },
1027*3d8817e4Smiod /* b$bcond2 ${rel8-2} */
1028*3d8817e4Smiod   {
1029*3d8817e4Smiod     XSTORMY16_INSN_BCC, "bcc", "b", 16,
1030*3d8817e4Smiod     { 0|A(COND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1031*3d8817e4Smiod   },
1032*3d8817e4Smiod /* br $Rd */
1033*3d8817e4Smiod   {
1034*3d8817e4Smiod     XSTORMY16_INSN_BGR, "bgr", "br", 16,
1035*3d8817e4Smiod     { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1036*3d8817e4Smiod   },
1037*3d8817e4Smiod /* br $rel12a */
1038*3d8817e4Smiod   {
1039*3d8817e4Smiod     XSTORMY16_INSN_BR, "br", "br", 16,
1040*3d8817e4Smiod     { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1041*3d8817e4Smiod   },
1042*3d8817e4Smiod /* jmp $Rbj,$Rd */
1043*3d8817e4Smiod   {
1044*3d8817e4Smiod     XSTORMY16_INSN_JMP, "jmp", "jmp", 16,
1045*3d8817e4Smiod     { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1046*3d8817e4Smiod   },
1047*3d8817e4Smiod /* jmpf $abs24 */
1048*3d8817e4Smiod   {
1049*3d8817e4Smiod     XSTORMY16_INSN_JMPF, "jmpf", "jmpf", 32,
1050*3d8817e4Smiod     { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1051*3d8817e4Smiod   },
1052*3d8817e4Smiod /* callr $Rd */
1053*3d8817e4Smiod   {
1054*3d8817e4Smiod     XSTORMY16_INSN_CALLRGR, "callrgr", "callr", 16,
1055*3d8817e4Smiod     { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1056*3d8817e4Smiod   },
1057*3d8817e4Smiod /* callr $rel12a */
1058*3d8817e4Smiod   {
1059*3d8817e4Smiod     XSTORMY16_INSN_CALLRIMM, "callrimm", "callr", 16,
1060*3d8817e4Smiod     { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1061*3d8817e4Smiod   },
1062*3d8817e4Smiod /* call $Rbj,$Rd */
1063*3d8817e4Smiod   {
1064*3d8817e4Smiod     XSTORMY16_INSN_CALLGR, "callgr", "call", 16,
1065*3d8817e4Smiod     { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1066*3d8817e4Smiod   },
1067*3d8817e4Smiod /* callf $abs24 */
1068*3d8817e4Smiod   {
1069*3d8817e4Smiod     XSTORMY16_INSN_CALLFIMM, "callfimm", "callf", 32,
1070*3d8817e4Smiod     { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1071*3d8817e4Smiod   },
1072*3d8817e4Smiod /* icallr $Rd */
1073*3d8817e4Smiod   {
1074*3d8817e4Smiod     XSTORMY16_INSN_ICALLRGR, "icallrgr", "icallr", 16,
1075*3d8817e4Smiod     { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1076*3d8817e4Smiod   },
1077*3d8817e4Smiod /* icall $Rbj,$Rd */
1078*3d8817e4Smiod   {
1079*3d8817e4Smiod     XSTORMY16_INSN_ICALLGR, "icallgr", "icall", 16,
1080*3d8817e4Smiod     { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1081*3d8817e4Smiod   },
1082*3d8817e4Smiod /* icallf $abs24 */
1083*3d8817e4Smiod   {
1084*3d8817e4Smiod     XSTORMY16_INSN_ICALLFIMM, "icallfimm", "icallf", 32,
1085*3d8817e4Smiod     { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1086*3d8817e4Smiod   },
1087*3d8817e4Smiod /* iret */
1088*3d8817e4Smiod   {
1089*3d8817e4Smiod     XSTORMY16_INSN_IRET, "iret", "iret", 16,
1090*3d8817e4Smiod     { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1091*3d8817e4Smiod   },
1092*3d8817e4Smiod /* ret */
1093*3d8817e4Smiod   {
1094*3d8817e4Smiod     XSTORMY16_INSN_RET, "ret", "ret", 16,
1095*3d8817e4Smiod     { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
1096*3d8817e4Smiod   },
1097*3d8817e4Smiod /* mul */
1098*3d8817e4Smiod   {
1099*3d8817e4Smiod     XSTORMY16_INSN_MUL, "mul", "mul", 16,
1100*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
1101*3d8817e4Smiod   },
1102*3d8817e4Smiod /* div */
1103*3d8817e4Smiod   {
1104*3d8817e4Smiod     XSTORMY16_INSN_DIV, "div", "div", 16,
1105*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
1106*3d8817e4Smiod   },
1107*3d8817e4Smiod /* sdiv */
1108*3d8817e4Smiod   {
1109*3d8817e4Smiod     XSTORMY16_INSN_SDIV, "sdiv", "sdiv", 16,
1110*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
1111*3d8817e4Smiod   },
1112*3d8817e4Smiod /* sdivlh */
1113*3d8817e4Smiod   {
1114*3d8817e4Smiod     XSTORMY16_INSN_SDIVLH, "sdivlh", "sdivlh", 16,
1115*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
1116*3d8817e4Smiod   },
1117*3d8817e4Smiod /* divlh */
1118*3d8817e4Smiod   {
1119*3d8817e4Smiod     XSTORMY16_INSN_DIVLH, "divlh", "divlh", 16,
1120*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
1121*3d8817e4Smiod   },
1122*3d8817e4Smiod /* reset */
1123*3d8817e4Smiod   {
1124*3d8817e4Smiod     XSTORMY16_INSN_RESET, "reset", "reset", 16,
1125*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
1126*3d8817e4Smiod   },
1127*3d8817e4Smiod /* nop */
1128*3d8817e4Smiod   {
1129*3d8817e4Smiod     XSTORMY16_INSN_NOP, "nop", "nop", 16,
1130*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
1131*3d8817e4Smiod   },
1132*3d8817e4Smiod /* halt */
1133*3d8817e4Smiod   {
1134*3d8817e4Smiod     XSTORMY16_INSN_HALT, "halt", "halt", 16,
1135*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
1136*3d8817e4Smiod   },
1137*3d8817e4Smiod /* hold */
1138*3d8817e4Smiod   {
1139*3d8817e4Smiod     XSTORMY16_INSN_HOLD, "hold", "hold", 16,
1140*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
1141*3d8817e4Smiod   },
1142*3d8817e4Smiod /* holdx */
1143*3d8817e4Smiod   {
1144*3d8817e4Smiod     XSTORMY16_INSN_HOLDX, "holdx", "holdx", 16,
1145*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
1146*3d8817e4Smiod   },
1147*3d8817e4Smiod /* brk */
1148*3d8817e4Smiod   {
1149*3d8817e4Smiod     XSTORMY16_INSN_BRK, "brk", "brk", 16,
1150*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
1151*3d8817e4Smiod   },
1152*3d8817e4Smiod /* --unused-- */
1153*3d8817e4Smiod   {
1154*3d8817e4Smiod     XSTORMY16_INSN_SYSCALL, "syscall", "--unused--", 16,
1155*3d8817e4Smiod     { 0, { { { (1<<MACH_BASE), 0 } } } }
1156*3d8817e4Smiod   },
1157*3d8817e4Smiod };
1158*3d8817e4Smiod 
1159*3d8817e4Smiod #undef OP
1160*3d8817e4Smiod #undef A
1161*3d8817e4Smiod 
1162*3d8817e4Smiod /* Initialize anything needed to be done once, before any cpu_open call.  */
1163*3d8817e4Smiod 
1164*3d8817e4Smiod static void
init_tables(void)1165*3d8817e4Smiod init_tables (void)
1166*3d8817e4Smiod {
1167*3d8817e4Smiod }
1168*3d8817e4Smiod 
1169*3d8817e4Smiod static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
1170*3d8817e4Smiod static void build_hw_table      (CGEN_CPU_TABLE *);
1171*3d8817e4Smiod static void build_ifield_table  (CGEN_CPU_TABLE *);
1172*3d8817e4Smiod static void build_operand_table (CGEN_CPU_TABLE *);
1173*3d8817e4Smiod static void build_insn_table    (CGEN_CPU_TABLE *);
1174*3d8817e4Smiod static void xstormy16_cgen_rebuild_tables (CGEN_CPU_TABLE *);
1175*3d8817e4Smiod 
1176*3d8817e4Smiod /* Subroutine of xstormy16_cgen_cpu_open to look up a mach via its bfd name.  */
1177*3d8817e4Smiod 
1178*3d8817e4Smiod static const CGEN_MACH *
lookup_mach_via_bfd_name(const CGEN_MACH * table,const char * name)1179*3d8817e4Smiod lookup_mach_via_bfd_name (const CGEN_MACH *table, const char *name)
1180*3d8817e4Smiod {
1181*3d8817e4Smiod   while (table->name)
1182*3d8817e4Smiod     {
1183*3d8817e4Smiod       if (strcmp (name, table->bfd_name) == 0)
1184*3d8817e4Smiod 	return table;
1185*3d8817e4Smiod       ++table;
1186*3d8817e4Smiod     }
1187*3d8817e4Smiod   abort ();
1188*3d8817e4Smiod }
1189*3d8817e4Smiod 
1190*3d8817e4Smiod /* Subroutine of xstormy16_cgen_cpu_open to build the hardware table.  */
1191*3d8817e4Smiod 
1192*3d8817e4Smiod static void
build_hw_table(CGEN_CPU_TABLE * cd)1193*3d8817e4Smiod build_hw_table (CGEN_CPU_TABLE *cd)
1194*3d8817e4Smiod {
1195*3d8817e4Smiod   int i;
1196*3d8817e4Smiod   int machs = cd->machs;
1197*3d8817e4Smiod   const CGEN_HW_ENTRY *init = & xstormy16_cgen_hw_table[0];
1198*3d8817e4Smiod   /* MAX_HW is only an upper bound on the number of selected entries.
1199*3d8817e4Smiod      However each entry is indexed by it's enum so there can be holes in
1200*3d8817e4Smiod      the table.  */
1201*3d8817e4Smiod   const CGEN_HW_ENTRY **selected =
1202*3d8817e4Smiod     (const CGEN_HW_ENTRY **) xmalloc (MAX_HW * sizeof (CGEN_HW_ENTRY *));
1203*3d8817e4Smiod 
1204*3d8817e4Smiod   cd->hw_table.init_entries = init;
1205*3d8817e4Smiod   cd->hw_table.entry_size = sizeof (CGEN_HW_ENTRY);
1206*3d8817e4Smiod   memset (selected, 0, MAX_HW * sizeof (CGEN_HW_ENTRY *));
1207*3d8817e4Smiod   /* ??? For now we just use machs to determine which ones we want.  */
1208*3d8817e4Smiod   for (i = 0; init[i].name != NULL; ++i)
1209*3d8817e4Smiod     if (CGEN_HW_ATTR_VALUE (&init[i], CGEN_HW_MACH)
1210*3d8817e4Smiod 	& machs)
1211*3d8817e4Smiod       selected[init[i].type] = &init[i];
1212*3d8817e4Smiod   cd->hw_table.entries = selected;
1213*3d8817e4Smiod   cd->hw_table.num_entries = MAX_HW;
1214*3d8817e4Smiod }
1215*3d8817e4Smiod 
1216*3d8817e4Smiod /* Subroutine of xstormy16_cgen_cpu_open to build the hardware table.  */
1217*3d8817e4Smiod 
1218*3d8817e4Smiod static void
build_ifield_table(CGEN_CPU_TABLE * cd)1219*3d8817e4Smiod build_ifield_table (CGEN_CPU_TABLE *cd)
1220*3d8817e4Smiod {
1221*3d8817e4Smiod   cd->ifld_table = & xstormy16_cgen_ifld_table[0];
1222*3d8817e4Smiod }
1223*3d8817e4Smiod 
1224*3d8817e4Smiod /* Subroutine of xstormy16_cgen_cpu_open to build the hardware table.  */
1225*3d8817e4Smiod 
1226*3d8817e4Smiod static void
build_operand_table(CGEN_CPU_TABLE * cd)1227*3d8817e4Smiod build_operand_table (CGEN_CPU_TABLE *cd)
1228*3d8817e4Smiod {
1229*3d8817e4Smiod   int i;
1230*3d8817e4Smiod   int machs = cd->machs;
1231*3d8817e4Smiod   const CGEN_OPERAND *init = & xstormy16_cgen_operand_table[0];
1232*3d8817e4Smiod   /* MAX_OPERANDS is only an upper bound on the number of selected entries.
1233*3d8817e4Smiod      However each entry is indexed by it's enum so there can be holes in
1234*3d8817e4Smiod      the table.  */
1235*3d8817e4Smiod   const CGEN_OPERAND **selected = xmalloc (MAX_OPERANDS * sizeof (* selected));
1236*3d8817e4Smiod 
1237*3d8817e4Smiod   cd->operand_table.init_entries = init;
1238*3d8817e4Smiod   cd->operand_table.entry_size = sizeof (CGEN_OPERAND);
1239*3d8817e4Smiod   memset (selected, 0, MAX_OPERANDS * sizeof (CGEN_OPERAND *));
1240*3d8817e4Smiod   /* ??? For now we just use mach to determine which ones we want.  */
1241*3d8817e4Smiod   for (i = 0; init[i].name != NULL; ++i)
1242*3d8817e4Smiod     if (CGEN_OPERAND_ATTR_VALUE (&init[i], CGEN_OPERAND_MACH)
1243*3d8817e4Smiod 	& machs)
1244*3d8817e4Smiod       selected[init[i].type] = &init[i];
1245*3d8817e4Smiod   cd->operand_table.entries = selected;
1246*3d8817e4Smiod   cd->operand_table.num_entries = MAX_OPERANDS;
1247*3d8817e4Smiod }
1248*3d8817e4Smiod 
1249*3d8817e4Smiod /* Subroutine of xstormy16_cgen_cpu_open to build the hardware table.
1250*3d8817e4Smiod    ??? This could leave out insns not supported by the specified mach/isa,
1251*3d8817e4Smiod    but that would cause errors like "foo only supported by bar" to become
1252*3d8817e4Smiod    "unknown insn", so for now we include all insns and require the app to
1253*3d8817e4Smiod    do the checking later.
1254*3d8817e4Smiod    ??? On the other hand, parsing of such insns may require their hardware or
1255*3d8817e4Smiod    operand elements to be in the table [which they mightn't be].  */
1256*3d8817e4Smiod 
1257*3d8817e4Smiod static void
build_insn_table(CGEN_CPU_TABLE * cd)1258*3d8817e4Smiod build_insn_table (CGEN_CPU_TABLE *cd)
1259*3d8817e4Smiod {
1260*3d8817e4Smiod   int i;
1261*3d8817e4Smiod   const CGEN_IBASE *ib = & xstormy16_cgen_insn_table[0];
1262*3d8817e4Smiod   CGEN_INSN *insns = xmalloc (MAX_INSNS * sizeof (CGEN_INSN));
1263*3d8817e4Smiod 
1264*3d8817e4Smiod   memset (insns, 0, MAX_INSNS * sizeof (CGEN_INSN));
1265*3d8817e4Smiod   for (i = 0; i < MAX_INSNS; ++i)
1266*3d8817e4Smiod     insns[i].base = &ib[i];
1267*3d8817e4Smiod   cd->insn_table.init_entries = insns;
1268*3d8817e4Smiod   cd->insn_table.entry_size = sizeof (CGEN_IBASE);
1269*3d8817e4Smiod   cd->insn_table.num_init_entries = MAX_INSNS;
1270*3d8817e4Smiod }
1271*3d8817e4Smiod 
1272*3d8817e4Smiod /* Subroutine of xstormy16_cgen_cpu_open to rebuild the tables.  */
1273*3d8817e4Smiod 
1274*3d8817e4Smiod static void
xstormy16_cgen_rebuild_tables(CGEN_CPU_TABLE * cd)1275*3d8817e4Smiod xstormy16_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
1276*3d8817e4Smiod {
1277*3d8817e4Smiod   int i;
1278*3d8817e4Smiod   CGEN_BITSET *isas = cd->isas;
1279*3d8817e4Smiod   unsigned int machs = cd->machs;
1280*3d8817e4Smiod 
1281*3d8817e4Smiod   cd->int_insn_p = CGEN_INT_INSN_P;
1282*3d8817e4Smiod 
1283*3d8817e4Smiod   /* Data derived from the isa spec.  */
1284*3d8817e4Smiod #define UNSET (CGEN_SIZE_UNKNOWN + 1)
1285*3d8817e4Smiod   cd->default_insn_bitsize = UNSET;
1286*3d8817e4Smiod   cd->base_insn_bitsize = UNSET;
1287*3d8817e4Smiod   cd->min_insn_bitsize = 65535; /* Some ridiculously big number.  */
1288*3d8817e4Smiod   cd->max_insn_bitsize = 0;
1289*3d8817e4Smiod   for (i = 0; i < MAX_ISAS; ++i)
1290*3d8817e4Smiod     if (cgen_bitset_contains (isas, i))
1291*3d8817e4Smiod       {
1292*3d8817e4Smiod 	const CGEN_ISA *isa = & xstormy16_cgen_isa_table[i];
1293*3d8817e4Smiod 
1294*3d8817e4Smiod 	/* Default insn sizes of all selected isas must be
1295*3d8817e4Smiod 	   equal or we set the result to 0, meaning "unknown".  */
1296*3d8817e4Smiod 	if (cd->default_insn_bitsize == UNSET)
1297*3d8817e4Smiod 	  cd->default_insn_bitsize = isa->default_insn_bitsize;
1298*3d8817e4Smiod 	else if (isa->default_insn_bitsize == cd->default_insn_bitsize)
1299*3d8817e4Smiod 	  ; /* This is ok.  */
1300*3d8817e4Smiod 	else
1301*3d8817e4Smiod 	  cd->default_insn_bitsize = CGEN_SIZE_UNKNOWN;
1302*3d8817e4Smiod 
1303*3d8817e4Smiod 	/* Base insn sizes of all selected isas must be equal
1304*3d8817e4Smiod 	   or we set the result to 0, meaning "unknown".  */
1305*3d8817e4Smiod 	if (cd->base_insn_bitsize == UNSET)
1306*3d8817e4Smiod 	  cd->base_insn_bitsize = isa->base_insn_bitsize;
1307*3d8817e4Smiod 	else if (isa->base_insn_bitsize == cd->base_insn_bitsize)
1308*3d8817e4Smiod 	  ; /* This is ok.  */
1309*3d8817e4Smiod 	else
1310*3d8817e4Smiod 	  cd->base_insn_bitsize = CGEN_SIZE_UNKNOWN;
1311*3d8817e4Smiod 
1312*3d8817e4Smiod 	/* Set min,max insn sizes.  */
1313*3d8817e4Smiod 	if (isa->min_insn_bitsize < cd->min_insn_bitsize)
1314*3d8817e4Smiod 	  cd->min_insn_bitsize = isa->min_insn_bitsize;
1315*3d8817e4Smiod 	if (isa->max_insn_bitsize > cd->max_insn_bitsize)
1316*3d8817e4Smiod 	  cd->max_insn_bitsize = isa->max_insn_bitsize;
1317*3d8817e4Smiod       }
1318*3d8817e4Smiod 
1319*3d8817e4Smiod   /* Data derived from the mach spec.  */
1320*3d8817e4Smiod   for (i = 0; i < MAX_MACHS; ++i)
1321*3d8817e4Smiod     if (((1 << i) & machs) != 0)
1322*3d8817e4Smiod       {
1323*3d8817e4Smiod 	const CGEN_MACH *mach = & xstormy16_cgen_mach_table[i];
1324*3d8817e4Smiod 
1325*3d8817e4Smiod 	if (mach->insn_chunk_bitsize != 0)
1326*3d8817e4Smiod 	{
1327*3d8817e4Smiod 	  if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
1328*3d8817e4Smiod 	    {
1329*3d8817e4Smiod 	      fprintf (stderr, "xstormy16_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
1330*3d8817e4Smiod 		       cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
1331*3d8817e4Smiod 	      abort ();
1332*3d8817e4Smiod 	    }
1333*3d8817e4Smiod 
1334*3d8817e4Smiod  	  cd->insn_chunk_bitsize = mach->insn_chunk_bitsize;
1335*3d8817e4Smiod 	}
1336*3d8817e4Smiod       }
1337*3d8817e4Smiod 
1338*3d8817e4Smiod   /* Determine which hw elements are used by MACH.  */
1339*3d8817e4Smiod   build_hw_table (cd);
1340*3d8817e4Smiod 
1341*3d8817e4Smiod   /* Build the ifield table.  */
1342*3d8817e4Smiod   build_ifield_table (cd);
1343*3d8817e4Smiod 
1344*3d8817e4Smiod   /* Determine which operands are used by MACH/ISA.  */
1345*3d8817e4Smiod   build_operand_table (cd);
1346*3d8817e4Smiod 
1347*3d8817e4Smiod   /* Build the instruction table.  */
1348*3d8817e4Smiod   build_insn_table (cd);
1349*3d8817e4Smiod }
1350*3d8817e4Smiod 
1351*3d8817e4Smiod /* Initialize a cpu table and return a descriptor.
1352*3d8817e4Smiod    It's much like opening a file, and must be the first function called.
1353*3d8817e4Smiod    The arguments are a set of (type/value) pairs, terminated with
1354*3d8817e4Smiod    CGEN_CPU_OPEN_END.
1355*3d8817e4Smiod 
1356*3d8817e4Smiod    Currently supported values:
1357*3d8817e4Smiod    CGEN_CPU_OPEN_ISAS:    bitmap of values in enum isa_attr
1358*3d8817e4Smiod    CGEN_CPU_OPEN_MACHS:   bitmap of values in enum mach_attr
1359*3d8817e4Smiod    CGEN_CPU_OPEN_BFDMACH: specify 1 mach using bfd name
1360*3d8817e4Smiod    CGEN_CPU_OPEN_ENDIAN:  specify endian choice
1361*3d8817e4Smiod    CGEN_CPU_OPEN_END:     terminates arguments
1362*3d8817e4Smiod 
1363*3d8817e4Smiod    ??? Simultaneous multiple isas might not make sense, but it's not (yet)
1364*3d8817e4Smiod    precluded.
1365*3d8817e4Smiod 
1366*3d8817e4Smiod    ??? We only support ISO C stdargs here, not K&R.
1367*3d8817e4Smiod    Laziness, plus experiment to see if anything requires K&R - eventually
1368*3d8817e4Smiod    K&R will no longer be supported - e.g. GDB is currently trying this.  */
1369*3d8817e4Smiod 
1370*3d8817e4Smiod CGEN_CPU_DESC
xstormy16_cgen_cpu_open(enum cgen_cpu_open_arg arg_type,...)1371*3d8817e4Smiod xstormy16_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
1372*3d8817e4Smiod {
1373*3d8817e4Smiod   CGEN_CPU_TABLE *cd = (CGEN_CPU_TABLE *) xmalloc (sizeof (CGEN_CPU_TABLE));
1374*3d8817e4Smiod   static int init_p;
1375*3d8817e4Smiod   CGEN_BITSET *isas = 0;  /* 0 = "unspecified" */
1376*3d8817e4Smiod   unsigned int machs = 0; /* 0 = "unspecified" */
1377*3d8817e4Smiod   enum cgen_endian endian = CGEN_ENDIAN_UNKNOWN;
1378*3d8817e4Smiod   va_list ap;
1379*3d8817e4Smiod 
1380*3d8817e4Smiod   if (! init_p)
1381*3d8817e4Smiod     {
1382*3d8817e4Smiod       init_tables ();
1383*3d8817e4Smiod       init_p = 1;
1384*3d8817e4Smiod     }
1385*3d8817e4Smiod 
1386*3d8817e4Smiod   memset (cd, 0, sizeof (*cd));
1387*3d8817e4Smiod 
1388*3d8817e4Smiod   va_start (ap, arg_type);
1389*3d8817e4Smiod   while (arg_type != CGEN_CPU_OPEN_END)
1390*3d8817e4Smiod     {
1391*3d8817e4Smiod       switch (arg_type)
1392*3d8817e4Smiod 	{
1393*3d8817e4Smiod 	case CGEN_CPU_OPEN_ISAS :
1394*3d8817e4Smiod 	  isas = va_arg (ap, CGEN_BITSET *);
1395*3d8817e4Smiod 	  break;
1396*3d8817e4Smiod 	case CGEN_CPU_OPEN_MACHS :
1397*3d8817e4Smiod 	  machs = va_arg (ap, unsigned int);
1398*3d8817e4Smiod 	  break;
1399*3d8817e4Smiod 	case CGEN_CPU_OPEN_BFDMACH :
1400*3d8817e4Smiod 	  {
1401*3d8817e4Smiod 	    const char *name = va_arg (ap, const char *);
1402*3d8817e4Smiod 	    const CGEN_MACH *mach =
1403*3d8817e4Smiod 	      lookup_mach_via_bfd_name (xstormy16_cgen_mach_table, name);
1404*3d8817e4Smiod 
1405*3d8817e4Smiod 	    machs |= 1 << mach->num;
1406*3d8817e4Smiod 	    break;
1407*3d8817e4Smiod 	  }
1408*3d8817e4Smiod 	case CGEN_CPU_OPEN_ENDIAN :
1409*3d8817e4Smiod 	  endian = va_arg (ap, enum cgen_endian);
1410*3d8817e4Smiod 	  break;
1411*3d8817e4Smiod 	default :
1412*3d8817e4Smiod 	  fprintf (stderr, "xstormy16_cgen_cpu_open: unsupported argument `%d'\n",
1413*3d8817e4Smiod 		   arg_type);
1414*3d8817e4Smiod 	  abort (); /* ??? return NULL? */
1415*3d8817e4Smiod 	}
1416*3d8817e4Smiod       arg_type = va_arg (ap, enum cgen_cpu_open_arg);
1417*3d8817e4Smiod     }
1418*3d8817e4Smiod   va_end (ap);
1419*3d8817e4Smiod 
1420*3d8817e4Smiod   /* Mach unspecified means "all".  */
1421*3d8817e4Smiod   if (machs == 0)
1422*3d8817e4Smiod     machs = (1 << MAX_MACHS) - 1;
1423*3d8817e4Smiod   /* Base mach is always selected.  */
1424*3d8817e4Smiod   machs |= 1;
1425*3d8817e4Smiod   if (endian == CGEN_ENDIAN_UNKNOWN)
1426*3d8817e4Smiod     {
1427*3d8817e4Smiod       /* ??? If target has only one, could have a default.  */
1428*3d8817e4Smiod       fprintf (stderr, "xstormy16_cgen_cpu_open: no endianness specified\n");
1429*3d8817e4Smiod       abort ();
1430*3d8817e4Smiod     }
1431*3d8817e4Smiod 
1432*3d8817e4Smiod   cd->isas = cgen_bitset_copy (isas);
1433*3d8817e4Smiod   cd->machs = machs;
1434*3d8817e4Smiod   cd->endian = endian;
1435*3d8817e4Smiod   /* FIXME: for the sparc case we can determine insn-endianness statically.
1436*3d8817e4Smiod      The worry here is where both data and insn endian can be independently
1437*3d8817e4Smiod      chosen, in which case this function will need another argument.
1438*3d8817e4Smiod      Actually, will want to allow for more arguments in the future anyway.  */
1439*3d8817e4Smiod   cd->insn_endian = endian;
1440*3d8817e4Smiod 
1441*3d8817e4Smiod   /* Table (re)builder.  */
1442*3d8817e4Smiod   cd->rebuild_tables = xstormy16_cgen_rebuild_tables;
1443*3d8817e4Smiod   xstormy16_cgen_rebuild_tables (cd);
1444*3d8817e4Smiod 
1445*3d8817e4Smiod   /* Default to not allowing signed overflow.  */
1446*3d8817e4Smiod   cd->signed_overflow_ok_p = 0;
1447*3d8817e4Smiod 
1448*3d8817e4Smiod   return (CGEN_CPU_DESC) cd;
1449*3d8817e4Smiod }
1450*3d8817e4Smiod 
1451*3d8817e4Smiod /* Cover fn to xstormy16_cgen_cpu_open to handle the simple case of 1 isa, 1 mach.
1452*3d8817e4Smiod    MACH_NAME is the bfd name of the mach.  */
1453*3d8817e4Smiod 
1454*3d8817e4Smiod CGEN_CPU_DESC
xstormy16_cgen_cpu_open_1(const char * mach_name,enum cgen_endian endian)1455*3d8817e4Smiod xstormy16_cgen_cpu_open_1 (const char *mach_name, enum cgen_endian endian)
1456*3d8817e4Smiod {
1457*3d8817e4Smiod   return xstormy16_cgen_cpu_open (CGEN_CPU_OPEN_BFDMACH, mach_name,
1458*3d8817e4Smiod 			       CGEN_CPU_OPEN_ENDIAN, endian,
1459*3d8817e4Smiod 			       CGEN_CPU_OPEN_END);
1460*3d8817e4Smiod }
1461*3d8817e4Smiod 
1462*3d8817e4Smiod /* Close a cpu table.
1463*3d8817e4Smiod    ??? This can live in a machine independent file, but there's currently
1464*3d8817e4Smiod    no place to put this file (there's no libcgen).  libopcodes is the wrong
1465*3d8817e4Smiod    place as some simulator ports use this but they don't use libopcodes.  */
1466*3d8817e4Smiod 
1467*3d8817e4Smiod void
xstormy16_cgen_cpu_close(CGEN_CPU_DESC cd)1468*3d8817e4Smiod xstormy16_cgen_cpu_close (CGEN_CPU_DESC cd)
1469*3d8817e4Smiod {
1470*3d8817e4Smiod   unsigned int i;
1471*3d8817e4Smiod   const CGEN_INSN *insns;
1472*3d8817e4Smiod 
1473*3d8817e4Smiod   if (cd->macro_insn_table.init_entries)
1474*3d8817e4Smiod     {
1475*3d8817e4Smiod       insns = cd->macro_insn_table.init_entries;
1476*3d8817e4Smiod       for (i = 0; i < cd->macro_insn_table.num_init_entries; ++i, ++insns)
1477*3d8817e4Smiod 	if (CGEN_INSN_RX ((insns)))
1478*3d8817e4Smiod 	  regfree (CGEN_INSN_RX (insns));
1479*3d8817e4Smiod     }
1480*3d8817e4Smiod 
1481*3d8817e4Smiod   if (cd->insn_table.init_entries)
1482*3d8817e4Smiod     {
1483*3d8817e4Smiod       insns = cd->insn_table.init_entries;
1484*3d8817e4Smiod       for (i = 0; i < cd->insn_table.num_init_entries; ++i, ++insns)
1485*3d8817e4Smiod 	if (CGEN_INSN_RX (insns))
1486*3d8817e4Smiod 	  regfree (CGEN_INSN_RX (insns));
1487*3d8817e4Smiod     }
1488*3d8817e4Smiod 
1489*3d8817e4Smiod   if (cd->macro_insn_table.init_entries)
1490*3d8817e4Smiod     free ((CGEN_INSN *) cd->macro_insn_table.init_entries);
1491*3d8817e4Smiod 
1492*3d8817e4Smiod   if (cd->insn_table.init_entries)
1493*3d8817e4Smiod     free ((CGEN_INSN *) cd->insn_table.init_entries);
1494*3d8817e4Smiod 
1495*3d8817e4Smiod   if (cd->hw_table.entries)
1496*3d8817e4Smiod     free ((CGEN_HW_ENTRY *) cd->hw_table.entries);
1497*3d8817e4Smiod 
1498*3d8817e4Smiod   if (cd->operand_table.entries)
1499*3d8817e4Smiod     free ((CGEN_HW_ENTRY *) cd->operand_table.entries);
1500*3d8817e4Smiod 
1501*3d8817e4Smiod   free (cd);
1502*3d8817e4Smiod }
1503*3d8817e4Smiod 
1504