* mn10x00-opc.c, mn10x00-dis.c: New files for Matsushita
[external/binutils.git] / opcodes / disassemble.c
1 /* Select disassembly routine for specified architecture.
2    Copyright (C) 1994, 1995 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
17
18 #include "ansidecl.h"
19 #include "dis-asm.h"
20
21 #ifdef ARCH_all
22 #define ARCH_a29k
23 #define ARCH_alpha
24 /* start-sanitize-arc */
25 #define ARCH_arc
26 /* end-sanitize-arc */
27 #define ARCH_arm
28 /* start-sanitize-d10v */
29 #define ARCH_d10v
30 /* end-sanitize-d10v */
31 /* start-sanitize-v850 */
32 #define ARCH_v850
33 /* end-sanitize-v850 */
34 #define ARCH_h8300
35 #define ARCH_h8500
36 #define ARCH_hppa
37 #define ARCH_i386
38 #define ARCH_i960
39 #define ARCH_m68k
40 #define ARCH_m88k
41 #define ARCH_mips
42 #define ARCH_mn10x00
43 #define ARCH_ns32k
44 #define ARCH_powerpc
45 #define ARCH_rs6000
46 #define ARCH_sh
47 #define ARCH_sparc
48 #define ARCH_w65
49 #define ARCH_z8k
50 #endif
51
52 disassembler_ftype
53 disassembler (abfd)
54      bfd *abfd;
55 {
56   enum bfd_architecture a = bfd_get_arch (abfd);
57   disassembler_ftype disassemble;
58
59   switch (a)
60     {
61       /* If you add a case to this table, also add it to the
62          ARCH_all definition right above this function.  */
63 #ifdef ARCH_a29k
64     case bfd_arch_a29k:
65       /* As far as I know we only handle big-endian 29k objects.  */
66       disassemble = print_insn_big_a29k;
67       break;
68 #endif
69 #ifdef ARCH_alpha
70     case bfd_arch_alpha:
71       disassemble = print_insn_alpha;
72       break;
73 #endif
74 /* start-sanitize-arc */
75 #ifdef ARCH_arc
76     case bfd_arch_arc:
77       {
78         disassemble = arc_get_disassembler (bfd_get_mach (abfd),
79                                             bfd_big_endian (abfd));
80         break;
81       }
82 #endif
83 /* end-sanitize-arc */
84 #ifdef ARCH_arm
85     case bfd_arch_arm:
86       if (bfd_big_endian (abfd))
87         disassemble = print_insn_big_arm;
88       else
89         disassemble = print_insn_little_arm;
90       break;
91 #endif
92 /* start-sanitize-d10v */
93 #ifdef ARCH_d10v
94     case bfd_arch_d10v:
95       disassemble = print_insn_d10v;
96       break;
97 #endif
98 /* end-sanitize-d10v */
99 #ifdef ARCH_h8300
100     case bfd_arch_h8300:
101       if (bfd_get_mach(abfd) == bfd_mach_h8300h)
102         disassemble = print_insn_h8300h;
103       else if (bfd_get_mach(abfd) == bfd_mach_h8300s)
104         disassemble = print_insn_h8300s;
105       else 
106         disassemble = print_insn_h8300;
107       break;
108 #endif
109 #ifdef ARCH_h8500
110     case bfd_arch_h8500:
111       disassemble = print_insn_h8500;
112       break;
113 #endif
114 #ifdef ARCH_hppa
115     case bfd_arch_hppa:
116       disassemble = print_insn_hppa;
117       break;
118 #endif
119 #ifdef ARCH_i386
120     case bfd_arch_i386:
121       disassemble = print_insn_i386;
122       break;
123 #endif
124 #ifdef ARCH_i960
125     case bfd_arch_i960:
126       disassemble = print_insn_i960;
127       break;
128 #endif
129 #ifdef ARCH_m68k
130     case bfd_arch_m68k:
131       disassemble = print_insn_m68k;
132       break;
133 #endif
134 #ifdef ARCH_m88k
135     case bfd_arch_m88k:
136       disassemble = print_insn_m88k;
137       break;
138 #endif
139 #ifdef ARCH_ns32k
140     case bfd_arch_ns32k:
141       disassemble = print_insn_ns32k;
142       break;
143 #endif
144 #ifdef ARCH_mips
145     case bfd_arch_mips:
146       if (bfd_big_endian (abfd))
147         disassemble = print_insn_big_mips;
148       else
149         disassemble = print_insn_little_mips;
150       break;
151 #endif
152 #ifdef ARCH_mn10x00
153     case bfd_arch_mn10x00:
154       disassemble = print_insn_mn10x00;
155       break;
156 #endif
157 #ifdef ARCH_powerpc
158     case bfd_arch_powerpc:
159       if (bfd_big_endian (abfd))
160         disassemble = print_insn_big_powerpc;
161       else
162         disassemble = print_insn_little_powerpc;
163       break;
164 #endif
165 #ifdef ARCH_rs6000
166     case bfd_arch_rs6000:
167       disassemble = print_insn_rs6000;
168       break;
169 #endif
170 #ifdef ARCH_sh
171     case bfd_arch_sh:
172       if (bfd_big_endian (abfd))
173         disassemble = print_insn_sh;
174       else
175         disassemble = print_insn_shl;
176       break;
177 #endif
178 #ifdef ARCH_sparc
179     case bfd_arch_sparc:
180       disassemble = print_insn_sparc;
181       break;
182 #endif
183 /* start-sanitize-v850 */
184 #ifdef ARCH_v850
185     case bfd_arch_v850:
186       disassemble = print_insn_v850;
187       break;
188 #endif
189 /* end-sanitize-v850 */
190 #ifdef ARCH_w65
191     case bfd_arch_w65:
192       disassemble = print_insn_w65;
193       break;
194 #endif
195 #ifdef ARCH_z8k
196     case bfd_arch_z8k:
197       if (bfd_get_mach(abfd) == bfd_mach_z8001)
198         disassemble = print_insn_z8001;
199       else 
200         disassemble = print_insn_z8002;
201       break;
202 #endif
203     default:
204       return 0;
205     }
206   return disassemble;
207 }