Commit | Line | Data |
---|---|---|
4162bb66 | 1 | /* DO NOT EDIT! -*- buffer-read-only: t -*- vi:set ro: */ |
fd3c93d5 DB |
2 | /* Instruction building/extraction support for frv. -*- C -*- |
3 | ||
47b0e7ad NC |
4 | THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator. |
5 | - the resultant file is machine generated, cgen-ibld.in isn't | |
fd3c93d5 | 6 | |
250d07de | 7 | Copyright (C) 1996-2021 Free Software Foundation, Inc. |
fd3c93d5 | 8 | |
9b201bb5 | 9 | This file is part of libopcodes. |
fd3c93d5 | 10 | |
9b201bb5 | 11 | This library is free software; you can redistribute it and/or modify |
47b0e7ad | 12 | it under the terms of the GNU General Public License as published by |
9b201bb5 | 13 | the Free Software Foundation; either version 3, or (at your option) |
47b0e7ad | 14 | any later version. |
fd3c93d5 | 15 | |
9b201bb5 NC |
16 | It is distributed in the hope that it will be useful, but WITHOUT |
17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
18 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | |
19 | License for more details. | |
fd3c93d5 | 20 | |
47b0e7ad NC |
21 | You should have received a copy of the GNU General Public License |
22 | along with this program; if not, write to the Free Software Foundation, Inc., | |
23 | 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ | |
fd3c93d5 DB |
24 | |
25 | /* ??? Eventually more and more of this stuff can go to cpu-independent files. | |
26 | Keep that in mind. */ | |
27 | ||
28 | #include "sysdep.h" | |
29 | #include <stdio.h> | |
30 | #include "ansidecl.h" | |
31 | #include "dis-asm.h" | |
32 | #include "bfd.h" | |
33 | #include "symcat.h" | |
34 | #include "frv-desc.h" | |
35 | #include "frv-opc.h" | |
fe8afbc4 | 36 | #include "cgen/basic-modes.h" |
fd3c93d5 DB |
37 | #include "opintl.h" |
38 | #include "safe-ctype.h" | |
39 | ||
47b0e7ad | 40 | #undef min |
fd3c93d5 | 41 | #define min(a,b) ((a) < (b) ? (a) : (b)) |
47b0e7ad | 42 | #undef max |
fd3c93d5 DB |
43 | #define max(a,b) ((a) > (b) ? (a) : (b)) |
44 | ||
45 | /* Used by the ifield rtx function. */ | |
46 | #define FLD(f) (fields->f) | |
47 | ||
48 | static const char * insert_normal | |
ffead7ae MM |
49 | (CGEN_CPU_DESC, long, unsigned int, unsigned int, unsigned int, |
50 | unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR); | |
fd3c93d5 | 51 | static const char * insert_insn_normal |
ffead7ae MM |
52 | (CGEN_CPU_DESC, const CGEN_INSN *, |
53 | CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma); | |
fd3c93d5 | 54 | static int extract_normal |
ffead7ae MM |
55 | (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, |
56 | unsigned int, unsigned int, unsigned int, unsigned int, | |
57 | unsigned int, unsigned int, bfd_vma, long *); | |
fd3c93d5 | 58 | static int extract_insn_normal |
ffead7ae MM |
59 | (CGEN_CPU_DESC, const CGEN_INSN *, CGEN_EXTRACT_INFO *, |
60 | CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma); | |
fd3c93d5 DB |
61 | #if CGEN_INT_INSN_P |
62 | static void put_insn_int_value | |
ffead7ae | 63 | (CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT); |
fd3c93d5 DB |
64 | #endif |
65 | #if ! CGEN_INT_INSN_P | |
66 | static CGEN_INLINE void insert_1 | |
ffead7ae | 67 | (CGEN_CPU_DESC, unsigned long, int, int, int, unsigned char *); |
fd3c93d5 | 68 | static CGEN_INLINE int fill_cache |
ffead7ae | 69 | (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, bfd_vma); |
fd3c93d5 | 70 | static CGEN_INLINE long extract_1 |
ffead7ae | 71 | (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, int, unsigned char *, bfd_vma); |
fd3c93d5 DB |
72 | #endif |
73 | \f | |
74 | /* Operand insertion. */ | |
75 | ||
76 | #if ! CGEN_INT_INSN_P | |
77 | ||
78 | /* Subroutine of insert_normal. */ | |
79 | ||
80 | static CGEN_INLINE void | |
ffead7ae MM |
81 | insert_1 (CGEN_CPU_DESC cd, |
82 | unsigned long value, | |
83 | int start, | |
84 | int length, | |
85 | int word_length, | |
86 | unsigned char *bufp) | |
fd3c93d5 | 87 | { |
a1e60a1b | 88 | unsigned long x, mask; |
fd3c93d5 DB |
89 | int shift; |
90 | ||
e9bffec9 | 91 | x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); |
fd3c93d5 DB |
92 | |
93 | /* Written this way to avoid undefined behaviour. */ | |
a1e60a1b | 94 | mask = (1UL << (length - 1) << 1) - 1; |
fd3c93d5 DB |
95 | if (CGEN_INSN_LSB0_P) |
96 | shift = (start + 1) - length; | |
97 | else | |
98 | shift = (word_length - (start + length)); | |
99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); | |
100 | ||
e9bffec9 | 101 | cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); |
fd3c93d5 DB |
102 | } |
103 | ||
104 | #endif /* ! CGEN_INT_INSN_P */ | |
105 | ||
106 | /* Default insertion routine. | |
107 | ||
108 | ATTRS is a mask of the boolean attributes. | |
109 | WORD_OFFSET is the offset in bits from the start of the insn of the value. | |
110 | WORD_LENGTH is the length of the word in bits in which the value resides. | |
111 | START is the starting bit number in the word, architecture origin. | |
112 | LENGTH is the length of VALUE in bits. | |
113 | TOTAL_LENGTH is the total length of the insn in bits. | |
114 | ||
115 | The result is an error message or NULL if success. */ | |
116 | ||
117 | /* ??? This duplicates functionality with bfd's howto table and | |
118 | bfd_install_relocation. */ | |
119 | /* ??? This doesn't handle bfd_vma's. Create another function when | |
120 | necessary. */ | |
121 | ||
122 | static const char * | |
ffead7ae MM |
123 | insert_normal (CGEN_CPU_DESC cd, |
124 | long value, | |
125 | unsigned int attrs, | |
126 | unsigned int word_offset, | |
127 | unsigned int start, | |
128 | unsigned int length, | |
129 | unsigned int word_length, | |
130 | unsigned int total_length, | |
131 | CGEN_INSN_BYTES_PTR buffer) | |
fd3c93d5 DB |
132 | { |
133 | static char errbuf[100]; | |
a1e60a1b | 134 | unsigned long mask; |
fd3c93d5 DB |
135 | |
136 | /* If LENGTH is zero, this operand doesn't contribute to the value. */ | |
137 | if (length == 0) | |
138 | return NULL; | |
139 | ||
a1e60a1b AM |
140 | /* Written this way to avoid undefined behaviour. */ |
141 | mask = (1UL << (length - 1) << 1) - 1; | |
142 | ||
b7cd1872 | 143 | if (word_length > 8 * sizeof (CGEN_INSN_INT)) |
fd3c93d5 DB |
144 | abort (); |
145 | ||
146 | /* For architectures with insns smaller than the base-insn-bitsize, | |
147 | word_length may be too big. */ | |
148 | if (cd->min_insn_bitsize < cd->base_insn_bitsize) | |
149 | { | |
150 | if (word_offset == 0 | |
151 | && word_length > total_length) | |
152 | word_length = total_length; | |
153 | } | |
154 | ||
155 | /* Ensure VALUE will fit. */ | |
156 | if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGN_OPT)) | |
157 | { | |
ae3e98b4 | 158 | long minval = - (1UL << (length - 1)); |
fd3c93d5 | 159 | unsigned long maxval = mask; |
43e65147 | 160 | |
fd3c93d5 DB |
161 | if ((value > 0 && (unsigned long) value > maxval) |
162 | || value < minval) | |
163 | { | |
164 | /* xgettext:c-format */ | |
165 | sprintf (errbuf, | |
166 | _("operand out of range (%ld not between %ld and %lu)"), | |
167 | value, minval, maxval); | |
168 | return errbuf; | |
169 | } | |
170 | } | |
171 | else if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)) | |
172 | { | |
173 | unsigned long maxval = mask; | |
ed963e2d NC |
174 | unsigned long val = (unsigned long) value; |
175 | ||
176 | /* For hosts with a word size > 32 check to see if value has been sign | |
177 | extended beyond 32 bits. If so then ignore these higher sign bits | |
178 | as the user is attempting to store a 32-bit signed value into an | |
179 | unsigned 32-bit field which is allowed. */ | |
180 | if (sizeof (unsigned long) > 4 && ((value >> 32) == -1)) | |
181 | val &= 0xFFFFFFFF; | |
182 | ||
183 | if (val > maxval) | |
fd3c93d5 DB |
184 | { |
185 | /* xgettext:c-format */ | |
186 | sprintf (errbuf, | |
ed963e2d NC |
187 | _("operand out of range (0x%lx not between 0 and 0x%lx)"), |
188 | val, maxval); | |
fd3c93d5 DB |
189 | return errbuf; |
190 | } | |
191 | } | |
192 | else | |
193 | { | |
194 | if (! cgen_signed_overflow_ok_p (cd)) | |
195 | { | |
ae3e98b4 AM |
196 | long minval = - (1UL << (length - 1)); |
197 | long maxval = (1UL << (length - 1)) - 1; | |
43e65147 | 198 | |
fd3c93d5 DB |
199 | if (value < minval || value > maxval) |
200 | { | |
201 | sprintf | |
202 | /* xgettext:c-format */ | |
203 | (errbuf, _("operand out of range (%ld not between %ld and %ld)"), | |
204 | value, minval, maxval); | |
205 | return errbuf; | |
206 | } | |
207 | } | |
208 | } | |
209 | ||
210 | #if CGEN_INT_INSN_P | |
211 | ||
212 | { | |
a143b004 | 213 | int shift_within_word, shift_to_word, shift; |
fd3c93d5 | 214 | |
a143b004 AB |
215 | /* How to shift the value to BIT0 of the word. */ |
216 | shift_to_word = total_length - (word_offset + word_length); | |
217 | ||
218 | /* How to shift the value to the field within the word. */ | |
fd3c93d5 | 219 | if (CGEN_INSN_LSB0_P) |
a143b004 | 220 | shift_within_word = start + 1 - length; |
fd3c93d5 | 221 | else |
a143b004 AB |
222 | shift_within_word = word_length - start - length; |
223 | ||
224 | /* The total SHIFT, then mask in the value. */ | |
225 | shift = shift_to_word + shift_within_word; | |
fd3c93d5 DB |
226 | *buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift); |
227 | } | |
228 | ||
229 | #else /* ! CGEN_INT_INSN_P */ | |
230 | ||
231 | { | |
232 | unsigned char *bufp = (unsigned char *) buffer + word_offset / 8; | |
233 | ||
234 | insert_1 (cd, value, start, length, word_length, bufp); | |
235 | } | |
236 | ||
237 | #endif /* ! CGEN_INT_INSN_P */ | |
238 | ||
239 | return NULL; | |
240 | } | |
241 | ||
242 | /* Default insn builder (insert handler). | |
243 | The instruction is recorded in CGEN_INT_INSN_P byte order (meaning | |
244 | that if CGEN_INSN_BYTES_PTR is an int * and thus, the value is | |
245 | recorded in host byte order, otherwise BUFFER is an array of bytes | |
246 | and the value is recorded in target byte order). | |
247 | The result is an error message or NULL if success. */ | |
248 | ||
249 | static const char * | |
ffead7ae MM |
250 | insert_insn_normal (CGEN_CPU_DESC cd, |
251 | const CGEN_INSN * insn, | |
252 | CGEN_FIELDS * fields, | |
253 | CGEN_INSN_BYTES_PTR buffer, | |
254 | bfd_vma pc) | |
fd3c93d5 DB |
255 | { |
256 | const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); | |
257 | unsigned long value; | |
258 | const CGEN_SYNTAX_CHAR_TYPE * syn; | |
259 | ||
260 | CGEN_INIT_INSERT (cd); | |
261 | value = CGEN_INSN_BASE_VALUE (insn); | |
262 | ||
263 | /* If we're recording insns as numbers (rather than a string of bytes), | |
264 | target byte order handling is deferred until later. */ | |
265 | ||
266 | #if CGEN_INT_INSN_P | |
267 | ||
268 | put_insn_int_value (cd, buffer, cd->base_insn_bitsize, | |
269 | CGEN_FIELDS_BITSIZE (fields), value); | |
270 | ||
271 | #else | |
272 | ||
273 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, | |
e9bffec9 JM |
274 | (unsigned) CGEN_FIELDS_BITSIZE (fields)), |
275 | value, cd->insn_endian); | |
fd3c93d5 DB |
276 | |
277 | #endif /* ! CGEN_INT_INSN_P */ | |
278 | ||
279 | /* ??? It would be better to scan the format's fields. | |
280 | Still need to be able to insert a value based on the operand though; | |
281 | e.g. storing a branch displacement that got resolved later. | |
282 | Needs more thought first. */ | |
283 | ||
284 | for (syn = CGEN_SYNTAX_STRING (syntax); * syn; ++ syn) | |
285 | { | |
286 | const char *errmsg; | |
287 | ||
288 | if (CGEN_SYNTAX_CHAR_P (* syn)) | |
289 | continue; | |
290 | ||
291 | errmsg = (* cd->insert_operand) (cd, CGEN_SYNTAX_FIELD (*syn), | |
292 | fields, buffer, pc); | |
293 | if (errmsg) | |
294 | return errmsg; | |
295 | } | |
296 | ||
297 | return NULL; | |
298 | } | |
299 | ||
300 | #if CGEN_INT_INSN_P | |
301 | /* Cover function to store an insn value into an integral insn. Must go here | |
47b0e7ad | 302 | because it needs <prefix>-desc.h for CGEN_INT_INSN_P. */ |
fd3c93d5 DB |
303 | |
304 | static void | |
ffead7ae MM |
305 | put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, |
306 | CGEN_INSN_BYTES_PTR buf, | |
307 | int length, | |
308 | int insn_length, | |
309 | CGEN_INSN_INT value) | |
fd3c93d5 DB |
310 | { |
311 | /* For architectures with insns smaller than the base-insn-bitsize, | |
312 | length may be too big. */ | |
313 | if (length > insn_length) | |
314 | *buf = value; | |
315 | else | |
316 | { | |
317 | int shift = insn_length - length; | |
318 | /* Written this way to avoid undefined behaviour. */ | |
a1e60a1b | 319 | CGEN_INSN_INT mask = length == 0 ? 0 : (1UL << (length - 1) << 1) - 1; |
47b0e7ad | 320 | |
fd3c93d5 DB |
321 | *buf = (*buf & ~(mask << shift)) | ((value & mask) << shift); |
322 | } | |
323 | } | |
324 | #endif | |
325 | \f | |
326 | /* Operand extraction. */ | |
327 | ||
328 | #if ! CGEN_INT_INSN_P | |
329 | ||
330 | /* Subroutine of extract_normal. | |
331 | Ensure sufficient bytes are cached in EX_INFO. | |
332 | OFFSET is the offset in bytes from the start of the insn of the value. | |
333 | BYTES is the length of the needed value. | |
334 | Returns 1 for success, 0 for failure. */ | |
335 | ||
336 | static CGEN_INLINE int | |
ffead7ae MM |
337 | fill_cache (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, |
338 | CGEN_EXTRACT_INFO *ex_info, | |
339 | int offset, | |
340 | int bytes, | |
341 | bfd_vma pc) | |
fd3c93d5 DB |
342 | { |
343 | /* It's doubtful that the middle part has already been fetched so | |
344 | we don't optimize that case. kiss. */ | |
345 | unsigned int mask; | |
346 | disassemble_info *info = (disassemble_info *) ex_info->dis_info; | |
347 | ||
348 | /* First do a quick check. */ | |
349 | mask = (1 << bytes) - 1; | |
350 | if (((ex_info->valid >> offset) & mask) == mask) | |
351 | return 1; | |
352 | ||
353 | /* Search for the first byte we need to read. */ | |
354 | for (mask = 1 << offset; bytes > 0; --bytes, ++offset, mask <<= 1) | |
355 | if (! (mask & ex_info->valid)) | |
356 | break; | |
357 | ||
358 | if (bytes) | |
359 | { | |
360 | int status; | |
361 | ||
362 | pc += offset; | |
363 | status = (*info->read_memory_func) | |
364 | (pc, ex_info->insn_bytes + offset, bytes, info); | |
365 | ||
366 | if (status != 0) | |
367 | { | |
368 | (*info->memory_error_func) (status, pc, info); | |
369 | return 0; | |
370 | } | |
371 | ||
372 | ex_info->valid |= ((1 << bytes) - 1) << offset; | |
373 | } | |
374 | ||
375 | return 1; | |
376 | } | |
377 | ||
378 | /* Subroutine of extract_normal. */ | |
379 | ||
380 | static CGEN_INLINE long | |
ffead7ae MM |
381 | extract_1 (CGEN_CPU_DESC cd, |
382 | CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED, | |
383 | int start, | |
384 | int length, | |
385 | int word_length, | |
386 | unsigned char *bufp, | |
387 | bfd_vma pc ATTRIBUTE_UNUSED) | |
fd3c93d5 DB |
388 | { |
389 | unsigned long x; | |
390 | int shift; | |
47b0e7ad | 391 | |
e9bffec9 | 392 | x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); |
fd3c93d5 DB |
393 | |
394 | if (CGEN_INSN_LSB0_P) | |
395 | shift = (start + 1) - length; | |
396 | else | |
397 | shift = (word_length - (start + length)); | |
398 | return x >> shift; | |
399 | } | |
400 | ||
401 | #endif /* ! CGEN_INT_INSN_P */ | |
402 | ||
403 | /* Default extraction routine. | |
404 | ||
405 | INSN_VALUE is the first base_insn_bitsize bits of the insn in host order, | |
406 | or sometimes less for cases like the m32r where the base insn size is 32 | |
407 | but some insns are 16 bits. | |
408 | ATTRS is a mask of the boolean attributes. We only need `SIGNED', | |
409 | but for generality we take a bitmask of all of them. | |
410 | WORD_OFFSET is the offset in bits from the start of the insn of the value. | |
411 | WORD_LENGTH is the length of the word in bits in which the value resides. | |
412 | START is the starting bit number in the word, architecture origin. | |
413 | LENGTH is the length of VALUE in bits. | |
414 | TOTAL_LENGTH is the total length of the insn in bits. | |
415 | ||
416 | Returns 1 for success, 0 for failure. */ | |
417 | ||
418 | /* ??? The return code isn't properly used. wip. */ | |
419 | ||
420 | /* ??? This doesn't handle bfd_vma's. Create another function when | |
421 | necessary. */ | |
422 | ||
423 | static int | |
ffead7ae | 424 | extract_normal (CGEN_CPU_DESC cd, |
fd3c93d5 | 425 | #if ! CGEN_INT_INSN_P |
ffead7ae | 426 | CGEN_EXTRACT_INFO *ex_info, |
fd3c93d5 | 427 | #else |
ffead7ae | 428 | CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED, |
fd3c93d5 | 429 | #endif |
ffead7ae MM |
430 | CGEN_INSN_INT insn_value, |
431 | unsigned int attrs, | |
432 | unsigned int word_offset, | |
433 | unsigned int start, | |
434 | unsigned int length, | |
435 | unsigned int word_length, | |
436 | unsigned int total_length, | |
fd3c93d5 | 437 | #if ! CGEN_INT_INSN_P |
ffead7ae | 438 | bfd_vma pc, |
fd3c93d5 | 439 | #else |
ffead7ae | 440 | bfd_vma pc ATTRIBUTE_UNUSED, |
fd3c93d5 | 441 | #endif |
ffead7ae | 442 | long *valuep) |
fd3c93d5 DB |
443 | { |
444 | long value, mask; | |
445 | ||
446 | /* If LENGTH is zero, this operand doesn't contribute to the value | |
447 | so give it a standard value of zero. */ | |
448 | if (length == 0) | |
449 | { | |
450 | *valuep = 0; | |
451 | return 1; | |
452 | } | |
453 | ||
b7cd1872 | 454 | if (word_length > 8 * sizeof (CGEN_INSN_INT)) |
fd3c93d5 DB |
455 | abort (); |
456 | ||
457 | /* For architectures with insns smaller than the insn-base-bitsize, | |
458 | word_length may be too big. */ | |
459 | if (cd->min_insn_bitsize < cd->base_insn_bitsize) | |
460 | { | |
ed963e2d NC |
461 | if (word_offset + word_length > total_length) |
462 | word_length = total_length - word_offset; | |
fd3c93d5 DB |
463 | } |
464 | ||
465 | /* Does the value reside in INSN_VALUE, and at the right alignment? */ | |
466 | ||
467 | if (CGEN_INT_INSN_P || (word_offset == 0 && word_length == total_length)) | |
468 | { | |
469 | if (CGEN_INSN_LSB0_P) | |
470 | value = insn_value >> ((word_offset + start + 1) - length); | |
471 | else | |
472 | value = insn_value >> (total_length - ( word_offset + start + length)); | |
473 | } | |
474 | ||
475 | #if ! CGEN_INT_INSN_P | |
476 | ||
477 | else | |
478 | { | |
479 | unsigned char *bufp = ex_info->insn_bytes + word_offset / 8; | |
480 | ||
b7cd1872 | 481 | if (word_length > 8 * sizeof (CGEN_INSN_INT)) |
fd3c93d5 DB |
482 | abort (); |
483 | ||
484 | if (fill_cache (cd, ex_info, word_offset / 8, word_length / 8, pc) == 0) | |
2f5dd314 AM |
485 | { |
486 | *valuep = 0; | |
487 | return 0; | |
488 | } | |
fd3c93d5 DB |
489 | |
490 | value = extract_1 (cd, ex_info, start, length, word_length, bufp, pc); | |
491 | } | |
492 | ||
493 | #endif /* ! CGEN_INT_INSN_P */ | |
494 | ||
495 | /* Written this way to avoid undefined behaviour. */ | |
a1e60a1b | 496 | mask = (1UL << (length - 1) << 1) - 1; |
fd3c93d5 DB |
497 | |
498 | value &= mask; | |
499 | /* sign extend? */ | |
500 | if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED) | |
ae3e98b4 | 501 | && (value & (1UL << (length - 1)))) |
fd3c93d5 DB |
502 | value |= ~mask; |
503 | ||
504 | *valuep = value; | |
505 | ||
506 | return 1; | |
507 | } | |
508 | ||
509 | /* Default insn extractor. | |
510 | ||
511 | INSN_VALUE is the first base_insn_bitsize bits, translated to host order. | |
512 | The extracted fields are stored in FIELDS. | |
513 | EX_INFO is used to handle reading variable length insns. | |
514 | Return the length of the insn in bits, or 0 if no match, | |
515 | or -1 if an error occurs fetching data (memory_error_func will have | |
516 | been called). */ | |
517 | ||
518 | static int | |
ffead7ae MM |
519 | extract_insn_normal (CGEN_CPU_DESC cd, |
520 | const CGEN_INSN *insn, | |
521 | CGEN_EXTRACT_INFO *ex_info, | |
522 | CGEN_INSN_INT insn_value, | |
523 | CGEN_FIELDS *fields, | |
524 | bfd_vma pc) | |
fd3c93d5 DB |
525 | { |
526 | const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn); | |
527 | const CGEN_SYNTAX_CHAR_TYPE *syn; | |
528 | ||
529 | CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn); | |
530 | ||
531 | CGEN_INIT_EXTRACT (cd); | |
532 | ||
533 | for (syn = CGEN_SYNTAX_STRING (syntax); *syn; ++syn) | |
534 | { | |
535 | int length; | |
536 | ||
537 | if (CGEN_SYNTAX_CHAR_P (*syn)) | |
538 | continue; | |
539 | ||
540 | length = (* cd->extract_operand) (cd, CGEN_SYNTAX_FIELD (*syn), | |
541 | ex_info, insn_value, fields, pc); | |
542 | if (length <= 0) | |
543 | return length; | |
544 | } | |
545 | ||
546 | /* We recognized and successfully extracted this insn. */ | |
547 | return CGEN_INSN_BITSIZE (insn); | |
548 | } | |
549 | \f | |
47b0e7ad | 550 | /* Machine generated code added here. */ |
fd3c93d5 DB |
551 | |
552 | const char * frv_cgen_insert_operand | |
47b0e7ad | 553 | (CGEN_CPU_DESC, int, CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma); |
fd3c93d5 DB |
554 | |
555 | /* Main entry point for operand insertion. | |
556 | ||
557 | This function is basically just a big switch statement. Earlier versions | |
558 | used tables to look up the function to use, but | |
559 | - if the table contains both assembler and disassembler functions then | |
560 | the disassembler contains much of the assembler and vice-versa, | |
561 | - there's a lot of inlining possibilities as things grow, | |
562 | - using a switch statement avoids the function call overhead. | |
563 | ||
564 | This function could be moved into `parse_insn_normal', but keeping it | |
565 | separate makes clear the interface between `parse_insn_normal' and each of | |
566 | the handlers. It's also needed by GAS to insert operands that couldn't be | |
567 | resolved during parsing. */ | |
568 | ||
569 | const char * | |
47b0e7ad NC |
570 | frv_cgen_insert_operand (CGEN_CPU_DESC cd, |
571 | int opindex, | |
572 | CGEN_FIELDS * fields, | |
573 | CGEN_INSN_BYTES_PTR buffer, | |
574 | bfd_vma pc ATTRIBUTE_UNUSED) | |
fd3c93d5 DB |
575 | { |
576 | const char * errmsg = NULL; | |
577 | unsigned int total_length = CGEN_FIELDS_BITSIZE (fields); | |
578 | ||
579 | switch (opindex) | |
580 | { | |
ecd51ad3 DB |
581 | case FRV_OPERAND_A0 : |
582 | errmsg = insert_normal (cd, fields->f_A, 0, 0, 17, 1, 32, total_length, buffer); | |
583 | break; | |
584 | case FRV_OPERAND_A1 : | |
fd3c93d5 DB |
585 | errmsg = insert_normal (cd, fields->f_A, 0, 0, 17, 1, 32, total_length, buffer); |
586 | break; | |
587 | case FRV_OPERAND_ACC40SI : | |
588 | errmsg = insert_normal (cd, fields->f_ACC40Si, 0, 0, 17, 6, 32, total_length, buffer); | |
589 | break; | |
590 | case FRV_OPERAND_ACC40SK : | |
591 | errmsg = insert_normal (cd, fields->f_ACC40Sk, 0, 0, 30, 6, 32, total_length, buffer); | |
592 | break; | |
593 | case FRV_OPERAND_ACC40UI : | |
594 | errmsg = insert_normal (cd, fields->f_ACC40Ui, 0, 0, 17, 6, 32, total_length, buffer); | |
595 | break; | |
596 | case FRV_OPERAND_ACC40UK : | |
597 | errmsg = insert_normal (cd, fields->f_ACC40Uk, 0, 0, 30, 6, 32, total_length, buffer); | |
598 | break; | |
599 | case FRV_OPERAND_ACCGI : | |
600 | errmsg = insert_normal (cd, fields->f_ACCGi, 0, 0, 17, 6, 32, total_length, buffer); | |
601 | break; | |
602 | case FRV_OPERAND_ACCGK : | |
603 | errmsg = insert_normal (cd, fields->f_ACCGk, 0, 0, 30, 6, 32, total_length, buffer); | |
604 | break; | |
605 | case FRV_OPERAND_CCI : | |
606 | errmsg = insert_normal (cd, fields->f_CCi, 0, 0, 11, 3, 32, total_length, buffer); | |
607 | break; | |
608 | case FRV_OPERAND_CPRDOUBLEK : | |
609 | errmsg = insert_normal (cd, fields->f_CPRk, 0, 0, 30, 6, 32, total_length, buffer); | |
610 | break; | |
611 | case FRV_OPERAND_CPRI : | |
612 | errmsg = insert_normal (cd, fields->f_CPRi, 0, 0, 17, 6, 32, total_length, buffer); | |
613 | break; | |
614 | case FRV_OPERAND_CPRJ : | |
615 | errmsg = insert_normal (cd, fields->f_CPRj, 0, 0, 5, 6, 32, total_length, buffer); | |
616 | break; | |
617 | case FRV_OPERAND_CPRK : | |
618 | errmsg = insert_normal (cd, fields->f_CPRk, 0, 0, 30, 6, 32, total_length, buffer); | |
619 | break; | |
620 | case FRV_OPERAND_CRI : | |
621 | errmsg = insert_normal (cd, fields->f_CRi, 0, 0, 14, 3, 32, total_length, buffer); | |
622 | break; | |
623 | case FRV_OPERAND_CRJ : | |
624 | errmsg = insert_normal (cd, fields->f_CRj, 0, 0, 2, 3, 32, total_length, buffer); | |
625 | break; | |
626 | case FRV_OPERAND_CRJ_FLOAT : | |
627 | errmsg = insert_normal (cd, fields->f_CRj_float, 0, 0, 26, 2, 32, total_length, buffer); | |
628 | break; | |
629 | case FRV_OPERAND_CRJ_INT : | |
630 | { | |
631 | long value = fields->f_CRj_int; | |
632 | value = ((value) - (4)); | |
633 | errmsg = insert_normal (cd, value, 0, 0, 26, 2, 32, total_length, buffer); | |
634 | } | |
635 | break; | |
636 | case FRV_OPERAND_CRK : | |
637 | errmsg = insert_normal (cd, fields->f_CRk, 0, 0, 27, 3, 32, total_length, buffer); | |
638 | break; | |
639 | case FRV_OPERAND_FCCI_1 : | |
640 | errmsg = insert_normal (cd, fields->f_FCCi_1, 0, 0, 11, 2, 32, total_length, buffer); | |
641 | break; | |
642 | case FRV_OPERAND_FCCI_2 : | |
643 | errmsg = insert_normal (cd, fields->f_FCCi_2, 0, 0, 26, 2, 32, total_length, buffer); | |
644 | break; | |
645 | case FRV_OPERAND_FCCI_3 : | |
646 | errmsg = insert_normal (cd, fields->f_FCCi_3, 0, 0, 1, 2, 32, total_length, buffer); | |
647 | break; | |
648 | case FRV_OPERAND_FCCK : | |
649 | errmsg = insert_normal (cd, fields->f_FCCk, 0, 0, 26, 2, 32, total_length, buffer); | |
650 | break; | |
651 | case FRV_OPERAND_FRDOUBLEI : | |
652 | errmsg = insert_normal (cd, fields->f_FRi, 0, 0, 17, 6, 32, total_length, buffer); | |
653 | break; | |
654 | case FRV_OPERAND_FRDOUBLEJ : | |
655 | errmsg = insert_normal (cd, fields->f_FRj, 0, 0, 5, 6, 32, total_length, buffer); | |
656 | break; | |
657 | case FRV_OPERAND_FRDOUBLEK : | |
658 | errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer); | |
659 | break; | |
660 | case FRV_OPERAND_FRI : | |
661 | errmsg = insert_normal (cd, fields->f_FRi, 0, 0, 17, 6, 32, total_length, buffer); | |
662 | break; | |
663 | case FRV_OPERAND_FRINTI : | |
664 | errmsg = insert_normal (cd, fields->f_FRi, 0, 0, 17, 6, 32, total_length, buffer); | |
665 | break; | |
36c3ae24 NC |
666 | case FRV_OPERAND_FRINTIEVEN : |
667 | errmsg = insert_normal (cd, fields->f_FRi, 0, 0, 17, 6, 32, total_length, buffer); | |
668 | break; | |
fd3c93d5 DB |
669 | case FRV_OPERAND_FRINTJ : |
670 | errmsg = insert_normal (cd, fields->f_FRj, 0, 0, 5, 6, 32, total_length, buffer); | |
671 | break; | |
36c3ae24 NC |
672 | case FRV_OPERAND_FRINTJEVEN : |
673 | errmsg = insert_normal (cd, fields->f_FRj, 0, 0, 5, 6, 32, total_length, buffer); | |
674 | break; | |
fd3c93d5 DB |
675 | case FRV_OPERAND_FRINTK : |
676 | errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer); | |
677 | break; | |
36c3ae24 NC |
678 | case FRV_OPERAND_FRINTKEVEN : |
679 | errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer); | |
680 | break; | |
fd3c93d5 DB |
681 | case FRV_OPERAND_FRJ : |
682 | errmsg = insert_normal (cd, fields->f_FRj, 0, 0, 5, 6, 32, total_length, buffer); | |
683 | break; | |
684 | case FRV_OPERAND_FRK : | |
685 | errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer); | |
686 | break; | |
687 | case FRV_OPERAND_FRKHI : | |
688 | errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer); | |
689 | break; | |
690 | case FRV_OPERAND_FRKLO : | |
691 | errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer); | |
692 | break; | |
693 | case FRV_OPERAND_GRDOUBLEK : | |
694 | errmsg = insert_normal (cd, fields->f_GRk, 0, 0, 30, 6, 32, total_length, buffer); | |
695 | break; | |
696 | case FRV_OPERAND_GRI : | |
697 | errmsg = insert_normal (cd, fields->f_GRi, 0, 0, 17, 6, 32, total_length, buffer); | |
698 | break; | |
699 | case FRV_OPERAND_GRJ : | |
700 | errmsg = insert_normal (cd, fields->f_GRj, 0, 0, 5, 6, 32, total_length, buffer); | |
701 | break; | |
702 | case FRV_OPERAND_GRK : | |
703 | errmsg = insert_normal (cd, fields->f_GRk, 0, 0, 30, 6, 32, total_length, buffer); | |
704 | break; | |
705 | case FRV_OPERAND_GRKHI : | |
706 | errmsg = insert_normal (cd, fields->f_GRk, 0, 0, 30, 6, 32, total_length, buffer); | |
707 | break; | |
708 | case FRV_OPERAND_GRKLO : | |
709 | errmsg = insert_normal (cd, fields->f_GRk, 0, 0, 30, 6, 32, total_length, buffer); | |
710 | break; | |
711 | case FRV_OPERAND_ICCI_1 : | |
712 | errmsg = insert_normal (cd, fields->f_ICCi_1, 0, 0, 11, 2, 32, total_length, buffer); | |
713 | break; | |
714 | case FRV_OPERAND_ICCI_2 : | |
715 | errmsg = insert_normal (cd, fields->f_ICCi_2, 0, 0, 26, 2, 32, total_length, buffer); | |
716 | break; | |
717 | case FRV_OPERAND_ICCI_3 : | |
718 | errmsg = insert_normal (cd, fields->f_ICCi_3, 0, 0, 1, 2, 32, total_length, buffer); | |
719 | break; | |
720 | case FRV_OPERAND_LI : | |
721 | errmsg = insert_normal (cd, fields->f_LI, 0, 0, 25, 1, 32, total_length, buffer); | |
722 | break; | |
676a64f4 RS |
723 | case FRV_OPERAND_LRAD : |
724 | errmsg = insert_normal (cd, fields->f_LRAD, 0, 0, 4, 1, 32, total_length, buffer); | |
725 | break; | |
726 | case FRV_OPERAND_LRAE : | |
727 | errmsg = insert_normal (cd, fields->f_LRAE, 0, 0, 5, 1, 32, total_length, buffer); | |
728 | break; | |
729 | case FRV_OPERAND_LRAS : | |
730 | errmsg = insert_normal (cd, fields->f_LRAS, 0, 0, 3, 1, 32, total_length, buffer); | |
731 | break; | |
732 | case FRV_OPERAND_TLBPRL : | |
733 | errmsg = insert_normal (cd, fields->f_TLBPRL, 0, 0, 25, 1, 32, total_length, buffer); | |
734 | break; | |
735 | case FRV_OPERAND_TLBPROPX : | |
736 | errmsg = insert_normal (cd, fields->f_TLBPRopx, 0, 0, 28, 3, 32, total_length, buffer); | |
737 | break; | |
fd3c93d5 DB |
738 | case FRV_OPERAND_AE : |
739 | errmsg = insert_normal (cd, fields->f_ae, 0, 0, 25, 1, 32, total_length, buffer); | |
740 | break; | |
90219bd0 AO |
741 | case FRV_OPERAND_CALLANN : |
742 | errmsg = insert_normal (cd, fields->f_reloc_ann, 0, 0, 0, 0, 32, total_length, buffer); | |
743 | break; | |
fd3c93d5 DB |
744 | case FRV_OPERAND_CCOND : |
745 | errmsg = insert_normal (cd, fields->f_ccond, 0, 0, 12, 1, 32, total_length, buffer); | |
746 | break; | |
747 | case FRV_OPERAND_COND : | |
748 | errmsg = insert_normal (cd, fields->f_cond, 0, 0, 8, 1, 32, total_length, buffer); | |
749 | break; | |
750 | case FRV_OPERAND_D12 : | |
751 | errmsg = insert_normal (cd, fields->f_d12, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 12, 32, total_length, buffer); | |
752 | break; | |
753 | case FRV_OPERAND_DEBUG : | |
754 | errmsg = insert_normal (cd, fields->f_debug, 0, 0, 25, 1, 32, total_length, buffer); | |
755 | break; | |
756 | case FRV_OPERAND_EIR : | |
757 | errmsg = insert_normal (cd, fields->f_eir, 0, 0, 17, 6, 32, total_length, buffer); | |
758 | break; | |
759 | case FRV_OPERAND_HINT : | |
760 | errmsg = insert_normal (cd, fields->f_hint, 0, 0, 17, 2, 32, total_length, buffer); | |
761 | break; | |
762 | case FRV_OPERAND_HINT_NOT_TAKEN : | |
763 | errmsg = insert_normal (cd, fields->f_hint, 0, 0, 17, 2, 32, total_length, buffer); | |
764 | break; | |
765 | case FRV_OPERAND_HINT_TAKEN : | |
766 | errmsg = insert_normal (cd, fields->f_hint, 0, 0, 17, 2, 32, total_length, buffer); | |
767 | break; | |
768 | case FRV_OPERAND_LABEL16 : | |
769 | { | |
770 | long value = fields->f_label16; | |
fe8afbc4 | 771 | value = ((SI) (((value) - (pc))) >> (2)); |
fd3c93d5 DB |
772 | errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 15, 16, 32, total_length, buffer); |
773 | } | |
774 | break; | |
775 | case FRV_OPERAND_LABEL24 : | |
776 | { | |
777 | { | |
fe8afbc4 DE |
778 | FLD (f_labelH6) = ((SI) (((FLD (f_label24)) - (pc))) >> (20)); |
779 | FLD (f_labelL18) = ((((UINT) (((FLD (f_label24)) - (pc))) >> (2))) & (262143)); | |
fd3c93d5 DB |
780 | } |
781 | errmsg = insert_normal (cd, fields->f_labelH6, 0|(1<<CGEN_IFLD_SIGNED), 0, 30, 6, 32, total_length, buffer); | |
782 | if (errmsg) | |
783 | break; | |
784 | errmsg = insert_normal (cd, fields->f_labelL18, 0, 0, 17, 18, 32, total_length, buffer); | |
785 | if (errmsg) | |
786 | break; | |
787 | } | |
788 | break; | |
90219bd0 AO |
789 | case FRV_OPERAND_LDANN : |
790 | errmsg = insert_normal (cd, fields->f_reloc_ann, 0, 0, 0, 0, 32, total_length, buffer); | |
791 | break; | |
792 | case FRV_OPERAND_LDDANN : | |
793 | errmsg = insert_normal (cd, fields->f_reloc_ann, 0, 0, 0, 0, 32, total_length, buffer); | |
794 | break; | |
fd3c93d5 DB |
795 | case FRV_OPERAND_LOCK : |
796 | errmsg = insert_normal (cd, fields->f_lock, 0, 0, 25, 1, 32, total_length, buffer); | |
797 | break; | |
798 | case FRV_OPERAND_PACK : | |
799 | errmsg = insert_normal (cd, fields->f_pack, 0, 0, 31, 1, 32, total_length, buffer); | |
800 | break; | |
801 | case FRV_OPERAND_S10 : | |
802 | errmsg = insert_normal (cd, fields->f_s10, 0|(1<<CGEN_IFLD_SIGNED), 0, 9, 10, 32, total_length, buffer); | |
803 | break; | |
804 | case FRV_OPERAND_S12 : | |
805 | errmsg = insert_normal (cd, fields->f_d12, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 12, 32, total_length, buffer); | |
806 | break; | |
807 | case FRV_OPERAND_S16 : | |
808 | errmsg = insert_normal (cd, fields->f_s16, 0|(1<<CGEN_IFLD_SIGNED), 0, 15, 16, 32, total_length, buffer); | |
809 | break; | |
810 | case FRV_OPERAND_S5 : | |
811 | errmsg = insert_normal (cd, fields->f_s5, 0|(1<<CGEN_IFLD_SIGNED), 0, 4, 5, 32, total_length, buffer); | |
812 | break; | |
813 | case FRV_OPERAND_S6 : | |
814 | errmsg = insert_normal (cd, fields->f_s6, 0|(1<<CGEN_IFLD_SIGNED), 0, 5, 6, 32, total_length, buffer); | |
815 | break; | |
816 | case FRV_OPERAND_S6_1 : | |
817 | errmsg = insert_normal (cd, fields->f_s6_1, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 6, 32, total_length, buffer); | |
818 | break; | |
819 | case FRV_OPERAND_SLO16 : | |
820 | errmsg = insert_normal (cd, fields->f_s16, 0|(1<<CGEN_IFLD_SIGNED), 0, 15, 16, 32, total_length, buffer); | |
821 | break; | |
822 | case FRV_OPERAND_SPR : | |
823 | { | |
824 | { | |
fe8afbc4 | 825 | FLD (f_spr_h) = ((UINT) (FLD (f_spr)) >> (6)); |
fd3c93d5 DB |
826 | FLD (f_spr_l) = ((FLD (f_spr)) & (63)); |
827 | } | |
828 | errmsg = insert_normal (cd, fields->f_spr_h, 0, 0, 30, 6, 32, total_length, buffer); | |
829 | if (errmsg) | |
830 | break; | |
831 | errmsg = insert_normal (cd, fields->f_spr_l, 0, 0, 17, 6, 32, total_length, buffer); | |
832 | if (errmsg) | |
833 | break; | |
834 | } | |
835 | break; | |
836 | case FRV_OPERAND_U12 : | |
837 | { | |
838 | { | |
fe8afbc4 | 839 | FLD (f_u12_h) = ((SI) (FLD (f_u12)) >> (6)); |
fd3c93d5 DB |
840 | FLD (f_u12_l) = ((FLD (f_u12)) & (63)); |
841 | } | |
842 | errmsg = insert_normal (cd, fields->f_u12_h, 0|(1<<CGEN_IFLD_SIGNED), 0, 17, 6, 32, total_length, buffer); | |
843 | if (errmsg) | |
844 | break; | |
845 | errmsg = insert_normal (cd, fields->f_u12_l, 0, 0, 5, 6, 32, total_length, buffer); | |
846 | if (errmsg) | |
847 | break; | |
848 | } | |
849 | break; | |
850 | case FRV_OPERAND_U16 : | |
851 | errmsg = insert_normal (cd, fields->f_u16, 0, 0, 15, 16, 32, total_length, buffer); | |
852 | break; | |
853 | case FRV_OPERAND_U6 : | |
854 | errmsg = insert_normal (cd, fields->f_u6, 0, 0, 5, 6, 32, total_length, buffer); | |
855 | break; | |
856 | case FRV_OPERAND_UHI16 : | |
857 | errmsg = insert_normal (cd, fields->f_u16, 0, 0, 15, 16, 32, total_length, buffer); | |
858 | break; | |
859 | case FRV_OPERAND_ULO16 : | |
860 | errmsg = insert_normal (cd, fields->f_u16, 0, 0, 15, 16, 32, total_length, buffer); | |
861 | break; | |
862 | ||
863 | default : | |
864 | /* xgettext:c-format */ | |
a6743a54 AM |
865 | opcodes_error_handler |
866 | (_("internal error: unrecognized field %d while building insn"), | |
867 | opindex); | |
fd3c93d5 DB |
868 | abort (); |
869 | } | |
870 | ||
871 | return errmsg; | |
872 | } | |
873 | ||
874 | int frv_cgen_extract_operand | |
47b0e7ad | 875 | (CGEN_CPU_DESC, int, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma); |
fd3c93d5 DB |
876 | |
877 | /* Main entry point for operand extraction. | |
878 | The result is <= 0 for error, >0 for success. | |
879 | ??? Actual values aren't well defined right now. | |
880 | ||
881 | This function is basically just a big switch statement. Earlier versions | |
882 | used tables to look up the function to use, but | |
883 | - if the table contains both assembler and disassembler functions then | |
884 | the disassembler contains much of the assembler and vice-versa, | |
885 | - there's a lot of inlining possibilities as things grow, | |
886 | - using a switch statement avoids the function call overhead. | |
887 | ||
888 | This function could be moved into `print_insn_normal', but keeping it | |
889 | separate makes clear the interface between `print_insn_normal' and each of | |
890 | the handlers. */ | |
891 | ||
892 | int | |
47b0e7ad NC |
893 | frv_cgen_extract_operand (CGEN_CPU_DESC cd, |
894 | int opindex, | |
895 | CGEN_EXTRACT_INFO *ex_info, | |
896 | CGEN_INSN_INT insn_value, | |
897 | CGEN_FIELDS * fields, | |
898 | bfd_vma pc) | |
fd3c93d5 DB |
899 | { |
900 | /* Assume success (for those operands that are nops). */ | |
901 | int length = 1; | |
902 | unsigned int total_length = CGEN_FIELDS_BITSIZE (fields); | |
903 | ||
904 | switch (opindex) | |
905 | { | |
ecd51ad3 DB |
906 | case FRV_OPERAND_A0 : |
907 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 1, 32, total_length, pc, & fields->f_A); | |
908 | break; | |
909 | case FRV_OPERAND_A1 : | |
fd3c93d5 DB |
910 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 1, 32, total_length, pc, & fields->f_A); |
911 | break; | |
912 | case FRV_OPERAND_ACC40SI : | |
913 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_ACC40Si); | |
914 | break; | |
915 | case FRV_OPERAND_ACC40SK : | |
916 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_ACC40Sk); | |
917 | break; | |
918 | case FRV_OPERAND_ACC40UI : | |
919 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_ACC40Ui); | |
920 | break; | |
921 | case FRV_OPERAND_ACC40UK : | |
922 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_ACC40Uk); | |
923 | break; | |
924 | case FRV_OPERAND_ACCGI : | |
925 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_ACCGi); | |
926 | break; | |
927 | case FRV_OPERAND_ACCGK : | |
928 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_ACCGk); | |
929 | break; | |
930 | case FRV_OPERAND_CCI : | |
931 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 11, 3, 32, total_length, pc, & fields->f_CCi); | |
932 | break; | |
933 | case FRV_OPERAND_CPRDOUBLEK : | |
934 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_CPRk); | |
935 | break; | |
936 | case FRV_OPERAND_CPRI : | |
937 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_CPRi); | |
938 | break; | |
939 | case FRV_OPERAND_CPRJ : | |
940 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_CPRj); | |
941 | break; | |
942 | case FRV_OPERAND_CPRK : | |
943 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_CPRk); | |
944 | break; | |
945 | case FRV_OPERAND_CRI : | |
946 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 14, 3, 32, total_length, pc, & fields->f_CRi); | |
947 | break; | |
948 | case FRV_OPERAND_CRJ : | |
949 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 2, 3, 32, total_length, pc, & fields->f_CRj); | |
950 | break; | |
951 | case FRV_OPERAND_CRJ_FLOAT : | |
952 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & fields->f_CRj_float); | |
953 | break; | |
954 | case FRV_OPERAND_CRJ_INT : | |
955 | { | |
956 | long value; | |
957 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & value); | |
958 | value = ((value) + (4)); | |
959 | fields->f_CRj_int = value; | |
960 | } | |
961 | break; | |
962 | case FRV_OPERAND_CRK : | |
963 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 27, 3, 32, total_length, pc, & fields->f_CRk); | |
964 | break; | |
965 | case FRV_OPERAND_FCCI_1 : | |
966 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 11, 2, 32, total_length, pc, & fields->f_FCCi_1); | |
967 | break; | |
968 | case FRV_OPERAND_FCCI_2 : | |
969 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & fields->f_FCCi_2); | |
970 | break; | |
971 | case FRV_OPERAND_FCCI_3 : | |
972 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 1, 2, 32, total_length, pc, & fields->f_FCCi_3); | |
973 | break; | |
974 | case FRV_OPERAND_FCCK : | |
975 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & fields->f_FCCk); | |
976 | break; | |
977 | case FRV_OPERAND_FRDOUBLEI : | |
978 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_FRi); | |
979 | break; | |
980 | case FRV_OPERAND_FRDOUBLEJ : | |
981 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_FRj); | |
982 | break; | |
983 | case FRV_OPERAND_FRDOUBLEK : | |
984 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk); | |
985 | break; | |
986 | case FRV_OPERAND_FRI : | |
987 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_FRi); | |
988 | break; | |
989 | case FRV_OPERAND_FRINTI : | |
990 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_FRi); | |
991 | break; | |
36c3ae24 NC |
992 | case FRV_OPERAND_FRINTIEVEN : |
993 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_FRi); | |
994 | break; | |
fd3c93d5 DB |
995 | case FRV_OPERAND_FRINTJ : |
996 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_FRj); | |
997 | break; | |
36c3ae24 NC |
998 | case FRV_OPERAND_FRINTJEVEN : |
999 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_FRj); | |
1000 | break; | |
fd3c93d5 DB |
1001 | case FRV_OPERAND_FRINTK : |
1002 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk); | |
1003 | break; | |
36c3ae24 NC |
1004 | case FRV_OPERAND_FRINTKEVEN : |
1005 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk); | |
1006 | break; | |
fd3c93d5 DB |
1007 | case FRV_OPERAND_FRJ : |
1008 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_FRj); | |
1009 | break; | |
1010 | case FRV_OPERAND_FRK : | |
1011 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk); | |
1012 | break; | |
1013 | case FRV_OPERAND_FRKHI : | |
1014 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk); | |
1015 | break; | |
1016 | case FRV_OPERAND_FRKLO : | |
1017 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk); | |
1018 | break; | |
1019 | case FRV_OPERAND_GRDOUBLEK : | |
1020 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_GRk); | |
1021 | break; | |
1022 | case FRV_OPERAND_GRI : | |
1023 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_GRi); | |
1024 | break; | |
1025 | case FRV_OPERAND_GRJ : | |
1026 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_GRj); | |
1027 | break; | |
1028 | case FRV_OPERAND_GRK : | |
1029 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_GRk); | |
1030 | break; | |
1031 | case FRV_OPERAND_GRKHI : | |
1032 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_GRk); | |
1033 | break; | |
1034 | case FRV_OPERAND_GRKLO : | |
1035 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_GRk); | |
1036 | break; | |
1037 | case FRV_OPERAND_ICCI_1 : | |
1038 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 11, 2, 32, total_length, pc, & fields->f_ICCi_1); | |
1039 | break; | |
1040 | case FRV_OPERAND_ICCI_2 : | |
1041 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & fields->f_ICCi_2); | |
1042 | break; | |
1043 | case FRV_OPERAND_ICCI_3 : | |
1044 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 1, 2, 32, total_length, pc, & fields->f_ICCi_3); | |
1045 | break; | |
1046 | case FRV_OPERAND_LI : | |
1047 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_LI); | |
1048 | break; | |
676a64f4 RS |
1049 | case FRV_OPERAND_LRAD : |
1050 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 1, 32, total_length, pc, & fields->f_LRAD); | |
1051 | break; | |
1052 | case FRV_OPERAND_LRAE : | |
1053 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 1, 32, total_length, pc, & fields->f_LRAE); | |
1054 | break; | |
1055 | case FRV_OPERAND_LRAS : | |
1056 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 3, 1, 32, total_length, pc, & fields->f_LRAS); | |
1057 | break; | |
1058 | case FRV_OPERAND_TLBPRL : | |
1059 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_TLBPRL); | |
1060 | break; | |
1061 | case FRV_OPERAND_TLBPROPX : | |
1062 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 3, 32, total_length, pc, & fields->f_TLBPRopx); | |
1063 | break; | |
fd3c93d5 DB |
1064 | case FRV_OPERAND_AE : |
1065 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_ae); | |
1066 | break; | |
90219bd0 AO |
1067 | case FRV_OPERAND_CALLANN : |
1068 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 0, 32, total_length, pc, & fields->f_reloc_ann); | |
1069 | break; | |
fd3c93d5 DB |
1070 | case FRV_OPERAND_CCOND : |
1071 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 12, 1, 32, total_length, pc, & fields->f_ccond); | |
1072 | break; | |
1073 | case FRV_OPERAND_COND : | |
1074 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 1, 32, total_length, pc, & fields->f_cond); | |
1075 | break; | |
1076 | case FRV_OPERAND_D12 : | |
1077 | length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 12, 32, total_length, pc, & fields->f_d12); | |
1078 | break; | |
1079 | case FRV_OPERAND_DEBUG : | |
1080 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_debug); | |
1081 | break; | |
1082 | case FRV_OPERAND_EIR : | |
1083 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_eir); | |
1084 | break; | |
1085 | case FRV_OPERAND_HINT : | |
1086 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 2, 32, total_length, pc, & fields->f_hint); | |
1087 | break; | |
1088 | case FRV_OPERAND_HINT_NOT_TAKEN : | |
1089 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 2, 32, total_length, pc, & fields->f_hint); | |
1090 | break; | |
1091 | case FRV_OPERAND_HINT_TAKEN : | |
1092 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 2, 32, total_length, pc, & fields->f_hint); | |
1093 | break; | |
1094 | case FRV_OPERAND_LABEL16 : | |
1095 | { | |
1096 | long value; | |
1097 | length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 15, 16, 32, total_length, pc, & value); | |
b2b1453a | 1098 | value = ((((value) * (4))) + (pc)); |
fd3c93d5 DB |
1099 | fields->f_label16 = value; |
1100 | } | |
1101 | break; | |
1102 | case FRV_OPERAND_LABEL24 : | |
1103 | { | |
1104 | length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 30, 6, 32, total_length, pc, & fields->f_labelH6); | |
1105 | if (length <= 0) break; | |
1106 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 18, 32, total_length, pc, & fields->f_labelL18); | |
1107 | if (length <= 0) break; | |
1108 | { | |
b2b1453a | 1109 | FLD (f_label24) = ((((((((FLD (f_labelH6)) * (((1) << (18))))) | (FLD (f_labelL18)))) * (4))) + (pc)); |
fd3c93d5 DB |
1110 | } |
1111 | } | |
1112 | break; | |
90219bd0 AO |
1113 | case FRV_OPERAND_LDANN : |
1114 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 0, 32, total_length, pc, & fields->f_reloc_ann); | |
1115 | break; | |
1116 | case FRV_OPERAND_LDDANN : | |
1117 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 0, 32, total_length, pc, & fields->f_reloc_ann); | |
1118 | break; | |
fd3c93d5 DB |
1119 | case FRV_OPERAND_LOCK : |
1120 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_lock); | |
1121 | break; | |
1122 | case FRV_OPERAND_PACK : | |
1123 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 31, 1, 32, total_length, pc, & fields->f_pack); | |
1124 | break; | |
1125 | case FRV_OPERAND_S10 : | |
1126 | length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 9, 10, 32, total_length, pc, & fields->f_s10); | |
1127 | break; | |
1128 | case FRV_OPERAND_S12 : | |
1129 | length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 12, 32, total_length, pc, & fields->f_d12); | |
1130 | break; | |
1131 | case FRV_OPERAND_S16 : | |
1132 | length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 15, 16, 32, total_length, pc, & fields->f_s16); | |
1133 | break; | |
1134 | case FRV_OPERAND_S5 : | |
1135 | length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 4, 5, 32, total_length, pc, & fields->f_s5); | |
1136 | break; | |
1137 | case FRV_OPERAND_S6 : | |
1138 | length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 5, 6, 32, total_length, pc, & fields->f_s6); | |
1139 | break; | |
1140 | case FRV_OPERAND_S6_1 : | |
1141 | length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 6, 32, total_length, pc, & fields->f_s6_1); | |
1142 | break; | |
1143 | case FRV_OPERAND_SLO16 : | |
1144 | length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 15, 16, 32, total_length, pc, & fields->f_s16); | |
1145 | break; | |
1146 | case FRV_OPERAND_SPR : | |
1147 | { | |
1148 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_spr_h); | |
1149 | if (length <= 0) break; | |
1150 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_spr_l); | |
1151 | if (length <= 0) break; | |
1152 | { | |
1153 | FLD (f_spr) = ((((FLD (f_spr_h)) << (6))) | (FLD (f_spr_l))); | |
1154 | } | |
1155 | } | |
1156 | break; | |
1157 | case FRV_OPERAND_U12 : | |
1158 | { | |
1159 | length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 17, 6, 32, total_length, pc, & fields->f_u12_h); | |
1160 | if (length <= 0) break; | |
1161 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_u12_l); | |
1162 | if (length <= 0) break; | |
1163 | { | |
b2b1453a | 1164 | FLD (f_u12) = ((((FLD (f_u12_h)) * (64))) | (FLD (f_u12_l))); |
fd3c93d5 DB |
1165 | } |
1166 | } | |
1167 | break; | |
1168 | case FRV_OPERAND_U16 : | |
1169 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 16, 32, total_length, pc, & fields->f_u16); | |
1170 | break; | |
1171 | case FRV_OPERAND_U6 : | |
1172 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_u6); | |
1173 | break; | |
1174 | case FRV_OPERAND_UHI16 : | |
1175 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 16, 32, total_length, pc, & fields->f_u16); | |
1176 | break; | |
1177 | case FRV_OPERAND_ULO16 : | |
1178 | length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 16, 32, total_length, pc, & fields->f_u16); | |
1179 | break; | |
1180 | ||
1181 | default : | |
1182 | /* xgettext:c-format */ | |
a6743a54 AM |
1183 | opcodes_error_handler |
1184 | (_("internal error: unrecognized field %d while decoding insn"), | |
1185 | opindex); | |
fd3c93d5 DB |
1186 | abort (); |
1187 | } | |
1188 | ||
1189 | return length; | |
1190 | } | |
1191 | ||
43e65147 | 1192 | cgen_insert_fn * const frv_cgen_insert_handlers[] = |
fd3c93d5 DB |
1193 | { |
1194 | insert_insn_normal, | |
1195 | }; | |
1196 | ||
43e65147 | 1197 | cgen_extract_fn * const frv_cgen_extract_handlers[] = |
fd3c93d5 DB |
1198 | { |
1199 | extract_insn_normal, | |
1200 | }; | |
1201 | ||
47b0e7ad NC |
1202 | int frv_cgen_get_int_operand (CGEN_CPU_DESC, int, const CGEN_FIELDS *); |
1203 | bfd_vma frv_cgen_get_vma_operand (CGEN_CPU_DESC, int, const CGEN_FIELDS *); | |
fd3c93d5 DB |
1204 | |
1205 | /* Getting values from cgen_fields is handled by a collection of functions. | |
1206 | They are distinguished by the type of the VALUE argument they return. | |
1207 | TODO: floating point, inlining support, remove cases where result type | |
1208 | not appropriate. */ | |
1209 | ||
1210 | int | |
47b0e7ad NC |
1211 | frv_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, |
1212 | int opindex, | |
1213 | const CGEN_FIELDS * fields) | |
fd3c93d5 DB |
1214 | { |
1215 | int value; | |
1216 | ||
1217 | switch (opindex) | |
1218 | { | |
ecd51ad3 DB |
1219 | case FRV_OPERAND_A0 : |
1220 | value = fields->f_A; | |
1221 | break; | |
1222 | case FRV_OPERAND_A1 : | |
fd3c93d5 DB |
1223 | value = fields->f_A; |
1224 | break; | |
1225 | case FRV_OPERAND_ACC40SI : | |
1226 | value = fields->f_ACC40Si; | |
1227 | break; | |
1228 | case FRV_OPERAND_ACC40SK : | |
1229 | value = fields->f_ACC40Sk; | |
1230 | break; | |
1231 | case FRV_OPERAND_ACC40UI : | |
1232 | value = fields->f_ACC40Ui; | |
1233 | break; | |
1234 | case FRV_OPERAND_ACC40UK : | |
1235 | value = fields->f_ACC40Uk; | |
1236 | break; | |
1237 | case FRV_OPERAND_ACCGI : | |
1238 | value = fields->f_ACCGi; | |
1239 | break; | |
1240 | case FRV_OPERAND_ACCGK : | |
1241 | value = fields->f_ACCGk; | |
1242 | break; | |
1243 | case FRV_OPERAND_CCI : | |
1244 | value = fields->f_CCi; | |
1245 | break; | |
1246 | case FRV_OPERAND_CPRDOUBLEK : | |
1247 | value = fields->f_CPRk; | |
1248 | break; | |
1249 | case FRV_OPERAND_CPRI : | |
1250 | value = fields->f_CPRi; | |
1251 | break; | |
1252 | case FRV_OPERAND_CPRJ : | |
1253 | value = fields->f_CPRj; | |
1254 | break; | |
1255 | case FRV_OPERAND_CPRK : | |
1256 | value = fields->f_CPRk; | |
1257 | break; | |
1258 | case FRV_OPERAND_CRI : | |
1259 | value = fields->f_CRi; | |
1260 | break; | |
1261 | case FRV_OPERAND_CRJ : | |
1262 | value = fields->f_CRj; | |
1263 | break; | |
1264 | case FRV_OPERAND_CRJ_FLOAT : | |
1265 | value = fields->f_CRj_float; | |
1266 | break; | |
1267 | case FRV_OPERAND_CRJ_INT : | |
1268 | value = fields->f_CRj_int; | |
1269 | break; | |
1270 | case FRV_OPERAND_CRK : | |
1271 | value = fields->f_CRk; | |
1272 | break; | |
1273 | case FRV_OPERAND_FCCI_1 : | |
1274 | value = fields->f_FCCi_1; | |
1275 | break; | |
1276 | case FRV_OPERAND_FCCI_2 : | |
1277 | value = fields->f_FCCi_2; | |
1278 | break; | |
1279 | case FRV_OPERAND_FCCI_3 : | |
1280 | value = fields->f_FCCi_3; | |
1281 | break; | |
1282 | case FRV_OPERAND_FCCK : | |
1283 | value = fields->f_FCCk; | |
1284 | break; | |
1285 | case FRV_OPERAND_FRDOUBLEI : | |
1286 | value = fields->f_FRi; | |
1287 | break; | |
1288 | case FRV_OPERAND_FRDOUBLEJ : | |
1289 | value = fields->f_FRj; | |
1290 | break; | |
1291 | case FRV_OPERAND_FRDOUBLEK : | |
1292 | value = fields->f_FRk; | |
1293 | break; | |
1294 | case FRV_OPERAND_FRI : | |
1295 | value = fields->f_FRi; | |
1296 | break; | |
1297 | case FRV_OPERAND_FRINTI : | |
1298 | value = fields->f_FRi; | |
1299 | break; | |
36c3ae24 NC |
1300 | case FRV_OPERAND_FRINTIEVEN : |
1301 | value = fields->f_FRi; | |
1302 | break; | |
fd3c93d5 DB |
1303 | case FRV_OPERAND_FRINTJ : |
1304 | value = fields->f_FRj; | |
1305 | break; | |
36c3ae24 NC |
1306 | case FRV_OPERAND_FRINTJEVEN : |
1307 | value = fields->f_FRj; | |
1308 | break; | |
fd3c93d5 DB |
1309 | case FRV_OPERAND_FRINTK : |
1310 | value = fields->f_FRk; | |
1311 | break; | |
36c3ae24 NC |
1312 | case FRV_OPERAND_FRINTKEVEN : |
1313 | value = fields->f_FRk; | |
1314 | break; | |
fd3c93d5 DB |
1315 | case FRV_OPERAND_FRJ : |
1316 | value = fields->f_FRj; | |
1317 | break; | |
1318 | case FRV_OPERAND_FRK : | |
1319 | value = fields->f_FRk; | |
1320 | break; | |
1321 | case FRV_OPERAND_FRKHI : | |
1322 | value = fields->f_FRk; | |
1323 | break; | |
1324 | case FRV_OPERAND_FRKLO : | |
1325 | value = fields->f_FRk; | |
1326 | break; | |
1327 | case FRV_OPERAND_GRDOUBLEK : | |
1328 | value = fields->f_GRk; | |
1329 | break; | |
1330 | case FRV_OPERAND_GRI : | |
1331 | value = fields->f_GRi; | |
1332 | break; | |
1333 | case FRV_OPERAND_GRJ : | |
1334 | value = fields->f_GRj; | |
1335 | break; | |
1336 | case FRV_OPERAND_GRK : | |
1337 | value = fields->f_GRk; | |
1338 | break; | |
1339 | case FRV_OPERAND_GRKHI : | |
1340 | value = fields->f_GRk; | |
1341 | break; | |
1342 | case FRV_OPERAND_GRKLO : | |
1343 | value = fields->f_GRk; | |
1344 | break; | |
1345 | case FRV_OPERAND_ICCI_1 : | |
1346 | value = fields->f_ICCi_1; | |
1347 | break; | |
1348 | case FRV_OPERAND_ICCI_2 : | |
1349 | value = fields->f_ICCi_2; | |
1350 | break; | |
1351 | case FRV_OPERAND_ICCI_3 : | |
1352 | value = fields->f_ICCi_3; | |
1353 | break; | |
1354 | case FRV_OPERAND_LI : | |
1355 | value = fields->f_LI; | |
1356 | break; | |
676a64f4 RS |
1357 | case FRV_OPERAND_LRAD : |
1358 | value = fields->f_LRAD; | |
1359 | break; | |
1360 | case FRV_OPERAND_LRAE : | |
1361 | value = fields->f_LRAE; | |
1362 | break; | |
1363 | case FRV_OPERAND_LRAS : | |
1364 | value = fields->f_LRAS; | |
1365 | break; | |
1366 | case FRV_OPERAND_TLBPRL : | |
1367 | value = fields->f_TLBPRL; | |
1368 | break; | |
1369 | case FRV_OPERAND_TLBPROPX : | |
1370 | value = fields->f_TLBPRopx; | |
1371 | break; | |
fd3c93d5 DB |
1372 | case FRV_OPERAND_AE : |
1373 | value = fields->f_ae; | |
1374 | break; | |
90219bd0 AO |
1375 | case FRV_OPERAND_CALLANN : |
1376 | value = fields->f_reloc_ann; | |
1377 | break; | |
fd3c93d5 DB |
1378 | case FRV_OPERAND_CCOND : |
1379 | value = fields->f_ccond; | |
1380 | break; | |
1381 | case FRV_OPERAND_COND : | |
1382 | value = fields->f_cond; | |
1383 | break; | |
1384 | case FRV_OPERAND_D12 : | |
1385 | value = fields->f_d12; | |
1386 | break; | |
1387 | case FRV_OPERAND_DEBUG : | |
1388 | value = fields->f_debug; | |
1389 | break; | |
1390 | case FRV_OPERAND_EIR : | |
1391 | value = fields->f_eir; | |
1392 | break; | |
1393 | case FRV_OPERAND_HINT : | |
1394 | value = fields->f_hint; | |
1395 | break; | |
1396 | case FRV_OPERAND_HINT_NOT_TAKEN : | |
1397 | value = fields->f_hint; | |
1398 | break; | |
1399 | case FRV_OPERAND_HINT_TAKEN : | |
1400 | value = fields->f_hint; | |
1401 | break; | |
1402 | case FRV_OPERAND_LABEL16 : | |
1403 | value = fields->f_label16; | |
1404 | break; | |
1405 | case FRV_OPERAND_LABEL24 : | |
1406 | value = fields->f_label24; | |
1407 | break; | |
90219bd0 AO |
1408 | case FRV_OPERAND_LDANN : |
1409 | value = fields->f_reloc_ann; | |
1410 | break; | |
1411 | case FRV_OPERAND_LDDANN : | |
1412 | value = fields->f_reloc_ann; | |
1413 | break; | |
fd3c93d5 DB |
1414 | case FRV_OPERAND_LOCK : |
1415 | value = fields->f_lock; | |
1416 | break; | |
1417 | case FRV_OPERAND_PACK : | |
1418 | value = fields->f_pack; | |
1419 | break; | |
1420 | case FRV_OPERAND_S10 : | |
1421 | value = fields->f_s10; | |
1422 | break; | |
1423 | case FRV_OPERAND_S12 : | |
1424 | value = fields->f_d12; | |
1425 | break; | |
1426 | case FRV_OPERAND_S16 : | |
1427 | value = fields->f_s16; | |
1428 | break; | |
1429 | case FRV_OPERAND_S5 : | |
1430 | value = fields->f_s5; | |
1431 | break; | |
1432 | case FRV_OPERAND_S6 : | |
1433 | value = fields->f_s6; | |
1434 | break; | |
1435 | case FRV_OPERAND_S6_1 : | |
1436 | value = fields->f_s6_1; | |
1437 | break; | |
1438 | case FRV_OPERAND_SLO16 : | |
1439 | value = fields->f_s16; | |
1440 | break; | |
1441 | case FRV_OPERAND_SPR : | |
1442 | value = fields->f_spr; | |
1443 | break; | |
1444 | case FRV_OPERAND_U12 : | |
1445 | value = fields->f_u12; | |
1446 | break; | |
1447 | case FRV_OPERAND_U16 : | |
1448 | value = fields->f_u16; | |
1449 | break; | |
1450 | case FRV_OPERAND_U6 : | |
1451 | value = fields->f_u6; | |
1452 | break; | |
1453 | case FRV_OPERAND_UHI16 : | |
1454 | value = fields->f_u16; | |
1455 | break; | |
1456 | case FRV_OPERAND_ULO16 : | |
1457 | value = fields->f_u16; | |
1458 | break; | |
1459 | ||
1460 | default : | |
1461 | /* xgettext:c-format */ | |
a6743a54 AM |
1462 | opcodes_error_handler |
1463 | (_("internal error: unrecognized field %d while getting int operand"), | |
1464 | opindex); | |
fd3c93d5 DB |
1465 | abort (); |
1466 | } | |
1467 | ||
1468 | return value; | |
1469 | } | |
1470 | ||
1471 | bfd_vma | |
47b0e7ad NC |
1472 | frv_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, |
1473 | int opindex, | |
1474 | const CGEN_FIELDS * fields) | |
fd3c93d5 DB |
1475 | { |
1476 | bfd_vma value; | |
1477 | ||
1478 | switch (opindex) | |
1479 | { | |
ecd51ad3 DB |
1480 | case FRV_OPERAND_A0 : |
1481 | value = fields->f_A; | |
1482 | break; | |
1483 | case FRV_OPERAND_A1 : | |
fd3c93d5 DB |
1484 | value = fields->f_A; |
1485 | break; | |
1486 | case FRV_OPERAND_ACC40SI : | |
1487 | value = fields->f_ACC40Si; | |
1488 | break; | |
1489 | case FRV_OPERAND_ACC40SK : | |
1490 | value = fields->f_ACC40Sk; | |
1491 | break; | |
1492 | case FRV_OPERAND_ACC40UI : | |
1493 | value = fields->f_ACC40Ui; | |
1494 | break; | |
1495 | case FRV_OPERAND_ACC40UK : | |
1496 | value = fields->f_ACC40Uk; | |
1497 | break; | |
1498 | case FRV_OPERAND_ACCGI : | |
1499 | value = fields->f_ACCGi; | |
1500 | break; | |
1501 | case FRV_OPERAND_ACCGK : | |
1502 | value = fields->f_ACCGk; | |
1503 | break; | |
1504 | case FRV_OPERAND_CCI : | |
1505 | value = fields->f_CCi; | |
1506 | break; | |
1507 | case FRV_OPERAND_CPRDOUBLEK : | |
1508 | value = fields->f_CPRk; | |
1509 | break; | |
1510 | case FRV_OPERAND_CPRI : | |
1511 | value = fields->f_CPRi; | |
1512 | break; | |
1513 | case FRV_OPERAND_CPRJ : | |
1514 | value = fields->f_CPRj; | |
1515 | break; | |
1516 | case FRV_OPERAND_CPRK : | |
1517 | value = fields->f_CPRk; | |
1518 | break; | |
1519 | case FRV_OPERAND_CRI : | |
1520 | value = fields->f_CRi; | |
1521 | break; | |
1522 | case FRV_OPERAND_CRJ : | |
1523 | value = fields->f_CRj; | |
1524 | break; | |
1525 | case FRV_OPERAND_CRJ_FLOAT : | |
1526 | value = fields->f_CRj_float; | |
1527 | break; | |
1528 | case FRV_OPERAND_CRJ_INT : | |
1529 | value = fields->f_CRj_int; | |
1530 | break; | |
1531 | case FRV_OPERAND_CRK : | |
1532 | value = fields->f_CRk; | |
1533 | break; | |
1534 | case FRV_OPERAND_FCCI_1 : | |
1535 | value = fields->f_FCCi_1; | |
1536 | break; | |
1537 | case FRV_OPERAND_FCCI_2 : | |
1538 | value = fields->f_FCCi_2; | |
1539 | break; | |
1540 | case FRV_OPERAND_FCCI_3 : | |
1541 | value = fields->f_FCCi_3; | |
1542 | break; | |
1543 | case FRV_OPERAND_FCCK : | |
1544 | value = fields->f_FCCk; | |
1545 | break; | |
1546 | case FRV_OPERAND_FRDOUBLEI : | |
1547 | value = fields->f_FRi; | |
1548 | break; | |
1549 | case FRV_OPERAND_FRDOUBLEJ : | |
1550 | value = fields->f_FRj; | |
1551 | break; | |
1552 | case FRV_OPERAND_FRDOUBLEK : | |
1553 | value = fields->f_FRk; | |
1554 | break; | |
1555 | case FRV_OPERAND_FRI : | |
1556 | value = fields->f_FRi; | |
1557 | break; | |
1558 | case FRV_OPERAND_FRINTI : | |
1559 | value = fields->f_FRi; | |
1560 | break; | |
36c3ae24 NC |
1561 | case FRV_OPERAND_FRINTIEVEN : |
1562 | value = fields->f_FRi; | |
1563 | break; | |
fd3c93d5 DB |
1564 | case FRV_OPERAND_FRINTJ : |
1565 | value = fields->f_FRj; | |
1566 | break; | |
36c3ae24 NC |
1567 | case FRV_OPERAND_FRINTJEVEN : |
1568 | value = fields->f_FRj; | |
1569 | break; | |
fd3c93d5 DB |
1570 | case FRV_OPERAND_FRINTK : |
1571 | value = fields->f_FRk; | |
1572 | break; | |
36c3ae24 NC |
1573 | case FRV_OPERAND_FRINTKEVEN : |
1574 | value = fields->f_FRk; | |
1575 | break; | |
fd3c93d5 DB |
1576 | case FRV_OPERAND_FRJ : |
1577 | value = fields->f_FRj; | |
1578 | break; | |
1579 | case FRV_OPERAND_FRK : | |
1580 | value = fields->f_FRk; | |
1581 | break; | |
1582 | case FRV_OPERAND_FRKHI : | |
1583 | value = fields->f_FRk; | |
1584 | break; | |
1585 | case FRV_OPERAND_FRKLO : | |
1586 | value = fields->f_FRk; | |
1587 | break; | |
1588 | case FRV_OPERAND_GRDOUBLEK : | |
1589 | value = fields->f_GRk; | |
1590 | break; | |
1591 | case FRV_OPERAND_GRI : | |
1592 | value = fields->f_GRi; | |
1593 | break; | |
1594 | case FRV_OPERAND_GRJ : | |
1595 | value = fields->f_GRj; | |
1596 | break; | |
1597 | case FRV_OPERAND_GRK : | |
1598 | value = fields->f_GRk; | |
1599 | break; | |
1600 | case FRV_OPERAND_GRKHI : | |
1601 | value = fields->f_GRk; | |
1602 | break; | |
1603 | case FRV_OPERAND_GRKLO : | |
1604 | value = fields->f_GRk; | |
1605 | break; | |
1606 | case FRV_OPERAND_ICCI_1 : | |
1607 | value = fields->f_ICCi_1; | |
1608 | break; | |
1609 | case FRV_OPERAND_ICCI_2 : | |
1610 | value = fields->f_ICCi_2; | |
1611 | break; | |
1612 | case FRV_OPERAND_ICCI_3 : | |
1613 | value = fields->f_ICCi_3; | |
1614 | break; | |
1615 | case FRV_OPERAND_LI : | |
1616 | value = fields->f_LI; | |
1617 | break; | |
676a64f4 RS |
1618 | case FRV_OPERAND_LRAD : |
1619 | value = fields->f_LRAD; | |
1620 | break; | |
1621 | case FRV_OPERAND_LRAE : | |
1622 | value = fields->f_LRAE; | |
1623 | break; | |
1624 | case FRV_OPERAND_LRAS : | |
1625 | value = fields->f_LRAS; | |
1626 | break; | |
1627 | case FRV_OPERAND_TLBPRL : | |
1628 | value = fields->f_TLBPRL; | |
1629 | break; | |
1630 | case FRV_OPERAND_TLBPROPX : | |
1631 | value = fields->f_TLBPRopx; | |
1632 | break; | |
fd3c93d5 DB |
1633 | case FRV_OPERAND_AE : |
1634 | value = fields->f_ae; | |
1635 | break; | |
90219bd0 AO |
1636 | case FRV_OPERAND_CALLANN : |
1637 | value = fields->f_reloc_ann; | |
1638 | break; | |
fd3c93d5 DB |
1639 | case FRV_OPERAND_CCOND : |
1640 | value = fields->f_ccond; | |
1641 | break; | |
1642 | case FRV_OPERAND_COND : | |
1643 | value = fields->f_cond; | |
1644 | break; | |
1645 | case FRV_OPERAND_D12 : | |
1646 | value = fields->f_d12; | |
1647 | break; | |
1648 | case FRV_OPERAND_DEBUG : | |
1649 | value = fields->f_debug; | |
1650 | break; | |
1651 | case FRV_OPERAND_EIR : | |
1652 | value = fields->f_eir; | |
1653 | break; | |
1654 | case FRV_OPERAND_HINT : | |
1655 | value = fields->f_hint; | |
1656 | break; | |
1657 | case FRV_OPERAND_HINT_NOT_TAKEN : | |
1658 | value = fields->f_hint; | |
1659 | break; | |
1660 | case FRV_OPERAND_HINT_TAKEN : | |
1661 | value = fields->f_hint; | |
1662 | break; | |
1663 | case FRV_OPERAND_LABEL16 : | |
1664 | value = fields->f_label16; | |
1665 | break; | |
1666 | case FRV_OPERAND_LABEL24 : | |
1667 | value = fields->f_label24; | |
1668 | break; | |
90219bd0 AO |
1669 | case FRV_OPERAND_LDANN : |
1670 | value = fields->f_reloc_ann; | |
1671 | break; | |
1672 | case FRV_OPERAND_LDDANN : | |
1673 | value = fields->f_reloc_ann; | |
1674 | break; | |
fd3c93d5 DB |
1675 | case FRV_OPERAND_LOCK : |
1676 | value = fields->f_lock; | |
1677 | break; | |
1678 | case FRV_OPERAND_PACK : | |
1679 | value = fields->f_pack; | |
1680 | break; | |
1681 | case FRV_OPERAND_S10 : | |
1682 | value = fields->f_s10; | |
1683 | break; | |
1684 | case FRV_OPERAND_S12 : | |
1685 | value = fields->f_d12; | |
1686 | break; | |
1687 | case FRV_OPERAND_S16 : | |
1688 | value = fields->f_s16; | |
1689 | break; | |
1690 | case FRV_OPERAND_S5 : | |
1691 | value = fields->f_s5; | |
1692 | break; | |
1693 | case FRV_OPERAND_S6 : | |
1694 | value = fields->f_s6; | |
1695 | break; | |
1696 | case FRV_OPERAND_S6_1 : | |
1697 | value = fields->f_s6_1; | |
1698 | break; | |
1699 | case FRV_OPERAND_SLO16 : | |
1700 | value = fields->f_s16; | |
1701 | break; | |
1702 | case FRV_OPERAND_SPR : | |
1703 | value = fields->f_spr; | |
1704 | break; | |
1705 | case FRV_OPERAND_U12 : | |
1706 | value = fields->f_u12; | |
1707 | break; | |
1708 | case FRV_OPERAND_U16 : | |
1709 | value = fields->f_u16; | |
1710 | break; | |
1711 | case FRV_OPERAND_U6 : | |
1712 | value = fields->f_u6; | |
1713 | break; | |
1714 | case FRV_OPERAND_UHI16 : | |
1715 | value = fields->f_u16; | |
1716 | break; | |
1717 | case FRV_OPERAND_ULO16 : | |
1718 | value = fields->f_u16; | |
1719 | break; | |
1720 | ||
1721 | default : | |
1722 | /* xgettext:c-format */ | |
a6743a54 AM |
1723 | opcodes_error_handler |
1724 | (_("internal error: unrecognized field %d while getting vma operand"), | |
1725 | opindex); | |
fd3c93d5 DB |
1726 | abort (); |
1727 | } | |
1728 | ||
1729 | return value; | |
1730 | } | |
1731 | ||
47b0e7ad NC |
1732 | void frv_cgen_set_int_operand (CGEN_CPU_DESC, int, CGEN_FIELDS *, int); |
1733 | void frv_cgen_set_vma_operand (CGEN_CPU_DESC, int, CGEN_FIELDS *, bfd_vma); | |
fd3c93d5 DB |
1734 | |
1735 | /* Stuffing values in cgen_fields is handled by a collection of functions. | |
1736 | They are distinguished by the type of the VALUE argument they accept. | |
1737 | TODO: floating point, inlining support, remove cases where argument type | |
1738 | not appropriate. */ | |
1739 | ||
1740 | void | |
47b0e7ad NC |
1741 | frv_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, |
1742 | int opindex, | |
1743 | CGEN_FIELDS * fields, | |
1744 | int value) | |
fd3c93d5 DB |
1745 | { |
1746 | switch (opindex) | |
1747 | { | |
ecd51ad3 DB |
1748 | case FRV_OPERAND_A0 : |
1749 | fields->f_A = value; | |
1750 | break; | |
1751 | case FRV_OPERAND_A1 : | |
fd3c93d5 DB |
1752 | fields->f_A = value; |
1753 | break; | |
1754 | case FRV_OPERAND_ACC40SI : | |
1755 | fields->f_ACC40Si = value; | |
1756 | break; | |
1757 | case FRV_OPERAND_ACC40SK : | |
1758 | fields->f_ACC40Sk = value; | |
1759 | break; | |
1760 | case FRV_OPERAND_ACC40UI : | |
1761 | fields->f_ACC40Ui = value; | |
1762 | break; | |
1763 | case FRV_OPERAND_ACC40UK : | |
1764 | fields->f_ACC40Uk = value; | |
1765 | break; | |
1766 | case FRV_OPERAND_ACCGI : | |
1767 | fields->f_ACCGi = value; | |
1768 | break; | |
1769 | case FRV_OPERAND_ACCGK : | |
1770 | fields->f_ACCGk = value; | |
1771 | break; | |
1772 | case FRV_OPERAND_CCI : | |
1773 | fields->f_CCi = value; | |
1774 | break; | |
1775 | case FRV_OPERAND_CPRDOUBLEK : | |
1776 | fields->f_CPRk = value; | |
1777 | break; | |
1778 | case FRV_OPERAND_CPRI : | |
1779 | fields->f_CPRi = value; | |
1780 | break; | |
1781 | case FRV_OPERAND_CPRJ : | |
1782 | fields->f_CPRj = value; | |
1783 | break; | |
1784 | case FRV_OPERAND_CPRK : | |
1785 | fields->f_CPRk = value; | |
1786 | break; | |
1787 | case FRV_OPERAND_CRI : | |
1788 | fields->f_CRi = value; | |
1789 | break; | |
1790 | case FRV_OPERAND_CRJ : | |
1791 | fields->f_CRj = value; | |
1792 | break; | |
1793 | case FRV_OPERAND_CRJ_FLOAT : | |
1794 | fields->f_CRj_float = value; | |
1795 | break; | |
1796 | case FRV_OPERAND_CRJ_INT : | |
1797 | fields->f_CRj_int = value; | |
1798 | break; | |
1799 | case FRV_OPERAND_CRK : | |
1800 | fields->f_CRk = value; | |
1801 | break; | |
1802 | case FRV_OPERAND_FCCI_1 : | |
1803 | fields->f_FCCi_1 = value; | |
1804 | break; | |
1805 | case FRV_OPERAND_FCCI_2 : | |
1806 | fields->f_FCCi_2 = value; | |
1807 | break; | |
1808 | case FRV_OPERAND_FCCI_3 : | |
1809 | fields->f_FCCi_3 = value; | |
1810 | break; | |
1811 | case FRV_OPERAND_FCCK : | |
1812 | fields->f_FCCk = value; | |
1813 | break; | |
1814 | case FRV_OPERAND_FRDOUBLEI : | |
1815 | fields->f_FRi = value; | |
1816 | break; | |
1817 | case FRV_OPERAND_FRDOUBLEJ : | |
1818 | fields->f_FRj = value; | |
1819 | break; | |
1820 | case FRV_OPERAND_FRDOUBLEK : | |
1821 | fields->f_FRk = value; | |
1822 | break; | |
1823 | case FRV_OPERAND_FRI : | |
1824 | fields->f_FRi = value; | |
1825 | break; | |
1826 | case FRV_OPERAND_FRINTI : | |
1827 | fields->f_FRi = value; | |
1828 | break; | |
36c3ae24 NC |
1829 | case FRV_OPERAND_FRINTIEVEN : |
1830 | fields->f_FRi = value; | |
1831 | break; | |
fd3c93d5 DB |
1832 | case FRV_OPERAND_FRINTJ : |
1833 | fields->f_FRj = value; | |
1834 | break; | |
36c3ae24 NC |
1835 | case FRV_OPERAND_FRINTJEVEN : |
1836 | fields->f_FRj = value; | |
1837 | break; | |
fd3c93d5 DB |
1838 | case FRV_OPERAND_FRINTK : |
1839 | fields->f_FRk = value; | |
1840 | break; | |
36c3ae24 NC |
1841 | case FRV_OPERAND_FRINTKEVEN : |
1842 | fields->f_FRk = value; | |
1843 | break; | |
fd3c93d5 DB |
1844 | case FRV_OPERAND_FRJ : |
1845 | fields->f_FRj = value; | |
1846 | break; | |
1847 | case FRV_OPERAND_FRK : | |
1848 | fields->f_FRk = value; | |
1849 | break; | |
1850 | case FRV_OPERAND_FRKHI : | |
1851 | fields->f_FRk = value; | |
1852 | break; | |
1853 | case FRV_OPERAND_FRKLO : | |
1854 | fields->f_FRk = value; | |
1855 | break; | |
1856 | case FRV_OPERAND_GRDOUBLEK : | |
1857 | fields->f_GRk = value; | |
1858 | break; | |
1859 | case FRV_OPERAND_GRI : | |
1860 | fields->f_GRi = value; | |
1861 | break; | |
1862 | case FRV_OPERAND_GRJ : | |
1863 | fields->f_GRj = value; | |
1864 | break; | |
1865 | case FRV_OPERAND_GRK : | |
1866 | fields->f_GRk = value; | |
1867 | break; | |
1868 | case FRV_OPERAND_GRKHI : | |
1869 | fields->f_GRk = value; | |
1870 | break; | |
1871 | case FRV_OPERAND_GRKLO : | |
1872 | fields->f_GRk = value; | |
1873 | break; | |
1874 | case FRV_OPERAND_ICCI_1 : | |
1875 | fields->f_ICCi_1 = value; | |
1876 | break; | |
1877 | case FRV_OPERAND_ICCI_2 : | |
1878 | fields->f_ICCi_2 = value; | |
1879 | break; | |
1880 | case FRV_OPERAND_ICCI_3 : | |
1881 | fields->f_ICCi_3 = value; | |
1882 | break; | |
1883 | case FRV_OPERAND_LI : | |
1884 | fields->f_LI = value; | |
1885 | break; | |
676a64f4 RS |
1886 | case FRV_OPERAND_LRAD : |
1887 | fields->f_LRAD = value; | |
1888 | break; | |
1889 | case FRV_OPERAND_LRAE : | |
1890 | fields->f_LRAE = value; | |
1891 | break; | |
1892 | case FRV_OPERAND_LRAS : | |
1893 | fields->f_LRAS = value; | |
1894 | break; | |
1895 | case FRV_OPERAND_TLBPRL : | |
1896 | fields->f_TLBPRL = value; | |
1897 | break; | |
1898 | case FRV_OPERAND_TLBPROPX : | |
1899 | fields->f_TLBPRopx = value; | |
1900 | break; | |
fd3c93d5 DB |
1901 | case FRV_OPERAND_AE : |
1902 | fields->f_ae = value; | |
1903 | break; | |
90219bd0 AO |
1904 | case FRV_OPERAND_CALLANN : |
1905 | fields->f_reloc_ann = value; | |
1906 | break; | |
fd3c93d5 DB |
1907 | case FRV_OPERAND_CCOND : |
1908 | fields->f_ccond = value; | |
1909 | break; | |
1910 | case FRV_OPERAND_COND : | |
1911 | fields->f_cond = value; | |
1912 | break; | |
1913 | case FRV_OPERAND_D12 : | |
1914 | fields->f_d12 = value; | |
1915 | break; | |
1916 | case FRV_OPERAND_DEBUG : | |
1917 | fields->f_debug = value; | |
1918 | break; | |
1919 | case FRV_OPERAND_EIR : | |
1920 | fields->f_eir = value; | |
1921 | break; | |
1922 | case FRV_OPERAND_HINT : | |
1923 | fields->f_hint = value; | |
1924 | break; | |
1925 | case FRV_OPERAND_HINT_NOT_TAKEN : | |
1926 | fields->f_hint = value; | |
1927 | break; | |
1928 | case FRV_OPERAND_HINT_TAKEN : | |
1929 | fields->f_hint = value; | |
1930 | break; | |
1931 | case FRV_OPERAND_LABEL16 : | |
1932 | fields->f_label16 = value; | |
1933 | break; | |
1934 | case FRV_OPERAND_LABEL24 : | |
1935 | fields->f_label24 = value; | |
1936 | break; | |
90219bd0 AO |
1937 | case FRV_OPERAND_LDANN : |
1938 | fields->f_reloc_ann = value; | |
1939 | break; | |
1940 | case FRV_OPERAND_LDDANN : | |
1941 | fields->f_reloc_ann = value; | |
1942 | break; | |
fd3c93d5 DB |
1943 | case FRV_OPERAND_LOCK : |
1944 | fields->f_lock = value; | |
1945 | break; | |
1946 | case FRV_OPERAND_PACK : | |
1947 | fields->f_pack = value; | |
1948 | break; | |
1949 | case FRV_OPERAND_S10 : | |
1950 | fields->f_s10 = value; | |
1951 | break; | |
1952 | case FRV_OPERAND_S12 : | |
1953 | fields->f_d12 = value; | |
1954 | break; | |
1955 | case FRV_OPERAND_S16 : | |
1956 | fields->f_s16 = value; | |
1957 | break; | |
1958 | case FRV_OPERAND_S5 : | |
1959 | fields->f_s5 = value; | |
1960 | break; | |
1961 | case FRV_OPERAND_S6 : | |
1962 | fields->f_s6 = value; | |
1963 | break; | |
1964 | case FRV_OPERAND_S6_1 : | |
1965 | fields->f_s6_1 = value; | |
1966 | break; | |
1967 | case FRV_OPERAND_SLO16 : | |
1968 | fields->f_s16 = value; | |
1969 | break; | |
1970 | case FRV_OPERAND_SPR : | |
1971 | fields->f_spr = value; | |
1972 | break; | |
1973 | case FRV_OPERAND_U12 : | |
1974 | fields->f_u12 = value; | |
1975 | break; | |
1976 | case FRV_OPERAND_U16 : | |
1977 | fields->f_u16 = value; | |
1978 | break; | |
1979 | case FRV_OPERAND_U6 : | |
1980 | fields->f_u6 = value; | |
1981 | break; | |
1982 | case FRV_OPERAND_UHI16 : | |
1983 | fields->f_u16 = value; | |
1984 | break; | |
1985 | case FRV_OPERAND_ULO16 : | |
1986 | fields->f_u16 = value; | |
1987 | break; | |
1988 | ||
1989 | default : | |
1990 | /* xgettext:c-format */ | |
a6743a54 AM |
1991 | opcodes_error_handler |
1992 | (_("internal error: unrecognized field %d while setting int operand"), | |
1993 | opindex); | |
fd3c93d5 DB |
1994 | abort (); |
1995 | } | |
1996 | } | |
1997 | ||
1998 | void | |
47b0e7ad NC |
1999 | frv_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, |
2000 | int opindex, | |
2001 | CGEN_FIELDS * fields, | |
2002 | bfd_vma value) | |
fd3c93d5 DB |
2003 | { |
2004 | switch (opindex) | |
2005 | { | |
ecd51ad3 DB |
2006 | case FRV_OPERAND_A0 : |
2007 | fields->f_A = value; | |
2008 | break; | |
2009 | case FRV_OPERAND_A1 : | |
fd3c93d5 DB |
2010 | fields->f_A = value; |
2011 | break; | |
2012 | case FRV_OPERAND_ACC40SI : | |
2013 | fields->f_ACC40Si = value; | |
2014 | break; | |
2015 | case FRV_OPERAND_ACC40SK : | |
2016 | fields->f_ACC40Sk = value; | |
2017 | break; | |
2018 | case FRV_OPERAND_ACC40UI : | |
2019 | fields->f_ACC40Ui = value; | |
2020 | break; | |
2021 | case FRV_OPERAND_ACC40UK : | |
2022 | fields->f_ACC40Uk = value; | |
2023 | break; | |
2024 | case FRV_OPERAND_ACCGI : | |
2025 | fields->f_ACCGi = value; | |
2026 | break; | |
2027 | case FRV_OPERAND_ACCGK : | |
2028 | fields->f_ACCGk = value; | |
2029 | break; | |
2030 | case FRV_OPERAND_CCI : | |
2031 | fields->f_CCi = value; | |
2032 | break; | |
2033 | case FRV_OPERAND_CPRDOUBLEK : | |
2034 | fields->f_CPRk = value; | |
2035 | break; | |
2036 | case FRV_OPERAND_CPRI : | |
2037 | fields->f_CPRi = value; | |
2038 | break; | |
2039 | case FRV_OPERAND_CPRJ : | |
2040 | fields->f_CPRj = value; | |
2041 | break; | |
2042 | case FRV_OPERAND_CPRK : | |
2043 | fields->f_CPRk = value; | |
2044 | break; | |
2045 | case FRV_OPERAND_CRI : | |
2046 | fields->f_CRi = value; | |
2047 | break; | |
2048 | case FRV_OPERAND_CRJ : | |
2049 | fields->f_CRj = value; | |
2050 | break; | |
2051 | case FRV_OPERAND_CRJ_FLOAT : | |
2052 | fields->f_CRj_float = value; | |
2053 | break; | |
2054 | case FRV_OPERAND_CRJ_INT : | |
2055 | fields->f_CRj_int = value; | |
2056 | break; | |
2057 | case FRV_OPERAND_CRK : | |
2058 | fields->f_CRk = value; | |
2059 | break; | |
2060 | case FRV_OPERAND_FCCI_1 : | |
2061 | fields->f_FCCi_1 = value; | |
2062 | break; | |
2063 | case FRV_OPERAND_FCCI_2 : | |
2064 | fields->f_FCCi_2 = value; | |
2065 | break; | |
2066 | case FRV_OPERAND_FCCI_3 : | |
2067 | fields->f_FCCi_3 = value; | |
2068 | break; | |
2069 | case FRV_OPERAND_FCCK : | |
2070 | fields->f_FCCk = value; | |
2071 | break; | |
2072 | case FRV_OPERAND_FRDOUBLEI : | |
2073 | fields->f_FRi = value; | |
2074 | break; | |
2075 | case FRV_OPERAND_FRDOUBLEJ : | |
2076 | fields->f_FRj = value; | |
2077 | break; | |
2078 | case FRV_OPERAND_FRDOUBLEK : | |
2079 | fields->f_FRk = value; | |
2080 | break; | |
2081 | case FRV_OPERAND_FRI : | |
2082 | fields->f_FRi = value; | |
2083 | break; | |
2084 | case FRV_OPERAND_FRINTI : | |
2085 | fields->f_FRi = value; | |
2086 | break; | |
36c3ae24 NC |
2087 | case FRV_OPERAND_FRINTIEVEN : |
2088 | fields->f_FRi = value; | |
2089 | break; | |
fd3c93d5 DB |
2090 | case FRV_OPERAND_FRINTJ : |
2091 | fields->f_FRj = value; | |
2092 | break; | |
36c3ae24 NC |
2093 | case FRV_OPERAND_FRINTJEVEN : |
2094 | fields->f_FRj = value; | |
2095 | break; | |
fd3c93d5 DB |
2096 | case FRV_OPERAND_FRINTK : |
2097 | fields->f_FRk = value; | |
2098 | break; | |
36c3ae24 NC |
2099 | case FRV_OPERAND_FRINTKEVEN : |
2100 | fields->f_FRk = value; | |
2101 | break; | |
fd3c93d5 DB |
2102 | case FRV_OPERAND_FRJ : |
2103 | fields->f_FRj = value; | |
2104 | break; | |
2105 | case FRV_OPERAND_FRK : | |
2106 | fields->f_FRk = value; | |
2107 | break; | |
2108 | case FRV_OPERAND_FRKHI : | |
2109 | fields->f_FRk = value; | |
2110 | break; | |
2111 | case FRV_OPERAND_FRKLO : | |
2112 | fields->f_FRk = value; | |
2113 | break; | |
2114 | case FRV_OPERAND_GRDOUBLEK : | |
2115 | fields->f_GRk = value; | |
2116 | break; | |
2117 | case FRV_OPERAND_GRI : | |
2118 | fields->f_GRi = value; | |
2119 | break; | |
2120 | case FRV_OPERAND_GRJ : | |
2121 | fields->f_GRj = value; | |
2122 | break; | |
2123 | case FRV_OPERAND_GRK : | |
2124 | fields->f_GRk = value; | |
2125 | break; | |
2126 | case FRV_OPERAND_GRKHI : | |
2127 | fields->f_GRk = value; | |
2128 | break; | |
2129 | case FRV_OPERAND_GRKLO : | |
2130 | fields->f_GRk = value; | |
2131 | break; | |
2132 | case FRV_OPERAND_ICCI_1 : | |
2133 | fields->f_ICCi_1 = value; | |
2134 | break; | |
2135 | case FRV_OPERAND_ICCI_2 : | |
2136 | fields->f_ICCi_2 = value; | |
2137 | break; | |
2138 | case FRV_OPERAND_ICCI_3 : | |
2139 | fields->f_ICCi_3 = value; | |
2140 | break; | |
2141 | case FRV_OPERAND_LI : | |
2142 | fields->f_LI = value; | |
2143 | break; | |
676a64f4 RS |
2144 | case FRV_OPERAND_LRAD : |
2145 | fields->f_LRAD = value; | |
2146 | break; | |
2147 | case FRV_OPERAND_LRAE : | |
2148 | fields->f_LRAE = value; | |
2149 | break; | |
2150 | case FRV_OPERAND_LRAS : | |
2151 | fields->f_LRAS = value; | |
2152 | break; | |
2153 | case FRV_OPERAND_TLBPRL : | |
2154 | fields->f_TLBPRL = value; | |
2155 | break; | |
2156 | case FRV_OPERAND_TLBPROPX : | |
2157 | fields->f_TLBPRopx = value; | |
2158 | break; | |
fd3c93d5 DB |
2159 | case FRV_OPERAND_AE : |
2160 | fields->f_ae = value; | |
2161 | break; | |
90219bd0 AO |
2162 | case FRV_OPERAND_CALLANN : |
2163 | fields->f_reloc_ann = value; | |
2164 | break; | |
fd3c93d5 DB |
2165 | case FRV_OPERAND_CCOND : |
2166 | fields->f_ccond = value; | |
2167 | break; | |
2168 | case FRV_OPERAND_COND : | |
2169 | fields->f_cond = value; | |
2170 | break; | |
2171 | case FRV_OPERAND_D12 : | |
2172 | fields->f_d12 = value; | |
2173 | break; | |
2174 | case FRV_OPERAND_DEBUG : | |
2175 | fields->f_debug = value; | |
2176 | break; | |
2177 | case FRV_OPERAND_EIR : | |
2178 | fields->f_eir = value; | |
2179 | break; | |
2180 | case FRV_OPERAND_HINT : | |
2181 | fields->f_hint = value; | |
2182 | break; | |
2183 | case FRV_OPERAND_HINT_NOT_TAKEN : | |
2184 | fields->f_hint = value; | |
2185 | break; | |
2186 | case FRV_OPERAND_HINT_TAKEN : | |
2187 | fields->f_hint = value; | |
2188 | break; | |
2189 | case FRV_OPERAND_LABEL16 : | |
2190 | fields->f_label16 = value; | |
2191 | break; | |
2192 | case FRV_OPERAND_LABEL24 : | |
2193 | fields->f_label24 = value; | |
2194 | break; | |
90219bd0 AO |
2195 | case FRV_OPERAND_LDANN : |
2196 | fields->f_reloc_ann = value; | |
2197 | break; | |
2198 | case FRV_OPERAND_LDDANN : | |
2199 | fields->f_reloc_ann = value; | |
2200 | break; | |
fd3c93d5 DB |
2201 | case FRV_OPERAND_LOCK : |
2202 | fields->f_lock = value; | |
2203 | break; | |
2204 | case FRV_OPERAND_PACK : | |
2205 | fields->f_pack = value; | |
2206 | break; | |
2207 | case FRV_OPERAND_S10 : | |
2208 | fields->f_s10 = value; | |
2209 | break; | |
2210 | case FRV_OPERAND_S12 : | |
2211 | fields->f_d12 = value; | |
2212 | break; | |
2213 | case FRV_OPERAND_S16 : | |
2214 | fields->f_s16 = value; | |
2215 | break; | |
2216 | case FRV_OPERAND_S5 : | |
2217 | fields->f_s5 = value; | |
2218 | break; | |
2219 | case FRV_OPERAND_S6 : | |
2220 | fields->f_s6 = value; | |
2221 | break; | |
2222 | case FRV_OPERAND_S6_1 : | |
2223 | fields->f_s6_1 = value; | |
2224 | break; | |
2225 | case FRV_OPERAND_SLO16 : | |
2226 | fields->f_s16 = value; | |
2227 | break; | |
2228 | case FRV_OPERAND_SPR : | |
2229 | fields->f_spr = value; | |
2230 | break; | |
2231 | case FRV_OPERAND_U12 : | |
2232 | fields->f_u12 = value; | |
2233 | break; | |
2234 | case FRV_OPERAND_U16 : | |
2235 | fields->f_u16 = value; | |
2236 | break; | |
2237 | case FRV_OPERAND_U6 : | |
2238 | fields->f_u6 = value; | |
2239 | break; | |
2240 | case FRV_OPERAND_UHI16 : | |
2241 | fields->f_u16 = value; | |
2242 | break; | |
2243 | case FRV_OPERAND_ULO16 : | |
2244 | fields->f_u16 = value; | |
2245 | break; | |
2246 | ||
2247 | default : | |
2248 | /* xgettext:c-format */ | |
a6743a54 AM |
2249 | opcodes_error_handler |
2250 | (_("internal error: unrecognized field %d while setting vma operand"), | |
2251 | opindex); | |
fd3c93d5 DB |
2252 | abort (); |
2253 | } | |
2254 | } | |
2255 | ||
2256 | /* Function to call before using the instruction builder tables. */ | |
2257 | ||
2258 | void | |
47b0e7ad | 2259 | frv_cgen_init_ibld_table (CGEN_CPU_DESC cd) |
fd3c93d5 DB |
2260 | { |
2261 | cd->insert_handlers = & frv_cgen_insert_handlers[0]; | |
2262 | cd->extract_handlers = & frv_cgen_extract_handlers[0]; | |
2263 | ||
2264 | cd->insert_operand = frv_cgen_insert_operand; | |
2265 | cd->extract_operand = frv_cgen_extract_operand; | |
2266 | ||
2267 | cd->get_int_operand = frv_cgen_get_int_operand; | |
2268 | cd->set_int_operand = frv_cgen_set_int_operand; | |
2269 | cd->get_vma_operand = frv_cgen_get_vma_operand; | |
2270 | cd->set_vma_operand = frv_cgen_set_vma_operand; | |
2271 | } |