1 /* m32c opcode support. -*- C -*-
2 Copyright (C) 2005 Red Hat, Inc.
3 This file is part of CGEN. */
5 /* This file is an addendum to m32c.cpu. Heavy use of C code isn't
6 appropriate in .cpu files, so it resides here. This especially applies
7 to assembly/disassembly where parsing/printing can be quite involved.
8 Such things aren't really part of the specification of the cpu, per se,
9 so .cpu files provide the general framework and .opc files handle the
10 nitty-gritty details as necessary.
12 Each section is delimited with start and end markers.
14 <arch>-opc.h additions use: "-- opc.h"
15 <arch>-opc.c additions use: "-- opc.c"
16 <arch>-asm.c additions use: "-- asm.c"
17 <arch>-dis.c additions use: "-- dis.c"
18 <arch>-ibd.h additions use: "-- ibd.h"
23 /* Needed for RTL's 'ext' and 'trunc' operators. */
24 #include "cgen-types.h"
27 /* We can't use the default hash size because many bits are used by
29 #define CGEN_DIS_HASH_SIZE 1
30 #define CGEN_DIS_HASH(buf, value) 0
31 #define CGEN_VERBOSE_ASSEMBLER_ERRORS
32 #define CGEN_VALIDATE_INSN_SUPPORTED
34 extern int m32c_cgen_insn_supported (CGEN_CPU_DESC, const CGEN_INSN *);
36 #define CGEN_ASM_HASH_SIZE 0xffff
37 #define CGEN_ASM_HASH(mnem) m32c_asm_hash ((mnem))
43 m32c_asm_hash (const char *mnem)
47 /* The length of the mnemonic for the Jcnd insns is 1. Hash jsri. */
48 if (mnem[0] == 'j' && mnem[1] != 's')
51 /* Don't hash scCND */
52 if (mnem[0] == 's' && mnem[1] == 'c')
55 for (h = 0; *mnem && *mnem != ' ' && *mnem != ':'; ++mnem)
57 return h % CGEN_ASM_HASH_SIZE;
63 #define MACH_M32C 5 /* Must match md_begin. */
66 m32c_cgen_isa_register (const char **strp)
69 const char *s = *strp;
70 static char * m32c_register_names [] =
72 "r0", "r1", "r2", "r3", "r0l", "r0h", "r1l", "r1h",
73 "a0", "a1", "r2r0", "r3r1", "sp", "fb", "dct0", "dct1", "flg", "svf",
74 "drc0", "drc1", "dmd0", "dmd1", "intb", "svp", "vct", "isp", "dma0",
75 "dma1", "dra0", "dra1", "dsa0", "dsa1", 0
78 for (u = 0; m32c_register_names[u]; u++)
80 int len = strlen (m32c_register_names[u]);
82 if (memcmp (m32c_register_names[u], s, len) == 0
83 && (s[len] == 0 || ! ISALNUM (s[len])))
90 parse_unsigned6 (CGEN_CPU_DESC cd, const char **strp,
91 int opindex, unsigned long *valuep)
93 const char *errmsg = 0;
97 /* Don't successfully parse literals beginning with '[' */
99 return "Invalid literal"; /* anything -- will not be seen */
101 if (strncmp (*strp, "0x0", 3) == 0
102 || (**strp == '0' && *(*strp + 1) != 'x'))
105 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
110 return _("imm:6 immediate is out of range");
117 parse_unsigned8 (CGEN_CPU_DESC cd, const char **strp,
118 int opindex, unsigned long *valuep)
120 const char *errmsg = 0;
124 /* Don't successfully parse literals beginning with '[' */
126 return "Invalid literal"; /* anything -- will not be seen */
128 if (strncmp (*strp, "0x0", 3) == 0
129 || (**strp == '0' && *(*strp + 1) != 'x'))
132 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
137 return _("dsp:8 immediate is out of range");
139 /* If this field may require a relocation then use larger dsp16. */
140 if (! have_zero && value == 0)
141 return _("dsp:8 immediate is out of range");
148 parse_signed4 (CGEN_CPU_DESC cd, const char **strp,
149 int opindex, signed long *valuep)
151 const char *errmsg = 0;
155 /* Don't successfully parse literals beginning with '[' */
157 return "Invalid literal"; /* anything -- will not be seen */
159 if (strncmp (*strp, "0x0", 3) == 0
160 || (**strp == '0' && *(*strp + 1) != 'x'))
163 errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value);
167 if (value < -8 || value > 7)
168 return _("Immediate is out of range -8 to 7");
170 /* If this field may require a relocation then use larger dsp16. */
171 if (! have_zero && value == 0)
172 return _("Immediate is out of range -8 to 7");
179 parse_signed8 (CGEN_CPU_DESC cd, const char **strp,
180 int opindex, signed long *valuep)
182 const char *errmsg = 0;
185 /* Don't successfully parse literals beginning with '[' */
187 return "Invalid literal"; /* anything -- will not be seen */
189 errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value);
193 if (value <= 255 && value > 127)
196 if (value < -128 || value > 127)
197 return _("dsp:8 immediate is out of range");
204 parse_unsigned16 (CGEN_CPU_DESC cd, const char **strp,
205 int opindex, unsigned long *valuep)
207 const char *errmsg = 0;
211 /* Don't successfully parse literals beginning with '[' */
213 return "Invalid literal"; /* anything -- will not be seen */
215 /* Don't successfully parse register names */
216 if (m32c_cgen_isa_register (strp))
217 return "Invalid literal"; /* anything -- will not be seen */
219 if (strncmp (*strp, "0x0", 3) == 0
220 || (**strp == '0' && *(*strp + 1) != 'x'))
223 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
228 return _("dsp:16 immediate is out of range");
230 /* If this field may require a relocation then use larger dsp24. */
231 if (cd->machs == MACH_M32C && ! have_zero && value == 0
232 && (strncmp (*strp, "[a", 2) == 0
235 return _("dsp:16 immediate is out of range");
242 parse_signed16 (CGEN_CPU_DESC cd, const char **strp,
243 int opindex, signed long *valuep)
245 const char *errmsg = 0;
248 /* Don't successfully parse literals beginning with '[' */
250 return "Invalid literal"; /* anything -- will not be seen */
252 errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value);
256 if (value <= 65535 && value > 32767)
259 if (value < -32768 || value > 32767)
260 return _("dsp:16 immediate is out of range");
267 parse_unsigned20 (CGEN_CPU_DESC cd, const char **strp,
268 int opindex, unsigned long *valuep)
270 const char *errmsg = 0;
273 /* Don't successfully parse literals beginning with '[' */
275 return "Invalid literal"; /* anything -- will not be seen */
277 /* Don't successfully parse register names */
278 if (m32c_cgen_isa_register (strp))
279 return "Invalid literal"; /* anything -- will not be seen */
281 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
286 return _("dsp:20 immediate is out of range");
293 parse_unsigned24 (CGEN_CPU_DESC cd, const char **strp,
294 int opindex, unsigned long *valuep)
296 const char *errmsg = 0;
299 /* Don't successfully parse literals beginning with '[' */
301 return "Invalid literal"; /* anything -- will not be seen */
303 /* Don't successfully parse register names */
304 if (m32c_cgen_isa_register (strp))
305 return "Invalid literal"; /* anything -- will not be seen */
307 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
311 if (value > 0xffffff)
312 return _("dsp:24 immediate is out of range");
319 parse_signed32 (CGEN_CPU_DESC cd, const char **strp,
320 int opindex, signed long *valuep)
322 const char *errmsg = 0;
326 /* Don't successfully parse literals beginning with '[' */
328 return "Invalid literal"; /* anything -- will not be seen */
330 /* Don't successfully parse register names */
331 if (m32c_cgen_isa_register (strp))
332 return "Invalid literal"; /* anything -- will not be seen */
335 errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value);
344 parse_imm1_S (CGEN_CPU_DESC cd, const char **strp,
345 int opindex, signed long *valuep)
347 const char *errmsg = 0;
351 /* Don't successfully parse literals beginning with '[' */
353 return "Invalid literal"; /* anything -- will not be seen */
355 /* Don't successfully parse register names */
356 if (m32c_cgen_isa_register (strp))
357 return "Invalid literal"; /* anything -- will not be seen */
360 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
364 if (value < 1 || value > 2)
365 return _("immediate is out of range 1-2");
372 parse_imm3_S (CGEN_CPU_DESC cd, const char **strp,
373 int opindex, signed long *valuep)
375 const char *errmsg = 0;
379 /* Don't successfully parse literals beginning with '[' */
381 return "Invalid literal"; /* anything -- will not be seen */
383 /* Don't successfully parse register names */
384 if (m32c_cgen_isa_register (strp))
385 return "Invalid literal"; /* anything -- will not be seen */
388 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
392 if (value < 1 || value > 8)
393 return _("immediate is out of range 1-8");
400 parse_Bitno16R (CGEN_CPU_DESC cd, const char **strp,
401 int opindex, unsigned long *valuep)
403 const char *errmsg = 0;
407 /* Don't successfully parse literals beginning with '[' */
409 return "Invalid literal"; /* anything -- will not be seen */
412 errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
417 return _("Bit number for indexing general register is out of range 0-15");
424 parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp,
425 int opindex, unsigned long *valuep,
428 const char *errmsg = 0;
431 const char *newp = *strp;
432 unsigned long long bitbase;
435 /* Don't successfully parse literals beginning with '[' */
437 return "Invalid literal"; /* anything -- will not be seen */
440 errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit);
445 return "Missing base for bit,base:8";
448 errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & base);
452 bitbase = (unsigned long long)bit + ((unsigned long long)base * 8);
454 if (bitbase >= (1ull << bits))
455 return _("bit,base is out of range");
463 parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp,
464 int opindex, signed long *valuep,
467 const char *errmsg = 0;
470 const char *newp = *strp;
475 /* Don't successfully parse literals beginning with '[' */
477 return "Invalid literal"; /* anything -- will not be seen */
480 errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit);
485 return "Missing base for bit,base:8";
488 errmsg = cgen_parse_signed_integer (cd, & newp, opindex, & base);
492 bitbase = (long long)bit + ((long long)base * 8);
494 limit = 1ll << (bits - 1);
495 if (bitbase < -limit || bitbase >= limit)
496 return _("bit,base is out of range");
504 parse_unsigned_bitbase8 (CGEN_CPU_DESC cd, const char **strp,
505 int opindex, unsigned long *valuep)
507 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 8);
511 parse_unsigned_bitbase11 (CGEN_CPU_DESC cd, const char **strp,
512 int opindex, unsigned long *valuep)
514 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 11);
518 parse_unsigned_bitbase16 (CGEN_CPU_DESC cd, const char **strp,
519 int opindex, unsigned long *valuep)
521 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 16);
525 parse_unsigned_bitbase19 (CGEN_CPU_DESC cd, const char **strp,
526 int opindex, unsigned long *valuep)
528 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 19);
532 parse_unsigned_bitbase27 (CGEN_CPU_DESC cd, const char **strp,
533 int opindex, unsigned long *valuep)
535 return parse_unsigned_bitbase (cd, strp, opindex, valuep, 27);
539 parse_signed_bitbase8 (CGEN_CPU_DESC cd, const char **strp,
540 int opindex, signed long *valuep)
542 return parse_signed_bitbase (cd, strp, opindex, valuep, 8);
546 parse_signed_bitbase11 (CGEN_CPU_DESC cd, const char **strp,
547 int opindex, signed long *valuep)
549 return parse_signed_bitbase (cd, strp, opindex, valuep, 11);
553 parse_signed_bitbase19 (CGEN_CPU_DESC cd, const char **strp,
554 int opindex, signed long *valuep)
556 return parse_signed_bitbase (cd, strp, opindex, valuep, 19);
559 /* Parse the suffix as :<char> or as nothing followed by a whitespace. */
561 parse_suffix (const char **strp, char suffix)
563 const char *newp = *strp;
565 if (**strp == ':' && tolower (*(*strp + 1)) == suffix)
574 return "Invalid suffix"; /* anything -- will not be seen */
578 parse_S (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
579 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
581 return parse_suffix (strp, 's');
585 parse_G (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
586 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
588 return parse_suffix (strp, 'g');
592 parse_Q (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
593 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
595 return parse_suffix (strp, 'q');
599 parse_Z (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
600 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
602 return parse_suffix (strp, 'z');
605 /* Parse an empty suffix. Fail if the next char is ':'. */
607 parse_X (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
608 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
611 return "Unexpected suffix";
616 parse_r0l_r0h (CGEN_CPU_DESC cd, const char **strp,
617 int opindex ATTRIBUTE_UNUSED, signed long *valuep)
622 const char *newp = *strp;
625 errmsg = cgen_parse_keyword (cd, & newp, & m32c_cgen_opval_h_r0l_r0h, & value);
630 return "not a valid r0l/r0h pair";
633 /* Parse the second register in the pair */
634 if (value == 0) /* r0l */
635 errmsg = cgen_parse_keyword (cd, & newp, & m32c_cgen_opval_h_r0h, & junk);
637 errmsg = cgen_parse_keyword (cd, & newp, & m32c_cgen_opval_h_r0l, & junk);
646 /* Accept .b or .w in any case */
648 parse_size (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, const char **strp,
649 int opindex ATTRIBUTE_UNUSED, signed long *valuep ATTRIBUTE_UNUSED)
652 && (*(*strp + 1) == 'b' || *(*strp + 1) == 'B'
653 || *(*strp + 1) == 'w' || *(*strp + 1) == 'W'))
658 return "Invalid size specifier";
661 /* static const char * parse_abs (CGEN_CPU_DESC, const char **, int, */
662 /* unsigned long *, unsigned long); */
663 /* static const char * parse_abs16 (CGEN_CPU_DESC, const char **, int, */
664 /* int ATTRIBUTE_UNUSED, */
665 /* enum cgen_parse_operand_result * ATTRIBUTE_UNUSED, */
666 /* unsigned long * ); */
667 /* static const char * parse_abs24 (CGEN_CPU_DESC, const char **, int, */
668 /* int ATTRIBUTE_UNUSED, */
669 /* enum cgen_parse_operand_result * ATTRIBUTE_UNUSED, */
670 /* unsigned long *); */
672 /* /\* Parse absolute *\/ */
674 /* static const char * */
675 /* parse_abs16 (CGEN_CPU_DESC cd, const char **strp, int opindex, */
676 /* int reloc ATTRIBUTE_UNUSED, */
677 /* enum cgen_parse_operand_result *type_addr ATTRIBUTE_UNUSED, */
678 /* unsigned long *valuep) */
680 /* return parse_abs (cd, strp, opindex, valuep, 16); */
683 /* static const char * */
684 /* parse_abs24 (CGEN_CPU_DESC cd, const char **strp, int opindex, */
685 /* int reloc ATTRIBUTE_UNUSED, */
686 /* enum cgen_parse_operand_result *type_addr ATTRIBUTE_UNUSED, */
687 /* unsigned long *valuep) */
689 /* return parse_abs (cd, strp, opindex, valuep, 24); */
692 /* static const char * */
693 /* parse_abs (CGEN_CPU_DESC cd, const char **strp, int opindex, */
694 /* unsigned long *valuep, */
695 /* unsigned long length) */
697 /* const char *errmsg = 0; */
698 /* const char *op; */
699 /* int has_register = 0; */
701 /* for (op = *strp; *op != '\0'; op++) */
703 /* if (*op == '[') */
705 /* has_register = 1; */
708 /* else if (*op == ',') */
712 /* if (has_register || m32c_cgen_isa_register (strp)) */
713 /* errmsg = _("immediate value cannot be register"); */
716 /* enum cgen_parse_operand_result result_type; */
718 /* const char *errmsg; */
720 /* errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16, */
721 /* &result_type, &value); */
722 /* *valuep = value; */
726 /* /\* Handle signed/unsigned literal. *\/ */
728 /* static const char * */
729 /* parse_imm8 (cd, strp, opindex, valuep) */
730 /* CGEN_CPU_DESC cd; */
731 /* const char **strp; */
733 /* unsigned long *valuep; */
735 /* const char *errmsg = 0; */
737 /* long have_zero = 0; */
739 /* if (strncmp (*strp, "0x0", 3) == 0 */
740 /* || (**strp == '0' && *(*strp + 1) != 'x')) */
742 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); */
743 /* *valuep = value; */
744 /* /\* If this field may require a relocation then use larger dsp16. *\/ */
745 /* if (! have_zero && value == 0) */
746 /* errmsg = _("immediate value may not fit in dsp8 field"); */
751 /* static const char * */
752 /* parse_imm16 (cd, strp, opindex, valuep) */
753 /* CGEN_CPU_DESC cd; */
754 /* const char **strp; */
756 /* unsigned long *valuep; */
758 /* const char *errmsg; */
761 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); */
762 /* *valuep = value; */
766 /* static const char * */
767 /* parse_imm24 (cd, strp, opindex, valuep) */
768 /* CGEN_CPU_DESC cd; */
769 /* const char **strp; */
771 /* unsigned long *valuep; */
773 /* const char *errmsg; */
776 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); */
777 /* *valuep = value; */
781 /* static const char * */
782 /* parse_imm32 (cd, strp, opindex, valuep) */
783 /* CGEN_CPU_DESC cd; */
784 /* const char **strp; */
786 /* unsigned long *valuep; */
788 /* const char *errmsg; */
791 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); */
792 /* *valuep = value; */
796 /* /\* Handle bitfields. *\/ */
798 /* static const char * */
799 /* parse_boff8 (cd, strp, opindex, valuep) */
800 /* CGEN_CPU_DESC cd; */
801 /* const char **strp; */
803 /* unsigned long *valuep; */
805 /* const char *errmsg; */
806 /* long bit_value, value; */
808 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & bit_value); */
809 /* if (errmsg == 0) */
811 /* *strp = *strp + 1; */
812 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); */
814 /* value = value * 8 + bit_value; */
815 /* *valuep = value; */
816 /* if (value > 0x100) */
817 /* errmsg = _("Operand out of range. Must be between 0 and 255."); */
821 /* static const char * */
822 /* parse_boff16 (cd, strp, opindex, valuep) */
823 /* CGEN_CPU_DESC cd; */
824 /* const char **strp; */
826 /* unsigned long *valuep; */
828 /* const char *errmsg; */
829 /* long bit_value, value; */
831 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & bit_value); */
832 /* if (errmsg == 0) */
834 /* *strp = *strp + 1; */
835 /* errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); */
837 /* value = value * 8 + bit_value; */
838 /* *valuep = value; */
839 /* if (value > 0x1000) */
840 /* errmsg = _("Operand out of range. Must be between 0 and 65535."); */
845 /* Special check to ensure that instruction exists for given machine */
847 m32c_cgen_insn_supported (CGEN_CPU_DESC cd,
848 const CGEN_INSN *insn)
850 int machs = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_MACH);
851 CGEN_BITSET isas = CGEN_INSN_BITSET_ATTR_VALUE (insn, CGEN_INSN_ISA);
853 /* If attributes are absent, assume no restriction. */
857 return (machs & cd->machs)
858 && cgen_bitset_intersect_p (& isas, cd->isas);
861 /* Parse a set of registers, R0,R1,A0,A1,SB,FB. */
864 parse_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
866 int opindex ATTRIBUTE_UNUSED,
867 unsigned long *valuep,
871 const char *errmsg = 0;
875 while (**strp && **strp != ')')
877 if (**strp == 'r' || **strp == 'R')
880 regno = **strp - '0';
882 errmsg = _("Register number is not valid");
884 else if (**strp == 'a' || **strp == 'A')
887 regno = **strp - '0';
889 errmsg = _("Register number is not valid");
890 regno = **strp - '0' + 4;
893 else if (strncasecmp (*strp, "sb", 2) == 0 || strncasecmp (*strp, "SB", 2) == 0)
899 else if (strncasecmp (*strp, "fb", 2) == 0 || strncasecmp (*strp, "FB", 2) == 0)
905 if (push) /* Mask is reversed for push. */
906 *valuep |= 0x80 >> regno;
908 *valuep |= 1 << regno;
913 if (*(*strp + 1) == ')')
920 errmsg = _("Register list is not valid");
929 parse_pop_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
931 int opindex ATTRIBUTE_UNUSED,
932 unsigned long *valuep)
934 return parse_regset (cd, strp, opindex, valuep, POP);
938 parse_push_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
940 int opindex ATTRIBUTE_UNUSED,
941 unsigned long *valuep)
943 return parse_regset (cd, strp, opindex, valuep, PUSH);
948 #include "elf/m32c.h"
951 /* Always print the short insn format suffix as ':<char>' */
953 print_suffix (PTR dis_info, char suffix)
955 disassemble_info *info = dis_info;
956 (*info->fprintf_func) (info->stream, ":%c", suffix);
960 print_S (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
962 long value ATTRIBUTE_UNUSED,
963 unsigned int attrs ATTRIBUTE_UNUSED,
964 bfd_vma pc ATTRIBUTE_UNUSED,
965 int length ATTRIBUTE_UNUSED)
967 print_suffix (dis_info, 's');
972 print_G (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
974 long value ATTRIBUTE_UNUSED,
975 unsigned int attrs ATTRIBUTE_UNUSED,
976 bfd_vma pc ATTRIBUTE_UNUSED,
977 int length ATTRIBUTE_UNUSED)
979 print_suffix (dis_info, 'g');
983 print_Q (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
985 long value ATTRIBUTE_UNUSED,
986 unsigned int attrs ATTRIBUTE_UNUSED,
987 bfd_vma pc ATTRIBUTE_UNUSED,
988 int length ATTRIBUTE_UNUSED)
990 print_suffix (dis_info, 'q');
994 print_Z (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
996 long value ATTRIBUTE_UNUSED,
997 unsigned int attrs ATTRIBUTE_UNUSED,
998 bfd_vma pc ATTRIBUTE_UNUSED,
999 int length ATTRIBUTE_UNUSED)
1001 print_suffix (dis_info, 'z');
1004 /* Print the empty suffix */
1006 print_X (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1007 PTR dis_info ATTRIBUTE_UNUSED,
1008 long value ATTRIBUTE_UNUSED,
1009 unsigned int attrs ATTRIBUTE_UNUSED,
1010 bfd_vma pc ATTRIBUTE_UNUSED,
1011 int length ATTRIBUTE_UNUSED)
1017 print_r0l_r0h (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1020 unsigned int attrs ATTRIBUTE_UNUSED,
1021 bfd_vma pc ATTRIBUTE_UNUSED,
1022 int length ATTRIBUTE_UNUSED)
1024 disassemble_info *info = dis_info;
1026 (*info->fprintf_func) (info->stream, "r0h,r0l");
1028 (*info->fprintf_func) (info->stream, "r0l,r0h");
1032 print_unsigned_bitbase (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1034 unsigned long value,
1035 unsigned int attrs ATTRIBUTE_UNUSED,
1036 bfd_vma pc ATTRIBUTE_UNUSED,
1037 int length ATTRIBUTE_UNUSED)
1039 disassemble_info *info = dis_info;
1040 (*info->fprintf_func) (info->stream, "%ld,0x%lx", value & 0x7, value >> 3);
1044 print_signed_bitbase (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;
1052 (*info->fprintf_func) (info->stream, "%ld,%ld", value & 0x7, value >> 3);
1056 print_size (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1058 long value ATTRIBUTE_UNUSED,
1059 unsigned int attrs ATTRIBUTE_UNUSED,
1060 bfd_vma pc ATTRIBUTE_UNUSED,
1061 int length ATTRIBUTE_UNUSED)
1063 /* Always print the size as '.w' */
1064 disassemble_info *info = dis_info;
1065 (*info->fprintf_func) (info->stream, ".w");
1071 static void print_pop_regset (CGEN_CPU_DESC, PTR, long, unsigned int, bfd_vma, int);
1072 static void print_push_regset (CGEN_CPU_DESC, PTR, long, unsigned int, bfd_vma, int);
1074 /* Print a set of registers, R0,R1,A0,A1,SB,FB. */
1077 print_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1080 unsigned int attrs ATTRIBUTE_UNUSED,
1081 bfd_vma pc ATTRIBUTE_UNUSED,
1082 int length ATTRIBUTE_UNUSED,
1085 static char * m16c_register_names [] =
1087 "r0", "r1", "r2", "r3", "a0", "a1", "sb", "fb"
1089 disassemble_info *info = dis_info;
1101 (*info->fprintf_func) (info->stream, "%s", m16c_register_names [0]);
1105 for (index = 1; index <= 7; ++index)
1114 (*info->fprintf_func) (info->stream, "%s%s", comma,
1115 m16c_register_names [index]);
1122 print_pop_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1125 unsigned int attrs ATTRIBUTE_UNUSED,
1126 bfd_vma pc ATTRIBUTE_UNUSED,
1127 int length ATTRIBUTE_UNUSED)
1129 print_regset (cd, dis_info, value, attrs, pc, length, POP);
1133 print_push_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1136 unsigned int attrs ATTRIBUTE_UNUSED,
1137 bfd_vma pc ATTRIBUTE_UNUSED,
1138 int length ATTRIBUTE_UNUSED)
1140 print_regset (cd, dis_info, value, attrs, pc, length, PUSH);
1142 #if 0 /* not used? */
1144 print_boff (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1147 unsigned int attrs ATTRIBUTE_UNUSED,
1148 bfd_vma pc ATTRIBUTE_UNUSED,
1149 int length ATTRIBUTE_UNUSED)
1151 disassemble_info *info = dis_info;
1153 info->fprintf_func (info->stream, "%d,%d", value % 16,
1157 #endif /* not used? */