| 1 | /* Declarations for SH64 opcodes. | 
|---|
| 2 | Copyright (C) 2000, 2001 Free Software Foundation, Inc. | 
|---|
| 3 |  | 
|---|
| 4 | This program is free software; you can redistribute it and/or modify | 
|---|
| 5 | it under the terms of the GNU General Public License as published by | 
|---|
| 6 | the Free Software Foundation; either version 2 of the License, or | 
|---|
| 7 | (at your option) any later version. | 
|---|
| 8 |  | 
|---|
| 9 | This program is distributed in the hope that it will be useful, | 
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 12 | GNU General Public License for more details. | 
|---|
| 13 |  | 
|---|
| 14 | You should have received a copy of the GNU General Public License | 
|---|
| 15 | along with this program; if not, write to the Free Software | 
|---|
| 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */ | 
|---|
| 17 |  | 
|---|
| 18 | #ifndef _SH64_OPC_INCLUDED_H | 
|---|
| 19 | #define _SH64_OPC_INCLUDED_H | 
|---|
| 20 |  | 
|---|
| 21 | typedef enum | 
|---|
| 22 | { | 
|---|
| 23 | /* A placeholder.  */ | 
|---|
| 24 | OFFSET_NONE = 0, | 
|---|
| 25 |  | 
|---|
| 26 | /* Bit number for where to insert operand.  */ | 
|---|
| 27 | OFFSET_4  = 4, | 
|---|
| 28 | OFFSET_9  = 9, | 
|---|
| 29 | OFFSET_10 = 10, | 
|---|
| 30 | OFFSET_20 = 20 | 
|---|
| 31 | } shmedia_nibble_type; | 
|---|
| 32 |  | 
|---|
| 33 | typedef enum { | 
|---|
| 34 | /* First a placeholder.  */ | 
|---|
| 35 | A_NONE = 0, | 
|---|
| 36 |  | 
|---|
| 37 | /* Registers.  */ | 
|---|
| 38 | A_GREG_M, | 
|---|
| 39 | A_GREG_N, | 
|---|
| 40 | A_GREG_D, | 
|---|
| 41 | A_FREG_G, | 
|---|
| 42 | A_FREG_H, | 
|---|
| 43 | A_FREG_F, | 
|---|
| 44 | A_DREG_G, | 
|---|
| 45 | A_DREG_H, | 
|---|
| 46 | A_DREG_F, | 
|---|
| 47 | A_FVREG_G, | 
|---|
| 48 | A_FVREG_H, | 
|---|
| 49 | A_FVREG_F, | 
|---|
| 50 | A_FMREG_G, | 
|---|
| 51 | A_FMREG_H, | 
|---|
| 52 | A_FMREG_F, | 
|---|
| 53 | A_FPREG_G, | 
|---|
| 54 | A_FPREG_H, | 
|---|
| 55 | A_FPREG_F, | 
|---|
| 56 | A_TREG_A, | 
|---|
| 57 | A_TREG_B, | 
|---|
| 58 | A_CREG_K, | 
|---|
| 59 | A_CREG_J, | 
|---|
| 60 |  | 
|---|
| 61 | /* This one is only used in a shmedia_get_operand.  */ | 
|---|
| 62 | A_IMMM, | 
|---|
| 63 |  | 
|---|
| 64 | /* Copy of previous register.  */ | 
|---|
| 65 | A_REUSE_PREV, | 
|---|
| 66 |  | 
|---|
| 67 | /* Unsigned 5-bit operand.  */ | 
|---|
| 68 | A_IMMU5, | 
|---|
| 69 |  | 
|---|
| 70 | /* Signed 6-bit operand.  */ | 
|---|
| 71 | A_IMMS6, | 
|---|
| 72 |  | 
|---|
| 73 | /* Signed operand, 6 bits << 5.  */ | 
|---|
| 74 | A_IMMS6BY32, | 
|---|
| 75 |  | 
|---|
| 76 | /* Unsigned 6-bit operand.  */ | 
|---|
| 77 | A_IMMU6, | 
|---|
| 78 |  | 
|---|
| 79 | /* Signed 10-bit operand.  */ | 
|---|
| 80 | A_IMMS10, | 
|---|
| 81 |  | 
|---|
| 82 | /* Signed operand, 10 bits << 0.  */ | 
|---|
| 83 | A_IMMS10BY1, | 
|---|
| 84 |  | 
|---|
| 85 | /* Signed operand, 10 bits << 1.  */ | 
|---|
| 86 | A_IMMS10BY2, | 
|---|
| 87 |  | 
|---|
| 88 | /* Signed operand, 10 bits << 2.  */ | 
|---|
| 89 | A_IMMS10BY4, | 
|---|
| 90 |  | 
|---|
| 91 | /* Signed operand, 10 bits << 3.  */ | 
|---|
| 92 | A_IMMS10BY8, | 
|---|
| 93 |  | 
|---|
| 94 | /* Signed 16-bit operand.  */ | 
|---|
| 95 | A_IMMS16, | 
|---|
| 96 |  | 
|---|
| 97 | /* Unsigned 16-bit operand.  */ | 
|---|
| 98 | A_IMMU16, | 
|---|
| 99 |  | 
|---|
| 100 | /* PC-relative signed operand, 16 bits << 2, for PTA and PTB insns.  */ | 
|---|
| 101 | A_PCIMMS16BY4, | 
|---|
| 102 |  | 
|---|
| 103 | /* PC relative signed operand, 16 bits << 2, for PT insns.  Also adjusts | 
|---|
| 104 | the opcode to be PTA or PTB.  */ | 
|---|
| 105 | A_PCIMMS16BY4_PT, | 
|---|
| 106 | } shmedia_arg_type; | 
|---|
| 107 |  | 
|---|
| 108 | typedef struct { | 
|---|
| 109 | char *name; | 
|---|
| 110 | shmedia_arg_type arg[4]; | 
|---|
| 111 | shmedia_nibble_type nibbles[4]; | 
|---|
| 112 | unsigned long opcode_base; | 
|---|
| 113 | } shmedia_opcode_info; | 
|---|
| 114 |  | 
|---|
| 115 | extern const shmedia_opcode_info shmedia_table[]; | 
|---|
| 116 |  | 
|---|
| 117 | typedef struct { | 
|---|
| 118 | int cregno; | 
|---|
| 119 | char *name; | 
|---|
| 120 | } shmedia_creg_info; | 
|---|
| 121 |  | 
|---|
| 122 | extern const shmedia_creg_info shmedia_creg_table[]; | 
|---|
| 123 |  | 
|---|
| 124 | #define SHMEDIA_LIKELY_BIT    0x00000200 | 
|---|
| 125 | #define SHMEDIA_PT_OPC        0xe8000000 | 
|---|
| 126 | #define SHMEDIA_PTB_BIT       0x04000000 | 
|---|
| 127 | #define SHMEDIA_PTA_OPC       0xe8000000 | 
|---|
| 128 | #define SHMEDIA_PTB_OPC       0xec000000 | 
|---|
| 129 |  | 
|---|
| 130 | /* Note that this is ptrel/u.  "Or" in SHMEDIA_LIKELY_BIT for ptrel/l.  */ | 
|---|
| 131 | #define SHMEDIA_PTREL_OPC     0x6bf50000 | 
|---|
| 132 | #define SHMEDIA_MOVI_OPC      0xcc000000 | 
|---|
| 133 | #define SHMEDIA_SHORI_OPC     0xc8000000 | 
|---|
| 134 | #define SHMEDIA_ADDI_OPC      0xd0000000 | 
|---|
| 135 | #define SHMEDIA_ADD_OPC       0x00090000 | 
|---|
| 136 | #define SHMEDIA_NOP_OPC       0x6ff0fff0 | 
|---|
| 137 | #define SHMEDIA_TEMP_REG      25 | 
|---|
| 138 |  | 
|---|
| 139 | #endif /* _SH64_OPC_INCLUDED_H */ | 
|---|