fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / binutils / opcodes / disassemble.c
blobfb5d082c9899d77636845da82353b0f159eda33e
1 /* Select disassembly routine for specified architecture.
2 Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19 #include "sysdep.h"
20 #include "dis-asm.h"
22 #ifdef ARCH_all
23 #define ARCH_a29k
24 #define ARCH_alpha
25 #define ARCH_arc
26 #define ARCH_arm
27 #define ARCH_avr
28 #define ARCH_cris
29 #define ARCH_d10v
30 #define ARCH_d30v
31 #define ARCH_dlx
32 #define ARCH_h8300
33 #define ARCH_h8500
34 #define ARCH_hppa
35 #define ARCH_i370
36 #define ARCH_i386
37 #define ARCH_i860
38 #define ARCH_i960
39 #define ARCH_ip2k
40 #define ARCH_ia64
41 #define ARCH_fr30
42 #define ARCH_m32r
43 #define ARCH_m68k
44 #define ARCH_zpu
45 #define ARCH_m68hc11
46 #define ARCH_m68hc12
47 #define ARCH_m88k
48 #define ARCH_mcore
49 #define ARCH_mips
50 #define ARCH_mmix
51 #define ARCH_mn10200
52 #define ARCH_mn10300
53 #define ARCH_msp430
54 #define ARCH_ns32k
55 #define ARCH_openrisc
56 #define ARCH_or32
57 #define ARCH_pdp11
58 #define ARCH_pj
59 #define ARCH_powerpc
60 #define ARCH_rs6000
61 #define ARCH_s390
62 #define ARCH_sh
63 #define ARCH_sparc
64 #define ARCH_tic30
65 #define ARCH_tic4x
66 #define ARCH_tic54x
67 #define ARCH_tic80
68 #define ARCH_v850
69 #define ARCH_vax
70 #define ARCH_w65
71 #define ARCH_xstormy16
72 #define ARCH_xtensa
73 #define ARCH_z8k
74 #define ARCH_frv
75 #define ARCH_iq2000
76 #define INCLUDE_SHMEDIA
77 #endif
80 disassembler_ftype
81 disassembler (abfd)
82 bfd *abfd;
84 enum bfd_architecture a = bfd_get_arch (abfd);
85 disassembler_ftype disassemble;
87 switch (a)
89 /* If you add a case to this table, also add it to the
90 ARCH_all definition right above this function. */
91 #ifdef ARCH_a29k
92 case bfd_arch_a29k:
93 /* As far as I know we only handle big-endian 29k objects. */
94 disassemble = print_insn_big_a29k;
95 break;
96 #endif
97 #ifdef ARCH_alpha
98 case bfd_arch_alpha:
99 disassemble = print_insn_alpha;
100 break;
101 #endif
102 #ifdef ARCH_arc
103 case bfd_arch_arc:
105 disassemble = arc_get_disassembler (abfd);
106 break;
108 #endif
109 #ifdef ARCH_arm
110 case bfd_arch_arm:
111 if (bfd_big_endian (abfd))
112 disassemble = print_insn_big_arm;
113 else
114 disassemble = print_insn_little_arm;
115 break;
116 #endif
117 #ifdef ARCH_avr
118 case bfd_arch_avr:
119 disassemble = print_insn_avr;
120 break;
121 #endif
122 #ifdef ARCH_cris
123 case bfd_arch_cris:
124 disassemble = cris_get_disassembler (abfd);
125 break;
126 #endif
127 #ifdef ARCH_d10v
128 case bfd_arch_d10v:
129 disassemble = print_insn_d10v;
130 break;
131 #endif
132 #ifdef ARCH_d30v
133 case bfd_arch_d30v:
134 disassemble = print_insn_d30v;
135 break;
136 #endif
137 #ifdef ARCH_dlx
138 case bfd_arch_dlx:
139 /* As far as I know we only handle big-endian DLX objects. */
140 disassemble = print_insn_dlx;
141 break;
142 #endif
143 #ifdef ARCH_h8300
144 case bfd_arch_h8300:
145 if (bfd_get_mach (abfd) == bfd_mach_h8300h
146 || bfd_get_mach (abfd) == bfd_mach_h8300hn)
147 disassemble = print_insn_h8300h;
148 else if (bfd_get_mach (abfd) == bfd_mach_h8300s
149 || bfd_get_mach (abfd) == bfd_mach_h8300sn
150 || bfd_get_mach (abfd) == bfd_mach_h8300sx)
151 disassemble = print_insn_h8300s;
152 else
153 disassemble = print_insn_h8300;
154 break;
155 #endif
156 #ifdef ARCH_h8500
157 case bfd_arch_h8500:
158 disassemble = print_insn_h8500;
159 break;
160 #endif
161 #ifdef ARCH_hppa
162 case bfd_arch_hppa:
163 disassemble = print_insn_hppa;
164 break;
165 #endif
166 #ifdef ARCH_i370
167 case bfd_arch_i370:
168 disassemble = print_insn_i370;
169 break;
170 #endif
171 #ifdef ARCH_i386
172 case bfd_arch_i386:
173 disassemble = print_insn_i386;
174 break;
175 #endif
176 #ifdef ARCH_i860
177 case bfd_arch_i860:
178 disassemble = print_insn_i860;
179 break;
180 #endif
181 #ifdef ARCH_i960
182 case bfd_arch_i960:
183 disassemble = print_insn_i960;
184 break;
185 #endif
186 #ifdef ARCH_ia64
187 case bfd_arch_ia64:
188 disassemble = print_insn_ia64;
189 break;
190 #endif
191 #ifdef ARCH_ip2k
192 case bfd_arch_ip2k:
193 disassemble = print_insn_ip2k;
194 break;
195 #endif
196 #ifdef ARCH_fr30
197 case bfd_arch_fr30:
198 disassemble = print_insn_fr30;
199 break;
200 #endif
201 #ifdef ARCH_m32r
202 case bfd_arch_m32r:
203 disassemble = print_insn_m32r;
204 break;
205 #endif
206 #if defined(ARCH_m68hc11) || defined(ARCH_m68hc12)
207 case bfd_arch_m68hc11:
208 disassemble = print_insn_m68hc11;
209 break;
210 case bfd_arch_m68hc12:
211 disassemble = print_insn_m68hc12;
212 break;
213 #endif
214 #if defined(ARCH_zpu)
215 case bfd_arch_zpu:
216 disassemble = print_insn_zpu;
217 break;
218 #endif
219 #ifdef ARCH_m68k
220 case bfd_arch_m68k:
221 disassemble = print_insn_m68k;
222 break;
223 #endif
224 #ifdef ARCH_m88k
225 case bfd_arch_m88k:
226 disassemble = print_insn_m88k;
227 break;
228 #endif
229 #ifdef ARCH_msp430
230 case bfd_arch_msp430:
231 disassemble = print_insn_msp430;
232 break;
233 #endif
234 #ifdef ARCH_ns32k
235 case bfd_arch_ns32k:
236 disassemble = print_insn_ns32k;
237 break;
238 #endif
239 #ifdef ARCH_mcore
240 case bfd_arch_mcore:
241 disassemble = print_insn_mcore;
242 break;
243 #endif
244 #ifdef ARCH_mips
245 case bfd_arch_mips:
246 if (bfd_big_endian (abfd))
247 disassemble = print_insn_big_mips;
248 else
249 disassemble = print_insn_little_mips;
250 break;
251 #endif
252 #ifdef ARCH_mmix
253 case bfd_arch_mmix:
254 disassemble = print_insn_mmix;
255 break;
256 #endif
257 #ifdef ARCH_mn10200
258 case bfd_arch_mn10200:
259 disassemble = print_insn_mn10200;
260 break;
261 #endif
262 #ifdef ARCH_mn10300
263 case bfd_arch_mn10300:
264 disassemble = print_insn_mn10300;
265 break;
266 #endif
267 #ifdef ARCH_openrisc
268 case bfd_arch_openrisc:
269 disassemble = print_insn_openrisc;
270 break;
271 #endif
272 #ifdef ARCH_or32
273 case bfd_arch_or32:
274 if (bfd_big_endian (abfd))
275 disassemble = print_insn_big_or32;
276 else
277 disassemble = print_insn_little_or32;
278 break;
279 #endif
280 #ifdef ARCH_pdp11
281 case bfd_arch_pdp11:
282 disassemble = print_insn_pdp11;
283 break;
284 #endif
285 #ifdef ARCH_pj
286 case bfd_arch_pj:
287 disassemble = print_insn_pj;
288 break;
289 #endif
290 #ifdef ARCH_powerpc
291 case bfd_arch_powerpc:
292 if (bfd_big_endian (abfd))
293 disassemble = print_insn_big_powerpc;
294 else
295 disassemble = print_insn_little_powerpc;
296 break;
297 #endif
298 #ifdef ARCH_rs6000
299 case bfd_arch_rs6000:
300 if (bfd_get_mach (abfd) == bfd_mach_ppc_620)
301 disassemble = print_insn_big_powerpc;
302 else
303 disassemble = print_insn_rs6000;
304 break;
305 #endif
306 #ifdef ARCH_s390
307 case bfd_arch_s390:
308 disassemble = print_insn_s390;
309 break;
310 #endif
311 #ifdef ARCH_sh
312 case bfd_arch_sh:
313 disassemble = print_insn_sh;
314 break;
315 #endif
316 #ifdef ARCH_sparc
317 case bfd_arch_sparc:
318 disassemble = print_insn_sparc;
319 break;
320 #endif
321 #ifdef ARCH_tic30
322 case bfd_arch_tic30:
323 disassemble = print_insn_tic30;
324 break;
325 #endif
326 #ifdef ARCH_tic4x
327 case bfd_arch_tic4x:
328 disassemble = print_insn_tic4x;
329 break;
330 #endif
331 #ifdef ARCH_tic54x
332 case bfd_arch_tic54x:
333 disassemble = print_insn_tic54x;
334 break;
335 #endif
336 #ifdef ARCH_tic80
337 case bfd_arch_tic80:
338 disassemble = print_insn_tic80;
339 break;
340 #endif
341 #ifdef ARCH_v850
342 case bfd_arch_v850:
343 disassemble = print_insn_v850;
344 break;
345 #endif
346 #ifdef ARCH_w65
347 case bfd_arch_w65:
348 disassemble = print_insn_w65;
349 break;
350 #endif
351 #ifdef ARCH_xstormy16
352 case bfd_arch_xstormy16:
353 disassemble = print_insn_xstormy16;
354 break;
355 #endif
356 #ifdef ARCH_xtensa
357 case bfd_arch_xtensa:
358 disassemble = print_insn_xtensa;
359 break;
360 #endif
361 #ifdef ARCH_z8k
362 case bfd_arch_z8k:
363 if (bfd_get_mach(abfd) == bfd_mach_z8001)
364 disassemble = print_insn_z8001;
365 else
366 disassemble = print_insn_z8002;
367 break;
368 #endif
369 #ifdef ARCH_vax
370 case bfd_arch_vax:
371 disassemble = print_insn_vax;
372 break;
373 #endif
374 #ifdef ARCH_frv
375 case bfd_arch_frv:
376 disassemble = print_insn_frv;
377 break;
378 #endif
379 #ifdef ARCH_iq2000
380 case bfd_arch_iq2000:
381 disassemble = print_insn_iq2000;
382 break;
383 #endif
384 default:
385 return 0;
387 return disassemble;
390 void
391 disassembler_usage (stream)
392 FILE * stream ATTRIBUTE_UNUSED;
394 #ifdef ARCH_arm
395 print_arm_disassembler_options (stream);
396 #endif
397 #ifdef ARCH_mips
398 print_mips_disassembler_options (stream);
399 #endif
400 #ifdef ARCH_powerpc
401 print_ppc_disassembler_options (stream);
402 #endif
404 return;
407 void
408 disassemble_init_for_target (struct disassemble_info * info)
410 if (info == NULL)
411 return;
413 switch (info->arch)
415 #ifdef ARCH_arm
416 case bfd_arch_arm:
417 info->symbol_is_valid = arm_symbol_is_valid;
418 break;
419 #endif
420 default:
421 break;