2001-03-05 Dave Brolley <brolley@redhat.co

* 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.
This commit is contained in:
Dave Brolley
2001-03-05 15:55:01 +00:00
parent 1c7566d167
commit b3466c39bc
16 changed files with 327 additions and 389 deletions

View File

@ -1,3 +1,21 @@
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> 2001-02-28 Igor Shevlyakov <igor@windriver.com>
* m68k-opc.c: fix cpushl according to Motorola. Enable * m68k-opc.c: fix cpushl according to Motorola. Enable

View File

@ -4,7 +4,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN. THIS FILE IS MACHINE GENERATED WITH CGEN.
- the resultant file is machine generated, cgen-asm.in isn't - 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. This file is part of the GNU Binutils and GDB, the GNU debugger.
@ -351,7 +351,7 @@ parse_insn_normal (cd, insn, strp, fields)
const char *str = *strp; const char *str = *strp;
const char *errmsg; const char *errmsg;
const char *p; const char *p;
const unsigned char * syn; const CGEN_SYNTAX_CHAR_TYPE * syn;
#ifdef CGEN_MNEMONIC_OPERANDS #ifdef CGEN_MNEMONIC_OPERANDS
/* FIXME: wip */ /* FIXME: wip */
int past_opcode_p; int past_opcode_p;
@ -401,19 +401,28 @@ parse_insn_normal (cd, insn, strp, fields)
if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn))) if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn)))
{ {
#ifdef CGEN_MNEMONIC_OPERANDS #ifdef CGEN_MNEMONIC_OPERANDS
if (* syn == ' ') if (CGEN_SYNTAX_CHAR(* syn) == ' ')
past_opcode_p = 1; past_opcode_p = 1;
#endif #endif
++ syn; ++ syn;
++ str; ++ str;
} }
else else if (*str)
{ {
/* Syntax char didn't match. Can't be this insn. */ /* Syntax char didn't match. Can't be this insn. */
static char msg [80]; static char msg [80];
/* xgettext:c-format */ /* xgettext:c-format */
sprintf (msg, _("syntax error (expected char `%c', found `%c')"), 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; return msg;
} }
continue; continue;
@ -430,7 +439,7 @@ parse_insn_normal (cd, insn, strp, fields)
} }
/* If we're at the end of the syntax string, we're done. */ /* 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 /* 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 blanks now. IE: We needn't try again with a longer version of
@ -480,7 +489,8 @@ fr30_cgen_assemble_insn (cd, str, fields, buf, errmsg)
{ {
const char *start; const char *start;
CGEN_INSN_LIST *ilist; CGEN_INSN_LIST *ilist;
const char *tmp_errmsg = NULL; const char *parse_errmsg = NULL;
const char *insert_errmsg = NULL;
/* Skip leading white space. */ /* Skip leading white space. */
while (isspace (* str)) while (isspace (* str))
@ -515,14 +525,14 @@ fr30_cgen_assemble_insn (cd, str, fields, buf, errmsg)
/* Allow parse/insert handlers to obtain length of insn. */ /* Allow parse/insert handlers to obtain length of insn. */
CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn); CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
tmp_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields); parse_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields);
if (tmp_errmsg != NULL) if (parse_errmsg != NULL)
continue; continue;
/* ??? 0 is passed for `pc' */ /* ??? 0 is passed for `pc' */
tmp_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf, insert_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf,
(bfd_vma) 0); (bfd_vma) 0);
if (tmp_errmsg != NULL) if (insert_errmsg != NULL)
continue; continue;
/* It is up to the caller to actually output the insn and any /* It is up to the caller to actually output the insn and any
@ -530,15 +540,17 @@ fr30_cgen_assemble_insn (cd, str, fields, buf, errmsg)
return insn; return insn;
} }
/* Make sure we leave this with something at this point. */
if (tmp_errmsg == NULL)
tmp_errmsg = "unknown mnemonic";
{ {
static char errbuf[150]; static char errbuf[150];
const char *tmp_errmsg;
#ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS #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) if (strlen (start) > 50)
/* xgettext:c-format */ /* xgettext:c-format */
sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start); sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start);

View File

@ -2,7 +2,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN. 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 part of the GNU Binutils and/or GDB, the GNU debugger.
@ -249,10 +249,13 @@ CGEN_KEYWORD fr30_cgen_opval_h_r15 =
}; };
/* The hardware table. */ /* 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[] = const CGEN_HW_ENTRY fr30_cgen_hw_table[] =
{ {
@ -286,9 +289,14 @@ const CGEN_HW_ENTRY fr30_cgen_hw_table[] =
#undef A #undef A
/* The instruction field table. */ /* 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[] = const CGEN_IFLD fr30_cgen_ifld_table[] =
{ {
@ -338,10 +346,19 @@ const CGEN_IFLD fr30_cgen_ifld_table[] =
#undef A #undef A
/* The operand table. */ /* The operand table. */
#define A(a) (1 << CONCAT2 (CGEN_OPERAND_,a)) #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
#define OPERAND(op) CONCAT2 (FR30_OPERAND_,op) #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[] = const CGEN_OPERAND fr30_cgen_operand_table[] =
{ {
@ -497,11 +514,16 @@ const CGEN_OPERAND fr30_cgen_operand_table[] =
#undef A #undef A
#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
/* The instruction table. */ /* 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] = static const CGEN_IBASE fr30_cgen_insn_table[MAX_INSNS] =
{ {
/* Special null first entry. /* Special null first entry.
@ -1335,9 +1357,8 @@ static const CGEN_IBASE fr30_cgen_insn_table[MAX_INSNS] =
}, },
}; };
#undef A
#undef MNEM
#undef OP #undef OP
#undef A
/* Initialize anything needed to be done once, before any cpu_open call. */ /* Initialize anything needed to be done once, before any cpu_open call. */

View File

@ -2,7 +2,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN. 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 part of the GNU Binutils and/or GDB, the GNU debugger.
@ -28,7 +28,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define CGEN_ARCH fr30 #define CGEN_ARCH fr30
/* Given symbol S, return fr30_cgen_<S>. */ /* 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. */ /* Selected cpu families. */
#define HAVE_CPU_FR30BF #define HAVE_CPU_FR30BF
@ -43,7 +48,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define CGEN_INT_INSN_P 0 #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 #define CGEN_ACTUAL_MAX_SYNTAX_ELEMENTS 15
/* CGEN_MNEMONIC_OPERANDS is defined if mnemonics have operands. /* CGEN_MNEMONIC_OPERANDS is defined if mnemonics have operands.

View File

@ -4,7 +4,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN. THIS FILE IS MACHINE GENERATED WITH CGEN.
- the resultant file is machine generated, cgen-dis.in isn't - 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. This file is part of the GNU Binutils and GDB, the GNU debugger.
@ -96,60 +96,60 @@ print_register_list (dis_info, value, offset, load_store)
static void static void
print_hi_register_list_ld (cd, dis_info, value, attrs, pc, length) 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; PTR dis_info;
long value; long value;
unsigned int attrs ATTRIBUTE_UNUSED; unsigned int attrs;
bfd_vma pc ATTRIBUTE_UNUSED; bfd_vma pc;
int length ATTRIBUTE_UNUSED; int length;
{ {
print_register_list (dis_info, value, 8, 0/*load*/); print_register_list (dis_info, value, 8, 0/*load*/);
} }
static void static void
print_low_register_list_ld (cd, dis_info, value, attrs, pc, length) 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; PTR dis_info;
long value; long value;
unsigned int attrs ATTRIBUTE_UNUSED; unsigned int attrs;
bfd_vma pc ATTRIBUTE_UNUSED; bfd_vma pc;
int length ATTRIBUTE_UNUSED; int length;
{ {
print_register_list (dis_info, value, 0, 0/*load*/); print_register_list (dis_info, value, 0, 0/*load*/);
} }
static void static void
print_hi_register_list_st (cd, dis_info, value, attrs, pc, length) 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; PTR dis_info;
long value; long value;
unsigned int attrs ATTRIBUTE_UNUSED; unsigned int attrs;
bfd_vma pc ATTRIBUTE_UNUSED; bfd_vma pc;
int length ATTRIBUTE_UNUSED; int length;
{ {
print_register_list (dis_info, value, 8, 1/*store*/); print_register_list (dis_info, value, 8, 1/*store*/);
} }
static void static void
print_low_register_list_st (cd, dis_info, value, attrs, pc, length) 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; PTR dis_info;
long value; long value;
unsigned int attrs ATTRIBUTE_UNUSED; unsigned int attrs;
bfd_vma pc ATTRIBUTE_UNUSED; bfd_vma pc;
int length ATTRIBUTE_UNUSED; int length;
{ {
print_register_list (dis_info, value, 0, 1/*store*/); print_register_list (dis_info, value, 0, 1/*store*/);
} }
static void static void
print_m4 (cd, dis_info, value, attrs, pc, length) print_m4 (cd, dis_info, value, attrs, pc, length)
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; CGEN_CPU_DESC cd;
PTR dis_info; PTR dis_info;
long value; long value;
unsigned int attrs ATTRIBUTE_UNUSED; unsigned int attrs;
bfd_vma pc ATTRIBUTE_UNUSED; bfd_vma pc;
int length ATTRIBUTE_UNUSED; int length;
{ {
disassemble_info *info = (disassemble_info *) dis_info; disassemble_info *info = (disassemble_info *) dis_info;
(*info->fprintf_func) (info->stream, "%ld", value); (*info->fprintf_func) (info->stream, "%ld", value);
@ -178,7 +178,7 @@ fr30_cgen_print_operand (cd, opindex, xinfo, fields, attrs, pc, length)
int opindex; int opindex;
PTR xinfo; PTR xinfo;
CGEN_FIELDS *fields; CGEN_FIELDS *fields;
void const *attrs ATTRIBUTE_UNUSED; void const *attrs;
bfd_vma pc; bfd_vma pc;
int length; int length;
{ {
@ -430,7 +430,7 @@ print_insn_normal (cd, dis_info, insn, fields, pc, length)
{ {
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
disassemble_info *info = (disassemble_info *) dis_info; disassemble_info *info = (disassemble_info *) dis_info;
const unsigned char *syn; const CGEN_SYNTAX_CHAR_TYPE *syn;
CGEN_INIT_PRINT (cd); CGEN_INIT_PRINT (cd);
@ -458,7 +458,7 @@ print_insn_normal (cd, dis_info, insn, fields, pc, length)
Returns 0 if all is well, non-zero otherwise. */ Returns 0 if all is well, non-zero otherwise. */
static int static int
read_insn (cd, pc, info, buf, buflen, ex_info, insn_value) read_insn (cd, pc, info, buf, buflen, ex_info, insn_value)
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; CGEN_CPU_DESC cd;
bfd_vma pc; bfd_vma pc;
disassemble_info *info; disassemble_info *info;
char *buf; char *buf;
@ -477,21 +477,7 @@ read_insn (cd, pc, info, buf, buflen, ex_info, insn_value)
ex_info->valid = (1 << buflen) - 1; ex_info->valid = (1 << buflen) - 1;
ex_info->insn_bytes = buf; ex_info->insn_bytes = buf;
switch (buflen) *insn_value = bfd_get_bits (buf, buflen * 8, info->endian == BFD_ENDIAN_BIG);
{
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 ();
}
return 0; return 0;
} }
@ -549,8 +535,8 @@ print_insn (cd, pc, info, buf, buflen)
/* Make sure the entire insn is loaded into insn_value, if it /* Make sure the entire insn is loaded into insn_value, if it
can fit. */ can fit. */
if ((unsigned) CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize && if (CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize &&
(unsigned) (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long)) (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long))
{ {
unsigned long full_insn_value; unsigned long full_insn_value;
int rc = read_insn (cd, pc, info, buf, int rc = read_insn (cd, pc, info, buf,

View File

@ -3,7 +3,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator. THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator.
- the resultant file is machine generated, cgen-ibld.in isn't - 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. This file is part of the GNU Binutils and GDB, the GNU debugger.
@ -78,34 +78,7 @@ insert_1 (cd, value, start, length, word_length, bufp)
int shift; int shift;
int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG; int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG;
switch (word_length) x = bfd_get_bits (bufp, word_length, big_p);
{
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 ();
}
/* Written this way to avoid undefined behaviour. */ /* Written this way to avoid undefined behaviour. */
mask = (((1L << (length - 1)) - 1) << 1) | 1; mask = (((1L << (length - 1)) - 1) << 1) | 1;
@ -115,40 +88,7 @@ insert_1 (cd, value, start, length, word_length, bufp)
shift = (word_length - (start + length)); shift = (word_length - (start + length));
x = (x & ~(mask << shift)) | ((value & mask) << shift); x = (x & ~(mask << shift)) | ((value & mask) << shift);
switch (word_length) bfd_put_bits ((bfd_vma) x, bufp, word_length, big_p);
{
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 ();
}
} }
#endif /* ! CGEN_INT_INSN_P */ #endif /* ! CGEN_INT_INSN_P */
@ -278,7 +218,7 @@ insert_insn_normal (cd, insn, fields, buffer, pc)
{ {
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
unsigned long value; unsigned long value;
const unsigned char * syn; const CGEN_SYNTAX_CHAR_TYPE * syn;
CGEN_INIT_INSERT (cd); CGEN_INIT_INSERT (cd);
value = CGEN_INSN_BASE_VALUE (insn); value = CGEN_INSN_BASE_VALUE (insn);
@ -304,7 +244,7 @@ insert_insn_normal (cd, insn, fields, buffer, pc)
e.g. storing a branch displacement that got resolved later. e.g. storing a branch displacement that got resolved later.
Needs more thought first. */ Needs more thought first. */
for (syn = CGEN_SYNTAX_STRING (syntax); * syn != '\0'; ++ syn) for (syn = CGEN_SYNTAX_STRING (syntax); * syn; ++ syn)
{ {
const char *errmsg; const char *errmsg;
@ -406,46 +346,17 @@ extract_1 (cd, ex_info, start, length, word_length, bufp, pc)
unsigned char *bufp; unsigned char *bufp;
bfd_vma pc; bfd_vma pc;
{ {
unsigned long x,mask; unsigned long x;
int shift; int shift;
int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG; int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG;
switch (word_length) x = bfd_get_bits (bufp, word_length, big_p);
{
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 ();
}
/* Written this way to avoid undefined behaviour. */
mask = (((1L << (length - 1)) - 1) << 1) | 1;
if (CGEN_INSN_LSB0_P) if (CGEN_INSN_LSB0_P)
shift = (start + 1) - length; shift = (start + 1) - length;
else else
shift = (word_length - (start + length)); shift = (word_length - (start + length));
return (x >> shift) & mask; return x >> shift;
} }
#endif /* ! CGEN_INT_INSN_P */ #endif /* ! CGEN_INT_INSN_P */
@ -489,7 +400,7 @@ extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length,
#endif #endif
long *valuep; long *valuep;
{ {
CGEN_INSN_INT value; CGEN_INSN_INT value, mask;
/* If LENGTH is zero, this operand doesn't contribute to the value /* If LENGTH is zero, this operand doesn't contribute to the value
so give it a standard value of zero. */ so give it a standard value of zero. */
@ -521,18 +432,10 @@ extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length,
if (CGEN_INT_INSN_P || word_offset == 0) 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) if (CGEN_INSN_LSB0_P)
value = insn_value >> ((word_offset + start + 1) - length); value = insn_value >> ((word_offset + start + 1) - length);
else else
value = insn_value >> (total_length - ( word_offset + start + length)); 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 #if ! CGEN_INT_INSN_P
@ -552,6 +455,15 @@ extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length,
#endif /* ! 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; *valuep = value;
return 1; return 1;
@ -576,7 +488,7 @@ extract_insn_normal (cd, insn, ex_info, insn_value, fields, pc)
bfd_vma pc; bfd_vma pc;
{ {
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); 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); CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);

View File

@ -2,7 +2,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN. 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 part of the GNU Binutils and/or GDB, the GNU debugger.
@ -40,8 +40,11 @@ static unsigned int dis_hash_insn PARAMS ((const char *, CGEN_INSN_INT));
/* Instruction formats. */ /* 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 = { static const CGEN_IFMT ifmt_empty = {
0, 0, 0x0, { { 0 } } 0, 0, 0x0, { { 0 } }
}; };
@ -164,9 +167,17 @@ static const CGEN_IFMT ifmt_enter = {
#undef F #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 MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
#define OPERAND(op) CONCAT2 (FR30_OPERAND_,op)
#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field)) #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
/* The instruction table. */ /* The instruction table. */
@ -1170,14 +1181,17 @@ static const CGEN_OPCODE fr30_cgen_insn_opcode_table[MAX_INSNS] =
}; };
#undef A #undef A
#undef MNEM
#undef OPERAND #undef OPERAND
#undef MNEM
#undef OP #undef OP
/* Formats for ALIAS macro-insns. */ /* 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 = { static const CGEN_IFMT ifmt_ldi8m = {
16, 16, 0xf000, { { F (F_OP1) }, { F (F_I8) }, { F (F_RI) }, { 0 } } 16, 16, 0xf000, { { F (F_OP1) }, { F (F_I8) }, { F (F_RI) }, { 0 } }
}; };
@ -1194,9 +1208,17 @@ static const CGEN_IFMT ifmt_ldi32m = {
/* Each non-simple macro entry points to an array of expansion possibilities. */ /* 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 MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
#define OPERAND(op) CONCAT2 (FR30_OPERAND_,op)
#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field)) #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
/* The macro instruction table. */ /* The macro instruction table. */
@ -1245,8 +1267,8 @@ static const CGEN_OPCODE fr30_cgen_macro_insn_opcode_table[] =
}; };
#undef A #undef A
#undef MNEM
#undef OPERAND #undef OPERAND
#undef MNEM
#undef OP #undef OP
#ifndef CGEN_ASM_HASH_P #ifndef CGEN_ASM_HASH_P

View File

@ -2,7 +2,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN. 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 part of the GNU Binutils and/or GDB, the GNU debugger.

View File

@ -4,7 +4,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN. THIS FILE IS MACHINE GENERATED WITH CGEN.
- the resultant file is machine generated, cgen-asm.in isn't - 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. This file is part of the GNU Binutils and GDB, the GNU debugger.
@ -359,7 +359,7 @@ parse_insn_normal (cd, insn, strp, fields)
const char *str = *strp; const char *str = *strp;
const char *errmsg; const char *errmsg;
const char *p; const char *p;
const unsigned char * syn; const CGEN_SYNTAX_CHAR_TYPE * syn;
#ifdef CGEN_MNEMONIC_OPERANDS #ifdef CGEN_MNEMONIC_OPERANDS
/* FIXME: wip */ /* FIXME: wip */
int past_opcode_p; int past_opcode_p;
@ -409,19 +409,28 @@ parse_insn_normal (cd, insn, strp, fields)
if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn))) if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn)))
{ {
#ifdef CGEN_MNEMONIC_OPERANDS #ifdef CGEN_MNEMONIC_OPERANDS
if (* syn == ' ') if (CGEN_SYNTAX_CHAR(* syn) == ' ')
past_opcode_p = 1; past_opcode_p = 1;
#endif #endif
++ syn; ++ syn;
++ str; ++ str;
} }
else else if (*str)
{ {
/* Syntax char didn't match. Can't be this insn. */ /* Syntax char didn't match. Can't be this insn. */
static char msg [80]; static char msg [80];
/* xgettext:c-format */ /* xgettext:c-format */
sprintf (msg, _("syntax error (expected char `%c', found `%c')"), 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; return msg;
} }
continue; continue;
@ -438,7 +447,7 @@ parse_insn_normal (cd, insn, strp, fields)
} }
/* If we're at the end of the syntax string, we're done. */ /* 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 /* 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 blanks now. IE: We needn't try again with a longer version of
@ -488,7 +497,8 @@ m32r_cgen_assemble_insn (cd, str, fields, buf, errmsg)
{ {
const char *start; const char *start;
CGEN_INSN_LIST *ilist; CGEN_INSN_LIST *ilist;
const char *tmp_errmsg = NULL; const char *parse_errmsg = NULL;
const char *insert_errmsg = NULL;
/* Skip leading white space. */ /* Skip leading white space. */
while (isspace (* str)) while (isspace (* str))
@ -523,14 +533,14 @@ m32r_cgen_assemble_insn (cd, str, fields, buf, errmsg)
/* Allow parse/insert handlers to obtain length of insn. */ /* Allow parse/insert handlers to obtain length of insn. */
CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn); CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
tmp_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields); parse_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields);
if (tmp_errmsg != NULL) if (parse_errmsg != NULL)
continue; continue;
/* ??? 0 is passed for `pc' */ /* ??? 0 is passed for `pc' */
tmp_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf, insert_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf,
(bfd_vma) 0); (bfd_vma) 0);
if (tmp_errmsg != NULL) if (insert_errmsg != NULL)
continue; continue;
/* It is up to the caller to actually output the insn and any /* It is up to the caller to actually output the insn and any
@ -538,15 +548,17 @@ m32r_cgen_assemble_insn (cd, str, fields, buf, errmsg)
return insn; return insn;
} }
/* Make sure we leave this with something at this point. */
if (tmp_errmsg == NULL)
tmp_errmsg = "unknown mnemonic";
{ {
static char errbuf[150]; static char errbuf[150];
const char *tmp_errmsg;
#ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS #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) if (strlen (start) > 50)
/* xgettext:c-format */ /* xgettext:c-format */
sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start); sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start);

View File

@ -2,7 +2,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN. 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 part of the GNU Binutils and/or GDB, the GNU debugger.
@ -219,10 +219,13 @@ CGEN_KEYWORD m32r_cgen_opval_h_accums =
}; };
/* The hardware table. */ /* 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[] = const CGEN_HW_ENTRY m32r_cgen_hw_table[] =
{ {
@ -249,9 +252,14 @@ const CGEN_HW_ENTRY m32r_cgen_hw_table[] =
#undef A #undef A
/* The instruction field table. */ /* 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[] = const CGEN_IFLD m32r_cgen_ifld_table[] =
{ {
@ -286,10 +294,19 @@ const CGEN_IFLD m32r_cgen_ifld_table[] =
#undef A #undef A
/* The operand table. */ /* The operand table. */
#define A(a) (1 << CONCAT2 (CGEN_OPERAND_,a)) #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
#define OPERAND(op) CONCAT2 (M32R_OPERAND_,op) #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[] = const CGEN_OPERAND m32r_cgen_operand_table[] =
{ {
@ -376,11 +393,16 @@ const CGEN_OPERAND m32r_cgen_operand_table[] =
#undef A #undef A
#define A(a) (1 << CONCAT2 (CGEN_INSN_,a))
#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
/* The instruction table. */ /* 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] = static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] =
{ {
/* Special null first entry. /* Special null first entry.
@ -1059,9 +1081,8 @@ static const CGEN_IBASE m32r_cgen_insn_table[MAX_INSNS] =
}, },
}; };
#undef A
#undef MNEM
#undef OP #undef OP
#undef A
/* Initialize anything needed to be done once, before any cpu_open call. */ /* Initialize anything needed to be done once, before any cpu_open call. */

View File

@ -2,7 +2,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN. 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 part of the GNU Binutils and/or GDB, the GNU debugger.
@ -28,7 +28,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define CGEN_ARCH m32r #define CGEN_ARCH m32r
/* Given symbol S, return m32r_cgen_<S>. */ /* 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. */ /* Selected cpu families. */
#define HAVE_CPU_M32RBF #define HAVE_CPU_M32RBF
@ -44,7 +49,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define CGEN_INT_INSN_P 1 #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 #define CGEN_ACTUAL_MAX_SYNTAX_ELEMENTS 15
/* CGEN_MNEMONIC_OPERANDS is defined if mnemonics have operands. /* CGEN_MNEMONIC_OPERANDS is defined if mnemonics have operands.

View File

@ -4,7 +4,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN. THIS FILE IS MACHINE GENERATED WITH CGEN.
- the resultant file is machine generated, cgen-dis.in isn't - 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. This file is part of the GNU Binutils and GDB, the GNU debugger.
@ -68,12 +68,12 @@ do { \
static void static void
print_hash (cd, dis_info, value, attrs, pc, length) print_hash (cd, dis_info, value, attrs, pc, length)
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; CGEN_CPU_DESC cd;
PTR dis_info; PTR dis_info;
long value ATTRIBUTE_UNUSED; long value;
unsigned int attrs ATTRIBUTE_UNUSED; unsigned int attrs;
bfd_vma pc ATTRIBUTE_UNUSED; bfd_vma pc;
int length ATTRIBUTE_UNUSED; int length;
{ {
disassemble_info *info = (disassemble_info *) dis_info; disassemble_info *info = (disassemble_info *) dis_info;
(*info->fprintf_func) (info->stream, "#"); (*info->fprintf_func) (info->stream, "#");
@ -156,7 +156,7 @@ m32r_cgen_print_operand (cd, opindex, xinfo, fields, attrs, pc, length)
int opindex; int opindex;
PTR xinfo; PTR xinfo;
CGEN_FIELDS *fields; CGEN_FIELDS *fields;
void const *attrs ATTRIBUTE_UNUSED; void const *attrs;
bfd_vma pc; bfd_vma pc;
int length; int length;
{ {
@ -263,12 +263,21 @@ m32r_cgen_init_dis (cd)
static void static void
print_normal (cd, dis_info, value, attrs, pc, length) print_normal (cd, dis_info, value, attrs, pc, length)
#ifdef CGEN_PRINT_NORMAL
CGEN_CPU_DESC cd;
#else
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
#endif
PTR dis_info; PTR dis_info;
long value; long value;
unsigned int attrs; unsigned int attrs;
#ifdef CGEN_PRINT_NORMAL
bfd_vma pc;
int length;
#else
bfd_vma pc ATTRIBUTE_UNUSED; bfd_vma pc ATTRIBUTE_UNUSED;
int length ATTRIBUTE_UNUSED; int length ATTRIBUTE_UNUSED;
#endif
{ {
disassemble_info *info = (disassemble_info *) dis_info; disassemble_info *info = (disassemble_info *) dis_info;
@ -289,12 +298,21 @@ print_normal (cd, dis_info, value, attrs, pc, length)
static void static void
print_address (cd, dis_info, value, attrs, pc, length) print_address (cd, dis_info, value, attrs, pc, length)
#ifdef CGEN_PRINT_NORMAL
CGEN_CPU_DESC cd;
#else
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
#endif
PTR dis_info; PTR dis_info;
bfd_vma value; bfd_vma value;
unsigned int attrs; unsigned int attrs;
#ifdef CGEN_PRINT_NORMAL
bfd_vma pc;
int length;
#else
bfd_vma pc ATTRIBUTE_UNUSED; bfd_vma pc ATTRIBUTE_UNUSED;
int length ATTRIBUTE_UNUSED; int length ATTRIBUTE_UNUSED;
#endif
{ {
disassemble_info *info = (disassemble_info *) dis_info; disassemble_info *info = (disassemble_info *) dis_info;
@ -351,7 +369,7 @@ print_insn_normal (cd, dis_info, insn, fields, pc, length)
{ {
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
disassemble_info *info = (disassemble_info *) dis_info; disassemble_info *info = (disassemble_info *) dis_info;
const unsigned char *syn; const CGEN_SYNTAX_CHAR_TYPE *syn;
CGEN_INIT_PRINT (cd); CGEN_INIT_PRINT (cd);
@ -379,7 +397,7 @@ print_insn_normal (cd, dis_info, insn, fields, pc, length)
Returns 0 if all is well, non-zero otherwise. */ Returns 0 if all is well, non-zero otherwise. */
static int static int
read_insn (cd, pc, info, buf, buflen, ex_info, insn_value) read_insn (cd, pc, info, buf, buflen, ex_info, insn_value)
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; CGEN_CPU_DESC cd;
bfd_vma pc; bfd_vma pc;
disassemble_info *info; disassemble_info *info;
char *buf; char *buf;
@ -398,21 +416,7 @@ read_insn (cd, pc, info, buf, buflen, ex_info, insn_value)
ex_info->valid = (1 << buflen) - 1; ex_info->valid = (1 << buflen) - 1;
ex_info->insn_bytes = buf; ex_info->insn_bytes = buf;
switch (buflen) *insn_value = bfd_get_bits (buf, buflen * 8, info->endian == BFD_ENDIAN_BIG);
{
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 ();
}
return 0; return 0;
} }
@ -433,30 +437,11 @@ print_insn (cd, pc, info, buf, buflen)
unsigned long insn_value; unsigned long insn_value;
const CGEN_INSN_LIST *insn_list; const CGEN_INSN_LIST *insn_list;
CGEN_EXTRACT_INFO ex_info; CGEN_EXTRACT_INFO ex_info;
#if 0
int rc = read_insn (cd, pc, info, buf, buflen, & ex_info, & insn_value); int rc = read_insn (cd, pc, info, buf, buflen, & ex_info, & insn_value);
if (rc != 0) if (rc != 0)
return rc; 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. /* The instructions are stored in hash lists.
Pick the first one and keep trying until we find the right one. */ Pick the first one and keep trying until we find the right one. */
@ -489,8 +474,8 @@ print_insn (cd, pc, info, buf, buflen)
/* Make sure the entire insn is loaded into insn_value, if it /* Make sure the entire insn is loaded into insn_value, if it
can fit. */ can fit. */
if ((unsigned) CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize && if (CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize &&
(unsigned) (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long)) (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long))
{ {
unsigned long full_insn_value; unsigned long full_insn_value;
int rc = read_insn (cd, pc, info, buf, int rc = read_insn (cd, pc, info, buf,
@ -504,6 +489,7 @@ print_insn (cd, pc, info, buf, buflen)
else else
length = CGEN_EXTRACT_FN (cd, insn) length = CGEN_EXTRACT_FN (cd, insn)
(cd, insn, &ex_info, insn_value, &fields, pc); (cd, insn, &ex_info, insn_value, &fields, pc);
/* length < 0 -> error */ /* length < 0 -> error */
if (length < 0) if (length < 0)
return length; return length;
@ -527,6 +513,7 @@ print_insn (cd, pc, info, buf, buflen)
#ifndef CGEN_PRINT_INSN #ifndef CGEN_PRINT_INSN
#define CGEN_PRINT_INSN default_print_insn #define CGEN_PRINT_INSN default_print_insn
#endif
static int static int
default_print_insn (cd, pc, info) default_print_insn (cd, pc, info)
@ -548,7 +535,6 @@ default_print_insn (cd, pc, info)
return print_insn (cd, pc, info, buf, cd->base_insn_bitsize / 8); return print_insn (cd, pc, info, buf, cd->base_insn_bitsize / 8);
} }
#endif
/* Main entry point. /* Main entry point.
Print one instruction from PC on INFO->STREAM. Print one instruction from PC on INFO->STREAM.

View File

@ -3,7 +3,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator. THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator.
- the resultant file is machine generated, cgen-ibld.in isn't - 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. This file is part of the GNU Binutils and GDB, the GNU debugger.
@ -78,34 +78,7 @@ insert_1 (cd, value, start, length, word_length, bufp)
int shift; int shift;
int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG; int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG;
switch (word_length) x = bfd_get_bits (bufp, word_length, big_p);
{
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 ();
}
/* Written this way to avoid undefined behaviour. */ /* Written this way to avoid undefined behaviour. */
mask = (((1L << (length - 1)) - 1) << 1) | 1; mask = (((1L << (length - 1)) - 1) << 1) | 1;
@ -115,40 +88,7 @@ insert_1 (cd, value, start, length, word_length, bufp)
shift = (word_length - (start + length)); shift = (word_length - (start + length));
x = (x & ~(mask << shift)) | ((value & mask) << shift); x = (x & ~(mask << shift)) | ((value & mask) << shift);
switch (word_length) bfd_put_bits ((bfd_vma) x, bufp, word_length, big_p);
{
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 ();
}
} }
#endif /* ! CGEN_INT_INSN_P */ #endif /* ! CGEN_INT_INSN_P */
@ -278,7 +218,7 @@ insert_insn_normal (cd, insn, fields, buffer, pc)
{ {
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
unsigned long value; unsigned long value;
const unsigned char * syn; const CGEN_SYNTAX_CHAR_TYPE * syn;
CGEN_INIT_INSERT (cd); CGEN_INIT_INSERT (cd);
value = CGEN_INSN_BASE_VALUE (insn); value = CGEN_INSN_BASE_VALUE (insn);
@ -304,7 +244,7 @@ insert_insn_normal (cd, insn, fields, buffer, pc)
e.g. storing a branch displacement that got resolved later. e.g. storing a branch displacement that got resolved later.
Needs more thought first. */ Needs more thought first. */
for (syn = CGEN_SYNTAX_STRING (syntax); * syn != '\0'; ++ syn) for (syn = CGEN_SYNTAX_STRING (syntax); * syn; ++ syn)
{ {
const char *errmsg; const char *errmsg;
@ -406,46 +346,17 @@ extract_1 (cd, ex_info, start, length, word_length, bufp, pc)
unsigned char *bufp; unsigned char *bufp;
bfd_vma pc; bfd_vma pc;
{ {
unsigned long x,mask; unsigned long x;
int shift; int shift;
int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG; int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG;
switch (word_length) x = bfd_get_bits (bufp, word_length, big_p);
{
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 ();
}
/* Written this way to avoid undefined behaviour. */
mask = (((1L << (length - 1)) - 1) << 1) | 1;
if (CGEN_INSN_LSB0_P) if (CGEN_INSN_LSB0_P)
shift = (start + 1) - length; shift = (start + 1) - length;
else else
shift = (word_length - (start + length)); shift = (word_length - (start + length));
return (x >> shift) & mask; return x >> shift;
} }
#endif /* ! CGEN_INT_INSN_P */ #endif /* ! CGEN_INT_INSN_P */
@ -489,7 +400,7 @@ extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length,
#endif #endif
long *valuep; long *valuep;
{ {
CGEN_INSN_INT value; CGEN_INSN_INT value, mask;
/* If LENGTH is zero, this operand doesn't contribute to the value /* If LENGTH is zero, this operand doesn't contribute to the value
so give it a standard value of zero. */ so give it a standard value of zero. */
@ -521,18 +432,10 @@ extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length,
if (CGEN_INT_INSN_P || word_offset == 0) 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) if (CGEN_INSN_LSB0_P)
value = insn_value >> ((word_offset + start + 1) - length); value = insn_value >> ((word_offset + start + 1) - length);
else else
value = insn_value >> (total_length - ( word_offset + start + length)); 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 #if ! CGEN_INT_INSN_P
@ -552,6 +455,15 @@ extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length,
#endif /* ! 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; *valuep = value;
return 1; return 1;
@ -576,7 +488,7 @@ extract_insn_normal (cd, insn, ex_info, insn_value, fields, pc)
bfd_vma pc; bfd_vma pc;
{ {
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); 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); CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);

View File

@ -2,7 +2,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN. 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 part of the GNU Binutils and/or GDB, the GNU debugger.
@ -40,8 +40,11 @@ static unsigned int dis_hash_insn PARAMS ((const char *, CGEN_INSN_INT));
/* Instruction formats. */ /* 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 = { static const CGEN_IFMT ifmt_empty = {
0, 0, 0x0, { { 0 } } 0, 0, 0x0, { { 0 } }
}; };
@ -172,9 +175,17 @@ static const CGEN_IFMT ifmt_satb = {
#undef F #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 MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
#define OPERAND(op) CONCAT2 (M32R_OPERAND_,op)
#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field)) #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
/* The instruction table. */ /* The instruction table. */
@ -992,14 +1003,17 @@ static const CGEN_OPCODE m32r_cgen_insn_opcode_table[MAX_INSNS] =
}; };
#undef A #undef A
#undef MNEM
#undef OPERAND #undef OPERAND
#undef MNEM
#undef OP #undef OP
/* Formats for ALIAS macro-insns. */ /* 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 = { static const CGEN_IFMT ifmt_bc8r = {
16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } } 16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
}; };
@ -1148,9 +1162,17 @@ static const CGEN_IFMT ifmt_push = {
/* Each non-simple macro entry points to an array of expansion possibilities. */ /* 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 MNEM CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
#define OPERAND(op) CONCAT2 (M32R_OPERAND_,op)
#define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field)) #define OP(field) CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
/* The macro instruction table. */ /* The macro instruction table. */
@ -1562,8 +1584,8 @@ static const CGEN_OPCODE m32r_cgen_macro_insn_opcode_table[] =
}; };
#undef A #undef A
#undef MNEM
#undef OPERAND #undef OPERAND
#undef MNEM
#undef OP #undef OP
#ifndef CGEN_ASM_HASH_P #ifndef CGEN_ASM_HASH_P

View File

@ -2,7 +2,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN. 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 part of the GNU Binutils and/or GDB, the GNU debugger.

View File

@ -2,7 +2,7 @@
THIS FILE IS MACHINE GENERATED WITH CGEN. 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 part of the GNU Binutils and/or GDB, the GNU debugger.
@ -31,11 +31,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
/* Operand references. */ /* 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 INPUT CGEN_OPINST_INPUT
#define OUTPUT CGEN_OPINST_OUTPUT #define OUTPUT CGEN_OPINST_OUTPUT
#define END CGEN_OPINST_END #define END CGEN_OPINST_END
#define COND_REF CGEN_OPINST_COND_REF #define COND_REF CGEN_OPINST_COND_REF
#define OP_ENT(op) CONCAT2 (M32R_OPERAND_,op)
static const CGEN_OPINST sfmt_empty_ops[] = { static const CGEN_OPINST sfmt_empty_ops[] = {
{ END } { END }
@ -513,11 +517,11 @@ static const CGEN_OPINST sfmt_sc_ops[] = {
{ END } { END }
}; };
#undef OP_ENT
#undef INPUT #undef INPUT
#undef OUTPUT #undef OUTPUT
#undef END #undef END
#undef COND_REF #undef COND_REF
#undef OP_ENT
/* Operand instance lookup table. */ /* Operand instance lookup table. */