From a394e3262fa7a03f9ca4e198044de683999457f0 Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Thu, 10 Apr 1997 23:39:51 +0000 Subject: [PATCH] * cgen-asm.c (cgen_parse_operand_fn): New global. (cgen_parse_{{,un}signed_integer,address}): Update call to cgen_parse_operand_fn. (cgen_init_parse_operand): New function. * m32r-asm.c (parse_insn_normal): cgen_init_parse_operand renamed from cgen_asm_init_parse. (m32r_cgen_assemble_insn): New operand `errmsg'. Delete call to as_bad, return error message to caller. (m32r_cgen_asm_hash_keywords): #if 0 out. --- opcodes/ChangeLog | 8 +++++--- opcodes/cgen-asm.c | 38 +++++++++++++++++++++++++++----------- opcodes/m32r-asm.c | 1 + 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index e9357fe6f92..6f33ac1d54a 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,9 +1,11 @@ Thu Apr 10 14:44:56 1997 Doug Evans - * cgen-asm.c (cgen_asm_parse_operand_fn): New global. + * cgen-asm.c (cgen_parse_operand_fn): New global. (cgen_parse_{{,un}signed_integer,address}): Update call to - cgen_asm_parse_operand_fn. - * m32r-asm.c (parse_insn_normal): Delete call to cgen_asm_init_parse. + cgen_parse_operand_fn. + (cgen_init_parse_operand): New function. + * m32r-asm.c (parse_insn_normal): cgen_init_parse_operand renamed + from cgen_asm_init_parse. (m32r_cgen_assemble_insn): New operand `errmsg'. Delete call to as_bad, return error message to caller. (m32r_cgen_asm_hash_keywords): #if 0 out. diff --git a/opcodes/cgen-asm.c b/opcodes/cgen-asm.c index 14c830ad656..5427aaaebfc 100644 --- a/opcodes/cgen-asm.c +++ b/opcodes/cgen-asm.c @@ -32,8 +32,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "opcode/cgen.h" /* Operand parsing callback. */ -const char * (*cgen_asm_parse_operand_fn) - PARAMS ((const char **, int, int, enum cgen_asm_result *, bfd_vma *)); +const char * (*cgen_parse_operand_fn) + PARAMS ((enum cgen_parse_operand_type, const char **, int, int, + enum cgen_parse_operand_result *, bfd_vma *)); /* This is not published as part of the public interface so we don't declare this in cgen.h. */ @@ -42,6 +43,8 @@ extern CGEN_OPCODE_DATA *cgen_current_opcode_data; /* Assembler instruction hash table. */ static CGEN_INSN_LIST **asm_hash_table; +/* Called once at startup and whenever machine/endian change. */ + void cgen_asm_init () { @@ -52,6 +55,16 @@ cgen_asm_init () } } +/* Called whenever starting to parse an insn. */ + +void +cgen_init_parse_operand () +{ + /* This tells the callback to re-initialize. */ + (void) (*cgen_parse_operand_fn) (CGEN_PARSE_OPERAND_INIT, NULL, 0, 0, + NULL, NULL); +} + /* Build the assembler instruction hash table. */ static void @@ -177,11 +190,12 @@ cgen_parse_signed_integer (strp, opindex, min, max, valuep) long *valuep; { long value; - enum cgen_asm_result result; + enum cgen_parse_operand_result result; const char *errmsg; - errmsg = (*cgen_asm_parse_operand_fn) (strp, opindex, BFD_RELOC_NONE, - &result, &value); + errmsg = (*cgen_parse_operand_fn) (CGEN_PARSE_OPERAND_INTEGER, strp, + opindex, BFD_RELOC_NONE, + &result, &value); /* FIXME: Examine `result'. */ if (!errmsg) { @@ -202,11 +216,12 @@ cgen_parse_unsigned_integer (strp, opindex, min, max, valuep) unsigned long *valuep; { unsigned long value; - enum cgen_asm_result result; + enum cgen_parse_operand_result result; const char *errmsg; - errmsg = (*cgen_asm_parse_operand_fn) (strp, opindex, BFD_RELOC_NONE, - &result, &value); + errmsg = (*cgen_parse_operand_fn) (CGEN_PARSE_OPERAND_INTEGER, strp, + opindex, BFD_RELOC_NONE, + &result, &value); /* FIXME: Examine `result'. */ if (!errmsg) { @@ -227,11 +242,12 @@ cgen_parse_address (strp, opindex, opinfo, valuep) long *valuep; { long value; - enum cgen_asm_result result; + enum cgen_parse_operand_result result; const char *errmsg; - errmsg = (*cgen_asm_parse_operand_fn) (strp, opindex, opinfo, - &result, &value); + errmsg = (*cgen_parse_operand_fn) (CGEN_PARSE_OPERAND_ADDRESS, strp, + opindex, opinfo, + &result, &value); /* FIXME: Examine `result'. */ if (!errmsg) { diff --git a/opcodes/m32r-asm.c b/opcodes/m32r-asm.c index 824366c7165..fb028c20304 100644 --- a/opcodes/m32r-asm.c +++ b/opcodes/m32r-asm.c @@ -551,6 +551,7 @@ parse_insn_normal (insn, strp, fields) #endif CGEN_INIT_PARSE (); + cgen_init_parse_operand (); #ifdef CGEN_MNEMONIC_OPERANDS past_opcode_p = 0; #endif -- 2.30.2