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