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.
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 (CGEN_CPU_DESC
, const CGEN_INSN
*, const char **, CGEN_FIELDS
*);
48 /* -- assembler routines inserted here. */
51 static const char * parse_ulo16
52 PARAMS ((CGEN_CPU_DESC
, const char **, int, unsigned long *));
53 static const char * parse_uslo16
54 PARAMS ((CGEN_CPU_DESC
, const char **, int, unsigned long *));
55 static const char * parse_uhi16
56 PARAMS ((CGEN_CPU_DESC
, const char **, int, unsigned long *));
57 static long parse_register_number
58 PARAMS ((const char **));
59 static const char * parse_spr
60 PARAMS ((CGEN_CPU_DESC
, const char **, CGEN_KEYWORD
*, long *));
61 static const char * parse_d12
62 PARAMS ((CGEN_CPU_DESC
, const char **, int, long *));
63 static const char * parse_s12
64 PARAMS ((CGEN_CPU_DESC
, const char **, int, long *));
65 static const char * parse_u12
66 PARAMS ((CGEN_CPU_DESC
, const char **, int, long *));
67 static const char * parse_even_register
68 PARAMS ((CGEN_CPU_DESC
, const char **, CGEN_KEYWORD
*, long *));
69 static const char * parse_A0
70 PARAMS ((CGEN_CPU_DESC
, const char **, int, long *));
71 static const char * parse_A1
72 PARAMS ((CGEN_CPU_DESC
, const char **, int, long *));
73 static const char * parse_A
74 PARAMS ((CGEN_CPU_DESC
, const char **, int, long *, long));
76 inline static const char *
77 parse_symbolic_address (CGEN_CPU_DESC cd
,
81 enum cgen_parse_operand_result
*resultp
,
84 enum cgen_parse_operand_result result_type
;
85 const char *errmsg
= (* cd
->parse_operand_fn
)
86 (cd
, CGEN_PARSE_OPERAND_SYMBOLIC
, strp
, opindex
, opinfo
,
87 &result_type
, valuep
);
90 && result_type
!= CGEN_PARSE_OPERAND_RESULT_QUEUED
)
91 return "symbolic expression required";
94 *resultp
= result_type
;
100 parse_ldd_annotation (CGEN_CPU_DESC cd
,
106 enum cgen_parse_operand_result result_type
;
109 if (**strp
== '#' || **strp
== '%')
111 if (strncasecmp (*strp
+ 1, "tlsdesc(", 8) == 0)
114 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
115 BFD_RELOC_FRV_TLSDESC_RELAX
,
116 &result_type
, &value
);
118 return "missing ')'";
127 while (**strp
== ' ' || **strp
== '\t')
131 return "missing `@'";
139 parse_call_annotation (CGEN_CPU_DESC cd
,
145 enum cgen_parse_operand_result result_type
;
148 if (**strp
== '#' || **strp
== '%')
150 if (strncasecmp (*strp
+ 1, "gettlsoff(", 10) == 0)
153 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
154 BFD_RELOC_FRV_GETTLSOFF_RELAX
,
155 &result_type
, &value
);
157 return "missing ')'";
166 while (**strp
== ' ' || **strp
== '\t')
170 return "missing `@'";
178 parse_ld_annotation (CGEN_CPU_DESC cd
,
184 enum cgen_parse_operand_result result_type
;
187 if (**strp
== '#' || **strp
== '%')
189 if (strncasecmp (*strp
+ 1, "tlsoff(", 7) == 0)
192 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
193 BFD_RELOC_FRV_TLSOFF_RELAX
,
194 &result_type
, &value
);
196 return "missing ')'";
205 while (**strp
== ' ' || **strp
== '\t')
209 return "missing `@'";
217 parse_ulo16 (cd
, strp
, opindex
, valuep
)
221 unsigned long *valuep
;
224 enum cgen_parse_operand_result result_type
;
227 if (**strp
== '#' || **strp
== '%')
229 if (strncasecmp (*strp
+ 1, "lo(", 3) == 0)
232 errmsg
= cgen_parse_address (cd
, strp
, opindex
, BFD_RELOC_FRV_LO16
,
233 &result_type
, &value
);
235 return "missing `)'";
238 && result_type
== CGEN_PARSE_OPERAND_RESULT_NUMBER
)
243 if (strncasecmp (*strp
+ 1, "gprello(", 8) == 0)
246 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
247 BFD_RELOC_FRV_GPRELLO
,
248 &result_type
, &value
);
250 return "missing ')'";
255 else if (strncasecmp (*strp
+ 1, "gotlo(", 6) == 0)
258 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
260 &result_type
, &value
);
262 return "missing ')'";
267 else if (strncasecmp (*strp
+ 1, "gotfuncdesclo(", 14) == 0)
270 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
271 BFD_RELOC_FRV_FUNCDESC_GOTLO
,
272 &result_type
, &value
);
274 return "missing ')'";
279 else if (strncasecmp (*strp
+ 1, "gotofflo(", 9) == 0)
282 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
283 BFD_RELOC_FRV_GOTOFFLO
,
284 &result_type
, &value
);
286 return "missing ')'";
291 else if (strncasecmp (*strp
+ 1, "gotofffuncdesclo(", 17) == 0)
294 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
295 BFD_RELOC_FRV_FUNCDESC_GOTOFFLO
,
296 &result_type
, &value
);
298 return "missing ')'";
303 else if (strncasecmp (*strp
+ 1, "gottlsdesclo(", 13) == 0)
306 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
307 BFD_RELOC_FRV_GOTTLSDESCLO
,
308 &result_type
, &value
);
310 return "missing ')'";
315 else if (strncasecmp (*strp
+ 1, "tlsmofflo(", 10) == 0)
318 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
319 BFD_RELOC_FRV_TLSMOFFLO
,
320 &result_type
, &value
);
322 return "missing ')'";
327 else if (strncasecmp (*strp
+ 1, "gottlsofflo(", 12) == 0)
330 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
331 BFD_RELOC_FRV_GOTTLSOFFLO
,
332 &result_type
, &value
);
334 return "missing ')'";
340 return cgen_parse_signed_integer (cd
, strp
, opindex
, valuep
);
344 parse_uslo16 (cd
, strp
, opindex
, valuep
)
348 unsigned long *valuep
;
351 enum cgen_parse_operand_result result_type
;
354 if (**strp
== '#' || **strp
== '%')
356 if (strncasecmp (*strp
+ 1, "lo(", 3) == 0)
359 errmsg
= cgen_parse_address (cd
, strp
, opindex
, BFD_RELOC_FRV_LO16
,
360 &result_type
, &value
);
362 return "missing `)'";
365 && result_type
== CGEN_PARSE_OPERAND_RESULT_NUMBER
)
370 else if (strncasecmp (*strp
+ 1, "gprello(", 8) == 0)
373 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
374 BFD_RELOC_FRV_GPRELLO
,
375 &result_type
, &value
);
377 return "missing ')'";
382 else if (strncasecmp (*strp
+ 1, "gotlo(", 6) == 0)
385 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
387 &result_type
, &value
);
389 return "missing ')'";
394 else if (strncasecmp (*strp
+ 1, "gotfuncdesclo(", 14) == 0)
397 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
398 BFD_RELOC_FRV_FUNCDESC_GOTLO
,
399 &result_type
, &value
);
401 return "missing ')'";
406 else if (strncasecmp (*strp
+ 1, "gotofflo(", 9) == 0)
409 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
410 BFD_RELOC_FRV_GOTOFFLO
,
411 &result_type
, &value
);
413 return "missing ')'";
418 else if (strncasecmp (*strp
+ 1, "gotofffuncdesclo(", 17) == 0)
421 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
422 BFD_RELOC_FRV_FUNCDESC_GOTOFFLO
,
423 &result_type
, &value
);
425 return "missing ')'";
430 else if (strncasecmp (*strp
+ 1, "gottlsdesclo(", 13) == 0)
433 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
434 BFD_RELOC_FRV_GOTTLSDESCLO
,
435 &result_type
, &value
);
437 return "missing ')'";
442 else if (strncasecmp (*strp
+ 1, "tlsmofflo(", 10) == 0)
445 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
446 BFD_RELOC_FRV_TLSMOFFLO
,
447 &result_type
, &value
);
449 return "missing ')'";
454 else if (strncasecmp (*strp
+ 1, "gottlsofflo(", 12) == 0)
457 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
458 BFD_RELOC_FRV_GOTTLSOFFLO
,
459 &result_type
, &value
);
461 return "missing ')'";
467 return cgen_parse_unsigned_integer (cd
, strp
, opindex
, valuep
);
471 parse_uhi16 (cd
, strp
, opindex
, valuep
)
475 unsigned long *valuep
;
478 enum cgen_parse_operand_result result_type
;
481 if (**strp
== '#' || **strp
== '%')
483 if (strncasecmp (*strp
+ 1, "hi(", 3) == 0)
486 errmsg
= cgen_parse_address (cd
, strp
, opindex
, BFD_RELOC_FRV_HI16
,
487 &result_type
, &value
);
489 return "missing `)'";
492 && result_type
== CGEN_PARSE_OPERAND_RESULT_NUMBER
)
494 /* If bfd_vma is wider than 32 bits, but we have a sign-
495 or zero-extension, truncate it. */
496 if (value
>= - ((bfd_vma
)1 << 31)
497 || value
<= ((bfd_vma
)1 << 31) - (bfd_vma
)1)
498 value
&= (((bfd_vma
)1 << 16) << 16) - 1;
504 else if (strncasecmp (*strp
+ 1, "gprelhi(", 8) == 0)
507 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
508 BFD_RELOC_FRV_GPRELHI
,
509 &result_type
, &value
);
511 return "missing ')'";
516 else if (strncasecmp (*strp
+ 1, "gothi(", 6) == 0)
519 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
521 &result_type
, &value
);
523 return "missing ')'";
528 else if (strncasecmp (*strp
+ 1, "gotfuncdeschi(", 14) == 0)
531 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
532 BFD_RELOC_FRV_FUNCDESC_GOTHI
,
533 &result_type
, &value
);
535 return "missing ')'";
540 else if (strncasecmp (*strp
+ 1, "gotoffhi(", 9) == 0)
543 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
544 BFD_RELOC_FRV_GOTOFFHI
,
545 &result_type
, &value
);
547 return "missing ')'";
552 else if (strncasecmp (*strp
+ 1, "gotofffuncdeschi(", 17) == 0)
555 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
556 BFD_RELOC_FRV_FUNCDESC_GOTOFFHI
,
557 &result_type
, &value
);
559 return "missing ')'";
564 else if (strncasecmp (*strp
+ 1, "gottlsdeschi(", 13) == 0)
567 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
568 BFD_RELOC_FRV_GOTTLSDESCHI
,
569 &result_type
, &value
);
571 return "missing ')'";
576 else if (strncasecmp (*strp
+ 1, "tlsmoffhi(", 10) == 0)
579 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
580 BFD_RELOC_FRV_TLSMOFFHI
,
581 &result_type
, &value
);
583 return "missing ')'";
588 else if (strncasecmp (*strp
+ 1, "gottlsoffhi(", 12) == 0)
591 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
592 BFD_RELOC_FRV_GOTTLSOFFHI
,
593 &result_type
, &value
);
595 return "missing ')'";
601 return cgen_parse_unsigned_integer (cd
, strp
, opindex
, valuep
);
605 parse_register_number (strp
)
609 if (**strp
< '0' || **strp
> '9')
610 return -1; /* error */
612 regno
= **strp
- '0';
613 for (++*strp
; **strp
>= '0' && **strp
<= '9'; ++*strp
)
614 regno
= regno
* 10 + (**strp
- '0');
620 parse_spr (cd
, strp
, table
, valuep
)
623 CGEN_KEYWORD
* table
;
626 const char *save_strp
;
629 /* Check for spr index notation. */
630 if (strncasecmp (*strp
, "spr[", 4) == 0)
633 regno
= parse_register_number (strp
);
635 return "missing `]'";
637 if (! spr_valid (regno
))
638 return "Special purpose register number is out of range";
644 regno
= parse_register_number (strp
);
647 if (! spr_valid (regno
))
648 return "Special purpose register number is out of range";
654 return cgen_parse_keyword (cd
, strp
, table
, valuep
);
658 parse_d12 (cd
, strp
, opindex
, valuep
)
665 enum cgen_parse_operand_result result_type
;
668 /* Check for small data reference. */
669 if (**strp
== '#' || **strp
== '%')
671 if (strncasecmp (*strp
+ 1, "gprel12(", 8) == 0)
674 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
675 BFD_RELOC_FRV_GPREL12
,
676 &result_type
, &value
);
678 return "missing `)'";
683 else if (strncasecmp (*strp
+ 1, "got12(", 6) == 0)
686 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
688 &result_type
, &value
);
690 return "missing ')'";
695 else if (strncasecmp (*strp
+ 1, "gotfuncdesc12(", 14) == 0)
698 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
699 BFD_RELOC_FRV_FUNCDESC_GOT12
,
700 &result_type
, &value
);
702 return "missing ')'";
707 else if (strncasecmp (*strp
+ 1, "gotoff12(", 9) == 0)
710 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
711 BFD_RELOC_FRV_GOTOFF12
,
712 &result_type
, &value
);
714 return "missing ')'";
719 else if (strncasecmp (*strp
+ 1, "gotofffuncdesc12(", 17) == 0)
722 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
723 BFD_RELOC_FRV_FUNCDESC_GOTOFF12
,
724 &result_type
, &value
);
726 return "missing ')'";
731 else if (strncasecmp (*strp
+ 1, "gottlsdesc12(", 13) == 0)
734 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
735 BFD_RELOC_FRV_GOTTLSDESC12
,
736 &result_type
, &value
);
738 return "missing ')'";
743 else if (strncasecmp (*strp
+ 1, "tlsmoff12(", 10) == 0)
746 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
747 BFD_RELOC_FRV_TLSMOFF12
,
748 &result_type
, &value
);
750 return "missing ')'";
755 else if (strncasecmp (*strp
+ 1, "gottlsoff12(", 12) == 0)
758 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
759 BFD_RELOC_FRV_GOTTLSOFF12
,
760 &result_type
, &value
);
762 return "missing ')'";
768 return cgen_parse_signed_integer (cd
, strp
, opindex
, valuep
);
772 parse_s12 (cd
, strp
, opindex
, valuep
)
779 enum cgen_parse_operand_result result_type
;
782 /* Check for small data reference. */
783 if (**strp
== '#' || **strp
== '%')
785 if (strncasecmp (*strp
+ 1, "gprel12(", 8) == 0)
788 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
789 BFD_RELOC_FRV_GPREL12
,
790 &result_type
, &value
);
792 return "missing `)'";
797 else if (strncasecmp (*strp
+ 1, "got12(", 6) == 0)
800 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
802 &result_type
, &value
);
804 return "missing ')'";
809 else if (strncasecmp (*strp
+ 1, "gotfuncdesc12(", 14) == 0)
812 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
813 BFD_RELOC_FRV_FUNCDESC_GOT12
,
814 &result_type
, &value
);
816 return "missing ')'";
821 else if (strncasecmp (*strp
+ 1, "gotoff12(", 9) == 0)
824 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
825 BFD_RELOC_FRV_GOTOFF12
,
826 &result_type
, &value
);
828 return "missing ')'";
833 else if (strncasecmp (*strp
+ 1, "gotofffuncdesc12(", 17) == 0)
836 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
837 BFD_RELOC_FRV_FUNCDESC_GOTOFF12
,
838 &result_type
, &value
);
840 return "missing ')'";
845 else if (strncasecmp (*strp
+ 1, "gottlsdesc12(", 13) == 0)
848 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
849 BFD_RELOC_FRV_GOTTLSDESC12
,
850 &result_type
, &value
);
852 return "missing ')'";
857 else if (strncasecmp (*strp
+ 1, "tlsmoff12(", 10) == 0)
860 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
861 BFD_RELOC_FRV_TLSMOFF12
,
862 &result_type
, &value
);
864 return "missing ')'";
869 else if (strncasecmp (*strp
+ 1, "gottlsoff12(", 12) == 0)
872 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
873 BFD_RELOC_FRV_GOTTLSOFF12
,
874 &result_type
, &value
);
876 return "missing ')'";
885 return cgen_parse_signed_integer (cd
, strp
, opindex
, valuep
);
889 parse_u12 (cd
, strp
, opindex
, valuep
)
896 enum cgen_parse_operand_result result_type
;
899 /* Check for small data reference. */
900 if ((**strp
== '#' || **strp
== '%')
901 && strncasecmp (*strp
+ 1, "gprel12(", 8) == 0)
904 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
905 BFD_RELOC_FRV_GPRELU12
,
906 &result_type
, &value
);
908 return "missing `)'";
917 return cgen_parse_signed_integer (cd
, strp
, opindex
, valuep
);
922 parse_A (cd
, strp
, opindex
, valuep
, A
)
934 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, opindex
, valuep
);
939 return "Value of A operand must be 0 or 1";
945 parse_A0 (cd
, strp
, opindex
, valuep
)
951 return parse_A (cd
, strp
, opindex
, valuep
, 0);
955 parse_A1 (cd
, strp
, opindex
, valuep
)
961 return parse_A (cd
, strp
, opindex
, valuep
, 1);
965 parse_even_register (cd
, strP
, tableP
, valueP
)
968 CGEN_KEYWORD
* tableP
;
972 const char * saved_star_strP
= * strP
;
974 errmsg
= cgen_parse_keyword (cd
, strP
, tableP
, valueP
);
976 if (errmsg
== NULL
&& ((* valueP
) & 1))
978 errmsg
= _("register number must be even");
979 * strP
= saved_star_strP
;
986 parse_call_label (CGEN_CPU_DESC cd
,
990 enum cgen_parse_operand_result
*resultp
,
996 /* Check for small data reference. */
997 if (opinfo
== 0 && (**strp
== '#' || **strp
== '%'))
999 if (strncasecmp (*strp
+ 1, "gettlsoff(", 10) == 0)
1002 errmsg
= parse_symbolic_address (cd
, strp
, opindex
,
1003 BFD_RELOC_FRV_GETTLSOFF
,
1006 return "missing `)'";
1013 return cgen_parse_address (cd
, strp
, opindex
, opinfo
, resultp
, valuep
);
1018 const char * frv_cgen_parse_operand
1019 PARAMS ((CGEN_CPU_DESC
, int, const char **, CGEN_FIELDS
*));
1021 /* Main entry point for operand parsing.
1023 This function is basically just a big switch statement. Earlier versions
1024 used tables to look up the function to use, but
1025 - if the table contains both assembler and disassembler functions then
1026 the disassembler contains much of the assembler and vice-versa,
1027 - there's a lot of inlining possibilities as things grow,
1028 - using a switch statement avoids the function call overhead.
1030 This function could be moved into `parse_insn_normal', but keeping it
1031 separate makes clear the interface between `parse_insn_normal' and each of
1035 frv_cgen_parse_operand (cd
, opindex
, strp
, fields
)
1039 CGEN_FIELDS
* fields
;
1041 const char * errmsg
= NULL
;
1042 /* Used by scalar operands that still need to be parsed. */
1043 long junk ATTRIBUTE_UNUSED
;
1047 case FRV_OPERAND_A0
:
1048 errmsg
= parse_A0 (cd
, strp
, FRV_OPERAND_A0
, &fields
->f_A
);
1050 case FRV_OPERAND_A1
:
1051 errmsg
= parse_A1 (cd
, strp
, FRV_OPERAND_A1
, &fields
->f_A
);
1053 case FRV_OPERAND_ACC40SI
:
1054 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_acc_names
, & fields
->f_ACC40Si
);
1056 case FRV_OPERAND_ACC40SK
:
1057 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_acc_names
, & fields
->f_ACC40Sk
);
1059 case FRV_OPERAND_ACC40UI
:
1060 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_acc_names
, & fields
->f_ACC40Ui
);
1062 case FRV_OPERAND_ACC40UK
:
1063 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_acc_names
, & fields
->f_ACC40Uk
);
1065 case FRV_OPERAND_ACCGI
:
1066 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_accg_names
, & fields
->f_ACCGi
);
1068 case FRV_OPERAND_ACCGK
:
1069 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_accg_names
, & fields
->f_ACCGk
);
1071 case FRV_OPERAND_CCI
:
1072 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_cccr_names
, & fields
->f_CCi
);
1074 case FRV_OPERAND_CPRDOUBLEK
:
1075 errmsg
= parse_even_register (cd
, strp
, & frv_cgen_opval_cpr_names
, & fields
->f_CPRk
);
1077 case FRV_OPERAND_CPRI
:
1078 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_cpr_names
, & fields
->f_CPRi
);
1080 case FRV_OPERAND_CPRJ
:
1081 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_cpr_names
, & fields
->f_CPRj
);
1083 case FRV_OPERAND_CPRK
:
1084 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_cpr_names
, & fields
->f_CPRk
);
1086 case FRV_OPERAND_CRI
:
1087 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_cccr_names
, & fields
->f_CRi
);
1089 case FRV_OPERAND_CRJ
:
1090 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_cccr_names
, & fields
->f_CRj
);
1092 case FRV_OPERAND_CRJ_FLOAT
:
1093 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_cccr_names
, & fields
->f_CRj_float
);
1095 case FRV_OPERAND_CRJ_INT
:
1096 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_cccr_names
, & fields
->f_CRj_int
);
1098 case FRV_OPERAND_CRK
:
1099 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_cccr_names
, & fields
->f_CRk
);
1101 case FRV_OPERAND_FCCI_1
:
1102 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_fccr_names
, & fields
->f_FCCi_1
);
1104 case FRV_OPERAND_FCCI_2
:
1105 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_fccr_names
, & fields
->f_FCCi_2
);
1107 case FRV_OPERAND_FCCI_3
:
1108 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_fccr_names
, & fields
->f_FCCi_3
);
1110 case FRV_OPERAND_FCCK
:
1111 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_fccr_names
, & fields
->f_FCCk
);
1113 case FRV_OPERAND_FRDOUBLEI
:
1114 errmsg
= parse_even_register (cd
, strp
, & frv_cgen_opval_fr_names
, & fields
->f_FRi
);
1116 case FRV_OPERAND_FRDOUBLEJ
:
1117 errmsg
= parse_even_register (cd
, strp
, & frv_cgen_opval_fr_names
, & fields
->f_FRj
);
1119 case FRV_OPERAND_FRDOUBLEK
:
1120 errmsg
= parse_even_register (cd
, strp
, & frv_cgen_opval_fr_names
, & fields
->f_FRk
);
1122 case FRV_OPERAND_FRI
:
1123 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_fr_names
, & fields
->f_FRi
);
1125 case FRV_OPERAND_FRINTI
:
1126 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_fr_names
, & fields
->f_FRi
);
1128 case FRV_OPERAND_FRINTIEVEN
:
1129 errmsg
= parse_even_register (cd
, strp
, & frv_cgen_opval_fr_names
, & fields
->f_FRi
);
1131 case FRV_OPERAND_FRINTJ
:
1132 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_fr_names
, & fields
->f_FRj
);
1134 case FRV_OPERAND_FRINTJEVEN
:
1135 errmsg
= parse_even_register (cd
, strp
, & frv_cgen_opval_fr_names
, & fields
->f_FRj
);
1137 case FRV_OPERAND_FRINTK
:
1138 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_fr_names
, & fields
->f_FRk
);
1140 case FRV_OPERAND_FRINTKEVEN
:
1141 errmsg
= parse_even_register (cd
, strp
, & frv_cgen_opval_fr_names
, & fields
->f_FRk
);
1143 case FRV_OPERAND_FRJ
:
1144 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_fr_names
, & fields
->f_FRj
);
1146 case FRV_OPERAND_FRK
:
1147 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_fr_names
, & fields
->f_FRk
);
1149 case FRV_OPERAND_FRKHI
:
1150 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_fr_names
, & fields
->f_FRk
);
1152 case FRV_OPERAND_FRKLO
:
1153 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_fr_names
, & fields
->f_FRk
);
1155 case FRV_OPERAND_GRDOUBLEK
:
1156 errmsg
= parse_even_register (cd
, strp
, & frv_cgen_opval_gr_names
, & fields
->f_GRk
);
1158 case FRV_OPERAND_GRI
:
1159 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_gr_names
, & fields
->f_GRi
);
1161 case FRV_OPERAND_GRJ
:
1162 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_gr_names
, & fields
->f_GRj
);
1164 case FRV_OPERAND_GRK
:
1165 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_gr_names
, & fields
->f_GRk
);
1167 case FRV_OPERAND_GRKHI
:
1168 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_gr_names
, & fields
->f_GRk
);
1170 case FRV_OPERAND_GRKLO
:
1171 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_gr_names
, & fields
->f_GRk
);
1173 case FRV_OPERAND_ICCI_1
:
1174 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_iccr_names
, & fields
->f_ICCi_1
);
1176 case FRV_OPERAND_ICCI_2
:
1177 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_iccr_names
, & fields
->f_ICCi_2
);
1179 case FRV_OPERAND_ICCI_3
:
1180 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_iccr_names
, & fields
->f_ICCi_3
);
1182 case FRV_OPERAND_LI
:
1183 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_LI
, &fields
->f_LI
);
1185 case FRV_OPERAND_LRAD
:
1186 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_LRAD
, &fields
->f_LRAD
);
1188 case FRV_OPERAND_LRAE
:
1189 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_LRAE
, &fields
->f_LRAE
);
1191 case FRV_OPERAND_LRAS
:
1192 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_LRAS
, &fields
->f_LRAS
);
1194 case FRV_OPERAND_TLBPRL
:
1195 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_TLBPRL
, &fields
->f_TLBPRL
);
1197 case FRV_OPERAND_TLBPROPX
:
1198 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_TLBPROPX
, &fields
->f_TLBPRopx
);
1200 case FRV_OPERAND_AE
:
1201 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_AE
, &fields
->f_ae
);
1203 case FRV_OPERAND_CALLANN
:
1204 errmsg
= parse_call_annotation (cd
, strp
, FRV_OPERAND_CALLANN
, &fields
->f_reloc_ann
);
1206 case FRV_OPERAND_CCOND
:
1207 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_CCOND
, &fields
->f_ccond
);
1209 case FRV_OPERAND_COND
:
1210 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_COND
, &fields
->f_cond
);
1212 case FRV_OPERAND_D12
:
1213 errmsg
= parse_d12 (cd
, strp
, FRV_OPERAND_D12
, &fields
->f_d12
);
1215 case FRV_OPERAND_DEBUG
:
1216 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_DEBUG
, &fields
->f_debug
);
1218 case FRV_OPERAND_EIR
:
1219 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_EIR
, &fields
->f_eir
);
1221 case FRV_OPERAND_HINT
:
1222 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_HINT
, &fields
->f_hint
);
1224 case FRV_OPERAND_HINT_NOT_TAKEN
:
1225 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_h_hint_not_taken
, & fields
->f_hint
);
1227 case FRV_OPERAND_HINT_TAKEN
:
1228 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_h_hint_taken
, & fields
->f_hint
);
1230 case FRV_OPERAND_LABEL16
:
1233 errmsg
= cgen_parse_address (cd
, strp
, FRV_OPERAND_LABEL16
, 0, NULL
, & value
);
1234 fields
->f_label16
= value
;
1237 case FRV_OPERAND_LABEL24
:
1240 errmsg
= parse_call_label (cd
, strp
, FRV_OPERAND_LABEL24
, 0, NULL
, & value
);
1241 fields
->f_label24
= value
;
1244 case FRV_OPERAND_LDANN
:
1245 errmsg
= parse_ld_annotation (cd
, strp
, FRV_OPERAND_LDANN
, &fields
->f_reloc_ann
);
1247 case FRV_OPERAND_LDDANN
:
1248 errmsg
= parse_ldd_annotation (cd
, strp
, FRV_OPERAND_LDDANN
, &fields
->f_reloc_ann
);
1250 case FRV_OPERAND_LOCK
:
1251 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_LOCK
, &fields
->f_lock
);
1253 case FRV_OPERAND_PACK
:
1254 errmsg
= cgen_parse_keyword (cd
, strp
, & frv_cgen_opval_h_pack
, & fields
->f_pack
);
1256 case FRV_OPERAND_S10
:
1257 errmsg
= cgen_parse_signed_integer (cd
, strp
, FRV_OPERAND_S10
, &fields
->f_s10
);
1259 case FRV_OPERAND_S12
:
1260 errmsg
= parse_s12 (cd
, strp
, FRV_OPERAND_S12
, &fields
->f_d12
);
1262 case FRV_OPERAND_S16
:
1263 errmsg
= cgen_parse_signed_integer (cd
, strp
, FRV_OPERAND_S16
, &fields
->f_s16
);
1265 case FRV_OPERAND_S5
:
1266 errmsg
= cgen_parse_signed_integer (cd
, strp
, FRV_OPERAND_S5
, &fields
->f_s5
);
1268 case FRV_OPERAND_S6
:
1269 errmsg
= cgen_parse_signed_integer (cd
, strp
, FRV_OPERAND_S6
, &fields
->f_s6
);
1271 case FRV_OPERAND_S6_1
:
1272 errmsg
= cgen_parse_signed_integer (cd
, strp
, FRV_OPERAND_S6_1
, &fields
->f_s6_1
);
1274 case FRV_OPERAND_SLO16
:
1275 errmsg
= parse_uslo16 (cd
, strp
, FRV_OPERAND_SLO16
, &fields
->f_s16
);
1277 case FRV_OPERAND_SPR
:
1278 errmsg
= parse_spr (cd
, strp
, & frv_cgen_opval_spr_names
, & fields
->f_spr
);
1280 case FRV_OPERAND_U12
:
1281 errmsg
= parse_u12 (cd
, strp
, FRV_OPERAND_U12
, &fields
->f_u12
);
1283 case FRV_OPERAND_U16
:
1284 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_U16
, &fields
->f_u16
);
1286 case FRV_OPERAND_U6
:
1287 errmsg
= cgen_parse_unsigned_integer (cd
, strp
, FRV_OPERAND_U6
, &fields
->f_u6
);
1289 case FRV_OPERAND_UHI16
:
1290 errmsg
= parse_uhi16 (cd
, strp
, FRV_OPERAND_UHI16
, &fields
->f_u16
);
1292 case FRV_OPERAND_ULO16
:
1293 errmsg
= parse_ulo16 (cd
, strp
, FRV_OPERAND_ULO16
, &fields
->f_u16
);
1297 /* xgettext:c-format */
1298 fprintf (stderr
, _("Unrecognized field %d while parsing.\n"), opindex
);
1305 cgen_parse_fn
* const frv_cgen_parse_handlers
[] =
1311 frv_cgen_init_asm (cd
)
1314 frv_cgen_init_opcode_table (cd
);
1315 frv_cgen_init_ibld_table (cd
);
1316 cd
->parse_handlers
= & frv_cgen_parse_handlers
[0];
1317 cd
->parse_operand
= frv_cgen_parse_operand
;
1322 /* Regex construction routine.
1324 This translates an opcode syntax string into a regex string,
1325 by replacing any non-character syntax element (such as an
1326 opcode) with the pattern '.*'
1328 It then compiles the regex and stores it in the opcode, for
1329 later use by frv_cgen_assemble_insn
1331 Returns NULL for success, an error message for failure. */
1334 frv_cgen_build_insn_regex (CGEN_INSN
*insn
)
1336 CGEN_OPCODE
*opc
= (CGEN_OPCODE
*) CGEN_INSN_OPCODE (insn
);
1337 const char *mnem
= CGEN_INSN_MNEMONIC (insn
);
1338 char rxbuf
[CGEN_MAX_RX_ELEMENTS
];
1340 const CGEN_SYNTAX_CHAR_TYPE
*syn
;
1343 syn
= CGEN_SYNTAX_STRING (CGEN_OPCODE_SYNTAX (opc
));
1345 /* Mnemonics come first in the syntax string. */
1346 if (! CGEN_SYNTAX_MNEMONIC_P (* syn
))
1347 return _("missing mnemonic in syntax string");
1350 /* Generate a case sensitive regular expression that emulates case
1351 insensitive matching in the "C" locale. We cannot generate a case
1352 insensitive regular expression because in Turkish locales, 'i' and 'I'
1353 are not equal modulo case conversion. */
1355 /* Copy the literal mnemonic out of the insn. */
1356 for (; *mnem
; mnem
++)
1363 *rx
++ = TOLOWER (c
);
1364 *rx
++ = TOUPPER (c
);
1371 /* Copy any remaining literals from the syntax string into the rx. */
1372 for(; * syn
!= 0 && rx
<= rxbuf
+ (CGEN_MAX_RX_ELEMENTS
- 7 - 4); ++syn
)
1374 if (CGEN_SYNTAX_CHAR_P (* syn
))
1376 char c
= CGEN_SYNTAX_CHAR (* syn
);
1380 /* Escape any regex metacharacters in the syntax. */
1381 case '.': case '[': case '\\':
1382 case '*': case '^': case '$':
1384 #ifdef CGEN_ESCAPE_EXTENDED_REGEX
1385 case '?': case '{': case '}':
1386 case '(': case ')': case '*':
1387 case '|': case '+': case ']':
1397 *rx
++ = TOLOWER (c
);
1398 *rx
++ = TOUPPER (c
);
1408 /* Replace non-syntax fields with globs. */
1414 /* Trailing whitespace ok. */
1421 /* But anchor it after that. */
1425 CGEN_INSN_RX (insn
) = xmalloc (sizeof (regex_t
));
1426 reg_err
= regcomp ((regex_t
*) CGEN_INSN_RX (insn
), rxbuf
, REG_NOSUB
);
1432 static char msg
[80];
1434 regerror (reg_err
, (regex_t
*) CGEN_INSN_RX (insn
), msg
, 80);
1435 regfree ((regex_t
*) CGEN_INSN_RX (insn
));
1436 free (CGEN_INSN_RX (insn
));
1437 (CGEN_INSN_RX (insn
)) = NULL
;
1443 /* Default insn parser.
1445 The syntax string is scanned and operands are parsed and stored in FIELDS.
1446 Relocs are queued as we go via other callbacks.
1448 ??? Note that this is currently an all-or-nothing parser. If we fail to
1449 parse the instruction, we return 0 and the caller will start over from
1450 the beginning. Backtracking will be necessary in parsing subexpressions,
1451 but that can be handled there. Not handling backtracking here may get
1452 expensive in the case of the m68k. Deal with later.
1454 Returns NULL for success, an error message for failure. */
1457 parse_insn_normal (CGEN_CPU_DESC cd
,
1458 const CGEN_INSN
*insn
,
1460 CGEN_FIELDS
*fields
)
1462 /* ??? Runtime added insns not handled yet. */
1463 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
1464 const char *str
= *strp
;
1467 const CGEN_SYNTAX_CHAR_TYPE
* syn
;
1468 #ifdef CGEN_MNEMONIC_OPERANDS
1473 /* For now we assume the mnemonic is first (there are no leading operands).
1474 We can parse it without needing to set up operand parsing.
1475 GAS's input scrubber will ensure mnemonics are lowercase, but we may
1476 not be called from GAS. */
1477 p
= CGEN_INSN_MNEMONIC (insn
);
1478 while (*p
&& TOLOWER (*p
) == TOLOWER (*str
))
1482 return _("unrecognized instruction");
1484 #ifndef CGEN_MNEMONIC_OPERANDS
1485 if (* str
&& ! ISSPACE (* str
))
1486 return _("unrecognized instruction");
1489 CGEN_INIT_PARSE (cd
);
1490 cgen_init_parse_operand (cd
);
1491 #ifdef CGEN_MNEMONIC_OPERANDS
1495 /* We don't check for (*str != '\0') here because we want to parse
1496 any trailing fake arguments in the syntax string. */
1497 syn
= CGEN_SYNTAX_STRING (syntax
);
1499 /* Mnemonics come first for now, ensure valid string. */
1500 if (! CGEN_SYNTAX_MNEMONIC_P (* syn
))
1507 /* Non operand chars must match exactly. */
1508 if (CGEN_SYNTAX_CHAR_P (* syn
))
1510 /* FIXME: While we allow for non-GAS callers above, we assume the
1511 first char after the mnemonic part is a space. */
1512 /* FIXME: We also take inappropriate advantage of the fact that
1513 GAS's input scrubber will remove extraneous blanks. */
1514 if (TOLOWER (*str
) == TOLOWER (CGEN_SYNTAX_CHAR (* syn
)))
1516 #ifdef CGEN_MNEMONIC_OPERANDS
1517 if (CGEN_SYNTAX_CHAR(* syn
) == ' ')
1525 /* Syntax char didn't match. Can't be this insn. */
1526 static char msg
[80];
1528 /* xgettext:c-format */
1529 sprintf (msg
, _("syntax error (expected char `%c', found `%c')"),
1530 CGEN_SYNTAX_CHAR(*syn
), *str
);
1535 /* Ran out of input. */
1536 static char msg
[80];
1538 /* xgettext:c-format */
1539 sprintf (msg
, _("syntax error (expected char `%c', found end of instruction)"),
1540 CGEN_SYNTAX_CHAR(*syn
));
1546 /* We have an operand of some sort. */
1547 errmsg
= cd
->parse_operand (cd
, CGEN_SYNTAX_FIELD (*syn
),
1552 /* Done with this operand, continue with next one. */
1556 /* If we're at the end of the syntax string, we're done. */
1559 /* FIXME: For the moment we assume a valid `str' can only contain
1560 blanks now. IE: We needn't try again with a longer version of
1561 the insn and it is assumed that longer versions of insns appear
1562 before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3). */
1563 while (ISSPACE (* str
))
1567 return _("junk at end of line"); /* FIXME: would like to include `str' */
1572 /* We couldn't parse it. */
1573 return _("unrecognized instruction");
1576 /* Main entry point.
1577 This routine is called for each instruction to be assembled.
1578 STR points to the insn to be assembled.
1579 We assume all necessary tables have been initialized.
1580 The assembled instruction, less any fixups, is stored in BUF.
1581 Remember that if CGEN_INT_INSN_P then BUF is an int and thus the value
1582 still needs to be converted to target byte order, otherwise BUF is an array
1583 of bytes in target byte order.
1584 The result is a pointer to the insn's entry in the opcode table,
1585 or NULL if an error occured (an error message will have already been
1588 Note that when processing (non-alias) macro-insns,
1589 this function recurses.
1591 ??? It's possible to make this cpu-independent.
1592 One would have to deal with a few minor things.
1593 At this point in time doing so would be more of a curiosity than useful
1594 [for example this file isn't _that_ big], but keeping the possibility in
1595 mind helps keep the design clean. */
1598 frv_cgen_assemble_insn (CGEN_CPU_DESC cd
,
1600 CGEN_FIELDS
*fields
,
1601 CGEN_INSN_BYTES_PTR buf
,
1605 CGEN_INSN_LIST
*ilist
;
1606 const char *parse_errmsg
= NULL
;
1607 const char *insert_errmsg
= NULL
;
1608 int recognized_mnemonic
= 0;
1610 /* Skip leading white space. */
1611 while (ISSPACE (* str
))
1614 /* The instructions are stored in hashed lists.
1615 Get the first in the list. */
1616 ilist
= CGEN_ASM_LOOKUP_INSN (cd
, str
);
1618 /* Keep looking until we find a match. */
1620 for ( ; ilist
!= NULL
; ilist
= CGEN_ASM_NEXT_INSN (ilist
))
1622 const CGEN_INSN
*insn
= ilist
->insn
;
1623 recognized_mnemonic
= 1;
1625 #ifdef CGEN_VALIDATE_INSN_SUPPORTED
1626 /* Not usually needed as unsupported opcodes
1627 shouldn't be in the hash lists. */
1628 /* Is this insn supported by the selected cpu? */
1629 if (! frv_cgen_insn_supported (cd
, insn
))
1632 /* If the RELAXED attribute is set, this is an insn that shouldn't be
1633 chosen immediately. Instead, it is used during assembler/linker
1634 relaxation if possible. */
1635 if (CGEN_INSN_ATTR_VALUE (insn
, CGEN_INSN_RELAXED
) != 0)
1640 /* Skip this insn if str doesn't look right lexically. */
1641 if (CGEN_INSN_RX (insn
) != NULL
&&
1642 regexec ((regex_t
*) CGEN_INSN_RX (insn
), str
, 0, NULL
, 0) == REG_NOMATCH
)
1645 /* Allow parse/insert handlers to obtain length of insn. */
1646 CGEN_FIELDS_BITSIZE (fields
) = CGEN_INSN_BITSIZE (insn
);
1648 parse_errmsg
= CGEN_PARSE_FN (cd
, insn
) (cd
, insn
, & str
, fields
);
1649 if (parse_errmsg
!= NULL
)
1652 /* ??? 0 is passed for `pc'. */
1653 insert_errmsg
= CGEN_INSERT_FN (cd
, insn
) (cd
, insn
, fields
, buf
,
1655 if (insert_errmsg
!= NULL
)
1658 /* It is up to the caller to actually output the insn and any
1664 static char errbuf
[150];
1665 #ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS
1666 const char *tmp_errmsg
;
1668 /* If requesting verbose error messages, use insert_errmsg.
1669 Failing that, use parse_errmsg. */
1670 tmp_errmsg
= (insert_errmsg
? insert_errmsg
:
1671 parse_errmsg
? parse_errmsg
:
1672 recognized_mnemonic
?
1673 _("unrecognized form of instruction") :
1674 _("unrecognized instruction"));
1676 if (strlen (start
) > 50)
1677 /* xgettext:c-format */
1678 sprintf (errbuf
, "%s `%.50s...'", tmp_errmsg
, start
);
1680 /* xgettext:c-format */
1681 sprintf (errbuf
, "%s `%.50s'", tmp_errmsg
, start
);
1683 if (strlen (start
) > 50)
1684 /* xgettext:c-format */
1685 sprintf (errbuf
, _("bad instruction `%.50s...'"), start
);
1687 /* xgettext:c-format */
1688 sprintf (errbuf
, _("bad instruction `%.50s'"), start
);
1696 #if 0 /* This calls back to GAS which we can't do without care. */
1698 /* Record each member of OPVALS in the assembler's symbol table.
1699 This lets GAS parse registers for us.
1700 ??? Interesting idea but not currently used. */
1702 /* Record each member of OPVALS in the assembler's symbol table.
1703 FIXME: Not currently used. */
1706 frv_cgen_asm_hash_keywords (CGEN_CPU_DESC cd
, CGEN_KEYWORD
*opvals
)
1708 CGEN_KEYWORD_SEARCH search
= cgen_keyword_search_init (opvals
, NULL
);
1709 const CGEN_KEYWORD_ENTRY
* ke
;
1711 while ((ke
= cgen_keyword_search_next (& search
)) != NULL
)
1713 #if 0 /* Unnecessary, should be done in the search routine. */
1714 if (! frv_cgen_opval_supported (ke
))
1717 cgen_asm_record_register (cd
, ke
->name
, ke
->value
);