xref: /netbsd-src/external/gpl3/binutils.old/dist/include/opcode/pj.h (revision e992f068c547fd6e84b3f104dc2340adcc955732)
175fd0b74Schristos /* Definitions for decoding the picoJava opcode table.
2*e992f068Schristos    Copyright (C) 1999-2022 Free Software Foundation, Inc.
375fd0b74Schristos    Contributed by Steve Chamberlain of Transmeta (sac@pobox.com).
475fd0b74Schristos 
575fd0b74Schristos    This program is free software; you can redistribute it and/or modify
675fd0b74Schristos    it under the terms of the GNU General Public License as published by
775fd0b74Schristos    the Free Software Foundation; either version 3 of the License, or
875fd0b74Schristos    (at your option) any later version.
975fd0b74Schristos 
1075fd0b74Schristos    This program is distributed in the hope that it will be useful,
1175fd0b74Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
1275fd0b74Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1375fd0b74Schristos    GNU General Public License for more details.
1475fd0b74Schristos 
1575fd0b74Schristos    You should have received a copy of the GNU General Public License
1675fd0b74Schristos    along with this program; if not, write to the Free Software
1775fd0b74Schristos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
1875fd0b74Schristos    MA 02110-1301, USA.  */
1975fd0b74Schristos 
2075fd0b74Schristos /* Names used to describe the type of instruction arguments, used by
2175fd0b74Schristos    the assembler and disassembler.  Attributes are encoded in various fields. */
2275fd0b74Schristos 
2375fd0b74Schristos /*            reloc  size pcrel    uns */
2475fd0b74Schristos #define O_N    0
2575fd0b74Schristos #define O_16  (1<<4 | 2 | (0<<6) | (0<<3))
2675fd0b74Schristos #define O_U16 (1<<4 | 2 | (0<<6) | (1<<3))
2775fd0b74Schristos #define O_R16 (2<<4 | 2 | (1<<6) | (0<<3))
2875fd0b74Schristos #define O_8   (3<<4 | 1 | (0<<6) | (0<<3))
2975fd0b74Schristos #define O_U8  (3<<4 | 1 | (0<<6) | (1<<3))
3075fd0b74Schristos #define O_R8  (4<<4 | 1 | (0<<6) | (0<<3))
3175fd0b74Schristos #define O_R32 (5<<4 | 4 | (1<<6) | (0<<3))
3275fd0b74Schristos #define O_32  (6<<4 | 4 | (0<<6) | (0<<3))
3375fd0b74Schristos 
3475fd0b74Schristos #define ASIZE(x)  ((x) & 0x7)
3575fd0b74Schristos #define PCREL(x)  (!!((x) & (1<<6)))
3675fd0b74Schristos #define UNS(x)    (!!((x) & (1<<3)))
3775fd0b74Schristos 
3875fd0b74Schristos 
3975fd0b74Schristos typedef struct pj_opc_info_t
4075fd0b74Schristos {
4175fd0b74Schristos   short opcode;
4275fd0b74Schristos   short opcode_next;
4375fd0b74Schristos   char len;
4475fd0b74Schristos   unsigned char arg[2];
4575fd0b74Schristos   union {
4675fd0b74Schristos     const char *name;
4775fd0b74Schristos     void (*func) (struct pj_opc_info_t *, char *);
4875fd0b74Schristos   } u;
4975fd0b74Schristos } pj_opc_info_t;
50