forked from Imagelibrary/binutils-gdb
Convert cgen to C-90
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user