Back to index

cell-binutils  2.17cvs20070401
Defines | Functions | Variables
v850-opc.c File Reference
#include "sysdep.h"
#include "opcode/v850.h"
#include <stdio.h>
#include "opintl.h"

Go to the source code of this file.

Defines

#define OP(x)   ((x & 0x3f) << 5)
#define OP_MASK   OP (0x3f)
#define BOP(x)   ((0x0b << 7) | (x & 0x0f))
#define BOP_MASK   ((0x0f << 7) | 0x0f)
#define one(x)   ((unsigned int) (x))
#define two(x, y)   ((unsigned int) (x) | ((unsigned int) (y) << 16))
#define UNUSED   0
#define R1   (UNUSED + 1)
#define R1_NOTR0   (R1 + 1)
#define R2   (R1_NOTR0 + 1)
#define R2_NOTR0   (R2 + 1)
#define I5   (R2_NOTR0 + 1)
#define I5U   (I5 + 1)
#define I16   (I5U + 1)
#define D7   (I16 + 1)
#define D16_15   (D7 + 1)
#define B3   (D16_15 + 1)
#define CCCC   (B3 + 1)
#define D8_7   (CCCC + 1)
#define D8_6   (D8_7 + 1)
#define SR1   (D8_6 + 1)
#define EP   (SR1 + 1)
#define I16U   (EP + 1)
#define SR2   (I16U + 1)
#define D16   (SR2 + 1)
#define D9_RELAX   (D16 + 1)
#define D22   (D9_RELAX + 1)
#define D4   (D22 + 1)
#define D5_4   (D4 + 1)
#define D16_16   (D5_4 + 1)
#define R3   (D16_16 + 1)
#define MOVCC   (R3 + 1)
#define I9   (MOVCC + 1)
#define U9   (I9 + 1)
#define LIST12   (U9 + 1)
#define I6   (LIST12 + 1)
#define IMM16   (I6 + 1)
#define IMM32   (IMM16 + 1)
#define IMM5   (IMM32 + 1)
#define R2DISPOSE   (IMM5 + 1)
#define SP   (R2DISPOSE + 1)
#define I5DIV   (SP + 1)
#define LIST18_H   (I5DIV + 1)
#define LIST18_L   (LIST18_H + 1)
#define IF1   {R1, R2}
#define IF2   {I5, R2}
#define IF3   {D9_RELAX}
#define IF6   {I16, R1, R2}
#define IF6U   {I16U, R1, R2}

Functions

static unsigned long insert_d9 (unsigned long insn, long value, const char **errmsg)
static unsigned long extract_d9 (unsigned long insn, int *invalid ATTRIBUTE_UNUSED)
static unsigned long insert_d22 (unsigned long insn, long value, const char **errmsg)
static unsigned long extract_d22 (unsigned long insn, int *invalid ATTRIBUTE_UNUSED)
static unsigned long insert_d16_15 (unsigned long insn, long value, const char **errmsg)
static unsigned long extract_d16_15 (unsigned long insn, int *invalid ATTRIBUTE_UNUSED)
static unsigned long insert_d8_7 (unsigned long insn, long value, const char **errmsg)
static unsigned long extract_d8_7 (unsigned long insn, int *invalid ATTRIBUTE_UNUSED)
static unsigned long insert_d8_6 (unsigned long insn, long value, const char **errmsg)
static unsigned long extract_d8_6 (unsigned long insn, int *invalid ATTRIBUTE_UNUSED)
static unsigned long insert_d5_4 (unsigned long insn, long value, const char **errmsg)
static unsigned long extract_d5_4 (unsigned long insn, int *invalid ATTRIBUTE_UNUSED)
static unsigned long insert_d16_16 (unsigned long insn, signed long value, const char **errmsg)
static unsigned long extract_d16_16 (unsigned long insn, int *invalid ATTRIBUTE_UNUSED)
static unsigned long insert_i9 (unsigned long insn, signed long value, const char **errmsg)
static unsigned long extract_i9 (unsigned long insn, int *invalid ATTRIBUTE_UNUSED)
static unsigned long insert_u9 (unsigned long insn, long v, const char **errmsg)
static unsigned long extract_u9 (unsigned long insn, int *invalid ATTRIBUTE_UNUSED)
static unsigned long insert_spe (unsigned long insn, long v, const char **errmsg)
static unsigned long extract_spe (unsigned long insn ATTRIBUTE_UNUSED, int *invalid ATTRIBUTE_UNUSED)
static unsigned long insert_i5div (unsigned long insn, long v, const char **errmsg)
static unsigned long extract_i5div (unsigned long insn, int *invalid ATTRIBUTE_UNUSED)

Variables

static const char * not_valid = N_ ("displacement value is not in range and is not aligned")
static const char * out_of_range = N_ ("displacement value is out of range")
static const char * not_aligned = N_ ("displacement value is not aligned")
static const char * immediate_out_of_range = N_ ("immediate value is out of range")
const int v850_num_opcodes

Define Documentation

#define B3   (D16_15 + 1)
#define BOP (   x)    ((0x0b << 7) | (x & 0x0f))

Definition at line 30 of file v850-opc.c.

#define BOP_MASK   ((0x0f << 7) | 0x0f)

Definition at line 31 of file v850-opc.c.

#define CCCC   (B3 + 1)
#define D16   (SR2 + 1)
#define D16_15   (D7 + 1)
#define D16_16   (D5_4 + 1)
#define D22   (D9_RELAX + 1)
#define D4   (D22 + 1)
#define D5_4   (D4 + 1)
data SP andb D9 D7   (I16 + 1)

Definition at line 86 of file indexed12.d.

#define D8_6   (D8_7 + 1)
#define D8_7   (CCCC + 1)
#define D9_RELAX   (D16 + 1)
#define EP   (SR1 + 1)
#define I16   (I5U + 1)
#define I16U   (EP + 1)
#define I5   (R2_NOTR0 + 1)
#define I5DIV   (SP + 1)
#define I5U   (I5 + 1)
#define I6   (LIST12 + 1)
#define I9   (MOVCC + 1)
#define IF1   {R1, R2}

Definition at line 484 of file v850-opc.c.

#define IF2   {I5, R2}

Definition at line 487 of file v850-opc.c.

#define IF3   {D9_RELAX}

Definition at line 490 of file v850-opc.c.

#define IF6   {I16, R1, R2}

Definition at line 493 of file v850-opc.c.

#define IF6U   {I16U, R1, R2}

Definition at line 496 of file v850-opc.c.

#define IMM16   (I6 + 1)
#define IMM32   (IMM16 + 1)
#define IMM5   (IMM32 + 1)
#define LIST12   (U9 + 1)
#define LIST18_H   (I5DIV + 1)
#define LIST18_L   (LIST18_H + 1)
#define MOVCC   (R3 + 1)
#define one (   x)    ((unsigned int) (x))

Definition at line 34 of file v850-opc.c.

#define OP (   x)    ((x & 0x3f) << 5)

Definition at line 26 of file v850-opc.c.

#define OP_MASK   OP (0x3f)

Definition at line 27 of file v850-opc.c.

#define R1   (UNUSED + 1)
#define R1_NOTR0   (R1 + 1)
#define R2   (R1_NOTR0 + 1)
#define R2_NOTR0   (R2 + 1)
#define R2DISPOSE   (IMM5 + 1)
#define R3   (D16_16 + 1)
#define SP   (R2DISPOSE + 1)
#define SR1   (D8_6 + 1)
#define SR2   (I16U + 1)
#define two (   x,
  y 
)    ((unsigned int) (x) | ((unsigned int) (y) << 16))

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

#define U9   (I9 + 1)
#define UNUSED   0

Function Documentation

static unsigned long extract_d16_15 ( unsigned long  insn,
int *invalid  ATTRIBUTE_UNUSED 
) [static]

Definition at line 120 of file v850-opc.c.

{
  signed long ret = (insn & 0xfffe0000);

  return ret >> 16;
}
static unsigned long extract_d16_16 ( unsigned long  insn,
int *invalid  ATTRIBUTE_UNUSED 
) [static]

Definition at line 215 of file v850-opc.c.

{
  signed long ret = insn & 0xfffe0000;

  ret >>= 16;

  ret |= ((insn & 0x20) >> 5);

  return ret;
}
static unsigned long extract_d22 ( unsigned long  insn,
int *invalid  ATTRIBUTE_UNUSED 
) [static]

Definition at line 96 of file v850-opc.c.

{
  signed long ret = ((insn & 0xfffe0000) >> 16) | ((insn & 0x3f) << 16);

  return (unsigned long) ((ret << 10) >> 10);
}
static unsigned long extract_d5_4 ( unsigned long  insn,
int *invalid  ATTRIBUTE_UNUSED 
) [static]

Definition at line 198 of file v850-opc.c.

{
  unsigned long ret = (insn & 0x0f);

  return ret << 1;
}
static unsigned long extract_d8_6 ( unsigned long  insn,
int *invalid  ATTRIBUTE_UNUSED 
) [static]

Definition at line 172 of file v850-opc.c.

{
  unsigned long ret = (insn & 0x7e);

  return ret << 1;
}
static unsigned long extract_d8_7 ( unsigned long  insn,
int *invalid  ATTRIBUTE_UNUSED 
) [static]

Definition at line 146 of file v850-opc.c.

{
  unsigned long ret = (insn & 0x7f);

  return ret << 1;
}
static unsigned long extract_d9 ( unsigned long  insn,
int *invalid  ATTRIBUTE_UNUSED 
) [static]

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

{
  unsigned long ret = ((insn & 0xf800) >> 7) | ((insn & 0x0070) >> 3);

  if ((insn & 0x8000) != 0)
    ret -= 0x0200;

  return ret;
}
static unsigned long extract_i5div ( unsigned long  insn,
int *invalid  ATTRIBUTE_UNUSED 
) [static]

Definition at line 310 of file v850-opc.c.

{
  unsigned long ret = insn & 0x3c0000;

  ret >>= 17;

  ret = 32 - ret;

  return ret;
}
static unsigned long extract_i9 ( unsigned long  insn,
int *invalid  ATTRIBUTE_UNUSED 
) [static]

Definition at line 236 of file v850-opc.c.

{
  signed long ret = insn & 0x003c0000;

  ret <<= 10;
  ret >>= 23;

  ret |= (insn & 0x1f);

  return ret;
}
static unsigned long extract_spe ( unsigned long insn  ATTRIBUTE_UNUSED,
int *invalid  ATTRIBUTE_UNUSED 
) [static]

Definition at line 283 of file v850-opc.c.

{
  return 3;
}
static unsigned long extract_u9 ( unsigned long  insn,
int *invalid  ATTRIBUTE_UNUSED 
) [static]

Definition at line 260 of file v850-opc.c.

{
  unsigned long ret = insn & 0x003c0000;

  ret >>= 13;

  ret |= (insn & 0x1f);

  return ret;
}
static unsigned long insert_d16_15 ( unsigned long  insn,
long  value,
const char **  errmsg 
) [static]

Definition at line 104 of file v850-opc.c.

{
  if (value > 0x7fff || value < -0x8000)
    {
      if ((value % 2) != 0)
       * errmsg = _(not_valid);
      else
       * errmsg = _(out_of_range);
    }
  else if ((value % 2) != 0)
    * errmsg = _(not_aligned);

  return insn | ((value & 0xfffe) << 16);
}
static unsigned long insert_d16_16 ( unsigned long  insn,
signed long  value,
const char **  errmsg 
) [static]

Definition at line 206 of file v850-opc.c.

{
  if (value > 0x7fff || value < -0x8000)
    * errmsg = _(out_of_range);

  return insn | ((value & 0xfffe) << 16) | ((value & 1) << 5);
}
static unsigned long insert_d22 ( unsigned long  insn,
long  value,
const char **  errmsg 
) [static]

Definition at line 80 of file v850-opc.c.

{
  if (value > 0x1fffff || value < -0x200000)
    {
      if ((value % 2) != 0)
       * errmsg = _("branch value not in range and to an odd offset");
      else
       * errmsg = _("branch value out of range");
    }
  else if ((value % 2) != 0)
    * errmsg = _("branch to odd offset");

  return insn | ((value & 0xfffe) << 16) | ((value & 0x3f0000) >> 16);
}
static unsigned long insert_d5_4 ( unsigned long  insn,
long  value,
const char **  errmsg 
) [static]

Definition at line 180 of file v850-opc.c.

{
  if (value > 0x1f || value < 0)
    {
      if (value & 1)
       * errmsg = _(not_valid);
      else
       *errmsg = _(out_of_range);
    }
  else if (value & 1)
    * errmsg = _(not_aligned);

  value >>= 1;

  return insn | (value & 0x0f);
}
static unsigned long insert_d8_6 ( unsigned long  insn,
long  value,
const char **  errmsg 
) [static]

Definition at line 154 of file v850-opc.c.

{
  if (value > 0xff || value < 0)
    {
      if ((value % 4) != 0)
       *errmsg = _(not_valid);
      else
       * errmsg = _(out_of_range);
    }
  else if ((value % 4) != 0)
    * errmsg = _(not_aligned);

  value >>= 1;

  return insn | (value & 0x7e);
}
static unsigned long insert_d8_7 ( unsigned long  insn,
long  value,
const char **  errmsg 
) [static]

Definition at line 128 of file v850-opc.c.

{
  if (value > 0xff || value < 0)
    {
      if ((value % 2) != 0)
       * errmsg = _(not_valid);
      else
       * errmsg = _(out_of_range);
    }
  else if ((value % 2) != 0)
    * errmsg = _(not_aligned);

  value >>= 1;

  return insn | (value & 0x7f);
}
static unsigned long insert_d9 ( unsigned long  insn,
long  value,
const char **  errmsg 
) [static]

Definition at line 53 of file v850-opc.c.

{
  if (value > 0xff || value < -0x100)
    {
      if ((value % 2) != 0)
       * errmsg = _("branch value not in range and to odd offset");
      else
       * errmsg = _("branch value out of range");
    }
  else if ((value % 2) != 0)
    * errmsg = _("branch to odd offset");

  return insn | ((value & 0x1f0) << 7) | ((value & 0x0e) << 3);
}
static unsigned long insert_i5div ( unsigned long  insn,
long  v,
const char **  errmsg 
) [static]

Definition at line 290 of file v850-opc.c.

{
  unsigned long value = (unsigned long) v;

  if (value > 0x1ff)
    {
      if (value & 1)
       * errmsg = _("immediate value not in range and not even");
      else
       * errmsg = _(immediate_out_of_range);
    }
  else if (value & 1)
    * errmsg = _("immediate value must be even");

  value = 32 - value;

  return insn | ((value & 0x1e) << 17);
}
static unsigned long insert_i9 ( unsigned long  insn,
signed long  value,
const char **  errmsg 
) [static]

Definition at line 227 of file v850-opc.c.

{
  if (value > 0xff || value < -0x100)
    * errmsg = _(immediate_out_of_range);

  return insn | ((value & 0x1e0) << 13) | (value & 0x1f);
}
static unsigned long insert_spe ( unsigned long  insn,
long  v,
const char **  errmsg 
) [static]

Definition at line 272 of file v850-opc.c.

{
  unsigned long value = (unsigned long) v;

  if (value != 3)
    * errmsg = _("invalid register for stack adjustment");

  return insn & (~ 0x180000);
}
static unsigned long insert_u9 ( unsigned long  insn,
long  v,
const char **  errmsg 
) [static]

Definition at line 249 of file v850-opc.c.

{
  unsigned long value = (unsigned long) v;

  if (value > 0x1ff)
    * errmsg = _(immediate_out_of_range);

  return insn | ((value & 0x1e0) << 13) | (value & 0x1f);
}

Variable Documentation

const char* immediate_out_of_range = N_ ("immediate value is out of range") [static]

Definition at line 50 of file v850-opc.c.

const char* not_aligned = N_ ("displacement value is not aligned") [static]

Definition at line 48 of file v850-opc.c.

const char* not_valid = N_ ("displacement value is not in range and is not aligned") [static]

Definition at line 46 of file v850-opc.c.

const char* out_of_range = N_ ("displacement value is out of range") [static]

Definition at line 47 of file v850-opc.c.

Initial value:
  sizeof (v850_opcodes) / sizeof (v850_opcodes[0])

Definition at line 726 of file v850-opc.c.