Back to index

cell-binutils  2.17cvs20070401
Classes | Defines | Typedefs | Functions | Variables
tc-iq2000.c File Reference
#include "as.h"
#include "safe-ctype.h"
#include "subsegs.h"
#include "symcat.h"
#include "opcodes/iq2000-desc.h"
#include "opcodes/iq2000-opc.h"
#include "cgen.h"
#include "elf/common.h"
#include "elf/iq2000.h"
#include "libbfd.h"
#include "sb.h"
#include "macro.h"

Go to the source code of this file.

Classes

struct  iq2000_insn
struct  proc
struct  iq2000_hi_fixup
struct  iq2000_macro_defs_s

Defines

#define INSN_VALUE(buf)   (buf)
#define DEFAULT_MACHINE   bfd_mach_iq2000
#define DEFAULT_FLAGS   EF_IQ2000_CPU_IQ2000
#define FX_OPINFO_R_TYPE(f)   ((f)->fx_cgen.opinfo)
#define MAX_LITTLENUMS   6

Typedefs

typedef struct proc procS

Functions

int md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
void md_show_usage (FILE *stream ATTRIBUTE_UNUSED)
static void iq2000_add_macro (const char *name, const char *semantics, const char **arguments)
static void iq2000_load_macros (void)
void md_begin (void)
void md_assemble (char *str)
valueT md_section_align (segT segment, valueT size)
symbolS * md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
int md_estimate_size_before_relax (fragS *fragP, segT segment ATTRIBUTE_UNUSED)
void md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec ATTRIBUTE_UNUSED, fragS *fragP ATTRIBUTE_UNUSED)
long md_pcrel_from_section (fixS *fixP, segT sec)
bfd_reloc_code_real_type md_cgen_lookup_reloc (const CGEN_INSN *insn ATTRIBUTE_UNUSED, const CGEN_OPERAND *operand, fixS *fixP ATTRIBUTE_UNUSED)
static void iq2000_record_hi16 (int reloc_type, fixS *fixP, segT seg ATTRIBUTE_UNUSED)
fixS * iq2000_cgen_record_fixup_exp (fragS *frag, int where, const CGEN_INSN *insn, int length, const CGEN_OPERAND *operand, int opinfo, expressionS *exp)
void iq2000_frob_file (void)
int iq2000_force_relocation (fixS *fix)
static void s_iq2000_set (int x ATTRIBUTE_UNUSED)
void md_number_to_chars (char *buf, valueT val, int n)
void md_operand (expressionS *exp)
char * md_atof (int type, char *litP, int *sizeP)
bfd_boolean iq2000_fix_adjustable (fixS *fixP)
static void s_change_sec (int sec)
static symbolS * get_symbol (void)
static void s_iq2000_end (int x ATTRIBUTE_UNUSED)
static int get_number (void)
static void s_iq2000_ent (int aent)
static void s_iq2000_frame (int ignore)
static void s_iq2000_mask (int reg_type)

Variables

const char comment_chars [] = "#"
const char line_comment_chars [] = "#"
const char line_separator_chars [] = ";"
const char EXP_CHARS [] = "eE"
const char FLT_CHARS [] = "dD"
static unsigned long iq2000_mach = bfd_mach_iq2000
static int cpu_mach = (1 << MACH_IQ2000)
static flagword iq2000_flags = DEFAULT_FLAGS
static procS cur_proc
static procScur_proc_ptr
static int numprocs
static struct iq2000_hi_fixupiq2000_hi_fixup_list
struct hash_controlmacro_hash
const char * md_shortopts = ""
size_t md_longopts_size = sizeof (md_longopts)
static const char * abs_args [] = { "rd", "rs", "scratch=%1", NULL }
static const char * abs_expn = "\n sra \\rd,\\rs,31\n xor \\scratch,\\rd,\\rs\n sub \\rd,\\scratch,\\rd\n"
static const char * la_expn = "\n lui \\reg,%hi(\\label)\n ori \\reg,\\reg,%lo(\\label)\n"
static const char * la_args [] = { "reg", "label", NULL }
static const char * bxx_args [] = { "rs", "rt", "label", "scratch=%1", NULL }
static const char * bge_expn = "\n slt \\scratch,\\rs,\\rt\n beq %0,\\scratch,\\label\n"
static const char * bgeu_expn = "\n sltu \\scratch,\\rs,\\rt\n beq %0,\\scratch,\\label\n"
static const char * bgt_expn = "\n slt \\scratch,\\rt,\\rs\n bne %0,\\scratch,\\label\n"
static const char * bgtu_expn = "\n sltu \\scratch,\\rt,\\rs\n bne %0,\\scratch,\\label\n"
static const char * ble_expn = "\n slt \\scratch,\\rt,\\rs\n beq %0,\\scratch,\\label\n"
static const char * bleu_expn = "\n sltu \\scratch,\\rt,\\rs\n beq %0,\\scratch,\\label\n"
static const char * blt_expn = "\n slt \\scratch,\\rs,\\rt\n bne %0,\\scratch,\\label\n"
static const char * bltu_expn = "\n sltu \\scratch,\\rs,\\rt\n bne %0,\\scratch,\\label\n"
static const char * sxx_args [] = { "rd", "rs", "rt", NULL }
static const char * sge_expn = "\n slt \\rd,\\rs,\\rt\n xori \\rd,\\rd,1\n"
static const char * sgeu_expn = "\n sltu \\rd,\\rs,\\rt\n xori \\rd,\\rd,1\n"
static const char * sle_expn = "\n slt \\rd,\\rt,\\rs\n xori \\rd,\\rd,1\n"
static const char * sleu_expn = "\n sltu \\rd,\\rt,\\rs\n xori \\rd,\\rd,1\n"
static const char * sgt_expn = "\n slt \\rd,\\rt,\\rs\n"
static const char * sgtu_expn = "\n sltu \\rd,\\rt,\\rs\n"
static const char * sne_expn = "\n xor \\rd,\\rt,\\rs\n sltu \\rd,%0,\\rd\n"
static const char * seq_expn = "\n xor \\rd,\\rt,\\rs\n sltu \\rd,%0,\\rd\n xori \\rd,\\rd,1\n"
static const char * ai32_args [] = { "rt", "rs", "imm", NULL }
static const char * andi32_expn
static const char * ori32_expn
static const char * neg_args [] = { "rd", "rs", NULL }
static const char * neg_expn = "\n sub \\rd,%0,\\rs\n"
static const char * negu_expn = "\n subu \\rd,%0,\\rs\n"
static const char * li_args [] = { "rt", "imm", NULL }
static const char * li_expn
static iq2000_macro_defs_s iq2000_macro_defs []
const pseudo_typeS md_pseudo_table []

Class Documentation

struct iq2000_insn

Definition at line 36 of file tc-iq2000.c.

Class Members
char * addr
unsigned char buffer
CGEN_FIELDS fields
fixS * fixups
fragS * frag
int indices
const CGEN_INSN * insn
int num_fixups
const CGEN_INSN * orig_insn
struct proc

Definition at line 72 of file tc-iq2000.c.

Class Members
unsigned long fpreg_mask
unsigned long fpreg_offset
unsigned long frame_offset
unsigned long frame_reg
symbolS * func_end_sym
symbolS * func_sym
symbolS * isym
unsigned long leaf
unsigned long pc_reg
unsigned long reg_mask
unsigned long reg_offset
struct iq2000_hi_fixup

Definition at line 99 of file tc-iq2000.c.

Collaboration diagram for iq2000_hi_fixup:
Class Members
fixS * fixp
struct iq2000_hi_fixup * next
segT seg
struct iq2000_macro_defs_s

Definition at line 133 of file tc-iq2000.c.

Class Members
const char ** args
const char ** expansion
const char * mnemonic

Define Documentation

Definition at line 64 of file tc-iq2000.c.

Definition at line 63 of file tc-iq2000.c.

#define FX_OPINFO_R_TYPE (   f)    ((f)->fx_cgen.opinfo)

Definition at line 573 of file tc-iq2000.c.

#define INSN_VALUE (   buf)    (buf)

Definition at line 46 of file tc-iq2000.c.

#define MAX_LITTLENUMS   6

Definition at line 733 of file tc-iq2000.c.


Typedef Documentation

typedef struct proc procS

Function Documentation

static int get_number ( void  ) [static]

Definition at line 899 of file tc-iq2000.c.

{
  int negative = 0;
  long val = 0;

  if (*input_line_pointer == '-')
    {
      ++input_line_pointer;
      negative = 1;
    }

  if (! ISDIGIT (*input_line_pointer))
    as_bad (_("Expected simple number."));

  if (input_line_pointer[0] == '0')
    {
      if (input_line_pointer[1] == 'x')
       {
         input_line_pointer += 2;
         while (ISXDIGIT (*input_line_pointer))
           {
             val <<= 4;
             val |= hex_value (*input_line_pointer++);
           }
         return negative ? -val : val;
       }
      else
       {
         ++input_line_pointer;

         while (ISDIGIT (*input_line_pointer))
           {
             val <<= 3;
             val |= *input_line_pointer++ - '0';
           }
         return negative ? -val : val;
       }
    }

  if (! ISDIGIT (*input_line_pointer))
    {
      printf (_(" *input_line_pointer == '%c' 0x%02x\n"),
             *input_line_pointer, *input_line_pointer);
      as_warn (_("Invalid number"));
      return -1;
    }

  while (ISDIGIT (*input_line_pointer))
    {
      val *= 10;
      val += *input_line_pointer++ - '0';
    }

  return negative ? -val : val;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static symbolS* get_symbol ( void  ) [static]

Definition at line 842 of file tc-iq2000.c.

{
  int c;
  char *name;
  symbolS *p;

  name = input_line_pointer;
  c = get_symbol_end ();
  p = (symbolS *) symbol_find_or_make (name);
  *input_line_pointer = c;
  return p;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void iq2000_add_macro ( const char *  name,
const char *  semantics,
const char **  arguments 
) [static]

Definition at line 228 of file tc-iq2000.c.

{
  macro_entry *macro;
  sb macro_name;
  const char *namestr;

  macro = xmalloc (sizeof (macro_entry));
  sb_new (& macro->sub);
  sb_new (& macro_name);

  macro->formal_count = 0;
  macro->formals = 0;

  sb_add_string (& macro->sub, semantics);

  if (arguments != NULL)
    {
      formal_entry ** p = &macro->formals;

      macro->formal_count = 0;
      macro->formal_hash = hash_new ();

      while (*arguments != NULL)
       {
         formal_entry *formal;

         formal = xmalloc (sizeof (formal_entry));

         sb_new (& formal->name);
         sb_new (& formal->def);
         sb_new (& formal->actual);

         /* chlm: Added the following to allow defaulted args.  */
         if (strchr (*arguments,'='))
           {
             char * tt_args = strdup (*arguments);
             char * tt_dflt = strchr (tt_args,'=');

             *tt_dflt = 0;
             sb_add_string (& formal->name, tt_args);
             sb_add_string (& formal->def,  tt_dflt + 1);
           }
         else
           sb_add_string (& formal->name, *arguments);

         /* Add to macro's hash table.  */
         hash_jam (macro->formal_hash, sb_terminate (& formal->name), formal);

         formal->index = macro->formal_count;
         macro->formal_count++;
         *p = formal;
         p = & formal->next;
         *p = NULL;
         ++arguments;
       }
    }

  sb_add_string (&macro_name, name);
  namestr = sb_terminate (&macro_name);
  hash_jam (macro_hash, namestr, macro);

  macro_defined = 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

fixS* iq2000_cgen_record_fixup_exp ( fragS *  frag,
int  where,
const CGEN_INSN *  insn,
int  length,
const CGEN_OPERAND operand,
int  opinfo,
expressionS exp 
)

Definition at line 550 of file tc-iq2000.c.

{
  fixS * fixP = gas_cgen_record_fixup_exp (frag, where, insn, length,
                                      operand, opinfo, exp);

  if (operand->type == IQ2000_OPERAND_HI16
      /* If low/high was used, it is recorded in `opinfo'.  */
      && (fixP->fx_cgen.opinfo == BFD_RELOC_HI16
         || fixP->fx_cgen.opinfo == BFD_RELOC_LO16))
    iq2000_record_hi16 (fixP->fx_cgen.opinfo, fixP, now_seg);

  return fixP;
}

Here is the call graph for this function:

Definition at line 783 of file tc-iq2000.c.

{
  bfd_reloc_code_real_type reloc_type;

  if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
    {
      const CGEN_INSN *insn = NULL;
      int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
      const CGEN_OPERAND *operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex);

      reloc_type = md_cgen_lookup_reloc (insn, operand, fixP);
    }
  else
    reloc_type = fixP->fx_r_type;

  if (fixP->fx_addsy == NULL)
    return TRUE;

  /* Prevent all adjustments to global symbols.  */
  if (S_IS_EXTERNAL (fixP->fx_addsy))
    return FALSE;

  if (S_IS_WEAK (fixP->fx_addsy))
    return FALSE;

  /* We need the symbol name for the VTABLE entries.  */
  if (   reloc_type == BFD_RELOC_VTABLE_INHERIT
      || reloc_type == BFD_RELOC_VTABLE_ENTRY)
    return FALSE;

  return TRUE;
}

Here is the call graph for this function:

int iq2000_force_relocation ( fixS *  fix)

Definition at line 658 of file tc-iq2000.c.

void iq2000_frob_file ( void  )

Definition at line 580 of file tc-iq2000.c.

{
  struct iq2000_hi_fixup * l;

  for (l = iq2000_hi_fixup_list; l != NULL; l = l->next)
    {
      segment_info_type * seginfo;
      int                 pass;

      assert (FX_OPINFO_R_TYPE (l->fixp) == BFD_RELOC_HI16
             || FX_OPINFO_R_TYPE (l->fixp) == BFD_RELOC_LO16);

      /* Check quickly whether the next fixup happens to be a matching low.  */
      if (l->fixp->fx_next != NULL
         && FX_OPINFO_R_TYPE (l->fixp->fx_next) == BFD_RELOC_LO16
         && l->fixp->fx_addsy == l->fixp->fx_next->fx_addsy
         && l->fixp->fx_offset == l->fixp->fx_next->fx_offset)
       continue;

      /* Look through the fixups for this segment for a matching
         `low'.  When we find one, move the high just in front of it.
         We do this in two passes.  In the first pass, we try to find
         a unique `low'.  In the second pass, we permit multiple
         high's relocs for a single `low'.  */
      seginfo = seg_info (l->seg);
      for (pass = 0; pass < 2; pass++)
       {
         fixS * f;
         fixS * prev;

         prev = NULL;
         for (f = seginfo->fix_root; f != NULL; f = f->fx_next)
           {
             /* Check whether this is a `low' fixup which matches l->fixp.  */
             if (FX_OPINFO_R_TYPE (f) == BFD_RELOC_LO16
                && f->fx_addsy == l->fixp->fx_addsy
                && f->fx_offset == l->fixp->fx_offset
                && (pass == 1
                    || prev == NULL
                    || (FX_OPINFO_R_TYPE (prev) != BFD_RELOC_HI16)
                    || prev->fx_addsy != f->fx_addsy
                    || prev->fx_offset !=  f->fx_offset))
              {
                fixS ** pf;

                /* Move l->fixp before f.  */
                for (pf = &seginfo->fix_root;
                     * pf != l->fixp;
                     pf = & (* pf)->fx_next)
                  assert (* pf != NULL);

                * pf = l->fixp->fx_next;

                l->fixp->fx_next = f;
                if (prev == NULL)
                  seginfo->fix_root = l->fixp;
                else
                  prev->fx_next = l->fixp;

                break;
              }

             prev = f;
           }

         if (f != NULL)
           break;

         if (pass == 1)
           as_warn_where (l->fixp->fx_file, l->fixp->fx_line,
                        _("Unmatched high relocation"));
       }
    }
}

Here is the call graph for this function:

static void iq2000_load_macros ( void  ) [static]

Definition at line 295 of file tc-iq2000.c.

{
  int i;
  int mcnt = ARRAY_SIZE (iq2000_macro_defs);

  for (i = 0; i < mcnt; i++)
    iq2000_add_macro (iq2000_macro_defs[i].mnemonic,
                    *iq2000_macro_defs[i].expansion,
                    iq2000_macro_defs[i].args);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void iq2000_record_hi16 ( int  reloc_type,
fixS *  fixP,
segT seg  ATTRIBUTE_UNUSED 
) [static]

Definition at line 530 of file tc-iq2000.c.

{
  struct iq2000_hi_fixup * hi_fixup;

  assert (reloc_type == BFD_RELOC_HI16);

  hi_fixup = xmalloc (sizeof * hi_fixup);
  hi_fixup->fixp = fixP;
  hi_fixup->seg  = now_seg;
  hi_fixup->next = iq2000_hi_fixup_list;

  iq2000_hi_fixup_list = hi_fixup;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void md_assemble ( char *  str)

Definition at line 332 of file tc-iq2000.c.

{
  static long delayed_load_register = 0;
  static int last_insn_had_delay_slot = 0;
  static int last_insn_has_load_delay = 0;
  static int last_insn_unconditional_jump = 0;
  static int last_insn_was_ldw = 0;

  iq2000_insn insn;
  char * errmsg;

  /* Initialize GAS's cgen interface for a new instruction.  */
  gas_cgen_init_parse ();

  insn.insn = iq2000_cgen_assemble_insn
      (gas_cgen_cpu_desc, str, & insn.fields, insn.buffer, & errmsg);

  if (!insn.insn)
    {
      as_bad ("%s", errmsg);
      return;
    }

  /* Doesn't really matter what we pass for RELAX_P here.  */
  gas_cgen_finish_insn (insn.insn, insn.buffer,
                     CGEN_FIELDS_BITSIZE (& insn.fields), 1, NULL);

  /* We need to generate an error if there's a yielding instruction in the delay
     slot of a control flow modifying instruction (jump (yes), load (no))  */
  if ((last_insn_had_delay_slot && !last_insn_has_load_delay) &&
      CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_YIELD_INSN))
      as_bad (_("the yielding instruction %s may not be in a delay slot."),
              CGEN_INSN_NAME (insn.insn));

  /* Warn about odd numbered base registers for paired-register
     instructions like LDW.  On iq2000, result is always rt.  */
  if (iq2000_mach == bfd_mach_iq2000
      && CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_EVEN_REG_NUM)
      && (insn.fields.f_rt % 2))
    as_bad (_("Register number (R%ld) for double word access must be even."),
           insn.fields.f_rt);

  /* Warn about insns that reference the target of a previous load.  */
  /* NOTE: R0 is a special case and is not subject to load delays (except for ldw).  */
  if (delayed_load_register && (last_insn_has_load_delay || last_insn_was_ldw))
    {
      if (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RD) &&
         insn.fields.f_rd == delayed_load_register)
       as_warn (_("operand references R%ld of previous load."),
               insn.fields.f_rd);

      if (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RS) &&
         insn.fields.f_rs == delayed_load_register)
       as_warn (_("operand references R%ld of previous load."),
               insn.fields.f_rs);

      if (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RT) &&
         insn.fields.f_rt == delayed_load_register)
       as_warn (_("operand references R%ld of previous load."),
               insn.fields.f_rt);

      if (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_R31) &&
         delayed_load_register == 31)
       as_warn (_("instruction implicitly accesses R31 of previous load."));
    }

  /* Warn about insns that reference the (target + 1) of a previous ldw.  */
  if (last_insn_was_ldw)
    {
      if ((CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RD)
           && insn.fields.f_rd == delayed_load_register + 1)
       || (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RS)
           && insn.fields.f_rs == delayed_load_register + 1)
       || (CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_USES_RT)
           && insn.fields.f_rt == delayed_load_register + 1))
        as_warn (_("operand references R%ld of previous load."),
                delayed_load_register + 1);
    }

  last_insn_had_delay_slot =
    CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_DELAY_SLOT);

  last_insn_has_load_delay =
    CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_LOAD_DELAY);

  if (last_insn_unconditional_jump)
    last_insn_has_load_delay = last_insn_unconditional_jump = 0;
  else if (! strcmp (CGEN_INSN_MNEMONIC (insn.insn), "j")
          || ! strcmp (CGEN_INSN_MNEMONIC (insn.insn), "jal"))
          last_insn_unconditional_jump = 1;

  /* The meaning of EVEN_REG_NUM was overloaded to also imply LDW.  Since
     that's not true for IQ10, let's make the above logic specific to LDW.  */
  last_insn_was_ldw = ! strcmp ("ldw", CGEN_INSN_NAME (insn.insn));

  /* The assumption here is that the target of a load is always rt.  */
  delayed_load_register = insn.fields.f_rt;
}

Here is the call graph for this function:

char* md_atof ( int type  ,
char *  litP,
int sizeP 
)

Definition at line 736 of file tc-iq2000.c.

{
  int              i;
  int              prec;
  LITTLENUM_TYPE   words [MAX_LITTLENUMS];
  char *           t;

  switch (type)
    {
    case 'f':
    case 'F':
    case 's':
    case 'S':
      prec = 2;
      break;

    case 'd':
    case 'D':
    case 'r':
    case 'R':
      prec = 4;
      break;

   /* FIXME: Some targets allow other format chars for bigger sizes here.  */

    default:
      * sizeP = 0;
      return _("Bad call to md_atof()");
    }

  t = atof_ieee (input_line_pointer, type, words);
  if (t)
    input_line_pointer = t;
  * sizeP = prec * sizeof (LITTLENUM_TYPE);

  for (i = 0; i < prec; i++)
    {
      md_number_to_chars (litP, (valueT) words[i],
                       sizeof (LITTLENUM_TYPE));
      litP += sizeof (LITTLENUM_TYPE);
    }

  return 0;
}

Here is the call graph for this function:

void md_begin ( void  )

Definition at line 307 of file tc-iq2000.c.

{
  /* Initialize the `cgen' interface.  */

  /* Set the machine number and endian.  */
  gas_cgen_cpu_desc = iq2000_cgen_cpu_open (CGEN_CPU_OPEN_MACHS, cpu_mach,
                                      CGEN_CPU_OPEN_ENDIAN,
                                      CGEN_ENDIAN_BIG,
                                      CGEN_CPU_OPEN_END);
  iq2000_cgen_init_asm (gas_cgen_cpu_desc);

  /* This is a callback from cgen to gas to parse operands.  */
  cgen_set_parse_operand_fn (gas_cgen_cpu_desc, gas_cgen_parse_operand);

  /* Set the ELF flags if desired.  */
  if (iq2000_flags)
    bfd_set_private_flags (stdoutput, iq2000_flags);

  /* Set the machine type */
  bfd_default_set_arch_mach (stdoutput, bfd_arch_iq2000, iq2000_mach);

  iq2000_load_macros ();
}

Here is the call graph for this function:

bfd_reloc_code_real_type md_cgen_lookup_reloc ( const CGEN_INSN *insn  ATTRIBUTE_UNUSED,
const CGEN_OPERAND operand,
fixS *fixP  ATTRIBUTE_UNUSED 
)

Definition at line 510 of file tc-iq2000.c.

void md_convert_frag ( bfd *abfd  ATTRIBUTE_UNUSED,
segT sec  ATTRIBUTE_UNUSED,
fragS *fragP  ATTRIBUTE_UNUSED 
)

Definition at line 480 of file tc-iq2000.c.

{
}
int md_estimate_size_before_relax ( fragS *  fragP,
segT segment  ATTRIBUTE_UNUSED 
)

Definition at line 458 of file tc-iq2000.c.

{
  int    old_fr_fix = fragP->fr_fix;

  /* The only thing we have to handle here are symbols outside of the
     current segment.  They may be undefined or in a different segment in
     which case linker scripts may place them anywhere.
     However, we can't finish the fragment here and emit the reloc as insn
     alignment requirements may move the insn about.  */

  return (fragP->fr_var + fragP->fr_fix - old_fr_fix);
}
void md_number_to_chars ( char *  buf,
valueT  val,
int  n 
)

Definition at line 714 of file tc-iq2000.c.

Here is the call graph for this function:

void md_operand ( expressionS exp)

Definition at line 720 of file tc-iq2000.c.

{
  /* In case of a syntax error, escape back to try next syntax combo.  */
  if (exp->X_op == O_absent)
    gas_cgen_md_operand (exp);
}

Here is the call graph for this function:

int md_parse_option ( int c  ATTRIBUTE_UNUSED,
char *arg  ATTRIBUTE_UNUSED 
)

Definition at line 120 of file tc-iq2000.c.

{
  return 0;
}
long md_pcrel_from_section ( fixS *  fixP,
segT sec   
)

Definition at line 490 of file tc-iq2000.c.

{
  if (fixP->fx_addsy != (symbolS *) NULL
      && (! S_IS_DEFINED (fixP->fx_addsy)
         || S_GET_SEGMENT (fixP->fx_addsy) != sec))
    {
      /* The symbol is undefined (or is defined but not in this section).
        Let the linker figure it out.  */
      return 0;
    }

  /* Return the address of the delay slot.  */
  return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address;
}

Here is the call graph for this function:

valueT md_section_align ( segT segment  ,
valueT size   
)

Definition at line 432 of file tc-iq2000.c.

{
  int align = bfd_get_section_alignment (stdoutput, segment);
  return ((size + (1 << align) - 1) & (-1 << align));
}

Here is the call graph for this function:

void md_show_usage ( FILE *stream  ATTRIBUTE_UNUSED)

Definition at line 127 of file tc-iq2000.c.

{
}
symbolS* md_undefined_symbol ( char *name  ATTRIBUTE_UNUSED)

Definition at line 439 of file tc-iq2000.c.

{
    return 0;
}
static void s_change_sec ( int  sec) [static]

Definition at line 817 of file tc-iq2000.c.

{
#ifdef OBJ_ELF
  /* The ELF backend needs to know that we are changing sections, so
     that .previous works correctly.  We could do something like check
     for a obj_section_change_hook macro, but that might be confusing
     as it would not be appropriate to use it in the section changing
     functions in read.c, since obj-elf.c intercepts those.  FIXME:
     This should be cleaner, somehow.  */
  obj_elf_section_change_hook ();
#endif

  switch (sec)
    {
    case 't':
      s_text (0);
      break;
    case 'd':
    case 'r':
      s_data (0);
      break;
    }
}

Here is the call graph for this function:

static void s_iq2000_end ( int x  ATTRIBUTE_UNUSED) [static]

Definition at line 858 of file tc-iq2000.c.

{
  symbolS *p;
  int maybe_text;

  if (!is_end_of_line[(unsigned char) *input_line_pointer])
    {
      p = get_symbol ();
      demand_empty_rest_of_line ();
    }
  else
    p = NULL;

  if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0)
    maybe_text = 1;
  else
    maybe_text = 0;

  if (!maybe_text)
    as_warn (_(".end not in text section"));

  if (!cur_proc_ptr)
    {
      as_warn (_(".end directive without a preceding .ent directive."));
      demand_empty_rest_of_line ();
      return;
    }

  if (p != NULL)
    {
      assert (S_GET_NAME (p));
      if (strcmp (S_GET_NAME (p), S_GET_NAME (cur_proc_ptr->isym)))
       as_warn (_(".end symbol does not match .ent symbol."));
    }
  else
    as_warn (_(".end directive missing or unknown symbol"));

  cur_proc_ptr = NULL;
}

Here is the call graph for this function:

static void s_iq2000_ent ( int  aent) [static]

Definition at line 958 of file tc-iq2000.c.

{
  int number = 0;
  symbolS *symbolP;
  int maybe_text;

  symbolP = get_symbol ();
  if (*input_line_pointer == ',')
    input_line_pointer++;
  SKIP_WHITESPACE ();
  if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-')
    number = get_number ();

  if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0)
    maybe_text = 1;
  else
    maybe_text = 0;

  if (!maybe_text)
    as_warn (_(".ent or .aent not in text section."));

  if (!aent && cur_proc_ptr)
    as_warn (_("missing `.end'"));

  if (!aent)
    {
      cur_proc_ptr = &cur_proc;
      memset (cur_proc_ptr, '\0', sizeof (procS));

      cur_proc_ptr->isym = symbolP;

      symbol_get_bfdsym (symbolP)->flags |= BSF_FUNCTION;

      numprocs++;
    }

  demand_empty_rest_of_line ();
}

Here is the call graph for this function:

static void s_iq2000_frame ( int  ignore) [static]

Definition at line 1004 of file tc-iq2000.c.

{
  s_ignore (ignore);
}

Here is the call graph for this function:

static void s_iq2000_mask ( int  reg_type) [static]

Definition at line 1016 of file tc-iq2000.c.

Here is the call graph for this function:

static void s_iq2000_set ( int x  ATTRIBUTE_UNUSED) [static]

Definition at line 670 of file tc-iq2000.c.

{
  static const char * ignored_arguments [] =
    {
      "reorder",
      "noreorder",
      "at",
      "noat",
      "macro",
      "nomacro",
      "move",
      "novolatile",
      "nomove",
      "volatile",
      "bopt",
      "nobopt",
      NULL
    };
  const char ** ignored;
  char *name = input_line_pointer, ch;
  char *save_ILP = input_line_pointer;

  while (!is_end_of_line[(unsigned char) *input_line_pointer])
    input_line_pointer++;
  ch = *input_line_pointer;
  *input_line_pointer = '\0';

  for (ignored = ignored_arguments; * ignored; ignored ++)
    if (strcmp (* ignored, name) == 0)
      break;
  if (* ignored == NULL)
    {
      /* We'd like to be able to use .set symbol, expn */
      input_line_pointer = save_ILP;
      s_set (0);
      return;
    }
  *input_line_pointer = ch;
  demand_empty_rest_of_line ();
}

Here is the call graph for this function:


Variable Documentation

const char* abs_args[] = { "rd", "rs", "scratch=%1", NULL } [static]

Definition at line 140 of file tc-iq2000.c.

const char* abs_expn = "\n sra \\rd,\\rs,31\n xor \\scratch,\\rd,\\rs\n sub \\rd,\\scratch,\\rd\n" [static]

Definition at line 141 of file tc-iq2000.c.

const char* ai32_args[] = { "rt", "rs", "imm", NULL } [static]

Definition at line 162 of file tc-iq2000.c.

const char* andi32_expn [static]
Initial value:
"\n\
 .if (\\imm & 0xffff0000 == 0xffff0000)\n\
 andoi \\rt,\\rs,%lo(\\imm)\n\
 .elseif (\\imm & 0x0000ffff == 0x0000ffff)\n\
 andoui \\rt,\\rs,%uhi(\\imm)\n\
 .elseif (\\imm & 0xffff0000 == 0x00000000)\n\
 andi \\rt,\\rs,%lo(\\imm)\n\
 .else\n\
 andoui \\rt,\\rs,%uhi(\\imm)\n\
 andoi \\rt,\\rt,%lo(\\imm)\n\
 .endif\n"

Definition at line 163 of file tc-iq2000.c.

const char* bge_expn = "\n slt \\scratch,\\rs,\\rt\n beq %0,\\scratch,\\label\n" [static]

Definition at line 145 of file tc-iq2000.c.

const char* bgeu_expn = "\n sltu \\scratch,\\rs,\\rt\n beq %0,\\scratch,\\label\n" [static]

Definition at line 146 of file tc-iq2000.c.

const char* bgt_expn = "\n slt \\scratch,\\rt,\\rs\n bne %0,\\scratch,\\label\n" [static]

Definition at line 147 of file tc-iq2000.c.

const char* bgtu_expn = "\n sltu \\scratch,\\rt,\\rs\n bne %0,\\scratch,\\label\n" [static]

Definition at line 148 of file tc-iq2000.c.

const char* ble_expn = "\n slt \\scratch,\\rt,\\rs\n beq %0,\\scratch,\\label\n" [static]

Definition at line 149 of file tc-iq2000.c.

const char* bleu_expn = "\n sltu \\scratch,\\rt,\\rs\n beq %0,\\scratch,\\label\n" [static]

Definition at line 150 of file tc-iq2000.c.

const char* blt_expn = "\n slt \\scratch,\\rs,\\rt\n bne %0,\\scratch,\\label\n" [static]

Definition at line 151 of file tc-iq2000.c.

const char* bltu_expn = "\n sltu \\scratch,\\rs,\\rt\n bne %0,\\scratch,\\label\n" [static]

Definition at line 152 of file tc-iq2000.c.

const char* bxx_args[] = { "rs", "rt", "label", "scratch=%1", NULL } [static]

Definition at line 144 of file tc-iq2000.c.

const char comment_chars[] = "#"

Definition at line 56 of file tc-iq2000.c.

int cpu_mach = (1 << MACH_IQ2000) [static]

Definition at line 67 of file tc-iq2000.c.

procS cur_proc [static]

Definition at line 84 of file tc-iq2000.c.

procS* cur_proc_ptr [static]

Definition at line 85 of file tc-iq2000.c.

const char EXP_CHARS[] = "eE"

Definition at line 59 of file tc-iq2000.c.

const char FLT_CHARS[] = "dD"

Definition at line 60 of file tc-iq2000.c.

Definition at line 70 of file tc-iq2000.c.

Definition at line 107 of file tc-iq2000.c.

Definition at line 66 of file tc-iq2000.c.

Initial value:
{
  {"abs",   (const char **) & abs_expn,   (const char **) & abs_args},
  {"la",    (const char **) & la_expn,    (const char **) & la_args},
  {"bge",   (const char **) & bge_expn,   (const char **) & bxx_args},
  {"bgeu",  (const char **) & bgeu_expn,  (const char **) & bxx_args},
  {"bgt",   (const char **) & bgt_expn,   (const char **) & bxx_args},
  {"bgtu",  (const char **) & bgtu_expn,  (const char **) & bxx_args},
  {"ble",   (const char **) & ble_expn,   (const char **) & bxx_args},
  {"bleu",  (const char **) & bleu_expn,  (const char **) & bxx_args},
  {"blt",   (const char **) & blt_expn,   (const char **) & bxx_args},
  {"bltu",  (const char **) & bltu_expn,  (const char **) & bxx_args},
  {"sge",   (const char **) & sge_expn,   (const char **) & sxx_args},
  {"sgeu",  (const char **) & sgeu_expn,  (const char **) & sxx_args},
  {"sle",   (const char **) & sle_expn,   (const char **) & sxx_args},
  {"sleu",  (const char **) & sleu_expn,  (const char **) & sxx_args},
  {"sgt",   (const char **) & sgt_expn,   (const char **) & sxx_args},
  {"sgtu",  (const char **) & sgtu_expn,  (const char **) & sxx_args},
  {"seq",   (const char **) & seq_expn,   (const char **) & sxx_args},
  {"sne",   (const char **) & sne_expn,   (const char **) & sxx_args},
  {"neg",   (const char **) & neg_expn,   (const char **) & neg_args},
  {"negu",  (const char **) & negu_expn,  (const char **) & neg_args},
  {"li",    (const char **) & li_expn,    (const char **) & li_args},
  {"ori32", (const char **) & ori32_expn, (const char **) & ai32_args},
  {"andi32",(const char **) & andi32_expn,(const char **) & ai32_args},
}

Definition at line 200 of file tc-iq2000.c.

const char* la_args[] = { "reg", "label", NULL } [static]

Definition at line 143 of file tc-iq2000.c.

const char* la_expn = "\n lui \\reg,%hi(\\label)\n ori \\reg,\\reg,%lo(\\label)\n" [static]

Definition at line 142 of file tc-iq2000.c.

const char* li_args[] = { "rt", "imm", NULL } [static]

Definition at line 187 of file tc-iq2000.c.

const char* li_expn [static]
Initial value:
"\n\
 .if (\\imm & 0xffff0000 == 0x0)\n\
 ori \\rt,%0,\\imm\n\
 .elseif (\\imm & 0xffff0000 == 0xffff0000)\n\
 addi \\rt,%0,\\imm\n\
 .elseif (\\imm & 0x0000ffff == 0)\n\
 lui \\rt,%uhi(\\imm)\n\
 .else\n\
 lui \\rt,%uhi(\\imm)\n\
 ori \\rt,\\rt,%lo(\\imm)\n\
 .endif\n"

Definition at line 188 of file tc-iq2000.c.

const char line_comment_chars[] = "#"

Definition at line 57 of file tc-iq2000.c.

Definition at line 58 of file tc-iq2000.c.

Definition at line 63 of file macro.c.

size_t md_longopts_size = sizeof (md_longopts)

Definition at line 117 of file tc-iq2000.c.

const pseudo_typeS md_pseudo_table[]
Initial value:
{
    { "align",  s_align_bytes,           0 },
    { "word",   cons,                    4 },
    { "rdata",  s_change_sec,             'r'},
    { "sdata",  s_change_sec,             's'},
    { "set",  s_iq2000_set,         0 },
    { "ent",    s_iq2000_ent,              0 },
    { "end",    s_iq2000_end,            0 },
    { "frame",  s_iq2000_frame,     0 },
    { "fmask",  s_iq2000_mask,            'F'},
    { "mask",   s_iq2000_mask,            'R'},
    { "dword",       cons,                 8 },
    { "half", cons,                 2 },
    { NULL,   NULL,                 0 }
}

Definition at line 1022 of file tc-iq2000.c.

const char* md_shortopts = ""

Definition at line 112 of file tc-iq2000.c.

const char* neg_args[] = { "rd", "rs", NULL } [static]

Definition at line 184 of file tc-iq2000.c.

const char* neg_expn = "\n sub \\rd,%0,\\rs\n" [static]

Definition at line 185 of file tc-iq2000.c.

const char* negu_expn = "\n subu \\rd,%0,\\rs\n" [static]

Definition at line 186 of file tc-iq2000.c.

int numprocs [static]

Definition at line 86 of file tc-iq2000.c.

const char* ori32_expn [static]
Initial value:
"\n\
 .if (\\imm & 0xffff == 0)\n\
 orui \\rt,\\rs,%uhi(\\imm)\n\
 .elseif (\\imm & 0xffff0000 == 0)\n\
 ori \\rt,\\rs,%lo(\\imm)\n\
 .else\n\
 orui \\rt,\\rs,%uhi(\\imm)\n\
 ori \\rt,\\rt,%lo(\\imm)\n\
 .endif\n"

Definition at line 174 of file tc-iq2000.c.

const char* seq_expn = "\n xor \\rd,\\rt,\\rs\n sltu \\rd,%0,\\rd\n xori \\rd,\\rd,1\n" [static]

Definition at line 161 of file tc-iq2000.c.

const char* sge_expn = "\n slt \\rd,\\rs,\\rt\n xori \\rd,\\rd,1\n" [static]

Definition at line 154 of file tc-iq2000.c.

const char* sgeu_expn = "\n sltu \\rd,\\rs,\\rt\n xori \\rd,\\rd,1\n" [static]

Definition at line 155 of file tc-iq2000.c.

const char* sgt_expn = "\n slt \\rd,\\rt,\\rs\n" [static]

Definition at line 158 of file tc-iq2000.c.

const char* sgtu_expn = "\n sltu \\rd,\\rt,\\rs\n" [static]

Definition at line 159 of file tc-iq2000.c.

const char* sle_expn = "\n slt \\rd,\\rt,\\rs\n xori \\rd,\\rd,1\n" [static]

Definition at line 156 of file tc-iq2000.c.

const char* sleu_expn = "\n sltu \\rd,\\rt,\\rs\n xori \\rd,\\rd,1\n" [static]

Definition at line 157 of file tc-iq2000.c.

const char* sne_expn = "\n xor \\rd,\\rt,\\rs\n sltu \\rd,%0,\\rd\n" [static]

Definition at line 160 of file tc-iq2000.c.

const char* sxx_args[] = { "rd", "rs", "rt", NULL } [static]

Definition at line 153 of file tc-iq2000.c.