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