* frv.cpu: Add IDOC attribute.
[binutils.git] / opcodes / disassemble.c
blob2d1358eb172107f733e9229018da24a3003864f3
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_m68hc11
45 #define ARCH_m68hc12
46 #define ARCH_m88k
47 #define ARCH_mcore
48 #define ARCH_mips
49 #define ARCH_mmix
50 #define ARCH_mn10200
51 #define ARCH_mn10300
52 #define ARCH_msp430
53 #define ARCH_ns32k
54 #define ARCH_openrisc
55 #define ARCH_or32
56 #define ARCH_pdp11
57 #define ARCH_pj
58 #define ARCH_powerpc
59 #define ARCH_rs6000
60 #define ARCH_s390
61 #define ARCH_sh
62 #define ARCH_sparc
63 #define ARCH_tic30
64 #define ARCH_tic4x
65 #define ARCH_tic54x
66 #define ARCH_tic80
67 #define ARCH_v850
68 #define ARCH_vax
69 #define ARCH_w65
70 #define ARCH_xstormy16
71 #define ARCH_xtensa
72 #define ARCH_z8k
73 #define ARCH_frv
74 #define ARCH_iq2000
75 #define INCLUDE_SHMEDIA
76 #endif
79 disassembler_ftype
80 disassembler (abfd)
81 bfd *abfd;
83 enum bfd_architecture a = bfd_get_arch (abfd);
84 disassembler_ftype disassemble;
86 switch (a)
88 /* If you add a case to this table, also add it to the
89 ARCH_all definition right above this function. */
90 #ifdef ARCH_a29k
91 case bfd_arch_a29k:
92 /* As far as I know we only handle big-endian 29k objects. */
93 disassemble = print_insn_big_a29k;
94 break;
95 #endif
96 #ifdef ARCH_alpha
97 case bfd_arch_alpha:
98 disassemble = print_insn_alpha;
99 break;
100 #endif
101 #ifdef ARCH_arc
102 case bfd_arch_arc:
104 disassemble = arc_get_disassembler (abfd);
105 break;
107 #endif
108 #ifdef ARCH_arm
109 case bfd_arch_arm:
110 if (bfd_big_endian (abfd))
111 disassemble = print_insn_big_arm;
112 else
113 disassemble = print_insn_little_arm;
114 break;
115 #endif
116 #ifdef ARCH_avr
117 case bfd_arch_avr:
118 disassemble = print_insn_avr;
119 break;
120 #endif
121 #ifdef ARCH_cris
122 case bfd_arch_cris:
123 disassemble = cris_get_disassembler (abfd);
124 break;
125 #endif
126 #ifdef ARCH_d10v
127 case bfd_arch_d10v:
128 disassemble = print_insn_d10v;
129 break;
130 #endif
131 #ifdef ARCH_d30v
132 case bfd_arch_d30v:
133 disassemble = print_insn_d30v;
134 break;
135 #endif
136 #ifdef ARCH_dlx
137 case bfd_arch_dlx:
138 /* As far as I know we only handle big-endian DLX objects. */
139 disassemble = print_insn_dlx;
140 break;
141 #endif
142 #ifdef ARCH_h8300
143 case bfd_arch_h8300:
144 if (bfd_get_mach (abfd) == bfd_mach_h8300h
145 || bfd_get_mach (abfd) == bfd_mach_h8300hn)
146 disassemble = print_insn_h8300h;
147 else if (bfd_get_mach (abfd) == bfd_mach_h8300s
148 || bfd_get_mach (abfd) == bfd_mach_h8300sn)
149 disassemble = print_insn_h8300s;
150 else
151 disassemble = print_insn_h8300;
152 break;
153 #endif
154 #ifdef ARCH_h8500
155 case bfd_arch_h8500:
156 disassemble = print_insn_h8500;
157 break;
158 #endif
159 #ifdef ARCH_hppa
160 case bfd_arch_hppa:
161 disassemble = print_insn_hppa;
162 break;
163 #endif
164 #ifdef ARCH_i370
165 case bfd_arch_i370:
166 disassemble = print_insn_i370;
167 break;
168 #endif
169 #ifdef ARCH_i386
170 case bfd_arch_i386:
171 disassemble = print_insn_i386;
172 break;
173 #endif
174 #ifdef ARCH_i860
175 case bfd_arch_i860:
176 disassemble = print_insn_i860;
177 break;
178 #endif
179 #ifdef ARCH_i960
180 case bfd_arch_i960:
181 disassemble = print_insn_i960;
182 break;
183 #endif
184 #ifdef ARCH_ia64
185 case bfd_arch_ia64:
186 disassemble = print_insn_ia64;
187 break;
188 #endif
189 #ifdef ARCH_ip2k
190 case bfd_arch_ip2k:
191 disassemble = print_insn_ip2k;
192 break;
193 #endif
194 #ifdef ARCH_fr30
195 case bfd_arch_fr30:
196 disassemble = print_insn_fr30;
197 break;
198 #endif
199 #ifdef ARCH_m32r
200 case bfd_arch_m32r:
201 disassemble = print_insn_m32r;
202 break;
203 #endif
204 #if defined(ARCH_m68hc11) || defined(ARCH_m68hc12)
205 case bfd_arch_m68hc11:
206 disassemble = print_insn_m68hc11;
207 break;
208 case bfd_arch_m68hc12:
209 disassemble = print_insn_m68hc12;
210 break;
211 #endif
212 #ifdef ARCH_m68k
213 case bfd_arch_m68k:
214 disassemble = print_insn_m68k;
215 break;
216 #endif
217 #ifdef ARCH_m88k
218 case bfd_arch_m88k:
219 disassemble = print_insn_m88k;
220 break;
221 #endif
222 #ifdef ARCH_msp430
223 case bfd_arch_msp430:
224 disassemble = print_insn_msp430;
225 break;
226 #endif
227 #ifdef ARCH_ns32k
228 case bfd_arch_ns32k:
229 disassemble = print_insn_ns32k;
230 break;
231 #endif
232 #ifdef ARCH_mcore
233 case bfd_arch_mcore:
234 disassemble = print_insn_mcore;
235 break;
236 #endif
237 #ifdef ARCH_mips
238 case bfd_arch_mips:
239 if (bfd_big_endian (abfd))
240 disassemble = print_insn_big_mips;
241 else
242 disassemble = print_insn_little_mips;
243 break;
244 #endif
245 #ifdef ARCH_mmix
246 case bfd_arch_mmix:
247 disassemble = print_insn_mmix;
248 break;
249 #endif
250 #ifdef ARCH_mn10200
251 case bfd_arch_mn10200:
252 disassemble = print_insn_mn10200;
253 break;
254 #endif
255 #ifdef ARCH_mn10300
256 case bfd_arch_mn10300:
257 disassemble = print_insn_mn10300;
258 break;
259 #endif
260 #ifdef ARCH_openrisc
261 case bfd_arch_openrisc:
262 disassemble = print_insn_openrisc;
263 break;
264 #endif
265 #ifdef ARCH_or32
266 case bfd_arch_or32:
267 if (bfd_big_endian (abfd))
268 disassemble = print_insn_big_or32;
269 else
270 disassemble = print_insn_little_or32;
271 break;
272 #endif
273 #ifdef ARCH_pdp11
274 case bfd_arch_pdp11:
275 disassemble = print_insn_pdp11;
276 break;
277 #endif
278 #ifdef ARCH_pj
279 case bfd_arch_pj:
280 disassemble = print_insn_pj;
281 break;
282 #endif
283 #ifdef ARCH_powerpc
284 case bfd_arch_powerpc:
285 if (bfd_big_endian (abfd))
286 disassemble = print_insn_big_powerpc;
287 else
288 disassemble = print_insn_little_powerpc;
289 break;
290 #endif
291 #ifdef ARCH_rs6000
292 case bfd_arch_rs6000:
293 if (bfd_get_mach (abfd) == bfd_mach_ppc_620)
294 disassemble = print_insn_big_powerpc;
295 else
296 disassemble = print_insn_rs6000;
297 break;
298 #endif
299 #ifdef ARCH_s390
300 case bfd_arch_s390:
301 disassemble = print_insn_s390;
302 break;
303 #endif
304 #ifdef ARCH_sh
305 case bfd_arch_sh:
306 disassemble = print_insn_sh;
307 break;
308 #endif
309 #ifdef ARCH_sparc
310 case bfd_arch_sparc:
311 disassemble = print_insn_sparc;
312 break;
313 #endif
314 #ifdef ARCH_tic30
315 case bfd_arch_tic30:
316 disassemble = print_insn_tic30;
317 break;
318 #endif
319 #ifdef ARCH_tic4x
320 case bfd_arch_tic4x:
321 disassemble = print_insn_tic4x;
322 break;
323 #endif
324 #ifdef ARCH_tic54x
325 case bfd_arch_tic54x:
326 disassemble = print_insn_tic54x;
327 break;
328 #endif
329 #ifdef ARCH_tic80
330 case bfd_arch_tic80:
331 disassemble = print_insn_tic80;
332 break;
333 #endif
334 #ifdef ARCH_v850
335 case bfd_arch_v850:
336 disassemble = print_insn_v850;
337 break;
338 #endif
339 #ifdef ARCH_w65
340 case bfd_arch_w65:
341 disassemble = print_insn_w65;
342 break;
343 #endif
344 #ifdef ARCH_xstormy16
345 case bfd_arch_xstormy16:
346 disassemble = print_insn_xstormy16;
347 break;
348 #endif
349 #ifdef ARCH_xtensa
350 case bfd_arch_xtensa:
351 disassemble = print_insn_xtensa;
352 break;
353 #endif
354 #ifdef ARCH_z8k
355 case bfd_arch_z8k:
356 if (bfd_get_mach(abfd) == bfd_mach_z8001)
357 disassemble = print_insn_z8001;
358 else
359 disassemble = print_insn_z8002;
360 break;
361 #endif
362 #ifdef ARCH_vax
363 case bfd_arch_vax:
364 disassemble = print_insn_vax;
365 break;
366 #endif
367 #ifdef ARCH_frv
368 case bfd_arch_frv:
369 disassemble = print_insn_frv;
370 break;
371 #endif
372 #ifdef ARCH_iq2000
373 case bfd_arch_iq2000:
374 disassemble = print_insn_iq2000;
375 break;
376 #endif
377 default:
378 return 0;
380 return disassemble;
383 void
384 disassembler_usage (stream)
385 FILE * stream ATTRIBUTE_UNUSED;
387 #ifdef ARCH_arm
388 print_arm_disassembler_options (stream);
389 #endif
390 #ifdef ARCH_mips
391 print_mips_disassembler_options (stream);
392 #endif
393 #ifdef ARCH_powerpc
394 print_ppc_disassembler_options (stream);
395 #endif
397 return;