From db55703487ec04ac06156ab76ea068055e494dde Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 21 Apr 2007 06:54:57 +0000 Subject: [PATCH] gas/ * expr.c (expr): Assert on rankarg, not rank which can be unsigned. * read.c (read_a_source_file): Remove buffer_limit[-1] assertion. Don't skip over NUL char. (pseudo_set): Set X_op for registers to O_register. * symbols.c (symbol_clone): Remove assertion that sym is defined. (resolve_symbol_value): Resolve O_register symbols. * config/tc-i386.c (parse_real_register): Don't use i386_float_regtab. Instead find st(0) by hash lookup. * config/tc-ppc.c (ppc_macro): Warning fix. opcodes/ * i386-opc.c (i386_float_regtab, i386_float_regtab_size): Delete. Move contents to.. (i386_regtab): ..here. * i386-opc.h (i386_float_regtab, i386_float_regtab_size): Delete. --- gas/ChangeLog | 10 ++++++++++ gas/config/tc-i386.c | 6 ++++-- gas/config/tc-ppc.c | 4 ++-- gas/expr.c | 4 ++-- gas/read.c | 6 ++---- gas/symbols.c | 8 ++++---- opcodes/ChangeLog | 5 +++++ opcodes/i386-opc.c | 9 ++------- opcodes/i386-opc.h | 2 -- 9 files changed, 31 insertions(+), 23 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 9c2f7f1..f573cfb 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,15 @@ 2007-04-21 Alan Modra + * expr.c (expr): Assert on rankarg, not rank which can be unsigned. + * read.c (read_a_source_file): Remove buffer_limit[-1] assertion. + Don't skip over NUL char. + (pseudo_set): Set X_op for registers to O_register. + * symbols.c (symbol_clone): Remove assertion that sym is defined. + (resolve_symbol_value): Resolve O_register symbols. + * config/tc-i386.c (parse_real_register): Don't use i386_float_regtab. + Instead find st(0) by hash lookup. + * config/tc-ppc.c (ppc_macro): Warning fix. + * as.h (ENABLE_CHECKING): Default define to 0. (know): Assert if ENABLE_CHECKING. (struct relax_type): Remove superfluous declaration. diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 0b60387..bc0945c 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -5804,14 +5804,16 @@ parse_real_register (char *reg_string, char **end_op) ++s; if (*s >= '0' && *s <= '7') { - r = &i386_float_regtab[*s - '0']; + int fpr = *s - '0'; ++s; if (is_space_char (*s)) ++s; if (*s == ')') { *end_op = s + 1; - return r; + r = hash_find (reg_hash, "st(0)"); + know (r); + return r + fpr; } } /* We have "%st(" then garbage. */ diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 1755363..978f0f3 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -2816,7 +2816,7 @@ ppc_macro (str, macro) char *s; unsigned int len; const char *format; - int arg; + unsigned int arg; char *send; char *complete; @@ -2854,7 +2854,7 @@ ppc_macro (str, macro) else { arg = strtol (format + 1, &send, 10); - know (send != format && arg >= 0 && arg < count); + know (send != format && arg < count); len += strlen (operands[arg]); format = send; } diff --git a/gas/expr.c b/gas/expr.c index c6c6ddf..11f2942 100644 --- a/gas/expr.c +++ b/gas/expr.c @@ -1,6 +1,6 @@ /* expr.c -operands, expressions- Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -1636,7 +1636,7 @@ expr (int rankarg, /* Larger # is higher rank. */ operatorT op_right; int op_chars; - know (rank >= 0); + know (rankarg >= 0); /* Save the value of dot for the fixup code. */ if (rank == 0) diff --git a/gas/read.c b/gas/read.c index 5782f23..de5f661 100644 --- a/gas/read.c +++ b/gas/read.c @@ -607,8 +607,6 @@ read_a_source_file (char *name) last_eol = NULL; #endif - know (buffer_limit[-1] == '\n'); /* Must have a sentinel. */ - while (input_line_pointer < buffer_limit) { /* We have more of this buffer to parse. */ @@ -705,8 +703,7 @@ read_a_source_file (char *name) If you must pass stuff, please pass a tree!) */ if ((c = *input_line_pointer++) == '\t' || c == ' ' - || c == '\f' - || c == 0) + || c == '\f') c = *input_line_pointer++; know (c != ' '); /* No further leading whitespace. */ @@ -3491,6 +3488,7 @@ pseudo_set (symbolS *symbolP) S_SET_SEGMENT (symbolP, reg_section); S_SET_VALUE (symbolP, (valueT) exp.X_add_number); set_zero_frag (symbolP); + symbol_get_value_expression (symbolP)->X_op = O_register; break; case O_symbol: diff --git a/gas/symbols.c b/gas/symbols.c index 2e098f1..816395f 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -1,6 +1,6 @@ /* symbols.c -symbol table- Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -563,8 +563,6 @@ symbol_clone (symbolS *orgsymP, int replace) orgsymP = local_symbol_convert ((struct local_symbol *) orgsymP); bsymorg = orgsymP->bsym; - know (S_IS_DEFINED (orgsymP)); - newsymP = obstack_alloc (¬es, sizeof (*newsymP)); *newsymP = *orgsymP; bsymnew = bfd_make_empty_symbol (bfd_asymbol_bfd (bsymorg)); @@ -1123,6 +1121,9 @@ resolve_symbol_value (symbolS *symp) final_val += symp->sy_frag->fr_address / OCTETS_PER_BYTE; if (final_seg == expr_section) final_seg = absolute_section; + /* Fall through. */ + + case O_register: resolved = 1; break; @@ -1400,7 +1401,6 @@ resolve_symbol_value (symbolS *symp) && symbol_resolved_p (op_symbol)); break; - case O_register: case O_big: case O_illegal: /* Give an error (below) if not in expr_section. We don't diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 38af5f8..f7d22be 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,5 +1,10 @@ 2007-04-21 Alan Modra + * i386-opc.c (i386_float_regtab, i386_float_regtab_size): Delete. + Move contents to.. + (i386_regtab): ..here. + * i386-opc.h (i386_float_regtab, i386_float_regtab_size): Delete. + * ppc-opc.c (powerpc_operands): Delete duplicate entries. (BA_MASK, FXM_MASK, STRM_MASK, VA_MASK, VB_MASK, VC_MASK): Delete. (VD_MASK, WS_MASK, MTMSRD_L, XRT_L): Delete. diff --git a/opcodes/i386-opc.c b/opcodes/i386-opc.c index 191054d..a374b65 100644 --- a/opcodes/i386-opc.c +++ b/opcodes/i386-opc.c @@ -1712,12 +1712,7 @@ const reg_entry i386_regtab[] = /* No type will make this register rejected for all purposes except for addressing. This saves creating one extra type for RIP. */ {"rip", BaseIndex, 0, 0}, -}; - -const unsigned int i386_regtab_size = ARRAY_SIZE (i386_regtab); - -const reg_entry i386_float_regtab[] = -{ + /* fp regs. */ {"st(0)", FloatReg|FloatAcc, 0, 0}, {"st(1)", FloatReg, 0, 1}, {"st(2)", FloatReg, 0, 2}, @@ -1728,7 +1723,7 @@ const reg_entry i386_float_regtab[] = {"st(7)", FloatReg, 0, 7} }; -const unsigned int i386_float_regtab_size = ARRAY_SIZE (i386_float_regtab); +const unsigned int i386_regtab_size = ARRAY_SIZE (i386_regtab); /* Segment stuff. */ const seg_entry cs = { "cs", 0x2e }; diff --git a/opcodes/i386-opc.h b/opcodes/i386-opc.h index 71f3892..67429f3 100644 --- a/opcodes/i386-opc.h +++ b/opcodes/i386-opc.h @@ -223,8 +223,6 @@ reg_entry; extern const reg_entry i386_regtab[]; extern const unsigned int i386_regtab_size; -extern const reg_entry i386_float_regtab[]; -extern const unsigned int i386_float_regtab_size; typedef struct { -- 2.7.4