* cgen.h (<cpu>_cgen_assemble_insn): New arg for errmsg.

(cgen_asm_parse_operand_fn): Declare.
This commit is contained in:
David Edelsohn 1997-04-10 21:55:09 +00:00
parent 4e9d8deacb
commit fe2dd6424b
2 changed files with 37 additions and 17 deletions

View File

@ -1,3 +1,8 @@
Thu Apr 10 14:35:00 1997 Doug Evans <dje@canuck.cygnus.com>
* cgen.h (<cpu>_cgen_assemble_insn): New arg for errmsg.
(cgen_asm_parse_operand_fn): Declare.
Sat Apr 5 13:14:05 1997 Ian Lance Taylor <ian@cygnus.com> Sat Apr 5 13:14:05 1997 Ian Lance Taylor <ian@cygnus.com>
* i386.h: Revert last patch for the NON_BROKEN_OPCODES cases. * i386.h: Revert last patch for the NON_BROKEN_OPCODES cases.

View File

@ -579,7 +579,7 @@ void CGEN_SYM (init_insert) PARAMS ((void));
void CGEN_SYM (init_extract) PARAMS ((void)); void CGEN_SYM (init_extract) PARAMS ((void));
const struct cgen_insn * const struct cgen_insn *
CGEN_SYM (assemble_insn) PARAMS ((const char *, struct cgen_fields *, CGEN_SYM (assemble_insn) PARAMS ((const char *, struct cgen_fields *,
cgen_insn_t *)); cgen_insn_t *, char **));
int CGEN_SYM (insn_supported) PARAMS ((const struct cgen_syntax *)); int CGEN_SYM (insn_supported) PARAMS ((const struct cgen_syntax *));
#if 0 /* old */ #if 0 /* old */
int CGEN_SYM (opval_supported) PARAMS ((const struct cgen_opval *)); int CGEN_SYM (opval_supported) PARAMS ((const struct cgen_opval *));
@ -609,34 +609,28 @@ extern cgen_print_fn CGEN_SYM (print_insn);
/* Read in a cpu description file. */ /* Read in a cpu description file. */
const char * cgen_read_cpu_file PARAMS ((const char *)); const char * cgen_read_cpu_file PARAMS ((const char *));
/* The interface to the assembler is intended to be clean in the sense that /* Assembler interface.
The interface to the assembler is intended to be clean in the sense that
libopcodes.a is a standalone entity and could be used with any assembler. libopcodes.a is a standalone entity and could be used with any assembler.
Well, that's the intention. Given that, we define an interface between us Not that one would necessarily want to do that but rather that it helps
and the assembler. The interface will obviously be slanted towards gas, keep a clean interface. The interface will obviously be slanted towards
but at least it's a start. GAS, but at least it's a start.
Parsing is controlled by the assembler which calls Parsing is controlled by the assembler which calls
CGEN_SYM (assemble_insn). If it can parse and build the entire insn CGEN_SYM (assemble_insn). If it can parse and build the entire insn
it doesn't call back to the assembler. If it needs/wants to call back it doesn't call back to the assembler. If it needs/wants to call back
to the assembler, cgen_asm_parse_operand is called. to the assembler, (*cgen_asm_parse_operand_fn) is called which can either
cgen_asm_parse_operand can either
- return a number to be inserted in the insn - return a number to be inserted in the insn
- return a "register" value to be inserted - return a "register" value to be inserted
(the register might not be a register per pe) (the register might not be a register per pe)
- queue the argument and return a marker saying the expression has been - queue the argument and return a marker saying the expression has been
queued (eg: a fix-up) queued (eg: a fix-up)
- return an error message indicating the expression wasn't recognizable - return an error message indicating the expression wasn't recognizable
After parsing is done, CGEN_SYM (assemble_insn) calls
cgen_asm_finish_insn to output the insn and record the relocs.
*/
/* Call this for each insn to initialize the assembler callback interface. */ The result is an error message or NULL for success.
void cgen_asm_insn_init PARAMS ((void)); The parsed value is stored in the bfd_vma *. */
/* Add a register to the assembler's hash table.
This makes lets GAS parse registers for us.
??? This isn't currently used, but it could be in the future. */
void cgen_asm_record_register PARAMS ((char *, int));
enum cgen_asm_result { enum cgen_asm_result {
CGEN_ASM_NUMBER, CGEN_ASM_REGISTER, CGEN_ASM_QUEUED, CGEN_ASM_ERROR CGEN_ASM_NUMBER, CGEN_ASM_REGISTER, CGEN_ASM_QUEUED, CGEN_ASM_ERROR
@ -644,11 +638,32 @@ enum cgen_asm_result {
/* Don't require bfd.h unnecessarily. */ /* Don't require bfd.h unnecessarily. */
#ifdef BFD_VERSION #ifdef BFD_VERSION
extern const char * (*cgen_asm_parse_operand_fn)
PARAMS ((const char **, int, int, enum cgen_asm_result *, bfd_vma *));
#endif
/* These are GAS specific. They're not here as part of the interface,
but rather that we need to put them somewhere. */
/* Call this for each insn to initialize the assembler callback interface. */
void cgen_asm_init_parse PARAMS ((void));
/* Don't require bfd.h unnecessarily. */
#ifdef BFD_VERSION
/* The result is an error message or NULL for success.
The parsed value is stored in the bfd_vma *. */
const char *cgen_asm_parse_operand PARAMS ((const char **, int, int, const char *cgen_asm_parse_operand PARAMS ((const char **, int, int,
enum cgen_asm_result *, enum cgen_asm_result *,
bfd_vma *)); bfd_vma *));
#endif #endif
/* Add a register to the assembler's hash table.
This makes lets GAS parse registers for us.
??? This isn't currently used, but it could be in the future. */
void cgen_asm_record_register PARAMS ((char *, int));
/* After CGEN_SYM (assemble_insn) is done, this is called to
output the insn and record any fixups. */
void cgen_asm_finish_insn PARAMS ((const struct cgen_insn *, cgen_insn_t *, void cgen_asm_finish_insn PARAMS ((const struct cgen_insn *, cgen_insn_t *,
unsigned int)); unsigned int));