From: Dmitry Selyutin Date: Sun, 28 May 2023 22:04:56 +0000 (+0300) Subject: ppc/svp64: introduce svp64_decode stub X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2eaa82821791586dbd856451079315da59c66d0e;p=binutils-gdb.git ppc/svp64: introduce svp64_decode stub --- diff --git a/gas/config/tc-ppc-svp64.c b/gas/config/tc-ppc-svp64.c index 9436c79afa6..89d62c218a5 100644 --- a/gas/config/tc-ppc-svp64.c +++ b/gas/config/tc-ppc-svp64.c @@ -22,6 +22,7 @@ #include struct svp64_ctx { + const char *name; const struct svp64_desc *desc; }; @@ -60,15 +61,31 @@ svp64_setup_records (void) } } -static char * +#define SVP64_SEP '/' + +static void svp64_decode (char *str, struct svp64_ctx *svp64) { + char *opc; + const struct svp64_record *record; + str += (sizeof ("sv.") - 1); - svp64->desc = (const struct svp64_desc *) str_hash_find (svp64_hash, str); + if (! ISALPHA (*str)) + svp64_raise (_("unrecognized opcode: `%s'"), str); + + opc = str; + for (; ! ISSPACE (*str) && *str != SVP64_SEP && *str != '\0'; ++str) + ; + if (*str != '\0') + *str++ = '\0'; + + svp64->desc = (const struct svp64_desc *) str_hash_find (svp64_hash, opc); if (!svp64->desc) svp64_raise (_("unrecognized opcode: `%s'"), str); - return str; + record = (const void *)((unsigned char *)svp64->desc - + offsetof (struct svp64_record, desc)); + svp64->name = record->name; } static void