From 2833e2512e1c241da35ff66e38ddf6a327055728 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Thu, 15 Jan 1998 21:51:12 +0000 Subject: [PATCH] * tc-h8500.c (parse_reg): Likewise. --- gas/ChangeLog | 1 + gas/config/tc-h8500.c | 53 +++++++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 84a986228da..8a14cb95bb0 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -2,6 +2,7 @@ Thu Jan 15 13:46:48 1998 Richard Henderson * tc-h8300.c (parse_reg): Take the length of the symbol into account when attempting to match a register name. + * tc-h8500.c (parse_reg): Likewise. start-sanitize-vr4111 Thu Jan 15 09:33:11 1998 Gavin Koch diff --git a/gas/config/tc-h8500.c b/gas/config/tc-h8500.c index 5a09e4ad40a..e8d6c7b6549 100644 --- a/gas/config/tc-h8500.c +++ b/gas/config/tc-h8500.c @@ -186,68 +186,73 @@ parse_reg (src, mode, reg) int *mode; int *reg; { - if (src[0] == 'r') + char *end; + int len; + + /* Cribbed from get_symbol_end(). */ + if (!is_name_beginner (*src) || *src == '\001') + return 0; + end = src+1; + while (is_part_of_name (*end) || *end == '\001') + end++; + len = end - src; + + if (len == 2 && src[0] == 'r') { if (src[1] >= '0' && src[1] <= '7') { *mode = RN; *reg = (src[1] - '0'); - return 2; + return len; } } - - if (src[0] == 's' && src[1] == 'p') + if (len == 2 && src[0] == 's' && src[1] == 'p') { *mode = RN; *reg = 7; - return 2; + return len; } - if (src[0] == 'c' && src[1] == 'c' && src[2] == 'r') + if (len == 3 && src[0] == 'c' && src[1] == 'c' && src[2] == 'r') { *mode = CRB; *reg = 1; - return 3; + return len; } - if (src[0] == 's' && src[1] == 'r') + if (len == 2 && src[0] == 's' && src[1] == 'r') { *mode = CRW; *reg = 0; - return 2; + return len; } - - if (src[0] == 'b' && src[1] == 'r') + if (len == 2 && src[0] == 'b' && src[1] == 'r') { *mode = CRB; *reg = 3; - return 2; + return len; } - - if (src[0] == 'e' && src[1] == 'p') + if (len == 2 && src[0] == 'e' && src[1] == 'p') { *mode = CRB; *reg = 4; - return 2; + return len; } - - if (src[0] == 'd' && src[1] == 'p') + if (len == 2 && src[0] == 'd' && src[1] == 'p') { *mode = CRB; *reg = 5; - return 2; + return len; } - - if (src[0] == 't' && src[1] == 'p') + if (len == 2 && src[0] == 't' && src[1] == 'p') { *mode = CRB; *reg = 7; - return 2; + return len; } - - if (src[0] == 'f' && src[1] == 'p') + if (len == 2 && src[0] == 'f' && src[1] == 'p') { *mode = RN; *reg = 6; - return 2; + return len; } return 0; } -- 2.30.2