* opcodes/fr30-asm.c: Regenerate.
* opcodes/fr30-desc.c: Regenerate.
* opcodes/fr30-desc.h: Regenerate.
* opcodes/fr30-dis.c: Regenerate.
* opcodes/fr30-ibld.c: Regenerate.
* opcodes/fr30-opc.c: Regenerate.
* opcodes/fr30-opc.h: Regenerate.
* opcodes/m32r-asm.c: Regenerate.
* opcodes/m32r-desc.c: Regenerate.
* opcodes/m32r-desc.h: Regenerate.
* opcodes/m32r-dis.c: Regenerate.
* opcodes/m32r-ibld.c: Regenerate.
* opcodes/m32r-opc.c: Regenerate.
* opcodes/m32r-opc.h: Regenerate.
* opcodes/m32r-opinst.c: Regenerate.
+2001-03-05 Dave Brolley <brolley@redhat.com>
+
+ * opcodes/fr30-asm.c: Regenerate.
+ * opcodes/fr30-desc.c: Regenerate.
+ * opcodes/fr30-desc.h: Regenerate.
+ * opcodes/fr30-dis.c: Regenerate.
+ * opcodes/fr30-ibld.c: Regenerate.
+ * opcodes/fr30-opc.c: Regenerate.
+ * opcodes/fr30-opc.h: Regenerate.
+ * opcodes/m32r-asm.c: Regenerate.
+ * opcodes/m32r-desc.c: Regenerate.
+ * opcodes/m32r-desc.h: Regenerate.
+ * opcodes/m32r-dis.c: Regenerate.
+ * opcodes/m32r-ibld.c: Regenerate.
+ * opcodes/m32r-opc.c: Regenerate.
+ * opcodes/m32r-opc.h: Regenerate.
+ * opcodes/m32r-opinst.c: Regenerate.
+
2001-02-28 Igor Shevlyakov <igor@windriver.com>
* m68k-opc.c: fix cpushl according to Motorola. Enable
THIS FILE IS MACHINE GENERATED WITH CGEN.
- the resultant file is machine generated, cgen-asm.in isn't
-Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU Binutils and GDB, the GNU debugger.
const char *str = *strp;
const char *errmsg;
const char *p;
- const unsigned char * syn;
+ const CGEN_SYNTAX_CHAR_TYPE * syn;
#ifdef CGEN_MNEMONIC_OPERANDS
/* FIXME: wip */
int past_opcode_p;
if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn)))
{
#ifdef CGEN_MNEMONIC_OPERANDS
- if (* syn == ' ')
+ if (CGEN_SYNTAX_CHAR(* syn) == ' ')
past_opcode_p = 1;
#endif
++ syn;
++ str;
}
- else
+ else if (*str)
{
/* Syntax char didn't match. Can't be this insn. */
static char msg [80];
/* xgettext:c-format */
sprintf (msg, _("syntax error (expected char `%c', found `%c')"),
- *syn, *str);
+ CGEN_SYNTAX_CHAR(*syn), *str);
+ return msg;
+ }
+ else
+ {
+ /* Ran out of input. */
+ static char msg [80];
+ /* xgettext:c-format */
+ sprintf (msg, _("syntax error (expected char `%c', found end of instruction)"),
+ CGEN_SYNTAX_CHAR(*syn));
return msg;
}
continue;
}
/* If we're at the end of the syntax string, we're done. */
- if (* syn == '\0')
+ if (* syn == 0)
{
/* FIXME: For the moment we assume a valid `str' can only contain
blanks now. IE: We needn't try again with a longer version of
{
const char *start;
CGEN_INSN_LIST *ilist;
- const char *tmp_errmsg = NULL;
+ const char *parse_errmsg = NULL;
+ const char *insert_errmsg = NULL;
/* Skip leading white space. */
while (isspace (* str))
/* Allow parse/insert handlers to obtain length of insn. */
CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
- tmp_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields);
- if (tmp_errmsg != NULL)
+ parse_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields);
+ if (parse_errmsg != NULL)
continue;
/* ??? 0 is passed for `pc' */
- tmp_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf,
- (bfd_vma) 0);
- if (tmp_errmsg != NULL)
+ insert_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf,
+ (bfd_vma) 0);
+ if (insert_errmsg != NULL)
continue;
/* It is up to the caller to actually output the insn and any
return insn;
}
- /* Make sure we leave this with something at this point. */
- if (tmp_errmsg == NULL)
- tmp_errmsg = "unknown mnemonic";
-
{
static char errbuf[150];
+ const char *tmp_errmsg;
#ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS
- /* if verbose error messages, use errmsg from CGEN_PARSE_FN */
+ /* If requesting verbose error messages, use insert_errmsg.
+ Failing that, use parse_errmsg */
+ tmp_errmsg = (insert_errmsg ? insert_errmsg :
+ parse_errmsg ? parse_errmsg :
+ _("unrecognized instruction"));
+
if (strlen (start) > 50)
/* xgettext:c-format */
sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start);
THIS FILE IS MACHINE GENERATED WITH CGEN.
-Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU Binutils and/or GDB, the GNU debugger.
};
-
/* The hardware table. */
-#define A(a) (1 << CONCAT2 (CGEN_HW_,a))
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define A(a) (1 << CGEN_HW_##a)
+#else
+#define A(a) (1 << CGEN_HW_/**/a)
+#endif
const CGEN_HW_ENTRY fr30_cgen_hw_table[] =
{
#undef A
+
/* The instruction field table. */
-#define A(a) (1 << CONCAT2 (CGEN_IFLD_,a))
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define A(a) (1 << CGEN_IFLD_##a)
+#else
+#define A(a) (1 << CGEN_IFLD_/**/a)
+#endif
const CGEN_IFLD fr30_cgen_ifld_table[] =
{
#undef A
+
/* The operand table. */
-#define A(a) (1 << CONCAT2 (CGEN_OPERAND_,a))
-#define OPERAND(op) CONCAT2 (FR30_OPERAND_,op)
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define A(a) (1 << CGEN_OPERAND_##a)
+#else
+#define A(a) (1 << CGEN_OPERAND_/**/a)
+#endif
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define OPERAND(op) FR30_OPERAND_##op
+#else
+#define OPERAND(op) FR30_OPERAND_/**/op
+#endif
const CGEN_OPERAND fr30_cgen_operand_table[] =
{
#undef A
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
-#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
/* The instruction table. */
+#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
+#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
+
static const CGEN_IBASE fr30_cgen_insn_table[MAX_INSNS] =
{
/* Special null first entry.
},
};
-#undef A
-#undef MNEM
#undef OP
+#undef A
/* Initialize anything needed to be done once, before any cpu_open call. */
THIS FILE IS MACHINE GENERATED WITH CGEN.
-Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU Binutils and/or GDB, the GNU debugger.
#define CGEN_ARCH fr30
/* Given symbol S, return fr30_cgen_<S>. */
-#define CGEN_SYM(s) CONCAT3 (fr30,_cgen_,s)
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define CGEN_SYM(s) fr30##_cgen_##s
+#else
+#define CGEN_SYM(s) fr30/**/_cgen_/**/s
+#endif
+
/* Selected cpu families. */
#define HAVE_CPU_FR30BF
#define CGEN_INT_INSN_P 0
-/* Maximum nymber of syntax bytes in an instruction. */
+/* Maximum number of syntax elements in an instruction. */
#define CGEN_ACTUAL_MAX_SYNTAX_ELEMENTS 15
/* CGEN_MNEMONIC_OPERANDS is defined if mnemonics have operands.
THIS FILE IS MACHINE GENERATED WITH CGEN.
- the resultant file is machine generated, cgen-dis.in isn't
-Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU Binutils and GDB, the GNU debugger.
static void
print_hi_register_list_ld (cd, dis_info, value, attrs, pc, length)
- CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+ CGEN_CPU_DESC cd;
PTR dis_info;
long value;
- unsigned int attrs ATTRIBUTE_UNUSED;
- bfd_vma pc ATTRIBUTE_UNUSED;
- int length ATTRIBUTE_UNUSED;
+ unsigned int attrs;
+ bfd_vma pc;
+ int length;
{
print_register_list (dis_info, value, 8, 0/*load*/);
}
static void
print_low_register_list_ld (cd, dis_info, value, attrs, pc, length)
- CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+ CGEN_CPU_DESC cd;
PTR dis_info;
long value;
- unsigned int attrs ATTRIBUTE_UNUSED;
- bfd_vma pc ATTRIBUTE_UNUSED;
- int length ATTRIBUTE_UNUSED;
+ unsigned int attrs;
+ bfd_vma pc;
+ int length;
{
print_register_list (dis_info, value, 0, 0/*load*/);
}
static void
print_hi_register_list_st (cd, dis_info, value, attrs, pc, length)
- CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+ CGEN_CPU_DESC cd;
PTR dis_info;
long value;
- unsigned int attrs ATTRIBUTE_UNUSED;
- bfd_vma pc ATTRIBUTE_UNUSED;
- int length ATTRIBUTE_UNUSED;
+ unsigned int attrs;
+ bfd_vma pc;
+ int length;
{
print_register_list (dis_info, value, 8, 1/*store*/);
}
static void
print_low_register_list_st (cd, dis_info, value, attrs, pc, length)
- CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+ CGEN_CPU_DESC cd;
PTR dis_info;
long value;
- unsigned int attrs ATTRIBUTE_UNUSED;
- bfd_vma pc ATTRIBUTE_UNUSED;
- int length ATTRIBUTE_UNUSED;
+ unsigned int attrs;
+ bfd_vma pc;
+ int length;
{
print_register_list (dis_info, value, 0, 1/*store*/);
}
static void
print_m4 (cd, dis_info, value, attrs, pc, length)
- CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+ CGEN_CPU_DESC cd;
PTR dis_info;
long value;
- unsigned int attrs ATTRIBUTE_UNUSED;
- bfd_vma pc ATTRIBUTE_UNUSED;
- int length ATTRIBUTE_UNUSED;
+ unsigned int attrs;
+ bfd_vma pc;
+ int length;
{
disassemble_info *info = (disassemble_info *) dis_info;
(*info->fprintf_func) (info->stream, "%ld", value);
int opindex;
PTR xinfo;
CGEN_FIELDS *fields;
- void const *attrs ATTRIBUTE_UNUSED;
+ void const *attrs;
bfd_vma pc;
int length;
{
{
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
disassemble_info *info = (disassemble_info *) dis_info;
- const unsigned char *syn;
+ const CGEN_SYNTAX_CHAR_TYPE *syn;
CGEN_INIT_PRINT (cd);
Returns 0 if all is well, non-zero otherwise. */
static int
read_insn (cd, pc, info, buf, buflen, ex_info, insn_value)
- CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+ CGEN_CPU_DESC cd;
bfd_vma pc;
disassemble_info *info;
char *buf;
ex_info->valid = (1 << buflen) - 1;
ex_info->insn_bytes = buf;
- switch (buflen)
- {
- case 1:
- *insn_value = buf[0];
- break;
- case 2:
- *insn_value = info->endian == BFD_ENDIAN_BIG ? bfd_getb16 (buf) : bfd_getl16 (buf);
- break;
- case 4:
- *insn_value = info->endian == BFD_ENDIAN_BIG ? bfd_getb32 (buf) : bfd_getl32 (buf);
- break;
- default:
- abort ();
- }
-
+ *insn_value = bfd_get_bits (buf, buflen * 8, info->endian == BFD_ENDIAN_BIG);
return 0;
}
/* Make sure the entire insn is loaded into insn_value, if it
can fit. */
- if ((unsigned) CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize &&
- (unsigned) (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long))
+ if (CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize &&
+ (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long))
{
unsigned long full_insn_value;
int rc = read_insn (cd, pc, info, buf,
THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator.
- the resultant file is machine generated, cgen-ibld.in isn't
-Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU Binutils and GDB, the GNU debugger.
int shift;
int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG;
- switch (word_length)
- {
- case 8:
- x = *bufp;
- break;
- case 16:
- if (big_p)
- x = bfd_getb16 (bufp);
- else
- x = bfd_getl16 (bufp);
- break;
- case 24:
- /* ??? This may need reworking as these cases don't necessarily
- want the first byte and the last two bytes handled like this. */
- if (big_p)
- x = (bufp[0] << 16) | bfd_getb16 (bufp + 1);
- else
- x = bfd_getl16 (bufp) | (bufp[2] << 16);
- break;
- case 32:
- if (big_p)
- x = bfd_getb32 (bufp);
- else
- x = bfd_getl32 (bufp);
- break;
- default :
- abort ();
- }
+ x = bfd_get_bits (bufp, word_length, big_p);
/* Written this way to avoid undefined behaviour. */
mask = (((1L << (length - 1)) - 1) << 1) | 1;
shift = (word_length - (start + length));
x = (x & ~(mask << shift)) | ((value & mask) << shift);
- switch (word_length)
- {
- case 8:
- *bufp = x;
- break;
- case 16:
- if (big_p)
- bfd_putb16 (x, bufp);
- else
- bfd_putl16 (x, bufp);
- break;
- case 24:
- /* ??? This may need reworking as these cases don't necessarily
- want the first byte and the last two bytes handled like this. */
- if (big_p)
- {
- bufp[0] = x >> 16;
- bfd_putb16 (x, bufp + 1);
- }
- else
- {
- bfd_putl16 (x, bufp);
- bufp[2] = x >> 16;
- }
- break;
- case 32:
- if (big_p)
- bfd_putb32 (x, bufp);
- else
- bfd_putl32 (x, bufp);
- break;
- default :
- abort ();
- }
+ bfd_put_bits ((bfd_vma) x, bufp, word_length, big_p);
}
#endif /* ! CGEN_INT_INSN_P */
{
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
unsigned long value;
- const unsigned char * syn;
+ const CGEN_SYNTAX_CHAR_TYPE * syn;
CGEN_INIT_INSERT (cd);
value = CGEN_INSN_BASE_VALUE (insn);
e.g. storing a branch displacement that got resolved later.
Needs more thought first. */
- for (syn = CGEN_SYNTAX_STRING (syntax); * syn != '\0'; ++ syn)
+ for (syn = CGEN_SYNTAX_STRING (syntax); * syn; ++ syn)
{
const char *errmsg;
unsigned char *bufp;
bfd_vma pc;
{
- unsigned long x,mask;
+ unsigned long x;
int shift;
int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG;
- switch (word_length)
- {
- case 8:
- x = *bufp;
- break;
- case 16:
- if (big_p)
- x = bfd_getb16 (bufp);
- else
- x = bfd_getl16 (bufp);
- break;
- case 24:
- /* ??? This may need reworking as these cases don't necessarily
- want the first byte and the last two bytes handled like this. */
- if (big_p)
- x = (bufp[0] << 16) | bfd_getb16 (bufp + 1);
- else
- x = bfd_getl16 (bufp) | (bufp[2] << 16);
- break;
- case 32:
- if (big_p)
- x = bfd_getb32 (bufp);
- else
- x = bfd_getl32 (bufp);
- break;
- default :
- abort ();
- }
+ x = bfd_get_bits (bufp, word_length, big_p);
- /* Written this way to avoid undefined behaviour. */
- mask = (((1L << (length - 1)) - 1) << 1) | 1;
if (CGEN_INSN_LSB0_P)
shift = (start + 1) - length;
else
shift = (word_length - (start + length));
- return (x >> shift) & mask;
+ return x >> shift;
}
#endif /* ! CGEN_INT_INSN_P */
#endif
long *valuep;
{
- CGEN_INSN_INT value;
+ CGEN_INSN_INT value, mask;
/* If LENGTH is zero, this operand doesn't contribute to the value
so give it a standard value of zero. */
if (CGEN_INT_INSN_P || word_offset == 0)
{
- /* Written this way to avoid undefined behaviour. */
- CGEN_INSN_INT mask = (((1L << (length - 1)) - 1) << 1) | 1;
-
if (CGEN_INSN_LSB0_P)
value = insn_value >> ((word_offset + start + 1) - length);
else
value = insn_value >> (total_length - ( word_offset + start + length));
- value &= mask;
- /* sign extend? */
- if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)
- && (value & (1L << (length - 1))))
- value |= ~mask;
}
#if ! CGEN_INT_INSN_P
#endif /* ! CGEN_INT_INSN_P */
+ /* Written this way to avoid undefined behaviour. */
+ mask = (((1L << (length - 1)) - 1) << 1) | 1;
+
+ value &= mask;
+ /* sign extend? */
+ if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)
+ && (value & (1L << (length - 1))))
+ value |= ~mask;
+
*valuep = value;
return 1;
bfd_vma pc;
{
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
- const unsigned char *syn;
+ const CGEN_SYNTAX_CHAR_TYPE *syn;
CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
THIS FILE IS MACHINE GENERATED WITH CGEN.
-Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU Binutils and/or GDB, the GNU debugger.
/* Instruction formats. */
-#define F(f) & fr30_cgen_ifld_table[CONCAT2 (FR30_,f)]
-
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define F(f) & fr30_cgen_ifld_table[FR30_##f]
+#else
+#define F(f) & fr30_cgen_ifld_table[FR30_/**/f]
+#endif
static const CGEN_IFMT ifmt_empty = {
0, 0, 0x0, { { 0 } }
};
#undef F
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
+#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) FR30_OPERAND_##op
+#else
+#define OPERAND(op) FR30_OPERAND_/**/op
+#endif
#define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
-#define OPERAND(op) CONCAT2 (FR30_OPERAND_,op)
#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
/* The instruction table. */
};
#undef A
-#undef MNEM
#undef OPERAND
+#undef MNEM
#undef OP
/* Formats for ALIAS macro-insns. */
-#define F(f) & fr30_cgen_ifld_table[CONCAT2 (FR30_,f)]
-
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define F(f) & fr30_cgen_ifld_table[FR30_##f]
+#else
+#define F(f) & fr30_cgen_ifld_table[FR30_/**/f]
+#endif
static const CGEN_IFMT ifmt_ldi8m = {
16, 16, 0xf000, { { F (F_OP1) }, { F (F_I8) }, { F (F_RI) }, { 0 } }
};
/* Each non-simple macro entry points to an array of expansion possibilities. */
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
+#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) FR30_OPERAND_##op
+#else
+#define OPERAND(op) FR30_OPERAND_/**/op
+#endif
#define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
-#define OPERAND(op) CONCAT2 (FR30_OPERAND_,op)
#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
/* The macro instruction table. */
};
#undef A
-#undef MNEM
#undef OPERAND
+#undef MNEM
#undef OP
#ifndef CGEN_ASM_HASH_P
THIS FILE IS MACHINE GENERATED WITH CGEN.
-Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU Binutils and/or GDB, the GNU debugger.
THIS FILE IS MACHINE GENERATED WITH CGEN.
- the resultant file is machine generated, cgen-asm.in isn't
-Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU Binutils and GDB, the GNU debugger.
const char *str = *strp;
const char *errmsg;
const char *p;
- const unsigned char * syn;
+ const CGEN_SYNTAX_CHAR_TYPE * syn;
#ifdef CGEN_MNEMONIC_OPERANDS
/* FIXME: wip */
int past_opcode_p;
if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn)))
{
#ifdef CGEN_MNEMONIC_OPERANDS
- if (* syn == ' ')
+ if (CGEN_SYNTAX_CHAR(* syn) == ' ')
past_opcode_p = 1;
#endif
++ syn;
++ str;
}
- else
+ else if (*str)
{
/* Syntax char didn't match. Can't be this insn. */
static char msg [80];
/* xgettext:c-format */
sprintf (msg, _("syntax error (expected char `%c', found `%c')"),
- *syn, *str);
+ CGEN_SYNTAX_CHAR(*syn), *str);
+ return msg;
+ }
+ else
+ {
+ /* Ran out of input. */
+ static char msg [80];
+ /* xgettext:c-format */
+ sprintf (msg, _("syntax error (expected char `%c', found end of instruction)"),
+ CGEN_SYNTAX_CHAR(*syn));
return msg;
}
continue;
}
/* If we're at the end of the syntax string, we're done. */
- if (* syn == '\0')
+ if (* syn == 0)
{
/* FIXME: For the moment we assume a valid `str' can only contain
blanks now. IE: We needn't try again with a longer version of
{
const char *start;
CGEN_INSN_LIST *ilist;
- const char *tmp_errmsg = NULL;
+ const char *parse_errmsg = NULL;
+ const char *insert_errmsg = NULL;
/* Skip leading white space. */
while (isspace (* str))
/* Allow parse/insert handlers to obtain length of insn. */
CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
- tmp_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields);
- if (tmp_errmsg != NULL)
+ parse_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields);
+ if (parse_errmsg != NULL)
continue;
/* ??? 0 is passed for `pc' */
- tmp_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf,
- (bfd_vma) 0);
- if (tmp_errmsg != NULL)
+ insert_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf,
+ (bfd_vma) 0);
+ if (insert_errmsg != NULL)
continue;
/* It is up to the caller to actually output the insn and any
return insn;
}
- /* Make sure we leave this with something at this point. */
- if (tmp_errmsg == NULL)
- tmp_errmsg = "unknown mnemonic";
-
{
static char errbuf[150];
+ const char *tmp_errmsg;
#ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS
- /* if verbose error messages, use errmsg from CGEN_PARSE_FN */
+ /* If requesting verbose error messages, use insert_errmsg.
+ Failing that, use parse_errmsg */
+ tmp_errmsg = (insert_errmsg ? insert_errmsg :
+ parse_errmsg ? parse_errmsg :
+ _("unrecognized instruction"));
+
if (strlen (start) > 50)
/* xgettext:c-format */
sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start);
THIS FILE IS MACHINE GENERATED WITH CGEN.
-Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU Binutils and/or GDB, the GNU debugger.
};
-
/* The hardware table. */
-#define A(a) (1 << CONCAT2 (CGEN_HW_,a))
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define A(a) (1 << CGEN_HW_##a)
+#else
+#define A(a) (1 << CGEN_HW_/**/a)
+#endif
const CGEN_HW_ENTRY m32r_cgen_hw_table[] =
{
#undef A
+
/* The instruction field table. */
-#define A(a) (1 << CONCAT2 (CGEN_IFLD_,a))
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define A(a) (1 << CGEN_IFLD_##a)
+#else
+#define A(a) (1 << CGEN_IFLD_/**/a)
+#endif
const CGEN_IFLD m32r_cgen_ifld_table[] =
{
#undef A
+
/* The operand table. */
-#define A(a) (1 << CONCAT2 (CGEN_OPERAND_,a))
-#define OPERAND(op) CONCAT2 (M32R_OPERAND_,op)
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define A(a) (1 << CGEN_OPERAND_##a)
+#else
+#define A(a) (1 << CGEN_OPERAND_/**/a)
+#endif
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define OPERAND(op) M32R_OPERAND_##op
+#else
+#define OPERAND(op) M32R_OPERAND_/**/op
+#endif
const CGEN_OPERAND m32r_cgen_operand_table[] =
{
#undef A
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
-#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
/* The instruction table. */
+#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
+#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
+
static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] =
{
/* Special null first entry.
},
};
-#undef A
-#undef MNEM
#undef OP
+#undef A
/* Initialize anything needed to be done once, before any cpu_open call. */
THIS FILE IS MACHINE GENERATED WITH CGEN.
-Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU Binutils and/or GDB, the GNU debugger.
#define CGEN_ARCH m32r
/* Given symbol S, return m32r_cgen_<S>. */
-#define CGEN_SYM(s) CONCAT3 (m32r,_cgen_,s)
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define CGEN_SYM(s) m32r##_cgen_##s
+#else
+#define CGEN_SYM(s) m32r/**/_cgen_/**/s
+#endif
+
/* Selected cpu families. */
#define HAVE_CPU_M32RBF
#define CGEN_INT_INSN_P 1
-/* Maximum nymber of syntax bytes in an instruction. */
+/* Maximum number of syntax elements in an instruction. */
#define CGEN_ACTUAL_MAX_SYNTAX_ELEMENTS 15
/* CGEN_MNEMONIC_OPERANDS is defined if mnemonics have operands.
THIS FILE IS MACHINE GENERATED WITH CGEN.
- the resultant file is machine generated, cgen-dis.in isn't
-Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU Binutils and GDB, the GNU debugger.
static void
print_hash (cd, dis_info, value, attrs, pc, length)
- CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+ CGEN_CPU_DESC cd;
PTR dis_info;
- long value ATTRIBUTE_UNUSED;
- unsigned int attrs ATTRIBUTE_UNUSED;
- bfd_vma pc ATTRIBUTE_UNUSED;
- int length ATTRIBUTE_UNUSED;
+ long value;
+ unsigned int attrs;
+ bfd_vma pc;
+ int length;
{
disassemble_info *info = (disassemble_info *) dis_info;
(*info->fprintf_func) (info->stream, "#");
int opindex;
PTR xinfo;
CGEN_FIELDS *fields;
- void const *attrs ATTRIBUTE_UNUSED;
+ void const *attrs;
bfd_vma pc;
int length;
{
static void
print_normal (cd, dis_info, value, attrs, pc, length)
+#ifdef CGEN_PRINT_NORMAL
+ CGEN_CPU_DESC cd;
+#else
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+#endif
PTR dis_info;
long value;
unsigned int attrs;
+#ifdef CGEN_PRINT_NORMAL
+ bfd_vma pc;
+ int length;
+#else
bfd_vma pc ATTRIBUTE_UNUSED;
int length ATTRIBUTE_UNUSED;
+#endif
{
disassemble_info *info = (disassemble_info *) dis_info;
static void
print_address (cd, dis_info, value, attrs, pc, length)
+#ifdef CGEN_PRINT_NORMAL
+ CGEN_CPU_DESC cd;
+#else
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+#endif
PTR dis_info;
bfd_vma value;
unsigned int attrs;
+#ifdef CGEN_PRINT_NORMAL
+ bfd_vma pc;
+ int length;
+#else
bfd_vma pc ATTRIBUTE_UNUSED;
int length ATTRIBUTE_UNUSED;
+#endif
{
disassemble_info *info = (disassemble_info *) dis_info;
{
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
disassemble_info *info = (disassemble_info *) dis_info;
- const unsigned char *syn;
+ const CGEN_SYNTAX_CHAR_TYPE *syn;
CGEN_INIT_PRINT (cd);
Returns 0 if all is well, non-zero otherwise. */
static int
read_insn (cd, pc, info, buf, buflen, ex_info, insn_value)
- CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+ CGEN_CPU_DESC cd;
bfd_vma pc;
disassemble_info *info;
char *buf;
ex_info->valid = (1 << buflen) - 1;
ex_info->insn_bytes = buf;
- switch (buflen)
- {
- case 1:
- *insn_value = buf[0];
- break;
- case 2:
- *insn_value = info->endian == BFD_ENDIAN_BIG ? bfd_getb16 (buf) : bfd_getl16 (buf);
- break;
- case 4:
- *insn_value = info->endian == BFD_ENDIAN_BIG ? bfd_getb32 (buf) : bfd_getl32 (buf);
- break;
- default:
- abort ();
- }
-
+ *insn_value = bfd_get_bits (buf, buflen * 8, info->endian == BFD_ENDIAN_BIG);
return 0;
}
unsigned long insn_value;
const CGEN_INSN_LIST *insn_list;
CGEN_EXTRACT_INFO ex_info;
-#if 0
+
int rc = read_insn (cd, pc, info, buf, buflen, & ex_info, & insn_value);
if (rc != 0)
return rc;
-#else
- ex_info.dis_info = info;
- ex_info.valid = (1 << buflen) - 1;
- ex_info.insn_bytes = buf;
- switch (buflen)
- {
- case 1:
- insn_value = buf[0];
- break;
- case 2:
- insn_value = info->endian == BFD_ENDIAN_BIG ? bfd_getb16 (buf) : bfd_getl16 (buf);
- break;
- case 4:
- insn_value = info->endian == BFD_ENDIAN_BIG ? bfd_getb32 (buf) : bfd_getl32 (buf);
- break;
- default:
- abort ();
- }
-#endif
/* The instructions are stored in hash lists.
Pick the first one and keep trying until we find the right one. */
/* Make sure the entire insn is loaded into insn_value, if it
can fit. */
- if ((unsigned) CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize &&
- (unsigned) (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long))
+ if (CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize &&
+ (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long))
{
unsigned long full_insn_value;
int rc = read_insn (cd, pc, info, buf,
else
length = CGEN_EXTRACT_FN (cd, insn)
(cd, insn, &ex_info, insn_value, &fields, pc);
+
/* length < 0 -> error */
if (length < 0)
return length;
#ifndef CGEN_PRINT_INSN
#define CGEN_PRINT_INSN default_print_insn
+#endif
static int
default_print_insn (cd, pc, info)
return print_insn (cd, pc, info, buf, cd->base_insn_bitsize / 8);
}
-#endif
/* Main entry point.
Print one instruction from PC on INFO->STREAM.
THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator.
- the resultant file is machine generated, cgen-ibld.in isn't
-Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU Binutils and GDB, the GNU debugger.
int shift;
int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG;
- switch (word_length)
- {
- case 8:
- x = *bufp;
- break;
- case 16:
- if (big_p)
- x = bfd_getb16 (bufp);
- else
- x = bfd_getl16 (bufp);
- break;
- case 24:
- /* ??? This may need reworking as these cases don't necessarily
- want the first byte and the last two bytes handled like this. */
- if (big_p)
- x = (bufp[0] << 16) | bfd_getb16 (bufp + 1);
- else
- x = bfd_getl16 (bufp) | (bufp[2] << 16);
- break;
- case 32:
- if (big_p)
- x = bfd_getb32 (bufp);
- else
- x = bfd_getl32 (bufp);
- break;
- default :
- abort ();
- }
+ x = bfd_get_bits (bufp, word_length, big_p);
/* Written this way to avoid undefined behaviour. */
mask = (((1L << (length - 1)) - 1) << 1) | 1;
shift = (word_length - (start + length));
x = (x & ~(mask << shift)) | ((value & mask) << shift);
- switch (word_length)
- {
- case 8:
- *bufp = x;
- break;
- case 16:
- if (big_p)
- bfd_putb16 (x, bufp);
- else
- bfd_putl16 (x, bufp);
- break;
- case 24:
- /* ??? This may need reworking as these cases don't necessarily
- want the first byte and the last two bytes handled like this. */
- if (big_p)
- {
- bufp[0] = x >> 16;
- bfd_putb16 (x, bufp + 1);
- }
- else
- {
- bfd_putl16 (x, bufp);
- bufp[2] = x >> 16;
- }
- break;
- case 32:
- if (big_p)
- bfd_putb32 (x, bufp);
- else
- bfd_putl32 (x, bufp);
- break;
- default :
- abort ();
- }
+ bfd_put_bits ((bfd_vma) x, bufp, word_length, big_p);
}
#endif /* ! CGEN_INT_INSN_P */
{
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
unsigned long value;
- const unsigned char * syn;
+ const CGEN_SYNTAX_CHAR_TYPE * syn;
CGEN_INIT_INSERT (cd);
value = CGEN_INSN_BASE_VALUE (insn);
e.g. storing a branch displacement that got resolved later.
Needs more thought first. */
- for (syn = CGEN_SYNTAX_STRING (syntax); * syn != '\0'; ++ syn)
+ for (syn = CGEN_SYNTAX_STRING (syntax); * syn; ++ syn)
{
const char *errmsg;
unsigned char *bufp;
bfd_vma pc;
{
- unsigned long x,mask;
+ unsigned long x;
int shift;
int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG;
- switch (word_length)
- {
- case 8:
- x = *bufp;
- break;
- case 16:
- if (big_p)
- x = bfd_getb16 (bufp);
- else
- x = bfd_getl16 (bufp);
- break;
- case 24:
- /* ??? This may need reworking as these cases don't necessarily
- want the first byte and the last two bytes handled like this. */
- if (big_p)
- x = (bufp[0] << 16) | bfd_getb16 (bufp + 1);
- else
- x = bfd_getl16 (bufp) | (bufp[2] << 16);
- break;
- case 32:
- if (big_p)
- x = bfd_getb32 (bufp);
- else
- x = bfd_getl32 (bufp);
- break;
- default :
- abort ();
- }
+ x = bfd_get_bits (bufp, word_length, big_p);
- /* Written this way to avoid undefined behaviour. */
- mask = (((1L << (length - 1)) - 1) << 1) | 1;
if (CGEN_INSN_LSB0_P)
shift = (start + 1) - length;
else
shift = (word_length - (start + length));
- return (x >> shift) & mask;
+ return x >> shift;
}
#endif /* ! CGEN_INT_INSN_P */
#endif
long *valuep;
{
- CGEN_INSN_INT value;
+ CGEN_INSN_INT value, mask;
/* If LENGTH is zero, this operand doesn't contribute to the value
so give it a standard value of zero. */
if (CGEN_INT_INSN_P || word_offset == 0)
{
- /* Written this way to avoid undefined behaviour. */
- CGEN_INSN_INT mask = (((1L << (length - 1)) - 1) << 1) | 1;
-
if (CGEN_INSN_LSB0_P)
value = insn_value >> ((word_offset + start + 1) - length);
else
value = insn_value >> (total_length - ( word_offset + start + length));
- value &= mask;
- /* sign extend? */
- if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)
- && (value & (1L << (length - 1))))
- value |= ~mask;
}
#if ! CGEN_INT_INSN_P
#endif /* ! CGEN_INT_INSN_P */
+ /* Written this way to avoid undefined behaviour. */
+ mask = (((1L << (length - 1)) - 1) << 1) | 1;
+
+ value &= mask;
+ /* sign extend? */
+ if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)
+ && (value & (1L << (length - 1))))
+ value |= ~mask;
+
*valuep = value;
return 1;
bfd_vma pc;
{
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
- const unsigned char *syn;
+ const CGEN_SYNTAX_CHAR_TYPE *syn;
CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
THIS FILE IS MACHINE GENERATED WITH CGEN.
-Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU Binutils and/or GDB, the GNU debugger.
/* Instruction formats. */
-#define F(f) & m32r_cgen_ifld_table[CONCAT2 (M32R_,f)]
-
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define F(f) & m32r_cgen_ifld_table[M32R_##f]
+#else
+#define F(f) & m32r_cgen_ifld_table[M32R_/**/f]
+#endif
static const CGEN_IFMT ifmt_empty = {
0, 0, 0x0, { { 0 } }
};
#undef F
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
+#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) M32R_OPERAND_##op
+#else
+#define OPERAND(op) M32R_OPERAND_/**/op
+#endif
#define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
-#define OPERAND(op) CONCAT2 (M32R_OPERAND_,op)
#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
/* The instruction table. */
};
#undef A
-#undef MNEM
#undef OPERAND
+#undef MNEM
#undef OP
/* Formats for ALIAS macro-insns. */
-#define F(f) & m32r_cgen_ifld_table[CONCAT2 (M32R_,f)]
-
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define F(f) & m32r_cgen_ifld_table[M32R_##f]
+#else
+#define F(f) & m32r_cgen_ifld_table[M32R_/**/f]
+#endif
static const CGEN_IFMT ifmt_bc8r = {
16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
};
/* Each non-simple macro entry points to an array of expansion possibilities. */
-#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
+#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) M32R_OPERAND_##op
+#else
+#define OPERAND(op) M32R_OPERAND_/**/op
+#endif
#define MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
-#define OPERAND(op) CONCAT2 (M32R_OPERAND_,op)
#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
/* The macro instruction table. */
};
#undef A
-#undef MNEM
#undef OPERAND
+#undef MNEM
#undef OP
#ifndef CGEN_ASM_HASH_P
THIS FILE IS MACHINE GENERATED WITH CGEN.
-Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU Binutils and/or GDB, the GNU debugger.
THIS FILE IS MACHINE GENERATED WITH CGEN.
-Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU Binutils and/or GDB, the GNU debugger.
/* Operand references. */
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#define OP_ENT(op) M32R_OPERAND_##op
+#else
+#define OP_ENT(op) M32R_OPERAND_/**/op
+#endif
#define INPUT CGEN_OPINST_INPUT
#define OUTPUT CGEN_OPINST_OUTPUT
#define END CGEN_OPINST_END
#define COND_REF CGEN_OPINST_COND_REF
-#define OP_ENT(op) CONCAT2 (M32R_OPERAND_,op)
static const CGEN_OPINST sfmt_empty_ops[] = {
{ END }
{ END }
};
+#undef OP_ENT
#undef INPUT
#undef OUTPUT
#undef END
#undef COND_REF
-#undef OP_ENT
/* Operand instance lookup table. */