Back to index

cell-binutils  2.17cvs20070401
Classes | Defines | Typedefs | Functions | Variables
tc-openrisc.c File Reference
#include "as.h"
#include "subsegs.h"
#include "symcat.h"
#include "opcodes/openrisc-desc.h"
#include "opcodes/openrisc-opc.h"
#include "cgen.h"

Go to the source code of this file.

Classes

struct  openrisc_insn

Defines

#define INSN_VALUE(buf)   (buf)
#define OPENRISC_SHORTOPTS   "m:"
#define MAX_LITTLENUMS   6

Typedefs

typedef struct openrisc_insn

Functions

int md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
void md_show_usage (FILE *stream ATTRIBUTE_UNUSED)
static void ignore_pseudo (int val ATTRIBUTE_UNUSED)
void md_begin (void)
void md_assemble (char *str)
void md_operand (expressionS *expressionP)
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)
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)
void md_number_to_chars (char *buf, valueT val, int n)
char * md_atof (int type, char *litP, int *sizeP)
bfd_boolean openrisc_fix_adjustable (fixS *fixP)

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"
const char * md_shortopts = OPENRISC_SHORTOPTS
size_t md_longopts_size = sizeof (md_longopts)
unsigned long openrisc_machine = 0
const char openrisc_comment_chars [] = ";#"
const pseudo_typeS md_pseudo_table []
const relax_typeS md_relax_table []

Class Documentation

struct openrisc_insn

Definition at line 33 of file tc-openrisc.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

Define Documentation

#define INSN_VALUE (   buf)    (buf)

Definition at line 43 of file tc-openrisc.c.

#define MAX_LITTLENUMS   6

Definition at line 345 of file tc-openrisc.c.

#define OPENRISC_SHORTOPTS   "m:"

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


Typedef Documentation

Definition at line 31 of file tc-openrisc.c.


Function Documentation

static void ignore_pseudo ( int val  ATTRIBUTE_UNUSED) [static]

Definition at line 83 of file tc-openrisc.c.

void md_assemble ( char *  str)

Definition at line 118 of file tc-openrisc.c.

{
  static int last_insn_had_delay_slot = 0;
  openrisc_insn insn;
  char *    errmsg;

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

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

  if (!insn.insn)
    {
      as_bad (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);

  last_insn_had_delay_slot
    = CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_DELAY_SLOT);
}

Here is the call graph for this function:

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

Definition at line 348 of file tc-openrisc.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 102 of file tc-openrisc.c.

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

  /* Set the machine number and endian.  */
  gas_cgen_cpu_desc = openrisc_cgen_cpu_open (CGEN_CPU_OPEN_MACHS, 0,
                                              CGEN_CPU_OPEN_ENDIAN,
                                              CGEN_ENDIAN_BIG,
                                              CGEN_CPU_OPEN_END);
  openrisc_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);
}

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 
)

Definition at line 296 of file tc-openrisc.c.

{
  bfd_reloc_code_real_type type;

  switch (operand->type)
    {
    case OPENRISC_OPERAND_ABS_26:
      fixP->fx_pcrel = 0;
      type = BFD_RELOC_OPENRISC_ABS_26;
      goto emit;
    case OPENRISC_OPERAND_DISP_26:
      fixP->fx_pcrel = 1;
      type = BFD_RELOC_OPENRISC_REL_26;
      goto emit;

    case OPENRISC_OPERAND_HI16:
      type = BFD_RELOC_HI16;
      goto emit;

    case OPENRISC_OPERAND_LO16:
      type = BFD_RELOC_LO16;
      goto emit;

    emit:
      return type;

    default : /* avoid -Wall warning */
      break;
    }

  return BFD_RELOC_NONE;
}

Here is the call graph for this function:

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

Definition at line 264 of file tc-openrisc.c.

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

Definition at line 214 of file tc-openrisc.c.

{
  /* 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.  */

  if (S_GET_SEGMENT (fragP->fr_symbol) != segment)
    {
      /* The symbol is undefined in this segment.
        Change the relaxation subtype to the max allowable and leave
        all further handling to md_convert_frag.  */
      fragP->fr_subtype = 2;

      {
       const CGEN_INSN * insn;
       int               i;

       /* Update the recorded insn.
          Fortunately we don't have to look very far.
          FIXME: Change this to record in the instruction the next higher
          relaxable insn to use.  */
       for (i = 0, insn = fragP->fr_cgen.insn; i < 4; i++, insn++)
         {
           if ((strcmp (CGEN_INSN_MNEMONIC (insn),
                      CGEN_INSN_MNEMONIC (fragP->fr_cgen.insn))
               == 0)
              && CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXED))
             break;
         }
       if (i == 4)
         abort ();

       fragP->fr_cgen.insn = insn;
       return 2;
      }
    }

  return md_relax_table[fragP->fr_subtype].rlx_length;
}

Here is the call graph for this function:

void md_number_to_chars ( char *  buf,
valueT  val,
int  n 
)

Definition at line 334 of file tc-openrisc.c.

Here is the call graph for this function:

void md_operand ( expressionS expressionP)

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

{
  if (* input_line_pointer == '#')
    {
      input_line_pointer ++;
      expression (expressionP);
    }
}
int md_parse_option ( int c  ATTRIBUTE_UNUSED,
char *arg  ATTRIBUTE_UNUSED 
)

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

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

Definition at line 278 of file tc-openrisc.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 (fixP->fx_frag->fr_address + fixP->fx_where) & ~1;
}

Here is the call graph for this function:

valueT md_section_align ( segT segment  ,
valueT size   
)

Definition at line 159 of file tc-openrisc.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 78 of file tc-openrisc.c.

{
}
symbolS* md_undefined_symbol ( char *name  ATTRIBUTE_UNUSED)

Definition at line 166 of file tc-openrisc.c.

{
  return 0;
}

Definition at line 394 of file tc-openrisc.c.

{
  /* We need the symbol name for the VTABLE entries.  */
  if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
      || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
    return 0;

  return 1;
}

Variable Documentation

const char comment_chars[] = "#"

Definition at line 53 of file tc-openrisc.c.

const char EXP_CHARS[] = "eE"

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

const char FLT_CHARS[] = "dD"

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

const char line_comment_chars[] = "#"

Definition at line 54 of file tc-openrisc.c.

Definition at line 55 of file tc-openrisc.c.

size_t md_longopts_size = sizeof (md_longopts)

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

const pseudo_typeS md_pseudo_table[]
Initial value:
{
  { "word",     cons,           4 },
  { "proc",     ignore_pseudo,  0 },
  { "endproc",  ignore_pseudo,  0 },
  { NULL,     NULL,         0 }
}

Definition at line 91 of file tc-openrisc.c.

const relax_typeS md_relax_table[]
Initial value:
{


  
  {1, 1, 0, 0},

  
  
  {511 - 2 - 2, -512 - 2 + 2, 0, 2 },
  
  {0x2000000 - 1 - 2, -0x2000000 - 2, 2, 0 },
  
  {0x2000000 - 1 - 2, -0x2000000 - 2, 4, 0 }
}

Definition at line 176 of file tc-openrisc.c.

Definition at line 61 of file tc-openrisc.c.

Definition at line 88 of file tc-openrisc.c.

Definition at line 69 of file tc-openrisc.c.