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