Back to index

cell-binutils  2.17cvs20070401
sh64-opc.h
Go to the documentation of this file.
00001 /* Declarations for SH64 opcodes.
00002    Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation; either version 2 of the License, or
00007 (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00017 
00018 #ifndef _SH64_OPC_INCLUDED_H
00019 #define _SH64_OPC_INCLUDED_H
00020 
00021 typedef enum
00022 {
00023   /* A placeholder.  */
00024   OFFSET_NONE = 0,
00025 
00026   /* Bit number for where to insert operand.  */
00027   OFFSET_4  = 4,
00028   OFFSET_9  = 9,
00029   OFFSET_10 = 10,
00030   OFFSET_20 = 20
00031 } shmedia_nibble_type;
00032 
00033 typedef enum {
00034   /* First a placeholder.  */
00035   A_NONE = 0,
00036 
00037   /* Registers.  */
00038   A_GREG_M,
00039   A_GREG_N,
00040   A_GREG_D,
00041   A_FREG_G,
00042   A_FREG_H,
00043   A_FREG_F,
00044   A_DREG_G,
00045   A_DREG_H,
00046   A_DREG_F,
00047   A_FVREG_G,
00048   A_FVREG_H,
00049   A_FVREG_F,
00050   A_FMREG_G,
00051   A_FMREG_H,
00052   A_FMREG_F,
00053   A_FPREG_G,
00054   A_FPREG_H,
00055   A_FPREG_F,
00056   A_TREG_A,
00057   A_TREG_B,
00058   A_CREG_K,
00059   A_CREG_J,
00060 
00061   /* This one is only used in a shmedia_get_operand.  */
00062   A_IMMM,
00063 
00064   /* Copy of previous register.  */
00065   A_REUSE_PREV,
00066 
00067   /* Unsigned 5-bit operand.  */
00068   A_IMMU5,
00069 
00070   /* Signed 6-bit operand.  */
00071   A_IMMS6,
00072 
00073   /* Signed operand, 6 bits << 5.  */
00074   A_IMMS6BY32,
00075 
00076   /* Unsigned 6-bit operand.  */
00077   A_IMMU6,
00078 
00079   /* Signed 10-bit operand.  */
00080   A_IMMS10,
00081 
00082   /* Signed operand, 10 bits << 0.  */
00083   A_IMMS10BY1,
00084 
00085   /* Signed operand, 10 bits << 1.  */
00086   A_IMMS10BY2,
00087 
00088   /* Signed operand, 10 bits << 2.  */
00089   A_IMMS10BY4,
00090 
00091   /* Signed operand, 10 bits << 3.  */
00092   A_IMMS10BY8,
00093 
00094   /* Signed 16-bit operand.  */
00095   A_IMMS16,
00096 
00097   /* Unsigned 16-bit operand.  */
00098   A_IMMU16,
00099 
00100   /* PC-relative signed operand, 16 bits << 2, for PTA and PTB insns.  */
00101   A_PCIMMS16BY4,
00102 
00103   /* PC relative signed operand, 16 bits << 2, for PT insns.  Also adjusts
00104      the opcode to be PTA or PTB.  */
00105   A_PCIMMS16BY4_PT,
00106 } shmedia_arg_type;
00107 
00108 typedef struct {
00109   char *name;
00110   shmedia_arg_type arg[4];
00111   shmedia_nibble_type nibbles[4];
00112   unsigned long opcode_base;
00113 } shmedia_opcode_info;
00114 
00115 extern const shmedia_opcode_info shmedia_table[];
00116 
00117 typedef struct {
00118   int cregno;
00119   char *name;
00120 } shmedia_creg_info;
00121 
00122 extern const shmedia_creg_info shmedia_creg_table[];
00123 
00124 #define SHMEDIA_LIKELY_BIT    0x00000200
00125 #define SHMEDIA_PT_OPC            0xe8000000
00126 #define SHMEDIA_PTB_BIT           0x04000000
00127 #define SHMEDIA_PTA_OPC       0xe8000000
00128 #define SHMEDIA_PTB_OPC       0xec000000
00129 
00130 /* Note that this is ptrel/u.  "Or" in SHMEDIA_LIKELY_BIT for ptrel/l.  */
00131 #define SHMEDIA_PTREL_OPC     0x6bf50000
00132 #define SHMEDIA_MOVI_OPC      0xcc000000
00133 #define SHMEDIA_SHORI_OPC     0xc8000000
00134 #define SHMEDIA_ADDI_OPC      0xd0000000
00135 #define SHMEDIA_ADD_OPC       0x00090000
00136 #define SHMEDIA_NOP_OPC           0x6ff0fff0
00137 #define SHMEDIA_TEMP_REG      25
00138 
00139 #endif /* _SH64_OPC_INCLUDED_H */