summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/opcodes/cgen-asm.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/binutils/opcodes/cgen-asm.c')
-rw-r--r--contrib/binutils/opcodes/cgen-asm.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/contrib/binutils/opcodes/cgen-asm.c b/contrib/binutils/opcodes/cgen-asm.c
index a8d6ff8..05b62bf 100644
--- a/contrib/binutils/opcodes/cgen-asm.c
+++ b/contrib/binutils/opcodes/cgen-asm.c
@@ -1,6 +1,6 @@
/* CGEN generic assembler support code.
- Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU Binutils and GDB, the GNU debugger.
@@ -20,14 +20,18 @@
#include "sysdep.h"
#include <stdio.h>
-#include <ctype.h>
#include "ansidecl.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "bfd.h"
#include "symcat.h"
#include "opcode/cgen.h"
#include "opintl.h"
+static CGEN_INSN_LIST * hash_insn_array PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, int, int, CGEN_INSN_LIST **, CGEN_INSN_LIST *));
+static CGEN_INSN_LIST * hash_insn_list PARAMS ((CGEN_CPU_DESC, const CGEN_INSN_LIST *, CGEN_INSN_LIST **, CGEN_INSN_LIST *));
+static void build_asm_hash_table PARAMS ((CGEN_CPU_DESC));
+
/* Set the cgen_parse_operand_fn callback. */
void
@@ -207,24 +211,34 @@ cgen_parse_keyword (cd, strp, keyword_table, valuep)
char buf[256];
const char *p,*start;
+ if (keyword_table->name_hash_table == NULL)
+ (void) cgen_keyword_search_init (keyword_table, NULL);
+
p = start = *strp;
- /* Allow any first character.
- Note that this allows recognizing ",a" for the annul flag in sparc
- even though "," is subsequently not a valid keyword char. */
+ /* Allow any first character. This is to make life easier for
+ the fairly common case of suffixes, eg. 'ld.b.w', where the first
+ character of the suffix ('.') is special. */
if (*p)
++p;
-
- /* Now allow letters, digits, and _. */
+
+ /* Allow letters, digits, and any special characters. */
while (((p - start) < (int) sizeof (buf))
- && (isalnum ((unsigned char) *p) || *p == '_'))
+ && *p
+ && (ISALNUM (*p) || strchr (keyword_table->nonalpha_chars, *p)))
++p;
if (p - start >= (int) sizeof (buf))
- return _("unrecognized keyword/register name");
-
- memcpy (buf, start, p - start);
- buf[p - start] = 0;
+ {
+ /* All non-empty CGEN keywords can fit into BUF. The only thing
+ we can match here is the empty keyword. */
+ buf[0] = 0;
+ }
+ else
+ {
+ memcpy (buf, start, p - start);
+ buf[p - start] = 0;
+ }
ke = cgen_keyword_lookup_name (keyword_table, buf);
OpenPOWER on IntegriCloud