1 /* m32c opcode support. -*- C -*-
3 Copyright 2005 Free Software Foundation, Inc.
5 Contributed by Red Hat Inc; developed under contract from Renesas
7 This file is part of the GNU Binutils.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
23 /* This file is an addendum to m32c.cpu. Heavy use of C code isn't
24 appropriate in .cpu files, so it resides here. This especially applies
25 to assembly/disassembly where parsing/printing can be quite involved.
26 Such things aren't really part of the specification of the cpu, per se,
27 so .cpu files provide the general framework and .opc files handle the
28 nitty-gritty details as necessary.
30 Each section is delimited with start and end markers.
32 <arch>-opc.h additions use: "-- opc.h"
33 <arch>-opc.c additions use: "-- opc.c"
34 <arch>-asm.c additions use: "-- asm.c"
35 <arch>-dis.c additions use: "-- dis.c"
36 <arch>-ibd.h additions use: "-- ibd.h"
41 /* Needed for RTL's 'ext' and 'trunc' operators. */
42 #include "cgen-types.h"
45 /* We can't use the default hash size because many bits are used by
47 #define CGEN_DIS_HASH_SIZE 1
48 #define CGEN_DIS_HASH(buf, value) 0
49 #define CGEN_VERBOSE_ASSEMBLER_ERRORS
50 #define CGEN_VALIDATE_INSN_SUPPORTED
52 extern int m32c_cgen_insn_supported (CGEN_CPU_DESC, const CGEN_INSN *);
54 #define CGEN_ASM_HASH_SIZE 0xffff
55 #define CGEN_ASM_HASH(mnem) m32c_asm_hash ((mnem))
61 m32c_asm_hash (const char *mnem)
65 /* The length of the mnemonic for the Jcnd insns is 1. Hash jsri. */
66 if (mnem[0] == 'j' && mnem[1] != 's')
69 /* Don't hash scCND */
70 if (mnem[0] == 's' && mnem[1] == 'c')
73 for (h = 0; *mnem && *mnem != ' ' && *mnem != ':'; ++mnem)
75 return h % CGEN_ASM_HASH_SIZE;
81 #define MACH_M32C 5 /* Must match md_begin. */
84 m32c_cgen_isa_register (const char **strp)
87 const char *s = *strp;
88 static char * m32c_register_names [] =
90 "r0", "r1", "r2", "r3", "r0l", "r0h", "r1l", "r1h",
91 "a0", "a1", "r2r0", "r3r1", "sp", "fb", "dct0", "dct1", "flg", "svf",
92 "drc0", "drc1", "dmd0", "dmd1", "intb", "svp", "vct", "isp", "dma0",
93 "dma1", "dra0", "dra1", "dsa0", "dsa1", 0
96 for (u = 0; m32c_register_names[u]; u++)
98 int len = strlen (m32c_register_names[u]);
100 if (memcmp (m32c_register_names[u], s, len) == 0
101 && (s[len] == 0 || ! ISALNUM (s[len])))
108 parse_unsigned6 (CGEN_CPU_DESC cd, const char **strp,
109 int opindex, unsigned long *valuep)
111 const char *errmsg = 0;
115 /* Don't successfully parse literals beginning with '[' */
117 return "Invalid literal"; /* anything -- will not be seen */
119 if (strncmp (*strp, "0x0", 3) == 0
120 || (**strp == '0' && *(*strp + 1) != 'x'))
123 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
128 return _("imm:6 immediate is out of range");
135 parse_unsigned8 (CGEN_CPU_DESC cd, const char **strp,
136 int opindex, unsigned long *valuep)
138 const char *errmsg = 0;
142 /* Don't successfully parse literals beginning with '[' */
144 return "Invalid literal"; /* anything -- will not be seen */
146 if (strncmp (*strp, "0x0", 3) == 0
147 || (**strp == '0' && *(*strp + 1) != 'x'))
150 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
155 return _("dsp:8 immediate is out of range");
157 /* If this field may require a relocation then use larger dsp16. */
158 if (! have_zero && value == 0)
159 return _("dsp:8 immediate is out of range");
166 parse_signed4 (CGEN_CPU_DESC cd, const char **strp,
167 int opindex, signed long *valuep)
169 const char *errmsg = 0;
173 /* Don't successfully parse literals beginning with '[' */
175 return "Invalid literal"; /* anything -- will not be seen */
177 if (strncmp (*strp, "0x0", 3) == 0
178 || (**strp == '0' && *(*strp + 1) != 'x'))
181 errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value);
185 if (value < -8 || value > 7)
186 return _("Immediate is out of range -8 to 7");
188 /* If this field may require a relocation then use larger dsp16. */
189 if (! have_zero && value == 0)
190 return _("Immediate is out of range -8 to 7");
197 parse_signed8 (CGEN_CPU_DESC cd, const char **strp,
198 int opindex, signed long *valuep)
200 const char *errmsg = 0;
203 /* Don't successfully parse literals beginning with '[' */
205 return "Invalid literal"; /* anything -- will not be seen */
207 errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value);
211 if (value <= 255 && value > 127)
214 if (value < -128 || value > 127)
215 return _("dsp:8 immediate is out of range");
222 parse_unsigned16 (CGEN_CPU_DESC cd, const char **strp,
223 int opindex, unsigned long *valuep)
225 const char *errmsg = 0;
229 /* Don't successfully parse literals beginning with '[' */
231 return "Invalid literal"; /* anything -- will not be seen */
233 /* Don't successfully parse register names */
234 if (m32c_cgen_isa_register (strp))
235 return "Invalid literal"; /* anything -- will not be seen */
237 if (strncmp (*strp, "0x0", 3) == 0
238 || (**strp == '0' && *(*strp + 1) != 'x'))
241 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
246 return _("dsp:16 immediate is out of range");
248 /* If this field may require a relocation then use larger dsp24. */
249 if (cd->machs == MACH_M32C && ! have_zero && value == 0
250 && (strncmp (*strp, "[a", 2) == 0
253 return _("dsp:16 immediate is out of range");
260 parse_signed16 (CGEN_CPU_DESC cd, const char **strp,
261 int opindex, signed long *valuep)
263 const char *errmsg = 0;
266 /* Don't successfully parse literals beginning with '[' */
268 return "Invalid literal"; /* anything -- will not be seen */
270 errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value);
274 if (value <= 65535 && value > 32767)
277 if (value < -32768 || value > 32767)
278 return _("dsp:16 immediate is out of range");
285 parse_unsigned20 (CGEN_CPU_DESC cd, const char **strp,
286 int opindex, unsigned long *valuep)
288 const char *errmsg = 0;
291 /* Don't successfully parse literals beginning with '[' */
293 return "Invalid literal"; /* anything -- will not be seen */
295 /* Don't successfully parse register names */
296 if (m32c_cgen_isa_register (strp))
297 return "Invalid literal"; /* anything -- will not be seen */
299 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
304 return _("dsp:20 immediate is out of range");
311 parse_unsigned24 (CGEN_CPU_DESC cd, const char **strp,
312 int opindex, unsigned long *valuep)
314 const char *errmsg = 0;
317 /* Don't successfully parse literals beginning with '[' */
319 return "Invalid literal"; /* anything -- will not be seen */
321 /* Don't successfully parse register names */
322 if (m32c_cgen_isa_register (strp))
323 return "Invalid literal"; /* anything -- will not be seen */
325 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
329 if (value > 0xffffff)
330 return _("dsp:24 immediate is out of range");
337 parse_signed32 (CGEN_CPU_DESC cd, const char **strp,
338 int opindex, signed long *valuep)
340 const char *errmsg = 0;
344 /* Don't successfully parse literals beginning with '[' */
346 return "Invalid literal"; /* anything -- will not be seen */
348 /* Don't successfully parse register names */
349 if (m32c_cgen_isa_register (strp))
350 return "Invalid literal"; /* anything -- will not be seen */
353 errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value);
362 parse_imm1_S (CGEN_CPU_DESC cd, const char **strp,
363 int opindex, signed long *valuep)
365 const char *errmsg = 0;
369 /* Don't successfully parse literals beginning with '[' */
371 return "Invalid literal"; /* anything -- will not be seen */
373 /* Don't successfully parse register names */
374 if (m32c_cgen_isa_register (strp))
375 return "Invalid literal"; /* anything -- will not be seen */
378 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
382 if (value < 1 || value > 2)
383 return _("immediate is out of range 1-2");
390 parse_imm3_S (CGEN_CPU_DESC cd, const char **strp,
391 int opindex, signed long *valuep)
393 const char *errmsg = 0;
397 /* Don't successfully parse literals beginning with '[' */
399 return "Invalid literal"; /* anything -- will not be seen */
401 /* Don't successfully parse register names */
402 if (m32c_cgen_isa_register (strp))
403 return "Invalid literal"; /* anything -- will not be seen */
406 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
410 if (value < 1 || value > 8)
411 return _("immediate is out of range 1-8");
418 parse_Bitno16R (CGEN_CPU_DESC cd, const char **strp,
419 int opindex, unsigned long *valuep)
421 const char *errmsg = 0;
425 /* Don't successfully parse literals beginning with '[' */
427 return "Invalid literal"; /* anything -- will not be seen */
430 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
435 return _("Bit number for indexing general register is out of range 0-15");
442 parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp,
443 int opindex, unsigned long *valuep,
446 const char *errmsg = 0;
449 const char *newp = *strp;
450 unsigned long long bitbase;
453 /* Don't successfully parse literals beginning with '[' */
455 return "Invalid literal"; /* anything -- will not be seen */
458 errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit);
463 return "Missing base for bit,base:8";
466 errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & base);
470 bitbase = (unsigned long long)bit + ((unsigned long long)base * 8);
472 if (bitbase >= (1ull << bits))
473 return _("bit,base is out of range");
481 parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp,
482 int opindex, signed long *valuep,
485 const char *errmsg = 0;
488 const char *newp = *strp;
493 /* Don't successfully parse literals beginning with '[' */
495 return "Invalid literal"; /* anything -- will not be seen */
498 errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit);
503 return "Missing base for bit,base:8";
506 errmsg = cgen_parse_signed_integer (cd, & newp, opindex, & base);
510 bitbase = (long long)bit + ((long long)base * 8);
512 limit = 1ll << (bits - 1);
513 if (bitbase < -limit || bitbase >= limit)
514 return _("bit,base is out of range");
522 parse_unsigned_bitbase8 (CGEN_CPU_DESC cd, const char **strp,
523 int opindex, unsigned long *valuep)
525 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 8);
529 parse_unsigned_bitbase11 (CGEN_CPU_DESC cd, const char **strp,
530 int opindex, unsigned long *valuep)
532 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 11);
536 parse_unsigned_bitbase16 (CGEN_CPU_DESC cd, const char **strp,
537 int opindex, unsigned long *valuep)
539 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 16);
543 parse_unsigned_bitbase19 (CGEN_CPU_DESC cd, const char **strp,
544 int opindex, unsigned long *valuep)
546 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 19);
550 parse_unsigned_bitbase27 (CGEN_CPU_DESC cd, const char **strp,
551 int opindex, unsigned long *valuep)
553 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 27);
557 parse_signed_bitbase8 (CGEN_CPU_DESC cd, const char **strp,
558 int opindex, signed long *valuep)
560 return parse_signed_bitbase (cd, strp, opindex, valuep, 8);
564 parse_signed_bitbase11 (CGEN_CPU_DESC cd, const char **strp,
565 int opindex, signed long *valuep)
567 return parse_signed_bitbase (cd, strp, opindex, valuep, 11);
571 parse_signed_bitbase19 (CGEN_CPU_DESC cd, const char **strp,
572 int opindex, signed long *valuep)
574 return parse_signed_bitbase (cd, strp, opindex, valuep, 19);
577 /* Parse the suffix as :<char> or as nothing followed by a whitespace. */
579 parse_suffix (const char **strp, char suffix)
581 const char *newp = *strp;
583 if (**strp == ':' && tolower (*(*strp + 1)) == suffix)
592 return "Invalid suffix"; /* anything -- will not be seen */
596 parse_S (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
597 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
599 return parse_suffix (strp, 's');
603 parse_G (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
604 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
606 return parse_suffix (strp, 'g');
610 parse_Q (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
611 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
613 return parse_suffix (strp, 'q');
617 parse_Z (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
618 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
620 return parse_suffix (strp, 'z');
623 /* Parse an empty suffix. Fail if the next char is ':'. */
625 parse_X (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
626 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
629 return "Unexpected suffix";
634 parse_r0l_r0h (CGEN_CPU_DESC cd, const char **strp,
635 int opindex ATTRIBUTE_UNUSED, signed long *valuep)
640 const char *newp = *strp;
643 errmsg = cgen_parse_keyword (cd, & newp, & m32c_cgen_opval_h_r0l_r0h, & value);
648 return "not a valid r0l/r0h pair";
651 /* Parse the second register in the pair */
652 if (value == 0) /* r0l */
653 errmsg = cgen_parse_keyword (cd, & newp, & m32c_cgen_opval_h_r0h, & junk);
655 errmsg = cgen_parse_keyword (cd, & newp, & m32c_cgen_opval_h_r0l, & junk);
664 /* Accept .b or .w in any case */
666 parse_size (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
667 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
670 && (*(*strp + 1) == 'b' || *(*strp + 1) == 'B'
671 || *(*strp + 1) == 'w' || *(*strp + 1) == 'W'))
676 return "Invalid size specifier";
679 /* static const char * parse_abs (CGEN_CPU_DESC, const char **, int, */
680 /* unsigned long *, unsigned long); */
681 /* static const char * parse_abs16 (CGEN_CPU_DESC, const char **, int, */
682 /* int ATTRIBUTE_UNUSED, */
683 /* enum cgen_parse_operand_result * ATTRIBUTE_UNUSED, */
684 /* unsigned long * ); */
685 /* static const char * parse_abs24 (CGEN_CPU_DESC, const char **, int, */
686 /* int ATTRIBUTE_UNUSED, */
687 /* enum cgen_parse_operand_result * ATTRIBUTE_UNUSED, */
688 /* unsigned long *); */
690 /* /\* Parse absolute *\/ */
692 /* static const char * */
693 /* parse_abs16 (CGEN_CPU_DESC cd, const char **strp, int opindex, */
694 /* int reloc ATTRIBUTE_UNUSED, */
695 /* enum cgen_parse_operand_result *type_addr ATTRIBUTE_UNUSED, */
696 /* unsigned long *valuep) */
698 /* return parse_abs (cd, strp, opindex, valuep, 16); */
701 /* static const char * */
702 /* parse_abs24 (CGEN_CPU_DESC cd, const char **strp, int opindex, */
703 /* int reloc ATTRIBUTE_UNUSED, */
704 /* enum cgen_parse_operand_result *type_addr ATTRIBUTE_UNUSED, */
705 /* unsigned long *valuep) */
707 /* return parse_abs (cd, strp, opindex, valuep, 24); */
710 /* static const char * */
711 /* parse_abs (CGEN_CPU_DESC cd, const char **strp, int opindex, */
712 /* unsigned long *valuep, */
713 /* unsigned long length) */
715 /* const char *errmsg = 0; */
716 /* const char *op; */
717 /* int has_register = 0; */
719 /* for (op = *strp; *op != '\0'; op++) */
721 /* if (*op == '[') */
723 /* has_register = 1; */
726 /* else if (*op == ',') */
730 /* if (has_register || m32c_cgen_isa_register (strp)) */
731 /* errmsg = _("immediate value cannot be register"); */
734 /* enum cgen_parse_operand_result result_type; */
736 /* const char *errmsg; */
738 /* errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16, */
739 /* &result_type, &value); */
740 /* *valuep = value; */
744 /* /\* Handle signed/unsigned literal. *\/ */
746 /* static const char * */
747 /* parse_imm8 (cd, strp, opindex, valuep) */
748 /* CGEN_CPU_DESC cd; */
749 /* const char **strp; */
751 /* unsigned long *valuep; */
753 /* const char *errmsg = 0; */
755 /* long have_zero = 0; */
757 /* if (strncmp (*strp, "0x0", 3) == 0 */
758 /* || (**strp == '0' && *(*strp + 1) != 'x')) */
760 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); */
761 /* *valuep = value; */
762 /* /\* If this field may require a relocation then use larger dsp16. *\/ */
763 /* if (! have_zero && value == 0) */
764 /* errmsg = _("immediate value may not fit in dsp8 field"); */
769 /* static const char * */
770 /* parse_imm16 (cd, strp, opindex, valuep) */
771 /* CGEN_CPU_DESC cd; */
772 /* const char **strp; */
774 /* unsigned long *valuep; */
776 /* const char *errmsg; */
779 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); */
780 /* *valuep = value; */
784 /* static const char * */
785 /* parse_imm24 (cd, strp, opindex, valuep) */
786 /* CGEN_CPU_DESC cd; */
787 /* const char **strp; */
789 /* unsigned long *valuep; */
791 /* const char *errmsg; */
794 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); */
795 /* *valuep = value; */
799 /* static const char * */
800 /* parse_imm32 (cd, strp, opindex, valuep) */
801 /* CGEN_CPU_DESC cd; */
802 /* const char **strp; */
804 /* unsigned long *valuep; */
806 /* const char *errmsg; */
809 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); */
810 /* *valuep = value; */
814 /* /\* Handle bitfields. *\/ */
816 /* static const char * */
817 /* parse_boff8 (cd, strp, opindex, valuep) */
818 /* CGEN_CPU_DESC cd; */
819 /* const char **strp; */
821 /* unsigned long *valuep; */
823 /* const char *errmsg; */
824 /* long bit_value, value; */
826 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & bit_value); */
827 /* if (errmsg == 0) */
829 /* *strp = *strp + 1; */
830 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); */
832 /* value = value * 8 + bit_value; */
833 /* *valuep = value; */
834 /* if (value > 0x100) */
835 /* errmsg = _("Operand out of range. Must be between 0 and 255."); */
839 /* static const char * */
840 /* parse_boff16 (cd, strp, opindex, valuep) */
841 /* CGEN_CPU_DESC cd; */
842 /* const char **strp; */
844 /* unsigned long *valuep; */
846 /* const char *errmsg; */
847 /* long bit_value, value; */
849 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & bit_value); */
850 /* if (errmsg == 0) */
852 /* *strp = *strp + 1; */
853 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); */
855 /* value = value * 8 + bit_value; */
856 /* *valuep = value; */
857 /* if (value > 0x1000) */
858 /* errmsg = _("Operand out of range. Must be between 0 and 65535."); */
863 /* Special check to ensure that instruction exists for given machine */
865 m32c_cgen_insn_supported (CGEN_CPU_DESC cd,
866 const CGEN_INSN *insn)
868 int machs = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_MACH);
869 int isas = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_ISA);
871 /* If attributes are absent, assume no restriction. */
875 return ((machs & cd->machs)
876 && (isas & cd->isas));
879 /* Parse a set of registers, R0,R1,A0,A1,SB,FB. */
882 parse_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
884 int opindex ATTRIBUTE_UNUSED,
885 unsigned long *valuep,
889 const char *errmsg = 0;
893 while (**strp && **strp != ')')
895 if (**strp == 'r' || **strp == 'R')
898 regno = **strp - '0';
900 errmsg = _("Register number is not valid");
902 else if (**strp == 'a' || **strp == 'A')
905 regno = **strp - '0';
907 errmsg = _("Register number is not valid");
908 regno = **strp - '0' + 4;
911 else if (strncasecmp (*strp, "sb", 2) == 0 || strncasecmp (*strp, "SB", 2) == 0)
917 else if (strncasecmp (*strp, "fb", 2) == 0 || strncasecmp (*strp, "FB", 2) == 0)
923 if (push) /* Mask is reversed for push. */
924 *valuep |= 0x80 >> regno;
926 *valuep |= 1 << regno;
931 if (*(*strp + 1) == ')')
938 errmsg = _("Register list is not valid");
947 parse_pop_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
949 int opindex ATTRIBUTE_UNUSED,
950 unsigned long *valuep)
952 return parse_regset (cd, strp, opindex, valuep, POP);
956 parse_push_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
958 int opindex ATTRIBUTE_UNUSED,
959 unsigned long *valuep)
961 return parse_regset (cd, strp, opindex, valuep, PUSH);
966 #include "elf/m32c.h"
969 /* Always print the short insn format suffix as ':<char>' */
971 print_suffix (PTR dis_info, char suffix)
973 disassemble_info *info = dis_info;
974 (*info->fprintf_func) (info->stream, ":%c", suffix);
978 print_S (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
980 long value ATTRIBUTE_UNUSED,
981 unsigned int attrs ATTRIBUTE_UNUSED,
982 bfd_vma pc ATTRIBUTE_UNUSED,
983 int length ATTRIBUTE_UNUSED)
985 print_suffix (dis_info, 's');
990 print_G (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
992 long value ATTRIBUTE_UNUSED,
993 unsigned int attrs ATTRIBUTE_UNUSED,
994 bfd_vma pc ATTRIBUTE_UNUSED,
995 int length ATTRIBUTE_UNUSED)
997 print_suffix (dis_info, 'g');
1001 print_Q (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1003 long value ATTRIBUTE_UNUSED,
1004 unsigned int attrs ATTRIBUTE_UNUSED,
1005 bfd_vma pc ATTRIBUTE_UNUSED,
1006 int length ATTRIBUTE_UNUSED)
1008 print_suffix (dis_info, 'q');
1012 print_Z (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1014 long value ATTRIBUTE_UNUSED,
1015 unsigned int attrs ATTRIBUTE_UNUSED,
1016 bfd_vma pc ATTRIBUTE_UNUSED,
1017 int length ATTRIBUTE_UNUSED)
1019 print_suffix (dis_info, 'z');
1022 /* Print the empty suffix */
1024 print_X (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1025 PTR dis_info ATTRIBUTE_UNUSED,
1026 long value ATTRIBUTE_UNUSED,
1027 unsigned int attrs ATTRIBUTE_UNUSED,
1028 bfd_vma pc ATTRIBUTE_UNUSED,
1029 int length ATTRIBUTE_UNUSED)
1035 print_r0l_r0h (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1038 unsigned int attrs ATTRIBUTE_UNUSED,
1039 bfd_vma pc ATTRIBUTE_UNUSED,
1040 int length ATTRIBUTE_UNUSED)
1042 disassemble_info *info = dis_info;
1044 (*info->fprintf_func) (info->stream, "r0h,r0l");
1046 (*info->fprintf_func) (info->stream, "r0l,r0h");
1050 print_unsigned_bitbase (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1052 unsigned long value,
1053 unsigned int attrs ATTRIBUTE_UNUSED,
1054 bfd_vma pc ATTRIBUTE_UNUSED,
1055 int length ATTRIBUTE_UNUSED)
1057 disassemble_info *info = dis_info;
1058 (*info->fprintf_func) (info->stream, "%ld,0x%lx", value & 0x7, value >> 3);
1062 print_signed_bitbase (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1065 unsigned int attrs ATTRIBUTE_UNUSED,
1066 bfd_vma pc ATTRIBUTE_UNUSED,
1067 int length ATTRIBUTE_UNUSED)
1069 disassemble_info *info = dis_info;
1070 (*info->fprintf_func) (info->stream, "%ld,%ld", value & 0x7, value >> 3);
1074 print_size (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1076 long value ATTRIBUTE_UNUSED,
1077 unsigned int attrs ATTRIBUTE_UNUSED,
1078 bfd_vma pc ATTRIBUTE_UNUSED,
1079 int length ATTRIBUTE_UNUSED)
1081 /* Always print the size as '.w' */
1082 disassemble_info *info = dis_info;
1083 (*info->fprintf_func) (info->stream, ".w");
1089 static void print_pop_regset (CGEN_CPU_DESC, PTR, long, unsigned int, bfd_vma, int);
1090 static void print_push_regset (CGEN_CPU_DESC, PTR, long, unsigned int, bfd_vma, int);
1092 /* Print a set of registers, R0,R1,A0,A1,SB,FB. */
1095 print_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1098 unsigned int attrs ATTRIBUTE_UNUSED,
1099 bfd_vma pc ATTRIBUTE_UNUSED,
1100 int length ATTRIBUTE_UNUSED,
1103 static char * m16c_register_names [] =
1105 "r0", "r1", "r2", "r3", "a0", "a1", "sb", "fb"
1107 disassemble_info *info = dis_info;
1119 (*info->fprintf_func) (info->stream, "%s", m16c_register_names [0]);
1123 for (index = 1; index <= 7; ++index)
1132 (*info->fprintf_func) (info->stream, "%s%s", comma,
1133 m16c_register_names [index]);
1140 print_pop_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1143 unsigned int attrs ATTRIBUTE_UNUSED,
1144 bfd_vma pc ATTRIBUTE_UNUSED,
1145 int length ATTRIBUTE_UNUSED)
1147 print_regset (cd, dis_info, value, attrs, pc, length, POP);
1151 print_push_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1154 unsigned int attrs ATTRIBUTE_UNUSED,
1155 bfd_vma pc ATTRIBUTE_UNUSED,
1156 int length ATTRIBUTE_UNUSED)
1158 print_regset (cd, dis_info, value, attrs, pc, length, PUSH);
1160 #if 0 /* not used? */
1162 print_boff (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1165 unsigned int attrs ATTRIBUTE_UNUSED,
1166 bfd_vma pc ATTRIBUTE_UNUSED,
1167 int length ATTRIBUTE_UNUSED)
1169 disassemble_info *info = dis_info;
1171 info->fprintf_func (info->stream, "%d,%d", value % 16,
1175 #endif /* not used? */