1*3d8817e4Smiod /* Instruction opcode table for openrisc.
2*3d8817e4Smiod 
3*3d8817e4Smiod THIS FILE IS MACHINE GENERATED WITH CGEN.
4*3d8817e4Smiod 
5*3d8817e4Smiod Copyright 1996-2005 Free Software Foundation, Inc.
6*3d8817e4Smiod 
7*3d8817e4Smiod This file is part of the GNU Binutils and/or GDB, the GNU debugger.
8*3d8817e4Smiod 
9*3d8817e4Smiod This program is free software; you can redistribute it and/or modify
10*3d8817e4Smiod it under the terms of the GNU General Public License as published by
11*3d8817e4Smiod the Free Software Foundation; either version 2, or (at your option)
12*3d8817e4Smiod any later version.
13*3d8817e4Smiod 
14*3d8817e4Smiod This program is distributed in the hope that it will be useful,
15*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of
16*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*3d8817e4Smiod GNU General Public License for more details.
18*3d8817e4Smiod 
19*3d8817e4Smiod You should have received a copy of the GNU General Public License along
20*3d8817e4Smiod with this program; if not, write to the Free Software Foundation, Inc.,
21*3d8817e4Smiod 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
22*3d8817e4Smiod 
23*3d8817e4Smiod */
24*3d8817e4Smiod 
25*3d8817e4Smiod #include "sysdep.h"
26*3d8817e4Smiod #include "ansidecl.h"
27*3d8817e4Smiod #include "bfd.h"
28*3d8817e4Smiod #include "symcat.h"
29*3d8817e4Smiod #include "openrisc-desc.h"
30*3d8817e4Smiod #include "openrisc-opc.h"
31*3d8817e4Smiod #include "libiberty.h"
32*3d8817e4Smiod 
33*3d8817e4Smiod /* -- opc.c */
34*3d8817e4Smiod /* -- */
35*3d8817e4Smiod /* The hash functions are recorded here to help keep assembler code out of
36*3d8817e4Smiod    the disassembler and vice versa.  */
37*3d8817e4Smiod 
38*3d8817e4Smiod static int asm_hash_insn_p        (const CGEN_INSN *);
39*3d8817e4Smiod static unsigned int asm_hash_insn (const char *);
40*3d8817e4Smiod static int dis_hash_insn_p        (const CGEN_INSN *);
41*3d8817e4Smiod static unsigned int dis_hash_insn (const char *, CGEN_INSN_INT);
42*3d8817e4Smiod 
43*3d8817e4Smiod /* Instruction formats.  */
44*3d8817e4Smiod 
45*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
46*3d8817e4Smiod #define F(f) & openrisc_cgen_ifld_table[OPENRISC_##f]
47*3d8817e4Smiod #else
48*3d8817e4Smiod #define F(f) & openrisc_cgen_ifld_table[OPENRISC_/**/f]
49*3d8817e4Smiod #endif
50*3d8817e4Smiod static const CGEN_IFMT ifmt_empty ATTRIBUTE_UNUSED = {
51*3d8817e4Smiod   0, 0, 0x0, { { 0 } }
52*3d8817e4Smiod };
53*3d8817e4Smiod 
54*3d8817e4Smiod static const CGEN_IFMT ifmt_l_j ATTRIBUTE_UNUSED = {
55*3d8817e4Smiod   32, 32, 0xfc000000, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_ABS26) }, { 0 } }
56*3d8817e4Smiod };
57*3d8817e4Smiod 
58*3d8817e4Smiod static const CGEN_IFMT ifmt_l_jr ATTRIBUTE_UNUSED = {
59*3d8817e4Smiod   32, 32, 0xffe00000, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_OP3) }, { F (F_OP4) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
60*3d8817e4Smiod };
61*3d8817e4Smiod 
62*3d8817e4Smiod static const CGEN_IFMT ifmt_l_bal ATTRIBUTE_UNUSED = {
63*3d8817e4Smiod   32, 32, 0xfc000000, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_DISP26) }, { 0 } }
64*3d8817e4Smiod };
65*3d8817e4Smiod 
66*3d8817e4Smiod static const CGEN_IFMT ifmt_l_movhi ATTRIBUTE_UNUSED = {
67*3d8817e4Smiod   32, 32, 0xfc000000, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
68*3d8817e4Smiod };
69*3d8817e4Smiod 
70*3d8817e4Smiod static const CGEN_IFMT ifmt_l_mfsr ATTRIBUTE_UNUSED = {
71*3d8817e4Smiod   32, 32, 0xfc000000, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_R1) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
72*3d8817e4Smiod };
73*3d8817e4Smiod 
74*3d8817e4Smiod static const CGEN_IFMT ifmt_l_mtsr ATTRIBUTE_UNUSED = {
75*3d8817e4Smiod   32, 32, 0xfc0007ff, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_I16_1) }, { 0 } }
76*3d8817e4Smiod };
77*3d8817e4Smiod 
78*3d8817e4Smiod static const CGEN_IFMT ifmt_l_lw ATTRIBUTE_UNUSED = {
79*3d8817e4Smiod   32, 32, 0xfc000000, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
80*3d8817e4Smiod };
81*3d8817e4Smiod 
82*3d8817e4Smiod static const CGEN_IFMT ifmt_l_sw ATTRIBUTE_UNUSED = {
83*3d8817e4Smiod   32, 32, 0xfc000000, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_R1) }, { F (F_R3) }, { F (F_I16NC) }, { 0 } }
84*3d8817e4Smiod };
85*3d8817e4Smiod 
86*3d8817e4Smiod static const CGEN_IFMT ifmt_l_sll ATTRIBUTE_UNUSED = {
87*3d8817e4Smiod   32, 32, 0xfc0007ff, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_F_10_3) }, { F (F_OP6) }, { F (F_F_4_1) }, { F (F_OP7) }, { 0 } }
88*3d8817e4Smiod };
89*3d8817e4Smiod 
90*3d8817e4Smiod static const CGEN_IFMT ifmt_l_slli ATTRIBUTE_UNUSED = {
91*3d8817e4Smiod   32, 32, 0xfc00ffe0, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_R1) }, { F (F_R2) }, { F (F_F_15_8) }, { F (F_OP6) }, { F (F_UIMM5) }, { 0 } }
92*3d8817e4Smiod };
93*3d8817e4Smiod 
94*3d8817e4Smiod static const CGEN_IFMT ifmt_l_add ATTRIBUTE_UNUSED = {
95*3d8817e4Smiod   32, 32, 0xfc0007ff, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_R1) }, { F (F_R2) }, { F (F_R3) }, { F (F_F_10_7) }, { F (F_OP7) }, { 0 } }
96*3d8817e4Smiod };
97*3d8817e4Smiod 
98*3d8817e4Smiod static const CGEN_IFMT ifmt_l_addi ATTRIBUTE_UNUSED = {
99*3d8817e4Smiod   32, 32, 0xfc000000, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_R1) }, { F (F_R2) }, { F (F_LO16) }, { 0 } }
100*3d8817e4Smiod };
101*3d8817e4Smiod 
102*3d8817e4Smiod static const CGEN_IFMT ifmt_l_sfgts ATTRIBUTE_UNUSED = {
103*3d8817e4Smiod   32, 32, 0xffe007ff, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_OP5) }, { F (F_R2) }, { F (F_R3) }, { F (F_F_10_11) }, { 0 } }
104*3d8817e4Smiod };
105*3d8817e4Smiod 
106*3d8817e4Smiod static const CGEN_IFMT ifmt_l_sfgtsi ATTRIBUTE_UNUSED = {
107*3d8817e4Smiod   32, 32, 0xffe00000, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_OP5) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
108*3d8817e4Smiod };
109*3d8817e4Smiod 
110*3d8817e4Smiod static const CGEN_IFMT ifmt_l_sfgtui ATTRIBUTE_UNUSED = {
111*3d8817e4Smiod   32, 32, 0xffe00000, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_OP5) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
112*3d8817e4Smiod };
113*3d8817e4Smiod 
114*3d8817e4Smiod #undef F
115*3d8817e4Smiod 
116*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
117*3d8817e4Smiod #define A(a) (1 << CGEN_INSN_##a)
118*3d8817e4Smiod #else
119*3d8817e4Smiod #define A(a) (1 << CGEN_INSN_/**/a)
120*3d8817e4Smiod #endif
121*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
122*3d8817e4Smiod #define OPERAND(op) OPENRISC_OPERAND_##op
123*3d8817e4Smiod #else
124*3d8817e4Smiod #define OPERAND(op) OPENRISC_OPERAND_/**/op
125*3d8817e4Smiod #endif
126*3d8817e4Smiod #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
127*3d8817e4Smiod #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
128*3d8817e4Smiod 
129*3d8817e4Smiod /* The instruction table.  */
130*3d8817e4Smiod 
131*3d8817e4Smiod static const CGEN_OPCODE openrisc_cgen_insn_opcode_table[MAX_INSNS] =
132*3d8817e4Smiod {
133*3d8817e4Smiod   /* Special null first entry.
134*3d8817e4Smiod      A `num' value of zero is thus invalid.
135*3d8817e4Smiod      Also, the special `invalid' insn resides here.  */
136*3d8817e4Smiod   { { 0, 0, 0, 0 }, {{0}}, 0, {0}},
137*3d8817e4Smiod /* l.j ${abs-26} */
138*3d8817e4Smiod   {
139*3d8817e4Smiod     { 0, 0, 0, 0 },
140*3d8817e4Smiod     { { MNEM, ' ', OP (ABS_26), 0 } },
141*3d8817e4Smiod     & ifmt_l_j, { 0x0 }
142*3d8817e4Smiod   },
143*3d8817e4Smiod /* l.jal ${abs-26} */
144*3d8817e4Smiod   {
145*3d8817e4Smiod     { 0, 0, 0, 0 },
146*3d8817e4Smiod     { { MNEM, ' ', OP (ABS_26), 0 } },
147*3d8817e4Smiod     & ifmt_l_j, { 0x4000000 }
148*3d8817e4Smiod   },
149*3d8817e4Smiod /* l.jr $rA */
150*3d8817e4Smiod   {
151*3d8817e4Smiod     { 0, 0, 0, 0 },
152*3d8817e4Smiod     { { MNEM, ' ', OP (RA), 0 } },
153*3d8817e4Smiod     & ifmt_l_jr, { 0x14000000 }
154*3d8817e4Smiod   },
155*3d8817e4Smiod /* l.jalr $rA */
156*3d8817e4Smiod   {
157*3d8817e4Smiod     { 0, 0, 0, 0 },
158*3d8817e4Smiod     { { MNEM, ' ', OP (RA), 0 } },
159*3d8817e4Smiod     & ifmt_l_jr, { 0x14200000 }
160*3d8817e4Smiod   },
161*3d8817e4Smiod /* l.bal ${disp-26} */
162*3d8817e4Smiod   {
163*3d8817e4Smiod     { 0, 0, 0, 0 },
164*3d8817e4Smiod     { { MNEM, ' ', OP (DISP_26), 0 } },
165*3d8817e4Smiod     & ifmt_l_bal, { 0x8000000 }
166*3d8817e4Smiod   },
167*3d8817e4Smiod /* l.bnf ${disp-26} */
168*3d8817e4Smiod   {
169*3d8817e4Smiod     { 0, 0, 0, 0 },
170*3d8817e4Smiod     { { MNEM, ' ', OP (DISP_26), 0 } },
171*3d8817e4Smiod     & ifmt_l_bal, { 0xc000000 }
172*3d8817e4Smiod   },
173*3d8817e4Smiod /* l.bf ${disp-26} */
174*3d8817e4Smiod   {
175*3d8817e4Smiod     { 0, 0, 0, 0 },
176*3d8817e4Smiod     { { MNEM, ' ', OP (DISP_26), 0 } },
177*3d8817e4Smiod     & ifmt_l_bal, { 0x10000000 }
178*3d8817e4Smiod   },
179*3d8817e4Smiod /* l.brk ${uimm-16} */
180*3d8817e4Smiod   {
181*3d8817e4Smiod     { 0, 0, 0, 0 },
182*3d8817e4Smiod     { { MNEM, ' ', OP (UIMM_16), 0 } },
183*3d8817e4Smiod     & ifmt_l_jr, { 0x17000000 }
184*3d8817e4Smiod   },
185*3d8817e4Smiod /* l.rfe $rA */
186*3d8817e4Smiod   {
187*3d8817e4Smiod     { 0, 0, 0, 0 },
188*3d8817e4Smiod     { { MNEM, ' ', OP (RA), 0 } },
189*3d8817e4Smiod     & ifmt_l_jr, { 0x14400000 }
190*3d8817e4Smiod   },
191*3d8817e4Smiod /* l.sys ${uimm-16} */
192*3d8817e4Smiod   {
193*3d8817e4Smiod     { 0, 0, 0, 0 },
194*3d8817e4Smiod     { { MNEM, ' ', OP (UIMM_16), 0 } },
195*3d8817e4Smiod     & ifmt_l_jr, { 0x16000000 }
196*3d8817e4Smiod   },
197*3d8817e4Smiod /* l.nop */
198*3d8817e4Smiod   {
199*3d8817e4Smiod     { 0, 0, 0, 0 },
200*3d8817e4Smiod     { { MNEM, 0 } },
201*3d8817e4Smiod     & ifmt_l_jr, { 0x15000000 }
202*3d8817e4Smiod   },
203*3d8817e4Smiod /* l.movhi $rD,$hi16 */
204*3d8817e4Smiod   {
205*3d8817e4Smiod     { 0, 0, 0, 0 },
206*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (HI16), 0 } },
207*3d8817e4Smiod     & ifmt_l_movhi, { 0x18000000 }
208*3d8817e4Smiod   },
209*3d8817e4Smiod /* l.mfsr $rD,$rA */
210*3d8817e4Smiod   {
211*3d8817e4Smiod     { 0, 0, 0, 0 },
212*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), 0 } },
213*3d8817e4Smiod     & ifmt_l_mfsr, { 0x1c000000 }
214*3d8817e4Smiod   },
215*3d8817e4Smiod /* l.mtsr $rA,$rB */
216*3d8817e4Smiod   {
217*3d8817e4Smiod     { 0, 0, 0, 0 },
218*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
219*3d8817e4Smiod     & ifmt_l_mtsr, { 0x40000000 }
220*3d8817e4Smiod   },
221*3d8817e4Smiod /* l.lw $rD,${simm-16}($rA) */
222*3d8817e4Smiod   {
223*3d8817e4Smiod     { 0, 0, 0, 0 },
224*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (SIMM_16), '(', OP (RA), ')', 0 } },
225*3d8817e4Smiod     & ifmt_l_lw, { 0x80000000 }
226*3d8817e4Smiod   },
227*3d8817e4Smiod /* l.lbz $rD,${simm-16}($rA) */
228*3d8817e4Smiod   {
229*3d8817e4Smiod     { 0, 0, 0, 0 },
230*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (SIMM_16), '(', OP (RA), ')', 0 } },
231*3d8817e4Smiod     & ifmt_l_lw, { 0x84000000 }
232*3d8817e4Smiod   },
233*3d8817e4Smiod /* l.lbs $rD,${simm-16}($rA) */
234*3d8817e4Smiod   {
235*3d8817e4Smiod     { 0, 0, 0, 0 },
236*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (SIMM_16), '(', OP (RA), ')', 0 } },
237*3d8817e4Smiod     & ifmt_l_lw, { 0x88000000 }
238*3d8817e4Smiod   },
239*3d8817e4Smiod /* l.lhz $rD,${simm-16}($rA) */
240*3d8817e4Smiod   {
241*3d8817e4Smiod     { 0, 0, 0, 0 },
242*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (SIMM_16), '(', OP (RA), ')', 0 } },
243*3d8817e4Smiod     & ifmt_l_lw, { 0x8c000000 }
244*3d8817e4Smiod   },
245*3d8817e4Smiod /* l.lhs $rD,${simm-16}($rA) */
246*3d8817e4Smiod   {
247*3d8817e4Smiod     { 0, 0, 0, 0 },
248*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (SIMM_16), '(', OP (RA), ')', 0 } },
249*3d8817e4Smiod     & ifmt_l_lw, { 0x90000000 }
250*3d8817e4Smiod   },
251*3d8817e4Smiod /* l.sw ${ui16nc}($rA),$rB */
252*3d8817e4Smiod   {
253*3d8817e4Smiod     { 0, 0, 0, 0 },
254*3d8817e4Smiod     { { MNEM, ' ', OP (UI16NC), '(', OP (RA), ')', ',', OP (RB), 0 } },
255*3d8817e4Smiod     & ifmt_l_sw, { 0xd4000000 }
256*3d8817e4Smiod   },
257*3d8817e4Smiod /* l.sb ${ui16nc}($rA),$rB */
258*3d8817e4Smiod   {
259*3d8817e4Smiod     { 0, 0, 0, 0 },
260*3d8817e4Smiod     { { MNEM, ' ', OP (UI16NC), '(', OP (RA), ')', ',', OP (RB), 0 } },
261*3d8817e4Smiod     & ifmt_l_sw, { 0xd8000000 }
262*3d8817e4Smiod   },
263*3d8817e4Smiod /* l.sh ${ui16nc}($rA),$rB */
264*3d8817e4Smiod   {
265*3d8817e4Smiod     { 0, 0, 0, 0 },
266*3d8817e4Smiod     { { MNEM, ' ', OP (UI16NC), '(', OP (RA), ')', ',', OP (RB), 0 } },
267*3d8817e4Smiod     & ifmt_l_sw, { 0xdc000000 }
268*3d8817e4Smiod   },
269*3d8817e4Smiod /* l.sll $rD,$rA,$rB */
270*3d8817e4Smiod   {
271*3d8817e4Smiod     { 0, 0, 0, 0 },
272*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
273*3d8817e4Smiod     & ifmt_l_sll, { 0xe0000008 }
274*3d8817e4Smiod   },
275*3d8817e4Smiod /* l.slli $rD,$rA,${uimm-5} */
276*3d8817e4Smiod   {
277*3d8817e4Smiod     { 0, 0, 0, 0 },
278*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM_5), 0 } },
279*3d8817e4Smiod     & ifmt_l_slli, { 0xb4000000 }
280*3d8817e4Smiod   },
281*3d8817e4Smiod /* l.srl $rD,$rA,$rB */
282*3d8817e4Smiod   {
283*3d8817e4Smiod     { 0, 0, 0, 0 },
284*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
285*3d8817e4Smiod     & ifmt_l_sll, { 0xe0000028 }
286*3d8817e4Smiod   },
287*3d8817e4Smiod /* l.srli $rD,$rA,${uimm-5} */
288*3d8817e4Smiod   {
289*3d8817e4Smiod     { 0, 0, 0, 0 },
290*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM_5), 0 } },
291*3d8817e4Smiod     & ifmt_l_slli, { 0xb4000020 }
292*3d8817e4Smiod   },
293*3d8817e4Smiod /* l.sra $rD,$rA,$rB */
294*3d8817e4Smiod   {
295*3d8817e4Smiod     { 0, 0, 0, 0 },
296*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
297*3d8817e4Smiod     & ifmt_l_sll, { 0xe0000048 }
298*3d8817e4Smiod   },
299*3d8817e4Smiod /* l.srai $rD,$rA,${uimm-5} */
300*3d8817e4Smiod   {
301*3d8817e4Smiod     { 0, 0, 0, 0 },
302*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM_5), 0 } },
303*3d8817e4Smiod     & ifmt_l_slli, { 0xb4000040 }
304*3d8817e4Smiod   },
305*3d8817e4Smiod /* l.ror $rD,$rA,$rB */
306*3d8817e4Smiod   {
307*3d8817e4Smiod     { 0, 0, 0, 0 },
308*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
309*3d8817e4Smiod     & ifmt_l_sll, { 0xe0000088 }
310*3d8817e4Smiod   },
311*3d8817e4Smiod /* l.rori $rD,$rA,${uimm-5} */
312*3d8817e4Smiod   {
313*3d8817e4Smiod     { 0, 0, 0, 0 },
314*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (UIMM_5), 0 } },
315*3d8817e4Smiod     & ifmt_l_slli, { 0xb4000080 }
316*3d8817e4Smiod   },
317*3d8817e4Smiod /* l.add $rD,$rA,$rB */
318*3d8817e4Smiod   {
319*3d8817e4Smiod     { 0, 0, 0, 0 },
320*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
321*3d8817e4Smiod     & ifmt_l_add, { 0xe0000000 }
322*3d8817e4Smiod   },
323*3d8817e4Smiod /* l.addi $rD,$rA,$lo16 */
324*3d8817e4Smiod   {
325*3d8817e4Smiod     { 0, 0, 0, 0 },
326*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (LO16), 0 } },
327*3d8817e4Smiod     & ifmt_l_addi, { 0x94000000 }
328*3d8817e4Smiod   },
329*3d8817e4Smiod /* l.sub $rD,$rA,$rB */
330*3d8817e4Smiod   {
331*3d8817e4Smiod     { 0, 0, 0, 0 },
332*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
333*3d8817e4Smiod     & ifmt_l_add, { 0xe0000002 }
334*3d8817e4Smiod   },
335*3d8817e4Smiod /* l.subi $rD,$rA,$lo16 */
336*3d8817e4Smiod   {
337*3d8817e4Smiod     { 0, 0, 0, 0 },
338*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (LO16), 0 } },
339*3d8817e4Smiod     & ifmt_l_addi, { 0x9c000000 }
340*3d8817e4Smiod   },
341*3d8817e4Smiod /* l.and $rD,$rA,$rB */
342*3d8817e4Smiod   {
343*3d8817e4Smiod     { 0, 0, 0, 0 },
344*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
345*3d8817e4Smiod     & ifmt_l_add, { 0xe0000003 }
346*3d8817e4Smiod   },
347*3d8817e4Smiod /* l.andi $rD,$rA,$lo16 */
348*3d8817e4Smiod   {
349*3d8817e4Smiod     { 0, 0, 0, 0 },
350*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (LO16), 0 } },
351*3d8817e4Smiod     & ifmt_l_addi, { 0xa0000000 }
352*3d8817e4Smiod   },
353*3d8817e4Smiod /* l.or $rD,$rA,$rB */
354*3d8817e4Smiod   {
355*3d8817e4Smiod     { 0, 0, 0, 0 },
356*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
357*3d8817e4Smiod     & ifmt_l_add, { 0xe0000004 }
358*3d8817e4Smiod   },
359*3d8817e4Smiod /* l.ori $rD,$rA,$lo16 */
360*3d8817e4Smiod   {
361*3d8817e4Smiod     { 0, 0, 0, 0 },
362*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (LO16), 0 } },
363*3d8817e4Smiod     & ifmt_l_addi, { 0xa4000000 }
364*3d8817e4Smiod   },
365*3d8817e4Smiod /* l.xor $rD,$rA,$rB */
366*3d8817e4Smiod   {
367*3d8817e4Smiod     { 0, 0, 0, 0 },
368*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
369*3d8817e4Smiod     & ifmt_l_add, { 0xe0000005 }
370*3d8817e4Smiod   },
371*3d8817e4Smiod /* l.xori $rD,$rA,$lo16 */
372*3d8817e4Smiod   {
373*3d8817e4Smiod     { 0, 0, 0, 0 },
374*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (LO16), 0 } },
375*3d8817e4Smiod     & ifmt_l_addi, { 0xa8000000 }
376*3d8817e4Smiod   },
377*3d8817e4Smiod /* l.mul $rD,$rA,$rB */
378*3d8817e4Smiod   {
379*3d8817e4Smiod     { 0, 0, 0, 0 },
380*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
381*3d8817e4Smiod     & ifmt_l_add, { 0xe0000006 }
382*3d8817e4Smiod   },
383*3d8817e4Smiod /* l.muli $rD,$rA,$lo16 */
384*3d8817e4Smiod   {
385*3d8817e4Smiod     { 0, 0, 0, 0 },
386*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (LO16), 0 } },
387*3d8817e4Smiod     & ifmt_l_addi, { 0xac000000 }
388*3d8817e4Smiod   },
389*3d8817e4Smiod /* l.div $rD,$rA,$rB */
390*3d8817e4Smiod   {
391*3d8817e4Smiod     { 0, 0, 0, 0 },
392*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
393*3d8817e4Smiod     & ifmt_l_add, { 0xe0000009 }
394*3d8817e4Smiod   },
395*3d8817e4Smiod /* l.divu $rD,$rA,$rB */
396*3d8817e4Smiod   {
397*3d8817e4Smiod     { 0, 0, 0, 0 },
398*3d8817e4Smiod     { { MNEM, ' ', OP (RD), ',', OP (RA), ',', OP (RB), 0 } },
399*3d8817e4Smiod     & ifmt_l_add, { 0xe000000a }
400*3d8817e4Smiod   },
401*3d8817e4Smiod /* l.sfgts $rA,$rB */
402*3d8817e4Smiod   {
403*3d8817e4Smiod     { 0, 0, 0, 0 },
404*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
405*3d8817e4Smiod     & ifmt_l_sfgts, { 0xe4c00000 }
406*3d8817e4Smiod   },
407*3d8817e4Smiod /* l.sfgtu $rA,$rB */
408*3d8817e4Smiod   {
409*3d8817e4Smiod     { 0, 0, 0, 0 },
410*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
411*3d8817e4Smiod     & ifmt_l_sfgts, { 0xe4400000 }
412*3d8817e4Smiod   },
413*3d8817e4Smiod /* l.sfges $rA,$rB */
414*3d8817e4Smiod   {
415*3d8817e4Smiod     { 0, 0, 0, 0 },
416*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
417*3d8817e4Smiod     & ifmt_l_sfgts, { 0xe4e00000 }
418*3d8817e4Smiod   },
419*3d8817e4Smiod /* l.sfgeu $rA,$rB */
420*3d8817e4Smiod   {
421*3d8817e4Smiod     { 0, 0, 0, 0 },
422*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
423*3d8817e4Smiod     & ifmt_l_sfgts, { 0xe4600000 }
424*3d8817e4Smiod   },
425*3d8817e4Smiod /* l.sflts $rA,$rB */
426*3d8817e4Smiod   {
427*3d8817e4Smiod     { 0, 0, 0, 0 },
428*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
429*3d8817e4Smiod     & ifmt_l_sfgts, { 0xe5000000 }
430*3d8817e4Smiod   },
431*3d8817e4Smiod /* l.sfltu $rA,$rB */
432*3d8817e4Smiod   {
433*3d8817e4Smiod     { 0, 0, 0, 0 },
434*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
435*3d8817e4Smiod     & ifmt_l_sfgts, { 0xe4800000 }
436*3d8817e4Smiod   },
437*3d8817e4Smiod /* l.sfles $rA,$rB */
438*3d8817e4Smiod   {
439*3d8817e4Smiod     { 0, 0, 0, 0 },
440*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
441*3d8817e4Smiod     & ifmt_l_sfgts, { 0xe5200000 }
442*3d8817e4Smiod   },
443*3d8817e4Smiod /* l.sfleu $rA,$rB */
444*3d8817e4Smiod   {
445*3d8817e4Smiod     { 0, 0, 0, 0 },
446*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
447*3d8817e4Smiod     & ifmt_l_sfgts, { 0xe4a00000 }
448*3d8817e4Smiod   },
449*3d8817e4Smiod /* l.sfgtsi $rA,${simm-16} */
450*3d8817e4Smiod   {
451*3d8817e4Smiod     { 0, 0, 0, 0 },
452*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (SIMM_16), 0 } },
453*3d8817e4Smiod     & ifmt_l_sfgtsi, { 0xb8c00000 }
454*3d8817e4Smiod   },
455*3d8817e4Smiod /* l.sfgtui $rA,${uimm-16} */
456*3d8817e4Smiod   {
457*3d8817e4Smiod     { 0, 0, 0, 0 },
458*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (UIMM_16), 0 } },
459*3d8817e4Smiod     & ifmt_l_sfgtui, { 0xb8400000 }
460*3d8817e4Smiod   },
461*3d8817e4Smiod /* l.sfgesi $rA,${simm-16} */
462*3d8817e4Smiod   {
463*3d8817e4Smiod     { 0, 0, 0, 0 },
464*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (SIMM_16), 0 } },
465*3d8817e4Smiod     & ifmt_l_sfgtsi, { 0xb8e00000 }
466*3d8817e4Smiod   },
467*3d8817e4Smiod /* l.sfgeui $rA,${uimm-16} */
468*3d8817e4Smiod   {
469*3d8817e4Smiod     { 0, 0, 0, 0 },
470*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (UIMM_16), 0 } },
471*3d8817e4Smiod     & ifmt_l_sfgtui, { 0xb8600000 }
472*3d8817e4Smiod   },
473*3d8817e4Smiod /* l.sfltsi $rA,${simm-16} */
474*3d8817e4Smiod   {
475*3d8817e4Smiod     { 0, 0, 0, 0 },
476*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (SIMM_16), 0 } },
477*3d8817e4Smiod     & ifmt_l_sfgtsi, { 0xb9000000 }
478*3d8817e4Smiod   },
479*3d8817e4Smiod /* l.sfltui $rA,${uimm-16} */
480*3d8817e4Smiod   {
481*3d8817e4Smiod     { 0, 0, 0, 0 },
482*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (UIMM_16), 0 } },
483*3d8817e4Smiod     & ifmt_l_sfgtui, { 0xb8800000 }
484*3d8817e4Smiod   },
485*3d8817e4Smiod /* l.sflesi $rA,${simm-16} */
486*3d8817e4Smiod   {
487*3d8817e4Smiod     { 0, 0, 0, 0 },
488*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (SIMM_16), 0 } },
489*3d8817e4Smiod     & ifmt_l_sfgtsi, { 0xb9200000 }
490*3d8817e4Smiod   },
491*3d8817e4Smiod /* l.sfleui $rA,${uimm-16} */
492*3d8817e4Smiod   {
493*3d8817e4Smiod     { 0, 0, 0, 0 },
494*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (UIMM_16), 0 } },
495*3d8817e4Smiod     & ifmt_l_sfgtui, { 0xb8a00000 }
496*3d8817e4Smiod   },
497*3d8817e4Smiod /* l.sfeq $rA,$rB */
498*3d8817e4Smiod   {
499*3d8817e4Smiod     { 0, 0, 0, 0 },
500*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
501*3d8817e4Smiod     & ifmt_l_sfgts, { 0xe4000000 }
502*3d8817e4Smiod   },
503*3d8817e4Smiod /* l.sfeqi $rA,${simm-16} */
504*3d8817e4Smiod   {
505*3d8817e4Smiod     { 0, 0, 0, 0 },
506*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (SIMM_16), 0 } },
507*3d8817e4Smiod     & ifmt_l_sfgtsi, { 0xb8000000 }
508*3d8817e4Smiod   },
509*3d8817e4Smiod /* l.sfne $rA,$rB */
510*3d8817e4Smiod   {
511*3d8817e4Smiod     { 0, 0, 0, 0 },
512*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (RB), 0 } },
513*3d8817e4Smiod     & ifmt_l_sfgts, { 0xe4200000 }
514*3d8817e4Smiod   },
515*3d8817e4Smiod /* l.sfnei $rA,${simm-16} */
516*3d8817e4Smiod   {
517*3d8817e4Smiod     { 0, 0, 0, 0 },
518*3d8817e4Smiod     { { MNEM, ' ', OP (RA), ',', OP (SIMM_16), 0 } },
519*3d8817e4Smiod     & ifmt_l_sfgtsi, { 0xb8200000 }
520*3d8817e4Smiod   },
521*3d8817e4Smiod };
522*3d8817e4Smiod 
523*3d8817e4Smiod #undef A
524*3d8817e4Smiod #undef OPERAND
525*3d8817e4Smiod #undef MNEM
526*3d8817e4Smiod #undef OP
527*3d8817e4Smiod 
528*3d8817e4Smiod /* Formats for ALIAS macro-insns.  */
529*3d8817e4Smiod 
530*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
531*3d8817e4Smiod #define F(f) & openrisc_cgen_ifld_table[OPENRISC_##f]
532*3d8817e4Smiod #else
533*3d8817e4Smiod #define F(f) & openrisc_cgen_ifld_table[OPENRISC_/**/f]
534*3d8817e4Smiod #endif
535*3d8817e4Smiod static const CGEN_IFMT ifmt_l_ret ATTRIBUTE_UNUSED = {
536*3d8817e4Smiod   32, 32, 0xffffffff, { { F (F_CLASS) }, { F (F_SUB) }, { F (F_OP3) }, { F (F_OP4) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
537*3d8817e4Smiod };
538*3d8817e4Smiod 
539*3d8817e4Smiod #undef F
540*3d8817e4Smiod 
541*3d8817e4Smiod /* Each non-simple macro entry points to an array of expansion possibilities.  */
542*3d8817e4Smiod 
543*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
544*3d8817e4Smiod #define A(a) (1 << CGEN_INSN_##a)
545*3d8817e4Smiod #else
546*3d8817e4Smiod #define A(a) (1 << CGEN_INSN_/**/a)
547*3d8817e4Smiod #endif
548*3d8817e4Smiod #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
549*3d8817e4Smiod #define OPERAND(op) OPENRISC_OPERAND_##op
550*3d8817e4Smiod #else
551*3d8817e4Smiod #define OPERAND(op) OPENRISC_OPERAND_/**/op
552*3d8817e4Smiod #endif
553*3d8817e4Smiod #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
554*3d8817e4Smiod #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
555*3d8817e4Smiod 
556*3d8817e4Smiod /* The macro instruction table.  */
557*3d8817e4Smiod 
558*3d8817e4Smiod static const CGEN_IBASE openrisc_cgen_macro_insn_table[] =
559*3d8817e4Smiod {
560*3d8817e4Smiod /* l.ret */
561*3d8817e4Smiod   {
562*3d8817e4Smiod     -1, "l-ret", "l.ret", 32,
563*3d8817e4Smiod     { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } } } }
564*3d8817e4Smiod   },
565*3d8817e4Smiod };
566*3d8817e4Smiod 
567*3d8817e4Smiod /* The macro instruction opcode table.  */
568*3d8817e4Smiod 
569*3d8817e4Smiod static const CGEN_OPCODE openrisc_cgen_macro_insn_opcode_table[] =
570*3d8817e4Smiod {
571*3d8817e4Smiod /* l.ret */
572*3d8817e4Smiod   {
573*3d8817e4Smiod     { 0, 0, 0, 0 },
574*3d8817e4Smiod     { { MNEM, 0 } },
575*3d8817e4Smiod     & ifmt_l_ret, { 0x140b0000 }
576*3d8817e4Smiod   },
577*3d8817e4Smiod };
578*3d8817e4Smiod 
579*3d8817e4Smiod #undef A
580*3d8817e4Smiod #undef OPERAND
581*3d8817e4Smiod #undef MNEM
582*3d8817e4Smiod #undef OP
583*3d8817e4Smiod 
584*3d8817e4Smiod #ifndef CGEN_ASM_HASH_P
585*3d8817e4Smiod #define CGEN_ASM_HASH_P(insn) 1
586*3d8817e4Smiod #endif
587*3d8817e4Smiod 
588*3d8817e4Smiod #ifndef CGEN_DIS_HASH_P
589*3d8817e4Smiod #define CGEN_DIS_HASH_P(insn) 1
590*3d8817e4Smiod #endif
591*3d8817e4Smiod 
592*3d8817e4Smiod /* Return non-zero if INSN is to be added to the hash table.
593*3d8817e4Smiod    Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file.  */
594*3d8817e4Smiod 
595*3d8817e4Smiod static int
asm_hash_insn_p(insn)596*3d8817e4Smiod asm_hash_insn_p (insn)
597*3d8817e4Smiod      const CGEN_INSN *insn ATTRIBUTE_UNUSED;
598*3d8817e4Smiod {
599*3d8817e4Smiod   return CGEN_ASM_HASH_P (insn);
600*3d8817e4Smiod }
601*3d8817e4Smiod 
602*3d8817e4Smiod static int
dis_hash_insn_p(insn)603*3d8817e4Smiod dis_hash_insn_p (insn)
604*3d8817e4Smiod      const CGEN_INSN *insn;
605*3d8817e4Smiod {
606*3d8817e4Smiod   /* If building the hash table and the NO-DIS attribute is present,
607*3d8817e4Smiod      ignore.  */
608*3d8817e4Smiod   if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_NO_DIS))
609*3d8817e4Smiod     return 0;
610*3d8817e4Smiod   return CGEN_DIS_HASH_P (insn);
611*3d8817e4Smiod }
612*3d8817e4Smiod 
613*3d8817e4Smiod #ifndef CGEN_ASM_HASH
614*3d8817e4Smiod #define CGEN_ASM_HASH_SIZE 127
615*3d8817e4Smiod #ifdef CGEN_MNEMONIC_OPERANDS
616*3d8817e4Smiod #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
617*3d8817e4Smiod #else
618*3d8817e4Smiod #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
619*3d8817e4Smiod #endif
620*3d8817e4Smiod #endif
621*3d8817e4Smiod 
622*3d8817e4Smiod /* It doesn't make much sense to provide a default here,
623*3d8817e4Smiod    but while this is under development we do.
624*3d8817e4Smiod    BUFFER is a pointer to the bytes of the insn, target order.
625*3d8817e4Smiod    VALUE is the first base_insn_bitsize bits as an int in host order.  */
626*3d8817e4Smiod 
627*3d8817e4Smiod #ifndef CGEN_DIS_HASH
628*3d8817e4Smiod #define CGEN_DIS_HASH_SIZE 256
629*3d8817e4Smiod #define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
630*3d8817e4Smiod #endif
631*3d8817e4Smiod 
632*3d8817e4Smiod /* The result is the hash value of the insn.
633*3d8817e4Smiod    Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file.  */
634*3d8817e4Smiod 
635*3d8817e4Smiod static unsigned int
asm_hash_insn(mnem)636*3d8817e4Smiod asm_hash_insn (mnem)
637*3d8817e4Smiod      const char * mnem;
638*3d8817e4Smiod {
639*3d8817e4Smiod   return CGEN_ASM_HASH (mnem);
640*3d8817e4Smiod }
641*3d8817e4Smiod 
642*3d8817e4Smiod /* BUF is a pointer to the bytes of the insn, target order.
643*3d8817e4Smiod    VALUE is the first base_insn_bitsize bits as an int in host order.  */
644*3d8817e4Smiod 
645*3d8817e4Smiod static unsigned int
dis_hash_insn(buf,value)646*3d8817e4Smiod dis_hash_insn (buf, value)
647*3d8817e4Smiod      const char * buf ATTRIBUTE_UNUSED;
648*3d8817e4Smiod      CGEN_INSN_INT value ATTRIBUTE_UNUSED;
649*3d8817e4Smiod {
650*3d8817e4Smiod   return CGEN_DIS_HASH (buf, value);
651*3d8817e4Smiod }
652*3d8817e4Smiod 
653*3d8817e4Smiod /* Set the recorded length of the insn in the CGEN_FIELDS struct.  */
654*3d8817e4Smiod 
655*3d8817e4Smiod static void
set_fields_bitsize(CGEN_FIELDS * fields,int size)656*3d8817e4Smiod set_fields_bitsize (CGEN_FIELDS *fields, int size)
657*3d8817e4Smiod {
658*3d8817e4Smiod   CGEN_FIELDS_BITSIZE (fields) = size;
659*3d8817e4Smiod }
660*3d8817e4Smiod 
661*3d8817e4Smiod /* Function to call before using the operand instance table.
662*3d8817e4Smiod    This plugs the opcode entries and macro instructions into the cpu table.  */
663*3d8817e4Smiod 
664*3d8817e4Smiod void
openrisc_cgen_init_opcode_table(CGEN_CPU_DESC cd)665*3d8817e4Smiod openrisc_cgen_init_opcode_table (CGEN_CPU_DESC cd)
666*3d8817e4Smiod {
667*3d8817e4Smiod   int i;
668*3d8817e4Smiod   int num_macros = (sizeof (openrisc_cgen_macro_insn_table) /
669*3d8817e4Smiod 		    sizeof (openrisc_cgen_macro_insn_table[0]));
670*3d8817e4Smiod   const CGEN_IBASE *ib = & openrisc_cgen_macro_insn_table[0];
671*3d8817e4Smiod   const CGEN_OPCODE *oc = & openrisc_cgen_macro_insn_opcode_table[0];
672*3d8817e4Smiod   CGEN_INSN *insns = xmalloc (num_macros * sizeof (CGEN_INSN));
673*3d8817e4Smiod 
674*3d8817e4Smiod   memset (insns, 0, num_macros * sizeof (CGEN_INSN));
675*3d8817e4Smiod   for (i = 0; i < num_macros; ++i)
676*3d8817e4Smiod     {
677*3d8817e4Smiod       insns[i].base = &ib[i];
678*3d8817e4Smiod       insns[i].opcode = &oc[i];
679*3d8817e4Smiod       openrisc_cgen_build_insn_regex (& insns[i]);
680*3d8817e4Smiod     }
681*3d8817e4Smiod   cd->macro_insn_table.init_entries = insns;
682*3d8817e4Smiod   cd->macro_insn_table.entry_size = sizeof (CGEN_IBASE);
683*3d8817e4Smiod   cd->macro_insn_table.num_init_entries = num_macros;
684*3d8817e4Smiod 
685*3d8817e4Smiod   oc = & openrisc_cgen_insn_opcode_table[0];
686*3d8817e4Smiod   insns = (CGEN_INSN *) cd->insn_table.init_entries;
687*3d8817e4Smiod   for (i = 0; i < MAX_INSNS; ++i)
688*3d8817e4Smiod     {
689*3d8817e4Smiod       insns[i].opcode = &oc[i];
690*3d8817e4Smiod       openrisc_cgen_build_insn_regex (& insns[i]);
691*3d8817e4Smiod     }
692*3d8817e4Smiod 
693*3d8817e4Smiod   cd->sizeof_fields = sizeof (CGEN_FIELDS);
694*3d8817e4Smiod   cd->set_fields_bitsize = set_fields_bitsize;
695*3d8817e4Smiod 
696*3d8817e4Smiod   cd->asm_hash_p = asm_hash_insn_p;
697*3d8817e4Smiod   cd->asm_hash = asm_hash_insn;
698*3d8817e4Smiod   cd->asm_hash_size = CGEN_ASM_HASH_SIZE;
699*3d8817e4Smiod 
700*3d8817e4Smiod   cd->dis_hash_p = dis_hash_insn_p;
701*3d8817e4Smiod   cd->dis_hash = dis_hash_insn;
702*3d8817e4Smiod   cd->dis_hash_size = CGEN_DIS_HASH_SIZE;
703*3d8817e4Smiod }
704