| 1 | /* Assembler interface for targets using CGEN. -*- C -*- | 
|---|
| 2 | CGEN: Cpu tools GENerator | 
|---|
| 3 |  | 
|---|
| 4 | THIS FILE IS MACHINE GENERATED WITH CGEN. | 
|---|
| 5 | - the resultant file is machine generated, cgen-asm.in isn't | 
|---|
| 6 |  | 
|---|
| 7 | Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. | 
|---|
| 8 |  | 
|---|
| 9 | This file is part of the GNU Binutils and GDB, the GNU debugger. | 
|---|
| 10 |  | 
|---|
| 11 | This program is free software; you can redistribute it and/or modify | 
|---|
| 12 | it under the terms of the GNU General Public License as published by | 
|---|
| 13 | the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 14 | any later version. | 
|---|
| 15 |  | 
|---|
| 16 | This program is distributed in the hope that it will be useful, | 
|---|
| 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 19 | GNU General Public License for more details. | 
|---|
| 20 |  | 
|---|
| 21 | You should have received a copy of the GNU General Public License | 
|---|
| 22 | along with this program; if not, write to the Free Software Foundation, Inc., | 
|---|
| 23 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */ | 
|---|
| 24 |  | 
|---|
| 25 | /* ??? Eventually more and more of this stuff can go to cpu-independent files. | 
|---|
| 26 | Keep that in mind.  */ | 
|---|
| 27 |  | 
|---|
| 28 | #include "sysdep.h" | 
|---|
| 29 | #include <stdio.h> | 
|---|
| 30 | #include "ansidecl.h" | 
|---|
| 31 | #include "bfd.h" | 
|---|
| 32 | #include "symcat.h" | 
|---|
| 33 | #include "@prefix@-desc.h" | 
|---|
| 34 | #include "@prefix@-opc.h" | 
|---|
| 35 | #include "opintl.h" | 
|---|
| 36 | #include "xregex.h" | 
|---|
| 37 | #include "libiberty.h" | 
|---|
| 38 | #include "safe-ctype.h" | 
|---|
| 39 |  | 
|---|
| 40 | #undef  min | 
|---|
| 41 | #define min(a,b) ((a) < (b) ? (a) : (b)) | 
|---|
| 42 | #undef  max | 
|---|
| 43 | #define max(a,b) ((a) > (b) ? (a) : (b)) | 
|---|
| 44 |  | 
|---|
| 45 | static const char * parse_insn_normal | 
|---|
| 46 | PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, const char **, CGEN_FIELDS *)); | 
|---|
| 47 |  | 
|---|
| 48 |  | 
|---|
| 49 | /* -- assembler routines inserted here.  */ | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 |  | 
|---|
| 53 | /* Regex construction routine. | 
|---|
| 54 |  | 
|---|
| 55 | This translates an opcode syntax string into a regex string, | 
|---|
| 56 | by replacing any non-character syntax element (such as an | 
|---|
| 57 | opcode) with the pattern '.*' | 
|---|
| 58 |  | 
|---|
| 59 | It then compiles the regex and stores it in the opcode, for | 
|---|
| 60 | later use by @arch@_cgen_assemble_insn | 
|---|
| 61 |  | 
|---|
| 62 | Returns NULL for success, an error message for failure.  */ | 
|---|
| 63 |  | 
|---|
| 64 | char * | 
|---|
| 65 | @arch@_cgen_build_insn_regex (insn) | 
|---|
| 66 | CGEN_INSN *insn; | 
|---|
| 67 | { | 
|---|
| 68 | CGEN_OPCODE *opc = (CGEN_OPCODE *) CGEN_INSN_OPCODE (insn); | 
|---|
| 69 | const char *mnem = CGEN_INSN_MNEMONIC (insn); | 
|---|
| 70 | char rxbuf[CGEN_MAX_RX_ELEMENTS]; | 
|---|
| 71 | char *rx = rxbuf; | 
|---|
| 72 | const CGEN_SYNTAX_CHAR_TYPE *syn; | 
|---|
| 73 | int reg_err; | 
|---|
| 74 |  | 
|---|
| 75 | syn = CGEN_SYNTAX_STRING (CGEN_OPCODE_SYNTAX (opc)); | 
|---|
| 76 |  | 
|---|
| 77 | /* Mnemonics come first in the syntax string.  */ | 
|---|
| 78 | if (! CGEN_SYNTAX_MNEMONIC_P (* syn)) | 
|---|
| 79 | return _("missing mnemonic in syntax string"); | 
|---|
| 80 | ++syn; | 
|---|
| 81 |  | 
|---|
| 82 | /* Generate a case sensitive regular expression that emulates case | 
|---|
| 83 | insensitive matching in the "C" locale.  We cannot generate a case | 
|---|
| 84 | insensitive regular expression because in Turkish locales, 'i' and 'I' | 
|---|
| 85 | are not equal modulo case conversion.  */ | 
|---|
| 86 |  | 
|---|
| 87 | /* Copy the literal mnemonic out of the insn.  */ | 
|---|
| 88 | for (; *mnem; mnem++) | 
|---|
| 89 | { | 
|---|
| 90 | char c = *mnem; | 
|---|
| 91 |  | 
|---|
| 92 | if (ISALPHA (c)) | 
|---|
| 93 | { | 
|---|
| 94 | *rx++ = '['; | 
|---|
| 95 | *rx++ = TOLOWER (c); | 
|---|
| 96 | *rx++ = TOUPPER (c); | 
|---|
| 97 | *rx++ = ']'; | 
|---|
| 98 | } | 
|---|
| 99 | else | 
|---|
| 100 | *rx++ = c; | 
|---|
| 101 | } | 
|---|
| 102 |  | 
|---|
| 103 | /* Copy any remaining literals from the syntax string into the rx.  */ | 
|---|
| 104 | for(; * syn != 0 && rx <= rxbuf + (CGEN_MAX_RX_ELEMENTS - 7 - 4); ++syn) | 
|---|
| 105 | { | 
|---|
| 106 | if (CGEN_SYNTAX_CHAR_P (* syn)) | 
|---|
| 107 | { | 
|---|
| 108 | char c = CGEN_SYNTAX_CHAR (* syn); | 
|---|
| 109 |  | 
|---|
| 110 | switch (c) | 
|---|
| 111 | { | 
|---|
| 112 | /* Escape any regex metacharacters in the syntax.  */ | 
|---|
| 113 | case '.': case '[': case '\\': | 
|---|
| 114 | case '*': case '^': case '$': | 
|---|
| 115 |  | 
|---|
| 116 | #ifdef CGEN_ESCAPE_EXTENDED_REGEX | 
|---|
| 117 | case '?': case '{': case '}': | 
|---|
| 118 | case '(': case ')': case '*': | 
|---|
| 119 | case '|': case '+': case ']': | 
|---|
| 120 | #endif | 
|---|
| 121 | *rx++ = '\\'; | 
|---|
| 122 | *rx++ = c; | 
|---|
| 123 | break; | 
|---|
| 124 |  | 
|---|
| 125 | default: | 
|---|
| 126 | if (ISALPHA (c)) | 
|---|
| 127 | { | 
|---|
| 128 | *rx++ = '['; | 
|---|
| 129 | *rx++ = TOLOWER (c); | 
|---|
| 130 | *rx++ = TOUPPER (c); | 
|---|
| 131 | *rx++ = ']'; | 
|---|
| 132 | } | 
|---|
| 133 | else | 
|---|
| 134 | *rx++ = c; | 
|---|
| 135 | break; | 
|---|
| 136 | } | 
|---|
| 137 | } | 
|---|
| 138 | else | 
|---|
| 139 | { | 
|---|
| 140 | /* Replace non-syntax fields with globs.  */ | 
|---|
| 141 | *rx++ = '.'; | 
|---|
| 142 | *rx++ = '*'; | 
|---|
| 143 | } | 
|---|
| 144 | } | 
|---|
| 145 |  | 
|---|
| 146 | /* Trailing whitespace ok.  */ | 
|---|
| 147 | * rx++ = '['; | 
|---|
| 148 | * rx++ = ' '; | 
|---|
| 149 | * rx++ = '\t'; | 
|---|
| 150 | * rx++ = ']'; | 
|---|
| 151 | * rx++ = '*'; | 
|---|
| 152 |  | 
|---|
| 153 | /* But anchor it after that.  */ | 
|---|
| 154 | * rx++ = '$'; | 
|---|
| 155 | * rx = '\0'; | 
|---|
| 156 |  | 
|---|
| 157 | CGEN_INSN_RX (insn) = xmalloc (sizeof (regex_t)); | 
|---|
| 158 | reg_err = regcomp ((regex_t *) CGEN_INSN_RX (insn), rxbuf, REG_NOSUB); | 
|---|
| 159 |  | 
|---|
| 160 | if (reg_err == 0) | 
|---|
| 161 | return NULL; | 
|---|
| 162 | else | 
|---|
| 163 | { | 
|---|
| 164 | static char msg[80]; | 
|---|
| 165 |  | 
|---|
| 166 | regerror (reg_err, (regex_t *) CGEN_INSN_RX (insn), msg, 80); | 
|---|
| 167 | regfree ((regex_t *) CGEN_INSN_RX (insn)); | 
|---|
| 168 | free (CGEN_INSN_RX (insn)); | 
|---|
| 169 | (CGEN_INSN_RX (insn)) = NULL; | 
|---|
| 170 | return msg; | 
|---|
| 171 | } | 
|---|
| 172 | } | 
|---|
| 173 |  | 
|---|
| 174 |  | 
|---|
| 175 |  | 
|---|
| 176 | /* Default insn parser. | 
|---|
| 177 |  | 
|---|
| 178 | The syntax string is scanned and operands are parsed and stored in FIELDS. | 
|---|
| 179 | Relocs are queued as we go via other callbacks. | 
|---|
| 180 |  | 
|---|
| 181 | ??? Note that this is currently an all-or-nothing parser.  If we fail to | 
|---|
| 182 | parse the instruction, we return 0 and the caller will start over from | 
|---|
| 183 | the beginning.  Backtracking will be necessary in parsing subexpressions, | 
|---|
| 184 | but that can be handled there.  Not handling backtracking here may get | 
|---|
| 185 | expensive in the case of the m68k.  Deal with later. | 
|---|
| 186 |  | 
|---|
| 187 | Returns NULL for success, an error message for failure.  */ | 
|---|
| 188 |  | 
|---|
| 189 | static const char * | 
|---|
| 190 | parse_insn_normal (cd, insn, strp, fields) | 
|---|
| 191 | CGEN_CPU_DESC cd; | 
|---|
| 192 | const CGEN_INSN *insn; | 
|---|
| 193 | const char **strp; | 
|---|
| 194 | CGEN_FIELDS *fields; | 
|---|
| 195 | { | 
|---|
| 196 | /* ??? Runtime added insns not handled yet.  */ | 
|---|
| 197 | const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); | 
|---|
| 198 | const char *str = *strp; | 
|---|
| 199 | const char *errmsg; | 
|---|
| 200 | const char *p; | 
|---|
| 201 | const CGEN_SYNTAX_CHAR_TYPE * syn; | 
|---|
| 202 | #ifdef CGEN_MNEMONIC_OPERANDS | 
|---|
| 203 | /* FIXME: wip */ | 
|---|
| 204 | int past_opcode_p; | 
|---|
| 205 | #endif | 
|---|
| 206 |  | 
|---|
| 207 | /* For now we assume the mnemonic is first (there are no leading operands). | 
|---|
| 208 | We can parse it without needing to set up operand parsing. | 
|---|
| 209 | GAS's input scrubber will ensure mnemonics are lowercase, but we may | 
|---|
| 210 | not be called from GAS.  */ | 
|---|
| 211 | p = CGEN_INSN_MNEMONIC (insn); | 
|---|
| 212 | while (*p && TOLOWER (*p) == TOLOWER (*str)) | 
|---|
| 213 | ++p, ++str; | 
|---|
| 214 |  | 
|---|
| 215 | if (* p) | 
|---|
| 216 | return _("unrecognized instruction"); | 
|---|
| 217 |  | 
|---|
| 218 | #ifndef CGEN_MNEMONIC_OPERANDS | 
|---|
| 219 | if (* str && ! ISSPACE (* str)) | 
|---|
| 220 | return _("unrecognized instruction"); | 
|---|
| 221 | #endif | 
|---|
| 222 |  | 
|---|
| 223 | CGEN_INIT_PARSE (cd); | 
|---|
| 224 | cgen_init_parse_operand (cd); | 
|---|
| 225 | #ifdef CGEN_MNEMONIC_OPERANDS | 
|---|
| 226 | past_opcode_p = 0; | 
|---|
| 227 | #endif | 
|---|
| 228 |  | 
|---|
| 229 | /* We don't check for (*str != '\0') here because we want to parse | 
|---|
| 230 | any trailing fake arguments in the syntax string.  */ | 
|---|
| 231 | syn = CGEN_SYNTAX_STRING (syntax); | 
|---|
| 232 |  | 
|---|
| 233 | /* Mnemonics come first for now, ensure valid string.  */ | 
|---|
| 234 | if (! CGEN_SYNTAX_MNEMONIC_P (* syn)) | 
|---|
| 235 | abort (); | 
|---|
| 236 |  | 
|---|
| 237 | ++syn; | 
|---|
| 238 |  | 
|---|
| 239 | while (* syn != 0) | 
|---|
| 240 | { | 
|---|
| 241 | /* Non operand chars must match exactly.  */ | 
|---|
| 242 | if (CGEN_SYNTAX_CHAR_P (* syn)) | 
|---|
| 243 | { | 
|---|
| 244 | /* FIXME: While we allow for non-GAS callers above, we assume the | 
|---|
| 245 | first char after the mnemonic part is a space.  */ | 
|---|
| 246 | /* FIXME: We also take inappropriate advantage of the fact that | 
|---|
| 247 | GAS's input scrubber will remove extraneous blanks.  */ | 
|---|
| 248 | if (TOLOWER (*str) == TOLOWER (CGEN_SYNTAX_CHAR (* syn))) | 
|---|
| 249 | { | 
|---|
| 250 | #ifdef CGEN_MNEMONIC_OPERANDS | 
|---|
| 251 | if (CGEN_SYNTAX_CHAR(* syn) == ' ') | 
|---|
| 252 | past_opcode_p = 1; | 
|---|
| 253 | #endif | 
|---|
| 254 | ++ syn; | 
|---|
| 255 | ++ str; | 
|---|
| 256 | } | 
|---|
| 257 | else if (*str) | 
|---|
| 258 | { | 
|---|
| 259 | /* Syntax char didn't match.  Can't be this insn.  */ | 
|---|
| 260 | static char msg [80]; | 
|---|
| 261 |  | 
|---|
| 262 | /* xgettext:c-format */ | 
|---|
| 263 | sprintf (msg, _("syntax error (expected char `%c', found `%c')"), | 
|---|
| 264 | CGEN_SYNTAX_CHAR(*syn), *str); | 
|---|
| 265 | return msg; | 
|---|
| 266 | } | 
|---|
| 267 | else | 
|---|
| 268 | { | 
|---|
| 269 | /* Ran out of input.  */ | 
|---|
| 270 | static char msg [80]; | 
|---|
| 271 |  | 
|---|
| 272 | /* xgettext:c-format */ | 
|---|
| 273 | sprintf (msg, _("syntax error (expected char `%c', found end of instruction)"), | 
|---|
| 274 | CGEN_SYNTAX_CHAR(*syn)); | 
|---|
| 275 | return msg; | 
|---|
| 276 | } | 
|---|
| 277 | continue; | 
|---|
| 278 | } | 
|---|
| 279 |  | 
|---|
| 280 | /* We have an operand of some sort.  */ | 
|---|
| 281 | errmsg = cd->parse_operand (cd, CGEN_SYNTAX_FIELD (*syn), | 
|---|
| 282 | &str, fields); | 
|---|
| 283 | if (errmsg) | 
|---|
| 284 | return errmsg; | 
|---|
| 285 |  | 
|---|
| 286 | /* Done with this operand, continue with next one.  */ | 
|---|
| 287 | ++ syn; | 
|---|
| 288 | } | 
|---|
| 289 |  | 
|---|
| 290 | /* If we're at the end of the syntax string, we're done.  */ | 
|---|
| 291 | if (* syn == 0) | 
|---|
| 292 | { | 
|---|
| 293 | /* FIXME: For the moment we assume a valid `str' can only contain | 
|---|
| 294 | blanks now.  IE: We needn't try again with a longer version of | 
|---|
| 295 | the insn and it is assumed that longer versions of insns appear | 
|---|
| 296 | before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3).  */ | 
|---|
| 297 | while (ISSPACE (* str)) | 
|---|
| 298 | ++ str; | 
|---|
| 299 |  | 
|---|
| 300 | if (* str != '\0') | 
|---|
| 301 | return _("junk at end of line"); /* FIXME: would like to include `str' */ | 
|---|
| 302 |  | 
|---|
| 303 | return NULL; | 
|---|
| 304 | } | 
|---|
| 305 |  | 
|---|
| 306 | /* We couldn't parse it.  */ | 
|---|
| 307 | return _("unrecognized instruction"); | 
|---|
| 308 | } | 
|---|
| 309 |  | 
|---|
| 310 |  | 
|---|
| 311 | /* Main entry point. | 
|---|
| 312 | This routine is called for each instruction to be assembled. | 
|---|
| 313 | STR points to the insn to be assembled. | 
|---|
| 314 | We assume all necessary tables have been initialized. | 
|---|
| 315 | The assembled instruction, less any fixups, is stored in BUF. | 
|---|
| 316 | Remember that if CGEN_INT_INSN_P then BUF is an int and thus the value | 
|---|
| 317 | still needs to be converted to target byte order, otherwise BUF is an array | 
|---|
| 318 | of bytes in target byte order. | 
|---|
| 319 | The result is a pointer to the insn's entry in the opcode table, | 
|---|
| 320 | or NULL if an error occured (an error message will have already been | 
|---|
| 321 | printed). | 
|---|
| 322 |  | 
|---|
| 323 | Note that when processing (non-alias) macro-insns, | 
|---|
| 324 | this function recurses. | 
|---|
| 325 |  | 
|---|
| 326 | ??? It's possible to make this cpu-independent. | 
|---|
| 327 | One would have to deal with a few minor things. | 
|---|
| 328 | At this point in time doing so would be more of a curiosity than useful | 
|---|
| 329 | [for example this file isn't _that_ big], but keeping the possibility in | 
|---|
| 330 | mind helps keep the design clean.  */ | 
|---|
| 331 |  | 
|---|
| 332 | const CGEN_INSN * | 
|---|
| 333 | @arch@_cgen_assemble_insn (cd, str, fields, buf, errmsg) | 
|---|
| 334 | CGEN_CPU_DESC cd; | 
|---|
| 335 | const char *str; | 
|---|
| 336 | CGEN_FIELDS *fields; | 
|---|
| 337 | CGEN_INSN_BYTES_PTR buf; | 
|---|
| 338 | char **errmsg; | 
|---|
| 339 | { | 
|---|
| 340 | const char *start; | 
|---|
| 341 | CGEN_INSN_LIST *ilist; | 
|---|
| 342 | const char *parse_errmsg = NULL; | 
|---|
| 343 | const char *insert_errmsg = NULL; | 
|---|
| 344 | int recognized_mnemonic = 0; | 
|---|
| 345 |  | 
|---|
| 346 | /* Skip leading white space.  */ | 
|---|
| 347 | while (ISSPACE (* str)) | 
|---|
| 348 | ++ str; | 
|---|
| 349 |  | 
|---|
| 350 | /* The instructions are stored in hashed lists. | 
|---|
| 351 | Get the first in the list.  */ | 
|---|
| 352 | ilist = CGEN_ASM_LOOKUP_INSN (cd, str); | 
|---|
| 353 |  | 
|---|
| 354 | /* Keep looking until we find a match.  */ | 
|---|
| 355 | start = str; | 
|---|
| 356 | for ( ; ilist != NULL ; ilist = CGEN_ASM_NEXT_INSN (ilist)) | 
|---|
| 357 | { | 
|---|
| 358 | const CGEN_INSN *insn = ilist->insn; | 
|---|
| 359 | recognized_mnemonic = 1; | 
|---|
| 360 |  | 
|---|
| 361 | #ifdef CGEN_VALIDATE_INSN_SUPPORTED | 
|---|
| 362 | /* Not usually needed as unsupported opcodes | 
|---|
| 363 | shouldn't be in the hash lists.  */ | 
|---|
| 364 | /* Is this insn supported by the selected cpu?  */ | 
|---|
| 365 | if (! @arch@_cgen_insn_supported (cd, insn)) | 
|---|
| 366 | continue; | 
|---|
| 367 | #endif | 
|---|
| 368 | /* If the RELAX attribute is set, this is an insn that shouldn't be | 
|---|
| 369 | chosen immediately.  Instead, it is used during assembler/linker | 
|---|
| 370 | relaxation if possible.  */ | 
|---|
| 371 | if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAX) != 0) | 
|---|
| 372 | continue; | 
|---|
| 373 |  | 
|---|
| 374 | str = start; | 
|---|
| 375 |  | 
|---|
| 376 | /* Skip this insn if str doesn't look right lexically.  */ | 
|---|
| 377 | if (CGEN_INSN_RX (insn) != NULL && | 
|---|
| 378 | regexec ((regex_t *) CGEN_INSN_RX (insn), str, 0, NULL, 0) == REG_NOMATCH) | 
|---|
| 379 | continue; | 
|---|
| 380 |  | 
|---|
| 381 | /* Allow parse/insert handlers to obtain length of insn.  */ | 
|---|
| 382 | CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn); | 
|---|
| 383 |  | 
|---|
| 384 | parse_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields); | 
|---|
| 385 | if (parse_errmsg != NULL) | 
|---|
| 386 | continue; | 
|---|
| 387 |  | 
|---|
| 388 | /* ??? 0 is passed for `pc'.  */ | 
|---|
| 389 | insert_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf, | 
|---|
| 390 | (bfd_vma) 0); | 
|---|
| 391 | if (insert_errmsg != NULL) | 
|---|
| 392 | continue; | 
|---|
| 393 |  | 
|---|
| 394 | /* It is up to the caller to actually output the insn and any | 
|---|
| 395 | queued relocs.  */ | 
|---|
| 396 | return insn; | 
|---|
| 397 | } | 
|---|
| 398 |  | 
|---|
| 399 | { | 
|---|
| 400 | static char errbuf[150]; | 
|---|
| 401 | #ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS | 
|---|
| 402 | const char *tmp_errmsg; | 
|---|
| 403 |  | 
|---|
| 404 | /* If requesting verbose error messages, use insert_errmsg. | 
|---|
| 405 | Failing that, use parse_errmsg.  */ | 
|---|
| 406 | tmp_errmsg = (insert_errmsg ? insert_errmsg : | 
|---|
| 407 | parse_errmsg ? parse_errmsg : | 
|---|
| 408 | recognized_mnemonic ? | 
|---|
| 409 | _("unrecognized form of instruction") : | 
|---|
| 410 | _("unrecognized instruction")); | 
|---|
| 411 |  | 
|---|
| 412 | if (strlen (start) > 50) | 
|---|
| 413 | /* xgettext:c-format */ | 
|---|
| 414 | sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start); | 
|---|
| 415 | else | 
|---|
| 416 | /* xgettext:c-format */ | 
|---|
| 417 | sprintf (errbuf, "%s `%.50s'", tmp_errmsg, start); | 
|---|
| 418 | #else | 
|---|
| 419 | if (strlen (start) > 50) | 
|---|
| 420 | /* xgettext:c-format */ | 
|---|
| 421 | sprintf (errbuf, _("bad instruction `%.50s...'"), start); | 
|---|
| 422 | else | 
|---|
| 423 | /* xgettext:c-format */ | 
|---|
| 424 | sprintf (errbuf, _("bad instruction `%.50s'"), start); | 
|---|
| 425 | #endif | 
|---|
| 426 |  | 
|---|
| 427 | *errmsg = errbuf; | 
|---|
| 428 | return NULL; | 
|---|
| 429 | } | 
|---|
| 430 | } | 
|---|
| 431 |  | 
|---|
| 432 |  | 
|---|
| 433 | #if 0 /* This calls back to GAS which we can't do without care.  */ | 
|---|
| 434 |  | 
|---|
| 435 | /* Record each member of OPVALS in the assembler's symbol table. | 
|---|
| 436 | This lets GAS parse registers for us. | 
|---|
| 437 | ??? Interesting idea but not currently used.  */ | 
|---|
| 438 |  | 
|---|
| 439 | /* Record each member of OPVALS in the assembler's symbol table. | 
|---|
| 440 | FIXME: Not currently used.  */ | 
|---|
| 441 |  | 
|---|
| 442 | void | 
|---|
| 443 | @arch@_cgen_asm_hash_keywords (cd, opvals) | 
|---|
| 444 | CGEN_CPU_DESC cd; | 
|---|
| 445 | CGEN_KEYWORD *opvals; | 
|---|
| 446 | { | 
|---|
| 447 | CGEN_KEYWORD_SEARCH search = cgen_keyword_search_init (opvals, NULL); | 
|---|
| 448 | const CGEN_KEYWORD_ENTRY * ke; | 
|---|
| 449 |  | 
|---|
| 450 | while ((ke = cgen_keyword_search_next (& search)) != NULL) | 
|---|
| 451 | { | 
|---|
| 452 | #if 0 /* Unnecessary, should be done in the search routine.  */ | 
|---|
| 453 | if (! @arch@_cgen_opval_supported (ke)) | 
|---|
| 454 | continue; | 
|---|
| 455 | #endif | 
|---|
| 456 | cgen_asm_record_register (cd, ke->name, ke->value); | 
|---|
| 457 | } | 
|---|
| 458 | } | 
|---|
| 459 |  | 
|---|
| 460 | #endif /* 0 */ | 
|---|