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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [opcodes/] [z8kgen.c] - Diff between revs 157 and 225

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

Rev 157 Rev 225
Line 1... Line 1...
/* Copyright 2001, 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
/* Copyright 2001, 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
 
 
   This file is part of the GNU opcodes library.
   This file is part of the GNU opcodes library.
 
 
   This library is free software; you can redistribute it and/or modify
   This library is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
Line 565... Line 565...
  return r;
  return r;
 
 
}
}
 
 
static int
static int
func (struct op *a, struct op *b)
func (const void *p1, const void *p2)
{
{
  return strcmp ((a)->name, (b)->name);
  const struct op *a = p1;
 
  const struct op *b = p2;
 
  int ret = strcmp (a->name, b->name);
 
  if (ret != 0)
 
    return ret;
 
  return p1 > p2 ? 1 : -1;
}
}
 
 
 
 
/* opcode
/* opcode
 
 
Line 902... Line 907...
 
 
static void
static void
internal (void)
internal (void)
{
{
  int c = count ();
  int c = count ();
  struct op *new = xmalloc (sizeof (struct op) * c);
  struct op *new_op = xmalloc (sizeof (struct op) * c);
  struct op *p = opt;
  struct op *p = opt;
  memcpy (new, p, c * sizeof (struct op));
  memcpy (new_op, p, c * sizeof (struct op));
 
 
  /* Sort all names in table alphabetically.  */
  /* Sort all names in table alphabetically.  */
  qsort (new, c, sizeof (struct op), (int (*)(const void *, const void *))func);
  qsort (new_op, c, sizeof (struct op), func);
 
 
  p = new;
  p = new_op;
  while (p->flags && p->flags[0] != '*')
  while (p->flags && p->flags[0] != '*')
  {
  {
    /* If there are any @rs, sub the ssss into a ssn0, (rs), (ssn0).  */
    /* If there are any @rs, sub the ssss into a ssn0, (rs), (ssn0).  */
    int loop = 1;
    int loop = 1;
 
 
Line 958... Line 963...
{
{
  int c = count ();
  int c = count ();
  struct op *p = opt;
  struct op *p = opt;
  int idx = -1;
  int idx = -1;
  char *oldname = "";
  char *oldname = "";
  struct op *new = xmalloc (sizeof (struct op) * c);
  struct op *new_op = xmalloc (sizeof (struct op) * c);
 
 
  memcpy (new, p, c * sizeof (struct op));
  memcpy (new_op, p, c * sizeof (struct op));
 
 
  /* Sort all names in table alphabetically.  */
  /* Sort all names in table alphabetically.  */
  qsort (new, c, sizeof (struct op), (int (*)(const void *, const void *)) func);
  qsort (new_op, c, sizeof (struct op), func);
 
 
  printf ("/* DO NOT EDIT!  -*- buffer-read-only: t -*-\n");
  printf ("/* DO NOT EDIT!  -*- buffer-read-only: t -*-\n");
  printf ("   This file is automatically generated by z8kgen.  */\n\n");
  printf ("   This file is automatically generated by z8kgen.  */\n\n");
  printf ("/* Copyright 2007 Free Software Foundation, Inc.\n\
  printf ("/* Copyright 2007, 2009 Free Software Foundation, Inc.\n\
\n\
\n\
/* This file is part of the GNU opcodes library.\n\
   This file is part of the GNU opcodes library.\n\
\n\
\n\
   This library is free software; you can redistribute it and/or modify\n\
   This library is free software; you can redistribute it and/or modify\n\
   it under the terms of the GNU General Public License as published by\n\
   it under the terms of the GNU General Public License as published by\n\
   the Free Software Foundation; either version 3, or (at your option)\n\
   the Free Software Foundation; either version 3, or (at your option)\n\
   any later version.\n\
   any later version.\n\
Line 1277... Line 1282...
  printf ("  int idx;\n");
  printf ("  int idx;\n");
  printf ("} opcode_entry_type;\n\n");
  printf ("} opcode_entry_type;\n\n");
  printf ("#ifdef DEFINE_TABLE\n");
  printf ("#ifdef DEFINE_TABLE\n");
  printf ("const opcode_entry_type z8k_table[] = {\n");
  printf ("const opcode_entry_type z8k_table[] = {\n");
 
 
  while (new->flags && new->flags[0])
  while (new_op->flags && new_op->flags[0])
    {
    {
      int nargs;
      int nargs;
      int length;
      int length;
 
 
      printf ("\n/* %s *** %s */\n", new->bits, new->name);
      printf ("\n/* %s *** %s */\n", new_op->bits, new_op->name);
      printf ("{\n");
      printf ("{\n");
 
 
      printf ("#ifdef NICENAMES\n");
      printf ("#ifdef NICENAMES\n");
      printf ("\"%s\",%d,%d,", new->name, new->type, new->cycles);
      printf ("\"%s\",%d,%d,", new_op->name, new_op->type, new_op->cycles);
      {
      {
        int answer = 0;
        int answer = 0;
        char *p = new->flags;
        char *p = new_op->flags;
 
 
        while (*p)
        while (*p)
          {
          {
            answer <<= 1;
            answer <<= 1;
 
 
Line 1304... Line 1309...
        printf ("0x%02x,\n", answer);
        printf ("0x%02x,\n", answer);
      }
      }
 
 
      printf ("#endif\n");
      printf ("#endif\n");
 
 
      nargs = chewname (&new->name);
      nargs = chewname (&new_op->name);
 
 
      printf ("\n\t");
      printf ("\n\t");
      chewbits (new->bits, &length);
      chewbits (new_op->bits, &length);
      length /= 2;
      length /= 2;
      if (length & 1)
      if (length & 1)
        abort();
        abort();
 
 
      if (strcmp (oldname, new->name) != 0)
      if (strcmp (oldname, new_op->name) != 0)
        idx++;
        idx++;
      printf (",%d,%d,%d", nargs, length, idx);
      printf (",%d,%d,%d", nargs, length, idx);
      oldname = new->name;
      oldname = new_op->name;
      printf ("},\n");
      printf ("},\n");
      new++;
      new_op++;
    }
    }
  printf ("\n/* end marker */\n");
  printf ("\n/* end marker */\n");
  printf ("{\n#ifdef NICENAMES\nNULL,0,0,\n0,\n#endif\n");
  printf ("{\n#ifdef NICENAMES\nNULL,0,0,\n0,\n#endif\n");
  printf ("NULL,0,0,{0,0,0,0},{0,0,0,0,0,0,0,0,0,0},0,0,0}\n};\n");
  printf ("NULL,0,0,{0,0,0,0},{0,0,0,0,0,0,0,0,0,0},0,0,0}\n};\n");
  printf ("#endif\n");
  printf ("#endif\n");

powered by: WebSVN 2.1.0

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