/* CGEN opcode support for m32r. This file is machine generated with CGEN. Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include #include "ansidecl.h" #include "libiberty.h" #include "bfd.h" #include "m32r-opc.h" /* Attributes. */ static const CGEN_ATTR_ENTRY MACH_attr[] = { { "m32r", MACH_M32R }, /* start-sanitize-m32rx */ { "m32rx", MACH_M32RX }, /* end-sanitize-m32rx */ { "max", MACH_MAX }, { 0, 0 } }; /* start-sanitize-m32rx */ static const CGEN_ATTR_ENTRY PIPE_attr[] = { { "NONE", PIPE_NONE }, { "O", PIPE_O }, { "S", PIPE_S }, { "OS", PIPE_OS }, { 0, 0 } }; /* end-sanitize-m32rx */ const CGEN_ATTR_TABLE m32r_cgen_operand_attr_table[] = { { "ABS-ADDR", NULL }, { "FAKE", NULL }, { "NEGATIVE", NULL }, { "PC", NULL }, { "PCREL-ADDR", NULL }, { "RELAX", NULL }, { "RELOC", NULL }, { "SIGN-OPT", NULL }, { "UNSIGNED", NULL }, { 0, 0 } }; const CGEN_ATTR_TABLE m32r_cgen_insn_attr_table[] = { { "MACH", & MACH_attr[0] }, /* start-sanitize-m32rx */ { "PIPE", & PIPE_attr[0] }, /* end-sanitize-m32rx */ { "ALIAS", NULL }, { "COND-CTI", NULL }, { "FILL-SLOT", NULL }, { "PARALLEL", NULL }, { "RELAX", NULL }, { "RELAXABLE", NULL }, { "UNCOND-CTI", NULL }, { 0, 0 } }; CGEN_KEYWORD_ENTRY m32r_cgen_opval_h_gr_entries[] = { { "fp", 13 }, { "lr", 14 }, { "sp", 15 }, { "r0", 0 }, { "r1", 1 }, { "r2", 2 }, { "r3", 3 }, { "r4", 4 }, { "r5", 5 }, { "r6", 6 }, { "r7", 7 }, { "r8", 8 }, { "r9", 9 }, { "r10", 10 }, { "r11", 11 }, { "r12", 12 }, { "r13", 13 }, { "r14", 14 }, { "r15", 15 } }; CGEN_KEYWORD m32r_cgen_opval_h_gr = { & m32r_cgen_opval_h_gr_entries[0], 19 }; CGEN_KEYWORD_ENTRY m32r_cgen_opval_h_cr_entries[] = { { "psw", 0 }, { "cbr", 1 }, { "spi", 2 }, { "spu", 3 }, { "bpc", 6 }, { "cr0", 0 }, { "cr1", 1 }, { "cr2", 2 }, { "cr3", 3 }, { "cr4", 4 }, { "cr5", 5 }, { "cr6", 6 } }; CGEN_KEYWORD m32r_cgen_opval_h_cr = { & m32r_cgen_opval_h_cr_entries[0], 12 }; /* start-sanitize-m32rx */ CGEN_KEYWORD_ENTRY m32r_cgen_opval_h_accums_entries[] = { { "a0", 0 }, { "a1", 1 } }; CGEN_KEYWORD m32r_cgen_opval_h_accums = { & m32r_cgen_opval_h_accums_entries[0], 2 }; /* end-sanitize-m32rx */ static CGEN_HW_ENTRY m32r_cgen_hw_entries[] = { { "h-pc", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-memory", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-sint", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-uint", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-addr", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-iaddr", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-hi16", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-slo16", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-ulo16", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-gr", CGEN_ASM_KEYWORD, (PTR) & m32r_cgen_opval_h_gr }, { "h-cr", CGEN_ASM_KEYWORD, (PTR) & m32r_cgen_opval_h_cr }, { "h-accum", CGEN_ASM_KEYWORD, (PTR) 0 }, /* start-sanitize-m32rx */ { "h-accums", CGEN_ASM_KEYWORD, (PTR) & m32r_cgen_opval_h_accums }, /* end-sanitize-m32rx */ /* start-sanitize-m32rx */ { "h-abort", CGEN_ASM_KEYWORD, (PTR) 0 }, /* end-sanitize-m32rx */ { "h-cond", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-sm", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-bsm", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-ie", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-bie", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-bcond", CGEN_ASM_KEYWORD, (PTR) 0 }, { "h-bpc", CGEN_ASM_KEYWORD, (PTR) 0 }, { 0 } }; const CGEN_OPERAND m32r_cgen_operand_table[MAX_OPERANDS] = { /* pc: program counter */ { "pc", 0, 0, { 0, 0|(1< $dr,$sr */ /* 0 */ { OP, ' ', 130, ',', 129, 0 }, /* $dr,$sr,#$slo16 */ /* 1 */ { OP, ' ', 130, ',', 129, ',', '#', 143, 0 }, /* $dr,$sr,$slo16 */ /* 2 */ { OP, ' ', 130, ',', 129, ',', 143, 0 }, /* $dr,$sr,#$uimm16 */ /* 3 */ { OP, ' ', 130, ',', 129, ',', '#', 139, 0 }, /* $dr,$sr,$uimm16 */ /* 4 */ { OP, ' ', 130, ',', 129, ',', 139, 0 }, /* $dr,$sr,#$ulo16 */ /* 5 */ { OP, ' ', 130, ',', 129, ',', '#', 144, 0 }, /* $dr,$sr,$ulo16 */ /* 6 */ { OP, ' ', 130, ',', 129, ',', 144, 0 }, /* $dr,#$simm8 */ /* 7 */ { OP, ' ', 130, ',', '#', 135, 0 }, /* $dr,$simm8 */ /* 8 */ { OP, ' ', 130, ',', 135, 0 }, /* $dr,$sr,#$simm16 */ /* 9 */ { OP, ' ', 130, ',', 129, ',', '#', 136, 0 }, /* $dr,$sr,$simm16 */ /* 10 */ { OP, ' ', 130, ',', 129, ',', 136, 0 }, /* $disp8 */ /* 11 */ { OP, ' ', 146, 0 }, /* $disp24 */ /* 12 */ { OP, ' ', 148, 0 }, /* $src1,$src2,$disp16 */ /* 13 */ { OP, ' ', 131, ',', 132, ',', 147, 0 }, /* $src2,$disp16 */ /* 14 */ { OP, ' ', 132, ',', 147, 0 }, /* $src1,$src2 */ /* 15 */ { OP, ' ', 131, ',', 132, 0 }, /* $src2,#$simm16 */ /* 16 */ { OP, ' ', 132, ',', '#', 136, 0 }, /* $src2,$simm16 */ /* 17 */ { OP, ' ', 132, ',', 136, 0 }, /* $src2,#$uimm16 */ /* 18 */ { OP, ' ', 132, ',', '#', 139, 0 }, /* $src2,$uimm16 */ /* 19 */ { OP, ' ', 132, ',', 139, 0 }, /* $src2 */ /* 20 */ { OP, ' ', 132, 0 }, /* $sr */ /* 21 */ { OP, ' ', 129, 0 }, /* $dr,@$sr */ /* 22 */ { OP, ' ', 130, ',', '@', 129, 0 }, /* $dr,@($sr) */ /* 23 */ { OP, ' ', 130, ',', '@', '(', 129, ')', 0 }, /* $dr,@($slo16,$sr) */ /* 24 */ { OP, ' ', 130, ',', '@', '(', 143, ',', 129, ')', 0 }, /* $dr,@($sr,$slo16) */ /* 25 */ { OP, ' ', 130, ',', '@', '(', 129, ',', 143, ')', 0 }, /* $dr,@$sr+ */ /* 26 */ { OP, ' ', 130, ',', '@', 129, '+', 0 }, /* $dr,#$uimm24 */ /* 27 */ { OP, ' ', 130, ',', '#', 145, 0 }, /* $dr,$uimm24 */ /* 28 */ { OP, ' ', 130, ',', 145, 0 }, /* $dr,$slo16 */ /* 29 */ { OP, ' ', 130, ',', 143, 0 }, /* $src1,$src2,$acc */ /* 30 */ { OP, ' ', 131, ',', 132, ',', 141, 0 }, /* $dr */ /* 31 */ { OP, ' ', 130, 0 }, /* $dr,$accs */ /* 32 */ { OP, ' ', 130, ',', 140, 0 }, /* $dr,$scr */ /* 33 */ { OP, ' ', 130, ',', 133, 0 }, /* $src1 */ /* 34 */ { OP, ' ', 131, 0 }, /* $src1,$accs */ /* 35 */ { OP, ' ', 131, ',', 140, 0 }, /* $sr,$dcr */ /* 36 */ { OP, ' ', 129, ',', 134, 0 }, /* */ /* 37 */ { OP, 0 }, /* $accs */ /* 38 */ { OP, ' ', 140, 0 }, /* $dr,#$hi16 */ /* 39 */ { OP, ' ', 130, ',', '#', 142, 0 }, /* $dr,$hi16 */ /* 40 */ { OP, ' ', 130, ',', 142, 0 }, /* $dr,#$uimm5 */ /* 41 */ { OP, ' ', 130, ',', '#', 138, 0 }, /* $dr,$uimm5 */ /* 42 */ { OP, ' ', 130, ',', 138, 0 }, /* $src1,@$src2 */ /* 43 */ { OP, ' ', 131, ',', '@', 132, 0 }, /* $src1,@($src2) */ /* 44 */ { OP, ' ', 131, ',', '@', '(', 132, ')', 0 }, /* $src1,@($slo16,$src2) */ /* 45 */ { OP, ' ', 131, ',', '@', '(', 143, ',', 132, ')', 0 }, /* $src1,@($src2,$slo16) */ /* 46 */ { OP, ' ', 131, ',', '@', '(', 132, ',', 143, ')', 0 }, /* $src1,@+$src2 */ /* 47 */ { OP, ' ', 131, ',', '@', '+', 132, 0 }, /* $src1,@-$src2 */ /* 48 */ { OP, ' ', 131, ',', '@', '-', 132, 0 }, /* #$uimm4 */ /* 49 */ { OP, ' ', '#', 137, 0 }, /* $uimm4 */ /* 50 */ { OP, ' ', 137, 0 }, /* $dr,$src2 */ /* 51 */ { OP, ' ', 130, ',', 132, 0 }, }; #undef OP static const CGEN_FORMAT format_table[] = { /* f-op1.number.f-r1.dr.f-op2.number.f-r2.sr. */ /* 0 */ { 16, 16, 0xf0f0 }, /* f-op1.number.f-r1.dr.f-op2.number.f-r2.sr.f-simm16.slo16. */ /* 1 */ { 32, 32, 0xf0f00000 }, /* f-op1.number.f-r1.dr.f-op2.number.f-r2.sr.f-uimm16.uimm16. */ /* 2 */ { 32, 32, 0xf0f00000 }, /* f-op1.number.f-r1.dr.f-op2.number.f-r2.sr.f-uimm16.ulo16. */ /* 3 */ { 32, 32, 0xf0f00000 }, /* f-op1.number.f-r1.dr.f-simm8.simm8. */ /* 4 */ { 16, 16, 0xf000 }, /* f-op1.number.f-r1.dr.f-op2.number.f-r2.sr.f-simm16.simm16. */ /* 5 */ { 32, 32, 0xf0f00000 }, /* f-op1.number.f-r1.number.f-disp8.disp8. */ /* 6 */ { 16, 16, 0xff00 }, /* f-op1.number.f-r1.number.f-disp24.disp24. */ /* 7 */ { 32, 32, 0xff000000 }, /* f-op1.number.f-r1.src1.f-op2.number.f-r2.src2.f-disp16.disp16. */ /* 8 */ { 32, 32, 0xf0f00000 }, /* f-op1.number.f-r1.number.f-op2.number.f-r2.src2.f-disp16.disp16. */ /* 9 */ { 32, 32, 0xfff00000 }, /* f-op1.number.f-r1.src1.f-op2.number.f-r2.src2. */ /* 10 */ { 16, 16, 0xf0f0 }, /* f-op1.number.f-r1.number.f-op2.number.f-r2.src2.f-simm16.simm16. */ /* 11 */ { 32, 32, 0xfff00000 }, /* f-op1.number.f-r1.number.f-op2.number.f-r2.src2.f-uimm16.uimm16. */ /* 12 */ { 32, 32, 0xfff00000 }, /* f-op1.number.f-r1.number.f-op2.number.f-r2.src2. */ /* 13 */ { 16, 16, 0xfff0 }, /* f-op1.number.f-r1.dr.f-op2.number.f-r2.sr.f-simm16.number. */ /* 14 */ { 32, 32, 0xf0f0ffff }, /* f-op1.number.f-r1.number.f-op2.number.f-r2.sr. */ /* 15 */ { 16, 16, 0xfff0 }, /* f-op1.number.f-r1.dr.f-uimm24.uimm24. */ /* 16 */ { 32, 32, 0xf0000000 }, /* f-op1.number.f-r1.dr.f-op2.number.f-r2.number.f-simm16.slo16. */ /* 17 */ { 32, 32, 0xf0ff0000 }, /* f-op1.number.f-r1.src1.f-acc.acc.f-op23.number.f-r2.src2. */ /* 18 */ { 16, 16, 0xf070 }, /* f-op1.number.f-r1.dr.f-op2.number.f-r2.number. */ /* 19 */ { 16, 16, 0xf0ff }, /* f-op1.number.f-r1.dr.f-op2.number.f-accs.accs.f-op3.number. */ /* 20 */ { 16, 16, 0xf0f3 }, /* f-op1.number.f-r1.dr.f-op2.number.f-r2.scr. */ /* 21 */ { 16, 16, 0xf0f0 }, /* f-op1.number.f-r1.src1.f-op2.number.f-r2.number. */ /* 22 */ { 16, 16, 0xf0ff }, /* f-op1.number.f-r1.src1.f-op2.number.f-accs.accs.f-op3.number. */ /* 23 */ { 16, 16, 0xf0f3 }, /* f-op1.number.f-r1.dcr.f-op2.number.f-r2.sr. */ /* 24 */ { 16, 16, 0xf0f0 }, /* f-op1.number.f-r1.number.f-op2.number.f-r2.number. */ /* 25 */ { 16, 16, 0xffff }, /* f-op1.number.f-r1.number.f-op2.number.f-accs.accs.f-op3.number. */ /* 26 */ { 16, 16, 0xfff3 }, /* f-op1.number.f-r1.dr.f-op2.number.f-r2.number.f-hi16.hi16. */ /* 27 */ { 32, 32, 0xf0ff0000 }, /* f-op1.number.f-r1.dr.f-shift-op2.number.f-uimm5.uimm5. */ /* 28 */ { 16, 16, 0xf0e0 }, /* f-op1.number.f-r1.src1.f-op2.number.f-r2.src2.f-simm16.slo16. */ /* 29 */ { 32, 32, 0xf0f00000 }, /* f-op1.number.f-r1.number.f-op2.number.f-uimm4.uimm4. */ /* 30 */ { 16, 16, 0xfff0 }, /* f-op1.number.f-r1.dr.f-op2.number.f-r2.src2.f-uimm16.number. */ /* 31 */ { 32, 32, 0xf0f0ffff }, }; #define A(a) (1 << CGEN_CAT3 (CGEN_INSN,_,a)) #define SYN(n) (& syntax_table[n]) #define FMT(n) (& format_table[n]) const CGEN_INSN m32r_cgen_insn_table_entries[MAX_INSNS] = { /* null first entry, end of all hash chains */ { { 0 }, 0 }, /* add $dr,$sr */ { { 1, 1, 1, 1 }, "add", "add", SYN (0), FMT (0), 0xa0, { 2, 0|A(PARALLEL), { (1<f_r2 = * valuep; break; case M32R_OPERAND_DR : fields->f_r1 = * valuep; break; case M32R_OPERAND_SRC1 : fields->f_r1 = * valuep; break; case M32R_OPERAND_SRC2 : fields->f_r2 = * valuep; break; case M32R_OPERAND_SCR : fields->f_r2 = * valuep; break; case M32R_OPERAND_DCR : fields->f_r1 = * valuep; break; case M32R_OPERAND_SIMM8 : fields->f_simm8 = * valuep; break; case M32R_OPERAND_SIMM16 : fields->f_simm16 = * valuep; break; case M32R_OPERAND_UIMM4 : fields->f_uimm4 = * valuep; break; case M32R_OPERAND_UIMM5 : fields->f_uimm5 = * valuep; break; case M32R_OPERAND_UIMM16 : fields->f_uimm16 = * valuep; break; /* start-sanitize-m32rx */ case M32R_OPERAND_ACCS : fields->f_accs = * valuep; break; /* end-sanitize-m32rx */ /* start-sanitize-m32rx */ case M32R_OPERAND_ACC : fields->f_acc = * valuep; break; /* end-sanitize-m32rx */ case M32R_OPERAND_HI16 : fields->f_hi16 = * valuep; break; case M32R_OPERAND_SLO16 : fields->f_simm16 = * valuep; break; case M32R_OPERAND_ULO16 : fields->f_uimm16 = * valuep; break; case M32R_OPERAND_UIMM24 : fields->f_uimm24 = * valuep; break; case M32R_OPERAND_DISP8 : fields->f_disp8 = * valuep; break; case M32R_OPERAND_DISP16 : fields->f_disp16 = * valuep; break; case M32R_OPERAND_DISP24 : fields->f_disp24 = * valuep; break; default : fprintf (stderr, "Unrecognized field %d while setting operand.\n", opindex); abort (); } } /* Main entry point for getting values from cgen_fields. */ CGEN_INLINE long m32r_cgen_get_operand (opindex, fields) int opindex; const CGEN_FIELDS * fields; { long value; switch (opindex) { case M32R_OPERAND_SR : value = fields->f_r2; break; case M32R_OPERAND_DR : value = fields->f_r1; break; case M32R_OPERAND_SRC1 : value = fields->f_r1; break; case M32R_OPERAND_SRC2 : value = fields->f_r2; break; case M32R_OPERAND_SCR : value = fields->f_r2; break; case M32R_OPERAND_DCR : value = fields->f_r1; break; case M32R_OPERAND_SIMM8 : value = fields->f_simm8; break; case M32R_OPERAND_SIMM16 : value = fields->f_simm16; break; case M32R_OPERAND_UIMM4 : value = fields->f_uimm4; break; case M32R_OPERAND_UIMM5 : value = fields->f_uimm5; break; case M32R_OPERAND_UIMM16 : value = fields->f_uimm16; break; /* start-sanitize-m32rx */ case M32R_OPERAND_ACCS : value = fields->f_accs; break; /* end-sanitize-m32rx */ /* start-sanitize-m32rx */ case M32R_OPERAND_ACC : value = fields->f_acc; break; /* end-sanitize-m32rx */ case M32R_OPERAND_HI16 : value = fields->f_hi16; break; case M32R_OPERAND_SLO16 : value = fields->f_simm16; break; case M32R_OPERAND_ULO16 : value = fields->f_uimm16; break; case M32R_OPERAND_UIMM24 : value = fields->f_uimm24; break; case M32R_OPERAND_DISP8 : value = fields->f_disp8; break; case M32R_OPERAND_DISP16 : value = fields->f_disp16; break; case M32R_OPERAND_DISP24 : value = fields->f_disp24; break; default : fprintf (stderr, "Unrecognized field %d while getting operand.\n", opindex); abort (); } return value; }