Back to index

cell-binutils  2.17cvs20070401
Defines | Functions
cpu-ia64-opc.c File Reference
#include "../opcodes/ia64-opc.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define NELEMS(a)   ((int) (sizeof (a) / sizeof ((a)[0])))
#define CST   IA64_OPND_CLASS_CST
#define REG   IA64_OPND_CLASS_REG
#define IND   IA64_OPND_CLASS_IND
#define ABS   IA64_OPND_CLASS_ABS
#define REL   IA64_OPND_CLASS_REL
#define SDEC   IA64_OPND_FLAG_DECIMAL_SIGNED
#define UDEC   IA64_OPND_FLAG_DECIMAL_UNSIGNED

Functions

static const char * ins_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED, ia64_insn value ATTRIBUTE_UNUSED, ia64_insn *code ATTRIBUTE_UNUSED)
static const char * ext_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED, ia64_insn code ATTRIBUTE_UNUSED, ia64_insn *valuep ATTRIBUTE_UNUSED)
static const char * ins_const (const struct ia64_operand *self ATTRIBUTE_UNUSED, ia64_insn value ATTRIBUTE_UNUSED, ia64_insn *code ATTRIBUTE_UNUSED)
static const char * ext_const (const struct ia64_operand *self ATTRIBUTE_UNUSED, ia64_insn code ATTRIBUTE_UNUSED, ia64_insn *valuep ATTRIBUTE_UNUSED)
static const char * ins_reg (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ext_reg (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
static const char * ins_immu (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ext_immu (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
static const char * ins_immu5b (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ext_immu5b (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
static const char * ins_immus8 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ext_immus8 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
static const char * ins_imms_scaled (const struct ia64_operand *self, ia64_insn value, ia64_insn *code, int scale)
static const char * ext_imms_scaled (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep, int scale)
static const char * ins_imms (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ins_immsu4 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ext_imms (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
static const char * ins_immsm1 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ins_immsm1u4 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ext_immsm1 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
static const char * ins_imms1 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ext_imms1 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
static const char * ins_imms4 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ext_imms4 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
static const char * ins_imms16 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ext_imms16 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
static const char * ins_cimmu (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ext_cimmu (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
static const char * ins_cnt (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ext_cnt (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
static const char * ins_cnt2b (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ext_cnt2b (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
static const char * ins_cnt2c (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ext_cnt2c (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
static const char * ins_inc3 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
static const char * ext_inc3 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)

Define Documentation

#define ABS   IA64_OPND_CLASS_ABS

Definition at line 429 of file cpu-ia64-opc.c.

#define CST   IA64_OPND_CLASS_CST

Definition at line 426 of file cpu-ia64-opc.c.

#define IND   IA64_OPND_CLASS_IND

Definition at line 428 of file cpu-ia64-opc.c.

#define NELEMS (   a)    ((int) (sizeof (a) / sizeof ((a)[0])))

Definition at line 32 of file cpu-ia64-opc.c.

#define REG   IA64_OPND_CLASS_REG

Definition at line 427 of file cpu-ia64-opc.c.

#define REL   IA64_OPND_CLASS_REL

Definition at line 430 of file cpu-ia64-opc.c.

Definition at line 432 of file cpu-ia64-opc.c.

Definition at line 433 of file cpu-ia64-opc.c.


Function Documentation

static const char* ext_cimmu ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep 
) [static]

Definition at line 296 of file cpu-ia64-opc.c.

{
  const char *result;
  ia64_insn mask;

  mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
  result = ext_immu (self, code, valuep);
  if (!result)
    {
      mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
      *valuep ^= mask;
    }
  return result;
}

Here is the call graph for this function:

static const char* ext_cnt ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep 
) [static]

Definition at line 323 of file cpu-ia64-opc.c.

{
  *valuep = ((code >> self->field[0].shift)
            & ((((BFD_HOST_U_64_BIT) 1) << self->field[0].bits) - 1)) + 1;
  return 0;
}
static const char* ext_cnt2b ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep 
) [static]

Definition at line 343 of file cpu-ia64-opc.c.

{
  *valuep = ((code >> self->field[0].shift) & 0x3) + 1;
  return 0;
}
static const char* ext_cnt2c ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep 
) [static]

Definition at line 365 of file cpu-ia64-opc.c.

{
  ia64_insn value;

  value = (code >> self->field[0].shift) & 0x3;
  switch (value)
    {
    case 0: value =  0; break;
    case 1: value =  7; break;
    case 2: value = 15; break;
    case 3: value = 16; break;
    }
  *valuep = value;
  return 0;
}
static const char* ext_const ( const struct ia64_operand *self  ATTRIBUTE_UNUSED,
ia64_insn code  ATTRIBUTE_UNUSED,
ia64_insn *valuep  ATTRIBUTE_UNUSED 
) [static]

Definition at line 56 of file cpu-ia64-opc.c.

{
  return 0;
}
static const char* ext_imms ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep 
) [static]

Definition at line 221 of file cpu-ia64-opc.c.

{
  return ext_imms_scaled (self, code, valuep, 0);
}

Here is the call graph for this function:

static const char* ext_imms1 ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep 
) [static]

Definition at line 259 of file cpu-ia64-opc.c.

{
  return ext_imms_scaled (self, code, valuep, 1);
}

Here is the call graph for this function:

static const char* ext_imms16 ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep 
) [static]

Definition at line 283 of file cpu-ia64-opc.c.

{
  return ext_imms_scaled (self, code, valuep, 16);
}

Here is the call graph for this function:

static const char* ext_imms4 ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep 
) [static]

Definition at line 271 of file cpu-ia64-opc.c.

{
  return ext_imms_scaled (self, code, valuep, 4);
}

Here is the call graph for this function:

static const char* ext_imms_scaled ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep,
int  scale 
) [static]

Definition at line 185 of file cpu-ia64-opc.c.

{
  int i, bits = 0, total = 0;
  BFD_HOST_64_BIT val = 0, sign;

  for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
    {
      bits = self->field[i].bits;
      val |= ((code >> self->field[i].shift)
             & ((((BFD_HOST_U_64_BIT) 1) << bits) - 1)) << total;
      total += bits;
    }
  /* sign extend: */
  sign = (BFD_HOST_64_BIT) 1 << (total - 1);
  val = (val ^ sign) - sign;

  *valuep = (val << scale);
  return 0;
}

Here is the caller graph for this function:

static const char* ext_immsm1 ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep 
) [static]

Definition at line 244 of file cpu-ia64-opc.c.

{
  const char *res = ext_imms_scaled (self, code, valuep, 0);

  ++*valuep;
  return res;
}

Here is the call graph for this function:

static const char* ext_immu ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep 
) [static]

Definition at line 100 of file cpu-ia64-opc.c.

{
  BFD_HOST_U_64_BIT value = 0;
  int i, bits = 0, total = 0;

  for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
    {
      bits = self->field[i].bits;
      value |= ((code >> self->field[i].shift)
              & ((((BFD_HOST_U_64_BIT) 1) << bits) - 1)) << total;
      total += bits;
    }
  *valuep = value;
  return 0;
}

Here is the caller graph for this function:

static const char* ext_immu5b ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep 
) [static]

Definition at line 126 of file cpu-ia64-opc.c.

{
  const char *result;

  result = ext_immu (self, code, valuep);
  if (result)
    return result;

  *valuep = *valuep + 32;
  return 0;
}

Here is the call graph for this function:

static const char* ext_immus8 ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep 
) [static]

Definition at line 148 of file cpu-ia64-opc.c.

{
  const char *result;

  result = ext_immu (self, code, valuep);
  if (result)
    return result;

  *valuep = *valuep << 3;
  return 0;
}

Here is the call graph for this function:

static const char* ext_inc3 ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep 
) [static]

Definition at line 405 of file cpu-ia64-opc.c.

{
  BFD_HOST_64_BIT val;
  int negate;

  val = (code >> self->field[0].shift) & 0x7;
  negate = val & 0x4;
  switch (val & 0x3)
    {
    case 0: val = 16; break;
    case 1: val =  8; break;
    case 2: val =  4; break;
    case 3: val =  1; break;
    }
  if (negate)
    val = -val;

  *valuep = val;
  return 0;
}
static const char* ext_reg ( const struct ia64_operand self,
ia64_insn  code,
ia64_insn valuep 
) [static]

Definition at line 73 of file cpu-ia64-opc.c.

{
  *valuep = ((code >> self->field[0].shift)
            & ((1u << self->field[0].bits) - 1));
  return 0;
}
static const char* ext_rsvd ( const struct ia64_operand *self  ATTRIBUTE_UNUSED,
ia64_insn code  ATTRIBUTE_UNUSED,
ia64_insn *valuep  ATTRIBUTE_UNUSED 
) [static]

Definition at line 42 of file cpu-ia64-opc.c.

{
  return "internal error---this shouldn't happen";
}
static const char* ins_cimmu ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 289 of file cpu-ia64-opc.c.

{
  ia64_insn mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
  return ins_immu (self, value ^ mask, code);
}

Here is the call graph for this function:

static const char* ins_cnt ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 312 of file cpu-ia64-opc.c.

{
  --value;
  if (value >= ((BFD_HOST_U_64_BIT) 1) << self->field[0].bits)
    return "count out of range";

  *code |= value << self->field[0].shift;
  return 0;
}
static const char* ins_cnt2b ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 331 of file cpu-ia64-opc.c.

{
  --value;

  if (value > 2)
    return "count must be in range 1..3";

  *code |= value << self->field[0].shift;
  return 0;
}
static const char* ins_cnt2c ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 350 of file cpu-ia64-opc.c.

{
  switch (value)
    {
    case 0:   value = 0; break;
    case 7:   value = 1; break;
    case 15:  value = 2; break;
    case 16:  value = 3; break;
    default:  return "count must be 0, 7, 15, or 16";
    }
  *code |= value << self->field[0].shift;
  return 0;
}
static const char* ins_const ( const struct ia64_operand *self  ATTRIBUTE_UNUSED,
ia64_insn value  ATTRIBUTE_UNUSED,
ia64_insn *code  ATTRIBUTE_UNUSED 
) [static]

Definition at line 49 of file cpu-ia64-opc.c.

{
  return 0;
}
static const char* ins_imms ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 207 of file cpu-ia64-opc.c.

{
  return ins_imms_scaled (self, value, code, 0);
}

Here is the call graph for this function:

static const char* ins_imms1 ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 253 of file cpu-ia64-opc.c.

{
  return ins_imms_scaled (self, value, code, 1);
}

Here is the call graph for this function:

static const char* ins_imms16 ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 277 of file cpu-ia64-opc.c.

{
  return ins_imms_scaled (self, value, code, 16);
}

Here is the call graph for this function:

static const char* ins_imms4 ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 265 of file cpu-ia64-opc.c.

{
  return ins_imms_scaled (self, value, code, 4);
}

Here is the call graph for this function:

static const char* ins_imms_scaled ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code,
int  scale 
) [static]

Definition at line 161 of file cpu-ia64-opc.c.

{
  BFD_HOST_64_BIT svalue = value, sign_bit = 0;
  ia64_insn new = 0;
  int i;

  svalue >>= scale;

  for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
    {
      new |= ((svalue & ((((ia64_insn) 1) << self->field[i].bits) - 1))
             << self->field[i].shift);
      sign_bit = (svalue >> (self->field[i].bits - 1)) & 1;
      svalue >>= self->field[i].bits;
    }
  if ((!sign_bit && svalue != 0) || (sign_bit && svalue != -1))
    return "integer operand out of range";

  *code |= new;
  return 0;
}

Here is the caller graph for this function:

static const char* ins_immsm1 ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 227 of file cpu-ia64-opc.c.

{
  --value;
  return ins_imms_scaled (self, value, code, 0);
}

Here is the call graph for this function:

static const char* ins_immsm1u4 ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 234 of file cpu-ia64-opc.c.

{
  value = ((value & 0xffffffff) ^ 0x80000000) - 0x80000000;

  --value;
  return ins_imms_scaled (self, value, code, 0);
}

Here is the call graph for this function:

static const char* ins_immsu4 ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 213 of file cpu-ia64-opc.c.

{
  value = ((value & 0xffffffff) ^ 0x80000000) - 0x80000000;

  return ins_imms_scaled (self, value, code, 0);
}

Here is the call graph for this function:

static const char* ins_immu ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 81 of file cpu-ia64-opc.c.

{
  ia64_insn new = 0;
  int i;

  for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
    {
      new |= ((value & ((((ia64_insn) 1) << self->field[i].bits) - 1))
             << self->field[i].shift);
      value >>= self->field[i].bits;
    }
  if (value)
    return "integer operand out of range";

  *code |= new;
  return 0;
}

Here is the caller graph for this function:

static const char* ins_immu5b ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 117 of file cpu-ia64-opc.c.

{
  if (value < 32 || value > 63)
    return "value must be between 32 and 63";
  return ins_immu (self, value - 32, code);
}

Here is the call graph for this function:

static const char* ins_immus8 ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 140 of file cpu-ia64-opc.c.

{
  if (value & 0x7)
    return "value not an integer multiple of 8";
  return ins_immu (self, value >> 3, code);
}

Here is the call graph for this function:

static const char* ins_inc3 ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 382 of file cpu-ia64-opc.c.

{
  BFD_HOST_64_BIT val = value;
  BFD_HOST_U_64_BIT sign = 0;

  if (val < 0)
    {
      sign = 0x4;
      value = -value;
    }
  switch (value)
    {
    case  1:  value = 3; break;
    case  4:  value = 2; break;
    case  8:  value = 1; break;
    case 16:  value = 0; break;
    default:  return "count must be +/- 1, 4, 8, or 16";
    }
  *code |= (sign | value) << self->field[0].shift;
  return 0;
}
static const char* ins_reg ( const struct ia64_operand self,
ia64_insn  value,
ia64_insn code 
) [static]

Definition at line 63 of file cpu-ia64-opc.c.

{
  if (value >= 1u << self->field[0].bits)
    return "register number out of range";

  *code |= value << self->field[0].shift;
  return 0;
}
static const char* ins_rsvd ( const struct ia64_operand *self  ATTRIBUTE_UNUSED,
ia64_insn value  ATTRIBUTE_UNUSED,
ia64_insn *code  ATTRIBUTE_UNUSED 
) [static]

Definition at line 35 of file cpu-ia64-opc.c.

{
  return "internal error---this shouldn't happen";
}