* config/tc-m68k.c (tc_gen_reloc <section>): Add ATTRIBUTE_UNUSED.
[binutils.git] / opcodes / m32r-desc.c
blob98fecb2650b92bf3fd30e79b073f472eeb4853cb
1 /* CPU data for m32r.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
7 This file is part of the GNU Binutils and/or GDB, the GNU debugger.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #include "sysdep.h"
26 #include <stdio.h>
27 #include <stdarg.h>
28 #include "ansidecl.h"
29 #include "bfd.h"
30 #include "symcat.h"
31 #include "m32r-desc.h"
32 #include "m32r-opc.h"
33 #include "opintl.h"
34 #include "libiberty.h"
35 #include "xregex.h"
37 /* Attributes. */
39 static const CGEN_ATTR_ENTRY bool_attr[] =
41 { "#f", 0 },
42 { "#t", 1 },
43 { 0, 0 }
46 static const CGEN_ATTR_ENTRY MACH_attr[] =
48 { "base", MACH_BASE },
49 { "m32r", MACH_M32R },
50 { "m32rx", MACH_M32RX },
51 { "max", MACH_MAX },
52 { 0, 0 }
55 static const CGEN_ATTR_ENTRY ISA_attr[] =
57 { "m32r", ISA_M32R },
58 { "max", ISA_MAX },
59 { 0, 0 }
62 static const CGEN_ATTR_ENTRY PIPE_attr[] =
64 { "NONE", PIPE_NONE },
65 { "O", PIPE_O },
66 { "S", PIPE_S },
67 { "OS", PIPE_OS },
68 { 0, 0 }
71 const CGEN_ATTR_TABLE m32r_cgen_ifield_attr_table[] =
73 { "MACH", & MACH_attr[0], & MACH_attr[0] },
74 { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
75 { "PCREL-ADDR", &bool_attr[0], &bool_attr[0] },
76 { "ABS-ADDR", &bool_attr[0], &bool_attr[0] },
77 { "RESERVED", &bool_attr[0], &bool_attr[0] },
78 { "SIGN-OPT", &bool_attr[0], &bool_attr[0] },
79 { "SIGNED", &bool_attr[0], &bool_attr[0] },
80 { "RELOC", &bool_attr[0], &bool_attr[0] },
81 { 0, 0, 0 }
84 const CGEN_ATTR_TABLE m32r_cgen_hardware_attr_table[] =
86 { "MACH", & MACH_attr[0], & MACH_attr[0] },
87 { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
88 { "CACHE-ADDR", &bool_attr[0], &bool_attr[0] },
89 { "PC", &bool_attr[0], &bool_attr[0] },
90 { "PROFILE", &bool_attr[0], &bool_attr[0] },
91 { 0, 0, 0 }
94 const CGEN_ATTR_TABLE m32r_cgen_operand_attr_table[] =
96 { "MACH", & MACH_attr[0], & MACH_attr[0] },
97 { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
98 { "PCREL-ADDR", &bool_attr[0], &bool_attr[0] },
99 { "ABS-ADDR", &bool_attr[0], &bool_attr[0] },
100 { "SIGN-OPT", &bool_attr[0], &bool_attr[0] },
101 { "SIGNED", &bool_attr[0], &bool_attr[0] },
102 { "NEGATIVE", &bool_attr[0], &bool_attr[0] },
103 { "RELAX", &bool_attr[0], &bool_attr[0] },
104 { "SEM-ONLY", &bool_attr[0], &bool_attr[0] },
105 { "RELOC", &bool_attr[0], &bool_attr[0] },
106 { "HASH-PREFIX", &bool_attr[0], &bool_attr[0] },
107 { 0, 0, 0 }
110 const CGEN_ATTR_TABLE m32r_cgen_insn_attr_table[] =
112 { "MACH", & MACH_attr[0], & MACH_attr[0] },
113 { "PIPE", & PIPE_attr[0], & PIPE_attr[0] },
114 { "ALIAS", &bool_attr[0], &bool_attr[0] },
115 { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
116 { "UNCOND-CTI", &bool_attr[0], &bool_attr[0] },
117 { "COND-CTI", &bool_attr[0], &bool_attr[0] },
118 { "SKIP-CTI", &bool_attr[0], &bool_attr[0] },
119 { "DELAY-SLOT", &bool_attr[0], &bool_attr[0] },
120 { "RELAXABLE", &bool_attr[0], &bool_attr[0] },
121 { "RELAX", &bool_attr[0], &bool_attr[0] },
122 { "NO-DIS", &bool_attr[0], &bool_attr[0] },
123 { "PBB", &bool_attr[0], &bool_attr[0] },
124 { "FILL-SLOT", &bool_attr[0], &bool_attr[0] },
125 { "SPECIAL", &bool_attr[0], &bool_attr[0] },
126 { 0, 0, 0 }
129 /* Instruction set variants. */
131 static const CGEN_ISA m32r_cgen_isa_table[] = {
132 { "m32r", 32, 32, 16, 32 },
133 { 0, 0, 0, 0, 0 }
136 /* Machine variants. */
138 static const CGEN_MACH m32r_cgen_mach_table[] = {
139 { "m32r", "m32r", MACH_M32R, 0 },
140 { "m32rx", "m32rx", MACH_M32RX, 0 },
141 { 0, 0, 0, 0 }
144 static CGEN_KEYWORD_ENTRY m32r_cgen_opval_gr_names_entries[] =
146 { "fp", 13, {0, {0}}, 0, 0 },
147 { "lr", 14, {0, {0}}, 0, 0 },
148 { "sp", 15, {0, {0}}, 0, 0 },
149 { "r0", 0, {0, {0}}, 0, 0 },
150 { "r1", 1, {0, {0}}, 0, 0 },
151 { "r2", 2, {0, {0}}, 0, 0 },
152 { "r3", 3, {0, {0}}, 0, 0 },
153 { "r4", 4, {0, {0}}, 0, 0 },
154 { "r5", 5, {0, {0}}, 0, 0 },
155 { "r6", 6, {0, {0}}, 0, 0 },
156 { "r7", 7, {0, {0}}, 0, 0 },
157 { "r8", 8, {0, {0}}, 0, 0 },
158 { "r9", 9, {0, {0}}, 0, 0 },
159 { "r10", 10, {0, {0}}, 0, 0 },
160 { "r11", 11, {0, {0}}, 0, 0 },
161 { "r12", 12, {0, {0}}, 0, 0 },
162 { "r13", 13, {0, {0}}, 0, 0 },
163 { "r14", 14, {0, {0}}, 0, 0 },
164 { "r15", 15, {0, {0}}, 0, 0 }
167 CGEN_KEYWORD m32r_cgen_opval_gr_names =
169 & m32r_cgen_opval_gr_names_entries[0],
171 0, 0, 0, 0, ""
174 static CGEN_KEYWORD_ENTRY m32r_cgen_opval_cr_names_entries[] =
176 { "psw", 0, {0, {0}}, 0, 0 },
177 { "cbr", 1, {0, {0}}, 0, 0 },
178 { "spi", 2, {0, {0}}, 0, 0 },
179 { "spu", 3, {0, {0}}, 0, 0 },
180 { "bpc", 6, {0, {0}}, 0, 0 },
181 { "bbpsw", 8, {0, {0}}, 0, 0 },
182 { "bbpc", 14, {0, {0}}, 0, 0 },
183 { "cr0", 0, {0, {0}}, 0, 0 },
184 { "cr1", 1, {0, {0}}, 0, 0 },
185 { "cr2", 2, {0, {0}}, 0, 0 },
186 { "cr3", 3, {0, {0}}, 0, 0 },
187 { "cr4", 4, {0, {0}}, 0, 0 },
188 { "cr5", 5, {0, {0}}, 0, 0 },
189 { "cr6", 6, {0, {0}}, 0, 0 },
190 { "cr7", 7, {0, {0}}, 0, 0 },
191 { "cr8", 8, {0, {0}}, 0, 0 },
192 { "cr9", 9, {0, {0}}, 0, 0 },
193 { "cr10", 10, {0, {0}}, 0, 0 },
194 { "cr11", 11, {0, {0}}, 0, 0 },
195 { "cr12", 12, {0, {0}}, 0, 0 },
196 { "cr13", 13, {0, {0}}, 0, 0 },
197 { "cr14", 14, {0, {0}}, 0, 0 },
198 { "cr15", 15, {0, {0}}, 0, 0 }
201 CGEN_KEYWORD m32r_cgen_opval_cr_names =
203 & m32r_cgen_opval_cr_names_entries[0],
205 0, 0, 0, 0, ""
208 static CGEN_KEYWORD_ENTRY m32r_cgen_opval_h_accums_entries[] =
210 { "a0", 0, {0, {0}}, 0, 0 },
211 { "a1", 1, {0, {0}}, 0, 0 }
214 CGEN_KEYWORD m32r_cgen_opval_h_accums =
216 & m32r_cgen_opval_h_accums_entries[0],
218 0, 0, 0, 0, ""
222 /* The hardware table. */
224 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
225 #define A(a) (1 << CGEN_HW_##a)
226 #else
227 #define A(a) (1 << CGEN_HW_/**/a)
228 #endif
230 const CGEN_HW_ENTRY m32r_cgen_hw_table[] =
232 { "h-memory", HW_H_MEMORY, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
233 { "h-sint", HW_H_SINT, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
234 { "h-uint", HW_H_UINT, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
235 { "h-addr", HW_H_ADDR, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
236 { "h-iaddr", HW_H_IADDR, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
237 { "h-pc", HW_H_PC, CGEN_ASM_NONE, 0, { 0|A(PROFILE)|A(PC), { (1<<MACH_BASE) } } },
238 { "h-hi16", HW_H_HI16, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
239 { "h-slo16", HW_H_SLO16, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
240 { "h-ulo16", HW_H_ULO16, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
241 { "h-gr", HW_H_GR, CGEN_ASM_KEYWORD, (PTR) & m32r_cgen_opval_gr_names, { 0|A(CACHE_ADDR)|A(PROFILE), { (1<<MACH_BASE) } } },
242 { "h-cr", HW_H_CR, CGEN_ASM_KEYWORD, (PTR) & m32r_cgen_opval_cr_names, { 0, { (1<<MACH_BASE) } } },
243 { "h-accum", HW_H_ACCUM, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
244 { "h-accums", HW_H_ACCUMS, CGEN_ASM_KEYWORD, (PTR) & m32r_cgen_opval_h_accums, { 0, { (1<<MACH_M32RX) } } },
245 { "h-cond", HW_H_COND, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
246 { "h-psw", HW_H_PSW, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
247 { "h-bpsw", HW_H_BPSW, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
248 { "h-bbpsw", HW_H_BBPSW, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
249 { "h-lock", HW_H_LOCK, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
250 { 0, 0, CGEN_ASM_NONE, 0, {0, {0}} }
253 #undef A
256 /* The instruction field table. */
258 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
259 #define A(a) (1 << CGEN_IFLD_##a)
260 #else
261 #define A(a) (1 << CGEN_IFLD_/**/a)
262 #endif
264 const CGEN_IFLD m32r_cgen_ifld_table[] =
266 { M32R_F_NIL, "f-nil", 0, 0, 0, 0, { 0, { (1<<MACH_BASE) } } },
267 { M32R_F_ANYOF, "f-anyof", 0, 0, 0, 0, { 0, { (1<<MACH_BASE) } } },
268 { M32R_F_OP1, "f-op1", 0, 32, 0, 4, { 0, { (1<<MACH_BASE) } } },
269 { M32R_F_OP2, "f-op2", 0, 32, 8, 4, { 0, { (1<<MACH_BASE) } } },
270 { M32R_F_COND, "f-cond", 0, 32, 4, 4, { 0, { (1<<MACH_BASE) } } },
271 { M32R_F_R1, "f-r1", 0, 32, 4, 4, { 0, { (1<<MACH_BASE) } } },
272 { M32R_F_R2, "f-r2", 0, 32, 12, 4, { 0, { (1<<MACH_BASE) } } },
273 { M32R_F_SIMM8, "f-simm8", 0, 32, 8, 8, { 0, { (1<<MACH_BASE) } } },
274 { M32R_F_SIMM16, "f-simm16", 0, 32, 16, 16, { 0, { (1<<MACH_BASE) } } },
275 { M32R_F_SHIFT_OP2, "f-shift-op2", 0, 32, 8, 3, { 0, { (1<<MACH_BASE) } } },
276 { M32R_F_UIMM4, "f-uimm4", 0, 32, 12, 4, { 0, { (1<<MACH_BASE) } } },
277 { M32R_F_UIMM5, "f-uimm5", 0, 32, 11, 5, { 0, { (1<<MACH_BASE) } } },
278 { M32R_F_UIMM16, "f-uimm16", 0, 32, 16, 16, { 0, { (1<<MACH_BASE) } } },
279 { M32R_F_UIMM24, "f-uimm24", 0, 32, 8, 24, { 0|A(RELOC)|A(ABS_ADDR), { (1<<MACH_BASE) } } },
280 { M32R_F_HI16, "f-hi16", 0, 32, 16, 16, { 0|A(SIGN_OPT), { (1<<MACH_BASE) } } },
281 { M32R_F_DISP8, "f-disp8", 0, 32, 8, 8, { 0|A(RELOC)|A(PCREL_ADDR), { (1<<MACH_BASE) } } },
282 { M32R_F_DISP16, "f-disp16", 0, 32, 16, 16, { 0|A(RELOC)|A(PCREL_ADDR), { (1<<MACH_BASE) } } },
283 { M32R_F_DISP24, "f-disp24", 0, 32, 8, 24, { 0|A(RELOC)|A(PCREL_ADDR), { (1<<MACH_BASE) } } },
284 { M32R_F_OP23, "f-op23", 0, 32, 9, 3, { 0, { (1<<MACH_BASE) } } },
285 { M32R_F_OP3, "f-op3", 0, 32, 14, 2, { 0, { (1<<MACH_BASE) } } },
286 { M32R_F_ACC, "f-acc", 0, 32, 8, 1, { 0, { (1<<MACH_BASE) } } },
287 { M32R_F_ACCS, "f-accs", 0, 32, 12, 2, { 0, { (1<<MACH_BASE) } } },
288 { M32R_F_ACCD, "f-accd", 0, 32, 4, 2, { 0, { (1<<MACH_BASE) } } },
289 { M32R_F_BITS67, "f-bits67", 0, 32, 6, 2, { 0, { (1<<MACH_BASE) } } },
290 { M32R_F_BIT14, "f-bit14", 0, 32, 14, 1, { 0, { (1<<MACH_BASE) } } },
291 { M32R_F_IMM1, "f-imm1", 0, 32, 15, 1, { 0, { (1<<MACH_BASE) } } },
292 { 0, 0, 0, 0, 0, 0, {0, {0}} }
295 #undef A
299 /* multi ifield declarations */
303 /* multi ifield definitions */
306 /* The operand table. */
308 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
309 #define A(a) (1 << CGEN_OPERAND_##a)
310 #else
311 #define A(a) (1 << CGEN_OPERAND_/**/a)
312 #endif
313 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
314 #define OPERAND(op) M32R_OPERAND_##op
315 #else
316 #define OPERAND(op) M32R_OPERAND_/**/op
317 #endif
319 const CGEN_OPERAND m32r_cgen_operand_table[] =
321 /* pc: program counter */
322 { "pc", M32R_OPERAND_PC, HW_H_PC, 0, 0,
323 { 0, { (const PTR) &m32r_cgen_ifld_table[0] } },
324 { 0|A(SEM_ONLY), { (1<<MACH_BASE) } } },
325 /* sr: source register */
326 { "sr", M32R_OPERAND_SR, HW_H_GR, 12, 4,
327 { 0, { (const PTR) &m32r_cgen_ifld_table[6] } },
328 { 0, { (1<<MACH_BASE) } } },
329 /* dr: destination register */
330 { "dr", M32R_OPERAND_DR, HW_H_GR, 4, 4,
331 { 0, { (const PTR) &m32r_cgen_ifld_table[5] } },
332 { 0, { (1<<MACH_BASE) } } },
333 /* src1: source register 1 */
334 { "src1", M32R_OPERAND_SRC1, HW_H_GR, 4, 4,
335 { 0, { (const PTR) &m32r_cgen_ifld_table[5] } },
336 { 0, { (1<<MACH_BASE) } } },
337 /* src2: source register 2 */
338 { "src2", M32R_OPERAND_SRC2, HW_H_GR, 12, 4,
339 { 0, { (const PTR) &m32r_cgen_ifld_table[6] } },
340 { 0, { (1<<MACH_BASE) } } },
341 /* scr: source control register */
342 { "scr", M32R_OPERAND_SCR, HW_H_CR, 12, 4,
343 { 0, { (const PTR) &m32r_cgen_ifld_table[6] } },
344 { 0, { (1<<MACH_BASE) } } },
345 /* dcr: destination control register */
346 { "dcr", M32R_OPERAND_DCR, HW_H_CR, 4, 4,
347 { 0, { (const PTR) &m32r_cgen_ifld_table[5] } },
348 { 0, { (1<<MACH_BASE) } } },
349 /* simm8: 8 bit signed immediate */
350 { "simm8", M32R_OPERAND_SIMM8, HW_H_SINT, 8, 8,
351 { 0, { (const PTR) &m32r_cgen_ifld_table[7] } },
352 { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } },
353 /* simm16: 16 bit signed immediate */
354 { "simm16", M32R_OPERAND_SIMM16, HW_H_SINT, 16, 16,
355 { 0, { (const PTR) &m32r_cgen_ifld_table[8] } },
356 { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } },
357 /* uimm4: 4 bit trap number */
358 { "uimm4", M32R_OPERAND_UIMM4, HW_H_UINT, 12, 4,
359 { 0, { (const PTR) &m32r_cgen_ifld_table[10] } },
360 { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } },
361 /* uimm5: 5 bit shift count */
362 { "uimm5", M32R_OPERAND_UIMM5, HW_H_UINT, 11, 5,
363 { 0, { (const PTR) &m32r_cgen_ifld_table[11] } },
364 { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } },
365 /* uimm16: 16 bit unsigned immediate */
366 { "uimm16", M32R_OPERAND_UIMM16, HW_H_UINT, 16, 16,
367 { 0, { (const PTR) &m32r_cgen_ifld_table[12] } },
368 { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } },
369 /* imm1: 1 bit immediate */
370 { "imm1", M32R_OPERAND_IMM1, HW_H_UINT, 15, 1,
371 { 0, { (const PTR) &m32r_cgen_ifld_table[25] } },
372 { 0|A(HASH_PREFIX), { (1<<MACH_M32RX) } } },
373 /* accd: accumulator destination register */
374 { "accd", M32R_OPERAND_ACCD, HW_H_ACCUMS, 4, 2,
375 { 0, { (const PTR) &m32r_cgen_ifld_table[22] } },
376 { 0, { (1<<MACH_M32RX) } } },
377 /* accs: accumulator source register */
378 { "accs", M32R_OPERAND_ACCS, HW_H_ACCUMS, 12, 2,
379 { 0, { (const PTR) &m32r_cgen_ifld_table[21] } },
380 { 0, { (1<<MACH_M32RX) } } },
381 /* acc: accumulator reg (d) */
382 { "acc", M32R_OPERAND_ACC, HW_H_ACCUMS, 8, 1,
383 { 0, { (const PTR) &m32r_cgen_ifld_table[20] } },
384 { 0, { (1<<MACH_M32RX) } } },
385 /* hash: # prefix */
386 { "hash", M32R_OPERAND_HASH, HW_H_SINT, 0, 0,
387 { 0, { (const PTR) 0 } },
388 { 0, { (1<<MACH_BASE) } } },
389 /* hi16: high 16 bit immediate, sign optional */
390 { "hi16", M32R_OPERAND_HI16, HW_H_HI16, 16, 16,
391 { 0, { (const PTR) &m32r_cgen_ifld_table[14] } },
392 { 0|A(SIGN_OPT), { (1<<MACH_BASE) } } },
393 /* slo16: 16 bit signed immediate, for low() */
394 { "slo16", M32R_OPERAND_SLO16, HW_H_SLO16, 16, 16,
395 { 0, { (const PTR) &m32r_cgen_ifld_table[8] } },
396 { 0, { (1<<MACH_BASE) } } },
397 /* ulo16: 16 bit unsigned immediate, for low() */
398 { "ulo16", M32R_OPERAND_ULO16, HW_H_ULO16, 16, 16,
399 { 0, { (const PTR) &m32r_cgen_ifld_table[12] } },
400 { 0, { (1<<MACH_BASE) } } },
401 /* uimm24: 24 bit address */
402 { "uimm24", M32R_OPERAND_UIMM24, HW_H_ADDR, 8, 24,
403 { 0, { (const PTR) &m32r_cgen_ifld_table[13] } },
404 { 0|A(HASH_PREFIX)|A(RELOC)|A(ABS_ADDR), { (1<<MACH_BASE) } } },
405 /* disp8: 8 bit displacement */
406 { "disp8", M32R_OPERAND_DISP8, HW_H_IADDR, 8, 8,
407 { 0, { (const PTR) &m32r_cgen_ifld_table[15] } },
408 { 0|A(RELAX)|A(RELOC)|A(PCREL_ADDR), { (1<<MACH_BASE) } } },
409 /* disp16: 16 bit displacement */
410 { "disp16", M32R_OPERAND_DISP16, HW_H_IADDR, 16, 16,
411 { 0, { (const PTR) &m32r_cgen_ifld_table[16] } },
412 { 0|A(RELOC)|A(PCREL_ADDR), { (1<<MACH_BASE) } } },
413 /* disp24: 24 bit displacement */
414 { "disp24", M32R_OPERAND_DISP24, HW_H_IADDR, 8, 24,
415 { 0, { (const PTR) &m32r_cgen_ifld_table[17] } },
416 { 0|A(RELAX)|A(RELOC)|A(PCREL_ADDR), { (1<<MACH_BASE) } } },
417 /* condbit: condition bit */
418 { "condbit", M32R_OPERAND_CONDBIT, HW_H_COND, 0, 0,
419 { 0, { (const PTR) 0 } },
420 { 0|A(SEM_ONLY), { (1<<MACH_BASE) } } },
421 /* accum: accumulator */
422 { "accum", M32R_OPERAND_ACCUM, HW_H_ACCUM, 0, 0,
423 { 0, { (const PTR) 0 } },
424 { 0|A(SEM_ONLY), { (1<<MACH_BASE) } } },
425 /* sentinel */
426 { 0, 0, 0, 0, 0,
427 { 0, { (const PTR) 0 } },
428 { 0, { 0 } } }
431 #undef A
434 /* The instruction table. */
436 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
437 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
438 #define A(a) (1 << CGEN_INSN_##a)
439 #else
440 #define A(a) (1 << CGEN_INSN_/**/a)
441 #endif
443 static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] =
445 /* Special null first entry.
446 A `num' value of zero is thus invalid.
447 Also, the special `invalid' insn resides here. */
448 { 0, 0, 0, 0, {0, {0}} },
449 /* add $dr,$sr */
451 M32R_INSN_ADD, "add", "add", 16,
452 { 0, { (1<<MACH_BASE), PIPE_OS } }
454 /* add3 $dr,$sr,$hash$slo16 */
456 M32R_INSN_ADD3, "add3", "add3", 32,
457 { 0, { (1<<MACH_BASE), PIPE_NONE } }
459 /* and $dr,$sr */
461 M32R_INSN_AND, "and", "and", 16,
462 { 0, { (1<<MACH_BASE), PIPE_OS } }
464 /* and3 $dr,$sr,$uimm16 */
466 M32R_INSN_AND3, "and3", "and3", 32,
467 { 0, { (1<<MACH_BASE), PIPE_NONE } }
469 /* or $dr,$sr */
471 M32R_INSN_OR, "or", "or", 16,
472 { 0, { (1<<MACH_BASE), PIPE_OS } }
474 /* or3 $dr,$sr,$hash$ulo16 */
476 M32R_INSN_OR3, "or3", "or3", 32,
477 { 0, { (1<<MACH_BASE), PIPE_NONE } }
479 /* xor $dr,$sr */
481 M32R_INSN_XOR, "xor", "xor", 16,
482 { 0, { (1<<MACH_BASE), PIPE_OS } }
484 /* xor3 $dr,$sr,$uimm16 */
486 M32R_INSN_XOR3, "xor3", "xor3", 32,
487 { 0, { (1<<MACH_BASE), PIPE_NONE } }
489 /* addi $dr,$simm8 */
491 M32R_INSN_ADDI, "addi", "addi", 16,
492 { 0, { (1<<MACH_BASE), PIPE_OS } }
494 /* addv $dr,$sr */
496 M32R_INSN_ADDV, "addv", "addv", 16,
497 { 0, { (1<<MACH_BASE), PIPE_OS } }
499 /* addv3 $dr,$sr,$simm16 */
501 M32R_INSN_ADDV3, "addv3", "addv3", 32,
502 { 0, { (1<<MACH_BASE), PIPE_NONE } }
504 /* addx $dr,$sr */
506 M32R_INSN_ADDX, "addx", "addx", 16,
507 { 0, { (1<<MACH_BASE), PIPE_OS } }
509 /* bc.s $disp8 */
511 M32R_INSN_BC8, "bc8", "bc.s", 16,
512 { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_O } }
514 /* bc.l $disp24 */
516 M32R_INSN_BC24, "bc24", "bc.l", 32,
517 { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
519 /* beq $src1,$src2,$disp16 */
521 M32R_INSN_BEQ, "beq", "beq", 32,
522 { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
524 /* beqz $src2,$disp16 */
526 M32R_INSN_BEQZ, "beqz", "beqz", 32,
527 { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
529 /* bgez $src2,$disp16 */
531 M32R_INSN_BGEZ, "bgez", "bgez", 32,
532 { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
534 /* bgtz $src2,$disp16 */
536 M32R_INSN_BGTZ, "bgtz", "bgtz", 32,
537 { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
539 /* blez $src2,$disp16 */
541 M32R_INSN_BLEZ, "blez", "blez", 32,
542 { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
544 /* bltz $src2,$disp16 */
546 M32R_INSN_BLTZ, "bltz", "bltz", 32,
547 { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
549 /* bnez $src2,$disp16 */
551 M32R_INSN_BNEZ, "bnez", "bnez", 32,
552 { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
554 /* bl.s $disp8 */
556 M32R_INSN_BL8, "bl8", "bl.s", 16,
557 { 0|A(FILL_SLOT)|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_O } }
559 /* bl.l $disp24 */
561 M32R_INSN_BL24, "bl24", "bl.l", 32,
562 { 0|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
564 /* bcl.s $disp8 */
566 M32R_INSN_BCL8, "bcl8", "bcl.s", 16,
567 { 0|A(FILL_SLOT)|A(COND_CTI), { (1<<MACH_M32RX), PIPE_O } }
569 /* bcl.l $disp24 */
571 M32R_INSN_BCL24, "bcl24", "bcl.l", 32,
572 { 0|A(COND_CTI), { (1<<MACH_M32RX), PIPE_NONE } }
574 /* bnc.s $disp8 */
576 M32R_INSN_BNC8, "bnc8", "bnc.s", 16,
577 { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_O } }
579 /* bnc.l $disp24 */
581 M32R_INSN_BNC24, "bnc24", "bnc.l", 32,
582 { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
584 /* bne $src1,$src2,$disp16 */
586 M32R_INSN_BNE, "bne", "bne", 32,
587 { 0|A(COND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
589 /* bra.s $disp8 */
591 M32R_INSN_BRA8, "bra8", "bra.s", 16,
592 { 0|A(FILL_SLOT)|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_O } }
594 /* bra.l $disp24 */
596 M32R_INSN_BRA24, "bra24", "bra.l", 32,
597 { 0|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_NONE } }
599 /* bncl.s $disp8 */
601 M32R_INSN_BNCL8, "bncl8", "bncl.s", 16,
602 { 0|A(FILL_SLOT)|A(COND_CTI), { (1<<MACH_M32RX), PIPE_O } }
604 /* bncl.l $disp24 */
606 M32R_INSN_BNCL24, "bncl24", "bncl.l", 32,
607 { 0|A(COND_CTI), { (1<<MACH_M32RX), PIPE_NONE } }
609 /* cmp $src1,$src2 */
611 M32R_INSN_CMP, "cmp", "cmp", 16,
612 { 0, { (1<<MACH_BASE), PIPE_OS } }
614 /* cmpi $src2,$simm16 */
616 M32R_INSN_CMPI, "cmpi", "cmpi", 32,
617 { 0, { (1<<MACH_BASE), PIPE_NONE } }
619 /* cmpu $src1,$src2 */
621 M32R_INSN_CMPU, "cmpu", "cmpu", 16,
622 { 0, { (1<<MACH_BASE), PIPE_OS } }
624 /* cmpui $src2,$simm16 */
626 M32R_INSN_CMPUI, "cmpui", "cmpui", 32,
627 { 0, { (1<<MACH_BASE), PIPE_NONE } }
629 /* cmpeq $src1,$src2 */
631 M32R_INSN_CMPEQ, "cmpeq", "cmpeq", 16,
632 { 0, { (1<<MACH_M32RX), PIPE_OS } }
634 /* cmpz $src2 */
636 M32R_INSN_CMPZ, "cmpz", "cmpz", 16,
637 { 0, { (1<<MACH_M32RX), PIPE_OS } }
639 /* div $dr,$sr */
641 M32R_INSN_DIV, "div", "div", 32,
642 { 0, { (1<<MACH_BASE), PIPE_NONE } }
644 /* divu $dr,$sr */
646 M32R_INSN_DIVU, "divu", "divu", 32,
647 { 0, { (1<<MACH_BASE), PIPE_NONE } }
649 /* rem $dr,$sr */
651 M32R_INSN_REM, "rem", "rem", 32,
652 { 0, { (1<<MACH_BASE), PIPE_NONE } }
654 /* remu $dr,$sr */
656 M32R_INSN_REMU, "remu", "remu", 32,
657 { 0, { (1<<MACH_BASE), PIPE_NONE } }
659 /* divh $dr,$sr */
661 M32R_INSN_DIVH, "divh", "divh", 32,
662 { 0, { (1<<MACH_M32RX), PIPE_NONE } }
664 /* jc $sr */
666 M32R_INSN_JC, "jc", "jc", 16,
667 { 0|A(SPECIAL)|A(COND_CTI), { (1<<MACH_M32RX), PIPE_O } }
669 /* jnc $sr */
671 M32R_INSN_JNC, "jnc", "jnc", 16,
672 { 0|A(SPECIAL)|A(COND_CTI), { (1<<MACH_M32RX), PIPE_O } }
674 /* jl $sr */
676 M32R_INSN_JL, "jl", "jl", 16,
677 { 0|A(FILL_SLOT)|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_O } }
679 /* jmp $sr */
681 M32R_INSN_JMP, "jmp", "jmp", 16,
682 { 0|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_O } }
684 /* ld $dr,@$sr */
686 M32R_INSN_LD, "ld", "ld", 16,
687 { 0, { (1<<MACH_BASE), PIPE_O } }
689 /* ld $dr,@($slo16,$sr) */
691 M32R_INSN_LD_D, "ld-d", "ld", 32,
692 { 0, { (1<<MACH_BASE), PIPE_NONE } }
694 /* ldb $dr,@$sr */
696 M32R_INSN_LDB, "ldb", "ldb", 16,
697 { 0, { (1<<MACH_BASE), PIPE_O } }
699 /* ldb $dr,@($slo16,$sr) */
701 M32R_INSN_LDB_D, "ldb-d", "ldb", 32,
702 { 0, { (1<<MACH_BASE), PIPE_NONE } }
704 /* ldh $dr,@$sr */
706 M32R_INSN_LDH, "ldh", "ldh", 16,
707 { 0, { (1<<MACH_BASE), PIPE_O } }
709 /* ldh $dr,@($slo16,$sr) */
711 M32R_INSN_LDH_D, "ldh-d", "ldh", 32,
712 { 0, { (1<<MACH_BASE), PIPE_NONE } }
714 /* ldub $dr,@$sr */
716 M32R_INSN_LDUB, "ldub", "ldub", 16,
717 { 0, { (1<<MACH_BASE), PIPE_O } }
719 /* ldub $dr,@($slo16,$sr) */
721 M32R_INSN_LDUB_D, "ldub-d", "ldub", 32,
722 { 0, { (1<<MACH_BASE), PIPE_NONE } }
724 /* lduh $dr,@$sr */
726 M32R_INSN_LDUH, "lduh", "lduh", 16,
727 { 0, { (1<<MACH_BASE), PIPE_O } }
729 /* lduh $dr,@($slo16,$sr) */
731 M32R_INSN_LDUH_D, "lduh-d", "lduh", 32,
732 { 0, { (1<<MACH_BASE), PIPE_NONE } }
734 /* ld $dr,@$sr+ */
736 M32R_INSN_LD_PLUS, "ld-plus", "ld", 16,
737 { 0, { (1<<MACH_BASE), PIPE_O } }
739 /* ld24 $dr,$uimm24 */
741 M32R_INSN_LD24, "ld24", "ld24", 32,
742 { 0, { (1<<MACH_BASE), PIPE_NONE } }
744 /* ldi8 $dr,$simm8 */
746 M32R_INSN_LDI8, "ldi8", "ldi8", 16,
747 { 0, { (1<<MACH_BASE), PIPE_OS } }
749 /* ldi16 $dr,$hash$slo16 */
751 M32R_INSN_LDI16, "ldi16", "ldi16", 32,
752 { 0, { (1<<MACH_BASE), PIPE_NONE } }
754 /* lock $dr,@$sr */
756 M32R_INSN_LOCK, "lock", "lock", 16,
757 { 0, { (1<<MACH_BASE), PIPE_O } }
759 /* machi $src1,$src2 */
761 M32R_INSN_MACHI, "machi", "machi", 16,
762 { 0, { (1<<MACH_M32R), PIPE_S } }
764 /* machi $src1,$src2,$acc */
766 M32R_INSN_MACHI_A, "machi-a", "machi", 16,
767 { 0, { (1<<MACH_M32RX), PIPE_S } }
769 /* maclo $src1,$src2 */
771 M32R_INSN_MACLO, "maclo", "maclo", 16,
772 { 0, { (1<<MACH_M32R), PIPE_S } }
774 /* maclo $src1,$src2,$acc */
776 M32R_INSN_MACLO_A, "maclo-a", "maclo", 16,
777 { 0, { (1<<MACH_M32RX), PIPE_S } }
779 /* macwhi $src1,$src2 */
781 M32R_INSN_MACWHI, "macwhi", "macwhi", 16,
782 { 0, { (1<<MACH_M32R), PIPE_S } }
784 /* macwhi $src1,$src2,$acc */
786 M32R_INSN_MACWHI_A, "macwhi-a", "macwhi", 16,
787 { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_S } }
789 /* macwlo $src1,$src2 */
791 M32R_INSN_MACWLO, "macwlo", "macwlo", 16,
792 { 0, { (1<<MACH_M32R), PIPE_S } }
794 /* macwlo $src1,$src2,$acc */
796 M32R_INSN_MACWLO_A, "macwlo-a", "macwlo", 16,
797 { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_S } }
799 /* mul $dr,$sr */
801 M32R_INSN_MUL, "mul", "mul", 16,
802 { 0, { (1<<MACH_BASE), PIPE_S } }
804 /* mulhi $src1,$src2 */
806 M32R_INSN_MULHI, "mulhi", "mulhi", 16,
807 { 0, { (1<<MACH_M32R), PIPE_S } }
809 /* mulhi $src1,$src2,$acc */
811 M32R_INSN_MULHI_A, "mulhi-a", "mulhi", 16,
812 { 0, { (1<<MACH_M32RX), PIPE_S } }
814 /* mullo $src1,$src2 */
816 M32R_INSN_MULLO, "mullo", "mullo", 16,
817 { 0, { (1<<MACH_M32R), PIPE_S } }
819 /* mullo $src1,$src2,$acc */
821 M32R_INSN_MULLO_A, "mullo-a", "mullo", 16,
822 { 0, { (1<<MACH_M32RX), PIPE_S } }
824 /* mulwhi $src1,$src2 */
826 M32R_INSN_MULWHI, "mulwhi", "mulwhi", 16,
827 { 0, { (1<<MACH_M32R), PIPE_S } }
829 /* mulwhi $src1,$src2,$acc */
831 M32R_INSN_MULWHI_A, "mulwhi-a", "mulwhi", 16,
832 { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_S } }
834 /* mulwlo $src1,$src2 */
836 M32R_INSN_MULWLO, "mulwlo", "mulwlo", 16,
837 { 0, { (1<<MACH_M32R), PIPE_S } }
839 /* mulwlo $src1,$src2,$acc */
841 M32R_INSN_MULWLO_A, "mulwlo-a", "mulwlo", 16,
842 { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_S } }
844 /* mv $dr,$sr */
846 M32R_INSN_MV, "mv", "mv", 16,
847 { 0, { (1<<MACH_BASE), PIPE_OS } }
849 /* mvfachi $dr */
851 M32R_INSN_MVFACHI, "mvfachi", "mvfachi", 16,
852 { 0, { (1<<MACH_M32R), PIPE_S } }
854 /* mvfachi $dr,$accs */
856 M32R_INSN_MVFACHI_A, "mvfachi-a", "mvfachi", 16,
857 { 0, { (1<<MACH_M32RX), PIPE_S } }
859 /* mvfaclo $dr */
861 M32R_INSN_MVFACLO, "mvfaclo", "mvfaclo", 16,
862 { 0, { (1<<MACH_M32R), PIPE_S } }
864 /* mvfaclo $dr,$accs */
866 M32R_INSN_MVFACLO_A, "mvfaclo-a", "mvfaclo", 16,
867 { 0, { (1<<MACH_M32RX), PIPE_S } }
869 /* mvfacmi $dr */
871 M32R_INSN_MVFACMI, "mvfacmi", "mvfacmi", 16,
872 { 0, { (1<<MACH_M32R), PIPE_S } }
874 /* mvfacmi $dr,$accs */
876 M32R_INSN_MVFACMI_A, "mvfacmi-a", "mvfacmi", 16,
877 { 0, { (1<<MACH_M32RX), PIPE_S } }
879 /* mvfc $dr,$scr */
881 M32R_INSN_MVFC, "mvfc", "mvfc", 16,
882 { 0, { (1<<MACH_BASE), PIPE_O } }
884 /* mvtachi $src1 */
886 M32R_INSN_MVTACHI, "mvtachi", "mvtachi", 16,
887 { 0, { (1<<MACH_M32R), PIPE_S } }
889 /* mvtachi $src1,$accs */
891 M32R_INSN_MVTACHI_A, "mvtachi-a", "mvtachi", 16,
892 { 0, { (1<<MACH_M32RX), PIPE_S } }
894 /* mvtaclo $src1 */
896 M32R_INSN_MVTACLO, "mvtaclo", "mvtaclo", 16,
897 { 0, { (1<<MACH_M32R), PIPE_S } }
899 /* mvtaclo $src1,$accs */
901 M32R_INSN_MVTACLO_A, "mvtaclo-a", "mvtaclo", 16,
902 { 0, { (1<<MACH_M32RX), PIPE_S } }
904 /* mvtc $sr,$dcr */
906 M32R_INSN_MVTC, "mvtc", "mvtc", 16,
907 { 0, { (1<<MACH_BASE), PIPE_O } }
909 /* neg $dr,$sr */
911 M32R_INSN_NEG, "neg", "neg", 16,
912 { 0, { (1<<MACH_BASE), PIPE_OS } }
914 /* nop */
916 M32R_INSN_NOP, "nop", "nop", 16,
917 { 0, { (1<<MACH_BASE), PIPE_OS } }
919 /* not $dr,$sr */
921 M32R_INSN_NOT, "not", "not", 16,
922 { 0, { (1<<MACH_BASE), PIPE_OS } }
924 /* rac */
926 M32R_INSN_RAC, "rac", "rac", 16,
927 { 0, { (1<<MACH_M32R), PIPE_S } }
929 /* rac $accd,$accs,$imm1 */
931 M32R_INSN_RAC_DSI, "rac-dsi", "rac", 16,
932 { 0, { (1<<MACH_M32RX), PIPE_S } }
934 /* rach */
936 M32R_INSN_RACH, "rach", "rach", 16,
937 { 0, { (1<<MACH_M32R), PIPE_S } }
939 /* rach $accd,$accs,$imm1 */
941 M32R_INSN_RACH_DSI, "rach-dsi", "rach", 16,
942 { 0, { (1<<MACH_M32RX), PIPE_S } }
944 /* rte */
946 M32R_INSN_RTE, "rte", "rte", 16,
947 { 0|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_O } }
949 /* seth $dr,$hash$hi16 */
951 M32R_INSN_SETH, "seth", "seth", 32,
952 { 0, { (1<<MACH_BASE), PIPE_NONE } }
954 /* sll $dr,$sr */
956 M32R_INSN_SLL, "sll", "sll", 16,
957 { 0, { (1<<MACH_BASE), PIPE_O } }
959 /* sll3 $dr,$sr,$simm16 */
961 M32R_INSN_SLL3, "sll3", "sll3", 32,
962 { 0, { (1<<MACH_BASE), PIPE_NONE } }
964 /* slli $dr,$uimm5 */
966 M32R_INSN_SLLI, "slli", "slli", 16,
967 { 0, { (1<<MACH_BASE), PIPE_O } }
969 /* sra $dr,$sr */
971 M32R_INSN_SRA, "sra", "sra", 16,
972 { 0, { (1<<MACH_BASE), PIPE_O } }
974 /* sra3 $dr,$sr,$simm16 */
976 M32R_INSN_SRA3, "sra3", "sra3", 32,
977 { 0, { (1<<MACH_BASE), PIPE_NONE } }
979 /* srai $dr,$uimm5 */
981 M32R_INSN_SRAI, "srai", "srai", 16,
982 { 0, { (1<<MACH_BASE), PIPE_O } }
984 /* srl $dr,$sr */
986 M32R_INSN_SRL, "srl", "srl", 16,
987 { 0, { (1<<MACH_BASE), PIPE_O } }
989 /* srl3 $dr,$sr,$simm16 */
991 M32R_INSN_SRL3, "srl3", "srl3", 32,
992 { 0, { (1<<MACH_BASE), PIPE_NONE } }
994 /* srli $dr,$uimm5 */
996 M32R_INSN_SRLI, "srli", "srli", 16,
997 { 0, { (1<<MACH_BASE), PIPE_O } }
999 /* st $src1,@$src2 */
1001 M32R_INSN_ST, "st", "st", 16,
1002 { 0, { (1<<MACH_BASE), PIPE_O } }
1004 /* st $src1,@($slo16,$src2) */
1006 M32R_INSN_ST_D, "st-d", "st", 32,
1007 { 0, { (1<<MACH_BASE), PIPE_NONE } }
1009 /* stb $src1,@$src2 */
1011 M32R_INSN_STB, "stb", "stb", 16,
1012 { 0, { (1<<MACH_BASE), PIPE_O } }
1014 /* stb $src1,@($slo16,$src2) */
1016 M32R_INSN_STB_D, "stb-d", "stb", 32,
1017 { 0, { (1<<MACH_BASE), PIPE_NONE } }
1019 /* sth $src1,@$src2 */
1021 M32R_INSN_STH, "sth", "sth", 16,
1022 { 0, { (1<<MACH_BASE), PIPE_O } }
1024 /* sth $src1,@($slo16,$src2) */
1026 M32R_INSN_STH_D, "sth-d", "sth", 32,
1027 { 0, { (1<<MACH_BASE), PIPE_NONE } }
1029 /* st $src1,@+$src2 */
1031 M32R_INSN_ST_PLUS, "st-plus", "st", 16,
1032 { 0, { (1<<MACH_BASE), PIPE_O } }
1034 /* st $src1,@-$src2 */
1036 M32R_INSN_ST_MINUS, "st-minus", "st", 16,
1037 { 0, { (1<<MACH_BASE), PIPE_O } }
1039 /* sub $dr,$sr */
1041 M32R_INSN_SUB, "sub", "sub", 16,
1042 { 0, { (1<<MACH_BASE), PIPE_OS } }
1044 /* subv $dr,$sr */
1046 M32R_INSN_SUBV, "subv", "subv", 16,
1047 { 0, { (1<<MACH_BASE), PIPE_OS } }
1049 /* subx $dr,$sr */
1051 M32R_INSN_SUBX, "subx", "subx", 16,
1052 { 0, { (1<<MACH_BASE), PIPE_OS } }
1054 /* trap $uimm4 */
1056 M32R_INSN_TRAP, "trap", "trap", 16,
1057 { 0|A(FILL_SLOT)|A(UNCOND_CTI), { (1<<MACH_BASE), PIPE_O } }
1059 /* unlock $src1,@$src2 */
1061 M32R_INSN_UNLOCK, "unlock", "unlock", 16,
1062 { 0, { (1<<MACH_BASE), PIPE_O } }
1064 /* satb $dr,$sr */
1066 M32R_INSN_SATB, "satb", "satb", 32,
1067 { 0, { (1<<MACH_M32RX), PIPE_NONE } }
1069 /* sath $dr,$sr */
1071 M32R_INSN_SATH, "sath", "sath", 32,
1072 { 0, { (1<<MACH_M32RX), PIPE_NONE } }
1074 /* sat $dr,$sr */
1076 M32R_INSN_SAT, "sat", "sat", 32,
1077 { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_NONE } }
1079 /* pcmpbz $src2 */
1081 M32R_INSN_PCMPBZ, "pcmpbz", "pcmpbz", 16,
1082 { 0|A(SPECIAL), { (1<<MACH_M32RX), PIPE_OS } }
1084 /* sadd */
1086 M32R_INSN_SADD, "sadd", "sadd", 16,
1087 { 0, { (1<<MACH_M32RX), PIPE_S } }
1089 /* macwu1 $src1,$src2 */
1091 M32R_INSN_MACWU1, "macwu1", "macwu1", 16,
1092 { 0, { (1<<MACH_M32RX), PIPE_S } }
1094 /* msblo $src1,$src2 */
1096 M32R_INSN_MSBLO, "msblo", "msblo", 16,
1097 { 0, { (1<<MACH_M32RX), PIPE_S } }
1099 /* mulwu1 $src1,$src2 */
1101 M32R_INSN_MULWU1, "mulwu1", "mulwu1", 16,
1102 { 0, { (1<<MACH_M32RX), PIPE_S } }
1104 /* maclh1 $src1,$src2 */
1106 M32R_INSN_MACLH1, "maclh1", "maclh1", 16,
1107 { 0, { (1<<MACH_M32RX), PIPE_S } }
1109 /* sc */
1111 M32R_INSN_SC, "sc", "sc", 16,
1112 { 0|A(SPECIAL)|A(SKIP_CTI), { (1<<MACH_M32RX), PIPE_O } }
1114 /* snc */
1116 M32R_INSN_SNC, "snc", "snc", 16,
1117 { 0|A(SPECIAL)|A(SKIP_CTI), { (1<<MACH_M32RX), PIPE_O } }
1121 #undef OP
1122 #undef A
1124 /* Initialize anything needed to be done once, before any cpu_open call. */
1125 static void init_tables PARAMS ((void));
1127 static void
1128 init_tables ()
1132 static const CGEN_MACH * lookup_mach_via_bfd_name
1133 PARAMS ((const CGEN_MACH *, const char *));
1134 static void build_hw_table PARAMS ((CGEN_CPU_TABLE *));
1135 static void build_ifield_table PARAMS ((CGEN_CPU_TABLE *));
1136 static void build_operand_table PARAMS ((CGEN_CPU_TABLE *));
1137 static void build_insn_table PARAMS ((CGEN_CPU_TABLE *));
1138 static void m32r_cgen_rebuild_tables PARAMS ((CGEN_CPU_TABLE *));
1140 /* Subroutine of m32r_cgen_cpu_open to look up a mach via its bfd name. */
1142 static const CGEN_MACH *
1143 lookup_mach_via_bfd_name (table, name)
1144 const CGEN_MACH *table;
1145 const char *name;
1147 while (table->name)
1149 if (strcmp (name, table->bfd_name) == 0)
1150 return table;
1151 ++table;
1153 abort ();
1156 /* Subroutine of m32r_cgen_cpu_open to build the hardware table. */
1158 static void
1159 build_hw_table (cd)
1160 CGEN_CPU_TABLE *cd;
1162 int i;
1163 int machs = cd->machs;
1164 const CGEN_HW_ENTRY *init = & m32r_cgen_hw_table[0];
1165 /* MAX_HW is only an upper bound on the number of selected entries.
1166 However each entry is indexed by it's enum so there can be holes in
1167 the table. */
1168 const CGEN_HW_ENTRY **selected =
1169 (const CGEN_HW_ENTRY **) xmalloc (MAX_HW * sizeof (CGEN_HW_ENTRY *));
1171 cd->hw_table.init_entries = init;
1172 cd->hw_table.entry_size = sizeof (CGEN_HW_ENTRY);
1173 memset (selected, 0, MAX_HW * sizeof (CGEN_HW_ENTRY *));
1174 /* ??? For now we just use machs to determine which ones we want. */
1175 for (i = 0; init[i].name != NULL; ++i)
1176 if (CGEN_HW_ATTR_VALUE (&init[i], CGEN_HW_MACH)
1177 & machs)
1178 selected[init[i].type] = &init[i];
1179 cd->hw_table.entries = selected;
1180 cd->hw_table.num_entries = MAX_HW;
1183 /* Subroutine of m32r_cgen_cpu_open to build the hardware table. */
1185 static void
1186 build_ifield_table (cd)
1187 CGEN_CPU_TABLE *cd;
1189 cd->ifld_table = & m32r_cgen_ifld_table[0];
1192 /* Subroutine of m32r_cgen_cpu_open to build the hardware table. */
1194 static void
1195 build_operand_table (cd)
1196 CGEN_CPU_TABLE *cd;
1198 int i;
1199 int machs = cd->machs;
1200 const CGEN_OPERAND *init = & m32r_cgen_operand_table[0];
1201 /* MAX_OPERANDS is only an upper bound on the number of selected entries.
1202 However each entry is indexed by it's enum so there can be holes in
1203 the table. */
1204 const CGEN_OPERAND **selected =
1205 (const CGEN_OPERAND **) xmalloc (MAX_OPERANDS * sizeof (CGEN_OPERAND *));
1207 cd->operand_table.init_entries = init;
1208 cd->operand_table.entry_size = sizeof (CGEN_OPERAND);
1209 memset (selected, 0, MAX_OPERANDS * sizeof (CGEN_OPERAND *));
1210 /* ??? For now we just use mach to determine which ones we want. */
1211 for (i = 0; init[i].name != NULL; ++i)
1212 if (CGEN_OPERAND_ATTR_VALUE (&init[i], CGEN_OPERAND_MACH)
1213 & machs)
1214 selected[init[i].type] = &init[i];
1215 cd->operand_table.entries = selected;
1216 cd->operand_table.num_entries = MAX_OPERANDS;
1219 /* Subroutine of m32r_cgen_cpu_open to build the hardware table.
1220 ??? This could leave out insns not supported by the specified mach/isa,
1221 but that would cause errors like "foo only supported by bar" to become
1222 "unknown insn", so for now we include all insns and require the app to
1223 do the checking later.
1224 ??? On the other hand, parsing of such insns may require their hardware or
1225 operand elements to be in the table [which they mightn't be]. */
1227 static void
1228 build_insn_table (cd)
1229 CGEN_CPU_TABLE *cd;
1231 int i;
1232 const CGEN_IBASE *ib = & m32r_cgen_insn_table[0];
1233 CGEN_INSN *insns = (CGEN_INSN *) xmalloc (MAX_INSNS * sizeof (CGEN_INSN));
1235 memset (insns, 0, MAX_INSNS * sizeof (CGEN_INSN));
1236 for (i = 0; i < MAX_INSNS; ++i)
1237 insns[i].base = &ib[i];
1238 cd->insn_table.init_entries = insns;
1239 cd->insn_table.entry_size = sizeof (CGEN_IBASE);
1240 cd->insn_table.num_init_entries = MAX_INSNS;
1243 /* Subroutine of m32r_cgen_cpu_open to rebuild the tables. */
1245 static void
1246 m32r_cgen_rebuild_tables (cd)
1247 CGEN_CPU_TABLE *cd;
1249 int i;
1250 unsigned int isas = cd->isas;
1251 unsigned int machs = cd->machs;
1253 cd->int_insn_p = CGEN_INT_INSN_P;
1255 /* Data derived from the isa spec. */
1256 #define UNSET (CGEN_SIZE_UNKNOWN + 1)
1257 cd->default_insn_bitsize = UNSET;
1258 cd->base_insn_bitsize = UNSET;
1259 cd->min_insn_bitsize = 65535; /* some ridiculously big number */
1260 cd->max_insn_bitsize = 0;
1261 for (i = 0; i < MAX_ISAS; ++i)
1262 if (((1 << i) & isas) != 0)
1264 const CGEN_ISA *isa = & m32r_cgen_isa_table[i];
1266 /* Default insn sizes of all selected isas must be
1267 equal or we set the result to 0, meaning "unknown". */
1268 if (cd->default_insn_bitsize == UNSET)
1269 cd->default_insn_bitsize = isa->default_insn_bitsize;
1270 else if (isa->default_insn_bitsize == cd->default_insn_bitsize)
1271 ; /* this is ok */
1272 else
1273 cd->default_insn_bitsize = CGEN_SIZE_UNKNOWN;
1275 /* Base insn sizes of all selected isas must be equal
1276 or we set the result to 0, meaning "unknown". */
1277 if (cd->base_insn_bitsize == UNSET)
1278 cd->base_insn_bitsize = isa->base_insn_bitsize;
1279 else if (isa->base_insn_bitsize == cd->base_insn_bitsize)
1280 ; /* this is ok */
1281 else
1282 cd->base_insn_bitsize = CGEN_SIZE_UNKNOWN;
1284 /* Set min,max insn sizes. */
1285 if (isa->min_insn_bitsize < cd->min_insn_bitsize)
1286 cd->min_insn_bitsize = isa->min_insn_bitsize;
1287 if (isa->max_insn_bitsize > cd->max_insn_bitsize)
1288 cd->max_insn_bitsize = isa->max_insn_bitsize;
1291 /* Data derived from the mach spec. */
1292 for (i = 0; i < MAX_MACHS; ++i)
1293 if (((1 << i) & machs) != 0)
1295 const CGEN_MACH *mach = & m32r_cgen_mach_table[i];
1297 if (mach->insn_chunk_bitsize != 0)
1299 if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
1301 fprintf (stderr, "m32r_cgen_rebuild_tables: conflicting insn-chunk-bitsize values: `%d' vs. `%d'\n",
1302 cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
1303 abort ();
1306 cd->insn_chunk_bitsize = mach->insn_chunk_bitsize;
1310 /* Determine which hw elements are used by MACH. */
1311 build_hw_table (cd);
1313 /* Build the ifield table. */
1314 build_ifield_table (cd);
1316 /* Determine which operands are used by MACH/ISA. */
1317 build_operand_table (cd);
1319 /* Build the instruction table. */
1320 build_insn_table (cd);
1323 /* Initialize a cpu table and return a descriptor.
1324 It's much like opening a file, and must be the first function called.
1325 The arguments are a set of (type/value) pairs, terminated with
1326 CGEN_CPU_OPEN_END.
1328 Currently supported values:
1329 CGEN_CPU_OPEN_ISAS: bitmap of values in enum isa_attr
1330 CGEN_CPU_OPEN_MACHS: bitmap of values in enum mach_attr
1331 CGEN_CPU_OPEN_BFDMACH: specify 1 mach using bfd name
1332 CGEN_CPU_OPEN_ENDIAN: specify endian choice
1333 CGEN_CPU_OPEN_END: terminates arguments
1335 ??? Simultaneous multiple isas might not make sense, but it's not (yet)
1336 precluded.
1338 ??? We only support ISO C stdargs here, not K&R.
1339 Laziness, plus experiment to see if anything requires K&R - eventually
1340 K&R will no longer be supported - e.g. GDB is currently trying this. */
1342 CGEN_CPU_DESC
1343 m32r_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
1345 CGEN_CPU_TABLE *cd = (CGEN_CPU_TABLE *) xmalloc (sizeof (CGEN_CPU_TABLE));
1346 static int init_p;
1347 unsigned int isas = 0; /* 0 = "unspecified" */
1348 unsigned int machs = 0; /* 0 = "unspecified" */
1349 enum cgen_endian endian = CGEN_ENDIAN_UNKNOWN;
1350 va_list ap;
1352 if (! init_p)
1354 init_tables ();
1355 init_p = 1;
1358 memset (cd, 0, sizeof (*cd));
1360 va_start (ap, arg_type);
1361 while (arg_type != CGEN_CPU_OPEN_END)
1363 switch (arg_type)
1365 case CGEN_CPU_OPEN_ISAS :
1366 isas = va_arg (ap, unsigned int);
1367 break;
1368 case CGEN_CPU_OPEN_MACHS :
1369 machs = va_arg (ap, unsigned int);
1370 break;
1371 case CGEN_CPU_OPEN_BFDMACH :
1373 const char *name = va_arg (ap, const char *);
1374 const CGEN_MACH *mach =
1375 lookup_mach_via_bfd_name (m32r_cgen_mach_table, name);
1377 machs |= 1 << mach->num;
1378 break;
1380 case CGEN_CPU_OPEN_ENDIAN :
1381 endian = va_arg (ap, enum cgen_endian);
1382 break;
1383 default :
1384 fprintf (stderr, "m32r_cgen_cpu_open: unsupported argument `%d'\n",
1385 arg_type);
1386 abort (); /* ??? return NULL? */
1388 arg_type = va_arg (ap, enum cgen_cpu_open_arg);
1390 va_end (ap);
1392 /* mach unspecified means "all" */
1393 if (machs == 0)
1394 machs = (1 << MAX_MACHS) - 1;
1395 /* base mach is always selected */
1396 machs |= 1;
1397 /* isa unspecified means "all" */
1398 if (isas == 0)
1399 isas = (1 << MAX_ISAS) - 1;
1400 if (endian == CGEN_ENDIAN_UNKNOWN)
1402 /* ??? If target has only one, could have a default. */
1403 fprintf (stderr, "m32r_cgen_cpu_open: no endianness specified\n");
1404 abort ();
1407 cd->isas = isas;
1408 cd->machs = machs;
1409 cd->endian = endian;
1410 /* FIXME: for the sparc case we can determine insn-endianness statically.
1411 The worry here is where both data and insn endian can be independently
1412 chosen, in which case this function will need another argument.
1413 Actually, will want to allow for more arguments in the future anyway. */
1414 cd->insn_endian = endian;
1416 /* Table (re)builder. */
1417 cd->rebuild_tables = m32r_cgen_rebuild_tables;
1418 m32r_cgen_rebuild_tables (cd);
1420 /* Default to not allowing signed overflow. */
1421 cd->signed_overflow_ok_p = 0;
1423 return (CGEN_CPU_DESC) cd;
1426 /* Cover fn to m32r_cgen_cpu_open to handle the simple case of 1 isa, 1 mach.
1427 MACH_NAME is the bfd name of the mach. */
1429 CGEN_CPU_DESC
1430 m32r_cgen_cpu_open_1 (mach_name, endian)
1431 const char *mach_name;
1432 enum cgen_endian endian;
1434 return m32r_cgen_cpu_open (CGEN_CPU_OPEN_BFDMACH, mach_name,
1435 CGEN_CPU_OPEN_ENDIAN, endian,
1436 CGEN_CPU_OPEN_END);
1439 /* Close a cpu table.
1440 ??? This can live in a machine independent file, but there's currently
1441 no place to put this file (there's no libcgen). libopcodes is the wrong
1442 place as some simulator ports use this but they don't use libopcodes. */
1444 void
1445 m32r_cgen_cpu_close (cd)
1446 CGEN_CPU_DESC cd;
1448 unsigned int i;
1449 const CGEN_INSN *insns;
1451 if (cd->macro_insn_table.init_entries)
1453 insns = cd->macro_insn_table.init_entries;
1454 for (i = 0; i < cd->macro_insn_table.num_init_entries; ++i, ++insns)
1456 if (CGEN_INSN_RX ((insns)))
1457 regfree (CGEN_INSN_RX (insns));
1461 if (cd->insn_table.init_entries)
1463 insns = cd->insn_table.init_entries;
1464 for (i = 0; i < cd->insn_table.num_init_entries; ++i, ++insns)
1466 if (CGEN_INSN_RX (insns))
1467 regfree (CGEN_INSN_RX (insns));
1473 if (cd->macro_insn_table.init_entries)
1474 free ((CGEN_INSN *) cd->macro_insn_table.init_entries);
1476 if (cd->insn_table.init_entries)
1477 free ((CGEN_INSN *) cd->insn_table.init_entries);
1479 if (cd->hw_table.entries)
1480 free ((CGEN_HW_ENTRY *) cd->hw_table.entries);
1482 if (cd->operand_table.entries)
1483 free ((CGEN_HW_ENTRY *) cd->operand_table.entries);
1485 free (cd);