xref: /openbsd-src/gnu/usr.bin/binutils-2.17/opcodes/m32c-dis.c (revision 3d8817e467ea46cf4772788d6804dd293abfb01a)
1*3d8817e4Smiod /* Disassembler interface for targets using CGEN. -*- C -*-
2*3d8817e4Smiod    CGEN: Cpu tools GENerator
3*3d8817e4Smiod 
4*3d8817e4Smiod    THIS FILE IS MACHINE GENERATED WITH CGEN.
5*3d8817e4Smiod    - the resultant file is machine generated, cgen-dis.in isn't
6*3d8817e4Smiod 
7*3d8817e4Smiod    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
8*3d8817e4Smiod    Free Software Foundation, Inc.
9*3d8817e4Smiod 
10*3d8817e4Smiod    This file is part of the GNU Binutils and GDB, the GNU debugger.
11*3d8817e4Smiod 
12*3d8817e4Smiod    This program is free software; you can redistribute it and/or modify
13*3d8817e4Smiod    it under the terms of the GNU General Public License as published by
14*3d8817e4Smiod    the Free Software Foundation; either version 2, or (at your option)
15*3d8817e4Smiod    any later version.
16*3d8817e4Smiod 
17*3d8817e4Smiod    This program is distributed in the hope that it will be useful,
18*3d8817e4Smiod    but WITHOUT ANY WARRANTY; without even the implied warranty of
19*3d8817e4Smiod    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20*3d8817e4Smiod    GNU General Public License for more details.
21*3d8817e4Smiod 
22*3d8817e4Smiod    You should have received a copy of the GNU General Public License
23*3d8817e4Smiod    along with this program; if not, write to the Free Software Foundation, Inc.,
24*3d8817e4Smiod    51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
25*3d8817e4Smiod 
26*3d8817e4Smiod /* ??? Eventually more and more of this stuff can go to cpu-independent files.
27*3d8817e4Smiod    Keep that in mind.  */
28*3d8817e4Smiod 
29*3d8817e4Smiod #include "sysdep.h"
30*3d8817e4Smiod #include <stdio.h>
31*3d8817e4Smiod #include "ansidecl.h"
32*3d8817e4Smiod #include "dis-asm.h"
33*3d8817e4Smiod #include "bfd.h"
34*3d8817e4Smiod #include "symcat.h"
35*3d8817e4Smiod #include "libiberty.h"
36*3d8817e4Smiod #include "m32c-desc.h"
37*3d8817e4Smiod #include "m32c-opc.h"
38*3d8817e4Smiod #include "opintl.h"
39*3d8817e4Smiod 
40*3d8817e4Smiod /* Default text to print if an instruction isn't recognized.  */
41*3d8817e4Smiod #define UNKNOWN_INSN_MSG _("*unknown*")
42*3d8817e4Smiod 
43*3d8817e4Smiod static void print_normal
44*3d8817e4Smiod   (CGEN_CPU_DESC, void *, long, unsigned int, bfd_vma, int);
45*3d8817e4Smiod static void print_address
46*3d8817e4Smiod   (CGEN_CPU_DESC, void *, bfd_vma, unsigned int, bfd_vma, int) ATTRIBUTE_UNUSED;
47*3d8817e4Smiod static void print_keyword
48*3d8817e4Smiod   (CGEN_CPU_DESC, void *, CGEN_KEYWORD *, long, unsigned int) ATTRIBUTE_UNUSED;
49*3d8817e4Smiod static void print_insn_normal
50*3d8817e4Smiod   (CGEN_CPU_DESC, void *, const CGEN_INSN *, CGEN_FIELDS *, bfd_vma, int);
51*3d8817e4Smiod static int print_insn
52*3d8817e4Smiod   (CGEN_CPU_DESC, bfd_vma,  disassemble_info *, bfd_byte *, unsigned);
53*3d8817e4Smiod static int default_print_insn
54*3d8817e4Smiod   (CGEN_CPU_DESC, bfd_vma, disassemble_info *) ATTRIBUTE_UNUSED;
55*3d8817e4Smiod static int read_insn
56*3d8817e4Smiod   (CGEN_CPU_DESC, bfd_vma, disassemble_info *, bfd_byte *, int, CGEN_EXTRACT_INFO *,
57*3d8817e4Smiod    unsigned long *);
58*3d8817e4Smiod 
59*3d8817e4Smiod /* -- disassembler routines inserted here.  */
60*3d8817e4Smiod 
61*3d8817e4Smiod /* -- dis.c */
62*3d8817e4Smiod 
63*3d8817e4Smiod #include "elf/m32c.h"
64*3d8817e4Smiod #include "elf-bfd.h"
65*3d8817e4Smiod 
66*3d8817e4Smiod /* Always print the short insn format suffix as ':<char>'.  */
67*3d8817e4Smiod 
68*3d8817e4Smiod static void
print_suffix(void * dis_info,char suffix)69*3d8817e4Smiod print_suffix (void * dis_info, char suffix)
70*3d8817e4Smiod {
71*3d8817e4Smiod   disassemble_info *info = dis_info;
72*3d8817e4Smiod 
73*3d8817e4Smiod   (*info->fprintf_func) (info->stream, ":%c", suffix);
74*3d8817e4Smiod }
75*3d8817e4Smiod 
76*3d8817e4Smiod static void
print_S(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,long value ATTRIBUTE_UNUSED,unsigned int attrs ATTRIBUTE_UNUSED,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED)77*3d8817e4Smiod print_S (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
78*3d8817e4Smiod 	 void * dis_info,
79*3d8817e4Smiod 	 long value ATTRIBUTE_UNUSED,
80*3d8817e4Smiod 	 unsigned int attrs ATTRIBUTE_UNUSED,
81*3d8817e4Smiod 	 bfd_vma pc ATTRIBUTE_UNUSED,
82*3d8817e4Smiod 	 int length ATTRIBUTE_UNUSED)
83*3d8817e4Smiod {
84*3d8817e4Smiod   print_suffix (dis_info, 's');
85*3d8817e4Smiod }
86*3d8817e4Smiod 
87*3d8817e4Smiod 
88*3d8817e4Smiod static void
print_G(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,long value ATTRIBUTE_UNUSED,unsigned int attrs ATTRIBUTE_UNUSED,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED)89*3d8817e4Smiod print_G (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
90*3d8817e4Smiod 	 void * dis_info,
91*3d8817e4Smiod 	 long value ATTRIBUTE_UNUSED,
92*3d8817e4Smiod 	 unsigned int attrs ATTRIBUTE_UNUSED,
93*3d8817e4Smiod 	 bfd_vma pc ATTRIBUTE_UNUSED,
94*3d8817e4Smiod 	 int length ATTRIBUTE_UNUSED)
95*3d8817e4Smiod {
96*3d8817e4Smiod   print_suffix (dis_info, 'g');
97*3d8817e4Smiod }
98*3d8817e4Smiod 
99*3d8817e4Smiod static void
print_Q(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,long value ATTRIBUTE_UNUSED,unsigned int attrs ATTRIBUTE_UNUSED,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED)100*3d8817e4Smiod print_Q (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
101*3d8817e4Smiod 	 void * dis_info,
102*3d8817e4Smiod 	 long value ATTRIBUTE_UNUSED,
103*3d8817e4Smiod 	 unsigned int attrs ATTRIBUTE_UNUSED,
104*3d8817e4Smiod 	 bfd_vma pc ATTRIBUTE_UNUSED,
105*3d8817e4Smiod 	 int length ATTRIBUTE_UNUSED)
106*3d8817e4Smiod {
107*3d8817e4Smiod   print_suffix (dis_info, 'q');
108*3d8817e4Smiod }
109*3d8817e4Smiod 
110*3d8817e4Smiod static void
print_Z(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,long value ATTRIBUTE_UNUSED,unsigned int attrs ATTRIBUTE_UNUSED,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED)111*3d8817e4Smiod print_Z (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
112*3d8817e4Smiod 	 void * dis_info,
113*3d8817e4Smiod 	 long value ATTRIBUTE_UNUSED,
114*3d8817e4Smiod 	 unsigned int attrs ATTRIBUTE_UNUSED,
115*3d8817e4Smiod 	 bfd_vma pc ATTRIBUTE_UNUSED,
116*3d8817e4Smiod 	 int length ATTRIBUTE_UNUSED)
117*3d8817e4Smiod {
118*3d8817e4Smiod   print_suffix (dis_info, 'z');
119*3d8817e4Smiod }
120*3d8817e4Smiod 
121*3d8817e4Smiod /* Print the empty suffix.  */
122*3d8817e4Smiod 
123*3d8817e4Smiod static void
print_X(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info ATTRIBUTE_UNUSED,long value ATTRIBUTE_UNUSED,unsigned int attrs ATTRIBUTE_UNUSED,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED)124*3d8817e4Smiod print_X (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
125*3d8817e4Smiod 	 void * dis_info ATTRIBUTE_UNUSED,
126*3d8817e4Smiod 	 long value ATTRIBUTE_UNUSED,
127*3d8817e4Smiod 	 unsigned int attrs ATTRIBUTE_UNUSED,
128*3d8817e4Smiod 	 bfd_vma pc ATTRIBUTE_UNUSED,
129*3d8817e4Smiod 	 int length ATTRIBUTE_UNUSED)
130*3d8817e4Smiod {
131*3d8817e4Smiod   return;
132*3d8817e4Smiod }
133*3d8817e4Smiod 
134*3d8817e4Smiod static void
print_r0l_r0h(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,long value,unsigned int attrs ATTRIBUTE_UNUSED,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED)135*3d8817e4Smiod print_r0l_r0h (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
136*3d8817e4Smiod 	       void * dis_info,
137*3d8817e4Smiod 	       long value,
138*3d8817e4Smiod 	       unsigned int attrs ATTRIBUTE_UNUSED,
139*3d8817e4Smiod 	       bfd_vma pc ATTRIBUTE_UNUSED,
140*3d8817e4Smiod 	       int length ATTRIBUTE_UNUSED)
141*3d8817e4Smiod {
142*3d8817e4Smiod   disassemble_info *info = dis_info;
143*3d8817e4Smiod 
144*3d8817e4Smiod   if (value == 0)
145*3d8817e4Smiod     (*info->fprintf_func) (info->stream, "r0h,r0l");
146*3d8817e4Smiod   else
147*3d8817e4Smiod     (*info->fprintf_func) (info->stream, "r0l,r0h");
148*3d8817e4Smiod }
149*3d8817e4Smiod 
150*3d8817e4Smiod static void
print_unsigned_bitbase(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,unsigned long value,unsigned int attrs ATTRIBUTE_UNUSED,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED)151*3d8817e4Smiod print_unsigned_bitbase (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
152*3d8817e4Smiod 			void * dis_info,
153*3d8817e4Smiod 			unsigned long value,
154*3d8817e4Smiod 			unsigned int attrs ATTRIBUTE_UNUSED,
155*3d8817e4Smiod 			bfd_vma pc ATTRIBUTE_UNUSED,
156*3d8817e4Smiod 			int length ATTRIBUTE_UNUSED)
157*3d8817e4Smiod {
158*3d8817e4Smiod   disassemble_info *info = dis_info;
159*3d8817e4Smiod 
160*3d8817e4Smiod   (*info->fprintf_func) (info->stream, "%ld,0x%lx", value & 0x7, value >> 3);
161*3d8817e4Smiod }
162*3d8817e4Smiod 
163*3d8817e4Smiod static void
print_signed_bitbase(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,signed long value,unsigned int attrs ATTRIBUTE_UNUSED,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED)164*3d8817e4Smiod print_signed_bitbase (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
165*3d8817e4Smiod 		      void * dis_info,
166*3d8817e4Smiod 		      signed long value,
167*3d8817e4Smiod 		      unsigned int attrs ATTRIBUTE_UNUSED,
168*3d8817e4Smiod 		      bfd_vma pc ATTRIBUTE_UNUSED,
169*3d8817e4Smiod 		      int length ATTRIBUTE_UNUSED)
170*3d8817e4Smiod {
171*3d8817e4Smiod   disassemble_info *info = dis_info;
172*3d8817e4Smiod 
173*3d8817e4Smiod   (*info->fprintf_func) (info->stream, "%ld,%ld", value & 0x7, value >> 3);
174*3d8817e4Smiod }
175*3d8817e4Smiod 
176*3d8817e4Smiod static void
print_size(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,long value ATTRIBUTE_UNUSED,unsigned int attrs ATTRIBUTE_UNUSED,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED)177*3d8817e4Smiod print_size (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
178*3d8817e4Smiod 	    void * dis_info,
179*3d8817e4Smiod 	    long value ATTRIBUTE_UNUSED,
180*3d8817e4Smiod 	    unsigned int attrs ATTRIBUTE_UNUSED,
181*3d8817e4Smiod 	    bfd_vma pc ATTRIBUTE_UNUSED,
182*3d8817e4Smiod 	    int length ATTRIBUTE_UNUSED)
183*3d8817e4Smiod {
184*3d8817e4Smiod   /* Always print the size as '.w'.  */
185*3d8817e4Smiod   disassemble_info *info = dis_info;
186*3d8817e4Smiod 
187*3d8817e4Smiod   (*info->fprintf_func) (info->stream, ".w");
188*3d8817e4Smiod }
189*3d8817e4Smiod 
190*3d8817e4Smiod #define POP  0
191*3d8817e4Smiod #define PUSH 1
192*3d8817e4Smiod 
193*3d8817e4Smiod static void print_pop_regset  (CGEN_CPU_DESC, void *, long, unsigned int, bfd_vma, int);
194*3d8817e4Smiod static void print_push_regset (CGEN_CPU_DESC, void *, long, unsigned int, bfd_vma, int);
195*3d8817e4Smiod 
196*3d8817e4Smiod /* Print a set of registers, R0,R1,A0,A1,SB,FB.  */
197*3d8817e4Smiod 
198*3d8817e4Smiod static void
print_regset(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,long value,unsigned int attrs ATTRIBUTE_UNUSED,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED,int push)199*3d8817e4Smiod print_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
200*3d8817e4Smiod 	      void * dis_info,
201*3d8817e4Smiod 	      long value,
202*3d8817e4Smiod 	      unsigned int attrs ATTRIBUTE_UNUSED,
203*3d8817e4Smiod 	      bfd_vma pc ATTRIBUTE_UNUSED,
204*3d8817e4Smiod 	      int length ATTRIBUTE_UNUSED,
205*3d8817e4Smiod 	      int push)
206*3d8817e4Smiod {
207*3d8817e4Smiod   static char * m16c_register_names [] =
208*3d8817e4Smiod   {
209*3d8817e4Smiod     "r0", "r1", "r2", "r3", "a0", "a1", "sb", "fb"
210*3d8817e4Smiod   };
211*3d8817e4Smiod   disassemble_info *info = dis_info;
212*3d8817e4Smiod   int mask;
213*3d8817e4Smiod   int index = 0;
214*3d8817e4Smiod   char* comma = "";
215*3d8817e4Smiod 
216*3d8817e4Smiod   if (push)
217*3d8817e4Smiod     mask = 0x80;
218*3d8817e4Smiod   else
219*3d8817e4Smiod     mask = 1;
220*3d8817e4Smiod 
221*3d8817e4Smiod   if (value & mask)
222*3d8817e4Smiod     {
223*3d8817e4Smiod       (*info->fprintf_func) (info->stream, "%s", m16c_register_names [0]);
224*3d8817e4Smiod       comma = ",";
225*3d8817e4Smiod     }
226*3d8817e4Smiod 
227*3d8817e4Smiod   for (index = 1; index <= 7; ++index)
228*3d8817e4Smiod     {
229*3d8817e4Smiod       if (push)
230*3d8817e4Smiod         mask >>= 1;
231*3d8817e4Smiod       else
232*3d8817e4Smiod         mask <<= 1;
233*3d8817e4Smiod 
234*3d8817e4Smiod       if (value & mask)
235*3d8817e4Smiod         {
236*3d8817e4Smiod           (*info->fprintf_func) (info->stream, "%s%s", comma,
237*3d8817e4Smiod 				 m16c_register_names [index]);
238*3d8817e4Smiod           comma = ",";
239*3d8817e4Smiod         }
240*3d8817e4Smiod     }
241*3d8817e4Smiod }
242*3d8817e4Smiod 
243*3d8817e4Smiod static void
print_pop_regset(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,long value,unsigned int attrs ATTRIBUTE_UNUSED,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED)244*3d8817e4Smiod print_pop_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
245*3d8817e4Smiod 		  void * dis_info,
246*3d8817e4Smiod 		  long value,
247*3d8817e4Smiod 		  unsigned int attrs ATTRIBUTE_UNUSED,
248*3d8817e4Smiod 		  bfd_vma pc ATTRIBUTE_UNUSED,
249*3d8817e4Smiod 		  int length ATTRIBUTE_UNUSED)
250*3d8817e4Smiod {
251*3d8817e4Smiod   print_regset (cd, dis_info, value, attrs, pc, length, POP);
252*3d8817e4Smiod }
253*3d8817e4Smiod 
254*3d8817e4Smiod static void
print_push_regset(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,long value,unsigned int attrs ATTRIBUTE_UNUSED,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED)255*3d8817e4Smiod print_push_regset (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
256*3d8817e4Smiod 		   void * dis_info,
257*3d8817e4Smiod 		   long value,
258*3d8817e4Smiod 		   unsigned int attrs ATTRIBUTE_UNUSED,
259*3d8817e4Smiod 		   bfd_vma pc ATTRIBUTE_UNUSED,
260*3d8817e4Smiod 		   int length ATTRIBUTE_UNUSED)
261*3d8817e4Smiod {
262*3d8817e4Smiod   print_regset (cd, dis_info, value, attrs, pc, length, PUSH);
263*3d8817e4Smiod }
264*3d8817e4Smiod 
265*3d8817e4Smiod static void
print_signed4n(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,signed long value,unsigned int attrs ATTRIBUTE_UNUSED,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED)266*3d8817e4Smiod print_signed4n (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
267*3d8817e4Smiod 		void * dis_info,
268*3d8817e4Smiod 		signed long value,
269*3d8817e4Smiod 		unsigned int attrs ATTRIBUTE_UNUSED,
270*3d8817e4Smiod 		bfd_vma pc ATTRIBUTE_UNUSED,
271*3d8817e4Smiod 		int length ATTRIBUTE_UNUSED)
272*3d8817e4Smiod {
273*3d8817e4Smiod   disassemble_info *info = dis_info;
274*3d8817e4Smiod 
275*3d8817e4Smiod   (*info->fprintf_func) (info->stream, "%ld", -value);
276*3d8817e4Smiod }
277*3d8817e4Smiod 
278*3d8817e4Smiod void m32c_cgen_print_operand
279*3d8817e4Smiod   (CGEN_CPU_DESC, int, PTR, CGEN_FIELDS *, void const *, bfd_vma, int);
280*3d8817e4Smiod 
281*3d8817e4Smiod /* Main entry point for printing operands.
282*3d8817e4Smiod    XINFO is a `void *' and not a `disassemble_info *' to not put a requirement
283*3d8817e4Smiod    of dis-asm.h on cgen.h.
284*3d8817e4Smiod 
285*3d8817e4Smiod    This function is basically just a big switch statement.  Earlier versions
286*3d8817e4Smiod    used tables to look up the function to use, but
287*3d8817e4Smiod    - if the table contains both assembler and disassembler functions then
288*3d8817e4Smiod      the disassembler contains much of the assembler and vice-versa,
289*3d8817e4Smiod    - there's a lot of inlining possibilities as things grow,
290*3d8817e4Smiod    - using a switch statement avoids the function call overhead.
291*3d8817e4Smiod 
292*3d8817e4Smiod    This function could be moved into `print_insn_normal', but keeping it
293*3d8817e4Smiod    separate makes clear the interface between `print_insn_normal' and each of
294*3d8817e4Smiod    the handlers.  */
295*3d8817e4Smiod 
296*3d8817e4Smiod void
m32c_cgen_print_operand(CGEN_CPU_DESC cd,int opindex,void * xinfo,CGEN_FIELDS * fields,void const * attrs ATTRIBUTE_UNUSED,bfd_vma pc,int length)297*3d8817e4Smiod m32c_cgen_print_operand (CGEN_CPU_DESC cd,
298*3d8817e4Smiod 			   int opindex,
299*3d8817e4Smiod 			   void * xinfo,
300*3d8817e4Smiod 			   CGEN_FIELDS *fields,
301*3d8817e4Smiod 			   void const *attrs ATTRIBUTE_UNUSED,
302*3d8817e4Smiod 			   bfd_vma pc,
303*3d8817e4Smiod 			   int length)
304*3d8817e4Smiod {
305*3d8817e4Smiod   disassemble_info *info = (disassemble_info *) xinfo;
306*3d8817e4Smiod 
307*3d8817e4Smiod   switch (opindex)
308*3d8817e4Smiod     {
309*3d8817e4Smiod     case M32C_OPERAND_A0 :
310*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_a0, 0, 0);
311*3d8817e4Smiod       break;
312*3d8817e4Smiod     case M32C_OPERAND_A1 :
313*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_a1, 0, 0);
314*3d8817e4Smiod       break;
315*3d8817e4Smiod     case M32C_OPERAND_AN16_PUSH_S :
316*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_HI, fields->f_4_1, 0);
317*3d8817e4Smiod       break;
318*3d8817e4Smiod     case M32C_OPERAND_BIT16AN :
319*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar, fields->f_dst16_an, 0);
320*3d8817e4Smiod       break;
321*3d8817e4Smiod     case M32C_OPERAND_BIT16RN :
322*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_HI, fields->f_dst16_rn, 0);
323*3d8817e4Smiod       break;
324*3d8817e4Smiod     case M32C_OPERAND_BIT3_S :
325*3d8817e4Smiod       print_normal (cd, info, fields->f_imm3_S, 0|(1<<CGEN_OPERAND_SIGNED)|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
326*3d8817e4Smiod       break;
327*3d8817e4Smiod     case M32C_OPERAND_BIT32ANPREFIXED :
328*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar, fields->f_dst32_an_prefixed, 0);
329*3d8817e4Smiod       break;
330*3d8817e4Smiod     case M32C_OPERAND_BIT32ANUNPREFIXED :
331*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar, fields->f_dst32_an_unprefixed, 0);
332*3d8817e4Smiod       break;
333*3d8817e4Smiod     case M32C_OPERAND_BIT32RNPREFIXED :
334*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_QI, fields->f_dst32_rn_prefixed_QI, 0);
335*3d8817e4Smiod       break;
336*3d8817e4Smiod     case M32C_OPERAND_BIT32RNUNPREFIXED :
337*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_QI, fields->f_dst32_rn_unprefixed_QI, 0);
338*3d8817e4Smiod       break;
339*3d8817e4Smiod     case M32C_OPERAND_BITBASE16_16_S8 :
340*3d8817e4Smiod       print_signed_bitbase (cd, info, fields->f_dsp_16_s8, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
341*3d8817e4Smiod       break;
342*3d8817e4Smiod     case M32C_OPERAND_BITBASE16_16_U16 :
343*3d8817e4Smiod       print_unsigned_bitbase (cd, info, fields->f_dsp_16_u16, 0, pc, length);
344*3d8817e4Smiod       break;
345*3d8817e4Smiod     case M32C_OPERAND_BITBASE16_16_U8 :
346*3d8817e4Smiod       print_unsigned_bitbase (cd, info, fields->f_dsp_16_u8, 0, pc, length);
347*3d8817e4Smiod       break;
348*3d8817e4Smiod     case M32C_OPERAND_BITBASE16_8_U11_S :
349*3d8817e4Smiod       print_unsigned_bitbase (cd, info, fields->f_bitbase16_u11_S, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
350*3d8817e4Smiod       break;
351*3d8817e4Smiod     case M32C_OPERAND_BITBASE32_16_S11_UNPREFIXED :
352*3d8817e4Smiod       print_signed_bitbase (cd, info, fields->f_bitbase32_16_s11_unprefixed, 0|(1<<CGEN_OPERAND_SIGNED)|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
353*3d8817e4Smiod       break;
354*3d8817e4Smiod     case M32C_OPERAND_BITBASE32_16_S19_UNPREFIXED :
355*3d8817e4Smiod       print_signed_bitbase (cd, info, fields->f_bitbase32_16_s19_unprefixed, 0|(1<<CGEN_OPERAND_SIGNED)|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
356*3d8817e4Smiod       break;
357*3d8817e4Smiod     case M32C_OPERAND_BITBASE32_16_U11_UNPREFIXED :
358*3d8817e4Smiod       print_unsigned_bitbase (cd, info, fields->f_bitbase32_16_u11_unprefixed, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
359*3d8817e4Smiod       break;
360*3d8817e4Smiod     case M32C_OPERAND_BITBASE32_16_U19_UNPREFIXED :
361*3d8817e4Smiod       print_unsigned_bitbase (cd, info, fields->f_bitbase32_16_u19_unprefixed, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
362*3d8817e4Smiod       break;
363*3d8817e4Smiod     case M32C_OPERAND_BITBASE32_16_U27_UNPREFIXED :
364*3d8817e4Smiod       print_unsigned_bitbase (cd, info, fields->f_bitbase32_16_u27_unprefixed, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
365*3d8817e4Smiod       break;
366*3d8817e4Smiod     case M32C_OPERAND_BITBASE32_24_S11_PREFIXED :
367*3d8817e4Smiod       print_signed_bitbase (cd, info, fields->f_bitbase32_24_s11_prefixed, 0|(1<<CGEN_OPERAND_SIGNED)|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
368*3d8817e4Smiod       break;
369*3d8817e4Smiod     case M32C_OPERAND_BITBASE32_24_S19_PREFIXED :
370*3d8817e4Smiod       print_signed_bitbase (cd, info, fields->f_bitbase32_24_s19_prefixed, 0|(1<<CGEN_OPERAND_SIGNED)|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
371*3d8817e4Smiod       break;
372*3d8817e4Smiod     case M32C_OPERAND_BITBASE32_24_U11_PREFIXED :
373*3d8817e4Smiod       print_unsigned_bitbase (cd, info, fields->f_bitbase32_24_u11_prefixed, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
374*3d8817e4Smiod       break;
375*3d8817e4Smiod     case M32C_OPERAND_BITBASE32_24_U19_PREFIXED :
376*3d8817e4Smiod       print_unsigned_bitbase (cd, info, fields->f_bitbase32_24_u19_prefixed, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
377*3d8817e4Smiod       break;
378*3d8817e4Smiod     case M32C_OPERAND_BITBASE32_24_U27_PREFIXED :
379*3d8817e4Smiod       print_unsigned_bitbase (cd, info, fields->f_bitbase32_24_u27_prefixed, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
380*3d8817e4Smiod       break;
381*3d8817e4Smiod     case M32C_OPERAND_BITNO16R :
382*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_16_u8, 0, pc, length);
383*3d8817e4Smiod       break;
384*3d8817e4Smiod     case M32C_OPERAND_BITNO32PREFIXED :
385*3d8817e4Smiod       print_normal (cd, info, fields->f_bitno32_prefixed, 0, pc, length);
386*3d8817e4Smiod       break;
387*3d8817e4Smiod     case M32C_OPERAND_BITNO32UNPREFIXED :
388*3d8817e4Smiod       print_normal (cd, info, fields->f_bitno32_unprefixed, 0, pc, length);
389*3d8817e4Smiod       break;
390*3d8817e4Smiod     case M32C_OPERAND_DSP_10_U6 :
391*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_10_u6, 0, pc, length);
392*3d8817e4Smiod       break;
393*3d8817e4Smiod     case M32C_OPERAND_DSP_16_S16 :
394*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_16_s16, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
395*3d8817e4Smiod       break;
396*3d8817e4Smiod     case M32C_OPERAND_DSP_16_S8 :
397*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_16_s8, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
398*3d8817e4Smiod       break;
399*3d8817e4Smiod     case M32C_OPERAND_DSP_16_U16 :
400*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_16_u16, 0, pc, length);
401*3d8817e4Smiod       break;
402*3d8817e4Smiod     case M32C_OPERAND_DSP_16_U20 :
403*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_16_u24, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
404*3d8817e4Smiod       break;
405*3d8817e4Smiod     case M32C_OPERAND_DSP_16_U24 :
406*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_16_u24, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
407*3d8817e4Smiod       break;
408*3d8817e4Smiod     case M32C_OPERAND_DSP_16_U8 :
409*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_16_u8, 0, pc, length);
410*3d8817e4Smiod       break;
411*3d8817e4Smiod     case M32C_OPERAND_DSP_24_S16 :
412*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_24_s16, 0|(1<<CGEN_OPERAND_SIGNED)|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
413*3d8817e4Smiod       break;
414*3d8817e4Smiod     case M32C_OPERAND_DSP_24_S8 :
415*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_24_s8, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
416*3d8817e4Smiod       break;
417*3d8817e4Smiod     case M32C_OPERAND_DSP_24_U16 :
418*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_24_u16, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
419*3d8817e4Smiod       break;
420*3d8817e4Smiod     case M32C_OPERAND_DSP_24_U20 :
421*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_24_u24, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
422*3d8817e4Smiod       break;
423*3d8817e4Smiod     case M32C_OPERAND_DSP_24_U24 :
424*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_24_u24, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
425*3d8817e4Smiod       break;
426*3d8817e4Smiod     case M32C_OPERAND_DSP_24_U8 :
427*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_24_u8, 0, pc, length);
428*3d8817e4Smiod       break;
429*3d8817e4Smiod     case M32C_OPERAND_DSP_32_S16 :
430*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_32_s16, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
431*3d8817e4Smiod       break;
432*3d8817e4Smiod     case M32C_OPERAND_DSP_32_S8 :
433*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_32_s8, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
434*3d8817e4Smiod       break;
435*3d8817e4Smiod     case M32C_OPERAND_DSP_32_U16 :
436*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_32_u16, 0, pc, length);
437*3d8817e4Smiod       break;
438*3d8817e4Smiod     case M32C_OPERAND_DSP_32_U20 :
439*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_32_u24, 0, pc, length);
440*3d8817e4Smiod       break;
441*3d8817e4Smiod     case M32C_OPERAND_DSP_32_U24 :
442*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_32_u24, 0, pc, length);
443*3d8817e4Smiod       break;
444*3d8817e4Smiod     case M32C_OPERAND_DSP_32_U8 :
445*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_32_u8, 0, pc, length);
446*3d8817e4Smiod       break;
447*3d8817e4Smiod     case M32C_OPERAND_DSP_40_S16 :
448*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_40_s16, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
449*3d8817e4Smiod       break;
450*3d8817e4Smiod     case M32C_OPERAND_DSP_40_S8 :
451*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_40_s8, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
452*3d8817e4Smiod       break;
453*3d8817e4Smiod     case M32C_OPERAND_DSP_40_U16 :
454*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_40_u16, 0, pc, length);
455*3d8817e4Smiod       break;
456*3d8817e4Smiod     case M32C_OPERAND_DSP_40_U24 :
457*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_40_u24, 0, pc, length);
458*3d8817e4Smiod       break;
459*3d8817e4Smiod     case M32C_OPERAND_DSP_40_U8 :
460*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_40_u8, 0, pc, length);
461*3d8817e4Smiod       break;
462*3d8817e4Smiod     case M32C_OPERAND_DSP_48_S16 :
463*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_48_s16, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
464*3d8817e4Smiod       break;
465*3d8817e4Smiod     case M32C_OPERAND_DSP_48_S8 :
466*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_48_s8, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
467*3d8817e4Smiod       break;
468*3d8817e4Smiod     case M32C_OPERAND_DSP_48_U16 :
469*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_48_u16, 0, pc, length);
470*3d8817e4Smiod       break;
471*3d8817e4Smiod     case M32C_OPERAND_DSP_48_U24 :
472*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_48_u24, 0|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
473*3d8817e4Smiod       break;
474*3d8817e4Smiod     case M32C_OPERAND_DSP_48_U8 :
475*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_48_u8, 0, pc, length);
476*3d8817e4Smiod       break;
477*3d8817e4Smiod     case M32C_OPERAND_DSP_8_S24 :
478*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_8_s24, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
479*3d8817e4Smiod       break;
480*3d8817e4Smiod     case M32C_OPERAND_DSP_8_S8 :
481*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_8_s8, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
482*3d8817e4Smiod       break;
483*3d8817e4Smiod     case M32C_OPERAND_DSP_8_U16 :
484*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_8_u16, 0, pc, length);
485*3d8817e4Smiod       break;
486*3d8817e4Smiod     case M32C_OPERAND_DSP_8_U24 :
487*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_8_u24, 0, pc, length);
488*3d8817e4Smiod       break;
489*3d8817e4Smiod     case M32C_OPERAND_DSP_8_U6 :
490*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_8_u6, 0, pc, length);
491*3d8817e4Smiod       break;
492*3d8817e4Smiod     case M32C_OPERAND_DSP_8_U8 :
493*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_8_u8, 0, pc, length);
494*3d8817e4Smiod       break;
495*3d8817e4Smiod     case M32C_OPERAND_DST16AN :
496*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar, fields->f_dst16_an, 0);
497*3d8817e4Smiod       break;
498*3d8817e4Smiod     case M32C_OPERAND_DST16AN_S :
499*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_HI, fields->f_dst16_an_s, 0);
500*3d8817e4Smiod       break;
501*3d8817e4Smiod     case M32C_OPERAND_DST16ANHI :
502*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_HI, fields->f_dst16_an, 0);
503*3d8817e4Smiod       break;
504*3d8817e4Smiod     case M32C_OPERAND_DST16ANQI :
505*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_QI, fields->f_dst16_an, 0);
506*3d8817e4Smiod       break;
507*3d8817e4Smiod     case M32C_OPERAND_DST16ANQI_S :
508*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_QI, fields->f_dst16_rn_QI_s, 0);
509*3d8817e4Smiod       break;
510*3d8817e4Smiod     case M32C_OPERAND_DST16ANSI :
511*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_SI, fields->f_dst16_an, 0);
512*3d8817e4Smiod       break;
513*3d8817e4Smiod     case M32C_OPERAND_DST16RNEXTQI :
514*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_ext_QI, fields->f_dst16_rn_ext, 0);
515*3d8817e4Smiod       break;
516*3d8817e4Smiod     case M32C_OPERAND_DST16RNHI :
517*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_HI, fields->f_dst16_rn, 0);
518*3d8817e4Smiod       break;
519*3d8817e4Smiod     case M32C_OPERAND_DST16RNQI :
520*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_QI, fields->f_dst16_rn, 0);
521*3d8817e4Smiod       break;
522*3d8817e4Smiod     case M32C_OPERAND_DST16RNQI_S :
523*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_r0l_r0h, fields->f_dst16_rn_QI_s, 0);
524*3d8817e4Smiod       break;
525*3d8817e4Smiod     case M32C_OPERAND_DST16RNSI :
526*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_SI, fields->f_dst16_rn, 0);
527*3d8817e4Smiod       break;
528*3d8817e4Smiod     case M32C_OPERAND_DST32ANEXTUNPREFIXED :
529*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar, fields->f_dst32_an_unprefixed, 0);
530*3d8817e4Smiod       break;
531*3d8817e4Smiod     case M32C_OPERAND_DST32ANPREFIXED :
532*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar, fields->f_dst32_an_prefixed, 0);
533*3d8817e4Smiod       break;
534*3d8817e4Smiod     case M32C_OPERAND_DST32ANPREFIXEDHI :
535*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_HI, fields->f_dst32_an_prefixed, 0);
536*3d8817e4Smiod       break;
537*3d8817e4Smiod     case M32C_OPERAND_DST32ANPREFIXEDQI :
538*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_QI, fields->f_dst32_an_prefixed, 0);
539*3d8817e4Smiod       break;
540*3d8817e4Smiod     case M32C_OPERAND_DST32ANPREFIXEDSI :
541*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar, fields->f_dst32_an_prefixed, 0);
542*3d8817e4Smiod       break;
543*3d8817e4Smiod     case M32C_OPERAND_DST32ANUNPREFIXED :
544*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar, fields->f_dst32_an_unprefixed, 0);
545*3d8817e4Smiod       break;
546*3d8817e4Smiod     case M32C_OPERAND_DST32ANUNPREFIXEDHI :
547*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_HI, fields->f_dst32_an_unprefixed, 0);
548*3d8817e4Smiod       break;
549*3d8817e4Smiod     case M32C_OPERAND_DST32ANUNPREFIXEDQI :
550*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_QI, fields->f_dst32_an_unprefixed, 0);
551*3d8817e4Smiod       break;
552*3d8817e4Smiod     case M32C_OPERAND_DST32ANUNPREFIXEDSI :
553*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar, fields->f_dst32_an_unprefixed, 0);
554*3d8817e4Smiod       break;
555*3d8817e4Smiod     case M32C_OPERAND_DST32R0HI_S :
556*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_r0, 0, 0);
557*3d8817e4Smiod       break;
558*3d8817e4Smiod     case M32C_OPERAND_DST32R0QI_S :
559*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_r0l, 0, 0);
560*3d8817e4Smiod       break;
561*3d8817e4Smiod     case M32C_OPERAND_DST32RNEXTUNPREFIXEDHI :
562*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_ext_HI, fields->f_dst32_rn_ext_unprefixed, 0);
563*3d8817e4Smiod       break;
564*3d8817e4Smiod     case M32C_OPERAND_DST32RNEXTUNPREFIXEDQI :
565*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_ext_QI, fields->f_dst32_rn_ext_unprefixed, 0);
566*3d8817e4Smiod       break;
567*3d8817e4Smiod     case M32C_OPERAND_DST32RNPREFIXEDHI :
568*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_HI, fields->f_dst32_rn_prefixed_HI, 0);
569*3d8817e4Smiod       break;
570*3d8817e4Smiod     case M32C_OPERAND_DST32RNPREFIXEDQI :
571*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_QI, fields->f_dst32_rn_prefixed_QI, 0);
572*3d8817e4Smiod       break;
573*3d8817e4Smiod     case M32C_OPERAND_DST32RNPREFIXEDSI :
574*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_SI, fields->f_dst32_rn_prefixed_SI, 0);
575*3d8817e4Smiod       break;
576*3d8817e4Smiod     case M32C_OPERAND_DST32RNUNPREFIXEDHI :
577*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_HI, fields->f_dst32_rn_unprefixed_HI, 0);
578*3d8817e4Smiod       break;
579*3d8817e4Smiod     case M32C_OPERAND_DST32RNUNPREFIXEDQI :
580*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_QI, fields->f_dst32_rn_unprefixed_QI, 0);
581*3d8817e4Smiod       break;
582*3d8817e4Smiod     case M32C_OPERAND_DST32RNUNPREFIXEDSI :
583*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_SI, fields->f_dst32_rn_unprefixed_SI, 0);
584*3d8817e4Smiod       break;
585*3d8817e4Smiod     case M32C_OPERAND_G :
586*3d8817e4Smiod       print_G (cd, info, 0, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
587*3d8817e4Smiod       break;
588*3d8817e4Smiod     case M32C_OPERAND_IMM_12_S4 :
589*3d8817e4Smiod       print_normal (cd, info, fields->f_imm_12_s4, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
590*3d8817e4Smiod       break;
591*3d8817e4Smiod     case M32C_OPERAND_IMM_12_S4N :
592*3d8817e4Smiod       print_signed4n (cd, info, fields->f_imm_12_s4, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
593*3d8817e4Smiod       break;
594*3d8817e4Smiod     case M32C_OPERAND_IMM_13_U3 :
595*3d8817e4Smiod       print_normal (cd, info, fields->f_imm_13_u3, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
596*3d8817e4Smiod       break;
597*3d8817e4Smiod     case M32C_OPERAND_IMM_16_HI :
598*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_16_s16, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
599*3d8817e4Smiod       break;
600*3d8817e4Smiod     case M32C_OPERAND_IMM_16_QI :
601*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_16_s8, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
602*3d8817e4Smiod       break;
603*3d8817e4Smiod     case M32C_OPERAND_IMM_16_SI :
604*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_16_s32, 0|(1<<CGEN_OPERAND_SIGNED)|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
605*3d8817e4Smiod       break;
606*3d8817e4Smiod     case M32C_OPERAND_IMM_20_S4 :
607*3d8817e4Smiod       print_normal (cd, info, fields->f_imm_20_s4, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
608*3d8817e4Smiod       break;
609*3d8817e4Smiod     case M32C_OPERAND_IMM_24_HI :
610*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_24_s16, 0|(1<<CGEN_OPERAND_SIGNED)|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
611*3d8817e4Smiod       break;
612*3d8817e4Smiod     case M32C_OPERAND_IMM_24_QI :
613*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_24_s8, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
614*3d8817e4Smiod       break;
615*3d8817e4Smiod     case M32C_OPERAND_IMM_24_SI :
616*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_24_s32, 0|(1<<CGEN_OPERAND_SIGNED)|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
617*3d8817e4Smiod       break;
618*3d8817e4Smiod     case M32C_OPERAND_IMM_32_HI :
619*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_32_s16, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
620*3d8817e4Smiod       break;
621*3d8817e4Smiod     case M32C_OPERAND_IMM_32_QI :
622*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_32_s8, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
623*3d8817e4Smiod       break;
624*3d8817e4Smiod     case M32C_OPERAND_IMM_32_SI :
625*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_32_s32, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
626*3d8817e4Smiod       break;
627*3d8817e4Smiod     case M32C_OPERAND_IMM_40_HI :
628*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_40_s16, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
629*3d8817e4Smiod       break;
630*3d8817e4Smiod     case M32C_OPERAND_IMM_40_QI :
631*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_40_s8, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
632*3d8817e4Smiod       break;
633*3d8817e4Smiod     case M32C_OPERAND_IMM_40_SI :
634*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_40_s32, 0|(1<<CGEN_OPERAND_SIGNED)|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
635*3d8817e4Smiod       break;
636*3d8817e4Smiod     case M32C_OPERAND_IMM_48_HI :
637*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_48_s16, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
638*3d8817e4Smiod       break;
639*3d8817e4Smiod     case M32C_OPERAND_IMM_48_QI :
640*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_48_s8, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
641*3d8817e4Smiod       break;
642*3d8817e4Smiod     case M32C_OPERAND_IMM_48_SI :
643*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_48_s32, 0|(1<<CGEN_OPERAND_SIGNED)|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
644*3d8817e4Smiod       break;
645*3d8817e4Smiod     case M32C_OPERAND_IMM_56_HI :
646*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_56_s16, 0|(1<<CGEN_OPERAND_SIGNED)|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
647*3d8817e4Smiod       break;
648*3d8817e4Smiod     case M32C_OPERAND_IMM_56_QI :
649*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_56_s8, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
650*3d8817e4Smiod       break;
651*3d8817e4Smiod     case M32C_OPERAND_IMM_64_HI :
652*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_64_s16, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
653*3d8817e4Smiod       break;
654*3d8817e4Smiod     case M32C_OPERAND_IMM_8_HI :
655*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_8_s16, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
656*3d8817e4Smiod       break;
657*3d8817e4Smiod     case M32C_OPERAND_IMM_8_QI :
658*3d8817e4Smiod       print_normal (cd, info, fields->f_dsp_8_s8, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
659*3d8817e4Smiod       break;
660*3d8817e4Smiod     case M32C_OPERAND_IMM_8_S4 :
661*3d8817e4Smiod       print_normal (cd, info, fields->f_imm_8_s4, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
662*3d8817e4Smiod       break;
663*3d8817e4Smiod     case M32C_OPERAND_IMM_8_S4N :
664*3d8817e4Smiod       print_normal (cd, info, fields->f_imm_8_s4, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
665*3d8817e4Smiod       break;
666*3d8817e4Smiod     case M32C_OPERAND_IMM_SH_12_S4 :
667*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_shimm, fields->f_imm_12_s4, 0);
668*3d8817e4Smiod       break;
669*3d8817e4Smiod     case M32C_OPERAND_IMM_SH_20_S4 :
670*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_shimm, fields->f_imm_20_s4, 0);
671*3d8817e4Smiod       break;
672*3d8817e4Smiod     case M32C_OPERAND_IMM_SH_8_S4 :
673*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_shimm, fields->f_imm_8_s4, 0);
674*3d8817e4Smiod       break;
675*3d8817e4Smiod     case M32C_OPERAND_IMM1_S :
676*3d8817e4Smiod       print_normal (cd, info, fields->f_imm1_S, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
677*3d8817e4Smiod       break;
678*3d8817e4Smiod     case M32C_OPERAND_IMM3_S :
679*3d8817e4Smiod       print_normal (cd, info, fields->f_imm3_S, 0|(1<<CGEN_OPERAND_SIGNED)|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
680*3d8817e4Smiod       break;
681*3d8817e4Smiod     case M32C_OPERAND_LAB_16_8 :
682*3d8817e4Smiod       print_address (cd, info, fields->f_lab_16_8, 0|(1<<CGEN_OPERAND_RELAX)|(1<<CGEN_OPERAND_PCREL_ADDR), pc, length);
683*3d8817e4Smiod       break;
684*3d8817e4Smiod     case M32C_OPERAND_LAB_24_8 :
685*3d8817e4Smiod       print_address (cd, info, fields->f_lab_24_8, 0|(1<<CGEN_OPERAND_PCREL_ADDR), pc, length);
686*3d8817e4Smiod       break;
687*3d8817e4Smiod     case M32C_OPERAND_LAB_32_8 :
688*3d8817e4Smiod       print_address (cd, info, fields->f_lab_32_8, 0|(1<<CGEN_OPERAND_PCREL_ADDR), pc, length);
689*3d8817e4Smiod       break;
690*3d8817e4Smiod     case M32C_OPERAND_LAB_40_8 :
691*3d8817e4Smiod       print_address (cd, info, fields->f_lab_40_8, 0|(1<<CGEN_OPERAND_PCREL_ADDR), pc, length);
692*3d8817e4Smiod       break;
693*3d8817e4Smiod     case M32C_OPERAND_LAB_5_3 :
694*3d8817e4Smiod       print_address (cd, info, fields->f_lab_5_3, 0|(1<<CGEN_OPERAND_RELAX)|(1<<CGEN_OPERAND_PCREL_ADDR), pc, length);
695*3d8817e4Smiod       break;
696*3d8817e4Smiod     case M32C_OPERAND_LAB_8_16 :
697*3d8817e4Smiod       print_address (cd, info, fields->f_lab_8_16, 0|(1<<CGEN_OPERAND_RELAX)|(1<<CGEN_OPERAND_SIGN_OPT)|(1<<CGEN_OPERAND_PCREL_ADDR), pc, length);
698*3d8817e4Smiod       break;
699*3d8817e4Smiod     case M32C_OPERAND_LAB_8_24 :
700*3d8817e4Smiod       print_address (cd, info, fields->f_lab_8_24, 0|(1<<CGEN_OPERAND_RELAX)|(1<<CGEN_OPERAND_ABS_ADDR), pc, length);
701*3d8817e4Smiod       break;
702*3d8817e4Smiod     case M32C_OPERAND_LAB_8_8 :
703*3d8817e4Smiod       print_address (cd, info, fields->f_lab_8_8, 0|(1<<CGEN_OPERAND_RELAX)|(1<<CGEN_OPERAND_PCREL_ADDR), pc, length);
704*3d8817e4Smiod       break;
705*3d8817e4Smiod     case M32C_OPERAND_LAB32_JMP_S :
706*3d8817e4Smiod       print_address (cd, info, fields->f_lab32_jmp_s, 0|(1<<CGEN_OPERAND_RELAX)|(1<<CGEN_OPERAND_PCREL_ADDR)|(1<<CGEN_OPERAND_VIRTUAL), pc, length);
707*3d8817e4Smiod       break;
708*3d8817e4Smiod     case M32C_OPERAND_Q :
709*3d8817e4Smiod       print_Q (cd, info, 0, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
710*3d8817e4Smiod       break;
711*3d8817e4Smiod     case M32C_OPERAND_R0 :
712*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_r0, 0, 0);
713*3d8817e4Smiod       break;
714*3d8817e4Smiod     case M32C_OPERAND_R0H :
715*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_r0h, 0, 0);
716*3d8817e4Smiod       break;
717*3d8817e4Smiod     case M32C_OPERAND_R0L :
718*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_r0l, 0, 0);
719*3d8817e4Smiod       break;
720*3d8817e4Smiod     case M32C_OPERAND_R1 :
721*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_r1, 0, 0);
722*3d8817e4Smiod       break;
723*3d8817e4Smiod     case M32C_OPERAND_R1R2R0 :
724*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_r1r2r0, 0, 0);
725*3d8817e4Smiod       break;
726*3d8817e4Smiod     case M32C_OPERAND_R2 :
727*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_r2, 0, 0);
728*3d8817e4Smiod       break;
729*3d8817e4Smiod     case M32C_OPERAND_R2R0 :
730*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_r2r0, 0, 0);
731*3d8817e4Smiod       break;
732*3d8817e4Smiod     case M32C_OPERAND_R3 :
733*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_r3, 0, 0);
734*3d8817e4Smiod       break;
735*3d8817e4Smiod     case M32C_OPERAND_R3R1 :
736*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_r3r1, 0, 0);
737*3d8817e4Smiod       break;
738*3d8817e4Smiod     case M32C_OPERAND_REGSETPOP :
739*3d8817e4Smiod       print_pop_regset (cd, info, fields->f_8_8, 0, pc, length);
740*3d8817e4Smiod       break;
741*3d8817e4Smiod     case M32C_OPERAND_REGSETPUSH :
742*3d8817e4Smiod       print_push_regset (cd, info, fields->f_8_8, 0, pc, length);
743*3d8817e4Smiod       break;
744*3d8817e4Smiod     case M32C_OPERAND_RN16_PUSH_S :
745*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_QI, fields->f_4_1, 0);
746*3d8817e4Smiod       break;
747*3d8817e4Smiod     case M32C_OPERAND_S :
748*3d8817e4Smiod       print_S (cd, info, 0, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
749*3d8817e4Smiod       break;
750*3d8817e4Smiod     case M32C_OPERAND_SRC16AN :
751*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar, fields->f_src16_an, 0);
752*3d8817e4Smiod       break;
753*3d8817e4Smiod     case M32C_OPERAND_SRC16ANHI :
754*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_HI, fields->f_src16_an, 0);
755*3d8817e4Smiod       break;
756*3d8817e4Smiod     case M32C_OPERAND_SRC16ANQI :
757*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_QI, fields->f_src16_an, 0);
758*3d8817e4Smiod       break;
759*3d8817e4Smiod     case M32C_OPERAND_SRC16RNHI :
760*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_HI, fields->f_src16_rn, 0);
761*3d8817e4Smiod       break;
762*3d8817e4Smiod     case M32C_OPERAND_SRC16RNQI :
763*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_QI, fields->f_src16_rn, 0);
764*3d8817e4Smiod       break;
765*3d8817e4Smiod     case M32C_OPERAND_SRC32ANPREFIXED :
766*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar, fields->f_src32_an_prefixed, 0);
767*3d8817e4Smiod       break;
768*3d8817e4Smiod     case M32C_OPERAND_SRC32ANPREFIXEDHI :
769*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_HI, fields->f_src32_an_prefixed, 0);
770*3d8817e4Smiod       break;
771*3d8817e4Smiod     case M32C_OPERAND_SRC32ANPREFIXEDQI :
772*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_QI, fields->f_src32_an_prefixed, 0);
773*3d8817e4Smiod       break;
774*3d8817e4Smiod     case M32C_OPERAND_SRC32ANPREFIXEDSI :
775*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar, fields->f_src32_an_prefixed, 0);
776*3d8817e4Smiod       break;
777*3d8817e4Smiod     case M32C_OPERAND_SRC32ANUNPREFIXED :
778*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar, fields->f_src32_an_unprefixed, 0);
779*3d8817e4Smiod       break;
780*3d8817e4Smiod     case M32C_OPERAND_SRC32ANUNPREFIXEDHI :
781*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_HI, fields->f_src32_an_unprefixed, 0);
782*3d8817e4Smiod       break;
783*3d8817e4Smiod     case M32C_OPERAND_SRC32ANUNPREFIXEDQI :
784*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar_QI, fields->f_src32_an_unprefixed, 0);
785*3d8817e4Smiod       break;
786*3d8817e4Smiod     case M32C_OPERAND_SRC32ANUNPREFIXEDSI :
787*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_ar, fields->f_src32_an_unprefixed, 0);
788*3d8817e4Smiod       break;
789*3d8817e4Smiod     case M32C_OPERAND_SRC32RNPREFIXEDHI :
790*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_HI, fields->f_src32_rn_prefixed_HI, 0);
791*3d8817e4Smiod       break;
792*3d8817e4Smiod     case M32C_OPERAND_SRC32RNPREFIXEDQI :
793*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_QI, fields->f_src32_rn_prefixed_QI, 0);
794*3d8817e4Smiod       break;
795*3d8817e4Smiod     case M32C_OPERAND_SRC32RNPREFIXEDSI :
796*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_SI, fields->f_src32_rn_prefixed_SI, 0);
797*3d8817e4Smiod       break;
798*3d8817e4Smiod     case M32C_OPERAND_SRC32RNUNPREFIXEDHI :
799*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_HI, fields->f_src32_rn_unprefixed_HI, 0);
800*3d8817e4Smiod       break;
801*3d8817e4Smiod     case M32C_OPERAND_SRC32RNUNPREFIXEDQI :
802*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_QI, fields->f_src32_rn_unprefixed_QI, 0);
803*3d8817e4Smiod       break;
804*3d8817e4Smiod     case M32C_OPERAND_SRC32RNUNPREFIXEDSI :
805*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_gr_SI, fields->f_src32_rn_unprefixed_SI, 0);
806*3d8817e4Smiod       break;
807*3d8817e4Smiod     case M32C_OPERAND_SRCDST16_R0L_R0H_S_NORMAL :
808*3d8817e4Smiod       print_r0l_r0h (cd, info, fields->f_5_1, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
809*3d8817e4Smiod       break;
810*3d8817e4Smiod     case M32C_OPERAND_X :
811*3d8817e4Smiod       print_X (cd, info, 0, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
812*3d8817e4Smiod       break;
813*3d8817e4Smiod     case M32C_OPERAND_Z :
814*3d8817e4Smiod       print_Z (cd, info, 0, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
815*3d8817e4Smiod       break;
816*3d8817e4Smiod     case M32C_OPERAND_COND16_16 :
817*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cond16, fields->f_dsp_16_u8, 0);
818*3d8817e4Smiod       break;
819*3d8817e4Smiod     case M32C_OPERAND_COND16_24 :
820*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cond16, fields->f_dsp_24_u8, 0);
821*3d8817e4Smiod       break;
822*3d8817e4Smiod     case M32C_OPERAND_COND16_32 :
823*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cond16, fields->f_dsp_32_u8, 0);
824*3d8817e4Smiod       break;
825*3d8817e4Smiod     case M32C_OPERAND_COND16C :
826*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cond16c, fields->f_cond16, 0);
827*3d8817e4Smiod       break;
828*3d8817e4Smiod     case M32C_OPERAND_COND16J :
829*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cond16j, fields->f_cond16, 0);
830*3d8817e4Smiod       break;
831*3d8817e4Smiod     case M32C_OPERAND_COND16J5 :
832*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cond16j_5, fields->f_cond16j_5, 0);
833*3d8817e4Smiod       break;
834*3d8817e4Smiod     case M32C_OPERAND_COND32 :
835*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cond32, fields->f_cond32, 0|(1<<CGEN_OPERAND_VIRTUAL));
836*3d8817e4Smiod       break;
837*3d8817e4Smiod     case M32C_OPERAND_COND32_16 :
838*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cond32, fields->f_dsp_16_u8, 0);
839*3d8817e4Smiod       break;
840*3d8817e4Smiod     case M32C_OPERAND_COND32_24 :
841*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cond32, fields->f_dsp_24_u8, 0);
842*3d8817e4Smiod       break;
843*3d8817e4Smiod     case M32C_OPERAND_COND32_32 :
844*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cond32, fields->f_dsp_32_u8, 0);
845*3d8817e4Smiod       break;
846*3d8817e4Smiod     case M32C_OPERAND_COND32_40 :
847*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cond32, fields->f_dsp_40_u8, 0);
848*3d8817e4Smiod       break;
849*3d8817e4Smiod     case M32C_OPERAND_COND32J :
850*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cond32, fields->f_cond32j, 0|(1<<CGEN_OPERAND_VIRTUAL));
851*3d8817e4Smiod       break;
852*3d8817e4Smiod     case M32C_OPERAND_CR1_PREFIXED_32 :
853*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cr1_32, fields->f_21_3, 0);
854*3d8817e4Smiod       break;
855*3d8817e4Smiod     case M32C_OPERAND_CR1_UNPREFIXED_32 :
856*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cr1_32, fields->f_13_3, 0);
857*3d8817e4Smiod       break;
858*3d8817e4Smiod     case M32C_OPERAND_CR16 :
859*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cr_16, fields->f_9_3, 0);
860*3d8817e4Smiod       break;
861*3d8817e4Smiod     case M32C_OPERAND_CR2_32 :
862*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cr2_32, fields->f_13_3, 0);
863*3d8817e4Smiod       break;
864*3d8817e4Smiod     case M32C_OPERAND_CR3_PREFIXED_32 :
865*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cr3_32, fields->f_21_3, 0);
866*3d8817e4Smiod       break;
867*3d8817e4Smiod     case M32C_OPERAND_CR3_UNPREFIXED_32 :
868*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cr3_32, fields->f_13_3, 0);
869*3d8817e4Smiod       break;
870*3d8817e4Smiod     case M32C_OPERAND_FLAGS16 :
871*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_flags, fields->f_9_3, 0);
872*3d8817e4Smiod       break;
873*3d8817e4Smiod     case M32C_OPERAND_FLAGS32 :
874*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_flags, fields->f_13_3, 0);
875*3d8817e4Smiod       break;
876*3d8817e4Smiod     case M32C_OPERAND_SCCOND32 :
877*3d8817e4Smiod       print_keyword (cd, info, & m32c_cgen_opval_h_cond32, fields->f_cond16, 0);
878*3d8817e4Smiod       break;
879*3d8817e4Smiod     case M32C_OPERAND_SIZE :
880*3d8817e4Smiod       print_size (cd, info, 0, 0|(1<<CGEN_OPERAND_SIGNED), pc, length);
881*3d8817e4Smiod       break;
882*3d8817e4Smiod 
883*3d8817e4Smiod     default :
884*3d8817e4Smiod       /* xgettext:c-format */
885*3d8817e4Smiod       fprintf (stderr, _("Unrecognized field %d while printing insn.\n"),
886*3d8817e4Smiod 	       opindex);
887*3d8817e4Smiod     abort ();
888*3d8817e4Smiod   }
889*3d8817e4Smiod }
890*3d8817e4Smiod 
891*3d8817e4Smiod cgen_print_fn * const m32c_cgen_print_handlers[] =
892*3d8817e4Smiod {
893*3d8817e4Smiod   print_insn_normal,
894*3d8817e4Smiod };
895*3d8817e4Smiod 
896*3d8817e4Smiod 
897*3d8817e4Smiod void
m32c_cgen_init_dis(CGEN_CPU_DESC cd)898*3d8817e4Smiod m32c_cgen_init_dis (CGEN_CPU_DESC cd)
899*3d8817e4Smiod {
900*3d8817e4Smiod   m32c_cgen_init_opcode_table (cd);
901*3d8817e4Smiod   m32c_cgen_init_ibld_table (cd);
902*3d8817e4Smiod   cd->print_handlers = & m32c_cgen_print_handlers[0];
903*3d8817e4Smiod   cd->print_operand = m32c_cgen_print_operand;
904*3d8817e4Smiod }
905*3d8817e4Smiod 
906*3d8817e4Smiod 
907*3d8817e4Smiod /* Default print handler.  */
908*3d8817e4Smiod 
909*3d8817e4Smiod static void
print_normal(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,long value,unsigned int attrs,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED)910*3d8817e4Smiod print_normal (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
911*3d8817e4Smiod 	      void *dis_info,
912*3d8817e4Smiod 	      long value,
913*3d8817e4Smiod 	      unsigned int attrs,
914*3d8817e4Smiod 	      bfd_vma pc ATTRIBUTE_UNUSED,
915*3d8817e4Smiod 	      int length ATTRIBUTE_UNUSED)
916*3d8817e4Smiod {
917*3d8817e4Smiod   disassemble_info *info = (disassemble_info *) dis_info;
918*3d8817e4Smiod 
919*3d8817e4Smiod #ifdef CGEN_PRINT_NORMAL
920*3d8817e4Smiod   CGEN_PRINT_NORMAL (cd, info, value, attrs, pc, length);
921*3d8817e4Smiod #endif
922*3d8817e4Smiod 
923*3d8817e4Smiod   /* Print the operand as directed by the attributes.  */
924*3d8817e4Smiod   if (CGEN_BOOL_ATTR (attrs, CGEN_OPERAND_SEM_ONLY))
925*3d8817e4Smiod     ; /* nothing to do */
926*3d8817e4Smiod   else if (CGEN_BOOL_ATTR (attrs, CGEN_OPERAND_SIGNED))
927*3d8817e4Smiod     (*info->fprintf_func) (info->stream, "%ld", value);
928*3d8817e4Smiod   else
929*3d8817e4Smiod     (*info->fprintf_func) (info->stream, "0x%lx", value);
930*3d8817e4Smiod }
931*3d8817e4Smiod 
932*3d8817e4Smiod /* Default address handler.  */
933*3d8817e4Smiod 
934*3d8817e4Smiod static void
print_address(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,bfd_vma value,unsigned int attrs,bfd_vma pc ATTRIBUTE_UNUSED,int length ATTRIBUTE_UNUSED)935*3d8817e4Smiod print_address (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
936*3d8817e4Smiod 	       void *dis_info,
937*3d8817e4Smiod 	       bfd_vma value,
938*3d8817e4Smiod 	       unsigned int attrs,
939*3d8817e4Smiod 	       bfd_vma pc ATTRIBUTE_UNUSED,
940*3d8817e4Smiod 	       int length ATTRIBUTE_UNUSED)
941*3d8817e4Smiod {
942*3d8817e4Smiod   disassemble_info *info = (disassemble_info *) dis_info;
943*3d8817e4Smiod 
944*3d8817e4Smiod #ifdef CGEN_PRINT_ADDRESS
945*3d8817e4Smiod   CGEN_PRINT_ADDRESS (cd, info, value, attrs, pc, length);
946*3d8817e4Smiod #endif
947*3d8817e4Smiod 
948*3d8817e4Smiod   /* Print the operand as directed by the attributes.  */
949*3d8817e4Smiod   if (CGEN_BOOL_ATTR (attrs, CGEN_OPERAND_SEM_ONLY))
950*3d8817e4Smiod     ; /* Nothing to do.  */
951*3d8817e4Smiod   else if (CGEN_BOOL_ATTR (attrs, CGEN_OPERAND_PCREL_ADDR))
952*3d8817e4Smiod     (*info->print_address_func) (value, info);
953*3d8817e4Smiod   else if (CGEN_BOOL_ATTR (attrs, CGEN_OPERAND_ABS_ADDR))
954*3d8817e4Smiod     (*info->print_address_func) (value, info);
955*3d8817e4Smiod   else if (CGEN_BOOL_ATTR (attrs, CGEN_OPERAND_SIGNED))
956*3d8817e4Smiod     (*info->fprintf_func) (info->stream, "%ld", (long) value);
957*3d8817e4Smiod   else
958*3d8817e4Smiod     (*info->fprintf_func) (info->stream, "0x%lx", (long) value);
959*3d8817e4Smiod }
960*3d8817e4Smiod 
961*3d8817e4Smiod /* Keyword print handler.  */
962*3d8817e4Smiod 
963*3d8817e4Smiod static void
print_keyword(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,void * dis_info,CGEN_KEYWORD * keyword_table,long value,unsigned int attrs ATTRIBUTE_UNUSED)964*3d8817e4Smiod print_keyword (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
965*3d8817e4Smiod 	       void *dis_info,
966*3d8817e4Smiod 	       CGEN_KEYWORD *keyword_table,
967*3d8817e4Smiod 	       long value,
968*3d8817e4Smiod 	       unsigned int attrs ATTRIBUTE_UNUSED)
969*3d8817e4Smiod {
970*3d8817e4Smiod   disassemble_info *info = (disassemble_info *) dis_info;
971*3d8817e4Smiod   const CGEN_KEYWORD_ENTRY *ke;
972*3d8817e4Smiod 
973*3d8817e4Smiod   ke = cgen_keyword_lookup_value (keyword_table, value);
974*3d8817e4Smiod   if (ke != NULL)
975*3d8817e4Smiod     (*info->fprintf_func) (info->stream, "%s", ke->name);
976*3d8817e4Smiod   else
977*3d8817e4Smiod     (*info->fprintf_func) (info->stream, "???");
978*3d8817e4Smiod }
979*3d8817e4Smiod 
980*3d8817e4Smiod /* Default insn printer.
981*3d8817e4Smiod 
982*3d8817e4Smiod    DIS_INFO is defined as `void *' so the disassembler needn't know anything
983*3d8817e4Smiod    about disassemble_info.  */
984*3d8817e4Smiod 
985*3d8817e4Smiod static void
print_insn_normal(CGEN_CPU_DESC cd,void * dis_info,const CGEN_INSN * insn,CGEN_FIELDS * fields,bfd_vma pc,int length)986*3d8817e4Smiod print_insn_normal (CGEN_CPU_DESC cd,
987*3d8817e4Smiod 		   void *dis_info,
988*3d8817e4Smiod 		   const CGEN_INSN *insn,
989*3d8817e4Smiod 		   CGEN_FIELDS *fields,
990*3d8817e4Smiod 		   bfd_vma pc,
991*3d8817e4Smiod 		   int length)
992*3d8817e4Smiod {
993*3d8817e4Smiod   const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
994*3d8817e4Smiod   disassemble_info *info = (disassemble_info *) dis_info;
995*3d8817e4Smiod   const CGEN_SYNTAX_CHAR_TYPE *syn;
996*3d8817e4Smiod 
997*3d8817e4Smiod   CGEN_INIT_PRINT (cd);
998*3d8817e4Smiod 
999*3d8817e4Smiod   for (syn = CGEN_SYNTAX_STRING (syntax); *syn; ++syn)
1000*3d8817e4Smiod     {
1001*3d8817e4Smiod       if (CGEN_SYNTAX_MNEMONIC_P (*syn))
1002*3d8817e4Smiod 	{
1003*3d8817e4Smiod 	  (*info->fprintf_func) (info->stream, "%s", CGEN_INSN_MNEMONIC (insn));
1004*3d8817e4Smiod 	  continue;
1005*3d8817e4Smiod 	}
1006*3d8817e4Smiod       if (CGEN_SYNTAX_CHAR_P (*syn))
1007*3d8817e4Smiod 	{
1008*3d8817e4Smiod 	  (*info->fprintf_func) (info->stream, "%c", CGEN_SYNTAX_CHAR (*syn));
1009*3d8817e4Smiod 	  continue;
1010*3d8817e4Smiod 	}
1011*3d8817e4Smiod 
1012*3d8817e4Smiod       /* We have an operand.  */
1013*3d8817e4Smiod       m32c_cgen_print_operand (cd, CGEN_SYNTAX_FIELD (*syn), info,
1014*3d8817e4Smiod 				 fields, CGEN_INSN_ATTRS (insn), pc, length);
1015*3d8817e4Smiod     }
1016*3d8817e4Smiod }
1017*3d8817e4Smiod 
1018*3d8817e4Smiod /* Subroutine of print_insn. Reads an insn into the given buffers and updates
1019*3d8817e4Smiod    the extract info.
1020*3d8817e4Smiod    Returns 0 if all is well, non-zero otherwise.  */
1021*3d8817e4Smiod 
1022*3d8817e4Smiod static int
read_insn(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,bfd_vma pc,disassemble_info * info,bfd_byte * buf,int buflen,CGEN_EXTRACT_INFO * ex_info,unsigned long * insn_value)1023*3d8817e4Smiod read_insn (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1024*3d8817e4Smiod 	   bfd_vma pc,
1025*3d8817e4Smiod 	   disassemble_info *info,
1026*3d8817e4Smiod 	   bfd_byte *buf,
1027*3d8817e4Smiod 	   int buflen,
1028*3d8817e4Smiod 	   CGEN_EXTRACT_INFO *ex_info,
1029*3d8817e4Smiod 	   unsigned long *insn_value)
1030*3d8817e4Smiod {
1031*3d8817e4Smiod   int status = (*info->read_memory_func) (pc, buf, buflen, info);
1032*3d8817e4Smiod 
1033*3d8817e4Smiod   if (status != 0)
1034*3d8817e4Smiod     {
1035*3d8817e4Smiod       (*info->memory_error_func) (status, pc, info);
1036*3d8817e4Smiod       return -1;
1037*3d8817e4Smiod     }
1038*3d8817e4Smiod 
1039*3d8817e4Smiod   ex_info->dis_info = info;
1040*3d8817e4Smiod   ex_info->valid = (1 << buflen) - 1;
1041*3d8817e4Smiod   ex_info->insn_bytes = buf;
1042*3d8817e4Smiod 
1043*3d8817e4Smiod   *insn_value = bfd_get_bits (buf, buflen * 8, info->endian == BFD_ENDIAN_BIG);
1044*3d8817e4Smiod   return 0;
1045*3d8817e4Smiod }
1046*3d8817e4Smiod 
1047*3d8817e4Smiod /* Utility to print an insn.
1048*3d8817e4Smiod    BUF is the base part of the insn, target byte order, BUFLEN bytes long.
1049*3d8817e4Smiod    The result is the size of the insn in bytes or zero for an unknown insn
1050*3d8817e4Smiod    or -1 if an error occurs fetching data (memory_error_func will have
1051*3d8817e4Smiod    been called).  */
1052*3d8817e4Smiod 
1053*3d8817e4Smiod static int
print_insn(CGEN_CPU_DESC cd,bfd_vma pc,disassemble_info * info,bfd_byte * buf,unsigned int buflen)1054*3d8817e4Smiod print_insn (CGEN_CPU_DESC cd,
1055*3d8817e4Smiod 	    bfd_vma pc,
1056*3d8817e4Smiod 	    disassemble_info *info,
1057*3d8817e4Smiod 	    bfd_byte *buf,
1058*3d8817e4Smiod 	    unsigned int buflen)
1059*3d8817e4Smiod {
1060*3d8817e4Smiod   CGEN_INSN_INT insn_value;
1061*3d8817e4Smiod   const CGEN_INSN_LIST *insn_list;
1062*3d8817e4Smiod   CGEN_EXTRACT_INFO ex_info;
1063*3d8817e4Smiod   int basesize;
1064*3d8817e4Smiod 
1065*3d8817e4Smiod   /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
1066*3d8817e4Smiod   basesize = cd->base_insn_bitsize < buflen * 8 ?
1067*3d8817e4Smiod                                      cd->base_insn_bitsize : buflen * 8;
1068*3d8817e4Smiod   insn_value = cgen_get_insn_value (cd, buf, basesize);
1069*3d8817e4Smiod 
1070*3d8817e4Smiod 
1071*3d8817e4Smiod   /* Fill in ex_info fields like read_insn would.  Don't actually call
1072*3d8817e4Smiod      read_insn, since the incoming buffer is already read (and possibly
1073*3d8817e4Smiod      modified a la m32r).  */
1074*3d8817e4Smiod   ex_info.valid = (1 << buflen) - 1;
1075*3d8817e4Smiod   ex_info.dis_info = info;
1076*3d8817e4Smiod   ex_info.insn_bytes = buf;
1077*3d8817e4Smiod 
1078*3d8817e4Smiod   /* The instructions are stored in hash lists.
1079*3d8817e4Smiod      Pick the first one and keep trying until we find the right one.  */
1080*3d8817e4Smiod 
1081*3d8817e4Smiod   insn_list = CGEN_DIS_LOOKUP_INSN (cd, (char *) buf, insn_value);
1082*3d8817e4Smiod   while (insn_list != NULL)
1083*3d8817e4Smiod     {
1084*3d8817e4Smiod       const CGEN_INSN *insn = insn_list->insn;
1085*3d8817e4Smiod       CGEN_FIELDS fields;
1086*3d8817e4Smiod       int length;
1087*3d8817e4Smiod       unsigned long insn_value_cropped;
1088*3d8817e4Smiod 
1089*3d8817e4Smiod #ifdef CGEN_VALIDATE_INSN_SUPPORTED
1090*3d8817e4Smiod       /* Not needed as insn shouldn't be in hash lists if not supported.  */
1091*3d8817e4Smiod       /* Supported by this cpu?  */
1092*3d8817e4Smiod       if (! m32c_cgen_insn_supported (cd, insn))
1093*3d8817e4Smiod         {
1094*3d8817e4Smiod           insn_list = CGEN_DIS_NEXT_INSN (insn_list);
1095*3d8817e4Smiod 	  continue;
1096*3d8817e4Smiod         }
1097*3d8817e4Smiod #endif
1098*3d8817e4Smiod 
1099*3d8817e4Smiod       /* Basic bit mask must be correct.  */
1100*3d8817e4Smiod       /* ??? May wish to allow target to defer this check until the extract
1101*3d8817e4Smiod 	 handler.  */
1102*3d8817e4Smiod 
1103*3d8817e4Smiod       /* Base size may exceed this instruction's size.  Extract the
1104*3d8817e4Smiod          relevant part from the buffer. */
1105*3d8817e4Smiod       if ((unsigned) (CGEN_INSN_BITSIZE (insn) / 8) < buflen &&
1106*3d8817e4Smiod 	  (unsigned) (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long))
1107*3d8817e4Smiod 	insn_value_cropped = bfd_get_bits (buf, CGEN_INSN_BITSIZE (insn),
1108*3d8817e4Smiod 					   info->endian == BFD_ENDIAN_BIG);
1109*3d8817e4Smiod       else
1110*3d8817e4Smiod 	insn_value_cropped = insn_value;
1111*3d8817e4Smiod 
1112*3d8817e4Smiod       if ((insn_value_cropped & CGEN_INSN_BASE_MASK (insn))
1113*3d8817e4Smiod 	  == CGEN_INSN_BASE_VALUE (insn))
1114*3d8817e4Smiod 	{
1115*3d8817e4Smiod 	  /* Printing is handled in two passes.  The first pass parses the
1116*3d8817e4Smiod 	     machine insn and extracts the fields.  The second pass prints
1117*3d8817e4Smiod 	     them.  */
1118*3d8817e4Smiod 
1119*3d8817e4Smiod 	  /* Make sure the entire insn is loaded into insn_value, if it
1120*3d8817e4Smiod 	     can fit.  */
1121*3d8817e4Smiod 	  if (((unsigned) CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize) &&
1122*3d8817e4Smiod 	      (unsigned) (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long))
1123*3d8817e4Smiod 	    {
1124*3d8817e4Smiod 	      unsigned long full_insn_value;
1125*3d8817e4Smiod 	      int rc = read_insn (cd, pc, info, buf,
1126*3d8817e4Smiod 				  CGEN_INSN_BITSIZE (insn) / 8,
1127*3d8817e4Smiod 				  & ex_info, & full_insn_value);
1128*3d8817e4Smiod 	      if (rc != 0)
1129*3d8817e4Smiod 		return rc;
1130*3d8817e4Smiod 	      length = CGEN_EXTRACT_FN (cd, insn)
1131*3d8817e4Smiod 		(cd, insn, &ex_info, full_insn_value, &fields, pc);
1132*3d8817e4Smiod 	    }
1133*3d8817e4Smiod 	  else
1134*3d8817e4Smiod 	    length = CGEN_EXTRACT_FN (cd, insn)
1135*3d8817e4Smiod 	      (cd, insn, &ex_info, insn_value_cropped, &fields, pc);
1136*3d8817e4Smiod 
1137*3d8817e4Smiod 	  /* Length < 0 -> error.  */
1138*3d8817e4Smiod 	  if (length < 0)
1139*3d8817e4Smiod 	    return length;
1140*3d8817e4Smiod 	  if (length > 0)
1141*3d8817e4Smiod 	    {
1142*3d8817e4Smiod 	      CGEN_PRINT_FN (cd, insn) (cd, info, insn, &fields, pc, length);
1143*3d8817e4Smiod 	      /* Length is in bits, result is in bytes.  */
1144*3d8817e4Smiod 	      return length / 8;
1145*3d8817e4Smiod 	    }
1146*3d8817e4Smiod 	}
1147*3d8817e4Smiod 
1148*3d8817e4Smiod       insn_list = CGEN_DIS_NEXT_INSN (insn_list);
1149*3d8817e4Smiod     }
1150*3d8817e4Smiod 
1151*3d8817e4Smiod   return 0;
1152*3d8817e4Smiod }
1153*3d8817e4Smiod 
1154*3d8817e4Smiod /* Default value for CGEN_PRINT_INSN.
1155*3d8817e4Smiod    The result is the size of the insn in bytes or zero for an unknown insn
1156*3d8817e4Smiod    or -1 if an error occured fetching bytes.  */
1157*3d8817e4Smiod 
1158*3d8817e4Smiod #ifndef CGEN_PRINT_INSN
1159*3d8817e4Smiod #define CGEN_PRINT_INSN default_print_insn
1160*3d8817e4Smiod #endif
1161*3d8817e4Smiod 
1162*3d8817e4Smiod static int
default_print_insn(CGEN_CPU_DESC cd,bfd_vma pc,disassemble_info * info)1163*3d8817e4Smiod default_print_insn (CGEN_CPU_DESC cd, bfd_vma pc, disassemble_info *info)
1164*3d8817e4Smiod {
1165*3d8817e4Smiod   bfd_byte buf[CGEN_MAX_INSN_SIZE];
1166*3d8817e4Smiod   int buflen;
1167*3d8817e4Smiod   int status;
1168*3d8817e4Smiod 
1169*3d8817e4Smiod   /* Attempt to read the base part of the insn.  */
1170*3d8817e4Smiod   buflen = cd->base_insn_bitsize / 8;
1171*3d8817e4Smiod   status = (*info->read_memory_func) (pc, buf, buflen, info);
1172*3d8817e4Smiod 
1173*3d8817e4Smiod   /* Try again with the minimum part, if min < base.  */
1174*3d8817e4Smiod   if (status != 0 && (cd->min_insn_bitsize < cd->base_insn_bitsize))
1175*3d8817e4Smiod     {
1176*3d8817e4Smiod       buflen = cd->min_insn_bitsize / 8;
1177*3d8817e4Smiod       status = (*info->read_memory_func) (pc, buf, buflen, info);
1178*3d8817e4Smiod     }
1179*3d8817e4Smiod 
1180*3d8817e4Smiod   if (status != 0)
1181*3d8817e4Smiod     {
1182*3d8817e4Smiod       (*info->memory_error_func) (status, pc, info);
1183*3d8817e4Smiod       return -1;
1184*3d8817e4Smiod     }
1185*3d8817e4Smiod 
1186*3d8817e4Smiod   return print_insn (cd, pc, info, buf, buflen);
1187*3d8817e4Smiod }
1188*3d8817e4Smiod 
1189*3d8817e4Smiod /* Main entry point.
1190*3d8817e4Smiod    Print one instruction from PC on INFO->STREAM.
1191*3d8817e4Smiod    Return the size of the instruction (in bytes).  */
1192*3d8817e4Smiod 
1193*3d8817e4Smiod typedef struct cpu_desc_list
1194*3d8817e4Smiod {
1195*3d8817e4Smiod   struct cpu_desc_list *next;
1196*3d8817e4Smiod   CGEN_BITSET *isa;
1197*3d8817e4Smiod   int mach;
1198*3d8817e4Smiod   int endian;
1199*3d8817e4Smiod   CGEN_CPU_DESC cd;
1200*3d8817e4Smiod } cpu_desc_list;
1201*3d8817e4Smiod 
1202*3d8817e4Smiod int
print_insn_m32c(bfd_vma pc,disassemble_info * info)1203*3d8817e4Smiod print_insn_m32c (bfd_vma pc, disassemble_info *info)
1204*3d8817e4Smiod {
1205*3d8817e4Smiod   static cpu_desc_list *cd_list = 0;
1206*3d8817e4Smiod   cpu_desc_list *cl = 0;
1207*3d8817e4Smiod   static CGEN_CPU_DESC cd = 0;
1208*3d8817e4Smiod   static CGEN_BITSET *prev_isa;
1209*3d8817e4Smiod   static int prev_mach;
1210*3d8817e4Smiod   static int prev_endian;
1211*3d8817e4Smiod   int length;
1212*3d8817e4Smiod   CGEN_BITSET *isa;
1213*3d8817e4Smiod   int mach;
1214*3d8817e4Smiod   int endian = (info->endian == BFD_ENDIAN_BIG
1215*3d8817e4Smiod 		? CGEN_ENDIAN_BIG
1216*3d8817e4Smiod 		: CGEN_ENDIAN_LITTLE);
1217*3d8817e4Smiod   enum bfd_architecture arch;
1218*3d8817e4Smiod 
1219*3d8817e4Smiod   /* ??? gdb will set mach but leave the architecture as "unknown" */
1220*3d8817e4Smiod #ifndef CGEN_BFD_ARCH
1221*3d8817e4Smiod #define CGEN_BFD_ARCH bfd_arch_m32c
1222*3d8817e4Smiod #endif
1223*3d8817e4Smiod   arch = info->arch;
1224*3d8817e4Smiod   if (arch == bfd_arch_unknown)
1225*3d8817e4Smiod     arch = CGEN_BFD_ARCH;
1226*3d8817e4Smiod 
1227*3d8817e4Smiod   /* There's no standard way to compute the machine or isa number
1228*3d8817e4Smiod      so we leave it to the target.  */
1229*3d8817e4Smiod #ifdef CGEN_COMPUTE_MACH
1230*3d8817e4Smiod   mach = CGEN_COMPUTE_MACH (info);
1231*3d8817e4Smiod #else
1232*3d8817e4Smiod   mach = info->mach;
1233*3d8817e4Smiod #endif
1234*3d8817e4Smiod 
1235*3d8817e4Smiod #ifdef CGEN_COMPUTE_ISA
1236*3d8817e4Smiod   {
1237*3d8817e4Smiod     static CGEN_BITSET *permanent_isa;
1238*3d8817e4Smiod 
1239*3d8817e4Smiod     if (!permanent_isa)
1240*3d8817e4Smiod       permanent_isa = cgen_bitset_create (MAX_ISAS);
1241*3d8817e4Smiod     isa = permanent_isa;
1242*3d8817e4Smiod     cgen_bitset_clear (isa);
1243*3d8817e4Smiod     cgen_bitset_add (isa, CGEN_COMPUTE_ISA (info));
1244*3d8817e4Smiod   }
1245*3d8817e4Smiod #else
1246*3d8817e4Smiod   isa = info->insn_sets;
1247*3d8817e4Smiod #endif
1248*3d8817e4Smiod 
1249*3d8817e4Smiod   /* If we've switched cpu's, try to find a handle we've used before */
1250*3d8817e4Smiod   if (cd
1251*3d8817e4Smiod       && (cgen_bitset_compare (isa, prev_isa) != 0
1252*3d8817e4Smiod 	  || mach != prev_mach
1253*3d8817e4Smiod 	  || endian != prev_endian))
1254*3d8817e4Smiod     {
1255*3d8817e4Smiod       cd = 0;
1256*3d8817e4Smiod       for (cl = cd_list; cl; cl = cl->next)
1257*3d8817e4Smiod 	{
1258*3d8817e4Smiod 	  if (cgen_bitset_compare (cl->isa, isa) == 0 &&
1259*3d8817e4Smiod 	      cl->mach == mach &&
1260*3d8817e4Smiod 	      cl->endian == endian)
1261*3d8817e4Smiod 	    {
1262*3d8817e4Smiod 	      cd = cl->cd;
1263*3d8817e4Smiod  	      prev_isa = cd->isas;
1264*3d8817e4Smiod 	      break;
1265*3d8817e4Smiod 	    }
1266*3d8817e4Smiod 	}
1267*3d8817e4Smiod     }
1268*3d8817e4Smiod 
1269*3d8817e4Smiod   /* If we haven't initialized yet, initialize the opcode table.  */
1270*3d8817e4Smiod   if (! cd)
1271*3d8817e4Smiod     {
1272*3d8817e4Smiod       const bfd_arch_info_type *arch_type = bfd_lookup_arch (arch, mach);
1273*3d8817e4Smiod       const char *mach_name;
1274*3d8817e4Smiod 
1275*3d8817e4Smiod       if (!arch_type)
1276*3d8817e4Smiod 	abort ();
1277*3d8817e4Smiod       mach_name = arch_type->printable_name;
1278*3d8817e4Smiod 
1279*3d8817e4Smiod       prev_isa = cgen_bitset_copy (isa);
1280*3d8817e4Smiod       prev_mach = mach;
1281*3d8817e4Smiod       prev_endian = endian;
1282*3d8817e4Smiod       cd = m32c_cgen_cpu_open (CGEN_CPU_OPEN_ISAS, prev_isa,
1283*3d8817e4Smiod 				 CGEN_CPU_OPEN_BFDMACH, mach_name,
1284*3d8817e4Smiod 				 CGEN_CPU_OPEN_ENDIAN, prev_endian,
1285*3d8817e4Smiod 				 CGEN_CPU_OPEN_END);
1286*3d8817e4Smiod       if (!cd)
1287*3d8817e4Smiod 	abort ();
1288*3d8817e4Smiod 
1289*3d8817e4Smiod       /* Save this away for future reference.  */
1290*3d8817e4Smiod       cl = xmalloc (sizeof (struct cpu_desc_list));
1291*3d8817e4Smiod       cl->cd = cd;
1292*3d8817e4Smiod       cl->isa = prev_isa;
1293*3d8817e4Smiod       cl->mach = mach;
1294*3d8817e4Smiod       cl->endian = endian;
1295*3d8817e4Smiod       cl->next = cd_list;
1296*3d8817e4Smiod       cd_list = cl;
1297*3d8817e4Smiod 
1298*3d8817e4Smiod       m32c_cgen_init_dis (cd);
1299*3d8817e4Smiod     }
1300*3d8817e4Smiod 
1301*3d8817e4Smiod   /* We try to have as much common code as possible.
1302*3d8817e4Smiod      But at this point some targets need to take over.  */
1303*3d8817e4Smiod   /* ??? Some targets may need a hook elsewhere.  Try to avoid this,
1304*3d8817e4Smiod      but if not possible try to move this hook elsewhere rather than
1305*3d8817e4Smiod      have two hooks.  */
1306*3d8817e4Smiod   length = CGEN_PRINT_INSN (cd, pc, info);
1307*3d8817e4Smiod   if (length > 0)
1308*3d8817e4Smiod     return length;
1309*3d8817e4Smiod   if (length < 0)
1310*3d8817e4Smiod     return -1;
1311*3d8817e4Smiod 
1312*3d8817e4Smiod   (*info->fprintf_func) (info->stream, UNKNOWN_INSN_MSG);
1313*3d8817e4Smiod   return cd->default_insn_bitsize / 8;
1314*3d8817e4Smiod }
1315