From 468cced8b997b43359f2610c43a223d907a9bea7 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 30 Jul 2001 06:15:49 +0000 Subject: [PATCH] * config/obj-elf.c (obj_elf_symver): Temporarily modify lex_type to include '@' in symbol names when parsing versioned symbols rather than calling get_symbol_end multiple times. * config/tc-i370.c (register_name): Format fixes. Don't call get_symbol_end after parsing number. * config/tc-mn10200.c (data_register_name): Format fixes. Hoist code out of conditional. (address_register_name): Likewise. (other_register_name): Likewise. * config/tc-mn10300.c (r_register_name): Likewise. (xr_register_name): Likewise. (data_register_name): Likewise. (address_register_name): Likewise. (other_register_name): Likewise. * config/tc-ppc.c (register_name): Likewise. * config/tc-s390.c (register_name): Likewise. --- gas/ChangeLog | 19 +++++++++ gas/config/obj-elf.c | 14 +++---- gas/config/tc-i370.c | 22 +++++------ gas/config/tc-mn10200.c | 51 +++++++++--------------- gas/config/tc-mn10300.c | 86 ++++++++++++++--------------------------- gas/config/tc-ppc.c | 16 ++++---- gas/config/tc-s390.c | 21 +++++----- 7 files changed, 102 insertions(+), 127 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 94bb8e046bd..a7157cc336d 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,22 @@ +2001-07-30 Alan Modra + + * config/obj-elf.c (obj_elf_symver): Temporarily modify lex_type + to include '@' in symbol names when parsing versioned symbols + rather than calling get_symbol_end multiple times. + * config/tc-i370.c (register_name): Format fixes. Don't call + get_symbol_end after parsing number. + * config/tc-mn10200.c (data_register_name): Format fixes. Hoist + code out of conditional. + (address_register_name): Likewise. + (other_register_name): Likewise. + * config/tc-mn10300.c (r_register_name): Likewise. + (xr_register_name): Likewise. + (data_register_name): Likewise. + (address_register_name): Likewise. + (other_register_name): Likewise. + * config/tc-ppc.c (register_name): Likewise. + * config/tc-s390.c (register_name): Likewise. + 2001-07-27 Stephane Carrez * config/tc-m68hc11.c (md_estimate_size_before_relax): Fix bsr diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 2510f4b4744..8c59479f068 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -1132,6 +1132,7 @@ obj_elf_symver (ignore) { char *name; char c; + char old_lexat; symbolS *sym; name = input_line_pointer; @@ -1151,13 +1152,12 @@ obj_elf_symver (ignore) ++input_line_pointer; name = input_line_pointer; - while (1) - { - c = get_symbol_end (); - if (c != ELF_VER_CHR) - break; - *input_line_pointer++ = c; - } + + /* Temporarily include '@' in symbol names. */ + old_lexat = lex_type[(unsigned char) '@']; + lex_type[(unsigned char) '@'] |= LEX_NAME; + c = get_symbol_end (); + lex_type[(unsigned char) '@'] = old_lexat; if (symbol_get_obj (sym)->versioned_name == NULL) { diff --git a/gas/config/tc-i370.c b/gas/config/tc-i370.c index bb6e01a3942..affc9575fda 100644 --- a/gas/config/tc-i370.c +++ b/gas/config/tc-i370.c @@ -332,7 +332,7 @@ register_name (expressionP) char *start; char c; - /* Find the spelling of the operand */ + /* Find the spelling of the operand. */ start = name = input_line_pointer; if (name[0] == '%' && isalpha (name[1])) name = ++input_line_pointer; @@ -343,36 +343,36 @@ register_name (expressionP) while (' ' == *name) name = ++input_line_pointer; - /* if its a number, treat it as a number */ - /* if its alpha, look to see if it's in the register table */ + /* If it's a number, treat it as a number. If it's alpha, look to + see if it's in the register table. */ if (!isalpha (name[0])) { reg_number = get_single_number (); - c = get_symbol_end (); } else { c = get_symbol_end (); reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name); + + /* Put back the delimiting char. */ + *input_line_pointer = c; } - /* if numeric, make sure its not out of bounds */ + /* If numeric, make sure its not out of bounds. */ if ((0 <= reg_number) && (16 >= reg_number)) { expressionP->X_op = O_register; expressionP->X_add_number = reg_number; - /* make the rest nice */ + /* Make the rest nice. */ expressionP->X_add_symbol = NULL; expressionP->X_op_symbol = NULL; - *input_line_pointer = c; /* put back the delimiting char */ return true; } - /* reset the line as if we had not done anything */ - *input_line_pointer = c; /* put back the delimiting char */ - input_line_pointer = start; /* reset input_line pointer */ - return false; + /* Reset the line as if we had not done anything. */ + input_line_pointer = start; + return false; } /* Local variables. */ diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c index dd3f9e54442..a6a46aff9e7 100644 --- a/gas/config/tc-mn10200.c +++ b/gas/config/tc-mn10200.c @@ -197,6 +197,9 @@ data_register_name (expressionP) c = get_symbol_end (); reg_number = reg_name_search (data_registers, DATA_REG_NAME_CNT, name); + /* Put back the delimiting char. */ + *input_line_pointer = c; + /* Look to see if it's in the register table. */ if (reg_number >= 0) { @@ -207,20 +210,12 @@ data_register_name (expressionP) expressionP->X_add_symbol = NULL; expressionP->X_op_symbol = NULL; - /* Put back the delimiting char. */ - *input_line_pointer = c; return true; } - else - { - /* Reset the line as if we had not done anything. */ - /* Put back the delimiting char. */ - *input_line_pointer = c; - /* Reset input_line pointer. */ - input_line_pointer = start; - return false; - } + /* Reset the line as if we had not done anything. */ + input_line_pointer = start; + return false; } /* Summary of register_name(). @@ -249,6 +244,9 @@ address_register_name (expressionP) c = get_symbol_end (); reg_number = reg_name_search (address_registers, ADDRESS_REG_NAME_CNT, name); + /* Put back the delimiting char. */ + *input_line_pointer = c; + /* Look to see if it's in the register table. */ if (reg_number >= 0) { @@ -259,20 +257,12 @@ address_register_name (expressionP) expressionP->X_add_symbol = NULL; expressionP->X_op_symbol = NULL; - /* Put back the delimiting char. */ - *input_line_pointer = c; return true; } - else - { - /* Reset the line as if we had not done anything. */ - /* Put back the delimiting char. */ - *input_line_pointer = c; - /* Reset input_line pointer. */ - input_line_pointer = start; - return false; - } + /* Reset the line as if we had not done anything. */ + input_line_pointer = start; + return false; } /* Summary of register_name(). @@ -301,6 +291,9 @@ other_register_name (expressionP) c = get_symbol_end (); reg_number = reg_name_search (other_registers, OTHER_REG_NAME_CNT, name); + /* Put back the delimiting char. */ + *input_line_pointer = c; + /* Look to see if it's in the register table. */ if (reg_number >= 0) { @@ -311,20 +304,12 @@ other_register_name (expressionP) expressionP->X_add_symbol = NULL; expressionP->X_op_symbol = NULL; - /* Put back the delimiting char. */ - *input_line_pointer = c; return true; } - else - { - /* Reset the line as if we had not done anything. */ - /* Put back the delimiting char. */ - *input_line_pointer = c; - /* Reset input_line pointer. */ - input_line_pointer = start; - return false; - } + /* Reset the line as if we had not done anything. */ + input_line_pointer = start; + return false; } void diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c index 9f3ee5f911c..10cb8faff25 100644 --- a/gas/config/tc-mn10300.c +++ b/gas/config/tc-mn10300.c @@ -302,6 +302,9 @@ r_register_name (expressionP) c = get_symbol_end (); reg_number = reg_name_search (r_registers, R_REG_NAME_CNT, name); + /* Put back the delimiting char. */ + *input_line_pointer = c; + /* Look to see if it's in the register table. */ if (reg_number >= 0) { @@ -312,20 +315,12 @@ r_register_name (expressionP) expressionP->X_add_symbol = NULL; expressionP->X_op_symbol = NULL; - /* Put back the delimiting char. */ - *input_line_pointer = c; return true; } - else - { - /* Reset the line as if we had not done anything. */ - /* Put back the delimiting char. */ - *input_line_pointer = c; - /* Reset input_line pointer. */ - input_line_pointer = start; - return false; - } + /* Reset the line as if we had not done anything. */ + input_line_pointer = start; + return false; } /* Summary of register_name(). @@ -354,6 +349,9 @@ xr_register_name (expressionP) c = get_symbol_end (); reg_number = reg_name_search (xr_registers, XR_REG_NAME_CNT, name); + /* Put back the delimiting char. */ + *input_line_pointer = c; + /* Look to see if it's in the register table. */ if (reg_number >= 0) { @@ -364,20 +362,12 @@ xr_register_name (expressionP) expressionP->X_add_symbol = NULL; expressionP->X_op_symbol = NULL; - /* Put back the delimiting char. */ - *input_line_pointer = c; return true; } - else - { - /* Reset the line as if we had not done anything. */ - /* Put back the delimiting char. */ - *input_line_pointer = c; - /* Reset input_line pointer. */ - input_line_pointer = start; - return false; - } + /* Reset the line as if we had not done anything. */ + input_line_pointer = start; + return false; } /* Summary of register_name(). @@ -406,6 +396,9 @@ data_register_name (expressionP) c = get_symbol_end (); reg_number = reg_name_search (data_registers, DATA_REG_NAME_CNT, name); + /* Put back the delimiting char. */ + *input_line_pointer = c; + /* Look to see if it's in the register table. */ if (reg_number >= 0) { @@ -416,20 +409,12 @@ data_register_name (expressionP) expressionP->X_add_symbol = NULL; expressionP->X_op_symbol = NULL; - /* Put back the delimiting char. */ - *input_line_pointer = c; return true; } - else - { - /* Reset the line as if we had not done anything. */ - /* Put back the delimiting char. */ - *input_line_pointer = c; - /* Reset input_line pointer. */ - input_line_pointer = start; - return false; - } + /* Reset the line as if we had not done anything. */ + input_line_pointer = start; + return false; } /* Summary of register_name(). @@ -458,6 +443,9 @@ address_register_name (expressionP) c = get_symbol_end (); reg_number = reg_name_search (address_registers, ADDRESS_REG_NAME_CNT, name); + /* Put back the delimiting char. */ + *input_line_pointer = c; + /* Look to see if it's in the register table. */ if (reg_number >= 0) { @@ -468,21 +456,12 @@ address_register_name (expressionP) expressionP->X_add_symbol = NULL; expressionP->X_op_symbol = NULL; - /* Put back the delimiting char. */ - *input_line_pointer = c; return true; } - else - { - /* Reset the line as if we had not done anything. */ - /* Put back the delimiting char. */ - *input_line_pointer = c; - - /* Reset input_line pointer. */ - input_line_pointer = start; - return false; - } + /* Reset the line as if we had not done anything. */ + input_line_pointer = start; + return false; } /* Summary of register_name(). @@ -511,6 +490,9 @@ other_register_name (expressionP) c = get_symbol_end (); reg_number = reg_name_search (other_registers, OTHER_REG_NAME_CNT, name); + /* Put back the delimiting char. */ + *input_line_pointer = c; + /* Look to see if it's in the register table. */ if (reg_number >= 0) { @@ -521,20 +503,12 @@ other_register_name (expressionP) expressionP->X_add_symbol = NULL; expressionP->X_op_symbol = NULL; - /* Put back the delimiting char. */ - *input_line_pointer = c; return true; } - else - { - /* Reset the line as if we had not done anything. */ - /* Put back the delimiting char. */ - *input_line_pointer = c; - /* Reset input_line pointer. */ - input_line_pointer = start; - return false; - } + /* Reset the line as if we had not done anything. */ + input_line_pointer = start; + return false; } void diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 88f9b8ee755..621b6dbe319 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -586,6 +586,9 @@ register_name (expressionP) c = get_symbol_end (); reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name); + /* Put back the delimiting char. */ + *input_line_pointer = c; + /* Look to see if it's in the register table. */ if (reg_number >= 0) { @@ -595,17 +598,12 @@ register_name (expressionP) /* Make the rest nice. */ expressionP->X_add_symbol = NULL; expressionP->X_op_symbol = NULL; - /* Put back the delimiting char. */ - *input_line_pointer = c; return true; } - else - { - /* Reset the line as if we had not done anything. */ - *input_line_pointer = c; - input_line_pointer = start; - return false; - } + + /* Reset the line as if we had not done anything. */ + input_line_pointer = start; + return false; } /* This function is called for each symbol seen in an expression. It diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index 21d4c0df61c..996678612fc 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -251,7 +251,7 @@ register_name (expressionP) char *start; char c; - /* Find the spelling of the operand */ + /* Find the spelling of the operand. */ start = name = input_line_pointer; if (name[0] == '%' && isalpha (name[1])) name = ++input_line_pointer; @@ -261,25 +261,24 @@ register_name (expressionP) c = get_symbol_end (); reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name); - /* look to see if it's in the register table */ + /* Put back the delimiting char. */ + *input_line_pointer = c; + + /* Look to see if it's in the register table. */ if (reg_number >= 0) { expressionP->X_op = O_register; expressionP->X_add_number = reg_number; - /* make the rest nice */ + /* Make the rest nice. */ expressionP->X_add_symbol = NULL; expressionP->X_op_symbol = NULL; - *input_line_pointer = c; /* put back the delimiting char */ return true; } - else - { - /* reset the line as if we had not done anything */ - *input_line_pointer = c; /* put back the delimiting char */ - input_line_pointer = start; /* reset input_line pointer */ - return false; - } + + /* Reset the line as if we had not done anything. */ + input_line_pointer = start; + return false; } /* Local variables. */ -- 2.30.2