Back to index

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

Go to the source code of this file.

Defines

#define OPTION_MASK
#define F(f)   & mep_cgen_ifld_table[MEP_f]
#define A(a)   (1 << CGEN_INSN_a)
#define OPERAND(op)   MEP_OPERAND_op
#define MNEM   CGEN_SYNTAX_MNEMONIC /* syntax value for mnemonic */
#define OP(field)   CGEN_SYNTAX_MAKE_FIELD (OPERAND (field))
#define F(f)   & mep_cgen_ifld_table[MEP_f]
#define A(a)   (1 << CGEN_INSN_a)
#define OPERAND(op)   MEP_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
#define CGEN_ASM_HASH_SIZE   127
#define CGEN_ASM_HASH(mnem)   (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)

Functions

void init_mep_all_core_isas_mask (void)
void init_mep_all_cop_isas_mask (void)
int mep_insn_supported_by_isa (const CGEN_INSN *insn, CGEN_ATTR_VALUE_BITSET_TYPE *isa_mask)
static int check_configured_mach (int machs)
int mep_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 mep_cgen_init_opcode_table (CGEN_CPU_DESC cd)

Variables

CGEN_ATTR_VALUE_BITSET_TYPE mep_all_core_isas_mask = {0, 0}
CGEN_ATTR_VALUE_BITSET_TYPE mep_all_cop_isas_mask = {0, 0}
mep_config_map_struct mep_config_map []
int mep_config_index = 0
static const CGEN_IFMT ifmt_empty ATTRIBUTE_UNUSED
static const CGEN_OPCODE mep_cgen_insn_opcode_table [MAX_INSNS]
static const CGEN_IBASE mep_cgen_macro_insn_table []
static const CGEN_OPCODE mep_cgen_macro_insn_opcode_table []

Define Documentation

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

Definition at line 1985 of file mep-opc.c.

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

Definition at line 1985 of file mep-opc.c.

#define CGEN_ASM_HASH (   mnem)    (*(unsigned char *) (mnem) % CGEN_ASM_HASH_SIZE)

Definition at line 2187 of file mep-opc.c.

#define CGEN_ASM_HASH_P (   insn)    1

Definition at line 2156 of file mep-opc.c.

#define CGEN_ASM_HASH_SIZE   127

Definition at line 2185 of file mep-opc.c.

#define CGEN_DIS_HASH_P (   insn)    1

Definition at line 2160 of file mep-opc.c.

#define F (   f)    & mep_cgen_ifld_table[MEP_f]

Definition at line 1924 of file mep-opc.c.

#define F (   f)    & mep_cgen_ifld_table[MEP_f]

Definition at line 1924 of file mep-opc.c.

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

Definition at line 1992 of file mep-opc.c.

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

Definition at line 1992 of file mep-opc.c.

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

Definition at line 1993 of file mep-opc.c.

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

Definition at line 1993 of file mep-opc.c.

#define OPERAND (   op)    MEP_OPERAND_op

Definition at line 1990 of file mep-opc.c.

#define OPERAND (   op)    MEP_OPERAND_op

Definition at line 1990 of file mep-opc.c.

#define OPTION_MASK

Function Documentation

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

Definition at line 2207 of file mep-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 2167 of file mep-opc.c.

{
  return CGEN_ASM_HASH_P (insn);
}
static int check_configured_mach ( int  machs) [static]

Definition at line 118 of file mep-opc.c.

{
  /* All base insns are supported.  */
  int mach = 1 << MACH_BASE;
  switch (MEP_CPU)
    {
    case EF_MEP_CPU_C2:
    case EF_MEP_CPU_C3:
      mach |= (1 << MACH_MEP);
      break;
    case EF_MEP_CPU_H1:
      mach |= (1 << MACH_H1);
      break;
    default:
      break;
    }
  return machs & mach;
}

Here is the caller graph for this function:

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 2217 of file mep-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 2174 of file mep-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);
}
void init_mep_all_cop_isas_mask ( void  )
void init_mep_all_core_isas_mask ( void  )

Definition at line 40 of file mep-opc.c.

Here is the call graph for this function:

Definition at line 2236 of file mep-opc.c.

{
  int i;
  int num_macros = (sizeof (mep_cgen_macro_insn_table) /
                  sizeof (mep_cgen_macro_insn_table[0]));
  const CGEN_IBASE *ib = & mep_cgen_macro_insn_table[0];
  const CGEN_OPCODE *oc = & mep_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];
      mep_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 = & mep_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];
      mep_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 mep_cgen_insn_supported ( CGEN_CPU_DESC  cd,
const CGEN_INSN *  insn 
)

Definition at line 138 of file mep-opc.c.

{
  int iconfig = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_CONFIG);
  int machs = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_MACH);
  CGEN_BITSET isas = CGEN_INSN_BITSET_ATTR_VALUE (insn, CGEN_INSN_ISA);
  int ok1;
  int ok2;
  int ok3;

  /* If the insn has an option bit set that we don't want,
     reject it.  */
  if (CGEN_INSN_ATTRS (insn)->bool & OPTION_MASK & ~MEP_OMASK)
    return 0;

  /* If attributes are absent, assume no restriction. */
  if (machs == 0)
    machs = ~0;

  ok1 = ((machs & cd->machs) && cgen_bitset_intersect_p (& isas, cd->isas));
  /* If the insn is config-specific, make sure it matches.  */
  ok2 =  (iconfig == 0 || iconfig == MEP_CONFIG);
  /* Make sure the insn is supported by the configured mach  */
  ok3 = check_configured_mach (machs);

  return (ok1 && ok2 && ok3);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int mep_insn_supported_by_isa ( const CGEN_INSN *  insn,
CGEN_ATTR_VALUE_BITSET_TYPE isa_mask 
)

Definition at line 69 of file mep-opc.c.

{
  CGEN_BITSET insn_isas = CGEN_INSN_BITSET_ATTR_VALUE (insn, CGEN_INSN_ISA);
  return cgen_bitset_intersect_p (& insn_isas, isa_mask);
}

Here is the call graph for this function:

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

Definition at line 2227 of file mep-opc.c.

{
  CGEN_FIELDS_BITSIZE (fields) = size;
}

Here is the caller graph for this function:


Variable Documentation

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

Definition at line 179 of file mep-opc.c.

Definition at line 52 of file mep-opc.c.

Definition at line 37 of file mep-opc.c.

Definition at line 460 of file mep-opc.c.

Definition at line 2068 of file mep-opc.c.

Definition at line 1997 of file mep-opc.c.

Definition at line 115 of file mep-opc.c.

Initial value:
{
  
  
  { "", 0, EF_MEP_CPU_C2, 1, 0, {1,"\x0"}, {1,"\x0"}, {1,"\x0"}, {1,"\x0"}, {1,"\x0"}, {1,"\x80"}, OPTION_MASK },
  { "simple", CONFIG_SIMPLE, EF_MEP_CPU_C2, 1, 0, { 1, "\x0" }, { 1, "\x0" }, { 1, "\x0" }, { 1, "\x0" }, { 1, "\x0" }, { 1, "\xc0" },
         0 },
  { "fmax", CONFIG_FMAX, EF_MEP_CPU_C2, 1, 0, { 1, "\x10" }, { 1, "\x8" }, { 1, "\x4" }, { 1, "\x2" }, { 1, "\x1e" }, { 1, "\xa0" },
         0
       | (1 << CGEN_INSN_OPTIONAL_CP_INSN)
       | (1 << CGEN_INSN_OPTIONAL_MUL_INSN)
       | (1 << CGEN_INSN_OPTIONAL_DIV_INSN)
       | (1 << CGEN_INSN_OPTIONAL_BIT_INSN)
       | (1 << CGEN_INSN_OPTIONAL_LDZ_INSN)
       | (1 << CGEN_INSN_OPTIONAL_ABS_INSN)
       | (1 << CGEN_INSN_OPTIONAL_AVE_INSN)
       | (1 << CGEN_INSN_OPTIONAL_MINMAX_INSN)
       | (1 << CGEN_INSN_OPTIONAL_CLIP_INSN)
       | (1 << CGEN_INSN_OPTIONAL_SAT_INSN) },
  
  { 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, 0 }
}

Definition at line 92 of file mep-opc.c.