Back to index

cell-binutils  2.17cvs20070401
Defines | Functions | Variables
cpu-m68k.c File Reference
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "opcode/m68k.h"

Go to the source code of this file.

Defines

#define N(name, print, d, next)   { 32, 32, 8, bfd_arch_m68k, name, "m68k",print,2,d,bfd_m68k_compatible,bfd_default_scan, next, }

Functions

static const bfd_arch_info_typebfd_m68k_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
static unsigned bit_count (unsigned mask)
unsigned bfd_m68k_mach_to_features (int mach)
int bfd_m68k_features_to_mach (unsigned features)

Variables

static const bfd_arch_info_type arch_info_struct []
const bfd_arch_info_type bfd_m68k_arch
static const unsigned m68k_arch_features []

Define Documentation

#define N (   name,
  print,
  d,
  next 
)    { 32, 32, 8, bfd_arch_m68k, name, "m68k",print,2,d,bfd_m68k_compatible,bfd_default_scan, next, }

Definition at line 31 of file cpu-m68k.c.


Function Documentation

Definition at line 190 of file cpu-m68k.c.

{
  if (a->arch != b->arch)
    return NULL;

  if (a->bits_per_word != b->bits_per_word)
    return NULL;

  if (!a->mach)
    return b;
  if (!b->mach)
    return a;
  
  if (a->mach <= bfd_mach_m68060 && b->mach <= bfd_mach_m68060)
    /* Merge m68k machine. */
    return a->mach > b->mach ? a : b;
  else if (a->mach >= bfd_mach_cpu32 && b->mach >= bfd_mach_cpu32)
    {
      /* Merge the machine features.  */
      unsigned features = (bfd_m68k_mach_to_features (a->mach)
                        | bfd_m68k_mach_to_features (b->mach));

      /* CPU32 and Coldfire are incompatible.  */
      if ((~features & (cpu32 | mcfisa_a)) == 0)
       return NULL;

      /* Fido and Coldfire are incompatible.  */
      if ((~features & (fido_a | mcfisa_a)) == 0)
       return NULL;

      /* ISA A+ and ISA B are incompatible.  */
      if ((~features & (mcfisa_aa | mcfisa_b)) == 0)
       return NULL;

      /* MAC and EMAC code cannot be merged.  */
      if ((~features & (mcfmac | mcfemac)) == 0)
       return NULL;

      /* CPU32 is compatible with Fido except that Fido does not
        support tbl instructions.  Warn when the user wants to mix
        the two.  */
      if ((a->mach == bfd_mach_cpu32 && b->mach == bfd_mach_fido)
         || (a->mach == bfd_mach_fido && b->mach == bfd_mach_cpu32))
       {
         static int cpu32_fido_mix_warning;
         if (!cpu32_fido_mix_warning)
           {
             cpu32_fido_mix_warning = 1;
             (*_bfd_error_handler) ("warning: linking CPU32 objects with fido objects");
           }
         return bfd_lookup_arch (a->arch,
                              bfd_m68k_features_to_mach (fido_a | m68881));
       }

      return bfd_lookup_arch (a->arch, bfd_m68k_features_to_mach (features));
    }
  else
    /* They are incompatible.  */
    return NULL;
}

Here is the call graph for this function:

Definition at line 158 of file cpu-m68k.c.

{
  int superset = 0, subset = 0;
  unsigned extra = 99, missing = 99;
  unsigned ix;

  for (ix = 0;
       ix != sizeof (m68k_arch_features) / sizeof (m68k_arch_features[0]);
       ix++)
    {
      unsigned this_extra, this_missing;
      
      if (m68k_arch_features[ix] == features)
       return ix;
      this_extra = bit_count (m68k_arch_features[ix] & ~features);
      if (this_extra < extra)
       {
         extra = this_extra;
         superset = ix;
       }
      
      this_missing = bit_count (features & ~m68k_arch_features[ix]);
      if (this_missing < missing)
       {
         missing = this_missing;
         superset = ix;
       }
    }
  return superset ? superset : subset;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 145 of file cpu-m68k.c.

{
  if ((unsigned)mach
      >= sizeof (m68k_arch_features) / sizeof (m68k_arch_features[0]))
    mach = 0;
  return m68k_arch_features[mach];
}

Here is the caller graph for this function:

static unsigned bit_count ( unsigned  mask) [static]

Definition at line 132 of file cpu-m68k.c.

{
  unsigned ix;

  for (ix = 0; mask; ix++)
    /* Clear the LSB set */
    mask ^= mask & -mask;
  return ix;
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 34 of file cpu-m68k.c.

Initial value:
  N(0, "m68k", TRUE, &arch_info_struct[0])

Definition at line 95 of file cpu-m68k.c.