X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gas%2Fitbl-ops.c;h=e97a63679f461983df6e9f0e83171c479e3dbfa0;hb=6f820c855cf3f858cea1d9284de4e925889476bf;hp=089bff4aac5a6381e17a0642d3546691b02331a0;hpb=b1f1fa963c3c1e6deb8e8cf0651ce993e2b94a3c;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/itbl-ops.c b/gas/itbl-ops.c index 089bff4aac..e97a63679f 100644 --- a/gas/itbl-ops.c +++ b/gas/itbl-ops.c @@ -1,11 +1,12 @@ /* itbl-ops.c - Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1997, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, + 2009, 2010 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. GAS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. GAS is distributed in the hope that it will be useful, @@ -15,8 +16,8 @@ You should have received a copy of the GNU General Public License along with GAS; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /*======================================================================*/ /* @@ -88,9 +89,7 @@ * */ -#include -#include -#include +#include "as.h" #include "itbl-ops.h" #include @@ -98,7 +97,7 @@ #ifdef DEBUG #include -#define ASSERT(x) assert(x) +#define ASSERT(x) gas_assert (x) #define DBG(x) printf x #else #define ASSERT(x) @@ -146,12 +145,7 @@ struct itbl_entry { static int itbl_num_opcodes = 0; /* Array of entries for each processor and entry type */ -static struct itbl_entry *entries[e_nprocs][e_ntypes] = { - {0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0} -}; +static struct itbl_entry *entries[e_nprocs][e_ntypes]; /* local prototypes */ static unsigned long build_opcode (struct itbl_entry *e); @@ -204,18 +198,6 @@ struct itbl_entry * itbl_add_reg (int yyprocessor, int yytype, char *regname, int regnum) { -#if 0 -#include "as.h" -#include "symbols.h" - /* Since register names don't have a prefix, we put them in the symbol table so - they can't be used as symbols. This also simplifies argument parsing as - we can let gas parse registers for us. The recorded register number is - regnum. */ - /* Use symbol_create here instead of symbol_new so we don't try to - output registers into the object file's symbol table. */ - symbol_table_insert (symbol_create (regname, reg_section, - regnum, &zero_address_frag)); -#endif return alloc_entry (get_processor (yyprocessor), get_type (yytype), regname, (unsigned long) regnum); } @@ -264,8 +246,6 @@ itbl_add_operand (struct itbl_entry *e, int yytype, int sbit, /* Interfaces for assembler and disassembler */ #ifndef STAND_ALONE -#include "as.h" -#include "symbols.h" static void append_insns_as_macros (void); /* Initialize for gas. */ @@ -320,7 +300,10 @@ append_insns_as_macros (void) { struct ITBL_OPCODE_STRUCT *new_opcodes, *o; struct itbl_entry *e, **es; - int n, id, size, new_size, new_num_opcodes; + int n, size, new_size, new_num_opcodes; +#ifdef USE_MACROS + int id; +#endif if (!itbl_have_entries) return; @@ -355,7 +338,9 @@ append_insns_as_macros (void) /* FIXME! some NUMOPCODES are calculated expressions. These need to be changed before itbls can be supported. */ +#ifdef USE_MACROS id = ITBL_NUM_MACROS; /* begin the next macro id after the last */ +#endif o = &new_opcodes[ITBL_NUM_OPCODES]; /* append macro to opcodes list */ for (n = e_p0; n < e_nprocs; n++) { @@ -613,6 +598,7 @@ itbl_disassemble (char *s, unsigned long insn) { struct itbl_entry *r; unsigned long value; + char s_value[20]; if (f == e->fields) /* First operand is preceded by tab. */ strcat (s, "\t"); @@ -631,14 +617,18 @@ itbl_disassemble (char *s, unsigned long insn) if (r) strcat (s, r->name); else - sprintf (s, "%s$%lu", s, value); + { + sprintf (s_value, "$%lu", value); + strcat (s, s_value); + } break; case e_addr: /* Use assembler's symbol table to find symbol. */ /* FIXME!! Do we need this? If so, what about relocs?? */ /* If not a symbol, fall through to IMMED. */ case e_immed: - sprintf (s, "%s0x%lx", s, value); + sprintf (s_value, "0x%lx", value); + strcat (s, s_value); break; default: return 0; /* error; invalid field spec */