aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-06-10 20:35:50 +0000
committerIan Lance Taylor <ian@airs.com>1999-06-10 20:35:50 +0000
commitd7ba4a779e0a1dba7c377b83a2747a186b21b527 (patch)
treee692de185fcc5aaf05e2500cf7984647806916d0
parent7f2f689c83164eb7d75193710065ed963c7fa06b (diff)
downloadgdb-d7ba4a779e0a1dba7c377b83a2747a186b21b527.zip
gdb-d7ba4a779e0a1dba7c377b83a2747a186b21b527.tar.gz
gdb-d7ba4a779e0a1dba7c377b83a2747a186b21b527.tar.bz2
Based on patches from John W. Woznack <jwoznack@concentric.net>:
* itbl-ops.c (itbl_get_reg_val): Add pval parameter. Return indication of success rather than a value. (itbl_get_val): Likewise. (itbl_get_field): Use strcspn. Change delimiters to include parens. * itbl-ops.h (itbl_get_reg_val): Update declaration. (itbl_get_val): Likewise. * config/tc-mips.c (mips_ip): Update call to itbl_get_reg_val.
-rw-r--r--gas/ChangeLog10
-rw-r--r--gas/config/tc-mips.c15
-rw-r--r--gas/itbl-ops.c47
-rw-r--r--gas/itbl-ops.h8
4 files changed, 42 insertions, 38 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 30fbfb5..85e98be 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,15 @@
1999-06-10 Ian Lance Taylor <ian@zembu.com>
+ Based on patches from John W. Woznack <jwoznack@concentric.net>:
+ * itbl-ops.c (itbl_get_reg_val): Add pval parameter. Return
+ indication of success rather than a value.
+ (itbl_get_val): Likewise.
+ (itbl_get_field): Use strcspn. Change delimiters to include
+ parens.
+ * itbl-ops.h (itbl_get_reg_val): Update declaration.
+ (itbl_get_val): Likewise.
+ * config/tc-mips.c (mips_ip): Update call to itbl_get_reg_val.
+
* symbols.c (copy_symbol_attributes): Convert local symbols to
regular symbols.
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 3c1c00c..c9b0632 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -7297,23 +7297,22 @@ mips_ip (str, ip)
else if (itbl_have_entries)
{
char *p, *n;
- int r;
+ unsigned long r;
- p = s+1; /* advance past '$' */
+ p = s + 1; /* advance past '$' */
n = itbl_get_field (&p); /* n is name */
- /* See if this is a register defined in an
- itbl entry */
- r = itbl_get_reg_val (n);
- if (r)
+ /* See if this is a register defined in an
+ itbl entry. */
+ if (itbl_get_reg_val (n, &r))
{
/* Get_field advances to the start of
the next field, so we need to back
- rack to the end of the last field. */
+ rack to the end of the last field. */
if (p)
s = p - 1;
else
- s = strchr (s,'\0');
+ s = strchr (s, '\0');
regno = r;
}
else
diff --git a/gas/itbl-ops.c b/gas/itbl-ops.c
index f008dca..23d5f2f 100644
--- a/gas/itbl-ops.c
+++ b/gas/itbl-ops.c
@@ -1,5 +1,5 @@
/* itbl-ops.c
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -457,18 +457,20 @@ form_args (struct itbl_entry *e)
/* Get processor's register name from val */
-unsigned long
-itbl_get_reg_val (char *name)
+int
+itbl_get_reg_val (char *name, unsigned long *pval)
{
e_type t;
e_processor p;
- int r = 0;
+
for (p = e_p0; p < e_nprocs; p++)
- for (t = e_regtype0; t < e_nregtypes; t++)
- {
- if (r = itbl_get_val (p, t, name), r)
- return r;
- }
+ {
+ for (t = e_regtype0; t < e_nregtypes; t++)
+ {
+ if (itbl_get_val (p, t, name, pval))
+ return 1;
+ }
+ }
return 0;
}
@@ -486,16 +488,17 @@ itbl_get_name (e_processor processor, e_type type, unsigned long val)
/* Get processor's register value from name */
-unsigned long
-itbl_get_val (e_processor processor, e_type type, char *name)
+int
+itbl_get_val (e_processor processor, e_type type, char *name,
+ unsigned long *pval)
{
struct itbl_entry *r;
/* type depends on instruction passed */
r = find_entry_byname (processor, type, name);
- if (r)
- return r->value;
- else
- return 0; /* error; invalid operand */
+ if (r == NULL)
+ return 0;
+ *pval = r->value;
+ return 1;
}
@@ -732,7 +735,7 @@ extract_range (unsigned long aval, struct itbl_range r)
/* Extract processor's assembly instruction field name from s;
* forms are "n args" "n,args" or "n" */
/* Return next argument from string pointer "s" and advance s.
- * delimiters are " ,\0" */
+ * delimiters are " ,()" */
char *
itbl_get_field (char **S)
@@ -744,16 +747,8 @@ itbl_get_field (char **S)
s = *S;
if (!s || !*s)
return 0;
- p = s + strlen (s);
- if (ps = strchr (s, ','), ps)
- p = ps;
- if (ps = strchr (s, ' '), ps)
- p = min (p, ps);
- if (ps = strchr (s, '\0'), ps)
- p = min (p, ps);
- if (p == 0)
- return 0; /* error! */
- len = p - s;
+ /* FIXME: This is a weird set of delimiters. */
+ len = strcspn (s, " \t,()");
ASSERT (128 > len + 1);
strncpy (n, s, len);
n[len] = 0;
diff --git a/gas/itbl-ops.h b/gas/itbl-ops.h
index 2946eff..d69ea7f 100644
--- a/gas/itbl-ops.h
+++ b/gas/itbl-ops.h
@@ -1,5 +1,5 @@
/* itbl-ops.h
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -92,9 +92,9 @@ char *itbl_get_field PARAMS ((char **s));
unsigned long itbl_assemble PARAMS ((char *name, char *operands));
int itbl_disassemble PARAMS ((char *str, unsigned long insn));
int itbl_parse PARAMS ((char *tbl)); /* parses insn tbl */
-unsigned long itbl_get_reg_val PARAMS ((char *name));
-unsigned long itbl_get_val PARAMS ((e_processor processor, e_type type,
- char *name));
+int itbl_get_reg_val PARAMS ((char *name, unsigned long *pval));
+int itbl_get_val PARAMS ((e_processor processor, e_type type, char *name,
+ unsigned long *pval));
char *itbl_get_name PARAMS ((e_processor processor, e_type type,
unsigned long val));