Convert cgen to C-90

This commit is contained in:
Michael Meissner 2003-08-08 21:21:24 +00:00
parent a685700c57
commit 10e05405ac
9 changed files with 429 additions and 397 deletions

View file

@ -1,3 +1,13 @@
2003-08-07 Michael Meissner <gnu@the-meissners.org>
* cgen.h: Remove PARAM macro usage in all prototypes.
(CGEN_EXTRACT_INFO): Use void * instead of PTR.
(cgen_print_fn): Ditto.
(CGEN_HW_ENTRY): Ditto.
(CGEN_MAYBE_MULTI_IFLD): Ditto.
(struct cgen_insn): Ditto.
(CGEN_CPU_TABLE): Ditto.
2003-08-07 Alan Modra <amodra@bigpond.net.au> 2003-08-07 Alan Modra <amodra@bigpond.net.au>
* alpha.h: Remove PARAMS macro. * alpha.h: Remove PARAMS macro.

View file

@ -242,9 +242,9 @@ typedef struct cgen_fields CGEN_FIELDS;
typedef struct { typedef struct {
/* A pointer to the disassemble_info struct. /* A pointer to the disassemble_info struct.
We don't require dis-asm.h so we use PTR for the type here. We don't require dis-asm.h so we use void * for the type here.
If NULL, BYTES is full of valid data (VALID == -1). */ If NULL, BYTES is full of valid data (VALID == -1). */
PTR dis_info; void *dis_info;
/* Points to a working buffer of sufficient size. */ /* Points to a working buffer of sufficient size. */
unsigned char *insn_bytes; unsigned char *insn_bytes;
/* Mask of bytes that are valid in INSN_BYTES. */ /* Mask of bytes that are valid in INSN_BYTES. */
@ -265,8 +265,8 @@ typedef struct {
If not it is left alone. If not it is left alone.
The result is NULL if success or an error message. */ The result is NULL if success or an error message. */
typedef const char * (cgen_parse_fn) typedef const char * (cgen_parse_fn)
PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *insn_, (CGEN_CPU_DESC, const CGEN_INSN *insn_,
const char **strp_, CGEN_FIELDS *fields_)); const char **strp_, CGEN_FIELDS *fields_);
/* Insert handler. /* Insert handler.
CD is a cpu table descriptor. CD is a cpu table descriptor.
@ -279,9 +279,9 @@ typedef const char * (cgen_parse_fn)
#ifdef __BFD_H_SEEN__ #ifdef __BFD_H_SEEN__
typedef const char * (cgen_insert_fn) typedef const char * (cgen_insert_fn)
PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *insn_, (CGEN_CPU_DESC, const CGEN_INSN *insn_,
CGEN_FIELDS *fields_, CGEN_INSN_BYTES_PTR insnp_, CGEN_FIELDS *fields_, CGEN_INSN_BYTES_PTR insnp_,
bfd_vma pc_)); bfd_vma pc_);
#else #else
typedef const char * (cgen_insert_fn) (); typedef const char * (cgen_insert_fn) ();
#endif #endif
@ -300,9 +300,9 @@ typedef const char * (cgen_insert_fn) ();
#ifdef __BFD_H_SEEN__ #ifdef __BFD_H_SEEN__
typedef int (cgen_extract_fn) typedef int (cgen_extract_fn)
PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *insn_, (CGEN_CPU_DESC, const CGEN_INSN *insn_,
CGEN_EXTRACT_INFO *ex_info_, CGEN_INSN_INT base_insn_, CGEN_EXTRACT_INFO *ex_info_, CGEN_INSN_INT base_insn_,
CGEN_FIELDS *fields_, bfd_vma pc_)); CGEN_FIELDS *fields_, bfd_vma pc_);
#else #else
typedef int (cgen_extract_fn) (); typedef int (cgen_extract_fn) ();
#endif #endif
@ -319,8 +319,8 @@ typedef int (cgen_extract_fn) ();
#ifdef __BFD_H_SEEN__ #ifdef __BFD_H_SEEN__
typedef void (cgen_print_fn) typedef void (cgen_print_fn)
PARAMS ((CGEN_CPU_DESC, PTR info_, const CGEN_INSN *insn_, (CGEN_CPU_DESC, void * info_, const CGEN_INSN *insn_,
CGEN_FIELDS *fields_, bfd_vma pc_, int len_)); CGEN_FIELDS *fields_, bfd_vma pc_, int len_);
#else #else
typedef void (cgen_print_fn) (); typedef void (cgen_print_fn) ();
#endif #endif
@ -384,9 +384,9 @@ enum cgen_parse_operand_result
#ifdef __BFD_H_SEEN__ /* Don't require bfd.h unnecessarily. */ #ifdef __BFD_H_SEEN__ /* Don't require bfd.h unnecessarily. */
typedef const char * (cgen_parse_operand_fn) typedef const char * (cgen_parse_operand_fn)
PARAMS ((CGEN_CPU_DESC, (CGEN_CPU_DESC,
enum cgen_parse_operand_type, const char **, int, int, enum cgen_parse_operand_type, const char **, int, int,
enum cgen_parse_operand_result *, bfd_vma *)); enum cgen_parse_operand_result *, bfd_vma *);
#else #else
typedef const char * (cgen_parse_operand_fn) (); typedef const char * (cgen_parse_operand_fn) ();
#endif #endif
@ -394,11 +394,11 @@ typedef const char * (cgen_parse_operand_fn) ();
/* Set the cgen_parse_operand_fn callback. */ /* Set the cgen_parse_operand_fn callback. */
extern void cgen_set_parse_operand_fn extern void cgen_set_parse_operand_fn
PARAMS ((CGEN_CPU_DESC, cgen_parse_operand_fn)); (CGEN_CPU_DESC, cgen_parse_operand_fn);
/* Called before trying to match a table entry with the insn. */ /* Called before trying to match a table entry with the insn. */
extern void cgen_init_parse_operand PARAMS ((CGEN_CPU_DESC)); extern void cgen_init_parse_operand (CGEN_CPU_DESC);
/* Operand values (keywords, integers, symbols, etc.) */ /* Operand values (keywords, integers, symbols, etc.) */
@ -422,7 +422,7 @@ typedef struct
/* There is currently no example where both index specs and value specs /* There is currently no example where both index specs and value specs
are required, so for now both are clumped under "asm_data". */ are required, so for now both are clumped under "asm_data". */
enum cgen_asm_type asm_type; enum cgen_asm_type asm_type;
PTR asm_data; void *asm_data;
#ifndef CGEN_HW_NBOOL_ATTRS #ifndef CGEN_HW_NBOOL_ATTRS
#define CGEN_HW_NBOOL_ATTRS 1 #define CGEN_HW_NBOOL_ATTRS 1
#endif #endif
@ -453,9 +453,9 @@ typedef struct {
} CGEN_HW_TABLE; } CGEN_HW_TABLE;
extern const CGEN_HW_ENTRY * cgen_hw_lookup_by_name extern const CGEN_HW_ENTRY * cgen_hw_lookup_by_name
PARAMS ((CGEN_CPU_DESC, const char *)); (CGEN_CPU_DESC, const char *);
extern const CGEN_HW_ENTRY * cgen_hw_lookup_by_num extern const CGEN_HW_ENTRY * cgen_hw_lookup_by_num
PARAMS ((CGEN_CPU_DESC, unsigned int)); (CGEN_CPU_DESC, unsigned int);
/* This struct is used to describe things like register names, etc. */ /* This struct is used to describe things like register names, etc. */
@ -543,41 +543,41 @@ typedef struct
/* Lookup a keyword from its name. */ /* Lookup a keyword from its name. */
const CGEN_KEYWORD_ENTRY *cgen_keyword_lookup_name const CGEN_KEYWORD_ENTRY *cgen_keyword_lookup_name
PARAMS ((CGEN_KEYWORD *, const char *)); (CGEN_KEYWORD *, const char *);
/* Lookup a keyword from its value. */ /* Lookup a keyword from its value. */
const CGEN_KEYWORD_ENTRY *cgen_keyword_lookup_value const CGEN_KEYWORD_ENTRY *cgen_keyword_lookup_value
PARAMS ((CGEN_KEYWORD *, int)); (CGEN_KEYWORD *, int);
/* Add a keyword. */ /* Add a keyword. */
void cgen_keyword_add PARAMS ((CGEN_KEYWORD *, CGEN_KEYWORD_ENTRY *)); void cgen_keyword_add (CGEN_KEYWORD *, CGEN_KEYWORD_ENTRY *);
/* Keyword searching. /* Keyword searching.
This can be used to retrieve every keyword, or a subset. */ This can be used to retrieve every keyword, or a subset. */
CGEN_KEYWORD_SEARCH cgen_keyword_search_init CGEN_KEYWORD_SEARCH cgen_keyword_search_init
PARAMS ((CGEN_KEYWORD *, const char *)); (CGEN_KEYWORD *, const char *);
const CGEN_KEYWORD_ENTRY *cgen_keyword_search_next const CGEN_KEYWORD_ENTRY *cgen_keyword_search_next
PARAMS ((CGEN_KEYWORD_SEARCH *)); (CGEN_KEYWORD_SEARCH *);
/* Operand value support routines. */ /* Operand value support routines. */
extern const char *cgen_parse_keyword extern const char *cgen_parse_keyword
PARAMS ((CGEN_CPU_DESC, const char **, CGEN_KEYWORD *, long *)); (CGEN_CPU_DESC, const char **, CGEN_KEYWORD *, long *);
#ifdef __BFD_H_SEEN__ /* Don't require bfd.h unnecessarily. */ #ifdef __BFD_H_SEEN__ /* Don't require bfd.h unnecessarily. */
extern const char *cgen_parse_signed_integer extern const char *cgen_parse_signed_integer
PARAMS ((CGEN_CPU_DESC, const char **, int, long *)); (CGEN_CPU_DESC, const char **, int, long *);
extern const char *cgen_parse_unsigned_integer extern const char *cgen_parse_unsigned_integer
PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); (CGEN_CPU_DESC, const char **, int, unsigned long *);
extern const char *cgen_parse_address extern const char *cgen_parse_address
PARAMS ((CGEN_CPU_DESC, const char **, int, int, (CGEN_CPU_DESC, const char **, int, int,
enum cgen_parse_operand_result *, bfd_vma *)); enum cgen_parse_operand_result *, bfd_vma *);
extern const char *cgen_validate_signed_integer extern const char *cgen_validate_signed_integer
PARAMS ((long, long, long)); (long, long, long);
extern const char *cgen_validate_unsigned_integer extern const char *cgen_validate_unsigned_integer
PARAMS ((unsigned long, unsigned long, unsigned long)); (unsigned long, unsigned long, unsigned long);
#endif #endif
/* Operand modes. */ /* Operand modes. */
@ -621,7 +621,7 @@ typedef struct cgen_maybe_multi_ifield
n: indexed by array of more cgen_maybe_multi_ifields. */ n: indexed by array of more cgen_maybe_multi_ifields. */
union union
{ {
const PTR p; const void *p;
const struct cgen_maybe_multi_ifield * multi; const struct cgen_maybe_multi_ifield * multi;
const struct cgen_ifld * leaf; const struct cgen_ifld * leaf;
} val; } val;
@ -705,9 +705,9 @@ typedef struct {
} CGEN_OPERAND_TABLE; } CGEN_OPERAND_TABLE;
extern const CGEN_OPERAND * cgen_operand_lookup_by_name extern const CGEN_OPERAND * cgen_operand_lookup_by_name
PARAMS ((CGEN_CPU_DESC, const char *)); (CGEN_CPU_DESC, const char *);
extern const CGEN_OPERAND * cgen_operand_lookup_by_num extern const CGEN_OPERAND * cgen_operand_lookup_by_num
PARAMS ((CGEN_CPU_DESC, int)); (CGEN_CPU_DESC, int);
/* Instruction operand instances. /* Instruction operand instances.
@ -1061,8 +1061,8 @@ typedef struct
/* Return number of instructions. This includes any added at run-time. */ /* Return number of instructions. This includes any added at run-time. */
extern int cgen_insn_count PARAMS ((CGEN_CPU_DESC)); extern int cgen_insn_count (CGEN_CPU_DESC);
extern int cgen_macro_insn_count PARAMS ((CGEN_CPU_DESC)); extern int cgen_macro_insn_count (CGEN_CPU_DESC);
/* Macros to access the other insn elements not recorded in CGEN_IBASE. */ /* Macros to access the other insn elements not recorded in CGEN_IBASE. */
@ -1126,9 +1126,10 @@ typedef struct cgen_minsn_expansion {
If the expansion fails (e.g. "no match") NULL is returned. If the expansion fails (e.g. "no match") NULL is returned.
Space for the expansion is obtained with malloc. Space for the expansion is obtained with malloc.
It is up to the caller to free it. */ It is up to the caller to free it. */
const char * (* fn) PARAMS ((const struct cgen_minsn_expansion *, const char * (* fn)
const char *, const char **, int *, (const struct cgen_minsn_expansion *,
CGEN_OPERAND **)); const char *, const char **, int *,
CGEN_OPERAND **);
#define CGEN_MIEXPN_FN(ex) ((ex)->fn) #define CGEN_MIEXPN_FN(ex) ((ex)->fn)
/* Instruction(s) the macro expands to. /* Instruction(s) the macro expands to.
@ -1146,15 +1147,15 @@ typedef struct cgen_minsn_expansion {
may contain further macro invocations. */ may contain further macro invocations. */
extern const char * cgen_expand_macro_insn extern const char * cgen_expand_macro_insn
PARAMS ((CGEN_CPU_DESC, const struct cgen_minsn_expansion *, (CGEN_CPU_DESC, const struct cgen_minsn_expansion *,
const char *, const char **, int *, CGEN_OPERAND **)); const char *, const char **, int *, CGEN_OPERAND **);
/* The assembler insn table is hashed based on some function of the mnemonic /* The assembler insn table is hashed based on some function of the mnemonic
(the actually hashing done is up to the target, but we provide a few (the actually hashing done is up to the target, but we provide a few
examples like the first letter or a function of the entire mnemonic). */ examples like the first letter or a function of the entire mnemonic). */
extern CGEN_INSN_LIST * cgen_asm_lookup_insn extern CGEN_INSN_LIST * cgen_asm_lookup_insn
PARAMS ((CGEN_CPU_DESC, const char *)); (CGEN_CPU_DESC, const char *);
#define CGEN_ASM_LOOKUP_INSN(cd, string) cgen_asm_lookup_insn ((cd), (string)) #define CGEN_ASM_LOOKUP_INSN(cd, string) cgen_asm_lookup_insn ((cd), (string))
#define CGEN_ASM_NEXT_INSN(insn) ((insn)->next) #define CGEN_ASM_NEXT_INSN(insn) ((insn)->next)
@ -1162,7 +1163,7 @@ extern CGEN_INSN_LIST * cgen_asm_lookup_insn
instruction (the actually hashing done is up to the target). */ instruction (the actually hashing done is up to the target). */
extern CGEN_INSN_LIST * cgen_dis_lookup_insn extern CGEN_INSN_LIST * cgen_dis_lookup_insn
PARAMS ((CGEN_CPU_DESC, const char *, CGEN_INSN_INT)); (CGEN_CPU_DESC, const char *, CGEN_INSN_INT);
/* FIXME: delete these two */ /* FIXME: delete these two */
#define CGEN_DIS_LOOKUP_INSN(cd, buf, value) cgen_dis_lookup_insn ((cd), (buf), (value)) #define CGEN_DIS_LOOKUP_INSN(cd, buf, value) cgen_dis_lookup_insn ((cd), (buf), (value))
#define CGEN_DIS_NEXT_INSN(insn) ((insn)->next) #define CGEN_DIS_NEXT_INSN(insn) ((insn)->next)
@ -1246,25 +1247,24 @@ typedef struct cgen_cpu_desc
int int_insn_p; int int_insn_p;
/* Called to rebuild the tables after something has changed. */ /* Called to rebuild the tables after something has changed. */
void (*rebuild_tables) PARAMS ((CGEN_CPU_DESC)); void (*rebuild_tables) (CGEN_CPU_DESC);
/* Operand parser callback. */ /* Operand parser callback. */
cgen_parse_operand_fn * parse_operand_fn; cgen_parse_operand_fn * parse_operand_fn;
/* Parse/insert/extract/print cover fns for operands. */ /* Parse/insert/extract/print cover fns for operands. */
const char * (*parse_operand) const char * (*parse_operand)
PARAMS ((CGEN_CPU_DESC, int opindex_, const char **, (CGEN_CPU_DESC, int opindex_, const char **, CGEN_FIELDS *fields_);
CGEN_FIELDS *fields_));
#ifdef __BFD_H_SEEN__ #ifdef __BFD_H_SEEN__
const char * (*insert_operand) const char * (*insert_operand)
PARAMS ((CGEN_CPU_DESC, int opindex_, CGEN_FIELDS *fields_, (CGEN_CPU_DESC, int opindex_, CGEN_FIELDS *fields_,
CGEN_INSN_BYTES_PTR, bfd_vma pc_)); CGEN_INSN_BYTES_PTR, bfd_vma pc_);
int (*extract_operand) int (*extract_operand)
PARAMS ((CGEN_CPU_DESC, int opindex_, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, (CGEN_CPU_DESC, int opindex_, CGEN_EXTRACT_INFO *, CGEN_INSN_INT,
CGEN_FIELDS *fields_, bfd_vma pc_)); CGEN_FIELDS *fields_, bfd_vma pc_);
void (*print_operand) void (*print_operand)
PARAMS ((CGEN_CPU_DESC, int opindex_, PTR info_, CGEN_FIELDS * fields_, (CGEN_CPU_DESC, int opindex_, void * info_, CGEN_FIELDS * fields_,
void const *attrs_, bfd_vma pc_, int length_)); void const *attrs_, bfd_vma pc_, int length_);
#else #else
const char * (*insert_operand) (); const char * (*insert_operand) ();
int (*extract_operand) (); int (*extract_operand) ();
@ -1280,19 +1280,19 @@ typedef struct cgen_cpu_desc
#define CGEN_CPU_SIZEOF_FIELDS(cd) ((cd)->sizeof_fields) #define CGEN_CPU_SIZEOF_FIELDS(cd) ((cd)->sizeof_fields)
/* Set the bitsize field. */ /* Set the bitsize field. */
void (*set_fields_bitsize) PARAMS ((CGEN_FIELDS *fields_, int size_)); void (*set_fields_bitsize) (CGEN_FIELDS *fields_, int size_);
#define CGEN_CPU_SET_FIELDS_BITSIZE(cd) ((cd)->set_fields_bitsize) #define CGEN_CPU_SET_FIELDS_BITSIZE(cd) ((cd)->set_fields_bitsize)
/* CGEN_FIELDS accessors. */ /* CGEN_FIELDS accessors. */
int (*get_int_operand) int (*get_int_operand)
PARAMS ((CGEN_CPU_DESC, int opindex_, const CGEN_FIELDS *fields_)); (CGEN_CPU_DESC, int opindex_, const CGEN_FIELDS *fields_);
void (*set_int_operand) void (*set_int_operand)
PARAMS ((CGEN_CPU_DESC, int opindex_, CGEN_FIELDS *fields_, int value_)); (CGEN_CPU_DESC, int opindex_, CGEN_FIELDS *fields_, int value_);
#ifdef __BFD_H_SEEN__ #ifdef __BFD_H_SEEN__
bfd_vma (*get_vma_operand) bfd_vma (*get_vma_operand)
PARAMS ((CGEN_CPU_DESC, int opindex_, const CGEN_FIELDS *fields_)); (CGEN_CPU_DESC, int opindex_, const CGEN_FIELDS *fields_);
void (*set_vma_operand) void (*set_vma_operand)
PARAMS ((CGEN_CPU_DESC, int opindex_, CGEN_FIELDS *fields_, bfd_vma value_)); (CGEN_CPU_DESC, int opindex_, CGEN_FIELDS *fields_, bfd_vma value_);
#else #else
long (*get_vma_operand) (); long (*get_vma_operand) ();
void (*set_vma_operand) (); void (*set_vma_operand) ();
@ -1314,19 +1314,19 @@ typedef struct cgen_cpu_desc
#define CGEN_PRINT_FN(cd, insn) (cd->print_handlers[(insn)->opcode->handlers.print]) #define CGEN_PRINT_FN(cd, insn) (cd->print_handlers[(insn)->opcode->handlers.print])
/* Return non-zero if insn should be added to hash table. */ /* Return non-zero if insn should be added to hash table. */
int (* asm_hash_p) PARAMS ((const CGEN_INSN *)); int (* asm_hash_p) (const CGEN_INSN *);
/* Assembler hash function. */ /* Assembler hash function. */
unsigned int (* asm_hash) PARAMS ((const char *)); unsigned int (* asm_hash) (const char *);
/* Number of entries in assembler hash table. */ /* Number of entries in assembler hash table. */
unsigned int asm_hash_size; unsigned int asm_hash_size;
/* Return non-zero if insn should be added to hash table. */ /* Return non-zero if insn should be added to hash table. */
int (* dis_hash_p) PARAMS ((const CGEN_INSN *)); int (* dis_hash_p) (const CGEN_INSN *);
/* Disassembler hash function. */ /* Disassembler hash function. */
unsigned int (* dis_hash) PARAMS ((const char *, CGEN_INSN_INT)); unsigned int (* dis_hash) (const char *, CGEN_INSN_INT);
/* Number of entries in disassembler hash table. */ /* Number of entries in disassembler hash table. */
unsigned int dis_hash_size; unsigned int dis_hash_size;
@ -1381,81 +1381,80 @@ extern CGEN_CPU_DESC CGEN_SYM (cpu_open) (enum cgen_cpu_open_arg, ...);
/* Cover fn to handle simple case. */ /* Cover fn to handle simple case. */
extern CGEN_CPU_DESC CGEN_SYM (cpu_open_1) PARAMS ((const char *mach_name_, extern CGEN_CPU_DESC CGEN_SYM (cpu_open_1)
enum cgen_endian endian_)); (const char *mach_name_, enum cgen_endian endian_);
/* Close it. */ /* Close it. */
extern void CGEN_SYM (cpu_close) PARAMS ((CGEN_CPU_DESC)); extern void CGEN_SYM (cpu_close) (CGEN_CPU_DESC);
/* Initialize the opcode table for use. /* Initialize the opcode table for use.
Called by init_asm/init_dis. */ Called by init_asm/init_dis. */
extern void CGEN_SYM (init_opcode_table) PARAMS ((CGEN_CPU_DESC cd_)); extern void CGEN_SYM (init_opcode_table) (CGEN_CPU_DESC cd_);
/* build the insn selection regex. /* build the insn selection regex.
called by init_opcode_table */ called by init_opcode_table */
extern char * CGEN_SYM(build_insn_regex) PARAMS ((CGEN_INSN *insn_)); extern char * CGEN_SYM(build_insn_regex) (CGEN_INSN *insn_);
/* Initialize the ibld table for use. /* Initialize the ibld table for use.
Called by init_asm/init_dis. */ Called by init_asm/init_dis. */
extern void CGEN_SYM (init_ibld_table) PARAMS ((CGEN_CPU_DESC cd_)); extern void CGEN_SYM (init_ibld_table) (CGEN_CPU_DESC cd_);
/* Initialize an cpu table for assembler or disassembler use. /* Initialize an cpu table for assembler or disassembler use.
These must be called immediately after cpu_open. */ These must be called immediately after cpu_open. */
extern void CGEN_SYM (init_asm) PARAMS ((CGEN_CPU_DESC)); extern void CGEN_SYM (init_asm) (CGEN_CPU_DESC);
extern void CGEN_SYM (init_dis) PARAMS ((CGEN_CPU_DESC)); extern void CGEN_SYM (init_dis) (CGEN_CPU_DESC);
/* Initialize the operand instance table for use. */ /* Initialize the operand instance table for use. */
extern void CGEN_SYM (init_opinst_table) PARAMS ((CGEN_CPU_DESC cd_)); extern void CGEN_SYM (init_opinst_table) (CGEN_CPU_DESC cd_);
/* Assemble an instruction. */ /* Assemble an instruction. */
extern const CGEN_INSN * CGEN_SYM (assemble_insn) extern const CGEN_INSN * CGEN_SYM (assemble_insn)
PARAMS ((CGEN_CPU_DESC, const char *, CGEN_FIELDS *, (CGEN_CPU_DESC, const char *, CGEN_FIELDS *,
CGEN_INSN_BYTES_PTR, char **)); CGEN_INSN_BYTES_PTR, char **);
extern const CGEN_KEYWORD CGEN_SYM (operand_mach); extern const CGEN_KEYWORD CGEN_SYM (operand_mach);
extern int CGEN_SYM (get_mach) PARAMS ((const char *)); extern int CGEN_SYM (get_mach) (const char *);
/* Operand index computation. */ /* Operand index computation. */
extern const CGEN_INSN * cgen_lookup_insn extern const CGEN_INSN * cgen_lookup_insn
PARAMS ((CGEN_CPU_DESC, const CGEN_INSN * insn_, (CGEN_CPU_DESC, const CGEN_INSN * insn_,
CGEN_INSN_INT int_value_, unsigned char *bytes_value_, CGEN_INSN_INT int_value_, unsigned char *bytes_value_,
int length_, CGEN_FIELDS *fields_, int alias_p_)); int length_, CGEN_FIELDS *fields_, int alias_p_);
extern void cgen_get_insn_operands extern void cgen_get_insn_operands
PARAMS ((CGEN_CPU_DESC, const CGEN_INSN * insn_, (CGEN_CPU_DESC, const CGEN_INSN * insn_,
const CGEN_FIELDS *fields_, int *indices_)); const CGEN_FIELDS *fields_, int *indices_);
extern const CGEN_INSN * cgen_lookup_get_insn_operands extern const CGEN_INSN * cgen_lookup_get_insn_operands
PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *insn_, (CGEN_CPU_DESC, const CGEN_INSN *insn_,
CGEN_INSN_INT int_value_, unsigned char *bytes_value_, CGEN_INSN_INT int_value_, unsigned char *bytes_value_,
int length_, int *indices_, CGEN_FIELDS *fields_)); int length_, int *indices_, CGEN_FIELDS *fields_);
/* Cover fns to bfd_get/set. */ /* Cover fns to bfd_get/set. */
extern CGEN_INSN_INT cgen_get_insn_value extern CGEN_INSN_INT cgen_get_insn_value
PARAMS ((CGEN_CPU_DESC, unsigned char *, int)); (CGEN_CPU_DESC, unsigned char *, int);
extern void cgen_put_insn_value extern void cgen_put_insn_value
PARAMS ((CGEN_CPU_DESC, unsigned char *, int, CGEN_INSN_INT)); (CGEN_CPU_DESC, unsigned char *, int, CGEN_INSN_INT);
/* Read in a cpu description file. /* Read in a cpu description file.
??? For future concerns, including adding instructions to the assembler/ ??? For future concerns, including adding instructions to the assembler/
disassembler at run-time. */ disassembler at run-time. */
extern const char * cgen_read_cpu_file extern const char * cgen_read_cpu_file (CGEN_CPU_DESC, const char * filename_);
PARAMS ((CGEN_CPU_DESC, const char * filename_));
/* Allow signed overflow of instruction fields. */ /* Allow signed overflow of instruction fields. */
extern void cgen_set_signed_overflow_ok PARAMS ((CGEN_CPU_DESC)); extern void cgen_set_signed_overflow_ok (CGEN_CPU_DESC);
/* Generate an error message if a signed field in an instruction overflows. */ /* Generate an error message if a signed field in an instruction overflows. */
extern void cgen_clear_signed_overflow_ok PARAMS ((CGEN_CPU_DESC)); extern void cgen_clear_signed_overflow_ok (CGEN_CPU_DESC);
/* Will an error message be generated if a signed field in an instruction overflows ? */ /* Will an error message be generated if a signed field in an instruction overflows ? */
extern unsigned int cgen_signed_overflow_ok_p PARAMS ((CGEN_CPU_DESC)); extern unsigned int cgen_signed_overflow_ok_p (CGEN_CPU_DESC);
#endif /* CGEN_H */ #endif /* CGEN_H */

View file

@ -1,3 +1,99 @@
2003-08-06 Michael Meissner <gnu@the-meissners.org>
* cgen-asm.c (hash_insn_array): Remove PARAMS macro.
(hash_insn_list): Ditto.
(build_asm_hash_table): Ditto.
(cgen_set_parse_operand_fn): Prototype definition.
(cgen_init_parse_operand): Ditto.
(hash_insn_array): Ditto.
(hash_insn_list): Ditto.
(build_asm_hash_table): Ditto.
(cgen_asm_lookup_insn): Ditto.
(cgen_parse_keyword): Ditto.
(cgen_parse_signed_integer): Ditto.
(cgen_parse_unsigned_integer): Ditto.
(cgen_parse_address): Ditto.
(cgen_validate_signed_integer): Ditto.
(cgen_validate_unsigned_integer): Ditto.
* cgen-opc.c (hash_keyword_name): Remove PARAMS macro.
(hash_keyword_value): Ditto.
(build_keyword_hash_tables): Ditto.
(cgen_keyword_lookup_name): Prototype definition.
(cgen_keyword_lookup_value): Ditto.
(cgen_keyword_add): Ditto.
(cgen_keyword_search_init): Ditto.
(cgen_keyword_search_next): Ditto.
(hash_keyword_name): Ditto.
(hash_keyword_value): Ditto.
(build_keyword_hash_tables): Ditto.
(cgen_hw_lookup_by_name): Ditto.
(cgen_hw_lookup_by_num): Ditto.
(cgen_operand_lookup_by_name): Ditto.
(cgen_operand_lookup_by_num): Ditto.
(cgen_insn_count): Ditto.
(cgen_macro_insn_count): Ditto.
(cgen_get_insn_value): Ditto.
(cgen_put_insn_value): Ditto.
(cgen_lookup_insn): Ditto.
(cgen_get_insn_operands): Ditto.
(cgen_lookup_get_insn_operands): Ditto.
(cgen_set_signed_overflow_ok): Ditto.
(cgen_clear_signed_overflow_ok): Ditto.
(cgen_signed_overflow_ok_p): Ditto.
* cgen-dis.c (hash_insn_array): Remove PARAMS macro.
(hash_insn_list): Ditto.
(build_dis_hash_table): Ditto.
(count_decodable_bits): Ditto.
(add_insn_to_hash_chain): Ditto.
(count_decodable_bits): Prototype definition.
(add_insn_to_hash_chain): Ditto.
(hash_insn_array): Ditto.
(hash_insn_list): Ditto.
(build_dis_hash_table): Ditto.
(cgen_dis_lookup_insn): Ditto.
* cgen-asm.in (parse_insn_normal): Remove PARAMS macro.
(@arch@_cgen_build_insn_regex): Prototype definition.
(parse_insn_normal): Ditto.
(@arch@_cgen_assemble_insn): Ditto.
(@arch@_cgen_asm_hash_keywords): Ditto.
* cgen-dis.in (print_normal): Remove PARAMS macro. Use void *
instead of PTR.
(print_address): Ditto.
(print_keyword): Ditto.
(print_insn_normal): Ditto.
(print_insn): Ditto.
(default_print_insn): Ditto.
(read_insn): Ditto.
(print_normal): Prototype definition. Use void * instead of PTR.
(print_address): Ditto.
(print_keyword): Ditto.
(print_insn_normal): Ditto.
(read_insn): Ditto.
(print_insn): Ditto.
(default_print_insn): Ditto.
(print_insn_@arch@): Ditto.
* cgen-ibld.in (insert_normal): Remove PARAMS macro.
(insn_insn_normal): Ditto.
(extract_normal): Ditto.
(extract_insn_normal): Ditto.
(put_insn_int_value): Ditto.
(insert_1): Ditto.
(fill_cache): Ditto.
(extract_1): Ditto.
(insert_1): Prototype definition.
(insert_normal): Ditto.
(insert_insn_normal): Ditto.
(put_insn_int_value): Ditto.
(fill_cache): Ditto.
(extract_1): Ditto.
(extract_normal): Ditto.
(extract_insn_normal): Ditto.
2003-08-06 Nick Clifton <nickc@redhat.com> 2003-08-06 Nick Clifton <nickc@redhat.com>
* po/fr.po: Updated French translation. * po/fr.po: Updated French translation.

View file

@ -28,16 +28,14 @@
#include "opcode/cgen.h" #include "opcode/cgen.h"
#include "opintl.h" #include "opintl.h"
static CGEN_INSN_LIST * hash_insn_array PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, int, int, CGEN_INSN_LIST **, CGEN_INSN_LIST *)); static CGEN_INSN_LIST * hash_insn_array (CGEN_CPU_DESC, const CGEN_INSN *, int, int, CGEN_INSN_LIST **, CGEN_INSN_LIST *);
static CGEN_INSN_LIST * hash_insn_list PARAMS ((CGEN_CPU_DESC, const CGEN_INSN_LIST *, CGEN_INSN_LIST **, CGEN_INSN_LIST *)); static CGEN_INSN_LIST * hash_insn_list (CGEN_CPU_DESC, const CGEN_INSN_LIST *, CGEN_INSN_LIST **, CGEN_INSN_LIST *);
static void build_asm_hash_table PARAMS ((CGEN_CPU_DESC)); static void build_asm_hash_table (CGEN_CPU_DESC);
/* Set the cgen_parse_operand_fn callback. */ /* Set the cgen_parse_operand_fn callback. */
void void
cgen_set_parse_operand_fn (cd, fn) cgen_set_parse_operand_fn (CGEN_CPU_DESC cd, cgen_parse_operand_fn fn)
CGEN_CPU_DESC cd;
cgen_parse_operand_fn fn;
{ {
cd->parse_operand_fn = fn; cd->parse_operand_fn = fn;
} }
@ -45,8 +43,7 @@ cgen_set_parse_operand_fn (cd, fn)
/* Called whenever starting to parse an insn. */ /* Called whenever starting to parse an insn. */
void void
cgen_init_parse_operand (cd) cgen_init_parse_operand (CGEN_CPU_DESC cd)
CGEN_CPU_DESC cd;
{ {
/* This tells the callback to re-initialize. */ /* This tells the callback to re-initialize. */
(void) (* cd->parse_operand_fn) (void) (* cd->parse_operand_fn)
@ -66,13 +63,12 @@ cgen_init_parse_operand (cd)
list and we want earlier ones to be prefered. */ list and we want earlier ones to be prefered. */
static CGEN_INSN_LIST * static CGEN_INSN_LIST *
hash_insn_array (cd, insns, count, entsize, htable, hentbuf) hash_insn_array (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; const CGEN_INSN *insns,
const CGEN_INSN *insns; int count,
int count; int entsize ATTRIBUTE_UNUSED,
int entsize ATTRIBUTE_UNUSED; CGEN_INSN_LIST **htable,
CGEN_INSN_LIST **htable; CGEN_INSN_LIST *hentbuf)
CGEN_INSN_LIST *hentbuf;
{ {
int i; int i;
@ -97,11 +93,10 @@ hash_insn_array (cd, insns, count, entsize, htable, hentbuf)
in a list. */ in a list. */
static CGEN_INSN_LIST * static CGEN_INSN_LIST *
hash_insn_list (cd, insns, htable, hentbuf) hash_insn_list (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; const CGEN_INSN_LIST *insns,
const CGEN_INSN_LIST *insns; CGEN_INSN_LIST **htable,
CGEN_INSN_LIST **htable; CGEN_INSN_LIST *hentbuf)
CGEN_INSN_LIST *hentbuf;
{ {
const CGEN_INSN_LIST *ilist; const CGEN_INSN_LIST *ilist;
@ -123,8 +118,7 @@ hash_insn_list (cd, insns, htable, hentbuf)
/* Build the assembler instruction hash table. */ /* Build the assembler instruction hash table. */
static void static void
build_asm_hash_table (cd) build_asm_hash_table (CGEN_CPU_DESC cd)
CGEN_CPU_DESC cd;
{ {
int count = cgen_insn_count (cd) + cgen_macro_insn_count (cd); int count = cgen_insn_count (cd) + cgen_macro_insn_count (cd);
CGEN_INSN_TABLE *insn_table = &cd->insn_table; CGEN_INSN_TABLE *insn_table = &cd->insn_table;
@ -179,9 +173,7 @@ build_asm_hash_table (cd)
/* Return the first entry in the hash list for INSN. */ /* Return the first entry in the hash list for INSN. */
CGEN_INSN_LIST * CGEN_INSN_LIST *
cgen_asm_lookup_insn (cd, insn) cgen_asm_lookup_insn (CGEN_CPU_DESC cd, const char *insn)
CGEN_CPU_DESC cd;
const char *insn;
{ {
unsigned int hash; unsigned int hash;
@ -201,11 +193,10 @@ cgen_asm_lookup_insn (cd, insn)
recording something in the keyword table]. */ recording something in the keyword table]. */
const char * const char *
cgen_parse_keyword (cd, strp, keyword_table, valuep) cgen_parse_keyword (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; const char **strp,
const char **strp; CGEN_KEYWORD *keyword_table,
CGEN_KEYWORD *keyword_table; long *valuep)
long *valuep;
{ {
const CGEN_KEYWORD_ENTRY *ke; const CGEN_KEYWORD_ENTRY *ke;
char buf[256]; char buf[256];
@ -262,11 +253,10 @@ cgen_parse_keyword (cd, strp, keyword_table, valuep)
cgen_parse_address. */ cgen_parse_address. */
const char * const char *
cgen_parse_signed_integer (cd, strp, opindex, valuep) cgen_parse_signed_integer (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; const char **strp,
const char **strp; int opindex,
int opindex; long *valuep)
long *valuep;
{ {
bfd_vma value; bfd_vma value;
enum cgen_parse_operand_result result; enum cgen_parse_operand_result result;
@ -287,11 +277,10 @@ cgen_parse_signed_integer (cd, strp, opindex, valuep)
cgen_parse_address. */ cgen_parse_address. */
const char * const char *
cgen_parse_unsigned_integer (cd, strp, opindex, valuep) cgen_parse_unsigned_integer (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; const char **strp,
const char **strp; int opindex,
int opindex; unsigned long *valuep)
unsigned long *valuep;
{ {
bfd_vma value; bfd_vma value;
enum cgen_parse_operand_result result; enum cgen_parse_operand_result result;
@ -309,13 +298,12 @@ cgen_parse_unsigned_integer (cd, strp, opindex, valuep)
/* Address parser. */ /* Address parser. */
const char * const char *
cgen_parse_address (cd, strp, opindex, opinfo, resultp, valuep) cgen_parse_address (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; const char **strp,
const char **strp; int opindex,
int opindex; int opinfo,
int opinfo; enum cgen_parse_operand_result *resultp,
enum cgen_parse_operand_result *resultp; bfd_vma *valuep)
bfd_vma *valuep;
{ {
bfd_vma value; bfd_vma value;
enum cgen_parse_operand_result result_type; enum cgen_parse_operand_result result_type;
@ -337,8 +325,7 @@ cgen_parse_address (cd, strp, opindex, opinfo, resultp, valuep)
/* Signed integer validation routine. */ /* Signed integer validation routine. */
const char * const char *
cgen_validate_signed_integer (value, min, max) cgen_validate_signed_integer (long value, long min, long max)
long value, min, max;
{ {
if (value < min || value > max) if (value < min || value > max)
{ {
@ -358,8 +345,9 @@ cgen_validate_signed_integer (value, min, max)
cases where min != 0 (and max > LONG_MAX). */ cases where min != 0 (and max > LONG_MAX). */
const char * const char *
cgen_validate_unsigned_integer (value, min, max) cgen_validate_unsigned_integer (unsigned long value,
unsigned long value, min, max; unsigned long min,
unsigned long max)
{ {
if (value < min || value > max) if (value < min || value > max)
{ {

View file

@ -43,7 +43,7 @@ along with this program; if not, write to the Free Software Foundation, Inc.,
#define max(a,b) ((a) > (b) ? (a) : (b)) #define max(a,b) ((a) > (b) ? (a) : (b))
static const char * parse_insn_normal static const char * parse_insn_normal
PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, const char **, CGEN_FIELDS *)); (CGEN_CPU_DESC, const CGEN_INSN *, const char **, CGEN_FIELDS *);
/* -- assembler routines inserted here. */ /* -- assembler routines inserted here. */
@ -60,8 +60,7 @@ static const char * parse_insn_normal
Returns NULL for success, an error message for failure. */ Returns NULL for success, an error message for failure. */
char * char *
@arch@_cgen_build_insn_regex (insn) @arch@_cgen_build_insn_regex (CGEN_INSN *insn)
CGEN_INSN *insn;
{ {
CGEN_OPCODE *opc = (CGEN_OPCODE *) CGEN_INSN_OPCODE (insn); CGEN_OPCODE *opc = (CGEN_OPCODE *) CGEN_INSN_OPCODE (insn);
const char *mnem = CGEN_INSN_MNEMONIC (insn); const char *mnem = CGEN_INSN_MNEMONIC (insn);
@ -184,11 +183,10 @@ char *
Returns NULL for success, an error message for failure. */ Returns NULL for success, an error message for failure. */
static const char * static const char *
parse_insn_normal (cd, insn, strp, fields) parse_insn_normal (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; const CGEN_INSN *insn,
const CGEN_INSN *insn; const char **strp,
const char **strp; CGEN_FIELDS *fields)
CGEN_FIELDS *fields;
{ {
/* ??? Runtime added insns not handled yet. */ /* ??? Runtime added insns not handled yet. */
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
@ -326,12 +324,11 @@ parse_insn_normal (cd, insn, strp, fields)
mind helps keep the design clean. */ mind helps keep the design clean. */
const CGEN_INSN * const CGEN_INSN *
@arch@_cgen_assemble_insn (cd, str, fields, buf, errmsg) @arch@_cgen_assemble_insn (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; const char *str,
const char *str; CGEN_FIELDS *fields,
CGEN_FIELDS *fields; CGEN_INSN_BYTES_PTR buf,
CGEN_INSN_BYTES_PTR buf; char **errmsg)
char **errmsg;
{ {
const char *start; const char *start;
CGEN_INSN_LIST *ilist; CGEN_INSN_LIST *ilist;
@ -435,9 +432,7 @@ const CGEN_INSN *
FIXME: Not currently used. */ FIXME: Not currently used. */
void void
@arch@_cgen_asm_hash_keywords (cd, opvals) @arch@_cgen_asm_hash_keywords (CGEN_CPU_DESC cd, CGEN_KEYWORD *opvals)
CGEN_CPU_DESC cd;
CGEN_KEYWORD *opvals;
{ {
CGEN_KEYWORD_SEARCH search = cgen_keyword_search_init (opvals, NULL); CGEN_KEYWORD_SEARCH search = cgen_keyword_search_init (opvals, NULL);
const CGEN_KEYWORD_ENTRY * ke; const CGEN_KEYWORD_ENTRY * ke;

View file

@ -27,19 +27,18 @@
#include "symcat.h" #include "symcat.h"
#include "opcode/cgen.h" #include "opcode/cgen.h"
static CGEN_INSN_LIST * hash_insn_array PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, int, int, CGEN_INSN_LIST **, CGEN_INSN_LIST *)); static CGEN_INSN_LIST * hash_insn_array (CGEN_CPU_DESC, const CGEN_INSN *, int, int, CGEN_INSN_LIST **, CGEN_INSN_LIST *);
static CGEN_INSN_LIST * hash_insn_list PARAMS ((CGEN_CPU_DESC, const CGEN_INSN_LIST *, CGEN_INSN_LIST **, CGEN_INSN_LIST *)); static CGEN_INSN_LIST * hash_insn_list (CGEN_CPU_DESC, const CGEN_INSN_LIST *, CGEN_INSN_LIST **, CGEN_INSN_LIST *);
static void build_dis_hash_table PARAMS ((CGEN_CPU_DESC)); static void build_dis_hash_table (CGEN_CPU_DESC);
static int count_decodable_bits PARAMS ((const CGEN_INSN *)); static int count_decodable_bits (const CGEN_INSN *);
static void add_insn_to_hash_chain PARAMS ((CGEN_INSN_LIST *, static void add_insn_to_hash_chain (CGEN_INSN_LIST *,
const CGEN_INSN *, const CGEN_INSN *,
CGEN_INSN_LIST **, CGEN_INSN_LIST **,
unsigned int)); unsigned int);
/* Return the number of decodable bits in this insn. */ /* Return the number of decodable bits in this insn. */
static int static int
count_decodable_bits (insn) count_decodable_bits (const CGEN_INSN *insn)
const CGEN_INSN *insn;
{ {
unsigned mask = CGEN_INSN_BASE_MASK (insn); unsigned mask = CGEN_INSN_BASE_MASK (insn);
int bits = 0; int bits = 0;
@ -54,11 +53,10 @@ count_decodable_bits (insn)
/* Add an instruction to the hash chain. */ /* Add an instruction to the hash chain. */
static void static void
add_insn_to_hash_chain (hentbuf, insn, htable, hash) add_insn_to_hash_chain (CGEN_INSN_LIST *hentbuf,
CGEN_INSN_LIST *hentbuf; const CGEN_INSN *insn,
const CGEN_INSN *insn; CGEN_INSN_LIST **htable,
CGEN_INSN_LIST **htable; unsigned int hash)
unsigned int hash;
{ {
CGEN_INSN_LIST *current_buf; CGEN_INSN_LIST *current_buf;
CGEN_INSN_LIST *previous_buf; CGEN_INSN_LIST *previous_buf;
@ -100,13 +98,12 @@ add_insn_to_hash_chain (hentbuf, insn, htable, hash)
list and we want earlier ones to be prefered. */ list and we want earlier ones to be prefered. */
static CGEN_INSN_LIST * static CGEN_INSN_LIST *
hash_insn_array (cd, insns, count, entsize, htable, hentbuf) hash_insn_array (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; const CGEN_INSN * insns,
const CGEN_INSN * insns; int count,
int count; int entsize ATTRIBUTE_UNUSED,
int entsize ATTRIBUTE_UNUSED; CGEN_INSN_LIST ** htable,
CGEN_INSN_LIST ** htable; CGEN_INSN_LIST * hentbuf)
CGEN_INSN_LIST * hentbuf;
{ {
int big_p = CGEN_CPU_ENDIAN (cd) == CGEN_ENDIAN_BIG; int big_p = CGEN_CPU_ENDIAN (cd) == CGEN_ENDIAN_BIG;
int i; int i;
@ -141,11 +138,10 @@ hash_insn_array (cd, insns, count, entsize, htable, hentbuf)
in a list. */ in a list. */
static CGEN_INSN_LIST * static CGEN_INSN_LIST *
hash_insn_list (cd, insns, htable, hentbuf) hash_insn_list (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; const CGEN_INSN_LIST *insns,
const CGEN_INSN_LIST *insns; CGEN_INSN_LIST **htable,
CGEN_INSN_LIST **htable; CGEN_INSN_LIST *hentbuf)
CGEN_INSN_LIST *hentbuf;
{ {
int big_p = CGEN_CPU_ENDIAN (cd) == CGEN_ENDIAN_BIG; int big_p = CGEN_CPU_ENDIAN (cd) == CGEN_ENDIAN_BIG;
const CGEN_INSN_LIST *ilist; const CGEN_INSN_LIST *ilist;
@ -177,8 +173,7 @@ hash_insn_list (cd, insns, htable, hentbuf)
/* Build the disassembler instruction hash table. */ /* Build the disassembler instruction hash table. */
static void static void
build_dis_hash_table (cd) build_dis_hash_table (CGEN_CPU_DESC cd)
CGEN_CPU_DESC cd;
{ {
int count = cgen_insn_count (cd) + cgen_macro_insn_count (cd); int count = cgen_insn_count (cd) + cgen_macro_insn_count (cd);
CGEN_INSN_TABLE *insn_table = & cd->insn_table; CGEN_INSN_TABLE *insn_table = & cd->insn_table;
@ -233,10 +228,7 @@ build_dis_hash_table (cd)
/* Return the first entry in the hash list for INSN. */ /* Return the first entry in the hash list for INSN. */
CGEN_INSN_LIST * CGEN_INSN_LIST *
cgen_dis_lookup_insn (cd, buf, value) cgen_dis_lookup_insn (CGEN_CPU_DESC cd, const char * buf, CGEN_INSN_INT value)
CGEN_CPU_DESC cd;
const char * buf;
CGEN_INSN_INT value;
{ {
unsigned int hash; unsigned int hash;

View file

@ -41,34 +41,32 @@ along with this program; if not, write to the Free Software Foundation, Inc.,
#define UNKNOWN_INSN_MSG _("*unknown*") #define UNKNOWN_INSN_MSG _("*unknown*")
static void print_normal static void print_normal
PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned int, bfd_vma, int)); (CGEN_CPU_DESC, void *, long, unsigned int, bfd_vma, int);
static void print_address static void print_address
PARAMS ((CGEN_CPU_DESC, PTR, bfd_vma, unsigned int, bfd_vma, int)); (CGEN_CPU_DESC, void *, bfd_vma, unsigned int, bfd_vma, int);
static void print_keyword static void print_keyword
PARAMS ((CGEN_CPU_DESC, PTR, CGEN_KEYWORD *, long, unsigned int)); (CGEN_CPU_DESC, void *, CGEN_KEYWORD *, long, unsigned int);
static void print_insn_normal static void print_insn_normal
PARAMS ((CGEN_CPU_DESC, PTR, const CGEN_INSN *, CGEN_FIELDS *, (CGEN_CPU_DESC, void *, const CGEN_INSN *, CGEN_FIELDS *, bfd_vma, int);
bfd_vma, int));
static int print_insn static int print_insn
PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *, char *, unsigned)); (CGEN_CPU_DESC, bfd_vma, disassemble_info *, char *, unsigned);
static int default_print_insn static int default_print_insn
PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *)); (CGEN_CPU_DESC, bfd_vma, disassemble_info *);
static int read_insn static int read_insn
PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *, char *, int, (CGEN_CPU_DESC, bfd_vma, disassemble_info *, char *, int, CGEN_EXTRACT_INFO *,
CGEN_EXTRACT_INFO *, unsigned long *)); unsigned long *);
/* -- disassembler routines inserted here */ /* -- disassembler routines inserted here */
/* Default print handler. */ /* Default print handler. */
static void static void
print_normal (cd, dis_info, value, attrs, pc, length) print_normal (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; void *dis_info,
PTR dis_info; long value,
long value; unsigned int attrs,
unsigned int attrs; bfd_vma pc ATTRIBUTE_UNUSED,
bfd_vma pc ATTRIBUTE_UNUSED; int length ATTRIBUTE_UNUSED)
int length ATTRIBUTE_UNUSED;
{ {
disassemble_info *info = (disassemble_info *) dis_info; disassemble_info *info = (disassemble_info *) dis_info;
@ -88,13 +86,12 @@ print_normal (cd, dis_info, value, attrs, pc, length)
/* Default address handler. */ /* Default address handler. */
static void static void
print_address (cd, dis_info, value, attrs, pc, length) print_address (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; void *dis_info,
PTR dis_info; bfd_vma value,
bfd_vma value; unsigned int attrs,
unsigned int attrs; bfd_vma pc ATTRIBUTE_UNUSED,
bfd_vma pc ATTRIBUTE_UNUSED; int length ATTRIBUTE_UNUSED)
int length ATTRIBUTE_UNUSED;
{ {
disassemble_info *info = (disassemble_info *) dis_info; disassemble_info *info = (disassemble_info *) dis_info;
@ -118,12 +115,11 @@ print_address (cd, dis_info, value, attrs, pc, length)
/* Keyword print handler. */ /* Keyword print handler. */
static void static void
print_keyword (cd, dis_info, keyword_table, value, attrs) print_keyword (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; void *dis_info,
PTR dis_info; CGEN_KEYWORD *keyword_table,
CGEN_KEYWORD *keyword_table; long value,
long value; unsigned int attrs ATTRIBUTE_UNUSED)
unsigned int attrs ATTRIBUTE_UNUSED;
{ {
disassemble_info *info = (disassemble_info *) dis_info; disassemble_info *info = (disassemble_info *) dis_info;
const CGEN_KEYWORD_ENTRY *ke; const CGEN_KEYWORD_ENTRY *ke;
@ -137,17 +133,16 @@ print_keyword (cd, dis_info, keyword_table, value, attrs)
/* Default insn printer. /* Default insn printer.
DIS_INFO is defined as `PTR' so the disassembler needn't know anything DIS_INFO is defined as `void *' so the disassembler needn't know anything
about disassemble_info. */ about disassemble_info. */
static void static void
print_insn_normal (cd, dis_info, insn, fields, pc, length) print_insn_normal (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; void *dis_info,
PTR dis_info; const CGEN_INSN *insn,
const CGEN_INSN *insn; CGEN_FIELDS *fields,
CGEN_FIELDS *fields; bfd_vma pc,
bfd_vma pc; int length)
int 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;
@ -179,14 +174,13 @@ 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 (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; bfd_vma pc,
bfd_vma pc; disassemble_info *info,
disassemble_info *info; char *buf,
char *buf; int buflen,
int buflen; CGEN_EXTRACT_INFO *ex_info,
CGEN_EXTRACT_INFO *ex_info; unsigned long *insn_value)
unsigned long *insn_value;
{ {
int status = (*info->read_memory_func) (pc, buf, buflen, info); int status = (*info->read_memory_func) (pc, buf, buflen, info);
if (status != 0) if (status != 0)
@ -210,12 +204,11 @@ read_insn (cd, pc, info, buf, buflen, ex_info, insn_value)
been called). */ been called). */
static int static int
print_insn (cd, pc, info, buf, buflen) print_insn (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; bfd_vma pc,
bfd_vma pc; disassemble_info *info,
disassemble_info *info; char *buf,
char *buf; unsigned int buflen)
unsigned int buflen;
{ {
CGEN_INSN_INT insn_value; CGEN_INSN_INT insn_value;
const CGEN_INSN_LIST *insn_list; const CGEN_INSN_LIST *insn_list;
@ -320,10 +313,7 @@ print_insn (cd, pc, info, buf, buflen)
#endif #endif
static int static int
default_print_insn (cd, pc, info) default_print_insn (CGEN_CPU_DESC cd, bfd_vma pc, disassemble_info *info)
CGEN_CPU_DESC cd;
bfd_vma pc;
disassemble_info *info;
{ {
char buf[CGEN_MAX_INSN_SIZE]; char buf[CGEN_MAX_INSN_SIZE];
int buflen; int buflen;
@ -362,9 +352,7 @@ typedef struct cpu_desc_list {
} cpu_desc_list; } cpu_desc_list;
int int
print_insn_@arch@ (pc, info) print_insn_@arch@ (bfd_vma pc, disassemble_info *info)
bfd_vma pc;
disassemble_info *info;
{ {
static cpu_desc_list *cd_list = 0; static cpu_desc_list *cd_list = 0;
cpu_desc_list *cl = 0; cpu_desc_list *cl = 0;

View file

@ -44,30 +44,29 @@ along with this program; if not, write to the Free Software Foundation, Inc.,
#define FLD(f) (fields->f) #define FLD(f) (fields->f)
static const char * insert_normal static const char * insert_normal
PARAMS ((CGEN_CPU_DESC, long, unsigned int, unsigned int, unsigned int, (CGEN_CPU_DESC, long, unsigned int, unsigned int, unsigned int,
unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR)); unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR);
static const char * insert_insn_normal static const char * insert_insn_normal
PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, (CGEN_CPU_DESC, const CGEN_INSN *,
CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma)); CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma);
static int extract_normal static int extract_normal
PARAMS ((CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, CGEN_INSN_INT,
unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int,
unsigned int, unsigned int, bfd_vma, long *)); unsigned int, unsigned int, bfd_vma, long *);
static int extract_insn_normal static int extract_insn_normal
PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, CGEN_EXTRACT_INFO *, (CGEN_CPU_DESC, const CGEN_INSN *, CGEN_EXTRACT_INFO *,
CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma)); CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma);
#if CGEN_INT_INSN_P #if CGEN_INT_INSN_P
static void put_insn_int_value static void put_insn_int_value
PARAMS ((CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT)); (CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT);
#endif #endif
#if ! CGEN_INT_INSN_P #if ! CGEN_INT_INSN_P
static CGEN_INLINE void insert_1 static CGEN_INLINE void insert_1
PARAMS ((CGEN_CPU_DESC, unsigned long, int, int, int, unsigned char *)); (CGEN_CPU_DESC, unsigned long, int, int, int, unsigned char *);
static CGEN_INLINE int fill_cache static CGEN_INLINE int fill_cache
PARAMS ((CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, bfd_vma)); (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, bfd_vma);
static CGEN_INLINE long extract_1 static CGEN_INLINE long extract_1
PARAMS ((CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, int, (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, int, unsigned char *, bfd_vma);
unsigned char *, bfd_vma));
#endif #endif
/* Operand insertion. */ /* Operand insertion. */
@ -77,11 +76,10 @@ static CGEN_INLINE long extract_1
/* Subroutine of insert_normal. */ /* Subroutine of insert_normal. */
static CGEN_INLINE void static CGEN_INLINE void
insert_1 (cd, value, start, length, word_length, bufp) insert_1 (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; unsigned long value,
unsigned long value; int start,length,word_length,
int start,length,word_length; unsigned char *bufp)
unsigned char *bufp;
{ {
unsigned long x,mask; unsigned long x,mask;
int shift; int shift;
@ -118,13 +116,15 @@ insert_1 (cd, value, start, length, word_length, bufp)
necessary. */ necessary. */
static const char * static const char *
insert_normal (cd, value, attrs, word_offset, start, length, word_length, insert_normal (CGEN_CPU_DESC cd,
total_length, buffer) long value,
CGEN_CPU_DESC cd; unsigned int attrs,
long value; unsigned int word_offset,
unsigned int attrs; unsigned int start,
unsigned int word_offset, start, length, word_length, total_length; unsigned int length,
CGEN_INSN_BYTES_PTR buffer; unsigned int word_length,
unsigned int total_length,
CGEN_INSN_BYTES_PTR buffer)
{ {
static char errbuf[100]; static char errbuf[100];
/* Written this way to avoid undefined behaviour. */ /* Written this way to avoid undefined behaviour. */
@ -232,12 +232,11 @@ insert_normal (cd, value, attrs, word_offset, start, length, word_length,
The result is an error message or NULL if success. */ The result is an error message or NULL if success. */
static const char * static const char *
insert_insn_normal (cd, insn, fields, buffer, pc) insert_insn_normal (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; const CGEN_INSN * insn,
const CGEN_INSN * insn; CGEN_FIELDS * fields,
CGEN_FIELDS * fields; CGEN_INSN_BYTES_PTR buffer,
CGEN_INSN_BYTES_PTR buffer; bfd_vma pc)
bfd_vma pc;
{ {
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
unsigned long value; unsigned long value;
@ -288,12 +287,11 @@ insert_insn_normal (cd, insn, fields, buffer, pc)
because it needs <prefix>-desc.h for CGEN_INT_INSN_P. */ because it needs <prefix>-desc.h for CGEN_INT_INSN_P. */
static void static void
put_insn_int_value (cd, buf, length, insn_length, value) put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; CGEN_INSN_BYTES_PTR buf,
CGEN_INSN_BYTES_PTR buf; int length,
int length; int insn_length,
int insn_length; CGEN_INSN_INT value)
CGEN_INSN_INT value;
{ {
/* For architectures with insns smaller than the base-insn-bitsize, /* For architectures with insns smaller than the base-insn-bitsize,
length may be too big. */ length may be too big. */
@ -320,11 +318,10 @@ put_insn_int_value (cd, buf, length, insn_length, value)
Returns 1 for success, 0 for failure. */ Returns 1 for success, 0 for failure. */
static CGEN_INLINE int static CGEN_INLINE int
fill_cache (cd, ex_info, offset, bytes, pc) fill_cache (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; CGEN_EXTRACT_INFO *ex_info,
CGEN_EXTRACT_INFO *ex_info; int offset, bytes,
int offset, bytes; bfd_vma pc)
bfd_vma pc;
{ {
/* It's doubtful that the middle part has already been fetched so /* It's doubtful that the middle part has already been fetched so
we don't optimize that case. kiss. */ we don't optimize that case. kiss. */
@ -364,12 +361,13 @@ fill_cache (cd, ex_info, offset, bytes, pc)
/* Subroutine of extract_normal. */ /* Subroutine of extract_normal. */
static CGEN_INLINE long static CGEN_INLINE long
extract_1 (cd, ex_info, start, length, word_length, bufp, pc) extract_1 (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED,
CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED; int start,
int start,length,word_length; int length,
unsigned char *bufp; int word_length,
bfd_vma pc ATTRIBUTE_UNUSED; unsigned char *bufp,
bfd_vma pc ATTRIBUTE_UNUSED)
{ {
unsigned long x; unsigned long x;
int shift; int shift;
@ -408,23 +406,25 @@ extract_1 (cd, ex_info, start, length, word_length, bufp, pc)
necessary. */ necessary. */
static int static int
extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length, extract_normal (CGEN_CPU_DESC cd;
word_length, total_length, pc, valuep)
CGEN_CPU_DESC cd;
#if ! CGEN_INT_INSN_P #if ! CGEN_INT_INSN_P
CGEN_EXTRACT_INFO *ex_info; CGEN_EXTRACT_INFO *ex_info,
#else #else
CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED; CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED,
#endif #endif
CGEN_INSN_INT insn_value; CGEN_INSN_INT insn_value,
unsigned int attrs; unsigned int attrs,
unsigned int word_offset, start, length, word_length, total_length; unsigned int word_offset,
unsigned int start,
unsigned int length,
unsigned int word_length,
unsigned int total_length,
#if ! CGEN_INT_INSN_P #if ! CGEN_INT_INSN_P
bfd_vma pc; bfd_vma pc,
#else #else
bfd_vma pc ATTRIBUTE_UNUSED; bfd_vma pc ATTRIBUTE_UNUSED,
#endif #endif
long *valuep; long *valuep)
{ {
long value, mask; long value, mask;
@ -505,13 +505,12 @@ extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length,
been called). */ been called). */
static int static int
extract_insn_normal (cd, insn, ex_info, insn_value, fields, pc) extract_insn_normal (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; const CGEN_INSN *insn,
const CGEN_INSN *insn; CGEN_EXTRACT_INFO *ex_info,
CGEN_EXTRACT_INFO *ex_info; CGEN_INSN_INT insn_value,
CGEN_INSN_INT insn_value; CGEN_FIELDS *fields,
CGEN_FIELDS *fields; bfd_vma pc)
bfd_vma pc;
{ {
const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
const CGEN_SYNTAX_CHAR_TYPE *syn; const CGEN_SYNTAX_CHAR_TYPE *syn;

View file

@ -33,11 +33,11 @@
#endif #endif
static unsigned int hash_keyword_name static unsigned int hash_keyword_name
PARAMS ((const CGEN_KEYWORD *, const char *, int)); (const CGEN_KEYWORD *, const char *, int);
static unsigned int hash_keyword_value static unsigned int hash_keyword_value
PARAMS ((const CGEN_KEYWORD *, unsigned int)); (const CGEN_KEYWORD *, unsigned int);
static void build_keyword_hash_tables static void build_keyword_hash_tables
PARAMS ((CGEN_KEYWORD *)); (CGEN_KEYWORD *);
/* Return number of hash table entries to use for N elements. */ /* Return number of hash table entries to use for N elements. */
#define KEYWORD_HASH_SIZE(n) ((n) <= 31 ? 17 : 31) #define KEYWORD_HASH_SIZE(n) ((n) <= 31 ? 17 : 31)
@ -46,9 +46,7 @@ static void build_keyword_hash_tables
The result is the keyword entry or NULL if not found. */ The result is the keyword entry or NULL if not found. */
const CGEN_KEYWORD_ENTRY * const CGEN_KEYWORD_ENTRY *
cgen_keyword_lookup_name (kt, name) cgen_keyword_lookup_name (CGEN_KEYWORD *kt, const char *name)
CGEN_KEYWORD *kt;
const char *name;
{ {
const CGEN_KEYWORD_ENTRY *ke; const CGEN_KEYWORD_ENTRY *ke;
const char *p,*n; const char *p,*n;
@ -87,9 +85,7 @@ cgen_keyword_lookup_name (kt, name)
The result is the keyword entry or NULL if not found. */ The result is the keyword entry or NULL if not found. */
const CGEN_KEYWORD_ENTRY * const CGEN_KEYWORD_ENTRY *
cgen_keyword_lookup_value (kt, value) cgen_keyword_lookup_value (CGEN_KEYWORD *kt, int value)
CGEN_KEYWORD *kt;
int value;
{ {
const CGEN_KEYWORD_ENTRY *ke; const CGEN_KEYWORD_ENTRY *ke;
@ -111,9 +107,7 @@ cgen_keyword_lookup_value (kt, value)
/* Add an entry to a keyword table. */ /* Add an entry to a keyword table. */
void void
cgen_keyword_add (kt, ke) cgen_keyword_add (CGEN_KEYWORD *kt, CGEN_KEYWORD_ENTRY *ke)
CGEN_KEYWORD *kt;
CGEN_KEYWORD_ENTRY *ke;
{ {
unsigned int hash; unsigned int hash;
size_t i; size_t i;
@ -159,9 +153,7 @@ cgen_keyword_add (kt, ke)
It is passed to each call to cgen_keyword_search_next. */ It is passed to each call to cgen_keyword_search_next. */
CGEN_KEYWORD_SEARCH CGEN_KEYWORD_SEARCH
cgen_keyword_search_init (kt, spec) cgen_keyword_search_init (CGEN_KEYWORD *kt, const char *spec)
CGEN_KEYWORD *kt;
const char *spec;
{ {
CGEN_KEYWORD_SEARCH search; CGEN_KEYWORD_SEARCH search;
@ -183,8 +175,7 @@ cgen_keyword_search_init (kt, spec)
The result is the next entry or NULL if there are no more. */ The result is the next entry or NULL if there are no more. */
const CGEN_KEYWORD_ENTRY * const CGEN_KEYWORD_ENTRY *
cgen_keyword_search_next (search) cgen_keyword_search_next (CGEN_KEYWORD_SEARCH *search)
CGEN_KEYWORD_SEARCH *search;
{ {
/* Has search finished? */ /* Has search finished? */
if (search->current_hash == search->table->hash_table_size) if (search->current_hash == search->table->hash_table_size)
@ -218,10 +209,9 @@ cgen_keyword_search_next (search)
If CASE_SENSITIVE_P is non-zero, return a case sensitive hash. */ If CASE_SENSITIVE_P is non-zero, return a case sensitive hash. */
static unsigned int static unsigned int
hash_keyword_name (kt, name, case_sensitive_p) hash_keyword_name (const CGEN_KEYWORD *kt,
const CGEN_KEYWORD *kt; const char *name,
const char *name; int case_sensitive_p)
int case_sensitive_p;
{ {
unsigned int hash; unsigned int hash;
@ -237,9 +227,7 @@ hash_keyword_name (kt, name, case_sensitive_p)
/* Return first entry in hash chain for VALUE. */ /* Return first entry in hash chain for VALUE. */
static unsigned int static unsigned int
hash_keyword_value (kt, value) hash_keyword_value (const CGEN_KEYWORD *kt, unsigned int value)
const CGEN_KEYWORD *kt;
unsigned int value;
{ {
return value % kt->hash_table_size; return value % kt->hash_table_size;
} }
@ -249,8 +237,7 @@ hash_keyword_value (kt, value)
we're using the disassembler, but we keep things simple. */ we're using the disassembler, but we keep things simple. */
static void static void
build_keyword_hash_tables (kt) build_keyword_hash_tables (CGEN_KEYWORD *kt)
CGEN_KEYWORD *kt;
{ {
int i; int i;
/* Use the number of compiled in entries as an estimate for the /* Use the number of compiled in entries as an estimate for the
@ -278,9 +265,7 @@ build_keyword_hash_tables (kt)
mach/isa. */ mach/isa. */
const CGEN_HW_ENTRY * const CGEN_HW_ENTRY *
cgen_hw_lookup_by_name (cd, name) cgen_hw_lookup_by_name (CGEN_CPU_DESC cd, const char *name)
CGEN_CPU_DESC cd;
const char *name;
{ {
unsigned int i; unsigned int i;
const CGEN_HW_ENTRY **hw = cd->hw_table.entries; const CGEN_HW_ENTRY **hw = cd->hw_table.entries;
@ -298,9 +283,7 @@ cgen_hw_lookup_by_name (cd, name)
Returns NULL if HWNUM is not supported by the currently selected mach. */ Returns NULL if HWNUM is not supported by the currently selected mach. */
const CGEN_HW_ENTRY * const CGEN_HW_ENTRY *
cgen_hw_lookup_by_num (cd, hwnum) cgen_hw_lookup_by_num (CGEN_CPU_DESC cd, unsigned int hwnum)
CGEN_CPU_DESC cd;
unsigned int hwnum;
{ {
unsigned int i; unsigned int i;
const CGEN_HW_ENTRY **hw = cd->hw_table.entries; const CGEN_HW_ENTRY **hw = cd->hw_table.entries;
@ -320,9 +303,7 @@ cgen_hw_lookup_by_num (cd, hwnum)
mach/isa. */ mach/isa. */
const CGEN_OPERAND * const CGEN_OPERAND *
cgen_operand_lookup_by_name (cd, name) cgen_operand_lookup_by_name (CGEN_CPU_DESC cd, const char *name)
CGEN_CPU_DESC cd;
const char *name;
{ {
unsigned int i; unsigned int i;
const CGEN_OPERAND **op = cd->operand_table.entries; const CGEN_OPERAND **op = cd->operand_table.entries;
@ -341,9 +322,7 @@ cgen_operand_lookup_by_name (cd, name)
mach/isa. */ mach/isa. */
const CGEN_OPERAND * const CGEN_OPERAND *
cgen_operand_lookup_by_num (cd, opnum) cgen_operand_lookup_by_num (CGEN_CPU_DESC cd, int opnum)
CGEN_CPU_DESC cd;
int opnum;
{ {
return cd->operand_table.entries[opnum]; return cd->operand_table.entries[opnum];
} }
@ -353,8 +332,7 @@ cgen_operand_lookup_by_num (cd, opnum)
/* Return number of instructions. This includes any added at runtime. */ /* Return number of instructions. This includes any added at runtime. */
int int
cgen_insn_count (cd) cgen_insn_count (CGEN_CPU_DESC cd)
CGEN_CPU_DESC cd;
{ {
int count = cd->insn_table.num_init_entries; int count = cd->insn_table.num_init_entries;
CGEN_INSN_LIST *rt_insns = cd->insn_table.new_entries; CGEN_INSN_LIST *rt_insns = cd->insn_table.new_entries;
@ -369,8 +347,7 @@ cgen_insn_count (cd)
This includes any added at runtime. */ This includes any added at runtime. */
int int
cgen_macro_insn_count (cd) cgen_macro_insn_count (CGEN_CPU_DESC cd)
CGEN_CPU_DESC cd;
{ {
int count = cd->macro_insn_table.num_init_entries; int count = cd->macro_insn_table.num_init_entries;
CGEN_INSN_LIST *rt_insns = cd->macro_insn_table.new_entries; CGEN_INSN_LIST *rt_insns = cd->macro_insn_table.new_entries;
@ -384,10 +361,7 @@ cgen_macro_insn_count (cd)
/* Cover function to read and properly byteswap an insn value. */ /* Cover function to read and properly byteswap an insn value. */
CGEN_INSN_INT CGEN_INSN_INT
cgen_get_insn_value (cd, buf, length) cgen_get_insn_value (CGEN_CPU_DESC cd, unsigned char *buf, int length)
CGEN_CPU_DESC cd;
unsigned char *buf;
int length;
{ {
int big_p = (cd->insn_endian == CGEN_ENDIAN_BIG); int big_p = (cd->insn_endian == CGEN_ENDIAN_BIG);
int insn_chunk_bitsize = cd->insn_chunk_bitsize; int insn_chunk_bitsize = cd->insn_chunk_bitsize;
@ -423,11 +397,10 @@ cgen_get_insn_value (cd, buf, length)
/* Cover function to store an insn value properly byteswapped. */ /* Cover function to store an insn value properly byteswapped. */
void void
cgen_put_insn_value (cd, buf, length, value) cgen_put_insn_value (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; unsigned char *buf,
unsigned char *buf; int length,
int length; CGEN_INSN_INT value)
CGEN_INSN_INT value;
{ {
int big_p = (cd->insn_endian == CGEN_ENDIAN_BIG); int big_p = (cd->insn_endian == CGEN_ENDIAN_BIG);
int insn_chunk_bitsize = cd->insn_chunk_bitsize; int insn_chunk_bitsize = cd->insn_chunk_bitsize;
@ -472,16 +445,14 @@ cgen_put_insn_value (cd, buf, length, value)
/* ??? Will need to be revisited for VLIW architectures. */ /* ??? Will need to be revisited for VLIW architectures. */
const CGEN_INSN * const CGEN_INSN *
cgen_lookup_insn (cd, insn, insn_int_value, insn_bytes_value, length, fields, cgen_lookup_insn (CGEN_CPU_DESC cd,
alias_p) const CGEN_INSN *insn,
CGEN_CPU_DESC cd; CGEN_INSN_INT insn_int_value,
const CGEN_INSN *insn; /* ??? CGEN_INSN_BYTES would be a nice type name to use here. */
CGEN_INSN_INT insn_int_value; unsigned char *insn_bytes_value,
/* ??? CGEN_INSN_BYTES would be a nice type name to use here. */ int length,
unsigned char *insn_bytes_value; CGEN_FIELDS *fields,
int length; int alias_p)
CGEN_FIELDS *fields;
int alias_p;
{ {
unsigned char *buf; unsigned char *buf;
CGEN_INSN_INT base_insn; CGEN_INSN_INT base_insn;
@ -571,11 +542,10 @@ cgen_lookup_insn (cd, insn, insn_int_value, insn_bytes_value, length, fields,
in. */ in. */
void void
cgen_get_insn_operands (cd, insn, fields, indices) cgen_get_insn_operands (CGEN_CPU_DESC cd,
CGEN_CPU_DESC cd; const CGEN_INSN *insn,
const CGEN_INSN *insn; const CGEN_FIELDS *fields,
const CGEN_FIELDS *fields; int *indices)
int *indices;
{ {
const CGEN_OPINST *opinst; const CGEN_OPINST *opinst;
int i; int i;
@ -603,16 +573,14 @@ cgen_get_insn_operands (cd, insn, fields, indices)
recognized. */ recognized. */
const CGEN_INSN * const CGEN_INSN *
cgen_lookup_get_insn_operands (cd, insn, insn_int_value, insn_bytes_value, cgen_lookup_get_insn_operands (CGEN_CPU_DESC cd,
length, indices, fields) const CGEN_INSN *insn,
CGEN_CPU_DESC cd; CGEN_INSN_INT insn_int_value,
const CGEN_INSN *insn; /* ??? CGEN_INSN_BYTES would be a nice type name to use here. */
CGEN_INSN_INT insn_int_value; unsigned char *insn_bytes_value,
/* ??? CGEN_INSN_BYTES would be a nice type name to use here. */ int length,
unsigned char *insn_bytes_value; int *indices,
int length; CGEN_FIELDS *fields)
int *indices;
CGEN_FIELDS *fields;
{ {
/* Pass non-zero for ALIAS_P only if INSN != NULL. /* Pass non-zero for ALIAS_P only if INSN != NULL.
If INSN == NULL, we want a real insn. */ If INSN == NULL, we want a real insn. */
@ -627,24 +595,21 @@ cgen_lookup_get_insn_operands (cd, insn, insn_int_value, insn_bytes_value,
/* Allow signed overflow of instruction fields. */ /* Allow signed overflow of instruction fields. */
void void
cgen_set_signed_overflow_ok (cd) cgen_set_signed_overflow_ok (CGEN_CPU_DESC cd)
CGEN_CPU_DESC cd;
{ {
cd->signed_overflow_ok_p = 1; cd->signed_overflow_ok_p = 1;
} }
/* Generate an error message if a signed field in an instruction overflows. */ /* Generate an error message if a signed field in an instruction overflows. */
void void
cgen_clear_signed_overflow_ok (cd) cgen_clear_signed_overflow_ok (CGEN_CPU_DESC cd)
CGEN_CPU_DESC cd;
{ {
cd->signed_overflow_ok_p = 0; cd->signed_overflow_ok_p = 0;
} }
/* Will an error message be generated if a signed field in an instruction overflows ? */ /* Will an error message be generated if a signed field in an instruction overflows ? */
unsigned int unsigned int
cgen_signed_overflow_ok_p (cd) cgen_signed_overflow_ok_p (CGEN_CPU_DESC cd)
CGEN_CPU_DESC cd;
{ {
return cd->signed_overflow_ok_p; return cd->signed_overflow_ok_p;
} }