1 /* Generic opcode table support for targets using CGEN. -*- C -*-
2 CGEN: Cpu tools GENerator
4 THIS FILE IS USED TO GENERATE fr30-opc.c.
6 Copyright (C) 1998 Free Software Foundation, Inc.
8 This file is part of the GNU Binutils and GDB, the GNU debugger.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software Foundation, Inc.,
22 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
27 #include "libiberty.h"
33 /* The hash functions are recorded here to help keep assembler code out of
34 the disassembler and vice versa. */
36 static int asm_hash_insn_p PARAMS ((const CGEN_INSN *));
37 static unsigned int asm_hash_insn PARAMS ((const char *));
38 static int dis_hash_insn_p PARAMS ((const CGEN_INSN *));
39 static unsigned int dis_hash_insn PARAMS ((const char *, CGEN_INSN_INT));
41 /* Look up instruction INSN_VALUE and extract its fields.
42 INSN, if non-null, is the insn table entry.
43 Otherwise INSN_VALUE is examined to compute it.
44 LENGTH is the bit length of INSN_VALUE if known, otherwise 0.
45 0 is only valid if `insn == NULL && ! CGEN_INT_INSN_P'.
46 If INSN != NULL, LENGTH must be valid.
47 ALIAS_P is non-zero if alias insns are to be included in the search.
49 The result is a pointer to the insn table entry, or NULL if the instruction
53 fr30_cgen_lookup_insn (od, insn, insn_value, length, fields, alias_p)
55 const CGEN_INSN *insn;
56 CGEN_INSN_BYTES insn_value;
61 unsigned char buf[CGEN_MAX_INSN_SIZE];
63 CGEN_INSN_INT base_insn;
65 CGEN_EXTRACT_INFO *info = NULL;
67 CGEN_EXTRACT_INFO ex_info;
68 CGEN_EXTRACT_INFO *info = &ex_info;
72 cgen_put_insn_value (od, buf, length, insn_value);
74 base_insn = insn_value; /*???*/
76 ex_info.dis_info = NULL;
77 ex_info.insn_bytes = insn_value;
79 base_insn = cgen_get_insn_value (od, buf, length);
85 const CGEN_INSN_LIST *insn_list;
87 /* The instructions are stored in hash lists.
88 Pick the first one and keep trying until we find the right one. */
90 insn_list = CGEN_DIS_LOOKUP_INSN (od, bufp, base_insn);
91 while (insn_list != NULL)
93 insn = insn_list->insn;
96 || ! CGEN_INSN_ATTR (insn, CGEN_INSN_ALIAS))
98 /* Basic bit mask must be correct. */
99 /* ??? May wish to allow target to defer this check until the
101 if ((base_insn & CGEN_INSN_MASK (insn)) == CGEN_INSN_VALUE (insn))
103 /* ??? 0 is passed for `pc' */
104 int elength = (*CGEN_EXTRACT_FN (insn)) (od, insn, info,
110 if (length != 0 && length != elength)
117 insn_list = CGEN_DIS_NEXT_INSN (insn_list);
122 /* Sanity check: can't pass an alias insn if ! alias_p. */
124 && CGEN_INSN_ATTR (insn, CGEN_INSN_ALIAS))
126 /* Sanity check: length must be correct. */
127 if (length != CGEN_INSN_BITSIZE (insn))
130 /* ??? 0 is passed for `pc' */
131 length = (*CGEN_EXTRACT_FN (insn)) (od, insn, info, base_insn, fields,
133 /* Sanity check: must succeed.
134 Could relax this later if it ever proves useful. */
143 /* Fill in the operand instances used by INSN whose operands are FIELDS.
144 INDICES is a pointer to a buffer of MAX_OPERAND_INSTANCES ints to be filled
148 fr30_cgen_get_insn_operands (od, insn, fields, indices)
150 const CGEN_INSN * insn;
151 const CGEN_FIELDS * fields;
154 const CGEN_OPERAND_INSTANCE *opinst;
157 for (i = 0, opinst = CGEN_INSN_OPERANDS (insn);
159 && CGEN_OPERAND_INSTANCE_TYPE (opinst) != CGEN_OPERAND_INSTANCE_END;
162 const CGEN_OPERAND *op = CGEN_OPERAND_INSTANCE_OPERAND (opinst);
164 indices[i] = CGEN_OPERAND_INSTANCE_INDEX (opinst);
166 indices[i] = fr30_cgen_get_int_operand (CGEN_OPERAND_INDEX (op),
171 /* Cover function to fr30_cgen_get_insn_operands when either INSN or FIELDS
173 The INSN, INSN_VALUE, and LENGTH arguments are passed to
174 fr30_cgen_lookup_insn unchanged.
176 The result is the insn table entry or NULL if the instruction wasn't
180 fr30_cgen_lookup_get_insn_operands (od, insn, insn_value, length, indices)
182 const CGEN_INSN *insn;
183 CGEN_INSN_BYTES insn_value;
189 /* Pass non-zero for ALIAS_P only if INSN != NULL.
190 If INSN == NULL, we want a real insn. */
191 insn = fr30_cgen_lookup_insn (od, insn, insn_value, length, &fields,
196 fr30_cgen_get_insn_operands (od, insn, &fields, indices);
201 static const CGEN_ATTR_ENTRY MACH_attr[] =
203 { "base", MACH_BASE },
204 { "fr30", MACH_FR30 },
209 const CGEN_ATTR_TABLE fr30_cgen_hardware_attr_table[] =
211 { "CACHE-ADDR", NULL },
217 const CGEN_ATTR_TABLE fr30_cgen_operand_attr_table[] =
219 { "ABS-ADDR", NULL },
220 { "HASH-PREFIX", NULL },
221 { "NEGATIVE", NULL },
222 { "PCREL-ADDR", NULL },
224 { "SEM-ONLY", NULL },
225 { "SIGN-OPT", NULL },
227 { "UNSIGNED", NULL },
231 const CGEN_ATTR_TABLE fr30_cgen_insn_attr_table[] =
234 { "COND-CTI", NULL },
237 { "RELAXABLE", NULL },
238 { "SKIP-CTI", NULL },
239 { "UNCOND-CTI", NULL },
244 CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_gr_entries[] =
267 CGEN_KEYWORD fr30_cgen_opval_h_gr =
269 & fr30_cgen_opval_h_gr_entries[0],
273 CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_dr_entries[] =
283 CGEN_KEYWORD fr30_cgen_opval_h_dr =
285 & fr30_cgen_opval_h_dr_entries[0],
289 CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_ps_entries[] =
294 CGEN_KEYWORD fr30_cgen_opval_h_ps =
296 & fr30_cgen_opval_h_ps_entries[0],
300 CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_r13_entries[] =
305 CGEN_KEYWORD fr30_cgen_opval_h_r13 =
307 & fr30_cgen_opval_h_r13_entries[0],
311 CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_r14_entries[] =
316 CGEN_KEYWORD fr30_cgen_opval_h_r14 =
318 & fr30_cgen_opval_h_r14_entries[0],
322 CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_r15_entries[] =
327 CGEN_KEYWORD fr30_cgen_opval_h_r15 =
329 & fr30_cgen_opval_h_r15_entries[0],
334 /* The hardware table. */
336 #define HW_ENT(n) fr30_cgen_hw_entries[n]
337 static const CGEN_HW_ENTRY fr30_cgen_hw_entries[] =
339 { HW_H_PC, & HW_ENT (HW_H_PC + 1), "h-pc", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0|(1<<CGEN_HW_PROFILE)|(1<<CGEN_HW_PC), { 0 } } },
340 { HW_H_MEMORY, & HW_ENT (HW_H_MEMORY + 1), "h-memory", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
341 { HW_H_SINT, & HW_ENT (HW_H_SINT + 1), "h-sint", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
342 { HW_H_UINT, & HW_ENT (HW_H_UINT + 1), "h-uint", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
343 { HW_H_ADDR, & HW_ENT (HW_H_ADDR + 1), "h-addr", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
344 { HW_H_IADDR, & HW_ENT (HW_H_IADDR + 1), "h-iaddr", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
345 { HW_H_GR, & HW_ENT (HW_H_GR + 1), "h-gr", CGEN_ASM_KEYWORD, (PTR) & fr30_cgen_opval_h_gr, { 0, 0|(1<<CGEN_HW_CACHE_ADDR)|(1<<CGEN_HW_PROFILE), { 0 } } },
346 { HW_H_DR, & HW_ENT (HW_H_DR + 1), "h-dr", CGEN_ASM_KEYWORD, (PTR) & fr30_cgen_opval_h_dr, { 0, 0, { 0 } } },
347 { HW_H_PS, & HW_ENT (HW_H_PS + 1), "h-ps", CGEN_ASM_KEYWORD, (PTR) & fr30_cgen_opval_h_ps, { 0, 0, { 0 } } },
348 { HW_H_R13, & HW_ENT (HW_H_R13 + 1), "h-r13", CGEN_ASM_KEYWORD, (PTR) & fr30_cgen_opval_h_r13, { 0, 0, { 0 } } },
349 { HW_H_R14, & HW_ENT (HW_H_R14 + 1), "h-r14", CGEN_ASM_KEYWORD, (PTR) & fr30_cgen_opval_h_r14, { 0, 0, { 0 } } },
350 { HW_H_R15, & HW_ENT (HW_H_R15 + 1), "h-r15", CGEN_ASM_KEYWORD, (PTR) & fr30_cgen_opval_h_r15, { 0, 0, { 0 } } },
351 { HW_H_NBIT, & HW_ENT (HW_H_NBIT + 1), "h-nbit", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
352 { HW_H_ZBIT, & HW_ENT (HW_H_ZBIT + 1), "h-zbit", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
353 { HW_H_VBIT, & HW_ENT (HW_H_VBIT + 1), "h-vbit", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
354 { HW_H_CBIT, & HW_ENT (HW_H_CBIT + 1), "h-cbit", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
358 /* The operand table. */
360 #define OPERAND(op) CONCAT2 (FR30_OPERAND_,op)
361 #define OP_ENT(op) fr30_cgen_operand_table[OPERAND (op)]
363 const CGEN_OPERAND fr30_cgen_operand_table[MAX_OPERANDS] =
365 /* pc: program counter */
366 { "pc", & HW_ENT (HW_H_PC), 0, 0,
367 { 0, 0|(1<<CGEN_OPERAND_SEM_ONLY), { 0 } } },
368 /* Ri: destination register */
369 { "Ri", & HW_ENT (HW_H_GR), 12, 4,
370 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
371 /* Rj: source register */
372 { "Rj", & HW_ENT (HW_H_GR), 8, 4,
373 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
374 /* Rs1: dedicated register */
375 { "Rs1", & HW_ENT (HW_H_DR), 8, 4,
376 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
377 /* Rs2: dedicated register */
378 { "Rs2", & HW_ENT (HW_H_DR), 12, 4,
379 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
380 /* R13: General Register 13 */
381 { "R13", & HW_ENT (HW_H_R13), 0, 0,
383 /* R14: General Register 14 */
384 { "R14", & HW_ENT (HW_H_R14), 0, 0,
386 /* R15: General Register 15 */
387 { "R15", & HW_ENT (HW_H_R15), 0, 0,
389 /* ps: Program Status register */
390 { "ps", & HW_ENT (HW_H_PS), 0, 0,
392 /* u4: 4 bit unsigned immediate */
393 { "u4", & HW_ENT (HW_H_UINT), 8, 4,
394 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
395 /* m4: 4 bit negative immediate */
396 { "m4", & HW_ENT (HW_H_UINT), 8, 4,
397 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
398 /* u8: 8 bit unsigned immediate */
399 { "u8", & HW_ENT (HW_H_UINT), 8, 8,
400 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
401 /* i8: 8 bit unsigned immediate */
402 { "i8", & HW_ENT (HW_H_UINT), 4, 8,
403 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
404 /* udisp6: 6 bit unsigned immediate */
405 { "udisp6", & HW_ENT (HW_H_UINT), 8, 4,
406 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
407 /* disp8: 8 bit signed immediate */
408 { "disp8", & HW_ENT (HW_H_SINT), 4, 8,
409 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_SIGNED), { 0 } } },
410 /* disp9: 9 bit signed immediate */
411 { "disp9", & HW_ENT (HW_H_SINT), 4, 8,
412 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_SIGNED), { 0 } } },
413 /* disp10: 10 bit signed immediate */
414 { "disp10", & HW_ENT (HW_H_SINT), 4, 8,
415 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_SIGNED), { 0 } } },
416 /* s10: 10 bit signed immediate */
417 { "s10", & HW_ENT (HW_H_SINT), 8, 8,
418 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_SIGNED), { 0 } } },
419 /* u10: 10 bit unsigned immediate */
420 { "u10", & HW_ENT (HW_H_UINT), 8, 8,
421 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
422 /* i32: 32 bit immediate */
423 { "i32", & HW_ENT (HW_H_UINT), 16, 32,
424 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_SIGN_OPT)|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
425 /* dir8: 8 bit direct address */
426 { "dir8", & HW_ENT (HW_H_UINT), 8, 8,
427 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
428 /* dir9: 9 bit direct address */
429 { "dir9", & HW_ENT (HW_H_UINT), 8, 8,
430 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
431 /* dir10: 10 bit direct address */
432 { "dir10", & HW_ENT (HW_H_UINT), 8, 8,
433 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
434 /* label9: 9 bit pc relative address */
435 { "label9", & HW_ENT (HW_H_SINT), 8, 8,
436 { 0, 0|(1<<CGEN_OPERAND_SIGNED), { 0 } } },
437 /* label12: 12 bit pc relative address */
438 { "label12", & HW_ENT (HW_H_SINT), 5, 11,
439 { 0, 0|(1<<CGEN_OPERAND_SIGNED), { 0 } } },
440 /* cc: condition codes */
441 { "cc", & HW_ENT (HW_H_UINT), 4, 4,
442 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
443 /* nbit: negative bit */
444 { "nbit", & HW_ENT (HW_H_NBIT), 0, 0,
445 { 0, 0|(1<<CGEN_OPERAND_SEM_ONLY), { 0 } } },
446 /* vbit: overflow bit */
447 { "vbit", & HW_ENT (HW_H_VBIT), 0, 0,
448 { 0, 0|(1<<CGEN_OPERAND_SEM_ONLY), { 0 } } },
450 { "zbit", & HW_ENT (HW_H_ZBIT), 0, 0,
451 { 0, 0|(1<<CGEN_OPERAND_SEM_ONLY), { 0 } } },
452 /* cbit: carry bit */
453 { "cbit", & HW_ENT (HW_H_CBIT), 0, 0,
454 { 0, 0|(1<<CGEN_OPERAND_SEM_ONLY), { 0 } } },
457 /* Operand references. */
459 #define INPUT CGEN_OPERAND_INSTANCE_INPUT
460 #define OUTPUT CGEN_OPERAND_INSTANCE_OUTPUT
461 #define COND_REF CGEN_OPERAND_INSTANCE_COND_REF
463 static const CGEN_OPERAND_INSTANCE fmt_add_ops[] = {
464 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
465 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RJ), 0, 0 },
466 { OUTPUT, "vbit", & HW_ENT (HW_H_VBIT), CGEN_MODE_BI, 0, 0, 0 },
467 { OUTPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0, 0 },
468 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
469 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0, 0 },
470 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0, 0 },
474 static const CGEN_OPERAND_INSTANCE fmt_addi_ops[] = {
475 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
476 { INPUT, "u4", & HW_ENT (HW_H_UINT), CGEN_MODE_USI, & OP_ENT (U4), 0, 0 },
477 { OUTPUT, "vbit", & HW_ENT (HW_H_VBIT), CGEN_MODE_BI, 0, 0, 0 },
478 { OUTPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0, 0 },
479 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
480 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0, 0 },
481 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0, 0 },
485 static const CGEN_OPERAND_INSTANCE fmt_add2_ops[] = {
486 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
487 { INPUT, "m4", & HW_ENT (HW_H_UINT), CGEN_MODE_USI, & OP_ENT (M4), 0, 0 },
488 { OUTPUT, "vbit", & HW_ENT (HW_H_VBIT), CGEN_MODE_BI, 0, 0, 0 },
489 { OUTPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0, 0 },
490 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
491 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0, 0 },
492 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0, 0 },
496 static const CGEN_OPERAND_INSTANCE fmt_addc_ops[] = {
497 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
498 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RJ), 0, 0 },
499 { INPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0, 0 },
500 { OUTPUT, "vbit", & HW_ENT (HW_H_VBIT), CGEN_MODE_BI, 0, 0, 0 },
501 { OUTPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0, 0 },
502 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
503 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0, 0 },
504 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0, 0 },
508 static const CGEN_OPERAND_INSTANCE fmt_addn_ops[] = {
509 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
510 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RJ), 0, 0 },
511 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
515 static const CGEN_OPERAND_INSTANCE fmt_addni_ops[] = {
516 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
517 { INPUT, "u4", & HW_ENT (HW_H_UINT), CGEN_MODE_USI, & OP_ENT (U4), 0, 0 },
518 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
522 static const CGEN_OPERAND_INSTANCE fmt_addn2_ops[] = {
523 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
524 { INPUT, "m4", & HW_ENT (HW_H_UINT), CGEN_MODE_USI, & OP_ENT (M4), 0, 0 },
525 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
529 static const CGEN_OPERAND_INSTANCE fmt_cmp_ops[] = {
530 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
531 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RJ), 0, 0 },
532 { OUTPUT, "vbit", & HW_ENT (HW_H_VBIT), CGEN_MODE_BI, 0, 0, 0 },
533 { OUTPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0, 0 },
534 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0, 0 },
535 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0, 0 },
539 static const CGEN_OPERAND_INSTANCE fmt_cmpi_ops[] = {
540 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
541 { INPUT, "u4", & HW_ENT (HW_H_UINT), CGEN_MODE_USI, & OP_ENT (U4), 0, 0 },
542 { OUTPUT, "vbit", & HW_ENT (HW_H_VBIT), CGEN_MODE_BI, 0, 0, 0 },
543 { OUTPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0, 0 },
544 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0, 0 },
545 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0, 0 },
549 static const CGEN_OPERAND_INSTANCE fmt_cmp2_ops[] = {
550 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
551 { INPUT, "m4", & HW_ENT (HW_H_UINT), CGEN_MODE_USI, & OP_ENT (M4), 0, 0 },
552 { OUTPUT, "vbit", & HW_ENT (HW_H_VBIT), CGEN_MODE_BI, 0, 0, 0 },
553 { OUTPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0, 0 },
554 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0, 0 },
555 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0, 0 },
559 static const CGEN_OPERAND_INSTANCE fmt_and_ops[] = {
560 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
561 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RJ), 0, 0 },
562 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
563 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0, 0 },
564 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0, 0 },
568 static const CGEN_OPERAND_INSTANCE fmt_andm_ops[] = {
569 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_USI, & OP_ENT (RI), 0, 0 },
570 { INPUT, "h_memory_Ri", & HW_ENT (HW_H_MEMORY), CGEN_MODE_SI, 0, 0, 0 },
571 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RJ), 0, 0 },
572 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0, 0 },
573 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0, 0 },
574 { OUTPUT, "h_memory_Ri", & HW_ENT (HW_H_MEMORY), CGEN_MODE_SI, 0, 0, 0 },
578 static const CGEN_OPERAND_INSTANCE fmt_andh_ops[] = {
579 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_USI, & OP_ENT (RI), 0, 0 },
580 { INPUT, "h_memory_Ri", & HW_ENT (HW_H_MEMORY), CGEN_MODE_HI, 0, 0, 0 },
581 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_HI, & OP_ENT (RJ), 0, 0 },
582 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0, 0 },
583 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0, 0 },
584 { OUTPUT, "h_memory_Ri", & HW_ENT (HW_H_MEMORY), CGEN_MODE_HI, 0, 0, 0 },
588 static const CGEN_OPERAND_INSTANCE fmt_andb_ops[] = {
589 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_USI, & OP_ENT (RI), 0, 0 },
590 { INPUT, "h_memory_Ri", & HW_ENT (HW_H_MEMORY), CGEN_MODE_QI, 0, 0, 0 },
591 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_QI, & OP_ENT (RJ), 0, 0 },
592 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0, 0 },
593 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0, 0 },
594 { OUTPUT, "h_memory_Ri", & HW_ENT (HW_H_MEMORY), CGEN_MODE_QI, 0, 0, 0 },
598 static const CGEN_OPERAND_INSTANCE fmt_ldi32_ops[] = {
599 { INPUT, "i32", & HW_ENT (HW_H_UINT), CGEN_MODE_USI, & OP_ENT (I32), 0, 0 },
600 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0, 0 },
608 #define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
609 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
610 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
612 /* The instruction table.
613 This is currently non-static because the simulator accesses it
616 const CGEN_INSN fr30_cgen_insn_table_entries[MAX_INSNS] =
618 /* Special null first entry.
619 A `num' value of zero is thus invalid.
620 Also, the special `invalid' insn resides here. */
625 FR30_INSN_ADD, "add", "add",
626 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
627 { 16, 16, 0xff00 }, 0xa600,
628 (PTR) & fmt_add_ops[0],
634 FR30_INSN_ADDI, "addi", "add",
635 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
636 { 16, 16, 0xff00 }, 0xa400,
637 (PTR) & fmt_addi_ops[0],
643 FR30_INSN_ADD2, "add2", "add2",
644 { { MNEM, ' ', OP (M4), ',', OP (RI), 0 } },
645 { 16, 16, 0xff00 }, 0xa500,
646 (PTR) & fmt_add2_ops[0],
652 FR30_INSN_ADDC, "addc", "addc",
653 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
654 { 16, 16, 0xff00 }, 0xa700,
655 (PTR) & fmt_addc_ops[0],
661 FR30_INSN_ADDN, "addn", "addn",
662 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
663 { 16, 16, 0xff00 }, 0xa200,
664 (PTR) & fmt_addn_ops[0],
670 FR30_INSN_ADDNI, "addni", "addn",
671 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
672 { 16, 16, 0xff00 }, 0xa000,
673 (PTR) & fmt_addni_ops[0],
679 FR30_INSN_ADDN2, "addn2", "addn2",
680 { { MNEM, ' ', OP (M4), ',', OP (RI), 0 } },
681 { 16, 16, 0xff00 }, 0xa100,
682 (PTR) & fmt_addn2_ops[0],
688 FR30_INSN_SUB, "sub", "sub",
689 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
690 { 16, 16, 0xff00 }, 0xac00,
691 (PTR) & fmt_add_ops[0],
697 FR30_INSN_SUBC, "subc", "subc",
698 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
699 { 16, 16, 0xff00 }, 0xad00,
700 (PTR) & fmt_addc_ops[0],
706 FR30_INSN_SUBN, "subn", "subn",
707 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
708 { 16, 16, 0xff00 }, 0xae00,
709 (PTR) & fmt_addn_ops[0],
715 FR30_INSN_CMP, "cmp", "cmp",
716 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
717 { 16, 16, 0xff00 }, 0xaa00,
718 (PTR) & fmt_cmp_ops[0],
724 FR30_INSN_CMPI, "cmpi", "cmp",
725 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
726 { 16, 16, 0xff00 }, 0xa800,
727 (PTR) & fmt_cmpi_ops[0],
733 FR30_INSN_CMP2, "cmp2", "cmp2",
734 { { MNEM, ' ', OP (M4), ',', OP (RI), 0 } },
735 { 16, 16, 0xff00 }, 0xa900,
736 (PTR) & fmt_cmp2_ops[0],
742 FR30_INSN_AND, "and", "and",
743 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
744 { 16, 16, 0xff00 }, 0x8200,
745 (PTR) & fmt_and_ops[0],
751 FR30_INSN_OR, "or", "or",
752 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
753 { 16, 16, 0xff00 }, 0x9200,
754 (PTR) & fmt_and_ops[0],
760 FR30_INSN_EOR, "eor", "eor",
761 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
762 { 16, 16, 0xff00 }, 0x9a00,
763 (PTR) & fmt_and_ops[0],
769 FR30_INSN_ANDM, "andm", "and",
770 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
771 { 16, 16, 0xff00 }, 0x8400,
772 (PTR) & fmt_andm_ops[0],
778 FR30_INSN_ANDH, "andh", "andh",
779 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
780 { 16, 16, 0xff00 }, 0x8500,
781 (PTR) & fmt_andh_ops[0],
787 FR30_INSN_ANDB, "andb", "andb",
788 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
789 { 16, 16, 0xff00 }, 0x8600,
790 (PTR) & fmt_andb_ops[0],
796 FR30_INSN_ORM, "orm", "or",
797 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
798 { 16, 16, 0xff00 }, 0x9400,
799 (PTR) & fmt_andm_ops[0],
805 FR30_INSN_ORH, "orh", "orh",
806 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
807 { 16, 16, 0xff00 }, 0x9500,
808 (PTR) & fmt_andh_ops[0],
814 FR30_INSN_ORB, "orb", "orb",
815 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
816 { 16, 16, 0xff00 }, 0x9600,
817 (PTR) & fmt_andb_ops[0],
823 FR30_INSN_EORM, "eorm", "eor",
824 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
825 { 16, 16, 0xff00 }, 0x9c00,
826 (PTR) & fmt_andm_ops[0],
832 FR30_INSN_EORH, "eorh", "eorh",
833 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
834 { 16, 16, 0xff00 }, 0x9d00,
835 (PTR) & fmt_andh_ops[0],
841 FR30_INSN_EORB, "eorb", "eorb",
842 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
843 { 16, 16, 0xff00 }, 0x9e00,
844 (PTR) & fmt_andb_ops[0],
850 FR30_INSN_BANDL, "bandl", "bandl",
851 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
852 { 16, 16, 0xff00 }, 0x8000,
859 FR30_INSN_BORL, "borl", "borl",
860 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
861 { 16, 16, 0xff00 }, 0x9000,
868 FR30_INSN_BEORL, "beorl", "beorl",
869 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
870 { 16, 16, 0xff00 }, 0x9800,
877 FR30_INSN_BANDH, "bandh", "bandh",
878 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
879 { 16, 16, 0xff00 }, 0x8100,
886 FR30_INSN_BORH, "borh", "borh",
887 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
888 { 16, 16, 0xff00 }, 0x9100,
895 FR30_INSN_BEORH, "beorh", "beorh",
896 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
897 { 16, 16, 0xff00 }, 0x9900,
904 FR30_INSN_BTSTL, "btstl", "btstl",
905 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
906 { 16, 16, 0xff00 }, 0x8800,
913 FR30_INSN_BTSTH, "btsth", "btsth",
914 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
915 { 16, 16, 0xff00 }, 0x8900,
922 FR30_INSN_MUL, "mul", "mul",
923 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
924 { 16, 16, 0xff00 }, 0xaf00,
931 FR30_INSN_MULU, "mulu", "mulu",
932 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
933 { 16, 16, 0xff00 }, 0xab00,
940 FR30_INSN_MULH, "mulh", "mulh",
941 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
942 { 16, 16, 0xff00 }, 0xbf00,
949 FR30_INSN_MULUH, "muluh", "muluh",
950 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
951 { 16, 16, 0xff00 }, 0xbb00,
958 FR30_INSN_DIV0S, "div0s", "div0s",
959 { { MNEM, ' ', OP (RI), 0 } },
960 { 16, 16, 0xfff0 }, 0x9740,
967 FR30_INSN_DIV0U, "div0u", "div0u",
968 { { MNEM, ' ', OP (RI), 0 } },
969 { 16, 16, 0xfff0 }, 0x9750,
976 FR30_INSN_DIV1, "div1", "div1",
977 { { MNEM, ' ', OP (RI), 0 } },
978 { 16, 16, 0xfff0 }, 0x9760,
985 FR30_INSN_DIV2, "div2", "div2",
986 { { MNEM, ' ', OP (RI), 0 } },
987 { 16, 16, 0xfff0 }, 0x9770,
994 FR30_INSN_DIV3, "div3", "div3",
996 { 16, 16, 0xffff }, 0x9f60,
1003 FR30_INSN_DIV4S, "div4s", "div4s",
1005 { 16, 16, 0xffff }, 0x9f70,
1012 FR30_INSN_LSL, "lsl", "lsl",
1013 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
1014 { 16, 16, 0xff00 }, 0xb600,
1021 FR30_INSN_LSLI, "lsli", "lsl",
1022 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
1023 { 16, 16, 0xff00 }, 0xb400,
1030 FR30_INSN_LSL2, "lsl2", "lsl2",
1031 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
1032 { 16, 16, 0xff00 }, 0xb500,
1039 FR30_INSN_LSR, "lsr", "lsr",
1040 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
1041 { 16, 16, 0xff00 }, 0xb200,
1048 FR30_INSN_LSRI, "lsri", "lsr",
1049 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
1050 { 16, 16, 0xff00 }, 0xb000,
1057 FR30_INSN_LSR2, "lsr2", "lsr2",
1058 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
1059 { 16, 16, 0xff00 }, 0xb100,
1066 FR30_INSN_ASR, "asr", "asr",
1067 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
1068 { 16, 16, 0xff00 }, 0xba00,
1075 FR30_INSN_ASRI, "asri", "asr",
1076 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
1077 { 16, 16, 0xff00 }, 0xb800,
1084 FR30_INSN_ASR2, "asr2", "asr2",
1085 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
1086 { 16, 16, 0xff00 }, 0xb900,
1093 FR30_INSN_LDI_8, "ldi:8", "ldi:8",
1094 { { MNEM, ' ', OP (I8), ',', OP (RI), 0 } },
1095 { 16, 16, 0xf000 }, 0xc000,
1099 /* ldi:32 $i32,$Ri */
1102 FR30_INSN_LDI32, "ldi32", "ldi:32",
1103 { { MNEM, ' ', OP (I32), ',', OP (RI), 0 } },
1104 { 16, 48, 0xfff0 }, 0x9f80,
1105 (PTR) & fmt_ldi32_ops[0],
1111 FR30_INSN_LD, "ld", "ld",
1112 { { MNEM, ' ', '@', OP (RJ), ',', OP (RI), 0 } },
1113 { 16, 16, 0xff00 }, 0x400,
1120 FR30_INSN_LDUH, "lduh", "lduh",
1121 { { MNEM, ' ', '@', OP (RJ), ',', OP (RI), 0 } },
1122 { 16, 16, 0xff00 }, 0x500,
1129 FR30_INSN_LDUB, "ldub", "ldub",
1130 { { MNEM, ' ', '@', OP (RJ), ',', OP (RI), 0 } },
1131 { 16, 16, 0xff00 }, 0x600,
1135 /* ld @($r13,$Rj),$Ri */
1138 FR30_INSN_LDR13, "ldr13", "ld",
1139 { { MNEM, ' ', '@', '(', OP (R13), ',', OP (RJ), ')', ',', OP (RI), 0 } },
1140 { 16, 16, 0xff00 }, 0x0,
1144 /* lduh @($r13,$Rj),$Ri */
1147 FR30_INSN_LDR13UH, "ldr13uh", "lduh",
1148 { { MNEM, ' ', '@', '(', OP (R13), ',', OP (RJ), ')', ',', OP (RI), 0 } },
1149 { 16, 16, 0xff00 }, 0x100,
1153 /* ldub @($r13,$Rj),$Ri */
1156 FR30_INSN_LDR13UB, "ldr13ub", "ldub",
1157 { { MNEM, ' ', '@', '(', OP (R13), ',', OP (RJ), ')', ',', OP (RI), 0 } },
1158 { 16, 16, 0xff00 }, 0x200,
1162 /* ld @($r14,$disp10),$Ri */
1165 FR30_INSN_LDR14, "ldr14", "ld",
1166 { { MNEM, ' ', '@', '(', OP (R14), ',', OP (DISP10), ')', ',', OP (RI), 0 } },
1167 { 16, 16, 0xf000 }, 0x2000,
1171 /* lduh @($r14,$disp9),$Ri */
1174 FR30_INSN_LDR14UH, "ldr14uh", "lduh",
1175 { { MNEM, ' ', '@', '(', OP (R14), ',', OP (DISP9), ')', ',', OP (RI), 0 } },
1176 { 16, 16, 0xf000 }, 0x4000,
1180 /* ldub @($r14,$disp8),$Ri */
1183 FR30_INSN_LDR14UB, "ldr14ub", "ldub",
1184 { { MNEM, ' ', '@', '(', OP (R14), ',', OP (DISP8), ')', ',', OP (RI), 0 } },
1185 { 16, 16, 0xf000 }, 0x6000,
1189 /* ld @($r15,$udisp6),$Ri */
1192 FR30_INSN_LDR15, "ldr15", "ld",
1193 { { MNEM, ' ', '@', '(', OP (R15), ',', OP (UDISP6), ')', ',', OP (RI), 0 } },
1194 { 16, 16, 0xff00 }, 0x300,
1201 FR30_INSN_LDR15GR, "ldr15gr", "ld",
1202 { { MNEM, ' ', '@', OP (R15), '+', ',', OP (RI), 0 } },
1203 { 16, 16, 0xfff0 }, 0x700,
1207 /* ld @$r15+,$Rs2 */
1210 FR30_INSN_LDR15DR, "ldr15dr", "ld",
1211 { { MNEM, ' ', '@', OP (R15), '+', ',', OP (RS2), 0 } },
1212 { 16, 16, 0xfff0 }, 0x780,
1219 FR30_INSN_LDR15PS, "ldr15ps", "ld",
1220 { { MNEM, ' ', '@', OP (R15), '+', ',', OP (PS), 0 } },
1221 { 16, 16, 0xffff }, 0x790,
1228 FR30_INSN_ST, "st", "st",
1229 { { MNEM, ' ', OP (RI), ',', '@', OP (RJ), 0 } },
1230 { 16, 16, 0xff00 }, 0x1400,
1237 FR30_INSN_STH, "sth", "sth",
1238 { { MNEM, ' ', OP (RI), ',', '@', OP (RJ), 0 } },
1239 { 16, 16, 0xff00 }, 0x1500,
1246 FR30_INSN_STB, "stb", "stb",
1247 { { MNEM, ' ', OP (RI), ',', '@', OP (RJ), 0 } },
1248 { 16, 16, 0xff00 }, 0x1600,
1252 /* st $Ri,@($r13,$Rj) */
1255 FR30_INSN_STR13, "str13", "st",
1256 { { MNEM, ' ', OP (RI), ',', '@', '(', OP (R13), ',', OP (RJ), ')', 0 } },
1257 { 16, 16, 0xff00 }, 0x1000,
1261 /* sth $Ri,@($r13,$Rj) */
1264 FR30_INSN_STR13H, "str13h", "sth",
1265 { { MNEM, ' ', OP (RI), ',', '@', '(', OP (R13), ',', OP (RJ), ')', 0 } },
1266 { 16, 16, 0xff00 }, 0x1100,
1270 /* stb $Ri,@($r13,$Rj) */
1273 FR30_INSN_STR13B, "stR13b", "stb",
1274 { { MNEM, ' ', OP (RI), ',', '@', '(', OP (R13), ',', OP (RJ), ')', 0 } },
1275 { 16, 16, 0xff00 }, 0x1200,
1279 /* st $Ri,@($r14,$disp10) */
1282 FR30_INSN_STR14, "str14", "st",
1283 { { MNEM, ' ', OP (RI), ',', '@', '(', OP (R14), ',', OP (DISP10), ')', 0 } },
1284 { 16, 16, 0xf000 }, 0x3000,
1288 /* sth $Ri,@($r14,$disp9) */
1291 FR30_INSN_STR14H, "str14h", "sth",
1292 { { MNEM, ' ', OP (RI), ',', '@', '(', OP (R14), ',', OP (DISP9), ')', 0 } },
1293 { 16, 16, 0xf000 }, 0x5000,
1297 /* stb $Ri,@($r14,$disp8) */
1300 FR30_INSN_STR14B, "str14b", "stb",
1301 { { MNEM, ' ', OP (RI), ',', '@', '(', OP (R14), ',', OP (DISP8), ')', 0 } },
1302 { 16, 16, 0xf000 }, 0x7000,
1306 /* st $Ri,@($r15,$udisp6) */
1309 FR30_INSN_STR15, "str15", "st",
1310 { { MNEM, ' ', OP (RI), ',', '@', '(', OP (R15), ',', OP (UDISP6), ')', 0 } },
1311 { 16, 16, 0xff00 }, 0x1300,
1318 FR30_INSN_STR15GR, "str15gr", "st",
1319 { { MNEM, ' ', OP (RI), ',', '@', '-', OP (R15), 0 } },
1320 { 16, 16, 0xfff0 }, 0x1700,
1324 /* st $Rs2,@-$r15 */
1327 FR30_INSN_STR15DR, "str15dr", "st",
1328 { { MNEM, ' ', OP (RS2), ',', '@', '-', OP (R15), 0 } },
1329 { 16, 16, 0xfff0 }, 0x1780,
1336 FR30_INSN_STR15PS, "str15ps", "st",
1337 { { MNEM, ' ', OP (PS), ',', '@', '-', OP (R15), 0 } },
1338 { 16, 16, 0xffff }, 0x1790,
1345 FR30_INSN_MOV, "mov", "mov",
1346 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
1347 { 16, 16, 0xff00 }, 0x8b00,
1354 FR30_INSN_MOVDR, "movdr", "mov",
1355 { { MNEM, ' ', OP (RS1), ',', OP (RI), 0 } },
1356 { 16, 16, 0xff00 }, 0xb700,
1363 FR30_INSN_MOVPS, "movps", "mov",
1364 { { MNEM, ' ', OP (PS), ',', OP (RI), 0 } },
1365 { 16, 16, 0xfff0 }, 0x1710,
1372 FR30_INSN_MOV2DR, "mov2dr", "mov",
1373 { { MNEM, ' ', OP (RI), ',', OP (RS1), 0 } },
1374 { 16, 16, 0xff00 }, 0xb300,
1381 FR30_INSN_MOV2PS, "mov2ps", "mov",
1382 { { MNEM, ' ', OP (RI), ',', OP (PS), 0 } },
1383 { 16, 16, 0xfff0 }, 0x710,
1390 FR30_INSN_JMP, "jmp", "jmp",
1391 { { MNEM, ' ', '@', OP (RI), 0 } },
1392 { 16, 16, 0xfff0 }, 0x9700,
1399 FR30_INSN_JMPD, "jmpd", "jmp:D",
1400 { { MNEM, ' ', '@', OP (RI), 0 } },
1401 { 16, 16, 0xfff0 }, 0x9f00,
1408 FR30_INSN_CALL, "call", "call",
1409 { { MNEM, ' ', OP (LABEL12), 0 } },
1410 { 16, 16, 0xf400 }, 0xd000,
1414 /* call:D $label12 */
1417 FR30_INSN_CALLD, "calld", "call:D",
1418 { { MNEM, ' ', OP (LABEL12), 0 } },
1419 { 16, 16, 0xf400 }, 0xd400,
1426 FR30_INSN_CALLR, "callr", "call",
1427 { { MNEM, ' ', '@', OP (RI), 0 } },
1428 { 16, 16, 0xfff0 }, 0x9710,
1435 FR30_INSN_CALLRD, "callrd", "call:D",
1436 { { MNEM, ' ', '@', OP (RI), 0 } },
1437 { 16, 16, 0xfff0 }, 0x9f10,
1444 FR30_INSN_RET, "ret", "ret",
1446 { 16, 16, 0xffff }, 0x9720,
1453 FR30_INSN_RETD, "retd", "ret:D",
1455 { 16, 16, 0xffff }, 0x9f20,
1462 FR30_INSN_INT, "int", "int",
1463 { { MNEM, ' ', OP (U8), 0 } },
1464 { 16, 16, 0xff00 }, 0x1f00,
1471 FR30_INSN_INTE, "inte", "inte",
1473 { 16, 16, 0xffff }, 0x9f30,
1480 FR30_INSN_RETI, "reti", "reti",
1482 { 16, 16, 0xffff }, 0x9730,
1489 FR30_INSN_BRA, "bra", "bra",
1490 { { MNEM, ' ', OP (LABEL9), 0 } },
1491 { 16, 16, 0xff00 }, 0xe000,
1498 FR30_INSN_BNO, "bno", "bno",
1499 { { MNEM, ' ', OP (LABEL9), 0 } },
1500 { 16, 16, 0xff00 }, 0xe100,
1507 FR30_INSN_BEQ, "beq", "beq",
1508 { { MNEM, ' ', OP (LABEL9), 0 } },
1509 { 16, 16, 0xff00 }, 0xe200,
1516 FR30_INSN_BNE, "bne", "bne",
1517 { { MNEM, ' ', OP (LABEL9), 0 } },
1518 { 16, 16, 0xff00 }, 0xe300,
1525 FR30_INSN_BC, "bc", "bc",
1526 { { MNEM, ' ', OP (LABEL9), 0 } },
1527 { 16, 16, 0xff00 }, 0xe400,
1534 FR30_INSN_BNC, "bnc", "bnc",
1535 { { MNEM, ' ', OP (LABEL9), 0 } },
1536 { 16, 16, 0xff00 }, 0xe500,
1543 FR30_INSN_BN, "bn", "bn",
1544 { { MNEM, ' ', OP (LABEL9), 0 } },
1545 { 16, 16, 0xff00 }, 0xe600,
1552 FR30_INSN_BP, "bp", "bp",
1553 { { MNEM, ' ', OP (LABEL9), 0 } },
1554 { 16, 16, 0xff00 }, 0xe700,
1561 FR30_INSN_BV, "bv", "bv",
1562 { { MNEM, ' ', OP (LABEL9), 0 } },
1563 { 16, 16, 0xff00 }, 0xe800,
1570 FR30_INSN_BNV, "bnv", "bnv",
1571 { { MNEM, ' ', OP (LABEL9), 0 } },
1572 { 16, 16, 0xff00 }, 0xe900,
1579 FR30_INSN_BLT, "blt", "blt",
1580 { { MNEM, ' ', OP (LABEL9), 0 } },
1581 { 16, 16, 0xff00 }, 0xea00,
1588 FR30_INSN_BGE, "bge", "bge",
1589 { { MNEM, ' ', OP (LABEL9), 0 } },
1590 { 16, 16, 0xff00 }, 0xeb00,
1597 FR30_INSN_BLE, "ble", "ble",
1598 { { MNEM, ' ', OP (LABEL9), 0 } },
1599 { 16, 16, 0xff00 }, 0xec00,
1606 FR30_INSN_BGT, "bgt", "bgt",
1607 { { MNEM, ' ', OP (LABEL9), 0 } },
1608 { 16, 16, 0xff00 }, 0xed00,
1615 FR30_INSN_BLS, "bls", "bls",
1616 { { MNEM, ' ', OP (LABEL9), 0 } },
1617 { 16, 16, 0xff00 }, 0xee00,
1624 FR30_INSN_BHI, "bhi", "bhi",
1625 { { MNEM, ' ', OP (LABEL9), 0 } },
1626 { 16, 16, 0xff00 }, 0xef00,
1633 FR30_INSN_BRAD, "brad", "bra:D",
1634 { { MNEM, ' ', OP (LABEL9), 0 } },
1635 { 16, 16, 0xff00 }, 0xf000,
1642 FR30_INSN_BNOD, "bnod", "bno:D",
1643 { { MNEM, ' ', OP (LABEL9), 0 } },
1644 { 16, 16, 0xff00 }, 0xf100,
1651 FR30_INSN_BEQD, "beqd", "beq:D",
1652 { { MNEM, ' ', OP (LABEL9), 0 } },
1653 { 16, 16, 0xff00 }, 0xf200,
1660 FR30_INSN_BNED, "bned", "bne:D",
1661 { { MNEM, ' ', OP (LABEL9), 0 } },
1662 { 16, 16, 0xff00 }, 0xf300,
1669 FR30_INSN_BCD, "bcd", "bc:D",
1670 { { MNEM, ' ', OP (LABEL9), 0 } },
1671 { 16, 16, 0xff00 }, 0xf400,
1678 FR30_INSN_BNCD, "bncd", "bnc:D",
1679 { { MNEM, ' ', OP (LABEL9), 0 } },
1680 { 16, 16, 0xff00 }, 0xf500,
1687 FR30_INSN_BND, "bnd", "bn:D",
1688 { { MNEM, ' ', OP (LABEL9), 0 } },
1689 { 16, 16, 0xff00 }, 0xf600,
1696 FR30_INSN_BPD, "bpd", "bp:D",
1697 { { MNEM, ' ', OP (LABEL9), 0 } },
1698 { 16, 16, 0xff00 }, 0xf700,
1705 FR30_INSN_BVD, "bvd", "bv:D",
1706 { { MNEM, ' ', OP (LABEL9), 0 } },
1707 { 16, 16, 0xff00 }, 0xf800,
1714 FR30_INSN_BNVD, "bnvd", "bnv:D",
1715 { { MNEM, ' ', OP (LABEL9), 0 } },
1716 { 16, 16, 0xff00 }, 0xf900,
1723 FR30_INSN_BLTD, "bltd", "blt:D",
1724 { { MNEM, ' ', OP (LABEL9), 0 } },
1725 { 16, 16, 0xff00 }, 0xfa00,
1732 FR30_INSN_BGED, "bged", "bge:D",
1733 { { MNEM, ' ', OP (LABEL9), 0 } },
1734 { 16, 16, 0xff00 }, 0xfb00,
1741 FR30_INSN_BLED, "bled", "ble:D",
1742 { { MNEM, ' ', OP (LABEL9), 0 } },
1743 { 16, 16, 0xff00 }, 0xfc00,
1750 FR30_INSN_BGTD, "bgtd", "bgt:D",
1751 { { MNEM, ' ', OP (LABEL9), 0 } },
1752 { 16, 16, 0xff00 }, 0xfd00,
1759 FR30_INSN_BLSD, "blsd", "bls:D",
1760 { { MNEM, ' ', OP (LABEL9), 0 } },
1761 { 16, 16, 0xff00 }, 0xfe00,
1768 FR30_INSN_BHID, "bhid", "bhi:D",
1769 { { MNEM, ' ', OP (LABEL9), 0 } },
1770 { 16, 16, 0xff00 }, 0xff00,
1774 /* dmov @$dir10,$R13 */
1777 FR30_INSN_DMOV2R13, "dmov2r13", "dmov",
1778 { { MNEM, ' ', '@', OP (DIR10), ',', OP (R13), 0 } },
1779 { 16, 16, 0xff00 }, 0x800,
1783 /* dmovh @$dir9,$R13 */
1786 FR30_INSN_DMOV2R13H, "dmov2r13h", "dmovh",
1787 { { MNEM, ' ', '@', OP (DIR9), ',', OP (R13), 0 } },
1788 { 16, 16, 0xff00 }, 0x900,
1792 /* dmovb @$dir8,$R13 */
1795 FR30_INSN_DMOV2R13B, "dmov2r13b", "dmovb",
1796 { { MNEM, ' ', '@', OP (DIR8), ',', OP (R13), 0 } },
1797 { 16, 16, 0xff00 }, 0xa00,
1801 /* dmov $R13,@$dir10 */
1804 FR30_INSN_DMOVR13, "dmovr13", "dmov",
1805 { { MNEM, ' ', OP (R13), ',', '@', OP (DIR10), 0 } },
1806 { 16, 16, 0xff00 }, 0x1800,
1810 /* dmovh $R13,@$dir9 */
1813 FR30_INSN_DMOVR13H, "dmovr13h", "dmovh",
1814 { { MNEM, ' ', OP (R13), ',', '@', OP (DIR9), 0 } },
1815 { 16, 16, 0xff00 }, 0x1900,
1819 /* dmovb $R13,@$dir8 */
1822 FR30_INSN_DMOVR13B, "dmovr13b", "dmovb",
1823 { { MNEM, ' ', OP (R13), ',', '@', OP (DIR8), 0 } },
1824 { 16, 16, 0xff00 }, 0x1a00,
1828 /* dmov @$dir10,@$R13+ */
1831 FR30_INSN_DMOV2R13PI, "dmov2r13pi", "dmov",
1832 { { MNEM, ' ', '@', OP (DIR10), ',', '@', OP (R13), '+', 0 } },
1833 { 16, 16, 0xff00 }, 0xc00,
1837 /* dmovh @$dir9,@$R13+ */
1840 FR30_INSN_DMOV2R13PIH, "dmov2r13pih", "dmovh",
1841 { { MNEM, ' ', '@', OP (DIR9), ',', '@', OP (R13), '+', 0 } },
1842 { 16, 16, 0xff00 }, 0xd00,
1846 /* dmovb @$dir8,@$R13+ */
1849 FR30_INSN_DMOV2R13PIB, "dmov2r13pib", "dmovb",
1850 { { MNEM, ' ', '@', OP (DIR8), ',', '@', OP (R13), '+', 0 } },
1851 { 16, 16, 0xff00 }, 0xe00,
1855 /* dmov @$R13+,@$dir10 */
1858 FR30_INSN_DMOVR13PI, "dmovr13pi", "dmov",
1859 { { MNEM, ' ', '@', OP (R13), '+', ',', '@', OP (DIR10), 0 } },
1860 { 16, 16, 0xff00 }, 0x1c00,
1864 /* dmovh @$R13+,@$dir9 */
1867 FR30_INSN_DMOVR13PIH, "dmovr13pih", "dmovh",
1868 { { MNEM, ' ', '@', OP (R13), '+', ',', '@', OP (DIR9), 0 } },
1869 { 16, 16, 0xff00 }, 0x1d00,
1873 /* dmovb @$R13+,@$dir8 */
1876 FR30_INSN_DMOVR13PIB, "dmovr13pib", "dmovb",
1877 { { MNEM, ' ', '@', OP (R13), '+', ',', '@', OP (DIR8), 0 } },
1878 { 16, 16, 0xff00 }, 0x1e00,
1882 /* dmov @$dir10,@-$R15 */
1885 FR30_INSN_DMOV2R15PD, "dmov2r15pd", "dmov",
1886 { { MNEM, ' ', '@', OP (DIR10), ',', '@', '-', OP (R15), 0 } },
1887 { 16, 16, 0xff00 }, 0xb00,
1891 /* dmov @$R15+,@$dir10 */
1894 FR30_INSN_DMOVR15PI, "dmovr15pi", "dmov",
1895 { { MNEM, ' ', '@', OP (R15), '+', ',', '@', OP (DIR10), 0 } },
1896 { 16, 16, 0xff00 }, 0x1b00,
1900 /* ldres @$Ri+,$u4 */
1903 FR30_INSN_LDRES, "ldres", "ldres",
1904 { { MNEM, ' ', '@', OP (RI), '+', ',', OP (U4), 0 } },
1905 { 16, 16, 0xff00 }, 0xbc00,
1909 /* stres $u4,@$Ri+ */
1912 FR30_INSN_STRES, "stres", "stres",
1913 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), '+', 0 } },
1914 { 16, 16, 0xff00 }, 0xbd00,
1921 FR30_INSN_NOP, "nop", "nop",
1923 { 16, 16, 0xffff }, 0x9fa0,
1930 FR30_INSN_ANDCCR, "andccr", "andccr",
1931 { { MNEM, ' ', OP (U8), 0 } },
1932 { 16, 16, 0xff00 }, 0x8300,
1939 FR30_INSN_ORCCR, "orccr", "orccr",
1940 { { MNEM, ' ', OP (U8), 0 } },
1941 { 16, 16, 0xff00 }, 0x9300,
1948 FR30_INSN_STILM, "stilm", "stilm",
1949 { { MNEM, ' ', OP (U8), 0 } },
1950 { 16, 16, 0xff00 }, 0x8700,
1957 FR30_INSN_ADDSP, "addsp", "addsp",
1958 { { MNEM, ' ', OP (S10), 0 } },
1959 { 16, 16, 0xff00 }, 0xa300,
1966 FR30_INSN_EXTSB, "extsb", "extsb",
1967 { { MNEM, ' ', OP (RI), 0 } },
1968 { 16, 16, 0xfff0 }, 0x9780,
1975 FR30_INSN_EXTUB, "extub", "extub",
1976 { { MNEM, ' ', OP (RI), 0 } },
1977 { 16, 16, 0xfff0 }, 0x9790,
1984 FR30_INSN_EXTSH, "extsh", "extsh",
1985 { { MNEM, ' ', OP (RI), 0 } },
1986 { 16, 16, 0xfff0 }, 0x97a0,
1993 FR30_INSN_EXTUH, "extuh", "extuh",
1994 { { MNEM, ' ', OP (RI), 0 } },
1995 { 16, 16, 0xfff0 }, 0x97b0,
2002 FR30_INSN_ENTER, "enter", "enter",
2003 { { MNEM, ' ', OP (U10), 0 } },
2004 { 16, 16, 0xff00 }, 0xf00,
2011 FR30_INSN_LEAVE, "leave", "leave",
2013 { 16, 16, 0xffff }, 0x9f90,
2020 FR30_INSN_XCHB, "xchb", "xchb",
2021 { { MNEM, ' ', '@', OP (RJ), ',', OP (RI), 0 } },
2022 { 16, 16, 0xff00 }, 0x8a00,
2032 static const CGEN_INSN_TABLE insn_table =
2034 & fr30_cgen_insn_table_entries[0],
2040 /* Each non-simple macro entry points to an array of expansion possibilities. */
2042 #define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
2043 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
2044 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
2046 /* The macro instruction table. */
2048 static const CGEN_INSN macro_insn_table_entries[] =
2056 static const CGEN_INSN_TABLE macro_insn_table =
2058 & macro_insn_table_entries[0],
2060 (sizeof (macro_insn_table_entries) /
2061 sizeof (macro_insn_table_entries[0])),
2070 /* Return non-zero if INSN is to be added to the hash table.
2071 Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file. */
2074 asm_hash_insn_p (insn)
2075 const CGEN_INSN * insn;
2077 return CGEN_ASM_HASH_P (insn);
2081 dis_hash_insn_p (insn)
2082 const CGEN_INSN * insn;
2084 /* If building the hash table and the NO-DIS attribute is present,
2086 if (CGEN_INSN_ATTR (insn, CGEN_INSN_NO_DIS))
2088 return CGEN_DIS_HASH_P (insn);
2091 /* The result is the hash value of the insn.
2092 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
2095 asm_hash_insn (mnem)
2098 return CGEN_ASM_HASH (mnem);
2101 /* BUF is a pointer to the insn's bytes in target order.
2102 VALUE is an integer of the first CGEN_BASE_INSN_BITSIZE bits,
2106 dis_hash_insn (buf, value)
2108 CGEN_INSN_INT value;
2110 return CGEN_DIS_HASH (buf, value);
2113 /* Initialize an opcode table and return a descriptor.
2114 It's much like opening a file, and must be the first function called. */
2117 fr30_cgen_opcode_open (mach, endian)
2119 enum cgen_endian endian;
2121 CGEN_OPCODE_TABLE * table = (CGEN_OPCODE_TABLE *) xmalloc (sizeof (CGEN_OPCODE_TABLE));
2130 memset (table, 0, sizeof (*table));
2132 CGEN_OPCODE_MACH (table) = mach;
2133 CGEN_OPCODE_ENDIAN (table) = endian;
2134 /* FIXME: for the sparc case we can determine insn-endianness statically.
2135 The worry here is where both data and insn endian can be independently
2136 chosen, in which case this function will need another argument.
2137 Actually, will want to allow for more arguments in the future anyway. */
2138 CGEN_OPCODE_INSN_ENDIAN (table) = endian;
2140 CGEN_OPCODE_HW_LIST (table) = & fr30_cgen_hw_entries[0];
2142 CGEN_OPCODE_OPERAND_TABLE (table) = & fr30_cgen_operand_table[0];
2144 * CGEN_OPCODE_INSN_TABLE (table) = insn_table;
2146 * CGEN_OPCODE_MACRO_INSN_TABLE (table) = macro_insn_table;
2148 CGEN_OPCODE_ASM_HASH_P (table) = asm_hash_insn_p;
2149 CGEN_OPCODE_ASM_HASH (table) = asm_hash_insn;
2150 CGEN_OPCODE_ASM_HASH_SIZE (table) = CGEN_ASM_HASH_SIZE;
2152 CGEN_OPCODE_DIS_HASH_P (table) = dis_hash_insn_p;
2153 CGEN_OPCODE_DIS_HASH (table) = dis_hash_insn;
2154 CGEN_OPCODE_DIS_HASH_SIZE (table) = CGEN_DIS_HASH_SIZE;
2156 return (CGEN_OPCODE_DESC) table;
2159 /* Close an opcode table. */
2162 fr30_cgen_opcode_close (desc)
2163 CGEN_OPCODE_DESC desc;
2168 /* Getting values from cgen_fields is handled by a collection of functions.
2169 They are distinguished by the type of the VALUE argument they return.
2170 TODO: floating point, inlining support, remove cases where result type
2174 fr30_cgen_get_int_operand (opindex, fields)
2176 const CGEN_FIELDS * fields;
2182 case FR30_OPERAND_RI :
2183 value = fields->f_Ri;
2185 case FR30_OPERAND_RJ :
2186 value = fields->f_Rj;
2188 case FR30_OPERAND_RS1 :
2189 value = fields->f_Rs1;
2191 case FR30_OPERAND_RS2 :
2192 value = fields->f_Rs2;
2194 case FR30_OPERAND_R13 :
2195 value = fields->f_nil;
2197 case FR30_OPERAND_R14 :
2198 value = fields->f_nil;
2200 case FR30_OPERAND_R15 :
2201 value = fields->f_nil;
2203 case FR30_OPERAND_PS :
2204 value = fields->f_nil;
2206 case FR30_OPERAND_U4 :
2207 value = fields->f_u4;
2209 case FR30_OPERAND_M4 :
2210 value = fields->f_m4;
2212 case FR30_OPERAND_U8 :
2213 value = fields->f_u8;
2215 case FR30_OPERAND_I8 :
2216 value = fields->f_i8;
2218 case FR30_OPERAND_UDISP6 :
2219 value = fields->f_udisp6;
2221 case FR30_OPERAND_DISP8 :
2222 value = fields->f_disp8;
2224 case FR30_OPERAND_DISP9 :
2225 value = fields->f_disp9;
2227 case FR30_OPERAND_DISP10 :
2228 value = fields->f_disp10;
2230 case FR30_OPERAND_S10 :
2231 value = fields->f_s10;
2233 case FR30_OPERAND_U10 :
2234 value = fields->f_u10;
2236 case FR30_OPERAND_I32 :
2237 value = fields->f_i32;
2239 case FR30_OPERAND_DIR8 :
2240 value = fields->f_dir8;
2242 case FR30_OPERAND_DIR9 :
2243 value = fields->f_dir9;
2245 case FR30_OPERAND_DIR10 :
2246 value = fields->f_dir10;
2248 case FR30_OPERAND_LABEL9 :
2249 value = fields->f_rel9;
2251 case FR30_OPERAND_LABEL12 :
2252 value = fields->f_rel12;
2254 case FR30_OPERAND_CC :
2255 value = fields->f_cc;
2259 /* xgettext:c-format */
2260 fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
2269 fr30_cgen_get_vma_operand (opindex, fields)
2271 const CGEN_FIELDS * fields;
2277 case FR30_OPERAND_RI :
2278 value = fields->f_Ri;
2280 case FR30_OPERAND_RJ :
2281 value = fields->f_Rj;
2283 case FR30_OPERAND_RS1 :
2284 value = fields->f_Rs1;
2286 case FR30_OPERAND_RS2 :
2287 value = fields->f_Rs2;
2289 case FR30_OPERAND_R13 :
2290 value = fields->f_nil;
2292 case FR30_OPERAND_R14 :
2293 value = fields->f_nil;
2295 case FR30_OPERAND_R15 :
2296 value = fields->f_nil;
2298 case FR30_OPERAND_PS :
2299 value = fields->f_nil;
2301 case FR30_OPERAND_U4 :
2302 value = fields->f_u4;
2304 case FR30_OPERAND_M4 :
2305 value = fields->f_m4;
2307 case FR30_OPERAND_U8 :
2308 value = fields->f_u8;
2310 case FR30_OPERAND_I8 :
2311 value = fields->f_i8;
2313 case FR30_OPERAND_UDISP6 :
2314 value = fields->f_udisp6;
2316 case FR30_OPERAND_DISP8 :
2317 value = fields->f_disp8;
2319 case FR30_OPERAND_DISP9 :
2320 value = fields->f_disp9;
2322 case FR30_OPERAND_DISP10 :
2323 value = fields->f_disp10;
2325 case FR30_OPERAND_S10 :
2326 value = fields->f_s10;
2328 case FR30_OPERAND_U10 :
2329 value = fields->f_u10;
2331 case FR30_OPERAND_I32 :
2332 value = fields->f_i32;
2334 case FR30_OPERAND_DIR8 :
2335 value = fields->f_dir8;
2337 case FR30_OPERAND_DIR9 :
2338 value = fields->f_dir9;
2340 case FR30_OPERAND_DIR10 :
2341 value = fields->f_dir10;
2343 case FR30_OPERAND_LABEL9 :
2344 value = fields->f_rel9;
2346 case FR30_OPERAND_LABEL12 :
2347 value = fields->f_rel12;
2349 case FR30_OPERAND_CC :
2350 value = fields->f_cc;
2354 /* xgettext:c-format */
2355 fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
2363 /* Stuffing values in cgen_fields is handled by a collection of functions.
2364 They are distinguished by the type of the VALUE argument they accept.
2365 TODO: floating point, inlining support, remove cases where argument type
2369 fr30_cgen_set_int_operand (opindex, fields, value)
2371 CGEN_FIELDS * fields;
2376 case FR30_OPERAND_RI :
2377 fields->f_Ri = value;
2379 case FR30_OPERAND_RJ :
2380 fields->f_Rj = value;
2382 case FR30_OPERAND_RS1 :
2383 fields->f_Rs1 = value;
2385 case FR30_OPERAND_RS2 :
2386 fields->f_Rs2 = value;
2388 case FR30_OPERAND_R13 :
2389 fields->f_nil = value;
2391 case FR30_OPERAND_R14 :
2392 fields->f_nil = value;
2394 case FR30_OPERAND_R15 :
2395 fields->f_nil = value;
2397 case FR30_OPERAND_PS :
2398 fields->f_nil = value;
2400 case FR30_OPERAND_U4 :
2401 fields->f_u4 = value;
2403 case FR30_OPERAND_M4 :
2404 fields->f_m4 = value;
2406 case FR30_OPERAND_U8 :
2407 fields->f_u8 = value;
2409 case FR30_OPERAND_I8 :
2410 fields->f_i8 = value;
2412 case FR30_OPERAND_UDISP6 :
2413 fields->f_udisp6 = value;
2415 case FR30_OPERAND_DISP8 :
2416 fields->f_disp8 = value;
2418 case FR30_OPERAND_DISP9 :
2419 fields->f_disp9 = value;
2421 case FR30_OPERAND_DISP10 :
2422 fields->f_disp10 = value;
2424 case FR30_OPERAND_S10 :
2425 fields->f_s10 = value;
2427 case FR30_OPERAND_U10 :
2428 fields->f_u10 = value;
2430 case FR30_OPERAND_I32 :
2431 fields->f_i32 = value;
2433 case FR30_OPERAND_DIR8 :
2434 fields->f_dir8 = value;
2436 case FR30_OPERAND_DIR9 :
2437 fields->f_dir9 = value;
2439 case FR30_OPERAND_DIR10 :
2440 fields->f_dir10 = value;
2442 case FR30_OPERAND_LABEL9 :
2443 fields->f_rel9 = value;
2445 case FR30_OPERAND_LABEL12 :
2446 fields->f_rel12 = value;
2448 case FR30_OPERAND_CC :
2449 fields->f_cc = value;
2453 /* xgettext:c-format */
2454 fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
2461 fr30_cgen_set_vma_operand (opindex, fields, value)
2463 CGEN_FIELDS * fields;
2468 case FR30_OPERAND_RI :
2469 fields->f_Ri = value;
2471 case FR30_OPERAND_RJ :
2472 fields->f_Rj = value;
2474 case FR30_OPERAND_RS1 :
2475 fields->f_Rs1 = value;
2477 case FR30_OPERAND_RS2 :
2478 fields->f_Rs2 = value;
2480 case FR30_OPERAND_R13 :
2481 fields->f_nil = value;
2483 case FR30_OPERAND_R14 :
2484 fields->f_nil = value;
2486 case FR30_OPERAND_R15 :
2487 fields->f_nil = value;
2489 case FR30_OPERAND_PS :
2490 fields->f_nil = value;
2492 case FR30_OPERAND_U4 :
2493 fields->f_u4 = value;
2495 case FR30_OPERAND_M4 :
2496 fields->f_m4 = value;
2498 case FR30_OPERAND_U8 :
2499 fields->f_u8 = value;
2501 case FR30_OPERAND_I8 :
2502 fields->f_i8 = value;
2504 case FR30_OPERAND_UDISP6 :
2505 fields->f_udisp6 = value;
2507 case FR30_OPERAND_DISP8 :
2508 fields->f_disp8 = value;
2510 case FR30_OPERAND_DISP9 :
2511 fields->f_disp9 = value;
2513 case FR30_OPERAND_DISP10 :
2514 fields->f_disp10 = value;
2516 case FR30_OPERAND_S10 :
2517 fields->f_s10 = value;
2519 case FR30_OPERAND_U10 :
2520 fields->f_u10 = value;
2522 case FR30_OPERAND_I32 :
2523 fields->f_i32 = value;
2525 case FR30_OPERAND_DIR8 :
2526 fields->f_dir8 = value;
2528 case FR30_OPERAND_DIR9 :
2529 fields->f_dir9 = value;
2531 case FR30_OPERAND_DIR10 :
2532 fields->f_dir10 = value;
2534 case FR30_OPERAND_LABEL9 :
2535 fields->f_rel9 = value;
2537 case FR30_OPERAND_LABEL12 :
2538 fields->f_rel12 = value;
2540 case FR30_OPERAND_CC :
2541 fields->f_cc = value;
2545 /* xgettext:c-format */
2546 fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),