Back to index

cell-binutils  2.17cvs20070401
Defines | Functions | Variables
ip2k-opc.c File Reference
#include "sysdep.h"
#include "ansidecl.h"
#include "bfd.h"
#include "symcat.h"
#include "ip2k-desc.h"
#include "ip2k-opc.h"
#include "libiberty.h"
#include "safe-ctype.h"

Go to the source code of this file.

Defines

#define F(f)   & ip2k_cgen_ifld_table[IP2K_f]
#define A(a)   (1 << CGEN_INSN_a)
#define OPERAND(op)   IP2K_OPERAND_op
#define MNEM   CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
#define OP(field)   CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
#define F(f)   & ip2k_cgen_ifld_table[IP2K_f]
#define A(a)   (1 << CGEN_INSN_a)
#define OPERAND(op)   IP2K_OPERAND_op
#define MNEM   CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
#define OP(field)   CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
#define CGEN_ASM_HASH_P(insn)   1
#define CGEN_DIS_HASH_P(insn)   1

Functions

unsigned int ip2k_asm_hash (const char *insn)
int ip2k_cgen_insn_supported (CGEN_CPU_DESC cd, const CGEN_INSN *insn)
static int asm_hash_insn_p (const CGEN_INSN *)
static unsigned int asm_hash_insn (const char *)
static int dis_hash_insn_p (const CGEN_INSN *)
static unsigned int dis_hash_insn (const char *, CGEN_INSN_INT)
static int asm_hash_insn_p (insn) const
static int dis_hash_insn_p (CGEN_INSN *insn) const
static unsigned int asm_hash_insn (char *mnem) const
static unsigned int dis_hash_insn (buf, value) const
static void set_fields_bitsize (CGEN_FIELDS *fields, int size)
void ip2k_cgen_init_opcode_table (CGEN_CPU_DESC cd)

Variables

static const CGEN_IFMT ifmt_empty ATTRIBUTE_UNUSED
static const CGEN_OPCODE ip2k_cgen_insn_opcode_table [MAX_INSNS]
static const CGEN_IBASE ip2k_cgen_macro_insn_table []
static const CGEN_OPCODE ip2k_cgen_macro_insn_opcode_table []

Define Documentation

#define A (   a)    (1 << CGEN_INSN_a)

Definition at line 712 of file ip2k-opc.c.

#define A (   a)    (1 << CGEN_INSN_a)

Definition at line 712 of file ip2k-opc.c.

#define CGEN_ASM_HASH_P (   insn)    1

Definition at line 806 of file ip2k-opc.c.

#define CGEN_DIS_HASH_P (   insn)    1

Definition at line 810 of file ip2k-opc.c.

#define F (   f)    & ip2k_cgen_ifld_table[IP2K_f]

Definition at line 679 of file ip2k-opc.c.

#define F (   f)    & ip2k_cgen_ifld_table[IP2K_f]

Definition at line 679 of file ip2k-opc.c.

#define MNEM   CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */

Definition at line 719 of file ip2k-opc.c.

#define MNEM   CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */

Definition at line 719 of file ip2k-opc.c.

#define OP (   field)    CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))

Definition at line 720 of file ip2k-opc.c.

#define OP (   field)    CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))

Definition at line 720 of file ip2k-opc.c.

#define OPERAND (   op)    IP2K_OPERAND_op

Definition at line 717 of file ip2k-opc.c.

#define OPERAND (   op)    IP2K_OPERAND_op

Definition at line 717 of file ip2k-opc.c.


Function Documentation

static unsigned int asm_hash_insn ( const char *  ) [static]
static unsigned int asm_hash_insn ( char *  mnem) const [static]

Definition at line 857 of file ip2k-opc.c.

{
  return CGEN_ASM_HASH (mnem);
}
static int asm_hash_insn_p ( const CGEN_INSN *  ) [static]
static int asm_hash_insn_p ( insn  ) const [static]

Definition at line 817 of file ip2k-opc.c.

{
  return CGEN_ASM_HASH_P (insn);
}
static unsigned int dis_hash_insn ( const char *  ,
CGEN_INSN_INT   
) [static]
static unsigned int dis_hash_insn ( buf  ,
value   
) const [static]

Definition at line 867 of file ip2k-opc.c.

{
  return CGEN_DIS_HASH (buf, value);
}
static int dis_hash_insn_p ( const CGEN_INSN *  ) [static]
static int dis_hash_insn_p ( CGEN_INSN *  insn) const [static]

Definition at line 824 of file ip2k-opc.c.

{
  /* If building the hash table and the NO-DIS attribute is present,
     ignore.  */
  if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_NO_DIS))
    return 0;
  return CGEN_DIS_HASH_P (insn);
}
unsigned int ip2k_asm_hash ( const char *  insn)

Definition at line 39 of file ip2k-opc.c.

{
  unsigned int hash;
  const char* m = insn;

  for (hash = 0; *m && ! ISSPACE (*m); m++)
    hash = (hash * 23) ^ (0x1F & TOLOWER (*m));

  /* printf ("%s %d\n", insn, (hash % CGEN_ASM_HASH_SIZE)); */

  return hash % CGEN_ASM_HASH_SIZE;
}

Definition at line 886 of file ip2k-opc.c.

{
  int i;
  int num_macros = (sizeof (ip2k_cgen_macro_insn_table) /
                  sizeof (ip2k_cgen_macro_insn_table[0]));
  const CGEN_IBASE *ib = & ip2k_cgen_macro_insn_table[0];
  const CGEN_OPCODE *oc = & ip2k_cgen_macro_insn_opcode_table[0];
  CGEN_INSN *insns = xmalloc (num_macros * sizeof (CGEN_INSN));

  memset (insns, 0, num_macros * sizeof (CGEN_INSN));
  for (i = 0; i < num_macros; ++i)
    {
      insns[i].base = &ib[i];
      insns[i].opcode = &oc[i];
      ip2k_cgen_build_insn_regex (& insns[i]);
    }
  cd->macro_insn_table.init_entries = insns;
  cd->macro_insn_table.entry_size = sizeof (CGEN_IBASE);
  cd->macro_insn_table.num_init_entries = num_macros;

  oc = & ip2k_cgen_insn_opcode_table[0];
  insns = (CGEN_INSN *) cd->insn_table.init_entries;
  for (i = 0; i < MAX_INSNS; ++i)
    {
      insns[i].opcode = &oc[i];
      ip2k_cgen_build_insn_regex (& insns[i]);
    }

  cd->sizeof_fields = sizeof (CGEN_FIELDS);
  cd->set_fields_bitsize = set_fields_bitsize;

  cd->asm_hash_p = asm_hash_insn_p;
  cd->asm_hash = asm_hash_insn;
  cd->asm_hash_size = CGEN_ASM_HASH_SIZE;

  cd->dis_hash_p = dis_hash_insn_p;
  cd->dis_hash = dis_hash_insn;
  cd->dis_hash_size = CGEN_DIS_HASH_SIZE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ip2k_cgen_insn_supported ( CGEN_CPU_DESC  cd,
const CGEN_INSN *  insn 
)

Definition at line 56 of file ip2k-opc.c.

{
  int machs = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_MACH);

  /* No mach attribute?  Assume it's supported for all machs.  */
  if (machs == 0)
    return 1;
  
  return (machs & cd->machs) != 0;
}

Here is the caller graph for this function:

static void set_fields_bitsize ( CGEN_FIELDS *  fields,
int  size 
) [static]

Definition at line 877 of file ip2k-opc.c.

{
  CGEN_FIELDS_BITSIZE (fields) = size;
}

Here is the caller graph for this function:


Variable Documentation

const CGEN_IFMT ifmt_skipb ATTRIBUTE_UNUSED [static]
Initial value:
 {
  0, 0, 0x0, { { 0 } }
}

Definition at line 84 of file ip2k-opc.c.

Definition at line 145 of file ip2k-opc.c.

Definition at line 760 of file ip2k-opc.c.

Definition at line 724 of file ip2k-opc.c.