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