|
|
1.1 root 1: /* @(#)inst.h 1.1 86/02/03 SMI */
2:
3: /*
4: * Copyright (c) 1985 by Sun Microsystems, Inc.
5: */
6:
7:
8: /*
9: * When this table is changed, we must also change:
10: * the table in pseudoop.c that is indexed by it.
11: */
12: typedef enum{
13: OP_FIRST = 0, OP_COMMENT, OP_LABEL,
14: OP_LONG, OP_WORD, OP_BYTE, OP_TEXT,
15: OP_DATA, OP_DATA1, OP_DATA2, OP_BSS,
16: OP_GLOBL, OP_COMM, OP_EVEN, OP_ALIGN,
17: OP_ASCIZ, OP_ASCII, OP_FLOAT, OP_DOUBLE,
18: OP_STABS, OP_STABD, OP_STABN, OP_SKIP, OP_LCOMM, OP_CPID,
19: OP_CSWITCH, OP_FSWITCH, OP_BRANCH, OP_MOVE, OP_MOVEM,
20: OP_EXIT, OP_DBRA, OP_CALL, OP_JUMP, OP_DJMP,
21: OP_LINK, OP_CMP, OP_PEA, OP_ADD, OP_AND,
22: OP_EXT, OP_OR, OP_TST, OP_ASL, OP_ASR,
23: OP_SUB, OP_UNLK, OP_LEA, OP_CLR , OP_BOP,
24: OP_EOR,
25: OP_FTST,
26: OP_OTHER
27: } opcode_t;
28:
29: typedef enum{
30: SUBOP_B = 0, SUBOP_W = 1, SUBOP_L = 2,
31: SUBOP_S = 3, SUBOP_D = 4, SUBOP_X = 5,
32: SUBOP_P = 6, SUBOP_C = 7,
33: JEQ = 8, JNE, JLE, JGE, JLT, JGT, JLS, JHI, JMI, JPL,
34: JALL, JCS, JCC, JVS, JVC, JNONE,
35: JFEQ, JFNEQ, JFLT, JFNLT, JFLE, JFNLE, JFGT, JFNGT,
36: JFGE, JFNGE,
37: FJEQ, FJNEQ, FJGT, FJNGT, FJGE, FJNGE, FJLT, FJNLT, FJLE, FJNLE,
38: FJGL, FJNGL, FJGLE, FJNGLE, FJOGT, FJULE, FJOGE, FJULT, FJOLT, FJUGE,
39: FJOLE, FJUGT, FJOGL, FJUEQ, FJOR, FJUN, FJSF, FJST, FJSEQ, FJSNEQ,
40: JIND,
41: SUBOP_Z /* Last type for typeless instructions. */
42: } subop_t;
43:
44: /* Instruction Hash Table entry */
45:
46: # define N_OPTYPES 8 /* Maximum number of operand type descriptors. */
47:
48: struct ins_bkt {
49: char *text_i;
50: opcode_t op_i:8;
51: subop_t subop_i:8;
52: unsigned short touchop_i;
53: short noper_i:8;
54: short cc_i:8;
55: short nassoc_i:8;
56: #if AS
57: short align_i:8;
58: int (*routine_i)();
59: unsigned short opval_i[5]; /* info, usually opcodes */
60: short xflags_i;
61: #endif
62: unsigned
63: optype_i[N_OPTYPES]; /* up to 4 pairs of 2 operands */
64: };
65:
66: /* instructuion flag values */
67: # define I20 1 /* instruction only on 68020 */
68: # define I81 2 /* instruction only on 68881 */
69:
70: struct ins_ptr { /* arranged so op-code table can be read-only */
71: char *name_p;
72: struct ins_ptr *next_p;
73: struct ins_bkt *this_p;
74: };
75: extern struct ins_ptr *inst;
76: extern char opcodetypes[];
77: #define INSTRTYPE 1
78: #define PSEUDONOCODE 2
79: #define PSEUDOCODE 4
80: #define BRANCHTYPE 8
81: #define JUMPTYPE 020
82: #define ISINSTRUC( op ) (opcodetypes[(int)(op)]&INSTRTYPE)
83: #define ISPSEUDO( op ) (opcodetypes[(int)(op)]&(PSEUDOCODE|PSEUDONOCODE))
84: #define ISDIRECTIVE( op ) (opcodetypes[(int)(op)]&PSEUDONOCODE)
85: #define ISBRANCH( op ) (opcodetypes[(int)(op)]&BRANCHTYPE)
86: #define ISJUMP( op ) (opcodetypes[(int)(op)]&JUMPTYPE)
87:
88: /* operand access bits */
89: # define RMASK 3
90: # define WMASK 014
91: # define RWWIDTH 2
92: # define BR 1
93: # define WR 2
94: # define LR 3
95: # define BW 4
96: # define WW 8
97: # define LW 12
98: # define TOUCHWIDTH 5
99: # define TOUCHMASK 037
100: # define SPEC(n) (16+n)
101: # define TOUCH1(x) (x&TOUCHMASK)
102: # define TOUCH2(x) ((x&TOUCHMASK)<<TOUCHWIDTH)
103: # define TOUCH3(x) (((x&TOUCHMASK)<<TOUCHWIDTH)<<TOUCHWIDTH)
104: /* operand access bits for floating point */
105: # define SR LR
106: # define XR LR
107: # define PR LR
108: # define DR LR
109: # define CR LR
110: # define FR LR
111: # define SW LW
112: # define XW LW
113: # define PW LW
114: # define DW LW
115: # define CW LW
116: # define FW LW
117:
118: #if AS
119: /* size code fields for floating point */
120:
121: # define L_SIZE 0*02000
122: # define S_SIZE 1*02000
123: # define X_SIZE 2*02000
124: # define P_SIZE 3*02000
125: # define W_SIZE 4*02000
126: # define D_SIZE 5*02000
127: # define B_SIZE 6*02000
128: # define C_SIZE 7*02000
129:
130: /* floating point condition code fields */
131:
132: # define FCC_F 00
133: # define FCC_EQ 01
134: # define FCC_OGT 02
135: # define FCC_OGE 03
136: # define FCC_OLT 04
137: # define FCC_OLE 05
138: # define FCC_OGL 06
139: # define FCC_OR 07
140: # define FCC_UN 010
141: # define FCC_UEQ 011
142: # define FCC_UGT 012
143: # define FCC_UGE 013
144: # define FCC_ULT 014
145: # define FCC_ULE 015
146: # define FCC_NEQ 016
147: # define FCC_T 017
148: # define FCC_SF 020
149: # define FCC_SEQ 021
150: # define FCC_GT 022
151: # define FCC_GE 023
152: # define FCC_LT 024
153: # define FCC_LE 025
154: # define FCC_GL 026
155: # define FCC_GLE 027
156: # define FCC_NGLE 030
157: # define FCC_NGL 031
158: # define FCC_NLE 032
159: # define FCC_NLT 033
160: # define FCC_NGE 034
161: # define FCC_NGT 035
162: # define FCC_SNEQ 036
163: # define FCC_ST 037
164: #endif AS
165:
166: /* operand addressing mode bits */
167: # define AM_DREG 01
168: # define AM_AREG 02
169: # define AM_DEFER 04
170: # define AM_POSTINC 010
171: # define AM_PREDEC 020
172: # define AM_DISPL 040
173: # define AM_INDEX 0100
174: # define AM_ABSS 0200
175: # define AM_ABSL 0400
176: # define AM_IMMED 01000
177: # define AM_PCDISPL 02000
178: # define AM_PCINDEX 04000
179: # define AM_NORMAL 010000
180: # define AM_REG (AM_DREG|AM_AREG)
181: # define AM_ALL 017777
182: # define AM_FREG 020000
183: # define AM_CCREG 040000
184: # define AM_CTRLREG 0100000
185: # define AM_USPREG 0200000
186: # define AM_PCREG 0400000
187: # define AM_REGPAIR 01000000
188: # define AM_FCTRLREG 02000000
189: # define AM_REGLIST 04000000
190: # define AM_FREGLIST 010000000
191: # define AM_FCREGLIST 020000000
192:
193: # define AM_AMEM (AM_DEFER|AM_POSTINC|AM_PREDEC|AM_DISPL|AM_INDEX|AM_ABSS|AM_ABSL|AM_NORMAL)
194: # define AM_ADAT (AM_AMEM|AM_DREG)
195: # define AM_CTRL (AM_DEFER|AM_DISPL|AM_INDEX|AM_ABSS|AM_ABSL|AM_NORMAL|AM_PCDISPL|AM_PCINDEX)
196: # define AM_ACTRL (AM_DEFER|AM_DISPL|AM_INDEX|AM_ABSS|AM_ABSL|AM_NORMAL)
197: # define AM_MEM (AM_ALL&~AM_REG)
198: # define AM_ADDR (AM_ALL&~AM_REG&~AM_IMMED)
199: # define AM_DATA (AM_ALL&~AM_AREG)
200: # define AM_AA (AM_ALL&~(AM_PCDISPL|AM_PCINDEX|AM_IMMED))
201:
202: #if C2
203: /* cc set */
204: # define CC0 0
205: # define CC1 1
206: # define CC2 2
207: # define CCX 3
208: # define FCC0 0
209: # define FCC 010
210: # define CCR 0100
211: # define FCCR 0200
212: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.