1 /* Instruction opcode table for or1k.
2
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
4
5 Copyright (C) 1996-2016 Free Software Foundation, Inc.
6
7 This file is part of the GNU Binutils and/or GDB, the GNU debugger.
8
9 This file is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
13
14 It is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
18
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
22
23 */
24
25 #include "sysdep.h"
26 #include "ansidecl.h"
27 #include "bfd.h"
28 #include "symcat.h"
29 #include "or1k-desc.h"
30 #include "or1k-opc.h"
31 #include "libiberty.h"
32
33 /* -- opc.c */
34 /* -- */
35 /* The hash functions are recorded here to help keep assembler code out of
36 the disassembler and vice versa. */
37
38 static int asm_hash_insn_p (const CGEN_INSN *);
39 static unsigned int asm_hash_insn (const char *);
40 static int dis_hash_insn_p (const CGEN_INSN *);
41 static unsigned int dis_hash_insn (const char *, CGEN_INSN_INT);
42
43 /* Instruction formats. */
44
45 #define F(f) & or1k_cgen_ifld_table[OR1K_##f]
46 static const CGEN_IFMT ifmt_empty ATTRIBUTE_UNUSED = {
47 0, 0, 0x0, { { 0 } }
48 };
49
50 static const CGEN_IFMT ifmt_l_j ATTRIBUTE_UNUSED = {
51 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_DISP26) }, { 0 } }
52 };
53
54 static const CGEN_IFMT ifmt_l_jr ATTRIBUTE_UNUSED = {
55 32, 32, 0xffff07ff, { { F (F_OPCODE) }, { F (F_RESV_25_10) }, { F (F_R3) }, { F (F_RESV_10_11) }, { 0 } }
56 };
57
58 static const CGEN_IFMT ifmt_l_trap ATTRIBUTE_UNUSED = {
59 32, 32, 0xffff0000, { { F (F_OPCODE) }, { F (F_OP_25_5) }, { F (F_RESV_20_5) }, { F (F_UIMM16) }, { 0 } }
60 };
61
62 static const CGEN_IFMT ifmt_l_msync ATTRIBUTE_UNUSED = {
63 32, 32, 0xffffffff, { { F (F_OPCODE) }, { F (F_OP_25_5) }, { F (F_RESV_20_21) }, { 0 } }
64 };
65
66 static const CGEN_IFMT ifmt_l_rfe ATTRIBUTE_UNUSED = {
67 32, 32, 0xffffffff, { { F (F_OPCODE) }, { F (F_RESV_25_26) }, { 0 } }
68 };
69
70 static const CGEN_IFMT ifmt_l_nop_imm ATTRIBUTE_UNUSED = {
71 32, 32, 0xffff0000, { { F (F_OPCODE) }, { F (F_OP_25_2) }, { F (F_RESV_23_8) }, { F (F_UIMM16) }, { 0 } }
72 };
73
74 static const CGEN_IFMT ifmt_l_movhi ATTRIBUTE_UNUSED = {
75 32, 32, 0xfc1f0000, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_RESV_20_4) }, { F (F_OP_16_1) }, { F (F_UIMM16) }, { 0 } }
76 };
77
78 static const CGEN_IFMT ifmt_l_macrc ATTRIBUTE_UNUSED = {
79 32, 32, 0xfc1fffff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_RESV_20_4) }, { F (F_OP_16_1) }, { F (F_UIMM16) }, { 0 } }
80 };
81
82 static const CGEN_IFMT ifmt_l_mfspr ATTRIBUTE_UNUSED = {
83 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
84 };
85
86 static const CGEN_IFMT ifmt_l_mtspr ATTRIBUTE_UNUSED = {
87 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_R2) }, { F (F_R3) }, { F (F_UIMM16_SPLIT) }, { 0 } }
88 };
89
90 static const CGEN_IFMT ifmt_l_lwz ATTRIBUTE_UNUSED = {
91 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
92 };
93
94 static const CGEN_IFMT ifmt_l_sw ATTRIBUTE_UNUSED = {
95 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_R2) }, { F (F_R3) }, { F (F_SIMM16_SPLIT) }, { 0 } }
96 };
97
98 static const CGEN_IFMT ifmt_l_swa ATTRIBUTE_UNUSED = {
99 32, 32, 0xfc000000, { { F (F_OPCODE) }, { F (F_R2) }, { F (F_R3) }, { F (F_SIMM16) }, { 0 } }
100 };
101
102 static const CGEN_IFMT ifmt_l_sll ATTRIBUTE_UNUSED = {
103 32, 32, 0xfc0007ff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_3) }, { F (F_OP_7_2) }, { F (F_RESV_5_2) }, { F (F_OP_3_4) }, { 0 } }
104 };
105
106 static const CGEN_IFMT ifmt_l_slli ATTRIBUTE_UNUSED = {
107 32, 32, 0xfc00ffc0, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_RESV_15_8) }, { F (F_OP_7_2) }, { F (F_UIMM6) }, { 0 } }
108 };
109
110 static const CGEN_IFMT ifmt_l_and ATTRIBUTE_UNUSED = {
111 32, 32, 0xfc0007ff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_7) }, { F (F_OP_3_4) }, { 0 } }
112 };
113
114 static const CGEN_IFMT ifmt_l_exths ATTRIBUTE_UNUSED = {
115 32, 32, 0xfc00ffff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_RESV_15_6) }, { F (F_OP_9_4) }, { F (F_RESV_5_2) }, { F (F_OP_3_4) }, { 0 } }
116 };
117
118 static const CGEN_IFMT ifmt_l_cmov ATTRIBUTE_UNUSED = {
119 32, 32, 0xfc0007ff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_1) }, { F (F_OP_9_2) }, { F (F_RESV_7_4) }, { F (F_OP_3_4) }, { 0 } }
120 };
121
122 static const CGEN_IFMT ifmt_l_sfgts ATTRIBUTE_UNUSED = {
123 32, 32, 0xffe007ff, { { F (F_OPCODE) }, { F (F_OP_25_5) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_11) }, { 0 } }
124 };
125
126 static const CGEN_IFMT ifmt_l_sfgtsi ATTRIBUTE_UNUSED = {
127 32, 32, 0xffe00000, { { F (F_OPCODE) }, { F (F_OP_25_5) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
128 };
129
130 static const CGEN_IFMT ifmt_l_mac ATTRIBUTE_UNUSED = {
131 32, 32, 0xffe007ff, { { F (F_OPCODE) }, { F (F_OP_25_5) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_7) }, { F (F_OP_3_4) }, { 0 } }
132 };
133
134 static const CGEN_IFMT ifmt_l_maci ATTRIBUTE_UNUSED = {
135 32, 32, 0xffe00000, { { F (F_OPCODE) }, { F (F_RESV_25_5) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
136 };
137
138 static const CGEN_IFMT ifmt_lf_add_s ATTRIBUTE_UNUSED = {
139 32, 32, 0xfc0007ff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
140 };
141
142 static const CGEN_IFMT ifmt_lf_add_d ATTRIBUTE_UNUSED = {
143 32, 32, 0xfc0007ff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R1) }, { F (F_R1) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
144 };
145
146 static const CGEN_IFMT ifmt_lf_itof_s ATTRIBUTE_UNUSED = {
147 32, 32, 0xfc00ffff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
148 };
149
150 static const CGEN_IFMT ifmt_lf_ftoi_s ATTRIBUTE_UNUSED = {
151 32, 32, 0xfc00ffff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
152 };
153
154 static const CGEN_IFMT ifmt_lf_ftoi_d ATTRIBUTE_UNUSED = {
155 32, 32, 0xfc00ffff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R1) }, { F (F_R3) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
156 };
157
158 static const CGEN_IFMT ifmt_lf_eq_s ATTRIBUTE_UNUSED = {
159 32, 32, 0xffe007ff, { { F (F_OPCODE) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
160 };
161
162 static const CGEN_IFMT ifmt_lf_cust1_s ATTRIBUTE_UNUSED = {
163 32, 32, 0xffe007ff, { { F (F_OPCODE) }, { F (F_RESV_25_5) }, { F (F_R2) }, { F (F_R3) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
164 };
165
166 static const CGEN_IFMT ifmt_lf_cust1_d ATTRIBUTE_UNUSED = {
167 32, 32, 0xffe007ff, { { F (F_OPCODE) }, { F (F_RESV_25_5) }, { F (F_R1) }, { F (F_R1) }, { F (F_RESV_10_3) }, { F (F_OP_7_8) }, { 0 } }
168 };
169
170 #undef F
171
172 #define A(a) (1 << CGEN_INSN_##a)
173 #define OPERAND(op) OR1K_OPERAND_##op
174 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
175 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
176
177 /* The instruction table. */
178
179 static const CGEN_OPCODE or1k_cgen_insn_opcode_table[MAX_INSNS] =
180 {
181 /* Special null first entry.
182 A `num' value of zero is thus invalid.
183 Also, the special `invalid' insn resides here. */
184 { { 0, 0, 0, 0 }, {{0}}, 0, {0}},
185 /* l.j ${disp26} */
186 {
187 { 0, 0, 0, 0 },
188 { { MNEM, ' ', OP (DISP26), 0 } },
189 & ifmt_l_j, { 0x0 }
190 },
191 /* l.jal ${disp26} */
192 {
193 { 0, 0, 0, 0 },
194 { { MNEM, ' ', OP (DISP26), 0 } },
195 & ifmt_l_j, { 0x4000000 }
196 },
197 /* l.jr $rB */
198 {
199 { 0, 0, 0, 0 },
200 { { MNEM, ' ', OP (RB), 0 } },
201 & ifmt_l_jr, { 0x44000000 }
202 },
203 /* l.jalr $rB */
204 {
205 { 0, 0, 0, 0 },
206 { { MNEM, ' ', OP (RB), 0 } },
207 & ifmt_l_jr, { 0x48000000 }
208 },
209 /* l.bnf ${disp26} */
210 {
211 { 0, 0, 0, 0 },
212 { { MNEM, ' ', OP (DISP26), 0 } },
213 & ifmt_l_j, { 0xc000000 }
214 },
215 /* l.bf ${disp26} */
216 {
217 { 0, 0, 0, 0 },
218 { { MNEM, ' ', OP (DISP26), 0 } },
219 & ifmt_l_j, { 0x10000000 }
220 },
221 /* l.trap ${uimm16} */
222 {
223 { 0, 0, 0, 0 },
224 { { MNEM, ' ', OP (UIMM16), 0 } },
225 & ifmt_l_trap, { 0x21000000 }
226 },
227 /* l.sys ${uimm16} */
228 {
229 { 0, 0, 0, 0 },
230 { { MNEM, ' ', OP (UIMM16), 0 } },
231 & ifmt_l_trap, { 0x20000000 }
232 },
233 /* l.msync */
234 {
235 { 0, 0, 0, 0 },
236 { { MNEM, 0 } },
237 & ifmt_l_msync, { 0x22000000 }
238 },
239 /* l.psync */
240 {
241 { 0, 0, 0, 0 },
242 { { MNEM, 0 } },
243 & ifmt_l_msync, { 0x22800000 }
244 },
245 /* l.csync */
246 {
247 { 0, 0, 0, 0 },
248 { { MNEM, 0 } },
249 & ifmt_l_msync, { 0x23000000 }
250 },
251 /* l.rfe */
252 {
253 { 0, 0, 0, 0 },
254 { { MNEM, 0 } },
255 & ifmt_l_rfe, { 0x24000000 }
256 },
257 /* l.nop ${uimm16} */
258 {
259 { 0, 0, 0, 0 },
260 { { MNEM, ' ', OP (UIMM16), 0 } },
261 & ifmt_l_nop_imm, { 0x15000000 }
262 },
263 /* l.nop */
264 {
265 { 0, 0, 0, 0 },
266 { { MNEM, 0 } },
267 & ifmt_l_nop_imm, { 0x15000000 }
268 },
269 /* l.movhi $rD,$uimm16 */
270 {
271 { 0, 0, 0, 0 },
272 { { MNEM, ' ', OP (RD), ',', OP (UIMM16), 0 } },
273 & ifmt_l_movhi, { 0x18000000 }
274 },
275 /* l.macrc $rD */
276 {
277 { 0, 0, 0, 0 },
278 { { MNEM, ' ', OP (RD), 0 } },
279 & ifmt_l_macrc, { 0x18010000 }
280 },
281 /* l.mfspr $rD,$rA,${uimm16} */
282 {
283 { 0, 0, 0, 0 },
284 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM16), 0 } },
285 & ifmt_l_mfspr, { 0xb4000000 }
286 },
287 /* l.mtspr $rA,$rB,${uimm16-split} */
288 {
289 { 0, 0, 0, 0 },
290 { { MNEM, ' ', OP (RA), ',', OP (RB), ',', OP (UIMM16_SPLIT), 0 } },
291 & ifmt_l_mtspr, { 0xc0000000 }
292 },
293 /* l.lwz $rD,${simm16}($rA) */
294 {
295 { 0, 0, 0, 0 },
296 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
297 & ifmt_l_lwz, { 0x84000000 }
298 },
299 /* l.lws $rD,${simm16}($rA) */
300 {
301 { 0, 0, 0, 0 },
302 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
303 & ifmt_l_lwz, { 0x88000000 }
304 },
305 /* l.lwa $rD,${simm16}($rA) */
306 {
307 { 0, 0, 0, 0 },
308 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
309 & ifmt_l_lwz, { 0x6c000000 }
310 },
311 /* l.lbz $rD,${simm16}($rA) */
312 {
313 { 0, 0, 0, 0 },
314 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
315 & ifmt_l_lwz, { 0x8c000000 }
316 },
317 /* l.lbs $rD,${simm16}($rA) */
318 {
319 { 0, 0, 0, 0 },
320 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
321 & ifmt_l_lwz, { 0x90000000 }
322 },
323 /* l.lhz $rD,${simm16}($rA) */
324 {
325 { 0, 0, 0, 0 },
326 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
327 & ifmt_l_lwz, { 0x94000000 }
328 },
329 /* l.lhs $rD,${simm16}($rA) */
330 {
331 { 0, 0, 0, 0 },
332 { { MNEM, ' ', OP (RD), ',', OP (SIMM16), '(', OP (RA), ')', 0 } },
333 & ifmt_l_lwz, { 0x98000000 }
334 },
335 /* l.sw ${simm16-split}($rA),$rB */
336 {
337 { 0, 0, 0, 0 },
338 { { MNEM, ' ', OP (SIMM16_SPLIT), '(', OP (RA), ')', ',', OP (RB), 0 } },
339 & ifmt_l_sw, { 0xd4000000 }
340 },
341 /* l.sb ${simm16-split}($rA),$rB */
342 {
343 { 0, 0, 0, 0 },
344 { { MNEM, ' ', OP (SIMM16_SPLIT), '(', OP (RA), ')', ',', OP (RB), 0 } },
345 & ifmt_l_sw, { 0xd8000000 }
346 },
347 /* l.sh ${simm16-split}($rA),$rB */
348 {
349 { 0, 0, 0, 0 },
350 { { MNEM, ' ', OP (SIMM16_SPLIT), '(', OP (RA), ')', ',', OP (RB), 0 } },
351 & ifmt_l_sw, { 0xdc000000 }
352 },
353 /* l.swa ${simm16-split}($rA),$rB */
354 {
355 { 0, 0, 0, 0 },
356 { { MNEM, ' ', OP (SIMM16_SPLIT), '(', OP (RA), ')', ',', OP (RB), 0 } },
357 & ifmt_l_swa, { 0xcc000000 }
358 },
359 /* l.sll $rD,$rA,$rB */
360 {
361 { 0, 0, 0, 0 },
362 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
363 & ifmt_l_sll, { 0xe0000008 }
364 },
365 /* l.slli $rD,$rA,${uimm6} */
366 {
367 { 0, 0, 0, 0 },
368 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM6), 0 } },
369 & ifmt_l_slli, { 0xb8000000 }
370 },
371 /* l.srl $rD,$rA,$rB */
372 {
373 { 0, 0, 0, 0 },
374 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
375 & ifmt_l_sll, { 0xe0000048 }
376 },
377 /* l.srli $rD,$rA,${uimm6} */
378 {
379 { 0, 0, 0, 0 },
380 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM6), 0 } },
381 & ifmt_l_slli, { 0xb8000040 }
382 },
383 /* l.sra $rD,$rA,$rB */
384 {
385 { 0, 0, 0, 0 },
386 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
387 & ifmt_l_sll, { 0xe0000088 }
388 },
389 /* l.srai $rD,$rA,${uimm6} */
390 {
391 { 0, 0, 0, 0 },
392 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM6), 0 } },
393 & ifmt_l_slli, { 0xb8000080 }
394 },
395 /* l.ror $rD,$rA,$rB */
396 {
397 { 0, 0, 0, 0 },
398 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
399 & ifmt_l_sll, { 0xe00000c8 }
400 },
401 /* l.rori $rD,$rA,${uimm6} */
402 {
403 { 0, 0, 0, 0 },
404 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM6), 0 } },
405 & ifmt_l_slli, { 0xb80000c0 }
406 },
407 /* l.and $rD,$rA,$rB */
408 {
409 { 0, 0, 0, 0 },
410 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
411 & ifmt_l_and, { 0xe0000003 }
412 },
413 /* l.or $rD,$rA,$rB */
414 {
415 { 0, 0, 0, 0 },
416 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
417 & ifmt_l_and, { 0xe0000004 }
418 },
419 /* l.xor $rD,$rA,$rB */
420 {
421 { 0, 0, 0, 0 },
422 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
423 & ifmt_l_and, { 0xe0000005 }
424 },
425 /* l.add $rD,$rA,$rB */
426 {
427 { 0, 0, 0, 0 },
428 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
429 & ifmt_l_and, { 0xe0000000 }
430 },
431 /* l.sub $rD,$rA,$rB */
432 {
433 { 0, 0, 0, 0 },
434 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
435 & ifmt_l_and, { 0xe0000002 }
436 },
437 /* l.addc $rD,$rA,$rB */
438 {
439 { 0, 0, 0, 0 },
440 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
441 & ifmt_l_and, { 0xe0000001 }
442 },
443 /* l.mul $rD,$rA,$rB */
444 {
445 { 0, 0, 0, 0 },
446 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
447 & ifmt_l_and, { 0xe0000306 }
448 },
449 /* l.mulu $rD,$rA,$rB */
450 {
451 { 0, 0, 0, 0 },
452 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
453 & ifmt_l_and, { 0xe000030b }
454 },
455 /* l.div $rD,$rA,$rB */
456 {
457 { 0, 0, 0, 0 },
458 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
459 & ifmt_l_and, { 0xe0000309 }
460 },
461 /* l.divu $rD,$rA,$rB */
462 {
463 { 0, 0, 0, 0 },
464 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
465 & ifmt_l_and, { 0xe000030a }
466 },
467 /* l.ff1 $rD,$rA */
468 {
469 { 0, 0, 0, 0 },
470 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
471 & ifmt_l_and, { 0xe000000f }
472 },
473 /* l.fl1 $rD,$rA */
474 {
475 { 0, 0, 0, 0 },
476 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
477 & ifmt_l_and, { 0xe000010f }
478 },
479 /* l.andi $rD,$rA,$uimm16 */
480 {
481 { 0, 0, 0, 0 },
482 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM16), 0 } },
483 & ifmt_l_mfspr, { 0xa4000000 }
484 },
485 /* l.ori $rD,$rA,$uimm16 */
486 {
487 { 0, 0, 0, 0 },
488 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM16), 0 } },
489 & ifmt_l_mfspr, { 0xa8000000 }
490 },
491 /* l.xori $rD,$rA,$simm16 */
492 {
493 { 0, 0, 0, 0 },
494 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (SIMM16), 0 } },
495 & ifmt_l_lwz, { 0xac000000 }
496 },
497 /* l.addi $rD,$rA,$simm16 */
498 {
499 { 0, 0, 0, 0 },
500 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (SIMM16), 0 } },
501 & ifmt_l_lwz, { 0x9c000000 }
502 },
503 /* l.addic $rD,$rA,$simm16 */
504 {
505 { 0, 0, 0, 0 },
506 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (SIMM16), 0 } },
507 & ifmt_l_lwz, { 0xa0000000 }
508 },
509 /* l.muli $rD,$rA,$simm16 */
510 {
511 { 0, 0, 0, 0 },
512 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (SIMM16), 0 } },
513 & ifmt_l_lwz, { 0xb0000000 }
514 },
515 /* l.exths $rD,$rA */
516 {
517 { 0, 0, 0, 0 },
518 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
519 & ifmt_l_exths, { 0xe000000c }
520 },
521 /* l.extbs $rD,$rA */
522 {
523 { 0, 0, 0, 0 },
524 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
525 & ifmt_l_exths, { 0xe000004c }
526 },
527 /* l.exthz $rD,$rA */
528 {
529 { 0, 0, 0, 0 },
530 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
531 & ifmt_l_exths, { 0xe000008c }
532 },
533 /* l.extbz $rD,$rA */
534 {
535 { 0, 0, 0, 0 },
536 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
537 & ifmt_l_exths, { 0xe00000cc }
538 },
539 /* l.extws $rD,$rA */
540 {
541 { 0, 0, 0, 0 },
542 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
543 & ifmt_l_exths, { 0xe000000d }
544 },
545 /* l.extwz $rD,$rA */
546 {
547 { 0, 0, 0, 0 },
548 { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
549 & ifmt_l_exths, { 0xe000004d }
550 },
551 /* l.cmov $rD,$rA,$rB */
552 {
553 { 0, 0, 0, 0 },
554 { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
555 & ifmt_l_cmov, { 0xe000000e }
556 },
557 /* l.sfgts $rA,$rB */
558 {
559 { 0, 0, 0, 0 },
560 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
561 & ifmt_l_sfgts, { 0xe5400000 }
562 },
563 /* l.sfgtsi $rA,$simm16 */
564 {
565 { 0, 0, 0, 0 },
566 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
567 & ifmt_l_sfgtsi, { 0xbd400000 }
568 },
569 /* l.sfgtu $rA,$rB */
570 {
571 { 0, 0, 0, 0 },
572 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
573 & ifmt_l_sfgts, { 0xe4400000 }
574 },
575 /* l.sfgtui $rA,$simm16 */
576 {
577 { 0, 0, 0, 0 },
578 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
579 & ifmt_l_sfgtsi, { 0xbc400000 }
580 },
581 /* l.sfges $rA,$rB */
582 {
583 { 0, 0, 0, 0 },
584 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
585 & ifmt_l_sfgts, { 0xe5600000 }
586 },
587 /* l.sfgesi $rA,$simm16 */
588 {
589 { 0, 0, 0, 0 },
590 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
591 & ifmt_l_sfgtsi, { 0xbd600000 }
592 },
593 /* l.sfgeu $rA,$rB */
594 {
595 { 0, 0, 0, 0 },
596 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
597 & ifmt_l_sfgts, { 0xe4600000 }
598 },
599 /* l.sfgeui $rA,$simm16 */
600 {
601 { 0, 0, 0, 0 },
602 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
603 & ifmt_l_sfgtsi, { 0xbc600000 }
604 },
605 /* l.sflts $rA,$rB */
606 {
607 { 0, 0, 0, 0 },
608 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
609 & ifmt_l_sfgts, { 0xe5800000 }
610 },
611 /* l.sfltsi $rA,$simm16 */
612 {
613 { 0, 0, 0, 0 },
614 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
615 & ifmt_l_sfgtsi, { 0xbd800000 }
616 },
617 /* l.sfltu $rA,$rB */
618 {
619 { 0, 0, 0, 0 },
620 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
621 & ifmt_l_sfgts, { 0xe4800000 }
622 },
623 /* l.sfltui $rA,$simm16 */
624 {
625 { 0, 0, 0, 0 },
626 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
627 & ifmt_l_sfgtsi, { 0xbc800000 }
628 },
629 /* l.sfles $rA,$rB */
630 {
631 { 0, 0, 0, 0 },
632 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
633 & ifmt_l_sfgts, { 0xe5a00000 }
634 },
635 /* l.sflesi $rA,$simm16 */
636 {
637 { 0, 0, 0, 0 },
638 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
639 & ifmt_l_sfgtsi, { 0xbda00000 }
640 },
641 /* l.sfleu $rA,$rB */
642 {
643 { 0, 0, 0, 0 },
644 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
645 & ifmt_l_sfgts, { 0xe4a00000 }
646 },
647 /* l.sfleui $rA,$simm16 */
648 {
649 { 0, 0, 0, 0 },
650 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
651 & ifmt_l_sfgtsi, { 0xbca00000 }
652 },
653 /* l.sfeq $rA,$rB */
654 {
655 { 0, 0, 0, 0 },
656 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
657 & ifmt_l_sfgts, { 0xe4000000 }
658 },
659 /* l.sfeqi $rA,$simm16 */
660 {
661 { 0, 0, 0, 0 },
662 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
663 & ifmt_l_sfgtsi, { 0xbc000000 }
664 },
665 /* l.sfne $rA,$rB */
666 {
667 { 0, 0, 0, 0 },
668 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
669 & ifmt_l_sfgts, { 0xe4200000 }
670 },
671 /* l.sfnei $rA,$simm16 */
672 {
673 { 0, 0, 0, 0 },
674 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
675 & ifmt_l_sfgtsi, { 0xbc200000 }
676 },
677 /* l.mac $rA,$rB */
678 {
679 { 0, 0, 0, 0 },
680 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
681 & ifmt_l_mac, { 0xc4000001 }
682 },
683 /* l.msb $rA,$rB */
684 {
685 { 0, 0, 0, 0 },
686 { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
687 & ifmt_l_mac, { 0xc4000002 }
688 },
689 /* l.maci $rA,${simm16} */
690 {
691 { 0, 0, 0, 0 },
692 { { MNEM, ' ', OP (RA), ',', OP (SIMM16), 0 } },
693 & ifmt_l_maci, { 0x4c000000 }
694 },
695 /* l.cust1 */
696 {
697 { 0, 0, 0, 0 },
698 { { MNEM, 0 } },
699 & ifmt_l_rfe, { 0x70000000 }
700 },
701 /* l.cust2 */
702 {
703 { 0, 0, 0, 0 },
704 { { MNEM, 0 } },
705 & ifmt_l_rfe, { 0x74000000 }
706 },
707 /* l.cust3 */
708 {
709 { 0, 0, 0, 0 },
710 { { MNEM, 0 } },
711 & ifmt_l_rfe, { 0x78000000 }
712 },
713 /* l.cust4 */
714 {
715 { 0, 0, 0, 0 },
716 { { MNEM, 0 } },
717 & ifmt_l_rfe, { 0x7c000000 }
718 },
719 /* l.cust5 */
720 {
721 { 0, 0, 0, 0 },
722 { { MNEM, 0 } },
723 & ifmt_l_rfe, { 0xf0000000 }
724 },
725 /* l.cust6 */
726 {
727 { 0, 0, 0, 0 },
728 { { MNEM, 0 } },
729 & ifmt_l_rfe, { 0xf4000000 }
730 },
731 /* l.cust7 */
732 {
733 { 0, 0, 0, 0 },
734 { { MNEM, 0 } },
735 & ifmt_l_rfe, { 0xf8000000 }
736 },
737 /* l.cust8 */
738 {
739 { 0, 0, 0, 0 },
740 { { MNEM, 0 } },
741 & ifmt_l_rfe, { 0xfc000000 }
742 },
743 /* lf.add.s $rDSF,$rASF,$rBSF */
744 {
745 { 0, 0, 0, 0 },
746 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
747 & ifmt_lf_add_s, { 0xc8000000 }
748 },
749 /* lf.add.d $rDDF,$rADF,$rBDF */
750 {
751 { 0, 0, 0, 0 },
752 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
753 & ifmt_lf_add_d, { 0xc8000010 }
754 },
755 /* lf.sub.s $rDSF,$rASF,$rBSF */
756 {
757 { 0, 0, 0, 0 },
758 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
759 & ifmt_lf_add_s, { 0xc8000001 }
760 },
761 /* lf.sub.d $rDDF,$rADF,$rBDF */
762 {
763 { 0, 0, 0, 0 },
764 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
765 & ifmt_lf_add_d, { 0xc8000011 }
766 },
767 /* lf.mul.s $rDSF,$rASF,$rBSF */
768 {
769 { 0, 0, 0, 0 },
770 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
771 & ifmt_lf_add_s, { 0xc8000002 }
772 },
773 /* lf.mul.d $rDDF,$rADF,$rBDF */
774 {
775 { 0, 0, 0, 0 },
776 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
777 & ifmt_lf_add_d, { 0xc8000012 }
778 },
779 /* lf.div.s $rDSF,$rASF,$rBSF */
780 {
781 { 0, 0, 0, 0 },
782 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
783 & ifmt_lf_add_s, { 0xc8000003 }
784 },
785 /* lf.div.d $rDDF,$rADF,$rBDF */
786 {
787 { 0, 0, 0, 0 },
788 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
789 & ifmt_lf_add_d, { 0xc8000013 }
790 },
791 /* lf.rem.s $rDSF,$rASF,$rBSF */
792 {
793 { 0, 0, 0, 0 },
794 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
795 & ifmt_lf_add_s, { 0xc8000006 }
796 },
797 /* lf.rem.d $rDDF,$rADF,$rBDF */
798 {
799 { 0, 0, 0, 0 },
800 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
801 & ifmt_lf_add_d, { 0xc8000016 }
802 },
803 /* lf.itof.s $rDSF,$rA */
804 {
805 { 0, 0, 0, 0 },
806 { { MNEM, ' ', OP (RDSF), ',', OP (RA), 0 } },
807 & ifmt_lf_itof_s, { 0xc8000004 }
808 },
809 /* lf.itof.d $rDSF,$rA */
810 {
811 { 0, 0, 0, 0 },
812 { { MNEM, ' ', OP (RDSF), ',', OP (RA), 0 } },
813 & ifmt_lf_itof_s, { 0xc8000014 }
814 },
815 /* lf.ftoi.s $rD,$rASF */
816 {
817 { 0, 0, 0, 0 },
818 { { MNEM, ' ', OP (RD), ',', OP (RASF), 0 } },
819 & ifmt_lf_ftoi_s, { 0xc8000005 }
820 },
821 /* lf.ftoi.d $rD,$rADF */
822 {
823 { 0, 0, 0, 0 },
824 { { MNEM, ' ', OP (RD), ',', OP (RADF), 0 } },
825 & ifmt_lf_ftoi_d, { 0xc8000015 }
826 },
827 /* lf.sfeq.s $rASF,$rBSF */
828 {
829 { 0, 0, 0, 0 },
830 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
831 & ifmt_lf_eq_s, { 0xc8000008 }
832 },
833 /* lf.sfeq.d $rASF,$rBSF */
834 {
835 { 0, 0, 0, 0 },
836 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
837 & ifmt_lf_eq_s, { 0xc8000018 }
838 },
839 /* lf.sfne.s $rASF,$rBSF */
840 {
841 { 0, 0, 0, 0 },
842 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
843 & ifmt_lf_eq_s, { 0xc8000009 }
844 },
845 /* lf.sfne.d $rASF,$rBSF */
846 {
847 { 0, 0, 0, 0 },
848 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
849 & ifmt_lf_eq_s, { 0xc8000019 }
850 },
851 /* lf.sfge.s $rASF,$rBSF */
852 {
853 { 0, 0, 0, 0 },
854 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
855 & ifmt_lf_eq_s, { 0xc800000b }
856 },
857 /* lf.sfge.d $rASF,$rBSF */
858 {
859 { 0, 0, 0, 0 },
860 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
861 & ifmt_lf_eq_s, { 0xc800001b }
862 },
863 /* lf.sfgt.s $rASF,$rBSF */
864 {
865 { 0, 0, 0, 0 },
866 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
867 & ifmt_lf_eq_s, { 0xc800000a }
868 },
869 /* lf.sfgt.d $rASF,$rBSF */
870 {
871 { 0, 0, 0, 0 },
872 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
873 & ifmt_lf_eq_s, { 0xc800001a }
874 },
875 /* lf.sflt.s $rASF,$rBSF */
876 {
877 { 0, 0, 0, 0 },
878 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
879 & ifmt_lf_eq_s, { 0xc800000c }
880 },
881 /* lf.sflt.d $rASF,$rBSF */
882 {
883 { 0, 0, 0, 0 },
884 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
885 & ifmt_lf_eq_s, { 0xc800001c }
886 },
887 /* lf.sfle.s $rASF,$rBSF */
888 {
889 { 0, 0, 0, 0 },
890 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
891 & ifmt_lf_eq_s, { 0xc800000d }
892 },
893 /* lf.sfle.d $rASF,$rBSF */
894 {
895 { 0, 0, 0, 0 },
896 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
897 & ifmt_lf_eq_s, { 0xc800001d }
898 },
899 /* lf.madd.s $rDSF,$rASF,$rBSF */
900 {
901 { 0, 0, 0, 0 },
902 { { MNEM, ' ', OP (RDSF), ',', OP (RASF), ',', OP (RBSF), 0 } },
903 & ifmt_lf_add_s, { 0xc8000007 }
904 },
905 /* lf.madd.d $rDDF,$rADF,$rBDF */
906 {
907 { 0, 0, 0, 0 },
908 { { MNEM, ' ', OP (RDDF), ',', OP (RADF), ',', OP (RBDF), 0 } },
909 & ifmt_lf_add_d, { 0xc8000017 }
910 },
911 /* lf.cust1.s $rASF,$rBSF */
912 {
913 { 0, 0, 0, 0 },
914 { { MNEM, ' ', OP (RASF), ',', OP (RBSF), 0 } },
915 & ifmt_lf_cust1_s, { 0xc80000d0 }
916 },
917 /* lf.cust1.d */
918 {
919 { 0, 0, 0, 0 },
920 { { MNEM, 0 } },
921 & ifmt_lf_cust1_d, { 0xc80000e0 }
922 },
923 };
924
925 #undef A
926 #undef OPERAND
927 #undef MNEM
928 #undef OP
929
930 /* Formats for ALIAS macro-insns. */
931
932 #define F(f) & or1k_cgen_ifld_table[OR1K_##f]
933 #undef F
934
935 /* Each non-simple macro entry points to an array of expansion possibilities. */
936
937 #define A(a) (1 << CGEN_INSN_##a)
938 #define OPERAND(op) OR1K_OPERAND_##op
939 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
940 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
941
942 /* The macro instruction table. */
943
944 static const CGEN_IBASE or1k_cgen_macro_insn_table[] =
945 {
946 };
947
948 /* The macro instruction opcode table. */
949
950 static const CGEN_OPCODE or1k_cgen_macro_insn_opcode_table[] =
951 {
952 };
953
954 #undef A
955 #undef OPERAND
956 #undef MNEM
957 #undef OP
958
959 #ifndef CGEN_ASM_HASH_P
960 #define CGEN_ASM_HASH_P(insn) 1
961 #endif
962
963 #ifndef CGEN_DIS_HASH_P
964 #define CGEN_DIS_HASH_P(insn) 1
965 #endif
966
967 /* Return non-zero if INSN is to be added to the hash table.
968 Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file. */
969
970 static int
asm_hash_insn_p(const CGEN_INSN * insn ATTRIBUTE_UNUSED)971 asm_hash_insn_p (const CGEN_INSN *insn ATTRIBUTE_UNUSED)
972 {
973 return CGEN_ASM_HASH_P (insn);
974 }
975
976 static int
dis_hash_insn_p(const CGEN_INSN * insn)977 dis_hash_insn_p (const CGEN_INSN *insn)
978 {
979 /* If building the hash table and the NO-DIS attribute is present,
980 ignore. */
981 if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_NO_DIS))
982 return 0;
983 return CGEN_DIS_HASH_P (insn);
984 }
985
986 #ifndef CGEN_ASM_HASH
987 #define CGEN_ASM_HASH_SIZE 127
988 #ifdef CGEN_MNEMONIC_OPERANDS
989 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
990 #else
991 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
992 #endif
993 #endif
994
995 /* It doesn't make much sense to provide a default here,
996 but while this is under development we do.
997 BUFFER is a pointer to the bytes of the insn, target order.
998 VALUE is the first base_insn_bitsize bits as an int in host order. */
999
1000 #ifndef CGEN_DIS_HASH
1001 #define CGEN_DIS_HASH_SIZE 256
1002 #define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
1003 #endif
1004
1005 /* The result is the hash value of the insn.
1006 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
1007
1008 static unsigned int
asm_hash_insn(const char * mnem)1009 asm_hash_insn (const char *mnem)
1010 {
1011 return CGEN_ASM_HASH (mnem);
1012 }
1013
1014 /* BUF is a pointer to the bytes of the insn, target order.
1015 VALUE is the first base_insn_bitsize bits as an int in host order. */
1016
1017 static unsigned int
dis_hash_insn(const char * buf ATTRIBUTE_UNUSED,CGEN_INSN_INT value ATTRIBUTE_UNUSED)1018 dis_hash_insn (const char *buf ATTRIBUTE_UNUSED,
1019 CGEN_INSN_INT value ATTRIBUTE_UNUSED)
1020 {
1021 return CGEN_DIS_HASH (buf, value);
1022 }
1023
1024 /* Set the recorded length of the insn in the CGEN_FIELDS struct. */
1025
1026 static void
set_fields_bitsize(CGEN_FIELDS * fields,int size)1027 set_fields_bitsize (CGEN_FIELDS *fields, int size)
1028 {
1029 CGEN_FIELDS_BITSIZE (fields) = size;
1030 }
1031
1032 /* Function to call before using the operand instance table.
1033 This plugs the opcode entries and macro instructions into the cpu table. */
1034
1035 void
or1k_cgen_init_opcode_table(CGEN_CPU_DESC cd)1036 or1k_cgen_init_opcode_table (CGEN_CPU_DESC cd)
1037 {
1038 int i;
1039 int num_macros = (sizeof (or1k_cgen_macro_insn_table) /
1040 sizeof (or1k_cgen_macro_insn_table[0]));
1041 const CGEN_IBASE *ib = & or1k_cgen_macro_insn_table[0];
1042 const CGEN_OPCODE *oc = & or1k_cgen_macro_insn_opcode_table[0];
1043 CGEN_INSN *insns = xmalloc (num_macros * sizeof (CGEN_INSN));
1044
1045 /* This test has been added to avoid a warning generated
1046 if memset is called with a third argument of value zero. */
1047 if (num_macros >= 1)
1048 memset (insns, 0, num_macros * sizeof (CGEN_INSN));
1049 for (i = 0; i < num_macros; ++i)
1050 {
1051 insns[i].base = &ib[i];
1052 insns[i].opcode = &oc[i];
1053 or1k_cgen_build_insn_regex (& insns[i]);
1054 }
1055 cd->macro_insn_table.init_entries = insns;
1056 cd->macro_insn_table.entry_size = sizeof (CGEN_IBASE);
1057 cd->macro_insn_table.num_init_entries = num_macros;
1058
1059 oc = & or1k_cgen_insn_opcode_table[0];
1060 insns = (CGEN_INSN *) cd->insn_table.init_entries;
1061 for (i = 0; i < MAX_INSNS; ++i)
1062 {
1063 insns[i].opcode = &oc[i];
1064 or1k_cgen_build_insn_regex (& insns[i]);
1065 }
1066
1067 cd->sizeof_fields = sizeof (CGEN_FIELDS);
1068 cd->set_fields_bitsize = set_fields_bitsize;
1069
1070 cd->asm_hash_p = asm_hash_insn_p;
1071 cd->asm_hash = asm_hash_insn;
1072 cd->asm_hash_size = CGEN_ASM_HASH_SIZE;
1073
1074 cd->dis_hash_p = dis_hash_insn_p;
1075 cd->dis_hash = dis_hash_insn;
1076 cd->dis_hash_size = CGEN_DIS_HASH_SIZE;
1077 }
1078