1 /* Instruction opcode table for openrisc.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996-2007 Free Software Foundation, Inc.
7 This file is part of the GNU Binutils and/or GDB, the GNU debugger.
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)
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.
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.
29 #include "openrisc-desc.h"
30 #include "openrisc-opc.h"
31 #include "libiberty.h"
35 /* The hash functions are recorded here to help keep assembler code out of
36 the disassembler and vice versa. */
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
);
43 /* Instruction formats. */
45 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
46 #define F(f) & openrisc_cgen_ifld_table[OPENRISC_##f]
48 #define F(f) & openrisc_cgen_ifld_table[OPENRISC_/**/f]
50 static const CGEN_IFMT ifmt_empty ATTRIBUTE_UNUSED
= {
54 static const CGEN_IFMT ifmt_l_j ATTRIBUTE_UNUSED
= {
55 32, 32, 0xfc000000, { { F (F_CLASS
) }, { F (F_SUB
) }, { F (F_ABS26
) }, { 0 } }
58 static const CGEN_IFMT ifmt_l_jr ATTRIBUTE_UNUSED
= {
59 32, 32, 0xffe00000, { { F (F_CLASS
) }, { F (F_SUB
) }, { F (F_OP3
) }, { F (F_OP4
) }, { F (F_R2
) }, { F (F_UIMM16
) }, { 0 } }
62 static const CGEN_IFMT ifmt_l_bal ATTRIBUTE_UNUSED
= {
63 32, 32, 0xfc000000, { { F (F_CLASS
) }, { F (F_SUB
) }, { F (F_DISP26
) }, { 0 } }
66 static const CGEN_IFMT ifmt_l_movhi ATTRIBUTE_UNUSED
= {
67 32, 32, 0xfc000000, { { F (F_CLASS
) }, { F (F_SUB
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
70 static const CGEN_IFMT ifmt_l_mfsr ATTRIBUTE_UNUSED
= {
71 32, 32, 0xfc000000, { { F (F_CLASS
) }, { F (F_SUB
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_UIMM16
) }, { 0 } }
74 static const CGEN_IFMT ifmt_l_mtsr ATTRIBUTE_UNUSED
= {
75 32, 32, 0xfc0007ff, { { F (F_CLASS
) }, { F (F_SUB
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_R3
) }, { F (F_I16_1
) }, { 0 } }
78 static const CGEN_IFMT ifmt_l_lw ATTRIBUTE_UNUSED
= {
79 32, 32, 0xfc000000, { { F (F_CLASS
) }, { F (F_SUB
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
82 static const CGEN_IFMT ifmt_l_sw ATTRIBUTE_UNUSED
= {
83 32, 32, 0xfc000000, { { F (F_CLASS
) }, { F (F_SUB
) }, { F (F_R1
) }, { F (F_R3
) }, { F (F_I16NC
) }, { 0 } }
86 static const CGEN_IFMT ifmt_l_sll ATTRIBUTE_UNUSED
= {
87 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 } }
90 static const CGEN_IFMT ifmt_l_slli ATTRIBUTE_UNUSED
= {
91 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 } }
94 static const CGEN_IFMT ifmt_l_add ATTRIBUTE_UNUSED
= {
95 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 } }
98 static const CGEN_IFMT ifmt_l_addi ATTRIBUTE_UNUSED
= {
99 32, 32, 0xfc000000, { { F (F_CLASS
) }, { F (F_SUB
) }, { F (F_R1
) }, { F (F_R2
) }, { F (F_LO16
) }, { 0 } }
102 static const CGEN_IFMT ifmt_l_sfgts ATTRIBUTE_UNUSED
= {
103 32, 32, 0xffe007ff, { { F (F_CLASS
) }, { F (F_SUB
) }, { F (F_OP5
) }, { F (F_R2
) }, { F (F_R3
) }, { F (F_F_10_11
) }, { 0 } }
106 static const CGEN_IFMT ifmt_l_sfgtsi ATTRIBUTE_UNUSED
= {
107 32, 32, 0xffe00000, { { F (F_CLASS
) }, { F (F_SUB
) }, { F (F_OP5
) }, { F (F_R2
) }, { F (F_SIMM16
) }, { 0 } }
110 static const CGEN_IFMT ifmt_l_sfgtui ATTRIBUTE_UNUSED
= {
111 32, 32, 0xffe00000, { { F (F_CLASS
) }, { F (F_SUB
) }, { F (F_OP5
) }, { F (F_R2
) }, { F (F_UIMM16
) }, { 0 } }
116 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
117 #define A(a) (1 << CGEN_INSN_##a)
119 #define A(a) (1 << CGEN_INSN_/**/a)
121 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
122 #define OPERAND(op) OPENRISC_OPERAND_##op
124 #define OPERAND(op) OPENRISC_OPERAND_/**/op
126 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
127 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
129 /* The instruction table. */
131 static const CGEN_OPCODE openrisc_cgen_insn_opcode_table
[MAX_INSNS
] =
133 /* Special null first entry.
134 A `num' value of zero is thus invalid.
135 Also, the special `invalid' insn resides here. */
136 { { 0, 0, 0, 0 }, {{0}}, 0, {0}},
140 { { MNEM
, ' ', OP (ABS_26
), 0 } },
143 /* l.jal ${abs-26} */
146 { { MNEM
, ' ', OP (ABS_26
), 0 } },
147 & ifmt_l_j
, { 0x4000000 }
152 { { MNEM
, ' ', OP (RA
), 0 } },
153 & ifmt_l_jr
, { 0x14000000 }
158 { { MNEM
, ' ', OP (RA
), 0 } },
159 & ifmt_l_jr
, { 0x14200000 }
161 /* l.bal ${disp-26} */
164 { { MNEM
, ' ', OP (DISP_26
), 0 } },
165 & ifmt_l_bal
, { 0x8000000 }
167 /* l.bnf ${disp-26} */
170 { { MNEM
, ' ', OP (DISP_26
), 0 } },
171 & ifmt_l_bal
, { 0xc000000 }
173 /* l.bf ${disp-26} */
176 { { MNEM
, ' ', OP (DISP_26
), 0 } },
177 & ifmt_l_bal
, { 0x10000000 }
179 /* l.brk ${uimm-16} */
182 { { MNEM
, ' ', OP (UIMM_16
), 0 } },
183 & ifmt_l_jr
, { 0x17000000 }
188 { { MNEM
, ' ', OP (RA
), 0 } },
189 & ifmt_l_jr
, { 0x14400000 }
191 /* l.sys ${uimm-16} */
194 { { MNEM
, ' ', OP (UIMM_16
), 0 } },
195 & ifmt_l_jr
, { 0x16000000 }
201 & ifmt_l_jr
, { 0x15000000 }
203 /* l.movhi $rD,$hi16 */
206 { { MNEM
, ' ', OP (RD
), ',', OP (HI16
), 0 } },
207 & ifmt_l_movhi
, { 0x18000000 }
212 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), 0 } },
213 & ifmt_l_mfsr
, { 0x1c000000 }
218 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
219 & ifmt_l_mtsr
, { 0x40000000 }
221 /* l.lw $rD,${simm-16}($rA) */
224 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM_16
), '(', OP (RA
), ')', 0 } },
225 & ifmt_l_lw
, { 0x80000000 }
227 /* l.lbz $rD,${simm-16}($rA) */
230 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM_16
), '(', OP (RA
), ')', 0 } },
231 & ifmt_l_lw
, { 0x84000000 }
233 /* l.lbs $rD,${simm-16}($rA) */
236 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM_16
), '(', OP (RA
), ')', 0 } },
237 & ifmt_l_lw
, { 0x88000000 }
239 /* l.lhz $rD,${simm-16}($rA) */
242 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM_16
), '(', OP (RA
), ')', 0 } },
243 & ifmt_l_lw
, { 0x8c000000 }
245 /* l.lhs $rD,${simm-16}($rA) */
248 { { MNEM
, ' ', OP (RD
), ',', OP (SIMM_16
), '(', OP (RA
), ')', 0 } },
249 & ifmt_l_lw
, { 0x90000000 }
251 /* l.sw ${ui16nc}($rA),$rB */
254 { { MNEM
, ' ', OP (UI16NC
), '(', OP (RA
), ')', ',', OP (RB
), 0 } },
255 & ifmt_l_sw
, { 0xd4000000 }
257 /* l.sb ${ui16nc}($rA),$rB */
260 { { MNEM
, ' ', OP (UI16NC
), '(', OP (RA
), ')', ',', OP (RB
), 0 } },
261 & ifmt_l_sw
, { 0xd8000000 }
263 /* l.sh ${ui16nc}($rA),$rB */
266 { { MNEM
, ' ', OP (UI16NC
), '(', OP (RA
), ')', ',', OP (RB
), 0 } },
267 & ifmt_l_sw
, { 0xdc000000 }
269 /* l.sll $rD,$rA,$rB */
272 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
273 & ifmt_l_sll
, { 0xe0000008 }
275 /* l.slli $rD,$rA,${uimm-5} */
278 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM_5
), 0 } },
279 & ifmt_l_slli
, { 0xb4000000 }
281 /* l.srl $rD,$rA,$rB */
284 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
285 & ifmt_l_sll
, { 0xe0000028 }
287 /* l.srli $rD,$rA,${uimm-5} */
290 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM_5
), 0 } },
291 & ifmt_l_slli
, { 0xb4000020 }
293 /* l.sra $rD,$rA,$rB */
296 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
297 & ifmt_l_sll
, { 0xe0000048 }
299 /* l.srai $rD,$rA,${uimm-5} */
302 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM_5
), 0 } },
303 & ifmt_l_slli
, { 0xb4000040 }
305 /* l.ror $rD,$rA,$rB */
308 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
309 & ifmt_l_sll
, { 0xe0000088 }
311 /* l.rori $rD,$rA,${uimm-5} */
314 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (UIMM_5
), 0 } },
315 & ifmt_l_slli
, { 0xb4000080 }
317 /* l.add $rD,$rA,$rB */
320 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
321 & ifmt_l_add
, { 0xe0000000 }
323 /* l.addi $rD,$rA,$lo16 */
326 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (LO16
), 0 } },
327 & ifmt_l_addi
, { 0x94000000 }
329 /* l.sub $rD,$rA,$rB */
332 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
333 & ifmt_l_add
, { 0xe0000002 }
335 /* l.subi $rD,$rA,$lo16 */
338 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (LO16
), 0 } },
339 & ifmt_l_addi
, { 0x9c000000 }
341 /* l.and $rD,$rA,$rB */
344 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
345 & ifmt_l_add
, { 0xe0000003 }
347 /* l.andi $rD,$rA,$lo16 */
350 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (LO16
), 0 } },
351 & ifmt_l_addi
, { 0xa0000000 }
353 /* l.or $rD,$rA,$rB */
356 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
357 & ifmt_l_add
, { 0xe0000004 }
359 /* l.ori $rD,$rA,$lo16 */
362 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (LO16
), 0 } },
363 & ifmt_l_addi
, { 0xa4000000 }
365 /* l.xor $rD,$rA,$rB */
368 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
369 & ifmt_l_add
, { 0xe0000005 }
371 /* l.xori $rD,$rA,$lo16 */
374 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (LO16
), 0 } },
375 & ifmt_l_addi
, { 0xa8000000 }
377 /* l.mul $rD,$rA,$rB */
380 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
381 & ifmt_l_add
, { 0xe0000006 }
383 /* l.muli $rD,$rA,$lo16 */
386 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (LO16
), 0 } },
387 & ifmt_l_addi
, { 0xac000000 }
389 /* l.div $rD,$rA,$rB */
392 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
393 & ifmt_l_add
, { 0xe0000009 }
395 /* l.divu $rD,$rA,$rB */
398 { { MNEM
, ' ', OP (RD
), ',', OP (RA
), ',', OP (RB
), 0 } },
399 & ifmt_l_add
, { 0xe000000a }
401 /* l.sfgts $rA,$rB */
404 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
405 & ifmt_l_sfgts
, { 0xe4c00000 }
407 /* l.sfgtu $rA,$rB */
410 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
411 & ifmt_l_sfgts
, { 0xe4400000 }
413 /* l.sfges $rA,$rB */
416 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
417 & ifmt_l_sfgts
, { 0xe4e00000 }
419 /* l.sfgeu $rA,$rB */
422 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
423 & ifmt_l_sfgts
, { 0xe4600000 }
425 /* l.sflts $rA,$rB */
428 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
429 & ifmt_l_sfgts
, { 0xe5000000 }
431 /* l.sfltu $rA,$rB */
434 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
435 & ifmt_l_sfgts
, { 0xe4800000 }
437 /* l.sfles $rA,$rB */
440 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
441 & ifmt_l_sfgts
, { 0xe5200000 }
443 /* l.sfleu $rA,$rB */
446 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
447 & ifmt_l_sfgts
, { 0xe4a00000 }
449 /* l.sfgtsi $rA,${simm-16} */
452 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM_16
), 0 } },
453 & ifmt_l_sfgtsi
, { 0xb8c00000 }
455 /* l.sfgtui $rA,${uimm-16} */
458 { { MNEM
, ' ', OP (RA
), ',', OP (UIMM_16
), 0 } },
459 & ifmt_l_sfgtui
, { 0xb8400000 }
461 /* l.sfgesi $rA,${simm-16} */
464 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM_16
), 0 } },
465 & ifmt_l_sfgtsi
, { 0xb8e00000 }
467 /* l.sfgeui $rA,${uimm-16} */
470 { { MNEM
, ' ', OP (RA
), ',', OP (UIMM_16
), 0 } },
471 & ifmt_l_sfgtui
, { 0xb8600000 }
473 /* l.sfltsi $rA,${simm-16} */
476 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM_16
), 0 } },
477 & ifmt_l_sfgtsi
, { 0xb9000000 }
479 /* l.sfltui $rA,${uimm-16} */
482 { { MNEM
, ' ', OP (RA
), ',', OP (UIMM_16
), 0 } },
483 & ifmt_l_sfgtui
, { 0xb8800000 }
485 /* l.sflesi $rA,${simm-16} */
488 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM_16
), 0 } },
489 & ifmt_l_sfgtsi
, { 0xb9200000 }
491 /* l.sfleui $rA,${uimm-16} */
494 { { MNEM
, ' ', OP (RA
), ',', OP (UIMM_16
), 0 } },
495 & ifmt_l_sfgtui
, { 0xb8a00000 }
500 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
501 & ifmt_l_sfgts
, { 0xe4000000 }
503 /* l.sfeqi $rA,${simm-16} */
506 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM_16
), 0 } },
507 & ifmt_l_sfgtsi
, { 0xb8000000 }
512 { { MNEM
, ' ', OP (RA
), ',', OP (RB
), 0 } },
513 & ifmt_l_sfgts
, { 0xe4200000 }
515 /* l.sfnei $rA,${simm-16} */
518 { { MNEM
, ' ', OP (RA
), ',', OP (SIMM_16
), 0 } },
519 & ifmt_l_sfgtsi
, { 0xb8200000 }
528 /* Formats for ALIAS macro-insns. */
530 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
531 #define F(f) & openrisc_cgen_ifld_table[OPENRISC_##f]
533 #define F(f) & openrisc_cgen_ifld_table[OPENRISC_/**/f]
535 static const CGEN_IFMT ifmt_l_ret ATTRIBUTE_UNUSED
= {
536 32, 32, 0xffffffff, { { F (F_CLASS
) }, { F (F_SUB
) }, { F (F_OP3
) }, { F (F_OP4
) }, { F (F_R2
) }, { F (F_UIMM16
) }, { 0 } }
541 /* Each non-simple macro entry points to an array of expansion possibilities. */
543 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
544 #define A(a) (1 << CGEN_INSN_##a)
546 #define A(a) (1 << CGEN_INSN_/**/a)
548 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
549 #define OPERAND(op) OPENRISC_OPERAND_##op
551 #define OPERAND(op) OPENRISC_OPERAND_/**/op
553 #define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
554 #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
556 /* The macro instruction table. */
558 static const CGEN_IBASE openrisc_cgen_macro_insn_table
[] =
562 -1, "l-ret", "l.ret", 32,
563 { 0|A(ALIAS
), { { { (1<<MACH_BASE
), 0 } } } }
567 /* The macro instruction opcode table. */
569 static const CGEN_OPCODE openrisc_cgen_macro_insn_opcode_table
[] =
575 & ifmt_l_ret
, { 0x140b0000 }
584 #ifndef CGEN_ASM_HASH_P
585 #define CGEN_ASM_HASH_P(insn) 1
588 #ifndef CGEN_DIS_HASH_P
589 #define CGEN_DIS_HASH_P(insn) 1
592 /* Return non-zero if INSN is to be added to the hash table.
593 Targets are free to override CGEN_{ASM,DIS}_HASH_P in the .opc file. */
596 asm_hash_insn_p (insn
)
597 const CGEN_INSN
*insn ATTRIBUTE_UNUSED
;
599 return CGEN_ASM_HASH_P (insn
);
603 dis_hash_insn_p (insn
)
604 const CGEN_INSN
*insn
;
606 /* If building the hash table and the NO-DIS attribute is present,
608 if (CGEN_INSN_ATTR_VALUE (insn
, CGEN_INSN_NO_DIS
))
610 return CGEN_DIS_HASH_P (insn
);
613 #ifndef CGEN_ASM_HASH
614 #define CGEN_ASM_HASH_SIZE 127
615 #ifdef CGEN_MNEMONIC_OPERANDS
616 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
618 #define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE) /*FIXME*/
622 /* It doesn't make much sense to provide a default here,
623 but while this is under development we do.
624 BUFFER is a pointer to the bytes of the insn, target order.
625 VALUE is the first base_insn_bitsize bits as an int in host order. */
627 #ifndef CGEN_DIS_HASH
628 #define CGEN_DIS_HASH_SIZE 256
629 #define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
632 /* The result is the hash value of the insn.
633 Targets are free to override CGEN_{ASM,DIS}_HASH in the .opc file. */
639 return CGEN_ASM_HASH (mnem
);
642 /* BUF is a pointer to the bytes of the insn, target order.
643 VALUE is the first base_insn_bitsize bits as an int in host order. */
646 dis_hash_insn (buf
, value
)
647 const char * buf ATTRIBUTE_UNUSED
;
648 CGEN_INSN_INT value ATTRIBUTE_UNUSED
;
650 return CGEN_DIS_HASH (buf
, value
);
653 /* Set the recorded length of the insn in the CGEN_FIELDS struct. */
656 set_fields_bitsize (CGEN_FIELDS
*fields
, int size
)
658 CGEN_FIELDS_BITSIZE (fields
) = size
;
661 /* Function to call before using the operand instance table.
662 This plugs the opcode entries and macro instructions into the cpu table. */
665 openrisc_cgen_init_opcode_table (CGEN_CPU_DESC cd
)
668 int num_macros
= (sizeof (openrisc_cgen_macro_insn_table
) /
669 sizeof (openrisc_cgen_macro_insn_table
[0]));
670 const CGEN_IBASE
*ib
= & openrisc_cgen_macro_insn_table
[0];
671 const CGEN_OPCODE
*oc
= & openrisc_cgen_macro_insn_opcode_table
[0];
672 CGEN_INSN
*insns
= xmalloc (num_macros
* sizeof (CGEN_INSN
));
674 memset (insns
, 0, num_macros
* sizeof (CGEN_INSN
));
675 for (i
= 0; i
< num_macros
; ++i
)
677 insns
[i
].base
= &ib
[i
];
678 insns
[i
].opcode
= &oc
[i
];
679 openrisc_cgen_build_insn_regex (& insns
[i
]);
681 cd
->macro_insn_table
.init_entries
= insns
;
682 cd
->macro_insn_table
.entry_size
= sizeof (CGEN_IBASE
);
683 cd
->macro_insn_table
.num_init_entries
= num_macros
;
685 oc
= & openrisc_cgen_insn_opcode_table
[0];
686 insns
= (CGEN_INSN
*) cd
->insn_table
.init_entries
;
687 for (i
= 0; i
< MAX_INSNS
; ++i
)
689 insns
[i
].opcode
= &oc
[i
];
690 openrisc_cgen_build_insn_regex (& insns
[i
]);
693 cd
->sizeof_fields
= sizeof (CGEN_FIELDS
);
694 cd
->set_fields_bitsize
= set_fields_bitsize
;
696 cd
->asm_hash_p
= asm_hash_insn_p
;
697 cd
->asm_hash
= asm_hash_insn
;
698 cd
->asm_hash_size
= CGEN_ASM_HASH_SIZE
;
700 cd
->dis_hash_p
= dis_hash_insn_p
;
701 cd
->dis_hash
= dis_hash_insn
;
702 cd
->dis_hash_size
= CGEN_DIS_HASH_SIZE
;