mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-09-09 23:32:21 +08:00
Convert cgen to C-90
This commit is contained in:
@ -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>
|
||||
|
||||
* po/fr.po: Updated French translation.
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 <prefix>-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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user