#include "sysdep.h"
#include "ansidecl.h"
#include "bfd.h"
#include "symcat.h"
#include "ip2k-desc.h"
#include "ip2k-opc.h"
#include "libiberty.h"
#include "safe-ctype.h"
unsigned int
ip2k_asm_hash (const char* insn)
{
unsigned int hash;
const char* m = insn;
for (hash = 0; *m && ! ISSPACE (*m); m++)
hash = (hash * 23) ^ (0x1F & TOLOWER (*m));
return hash % CGEN_ASM_HASH_SIZE;
}
int
ip2k_cgen_insn_supported (CGEN_CPU_DESC cd, const CGEN_INSN *insn)
{
int machs = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_MACH);
if (machs == 0)
return 1;
return (machs & cd->machs) != 0;
}
static int asm_hash_insn_p (const CGEN_INSN *);
static unsigned int asm_hash_insn (const char *);
static int dis_hash_insn_p (const CGEN_INSN *);
static unsigned int dis_hash_insn (const char *, CGEN_INSN_INT);
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
#define F(f) & ip2k_cgen_ifld_table[IP2K_##f]
#else
#define F(f) & ip2k_cgen_ifld_table[IP2K_f]
#endif
static const CGEN_IFMT ifmt_empty ATTRIBUTE_UNUSED = {
0, 0, 0x0, { { 0 } }
};
static const CGEN_IFMT ifmt_jmp ATTRIBUTE_UNUSED = {
16, 16, 0xe000, { { F (F_OP3) }, { F (F_ADDR16CJP) }, { 0 } }
};
static const CGEN_IFMT ifmt_sb ATTRIBUTE_UNUSED = {
16, 16, 0xf000, { { F (F_OP4) }, { F (F_BITNO) }, { F (F_REG) }, { 0 } }
};
static const CGEN_IFMT ifmt_xorw_l ATTRIBUTE_UNUSED = {
16, 16, 0xff00, { { F (F_OP4) }, { F (F_OP4MID) }, { F (F_IMM8) }, { 0 } }
};
static const CGEN_IFMT ifmt_loadl_a ATTRIBUTE_UNUSED = {
16, 16, 0xff00, { { F (F_OP4) }, { F (F_OP4MID) }, { F (F_IMM8) }, { 0 } }
};
static const CGEN_IFMT ifmt_loadh_a ATTRIBUTE_UNUSED = {
16, 16, 0xff00, { { F (F_OP4) }, { F (F_OP4MID) }, { F (F_IMM8) }, { 0 } }
};
static const CGEN_IFMT ifmt_addcfr_w ATTRIBUTE_UNUSED = {
16, 16, 0xfe00, { { F (F_OP6) }, { F (F_DIR) }, { F (F_REG) }, { 0 } }
};
static const CGEN_IFMT ifmt_speed ATTRIBUTE_UNUSED = {
16, 16, 0xff00, { { F (F_OP8) }, { F (F_IMM8) }, { 0 } }
};
static const CGEN_IFMT ifmt_ireadi ATTRIBUTE_UNUSED = {
16, 16, 0xffff, { { F (F_OP6) }, { F (F_OP6_10LOW) }, { 0 } }
};
static const CGEN_IFMT ifmt_page ATTRIBUTE_UNUSED = {
16, 16, 0xfff8, { { F (F_OP6) }, { F (F_OP6_7LOW) }, { F (F_PAGE3) }, { 0 } }
};
static const CGEN_IFMT ifmt_reti ATTRIBUTE_UNUSED = {
16, 16, 0xfff8, { { F (F_OP6) }, { F (F_OP6_7LOW) }, { F (F_RETI3) }, { 0 } }
};
#undef F
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
#define A(a) (1 << CGEN_INSN_##a)
#else
#define A(a) (1 << CGEN_INSN_a)
#endif
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
#define OPERAND(op) IP2K_OPERAND_##op
#else
#define OPERAND(op) IP2K_OPERAND_op
#endif
#define MNEM CGEN_SYNTAX_MNEMONIC
#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
static const CGEN_OPCODE ip2k_cgen_insn_opcode_table[MAX_INSNS] =
{
{ { 0, 0, 0, 0 }, {{0}}, 0, {0}},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (ADDR16CJP), 0 } },
& ifmt_jmp, { 0xe000 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (ADDR16CJP), 0 } },
& ifmt_jmp, { 0xc000 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), ',', OP (BITNO), 0 } },
& ifmt_sb, { 0xb000 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), ',', OP (BITNO), 0 } },
& ifmt_sb, { 0xa000 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), ',', OP (BITNO), 0 } },
& ifmt_sb, { 0x9000 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), ',', OP (BITNO), 0 } },
& ifmt_sb, { 0x8000 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7f00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7e00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7d00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7b00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7a00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7900 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7800 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7700 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7600 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7400 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7300 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7200 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7100 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7000 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (ADDR16L), 0 } },
& ifmt_loadl_a, { 0x7100 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (ADDR16H), 0 } },
& ifmt_loadh_a, { 0x7000 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), ',', 'W', 0 } },
& ifmt_addcfr_w, { 0x5e00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x5c00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x5a00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x5800 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x5400 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x5000 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x4e00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x4c00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x4800 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), ',', 'W', 0 } },
& ifmt_addcfr_w, { 0x4a00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x4600 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x4400 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x4200 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x4000 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x3e00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x3c00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x3a00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x3800 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x3600 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x3400 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x3200 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x3000 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x2e00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x2c00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x2a00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x2800 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x2600 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x2400 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x2200 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', '#', OP (LIT8), 0 } },
& ifmt_xorw_l, { 0x7c00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), ',', 'W', 0 } },
& ifmt_addcfr_w, { 0x200 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x2000 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), ',', 'W', 0 } },
& ifmt_addcfr_w, { 0x1e00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x1c00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), ',', 'W', 0 } },
& ifmt_addcfr_w, { 0x1a00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x1800 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), ',', 'W', 0 } },
& ifmt_addcfr_w, { 0x1600 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x1400 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), ',', 'W', 0 } },
& ifmt_addcfr_w, { 0x1200 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x1000 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), 0 } },
& ifmt_addcfr_w, { 0xe00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0xc00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), ',', 'W', 0 } },
& ifmt_addcfr_w, { 0xa00 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x800 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x600 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', 'W', ',', OP (FR), 0 } },
& ifmt_addcfr_w, { 0x400 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', '#', OP (LIT8), 0 } },
& ifmt_speed, { 0x100 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0x1d }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0x1c }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0x1b }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0x1a }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0x19 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0x18 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (ADDR16P), 0 } },
& ifmt_page, { 0x10 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0xff }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', '#', OP (RETI3), 0 } },
& ifmt_reti, { 0x8 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0x7 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0x6 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0x5 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0x4 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0x3 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0x2 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0x1 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_ireadi, { 0x0 }
},
};
#undef A
#undef OPERAND
#undef MNEM
#undef OP
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
#define F(f) & ip2k_cgen_ifld_table[IP2K_##f]
#else
#define F(f) & ip2k_cgen_ifld_table[IP2K_f]
#endif
static const CGEN_IFMT ifmt_sc ATTRIBUTE_UNUSED = {
16, 16, 0xffff, { { F (F_OP4) }, { F (F_BITNO) }, { F (F_REG) }, { 0 } }
};
static const CGEN_IFMT ifmt_snc ATTRIBUTE_UNUSED = {
16, 16, 0xffff, { { F (F_OP4) }, { F (F_BITNO) }, { F (F_REG) }, { 0 } }
};
static const CGEN_IFMT ifmt_sz ATTRIBUTE_UNUSED = {
16, 16, 0xffff, { { F (F_OP4) }, { F (F_BITNO) }, { F (F_REG) }, { 0 } }
};
static const CGEN_IFMT ifmt_snz ATTRIBUTE_UNUSED = {
16, 16, 0xffff, { { F (F_OP4) }, { F (F_BITNO) }, { F (F_REG) }, { 0 } }
};
static const CGEN_IFMT ifmt_skip ATTRIBUTE_UNUSED = {
16, 16, 0xffff, { { F (F_OP4) }, { F (F_BITNO) }, { F (F_REG) }, { 0 } }
};
static const CGEN_IFMT ifmt_skipb ATTRIBUTE_UNUSED = {
16, 16, 0xffff, { { F (F_OP4) }, { F (F_BITNO) }, { F (F_REG) }, { 0 } }
};
#undef F
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
#define A(a) (1 << CGEN_INSN_##a)
#else
#define A(a) (1 << CGEN_INSN_a)
#endif
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
#define OPERAND(op) IP2K_OPERAND_##op
#else
#define OPERAND(op) IP2K_OPERAND_op
#endif
#define MNEM CGEN_SYNTAX_MNEMONIC
#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
static const CGEN_IBASE ip2k_cgen_macro_insn_table[] =
{
{
-1, "sc", "sc", 16,
{ 0|A(ALIAS), { (1<<MACH_BASE) } }
},
{
-1, "snc", "snc", 16,
{ 0|A(ALIAS), { (1<<MACH_BASE) } }
},
{
-1, "sz", "sz", 16,
{ 0|A(ALIAS), { (1<<MACH_BASE) } }
},
{
-1, "snz", "snz", 16,
{ 0|A(ALIAS), { (1<<MACH_BASE) } }
},
{
-1, "skip", "skip", 16,
{ 0|A(SKIPA)|A(ALIAS), { (1<<MACH_BASE) } }
},
{
-1, "skipb", "skip", 16,
{ 0|A(SKIPA)|A(ALIAS), { (1<<MACH_BASE) } }
},
};
static const CGEN_OPCODE ip2k_cgen_macro_insn_opcode_table[] =
{
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_sc, { 0xb00b }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_snc, { 0xa00b }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_sz, { 0xb40b }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_snz, { 0xa40b }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_skip, { 0xa009 }
},
{
{ 0, 0, 0, 0 },
{ { MNEM, 0 } },
& ifmt_skipb, { 0xb009 }
},
};
#undef A
#undef OPERAND
#undef MNEM
#undef OP
#ifndef CGEN_ASM_HASH_P
#define CGEN_ASM_HASH_P(insn) 1
#endif
#ifndef CGEN_DIS_HASH_P
#define CGEN_DIS_HASH_P(insn) 1
#endif
static int
asm_hash_insn_p (insn)
const CGEN_INSN *insn ATTRIBUTE_UNUSED;
{
return CGEN_ASM_HASH_P (insn);
}
static int
dis_hash_insn_p (insn)
const CGEN_INSN *insn;
{
if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_NO_DIS))
return 0;
return CGEN_DIS_HASH_P (insn);
}
#ifndef CGEN_ASM_HASH
#define CGEN_ASM_HASH_SIZE 127
#ifdef CGEN_MNEMONIC_OPERANDS
#define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
#else
#define CGEN_ASM_HASH(mnem) (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)
#endif
#endif
#ifndef CGEN_DIS_HASH
#define CGEN_DIS_HASH_SIZE 256
#define CGEN_DIS_HASH(buf, value) (*(unsigned char *) (buf))
#endif
static unsigned int
asm_hash_insn (mnem)
const char * mnem;
{
return CGEN_ASM_HASH (mnem);
}
static unsigned int
dis_hash_insn (buf, value)
const char * buf ATTRIBUTE_UNUSED;
CGEN_INSN_INT value ATTRIBUTE_UNUSED;
{
return CGEN_DIS_HASH (buf, value);
}
static void
set_fields_bitsize (CGEN_FIELDS *fields, int size)
{
CGEN_FIELDS_BITSIZE (fields) = size;
}
void
ip2k_cgen_init_opcode_table (CGEN_CPU_DESC cd)
{
int i;
int num_macros = (sizeof (ip2k_cgen_macro_insn_table) /
sizeof (ip2k_cgen_macro_insn_table[0]));
const CGEN_IBASE *ib = & ip2k_cgen_macro_insn_table[0];
const CGEN_OPCODE *oc = & ip2k_cgen_macro_insn_opcode_table[0];
CGEN_INSN *insns = xmalloc (num_macros * sizeof (CGEN_INSN));
memset (insns, 0, num_macros * sizeof (CGEN_INSN));
for (i = 0; i < num_macros; ++i)
{
insns[i].base = &ib[i];
insns[i].opcode = &oc[i];
ip2k_cgen_build_insn_regex (& insns[i]);
}
cd->macro_insn_table.init_entries = insns;
cd->macro_insn_table.entry_size = sizeof (CGEN_IBASE);
cd->macro_insn_table.num_init_entries = num_macros;
oc = & ip2k_cgen_insn_opcode_table[0];
insns = (CGEN_INSN *) cd->insn_table.init_entries;
for (i = 0; i < MAX_INSNS; ++i)
{
insns[i].opcode = &oc[i];
ip2k_cgen_build_insn_regex (& insns[i]);
}
cd->sizeof_fields = sizeof (CGEN_FIELDS);
cd->set_fields_bitsize = set_fields_bitsize;
cd->asm_hash_p = asm_hash_insn_p;
cd->asm_hash = asm_hash_insn;
cd->asm_hash_size = CGEN_ASM_HASH_SIZE;
cd->dis_hash_p = dis_hash_insn_p;
cd->dis_hash = dis_hash_insn;
cd->dis_hash_size = CGEN_DIS_HASH_SIZE;
}