OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [gas/] [config/] [tc-rl78.c] - Diff between revs 163 and 166

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 163 Rev 166
Line 79... Line 79...
  char times_shrank;
  char times_shrank;
} rl78_bytesT;
} rl78_bytesT;
 
 
static rl78_bytesT rl78_bytes;
static rl78_bytesT rl78_bytes;
 
 
 
void
 
rl78_linkrelax_addr16 (void)
 
{
 
  rl78_bytes.link_relax |= RL78_RELAXA_ADDR16;
 
}
 
 
 
void
 
rl78_linkrelax_branch (void)
 
{
 
  rl78_bytes.link_relax |= RL78_RELAXA_BRA;
 
}
 
 
static void
static void
rl78_fixup (expressionS exp, int offsetbits, int nbits, int type)
rl78_fixup (expressionS exp, int offsetbits, int nbits, int type)
{
{
  rl78_bytes.fixups[rl78_bytes.n_fixups].exp = exp;
  rl78_bytes.fixups[rl78_bytes.n_fixups].exp = exp;
  rl78_bytes.fixups[rl78_bytes.n_fixups].offset = offsetbits;
  rl78_bytes.fixups[rl78_bytes.n_fixups].offset = offsetbits;
Line 238... Line 250...
  rl78_bytes.base[bytep] |= valm;
  rl78_bytes.base[bytep] |= valm;
}
}
 
 
/*------------------------------------------------------------------*/
/*------------------------------------------------------------------*/
 
 
 
enum options
 
{
 
  OPTION_RELAX = OPTION_MD_BASE,
 
};
 
 
#define RL78_SHORTOPTS ""
#define RL78_SHORTOPTS ""
const char * md_shortopts = RL78_SHORTOPTS;
const char * md_shortopts = RL78_SHORTOPTS;
 
 
/* Assembler options.  */
/* Assembler options.  */
struct option md_longopts[] =
struct option md_longopts[] =
{
{
 
  {"relax", no_argument, NULL, OPTION_RELAX},
  {NULL, no_argument, NULL, 0}
  {NULL, no_argument, NULL, 0}
};
};
size_t md_longopts_size = sizeof (md_longopts);
size_t md_longopts_size = sizeof (md_longopts);
 
 
int
int
md_parse_option (int c ATTRIBUTE_UNUSED, char * arg ATTRIBUTE_UNUSED)
md_parse_option (int c, char * arg ATTRIBUTE_UNUSED)
 
{
 
  switch (c)
{
{
 
    case OPTION_RELAX:
 
      linkrelax = 1;
 
      return 1;
 
 
 
    }
  return 0;
  return 0;
}
}
 
 
void
void
md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
Line 346... Line 371...
}
}
 
 
void
void
rl78_frag_init (fragS * fragP)
rl78_frag_init (fragS * fragP)
{
{
 
  if (rl78_bytes.n_relax || rl78_bytes.link_relax)
 
    {
 
      fragP->tc_frag_data = malloc (sizeof (rl78_bytesT));
 
      memcpy (fragP->tc_frag_data, & rl78_bytes, sizeof (rl78_bytesT));
 
    }
 
  else
  fragP->tc_frag_data = 0;
  fragP->tc_frag_data = 0;
}
}
 
 
 
/* When relaxing, we need to output a reloc for any .align directive
 
   so that we can retain this alignment as we adjust opcode sizes.  */
 
void
 
rl78_handle_align (fragS * frag)
 
{
 
  if (linkrelax
 
      && (frag->fr_type == rs_align
 
          || frag->fr_type == rs_align_code)
 
      && frag->fr_address + frag->fr_fix > 0
 
      && frag->fr_offset > 0
 
      && now_seg != bss_section)
 
    {
 
      fix_new (frag, frag->fr_fix, 0,
 
               &abs_symbol, RL78_RELAXA_ALIGN + frag->fr_offset,
 
               0, BFD_RELOC_RL78_RELAX);
 
      /* For the purposes of relaxation, this relocation is attached
 
         to the byte *after* the alignment - i.e. the byte that must
 
         remain aligned.  */
 
      fix_new (frag->fr_next, 0, 0,
 
               &abs_symbol, RL78_RELAXA_ELIGN + frag->fr_offset,
 
               0, BFD_RELOC_RL78_RELAX);
 
    }
 
}
 
 
char *
char *
md_atof (int type, char * litP, int * sizeP)
md_atof (int type, char * litP, int * sizeP)
{
{
  return ieee_md_atof (type, litP, sizeP, target_big_endian);
  return ieee_md_atof (type, litP, sizeP, target_big_endian);
}
}
Line 389... Line 444...
 
 
  rl78_lex_init (str, str + strlen (str));
  rl78_lex_init (str, str + strlen (str));
 
 
  rl78_parse ();
  rl78_parse ();
 
 
 
  /* This simplifies the relaxation code.  */
 
  if (rl78_bytes.link_relax)
 
    {
 
      int olen = rl78_bytes.n_prefix + rl78_bytes.n_base + rl78_bytes.n_ops;
 
      /* We do it this way because we want the frag to have the
 
         rl78_bytes in it, which we initialize above.  */
 
      bytes = frag_more (olen);
 
      frag_then = frag_now;
 
      frag_variant (rs_machine_dependent,
 
                    olen /* max_chars */,
 
                    0 /* var */,
 
                    olen /* subtype */,
 
                    0 /* symbol */,
 
                    0 /* offset */,
 
                    0 /* opcode */);
 
      frag_then->fr_opcode = bytes;
 
      frag_then->fr_fix = olen + (bytes - frag_then->fr_literal);
 
      frag_then->fr_subtype = olen;
 
      frag_then->fr_var = 0;
 
    }
 
  else
 
    {
  bytes = frag_more (rl78_bytes.n_prefix + rl78_bytes.n_base + rl78_bytes.n_ops);
  bytes = frag_more (rl78_bytes.n_prefix + rl78_bytes.n_base + rl78_bytes.n_ops);
  frag_then = frag_now;
  frag_then = frag_now;
 
    }
 
 
  APPEND (prefix, n_prefix);
  APPEND (prefix, n_prefix);
  APPEND (base, n_base);
  APPEND (base, n_base);
  APPEND (ops, n_ops);
  APPEND (ops, n_ops);
 
 
 
  if (rl78_bytes.link_relax)
 
    {
 
      fixS * f;
 
 
 
      f = fix_new (frag_then,
 
                   (char *) bytes - frag_then->fr_literal,
 
                   0,
 
                   abs_section_sym,
 
                   rl78_bytes.link_relax | rl78_bytes.n_fixups,
 
                   0,
 
                   BFD_RELOC_RL78_RELAX);
 
      frag_then->tc_frag_data->link_relax_fixP = f;
 
    }
 
 
  for (i = 0; i < rl78_bytes.n_fixups; i ++)
  for (i = 0; i < rl78_bytes.n_fixups; i ++)
    {
    {
      /* index: [nbytes][type] */
      /* index: [nbytes][type] */
      static int reloc_map[5][4] =
      static int reloc_map[5][4] =
        {
        {
Line 475... Line 567...
int
int
md_estimate_size_before_relax (fragS * fragP ATTRIBUTE_UNUSED, segT segment ATTRIBUTE_UNUSED)
md_estimate_size_before_relax (fragS * fragP ATTRIBUTE_UNUSED, segT segment ATTRIBUTE_UNUSED)
{
{
  return 0;
  return 0;
}
}
 
 
arelent **
arelent **
tc_gen_reloc (asection * seg ATTRIBUTE_UNUSED, fixS * fixp)
tc_gen_reloc (asection * seg ATTRIBUTE_UNUSED, fixS * fixp)
{
{
  static arelent * reloc[8];
  static arelent * reloc[8];
  int rp;
  int rp;
Line 646... Line 739...
  switch (f->fx_r_type)
  switch (f->fx_r_type)
    {
    {
    case BFD_RELOC_NONE:
    case BFD_RELOC_NONE:
      break;
      break;
 
 
 
    case BFD_RELOC_RL78_RELAX:
 
      f->fx_done = 1;
 
      break;
 
 
    case BFD_RELOC_8:
    case BFD_RELOC_8:
    case BFD_RELOC_8_PCREL:
    case BFD_RELOC_8_PCREL:
      op[0] = val;
      op[0] = val;
      break;
      break;
 
 
Line 694... Line 791...
md_convert_frag (bfd *   abfd ATTRIBUTE_UNUSED,
md_convert_frag (bfd *   abfd ATTRIBUTE_UNUSED,
                 segT    segment ATTRIBUTE_UNUSED,
                 segT    segment ATTRIBUTE_UNUSED,
                 fragS * fragP ATTRIBUTE_UNUSED)
                 fragS * fragP ATTRIBUTE_UNUSED)
{
{
  /* No relaxation yet */
  /* No relaxation yet */
 
  fragP->fr_var = 0;
}
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.