From: Michael Meissner Date: Fri, 8 Aug 2003 21:21:24 +0000 (+0000) Subject: Convert cgen to C-90 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=360c5c446fa1a227d0d5a399c46d009d09c1b20a;p=pf3gnuchains%2Fpf3gnuchains3x.git Convert cgen to C-90 --- diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index c0e95d5bf5..a9b501d1ef 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,3 +1,13 @@ +2003-08-07 Michael Meissner + + * 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 * alpha.h: Remove PARAMS macro. diff --git a/include/opcode/cgen.h b/include/opcode/cgen.h index 76a0af47b5..16366fd0d7 100644 --- a/include/opcode/cgen.h +++ b/include/opcode/cgen.h @@ -242,9 +242,9 @@ typedef struct cgen_fields CGEN_FIELDS; typedef 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). */ - PTR dis_info; + void *dis_info; /* Points to a working buffer of sufficient size. */ unsigned char *insn_bytes; /* Mask of bytes that are valid in INSN_BYTES. */ @@ -265,8 +265,8 @@ typedef struct { If not it is left alone. The result is NULL if success or an error message. */ typedef const char * (cgen_parse_fn) - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *insn_, - const char **strp_, CGEN_FIELDS *fields_)); + (CGEN_CPU_DESC, const CGEN_INSN *insn_, + const char **strp_, CGEN_FIELDS *fields_); /* Insert handler. CD is a cpu table descriptor. @@ -279,9 +279,9 @@ typedef const char * (cgen_parse_fn) #ifdef __BFD_H_SEEN__ typedef const char * (cgen_insert_fn) - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *insn_, - CGEN_FIELDS *fields_, CGEN_INSN_BYTES_PTR insnp_, - bfd_vma pc_)); + (CGEN_CPU_DESC, const CGEN_INSN *insn_, + CGEN_FIELDS *fields_, CGEN_INSN_BYTES_PTR insnp_, + bfd_vma pc_); #else typedef const char * (cgen_insert_fn) (); #endif @@ -300,9 +300,9 @@ typedef const char * (cgen_insert_fn) (); #ifdef __BFD_H_SEEN__ typedef int (cgen_extract_fn) - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *insn_, - CGEN_EXTRACT_INFO *ex_info_, CGEN_INSN_INT base_insn_, - CGEN_FIELDS *fields_, bfd_vma pc_)); + (CGEN_CPU_DESC, const CGEN_INSN *insn_, + CGEN_EXTRACT_INFO *ex_info_, CGEN_INSN_INT base_insn_, + CGEN_FIELDS *fields_, bfd_vma pc_); #else typedef int (cgen_extract_fn) (); #endif @@ -319,8 +319,8 @@ typedef int (cgen_extract_fn) (); #ifdef __BFD_H_SEEN__ typedef void (cgen_print_fn) - PARAMS ((CGEN_CPU_DESC, PTR info_, const CGEN_INSN *insn_, - CGEN_FIELDS *fields_, bfd_vma pc_, int len_)); + (CGEN_CPU_DESC, void * info_, const CGEN_INSN *insn_, + CGEN_FIELDS *fields_, bfd_vma pc_, int len_); #else typedef void (cgen_print_fn) (); #endif @@ -384,9 +384,9 @@ enum cgen_parse_operand_result #ifdef __BFD_H_SEEN__ /* Don't require bfd.h unnecessarily. */ typedef const char * (cgen_parse_operand_fn) - PARAMS ((CGEN_CPU_DESC, - enum cgen_parse_operand_type, const char **, int, int, - enum cgen_parse_operand_result *, bfd_vma *)); + (CGEN_CPU_DESC, + enum cgen_parse_operand_type, const char **, int, int, + enum cgen_parse_operand_result *, bfd_vma *); #else typedef const char * (cgen_parse_operand_fn) (); #endif @@ -394,11 +394,11 @@ typedef const char * (cgen_parse_operand_fn) (); /* Set the cgen_parse_operand_fn callback. */ 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. */ -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.) */ @@ -422,7 +422,7 @@ typedef struct /* There is currently no example where both index specs and value specs are required, so for now both are clumped under "asm_data". */ enum cgen_asm_type asm_type; - PTR asm_data; + void *asm_data; #ifndef CGEN_HW_NBOOL_ATTRS #define CGEN_HW_NBOOL_ATTRS 1 #endif @@ -453,9 +453,9 @@ typedef struct { } CGEN_HW_TABLE; 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 - PARAMS ((CGEN_CPU_DESC, unsigned int)); + (CGEN_CPU_DESC, unsigned int); /* This struct is used to describe things like register names, etc. */ @@ -543,41 +543,41 @@ typedef struct /* Lookup a keyword from its name. */ const CGEN_KEYWORD_ENTRY *cgen_keyword_lookup_name - PARAMS ((CGEN_KEYWORD *, const char *)); + (CGEN_KEYWORD *, const char *); /* Lookup a keyword from its value. */ const CGEN_KEYWORD_ENTRY *cgen_keyword_lookup_value - PARAMS ((CGEN_KEYWORD *, int)); + (CGEN_KEYWORD *, int); /* Add a keyword. */ -void cgen_keyword_add PARAMS ((CGEN_KEYWORD *, CGEN_KEYWORD_ENTRY *)); +void cgen_keyword_add (CGEN_KEYWORD *, CGEN_KEYWORD_ENTRY *); /* Keyword searching. This can be used to retrieve every keyword, or a subset. */ CGEN_KEYWORD_SEARCH cgen_keyword_search_init - PARAMS ((CGEN_KEYWORD *, const char *)); + (CGEN_KEYWORD *, const char *); const CGEN_KEYWORD_ENTRY *cgen_keyword_search_next - PARAMS ((CGEN_KEYWORD_SEARCH *)); + (CGEN_KEYWORD_SEARCH *); /* Operand value support routines. */ 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. */ 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 - PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); + (CGEN_CPU_DESC, const char **, int, unsigned long *); extern const char *cgen_parse_address - PARAMS ((CGEN_CPU_DESC, const char **, int, int, - enum cgen_parse_operand_result *, bfd_vma *)); + (CGEN_CPU_DESC, const char **, int, int, + enum cgen_parse_operand_result *, bfd_vma *); extern const char *cgen_validate_signed_integer - PARAMS ((long, long, long)); + (long, long, long); extern const char *cgen_validate_unsigned_integer - PARAMS ((unsigned long, unsigned long, unsigned long)); + (unsigned long, unsigned long, unsigned long); #endif /* Operand modes. */ @@ -621,7 +621,7 @@ typedef struct cgen_maybe_multi_ifield n: indexed by array of more cgen_maybe_multi_ifields. */ union { - const PTR p; + const void *p; const struct cgen_maybe_multi_ifield * multi; const struct cgen_ifld * leaf; } val; @@ -705,9 +705,9 @@ typedef struct { } CGEN_OPERAND_TABLE; 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 - PARAMS ((CGEN_CPU_DESC, int)); + (CGEN_CPU_DESC, int); /* Instruction operand instances. @@ -1061,8 +1061,8 @@ typedef struct /* Return number of instructions. This includes any added at run-time. */ -extern int cgen_insn_count PARAMS ((CGEN_CPU_DESC)); -extern int cgen_macro_insn_count PARAMS ((CGEN_CPU_DESC)); +extern int cgen_insn_count (CGEN_CPU_DESC); +extern int cgen_macro_insn_count (CGEN_CPU_DESC); /* 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. Space for the expansion is obtained with malloc. It is up to the caller to free it. */ - const char * (* fn) PARAMS ((const struct cgen_minsn_expansion *, - const char *, const char **, int *, - CGEN_OPERAND **)); + const char * (* fn) + (const struct cgen_minsn_expansion *, + const char *, const char **, int *, + CGEN_OPERAND **); #define CGEN_MIEXPN_FN(ex) ((ex)->fn) /* Instruction(s) the macro expands to. @@ -1146,15 +1147,15 @@ typedef struct cgen_minsn_expansion { may contain further macro invocations. */ extern const char * cgen_expand_macro_insn - PARAMS ((CGEN_CPU_DESC, const struct cgen_minsn_expansion *, - const char *, const char **, int *, CGEN_OPERAND **)); + (CGEN_CPU_DESC, const struct cgen_minsn_expansion *, + const char *, const char **, int *, CGEN_OPERAND **); /* 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 examples like the first letter or a function of the entire mnemonic). */ 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_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). */ 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 */ #define CGEN_DIS_LOOKUP_INSN(cd, buf, value) cgen_dis_lookup_insn ((cd), (buf), (value)) #define CGEN_DIS_NEXT_INSN(insn) ((insn)->next) @@ -1246,25 +1247,24 @@ typedef struct cgen_cpu_desc int int_insn_p; /* 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. */ cgen_parse_operand_fn * parse_operand_fn; /* Parse/insert/extract/print cover fns for operands. */ const char * (*parse_operand) - PARAMS ((CGEN_CPU_DESC, int opindex_, const char **, - CGEN_FIELDS *fields_)); + (CGEN_CPU_DESC, int opindex_, const char **, CGEN_FIELDS *fields_); #ifdef __BFD_H_SEEN__ const char * (*insert_operand) - PARAMS ((CGEN_CPU_DESC, int opindex_, CGEN_FIELDS *fields_, - CGEN_INSN_BYTES_PTR, bfd_vma pc_)); + (CGEN_CPU_DESC, int opindex_, CGEN_FIELDS *fields_, + CGEN_INSN_BYTES_PTR, bfd_vma pc_); int (*extract_operand) - PARAMS ((CGEN_CPU_DESC, int opindex_, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, - CGEN_FIELDS *fields_, bfd_vma pc_)); + (CGEN_CPU_DESC, int opindex_, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, + CGEN_FIELDS *fields_, bfd_vma pc_); void (*print_operand) - PARAMS ((CGEN_CPU_DESC, int opindex_, PTR info_, CGEN_FIELDS * fields_, - void const *attrs_, bfd_vma pc_, int length_)); + (CGEN_CPU_DESC, int opindex_, void * info_, CGEN_FIELDS * fields_, + void const *attrs_, bfd_vma pc_, int length_); #else const char * (*insert_operand) (); int (*extract_operand) (); @@ -1280,19 +1280,19 @@ typedef struct cgen_cpu_desc #define CGEN_CPU_SIZEOF_FIELDS(cd) ((cd)->sizeof_fields) /* 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) /* CGEN_FIELDS accessors. */ 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) - 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__ 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) - PARAMS ((CGEN_CPU_DESC, int opindex_, CGEN_FIELDS *fields_, bfd_vma value_)); + (CGEN_CPU_DESC, int opindex_, CGEN_FIELDS *fields_, bfd_vma value_); #else long (*get_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]) /* 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. */ - unsigned int (* asm_hash) PARAMS ((const char *)); + unsigned int (* asm_hash) (const char *); /* Number of entries in assembler hash table. */ unsigned int asm_hash_size; /* 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. */ - 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. */ 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. */ -extern CGEN_CPU_DESC CGEN_SYM (cpu_open_1) PARAMS ((const char *mach_name_, - enum cgen_endian endian_)); +extern CGEN_CPU_DESC CGEN_SYM (cpu_open_1) + (const char *mach_name_, enum cgen_endian endian_); /* 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. 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. 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. 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. These must be called immediately after cpu_open. */ -extern void CGEN_SYM (init_asm) PARAMS ((CGEN_CPU_DESC)); -extern void CGEN_SYM (init_dis) PARAMS ((CGEN_CPU_DESC)); +extern void CGEN_SYM (init_asm) (CGEN_CPU_DESC); +extern void CGEN_SYM (init_dis) (CGEN_CPU_DESC); /* 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. */ extern const CGEN_INSN * CGEN_SYM (assemble_insn) - PARAMS ((CGEN_CPU_DESC, const char *, CGEN_FIELDS *, - CGEN_INSN_BYTES_PTR, char **)); + (CGEN_CPU_DESC, const char *, CGEN_FIELDS *, + CGEN_INSN_BYTES_PTR, char **); 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. */ extern const CGEN_INSN * cgen_lookup_insn - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN * insn_, - CGEN_INSN_INT int_value_, unsigned char *bytes_value_, - int length_, CGEN_FIELDS *fields_, int alias_p_)); + (CGEN_CPU_DESC, const CGEN_INSN * insn_, + CGEN_INSN_INT int_value_, unsigned char *bytes_value_, + int length_, CGEN_FIELDS *fields_, int alias_p_); extern void cgen_get_insn_operands - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN * insn_, - const CGEN_FIELDS *fields_, int *indices_)); + (CGEN_CPU_DESC, const CGEN_INSN * insn_, + const CGEN_FIELDS *fields_, int *indices_); extern const CGEN_INSN * cgen_lookup_get_insn_operands - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *insn_, - CGEN_INSN_INT int_value_, unsigned char *bytes_value_, - int length_, int *indices_, CGEN_FIELDS *fields_)); + (CGEN_CPU_DESC, const CGEN_INSN *insn_, + CGEN_INSN_INT int_value_, unsigned char *bytes_value_, + int length_, int *indices_, CGEN_FIELDS *fields_); /* Cover fns to bfd_get/set. */ 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 - 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. ??? For future concerns, including adding instructions to the assembler/ disassembler at run-time. */ -extern const char * cgen_read_cpu_file - PARAMS ((CGEN_CPU_DESC, const char * filename_)); +extern const char * cgen_read_cpu_file (CGEN_CPU_DESC, const char * filename_); /* 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. */ -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 ? */ -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 */ diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index be2f8a0869..08fcc35c83 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,99 @@ +2003-08-06 Michael Meissner + + * 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 * po/fr.po: Updated French translation. diff --git a/opcodes/cgen-asm.c b/opcodes/cgen-asm.c index c71c70de08..7231e2d7ae 100644 --- a/opcodes/cgen-asm.c +++ b/opcodes/cgen-asm.c @@ -28,16 +28,14 @@ #include "opcode/cgen.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_list PARAMS ((CGEN_CPU_DESC, const CGEN_INSN_LIST *, CGEN_INSN_LIST **, CGEN_INSN_LIST *)); -static void build_asm_hash_table PARAMS ((CGEN_CPU_DESC)); +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 (CGEN_CPU_DESC, const CGEN_INSN_LIST *, CGEN_INSN_LIST **, CGEN_INSN_LIST *); +static void build_asm_hash_table (CGEN_CPU_DESC); /* Set the cgen_parse_operand_fn callback. */ void -cgen_set_parse_operand_fn (cd, fn) - CGEN_CPU_DESC cd; - cgen_parse_operand_fn fn; +cgen_set_parse_operand_fn (CGEN_CPU_DESC cd, cgen_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. */ void -cgen_init_parse_operand (cd) - CGEN_CPU_DESC cd; +cgen_init_parse_operand (CGEN_CPU_DESC cd) { /* This tells the callback to re-initialize. */ (void) (* cd->parse_operand_fn) @@ -66,13 +63,12 @@ cgen_init_parse_operand (cd) list and we want earlier ones to be prefered. */ static CGEN_INSN_LIST * -hash_insn_array (cd, insns, count, entsize, htable, hentbuf) - CGEN_CPU_DESC cd; - const CGEN_INSN *insns; - int count; - int entsize ATTRIBUTE_UNUSED; - CGEN_INSN_LIST **htable; - CGEN_INSN_LIST *hentbuf; +hash_insn_array (CGEN_CPU_DESC cd, + const CGEN_INSN *insns, + int count, + int entsize ATTRIBUTE_UNUSED, + CGEN_INSN_LIST **htable, + CGEN_INSN_LIST *hentbuf) { int i; @@ -97,11 +93,10 @@ hash_insn_array (cd, insns, count, entsize, htable, hentbuf) in a list. */ static CGEN_INSN_LIST * -hash_insn_list (cd, insns, htable, hentbuf) - CGEN_CPU_DESC cd; - const CGEN_INSN_LIST *insns; - CGEN_INSN_LIST **htable; - CGEN_INSN_LIST *hentbuf; +hash_insn_list (CGEN_CPU_DESC cd, + const CGEN_INSN_LIST *insns, + CGEN_INSN_LIST **htable, + CGEN_INSN_LIST *hentbuf) { const CGEN_INSN_LIST *ilist; @@ -123,8 +118,7 @@ hash_insn_list (cd, insns, htable, hentbuf) /* Build the assembler instruction hash table. */ static void -build_asm_hash_table (cd) - CGEN_CPU_DESC cd; +build_asm_hash_table (CGEN_CPU_DESC cd) { int count = cgen_insn_count (cd) + cgen_macro_insn_count (cd); 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. */ CGEN_INSN_LIST * -cgen_asm_lookup_insn (cd, insn) - CGEN_CPU_DESC cd; - const char *insn; +cgen_asm_lookup_insn (CGEN_CPU_DESC cd, const char *insn) { unsigned int hash; @@ -201,11 +193,10 @@ cgen_asm_lookup_insn (cd, insn) recording something in the keyword table]. */ const char * -cgen_parse_keyword (cd, strp, keyword_table, valuep) - CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; - const char **strp; - CGEN_KEYWORD *keyword_table; - long *valuep; +cgen_parse_keyword (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, + const char **strp, + CGEN_KEYWORD *keyword_table, + long *valuep) { const CGEN_KEYWORD_ENTRY *ke; char buf[256]; @@ -262,11 +253,10 @@ cgen_parse_keyword (cd, strp, keyword_table, valuep) cgen_parse_address. */ const char * -cgen_parse_signed_integer (cd, strp, opindex, valuep) - CGEN_CPU_DESC cd; - const char **strp; - int opindex; - long *valuep; +cgen_parse_signed_integer (CGEN_CPU_DESC cd, + const char **strp, + int opindex, + long *valuep) { bfd_vma value; enum cgen_parse_operand_result result; @@ -287,11 +277,10 @@ cgen_parse_signed_integer (cd, strp, opindex, valuep) cgen_parse_address. */ const char * -cgen_parse_unsigned_integer (cd, strp, opindex, valuep) - CGEN_CPU_DESC cd; - const char **strp; - int opindex; - unsigned long *valuep; +cgen_parse_unsigned_integer (CGEN_CPU_DESC cd, + const char **strp, + int opindex, + unsigned long *valuep) { bfd_vma value; enum cgen_parse_operand_result result; @@ -309,13 +298,12 @@ cgen_parse_unsigned_integer (cd, strp, opindex, valuep) /* Address parser. */ const char * -cgen_parse_address (cd, strp, opindex, opinfo, resultp, valuep) - CGEN_CPU_DESC cd; - const char **strp; - int opindex; - int opinfo; - enum cgen_parse_operand_result *resultp; - bfd_vma *valuep; +cgen_parse_address (CGEN_CPU_DESC cd, + const char **strp, + int opindex, + int opinfo, + enum cgen_parse_operand_result *resultp, + bfd_vma *valuep) { bfd_vma value; enum cgen_parse_operand_result result_type; @@ -337,8 +325,7 @@ cgen_parse_address (cd, strp, opindex, opinfo, resultp, valuep) /* Signed integer validation routine. */ const char * -cgen_validate_signed_integer (value, min, max) - long value, min, max; +cgen_validate_signed_integer (long value, long min, long 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). */ const char * -cgen_validate_unsigned_integer (value, min, max) - unsigned long value, min, max; +cgen_validate_unsigned_integer (unsigned long value, + unsigned long min, + unsigned long max) { if (value < min || value > max) { diff --git a/opcodes/cgen-asm.in b/opcodes/cgen-asm.in index 1ea076809b..420f640ec3 100644 --- a/opcodes/cgen-asm.in +++ b/opcodes/cgen-asm.in @@ -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)) 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. */ @@ -60,8 +60,7 @@ static const char * parse_insn_normal Returns NULL for success, an error message for failure. */ char * -@arch@_cgen_build_insn_regex (insn) - CGEN_INSN *insn; +@arch@_cgen_build_insn_regex (CGEN_INSN *insn) { CGEN_OPCODE *opc = (CGEN_OPCODE *) CGEN_INSN_OPCODE (insn); const char *mnem = CGEN_INSN_MNEMONIC (insn); @@ -184,11 +183,10 @@ char * Returns NULL for success, an error message for failure. */ static const char * -parse_insn_normal (cd, insn, strp, fields) - CGEN_CPU_DESC cd; - const CGEN_INSN *insn; - const char **strp; - CGEN_FIELDS *fields; +parse_insn_normal (CGEN_CPU_DESC cd, + const CGEN_INSN *insn, + const char **strp, + CGEN_FIELDS *fields) { /* ??? Runtime added insns not handled yet. */ 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. */ const CGEN_INSN * -@arch@_cgen_assemble_insn (cd, str, fields, buf, errmsg) - CGEN_CPU_DESC cd; - const char *str; - CGEN_FIELDS *fields; - CGEN_INSN_BYTES_PTR buf; - char **errmsg; +@arch@_cgen_assemble_insn (CGEN_CPU_DESC cd, + const char *str, + CGEN_FIELDS *fields, + CGEN_INSN_BYTES_PTR buf, + char **errmsg) { const char *start; CGEN_INSN_LIST *ilist; @@ -435,9 +432,7 @@ const CGEN_INSN * FIXME: Not currently used. */ void -@arch@_cgen_asm_hash_keywords (cd, opvals) - CGEN_CPU_DESC cd; - CGEN_KEYWORD *opvals; +@arch@_cgen_asm_hash_keywords (CGEN_CPU_DESC cd, CGEN_KEYWORD *opvals) { CGEN_KEYWORD_SEARCH search = cgen_keyword_search_init (opvals, NULL); const CGEN_KEYWORD_ENTRY * ke; diff --git a/opcodes/cgen-dis.c b/opcodes/cgen-dis.c index 881ee1470f..ca621dec2d 100644 --- a/opcodes/cgen-dis.c +++ b/opcodes/cgen-dis.c @@ -27,19 +27,18 @@ #include "symcat.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_list PARAMS ((CGEN_CPU_DESC, const CGEN_INSN_LIST *, CGEN_INSN_LIST **, CGEN_INSN_LIST *)); -static void build_dis_hash_table PARAMS ((CGEN_CPU_DESC)); -static int count_decodable_bits PARAMS ((const CGEN_INSN *)); -static void add_insn_to_hash_chain PARAMS ((CGEN_INSN_LIST *, - const CGEN_INSN *, - CGEN_INSN_LIST **, - unsigned int)); +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 (CGEN_CPU_DESC, const CGEN_INSN_LIST *, CGEN_INSN_LIST **, CGEN_INSN_LIST *); +static void build_dis_hash_table (CGEN_CPU_DESC); +static int count_decodable_bits (const CGEN_INSN *); +static void add_insn_to_hash_chain (CGEN_INSN_LIST *, + const CGEN_INSN *, + CGEN_INSN_LIST **, + unsigned int); /* Return the number of decodable bits in this insn. */ static int -count_decodable_bits (insn) - const CGEN_INSN *insn; +count_decodable_bits (const CGEN_INSN *insn) { unsigned mask = CGEN_INSN_BASE_MASK (insn); int bits = 0; @@ -54,11 +53,10 @@ count_decodable_bits (insn) /* Add an instruction to the hash chain. */ static void -add_insn_to_hash_chain (hentbuf, insn, htable, hash) - CGEN_INSN_LIST *hentbuf; - const CGEN_INSN *insn; - CGEN_INSN_LIST **htable; - unsigned int hash; +add_insn_to_hash_chain (CGEN_INSN_LIST *hentbuf, + const CGEN_INSN *insn, + CGEN_INSN_LIST **htable, + unsigned int hash) { CGEN_INSN_LIST *current_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. */ static CGEN_INSN_LIST * -hash_insn_array (cd, insns, count, entsize, htable, hentbuf) - CGEN_CPU_DESC cd; - const CGEN_INSN * insns; - int count; - int entsize ATTRIBUTE_UNUSED; - CGEN_INSN_LIST ** htable; - CGEN_INSN_LIST * hentbuf; +hash_insn_array (CGEN_CPU_DESC cd, + const CGEN_INSN * insns, + int count, + int entsize ATTRIBUTE_UNUSED, + CGEN_INSN_LIST ** htable, + CGEN_INSN_LIST * hentbuf) { int big_p = CGEN_CPU_ENDIAN (cd) == CGEN_ENDIAN_BIG; int i; @@ -141,11 +138,10 @@ hash_insn_array (cd, insns, count, entsize, htable, hentbuf) in a list. */ static CGEN_INSN_LIST * -hash_insn_list (cd, insns, htable, hentbuf) - CGEN_CPU_DESC cd; - const CGEN_INSN_LIST *insns; - CGEN_INSN_LIST **htable; - CGEN_INSN_LIST *hentbuf; +hash_insn_list (CGEN_CPU_DESC cd, + const CGEN_INSN_LIST *insns, + CGEN_INSN_LIST **htable, + CGEN_INSN_LIST *hentbuf) { int big_p = CGEN_CPU_ENDIAN (cd) == CGEN_ENDIAN_BIG; const CGEN_INSN_LIST *ilist; @@ -177,8 +173,7 @@ hash_insn_list (cd, insns, htable, hentbuf) /* Build the disassembler instruction hash table. */ static void -build_dis_hash_table (cd) - CGEN_CPU_DESC cd; +build_dis_hash_table (CGEN_CPU_DESC cd) { int count = cgen_insn_count (cd) + cgen_macro_insn_count (cd); 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. */ CGEN_INSN_LIST * -cgen_dis_lookup_insn (cd, buf, value) - CGEN_CPU_DESC cd; - const char * buf; - CGEN_INSN_INT value; +cgen_dis_lookup_insn (CGEN_CPU_DESC cd, const char * buf, CGEN_INSN_INT value) { unsigned int hash; diff --git a/opcodes/cgen-dis.in b/opcodes/cgen-dis.in index 9203b71d02..1a3c0fa59d 100644 --- a/opcodes/cgen-dis.in +++ b/opcodes/cgen-dis.in @@ -41,34 +41,32 @@ along with this program; if not, write to the Free Software Foundation, Inc., #define UNKNOWN_INSN_MSG _("*unknown*") 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 - 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 - PARAMS ((CGEN_CPU_DESC, PTR, CGEN_KEYWORD *, long, unsigned int)); + (CGEN_CPU_DESC, void *, CGEN_KEYWORD *, long, unsigned int); static void print_insn_normal - PARAMS ((CGEN_CPU_DESC, PTR, const CGEN_INSN *, CGEN_FIELDS *, - bfd_vma, int)); + (CGEN_CPU_DESC, void *, const CGEN_INSN *, CGEN_FIELDS *, bfd_vma, int); 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 - PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *)); + (CGEN_CPU_DESC, bfd_vma, disassemble_info *); static int read_insn - PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *, char *, int, - CGEN_EXTRACT_INFO *, unsigned long *)); + (CGEN_CPU_DESC, bfd_vma, disassemble_info *, char *, int, CGEN_EXTRACT_INFO *, + unsigned long *); /* -- disassembler routines inserted here */ /* Default print handler. */ static void -print_normal (cd, dis_info, value, attrs, pc, length) - CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; - PTR dis_info; - long value; - unsigned int attrs; - bfd_vma pc ATTRIBUTE_UNUSED; - int length ATTRIBUTE_UNUSED; +print_normal (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, + void *dis_info, + long value, + unsigned int attrs, + bfd_vma pc ATTRIBUTE_UNUSED, + int length ATTRIBUTE_UNUSED) { disassemble_info *info = (disassemble_info *) dis_info; @@ -88,13 +86,12 @@ print_normal (cd, dis_info, value, attrs, pc, length) /* Default address handler. */ static void -print_address (cd, dis_info, value, attrs, pc, length) - CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; - PTR dis_info; - bfd_vma value; - unsigned int attrs; - bfd_vma pc ATTRIBUTE_UNUSED; - int length ATTRIBUTE_UNUSED; +print_address (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, + void *dis_info, + bfd_vma value, + unsigned int attrs, + bfd_vma pc ATTRIBUTE_UNUSED, + int length ATTRIBUTE_UNUSED) { disassemble_info *info = (disassemble_info *) dis_info; @@ -118,12 +115,11 @@ print_address (cd, dis_info, value, attrs, pc, length) /* Keyword print handler. */ static void -print_keyword (cd, dis_info, keyword_table, value, attrs) - CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; - PTR dis_info; - CGEN_KEYWORD *keyword_table; - long value; - unsigned int attrs ATTRIBUTE_UNUSED; +print_keyword (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, + void *dis_info, + CGEN_KEYWORD *keyword_table, + long value, + unsigned int attrs ATTRIBUTE_UNUSED) { disassemble_info *info = (disassemble_info *) dis_info; const CGEN_KEYWORD_ENTRY *ke; @@ -137,17 +133,16 @@ print_keyword (cd, dis_info, keyword_table, value, attrs) /* 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. */ static void -print_insn_normal (cd, dis_info, insn, fields, pc, length) - CGEN_CPU_DESC cd; - PTR dis_info; - const CGEN_INSN *insn; - CGEN_FIELDS *fields; - bfd_vma pc; - int length; +print_insn_normal (CGEN_CPU_DESC cd, + void *dis_info, + const CGEN_INSN *insn, + CGEN_FIELDS *fields, + bfd_vma pc, + int length) { const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); 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. */ static int -read_insn (cd, pc, info, buf, buflen, ex_info, insn_value) - CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; - bfd_vma pc; - disassemble_info *info; - char *buf; - int buflen; - CGEN_EXTRACT_INFO *ex_info; - unsigned long *insn_value; +read_insn (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, + bfd_vma pc, + disassemble_info *info, + char *buf, + int buflen, + CGEN_EXTRACT_INFO *ex_info, + unsigned long *insn_value) { int status = (*info->read_memory_func) (pc, buf, buflen, info); if (status != 0) @@ -210,12 +204,11 @@ read_insn (cd, pc, info, buf, buflen, ex_info, insn_value) been called). */ static int -print_insn (cd, pc, info, buf, buflen) - CGEN_CPU_DESC cd; - bfd_vma pc; - disassemble_info *info; - char *buf; - unsigned int buflen; +print_insn (CGEN_CPU_DESC cd, + bfd_vma pc, + disassemble_info *info, + char *buf, + unsigned int buflen) { CGEN_INSN_INT insn_value; const CGEN_INSN_LIST *insn_list; @@ -320,10 +313,7 @@ print_insn (cd, pc, info, buf, buflen) #endif static int -default_print_insn (cd, pc, info) - CGEN_CPU_DESC cd; - bfd_vma pc; - disassemble_info *info; +default_print_insn (CGEN_CPU_DESC cd, bfd_vma pc, disassemble_info *info) { char buf[CGEN_MAX_INSN_SIZE]; int buflen; @@ -362,9 +352,7 @@ typedef struct cpu_desc_list { } cpu_desc_list; int -print_insn_@arch@ (pc, info) - bfd_vma pc; - disassemble_info *info; +print_insn_@arch@ (bfd_vma pc, disassemble_info *info) { static cpu_desc_list *cd_list = 0; cpu_desc_list *cl = 0; diff --git a/opcodes/cgen-ibld.in b/opcodes/cgen-ibld.in index d2bfd02a91..5cf57848c5 100644 --- a/opcodes/cgen-ibld.in +++ b/opcodes/cgen-ibld.in @@ -44,30 +44,29 @@ along with this program; if not, write to the Free Software Foundation, Inc., #define FLD(f) (fields->f) static const char * insert_normal - PARAMS ((CGEN_CPU_DESC, long, unsigned int, unsigned int, unsigned int, - unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR)); + (CGEN_CPU_DESC, long, unsigned int, unsigned int, unsigned int, + unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR); static const char * insert_insn_normal - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, - CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma)); + (CGEN_CPU_DESC, const CGEN_INSN *, + CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma); static int extract_normal - PARAMS ((CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, - unsigned int, unsigned int, unsigned int, unsigned int, - unsigned int, unsigned int, bfd_vma, long *)); + (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, + unsigned int, unsigned int, unsigned int, unsigned int, + unsigned int, unsigned int, bfd_vma, long *); static int extract_insn_normal - PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, CGEN_EXTRACT_INFO *, - CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma)); + (CGEN_CPU_DESC, const CGEN_INSN *, CGEN_EXTRACT_INFO *, + CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma); #if CGEN_INT_INSN_P 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 #if ! CGEN_INT_INSN_P 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 - 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 - PARAMS ((CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, int, - unsigned char *, bfd_vma)); + (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, int, unsigned char *, bfd_vma); #endif /* Operand insertion. */ @@ -77,11 +76,10 @@ static CGEN_INLINE long extract_1 /* Subroutine of insert_normal. */ static CGEN_INLINE void -insert_1 (cd, value, start, length, word_length, bufp) - CGEN_CPU_DESC cd; - unsigned long value; - int start,length,word_length; - unsigned char *bufp; +insert_1 (CGEN_CPU_DESC cd, + unsigned long value, + int start,length,word_length, + unsigned char *bufp) { unsigned long x,mask; int shift; @@ -118,13 +116,15 @@ insert_1 (cd, value, start, length, word_length, bufp) necessary. */ static const char * -insert_normal (cd, value, attrs, word_offset, start, length, word_length, - total_length, buffer) - CGEN_CPU_DESC cd; - long value; - unsigned int attrs; - unsigned int word_offset, start, length, word_length, total_length; - CGEN_INSN_BYTES_PTR buffer; +insert_normal (CGEN_CPU_DESC cd, + long value, + unsigned int attrs, + unsigned int word_offset, + unsigned int start, + unsigned int length, + unsigned int word_length, + unsigned int total_length, + CGEN_INSN_BYTES_PTR buffer) { static char errbuf[100]; /* 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. */ static const char * -insert_insn_normal (cd, insn, fields, buffer, pc) - CGEN_CPU_DESC cd; - const CGEN_INSN * insn; - CGEN_FIELDS * fields; - CGEN_INSN_BYTES_PTR buffer; - bfd_vma pc; +insert_insn_normal (CGEN_CPU_DESC cd, + const CGEN_INSN * insn, + CGEN_FIELDS * fields, + CGEN_INSN_BYTES_PTR buffer, + bfd_vma pc) { const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); unsigned long value; @@ -288,12 +287,11 @@ insert_insn_normal (cd, insn, fields, buffer, pc) because it needs -desc.h for CGEN_INT_INSN_P. */ static void -put_insn_int_value (cd, buf, length, insn_length, value) - CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; - CGEN_INSN_BYTES_PTR buf; - int length; - int insn_length; - CGEN_INSN_INT value; +put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, + CGEN_INSN_BYTES_PTR buf, + int length, + int insn_length, + CGEN_INSN_INT value) { /* For architectures with insns smaller than the base-insn-bitsize, 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. */ static CGEN_INLINE int -fill_cache (cd, ex_info, offset, bytes, pc) - CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; - CGEN_EXTRACT_INFO *ex_info; - int offset, bytes; - bfd_vma pc; +fill_cache (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, + CGEN_EXTRACT_INFO *ex_info, + int offset, bytes, + bfd_vma pc) { /* It's doubtful that the middle part has already been fetched so we don't optimize that case. kiss. */ @@ -364,12 +361,13 @@ fill_cache (cd, ex_info, offset, bytes, pc) /* Subroutine of extract_normal. */ static CGEN_INLINE long -extract_1 (cd, ex_info, start, length, word_length, bufp, pc) - CGEN_CPU_DESC cd; - CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED; - int start,length,word_length; - unsigned char *bufp; - bfd_vma pc ATTRIBUTE_UNUSED; +extract_1 (CGEN_CPU_DESC cd, + CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED, + int start, + int length, + int word_length, + unsigned char *bufp, + bfd_vma pc ATTRIBUTE_UNUSED) { unsigned long x; int shift; @@ -408,23 +406,25 @@ extract_1 (cd, ex_info, start, length, word_length, bufp, pc) necessary. */ static int -extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length, - word_length, total_length, pc, valuep) - CGEN_CPU_DESC cd; +extract_normal (CGEN_CPU_DESC cd; #if ! CGEN_INT_INSN_P - CGEN_EXTRACT_INFO *ex_info; + CGEN_EXTRACT_INFO *ex_info, #else - CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED; + CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED, #endif - CGEN_INSN_INT insn_value; - unsigned int attrs; - unsigned int word_offset, start, length, word_length, total_length; + CGEN_INSN_INT insn_value, + unsigned int attrs, + unsigned int word_offset, + unsigned int start, + unsigned int length, + unsigned int word_length, + unsigned int total_length, #if ! CGEN_INT_INSN_P - bfd_vma pc; + bfd_vma pc, #else - bfd_vma pc ATTRIBUTE_UNUSED; + bfd_vma pc ATTRIBUTE_UNUSED, #endif - long *valuep; + long *valuep) { long value, mask; @@ -505,13 +505,12 @@ extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length, been called). */ static int -extract_insn_normal (cd, insn, ex_info, insn_value, fields, pc) - CGEN_CPU_DESC cd; - const CGEN_INSN *insn; - CGEN_EXTRACT_INFO *ex_info; - CGEN_INSN_INT insn_value; - CGEN_FIELDS *fields; - bfd_vma pc; +extract_insn_normal (CGEN_CPU_DESC cd, + const CGEN_INSN *insn, + CGEN_EXTRACT_INFO *ex_info, + CGEN_INSN_INT insn_value, + CGEN_FIELDS *fields, + bfd_vma pc) { const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); const CGEN_SYNTAX_CHAR_TYPE *syn; diff --git a/opcodes/cgen-opc.c b/opcodes/cgen-opc.c index 06544ca057..882b34898b 100644 --- a/opcodes/cgen-opc.c +++ b/opcodes/cgen-opc.c @@ -33,11 +33,11 @@ #endif 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 - PARAMS ((const CGEN_KEYWORD *, unsigned int)); + (const CGEN_KEYWORD *, unsigned int); static void build_keyword_hash_tables - PARAMS ((CGEN_KEYWORD *)); + (CGEN_KEYWORD *); /* Return number of hash table entries to use for N elements. */ #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. */ const CGEN_KEYWORD_ENTRY * -cgen_keyword_lookup_name (kt, name) - CGEN_KEYWORD *kt; - const char *name; +cgen_keyword_lookup_name (CGEN_KEYWORD *kt, const char *name) { const CGEN_KEYWORD_ENTRY *ke; 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. */ const CGEN_KEYWORD_ENTRY * -cgen_keyword_lookup_value (kt, value) - CGEN_KEYWORD *kt; - int value; +cgen_keyword_lookup_value (CGEN_KEYWORD *kt, int value) { const CGEN_KEYWORD_ENTRY *ke; @@ -111,9 +107,7 @@ cgen_keyword_lookup_value (kt, value) /* Add an entry to a keyword table. */ void -cgen_keyword_add (kt, ke) - CGEN_KEYWORD *kt; - CGEN_KEYWORD_ENTRY *ke; +cgen_keyword_add (CGEN_KEYWORD *kt, CGEN_KEYWORD_ENTRY *ke) { unsigned int hash; size_t i; @@ -159,9 +153,7 @@ cgen_keyword_add (kt, ke) It is passed to each call to cgen_keyword_search_next. */ CGEN_KEYWORD_SEARCH -cgen_keyword_search_init (kt, spec) - CGEN_KEYWORD *kt; - const char *spec; +cgen_keyword_search_init (CGEN_KEYWORD *kt, const char *spec) { 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. */ const CGEN_KEYWORD_ENTRY * -cgen_keyword_search_next (search) - CGEN_KEYWORD_SEARCH *search; +cgen_keyword_search_next (CGEN_KEYWORD_SEARCH *search) { /* Has search finished? */ 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. */ static unsigned int -hash_keyword_name (kt, name, case_sensitive_p) - const CGEN_KEYWORD *kt; - const char *name; - int case_sensitive_p; +hash_keyword_name (const CGEN_KEYWORD *kt, + const char *name, + int case_sensitive_p) { unsigned int hash; @@ -237,9 +227,7 @@ hash_keyword_name (kt, name, case_sensitive_p) /* Return first entry in hash chain for VALUE. */ static unsigned int -hash_keyword_value (kt, value) - const CGEN_KEYWORD *kt; - unsigned int value; +hash_keyword_value (const CGEN_KEYWORD *kt, unsigned int value) { 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. */ static void -build_keyword_hash_tables (kt) - CGEN_KEYWORD *kt; +build_keyword_hash_tables (CGEN_KEYWORD *kt) { int i; /* Use the number of compiled in entries as an estimate for the @@ -278,9 +265,7 @@ build_keyword_hash_tables (kt) mach/isa. */ const CGEN_HW_ENTRY * -cgen_hw_lookup_by_name (cd, name) - CGEN_CPU_DESC cd; - const char *name; +cgen_hw_lookup_by_name (CGEN_CPU_DESC cd, const char *name) { unsigned int i; 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. */ const CGEN_HW_ENTRY * -cgen_hw_lookup_by_num (cd, hwnum) - CGEN_CPU_DESC cd; - unsigned int hwnum; +cgen_hw_lookup_by_num (CGEN_CPU_DESC cd, unsigned int hwnum) { unsigned int i; const CGEN_HW_ENTRY **hw = cd->hw_table.entries; @@ -320,9 +303,7 @@ cgen_hw_lookup_by_num (cd, hwnum) mach/isa. */ const CGEN_OPERAND * -cgen_operand_lookup_by_name (cd, name) - CGEN_CPU_DESC cd; - const char *name; +cgen_operand_lookup_by_name (CGEN_CPU_DESC cd, const char *name) { unsigned int i; const CGEN_OPERAND **op = cd->operand_table.entries; @@ -341,9 +322,7 @@ cgen_operand_lookup_by_name (cd, name) mach/isa. */ const CGEN_OPERAND * -cgen_operand_lookup_by_num (cd, opnum) - CGEN_CPU_DESC cd; - int opnum; +cgen_operand_lookup_by_num (CGEN_CPU_DESC cd, int 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. */ int -cgen_insn_count (cd) - CGEN_CPU_DESC cd; +cgen_insn_count (CGEN_CPU_DESC cd) { int count = cd->insn_table.num_init_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. */ int -cgen_macro_insn_count (cd) - CGEN_CPU_DESC cd; +cgen_macro_insn_count (CGEN_CPU_DESC cd) { int count = cd->macro_insn_table.num_init_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. */ CGEN_INSN_INT -cgen_get_insn_value (cd, buf, length) - CGEN_CPU_DESC cd; - unsigned char *buf; - int length; +cgen_get_insn_value (CGEN_CPU_DESC cd, unsigned char *buf, int length) { int big_p = (cd->insn_endian == CGEN_ENDIAN_BIG); 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. */ void -cgen_put_insn_value (cd, buf, length, value) - CGEN_CPU_DESC cd; - unsigned char *buf; - int length; - CGEN_INSN_INT value; +cgen_put_insn_value (CGEN_CPU_DESC cd, + unsigned char *buf, + int length, + CGEN_INSN_INT value) { int big_p = (cd->insn_endian == CGEN_ENDIAN_BIG); 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. */ const CGEN_INSN * -cgen_lookup_insn (cd, insn, insn_int_value, insn_bytes_value, length, fields, - alias_p) - CGEN_CPU_DESC cd; - const CGEN_INSN *insn; - CGEN_INSN_INT insn_int_value; - /* ??? CGEN_INSN_BYTES would be a nice type name to use here. */ - unsigned char *insn_bytes_value; - int length; - CGEN_FIELDS *fields; - int alias_p; +cgen_lookup_insn (CGEN_CPU_DESC cd, + const CGEN_INSN *insn, + CGEN_INSN_INT insn_int_value, + /* ??? CGEN_INSN_BYTES would be a nice type name to use here. */ + unsigned char *insn_bytes_value, + int length, + CGEN_FIELDS *fields, + int alias_p) { unsigned char *buf; CGEN_INSN_INT base_insn; @@ -571,11 +542,10 @@ cgen_lookup_insn (cd, insn, insn_int_value, insn_bytes_value, length, fields, in. */ void -cgen_get_insn_operands (cd, insn, fields, indices) - CGEN_CPU_DESC cd; - const CGEN_INSN *insn; - const CGEN_FIELDS *fields; - int *indices; +cgen_get_insn_operands (CGEN_CPU_DESC cd, + const CGEN_INSN *insn, + const CGEN_FIELDS *fields, + int *indices) { const CGEN_OPINST *opinst; int i; @@ -603,16 +573,14 @@ cgen_get_insn_operands (cd, insn, fields, indices) recognized. */ const CGEN_INSN * -cgen_lookup_get_insn_operands (cd, insn, insn_int_value, insn_bytes_value, - length, indices, fields) - CGEN_CPU_DESC cd; - const CGEN_INSN *insn; - CGEN_INSN_INT insn_int_value; - /* ??? CGEN_INSN_BYTES would be a nice type name to use here. */ - unsigned char *insn_bytes_value; - int length; - int *indices; - CGEN_FIELDS *fields; +cgen_lookup_get_insn_operands (CGEN_CPU_DESC cd, + const CGEN_INSN *insn, + CGEN_INSN_INT insn_int_value, + /* ??? CGEN_INSN_BYTES would be a nice type name to use here. */ + unsigned char *insn_bytes_value, + int length, + int *indices, + CGEN_FIELDS *fields) { /* Pass non-zero for ALIAS_P only if INSN != NULL. 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. */ void -cgen_set_signed_overflow_ok (cd) - CGEN_CPU_DESC cd; +cgen_set_signed_overflow_ok (CGEN_CPU_DESC cd) { cd->signed_overflow_ok_p = 1; } /* Generate an error message if a signed field in an instruction overflows. */ void -cgen_clear_signed_overflow_ok (cd) - CGEN_CPU_DESC cd; +cgen_clear_signed_overflow_ok (CGEN_CPU_DESC cd) { cd->signed_overflow_ok_p = 0; } /* Will an error message be generated if a signed field in an instruction overflows ? */ unsigned int -cgen_signed_overflow_ok_p (cd) - CGEN_CPU_DESC cd; +cgen_signed_overflow_ok_p (CGEN_CPU_DESC cd) { return cd->signed_overflow_ok_p; }