1 /* Disassembler code for Renesas RX.
2 Copyright 2008, 2009 Free Software Foundation, Inc.
3 Contributed by Red Hat.
6 This file is part of the GNU opcodes library.
8 This library is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 It is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 MA 02110-1301, USA. */
27 #include "opcode/rx.h"
32 disassemble_info
* dis
;
36 rx_get_byte (void * vdata
)
39 RX_Data
*rx_data
= (RX_Data
*) vdata
;
41 rx_data
->dis
->read_memory_func (rx_data
->pc
,
50 static char const * size_names
[] =
52 "", ".b", ".ub", ".b", ".w", ".uw", ".w", ".a", ".l"
55 static char const * opsize_names
[] =
57 "", ".b", ".b", ".b", ".w", ".w", ".w", ".a", ".l"
60 static char const * register_names
[] =
62 /* general registers */
63 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
64 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
65 /* control register */
66 "psw", "pc", "usp", "fpsw", "", "", "", "wr",
67 "bpsw", "bpc", "isp", "fintv", "intb", "", "", "",
68 "pbp", "pben", "", "", "", "", "", "",
69 "bbpsw", "bbpc", "", "", "", "", "", ""
72 static char const * condition_names
[] =
75 "eq", "ne", "c", "nc", "gtu", "leu", "pz", "n",
76 "ge", "lt", "gt", "le", "o", "no", "always", "never"
79 static const char * flag_names
[] =
81 "c", "z", "s", "o", "", "", "", "",
82 "", "", "", "", "", "", "", "",
83 "i", "u", "", "", "", "", "", ""
84 "", "", "", "", "", "", "", "",
88 print_insn_rx (bfd_vma addr
, disassemble_info
* dis
)
92 RX_Opcode_Decoded opcode
;
98 rv
= rx_decode_opcode (addr
, &opcode
, rx_get_byte
, &rx_data
);
100 dis
->bytes_per_line
= 10;
102 #define PR (dis->fprintf_func)
103 #define PS (dis->stream)
104 #define PC(c) PR (PS, "%c", c)
106 for (s
= opcode
.syntax
; *s
; s
++)
114 RX_Opcode_Operand
* oper
;
144 PR (PS
, "%s", opsize_names
[opcode
.size
]);
150 oper
= opcode
.op
+ *s
- '0';
153 if (oper
->type
== RX_Operand_Indirect
)
154 PR (PS
, "%s", size_names
[oper
->size
]);
159 case RX_Operand_Immediate
:
161 dis
->print_address_func (oper
->addend
, dis
);
163 || oper
->addend
> 999
164 || oper
->addend
< -999)
165 PR (PS
, "%#x", oper
->addend
);
167 PR (PS
, "%d", oper
->addend
);
169 case RX_Operand_Register
:
170 PR (PS
, "%s", register_names
[oper
->reg
]);
172 case RX_Operand_Indirect
:
174 PR (PS
, "%d[%s]", oper
->addend
, register_names
[oper
->reg
]);
176 PR (PS
, "[%s]", register_names
[oper
->reg
]);
178 case RX_Operand_Postinc
:
179 PR (PS
, "[%s+]", register_names
[oper
->reg
]);
181 case RX_Operand_Predec
:
182 PR (PS
, "[-%s]", register_names
[oper
->reg
]);
184 case RX_Operand_Condition
:
185 PR (PS
, "%s", condition_names
[oper
->reg
]);
187 case RX_Operand_Flag
:
188 PR (PS
, "%s", flag_names
[oper
->reg
]);
This page took 0.034143 seconds and 4 git commands to generate.