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 *, unsigned long));
41 /* Cover function to read and properly byteswap an insn value. */
44 cgen_get_insn_value (od, buf, length)
57 if (CGEN_OPCODE_INSN_ENDIAN (od) == CGEN_ENDIAN_BIG)
58 value = bfd_getb16 (buf);
60 value = bfd_getl16 (buf);
63 if (CGEN_OPCODE_INSN_ENDIAN (od) == CGEN_ENDIAN_BIG)
64 value = bfd_getb32 (buf);
66 value = bfd_getl32 (buf);
75 /* Cover function to store an insn value properly byteswapped. */
78 cgen_put_insn_value (od, buf, length, value)
90 if (CGEN_OPCODE_INSN_ENDIAN (od) == CGEN_ENDIAN_BIG)
91 bfd_putb16 (value, buf);
93 bfd_putl16 (value, buf);
96 if (CGEN_OPCODE_INSN_ENDIAN (od) == CGEN_ENDIAN_BIG)
97 bfd_putb32 (value, buf);
99 bfd_putl32 (value, buf);
106 /* Look up instruction INSN_VALUE and extract its fields.
107 INSN, if non-null, is the insn table entry.
108 Otherwise INSN_VALUE is examined to compute it.
109 LENGTH is the bit length of INSN_VALUE if known, otherwise 0.
110 0 is only valid if `insn == NULL && ! CGEN_INT_INSN_P'.
111 If INSN != NULL, LENGTH must be valid.
112 ALIAS_P is non-zero if alias insns are to be included in the search.
114 The result a pointer to the insn table entry, or NULL if the instruction
115 wasn't recognized. */
118 fr30_cgen_lookup_insn (od, insn, insn_value, length, fields, alias_p)
120 const CGEN_INSN *insn;
121 CGEN_INSN_BYTES insn_value;
126 unsigned char buf[16];
128 unsigned int base_insn;
130 CGEN_EXTRACT_INFO *info = NULL;
132 CGEN_EXTRACT_INFO ex_info;
133 CGEN_EXTRACT_INFO *info = &ex_info;
136 #if ! CGEN_INT_INSN_P
137 ex_info.dis_info = NULL;
138 ex_info.bytes = insn_value;
144 const CGEN_INSN_LIST *insn_list;
147 cgen_put_insn_value (od, buf, length, insn_value);
149 base_insn = insn_value; /*???*/
151 base_insn = cgen_get_insn_value (od, buf, length);
155 /* The instructions are stored in hash lists.
156 Pick the first one and keep trying until we find the right one. */
158 insn_list = CGEN_DIS_LOOKUP_INSN (od, bufp, base_insn);
159 while (insn_list != NULL)
161 insn = insn_list->insn;
164 || ! CGEN_INSN_ATTR (insn, CGEN_INSN_ALIAS))
166 /* Basic bit mask must be correct. */
167 /* ??? May wish to allow target to defer this check until the
169 if ((insn_value & CGEN_INSN_MASK (insn)) == CGEN_INSN_VALUE (insn))
171 /* ??? 0 is passed for `pc' */
172 int elength = (*CGEN_EXTRACT_FN (insn)) (od, insn, info,
178 if (length != 0 && length != elength)
185 insn_list = CGEN_DIS_NEXT_INSN (insn_list);
190 /* Sanity check: can't pass an alias insn if ! alias_p. */
192 && CGEN_INSN_ATTR (insn, CGEN_INSN_ALIAS))
194 /* Sanity check: length must be correct. */
195 if (length != CGEN_INSN_BITSIZE (insn))
198 /* ??? 0 is passed for `pc' */
199 length = (*CGEN_EXTRACT_FN (insn)) (od, insn, info, insn_value, fields,
201 /* Sanity check: must succeed.
202 Could relax this later if it ever proves useful. */
211 /* Fill in the operand instances used by INSN whose operands are FIELDS.
212 INDICES is a pointer to a buffer of MAX_OPERAND_INSTANCES ints to be filled
216 fr30_cgen_get_insn_operands (od, insn, fields, indices)
218 const CGEN_INSN * insn;
219 const CGEN_FIELDS * fields;
222 const CGEN_OPERAND_INSTANCE *opinst;
225 for (i = 0, opinst = CGEN_INSN_OPERANDS (insn);
227 && CGEN_OPERAND_INSTANCE_TYPE (opinst) != CGEN_OPERAND_INSTANCE_END;
230 const CGEN_OPERAND *op = CGEN_OPERAND_INSTANCE_OPERAND (opinst);
232 indices[i] = CGEN_OPERAND_INSTANCE_INDEX (opinst);
234 indices[i] = fr30_cgen_get_int_operand (CGEN_OPERAND_INDEX (op),
239 /* Cover function to fr30_cgen_get_insn_operands when either INSN or FIELDS
241 The INSN, INSN_VALUE, and LENGTH arguments are passed to
242 fr30_cgen_lookup_insn unchanged.
244 The result is the insn table entry or NULL if the instruction wasn't
248 fr30_cgen_lookup_get_insn_operands (od, insn, insn_value, length, indices)
250 const CGEN_INSN *insn;
251 CGEN_INSN_BYTES insn_value;
257 /* Pass non-zero for ALIAS_P only if INSN != NULL.
258 If INSN == NULL, we want a real insn. */
259 insn = fr30_cgen_lookup_insn (od, insn, insn_value, length, &fields,
264 fr30_cgen_get_insn_operands (od, insn, &fields, indices);
269 static const CGEN_ATTR_ENTRY MACH_attr[] =
271 { "base", MACH_BASE },
272 { "fr30", MACH_FR30 },
277 const CGEN_ATTR_TABLE fr30_cgen_hardware_attr_table[] =
279 { "CACHE-ADDR", NULL },
285 const CGEN_ATTR_TABLE fr30_cgen_operand_attr_table[] =
287 { "ABS-ADDR", NULL },
288 { "HASH-PREFIX", NULL },
289 { "NEGATIVE", NULL },
290 { "PCREL-ADDR", NULL },
292 { "SEM-ONLY", NULL },
293 { "SIGN-OPT", NULL },
295 { "UNSIGNED", NULL },
299 const CGEN_ATTR_TABLE fr30_cgen_insn_attr_table[] =
302 { "COND-CTI", NULL },
305 { "RELAXABLE", NULL },
306 { "SKIP-CTI", NULL },
307 { "UNCOND-CTI", NULL },
312 CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_gr_entries[] =
335 CGEN_KEYWORD fr30_cgen_opval_h_gr =
337 & fr30_cgen_opval_h_gr_entries[0],
341 CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_dr_entries[] =
351 CGEN_KEYWORD fr30_cgen_opval_h_dr =
353 & fr30_cgen_opval_h_dr_entries[0],
357 CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_ps_entries[] =
362 CGEN_KEYWORD fr30_cgen_opval_h_ps =
364 & fr30_cgen_opval_h_ps_entries[0],
368 CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_r13_entries[] =
373 CGEN_KEYWORD fr30_cgen_opval_h_r13 =
375 & fr30_cgen_opval_h_r13_entries[0],
379 CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_r14_entries[] =
384 CGEN_KEYWORD fr30_cgen_opval_h_r14 =
386 & fr30_cgen_opval_h_r14_entries[0],
390 CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_r15_entries[] =
395 CGEN_KEYWORD fr30_cgen_opval_h_r15 =
397 & fr30_cgen_opval_h_r15_entries[0],
402 /* The hardware table. */
404 #define HW_ENT(n) fr30_cgen_hw_entries[n]
405 static const CGEN_HW_ENTRY fr30_cgen_hw_entries[] =
407 { 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 } } },
408 { HW_H_MEMORY, & HW_ENT (HW_H_MEMORY + 1), "h-memory", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
409 { HW_H_SINT, & HW_ENT (HW_H_SINT + 1), "h-sint", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
410 { HW_H_UINT, & HW_ENT (HW_H_UINT + 1), "h-uint", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
411 { HW_H_ADDR, & HW_ENT (HW_H_ADDR + 1), "h-addr", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
412 { HW_H_IADDR, & HW_ENT (HW_H_IADDR + 1), "h-iaddr", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
413 { 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 } } },
414 { HW_H_DR, & HW_ENT (HW_H_DR + 1), "h-dr", CGEN_ASM_KEYWORD, (PTR) & fr30_cgen_opval_h_dr, { 0, 0, { 0 } } },
415 { HW_H_PS, & HW_ENT (HW_H_PS + 1), "h-ps", CGEN_ASM_KEYWORD, (PTR) & fr30_cgen_opval_h_ps, { 0, 0, { 0 } } },
416 { HW_H_R13, & HW_ENT (HW_H_R13 + 1), "h-r13", CGEN_ASM_KEYWORD, (PTR) & fr30_cgen_opval_h_r13, { 0, 0, { 0 } } },
417 { HW_H_R14, & HW_ENT (HW_H_R14 + 1), "h-r14", CGEN_ASM_KEYWORD, (PTR) & fr30_cgen_opval_h_r14, { 0, 0, { 0 } } },
418 { HW_H_R15, & HW_ENT (HW_H_R15 + 1), "h-r15", CGEN_ASM_KEYWORD, (PTR) & fr30_cgen_opval_h_r15, { 0, 0, { 0 } } },
419 { HW_H_NBIT, & HW_ENT (HW_H_NBIT + 1), "h-nbit", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
420 { HW_H_ZBIT, & HW_ENT (HW_H_ZBIT + 1), "h-zbit", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
421 { HW_H_VBIT, & HW_ENT (HW_H_VBIT + 1), "h-vbit", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
422 { HW_H_CBIT, & HW_ENT (HW_H_CBIT + 1), "h-cbit", CGEN_ASM_KEYWORD, (PTR) 0, { 0, 0, { 0 } } },
426 /* The operand table. */
428 #define OPERAND(op) CONCAT2 (FR30_OPERAND_,op)
429 #define OP_ENT(op) fr30_cgen_operand_table[OPERAND (op)]
431 const CGEN_OPERAND fr30_cgen_operand_table[MAX_OPERANDS] =
433 /* pc: program counter */
434 { "pc", & HW_ENT (HW_H_PC), 0, 0,
435 { 0, 0|(1<<CGEN_OPERAND_SEM_ONLY), { 0 } } },
436 /* Ri: destination register */
437 { "Ri", & HW_ENT (HW_H_GR), 12, 4,
438 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
439 /* Rj: source register */
440 { "Rj", & HW_ENT (HW_H_GR), 8, 4,
441 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
442 /* Rs1: dedicated register */
443 { "Rs1", & HW_ENT (HW_H_DR), 8, 4,
444 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
445 /* Rs2: dedicated register */
446 { "Rs2", & HW_ENT (HW_H_DR), 12, 4,
447 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
448 /* R13: General Register 13 */
449 { "R13", & HW_ENT (HW_H_R13), 0, 0,
451 /* R14: General Register 14 */
452 { "R14", & HW_ENT (HW_H_R14), 0, 0,
454 /* R15: General Register 15 */
455 { "R15", & HW_ENT (HW_H_R15), 0, 0,
457 /* ps: Program Status register */
458 { "ps", & HW_ENT (HW_H_PS), 0, 0,
460 /* u4: 4 bit unsigned immediate */
461 { "u4", & HW_ENT (HW_H_UINT), 8, 4,
462 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
463 /* m4: 4 bit negative immediate */
464 { "m4", & HW_ENT (HW_H_UINT), 8, 4,
465 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
466 /* u8: 8 bit unsigned immediate */
467 { "u8", & HW_ENT (HW_H_UINT), 8, 8,
468 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
469 /* i8: 8 bit unsigned immediate */
470 { "i8", & HW_ENT (HW_H_UINT), 4, 8,
471 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
472 /* udisp6: 6 bit unsigned immediate */
473 { "udisp6", & HW_ENT (HW_H_UINT), 8, 4,
474 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
475 /* disp8: 8 bit signed immediate */
476 { "disp8", & HW_ENT (HW_H_SINT), 4, 8,
477 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_SIGNED), { 0 } } },
478 /* disp9: 9 bit signed immediate */
479 { "disp9", & HW_ENT (HW_H_SINT), 4, 8,
480 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_SIGNED), { 0 } } },
481 /* disp10: 10 bit signed immediate */
482 { "disp10", & HW_ENT (HW_H_SINT), 4, 8,
483 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_SIGNED), { 0 } } },
484 /* s10: 10 bit signed immediate */
485 { "s10", & HW_ENT (HW_H_SINT), 8, 8,
486 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_SIGNED), { 0 } } },
487 /* u10: 10 bit unsigned immediate */
488 { "u10", & HW_ENT (HW_H_UINT), 8, 8,
489 { 0, 0|(1<<CGEN_OPERAND_HASH_PREFIX)|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
490 /* dir8: 8 bit direct address */
491 { "dir8", & HW_ENT (HW_H_UINT), 8, 8,
492 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
493 /* dir9: 9 bit direct address */
494 { "dir9", & HW_ENT (HW_H_UINT), 8, 8,
495 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
496 /* dir10: 10 bit direct address */
497 { "dir10", & HW_ENT (HW_H_UINT), 8, 8,
498 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
499 /* label9: 9 bit pc relative address */
500 { "label9", & HW_ENT (HW_H_SINT), 8, 8,
501 { 0, 0|(1<<CGEN_OPERAND_SIGNED), { 0 } } },
502 /* label12: 12 bit pc relative address */
503 { "label12", & HW_ENT (HW_H_SINT), 5, 11,
504 { 0, 0|(1<<CGEN_OPERAND_SIGNED), { 0 } } },
505 /* cc: condition codes */
506 { "cc", & HW_ENT (HW_H_UINT), 4, 4,
507 { 0, 0|(1<<CGEN_OPERAND_UNSIGNED), { 0 } } },
508 /* nbit: negative bit */
509 { "nbit", & HW_ENT (HW_H_NBIT), 0, 0,
510 { 0, 0|(1<<CGEN_OPERAND_SEM_ONLY), { 0 } } },
511 /* vbit: overflow bit */
512 { "vbit", & HW_ENT (HW_H_VBIT), 0, 0,
513 { 0, 0|(1<<CGEN_OPERAND_SEM_ONLY), { 0 } } },
515 { "zbit", & HW_ENT (HW_H_ZBIT), 0, 0,
516 { 0, 0|(1<<CGEN_OPERAND_SEM_ONLY), { 0 } } },
517 /* cbit: carry bit */
518 { "cbit", & HW_ENT (HW_H_CBIT), 0, 0,
519 { 0, 0|(1<<CGEN_OPERAND_SEM_ONLY), { 0 } } },
522 /* Operand references. */
524 #define INPUT CGEN_OPERAND_INSTANCE_INPUT
525 #define OUTPUT CGEN_OPERAND_INSTANCE_OUTPUT
527 static const CGEN_OPERAND_INSTANCE fmt_add_ops[] = {
528 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
529 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RJ), 0 },
530 { OUTPUT, "vbit", & HW_ENT (HW_H_VBIT), CGEN_MODE_BI, 0, 0 },
531 { OUTPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0 },
532 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
533 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0 },
534 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0 },
538 static const CGEN_OPERAND_INSTANCE fmt_addi_ops[] = {
539 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
540 { INPUT, "u4", & HW_ENT (HW_H_UINT), CGEN_MODE_USI, & OP_ENT (U4), 0 },
541 { OUTPUT, "vbit", & HW_ENT (HW_H_VBIT), CGEN_MODE_BI, 0, 0 },
542 { OUTPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0 },
543 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
544 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0 },
545 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0 },
549 static const CGEN_OPERAND_INSTANCE fmt_add2_ops[] = {
550 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
551 { INPUT, "m4", & HW_ENT (HW_H_UINT), CGEN_MODE_USI, & OP_ENT (M4), 0 },
552 { OUTPUT, "vbit", & HW_ENT (HW_H_VBIT), CGEN_MODE_BI, 0, 0 },
553 { OUTPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0 },
554 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
555 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0 },
556 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0 },
560 static const CGEN_OPERAND_INSTANCE fmt_addc_ops[] = {
561 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
562 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RJ), 0 },
563 { INPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0 },
564 { OUTPUT, "vbit", & HW_ENT (HW_H_VBIT), CGEN_MODE_BI, 0, 0 },
565 { OUTPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0 },
566 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
567 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0 },
568 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0 },
572 static const CGEN_OPERAND_INSTANCE fmt_addn_ops[] = {
573 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
574 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RJ), 0 },
575 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
579 static const CGEN_OPERAND_INSTANCE fmt_addni_ops[] = {
580 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
581 { INPUT, "u4", & HW_ENT (HW_H_UINT), CGEN_MODE_USI, & OP_ENT (U4), 0 },
582 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
586 static const CGEN_OPERAND_INSTANCE fmt_addn2_ops[] = {
587 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
588 { INPUT, "m4", & HW_ENT (HW_H_UINT), CGEN_MODE_USI, & OP_ENT (M4), 0 },
589 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
593 static const CGEN_OPERAND_INSTANCE fmt_cmp_ops[] = {
594 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
595 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RJ), 0 },
596 { OUTPUT, "vbit", & HW_ENT (HW_H_VBIT), CGEN_MODE_BI, 0, 0 },
597 { OUTPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0 },
598 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0 },
599 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0 },
603 static const CGEN_OPERAND_INSTANCE fmt_cmpi_ops[] = {
604 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
605 { INPUT, "u4", & HW_ENT (HW_H_UINT), CGEN_MODE_USI, & OP_ENT (U4), 0 },
606 { OUTPUT, "vbit", & HW_ENT (HW_H_VBIT), CGEN_MODE_BI, 0, 0 },
607 { OUTPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0 },
608 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0 },
609 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0 },
613 static const CGEN_OPERAND_INSTANCE fmt_cmp2_ops[] = {
614 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
615 { INPUT, "m4", & HW_ENT (HW_H_UINT), CGEN_MODE_USI, & OP_ENT (M4), 0 },
616 { OUTPUT, "vbit", & HW_ENT (HW_H_VBIT), CGEN_MODE_BI, 0, 0 },
617 { OUTPUT, "cbit", & HW_ENT (HW_H_CBIT), CGEN_MODE_BI, 0, 0 },
618 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0 },
619 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0 },
623 static const CGEN_OPERAND_INSTANCE fmt_and_ops[] = {
624 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
625 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RJ), 0 },
626 { OUTPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RI), 0 },
627 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0 },
628 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0 },
632 static const CGEN_OPERAND_INSTANCE fmt_andm_ops[] = {
633 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_USI, & OP_ENT (RI), 0 },
634 { INPUT, "h_memory_Ri", & HW_ENT (HW_H_MEMORY), CGEN_MODE_SI, 0, 0 },
635 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_SI, & OP_ENT (RJ), 0 },
636 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0 },
637 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0 },
638 { OUTPUT, "h_memory_Ri", & HW_ENT (HW_H_MEMORY), CGEN_MODE_SI, 0, 0 },
642 static const CGEN_OPERAND_INSTANCE fmt_andh_ops[] = {
643 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_USI, & OP_ENT (RI), 0 },
644 { INPUT, "h_memory_Ri", & HW_ENT (HW_H_MEMORY), CGEN_MODE_HI, 0, 0 },
645 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_HI, & OP_ENT (RJ), 0 },
646 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0 },
647 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0 },
648 { OUTPUT, "h_memory_Ri", & HW_ENT (HW_H_MEMORY), CGEN_MODE_HI, 0, 0 },
652 static const CGEN_OPERAND_INSTANCE fmt_andb_ops[] = {
653 { INPUT, "Ri", & HW_ENT (HW_H_GR), CGEN_MODE_USI, & OP_ENT (RI), 0 },
654 { INPUT, "h_memory_Ri", & HW_ENT (HW_H_MEMORY), CGEN_MODE_QI, 0, 0 },
655 { INPUT, "Rj", & HW_ENT (HW_H_GR), CGEN_MODE_QI, & OP_ENT (RJ), 0 },
656 { OUTPUT, "zbit", & HW_ENT (HW_H_ZBIT), CGEN_MODE_BI, 0, 0 },
657 { OUTPUT, "nbit", & HW_ENT (HW_H_NBIT), CGEN_MODE_BI, 0, 0 },
658 { OUTPUT, "h_memory_Ri", & HW_ENT (HW_H_MEMORY), CGEN_MODE_QI, 0, 0 },
665 #define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
666 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
667 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
669 /* The instruction table.
670 This is currently non-static because the simulator accesses it
673 const CGEN_INSN fr30_cgen_insn_table_entries[MAX_INSNS] =
675 /* Special null first entry.
676 A `num' value of zero is thus invalid.
677 Also, the special `invalid' insn resides here. */
682 FR30_INSN_ADD, "add", "add",
683 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
684 { 16, 16, 0xff00 }, 0xa600,
685 (PTR) & fmt_add_ops[0],
691 FR30_INSN_ADDI, "addi", "add",
692 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
693 { 16, 16, 0xff00 }, 0xa400,
694 (PTR) & fmt_addi_ops[0],
700 FR30_INSN_ADD2, "add2", "add2",
701 { { MNEM, ' ', OP (M4), ',', OP (RI), 0 } },
702 { 16, 16, 0xff00 }, 0xa500,
703 (PTR) & fmt_add2_ops[0],
709 FR30_INSN_ADDC, "addc", "addc",
710 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
711 { 16, 16, 0xff00 }, 0xa700,
712 (PTR) & fmt_addc_ops[0],
718 FR30_INSN_ADDN, "addn", "addn",
719 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
720 { 16, 16, 0xff00 }, 0xa200,
721 (PTR) & fmt_addn_ops[0],
727 FR30_INSN_ADDNI, "addni", "addn",
728 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
729 { 16, 16, 0xff00 }, 0xa000,
730 (PTR) & fmt_addni_ops[0],
736 FR30_INSN_ADDN2, "addn2", "addn2",
737 { { MNEM, ' ', OP (M4), ',', OP (RI), 0 } },
738 { 16, 16, 0xff00 }, 0xa100,
739 (PTR) & fmt_addn2_ops[0],
745 FR30_INSN_SUB, "sub", "sub",
746 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
747 { 16, 16, 0xff00 }, 0xac00,
748 (PTR) & fmt_add_ops[0],
754 FR30_INSN_SUBC, "subc", "subc",
755 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
756 { 16, 16, 0xff00 }, 0xad00,
757 (PTR) & fmt_addc_ops[0],
763 FR30_INSN_SUBN, "subn", "subn",
764 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
765 { 16, 16, 0xff00 }, 0xae00,
766 (PTR) & fmt_addn_ops[0],
772 FR30_INSN_CMP, "cmp", "cmp",
773 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
774 { 16, 16, 0xff00 }, 0xaa00,
775 (PTR) & fmt_cmp_ops[0],
781 FR30_INSN_CMPI, "cmpi", "cmp",
782 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
783 { 16, 16, 0xff00 }, 0xa800,
784 (PTR) & fmt_cmpi_ops[0],
790 FR30_INSN_CMP2, "cmp2", "cmp2",
791 { { MNEM, ' ', OP (M4), ',', OP (RI), 0 } },
792 { 16, 16, 0xff00 }, 0xa900,
793 (PTR) & fmt_cmp2_ops[0],
799 FR30_INSN_AND, "and", "and",
800 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
801 { 16, 16, 0xff00 }, 0x8200,
802 (PTR) & fmt_and_ops[0],
808 FR30_INSN_OR, "or", "or",
809 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
810 { 16, 16, 0xff00 }, 0x9200,
811 (PTR) & fmt_and_ops[0],
817 FR30_INSN_EOR, "eor", "eor",
818 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
819 { 16, 16, 0xff00 }, 0x9a00,
820 (PTR) & fmt_and_ops[0],
826 FR30_INSN_ANDM, "andm", "and",
827 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
828 { 16, 16, 0xff00 }, 0x8400,
829 (PTR) & fmt_andm_ops[0],
835 FR30_INSN_ANDH, "andh", "andh",
836 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
837 { 16, 16, 0xff00 }, 0x8500,
838 (PTR) & fmt_andh_ops[0],
844 FR30_INSN_ANDB, "andb", "andb",
845 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
846 { 16, 16, 0xff00 }, 0x8600,
847 (PTR) & fmt_andb_ops[0],
853 FR30_INSN_ORM, "orm", "or",
854 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
855 { 16, 16, 0xff00 }, 0x9400,
856 (PTR) & fmt_andm_ops[0],
862 FR30_INSN_ORH, "orh", "orh",
863 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
864 { 16, 16, 0xff00 }, 0x9500,
865 (PTR) & fmt_andh_ops[0],
871 FR30_INSN_ORB, "orb", "orb",
872 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
873 { 16, 16, 0xff00 }, 0x9600,
874 (PTR) & fmt_andb_ops[0],
880 FR30_INSN_EORM, "eorm", "eor",
881 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
882 { 16, 16, 0xff00 }, 0x9c00,
883 (PTR) & fmt_andm_ops[0],
889 FR30_INSN_EORH, "eorh", "eorh",
890 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
891 { 16, 16, 0xff00 }, 0x9d00,
892 (PTR) & fmt_andh_ops[0],
898 FR30_INSN_EORB, "eorb", "eorb",
899 { { MNEM, ' ', OP (RJ), ',', '@', OP (RI), 0 } },
900 { 16, 16, 0xff00 }, 0x9e00,
901 (PTR) & fmt_andb_ops[0],
907 FR30_INSN_BANDL, "bandl", "bandl",
908 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
909 { 16, 16, 0xff00 }, 0x8000,
916 FR30_INSN_BORL, "borl", "borl",
917 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
918 { 16, 16, 0xff00 }, 0x9000,
925 FR30_INSN_BEORL, "beorl", "beorl",
926 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
927 { 16, 16, 0xff00 }, 0x9800,
934 FR30_INSN_BANDH, "bandh", "bandh",
935 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
936 { 16, 16, 0xff00 }, 0x8100,
943 FR30_INSN_BORH, "borh", "borh",
944 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
945 { 16, 16, 0xff00 }, 0x9100,
952 FR30_INSN_BEORH, "beorh", "beorh",
953 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
954 { 16, 16, 0xff00 }, 0x9900,
961 FR30_INSN_BTSTL, "btstl", "btstl",
962 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
963 { 16, 16, 0xff00 }, 0x8800,
970 FR30_INSN_BTSTH, "btsth", "btsth",
971 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), 0 } },
972 { 16, 16, 0xff00 }, 0x8900,
979 FR30_INSN_MUL, "mul", "mul",
980 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
981 { 16, 16, 0xff00 }, 0xaf00,
988 FR30_INSN_MULU, "mulu", "mulu",
989 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
990 { 16, 16, 0xff00 }, 0xab00,
997 FR30_INSN_MULH, "mulh", "mulh",
998 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
999 { 16, 16, 0xff00 }, 0xbf00,
1006 FR30_INSN_MULUH, "muluh", "muluh",
1007 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
1008 { 16, 16, 0xff00 }, 0xbb00,
1015 FR30_INSN_DIV0S, "div0s", "div0s",
1016 { { MNEM, ' ', OP (RI), 0 } },
1017 { 16, 16, 0xfff0 }, 0x9740,
1024 FR30_INSN_DIV0U, "div0u", "div0u",
1025 { { MNEM, ' ', OP (RI), 0 } },
1026 { 16, 16, 0xfff0 }, 0x9750,
1033 FR30_INSN_DIV1, "div1", "div1",
1034 { { MNEM, ' ', OP (RI), 0 } },
1035 { 16, 16, 0xfff0 }, 0x9760,
1042 FR30_INSN_DIV2, "div2", "div2",
1043 { { MNEM, ' ', OP (RI), 0 } },
1044 { 16, 16, 0xfff0 }, 0x9770,
1051 FR30_INSN_DIV3, "div3", "div3",
1053 { 16, 16, 0xffff }, 0x9f60,
1060 FR30_INSN_DIV4S, "div4s", "div4s",
1062 { 16, 16, 0xffff }, 0x9f70,
1069 FR30_INSN_LSL, "lsl", "lsl",
1070 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
1071 { 16, 16, 0xff00 }, 0xb600,
1078 FR30_INSN_LSLI, "lsli", "lsl",
1079 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
1080 { 16, 16, 0xff00 }, 0xb400,
1087 FR30_INSN_LSL2, "lsl2", "lsl2",
1088 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
1089 { 16, 16, 0xff00 }, 0xb500,
1096 FR30_INSN_LSR, "lsr", "lsr",
1097 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
1098 { 16, 16, 0xff00 }, 0xb200,
1105 FR30_INSN_LSRI, "lsri", "lsr",
1106 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
1107 { 16, 16, 0xff00 }, 0xb000,
1114 FR30_INSN_LSR2, "lsr2", "lsr2",
1115 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
1116 { 16, 16, 0xff00 }, 0xb100,
1123 FR30_INSN_ASR, "asr", "asr",
1124 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
1125 { 16, 16, 0xff00 }, 0xba00,
1132 FR30_INSN_ASRI, "asri", "asr",
1133 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
1134 { 16, 16, 0xff00 }, 0xb800,
1141 FR30_INSN_ASR2, "asr2", "asr2",
1142 { { MNEM, ' ', OP (U4), ',', OP (RI), 0 } },
1143 { 16, 16, 0xff00 }, 0xb900,
1150 FR30_INSN_LDI_8, "ldi:8", "ldi:8",
1151 { { MNEM, ' ', OP (I8), ',', OP (RI), 0 } },
1152 { 16, 16, 0xf000 }, 0xc000,
1159 FR30_INSN_LD, "ld", "ld",
1160 { { MNEM, ' ', '@', OP (RJ), ',', OP (RI), 0 } },
1161 { 16, 16, 0xff00 }, 0x400,
1168 FR30_INSN_LDUH, "lduh", "lduh",
1169 { { MNEM, ' ', '@', OP (RJ), ',', OP (RI), 0 } },
1170 { 16, 16, 0xff00 }, 0x500,
1177 FR30_INSN_LDUB, "ldub", "ldub",
1178 { { MNEM, ' ', '@', OP (RJ), ',', OP (RI), 0 } },
1179 { 16, 16, 0xff00 }, 0x600,
1183 /* ld @($r13,$Rj),$Ri */
1186 FR30_INSN_LDR13, "ldr13", "ld",
1187 { { MNEM, ' ', '@', '(', OP (R13), ',', OP (RJ), ')', ',', OP (RI), 0 } },
1188 { 16, 16, 0xff00 }, 0x0,
1192 /* lduh @($r13,$Rj),$Ri */
1195 FR30_INSN_LDR13UH, "ldr13uh", "lduh",
1196 { { MNEM, ' ', '@', '(', OP (R13), ',', OP (RJ), ')', ',', OP (RI), 0 } },
1197 { 16, 16, 0xff00 }, 0x100,
1201 /* ldub @($r13,$Rj),$Ri */
1204 FR30_INSN_LDR13UB, "ldr13ub", "ldub",
1205 { { MNEM, ' ', '@', '(', OP (R13), ',', OP (RJ), ')', ',', OP (RI), 0 } },
1206 { 16, 16, 0xff00 }, 0x200,
1210 /* ld @($r14,$disp10),$Ri */
1213 FR30_INSN_LDR14, "ldr14", "ld",
1214 { { MNEM, ' ', '@', '(', OP (R14), ',', OP (DISP10), ')', ',', OP (RI), 0 } },
1215 { 16, 16, 0xf000 }, 0x2000,
1219 /* lduh @($r14,$disp9),$Ri */
1222 FR30_INSN_LDR14UH, "ldr14uh", "lduh",
1223 { { MNEM, ' ', '@', '(', OP (R14), ',', OP (DISP9), ')', ',', OP (RI), 0 } },
1224 { 16, 16, 0xf000 }, 0x4000,
1228 /* ldub @($r14,$disp8),$Ri */
1231 FR30_INSN_LDR14UB, "ldr14ub", "ldub",
1232 { { MNEM, ' ', '@', '(', OP (R14), ',', OP (DISP8), ')', ',', OP (RI), 0 } },
1233 { 16, 16, 0xf000 }, 0x6000,
1237 /* ld @($r15,$udisp6),$Ri */
1240 FR30_INSN_LDR15, "ldr15", "ld",
1241 { { MNEM, ' ', '@', '(', OP (R15), ',', OP (UDISP6), ')', ',', OP (RI), 0 } },
1242 { 16, 16, 0xff00 }, 0x300,
1249 FR30_INSN_LDR15GR, "ldr15gr", "ld",
1250 { { MNEM, ' ', '@', OP (R15), '+', ',', OP (RI), 0 } },
1251 { 16, 16, 0xfff0 }, 0x700,
1255 /* ld @$r15+,$Rs2 */
1258 FR30_INSN_LDR15DR, "ldr15dr", "ld",
1259 { { MNEM, ' ', '@', OP (R15), '+', ',', OP (RS2), 0 } },
1260 { 16, 16, 0xfff0 }, 0x780,
1267 FR30_INSN_LDR15PS, "ldr15ps", "ld",
1268 { { MNEM, ' ', '@', OP (R15), '+', ',', OP (PS), 0 } },
1269 { 16, 16, 0xffff }, 0x790,
1276 FR30_INSN_ST, "st", "st",
1277 { { MNEM, ' ', OP (RI), ',', '@', OP (RJ), 0 } },
1278 { 16, 16, 0xff00 }, 0x1400,
1285 FR30_INSN_STH, "sth", "sth",
1286 { { MNEM, ' ', OP (RI), ',', '@', OP (RJ), 0 } },
1287 { 16, 16, 0xff00 }, 0x1500,
1294 FR30_INSN_STB, "stb", "stb",
1295 { { MNEM, ' ', OP (RI), ',', '@', OP (RJ), 0 } },
1296 { 16, 16, 0xff00 }, 0x1600,
1300 /* st $Ri,@($r13,$Rj) */
1303 FR30_INSN_STR13, "str13", "st",
1304 { { MNEM, ' ', OP (RI), ',', '@', '(', OP (R13), ',', OP (RJ), ')', 0 } },
1305 { 16, 16, 0xff00 }, 0x1000,
1309 /* sth $Ri,@($r13,$Rj) */
1312 FR30_INSN_STR13H, "str13h", "sth",
1313 { { MNEM, ' ', OP (RI), ',', '@', '(', OP (R13), ',', OP (RJ), ')', 0 } },
1314 { 16, 16, 0xff00 }, 0x1100,
1318 /* stb $Ri,@($r13,$Rj) */
1321 FR30_INSN_STR13B, "stR13b", "stb",
1322 { { MNEM, ' ', OP (RI), ',', '@', '(', OP (R13), ',', OP (RJ), ')', 0 } },
1323 { 16, 16, 0xff00 }, 0x1200,
1327 /* st $Ri,@($r14,$disp10) */
1330 FR30_INSN_STR14, "str14", "st",
1331 { { MNEM, ' ', OP (RI), ',', '@', '(', OP (R14), ',', OP (DISP10), ')', 0 } },
1332 { 16, 16, 0xf000 }, 0x3000,
1336 /* sth $Ri,@($r14,$disp9) */
1339 FR30_INSN_STR14H, "str14h", "sth",
1340 { { MNEM, ' ', OP (RI), ',', '@', '(', OP (R14), ',', OP (DISP9), ')', 0 } },
1341 { 16, 16, 0xf000 }, 0x5000,
1345 /* stb $Ri,@($r14,$disp8) */
1348 FR30_INSN_STR14B, "str14b", "stb",
1349 { { MNEM, ' ', OP (RI), ',', '@', '(', OP (R14), ',', OP (DISP8), ')', 0 } },
1350 { 16, 16, 0xf000 }, 0x7000,
1354 /* st $Ri,@($r15,$udisp6) */
1357 FR30_INSN_STR15, "str15", "st",
1358 { { MNEM, ' ', OP (RI), ',', '@', '(', OP (R15), ',', OP (UDISP6), ')', 0 } },
1359 { 16, 16, 0xff00 }, 0x1300,
1366 FR30_INSN_STR15GR, "str15gr", "st",
1367 { { MNEM, ' ', OP (RI), ',', '@', '-', OP (R15), 0 } },
1368 { 16, 16, 0xfff0 }, 0x1700,
1372 /* st $Rs2,@-$r15 */
1375 FR30_INSN_STR15DR, "str15dr", "st",
1376 { { MNEM, ' ', OP (RS2), ',', '@', '-', OP (R15), 0 } },
1377 { 16, 16, 0xfff0 }, 0x1780,
1384 FR30_INSN_STR15PS, "str15ps", "st",
1385 { { MNEM, ' ', OP (PS), ',', '@', '-', OP (R15), 0 } },
1386 { 16, 16, 0xffff }, 0x1790,
1393 FR30_INSN_MOV, "mov", "mov",
1394 { { MNEM, ' ', OP (RJ), ',', OP (RI), 0 } },
1395 { 16, 16, 0xff00 }, 0x8b00,
1402 FR30_INSN_MOVDR, "movdr", "mov",
1403 { { MNEM, ' ', OP (RS1), ',', OP (RI), 0 } },
1404 { 16, 16, 0xff00 }, 0xb700,
1411 FR30_INSN_MOVPS, "movps", "mov",
1412 { { MNEM, ' ', OP (PS), ',', OP (RI), 0 } },
1413 { 16, 16, 0xfff0 }, 0x1710,
1420 FR30_INSN_MOV2DR, "mov2dr", "mov",
1421 { { MNEM, ' ', OP (RI), ',', OP (RS1), 0 } },
1422 { 16, 16, 0xff00 }, 0xb300,
1429 FR30_INSN_MOV2PS, "mov2ps", "mov",
1430 { { MNEM, ' ', OP (RI), ',', OP (PS), 0 } },
1431 { 16, 16, 0xfff0 }, 0x710,
1438 FR30_INSN_JMP, "jmp", "jmp",
1439 { { MNEM, ' ', '@', OP (RI), 0 } },
1440 { 16, 16, 0xfff0 }, 0x9700,
1447 FR30_INSN_JMPD, "jmpd", "jmp:D",
1448 { { MNEM, ' ', '@', OP (RI), 0 } },
1449 { 16, 16, 0xfff0 }, 0x9f00,
1456 FR30_INSN_CALL, "call", "call",
1457 { { MNEM, ' ', OP (LABEL12), 0 } },
1458 { 16, 16, 0xf400 }, 0xd000,
1462 /* call:D $label12 */
1465 FR30_INSN_CALLD, "calld", "call:D",
1466 { { MNEM, ' ', OP (LABEL12), 0 } },
1467 { 16, 16, 0xf400 }, 0xd400,
1474 FR30_INSN_CALLR, "callr", "call",
1475 { { MNEM, ' ', '@', OP (RI), 0 } },
1476 { 16, 16, 0xfff0 }, 0x9710,
1483 FR30_INSN_CALLRD, "callrd", "call:D",
1484 { { MNEM, ' ', '@', OP (RI), 0 } },
1485 { 16, 16, 0xfff0 }, 0x9f10,
1492 FR30_INSN_RET, "ret", "ret",
1494 { 16, 16, 0xffff }, 0x9720,
1501 FR30_INSN_RETD, "retd", "ret:D",
1503 { 16, 16, 0xffff }, 0x9f20,
1510 FR30_INSN_INT, "int", "int",
1511 { { MNEM, ' ', OP (U8), 0 } },
1512 { 16, 16, 0xff00 }, 0x1f00,
1519 FR30_INSN_INTE, "inte", "inte",
1521 { 16, 16, 0xffff }, 0x9f30,
1528 FR30_INSN_RETI, "reti", "reti",
1530 { 16, 16, 0xffff }, 0x9730,
1537 FR30_INSN_BRA, "bra", "bra",
1538 { { MNEM, ' ', OP (LABEL9), 0 } },
1539 { 16, 16, 0xff00 }, 0xe000,
1546 FR30_INSN_BNO, "bno", "bno",
1547 { { MNEM, ' ', OP (LABEL9), 0 } },
1548 { 16, 16, 0xff00 }, 0xe100,
1555 FR30_INSN_BEQ, "beq", "beq",
1556 { { MNEM, ' ', OP (LABEL9), 0 } },
1557 { 16, 16, 0xff00 }, 0xe200,
1564 FR30_INSN_BNE, "bne", "bne",
1565 { { MNEM, ' ', OP (LABEL9), 0 } },
1566 { 16, 16, 0xff00 }, 0xe300,
1573 FR30_INSN_BC, "bc", "bc",
1574 { { MNEM, ' ', OP (LABEL9), 0 } },
1575 { 16, 16, 0xff00 }, 0xe400,
1582 FR30_INSN_BNC, "bnc", "bnc",
1583 { { MNEM, ' ', OP (LABEL9), 0 } },
1584 { 16, 16, 0xff00 }, 0xe500,
1591 FR30_INSN_BN, "bn", "bn",
1592 { { MNEM, ' ', OP (LABEL9), 0 } },
1593 { 16, 16, 0xff00 }, 0xe600,
1600 FR30_INSN_BP, "bp", "bp",
1601 { { MNEM, ' ', OP (LABEL9), 0 } },
1602 { 16, 16, 0xff00 }, 0xe700,
1609 FR30_INSN_BV, "bv", "bv",
1610 { { MNEM, ' ', OP (LABEL9), 0 } },
1611 { 16, 16, 0xff00 }, 0xe800,
1618 FR30_INSN_BNV, "bnv", "bnv",
1619 { { MNEM, ' ', OP (LABEL9), 0 } },
1620 { 16, 16, 0xff00 }, 0xe900,
1627 FR30_INSN_BLT, "blt", "blt",
1628 { { MNEM, ' ', OP (LABEL9), 0 } },
1629 { 16, 16, 0xff00 }, 0xea00,
1636 FR30_INSN_BGE, "bge", "bge",
1637 { { MNEM, ' ', OP (LABEL9), 0 } },
1638 { 16, 16, 0xff00 }, 0xeb00,
1645 FR30_INSN_BLE, "ble", "ble",
1646 { { MNEM, ' ', OP (LABEL9), 0 } },
1647 { 16, 16, 0xff00 }, 0xec00,
1654 FR30_INSN_BGT, "bgt", "bgt",
1655 { { MNEM, ' ', OP (LABEL9), 0 } },
1656 { 16, 16, 0xff00 }, 0xed00,
1663 FR30_INSN_BLS, "bls", "bls",
1664 { { MNEM, ' ', OP (LABEL9), 0 } },
1665 { 16, 16, 0xff00 }, 0xee00,
1672 FR30_INSN_BHI, "bhi", "bhi",
1673 { { MNEM, ' ', OP (LABEL9), 0 } },
1674 { 16, 16, 0xff00 }, 0xef00,
1681 FR30_INSN_BRAD, "brad", "bra:D",
1682 { { MNEM, ' ', OP (LABEL9), 0 } },
1683 { 16, 16, 0xff00 }, 0xf000,
1690 FR30_INSN_BNOD, "bnod", "bno:D",
1691 { { MNEM, ' ', OP (LABEL9), 0 } },
1692 { 16, 16, 0xff00 }, 0xf100,
1699 FR30_INSN_BEQD, "beqd", "beq:D",
1700 { { MNEM, ' ', OP (LABEL9), 0 } },
1701 { 16, 16, 0xff00 }, 0xf200,
1708 FR30_INSN_BNED, "bned", "bne:D",
1709 { { MNEM, ' ', OP (LABEL9), 0 } },
1710 { 16, 16, 0xff00 }, 0xf300,
1717 FR30_INSN_BCD, "bcd", "bc:D",
1718 { { MNEM, ' ', OP (LABEL9), 0 } },
1719 { 16, 16, 0xff00 }, 0xf400,
1726 FR30_INSN_BNCD, "bncd", "bnc:D",
1727 { { MNEM, ' ', OP (LABEL9), 0 } },
1728 { 16, 16, 0xff00 }, 0xf500,
1735 FR30_INSN_BND, "bnd", "bn:D",
1736 { { MNEM, ' ', OP (LABEL9), 0 } },
1737 { 16, 16, 0xff00 }, 0xf600,
1744 FR30_INSN_BPD, "bpd", "bp:D",
1745 { { MNEM, ' ', OP (LABEL9), 0 } },
1746 { 16, 16, 0xff00 }, 0xf700,
1753 FR30_INSN_BVD, "bvd", "bv:D",
1754 { { MNEM, ' ', OP (LABEL9), 0 } },
1755 { 16, 16, 0xff00 }, 0xf800,
1762 FR30_INSN_BNVD, "bnvd", "bnv:D",
1763 { { MNEM, ' ', OP (LABEL9), 0 } },
1764 { 16, 16, 0xff00 }, 0xf900,
1771 FR30_INSN_BLTD, "bltd", "blt:D",
1772 { { MNEM, ' ', OP (LABEL9), 0 } },
1773 { 16, 16, 0xff00 }, 0xfa00,
1780 FR30_INSN_BGED, "bged", "bge:D",
1781 { { MNEM, ' ', OP (LABEL9), 0 } },
1782 { 16, 16, 0xff00 }, 0xfb00,
1789 FR30_INSN_BLED, "bled", "ble:D",
1790 { { MNEM, ' ', OP (LABEL9), 0 } },
1791 { 16, 16, 0xff00 }, 0xfc00,
1798 FR30_INSN_BGTD, "bgtd", "bgt:D",
1799 { { MNEM, ' ', OP (LABEL9), 0 } },
1800 { 16, 16, 0xff00 }, 0xfd00,
1807 FR30_INSN_BLSD, "blsd", "bls:D",
1808 { { MNEM, ' ', OP (LABEL9), 0 } },
1809 { 16, 16, 0xff00 }, 0xfe00,
1816 FR30_INSN_BHID, "bhid", "bhi:D",
1817 { { MNEM, ' ', OP (LABEL9), 0 } },
1818 { 16, 16, 0xff00 }, 0xff00,
1822 /* dmov @$dir10,$R13 */
1825 FR30_INSN_DMOV2R13, "dmov2r13", "dmov",
1826 { { MNEM, ' ', '@', OP (DIR10), ',', OP (R13), 0 } },
1827 { 16, 16, 0xff00 }, 0x800,
1831 /* dmovh @$dir9,$R13 */
1834 FR30_INSN_DMOV2R13H, "dmov2r13h", "dmovh",
1835 { { MNEM, ' ', '@', OP (DIR9), ',', OP (R13), 0 } },
1836 { 16, 16, 0xff00 }, 0x900,
1840 /* dmovb @$dir8,$R13 */
1843 FR30_INSN_DMOV2R13B, "dmov2r13b", "dmovb",
1844 { { MNEM, ' ', '@', OP (DIR8), ',', OP (R13), 0 } },
1845 { 16, 16, 0xff00 }, 0xa00,
1849 /* dmov $R13,@$dir10 */
1852 FR30_INSN_DMOVR13, "dmovr13", "dmov",
1853 { { MNEM, ' ', OP (R13), ',', '@', OP (DIR10), 0 } },
1854 { 16, 16, 0xff00 }, 0x1800,
1858 /* dmovh $R13,@$dir9 */
1861 FR30_INSN_DMOVR13H, "dmovr13h", "dmovh",
1862 { { MNEM, ' ', OP (R13), ',', '@', OP (DIR9), 0 } },
1863 { 16, 16, 0xff00 }, 0x1900,
1867 /* dmovb $R13,@$dir8 */
1870 FR30_INSN_DMOVR13B, "dmovr13b", "dmovb",
1871 { { MNEM, ' ', OP (R13), ',', '@', OP (DIR8), 0 } },
1872 { 16, 16, 0xff00 }, 0x1a00,
1876 /* dmov @$dir10,@$R13+ */
1879 FR30_INSN_DMOV2R13PI, "dmov2r13pi", "dmov",
1880 { { MNEM, ' ', '@', OP (DIR10), ',', '@', OP (R13), '+', 0 } },
1881 { 16, 16, 0xff00 }, 0xc00,
1885 /* dmovh @$dir9,@$R13+ */
1888 FR30_INSN_DMOV2R13PIH, "dmov2r13pih", "dmovh",
1889 { { MNEM, ' ', '@', OP (DIR9), ',', '@', OP (R13), '+', 0 } },
1890 { 16, 16, 0xff00 }, 0xd00,
1894 /* dmovb @$dir8,@$R13+ */
1897 FR30_INSN_DMOV2R13PIB, "dmov2r13pib", "dmovb",
1898 { { MNEM, ' ', '@', OP (DIR8), ',', '@', OP (R13), '+', 0 } },
1899 { 16, 16, 0xff00 }, 0xe00,
1903 /* dmov @$R13+,@$dir10 */
1906 FR30_INSN_DMOVR13PI, "dmovr13pi", "dmov",
1907 { { MNEM, ' ', '@', OP (R13), '+', ',', '@', OP (DIR10), 0 } },
1908 { 16, 16, 0xff00 }, 0x1c00,
1912 /* dmovh @$R13+,@$dir9 */
1915 FR30_INSN_DMOVR13PIH, "dmovr13pih", "dmovh",
1916 { { MNEM, ' ', '@', OP (R13), '+', ',', '@', OP (DIR9), 0 } },
1917 { 16, 16, 0xff00 }, 0x1d00,
1921 /* dmovb @$R13+,@$dir8 */
1924 FR30_INSN_DMOVR13PIB, "dmovr13pib", "dmovb",
1925 { { MNEM, ' ', '@', OP (R13), '+', ',', '@', OP (DIR8), 0 } },
1926 { 16, 16, 0xff00 }, 0x1e00,
1930 /* dmov @$dir10,@-$R15 */
1933 FR30_INSN_DMOV2R15PD, "dmov2r15pd", "dmov",
1934 { { MNEM, ' ', '@', OP (DIR10), ',', '@', '-', OP (R15), 0 } },
1935 { 16, 16, 0xff00 }, 0xb00,
1939 /* dmov @$R15+,@$dir10 */
1942 FR30_INSN_DMOVR15PI, "dmovr15pi", "dmov",
1943 { { MNEM, ' ', '@', OP (R15), '+', ',', '@', OP (DIR10), 0 } },
1944 { 16, 16, 0xff00 }, 0x1b00,
1948 /* ldres @$Ri+,$u4 */
1951 FR30_INSN_LDRES, "ldres", "ldres",
1952 { { MNEM, ' ', '@', OP (RI), '+', ',', OP (U4), 0 } },
1953 { 16, 16, 0xff00 }, 0xbc00,
1957 /* stres $u4,@$Ri+ */
1960 FR30_INSN_STRES, "stres", "stres",
1961 { { MNEM, ' ', OP (U4), ',', '@', OP (RI), '+', 0 } },
1962 { 16, 16, 0xff00 }, 0xbd00,
1969 FR30_INSN_NOP, "nop", "nop",
1971 { 16, 16, 0xffff }, 0x9fa0,
1978 FR30_INSN_ANDCCR, "andccr", "andccr",
1979 { { MNEM, ' ', OP (U8), 0 } },
1980 { 16, 16, 0xff00 }, 0x8300,
1987 FR30_INSN_ORCCR, "orccr", "orccr",
1988 { { MNEM, ' ', OP (U8), 0 } },
1989 { 16, 16, 0xff00 }, 0x9300,
1996 FR30_INSN_STILM, "stilm", "stilm",
1997 { { MNEM, ' ', OP (U8), 0 } },
1998 { 16, 16, 0xff00 }, 0x8700,
2005 FR30_INSN_ADDSP, "addsp", "addsp",
2006 { { MNEM, ' ', OP (S10), 0 } },
2007 { 16, 16, 0xff00 }, 0xa300,
2014 FR30_INSN_EXTSB, "extsb", "extsb",
2015 { { MNEM, ' ', OP (RI), 0 } },
2016 { 16, 16, 0xfff0 }, 0x9780,
2023 FR30_INSN_EXTUB, "extub", "extub",
2024 { { MNEM, ' ', OP (RI), 0 } },
2025 { 16, 16, 0xfff0 }, 0x9790,
2032 FR30_INSN_EXTSH, "extsh", "extsh",
2033 { { MNEM, ' ', OP (RI), 0 } },
2034 { 16, 16, 0xfff0 }, 0x97a0,
2041 FR30_INSN_EXTUH, "extuh", "extuh",
2042 { { MNEM, ' ', OP (RI), 0 } },
2043 { 16, 16, 0xfff0 }, 0x97b0,
2050 FR30_INSN_ENTER, "enter", "enter",
2051 { { MNEM, ' ', OP (U10), 0 } },
2052 { 16, 16, 0xff00 }, 0xf00,
2059 FR30_INSN_LEAVE, "leave", "leave",
2061 { 16, 16, 0xffff }, 0x9f90,
2068 FR30_INSN_XCHB, "xchb", "xchb",
2069 { { MNEM, ' ', '@', OP (RJ), ',', OP (RI), 0 } },
2070 { 16, 16, 0xff00 }, 0x8a00,
2080 static const CGEN_INSN_TABLE insn_table =
2082 & fr30_cgen_insn_table_entries[0],
2088 /* Each non-simple macro entry points to an array of expansion possibilities. */
2090 #define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
2091 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
2092 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
2094 /* The macro instruction table. */
2096 static const CGEN_INSN macro_insn_table_entries[] =
2104 static const CGEN_INSN_TABLE macro_insn_table =
2106 & macro_insn_table_entries[0],
2108 (sizeof (macro_insn_table_entries) /
2109 sizeof (macro_insn_table_entries[0])),
2118 /* Return non-zero if INSN is to be added to the hash table.
2119 Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file. */
2122 asm_hash_insn_p (insn)
2123 const CGEN_INSN * insn;
2125 return CGEN_ASM_HASH_P (insn);
2129 dis_hash_insn_p (insn)
2130 const CGEN_INSN * insn;
2132 /* If building the hash table and the NO-DIS attribute is present,
2134 if (CGEN_INSN_ATTR (insn, CGEN_INSN_NO_DIS))
2136 return CGEN_DIS_HASH_P (insn);
2139 /* The result is the hash value of the insn.
2140 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
2143 asm_hash_insn (mnem)
2146 return CGEN_ASM_HASH (mnem);
2149 /* BUF is a pointer to the insn's bytes in target order.
2150 VALUE is an integer of the first CGEN_BASE_INSN_BITSIZE bits,
2154 dis_hash_insn (buf, value)
2156 unsigned long value;
2158 return CGEN_DIS_HASH (buf, value);
2161 /* Initialize an opcode table and return a descriptor.
2162 It's much like opening a file, and must be the first function called. */
2165 fr30_cgen_opcode_open (mach, endian)
2167 enum cgen_endian endian;
2169 CGEN_OPCODE_TABLE * table = (CGEN_OPCODE_TABLE *) xmalloc (sizeof (CGEN_OPCODE_TABLE));
2178 memset (table, 0, sizeof (*table));
2180 CGEN_OPCODE_MACH (table) = mach;
2181 CGEN_OPCODE_ENDIAN (table) = endian;
2182 /* FIXME: for the sparc case we can determine insn-endianness statically.
2183 The worry here is where both data and insn endian can be independently
2184 chosen, in which case this function will need another argument.
2185 Actually, will want to allow for more arguments in the future anyway. */
2186 CGEN_OPCODE_INSN_ENDIAN (table) = endian;
2188 CGEN_OPCODE_HW_LIST (table) = & fr30_cgen_hw_entries[0];
2190 CGEN_OPCODE_OPERAND_TABLE (table) = & fr30_cgen_operand_table[0];
2192 * CGEN_OPCODE_INSN_TABLE (table) = insn_table;
2194 * CGEN_OPCODE_MACRO_INSN_TABLE (table) = macro_insn_table;
2196 CGEN_OPCODE_ASM_HASH_P (table) = asm_hash_insn_p;
2197 CGEN_OPCODE_ASM_HASH (table) = asm_hash_insn;
2198 CGEN_OPCODE_ASM_HASH_SIZE (table) = CGEN_ASM_HASH_SIZE;
2200 CGEN_OPCODE_DIS_HASH_P (table) = dis_hash_insn_p;
2201 CGEN_OPCODE_DIS_HASH (table) = dis_hash_insn;
2202 CGEN_OPCODE_DIS_HASH_SIZE (table) = CGEN_DIS_HASH_SIZE;
2204 return (CGEN_OPCODE_DESC) table;
2207 /* Close an opcode table. */
2210 fr30_cgen_opcode_close (desc)
2211 CGEN_OPCODE_DESC desc;
2216 /* Getting values from cgen_fields is handled by a collection of functions.
2217 They are distinguished by the type of the VALUE argument they return.
2218 TODO: floating point, inlining support, remove cases where result type
2222 fr30_cgen_get_int_operand (opindex, fields)
2224 const CGEN_FIELDS * fields;
2230 case FR30_OPERAND_RI :
2231 value = fields->f_Ri;
2233 case FR30_OPERAND_RJ :
2234 value = fields->f_Rj;
2236 case FR30_OPERAND_RS1 :
2237 value = fields->f_Rs1;
2239 case FR30_OPERAND_RS2 :
2240 value = fields->f_Rs2;
2242 case FR30_OPERAND_R13 :
2243 value = fields->f_nil;
2245 case FR30_OPERAND_R14 :
2246 value = fields->f_nil;
2248 case FR30_OPERAND_R15 :
2249 value = fields->f_nil;
2251 case FR30_OPERAND_PS :
2252 value = fields->f_nil;
2254 case FR30_OPERAND_U4 :
2255 value = fields->f_u4;
2257 case FR30_OPERAND_M4 :
2258 value = fields->f_m4;
2260 case FR30_OPERAND_U8 :
2261 value = fields->f_u8;
2263 case FR30_OPERAND_I8 :
2264 value = fields->f_i8;
2266 case FR30_OPERAND_UDISP6 :
2267 value = fields->f_udisp6;
2269 case FR30_OPERAND_DISP8 :
2270 value = fields->f_disp8;
2272 case FR30_OPERAND_DISP9 :
2273 value = fields->f_disp9;
2275 case FR30_OPERAND_DISP10 :
2276 value = fields->f_disp10;
2278 case FR30_OPERAND_S10 :
2279 value = fields->f_s10;
2281 case FR30_OPERAND_U10 :
2282 value = fields->f_u10;
2284 case FR30_OPERAND_DIR8 :
2285 value = fields->f_dir8;
2287 case FR30_OPERAND_DIR9 :
2288 value = fields->f_dir9;
2290 case FR30_OPERAND_DIR10 :
2291 value = fields->f_dir10;
2293 case FR30_OPERAND_LABEL9 :
2294 value = fields->f_rel9;
2296 case FR30_OPERAND_LABEL12 :
2297 value = fields->f_rel12;
2299 case FR30_OPERAND_CC :
2300 value = fields->f_cc;
2304 /* xgettext:c-format */
2305 fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
2314 fr30_cgen_get_vma_operand (opindex, fields)
2316 const CGEN_FIELDS * fields;
2322 case FR30_OPERAND_RI :
2323 value = fields->f_Ri;
2325 case FR30_OPERAND_RJ :
2326 value = fields->f_Rj;
2328 case FR30_OPERAND_RS1 :
2329 value = fields->f_Rs1;
2331 case FR30_OPERAND_RS2 :
2332 value = fields->f_Rs2;
2334 case FR30_OPERAND_R13 :
2335 value = fields->f_nil;
2337 case FR30_OPERAND_R14 :
2338 value = fields->f_nil;
2340 case FR30_OPERAND_R15 :
2341 value = fields->f_nil;
2343 case FR30_OPERAND_PS :
2344 value = fields->f_nil;
2346 case FR30_OPERAND_U4 :
2347 value = fields->f_u4;
2349 case FR30_OPERAND_M4 :
2350 value = fields->f_m4;
2352 case FR30_OPERAND_U8 :
2353 value = fields->f_u8;
2355 case FR30_OPERAND_I8 :
2356 value = fields->f_i8;
2358 case FR30_OPERAND_UDISP6 :
2359 value = fields->f_udisp6;
2361 case FR30_OPERAND_DISP8 :
2362 value = fields->f_disp8;
2364 case FR30_OPERAND_DISP9 :
2365 value = fields->f_disp9;
2367 case FR30_OPERAND_DISP10 :
2368 value = fields->f_disp10;
2370 case FR30_OPERAND_S10 :
2371 value = fields->f_s10;
2373 case FR30_OPERAND_U10 :
2374 value = fields->f_u10;
2376 case FR30_OPERAND_DIR8 :
2377 value = fields->f_dir8;
2379 case FR30_OPERAND_DIR9 :
2380 value = fields->f_dir9;
2382 case FR30_OPERAND_DIR10 :
2383 value = fields->f_dir10;
2385 case FR30_OPERAND_LABEL9 :
2386 value = fields->f_rel9;
2388 case FR30_OPERAND_LABEL12 :
2389 value = fields->f_rel12;
2391 case FR30_OPERAND_CC :
2392 value = fields->f_cc;
2396 /* xgettext:c-format */
2397 fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
2405 /* Stuffing values in cgen_fields is handled by a collection of functions.
2406 They are distinguished by the type of the VALUE argument they accept.
2407 TODO: floating point, inlining support, remove cases where argument type
2411 fr30_cgen_set_int_operand (opindex, fields, value)
2413 CGEN_FIELDS * fields;
2418 case FR30_OPERAND_RI :
2419 fields->f_Ri = value;
2421 case FR30_OPERAND_RJ :
2422 fields->f_Rj = value;
2424 case FR30_OPERAND_RS1 :
2425 fields->f_Rs1 = value;
2427 case FR30_OPERAND_RS2 :
2428 fields->f_Rs2 = value;
2430 case FR30_OPERAND_R13 :
2431 fields->f_nil = value;
2433 case FR30_OPERAND_R14 :
2434 fields->f_nil = value;
2436 case FR30_OPERAND_R15 :
2437 fields->f_nil = value;
2439 case FR30_OPERAND_PS :
2440 fields->f_nil = value;
2442 case FR30_OPERAND_U4 :
2443 fields->f_u4 = value;
2445 case FR30_OPERAND_M4 :
2446 fields->f_m4 = value;
2448 case FR30_OPERAND_U8 :
2449 fields->f_u8 = value;
2451 case FR30_OPERAND_I8 :
2452 fields->f_i8 = value;
2454 case FR30_OPERAND_UDISP6 :
2455 fields->f_udisp6 = value;
2457 case FR30_OPERAND_DISP8 :
2458 fields->f_disp8 = value;
2460 case FR30_OPERAND_DISP9 :
2461 fields->f_disp9 = value;
2463 case FR30_OPERAND_DISP10 :
2464 fields->f_disp10 = value;
2466 case FR30_OPERAND_S10 :
2467 fields->f_s10 = value;
2469 case FR30_OPERAND_U10 :
2470 fields->f_u10 = value;
2472 case FR30_OPERAND_DIR8 :
2473 fields->f_dir8 = value;
2475 case FR30_OPERAND_DIR9 :
2476 fields->f_dir9 = value;
2478 case FR30_OPERAND_DIR10 :
2479 fields->f_dir10 = value;
2481 case FR30_OPERAND_LABEL9 :
2482 fields->f_rel9 = value;
2484 case FR30_OPERAND_LABEL12 :
2485 fields->f_rel12 = value;
2487 case FR30_OPERAND_CC :
2488 fields->f_cc = value;
2492 /* xgettext:c-format */
2493 fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
2500 fr30_cgen_set_vma_operand (opindex, fields, value)
2502 CGEN_FIELDS * fields;
2507 case FR30_OPERAND_RI :
2508 fields->f_Ri = value;
2510 case FR30_OPERAND_RJ :
2511 fields->f_Rj = value;
2513 case FR30_OPERAND_RS1 :
2514 fields->f_Rs1 = value;
2516 case FR30_OPERAND_RS2 :
2517 fields->f_Rs2 = value;
2519 case FR30_OPERAND_R13 :
2520 fields->f_nil = value;
2522 case FR30_OPERAND_R14 :
2523 fields->f_nil = value;
2525 case FR30_OPERAND_R15 :
2526 fields->f_nil = value;
2528 case FR30_OPERAND_PS :
2529 fields->f_nil = value;
2531 case FR30_OPERAND_U4 :
2532 fields->f_u4 = value;
2534 case FR30_OPERAND_M4 :
2535 fields->f_m4 = value;
2537 case FR30_OPERAND_U8 :
2538 fields->f_u8 = value;
2540 case FR30_OPERAND_I8 :
2541 fields->f_i8 = value;
2543 case FR30_OPERAND_UDISP6 :
2544 fields->f_udisp6 = value;
2546 case FR30_OPERAND_DISP8 :
2547 fields->f_disp8 = value;
2549 case FR30_OPERAND_DISP9 :
2550 fields->f_disp9 = value;
2552 case FR30_OPERAND_DISP10 :
2553 fields->f_disp10 = value;
2555 case FR30_OPERAND_S10 :
2556 fields->f_s10 = value;
2558 case FR30_OPERAND_U10 :
2559 fields->f_u10 = value;
2561 case FR30_OPERAND_DIR8 :
2562 fields->f_dir8 = value;
2564 case FR30_OPERAND_DIR9 :
2565 fields->f_dir9 = value;
2567 case FR30_OPERAND_DIR10 :
2568 fields->f_dir10 = value;
2570 case FR30_OPERAND_LABEL9 :
2571 fields->f_rel9 = value;
2573 case FR30_OPERAND_LABEL12 :
2574 fields->f_rel12 = value;
2576 case FR30_OPERAND_CC :
2577 fields->f_cc = value;
2581 /* xgettext:c-format */
2582 fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),