1*3d8817e4Smiod /* mmix.h -- Header file for MMIX opcode table 2*3d8817e4Smiod Copyright (C) 2001, 2003 Free Software Foundation, Inc. 3*3d8817e4Smiod Written by Hans-Peter Nilsson (hp@bitrange.com) 4*3d8817e4Smiod 5*3d8817e4Smiod This file is part of GDB, GAS, and the GNU binutils. 6*3d8817e4Smiod 7*3d8817e4Smiod GDB, GAS, and the GNU binutils are free software; you can redistribute 8*3d8817e4Smiod them and/or modify them under the terms of the GNU General Public 9*3d8817e4Smiod License as published by the Free Software Foundation; either version 2, 10*3d8817e4Smiod or (at your option) any later version. 11*3d8817e4Smiod 12*3d8817e4Smiod GDB, GAS, and the GNU binutils are distributed in the hope that they 13*3d8817e4Smiod will be useful, but WITHOUT ANY WARRANTY; without even the implied 14*3d8817e4Smiod warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 15*3d8817e4Smiod the GNU General Public License for more details. 16*3d8817e4Smiod 17*3d8817e4Smiod You should have received a copy of the GNU General Public License 18*3d8817e4Smiod along with this file; see the file COPYING. If not, write to the Free 19*3d8817e4Smiod Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 20*3d8817e4Smiod 21*3d8817e4Smiod /* We could have just a char*[] table indexed by the register number, but 22*3d8817e4Smiod that would not allow for synonyms. The table is terminated with an 23*3d8817e4Smiod entry with a NULL name. */ 24*3d8817e4Smiod struct mmix_spec_reg 25*3d8817e4Smiod { 26*3d8817e4Smiod const char *name; 27*3d8817e4Smiod unsigned int number; 28*3d8817e4Smiod }; 29*3d8817e4Smiod 30*3d8817e4Smiod /* General indication of the type of instruction. */ 31*3d8817e4Smiod enum mmix_insn_type 32*3d8817e4Smiod { 33*3d8817e4Smiod mmix_type_pseudo, 34*3d8817e4Smiod mmix_type_normal, 35*3d8817e4Smiod mmix_type_branch, 36*3d8817e4Smiod mmix_type_condbranch, 37*3d8817e4Smiod mmix_type_memaccess_octa, 38*3d8817e4Smiod mmix_type_memaccess_tetra, 39*3d8817e4Smiod mmix_type_memaccess_wyde, 40*3d8817e4Smiod mmix_type_memaccess_byte, 41*3d8817e4Smiod mmix_type_memaccess_block, 42*3d8817e4Smiod mmix_type_jsr 43*3d8817e4Smiod }; 44*3d8817e4Smiod 45*3d8817e4Smiod /* Type of operands an instruction takes. Use when parsing assembly code 46*3d8817e4Smiod and disassembling. */ 47*3d8817e4Smiod enum mmix_operands_type 48*3d8817e4Smiod { 49*3d8817e4Smiod mmix_operands_none = 0, 50*3d8817e4Smiod 51*3d8817e4Smiod /* All operands are registers: "$X,$Y,$Z". */ 52*3d8817e4Smiod mmix_operands_regs, 53*3d8817e4Smiod 54*3d8817e4Smiod /* "$X,YZ", like SETH. */ 55*3d8817e4Smiod mmix_operands_reg_yz, 56*3d8817e4Smiod 57*3d8817e4Smiod /* The regular "$X,$Y,$Z|Z". 58*3d8817e4Smiod The Z is optional; if only "$X,$Y" is given, then "$X,$Y,0" is 59*3d8817e4Smiod assumed. */ 60*3d8817e4Smiod mmix_operands_regs_z_opt, 61*3d8817e4Smiod 62*3d8817e4Smiod /* The regular "$X,$Y,$Z|Z". */ 63*3d8817e4Smiod mmix_operands_regs_z, 64*3d8817e4Smiod 65*3d8817e4Smiod /* "Address"; only JMP. Zero operands allowed unless GNU syntax. */ 66*3d8817e4Smiod mmix_operands_jmp, 67*3d8817e4Smiod 68*3d8817e4Smiod /* "$X|X,$Y,$Z|Z": PUSHGO; like "3", but X can be expressed as an 69*3d8817e4Smiod integer. */ 70*3d8817e4Smiod mmix_operands_pushgo, 71*3d8817e4Smiod 72*3d8817e4Smiod /* Two registers or a register and a byte, like FLOT, possibly with 73*3d8817e4Smiod rounding: "$X,$Z|Z" or "$X,ROUND_MODE,$Z|Z". */ 74*3d8817e4Smiod mmix_operands_roundregs_z, 75*3d8817e4Smiod 76*3d8817e4Smiod /* "X,YZ", POP. Unless GNU syntax, zero or one operand is allowed. */ 77*3d8817e4Smiod mmix_operands_pop, 78*3d8817e4Smiod 79*3d8817e4Smiod /* Two registers, possibly with rounding: "$X,$Z" or 80*3d8817e4Smiod "$X,ROUND_MODE,$Z". */ 81*3d8817e4Smiod mmix_operands_roundregs, 82*3d8817e4Smiod 83*3d8817e4Smiod /* "XYZ", like SYNC. */ 84*3d8817e4Smiod mmix_operands_sync, 85*3d8817e4Smiod 86*3d8817e4Smiod /* "X,$Y,$Z|Z", like SYNCD. */ 87*3d8817e4Smiod mmix_operands_x_regs_z, 88*3d8817e4Smiod 89*3d8817e4Smiod /* "$X,Y,$Z|Z", like NEG and NEGU. The Y field is optional, default 0. */ 90*3d8817e4Smiod mmix_operands_neg, 91*3d8817e4Smiod 92*3d8817e4Smiod /* "$X,Address, like GETA or branches. */ 93*3d8817e4Smiod mmix_operands_regaddr, 94*3d8817e4Smiod 95*3d8817e4Smiod /* "$X|X,Address, like PUSHJ. */ 96*3d8817e4Smiod mmix_operands_pushj, 97*3d8817e4Smiod 98*3d8817e4Smiod /* "$X,spec_reg"; GET. */ 99*3d8817e4Smiod mmix_operands_get, 100*3d8817e4Smiod 101*3d8817e4Smiod /* "spec_reg,$Z|Z"; PUT. */ 102*3d8817e4Smiod mmix_operands_put, 103*3d8817e4Smiod 104*3d8817e4Smiod /* Two registers, "$X,$Y". */ 105*3d8817e4Smiod mmix_operands_set, 106*3d8817e4Smiod 107*3d8817e4Smiod /* "$X,0"; SAVE. */ 108*3d8817e4Smiod mmix_operands_save, 109*3d8817e4Smiod 110*3d8817e4Smiod /* "0,$Z"; UNSAVE. */ 111*3d8817e4Smiod mmix_operands_unsave, 112*3d8817e4Smiod 113*3d8817e4Smiod /* "X,Y,Z"; like SWYM or TRAP. Zero (or 1 if GNU syntax) to three 114*3d8817e4Smiod operands, interpreted as 0; XYZ; X, YZ and X, Y, Z. */ 115*3d8817e4Smiod mmix_operands_xyz_opt, 116*3d8817e4Smiod 117*3d8817e4Smiod /* Just "Z", like RESUME. Unless GNU syntax, the operand can be omitted 118*3d8817e4Smiod and will then be assumed zero. */ 119*3d8817e4Smiod mmix_operands_resume, 120*3d8817e4Smiod 121*3d8817e4Smiod /* These are specials to handle that pseudo-directives are specified 122*3d8817e4Smiod like ordinary insns when being mmixal-compatible. They signify the 123*3d8817e4Smiod specific pseudo-directive rather than the operands type. */ 124*3d8817e4Smiod 125*3d8817e4Smiod /* LOC. */ 126*3d8817e4Smiod mmix_operands_loc, 127*3d8817e4Smiod 128*3d8817e4Smiod /* PREFIX. */ 129*3d8817e4Smiod mmix_operands_prefix, 130*3d8817e4Smiod 131*3d8817e4Smiod /* BYTE. */ 132*3d8817e4Smiod mmix_operands_byte, 133*3d8817e4Smiod 134*3d8817e4Smiod /* WYDE. */ 135*3d8817e4Smiod mmix_operands_wyde, 136*3d8817e4Smiod 137*3d8817e4Smiod /* TETRA. */ 138*3d8817e4Smiod mmix_operands_tetra, 139*3d8817e4Smiod 140*3d8817e4Smiod /* OCTA. */ 141*3d8817e4Smiod mmix_operands_octa, 142*3d8817e4Smiod 143*3d8817e4Smiod /* LOCAL. */ 144*3d8817e4Smiod mmix_operands_local, 145*3d8817e4Smiod 146*3d8817e4Smiod /* BSPEC. */ 147*3d8817e4Smiod mmix_operands_bspec, 148*3d8817e4Smiod 149*3d8817e4Smiod /* ESPEC. */ 150*3d8817e4Smiod mmix_operands_espec, 151*3d8817e4Smiod }; 152*3d8817e4Smiod 153*3d8817e4Smiod struct mmix_opcode 154*3d8817e4Smiod { 155*3d8817e4Smiod const char *name; 156*3d8817e4Smiod unsigned long match; 157*3d8817e4Smiod unsigned long lose; 158*3d8817e4Smiod enum mmix_operands_type operands; 159*3d8817e4Smiod 160*3d8817e4Smiod /* This is used by the disassembly function. */ 161*3d8817e4Smiod enum mmix_insn_type type; 162*3d8817e4Smiod }; 163*3d8817e4Smiod 164*3d8817e4Smiod /* Declare the actual tables. */ 165*3d8817e4Smiod extern const struct mmix_opcode mmix_opcodes[]; 166*3d8817e4Smiod 167*3d8817e4Smiod /* This one is terminated with an entry with a NULL name. */ 168*3d8817e4Smiod extern const struct mmix_spec_reg mmix_spec_regs[]; 169*3d8817e4Smiod 170*3d8817e4Smiod /* Some insn values we use when padding and synthesizing address loads. */ 171*3d8817e4Smiod #define IMM_OFFSET_BIT 1 172*3d8817e4Smiod #define COND_INV_BIT 0x8 173*3d8817e4Smiod #define PRED_INV_BIT 0x10 174*3d8817e4Smiod 175*3d8817e4Smiod #define PUSHGO_INSN_BYTE 0xbe 176*3d8817e4Smiod #define GO_INSN_BYTE 0x9e 177*3d8817e4Smiod #define SETL_INSN_BYTE 0xe3 178*3d8817e4Smiod #define INCML_INSN_BYTE 0xe6 179*3d8817e4Smiod #define INCMH_INSN_BYTE 0xe5 180*3d8817e4Smiod #define INCH_INSN_BYTE 0xe4 181*3d8817e4Smiod #define SWYM_INSN_BYTE 0xfd 182*3d8817e4Smiod #define JMP_INSN_BYTE 0xf0 183*3d8817e4Smiod 184*3d8817e4Smiod /* We can have 256 - 32 (local registers) - 1 ($255 is not allocatable) 185*3d8817e4Smiod global registers. */ 186*3d8817e4Smiod #define MAX_GREGS 223 187