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". */
40 /* Needed for RTL's 'ext' and 'trunc' operators. */
41 #include "cgen-types.h"
44 /* We can't use the default hash size because many bits are used by
46 #define CGEN_DIS_HASH_SIZE 1
47 #define CGEN_DIS_HASH(buf, value) 0
48 #define CGEN_VERBOSE_ASSEMBLER_ERRORS
49 #define CGEN_VALIDATE_INSN_SUPPORTED
51 extern int m32c_cgen_insn_supported (CGEN_CPU_DESC, const CGEN_INSN *);
53 #define CGEN_ASM_HASH_SIZE 0xffff
54 #define CGEN_ASM_HASH(mnem) m32c_asm_hash ((mnem))
60 m32c_asm_hash (const char *mnem)
64 /* The length of the mnemonic for the Jcnd insns is 1. Hash jsri. */
65 if (mnem[0] == 'j' && mnem[1] != 's')
68 /* Don't hash scCND */
69 if (mnem[0] == 's' && mnem[1] == 'c')
72 /* Don't hash bmCND */
73 if (mnem[0] == 'b' && mnem[1] == 'm')
76 for (h = 0; *mnem && *mnem != ' ' && *mnem != ':'; ++mnem)
78 return h % CGEN_ASM_HASH_SIZE;
82 #include "safe-ctype.h"
84 #define MACH_M32C 5 /* Must match md_begin. */
87 m32c_cgen_isa_register (const char **strp)
90 const char *s = *strp;
91 static char * m32c_register_names [] =
93 "r0", "r1", "r2", "r3", "r0l", "r0h", "r1l", "r1h",
94 "a0", "a1", "r2r0", "r3r1", "sp", "fb", "dct0", "dct1", "flg", "svf",
95 "drc0", "drc1", "dmd0", "dmd1", "intb", "svp", "vct", "isp", "dma0",
96 "dma1", "dra0", "dra1", "dsa0", "dsa1", 0
99 for (u = 0; m32c_register_names[u]; u++)
101 int len = strlen (m32c_register_names[u]);
103 if (memcmp (m32c_register_names[u], s, len) == 0
104 && (s[len] == 0 || ! ISALNUM (s[len])))
110 #define PARSE_UNSIGNED \
113 /* Don't successfully parse literals beginning with '['. */ \
115 return "Invalid literal"; /* Anything -- will not be seen. */ \
117 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);\
123 #define PARSE_SIGNED \
126 /* Don't successfully parse literals beginning with '['. */ \
128 return "Invalid literal"; /* Anything -- will not be seen. */ \
130 errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); \
137 parse_unsigned6 (CGEN_CPU_DESC cd, const char **strp,
138 int opindex, unsigned long *valuep)
140 const char *errmsg = 0;
146 return _("imm:6 immediate is out of range");
153 parse_unsigned8 (CGEN_CPU_DESC cd, const char **strp,
154 int opindex, unsigned long *valuep)
156 const char *errmsg = 0;
160 if (strncasecmp (*strp, "%dsp8(", 6) == 0)
162 enum cgen_parse_operand_result result_type;
167 errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_8,
168 & result_type, & value);
170 return _("missing `)'");
174 && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
176 return _("%dsp8() takes a symbolic address, not a number");
182 if (strncmp (*strp, "0x0", 3) == 0
183 || (**strp == '0' && *(*strp + 1) != 'x'))
189 return _("dsp:8 immediate is out of range");
191 /* If this field may require a relocation then use larger dsp16. */
192 if (! have_zero && value == 0)
193 return _("dsp:8 immediate is out of range");
200 parse_signed4 (CGEN_CPU_DESC cd, const char **strp,
201 int opindex, signed long *valuep)
203 const char *errmsg = 0;
207 if (strncmp (*strp, "0x0", 3) == 0
208 || (**strp == '0' && *(*strp + 1) != 'x'))
213 if (value < -8 || value > 7)
214 return _("Immediate is out of range -8 to 7");
216 /* If this field may require a relocation then use larger dsp16. */
217 if (! have_zero && value == 0)
218 return _("Immediate is out of range -8 to 7");
225 parse_signed4n (CGEN_CPU_DESC cd, const char **strp,
226 int opindex, signed long *valuep)
228 const char *errmsg = 0;
232 if (strncmp (*strp, "0x0", 3) == 0
233 || (**strp == '0' && *(*strp + 1) != 'x'))
238 if (value < -7 || value > 8)
239 return _("Immediate is out of range -7 to 8");
241 /* If this field may require a relocation then use larger dsp16. */
242 if (! have_zero && value == 0)
243 return _("Immediate is out of range -7 to 8");
250 parse_signed8 (CGEN_CPU_DESC cd, const char **strp,
251 int opindex, signed long *valuep)
253 const char *errmsg = 0;
256 if (strncasecmp (*strp, "%hi8(", 5) == 0)
258 enum cgen_parse_operand_result result_type;
263 errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_M32C_HI8,
264 & result_type, & value);
266 return _("missing `)'");
270 && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
280 if (value <= 255 && value > 127)
283 if (value < -128 || value > 127)
284 return _("dsp:8 immediate is out of range");
291 parse_unsigned16 (CGEN_CPU_DESC cd, const char **strp,
292 int opindex, unsigned long *valuep)
294 const char *errmsg = 0;
298 if (strncasecmp (*strp, "%dsp16(", 7) == 0)
300 enum cgen_parse_operand_result result_type;
305 errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_16,
306 & result_type, & value);
308 return _("missing `)'");
312 && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
314 return _("%dsp16() takes a symbolic address, not a number");
320 /* Don't successfully parse literals beginning with '['. */
322 return "Invalid literal"; /* Anything -- will not be seen. */
324 /* Don't successfully parse register names. */
325 if (m32c_cgen_isa_register (strp))
326 return "Invalid literal"; /* Anything -- will not be seen. */
328 if (strncmp (*strp, "0x0", 3) == 0
329 || (**strp == '0' && *(*strp + 1) != 'x'))
332 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
337 return _("dsp:16 immediate is out of range");
339 /* If this field may require a relocation then use larger dsp24. */
340 if (cd->machs == MACH_M32C && ! have_zero && value == 0
341 && (strncmp (*strp, "[a", 2) == 0
344 return _("dsp:16 immediate is out of range");
351 parse_signed16 (CGEN_CPU_DESC cd, const char **strp,
352 int opindex, signed long *valuep)
354 const char *errmsg = 0;
357 if (strncasecmp (*strp, "%lo16(", 6) == 0)
359 enum cgen_parse_operand_result result_type;
364 errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16,
365 & result_type, & value);
367 return _("missing `)'");
371 && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
379 if (strncasecmp (*strp, "%hi16(", 6) == 0)
381 enum cgen_parse_operand_result result_type;
386 errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16,
387 & result_type, & value);
389 return _("missing `)'");
393 && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
403 if (value <= 65535 && value > 32767)
406 if (value < -32768 || value > 32767)
407 return _("dsp:16 immediate is out of range");
414 parse_unsigned20 (CGEN_CPU_DESC cd, const char **strp,
415 int opindex, unsigned long *valuep)
417 const char *errmsg = 0;
420 /* Don't successfully parse literals beginning with '['. */
422 return "Invalid literal"; /* Anything -- will not be seen. */
424 /* Don't successfully parse register names. */
425 if (m32c_cgen_isa_register (strp))
426 return "Invalid literal"; /* Anything -- will not be seen. */
428 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
433 return _("dsp:20 immediate is out of range");
440 parse_unsigned24 (CGEN_CPU_DESC cd, const char **strp,
441 int opindex, unsigned long *valuep)
443 const char *errmsg = 0;
446 /* Don't successfully parse literals beginning with '['. */
448 return "Invalid literal"; /* Anything -- will not be seen. */
450 /* Don't successfully parse register names. */
451 if (m32c_cgen_isa_register (strp))
452 return "Invalid literal"; /* Anything -- will not be seen. */
454 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
458 if (value > 0xffffff)
459 return _("dsp:24 immediate is out of range");
465 /* This should only be used for #imm->reg. */
467 parse_signed24 (CGEN_CPU_DESC cd, const char **strp,
468 int opindex, signed long *valuep)
470 const char *errmsg = 0;
475 if (value <= 0xffffff && value > 0x7fffff)
478 if (value > 0xffffff)
479 return _("dsp:24 immediate is out of range");
486 parse_signed32 (CGEN_CPU_DESC cd, const char **strp,
487 int opindex, signed long *valuep)
489 const char *errmsg = 0;
492 errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value);
501 parse_imm1_S (CGEN_CPU_DESC cd, const char **strp,
502 int opindex, signed long *valuep)
504 const char *errmsg = 0;
507 errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value);
511 if (value < 1 || value > 2)
512 return _("immediate is out of range 1-2");
519 parse_imm3_S (CGEN_CPU_DESC cd, const char **strp,
520 int opindex, signed long *valuep)
522 const char *errmsg = 0;
525 errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value);
529 if (value < 1 || value > 8)
530 return _("immediate is out of range 1-8");
537 parse_bit3_S (CGEN_CPU_DESC cd, const char **strp,
538 int opindex, signed long *valuep)
540 const char *errmsg = 0;
543 errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value);
547 if (value < 0 || value > 7)
548 return _("immediate is out of range 0-7");
555 parse_lab_5_3 (CGEN_CPU_DESC cd,
557 int opindex ATTRIBUTE_UNUSED,
559 enum cgen_parse_operand_result *type_addr,
562 const char *errmsg = 0;
564 enum cgen_parse_operand_result op_res;
566 errmsg = cgen_parse_address (cd, strp, M32C_OPERAND_LAB_5_3,
567 opinfo, & op_res, & value);
572 if (op_res == CGEN_PARSE_OPERAND_ADDRESS)
574 /* This is a hack; the field cannot handle near-zero signed
575 offsets that CGEN wants to put in to indicate an "empty"
583 if (value < 2 || value > 9)
584 return _("immediate is out of range 2-9");
591 parse_Bitno16R (CGEN_CPU_DESC cd, const char **strp,
592 int opindex, unsigned long *valuep)
594 const char *errmsg = 0;
597 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
602 return _("Bit number for indexing general register is out of range 0-15");
609 parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp,
610 int opindex, unsigned long *valuep,
611 unsigned bits, int allow_syms)
613 const char *errmsg = 0;
616 const char *newp = *strp;
617 unsigned long long bitbase;
620 errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit);
625 return "Missing base for bit,base:8";
629 if (strncmp (newp, "0x0", 3) == 0
630 || (newp[0] == '0' && newp[1] != 'x'))
633 errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & base);
637 bitbase = (unsigned long long) bit + ((unsigned long long) base * 8);
639 if (bitbase >= (1ull << bits))
640 return _("bit,base is out of range");
642 /* If this field may require a relocation then use larger displacement. */
643 if (! have_zero && base == 0)
645 switch (allow_syms) {
647 return _("bit,base out of range for symbol");
651 if (strncmp (newp, "[sb]", 4) != 0)
652 return _("bit,base out of range for symbol");
663 parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp,
664 int opindex, signed long *valuep,
665 unsigned bits, int allow_syms)
667 const char *errmsg = 0;
670 const char *newp = *strp;
675 errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit);
680 return "Missing base for bit,base:8";
684 if (strncmp (newp, "0x0", 3) == 0
685 || (newp[0] == '0' && newp[1] != 'x'))
688 errmsg = cgen_parse_signed_integer (cd, & newp, opindex, & base);
692 bitbase = (long long)bit + ((long long)base * 8);
694 limit = 1ll << (bits - 1);
695 if (bitbase < -limit || bitbase >= limit)
696 return _("bit,base is out of range");
698 /* If this field may require a relocation then use larger displacement. */
699 if (! have_zero && base == 0 && ! allow_syms)
700 return _("bit,base out of range for symbol");
708 parse_unsigned_bitbase8 (CGEN_CPU_DESC cd, const char **strp,
709 int opindex, unsigned long *valuep)
711 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 8, 0);
715 parse_unsigned_bitbase11 (CGEN_CPU_DESC cd, const char **strp,
716 int opindex, unsigned long *valuep)
718 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 11, 0);
722 parse_unsigned_bitbase16 (CGEN_CPU_DESC cd, const char **strp,
723 int opindex, unsigned long *valuep)
725 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 16, 1);
729 parse_unsigned_bitbase19 (CGEN_CPU_DESC cd, const char **strp,
730 int opindex, unsigned long *valuep)
732 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 19, 2);
736 parse_unsigned_bitbase27 (CGEN_CPU_DESC cd, const char **strp,
737 int opindex, unsigned long *valuep)
739 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 27, 1);
743 parse_signed_bitbase8 (CGEN_CPU_DESC cd, const char **strp,
744 int opindex, signed long *valuep)
746 return parse_signed_bitbase (cd, strp, opindex, valuep, 8, 1);
750 parse_signed_bitbase11 (CGEN_CPU_DESC cd, const char **strp,
751 int opindex, signed long *valuep)
753 return parse_signed_bitbase (cd, strp, opindex, valuep, 11, 0);
757 parse_signed_bitbase19 (CGEN_CPU_DESC cd, const char **strp,
758 int opindex, signed long *valuep)
760 return parse_signed_bitbase (cd, strp, opindex, valuep, 19, 1);
763 /* Parse the suffix as :<char> or as nothing followed by a whitespace. */
766 parse_suffix (const char **strp, char suffix)
768 const char *newp = *strp;
770 if (**strp == ':' && TOLOWER (*(*strp + 1)) == suffix)
779 return "Invalid suffix"; /* Anything -- will not be seen. */
783 parse_S (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
784 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
786 return parse_suffix (strp, 's');
790 parse_G (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
791 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
793 return parse_suffix (strp, 'g');
797 parse_Q (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
798 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
800 return parse_suffix (strp, 'q');
804 parse_Z (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
805 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
807 return parse_suffix (strp, 'z');
810 /* Parse an empty suffix. Fail if the next char is ':'. */
813 parse_X (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
814 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
817 return "Unexpected suffix";
822 parse_r0l_r0h (CGEN_CPU_DESC cd, const char **strp,
823 int opindex ATTRIBUTE_UNUSED, signed long *valuep)
828 const char *newp = *strp;
831 errmsg = cgen_parse_keyword (cd, & newp, & m32c_cgen_opval_h_r0l_r0h, & value);
836 return _("not a valid r0l/r0h pair");
839 /* Parse the second register in the pair. */
840 if (value == 0) /* r0l */
841 errmsg = cgen_parse_keyword (cd, & newp, & m32c_cgen_opval_h_r0h, & junk);
843 errmsg = cgen_parse_keyword (cd, & newp, & m32c_cgen_opval_h_r0l, & junk);
852 /* Accept .b or .w in any case. */
855 parse_size (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
856 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
859 && (*(*strp + 1) == 'b' || *(*strp + 1) == 'B'
860 || *(*strp + 1) == 'w' || *(*strp + 1) == 'W'))
866 return _("Invalid size specifier");
869 /* Special check to ensure that instruction exists for given machine. */
872 m32c_cgen_insn_supported (CGEN_CPU_DESC cd,
873 const CGEN_INSN *insn)
875 int machs = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_MACH);
876 CGEN_BITSET isas = CGEN_INSN_BITSET_ATTR_VALUE (insn, CGEN_INSN_ISA);
878 /* If attributes are absent, assume no restriction. */
882 return ((machs & cd->machs)
883 && cgen_bitset_intersect_p (& isas, cd->isas));
886 /* Parse a set of registers, R0,R1,A0,A1,SB,FB. */
889 parse_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
891 int opindex ATTRIBUTE_UNUSED,
892 unsigned long *valuep,
895 const char *errmsg = 0;
899 while (**strp && **strp != ')')
901 if (**strp == 'r' || **strp == 'R')
904 regno = **strp - '0';
906 errmsg = _("Register number is not valid");
908 else if (**strp == 'a' || **strp == 'A')
911 regno = **strp - '0';
913 errmsg = _("Register number is not valid");
914 regno = **strp - '0' + 4;
917 else if (strncasecmp (*strp, "sb", 2) == 0 || strncasecmp (*strp, "SB", 2) == 0)
923 else if (strncasecmp (*strp, "fb", 2) == 0 || strncasecmp (*strp, "FB", 2) == 0)
929 if (push) /* Mask is reversed for push. */
930 *valuep |= 0x80 >> regno;
932 *valuep |= 1 << regno;
937 if (*(*strp + 1) == ')')
944 errmsg = _("Register list is not valid");
953 parse_pop_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
955 int opindex ATTRIBUTE_UNUSED,
956 unsigned long *valuep)
958 return parse_regset (cd, strp, opindex, valuep, POP);
962 parse_push_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
964 int opindex ATTRIBUTE_UNUSED,
965 unsigned long *valuep)
967 return parse_regset (cd, strp, opindex, valuep, PUSH);
972 #include "elf/m32c.h"
975 /* Always print the short insn format suffix as ':<char>'. */
978 print_suffix (void * dis_info, char suffix)
980 disassemble_info *info = dis_info;
982 (*info->fprintf_func) (info->stream, ":%c", suffix);
986 print_S (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
988 long value ATTRIBUTE_UNUSED,
989 unsigned int attrs ATTRIBUTE_UNUSED,
990 bfd_vma pc ATTRIBUTE_UNUSED,
991 int length ATTRIBUTE_UNUSED)
993 print_suffix (dis_info, 's');
998 print_G (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1000 long value ATTRIBUTE_UNUSED,
1001 unsigned int attrs ATTRIBUTE_UNUSED,
1002 bfd_vma pc ATTRIBUTE_UNUSED,
1003 int length ATTRIBUTE_UNUSED)
1005 print_suffix (dis_info, 'g');
1009 print_Q (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1011 long value ATTRIBUTE_UNUSED,
1012 unsigned int attrs ATTRIBUTE_UNUSED,
1013 bfd_vma pc ATTRIBUTE_UNUSED,
1014 int length ATTRIBUTE_UNUSED)
1016 print_suffix (dis_info, 'q');
1020 print_Z (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1022 long value ATTRIBUTE_UNUSED,
1023 unsigned int attrs ATTRIBUTE_UNUSED,
1024 bfd_vma pc ATTRIBUTE_UNUSED,
1025 int length ATTRIBUTE_UNUSED)
1027 print_suffix (dis_info, 'z');
1030 /* Print the empty suffix. */
1033 print_X (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1034 void * dis_info ATTRIBUTE_UNUSED,
1035 long value ATTRIBUTE_UNUSED,
1036 unsigned int attrs ATTRIBUTE_UNUSED,
1037 bfd_vma pc ATTRIBUTE_UNUSED,
1038 int length ATTRIBUTE_UNUSED)
1044 print_r0l_r0h (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1047 unsigned int attrs ATTRIBUTE_UNUSED,
1048 bfd_vma pc ATTRIBUTE_UNUSED,
1049 int length ATTRIBUTE_UNUSED)
1051 disassemble_info *info = dis_info;
1054 (*info->fprintf_func) (info->stream, "r0h,r0l");
1056 (*info->fprintf_func) (info->stream, "r0l,r0h");
1060 print_unsigned_bitbase (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1062 unsigned long value,
1063 unsigned int attrs ATTRIBUTE_UNUSED,
1064 bfd_vma pc ATTRIBUTE_UNUSED,
1065 int length ATTRIBUTE_UNUSED)
1067 disassemble_info *info = dis_info;
1069 (*info->fprintf_func) (info->stream, "%ld,0x%lx", value & 0x7, value >> 3);
1073 print_signed_bitbase (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1076 unsigned int attrs ATTRIBUTE_UNUSED,
1077 bfd_vma pc ATTRIBUTE_UNUSED,
1078 int length ATTRIBUTE_UNUSED)
1080 disassemble_info *info = dis_info;
1082 (*info->fprintf_func) (info->stream, "%ld,%ld", value & 0x7, value >> 3);
1086 print_size (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1088 long value ATTRIBUTE_UNUSED,
1089 unsigned int attrs ATTRIBUTE_UNUSED,
1090 bfd_vma pc ATTRIBUTE_UNUSED,
1091 int length ATTRIBUTE_UNUSED)
1093 /* Always print the size as '.w'. */
1094 disassemble_info *info = dis_info;
1096 (*info->fprintf_func) (info->stream, ".w");
1102 static void print_pop_regset (CGEN_CPU_DESC, void *, long, unsigned int, bfd_vma, int);
1103 static void print_push_regset (CGEN_CPU_DESC, void *, long, unsigned int, bfd_vma, int);
1105 /* Print a set of registers, R0,R1,A0,A1,SB,FB. */
1108 print_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1111 unsigned int attrs ATTRIBUTE_UNUSED,
1112 bfd_vma pc ATTRIBUTE_UNUSED,
1113 int length ATTRIBUTE_UNUSED,
1116 static char * m16c_register_names [] =
1118 "r0", "r1", "r2", "r3", "a0", "a1", "sb", "fb"
1120 disassemble_info *info = dis_info;
1132 (*info->fprintf_func) (info->stream, "%s", m16c_register_names [0]);
1136 for (index = 1; index <= 7; ++index)
1145 (*info->fprintf_func) (info->stream, "%s%s", comma,
1146 m16c_register_names [index]);
1153 print_pop_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1156 unsigned int attrs ATTRIBUTE_UNUSED,
1157 bfd_vma pc ATTRIBUTE_UNUSED,
1158 int length ATTRIBUTE_UNUSED)
1160 print_regset (cd, dis_info, value, attrs, pc, length, POP);
1164 print_push_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1167 unsigned int attrs ATTRIBUTE_UNUSED,
1168 bfd_vma pc ATTRIBUTE_UNUSED,
1169 int length ATTRIBUTE_UNUSED)
1171 print_regset (cd, dis_info, value, attrs, pc, length, PUSH);
1175 print_signed4n (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1178 unsigned int attrs ATTRIBUTE_UNUSED,
1179 bfd_vma pc ATTRIBUTE_UNUSED,
1180 int length ATTRIBUTE_UNUSED)
1182 disassemble_info *info = dis_info;
1184 (*info->fprintf_func) (info->stream, "%ld", -value);