1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#ifndef TARGET_CRIS_OPCODE_CRIS_H
23#define TARGET_CRIS_OPCODE_CRIS_H
24
25#if !defined(__STDC__) && !defined(const)
26#define const
27#endif
28
29
30
31#define MAX_REG (15)
32#define CRIS_REG_SP (14)
33#define CRIS_REG_PC (15)
34
35
36
37
38enum cris_insn_version_usage
39{
40
41 cris_ver_version_all=0,
42
43
44 cris_ver_warning,
45
46
47 cris_ver_v0_3,
48
49
50 cris_ver_v3p,
51
52
53 cris_ver_v8,
54
55
56 cris_ver_v8p,
57
58
59 cris_ver_sim_v0_10,
60
61
62 cris_ver_v0_10,
63
64
65 cris_ver_v3_10,
66
67
68 cris_ver_v8_10,
69
70
71 cris_ver_v10,
72
73
74 cris_ver_v10p,
75
76
77
78
79 cris_ver_v32p
80};
81
82
83
84struct cris_spec_reg
85{
86 const char *const name;
87 unsigned int number;
88
89
90 unsigned int reg_size;
91
92
93
94 enum cris_insn_version_usage applicable_version;
95
96
97
98 const char *const warning;
99};
100extern const struct cris_spec_reg cris_spec_regs[];
101
102
103
104struct cris_support_reg
105{
106 const char *const name;
107 unsigned int number;
108};
109extern const struct cris_support_reg cris_support_regs[];
110
111
112#define AUTOINCR_BIT (0x04)
113
114
115#define BDAP_QUICK_OPCODE (0x0100)
116#define BDAP_QUICK_Z_BITS (0x0e00)
117
118#define BIAP_OPCODE (0x0540)
119#define BIAP_Z_BITS (0x0a80)
120
121#define DIP_OPCODE (0x0970)
122#define DIP_Z_BITS (0xf280)
123
124#define BDAP_INDIR_LOW (0x40)
125#define BDAP_INDIR_LOW_Z (0x80)
126#define BDAP_INDIR_HIGH (0x09)
127#define BDAP_INDIR_HIGH_Z (0x02)
128
129#define BDAP_INDIR_OPCODE (BDAP_INDIR_HIGH * 0x0100 + BDAP_INDIR_LOW)
130#define BDAP_INDIR_Z_BITS (BDAP_INDIR_HIGH_Z * 0x100 + BDAP_INDIR_LOW_Z)
131#define BDAP_PC_LOW (BDAP_INDIR_LOW + CRIS_REG_PC)
132#define BDAP_INCR_HIGH (BDAP_INDIR_HIGH + AUTOINCR_BIT)
133
134
135
136#define NO_CRIS_PREFIX 0
137
138
139#define CC_CC 0x0
140#define CC_HS 0x0
141#define CC_CS 0x1
142#define CC_LO 0x1
143#define CC_NE 0x2
144#define CC_EQ 0x3
145#define CC_VC 0x4
146#define CC_VS 0x5
147#define CC_PL 0x6
148#define CC_MI 0x7
149#define CC_LS 0x8
150#define CC_HI 0x9
151#define CC_GE 0xA
152#define CC_LT 0xB
153#define CC_GT 0xC
154#define CC_LE 0xD
155#define CC_A 0xE
156#define CC_EXT 0xF
157
158
159
160extern const char *const cris_cc_strings[];
161
162
163#define BRANCH_QUICK_LOW (0)
164#define BRANCH_QUICK_HIGH (0)
165#define BRANCH_QUICK_OPCODE (BRANCH_QUICK_HIGH * 0x0100 + BRANCH_QUICK_LOW)
166#define BRANCH_QUICK_Z_BITS (0x0F00)
167
168
169#define BA_QUICK_HIGH (BRANCH_QUICK_HIGH + CC_A * 0x10)
170#define BA_QUICK_OPCODE (BA_QUICK_HIGH * 0x100 + BRANCH_QUICK_LOW)
171
172
173#define BRANCH_PC_LOW (0xFF)
174#define BRANCH_INCR_HIGH (0x0D)
175#define BA_PC_INCR_OPCODE \
176 ((BRANCH_INCR_HIGH + CC_A * 0x10) * 0x0100 + BRANCH_PC_LOW)
177
178
179
180
181
182#define JUMP_INDIR_OPCODE (0x0930)
183#define JUMP_INDIR_Z_BITS (0xf2c0)
184#define JUMP_PC_INCR_OPCODE \
185 (JUMP_INDIR_OPCODE + AUTOINCR_BIT * 0x0100 + CRIS_REG_PC)
186
187#define MOVE_M_TO_PREG_OPCODE 0x0a30
188#define MOVE_M_TO_PREG_ZBITS 0x01c0
189
190
191#define MOVE_PC_INCR_OPCODE_PREFIX \
192 (((BDAP_INCR_HIGH | (CRIS_REG_PC << 4)) << 8) | BDAP_PC_LOW | (2 << 4))
193#define MOVE_PC_INCR_OPCODE_SUFFIX \
194 (MOVE_M_TO_PREG_OPCODE | CRIS_REG_PC | (AUTOINCR_BIT << 8))
195
196#define JUMP_PC_INCR_OPCODE_V32 (0x0DBF)
197
198
199#define BA_DWORD_OPCODE (0x0EBF)
200
201
202#define NOP_OPCODE (0x050F)
203#define NOP_Z_BITS (0xFFFF ^ NOP_OPCODE)
204
205#define NOP_OPCODE_V32 (0x05B0)
206#define NOP_Z_BITS_V32 (0xFFFF ^ NOP_OPCODE_V32)
207
208
209
210
211
212#define NOP_OPCODE_COMMON (0x630)
213#define NOP_OPCODE_ZBITS_COMMON (0xffff & ~NOP_OPCODE_COMMON)
214
215
216#define LAPC_DWORD_OPCODE (0x0D7F)
217#define LAPC_DWORD_Z_BITS (0x0fff & ~LAPC_DWORD_OPCODE)
218
219
220enum cris_imm_oprnd_size_type
221{
222
223 SIZE_NONE,
224
225
226 SIZE_FIX_32,
227
228
229 SIZE_SPEC_REG,
230
231
232 SIZE_FIELD_SIGNED,
233
234
235 SIZE_FIELD_UNSIGNED,
236
237
238 SIZE_FIELD
239};
240
241
242
243enum cris_op_type
244{
245 cris_not_implemented_op = 0,
246 cris_abs_op,
247 cris_addi_op,
248 cris_asr_op,
249 cris_asrq_op,
250 cris_ax_ei_setf_op,
251 cris_bdap_prefix,
252 cris_biap_prefix,
253 cris_break_op,
254 cris_btst_nop_op,
255 cris_clearf_di_op,
256 cris_dip_prefix,
257 cris_dstep_logshift_mstep_neg_not_op,
258 cris_eight_bit_offset_branch_op,
259 cris_move_mem_to_reg_movem_op,
260 cris_move_reg_to_mem_movem_op,
261 cris_move_to_preg_op,
262 cris_muls_op,
263 cris_mulu_op,
264 cris_none_reg_mode_add_sub_cmp_and_or_move_op,
265 cris_none_reg_mode_clear_test_op,
266 cris_none_reg_mode_jump_op,
267 cris_none_reg_mode_move_from_preg_op,
268 cris_quick_mode_add_sub_op,
269 cris_quick_mode_and_cmp_move_or_op,
270 cris_quick_mode_bdap_prefix,
271 cris_reg_mode_add_sub_cmp_and_or_move_op,
272 cris_reg_mode_clear_op,
273 cris_reg_mode_jump_op,
274 cris_reg_mode_move_from_preg_op,
275 cris_reg_mode_test_op,
276 cris_scc_op,
277 cris_sixteen_bit_offset_branch_op,
278 cris_three_operand_add_sub_cmp_and_or_op,
279 cris_three_operand_bound_op,
280 cris_two_operand_bound_op,
281 cris_xor_op
282};
283
284struct cris_opcode
285{
286
287 const char *name;
288
289
290 unsigned int match;
291
292
293 unsigned int lose;
294
295
296 const char *args;
297
298
299 char delayed;
300
301
302 enum cris_imm_oprnd_size_type imm_oprnd_size;
303
304
305 enum cris_insn_version_usage applicable_version;
306
307
308 enum cris_op_type op;
309};
310extern const struct cris_opcode cris_opcodes[];
311
312
313
314
315
316
317
318
319#define CRIS_DIS_FLAG_MEMREF (1 << 0)
320
321
322#define CRIS_DIS_FLAG_MEM_TARGET_IS_REG (1 << 1)
323
324
325#define CRIS_DIS_FLAG_MEM_TARGET2_IS_REG (1 << 2)
326
327
328
329#define CRIS_DIS_FLAG_MEM_TARGET2_MULT2 (1 << 3)
330
331
332
333#define CRIS_DIS_FLAG_MEM_TARGET2_MULT4 (1 << 4)
334
335
336
337
338#define CRIS_DIS_FLAG_MEM_TARGET2_MEM (1 << 5)
339
340
341
342#define CRIS_DIS_FLAG_MEM_TARGET2_MEM_BYTE (1 << 6)
343
344
345
346#define CRIS_DIS_FLAG_MEM_TARGET2_MEM_WORD (1 << 7)
347
348#endif
349
350
351
352
353
354
355
356