xref: /netbsd-src/external/gpl3/gdb/dist/include/opcode/mn10300.h (revision aab831cebf6361fb2b518a47c70732e608d9abd2)
198b9484cSchristos /* mn10300.h -- Header file for Matsushita 10300 opcode table
2*aab831ceSchristos    Copyright (C) 1996-2024 Free Software Foundation, Inc.
398b9484cSchristos    Written by Jeff Law, Cygnus Support
498b9484cSchristos 
598b9484cSchristos    This file is part of GDB, GAS, and the GNU binutils.
698b9484cSchristos 
798b9484cSchristos    GDB, GAS, and the GNU binutils are free software; you can redistribute
898b9484cSchristos    them and/or modify them under the terms of the GNU General Public
998b9484cSchristos    License as published by the Free Software Foundation; either version 3,
1098b9484cSchristos    or (at your option) any later version.
1198b9484cSchristos 
1298b9484cSchristos    GDB, GAS, and the GNU binutils are distributed in the hope that they
1398b9484cSchristos    will be useful, but WITHOUT ANY WARRANTY; without even the implied
1498b9484cSchristos    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
1598b9484cSchristos    the GNU General Public License for more details.
1698b9484cSchristos 
1798b9484cSchristos    You should have received a copy of the GNU General Public License
1898b9484cSchristos    along with this file; see the file COPYING3.  If not, write to the Free
1998b9484cSchristos    Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
2098b9484cSchristos    MA 02110-1301, USA.  */
2198b9484cSchristos 
2298b9484cSchristos #ifndef MN10300_H
2398b9484cSchristos #define MN10300_H
2498b9484cSchristos 
2598b9484cSchristos /* The opcode table is an array of struct mn10300_opcode.  */
2698b9484cSchristos 
2798b9484cSchristos #define MN10300_MAX_OPERANDS 8
2898b9484cSchristos struct mn10300_opcode
2998b9484cSchristos {
3098b9484cSchristos   /* The opcode name.  */
3198b9484cSchristos   const char *name;
3298b9484cSchristos 
3398b9484cSchristos   /* The opcode itself.  Those bits which will be filled in with
3498b9484cSchristos      operands are zeroes.  */
3598b9484cSchristos   unsigned long opcode;
3698b9484cSchristos 
3798b9484cSchristos   /* The opcode mask.  This is used by the disassembler.  This is a
3898b9484cSchristos      mask containing ones indicating those bits which must match the
3998b9484cSchristos      opcode field, and zeroes indicating those bits which need not
4098b9484cSchristos      match (and are presumably filled in by operands).  */
4198b9484cSchristos   unsigned long mask;
4298b9484cSchristos 
4398b9484cSchristos   /* A bitmask.  For each operand, nonzero if it must not have the same
4498b9484cSchristos      register specification as all other operands with a nonzero bit in
4598b9484cSchristos      this flag.  ie 0x81 would indicate that operands 7 and 0 must not
4698b9484cSchristos      match.  Note that we count operands from left to right as they appear
4798b9484cSchristos      in the operands specification below.  */
4898b9484cSchristos   unsigned int no_match_operands;
4998b9484cSchristos 
5098b9484cSchristos   /* The format of this opcode.  */
5198b9484cSchristos   unsigned char format;
5298b9484cSchristos 
5398b9484cSchristos   /* Bitmask indicating what cpu variants this opcode is available on.
5498b9484cSchristos      We assume mn10300 base opcodes are available everywhere, so we only
5598b9484cSchristos      have to note opcodes which are available on other variants.  */
5698b9484cSchristos   unsigned int machine;
5798b9484cSchristos 
5898b9484cSchristos   /* An array of operand codes.  Each code is an index into the
5998b9484cSchristos      operand table.  They appear in the order which the operands must
6098b9484cSchristos      appear in assembly code, and are terminated by a zero.  */
6198b9484cSchristos   unsigned char operands[MN10300_MAX_OPERANDS];
6298b9484cSchristos };
6398b9484cSchristos 
6498b9484cSchristos /* The table itself is sorted by major opcode number, and is otherwise
6598b9484cSchristos    in the order in which the disassembler should consider
6698b9484cSchristos    instructions.  */
6798b9484cSchristos extern const struct mn10300_opcode mn10300_opcodes[];
6898b9484cSchristos extern const int mn10300_num_opcodes;
6998b9484cSchristos 
7098b9484cSchristos 
7198b9484cSchristos /* The operands table is an array of struct mn10300_operand.  */
7298b9484cSchristos 
7398b9484cSchristos struct mn10300_operand
7498b9484cSchristos {
7598b9484cSchristos   /* The number of bits in the operand.  */
7698b9484cSchristos   int bits;
7798b9484cSchristos 
7898b9484cSchristos   /* How far the operand is left shifted in the instruction.  */
7998b9484cSchristos   int shift;
8098b9484cSchristos 
8198b9484cSchristos   /* One bit syntax flags.  */
8298b9484cSchristos   int flags;
8398b9484cSchristos };
8498b9484cSchristos 
8598b9484cSchristos /* Elements in the table are retrieved by indexing with values from
8698b9484cSchristos    the operands field of the mn10300_opcodes table.  */
8798b9484cSchristos 
8898b9484cSchristos extern const struct mn10300_operand mn10300_operands[];
8998b9484cSchristos 
9098b9484cSchristos /* Values defined for the flags field of a struct mn10300_operand.  */
9198b9484cSchristos #define MN10300_OPERAND_DREG 0x1
9298b9484cSchristos 
9398b9484cSchristos #define MN10300_OPERAND_AREG 0x2
9498b9484cSchristos 
9598b9484cSchristos #define MN10300_OPERAND_SP 0x4
9698b9484cSchristos 
9798b9484cSchristos #define MN10300_OPERAND_PSW 0x8
9898b9484cSchristos 
9998b9484cSchristos #define MN10300_OPERAND_MDR 0x10
10098b9484cSchristos 
10198b9484cSchristos #define MN10300_OPERAND_SIGNED 0x20
10298b9484cSchristos 
10398b9484cSchristos #define MN10300_OPERAND_PROMOTE 0x40
10498b9484cSchristos 
10598b9484cSchristos #define MN10300_OPERAND_PAREN 0x80
10698b9484cSchristos 
10798b9484cSchristos #define MN10300_OPERAND_REPEATED 0x100
10898b9484cSchristos 
10998b9484cSchristos #define MN10300_OPERAND_EXTENDED 0x200
11098b9484cSchristos 
11198b9484cSchristos #define MN10300_OPERAND_SPLIT 0x400
11298b9484cSchristos 
11398b9484cSchristos #define MN10300_OPERAND_REG_LIST 0x800
11498b9484cSchristos 
11598b9484cSchristos #define MN10300_OPERAND_PCREL 0x1000
11698b9484cSchristos 
11798b9484cSchristos #define MN10300_OPERAND_MEMADDR 0x2000
11898b9484cSchristos 
11998b9484cSchristos #define MN10300_OPERAND_RELAX 0x4000
12098b9484cSchristos 
12198b9484cSchristos #define MN10300_OPERAND_USP 0x8000
12298b9484cSchristos 
12398b9484cSchristos #define MN10300_OPERAND_SSP 0x10000
12498b9484cSchristos 
12598b9484cSchristos #define MN10300_OPERAND_MSP 0x20000
12698b9484cSchristos 
12798b9484cSchristos #define MN10300_OPERAND_PC 0x40000
12898b9484cSchristos 
12998b9484cSchristos #define MN10300_OPERAND_EPSW 0x80000
13098b9484cSchristos 
13198b9484cSchristos #define MN10300_OPERAND_RREG 0x100000
13298b9484cSchristos 
13398b9484cSchristos #define MN10300_OPERAND_XRREG 0x200000
13498b9484cSchristos 
13598b9484cSchristos #define MN10300_OPERAND_PLUS 0x400000
13698b9484cSchristos 
13798b9484cSchristos #define MN10300_OPERAND_24BIT 0x800000
13898b9484cSchristos 
13998b9484cSchristos #define MN10300_OPERAND_FSREG 0x1000000
14098b9484cSchristos 
14198b9484cSchristos #define MN10300_OPERAND_FDREG 0x2000000
14298b9484cSchristos 
14398b9484cSchristos #define MN10300_OPERAND_FPCR 0x4000000
14498b9484cSchristos 
14598b9484cSchristos /* Opcode Formats.  */
14698b9484cSchristos #define FMT_S0 1
14798b9484cSchristos #define FMT_S1 2
14898b9484cSchristos #define FMT_S2 3
14998b9484cSchristos #define FMT_S4 4
15098b9484cSchristos #define FMT_S6 5
15198b9484cSchristos #define FMT_D0 6
15298b9484cSchristos #define FMT_D1 7
15398b9484cSchristos #define FMT_D2 8
15498b9484cSchristos #define FMT_D4 9
15598b9484cSchristos #define FMT_D5 10
15698b9484cSchristos #define FMT_D6 11
15798b9484cSchristos #define FMT_D7 12
15898b9484cSchristos #define FMT_D8 13
15998b9484cSchristos #define FMT_D9 14
16098b9484cSchristos #define FMT_D10 15
16198b9484cSchristos #define FMT_D3 16
16298b9484cSchristos 
16398b9484cSchristos /* Variants of the mn10300 which have additional opcodes.  */
16498b9484cSchristos #define MN103 300
16598b9484cSchristos #define AM30  300
16698b9484cSchristos 
16798b9484cSchristos #define AM33 330
16898b9484cSchristos #define AM33_2 332
16998b9484cSchristos 
17098b9484cSchristos #endif /* MN10300_H */
171