1 /* Assembler interface for targets using CGEN. -*- C -*-
2 CGEN: Cpu tools GENerator
4 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 - the resultant file is machine generated, cgen-asm.in isn't
7 Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
9 This file is part of the GNU Binutils and GDB, the GNU debugger.
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)
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.
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. */
25 /* ??? Eventually more and more of this stuff can go to cpu-independent files.
33 #include "ip2k-desc.h"
37 #include "libiberty.h"
38 #include "safe-ctype.h"
41 #define min(a,b) ((a) < (b) ? (a) : (b))
43 #define max(a,b) ((a) > (b) ? (a) : (b))
45 static const char * parse_insn_normal
46 PARAMS ((CGEN_CPU_DESC
, const CGEN_INSN
*, const char **, CGEN_FIELDS
*));
48 /* -- assembler routines inserted here. */
52 #define PARSE_FUNC_DECL(name) \
53 static const char *name PARAMS ((CGEN_CPU_DESC, const char **, int, long *))
55 PARSE_FUNC_DECL (parse_fr
);
56 PARSE_FUNC_DECL (parse_addr16
);
57 PARSE_FUNC_DECL (parse_addr16_p
);
58 PARSE_FUNC_DECL (parse_addr16_cjp
);
59 PARSE_FUNC_DECL (parse_lit8
);
60 PARSE_FUNC_DECL (parse_bit3
);
64 parse_fr (cd
, strp
, opindex
, valuep
)
73 enum cgen_parse_operand_result result_type
;
75 extern CGEN_KEYWORD ip2k_cgen_opval_register_names
;
82 /* Check here to see if you're about to try parsing a w as the first arg */
83 /* and return an error if you are. */
84 if ( (strncmp(*strp
,"w",1)==0) || (strncmp(*strp
,"W",1)==0) )
88 if ( (strncmp(*strp
,",",1)==0) || ISSPACE(**strp
) )
90 /* We've been passed a w. Return with an error message so that */
91 /* cgen will try the next parsing option. */
92 errmsg
= _("W keyword invalid in FR operand slot.");
99 /* Attempt parse as register keyword. */
100 /* old_strp = *strp; */
102 errmsg
= cgen_parse_keyword (cd
, strp
, & ip2k_cgen_opval_register_names
,
108 /* Attempt to parse for "(IP)" */
109 afteroffset
= strstr(*strp
,"(IP)");
111 if ( afteroffset
== NULL
)
113 /* Make sure it's not in lower case */
114 afteroffset
= strstr(*strp
,"(ip)");
117 if ( afteroffset
!= NULL
)
119 if ( afteroffset
!= *strp
)
121 /* Invalid offset present.*/
122 errmsg
= _("offset(IP) is not a valid form");
134 /* Attempt to parse for DP. ex: mov w, offset(DP) */
135 /* mov offset(DP),w */
137 /* Try parsing it as an address and see what comes back */
139 afteroffset
= strstr(*strp
,"(DP)");
141 if ( afteroffset
== NULL
)
143 /* Maybe it's in lower case */
144 afteroffset
= strstr(*strp
,"(dp)");
147 if ( afteroffset
!= NULL
)
149 if ( afteroffset
== *strp
)
151 /* No offset present. Use 0 by default. */
157 errmsg
= cgen_parse_address (cd
, strp
, opindex
,
158 BFD_RELOC_IP2K_FR_OFFSET
,
159 & result_type
, & tempvalue
);
164 if (tempvalue
<= 127)
166 /* Value is ok. Fix up the first 2 bits and return */
167 *valuep
= 0x0100 | tempvalue
;
168 *strp
+= 4; /* skip over the (DP) in *strp */
173 /* Found something there in front of (DP) but it's out
175 errmsg
= _("(DP) offset out of range.");
182 /* Attempt to parse for SP. ex: mov w, offset(SP) */
183 /* mov offset(SP), w */
186 afteroffset
= strstr(*strp
,"(SP)");
188 if (afteroffset
== NULL
)
190 /* Maybe it's in lower case. */
191 afteroffset
= strstr(*strp
, "(sp)");
194 if ( afteroffset
!= NULL
)
196 if ( afteroffset
== *strp
)
198 /* No offset present. Use 0 by default. */
204 errmsg
= cgen_parse_address (cd
, strp
, opindex
,
205 BFD_RELOC_IP2K_FR_OFFSET
,
206 & result_type
, & tempvalue
);
210 if (tempvalue
<= 127)
212 /* Value is ok. Fix up the first 2 bits and return */
213 *valuep
= 0x0180 | tempvalue
;
214 *strp
+= 4; /* skip over the (SP) in *strp */
219 /* Found something there in front of (SP) but it's out
221 errmsg
= _("(SP) offset out of range.");
229 /* Attempt to parse as an address. */
231 errmsg
= cgen_parse_address (cd
, strp
, opindex
, BFD_RELOC_IP2K_FR9
,
232 & result_type
, & value
);
237 /* if a parenthesis is found, warn about invalid form */
241 errmsg
= _("illegal use of parentheses");
243 /* if a numeric value is specified, ensure that it is between
245 else if (result_type
== CGEN_PARSE_OPERAND_RESULT_NUMBER
)
247 if (value
< 0x1 || value
> 0xff)
248 errmsg
= _("operand out of range (not between 1 and 255)");
255 parse_addr16 (cd
, strp
, opindex
, valuep
)
262 enum cgen_parse_operand_result result_type
;
263 bfd_reloc_code_real_type code
= BFD_RELOC_NONE
;
266 if ( opindex
== (CGEN_OPERAND_TYPE
)IP2K_OPERAND_ADDR16H
)
267 code
= BFD_RELOC_IP2K_HI8DATA
;
268 else if ( opindex
== (CGEN_OPERAND_TYPE
)IP2K_OPERAND_ADDR16L
)
269 code
= BFD_RELOC_IP2K_LO8DATA
;
272 /* Something is very wrong. opindex has to be one of the above. */
273 errmsg
= _("parse_addr16: invalid opindex.");
277 errmsg
= cgen_parse_address (cd
, strp
, opindex
, code
,
278 & result_type
, & value
);
281 /* We either have a relocation or a number now. */
282 if ( result_type
== CGEN_PARSE_OPERAND_RESULT_NUMBER
)
284 /* We got a number back. */
285 if ( code
== BFD_RELOC_IP2K_HI8DATA
)
287 else /* code = BFD_RELOC_IP2K_LOW8DATA */
298 parse_addr16_p (cd
, strp
, opindex
, valuep
)
305 enum cgen_parse_operand_result result_type
;
306 bfd_reloc_code_real_type code
= BFD_RELOC_IP2K_PAGE3
;
309 errmsg
= cgen_parse_address (cd
, strp
, opindex
, code
,
310 & result_type
, & value
);
313 if ( result_type
== CGEN_PARSE_OPERAND_RESULT_NUMBER
)
314 *valuep
= (value
>> 13) & 0x7;
315 else if ( result_type
== CGEN_PARSE_OPERAND_RESULT_QUEUED
)
323 parse_addr16_cjp (cd
, strp
, opindex
, valuep
)
330 enum cgen_parse_operand_result result_type
;
331 bfd_reloc_code_real_type code
= BFD_RELOC_NONE
;
334 if ( opindex
== (CGEN_OPERAND_TYPE
)IP2K_OPERAND_ADDR16CJP
)
335 code
= BFD_RELOC_IP2K_ADDR16CJP
;
336 else if ( opindex
== (CGEN_OPERAND_TYPE
)IP2K_OPERAND_ADDR16P
)
337 code
= BFD_RELOC_IP2K_PAGE3
;
339 errmsg
= cgen_parse_address (cd
, strp
, opindex
, code
,
340 & result_type
, & value
);
343 if ( result_type
== CGEN_PARSE_OPERAND_RESULT_NUMBER
)
345 if ( (value
& 0x1) == 0) /* If the address is even .... */
347 if ( opindex
== (CGEN_OPERAND_TYPE
)IP2K_OPERAND_ADDR16CJP
)
348 *valuep
= (value
>> 1) & 0x1FFF; /* Should mask be 1FFF? */
349 else if ( opindex
== (CGEN_OPERAND_TYPE
)IP2K_OPERAND_ADDR16P
)
350 *valuep
= (value
>> 14) & 0x7;
353 errmsg
= _("Byte address required. - must be even.");
355 else if ( result_type
== CGEN_PARSE_OPERAND_RESULT_QUEUED
)
357 /* This will happen for things like (s2-s1) where s2 and s1
362 errmsg
= _("cgen_parse_address returned a symbol. Literal required.");
369 parse_lit8 (cd
, strp
, opindex
, valuep
)
376 enum cgen_parse_operand_result result_type
;
377 bfd_reloc_code_real_type code
= BFD_RELOC_NONE
;
380 /* Parse %OP relocating operators. */
381 if (strncmp (*strp
, "%bank", 5) == 0)
384 code
= BFD_RELOC_IP2K_BANK
;
386 else if (strncmp (*strp
, "%lo8data", 8) == 0)
389 code
= BFD_RELOC_IP2K_LO8DATA
;
391 else if (strncmp (*strp
, "%hi8data", 8) == 0)
394 code
= BFD_RELOC_IP2K_HI8DATA
;
396 else if (strncmp (*strp
, "%ex8data", 8) == 0)
399 code
= BFD_RELOC_IP2K_EX8DATA
;
401 else if (strncmp (*strp
, "%lo8insn", 8) == 0)
404 code
= BFD_RELOC_IP2K_LO8INSN
;
406 else if (strncmp (*strp
, "%hi8insn", 8) == 0)
409 code
= BFD_RELOC_IP2K_HI8INSN
;
413 /* Parse %op operand. */
414 if (code
!= BFD_RELOC_NONE
)
416 errmsg
= cgen_parse_address (cd
, strp
, opindex
, code
,
417 & result_type
, & value
);
418 if ((errmsg
== NULL
) &&
419 (result_type
!= CGEN_PARSE_OPERAND_RESULT_QUEUED
))
420 errmsg
= _("%operator operand is not a symbol");
424 /* Parse as a number. */
427 errmsg
= cgen_parse_signed_integer (cd
, strp
, opindex
, valuep
);
429 /* Truncate to eight bits to accept both signed and unsigned input. */
438 parse_bit3 (cd
, strp
, opindex
, valuep
)
449 if (strncmp (*strp
, "%bit", 4) == 0)
454 else if (strncmp (*strp
, "%msbbit", 7) == 0)
459 else if (strncmp (*strp
, "%lsbbit", 7) == 0)
465 errmsg
= cgen_parse_signed_integer (cd
, strp
, opindex
, valuep
);
471 value
= (unsigned long) *valuep
;
474 errmsg
= _("Attempt to find bit index of 0");
481 while ((value
& 0x80000000) == 0)
490 while ((value
& 0x00000001) == 0)
506 const char * ip2k_cgen_parse_operand
507 PARAMS ((CGEN_CPU_DESC
, int, const char **, CGEN_FIELDS
*));
509 /* Main entry point for operand parsing.
511 This function is basically just a big switch statement. Earlier versions
512 used tables to look up the function to use, but
513 - if the table contains both assembler and disassembler functions then
514 the disassembler contains much of the assembler and vice-versa,
515 - there's a lot of inlining possibilities as things grow,
516 - using a switch statement avoids the function call overhead.
518 This function could be moved into `parse_insn_normal', but keeping it
519 separate makes clear the interface between `parse_insn_normal' and each of
523 ip2k_cgen_parse_operand (cd
, opindex
, strp
, fields
)
527 CGEN_FIELDS
* fields
;
529 const char * errmsg
= NULL
;
530 /* Used by scalar operands that still need to be parsed. */
531 long junk ATTRIBUTE_UNUSED
;
535 case IP2K_OPERAND_ADDR16CJP
:
536 errmsg
= parse_addr16_cjp (cd
, strp
, IP2K_OPERAND_ADDR16CJP
, &fields
->f_addr16cjp
);
538 case IP2K_OPERAND_ADDR16H
:
539 errmsg
= parse_addr16 (cd
, strp
, IP2K_OPERAND_ADDR16H
, &fields
->f_imm8
);
541 case IP2K_OPERAND_ADDR16L
:
542 errmsg
= parse_addr16 (cd
, strp
, IP2K_OPERAND_ADDR16L
, &fields
->f_imm8
);
544 case IP2K_OPERAND_ADDR16P
:
545 errmsg
= parse_addr16_cjp (cd
, strp
, IP2K_OPERAND_ADDR16P
, &fields
->f_page3
);
547 case IP2K_OPERAND_BITNO
:
548 errmsg
= parse_bit3 (cd
, strp
, IP2K_OPERAND_BITNO
, &fields
->f_bitno
);
550 case IP2K_OPERAND_CBIT
:
551 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, IP2K_OPERAND_CBIT
, &junk
);
553 case IP2K_OPERAND_DCBIT
:
554 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, IP2K_OPERAND_DCBIT
, &junk
);
556 case IP2K_OPERAND_FR
:
557 errmsg
= parse_fr (cd
, strp
, IP2K_OPERAND_FR
, &fields
->f_reg
);
559 case IP2K_OPERAND_LIT8
:
560 errmsg
= parse_lit8 (cd
, strp
, IP2K_OPERAND_LIT8
, &fields
->f_imm8
);
562 case IP2K_OPERAND_PABITS
:
563 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, IP2K_OPERAND_PABITS
, &junk
);
565 case IP2K_OPERAND_RETI3
:
566 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, IP2K_OPERAND_RETI3
, &fields
->f_reti3
);
568 case IP2K_OPERAND_ZBIT
:
569 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, IP2K_OPERAND_ZBIT
, &junk
);
573 /* xgettext:c-format */
574 fprintf (stderr
, _("Unrecognized field %d while parsing.\n"), opindex
);
581 cgen_parse_fn
* const ip2k_cgen_parse_handlers
[] =
587 ip2k_cgen_init_asm (cd
)
590 ip2k_cgen_init_opcode_table (cd
);
591 ip2k_cgen_init_ibld_table (cd
);
592 cd
->parse_handlers
= & ip2k_cgen_parse_handlers
[0];
593 cd
->parse_operand
= ip2k_cgen_parse_operand
;
598 /* Regex construction routine.
600 This translates an opcode syntax string into a regex string,
601 by replacing any non-character syntax element (such as an
602 opcode) with the pattern '.*'
604 It then compiles the regex and stores it in the opcode, for
605 later use by ip2k_cgen_assemble_insn
607 Returns NULL for success, an error message for failure. */
610 ip2k_cgen_build_insn_regex (insn
)
613 CGEN_OPCODE
*opc
= (CGEN_OPCODE
*) CGEN_INSN_OPCODE (insn
);
614 const char *mnem
= CGEN_INSN_MNEMONIC (insn
);
615 char rxbuf
[CGEN_MAX_RX_ELEMENTS
];
617 const CGEN_SYNTAX_CHAR_TYPE
*syn
;
620 syn
= CGEN_SYNTAX_STRING (CGEN_OPCODE_SYNTAX (opc
));
622 /* Mnemonics come first in the syntax string. */
623 if (! CGEN_SYNTAX_MNEMONIC_P (* syn
))
624 return _("missing mnemonic in syntax string");
627 /* Generate a case sensitive regular expression that emulates case
628 insensitive matching in the "C" locale. We cannot generate a case
629 insensitive regular expression because in Turkish locales, 'i' and 'I'
630 are not equal modulo case conversion. */
632 /* Copy the literal mnemonic out of the insn. */
633 for (; *mnem
; mnem
++)
648 /* Copy any remaining literals from the syntax string into the rx. */
649 for(; * syn
!= 0 && rx
<= rxbuf
+ (CGEN_MAX_RX_ELEMENTS
- 7 - 4); ++syn
)
651 if (CGEN_SYNTAX_CHAR_P (* syn
))
653 char c
= CGEN_SYNTAX_CHAR (* syn
);
657 /* Escape any regex metacharacters in the syntax. */
658 case '.': case '[': case '\\':
659 case '*': case '^': case '$':
661 #ifdef CGEN_ESCAPE_EXTENDED_REGEX
662 case '?': case '{': case '}':
663 case '(': case ')': case '*':
664 case '|': case '+': case ']':
685 /* Replace non-syntax fields with globs. */
691 /* Trailing whitespace ok. */
698 /* But anchor it after that. */
702 CGEN_INSN_RX (insn
) = xmalloc (sizeof (regex_t
));
703 reg_err
= regcomp ((regex_t
*) CGEN_INSN_RX (insn
), rxbuf
, REG_NOSUB
);
711 regerror (reg_err
, (regex_t
*) CGEN_INSN_RX (insn
), msg
, 80);
712 regfree ((regex_t
*) CGEN_INSN_RX (insn
));
713 free (CGEN_INSN_RX (insn
));
714 (CGEN_INSN_RX (insn
)) = NULL
;
720 /* Default insn parser.
722 The syntax string is scanned and operands are parsed and stored in FIELDS.
723 Relocs are queued as we go via other callbacks.
725 ??? Note that this is currently an all-or-nothing parser. If we fail to
726 parse the instruction, we return 0 and the caller will start over from
727 the beginning. Backtracking will be necessary in parsing subexpressions,
728 but that can be handled there. Not handling backtracking here may get
729 expensive in the case of the m68k. Deal with later.
731 Returns NULL for success, an error message for failure. */
734 parse_insn_normal (cd
, insn
, strp
, fields
)
736 const CGEN_INSN
*insn
;
740 /* ??? Runtime added insns not handled yet. */
741 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
742 const char *str
= *strp
;
745 const CGEN_SYNTAX_CHAR_TYPE
* syn
;
746 #ifdef CGEN_MNEMONIC_OPERANDS
751 /* For now we assume the mnemonic is first (there are no leading operands).
752 We can parse it without needing to set up operand parsing.
753 GAS's input scrubber will ensure mnemonics are lowercase, but we may
754 not be called from GAS. */
755 p
= CGEN_INSN_MNEMONIC (insn
);
756 while (*p
&& TOLOWER (*p
) == TOLOWER (*str
))
760 return _("unrecognized instruction");
762 #ifndef CGEN_MNEMONIC_OPERANDS
763 if (* str
&& ! ISSPACE (* str
))
764 return _("unrecognized instruction");
767 CGEN_INIT_PARSE (cd
);
768 cgen_init_parse_operand (cd
);
769 #ifdef CGEN_MNEMONIC_OPERANDS
773 /* We don't check for (*str != '\0') here because we want to parse
774 any trailing fake arguments in the syntax string. */
775 syn
= CGEN_SYNTAX_STRING (syntax
);
777 /* Mnemonics come first for now, ensure valid string. */
778 if (! CGEN_SYNTAX_MNEMONIC_P (* syn
))
785 /* Non operand chars must match exactly. */
786 if (CGEN_SYNTAX_CHAR_P (* syn
))
788 /* FIXME: While we allow for non-GAS callers above, we assume the
789 first char after the mnemonic part is a space. */
790 /* FIXME: We also take inappropriate advantage of the fact that
791 GAS's input scrubber will remove extraneous blanks. */
792 if (TOLOWER (*str
) == TOLOWER (CGEN_SYNTAX_CHAR (* syn
)))
794 #ifdef CGEN_MNEMONIC_OPERANDS
795 if (CGEN_SYNTAX_CHAR(* syn
) == ' ')
803 /* Syntax char didn't match. Can't be this insn. */
804 static char msg
[80];
806 /* xgettext:c-format */
807 sprintf (msg
, _("syntax error (expected char `%c', found `%c')"),
808 CGEN_SYNTAX_CHAR(*syn
), *str
);
813 /* Ran out of input. */
814 static char msg
[80];
816 /* xgettext:c-format */
817 sprintf (msg
, _("syntax error (expected char `%c', found end of instruction)"),
818 CGEN_SYNTAX_CHAR(*syn
));
824 /* We have an operand of some sort. */
825 errmsg
= cd
->parse_operand (cd
, CGEN_SYNTAX_FIELD (*syn
),
830 /* Done with this operand, continue with next one. */
834 /* If we're at the end of the syntax string, we're done. */
837 /* FIXME: For the moment we assume a valid `str' can only contain
838 blanks now. IE: We needn't try again with a longer version of
839 the insn and it is assumed that longer versions of insns appear
840 before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
841 while (ISSPACE (* str
))
845 return _("junk at end of line"); /* FIXME: would like to include `str' */
850 /* We couldn't parse it. */
851 return _("unrecognized instruction");
855 This routine is called for each instruction to be assembled.
856 STR points to the insn to be assembled.
857 We assume all necessary tables have been initialized.
858 The assembled instruction, less any fixups, is stored in BUF.
859 Remember that if CGEN_INT_INSN_P then BUF is an int and thus the value
860 still needs to be converted to target byte order, otherwise BUF is an array
861 of bytes in target byte order.
862 The result is a pointer to the insn's entry in the opcode table,
863 or NULL if an error occured (an error message will have already been
866 Note that when processing (non-alias) macro-insns,
867 this function recurses.
869 ??? It's possible to make this cpu-independent.
870 One would have to deal with a few minor things.
871 At this point in time doing so would be more of a curiosity than useful
872 [for example this file isn't _that_ big], but keeping the possibility in
873 mind helps keep the design clean. */
876 ip2k_cgen_assemble_insn (cd
, str
, fields
, buf
, errmsg
)
880 CGEN_INSN_BYTES_PTR buf
;
884 CGEN_INSN_LIST
*ilist
;
885 const char *parse_errmsg
= NULL
;
886 const char *insert_errmsg
= NULL
;
887 int recognized_mnemonic
= 0;
889 /* Skip leading white space. */
890 while (ISSPACE (* str
))
893 /* The instructions are stored in hashed lists.
894 Get the first in the list. */
895 ilist
= CGEN_ASM_LOOKUP_INSN (cd
, str
);
897 /* Keep looking until we find a match. */
899 for ( ; ilist
!= NULL
; ilist
= CGEN_ASM_NEXT_INSN (ilist
))
901 const CGEN_INSN
*insn
= ilist
->insn
;
902 recognized_mnemonic
= 1;
904 #ifdef CGEN_VALIDATE_INSN_SUPPORTED
905 /* Not usually needed as unsupported opcodes
906 shouldn't be in the hash lists. */
907 /* Is this insn supported by the selected cpu? */
908 if (! ip2k_cgen_insn_supported (cd
, insn
))
911 /* If the RELAX attribute is set, this is an insn that shouldn't be
912 chosen immediately. Instead, it is used during assembler/linker
913 relaxation if possible. */
914 if (CGEN_INSN_ATTR_VALUE (insn
, CGEN_INSN_RELAX
) != 0)
919 /* Skip this insn if str doesn't look right lexically. */
920 if (CGEN_INSN_RX (insn
) != NULL
&&
921 regexec ((regex_t
*) CGEN_INSN_RX (insn
), str
, 0, NULL
, 0) == REG_NOMATCH
)
924 /* Allow parse/insert handlers to obtain length of insn. */
925 CGEN_FIELDS_BITSIZE (fields
) = CGEN_INSN_BITSIZE (insn
);
927 parse_errmsg
= CGEN_PARSE_FN (cd
, insn
) (cd
, insn
, & str
, fields
);
928 if (parse_errmsg
!= NULL
)
931 /* ??? 0 is passed for `pc'. */
932 insert_errmsg
= CGEN_INSERT_FN (cd
, insn
) (cd
, insn
, fields
, buf
,
934 if (insert_errmsg
!= NULL
)
937 /* It is up to the caller to actually output the insn and any
943 static char errbuf
[150];
944 #ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS
945 const char *tmp_errmsg
;
947 /* If requesting verbose error messages, use insert_errmsg.
948 Failing that, use parse_errmsg. */
949 tmp_errmsg
= (insert_errmsg
? insert_errmsg
:
950 parse_errmsg
? parse_errmsg
:
951 recognized_mnemonic
?
952 _("unrecognized form of instruction") :
953 _("unrecognized instruction"));
955 if (strlen (start
) > 50)
956 /* xgettext:c-format */
957 sprintf (errbuf
, "%s `%.50s...'", tmp_errmsg
, start
);
959 /* xgettext:c-format */
960 sprintf (errbuf
, "%s `%.50s'", tmp_errmsg
, start
);
962 if (strlen (start
) > 50)
963 /* xgettext:c-format */
964 sprintf (errbuf
, _("bad instruction `%.50s...'"), start
);
966 /* xgettext:c-format */
967 sprintf (errbuf
, _("bad instruction `%.50s'"), start
);
975 #if 0 /* This calls back to GAS which we can't do without care. */
977 /* Record each member of OPVALS in the assembler's symbol table.
978 This lets GAS parse registers for us.
979 ??? Interesting idea but not currently used. */
981 /* Record each member of OPVALS in the assembler's symbol table.
982 FIXME: Not currently used. */
985 ip2k_cgen_asm_hash_keywords (cd
, opvals
)
987 CGEN_KEYWORD
*opvals
;
989 CGEN_KEYWORD_SEARCH search
= cgen_keyword_search_init (opvals
, NULL
);
990 const CGEN_KEYWORD_ENTRY
* ke
;
992 while ((ke
= cgen_keyword_search_next (& search
)) != NULL
)
994 #if 0 /* Unnecessary, should be done in the search routine. */
995 if (! ip2k_cgen_opval_supported (ke
))
998 cgen_asm_record_register (cd
, ke
->name
, ke
->value
);