[opcodes, ARM, 14/16] Add mode availability to coprocessor table entries
[binutils-gdb.git] / opcodes / frv-ibld.c
blob6dabd4fa005b6b4eba98adfca4bf6f98928d3fb1
1 /* DO NOT EDIT! -*- buffer-read-only: t -*- vi:set ro: */
2 /* Instruction building/extraction support for frv. -*- C -*-
4 THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator.
5 - the resultant file is machine generated, cgen-ibld.in isn't
7 Copyright (C) 1996-2019 Free Software Foundation, Inc.
9 This file is part of libopcodes.
11 This library is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3, or (at your option)
14 any later version.
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.
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. */
25 /* ??? Eventually more and more of this stuff can go to cpu-independent files.
26 Keep that in mind. */
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"
36 #include "cgen/basic-modes.h"
37 #include "opintl.h"
38 #include "safe-ctype.h"
40 #undef min
41 #define min(a,b) ((a) < (b) ? (a) : (b))
42 #undef max
43 #define max(a,b) ((a) > (b) ? (a) : (b))
45 /* Used by the ifield rtx function. */
46 #define FLD(f) (fields->f)
48 static const char * insert_normal
49 (CGEN_CPU_DESC, long, unsigned int, unsigned int, unsigned int,
50 unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR);
51 static const char * insert_insn_normal
52 (CGEN_CPU_DESC, const CGEN_INSN *,
53 CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma);
54 static int extract_normal
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 *);
58 static int extract_insn_normal
59 (CGEN_CPU_DESC, const CGEN_INSN *, CGEN_EXTRACT_INFO *,
60 CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma);
61 #if CGEN_INT_INSN_P
62 static void put_insn_int_value
63 (CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT);
64 #endif
65 #if ! CGEN_INT_INSN_P
66 static CGEN_INLINE void insert_1
67 (CGEN_CPU_DESC, unsigned long, int, int, int, unsigned char *);
68 static CGEN_INLINE int fill_cache
69 (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, bfd_vma);
70 static CGEN_INLINE long extract_1
71 (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, int, unsigned char *, bfd_vma);
72 #endif
74 /* Operand insertion. */
76 #if ! CGEN_INT_INSN_P
78 /* Subroutine of insert_normal. */
80 static CGEN_INLINE void
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)
88 unsigned long x,mask;
89 int shift;
91 x = cgen_get_insn_value (cd, bufp, word_length);
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);
101 cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x);
104 #endif /* ! CGEN_INT_INSN_P */
106 /* Default insertion routine.
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.
115 The result is an error message or NULL if success. */
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. */
122 static const char *
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)
133 static char errbuf[100];
134 /* Written this way to avoid undefined behaviour. */
135 unsigned long mask = (((1L << (length - 1)) - 1) << 1) | 1;
137 /* If LENGTH is zero, this operand doesn't contribute to the value. */
138 if (length == 0)
139 return NULL;
141 if (word_length > 8 * sizeof (CGEN_INSN_INT))
142 abort ();
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)
148 if (word_offset == 0
149 && word_length > total_length)
150 word_length = total_length;
153 /* Ensure VALUE will fit. */
154 if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGN_OPT))
156 long minval = - (1L << (length - 1));
157 unsigned long maxval = mask;
159 if ((value > 0 && (unsigned long) value > maxval)
160 || value < minval)
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;
169 else if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED))
171 unsigned long maxval = mask;
172 unsigned long val = (unsigned long) value;
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;
181 if (val > maxval)
183 /* xgettext:c-format */
184 sprintf (errbuf,
185 _("operand out of range (0x%lx not between 0 and 0x%lx)"),
186 val, maxval);
187 return errbuf;
190 else
192 if (! cgen_signed_overflow_ok_p (cd))
194 long minval = - (1L << (length - 1));
195 long maxval = (1L << (length - 1)) - 1;
197 if (value < minval || value > maxval)
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;
208 #if CGEN_INT_INSN_P
211 int shift_within_word, shift_to_word, shift;
213 /* How to shift the value to BIT0 of the word. */
214 shift_to_word = total_length - (word_offset + word_length);
216 /* How to shift the value to the field within the word. */
217 if (CGEN_INSN_LSB0_P)
218 shift_within_word = start + 1 - length;
219 else
220 shift_within_word = word_length - start - length;
222 /* The total SHIFT, then mask in the value. */
223 shift = shift_to_word + shift_within_word;
224 *buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
227 #else /* ! CGEN_INT_INSN_P */
230 unsigned char *bufp = (unsigned char *) buffer + word_offset / 8;
232 insert_1 (cd, value, start, length, word_length, bufp);
235 #endif /* ! CGEN_INT_INSN_P */
237 return NULL;
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. */
247 static const char *
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)
254 const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
255 unsigned long value;
256 const CGEN_SYNTAX_CHAR_TYPE * syn;
258 CGEN_INIT_INSERT (cd);
259 value = CGEN_INSN_BASE_VALUE (insn);
261 /* If we're recording insns as numbers (rather than a string of bytes),
262 target byte order handling is deferred until later. */
264 #if CGEN_INT_INSN_P
266 put_insn_int_value (cd, buffer, cd->base_insn_bitsize,
267 CGEN_FIELDS_BITSIZE (fields), value);
269 #else
271 cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize,
272 (unsigned) CGEN_FIELDS_BITSIZE (fields)),
273 value);
275 #endif /* ! CGEN_INT_INSN_P */
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. */
282 for (syn = CGEN_SYNTAX_STRING (syntax); * syn; ++ syn)
284 const char *errmsg;
286 if (CGEN_SYNTAX_CHAR_P (* syn))
287 continue;
289 errmsg = (* cd->insert_operand) (cd, CGEN_SYNTAX_FIELD (*syn),
290 fields, buffer, pc);
291 if (errmsg)
292 return errmsg;
295 return NULL;
298 #if CGEN_INT_INSN_P
299 /* Cover function to store an insn value into an integral insn. Must go here
300 because it needs <prefix>-desc.h for CGEN_INT_INSN_P. */
302 static void
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)
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
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;
319 *buf = (*buf & ~(mask << shift)) | ((value & mask) << shift);
322 #endif
324 /* Operand extraction. */
326 #if ! CGEN_INT_INSN_P
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. */
334 static CGEN_INLINE int
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)
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;
346 /* First do a quick check. */
347 mask = (1 << bytes) - 1;
348 if (((ex_info->valid >> offset) & mask) == mask)
349 return 1;
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;
356 if (bytes)
358 int status;
360 pc += offset;
361 status = (*info->read_memory_func)
362 (pc, ex_info->insn_bytes + offset, bytes, info);
364 if (status != 0)
366 (*info->memory_error_func) (status, pc, info);
367 return 0;
370 ex_info->valid |= ((1 << bytes) - 1) << offset;
373 return 1;
376 /* Subroutine of extract_normal. */
378 static CGEN_INLINE long
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)
387 unsigned long x;
388 int shift;
390 x = cgen_get_insn_value (cd, bufp, word_length);
392 if (CGEN_INSN_LSB0_P)
393 shift = (start + 1) - length;
394 else
395 shift = (word_length - (start + length));
396 return x >> shift;
399 #endif /* ! CGEN_INT_INSN_P */
401 /* Default extraction routine.
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.
414 Returns 1 for success, 0 for failure. */
416 /* ??? The return code isn't properly used. wip. */
418 /* ??? This doesn't handle bfd_vma's. Create another function when
419 necessary. */
421 static int
422 extract_normal (CGEN_CPU_DESC cd,
423 #if ! CGEN_INT_INSN_P
424 CGEN_EXTRACT_INFO *ex_info,
425 #else
426 CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED,
427 #endif
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,
435 #if ! CGEN_INT_INSN_P
436 bfd_vma pc,
437 #else
438 bfd_vma pc ATTRIBUTE_UNUSED,
439 #endif
440 long *valuep)
442 long value, mask;
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)
448 *valuep = 0;
449 return 1;
452 if (word_length > 8 * sizeof (CGEN_INSN_INT))
453 abort ();
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)
459 if (word_offset + word_length > total_length)
460 word_length = total_length - word_offset;
463 /* Does the value reside in INSN_VALUE, and at the right alignment? */
465 if (CGEN_INT_INSN_P || (word_offset == 0 && word_length == total_length))
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));
473 #if ! CGEN_INT_INSN_P
475 else
477 unsigned char *bufp = ex_info->insn_bytes + word_offset / 8;
479 if (word_length > 8 * sizeof (CGEN_INSN_INT))
480 abort ();
482 if (fill_cache (cd, ex_info, word_offset / 8, word_length / 8, pc) == 0)
483 return 0;
485 value = extract_1 (cd, ex_info, start, length, word_length, bufp, pc);
488 #endif /* ! CGEN_INT_INSN_P */
490 /* Written this way to avoid undefined behaviour. */
491 mask = (((1L << (length - 1)) - 1) << 1) | 1;
493 value &= mask;
494 /* sign extend? */
495 if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)
496 && (value & (1L << (length - 1))))
497 value |= ~mask;
499 *valuep = value;
501 return 1;
504 /* Default insn extractor.
506 INSN_VALUE is the first base_insn_bitsize bits, translated to host order.
507 The extracted fields are stored in FIELDS.
508 EX_INFO is used to handle reading variable length insns.
509 Return the length of the insn in bits, or 0 if no match,
510 or -1 if an error occurs fetching data (memory_error_func will have
511 been called). */
513 static int
514 extract_insn_normal (CGEN_CPU_DESC cd,
515 const CGEN_INSN *insn,
516 CGEN_EXTRACT_INFO *ex_info,
517 CGEN_INSN_INT insn_value,
518 CGEN_FIELDS *fields,
519 bfd_vma pc)
521 const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
522 const CGEN_SYNTAX_CHAR_TYPE *syn;
524 CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
526 CGEN_INIT_EXTRACT (cd);
528 for (syn = CGEN_SYNTAX_STRING (syntax); *syn; ++syn)
530 int length;
532 if (CGEN_SYNTAX_CHAR_P (*syn))
533 continue;
535 length = (* cd->extract_operand) (cd, CGEN_SYNTAX_FIELD (*syn),
536 ex_info, insn_value, fields, pc);
537 if (length <= 0)
538 return length;
541 /* We recognized and successfully extracted this insn. */
542 return CGEN_INSN_BITSIZE (insn);
545 /* Machine generated code added here. */
547 const char * frv_cgen_insert_operand
548 (CGEN_CPU_DESC, int, CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma);
550 /* Main entry point for operand insertion.
552 This function is basically just a big switch statement. Earlier versions
553 used tables to look up the function to use, but
554 - if the table contains both assembler and disassembler functions then
555 the disassembler contains much of the assembler and vice-versa,
556 - there's a lot of inlining possibilities as things grow,
557 - using a switch statement avoids the function call overhead.
559 This function could be moved into `parse_insn_normal', but keeping it
560 separate makes clear the interface between `parse_insn_normal' and each of
561 the handlers. It's also needed by GAS to insert operands that couldn't be
562 resolved during parsing. */
564 const char *
565 frv_cgen_insert_operand (CGEN_CPU_DESC cd,
566 int opindex,
567 CGEN_FIELDS * fields,
568 CGEN_INSN_BYTES_PTR buffer,
569 bfd_vma pc ATTRIBUTE_UNUSED)
571 const char * errmsg = NULL;
572 unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);
574 switch (opindex)
576 case FRV_OPERAND_A0 :
577 errmsg = insert_normal (cd, fields->f_A, 0, 0, 17, 1, 32, total_length, buffer);
578 break;
579 case FRV_OPERAND_A1 :
580 errmsg = insert_normal (cd, fields->f_A, 0, 0, 17, 1, 32, total_length, buffer);
581 break;
582 case FRV_OPERAND_ACC40SI :
583 errmsg = insert_normal (cd, fields->f_ACC40Si, 0, 0, 17, 6, 32, total_length, buffer);
584 break;
585 case FRV_OPERAND_ACC40SK :
586 errmsg = insert_normal (cd, fields->f_ACC40Sk, 0, 0, 30, 6, 32, total_length, buffer);
587 break;
588 case FRV_OPERAND_ACC40UI :
589 errmsg = insert_normal (cd, fields->f_ACC40Ui, 0, 0, 17, 6, 32, total_length, buffer);
590 break;
591 case FRV_OPERAND_ACC40UK :
592 errmsg = insert_normal (cd, fields->f_ACC40Uk, 0, 0, 30, 6, 32, total_length, buffer);
593 break;
594 case FRV_OPERAND_ACCGI :
595 errmsg = insert_normal (cd, fields->f_ACCGi, 0, 0, 17, 6, 32, total_length, buffer);
596 break;
597 case FRV_OPERAND_ACCGK :
598 errmsg = insert_normal (cd, fields->f_ACCGk, 0, 0, 30, 6, 32, total_length, buffer);
599 break;
600 case FRV_OPERAND_CCI :
601 errmsg = insert_normal (cd, fields->f_CCi, 0, 0, 11, 3, 32, total_length, buffer);
602 break;
603 case FRV_OPERAND_CPRDOUBLEK :
604 errmsg = insert_normal (cd, fields->f_CPRk, 0, 0, 30, 6, 32, total_length, buffer);
605 break;
606 case FRV_OPERAND_CPRI :
607 errmsg = insert_normal (cd, fields->f_CPRi, 0, 0, 17, 6, 32, total_length, buffer);
608 break;
609 case FRV_OPERAND_CPRJ :
610 errmsg = insert_normal (cd, fields->f_CPRj, 0, 0, 5, 6, 32, total_length, buffer);
611 break;
612 case FRV_OPERAND_CPRK :
613 errmsg = insert_normal (cd, fields->f_CPRk, 0, 0, 30, 6, 32, total_length, buffer);
614 break;
615 case FRV_OPERAND_CRI :
616 errmsg = insert_normal (cd, fields->f_CRi, 0, 0, 14, 3, 32, total_length, buffer);
617 break;
618 case FRV_OPERAND_CRJ :
619 errmsg = insert_normal (cd, fields->f_CRj, 0, 0, 2, 3, 32, total_length, buffer);
620 break;
621 case FRV_OPERAND_CRJ_FLOAT :
622 errmsg = insert_normal (cd, fields->f_CRj_float, 0, 0, 26, 2, 32, total_length, buffer);
623 break;
624 case FRV_OPERAND_CRJ_INT :
626 long value = fields->f_CRj_int;
627 value = ((value) - (4));
628 errmsg = insert_normal (cd, value, 0, 0, 26, 2, 32, total_length, buffer);
630 break;
631 case FRV_OPERAND_CRK :
632 errmsg = insert_normal (cd, fields->f_CRk, 0, 0, 27, 3, 32, total_length, buffer);
633 break;
634 case FRV_OPERAND_FCCI_1 :
635 errmsg = insert_normal (cd, fields->f_FCCi_1, 0, 0, 11, 2, 32, total_length, buffer);
636 break;
637 case FRV_OPERAND_FCCI_2 :
638 errmsg = insert_normal (cd, fields->f_FCCi_2, 0, 0, 26, 2, 32, total_length, buffer);
639 break;
640 case FRV_OPERAND_FCCI_3 :
641 errmsg = insert_normal (cd, fields->f_FCCi_3, 0, 0, 1, 2, 32, total_length, buffer);
642 break;
643 case FRV_OPERAND_FCCK :
644 errmsg = insert_normal (cd, fields->f_FCCk, 0, 0, 26, 2, 32, total_length, buffer);
645 break;
646 case FRV_OPERAND_FRDOUBLEI :
647 errmsg = insert_normal (cd, fields->f_FRi, 0, 0, 17, 6, 32, total_length, buffer);
648 break;
649 case FRV_OPERAND_FRDOUBLEJ :
650 errmsg = insert_normal (cd, fields->f_FRj, 0, 0, 5, 6, 32, total_length, buffer);
651 break;
652 case FRV_OPERAND_FRDOUBLEK :
653 errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer);
654 break;
655 case FRV_OPERAND_FRI :
656 errmsg = insert_normal (cd, fields->f_FRi, 0, 0, 17, 6, 32, total_length, buffer);
657 break;
658 case FRV_OPERAND_FRINTI :
659 errmsg = insert_normal (cd, fields->f_FRi, 0, 0, 17, 6, 32, total_length, buffer);
660 break;
661 case FRV_OPERAND_FRINTIEVEN :
662 errmsg = insert_normal (cd, fields->f_FRi, 0, 0, 17, 6, 32, total_length, buffer);
663 break;
664 case FRV_OPERAND_FRINTJ :
665 errmsg = insert_normal (cd, fields->f_FRj, 0, 0, 5, 6, 32, total_length, buffer);
666 break;
667 case FRV_OPERAND_FRINTJEVEN :
668 errmsg = insert_normal (cd, fields->f_FRj, 0, 0, 5, 6, 32, total_length, buffer);
669 break;
670 case FRV_OPERAND_FRINTK :
671 errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer);
672 break;
673 case FRV_OPERAND_FRINTKEVEN :
674 errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer);
675 break;
676 case FRV_OPERAND_FRJ :
677 errmsg = insert_normal (cd, fields->f_FRj, 0, 0, 5, 6, 32, total_length, buffer);
678 break;
679 case FRV_OPERAND_FRK :
680 errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer);
681 break;
682 case FRV_OPERAND_FRKHI :
683 errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer);
684 break;
685 case FRV_OPERAND_FRKLO :
686 errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer);
687 break;
688 case FRV_OPERAND_GRDOUBLEK :
689 errmsg = insert_normal (cd, fields->f_GRk, 0, 0, 30, 6, 32, total_length, buffer);
690 break;
691 case FRV_OPERAND_GRI :
692 errmsg = insert_normal (cd, fields->f_GRi, 0, 0, 17, 6, 32, total_length, buffer);
693 break;
694 case FRV_OPERAND_GRJ :
695 errmsg = insert_normal (cd, fields->f_GRj, 0, 0, 5, 6, 32, total_length, buffer);
696 break;
697 case FRV_OPERAND_GRK :
698 errmsg = insert_normal (cd, fields->f_GRk, 0, 0, 30, 6, 32, total_length, buffer);
699 break;
700 case FRV_OPERAND_GRKHI :
701 errmsg = insert_normal (cd, fields->f_GRk, 0, 0, 30, 6, 32, total_length, buffer);
702 break;
703 case FRV_OPERAND_GRKLO :
704 errmsg = insert_normal (cd, fields->f_GRk, 0, 0, 30, 6, 32, total_length, buffer);
705 break;
706 case FRV_OPERAND_ICCI_1 :
707 errmsg = insert_normal (cd, fields->f_ICCi_1, 0, 0, 11, 2, 32, total_length, buffer);
708 break;
709 case FRV_OPERAND_ICCI_2 :
710 errmsg = insert_normal (cd, fields->f_ICCi_2, 0, 0, 26, 2, 32, total_length, buffer);
711 break;
712 case FRV_OPERAND_ICCI_3 :
713 errmsg = insert_normal (cd, fields->f_ICCi_3, 0, 0, 1, 2, 32, total_length, buffer);
714 break;
715 case FRV_OPERAND_LI :
716 errmsg = insert_normal (cd, fields->f_LI, 0, 0, 25, 1, 32, total_length, buffer);
717 break;
718 case FRV_OPERAND_LRAD :
719 errmsg = insert_normal (cd, fields->f_LRAD, 0, 0, 4, 1, 32, total_length, buffer);
720 break;
721 case FRV_OPERAND_LRAE :
722 errmsg = insert_normal (cd, fields->f_LRAE, 0, 0, 5, 1, 32, total_length, buffer);
723 break;
724 case FRV_OPERAND_LRAS :
725 errmsg = insert_normal (cd, fields->f_LRAS, 0, 0, 3, 1, 32, total_length, buffer);
726 break;
727 case FRV_OPERAND_TLBPRL :
728 errmsg = insert_normal (cd, fields->f_TLBPRL, 0, 0, 25, 1, 32, total_length, buffer);
729 break;
730 case FRV_OPERAND_TLBPROPX :
731 errmsg = insert_normal (cd, fields->f_TLBPRopx, 0, 0, 28, 3, 32, total_length, buffer);
732 break;
733 case FRV_OPERAND_AE :
734 errmsg = insert_normal (cd, fields->f_ae, 0, 0, 25, 1, 32, total_length, buffer);
735 break;
736 case FRV_OPERAND_CALLANN :
737 errmsg = insert_normal (cd, fields->f_reloc_ann, 0, 0, 0, 0, 32, total_length, buffer);
738 break;
739 case FRV_OPERAND_CCOND :
740 errmsg = insert_normal (cd, fields->f_ccond, 0, 0, 12, 1, 32, total_length, buffer);
741 break;
742 case FRV_OPERAND_COND :
743 errmsg = insert_normal (cd, fields->f_cond, 0, 0, 8, 1, 32, total_length, buffer);
744 break;
745 case FRV_OPERAND_D12 :
746 errmsg = insert_normal (cd, fields->f_d12, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 12, 32, total_length, buffer);
747 break;
748 case FRV_OPERAND_DEBUG :
749 errmsg = insert_normal (cd, fields->f_debug, 0, 0, 25, 1, 32, total_length, buffer);
750 break;
751 case FRV_OPERAND_EIR :
752 errmsg = insert_normal (cd, fields->f_eir, 0, 0, 17, 6, 32, total_length, buffer);
753 break;
754 case FRV_OPERAND_HINT :
755 errmsg = insert_normal (cd, fields->f_hint, 0, 0, 17, 2, 32, total_length, buffer);
756 break;
757 case FRV_OPERAND_HINT_NOT_TAKEN :
758 errmsg = insert_normal (cd, fields->f_hint, 0, 0, 17, 2, 32, total_length, buffer);
759 break;
760 case FRV_OPERAND_HINT_TAKEN :
761 errmsg = insert_normal (cd, fields->f_hint, 0, 0, 17, 2, 32, total_length, buffer);
762 break;
763 case FRV_OPERAND_LABEL16 :
765 long value = fields->f_label16;
766 value = ((SI) (((value) - (pc))) >> (2));
767 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 15, 16, 32, total_length, buffer);
769 break;
770 case FRV_OPERAND_LABEL24 :
773 FLD (f_labelH6) = ((SI) (((FLD (f_label24)) - (pc))) >> (20));
774 FLD (f_labelL18) = ((((UINT) (((FLD (f_label24)) - (pc))) >> (2))) & (262143));
776 errmsg = insert_normal (cd, fields->f_labelH6, 0|(1<<CGEN_IFLD_SIGNED), 0, 30, 6, 32, total_length, buffer);
777 if (errmsg)
778 break;
779 errmsg = insert_normal (cd, fields->f_labelL18, 0, 0, 17, 18, 32, total_length, buffer);
780 if (errmsg)
781 break;
783 break;
784 case FRV_OPERAND_LDANN :
785 errmsg = insert_normal (cd, fields->f_reloc_ann, 0, 0, 0, 0, 32, total_length, buffer);
786 break;
787 case FRV_OPERAND_LDDANN :
788 errmsg = insert_normal (cd, fields->f_reloc_ann, 0, 0, 0, 0, 32, total_length, buffer);
789 break;
790 case FRV_OPERAND_LOCK :
791 errmsg = insert_normal (cd, fields->f_lock, 0, 0, 25, 1, 32, total_length, buffer);
792 break;
793 case FRV_OPERAND_PACK :
794 errmsg = insert_normal (cd, fields->f_pack, 0, 0, 31, 1, 32, total_length, buffer);
795 break;
796 case FRV_OPERAND_S10 :
797 errmsg = insert_normal (cd, fields->f_s10, 0|(1<<CGEN_IFLD_SIGNED), 0, 9, 10, 32, total_length, buffer);
798 break;
799 case FRV_OPERAND_S12 :
800 errmsg = insert_normal (cd, fields->f_d12, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 12, 32, total_length, buffer);
801 break;
802 case FRV_OPERAND_S16 :
803 errmsg = insert_normal (cd, fields->f_s16, 0|(1<<CGEN_IFLD_SIGNED), 0, 15, 16, 32, total_length, buffer);
804 break;
805 case FRV_OPERAND_S5 :
806 errmsg = insert_normal (cd, fields->f_s5, 0|(1<<CGEN_IFLD_SIGNED), 0, 4, 5, 32, total_length, buffer);
807 break;
808 case FRV_OPERAND_S6 :
809 errmsg = insert_normal (cd, fields->f_s6, 0|(1<<CGEN_IFLD_SIGNED), 0, 5, 6, 32, total_length, buffer);
810 break;
811 case FRV_OPERAND_S6_1 :
812 errmsg = insert_normal (cd, fields->f_s6_1, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 6, 32, total_length, buffer);
813 break;
814 case FRV_OPERAND_SLO16 :
815 errmsg = insert_normal (cd, fields->f_s16, 0|(1<<CGEN_IFLD_SIGNED), 0, 15, 16, 32, total_length, buffer);
816 break;
817 case FRV_OPERAND_SPR :
820 FLD (f_spr_h) = ((UINT) (FLD (f_spr)) >> (6));
821 FLD (f_spr_l) = ((FLD (f_spr)) & (63));
823 errmsg = insert_normal (cd, fields->f_spr_h, 0, 0, 30, 6, 32, total_length, buffer);
824 if (errmsg)
825 break;
826 errmsg = insert_normal (cd, fields->f_spr_l, 0, 0, 17, 6, 32, total_length, buffer);
827 if (errmsg)
828 break;
830 break;
831 case FRV_OPERAND_U12 :
834 FLD (f_u12_h) = ((SI) (FLD (f_u12)) >> (6));
835 FLD (f_u12_l) = ((FLD (f_u12)) & (63));
837 errmsg = insert_normal (cd, fields->f_u12_h, 0|(1<<CGEN_IFLD_SIGNED), 0, 17, 6, 32, total_length, buffer);
838 if (errmsg)
839 break;
840 errmsg = insert_normal (cd, fields->f_u12_l, 0, 0, 5, 6, 32, total_length, buffer);
841 if (errmsg)
842 break;
844 break;
845 case FRV_OPERAND_U16 :
846 errmsg = insert_normal (cd, fields->f_u16, 0, 0, 15, 16, 32, total_length, buffer);
847 break;
848 case FRV_OPERAND_U6 :
849 errmsg = insert_normal (cd, fields->f_u6, 0, 0, 5, 6, 32, total_length, buffer);
850 break;
851 case FRV_OPERAND_UHI16 :
852 errmsg = insert_normal (cd, fields->f_u16, 0, 0, 15, 16, 32, total_length, buffer);
853 break;
854 case FRV_OPERAND_ULO16 :
855 errmsg = insert_normal (cd, fields->f_u16, 0, 0, 15, 16, 32, total_length, buffer);
856 break;
858 default :
859 /* xgettext:c-format */
860 opcodes_error_handler
861 (_("internal error: unrecognized field %d while building insn"),
862 opindex);
863 abort ();
866 return errmsg;
869 int frv_cgen_extract_operand
870 (CGEN_CPU_DESC, int, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma);
872 /* Main entry point for operand extraction.
873 The result is <= 0 for error, >0 for success.
874 ??? Actual values aren't well defined right now.
876 This function is basically just a big switch statement. Earlier versions
877 used tables to look up the function to use, but
878 - if the table contains both assembler and disassembler functions then
879 the disassembler contains much of the assembler and vice-versa,
880 - there's a lot of inlining possibilities as things grow,
881 - using a switch statement avoids the function call overhead.
883 This function could be moved into `print_insn_normal', but keeping it
884 separate makes clear the interface between `print_insn_normal' and each of
885 the handlers. */
888 frv_cgen_extract_operand (CGEN_CPU_DESC cd,
889 int opindex,
890 CGEN_EXTRACT_INFO *ex_info,
891 CGEN_INSN_INT insn_value,
892 CGEN_FIELDS * fields,
893 bfd_vma pc)
895 /* Assume success (for those operands that are nops). */
896 int length = 1;
897 unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);
899 switch (opindex)
901 case FRV_OPERAND_A0 :
902 length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 1, 32, total_length, pc, & fields->f_A);
903 break;
904 case FRV_OPERAND_A1 :
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_ACC40SI :
908 length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_ACC40Si);
909 break;
910 case FRV_OPERAND_ACC40SK :
911 length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_ACC40Sk);
912 break;
913 case FRV_OPERAND_ACC40UI :
914 length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_ACC40Ui);
915 break;
916 case FRV_OPERAND_ACC40UK :
917 length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_ACC40Uk);
918 break;
919 case FRV_OPERAND_ACCGI :
920 length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_ACCGi);
921 break;
922 case FRV_OPERAND_ACCGK :
923 length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_ACCGk);
924 break;
925 case FRV_OPERAND_CCI :
926 length = extract_normal (cd, ex_info, insn_value, 0, 0, 11, 3, 32, total_length, pc, & fields->f_CCi);
927 break;
928 case FRV_OPERAND_CPRDOUBLEK :
929 length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_CPRk);
930 break;
931 case FRV_OPERAND_CPRI :
932 length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_CPRi);
933 break;
934 case FRV_OPERAND_CPRJ :
935 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_CPRj);
936 break;
937 case FRV_OPERAND_CPRK :
938 length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_CPRk);
939 break;
940 case FRV_OPERAND_CRI :
941 length = extract_normal (cd, ex_info, insn_value, 0, 0, 14, 3, 32, total_length, pc, & fields->f_CRi);
942 break;
943 case FRV_OPERAND_CRJ :
944 length = extract_normal (cd, ex_info, insn_value, 0, 0, 2, 3, 32, total_length, pc, & fields->f_CRj);
945 break;
946 case FRV_OPERAND_CRJ_FLOAT :
947 length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & fields->f_CRj_float);
948 break;
949 case FRV_OPERAND_CRJ_INT :
951 long value;
952 length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & value);
953 value = ((value) + (4));
954 fields->f_CRj_int = value;
956 break;
957 case FRV_OPERAND_CRK :
958 length = extract_normal (cd, ex_info, insn_value, 0, 0, 27, 3, 32, total_length, pc, & fields->f_CRk);
959 break;
960 case FRV_OPERAND_FCCI_1 :
961 length = extract_normal (cd, ex_info, insn_value, 0, 0, 11, 2, 32, total_length, pc, & fields->f_FCCi_1);
962 break;
963 case FRV_OPERAND_FCCI_2 :
964 length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & fields->f_FCCi_2);
965 break;
966 case FRV_OPERAND_FCCI_3 :
967 length = extract_normal (cd, ex_info, insn_value, 0, 0, 1, 2, 32, total_length, pc, & fields->f_FCCi_3);
968 break;
969 case FRV_OPERAND_FCCK :
970 length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & fields->f_FCCk);
971 break;
972 case FRV_OPERAND_FRDOUBLEI :
973 length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_FRi);
974 break;
975 case FRV_OPERAND_FRDOUBLEJ :
976 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_FRj);
977 break;
978 case FRV_OPERAND_FRDOUBLEK :
979 length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk);
980 break;
981 case FRV_OPERAND_FRI :
982 length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_FRi);
983 break;
984 case FRV_OPERAND_FRINTI :
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_FRINTIEVEN :
988 length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_FRi);
989 break;
990 case FRV_OPERAND_FRINTJ :
991 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_FRj);
992 break;
993 case FRV_OPERAND_FRINTJEVEN :
994 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_FRj);
995 break;
996 case FRV_OPERAND_FRINTK :
997 length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk);
998 break;
999 case FRV_OPERAND_FRINTKEVEN :
1000 length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk);
1001 break;
1002 case FRV_OPERAND_FRJ :
1003 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_FRj);
1004 break;
1005 case FRV_OPERAND_FRK :
1006 length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk);
1007 break;
1008 case FRV_OPERAND_FRKHI :
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_FRKLO :
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_GRDOUBLEK :
1015 length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_GRk);
1016 break;
1017 case FRV_OPERAND_GRI :
1018 length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_GRi);
1019 break;
1020 case FRV_OPERAND_GRJ :
1021 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_GRj);
1022 break;
1023 case FRV_OPERAND_GRK :
1024 length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_GRk);
1025 break;
1026 case FRV_OPERAND_GRKHI :
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_GRKLO :
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_ICCI_1 :
1033 length = extract_normal (cd, ex_info, insn_value, 0, 0, 11, 2, 32, total_length, pc, & fields->f_ICCi_1);
1034 break;
1035 case FRV_OPERAND_ICCI_2 :
1036 length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & fields->f_ICCi_2);
1037 break;
1038 case FRV_OPERAND_ICCI_3 :
1039 length = extract_normal (cd, ex_info, insn_value, 0, 0, 1, 2, 32, total_length, pc, & fields->f_ICCi_3);
1040 break;
1041 case FRV_OPERAND_LI :
1042 length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_LI);
1043 break;
1044 case FRV_OPERAND_LRAD :
1045 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 1, 32, total_length, pc, & fields->f_LRAD);
1046 break;
1047 case FRV_OPERAND_LRAE :
1048 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 1, 32, total_length, pc, & fields->f_LRAE);
1049 break;
1050 case FRV_OPERAND_LRAS :
1051 length = extract_normal (cd, ex_info, insn_value, 0, 0, 3, 1, 32, total_length, pc, & fields->f_LRAS);
1052 break;
1053 case FRV_OPERAND_TLBPRL :
1054 length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_TLBPRL);
1055 break;
1056 case FRV_OPERAND_TLBPROPX :
1057 length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 3, 32, total_length, pc, & fields->f_TLBPRopx);
1058 break;
1059 case FRV_OPERAND_AE :
1060 length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_ae);
1061 break;
1062 case FRV_OPERAND_CALLANN :
1063 length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 0, 32, total_length, pc, & fields->f_reloc_ann);
1064 break;
1065 case FRV_OPERAND_CCOND :
1066 length = extract_normal (cd, ex_info, insn_value, 0, 0, 12, 1, 32, total_length, pc, & fields->f_ccond);
1067 break;
1068 case FRV_OPERAND_COND :
1069 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 1, 32, total_length, pc, & fields->f_cond);
1070 break;
1071 case FRV_OPERAND_D12 :
1072 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 12, 32, total_length, pc, & fields->f_d12);
1073 break;
1074 case FRV_OPERAND_DEBUG :
1075 length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_debug);
1076 break;
1077 case FRV_OPERAND_EIR :
1078 length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_eir);
1079 break;
1080 case FRV_OPERAND_HINT :
1081 length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 2, 32, total_length, pc, & fields->f_hint);
1082 break;
1083 case FRV_OPERAND_HINT_NOT_TAKEN :
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_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_LABEL16 :
1091 long value;
1092 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);
1093 value = ((((value) << (2))) + (pc));
1094 fields->f_label16 = value;
1096 break;
1097 case FRV_OPERAND_LABEL24 :
1099 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 30, 6, 32, total_length, pc, & fields->f_labelH6);
1100 if (length <= 0) break;
1101 length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 18, 32, total_length, pc, & fields->f_labelL18);
1102 if (length <= 0) break;
1104 FLD (f_label24) = ((((((((FLD (f_labelH6)) << (18))) | (FLD (f_labelL18)))) << (2))) + (pc));
1107 break;
1108 case FRV_OPERAND_LDANN :
1109 length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 0, 32, total_length, pc, & fields->f_reloc_ann);
1110 break;
1111 case FRV_OPERAND_LDDANN :
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_LOCK :
1115 length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_lock);
1116 break;
1117 case FRV_OPERAND_PACK :
1118 length = extract_normal (cd, ex_info, insn_value, 0, 0, 31, 1, 32, total_length, pc, & fields->f_pack);
1119 break;
1120 case FRV_OPERAND_S10 :
1121 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 9, 10, 32, total_length, pc, & fields->f_s10);
1122 break;
1123 case FRV_OPERAND_S12 :
1124 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 12, 32, total_length, pc, & fields->f_d12);
1125 break;
1126 case FRV_OPERAND_S16 :
1127 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 15, 16, 32, total_length, pc, & fields->f_s16);
1128 break;
1129 case FRV_OPERAND_S5 :
1130 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 4, 5, 32, total_length, pc, & fields->f_s5);
1131 break;
1132 case FRV_OPERAND_S6 :
1133 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 5, 6, 32, total_length, pc, & fields->f_s6);
1134 break;
1135 case FRV_OPERAND_S6_1 :
1136 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 6, 32, total_length, pc, & fields->f_s6_1);
1137 break;
1138 case FRV_OPERAND_SLO16 :
1139 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 15, 16, 32, total_length, pc, & fields->f_s16);
1140 break;
1141 case FRV_OPERAND_SPR :
1143 length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_spr_h);
1144 if (length <= 0) break;
1145 length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_spr_l);
1146 if (length <= 0) break;
1148 FLD (f_spr) = ((((FLD (f_spr_h)) << (6))) | (FLD (f_spr_l)));
1151 break;
1152 case FRV_OPERAND_U12 :
1154 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 17, 6, 32, total_length, pc, & fields->f_u12_h);
1155 if (length <= 0) break;
1156 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_u12_l);
1157 if (length <= 0) break;
1159 FLD (f_u12) = ((((FLD (f_u12_h)) << (6))) | (FLD (f_u12_l)));
1162 break;
1163 case FRV_OPERAND_U16 :
1164 length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 16, 32, total_length, pc, & fields->f_u16);
1165 break;
1166 case FRV_OPERAND_U6 :
1167 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_u6);
1168 break;
1169 case FRV_OPERAND_UHI16 :
1170 length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 16, 32, total_length, pc, & fields->f_u16);
1171 break;
1172 case FRV_OPERAND_ULO16 :
1173 length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 16, 32, total_length, pc, & fields->f_u16);
1174 break;
1176 default :
1177 /* xgettext:c-format */
1178 opcodes_error_handler
1179 (_("internal error: unrecognized field %d while decoding insn"),
1180 opindex);
1181 abort ();
1184 return length;
1187 cgen_insert_fn * const frv_cgen_insert_handlers[] =
1189 insert_insn_normal,
1192 cgen_extract_fn * const frv_cgen_extract_handlers[] =
1194 extract_insn_normal,
1197 int frv_cgen_get_int_operand (CGEN_CPU_DESC, int, const CGEN_FIELDS *);
1198 bfd_vma frv_cgen_get_vma_operand (CGEN_CPU_DESC, int, const CGEN_FIELDS *);
1200 /* Getting values from cgen_fields is handled by a collection of functions.
1201 They are distinguished by the type of the VALUE argument they return.
1202 TODO: floating point, inlining support, remove cases where result type
1203 not appropriate. */
1206 frv_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1207 int opindex,
1208 const CGEN_FIELDS * fields)
1210 int value;
1212 switch (opindex)
1214 case FRV_OPERAND_A0 :
1215 value = fields->f_A;
1216 break;
1217 case FRV_OPERAND_A1 :
1218 value = fields->f_A;
1219 break;
1220 case FRV_OPERAND_ACC40SI :
1221 value = fields->f_ACC40Si;
1222 break;
1223 case FRV_OPERAND_ACC40SK :
1224 value = fields->f_ACC40Sk;
1225 break;
1226 case FRV_OPERAND_ACC40UI :
1227 value = fields->f_ACC40Ui;
1228 break;
1229 case FRV_OPERAND_ACC40UK :
1230 value = fields->f_ACC40Uk;
1231 break;
1232 case FRV_OPERAND_ACCGI :
1233 value = fields->f_ACCGi;
1234 break;
1235 case FRV_OPERAND_ACCGK :
1236 value = fields->f_ACCGk;
1237 break;
1238 case FRV_OPERAND_CCI :
1239 value = fields->f_CCi;
1240 break;
1241 case FRV_OPERAND_CPRDOUBLEK :
1242 value = fields->f_CPRk;
1243 break;
1244 case FRV_OPERAND_CPRI :
1245 value = fields->f_CPRi;
1246 break;
1247 case FRV_OPERAND_CPRJ :
1248 value = fields->f_CPRj;
1249 break;
1250 case FRV_OPERAND_CPRK :
1251 value = fields->f_CPRk;
1252 break;
1253 case FRV_OPERAND_CRI :
1254 value = fields->f_CRi;
1255 break;
1256 case FRV_OPERAND_CRJ :
1257 value = fields->f_CRj;
1258 break;
1259 case FRV_OPERAND_CRJ_FLOAT :
1260 value = fields->f_CRj_float;
1261 break;
1262 case FRV_OPERAND_CRJ_INT :
1263 value = fields->f_CRj_int;
1264 break;
1265 case FRV_OPERAND_CRK :
1266 value = fields->f_CRk;
1267 break;
1268 case FRV_OPERAND_FCCI_1 :
1269 value = fields->f_FCCi_1;
1270 break;
1271 case FRV_OPERAND_FCCI_2 :
1272 value = fields->f_FCCi_2;
1273 break;
1274 case FRV_OPERAND_FCCI_3 :
1275 value = fields->f_FCCi_3;
1276 break;
1277 case FRV_OPERAND_FCCK :
1278 value = fields->f_FCCk;
1279 break;
1280 case FRV_OPERAND_FRDOUBLEI :
1281 value = fields->f_FRi;
1282 break;
1283 case FRV_OPERAND_FRDOUBLEJ :
1284 value = fields->f_FRj;
1285 break;
1286 case FRV_OPERAND_FRDOUBLEK :
1287 value = fields->f_FRk;
1288 break;
1289 case FRV_OPERAND_FRI :
1290 value = fields->f_FRi;
1291 break;
1292 case FRV_OPERAND_FRINTI :
1293 value = fields->f_FRi;
1294 break;
1295 case FRV_OPERAND_FRINTIEVEN :
1296 value = fields->f_FRi;
1297 break;
1298 case FRV_OPERAND_FRINTJ :
1299 value = fields->f_FRj;
1300 break;
1301 case FRV_OPERAND_FRINTJEVEN :
1302 value = fields->f_FRj;
1303 break;
1304 case FRV_OPERAND_FRINTK :
1305 value = fields->f_FRk;
1306 break;
1307 case FRV_OPERAND_FRINTKEVEN :
1308 value = fields->f_FRk;
1309 break;
1310 case FRV_OPERAND_FRJ :
1311 value = fields->f_FRj;
1312 break;
1313 case FRV_OPERAND_FRK :
1314 value = fields->f_FRk;
1315 break;
1316 case FRV_OPERAND_FRKHI :
1317 value = fields->f_FRk;
1318 break;
1319 case FRV_OPERAND_FRKLO :
1320 value = fields->f_FRk;
1321 break;
1322 case FRV_OPERAND_GRDOUBLEK :
1323 value = fields->f_GRk;
1324 break;
1325 case FRV_OPERAND_GRI :
1326 value = fields->f_GRi;
1327 break;
1328 case FRV_OPERAND_GRJ :
1329 value = fields->f_GRj;
1330 break;
1331 case FRV_OPERAND_GRK :
1332 value = fields->f_GRk;
1333 break;
1334 case FRV_OPERAND_GRKHI :
1335 value = fields->f_GRk;
1336 break;
1337 case FRV_OPERAND_GRKLO :
1338 value = fields->f_GRk;
1339 break;
1340 case FRV_OPERAND_ICCI_1 :
1341 value = fields->f_ICCi_1;
1342 break;
1343 case FRV_OPERAND_ICCI_2 :
1344 value = fields->f_ICCi_2;
1345 break;
1346 case FRV_OPERAND_ICCI_3 :
1347 value = fields->f_ICCi_3;
1348 break;
1349 case FRV_OPERAND_LI :
1350 value = fields->f_LI;
1351 break;
1352 case FRV_OPERAND_LRAD :
1353 value = fields->f_LRAD;
1354 break;
1355 case FRV_OPERAND_LRAE :
1356 value = fields->f_LRAE;
1357 break;
1358 case FRV_OPERAND_LRAS :
1359 value = fields->f_LRAS;
1360 break;
1361 case FRV_OPERAND_TLBPRL :
1362 value = fields->f_TLBPRL;
1363 break;
1364 case FRV_OPERAND_TLBPROPX :
1365 value = fields->f_TLBPRopx;
1366 break;
1367 case FRV_OPERAND_AE :
1368 value = fields->f_ae;
1369 break;
1370 case FRV_OPERAND_CALLANN :
1371 value = fields->f_reloc_ann;
1372 break;
1373 case FRV_OPERAND_CCOND :
1374 value = fields->f_ccond;
1375 break;
1376 case FRV_OPERAND_COND :
1377 value = fields->f_cond;
1378 break;
1379 case FRV_OPERAND_D12 :
1380 value = fields->f_d12;
1381 break;
1382 case FRV_OPERAND_DEBUG :
1383 value = fields->f_debug;
1384 break;
1385 case FRV_OPERAND_EIR :
1386 value = fields->f_eir;
1387 break;
1388 case FRV_OPERAND_HINT :
1389 value = fields->f_hint;
1390 break;
1391 case FRV_OPERAND_HINT_NOT_TAKEN :
1392 value = fields->f_hint;
1393 break;
1394 case FRV_OPERAND_HINT_TAKEN :
1395 value = fields->f_hint;
1396 break;
1397 case FRV_OPERAND_LABEL16 :
1398 value = fields->f_label16;
1399 break;
1400 case FRV_OPERAND_LABEL24 :
1401 value = fields->f_label24;
1402 break;
1403 case FRV_OPERAND_LDANN :
1404 value = fields->f_reloc_ann;
1405 break;
1406 case FRV_OPERAND_LDDANN :
1407 value = fields->f_reloc_ann;
1408 break;
1409 case FRV_OPERAND_LOCK :
1410 value = fields->f_lock;
1411 break;
1412 case FRV_OPERAND_PACK :
1413 value = fields->f_pack;
1414 break;
1415 case FRV_OPERAND_S10 :
1416 value = fields->f_s10;
1417 break;
1418 case FRV_OPERAND_S12 :
1419 value = fields->f_d12;
1420 break;
1421 case FRV_OPERAND_S16 :
1422 value = fields->f_s16;
1423 break;
1424 case FRV_OPERAND_S5 :
1425 value = fields->f_s5;
1426 break;
1427 case FRV_OPERAND_S6 :
1428 value = fields->f_s6;
1429 break;
1430 case FRV_OPERAND_S6_1 :
1431 value = fields->f_s6_1;
1432 break;
1433 case FRV_OPERAND_SLO16 :
1434 value = fields->f_s16;
1435 break;
1436 case FRV_OPERAND_SPR :
1437 value = fields->f_spr;
1438 break;
1439 case FRV_OPERAND_U12 :
1440 value = fields->f_u12;
1441 break;
1442 case FRV_OPERAND_U16 :
1443 value = fields->f_u16;
1444 break;
1445 case FRV_OPERAND_U6 :
1446 value = fields->f_u6;
1447 break;
1448 case FRV_OPERAND_UHI16 :
1449 value = fields->f_u16;
1450 break;
1451 case FRV_OPERAND_ULO16 :
1452 value = fields->f_u16;
1453 break;
1455 default :
1456 /* xgettext:c-format */
1457 opcodes_error_handler
1458 (_("internal error: unrecognized field %d while getting int operand"),
1459 opindex);
1460 abort ();
1463 return value;
1466 bfd_vma
1467 frv_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1468 int opindex,
1469 const CGEN_FIELDS * fields)
1471 bfd_vma value;
1473 switch (opindex)
1475 case FRV_OPERAND_A0 :
1476 value = fields->f_A;
1477 break;
1478 case FRV_OPERAND_A1 :
1479 value = fields->f_A;
1480 break;
1481 case FRV_OPERAND_ACC40SI :
1482 value = fields->f_ACC40Si;
1483 break;
1484 case FRV_OPERAND_ACC40SK :
1485 value = fields->f_ACC40Sk;
1486 break;
1487 case FRV_OPERAND_ACC40UI :
1488 value = fields->f_ACC40Ui;
1489 break;
1490 case FRV_OPERAND_ACC40UK :
1491 value = fields->f_ACC40Uk;
1492 break;
1493 case FRV_OPERAND_ACCGI :
1494 value = fields->f_ACCGi;
1495 break;
1496 case FRV_OPERAND_ACCGK :
1497 value = fields->f_ACCGk;
1498 break;
1499 case FRV_OPERAND_CCI :
1500 value = fields->f_CCi;
1501 break;
1502 case FRV_OPERAND_CPRDOUBLEK :
1503 value = fields->f_CPRk;
1504 break;
1505 case FRV_OPERAND_CPRI :
1506 value = fields->f_CPRi;
1507 break;
1508 case FRV_OPERAND_CPRJ :
1509 value = fields->f_CPRj;
1510 break;
1511 case FRV_OPERAND_CPRK :
1512 value = fields->f_CPRk;
1513 break;
1514 case FRV_OPERAND_CRI :
1515 value = fields->f_CRi;
1516 break;
1517 case FRV_OPERAND_CRJ :
1518 value = fields->f_CRj;
1519 break;
1520 case FRV_OPERAND_CRJ_FLOAT :
1521 value = fields->f_CRj_float;
1522 break;
1523 case FRV_OPERAND_CRJ_INT :
1524 value = fields->f_CRj_int;
1525 break;
1526 case FRV_OPERAND_CRK :
1527 value = fields->f_CRk;
1528 break;
1529 case FRV_OPERAND_FCCI_1 :
1530 value = fields->f_FCCi_1;
1531 break;
1532 case FRV_OPERAND_FCCI_2 :
1533 value = fields->f_FCCi_2;
1534 break;
1535 case FRV_OPERAND_FCCI_3 :
1536 value = fields->f_FCCi_3;
1537 break;
1538 case FRV_OPERAND_FCCK :
1539 value = fields->f_FCCk;
1540 break;
1541 case FRV_OPERAND_FRDOUBLEI :
1542 value = fields->f_FRi;
1543 break;
1544 case FRV_OPERAND_FRDOUBLEJ :
1545 value = fields->f_FRj;
1546 break;
1547 case FRV_OPERAND_FRDOUBLEK :
1548 value = fields->f_FRk;
1549 break;
1550 case FRV_OPERAND_FRI :
1551 value = fields->f_FRi;
1552 break;
1553 case FRV_OPERAND_FRINTI :
1554 value = fields->f_FRi;
1555 break;
1556 case FRV_OPERAND_FRINTIEVEN :
1557 value = fields->f_FRi;
1558 break;
1559 case FRV_OPERAND_FRINTJ :
1560 value = fields->f_FRj;
1561 break;
1562 case FRV_OPERAND_FRINTJEVEN :
1563 value = fields->f_FRj;
1564 break;
1565 case FRV_OPERAND_FRINTK :
1566 value = fields->f_FRk;
1567 break;
1568 case FRV_OPERAND_FRINTKEVEN :
1569 value = fields->f_FRk;
1570 break;
1571 case FRV_OPERAND_FRJ :
1572 value = fields->f_FRj;
1573 break;
1574 case FRV_OPERAND_FRK :
1575 value = fields->f_FRk;
1576 break;
1577 case FRV_OPERAND_FRKHI :
1578 value = fields->f_FRk;
1579 break;
1580 case FRV_OPERAND_FRKLO :
1581 value = fields->f_FRk;
1582 break;
1583 case FRV_OPERAND_GRDOUBLEK :
1584 value = fields->f_GRk;
1585 break;
1586 case FRV_OPERAND_GRI :
1587 value = fields->f_GRi;
1588 break;
1589 case FRV_OPERAND_GRJ :
1590 value = fields->f_GRj;
1591 break;
1592 case FRV_OPERAND_GRK :
1593 value = fields->f_GRk;
1594 break;
1595 case FRV_OPERAND_GRKHI :
1596 value = fields->f_GRk;
1597 break;
1598 case FRV_OPERAND_GRKLO :
1599 value = fields->f_GRk;
1600 break;
1601 case FRV_OPERAND_ICCI_1 :
1602 value = fields->f_ICCi_1;
1603 break;
1604 case FRV_OPERAND_ICCI_2 :
1605 value = fields->f_ICCi_2;
1606 break;
1607 case FRV_OPERAND_ICCI_3 :
1608 value = fields->f_ICCi_3;
1609 break;
1610 case FRV_OPERAND_LI :
1611 value = fields->f_LI;
1612 break;
1613 case FRV_OPERAND_LRAD :
1614 value = fields->f_LRAD;
1615 break;
1616 case FRV_OPERAND_LRAE :
1617 value = fields->f_LRAE;
1618 break;
1619 case FRV_OPERAND_LRAS :
1620 value = fields->f_LRAS;
1621 break;
1622 case FRV_OPERAND_TLBPRL :
1623 value = fields->f_TLBPRL;
1624 break;
1625 case FRV_OPERAND_TLBPROPX :
1626 value = fields->f_TLBPRopx;
1627 break;
1628 case FRV_OPERAND_AE :
1629 value = fields->f_ae;
1630 break;
1631 case FRV_OPERAND_CALLANN :
1632 value = fields->f_reloc_ann;
1633 break;
1634 case FRV_OPERAND_CCOND :
1635 value = fields->f_ccond;
1636 break;
1637 case FRV_OPERAND_COND :
1638 value = fields->f_cond;
1639 break;
1640 case FRV_OPERAND_D12 :
1641 value = fields->f_d12;
1642 break;
1643 case FRV_OPERAND_DEBUG :
1644 value = fields->f_debug;
1645 break;
1646 case FRV_OPERAND_EIR :
1647 value = fields->f_eir;
1648 break;
1649 case FRV_OPERAND_HINT :
1650 value = fields->f_hint;
1651 break;
1652 case FRV_OPERAND_HINT_NOT_TAKEN :
1653 value = fields->f_hint;
1654 break;
1655 case FRV_OPERAND_HINT_TAKEN :
1656 value = fields->f_hint;
1657 break;
1658 case FRV_OPERAND_LABEL16 :
1659 value = fields->f_label16;
1660 break;
1661 case FRV_OPERAND_LABEL24 :
1662 value = fields->f_label24;
1663 break;
1664 case FRV_OPERAND_LDANN :
1665 value = fields->f_reloc_ann;
1666 break;
1667 case FRV_OPERAND_LDDANN :
1668 value = fields->f_reloc_ann;
1669 break;
1670 case FRV_OPERAND_LOCK :
1671 value = fields->f_lock;
1672 break;
1673 case FRV_OPERAND_PACK :
1674 value = fields->f_pack;
1675 break;
1676 case FRV_OPERAND_S10 :
1677 value = fields->f_s10;
1678 break;
1679 case FRV_OPERAND_S12 :
1680 value = fields->f_d12;
1681 break;
1682 case FRV_OPERAND_S16 :
1683 value = fields->f_s16;
1684 break;
1685 case FRV_OPERAND_S5 :
1686 value = fields->f_s5;
1687 break;
1688 case FRV_OPERAND_S6 :
1689 value = fields->f_s6;
1690 break;
1691 case FRV_OPERAND_S6_1 :
1692 value = fields->f_s6_1;
1693 break;
1694 case FRV_OPERAND_SLO16 :
1695 value = fields->f_s16;
1696 break;
1697 case FRV_OPERAND_SPR :
1698 value = fields->f_spr;
1699 break;
1700 case FRV_OPERAND_U12 :
1701 value = fields->f_u12;
1702 break;
1703 case FRV_OPERAND_U16 :
1704 value = fields->f_u16;
1705 break;
1706 case FRV_OPERAND_U6 :
1707 value = fields->f_u6;
1708 break;
1709 case FRV_OPERAND_UHI16 :
1710 value = fields->f_u16;
1711 break;
1712 case FRV_OPERAND_ULO16 :
1713 value = fields->f_u16;
1714 break;
1716 default :
1717 /* xgettext:c-format */
1718 opcodes_error_handler
1719 (_("internal error: unrecognized field %d while getting vma operand"),
1720 opindex);
1721 abort ();
1724 return value;
1727 void frv_cgen_set_int_operand (CGEN_CPU_DESC, int, CGEN_FIELDS *, int);
1728 void frv_cgen_set_vma_operand (CGEN_CPU_DESC, int, CGEN_FIELDS *, bfd_vma);
1730 /* Stuffing values in cgen_fields is handled by a collection of functions.
1731 They are distinguished by the type of the VALUE argument they accept.
1732 TODO: floating point, inlining support, remove cases where argument type
1733 not appropriate. */
1735 void
1736 frv_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1737 int opindex,
1738 CGEN_FIELDS * fields,
1739 int value)
1741 switch (opindex)
1743 case FRV_OPERAND_A0 :
1744 fields->f_A = value;
1745 break;
1746 case FRV_OPERAND_A1 :
1747 fields->f_A = value;
1748 break;
1749 case FRV_OPERAND_ACC40SI :
1750 fields->f_ACC40Si = value;
1751 break;
1752 case FRV_OPERAND_ACC40SK :
1753 fields->f_ACC40Sk = value;
1754 break;
1755 case FRV_OPERAND_ACC40UI :
1756 fields->f_ACC40Ui = value;
1757 break;
1758 case FRV_OPERAND_ACC40UK :
1759 fields->f_ACC40Uk = value;
1760 break;
1761 case FRV_OPERAND_ACCGI :
1762 fields->f_ACCGi = value;
1763 break;
1764 case FRV_OPERAND_ACCGK :
1765 fields->f_ACCGk = value;
1766 break;
1767 case FRV_OPERAND_CCI :
1768 fields->f_CCi = value;
1769 break;
1770 case FRV_OPERAND_CPRDOUBLEK :
1771 fields->f_CPRk = value;
1772 break;
1773 case FRV_OPERAND_CPRI :
1774 fields->f_CPRi = value;
1775 break;
1776 case FRV_OPERAND_CPRJ :
1777 fields->f_CPRj = value;
1778 break;
1779 case FRV_OPERAND_CPRK :
1780 fields->f_CPRk = value;
1781 break;
1782 case FRV_OPERAND_CRI :
1783 fields->f_CRi = value;
1784 break;
1785 case FRV_OPERAND_CRJ :
1786 fields->f_CRj = value;
1787 break;
1788 case FRV_OPERAND_CRJ_FLOAT :
1789 fields->f_CRj_float = value;
1790 break;
1791 case FRV_OPERAND_CRJ_INT :
1792 fields->f_CRj_int = value;
1793 break;
1794 case FRV_OPERAND_CRK :
1795 fields->f_CRk = value;
1796 break;
1797 case FRV_OPERAND_FCCI_1 :
1798 fields->f_FCCi_1 = value;
1799 break;
1800 case FRV_OPERAND_FCCI_2 :
1801 fields->f_FCCi_2 = value;
1802 break;
1803 case FRV_OPERAND_FCCI_3 :
1804 fields->f_FCCi_3 = value;
1805 break;
1806 case FRV_OPERAND_FCCK :
1807 fields->f_FCCk = value;
1808 break;
1809 case FRV_OPERAND_FRDOUBLEI :
1810 fields->f_FRi = value;
1811 break;
1812 case FRV_OPERAND_FRDOUBLEJ :
1813 fields->f_FRj = value;
1814 break;
1815 case FRV_OPERAND_FRDOUBLEK :
1816 fields->f_FRk = value;
1817 break;
1818 case FRV_OPERAND_FRI :
1819 fields->f_FRi = value;
1820 break;
1821 case FRV_OPERAND_FRINTI :
1822 fields->f_FRi = value;
1823 break;
1824 case FRV_OPERAND_FRINTIEVEN :
1825 fields->f_FRi = value;
1826 break;
1827 case FRV_OPERAND_FRINTJ :
1828 fields->f_FRj = value;
1829 break;
1830 case FRV_OPERAND_FRINTJEVEN :
1831 fields->f_FRj = value;
1832 break;
1833 case FRV_OPERAND_FRINTK :
1834 fields->f_FRk = value;
1835 break;
1836 case FRV_OPERAND_FRINTKEVEN :
1837 fields->f_FRk = value;
1838 break;
1839 case FRV_OPERAND_FRJ :
1840 fields->f_FRj = value;
1841 break;
1842 case FRV_OPERAND_FRK :
1843 fields->f_FRk = value;
1844 break;
1845 case FRV_OPERAND_FRKHI :
1846 fields->f_FRk = value;
1847 break;
1848 case FRV_OPERAND_FRKLO :
1849 fields->f_FRk = value;
1850 break;
1851 case FRV_OPERAND_GRDOUBLEK :
1852 fields->f_GRk = value;
1853 break;
1854 case FRV_OPERAND_GRI :
1855 fields->f_GRi = value;
1856 break;
1857 case FRV_OPERAND_GRJ :
1858 fields->f_GRj = value;
1859 break;
1860 case FRV_OPERAND_GRK :
1861 fields->f_GRk = value;
1862 break;
1863 case FRV_OPERAND_GRKHI :
1864 fields->f_GRk = value;
1865 break;
1866 case FRV_OPERAND_GRKLO :
1867 fields->f_GRk = value;
1868 break;
1869 case FRV_OPERAND_ICCI_1 :
1870 fields->f_ICCi_1 = value;
1871 break;
1872 case FRV_OPERAND_ICCI_2 :
1873 fields->f_ICCi_2 = value;
1874 break;
1875 case FRV_OPERAND_ICCI_3 :
1876 fields->f_ICCi_3 = value;
1877 break;
1878 case FRV_OPERAND_LI :
1879 fields->f_LI = value;
1880 break;
1881 case FRV_OPERAND_LRAD :
1882 fields->f_LRAD = value;
1883 break;
1884 case FRV_OPERAND_LRAE :
1885 fields->f_LRAE = value;
1886 break;
1887 case FRV_OPERAND_LRAS :
1888 fields->f_LRAS = value;
1889 break;
1890 case FRV_OPERAND_TLBPRL :
1891 fields->f_TLBPRL = value;
1892 break;
1893 case FRV_OPERAND_TLBPROPX :
1894 fields->f_TLBPRopx = value;
1895 break;
1896 case FRV_OPERAND_AE :
1897 fields->f_ae = value;
1898 break;
1899 case FRV_OPERAND_CALLANN :
1900 fields->f_reloc_ann = value;
1901 break;
1902 case FRV_OPERAND_CCOND :
1903 fields->f_ccond = value;
1904 break;
1905 case FRV_OPERAND_COND :
1906 fields->f_cond = value;
1907 break;
1908 case FRV_OPERAND_D12 :
1909 fields->f_d12 = value;
1910 break;
1911 case FRV_OPERAND_DEBUG :
1912 fields->f_debug = value;
1913 break;
1914 case FRV_OPERAND_EIR :
1915 fields->f_eir = value;
1916 break;
1917 case FRV_OPERAND_HINT :
1918 fields->f_hint = value;
1919 break;
1920 case FRV_OPERAND_HINT_NOT_TAKEN :
1921 fields->f_hint = value;
1922 break;
1923 case FRV_OPERAND_HINT_TAKEN :
1924 fields->f_hint = value;
1925 break;
1926 case FRV_OPERAND_LABEL16 :
1927 fields->f_label16 = value;
1928 break;
1929 case FRV_OPERAND_LABEL24 :
1930 fields->f_label24 = value;
1931 break;
1932 case FRV_OPERAND_LDANN :
1933 fields->f_reloc_ann = value;
1934 break;
1935 case FRV_OPERAND_LDDANN :
1936 fields->f_reloc_ann = value;
1937 break;
1938 case FRV_OPERAND_LOCK :
1939 fields->f_lock = value;
1940 break;
1941 case FRV_OPERAND_PACK :
1942 fields->f_pack = value;
1943 break;
1944 case FRV_OPERAND_S10 :
1945 fields->f_s10 = value;
1946 break;
1947 case FRV_OPERAND_S12 :
1948 fields->f_d12 = value;
1949 break;
1950 case FRV_OPERAND_S16 :
1951 fields->f_s16 = value;
1952 break;
1953 case FRV_OPERAND_S5 :
1954 fields->f_s5 = value;
1955 break;
1956 case FRV_OPERAND_S6 :
1957 fields->f_s6 = value;
1958 break;
1959 case FRV_OPERAND_S6_1 :
1960 fields->f_s6_1 = value;
1961 break;
1962 case FRV_OPERAND_SLO16 :
1963 fields->f_s16 = value;
1964 break;
1965 case FRV_OPERAND_SPR :
1966 fields->f_spr = value;
1967 break;
1968 case FRV_OPERAND_U12 :
1969 fields->f_u12 = value;
1970 break;
1971 case FRV_OPERAND_U16 :
1972 fields->f_u16 = value;
1973 break;
1974 case FRV_OPERAND_U6 :
1975 fields->f_u6 = value;
1976 break;
1977 case FRV_OPERAND_UHI16 :
1978 fields->f_u16 = value;
1979 break;
1980 case FRV_OPERAND_ULO16 :
1981 fields->f_u16 = value;
1982 break;
1984 default :
1985 /* xgettext:c-format */
1986 opcodes_error_handler
1987 (_("internal error: unrecognized field %d while setting int operand"),
1988 opindex);
1989 abort ();
1993 void
1994 frv_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1995 int opindex,
1996 CGEN_FIELDS * fields,
1997 bfd_vma value)
1999 switch (opindex)
2001 case FRV_OPERAND_A0 :
2002 fields->f_A = value;
2003 break;
2004 case FRV_OPERAND_A1 :
2005 fields->f_A = value;
2006 break;
2007 case FRV_OPERAND_ACC40SI :
2008 fields->f_ACC40Si = value;
2009 break;
2010 case FRV_OPERAND_ACC40SK :
2011 fields->f_ACC40Sk = value;
2012 break;
2013 case FRV_OPERAND_ACC40UI :
2014 fields->f_ACC40Ui = value;
2015 break;
2016 case FRV_OPERAND_ACC40UK :
2017 fields->f_ACC40Uk = value;
2018 break;
2019 case FRV_OPERAND_ACCGI :
2020 fields->f_ACCGi = value;
2021 break;
2022 case FRV_OPERAND_ACCGK :
2023 fields->f_ACCGk = value;
2024 break;
2025 case FRV_OPERAND_CCI :
2026 fields->f_CCi = value;
2027 break;
2028 case FRV_OPERAND_CPRDOUBLEK :
2029 fields->f_CPRk = value;
2030 break;
2031 case FRV_OPERAND_CPRI :
2032 fields->f_CPRi = value;
2033 break;
2034 case FRV_OPERAND_CPRJ :
2035 fields->f_CPRj = value;
2036 break;
2037 case FRV_OPERAND_CPRK :
2038 fields->f_CPRk = value;
2039 break;
2040 case FRV_OPERAND_CRI :
2041 fields->f_CRi = value;
2042 break;
2043 case FRV_OPERAND_CRJ :
2044 fields->f_CRj = value;
2045 break;
2046 case FRV_OPERAND_CRJ_FLOAT :
2047 fields->f_CRj_float = value;
2048 break;
2049 case FRV_OPERAND_CRJ_INT :
2050 fields->f_CRj_int = value;
2051 break;
2052 case FRV_OPERAND_CRK :
2053 fields->f_CRk = value;
2054 break;
2055 case FRV_OPERAND_FCCI_1 :
2056 fields->f_FCCi_1 = value;
2057 break;
2058 case FRV_OPERAND_FCCI_2 :
2059 fields->f_FCCi_2 = value;
2060 break;
2061 case FRV_OPERAND_FCCI_3 :
2062 fields->f_FCCi_3 = value;
2063 break;
2064 case FRV_OPERAND_FCCK :
2065 fields->f_FCCk = value;
2066 break;
2067 case FRV_OPERAND_FRDOUBLEI :
2068 fields->f_FRi = value;
2069 break;
2070 case FRV_OPERAND_FRDOUBLEJ :
2071 fields->f_FRj = value;
2072 break;
2073 case FRV_OPERAND_FRDOUBLEK :
2074 fields->f_FRk = value;
2075 break;
2076 case FRV_OPERAND_FRI :
2077 fields->f_FRi = value;
2078 break;
2079 case FRV_OPERAND_FRINTI :
2080 fields->f_FRi = value;
2081 break;
2082 case FRV_OPERAND_FRINTIEVEN :
2083 fields->f_FRi = value;
2084 break;
2085 case FRV_OPERAND_FRINTJ :
2086 fields->f_FRj = value;
2087 break;
2088 case FRV_OPERAND_FRINTJEVEN :
2089 fields->f_FRj = value;
2090 break;
2091 case FRV_OPERAND_FRINTK :
2092 fields->f_FRk = value;
2093 break;
2094 case FRV_OPERAND_FRINTKEVEN :
2095 fields->f_FRk = value;
2096 break;
2097 case FRV_OPERAND_FRJ :
2098 fields->f_FRj = value;
2099 break;
2100 case FRV_OPERAND_FRK :
2101 fields->f_FRk = value;
2102 break;
2103 case FRV_OPERAND_FRKHI :
2104 fields->f_FRk = value;
2105 break;
2106 case FRV_OPERAND_FRKLO :
2107 fields->f_FRk = value;
2108 break;
2109 case FRV_OPERAND_GRDOUBLEK :
2110 fields->f_GRk = value;
2111 break;
2112 case FRV_OPERAND_GRI :
2113 fields->f_GRi = value;
2114 break;
2115 case FRV_OPERAND_GRJ :
2116 fields->f_GRj = value;
2117 break;
2118 case FRV_OPERAND_GRK :
2119 fields->f_GRk = value;
2120 break;
2121 case FRV_OPERAND_GRKHI :
2122 fields->f_GRk = value;
2123 break;
2124 case FRV_OPERAND_GRKLO :
2125 fields->f_GRk = value;
2126 break;
2127 case FRV_OPERAND_ICCI_1 :
2128 fields->f_ICCi_1 = value;
2129 break;
2130 case FRV_OPERAND_ICCI_2 :
2131 fields->f_ICCi_2 = value;
2132 break;
2133 case FRV_OPERAND_ICCI_3 :
2134 fields->f_ICCi_3 = value;
2135 break;
2136 case FRV_OPERAND_LI :
2137 fields->f_LI = value;
2138 break;
2139 case FRV_OPERAND_LRAD :
2140 fields->f_LRAD = value;
2141 break;
2142 case FRV_OPERAND_LRAE :
2143 fields->f_LRAE = value;
2144 break;
2145 case FRV_OPERAND_LRAS :
2146 fields->f_LRAS = value;
2147 break;
2148 case FRV_OPERAND_TLBPRL :
2149 fields->f_TLBPRL = value;
2150 break;
2151 case FRV_OPERAND_TLBPROPX :
2152 fields->f_TLBPRopx = value;
2153 break;
2154 case FRV_OPERAND_AE :
2155 fields->f_ae = value;
2156 break;
2157 case FRV_OPERAND_CALLANN :
2158 fields->f_reloc_ann = value;
2159 break;
2160 case FRV_OPERAND_CCOND :
2161 fields->f_ccond = value;
2162 break;
2163 case FRV_OPERAND_COND :
2164 fields->f_cond = value;
2165 break;
2166 case FRV_OPERAND_D12 :
2167 fields->f_d12 = value;
2168 break;
2169 case FRV_OPERAND_DEBUG :
2170 fields->f_debug = value;
2171 break;
2172 case FRV_OPERAND_EIR :
2173 fields->f_eir = value;
2174 break;
2175 case FRV_OPERAND_HINT :
2176 fields->f_hint = value;
2177 break;
2178 case FRV_OPERAND_HINT_NOT_TAKEN :
2179 fields->f_hint = value;
2180 break;
2181 case FRV_OPERAND_HINT_TAKEN :
2182 fields->f_hint = value;
2183 break;
2184 case FRV_OPERAND_LABEL16 :
2185 fields->f_label16 = value;
2186 break;
2187 case FRV_OPERAND_LABEL24 :
2188 fields->f_label24 = value;
2189 break;
2190 case FRV_OPERAND_LDANN :
2191 fields->f_reloc_ann = value;
2192 break;
2193 case FRV_OPERAND_LDDANN :
2194 fields->f_reloc_ann = value;
2195 break;
2196 case FRV_OPERAND_LOCK :
2197 fields->f_lock = value;
2198 break;
2199 case FRV_OPERAND_PACK :
2200 fields->f_pack = value;
2201 break;
2202 case FRV_OPERAND_S10 :
2203 fields->f_s10 = value;
2204 break;
2205 case FRV_OPERAND_S12 :
2206 fields->f_d12 = value;
2207 break;
2208 case FRV_OPERAND_S16 :
2209 fields->f_s16 = value;
2210 break;
2211 case FRV_OPERAND_S5 :
2212 fields->f_s5 = value;
2213 break;
2214 case FRV_OPERAND_S6 :
2215 fields->f_s6 = value;
2216 break;
2217 case FRV_OPERAND_S6_1 :
2218 fields->f_s6_1 = value;
2219 break;
2220 case FRV_OPERAND_SLO16 :
2221 fields->f_s16 = value;
2222 break;
2223 case FRV_OPERAND_SPR :
2224 fields->f_spr = value;
2225 break;
2226 case FRV_OPERAND_U12 :
2227 fields->f_u12 = value;
2228 break;
2229 case FRV_OPERAND_U16 :
2230 fields->f_u16 = value;
2231 break;
2232 case FRV_OPERAND_U6 :
2233 fields->f_u6 = value;
2234 break;
2235 case FRV_OPERAND_UHI16 :
2236 fields->f_u16 = value;
2237 break;
2238 case FRV_OPERAND_ULO16 :
2239 fields->f_u16 = value;
2240 break;
2242 default :
2243 /* xgettext:c-format */
2244 opcodes_error_handler
2245 (_("internal error: unrecognized field %d while setting vma operand"),
2246 opindex);
2247 abort ();
2251 /* Function to call before using the instruction builder tables. */
2253 void
2254 frv_cgen_init_ibld_table (CGEN_CPU_DESC cd)
2256 cd->insert_handlers = & frv_cgen_insert_handlers[0];
2257 cd->extract_handlers = & frv_cgen_extract_handlers[0];
2259 cd->insert_operand = frv_cgen_insert_operand;
2260 cd->extract_operand = frv_cgen_extract_operand;
2262 cd->get_int_operand = frv_cgen_get_int_operand;
2263 cd->set_int_operand = frv_cgen_set_int_operand;
2264 cd->get_vma_operand = frv_cgen_get_vma_operand;
2265 cd->set_vma_operand = frv_cgen_set_vma_operand;