ip2k-desc.c revision 1.1.1.8 1 1.1.1.5 christos /* DO NOT EDIT! -*- buffer-read-only: t -*- vi:set ro: */
2 1.1 christos /* CPU data for ip2k.
3 1.1 christos
4 1.1 christos THIS FILE IS MACHINE GENERATED WITH CGEN.
5 1.1 christos
6 1.1.1.8 christos Copyright (C) 1996-2024 Free Software Foundation, Inc.
7 1.1 christos
8 1.1 christos This file is part of the GNU Binutils and/or GDB, the GNU debugger.
9 1.1 christos
10 1.1 christos This file is free software; you can redistribute it and/or modify
11 1.1 christos it under the terms of the GNU General Public License as published by
12 1.1 christos the Free Software Foundation; either version 3, or (at your option)
13 1.1 christos any later version.
14 1.1 christos
15 1.1 christos It is distributed in the hope that it will be useful, but WITHOUT
16 1.1 christos ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 1.1 christos or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 1.1 christos License for more details.
19 1.1 christos
20 1.1 christos You should have received a copy of the GNU General Public License along
21 1.1 christos with this program; if not, write to the Free Software Foundation, Inc.,
22 1.1 christos 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
23 1.1 christos
24 1.1 christos */
25 1.1 christos
26 1.1 christos #include "sysdep.h"
27 1.1 christos #include <stdio.h>
28 1.1 christos #include <stdarg.h>
29 1.1.1.7 christos #include <stdlib.h>
30 1.1 christos #include "ansidecl.h"
31 1.1 christos #include "bfd.h"
32 1.1 christos #include "symcat.h"
33 1.1 christos #include "ip2k-desc.h"
34 1.1 christos #include "ip2k-opc.h"
35 1.1 christos #include "opintl.h"
36 1.1 christos #include "libiberty.h"
37 1.1 christos #include "xregex.h"
38 1.1 christos
39 1.1 christos /* Attributes. */
40 1.1 christos
41 1.1 christos static const CGEN_ATTR_ENTRY bool_attr[] =
42 1.1 christos {
43 1.1 christos { "#f", 0 },
44 1.1 christos { "#t", 1 },
45 1.1 christos { 0, 0 }
46 1.1 christos };
47 1.1 christos
48 1.1 christos static const CGEN_ATTR_ENTRY MACH_attr[] ATTRIBUTE_UNUSED =
49 1.1 christos {
50 1.1 christos { "base", MACH_BASE },
51 1.1 christos { "ip2022", MACH_IP2022 },
52 1.1 christos { "ip2022ext", MACH_IP2022EXT },
53 1.1 christos { "max", MACH_MAX },
54 1.1 christos { 0, 0 }
55 1.1 christos };
56 1.1 christos
57 1.1 christos static const CGEN_ATTR_ENTRY ISA_attr[] ATTRIBUTE_UNUSED =
58 1.1 christos {
59 1.1 christos { "ip2k", ISA_IP2K },
60 1.1 christos { "max", ISA_MAX },
61 1.1 christos { 0, 0 }
62 1.1 christos };
63 1.1 christos
64 1.1 christos const CGEN_ATTR_TABLE ip2k_cgen_ifield_attr_table[] =
65 1.1 christos {
66 1.1 christos { "MACH", & MACH_attr[0], & MACH_attr[0] },
67 1.1 christos { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
68 1.1 christos { "PCREL-ADDR", &bool_attr[0], &bool_attr[0] },
69 1.1 christos { "ABS-ADDR", &bool_attr[0], &bool_attr[0] },
70 1.1 christos { "RESERVED", &bool_attr[0], &bool_attr[0] },
71 1.1 christos { "SIGN-OPT", &bool_attr[0], &bool_attr[0] },
72 1.1 christos { "SIGNED", &bool_attr[0], &bool_attr[0] },
73 1.1 christos { 0, 0, 0 }
74 1.1 christos };
75 1.1 christos
76 1.1 christos const CGEN_ATTR_TABLE ip2k_cgen_hardware_attr_table[] =
77 1.1 christos {
78 1.1 christos { "MACH", & MACH_attr[0], & MACH_attr[0] },
79 1.1 christos { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
80 1.1 christos { "CACHE-ADDR", &bool_attr[0], &bool_attr[0] },
81 1.1 christos { "PC", &bool_attr[0], &bool_attr[0] },
82 1.1 christos { "PROFILE", &bool_attr[0], &bool_attr[0] },
83 1.1 christos { 0, 0, 0 }
84 1.1 christos };
85 1.1 christos
86 1.1 christos const CGEN_ATTR_TABLE ip2k_cgen_operand_attr_table[] =
87 1.1 christos {
88 1.1 christos { "MACH", & MACH_attr[0], & MACH_attr[0] },
89 1.1 christos { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
90 1.1 christos { "PCREL-ADDR", &bool_attr[0], &bool_attr[0] },
91 1.1 christos { "ABS-ADDR", &bool_attr[0], &bool_attr[0] },
92 1.1 christos { "SIGN-OPT", &bool_attr[0], &bool_attr[0] },
93 1.1 christos { "SIGNED", &bool_attr[0], &bool_attr[0] },
94 1.1 christos { "NEGATIVE", &bool_attr[0], &bool_attr[0] },
95 1.1 christos { "RELAX", &bool_attr[0], &bool_attr[0] },
96 1.1 christos { "SEM-ONLY", &bool_attr[0], &bool_attr[0] },
97 1.1 christos { 0, 0, 0 }
98 1.1 christos };
99 1.1 christos
100 1.1 christos const CGEN_ATTR_TABLE ip2k_cgen_insn_attr_table[] =
101 1.1 christos {
102 1.1 christos { "MACH", & MACH_attr[0], & MACH_attr[0] },
103 1.1 christos { "ALIAS", &bool_attr[0], &bool_attr[0] },
104 1.1 christos { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
105 1.1 christos { "UNCOND-CTI", &bool_attr[0], &bool_attr[0] },
106 1.1 christos { "COND-CTI", &bool_attr[0], &bool_attr[0] },
107 1.1 christos { "SKIP-CTI", &bool_attr[0], &bool_attr[0] },
108 1.1 christos { "DELAY-SLOT", &bool_attr[0], &bool_attr[0] },
109 1.1 christos { "RELAXABLE", &bool_attr[0], &bool_attr[0] },
110 1.1 christos { "RELAXED", &bool_attr[0], &bool_attr[0] },
111 1.1 christos { "NO-DIS", &bool_attr[0], &bool_attr[0] },
112 1.1 christos { "PBB", &bool_attr[0], &bool_attr[0] },
113 1.1 christos { "EXT-SKIP-INSN", &bool_attr[0], &bool_attr[0] },
114 1.1 christos { "SKIPA", &bool_attr[0], &bool_attr[0] },
115 1.1 christos { 0, 0, 0 }
116 1.1 christos };
117 1.1 christos
118 1.1 christos /* Instruction set variants. */
119 1.1 christos
120 1.1 christos static const CGEN_ISA ip2k_cgen_isa_table[] = {
121 1.1 christos { "ip2k", 16, 16, 16, 16 },
122 1.1 christos { 0, 0, 0, 0, 0 }
123 1.1 christos };
124 1.1 christos
125 1.1 christos /* Machine variants. */
126 1.1 christos
127 1.1 christos static const CGEN_MACH ip2k_cgen_mach_table[] = {
128 1.1 christos { "ip2022", "ip2022", MACH_IP2022, 0 },
129 1.1 christos { "ip2022ext", "ip2022ext", MACH_IP2022EXT, 0 },
130 1.1 christos { 0, 0, 0, 0 }
131 1.1 christos };
132 1.1 christos
133 1.1 christos static CGEN_KEYWORD_ENTRY ip2k_cgen_opval_register_names_entries[] =
134 1.1 christos {
135 1.1 christos { "ADDRSEL", 2, {0, {{{0, 0}}}}, 0, 0 },
136 1.1 christos { "ADDRX", 3, {0, {{{0, 0}}}}, 0, 0 },
137 1.1 christos { "IPH", 4, {0, {{{0, 0}}}}, 0, 0 },
138 1.1 christos { "IPL", 5, {0, {{{0, 0}}}}, 0, 0 },
139 1.1 christos { "SPH", 6, {0, {{{0, 0}}}}, 0, 0 },
140 1.1 christos { "SPL", 7, {0, {{{0, 0}}}}, 0, 0 },
141 1.1 christos { "PCH", 8, {0, {{{0, 0}}}}, 0, 0 },
142 1.1 christos { "PCL", 9, {0, {{{0, 0}}}}, 0, 0 },
143 1.1 christos { "WREG", 10, {0, {{{0, 0}}}}, 0, 0 },
144 1.1 christos { "STATUS", 11, {0, {{{0, 0}}}}, 0, 0 },
145 1.1 christos { "DPH", 12, {0, {{{0, 0}}}}, 0, 0 },
146 1.1 christos { "DPL", 13, {0, {{{0, 0}}}}, 0, 0 },
147 1.1 christos { "SPDREG", 14, {0, {{{0, 0}}}}, 0, 0 },
148 1.1 christos { "MULH", 15, {0, {{{0, 0}}}}, 0, 0 },
149 1.1 christos { "ADDRH", 16, {0, {{{0, 0}}}}, 0, 0 },
150 1.1 christos { "ADDRL", 17, {0, {{{0, 0}}}}, 0, 0 },
151 1.1 christos { "DATAH", 18, {0, {{{0, 0}}}}, 0, 0 },
152 1.1 christos { "DATAL", 19, {0, {{{0, 0}}}}, 0, 0 },
153 1.1 christos { "INTVECH", 20, {0, {{{0, 0}}}}, 0, 0 },
154 1.1 christos { "INTVECL", 21, {0, {{{0, 0}}}}, 0, 0 },
155 1.1 christos { "INTSPD", 22, {0, {{{0, 0}}}}, 0, 0 },
156 1.1 christos { "INTF", 23, {0, {{{0, 0}}}}, 0, 0 },
157 1.1 christos { "INTE", 24, {0, {{{0, 0}}}}, 0, 0 },
158 1.1 christos { "INTED", 25, {0, {{{0, 0}}}}, 0, 0 },
159 1.1 christos { "FCFG", 26, {0, {{{0, 0}}}}, 0, 0 },
160 1.1 christos { "TCTRL", 27, {0, {{{0, 0}}}}, 0, 0 },
161 1.1 christos { "XCFG", 28, {0, {{{0, 0}}}}, 0, 0 },
162 1.1 christos { "EMCFG", 29, {0, {{{0, 0}}}}, 0, 0 },
163 1.1 christos { "IPCH", 30, {0, {{{0, 0}}}}, 0, 0 },
164 1.1 christos { "IPCL", 31, {0, {{{0, 0}}}}, 0, 0 },
165 1.1 christos { "RAIN", 32, {0, {{{0, 0}}}}, 0, 0 },
166 1.1 christos { "RAOUT", 33, {0, {{{0, 0}}}}, 0, 0 },
167 1.1 christos { "RADIR", 34, {0, {{{0, 0}}}}, 0, 0 },
168 1.1 christos { "LFSRH", 35, {0, {{{0, 0}}}}, 0, 0 },
169 1.1 christos { "RBIN", 36, {0, {{{0, 0}}}}, 0, 0 },
170 1.1 christos { "RBOUT", 37, {0, {{{0, 0}}}}, 0, 0 },
171 1.1 christos { "RBDIR", 38, {0, {{{0, 0}}}}, 0, 0 },
172 1.1 christos { "LFSRL", 39, {0, {{{0, 0}}}}, 0, 0 },
173 1.1 christos { "RCIN", 40, {0, {{{0, 0}}}}, 0, 0 },
174 1.1 christos { "RCOUT", 41, {0, {{{0, 0}}}}, 0, 0 },
175 1.1 christos { "RCDIR", 42, {0, {{{0, 0}}}}, 0, 0 },
176 1.1 christos { "LFSRA", 43, {0, {{{0, 0}}}}, 0, 0 },
177 1.1 christos { "RDIN", 44, {0, {{{0, 0}}}}, 0, 0 },
178 1.1 christos { "RDOUT", 45, {0, {{{0, 0}}}}, 0, 0 },
179 1.1 christos { "RDDIR", 46, {0, {{{0, 0}}}}, 0, 0 },
180 1.1 christos { "REIN", 48, {0, {{{0, 0}}}}, 0, 0 },
181 1.1 christos { "REOUT", 49, {0, {{{0, 0}}}}, 0, 0 },
182 1.1 christos { "REDIR", 50, {0, {{{0, 0}}}}, 0, 0 },
183 1.1 christos { "RFIN", 52, {0, {{{0, 0}}}}, 0, 0 },
184 1.1 christos { "RFOUT", 53, {0, {{{0, 0}}}}, 0, 0 },
185 1.1 christos { "RFDIR", 54, {0, {{{0, 0}}}}, 0, 0 },
186 1.1 christos { "RGOUT", 57, {0, {{{0, 0}}}}, 0, 0 },
187 1.1 christos { "RGDIR", 58, {0, {{{0, 0}}}}, 0, 0 },
188 1.1 christos { "RTTMR", 64, {0, {{{0, 0}}}}, 0, 0 },
189 1.1 christos { "RTCFG", 65, {0, {{{0, 0}}}}, 0, 0 },
190 1.1 christos { "T0TMR", 66, {0, {{{0, 0}}}}, 0, 0 },
191 1.1 christos { "T0CFG", 67, {0, {{{0, 0}}}}, 0, 0 },
192 1.1 christos { "T1CNTH", 68, {0, {{{0, 0}}}}, 0, 0 },
193 1.1 christos { "T1CNTL", 69, {0, {{{0, 0}}}}, 0, 0 },
194 1.1 christos { "T1CAP1H", 70, {0, {{{0, 0}}}}, 0, 0 },
195 1.1 christos { "T1CAP1L", 71, {0, {{{0, 0}}}}, 0, 0 },
196 1.1 christos { "T1CAP2H", 72, {0, {{{0, 0}}}}, 0, 0 },
197 1.1 christos { "T1CMP2H", 72, {0, {{{0, 0}}}}, 0, 0 },
198 1.1 christos { "T1CAP2L", 73, {0, {{{0, 0}}}}, 0, 0 },
199 1.1 christos { "T1CMP2L", 73, {0, {{{0, 0}}}}, 0, 0 },
200 1.1 christos { "T1CMP1H", 74, {0, {{{0, 0}}}}, 0, 0 },
201 1.1 christos { "T1CMP1L", 75, {0, {{{0, 0}}}}, 0, 0 },
202 1.1 christos { "T1CFG1H", 76, {0, {{{0, 0}}}}, 0, 0 },
203 1.1 christos { "T1CFG1L", 77, {0, {{{0, 0}}}}, 0, 0 },
204 1.1 christos { "T1CFG2H", 78, {0, {{{0, 0}}}}, 0, 0 },
205 1.1 christos { "T1CFG2L", 79, {0, {{{0, 0}}}}, 0, 0 },
206 1.1 christos { "ADCH", 80, {0, {{{0, 0}}}}, 0, 0 },
207 1.1 christos { "ADCL", 81, {0, {{{0, 0}}}}, 0, 0 },
208 1.1 christos { "ADCCFG", 82, {0, {{{0, 0}}}}, 0, 0 },
209 1.1 christos { "ADCTMR", 83, {0, {{{0, 0}}}}, 0, 0 },
210 1.1 christos { "T2CNTH", 84, {0, {{{0, 0}}}}, 0, 0 },
211 1.1 christos { "T2CNTL", 85, {0, {{{0, 0}}}}, 0, 0 },
212 1.1 christos { "T2CAP1H", 86, {0, {{{0, 0}}}}, 0, 0 },
213 1.1 christos { "T2CAP1L", 87, {0, {{{0, 0}}}}, 0, 0 },
214 1.1 christos { "T2CAP2H", 88, {0, {{{0, 0}}}}, 0, 0 },
215 1.1 christos { "T2CMP2H", 88, {0, {{{0, 0}}}}, 0, 0 },
216 1.1 christos { "T2CAP2L", 89, {0, {{{0, 0}}}}, 0, 0 },
217 1.1 christos { "T2CMP2L", 89, {0, {{{0, 0}}}}, 0, 0 },
218 1.1 christos { "T2CMP1H", 90, {0, {{{0, 0}}}}, 0, 0 },
219 1.1 christos { "T2CMP1L", 91, {0, {{{0, 0}}}}, 0, 0 },
220 1.1 christos { "T2CFG1H", 92, {0, {{{0, 0}}}}, 0, 0 },
221 1.1 christos { "T2CFG1L", 93, {0, {{{0, 0}}}}, 0, 0 },
222 1.1 christos { "T2CFG2H", 94, {0, {{{0, 0}}}}, 0, 0 },
223 1.1 christos { "T2CFG2L", 95, {0, {{{0, 0}}}}, 0, 0 },
224 1.1 christos { "S1TMRH", 96, {0, {{{0, 0}}}}, 0, 0 },
225 1.1 christos { "S1TMRL", 97, {0, {{{0, 0}}}}, 0, 0 },
226 1.1 christos { "S1TBUFH", 98, {0, {{{0, 0}}}}, 0, 0 },
227 1.1 christos { "S1TBUFL", 99, {0, {{{0, 0}}}}, 0, 0 },
228 1.1 christos { "S1TCFG", 100, {0, {{{0, 0}}}}, 0, 0 },
229 1.1 christos { "S1RCNT", 101, {0, {{{0, 0}}}}, 0, 0 },
230 1.1 christos { "S1RBUFH", 102, {0, {{{0, 0}}}}, 0, 0 },
231 1.1 christos { "S1RBUFL", 103, {0, {{{0, 0}}}}, 0, 0 },
232 1.1 christos { "S1RCFG", 104, {0, {{{0, 0}}}}, 0, 0 },
233 1.1 christos { "S1RSYNC", 105, {0, {{{0, 0}}}}, 0, 0 },
234 1.1 christos { "S1INTF", 106, {0, {{{0, 0}}}}, 0, 0 },
235 1.1 christos { "S1INTE", 107, {0, {{{0, 0}}}}, 0, 0 },
236 1.1 christos { "S1MODE", 108, {0, {{{0, 0}}}}, 0, 0 },
237 1.1 christos { "S1SMASK", 109, {0, {{{0, 0}}}}, 0, 0 },
238 1.1 christos { "PSPCFG", 110, {0, {{{0, 0}}}}, 0, 0 },
239 1.1 christos { "CMPCFG", 111, {0, {{{0, 0}}}}, 0, 0 },
240 1.1 christos { "S2TMRH", 112, {0, {{{0, 0}}}}, 0, 0 },
241 1.1 christos { "S2TMRL", 113, {0, {{{0, 0}}}}, 0, 0 },
242 1.1 christos { "S2TBUFH", 114, {0, {{{0, 0}}}}, 0, 0 },
243 1.1 christos { "S2TBUFL", 115, {0, {{{0, 0}}}}, 0, 0 },
244 1.1 christos { "S2TCFG", 116, {0, {{{0, 0}}}}, 0, 0 },
245 1.1 christos { "S2RCNT", 117, {0, {{{0, 0}}}}, 0, 0 },
246 1.1 christos { "S2RBUFH", 118, {0, {{{0, 0}}}}, 0, 0 },
247 1.1 christos { "S2RBUFL", 119, {0, {{{0, 0}}}}, 0, 0 },
248 1.1 christos { "S2RCFG", 120, {0, {{{0, 0}}}}, 0, 0 },
249 1.1 christos { "S2RSYNC", 121, {0, {{{0, 0}}}}, 0, 0 },
250 1.1 christos { "S2INTF", 122, {0, {{{0, 0}}}}, 0, 0 },
251 1.1 christos { "S2INTE", 123, {0, {{{0, 0}}}}, 0, 0 },
252 1.1 christos { "S2MODE", 124, {0, {{{0, 0}}}}, 0, 0 },
253 1.1 christos { "S2SMASK", 125, {0, {{{0, 0}}}}, 0, 0 },
254 1.1 christos { "CALLH", 126, {0, {{{0, 0}}}}, 0, 0 },
255 1.1 christos { "CALLL", 127, {0, {{{0, 0}}}}, 0, 0 }
256 1.1 christos };
257 1.1 christos
258 1.1 christos CGEN_KEYWORD ip2k_cgen_opval_register_names =
259 1.1 christos {
260 1.1 christos & ip2k_cgen_opval_register_names_entries[0],
261 1.1 christos 121,
262 1.1 christos 0, 0, 0, 0, ""
263 1.1 christos };
264 1.1 christos
265 1.1 christos
266 1.1 christos /* The hardware table. */
267 1.1 christos
268 1.1 christos #define A(a) (1 << CGEN_HW_##a)
269 1.1 christos
270 1.1 christos const CGEN_HW_ENTRY ip2k_cgen_hw_table[] =
271 1.1 christos {
272 1.1 christos { "h-memory", HW_H_MEMORY, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
273 1.1 christos { "h-sint", HW_H_SINT, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
274 1.1 christos { "h-uint", HW_H_UINT, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
275 1.1 christos { "h-addr", HW_H_ADDR, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
276 1.1 christos { "h-iaddr", HW_H_IADDR, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
277 1.1 christos { "h-spr", HW_H_SPR, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
278 1.1 christos { "h-registers", HW_H_REGISTERS, CGEN_ASM_NONE, 0, { 0|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } } } } },
279 1.1 christos { "h-stack", HW_H_STACK, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
280 1.1 christos { "h-pabits", HW_H_PABITS, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
281 1.1 christos { "h-zbit", HW_H_ZBIT, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
282 1.1 christos { "h-cbit", HW_H_CBIT, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
283 1.1 christos { "h-dcbit", HW_H_DCBIT, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
284 1.1 christos { "h-pc", HW_H_PC, CGEN_ASM_NONE, 0, { 0|A(PROFILE)|A(PC), { { { (1<<MACH_BASE), 0 } } } } },
285 1.1 christos { 0, 0, CGEN_ASM_NONE, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } }
286 1.1 christos };
287 1.1 christos
288 1.1 christos #undef A
289 1.1 christos
290 1.1 christos
291 1.1 christos /* The instruction field table. */
292 1.1 christos
293 1.1 christos #define A(a) (1 << CGEN_IFLD_##a)
294 1.1 christos
295 1.1 christos const CGEN_IFLD ip2k_cgen_ifld_table[] =
296 1.1 christos {
297 1.1 christos { IP2K_F_NIL, "f-nil", 0, 0, 0, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
298 1.1 christos { IP2K_F_ANYOF, "f-anyof", 0, 0, 0, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
299 1.1 christos { IP2K_F_IMM8, "f-imm8", 0, 16, 7, 8, { 0, { { { (1<<MACH_BASE), 0 } } } } },
300 1.1 christos { IP2K_F_REG, "f-reg", 0, 16, 8, 9, { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
301 1.1 christos { IP2K_F_ADDR16CJP, "f-addr16cjp", 0, 16, 12, 13, { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
302 1.1 christos { IP2K_F_DIR, "f-dir", 0, 16, 9, 1, { 0, { { { (1<<MACH_BASE), 0 } } } } },
303 1.1 christos { IP2K_F_BITNO, "f-bitno", 0, 16, 11, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
304 1.1 christos { IP2K_F_OP3, "f-op3", 0, 16, 15, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
305 1.1 christos { IP2K_F_OP4, "f-op4", 0, 16, 15, 4, { 0, { { { (1<<MACH_BASE), 0 } } } } },
306 1.1 christos { IP2K_F_OP4MID, "f-op4mid", 0, 16, 11, 4, { 0, { { { (1<<MACH_BASE), 0 } } } } },
307 1.1 christos { IP2K_F_OP6, "f-op6", 0, 16, 15, 6, { 0, { { { (1<<MACH_BASE), 0 } } } } },
308 1.1 christos { IP2K_F_OP8, "f-op8", 0, 16, 15, 8, { 0, { { { (1<<MACH_BASE), 0 } } } } },
309 1.1 christos { IP2K_F_OP6_10LOW, "f-op6-10low", 0, 16, 9, 10, { 0, { { { (1<<MACH_BASE), 0 } } } } },
310 1.1 christos { IP2K_F_OP6_7LOW, "f-op6-7low", 0, 16, 9, 7, { 0, { { { (1<<MACH_BASE), 0 } } } } },
311 1.1 christos { IP2K_F_RETI3, "f-reti3", 0, 16, 2, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
312 1.1 christos { IP2K_F_SKIPB, "f-skipb", 0, 16, 12, 1, { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
313 1.1 christos { IP2K_F_PAGE3, "f-page3", 0, 16, 2, 3, { 0, { { { (1<<MACH_BASE), 0 } } } } },
314 1.1 christos { 0, 0, 0, 0, 0, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } }
315 1.1 christos };
316 1.1 christos
317 1.1 christos #undef A
318 1.1 christos
319 1.1 christos
320 1.1 christos
321 1.1 christos /* multi ifield declarations */
322 1.1 christos
323 1.1 christos
324 1.1 christos
325 1.1 christos /* multi ifield definitions */
326 1.1 christos
327 1.1 christos
328 1.1 christos /* The operand table. */
329 1.1 christos
330 1.1 christos #define A(a) (1 << CGEN_OPERAND_##a)
331 1.1 christos #define OPERAND(op) IP2K_OPERAND_##op
332 1.1 christos
333 1.1 christos const CGEN_OPERAND ip2k_cgen_operand_table[] =
334 1.1 christos {
335 1.1 christos /* pc: program counter */
336 1.1 christos { "pc", IP2K_OPERAND_PC, HW_H_PC, 0, 0,
337 1.1.1.7 christos { 0, { &ip2k_cgen_ifld_table[IP2K_F_NIL] } },
338 1.1 christos { 0|A(SEM_ONLY), { { { (1<<MACH_BASE), 0 } } } } },
339 1.1 christos /* addr16cjp: 13-bit address */
340 1.1 christos { "addr16cjp", IP2K_OPERAND_ADDR16CJP, HW_H_UINT, 12, 13,
341 1.1.1.7 christos { 0, { &ip2k_cgen_ifld_table[IP2K_F_ADDR16CJP] } },
342 1.1 christos { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
343 1.1 christos /* fr: register */
344 1.1 christos { "fr", IP2K_OPERAND_FR, HW_H_REGISTERS, 8, 9,
345 1.1.1.7 christos { 0, { &ip2k_cgen_ifld_table[IP2K_F_REG] } },
346 1.1 christos { 0|A(ABS_ADDR), { { { (1<<MACH_BASE), 0 } } } } },
347 1.1 christos /* lit8: 8-bit signed literal */
348 1.1 christos { "lit8", IP2K_OPERAND_LIT8, HW_H_SINT, 7, 8,
349 1.1.1.7 christos { 0, { &ip2k_cgen_ifld_table[IP2K_F_IMM8] } },
350 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } } },
351 1.1 christos /* bitno: bit number */
352 1.1 christos { "bitno", IP2K_OPERAND_BITNO, HW_H_UINT, 11, 3,
353 1.1.1.7 christos { 0, { &ip2k_cgen_ifld_table[IP2K_F_BITNO] } },
354 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } } },
355 1.1 christos /* addr16p: page number */
356 1.1 christos { "addr16p", IP2K_OPERAND_ADDR16P, HW_H_UINT, 2, 3,
357 1.1.1.7 christos { 0, { &ip2k_cgen_ifld_table[IP2K_F_PAGE3] } },
358 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } } },
359 1.1 christos /* addr16h: high 8 bits of address */
360 1.1 christos { "addr16h", IP2K_OPERAND_ADDR16H, HW_H_UINT, 7, 8,
361 1.1.1.7 christos { 0, { &ip2k_cgen_ifld_table[IP2K_F_IMM8] } },
362 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } } },
363 1.1 christos /* addr16l: low 8 bits of address */
364 1.1 christos { "addr16l", IP2K_OPERAND_ADDR16L, HW_H_UINT, 7, 8,
365 1.1.1.7 christos { 0, { &ip2k_cgen_ifld_table[IP2K_F_IMM8] } },
366 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } } },
367 1.1 christos /* reti3: reti flags */
368 1.1 christos { "reti3", IP2K_OPERAND_RETI3, HW_H_UINT, 2, 3,
369 1.1.1.7 christos { 0, { &ip2k_cgen_ifld_table[IP2K_F_RETI3] } },
370 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } } },
371 1.1 christos /* pabits: page bits */
372 1.1 christos { "pabits", IP2K_OPERAND_PABITS, HW_H_PABITS, 0, 0,
373 1.1.1.7 christos { 0, { 0 } },
374 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } } },
375 1.1 christos /* zbit: zero bit */
376 1.1 christos { "zbit", IP2K_OPERAND_ZBIT, HW_H_ZBIT, 0, 0,
377 1.1.1.7 christos { 0, { 0 } },
378 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } } },
379 1.1 christos /* cbit: carry bit */
380 1.1 christos { "cbit", IP2K_OPERAND_CBIT, HW_H_CBIT, 0, 0,
381 1.1.1.7 christos { 0, { 0 } },
382 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } } },
383 1.1 christos /* dcbit: digit carry bit */
384 1.1 christos { "dcbit", IP2K_OPERAND_DCBIT, HW_H_DCBIT, 0, 0,
385 1.1.1.7 christos { 0, { 0 } },
386 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } } },
387 1.1 christos /* sentinel */
388 1.1 christos { 0, 0, 0, 0, 0,
389 1.1.1.7 christos { 0, { 0 } },
390 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } } }
391 1.1 christos };
392 1.1 christos
393 1.1 christos #undef A
394 1.1 christos
395 1.1 christos
396 1.1 christos /* The instruction table. */
397 1.1 christos
398 1.1 christos #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
399 1.1 christos #define A(a) (1 << CGEN_INSN_##a)
400 1.1 christos
401 1.1 christos static const CGEN_IBASE ip2k_cgen_insn_table[MAX_INSNS] =
402 1.1 christos {
403 1.1 christos /* Special null first entry.
404 1.1 christos A `num' value of zero is thus invalid.
405 1.1 christos Also, the special `invalid' insn resides here. */
406 1.1 christos { 0, 0, 0, 0, { 0, { { { (1<<MACH_BASE), 0 } } } } },
407 1.1 christos /* jmp $addr16cjp */
408 1.1 christos {
409 1.1 christos IP2K_INSN_JMP, "jmp", "jmp", 16,
410 1.1 christos { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
411 1.1 christos },
412 1.1 christos /* call $addr16cjp */
413 1.1 christos {
414 1.1 christos IP2K_INSN_CALL, "call", "call", 16,
415 1.1 christos { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
416 1.1 christos },
417 1.1 christos /* sb $fr,$bitno */
418 1.1 christos {
419 1.1 christos IP2K_INSN_SB, "sb", "sb", 16,
420 1.1 christos { 0|A(SKIP_CTI), { { { (1<<MACH_BASE), 0 } } } }
421 1.1 christos },
422 1.1 christos /* snb $fr,$bitno */
423 1.1 christos {
424 1.1 christos IP2K_INSN_SNB, "snb", "snb", 16,
425 1.1 christos { 0|A(SKIP_CTI), { { { (1<<MACH_BASE), 0 } } } }
426 1.1 christos },
427 1.1 christos /* setb $fr,$bitno */
428 1.1 christos {
429 1.1 christos IP2K_INSN_SETB, "setb", "setb", 16,
430 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
431 1.1 christos },
432 1.1 christos /* clrb $fr,$bitno */
433 1.1 christos {
434 1.1 christos IP2K_INSN_CLRB, "clrb", "clrb", 16,
435 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
436 1.1 christos },
437 1.1 christos /* xor W,#$lit8 */
438 1.1 christos {
439 1.1 christos IP2K_INSN_XORW_L, "xorw_l", "xor", 16,
440 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
441 1.1 christos },
442 1.1 christos /* and W,#$lit8 */
443 1.1 christos {
444 1.1 christos IP2K_INSN_ANDW_L, "andw_l", "and", 16,
445 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
446 1.1 christos },
447 1.1 christos /* or W,#$lit8 */
448 1.1 christos {
449 1.1 christos IP2K_INSN_ORW_L, "orw_l", "or", 16,
450 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
451 1.1 christos },
452 1.1 christos /* add W,#$lit8 */
453 1.1 christos {
454 1.1 christos IP2K_INSN_ADDW_L, "addw_l", "add", 16,
455 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
456 1.1 christos },
457 1.1 christos /* sub W,#$lit8 */
458 1.1 christos {
459 1.1 christos IP2K_INSN_SUBW_L, "subw_l", "sub", 16,
460 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
461 1.1 christos },
462 1.1 christos /* cmp W,#$lit8 */
463 1.1 christos {
464 1.1 christos IP2K_INSN_CMPW_L, "cmpw_l", "cmp", 16,
465 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
466 1.1 christos },
467 1.1 christos /* retw #$lit8 */
468 1.1 christos {
469 1.1 christos IP2K_INSN_RETW_L, "retw_l", "retw", 16,
470 1.1 christos { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
471 1.1 christos },
472 1.1 christos /* cse W,#$lit8 */
473 1.1 christos {
474 1.1 christos IP2K_INSN_CSEW_L, "csew_l", "cse", 16,
475 1.1 christos { 0|A(SKIP_CTI), { { { (1<<MACH_BASE), 0 } } } }
476 1.1 christos },
477 1.1 christos /* csne W,#$lit8 */
478 1.1 christos {
479 1.1 christos IP2K_INSN_CSNEW_L, "csnew_l", "csne", 16,
480 1.1 christos { 0|A(SKIP_CTI), { { { (1<<MACH_BASE), 0 } } } }
481 1.1 christos },
482 1.1 christos /* push #$lit8 */
483 1.1 christos {
484 1.1 christos IP2K_INSN_PUSH_L, "push_l", "push", 16,
485 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
486 1.1 christos },
487 1.1 christos /* muls W,#$lit8 */
488 1.1 christos {
489 1.1 christos IP2K_INSN_MULSW_L, "mulsw_l", "muls", 16,
490 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
491 1.1 christos },
492 1.1 christos /* mulu W,#$lit8 */
493 1.1 christos {
494 1.1 christos IP2K_INSN_MULUW_L, "muluw_l", "mulu", 16,
495 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
496 1.1 christos },
497 1.1 christos /* loadl #$lit8 */
498 1.1 christos {
499 1.1 christos IP2K_INSN_LOADL_L, "loadl_l", "loadl", 16,
500 1.1 christos { 0|A(EXT_SKIP_INSN), { { { (1<<MACH_BASE), 0 } } } }
501 1.1 christos },
502 1.1 christos /* loadh #$lit8 */
503 1.1 christos {
504 1.1 christos IP2K_INSN_LOADH_L, "loadh_l", "loadh", 16,
505 1.1 christos { 0|A(EXT_SKIP_INSN), { { { (1<<MACH_BASE), 0 } } } }
506 1.1 christos },
507 1.1 christos /* loadl $addr16l */
508 1.1 christos {
509 1.1 christos IP2K_INSN_LOADL_A, "loadl_a", "loadl", 16,
510 1.1 christos { 0|A(EXT_SKIP_INSN), { { { (1<<MACH_BASE), 0 } } } }
511 1.1 christos },
512 1.1 christos /* loadh $addr16h */
513 1.1 christos {
514 1.1 christos IP2K_INSN_LOADH_A, "loadh_a", "loadh", 16,
515 1.1 christos { 0|A(EXT_SKIP_INSN), { { { (1<<MACH_BASE), 0 } } } }
516 1.1 christos },
517 1.1 christos /* addc $fr,W */
518 1.1 christos {
519 1.1 christos IP2K_INSN_ADDCFR_W, "addcfr_w", "addc", 16,
520 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
521 1.1 christos },
522 1.1 christos /* addc W,$fr */
523 1.1 christos {
524 1.1 christos IP2K_INSN_ADDCW_FR, "addcw_fr", "addc", 16,
525 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
526 1.1 christos },
527 1.1 christos /* incsnz $fr */
528 1.1 christos {
529 1.1 christos IP2K_INSN_INCSNZ_FR, "incsnz_fr", "incsnz", 16,
530 1.1 christos { 0|A(SKIP_CTI), { { { (1<<MACH_BASE), 0 } } } }
531 1.1 christos },
532 1.1 christos /* incsnz W,$fr */
533 1.1 christos {
534 1.1 christos IP2K_INSN_INCSNZW_FR, "incsnzw_fr", "incsnz", 16,
535 1.1 christos { 0|A(SKIP_CTI), { { { (1<<MACH_BASE), 0 } } } }
536 1.1 christos },
537 1.1 christos /* muls W,$fr */
538 1.1 christos {
539 1.1 christos IP2K_INSN_MULSW_FR, "mulsw_fr", "muls", 16,
540 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
541 1.1 christos },
542 1.1 christos /* mulu W,$fr */
543 1.1 christos {
544 1.1 christos IP2K_INSN_MULUW_FR, "muluw_fr", "mulu", 16,
545 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
546 1.1 christos },
547 1.1 christos /* decsnz $fr */
548 1.1 christos {
549 1.1 christos IP2K_INSN_DECSNZ_FR, "decsnz_fr", "decsnz", 16,
550 1.1 christos { 0|A(SKIP_CTI), { { { (1<<MACH_BASE), 0 } } } }
551 1.1 christos },
552 1.1 christos /* decsnz W,$fr */
553 1.1 christos {
554 1.1 christos IP2K_INSN_DECSNZW_FR, "decsnzw_fr", "decsnz", 16,
555 1.1 christos { 0|A(SKIP_CTI), { { { (1<<MACH_BASE), 0 } } } }
556 1.1 christos },
557 1.1 christos /* subc W,$fr */
558 1.1 christos {
559 1.1 christos IP2K_INSN_SUBCW_FR, "subcw_fr", "subc", 16,
560 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
561 1.1 christos },
562 1.1 christos /* subc $fr,W */
563 1.1 christos {
564 1.1 christos IP2K_INSN_SUBCFR_W, "subcfr_w", "subc", 16,
565 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
566 1.1 christos },
567 1.1 christos /* pop $fr */
568 1.1 christos {
569 1.1 christos IP2K_INSN_POP_FR, "pop_fr", "pop", 16,
570 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
571 1.1 christos },
572 1.1 christos /* push $fr */
573 1.1 christos {
574 1.1 christos IP2K_INSN_PUSH_FR, "push_fr", "push", 16,
575 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
576 1.1 christos },
577 1.1 christos /* cse W,$fr */
578 1.1 christos {
579 1.1 christos IP2K_INSN_CSEW_FR, "csew_fr", "cse", 16,
580 1.1 christos { 0|A(SKIP_CTI), { { { (1<<MACH_BASE), 0 } } } }
581 1.1 christos },
582 1.1 christos /* csne W,$fr */
583 1.1 christos {
584 1.1 christos IP2K_INSN_CSNEW_FR, "csnew_fr", "csne", 16,
585 1.1 christos { 0|A(SKIP_CTI), { { { (1<<MACH_BASE), 0 } } } }
586 1.1 christos },
587 1.1 christos /* incsz $fr */
588 1.1 christos {
589 1.1 christos IP2K_INSN_INCSZ_FR, "incsz_fr", "incsz", 16,
590 1.1 christos { 0|A(SKIP_CTI), { { { (1<<MACH_BASE), 0 } } } }
591 1.1 christos },
592 1.1 christos /* incsz W,$fr */
593 1.1 christos {
594 1.1 christos IP2K_INSN_INCSZW_FR, "incszw_fr", "incsz", 16,
595 1.1 christos { 0|A(SKIP_CTI), { { { (1<<MACH_BASE), 0 } } } }
596 1.1 christos },
597 1.1 christos /* swap $fr */
598 1.1 christos {
599 1.1 christos IP2K_INSN_SWAP_FR, "swap_fr", "swap", 16,
600 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
601 1.1 christos },
602 1.1 christos /* swap W,$fr */
603 1.1 christos {
604 1.1 christos IP2K_INSN_SWAPW_FR, "swapw_fr", "swap", 16,
605 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
606 1.1 christos },
607 1.1 christos /* rl $fr */
608 1.1 christos {
609 1.1 christos IP2K_INSN_RL_FR, "rl_fr", "rl", 16,
610 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
611 1.1 christos },
612 1.1 christos /* rl W,$fr */
613 1.1 christos {
614 1.1 christos IP2K_INSN_RLW_FR, "rlw_fr", "rl", 16,
615 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
616 1.1 christos },
617 1.1 christos /* rr $fr */
618 1.1 christos {
619 1.1 christos IP2K_INSN_RR_FR, "rr_fr", "rr", 16,
620 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
621 1.1 christos },
622 1.1 christos /* rr W,$fr */
623 1.1 christos {
624 1.1 christos IP2K_INSN_RRW_FR, "rrw_fr", "rr", 16,
625 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
626 1.1 christos },
627 1.1 christos /* decsz $fr */
628 1.1 christos {
629 1.1 christos IP2K_INSN_DECSZ_FR, "decsz_fr", "decsz", 16,
630 1.1 christos { 0|A(SKIP_CTI), { { { (1<<MACH_BASE), 0 } } } }
631 1.1 christos },
632 1.1 christos /* decsz W,$fr */
633 1.1 christos {
634 1.1 christos IP2K_INSN_DECSZW_FR, "decszw_fr", "decsz", 16,
635 1.1 christos { 0|A(SKIP_CTI), { { { (1<<MACH_BASE), 0 } } } }
636 1.1 christos },
637 1.1 christos /* inc $fr */
638 1.1 christos {
639 1.1 christos IP2K_INSN_INC_FR, "inc_fr", "inc", 16,
640 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
641 1.1 christos },
642 1.1 christos /* inc W,$fr */
643 1.1 christos {
644 1.1 christos IP2K_INSN_INCW_FR, "incw_fr", "inc", 16,
645 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
646 1.1 christos },
647 1.1 christos /* not $fr */
648 1.1 christos {
649 1.1 christos IP2K_INSN_NOT_FR, "not_fr", "not", 16,
650 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
651 1.1 christos },
652 1.1 christos /* not W,$fr */
653 1.1 christos {
654 1.1 christos IP2K_INSN_NOTW_FR, "notw_fr", "not", 16,
655 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
656 1.1 christos },
657 1.1 christos /* test $fr */
658 1.1 christos {
659 1.1 christos IP2K_INSN_TEST_FR, "test_fr", "test", 16,
660 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
661 1.1 christos },
662 1.1 christos /* mov W,#$lit8 */
663 1.1 christos {
664 1.1 christos IP2K_INSN_MOVW_L, "movw_l", "mov", 16,
665 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
666 1.1 christos },
667 1.1 christos /* mov $fr,W */
668 1.1 christos {
669 1.1 christos IP2K_INSN_MOVFR_W, "movfr_w", "mov", 16,
670 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
671 1.1 christos },
672 1.1 christos /* mov W,$fr */
673 1.1 christos {
674 1.1 christos IP2K_INSN_MOVW_FR, "movw_fr", "mov", 16,
675 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
676 1.1 christos },
677 1.1 christos /* add $fr,W */
678 1.1 christos {
679 1.1 christos IP2K_INSN_ADDFR_W, "addfr_w", "add", 16,
680 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
681 1.1 christos },
682 1.1 christos /* add W,$fr */
683 1.1 christos {
684 1.1 christos IP2K_INSN_ADDW_FR, "addw_fr", "add", 16,
685 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
686 1.1 christos },
687 1.1 christos /* xor $fr,W */
688 1.1 christos {
689 1.1 christos IP2K_INSN_XORFR_W, "xorfr_w", "xor", 16,
690 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
691 1.1 christos },
692 1.1 christos /* xor W,$fr */
693 1.1 christos {
694 1.1 christos IP2K_INSN_XORW_FR, "xorw_fr", "xor", 16,
695 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
696 1.1 christos },
697 1.1 christos /* and $fr,W */
698 1.1 christos {
699 1.1 christos IP2K_INSN_ANDFR_W, "andfr_w", "and", 16,
700 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
701 1.1 christos },
702 1.1 christos /* and W,$fr */
703 1.1 christos {
704 1.1 christos IP2K_INSN_ANDW_FR, "andw_fr", "and", 16,
705 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
706 1.1 christos },
707 1.1 christos /* or $fr,W */
708 1.1 christos {
709 1.1 christos IP2K_INSN_ORFR_W, "orfr_w", "or", 16,
710 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
711 1.1 christos },
712 1.1 christos /* or W,$fr */
713 1.1 christos {
714 1.1 christos IP2K_INSN_ORW_FR, "orw_fr", "or", 16,
715 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
716 1.1 christos },
717 1.1 christos /* dec $fr */
718 1.1 christos {
719 1.1 christos IP2K_INSN_DEC_FR, "dec_fr", "dec", 16,
720 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
721 1.1 christos },
722 1.1 christos /* dec W,$fr */
723 1.1 christos {
724 1.1 christos IP2K_INSN_DECW_FR, "decw_fr", "dec", 16,
725 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
726 1.1 christos },
727 1.1 christos /* sub $fr,W */
728 1.1 christos {
729 1.1 christos IP2K_INSN_SUBFR_W, "subfr_w", "sub", 16,
730 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
731 1.1 christos },
732 1.1 christos /* sub W,$fr */
733 1.1 christos {
734 1.1 christos IP2K_INSN_SUBW_FR, "subw_fr", "sub", 16,
735 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
736 1.1 christos },
737 1.1 christos /* clr $fr */
738 1.1 christos {
739 1.1 christos IP2K_INSN_CLR_FR, "clr_fr", "clr", 16,
740 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
741 1.1 christos },
742 1.1 christos /* cmp W,$fr */
743 1.1 christos {
744 1.1 christos IP2K_INSN_CMPW_FR, "cmpw_fr", "cmp", 16,
745 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
746 1.1 christos },
747 1.1 christos /* speed #$lit8 */
748 1.1 christos {
749 1.1 christos IP2K_INSN_SPEED, "speed", "speed", 16,
750 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
751 1.1 christos },
752 1.1 christos /* ireadi */
753 1.1 christos {
754 1.1 christos IP2K_INSN_IREADI, "ireadi", "ireadi", 16,
755 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
756 1.1 christos },
757 1.1 christos /* iwritei */
758 1.1 christos {
759 1.1 christos IP2K_INSN_IWRITEI, "iwritei", "iwritei", 16,
760 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
761 1.1 christos },
762 1.1 christos /* fread */
763 1.1 christos {
764 1.1 christos IP2K_INSN_FREAD, "fread", "fread", 16,
765 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
766 1.1 christos },
767 1.1 christos /* fwrite */
768 1.1 christos {
769 1.1 christos IP2K_INSN_FWRITE, "fwrite", "fwrite", 16,
770 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
771 1.1 christos },
772 1.1 christos /* iread */
773 1.1 christos {
774 1.1 christos IP2K_INSN_IREAD, "iread", "iread", 16,
775 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
776 1.1 christos },
777 1.1 christos /* iwrite */
778 1.1 christos {
779 1.1 christos IP2K_INSN_IWRITE, "iwrite", "iwrite", 16,
780 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
781 1.1 christos },
782 1.1 christos /* page $addr16p */
783 1.1 christos {
784 1.1 christos IP2K_INSN_PAGE, "page", "page", 16,
785 1.1 christos { 0|A(EXT_SKIP_INSN), { { { (1<<MACH_BASE), 0 } } } }
786 1.1 christos },
787 1.1 christos /* system */
788 1.1 christos {
789 1.1 christos IP2K_INSN_SYSTEM, "system", "system", 16,
790 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
791 1.1 christos },
792 1.1 christos /* reti #$reti3 */
793 1.1 christos {
794 1.1 christos IP2K_INSN_RETI, "reti", "reti", 16,
795 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
796 1.1 christos },
797 1.1 christos /* ret */
798 1.1 christos {
799 1.1 christos IP2K_INSN_RET, "ret", "ret", 16,
800 1.1 christos { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
801 1.1 christos },
802 1.1 christos /* int */
803 1.1 christos {
804 1.1 christos IP2K_INSN_INT, "int", "int", 16,
805 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
806 1.1 christos },
807 1.1 christos /* breakx */
808 1.1 christos {
809 1.1 christos IP2K_INSN_BREAKX, "breakx", "breakx", 16,
810 1.1 christos { 0|A(EXT_SKIP_INSN), { { { (1<<MACH_BASE), 0 } } } }
811 1.1 christos },
812 1.1 christos /* cwdt */
813 1.1 christos {
814 1.1 christos IP2K_INSN_CWDT, "cwdt", "cwdt", 16,
815 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
816 1.1 christos },
817 1.1 christos /* ferase */
818 1.1 christos {
819 1.1 christos IP2K_INSN_FERASE, "ferase", "ferase", 16,
820 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
821 1.1 christos },
822 1.1 christos /* retnp */
823 1.1 christos {
824 1.1 christos IP2K_INSN_RETNP, "retnp", "retnp", 16,
825 1.1 christos { 0|A(UNCOND_CTI), { { { (1<<MACH_BASE), 0 } } } }
826 1.1 christos },
827 1.1 christos /* break */
828 1.1 christos {
829 1.1 christos IP2K_INSN_BREAK, "break", "break", 16,
830 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
831 1.1 christos },
832 1.1 christos /* nop */
833 1.1 christos {
834 1.1 christos IP2K_INSN_NOP, "nop", "nop", 16,
835 1.1 christos { 0, { { { (1<<MACH_BASE), 0 } } } }
836 1.1 christos },
837 1.1 christos };
838 1.1 christos
839 1.1 christos #undef OP
840 1.1 christos #undef A
841 1.1 christos
842 1.1 christos /* Initialize anything needed to be done once, before any cpu_open call. */
843 1.1 christos
844 1.1 christos static void
845 1.1 christos init_tables (void)
846 1.1 christos {
847 1.1 christos }
848 1.1 christos
849 1.1.1.5 christos #ifndef opcodes_error_handler
850 1.1.1.5 christos #define opcodes_error_handler(...) \
851 1.1.1.5 christos fprintf (stderr, __VA_ARGS__); fputc ('\n', stderr)
852 1.1.1.5 christos #endif
853 1.1.1.5 christos
854 1.1 christos static const CGEN_MACH * lookup_mach_via_bfd_name (const CGEN_MACH *, const char *);
855 1.1 christos static void build_hw_table (CGEN_CPU_TABLE *);
856 1.1 christos static void build_ifield_table (CGEN_CPU_TABLE *);
857 1.1 christos static void build_operand_table (CGEN_CPU_TABLE *);
858 1.1 christos static void build_insn_table (CGEN_CPU_TABLE *);
859 1.1 christos static void ip2k_cgen_rebuild_tables (CGEN_CPU_TABLE *);
860 1.1 christos
861 1.1 christos /* Subroutine of ip2k_cgen_cpu_open to look up a mach via its bfd name. */
862 1.1 christos
863 1.1 christos static const CGEN_MACH *
864 1.1 christos lookup_mach_via_bfd_name (const CGEN_MACH *table, const char *name)
865 1.1 christos {
866 1.1 christos while (table->name)
867 1.1 christos {
868 1.1 christos if (strcmp (name, table->bfd_name) == 0)
869 1.1 christos return table;
870 1.1 christos ++table;
871 1.1 christos }
872 1.1.1.4 christos return NULL;
873 1.1 christos }
874 1.1 christos
875 1.1 christos /* Subroutine of ip2k_cgen_cpu_open to build the hardware table. */
876 1.1 christos
877 1.1 christos static void
878 1.1 christos build_hw_table (CGEN_CPU_TABLE *cd)
879 1.1 christos {
880 1.1 christos int i;
881 1.1 christos int machs = cd->machs;
882 1.1 christos const CGEN_HW_ENTRY *init = & ip2k_cgen_hw_table[0];
883 1.1 christos /* MAX_HW is only an upper bound on the number of selected entries.
884 1.1 christos However each entry is indexed by it's enum so there can be holes in
885 1.1 christos the table. */
886 1.1 christos const CGEN_HW_ENTRY **selected =
887 1.1 christos (const CGEN_HW_ENTRY **) xmalloc (MAX_HW * sizeof (CGEN_HW_ENTRY *));
888 1.1 christos
889 1.1 christos cd->hw_table.init_entries = init;
890 1.1 christos cd->hw_table.entry_size = sizeof (CGEN_HW_ENTRY);
891 1.1 christos memset (selected, 0, MAX_HW * sizeof (CGEN_HW_ENTRY *));
892 1.1 christos /* ??? For now we just use machs to determine which ones we want. */
893 1.1 christos for (i = 0; init[i].name != NULL; ++i)
894 1.1 christos if (CGEN_HW_ATTR_VALUE (&init[i], CGEN_HW_MACH)
895 1.1 christos & machs)
896 1.1 christos selected[init[i].type] = &init[i];
897 1.1 christos cd->hw_table.entries = selected;
898 1.1 christos cd->hw_table.num_entries = MAX_HW;
899 1.1 christos }
900 1.1 christos
901 1.1 christos /* Subroutine of ip2k_cgen_cpu_open to build the hardware table. */
902 1.1 christos
903 1.1 christos static void
904 1.1 christos build_ifield_table (CGEN_CPU_TABLE *cd)
905 1.1 christos {
906 1.1 christos cd->ifld_table = & ip2k_cgen_ifld_table[0];
907 1.1 christos }
908 1.1 christos
909 1.1 christos /* Subroutine of ip2k_cgen_cpu_open to build the hardware table. */
910 1.1 christos
911 1.1 christos static void
912 1.1 christos build_operand_table (CGEN_CPU_TABLE *cd)
913 1.1 christos {
914 1.1 christos int i;
915 1.1 christos int machs = cd->machs;
916 1.1 christos const CGEN_OPERAND *init = & ip2k_cgen_operand_table[0];
917 1.1 christos /* MAX_OPERANDS is only an upper bound on the number of selected entries.
918 1.1 christos However each entry is indexed by it's enum so there can be holes in
919 1.1 christos the table. */
920 1.1 christos const CGEN_OPERAND **selected = xmalloc (MAX_OPERANDS * sizeof (* selected));
921 1.1 christos
922 1.1 christos cd->operand_table.init_entries = init;
923 1.1 christos cd->operand_table.entry_size = sizeof (CGEN_OPERAND);
924 1.1 christos memset (selected, 0, MAX_OPERANDS * sizeof (CGEN_OPERAND *));
925 1.1 christos /* ??? For now we just use mach to determine which ones we want. */
926 1.1 christos for (i = 0; init[i].name != NULL; ++i)
927 1.1 christos if (CGEN_OPERAND_ATTR_VALUE (&init[i], CGEN_OPERAND_MACH)
928 1.1 christos & machs)
929 1.1 christos selected[init[i].type] = &init[i];
930 1.1 christos cd->operand_table.entries = selected;
931 1.1 christos cd->operand_table.num_entries = MAX_OPERANDS;
932 1.1 christos }
933 1.1 christos
934 1.1 christos /* Subroutine of ip2k_cgen_cpu_open to build the hardware table.
935 1.1 christos ??? This could leave out insns not supported by the specified mach/isa,
936 1.1 christos but that would cause errors like "foo only supported by bar" to become
937 1.1 christos "unknown insn", so for now we include all insns and require the app to
938 1.1 christos do the checking later.
939 1.1 christos ??? On the other hand, parsing of such insns may require their hardware or
940 1.1 christos operand elements to be in the table [which they mightn't be]. */
941 1.1 christos
942 1.1 christos static void
943 1.1 christos build_insn_table (CGEN_CPU_TABLE *cd)
944 1.1 christos {
945 1.1 christos int i;
946 1.1 christos const CGEN_IBASE *ib = & ip2k_cgen_insn_table[0];
947 1.1 christos CGEN_INSN *insns = xmalloc (MAX_INSNS * sizeof (CGEN_INSN));
948 1.1 christos
949 1.1 christos memset (insns, 0, MAX_INSNS * sizeof (CGEN_INSN));
950 1.1 christos for (i = 0; i < MAX_INSNS; ++i)
951 1.1 christos insns[i].base = &ib[i];
952 1.1 christos cd->insn_table.init_entries = insns;
953 1.1 christos cd->insn_table.entry_size = sizeof (CGEN_IBASE);
954 1.1 christos cd->insn_table.num_init_entries = MAX_INSNS;
955 1.1 christos }
956 1.1 christos
957 1.1 christos /* Subroutine of ip2k_cgen_cpu_open to rebuild the tables. */
958 1.1 christos
959 1.1 christos static void
960 1.1 christos ip2k_cgen_rebuild_tables (CGEN_CPU_TABLE *cd)
961 1.1 christos {
962 1.1 christos int i;
963 1.1 christos CGEN_BITSET *isas = cd->isas;
964 1.1 christos unsigned int machs = cd->machs;
965 1.1 christos
966 1.1 christos cd->int_insn_p = CGEN_INT_INSN_P;
967 1.1 christos
968 1.1 christos /* Data derived from the isa spec. */
969 1.1 christos #define UNSET (CGEN_SIZE_UNKNOWN + 1)
970 1.1 christos cd->default_insn_bitsize = UNSET;
971 1.1 christos cd->base_insn_bitsize = UNSET;
972 1.1 christos cd->min_insn_bitsize = 65535; /* Some ridiculously big number. */
973 1.1 christos cd->max_insn_bitsize = 0;
974 1.1 christos for (i = 0; i < MAX_ISAS; ++i)
975 1.1 christos if (cgen_bitset_contains (isas, i))
976 1.1 christos {
977 1.1 christos const CGEN_ISA *isa = & ip2k_cgen_isa_table[i];
978 1.1 christos
979 1.1 christos /* Default insn sizes of all selected isas must be
980 1.1 christos equal or we set the result to 0, meaning "unknown". */
981 1.1 christos if (cd->default_insn_bitsize == UNSET)
982 1.1 christos cd->default_insn_bitsize = isa->default_insn_bitsize;
983 1.1 christos else if (isa->default_insn_bitsize == cd->default_insn_bitsize)
984 1.1 christos ; /* This is ok. */
985 1.1 christos else
986 1.1 christos cd->default_insn_bitsize = CGEN_SIZE_UNKNOWN;
987 1.1 christos
988 1.1 christos /* Base insn sizes of all selected isas must be equal
989 1.1 christos or we set the result to 0, meaning "unknown". */
990 1.1 christos if (cd->base_insn_bitsize == UNSET)
991 1.1 christos cd->base_insn_bitsize = isa->base_insn_bitsize;
992 1.1 christos else if (isa->base_insn_bitsize == cd->base_insn_bitsize)
993 1.1 christos ; /* This is ok. */
994 1.1 christos else
995 1.1 christos cd->base_insn_bitsize = CGEN_SIZE_UNKNOWN;
996 1.1 christos
997 1.1 christos /* Set min,max insn sizes. */
998 1.1 christos if (isa->min_insn_bitsize < cd->min_insn_bitsize)
999 1.1 christos cd->min_insn_bitsize = isa->min_insn_bitsize;
1000 1.1 christos if (isa->max_insn_bitsize > cd->max_insn_bitsize)
1001 1.1 christos cd->max_insn_bitsize = isa->max_insn_bitsize;
1002 1.1 christos }
1003 1.1 christos
1004 1.1 christos /* Data derived from the mach spec. */
1005 1.1 christos for (i = 0; i < MAX_MACHS; ++i)
1006 1.1 christos if (((1 << i) & machs) != 0)
1007 1.1 christos {
1008 1.1 christos const CGEN_MACH *mach = & ip2k_cgen_mach_table[i];
1009 1.1 christos
1010 1.1 christos if (mach->insn_chunk_bitsize != 0)
1011 1.1 christos {
1012 1.1 christos if (cd->insn_chunk_bitsize != 0 && cd->insn_chunk_bitsize != mach->insn_chunk_bitsize)
1013 1.1 christos {
1014 1.1.1.5 christos opcodes_error_handler
1015 1.1.1.5 christos (/* xgettext:c-format */
1016 1.1.1.5 christos _("internal error: ip2k_cgen_rebuild_tables: "
1017 1.1.1.5 christos "conflicting insn-chunk-bitsize values: `%d' vs. `%d'"),
1018 1.1.1.5 christos cd->insn_chunk_bitsize, mach->insn_chunk_bitsize);
1019 1.1 christos abort ();
1020 1.1 christos }
1021 1.1 christos
1022 1.1 christos cd->insn_chunk_bitsize = mach->insn_chunk_bitsize;
1023 1.1 christos }
1024 1.1 christos }
1025 1.1 christos
1026 1.1 christos /* Determine which hw elements are used by MACH. */
1027 1.1 christos build_hw_table (cd);
1028 1.1 christos
1029 1.1 christos /* Build the ifield table. */
1030 1.1 christos build_ifield_table (cd);
1031 1.1 christos
1032 1.1 christos /* Determine which operands are used by MACH/ISA. */
1033 1.1 christos build_operand_table (cd);
1034 1.1 christos
1035 1.1 christos /* Build the instruction table. */
1036 1.1 christos build_insn_table (cd);
1037 1.1 christos }
1038 1.1 christos
1039 1.1 christos /* Initialize a cpu table and return a descriptor.
1040 1.1 christos It's much like opening a file, and must be the first function called.
1041 1.1 christos The arguments are a set of (type/value) pairs, terminated with
1042 1.1 christos CGEN_CPU_OPEN_END.
1043 1.1 christos
1044 1.1 christos Currently supported values:
1045 1.1 christos CGEN_CPU_OPEN_ISAS: bitmap of values in enum isa_attr
1046 1.1 christos CGEN_CPU_OPEN_MACHS: bitmap of values in enum mach_attr
1047 1.1 christos CGEN_CPU_OPEN_BFDMACH: specify 1 mach using bfd name
1048 1.1 christos CGEN_CPU_OPEN_ENDIAN: specify endian choice
1049 1.1.1.6 christos CGEN_CPU_OPEN_INSN_ENDIAN: specify instruction endian choice
1050 1.1 christos CGEN_CPU_OPEN_END: terminates arguments
1051 1.1 christos
1052 1.1 christos ??? Simultaneous multiple isas might not make sense, but it's not (yet)
1053 1.1 christos precluded. */
1054 1.1 christos
1055 1.1 christos CGEN_CPU_DESC
1056 1.1 christos ip2k_cgen_cpu_open (enum cgen_cpu_open_arg arg_type, ...)
1057 1.1 christos {
1058 1.1 christos CGEN_CPU_TABLE *cd = (CGEN_CPU_TABLE *) xmalloc (sizeof (CGEN_CPU_TABLE));
1059 1.1 christos static int init_p;
1060 1.1 christos CGEN_BITSET *isas = 0; /* 0 = "unspecified" */
1061 1.1 christos unsigned int machs = 0; /* 0 = "unspecified" */
1062 1.1 christos enum cgen_endian endian = CGEN_ENDIAN_UNKNOWN;
1063 1.1.1.6 christos enum cgen_endian insn_endian = CGEN_ENDIAN_UNKNOWN;
1064 1.1 christos va_list ap;
1065 1.1 christos
1066 1.1 christos if (! init_p)
1067 1.1 christos {
1068 1.1 christos init_tables ();
1069 1.1 christos init_p = 1;
1070 1.1 christos }
1071 1.1 christos
1072 1.1 christos memset (cd, 0, sizeof (*cd));
1073 1.1 christos
1074 1.1 christos va_start (ap, arg_type);
1075 1.1 christos while (arg_type != CGEN_CPU_OPEN_END)
1076 1.1 christos {
1077 1.1 christos switch (arg_type)
1078 1.1 christos {
1079 1.1 christos case CGEN_CPU_OPEN_ISAS :
1080 1.1 christos isas = va_arg (ap, CGEN_BITSET *);
1081 1.1 christos break;
1082 1.1 christos case CGEN_CPU_OPEN_MACHS :
1083 1.1 christos machs = va_arg (ap, unsigned int);
1084 1.1 christos break;
1085 1.1 christos case CGEN_CPU_OPEN_BFDMACH :
1086 1.1 christos {
1087 1.1 christos const char *name = va_arg (ap, const char *);
1088 1.1 christos const CGEN_MACH *mach =
1089 1.1 christos lookup_mach_via_bfd_name (ip2k_cgen_mach_table, name);
1090 1.1 christos
1091 1.1.1.4 christos if (mach != NULL)
1092 1.1.1.4 christos machs |= 1 << mach->num;
1093 1.1 christos break;
1094 1.1 christos }
1095 1.1 christos case CGEN_CPU_OPEN_ENDIAN :
1096 1.1 christos endian = va_arg (ap, enum cgen_endian);
1097 1.1 christos break;
1098 1.1.1.6 christos case CGEN_CPU_OPEN_INSN_ENDIAN :
1099 1.1.1.6 christos insn_endian = va_arg (ap, enum cgen_endian);
1100 1.1.1.6 christos break;
1101 1.1 christos default :
1102 1.1.1.5 christos opcodes_error_handler
1103 1.1.1.5 christos (/* xgettext:c-format */
1104 1.1.1.5 christos _("internal error: ip2k_cgen_cpu_open: "
1105 1.1.1.5 christos "unsupported argument `%d'"),
1106 1.1.1.5 christos arg_type);
1107 1.1 christos abort (); /* ??? return NULL? */
1108 1.1 christos }
1109 1.1 christos arg_type = va_arg (ap, enum cgen_cpu_open_arg);
1110 1.1 christos }
1111 1.1 christos va_end (ap);
1112 1.1 christos
1113 1.1 christos /* Mach unspecified means "all". */
1114 1.1 christos if (machs == 0)
1115 1.1 christos machs = (1 << MAX_MACHS) - 1;
1116 1.1 christos /* Base mach is always selected. */
1117 1.1 christos machs |= 1;
1118 1.1 christos if (endian == CGEN_ENDIAN_UNKNOWN)
1119 1.1 christos {
1120 1.1 christos /* ??? If target has only one, could have a default. */
1121 1.1.1.5 christos opcodes_error_handler
1122 1.1.1.5 christos (/* xgettext:c-format */
1123 1.1.1.5 christos _("internal error: ip2k_cgen_cpu_open: no endianness specified"));
1124 1.1 christos abort ();
1125 1.1 christos }
1126 1.1 christos
1127 1.1 christos cd->isas = cgen_bitset_copy (isas);
1128 1.1 christos cd->machs = machs;
1129 1.1 christos cd->endian = endian;
1130 1.1.1.6 christos cd->insn_endian
1131 1.1.1.6 christos = (insn_endian == CGEN_ENDIAN_UNKNOWN ? endian : insn_endian);
1132 1.1 christos
1133 1.1 christos /* Table (re)builder. */
1134 1.1 christos cd->rebuild_tables = ip2k_cgen_rebuild_tables;
1135 1.1 christos ip2k_cgen_rebuild_tables (cd);
1136 1.1 christos
1137 1.1 christos /* Default to not allowing signed overflow. */
1138 1.1 christos cd->signed_overflow_ok_p = 0;
1139 1.1.1.3 christos
1140 1.1 christos return (CGEN_CPU_DESC) cd;
1141 1.1 christos }
1142 1.1 christos
1143 1.1 christos /* Cover fn to ip2k_cgen_cpu_open to handle the simple case of 1 isa, 1 mach.
1144 1.1 christos MACH_NAME is the bfd name of the mach. */
1145 1.1 christos
1146 1.1 christos CGEN_CPU_DESC
1147 1.1 christos ip2k_cgen_cpu_open_1 (const char *mach_name, enum cgen_endian endian)
1148 1.1 christos {
1149 1.1 christos return ip2k_cgen_cpu_open (CGEN_CPU_OPEN_BFDMACH, mach_name,
1150 1.1 christos CGEN_CPU_OPEN_ENDIAN, endian,
1151 1.1 christos CGEN_CPU_OPEN_END);
1152 1.1 christos }
1153 1.1 christos
1154 1.1 christos /* Close a cpu table.
1155 1.1 christos ??? This can live in a machine independent file, but there's currently
1156 1.1 christos no place to put this file (there's no libcgen). libopcodes is the wrong
1157 1.1 christos place as some simulator ports use this but they don't use libopcodes. */
1158 1.1 christos
1159 1.1 christos void
1160 1.1 christos ip2k_cgen_cpu_close (CGEN_CPU_DESC cd)
1161 1.1 christos {
1162 1.1 christos unsigned int i;
1163 1.1 christos const CGEN_INSN *insns;
1164 1.1 christos
1165 1.1 christos if (cd->macro_insn_table.init_entries)
1166 1.1 christos {
1167 1.1 christos insns = cd->macro_insn_table.init_entries;
1168 1.1 christos for (i = 0; i < cd->macro_insn_table.num_init_entries; ++i, ++insns)
1169 1.1 christos if (CGEN_INSN_RX ((insns)))
1170 1.1 christos regfree (CGEN_INSN_RX (insns));
1171 1.1 christos }
1172 1.1 christos
1173 1.1 christos if (cd->insn_table.init_entries)
1174 1.1 christos {
1175 1.1 christos insns = cd->insn_table.init_entries;
1176 1.1 christos for (i = 0; i < cd->insn_table.num_init_entries; ++i, ++insns)
1177 1.1 christos if (CGEN_INSN_RX (insns))
1178 1.1 christos regfree (CGEN_INSN_RX (insns));
1179 1.1.1.3 christos }
1180 1.1 christos
1181 1.1.1.6 christos free ((CGEN_INSN *) cd->macro_insn_table.init_entries);
1182 1.1.1.6 christos free ((CGEN_INSN *) cd->insn_table.init_entries);
1183 1.1.1.6 christos free ((CGEN_HW_ENTRY *) cd->hw_table.entries);
1184 1.1.1.6 christos free ((CGEN_HW_ENTRY *) cd->operand_table.entries);
1185 1.1 christos free (cd);
1186 1.1 christos }
1187 1.1 christos
1188