Commit | Line | Data |
---|---|---|
47660bef | 1 | /* to sanitize this file, grep -v v9 < sparc.h > clean-sparc.h */ |
0227e918 | 2 | |
7b22a53c | 3 | /* Definitions for opcode table for the sparc. |
47660bef KR |
4 | Copyright 1989, 1991, 1992 Free Software Foundation, Inc. |
5 | ||
6 | This file is part of GAS, the GNU Assembler, GDB, the GNU debugger, and | |
7 | the GNU Binutils. | |
0227e918 | 8 | |
0227e918 SC |
9 | |
10 | GAS/GDB is free software; you can redistribute it and/or modify | |
11 | it under the terms of the GNU General Public License as published by | |
12 | the Free Software Foundation; either version 2, or (at your option) | |
13 | any later version. | |
14 | ||
15 | GAS/GDB is distributed in the hope that it will be useful, | |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | GNU General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU General Public License | |
21 | along with GAS or GDB; see the file COPYING. If not, write to | |
22 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
23 | ||
7b22a53c KR |
24 | /* The SPARC opcode table (and other related data) is defined in |
25 | the BFD library in opc-sparc.c. If you change anything here, make | |
26 | sure you fix up that file, and vice versa. */ | |
27 | ||
0227e918 SC |
28 | /* FIXME-someday: perhaps the ,a's and such should be embedded in the |
29 | instruction's name rather than the args. This would make gas faster, pinsn | |
30 | slower, but would mess up some macros a bit. xoxorich. */ | |
31 | ||
32 | #if !defined(__STDC__) && !defined(const) | |
33 | #define const | |
34 | #endif | |
35 | ||
7b22a53c KR |
36 | #define sparc_architecture bfd_sparc_architecture |
37 | #define architecture_pname bfd_sparc_architecture_pname | |
38 | #define sparc_opcode bfd_sparc_opcode | |
39 | #define sparc_opcodes bfd_sparc_opcodes | |
40 | ||
0227e918 SC |
41 | /* |
42 | * Structure of an opcode table entry. | |
7b22a53c KR |
43 | * This enumerator must parallel the architecture_pname array |
44 | * in bfd/opc-sparc.c. | |
0227e918 SC |
45 | */ |
46 | enum sparc_architecture { | |
47 | v6 = 0, | |
48 | v7, | |
0227e918 | 49 | v8, |
47660bef | 50 | sparclite, |
f59db855 | 51 | v9 |
0227e918 SC |
52 | }; |
53 | ||
7b22a53c | 54 | extern const char *architecture_pname[]; |
0227e918 | 55 | |
47660bef KR |
56 | /* Sparclite and v9 are both supersets of v8; we can't bump between them. */ |
57 | ||
58 | #define ARCHITECTURES_CONFLICT_P(ARCH1, ARCH2) ((ARCH1) == sparclite && (ARCH2) == v9) | |
59 | ||
0227e918 SC |
60 | struct sparc_opcode { |
61 | const char *name; | |
62 | unsigned long match; /* Bits that must be set. */ | |
63 | unsigned long lose; /* Bits that must not be set. */ | |
64 | const char *args; | |
65 | /* This was called "delayed" in versions before the flags. */ | |
66 | char flags; | |
67 | enum sparc_architecture architecture; | |
68 | }; | |
69 | ||
70 | #define F_DELAYED 1 /* Delayed branch */ | |
71 | #define F_ALIAS 2 /* Alias for a "real" instruction */ | |
72 | ||
73 | /* | |
74 | ||
75 | All sparc opcodes are 32 bits, except for the `set' instruction (really a | |
76 | macro), which is 64 bits. It is handled as a special case. | |
77 | ||
78 | The match component is a mask saying which bits must match a particular | |
79 | opcode in order for an instruction to be an instance of that opcode. | |
80 | ||
81 | The args component is a string containing one character for each operand of the | |
82 | instruction. | |
83 | ||
84 | Kinds of operands: | |
85 | # Number used by optimizer. It is ignored. | |
86 | 1 rs1 register. | |
87 | 2 rs2 register. | |
88 | d rd register. | |
89 | e frs1 floating point register. | |
90 | v frs1 floating point register (double/even). | |
91 | V frs1 floating point register (quad/multiple of 4). | |
92 | f frs2 floating point register. | |
93 | B frs2 floating point register (double/even). | |
94 | R frs2 floating point register (quad/multiple of 4). | |
95 | j frs3 floating point register. (v9) | |
96 | u frs3 floating point register. (double/even) (v9) | |
97 | U frs3 floating point register. (quad/multiple of 4) (v9) | |
98 | g frsd floating point register. | |
99 | H frsd floating point register (double/even). | |
100 | J frsd floating point register (quad/multiple of 4). | |
101 | b crs1 coprocessor register | |
102 | c crs2 coprocessor register | |
103 | D crsd coprocessor register | |
104 | m alternate space register (asr) in rd | |
105 | M alternate space register (asr) in rs1 | |
106 | h 22 high bits. | |
47660bef | 107 | K MEMBAR mask (4 bits). (v9) |
0227e918 SC |
108 | I 11 bit Immediate. (v9) |
109 | i 13 bit Immediate. | |
cc35cb05 | 110 | n 22 bit immediate. |
0227e918 SC |
111 | k 2+14 bit PC relative immediate. (v9) |
112 | G 19 bit PC relative immediate. (v9) | |
113 | l 22 bit PC relative immediate. | |
114 | L 30 bit PC relative immediate. | |
115 | a Annul. The annul bit is set. | |
116 | A Alternate address space. Stored as 8 bits. | |
117 | C Coprocessor state register. | |
118 | F floating point state register. | |
119 | p Processor state register. | |
120 | N Branch predict clear ",pn" (v9) | |
121 | T Branch predict set ",pt" (v9) | |
122 | z icc. (v9) | |
123 | Z xcc. (v9) | |
124 | q Floating point queue. | |
125 | r Single register that is both rs1 and rsd. | |
126 | Q Coprocessor queue. | |
127 | S Special case. | |
128 | t Trap base register. | |
129 | w Window invalid mask register. | |
130 | y Y register. | |
131 | Y %amr (v9?) | |
132 | P %pc. (v9) | |
133 | E %modes. (v9) | |
134 | W %tick. (v9) | |
47660bef KR |
135 | s %usr. (v9) |
136 | o %asi. (v9) | |
0227e918 SC |
137 | 6 fcc0. (v9) |
138 | 7 fcc1. (v9) | |
139 | 8 fcc2. (v9) | |
140 | 9 fcc3. (v9) | |
47660bef KR |
141 | ! Privileged Register in rd (v9) |
142 | ? Privileged Register in rs1 (v9) | |
0227e918 SC |
143 | |
144 | The following chars are unused: (note: ,[] are used as punctuation) | |
cc35cb05 | 145 | [osxOX3450] |
0227e918 SC |
146 | |
147 | */ | |
148 | ||
0227e918 SC |
149 | #define OP2(x) (((x)&0x7) << 22) /* op2 field of format2 insns */ |
150 | #define OP3(x) (((x)&0x3f) << 19) /* op3 field of format3 insns */ | |
47660bef | 151 | #define OP(x) ((unsigned)((x)&0x3) << 30) /* op field of all insns */ |
0227e918 SC |
152 | #define OPF(x) (((x)&0x1ff) << 5) /* opf field of float insns */ |
153 | #define OPF_LOW(x) OPF((x)&0xf) /* v9 */ | |
154 | #define F3F(x, y, z) (OP(x) | OP3(y) | OPF(z)) /* format3 float insns */ | |
155 | #define F3I(x) (((x)&0x1) << 13) /* immediate field of format 3 insns */ | |
156 | #define F2(x, y) (OP(x) | OP2(y)) /* format 2 insns */ | |
157 | #define F3(x, y, z) (OP(x) | OP3(y) | F3I(z)) /* format3 insns */ | |
158 | #define F1(x) (OP(x)) | |
159 | #define DISP30(x) ((x)&0x3fffffff) | |
160 | #define ASI(x) (((x)&0xff) << 5) /* asi field of format3 insns */ | |
161 | #define RS2(x) ((x)&0x1f) /* rs2 field */ | |
162 | #define SIMM13(x) ((x)&0x1fff) /* simm13 field */ | |
163 | #define RD(x) (((x)&0x1f) << 25) /* destination register field */ | |
164 | #define RS1(x) (((x)&0x1f) << 14) /* rs1 field */ | |
165 | #define ASI_RS2(x) (SIMM13(x)) | |
166 | ||
167 | #define ANNUL (1<<29) | |
f59db855 | 168 | #define BPRED (1<<19) /* v9 */ |
0227e918 SC |
169 | #define IMMED F3I(1) |
170 | #define RD_G0 RD(~0) | |
171 | #define RS1_G0 RS1(~0) | |
172 | #define RS2_G0 RS2(~0) | |
173 | ||
7b22a53c KR |
174 | extern struct sparc_opcode sparc_opcodes[]; |
175 | extern const int bfd_sparc_num_opcodes; | |
0227e918 | 176 | |
7b22a53c | 177 | #define NUMOPCODES bfd_sparc_num_opcodes |
0227e918 SC |
178 | |
179 | /* | |
180 | * Local Variables: | |
181 | * fill-column: 131 | |
182 | * comment-column: 0 | |
183 | * End: | |
184 | */ | |
185 | ||
47660bef | 186 | /* end of sparc.h */ |