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, 2005
7 Free Software Foundation, Inc.
9 This file is part of the GNU Binutils and GDB, the GNU debugger.
11 This program 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 2, or (at your option)
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public 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.
37 #include "safe-ctype.h"
40 #define min(a,b) ((a) < (b) ? (a) : (b))
42 #define max(a,b) ((a) > (b) ? (a) : (b))
44 /* Used by the ifield rtx function. */
45 #define FLD(f) (fields->f)
47 static const char * insert_normal
48 (CGEN_CPU_DESC
, long, unsigned int, unsigned int, unsigned int,
49 unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR
);
50 static const char * insert_insn_normal
51 (CGEN_CPU_DESC
, const CGEN_INSN
*,
52 CGEN_FIELDS
*, CGEN_INSN_BYTES_PTR
, bfd_vma
);
53 static int extract_normal
54 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
,
55 unsigned int, unsigned int, unsigned int, unsigned int,
56 unsigned int, unsigned int, bfd_vma
, long *);
57 static int extract_insn_normal
58 (CGEN_CPU_DESC
, const CGEN_INSN
*, CGEN_EXTRACT_INFO
*,
59 CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
61 static void put_insn_int_value
62 (CGEN_CPU_DESC
, CGEN_INSN_BYTES_PTR
, int, int, CGEN_INSN_INT
);
65 static CGEN_INLINE
void insert_1
66 (CGEN_CPU_DESC
, unsigned long, int, int, int, unsigned char *);
67 static CGEN_INLINE
int fill_cache
68 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, int, int, bfd_vma
);
69 static CGEN_INLINE
long extract_1
70 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, int, int, int, unsigned char *, bfd_vma
);
73 /* Operand insertion. */
77 /* Subroutine of insert_normal. */
79 static CGEN_INLINE
void
80 insert_1 (CGEN_CPU_DESC cd
,
90 x
= cgen_get_insn_value (cd
, bufp
, word_length
);
92 /* Written this way to avoid undefined behaviour. */
93 mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
95 shift
= (start
+ 1) - length
;
97 shift
= (word_length
- (start
+ length
));
98 x
= (x
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
100 cgen_put_insn_value (cd
, bufp
, word_length
, (bfd_vma
) x
);
103 #endif /* ! CGEN_INT_INSN_P */
105 /* Default insertion routine.
107 ATTRS is a mask of the boolean attributes.
108 WORD_OFFSET is the offset in bits from the start of the insn of the value.
109 WORD_LENGTH is the length of the word in bits in which the value resides.
110 START is the starting bit number in the word, architecture origin.
111 LENGTH is the length of VALUE in bits.
112 TOTAL_LENGTH is the total length of the insn in bits.
114 The result is an error message or NULL if success. */
116 /* ??? This duplicates functionality with bfd's howto table and
117 bfd_install_relocation. */
118 /* ??? This doesn't handle bfd_vma's. Create another function when
122 insert_normal (CGEN_CPU_DESC cd
,
125 unsigned int word_offset
,
128 unsigned int word_length
,
129 unsigned int total_length
,
130 CGEN_INSN_BYTES_PTR buffer
)
132 static char errbuf
[100];
133 /* Written this way to avoid undefined behaviour. */
134 unsigned long mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
136 /* If LENGTH is zero, this operand doesn't contribute to the value. */
140 if (word_length
> 32)
143 /* For architectures with insns smaller than the base-insn-bitsize,
144 word_length may be too big. */
145 if (cd
->min_insn_bitsize
< cd
->base_insn_bitsize
)
148 && word_length
> total_length
)
149 word_length
= total_length
;
152 /* Ensure VALUE will fit. */
153 if (CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGN_OPT
))
155 long minval
= - (1L << (length
- 1));
156 unsigned long maxval
= mask
;
158 if ((value
> 0 && (unsigned long) value
> maxval
)
161 /* xgettext:c-format */
163 _("operand out of range (%ld not between %ld and %lu)"),
164 value
, minval
, maxval
);
168 else if (! CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGNED
))
170 unsigned long maxval
= mask
;
172 if ((unsigned long) value
> maxval
)
174 /* xgettext:c-format */
176 _("operand out of range (%lu not between 0 and %lu)"),
183 if (! cgen_signed_overflow_ok_p (cd
))
185 long minval
= - (1L << (length
- 1));
186 long maxval
= (1L << (length
- 1)) - 1;
188 if (value
< minval
|| value
> maxval
)
191 /* xgettext:c-format */
192 (errbuf
, _("operand out of range (%ld not between %ld and %ld)"),
193 value
, minval
, maxval
);
204 if (CGEN_INSN_LSB0_P
)
205 shift
= (word_offset
+ start
+ 1) - length
;
207 shift
= total_length
- (word_offset
+ start
+ length
);
208 *buffer
= (*buffer
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
211 #else /* ! CGEN_INT_INSN_P */
214 unsigned char *bufp
= (unsigned char *) buffer
+ word_offset
/ 8;
216 insert_1 (cd
, value
, start
, length
, word_length
, bufp
);
219 #endif /* ! CGEN_INT_INSN_P */
224 /* Default insn builder (insert handler).
225 The instruction is recorded in CGEN_INT_INSN_P byte order (meaning
226 that if CGEN_INSN_BYTES_PTR is an int * and thus, the value is
227 recorded in host byte order, otherwise BUFFER is an array of bytes
228 and the value is recorded in target byte order).
229 The result is an error message or NULL if success. */
232 insert_insn_normal (CGEN_CPU_DESC cd
,
233 const CGEN_INSN
* insn
,
234 CGEN_FIELDS
* fields
,
235 CGEN_INSN_BYTES_PTR buffer
,
238 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
240 const CGEN_SYNTAX_CHAR_TYPE
* syn
;
242 CGEN_INIT_INSERT (cd
);
243 value
= CGEN_INSN_BASE_VALUE (insn
);
245 /* If we're recording insns as numbers (rather than a string of bytes),
246 target byte order handling is deferred until later. */
250 put_insn_int_value (cd
, buffer
, cd
->base_insn_bitsize
,
251 CGEN_FIELDS_BITSIZE (fields
), value
);
255 cgen_put_insn_value (cd
, buffer
, min ((unsigned) cd
->base_insn_bitsize
,
256 (unsigned) CGEN_FIELDS_BITSIZE (fields
)),
259 #endif /* ! CGEN_INT_INSN_P */
261 /* ??? It would be better to scan the format's fields.
262 Still need to be able to insert a value based on the operand though;
263 e.g. storing a branch displacement that got resolved later.
264 Needs more thought first. */
266 for (syn
= CGEN_SYNTAX_STRING (syntax
); * syn
; ++ syn
)
270 if (CGEN_SYNTAX_CHAR_P (* syn
))
273 errmsg
= (* cd
->insert_operand
) (cd
, CGEN_SYNTAX_FIELD (*syn
),
283 /* Cover function to store an insn value into an integral insn. Must go here
284 because it needs <prefix>-desc.h for CGEN_INT_INSN_P. */
287 put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
288 CGEN_INSN_BYTES_PTR buf
,
293 /* For architectures with insns smaller than the base-insn-bitsize,
294 length may be too big. */
295 if (length
> insn_length
)
299 int shift
= insn_length
- length
;
300 /* Written this way to avoid undefined behaviour. */
301 CGEN_INSN_INT mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
303 *buf
= (*buf
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
308 /* Operand extraction. */
310 #if ! CGEN_INT_INSN_P
312 /* Subroutine of extract_normal.
313 Ensure sufficient bytes are cached in EX_INFO.
314 OFFSET is the offset in bytes from the start of the insn of the value.
315 BYTES is the length of the needed value.
316 Returns 1 for success, 0 for failure. */
318 static CGEN_INLINE
int
319 fill_cache (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
320 CGEN_EXTRACT_INFO
*ex_info
,
325 /* It's doubtful that the middle part has already been fetched so
326 we don't optimize that case. kiss. */
328 disassemble_info
*info
= (disassemble_info
*) ex_info
->dis_info
;
330 /* First do a quick check. */
331 mask
= (1 << bytes
) - 1;
332 if (((ex_info
->valid
>> offset
) & mask
) == mask
)
335 /* Search for the first byte we need to read. */
336 for (mask
= 1 << offset
; bytes
> 0; --bytes
, ++offset
, mask
<<= 1)
337 if (! (mask
& ex_info
->valid
))
345 status
= (*info
->read_memory_func
)
346 (pc
, ex_info
->insn_bytes
+ offset
, bytes
, info
);
350 (*info
->memory_error_func
) (status
, pc
, info
);
354 ex_info
->valid
|= ((1 << bytes
) - 1) << offset
;
360 /* Subroutine of extract_normal. */
362 static CGEN_INLINE
long
363 extract_1 (CGEN_CPU_DESC cd
,
364 CGEN_EXTRACT_INFO
*ex_info ATTRIBUTE_UNUSED
,
369 bfd_vma pc ATTRIBUTE_UNUSED
)
374 x
= cgen_get_insn_value (cd
, bufp
, word_length
);
376 if (CGEN_INSN_LSB0_P
)
377 shift
= (start
+ 1) - length
;
379 shift
= (word_length
- (start
+ length
));
383 #endif /* ! CGEN_INT_INSN_P */
385 /* Default extraction routine.
387 INSN_VALUE is the first base_insn_bitsize bits of the insn in host order,
388 or sometimes less for cases like the m32r where the base insn size is 32
389 but some insns are 16 bits.
390 ATTRS is a mask of the boolean attributes. We only need `SIGNED',
391 but for generality we take a bitmask of all of them.
392 WORD_OFFSET is the offset in bits from the start of the insn of the value.
393 WORD_LENGTH is the length of the word in bits in which the value resides.
394 START is the starting bit number in the word, architecture origin.
395 LENGTH is the length of VALUE in bits.
396 TOTAL_LENGTH is the total length of the insn in bits.
398 Returns 1 for success, 0 for failure. */
400 /* ??? The return code isn't properly used. wip. */
402 /* ??? This doesn't handle bfd_vma's. Create another function when
406 extract_normal (CGEN_CPU_DESC cd
,
407 #if ! CGEN_INT_INSN_P
408 CGEN_EXTRACT_INFO
*ex_info
,
410 CGEN_EXTRACT_INFO
*ex_info ATTRIBUTE_UNUSED
,
412 CGEN_INSN_INT insn_value
,
414 unsigned int word_offset
,
417 unsigned int word_length
,
418 unsigned int total_length
,
419 #if ! CGEN_INT_INSN_P
422 bfd_vma pc ATTRIBUTE_UNUSED
,
428 /* If LENGTH is zero, this operand doesn't contribute to the value
429 so give it a standard value of zero. */
436 if (word_length
> 32)
439 /* For architectures with insns smaller than the insn-base-bitsize,
440 word_length may be too big. */
441 if (cd
->min_insn_bitsize
< cd
->base_insn_bitsize
)
444 && word_length
> total_length
)
445 word_length
= total_length
;
448 /* Does the value reside in INSN_VALUE, and at the right alignment? */
450 if (CGEN_INT_INSN_P
|| (word_offset
== 0 && word_length
== total_length
))
452 if (CGEN_INSN_LSB0_P
)
453 value
= insn_value
>> ((word_offset
+ start
+ 1) - length
);
455 value
= insn_value
>> (total_length
- ( word_offset
+ start
+ length
));
458 #if ! CGEN_INT_INSN_P
462 unsigned char *bufp
= ex_info
->insn_bytes
+ word_offset
/ 8;
464 if (word_length
> 32)
467 if (fill_cache (cd
, ex_info
, word_offset
/ 8, word_length
/ 8, pc
) == 0)
470 value
= extract_1 (cd
, ex_info
, start
, length
, word_length
, bufp
, pc
);
473 #endif /* ! CGEN_INT_INSN_P */
475 /* Written this way to avoid undefined behaviour. */
476 mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
480 if (CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGNED
)
481 && (value
& (1L << (length
- 1))))
489 /* Default insn extractor.
491 INSN_VALUE is the first base_insn_bitsize bits, translated to host order.
492 The extracted fields are stored in FIELDS.
493 EX_INFO is used to handle reading variable length insns.
494 Return the length of the insn in bits, or 0 if no match,
495 or -1 if an error occurs fetching data (memory_error_func will have
499 extract_insn_normal (CGEN_CPU_DESC cd
,
500 const CGEN_INSN
*insn
,
501 CGEN_EXTRACT_INFO
*ex_info
,
502 CGEN_INSN_INT insn_value
,
506 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
507 const CGEN_SYNTAX_CHAR_TYPE
*syn
;
509 CGEN_FIELDS_BITSIZE (fields
) = CGEN_INSN_BITSIZE (insn
);
511 CGEN_INIT_EXTRACT (cd
);
513 for (syn
= CGEN_SYNTAX_STRING (syntax
); *syn
; ++syn
)
517 if (CGEN_SYNTAX_CHAR_P (*syn
))
520 length
= (* cd
->extract_operand
) (cd
, CGEN_SYNTAX_FIELD (*syn
),
521 ex_info
, insn_value
, fields
, pc
);
526 /* We recognized and successfully extracted this insn. */
527 return CGEN_INSN_BITSIZE (insn
);
530 /* Machine generated code added here. */
532 const char * frv_cgen_insert_operand
533 (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, CGEN_INSN_BYTES_PTR
, bfd_vma
);
535 /* Main entry point for operand insertion.
537 This function is basically just a big switch statement. Earlier versions
538 used tables to look up the function to use, but
539 - if the table contains both assembler and disassembler functions then
540 the disassembler contains much of the assembler and vice-versa,
541 - there's a lot of inlining possibilities as things grow,
542 - using a switch statement avoids the function call overhead.
544 This function could be moved into `parse_insn_normal', but keeping it
545 separate makes clear the interface between `parse_insn_normal' and each of
546 the handlers. It's also needed by GAS to insert operands that couldn't be
547 resolved during parsing. */
550 frv_cgen_insert_operand (CGEN_CPU_DESC cd
,
552 CGEN_FIELDS
* fields
,
553 CGEN_INSN_BYTES_PTR buffer
,
554 bfd_vma pc ATTRIBUTE_UNUSED
)
556 const char * errmsg
= NULL
;
557 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
561 case FRV_OPERAND_A0
:
562 errmsg
= insert_normal (cd
, fields
->f_A
, 0, 0, 17, 1, 32, total_length
, buffer
);
564 case FRV_OPERAND_A1
:
565 errmsg
= insert_normal (cd
, fields
->f_A
, 0, 0, 17, 1, 32, total_length
, buffer
);
567 case FRV_OPERAND_ACC40SI
:
568 errmsg
= insert_normal (cd
, fields
->f_ACC40Si
, 0, 0, 17, 6, 32, total_length
, buffer
);
570 case FRV_OPERAND_ACC40SK
:
571 errmsg
= insert_normal (cd
, fields
->f_ACC40Sk
, 0, 0, 30, 6, 32, total_length
, buffer
);
573 case FRV_OPERAND_ACC40UI
:
574 errmsg
= insert_normal (cd
, fields
->f_ACC40Ui
, 0, 0, 17, 6, 32, total_length
, buffer
);
576 case FRV_OPERAND_ACC40UK
:
577 errmsg
= insert_normal (cd
, fields
->f_ACC40Uk
, 0, 0, 30, 6, 32, total_length
, buffer
);
579 case FRV_OPERAND_ACCGI
:
580 errmsg
= insert_normal (cd
, fields
->f_ACCGi
, 0, 0, 17, 6, 32, total_length
, buffer
);
582 case FRV_OPERAND_ACCGK
:
583 errmsg
= insert_normal (cd
, fields
->f_ACCGk
, 0, 0, 30, 6, 32, total_length
, buffer
);
585 case FRV_OPERAND_CCI
:
586 errmsg
= insert_normal (cd
, fields
->f_CCi
, 0, 0, 11, 3, 32, total_length
, buffer
);
588 case FRV_OPERAND_CPRDOUBLEK
:
589 errmsg
= insert_normal (cd
, fields
->f_CPRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
591 case FRV_OPERAND_CPRI
:
592 errmsg
= insert_normal (cd
, fields
->f_CPRi
, 0, 0, 17, 6, 32, total_length
, buffer
);
594 case FRV_OPERAND_CPRJ
:
595 errmsg
= insert_normal (cd
, fields
->f_CPRj
, 0, 0, 5, 6, 32, total_length
, buffer
);
597 case FRV_OPERAND_CPRK
:
598 errmsg
= insert_normal (cd
, fields
->f_CPRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
600 case FRV_OPERAND_CRI
:
601 errmsg
= insert_normal (cd
, fields
->f_CRi
, 0, 0, 14, 3, 32, total_length
, buffer
);
603 case FRV_OPERAND_CRJ
:
604 errmsg
= insert_normal (cd
, fields
->f_CRj
, 0, 0, 2, 3, 32, total_length
, buffer
);
606 case FRV_OPERAND_CRJ_FLOAT
:
607 errmsg
= insert_normal (cd
, fields
->f_CRj_float
, 0, 0, 26, 2, 32, total_length
, buffer
);
609 case FRV_OPERAND_CRJ_INT
:
611 long value
= fields
->f_CRj_int
;
612 value
= ((value
) - (4));
613 errmsg
= insert_normal (cd
, value
, 0, 0, 26, 2, 32, total_length
, buffer
);
616 case FRV_OPERAND_CRK
:
617 errmsg
= insert_normal (cd
, fields
->f_CRk
, 0, 0, 27, 3, 32, total_length
, buffer
);
619 case FRV_OPERAND_FCCI_1
:
620 errmsg
= insert_normal (cd
, fields
->f_FCCi_1
, 0, 0, 11, 2, 32, total_length
, buffer
);
622 case FRV_OPERAND_FCCI_2
:
623 errmsg
= insert_normal (cd
, fields
->f_FCCi_2
, 0, 0, 26, 2, 32, total_length
, buffer
);
625 case FRV_OPERAND_FCCI_3
:
626 errmsg
= insert_normal (cd
, fields
->f_FCCi_3
, 0, 0, 1, 2, 32, total_length
, buffer
);
628 case FRV_OPERAND_FCCK
:
629 errmsg
= insert_normal (cd
, fields
->f_FCCk
, 0, 0, 26, 2, 32, total_length
, buffer
);
631 case FRV_OPERAND_FRDOUBLEI
:
632 errmsg
= insert_normal (cd
, fields
->f_FRi
, 0, 0, 17, 6, 32, total_length
, buffer
);
634 case FRV_OPERAND_FRDOUBLEJ
:
635 errmsg
= insert_normal (cd
, fields
->f_FRj
, 0, 0, 5, 6, 32, total_length
, buffer
);
637 case FRV_OPERAND_FRDOUBLEK
:
638 errmsg
= insert_normal (cd
, fields
->f_FRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
640 case FRV_OPERAND_FRI
:
641 errmsg
= insert_normal (cd
, fields
->f_FRi
, 0, 0, 17, 6, 32, total_length
, buffer
);
643 case FRV_OPERAND_FRINTI
:
644 errmsg
= insert_normal (cd
, fields
->f_FRi
, 0, 0, 17, 6, 32, total_length
, buffer
);
646 case FRV_OPERAND_FRINTIEVEN
:
647 errmsg
= insert_normal (cd
, fields
->f_FRi
, 0, 0, 17, 6, 32, total_length
, buffer
);
649 case FRV_OPERAND_FRINTJ
:
650 errmsg
= insert_normal (cd
, fields
->f_FRj
, 0, 0, 5, 6, 32, total_length
, buffer
);
652 case FRV_OPERAND_FRINTJEVEN
:
653 errmsg
= insert_normal (cd
, fields
->f_FRj
, 0, 0, 5, 6, 32, total_length
, buffer
);
655 case FRV_OPERAND_FRINTK
:
656 errmsg
= insert_normal (cd
, fields
->f_FRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
658 case FRV_OPERAND_FRINTKEVEN
:
659 errmsg
= insert_normal (cd
, fields
->f_FRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
661 case FRV_OPERAND_FRJ
:
662 errmsg
= insert_normal (cd
, fields
->f_FRj
, 0, 0, 5, 6, 32, total_length
, buffer
);
664 case FRV_OPERAND_FRK
:
665 errmsg
= insert_normal (cd
, fields
->f_FRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
667 case FRV_OPERAND_FRKHI
:
668 errmsg
= insert_normal (cd
, fields
->f_FRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
670 case FRV_OPERAND_FRKLO
:
671 errmsg
= insert_normal (cd
, fields
->f_FRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
673 case FRV_OPERAND_GRDOUBLEK
:
674 errmsg
= insert_normal (cd
, fields
->f_GRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
676 case FRV_OPERAND_GRI
:
677 errmsg
= insert_normal (cd
, fields
->f_GRi
, 0, 0, 17, 6, 32, total_length
, buffer
);
679 case FRV_OPERAND_GRJ
:
680 errmsg
= insert_normal (cd
, fields
->f_GRj
, 0, 0, 5, 6, 32, total_length
, buffer
);
682 case FRV_OPERAND_GRK
:
683 errmsg
= insert_normal (cd
, fields
->f_GRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
685 case FRV_OPERAND_GRKHI
:
686 errmsg
= insert_normal (cd
, fields
->f_GRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
688 case FRV_OPERAND_GRKLO
:
689 errmsg
= insert_normal (cd
, fields
->f_GRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
691 case FRV_OPERAND_ICCI_1
:
692 errmsg
= insert_normal (cd
, fields
->f_ICCi_1
, 0, 0, 11, 2, 32, total_length
, buffer
);
694 case FRV_OPERAND_ICCI_2
:
695 errmsg
= insert_normal (cd
, fields
->f_ICCi_2
, 0, 0, 26, 2, 32, total_length
, buffer
);
697 case FRV_OPERAND_ICCI_3
:
698 errmsg
= insert_normal (cd
, fields
->f_ICCi_3
, 0, 0, 1, 2, 32, total_length
, buffer
);
700 case FRV_OPERAND_LI
:
701 errmsg
= insert_normal (cd
, fields
->f_LI
, 0, 0, 25, 1, 32, total_length
, buffer
);
703 case FRV_OPERAND_LRAD
:
704 errmsg
= insert_normal (cd
, fields
->f_LRAD
, 0, 0, 4, 1, 32, total_length
, buffer
);
706 case FRV_OPERAND_LRAE
:
707 errmsg
= insert_normal (cd
, fields
->f_LRAE
, 0, 0, 5, 1, 32, total_length
, buffer
);
709 case FRV_OPERAND_LRAS
:
710 errmsg
= insert_normal (cd
, fields
->f_LRAS
, 0, 0, 3, 1, 32, total_length
, buffer
);
712 case FRV_OPERAND_TLBPRL
:
713 errmsg
= insert_normal (cd
, fields
->f_TLBPRL
, 0, 0, 25, 1, 32, total_length
, buffer
);
715 case FRV_OPERAND_TLBPROPX
:
716 errmsg
= insert_normal (cd
, fields
->f_TLBPRopx
, 0, 0, 28, 3, 32, total_length
, buffer
);
718 case FRV_OPERAND_AE
:
719 errmsg
= insert_normal (cd
, fields
->f_ae
, 0, 0, 25, 1, 32, total_length
, buffer
);
721 case FRV_OPERAND_CALLANN
:
722 errmsg
= insert_normal (cd
, fields
->f_reloc_ann
, 0, 0, 0, 0, 32, total_length
, buffer
);
724 case FRV_OPERAND_CCOND
:
725 errmsg
= insert_normal (cd
, fields
->f_ccond
, 0, 0, 12, 1, 32, total_length
, buffer
);
727 case FRV_OPERAND_COND
:
728 errmsg
= insert_normal (cd
, fields
->f_cond
, 0, 0, 8, 1, 32, total_length
, buffer
);
730 case FRV_OPERAND_D12
:
731 errmsg
= insert_normal (cd
, fields
->f_d12
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 11, 12, 32, total_length
, buffer
);
733 case FRV_OPERAND_DEBUG
:
734 errmsg
= insert_normal (cd
, fields
->f_debug
, 0, 0, 25, 1, 32, total_length
, buffer
);
736 case FRV_OPERAND_EIR
:
737 errmsg
= insert_normal (cd
, fields
->f_eir
, 0, 0, 17, 6, 32, total_length
, buffer
);
739 case FRV_OPERAND_HINT
:
740 errmsg
= insert_normal (cd
, fields
->f_hint
, 0, 0, 17, 2, 32, total_length
, buffer
);
742 case FRV_OPERAND_HINT_NOT_TAKEN
:
743 errmsg
= insert_normal (cd
, fields
->f_hint
, 0, 0, 17, 2, 32, total_length
, buffer
);
745 case FRV_OPERAND_HINT_TAKEN
:
746 errmsg
= insert_normal (cd
, fields
->f_hint
, 0, 0, 17, 2, 32, total_length
, buffer
);
748 case FRV_OPERAND_LABEL16
:
750 long value
= fields
->f_label16
;
751 value
= ((int) (((value
) - (pc
))) >> (2));
752 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 15, 16, 32, total_length
, buffer
);
755 case FRV_OPERAND_LABEL24
:
758 FLD (f_labelH6
) = ((int) (((FLD (f_label24
)) - (pc
))) >> (20));
759 FLD (f_labelL18
) = ((((unsigned int) (((FLD (f_label24
)) - (pc
))) >> (2))) & (262143));
761 errmsg
= insert_normal (cd
, fields
->f_labelH6
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 30, 6, 32, total_length
, buffer
);
764 errmsg
= insert_normal (cd
, fields
->f_labelL18
, 0, 0, 17, 18, 32, total_length
, buffer
);
769 case FRV_OPERAND_LDANN
:
770 errmsg
= insert_normal (cd
, fields
->f_reloc_ann
, 0, 0, 0, 0, 32, total_length
, buffer
);
772 case FRV_OPERAND_LDDANN
:
773 errmsg
= insert_normal (cd
, fields
->f_reloc_ann
, 0, 0, 0, 0, 32, total_length
, buffer
);
775 case FRV_OPERAND_LOCK
:
776 errmsg
= insert_normal (cd
, fields
->f_lock
, 0, 0, 25, 1, 32, total_length
, buffer
);
778 case FRV_OPERAND_PACK
:
779 errmsg
= insert_normal (cd
, fields
->f_pack
, 0, 0, 31, 1, 32, total_length
, buffer
);
781 case FRV_OPERAND_S10
:
782 errmsg
= insert_normal (cd
, fields
->f_s10
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 9, 10, 32, total_length
, buffer
);
784 case FRV_OPERAND_S12
:
785 errmsg
= insert_normal (cd
, fields
->f_d12
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 11, 12, 32, total_length
, buffer
);
787 case FRV_OPERAND_S16
:
788 errmsg
= insert_normal (cd
, fields
->f_s16
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 15, 16, 32, total_length
, buffer
);
790 case FRV_OPERAND_S5
:
791 errmsg
= insert_normal (cd
, fields
->f_s5
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 4, 5, 32, total_length
, buffer
);
793 case FRV_OPERAND_S6
:
794 errmsg
= insert_normal (cd
, fields
->f_s6
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 5, 6, 32, total_length
, buffer
);
796 case FRV_OPERAND_S6_1
:
797 errmsg
= insert_normal (cd
, fields
->f_s6_1
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 11, 6, 32, total_length
, buffer
);
799 case FRV_OPERAND_SLO16
:
800 errmsg
= insert_normal (cd
, fields
->f_s16
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 15, 16, 32, total_length
, buffer
);
802 case FRV_OPERAND_SPR
:
805 FLD (f_spr_h
) = ((unsigned int) (FLD (f_spr
)) >> (6));
806 FLD (f_spr_l
) = ((FLD (f_spr
)) & (63));
808 errmsg
= insert_normal (cd
, fields
->f_spr_h
, 0, 0, 30, 6, 32, total_length
, buffer
);
811 errmsg
= insert_normal (cd
, fields
->f_spr_l
, 0, 0, 17, 6, 32, total_length
, buffer
);
816 case FRV_OPERAND_U12
:
819 FLD (f_u12_h
) = ((int) (FLD (f_u12
)) >> (6));
820 FLD (f_u12_l
) = ((FLD (f_u12
)) & (63));
822 errmsg
= insert_normal (cd
, fields
->f_u12_h
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 17, 6, 32, total_length
, buffer
);
825 errmsg
= insert_normal (cd
, fields
->f_u12_l
, 0, 0, 5, 6, 32, total_length
, buffer
);
830 case FRV_OPERAND_U16
:
831 errmsg
= insert_normal (cd
, fields
->f_u16
, 0, 0, 15, 16, 32, total_length
, buffer
);
833 case FRV_OPERAND_U6
:
834 errmsg
= insert_normal (cd
, fields
->f_u6
, 0, 0, 5, 6, 32, total_length
, buffer
);
836 case FRV_OPERAND_UHI16
:
837 errmsg
= insert_normal (cd
, fields
->f_u16
, 0, 0, 15, 16, 32, total_length
, buffer
);
839 case FRV_OPERAND_ULO16
:
840 errmsg
= insert_normal (cd
, fields
->f_u16
, 0, 0, 15, 16, 32, total_length
, buffer
);
844 /* xgettext:c-format */
845 fprintf (stderr
, _("Unrecognized field %d while building insn.\n"),
853 int frv_cgen_extract_operand
854 (CGEN_CPU_DESC
, int, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
856 /* Main entry point for operand extraction.
857 The result is <= 0 for error, >0 for success.
858 ??? Actual values aren't well defined right now.
860 This function is basically just a big switch statement. Earlier versions
861 used tables to look up the function to use, but
862 - if the table contains both assembler and disassembler functions then
863 the disassembler contains much of the assembler and vice-versa,
864 - there's a lot of inlining possibilities as things grow,
865 - using a switch statement avoids the function call overhead.
867 This function could be moved into `print_insn_normal', but keeping it
868 separate makes clear the interface between `print_insn_normal' and each of
872 frv_cgen_extract_operand (CGEN_CPU_DESC cd
,
874 CGEN_EXTRACT_INFO
*ex_info
,
875 CGEN_INSN_INT insn_value
,
876 CGEN_FIELDS
* fields
,
879 /* Assume success (for those operands that are nops). */
881 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
885 case FRV_OPERAND_A0
:
886 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 1, 32, total_length
, pc
, & fields
->f_A
);
888 case FRV_OPERAND_A1
:
889 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 1, 32, total_length
, pc
, & fields
->f_A
);
891 case FRV_OPERAND_ACC40SI
:
892 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_ACC40Si
);
894 case FRV_OPERAND_ACC40SK
:
895 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_ACC40Sk
);
897 case FRV_OPERAND_ACC40UI
:
898 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_ACC40Ui
);
900 case FRV_OPERAND_ACC40UK
:
901 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_ACC40Uk
);
903 case FRV_OPERAND_ACCGI
:
904 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_ACCGi
);
906 case FRV_OPERAND_ACCGK
:
907 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_ACCGk
);
909 case FRV_OPERAND_CCI
:
910 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 3, 32, total_length
, pc
, & fields
->f_CCi
);
912 case FRV_OPERAND_CPRDOUBLEK
:
913 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_CPRk
);
915 case FRV_OPERAND_CPRI
:
916 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_CPRi
);
918 case FRV_OPERAND_CPRJ
:
919 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_CPRj
);
921 case FRV_OPERAND_CPRK
:
922 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_CPRk
);
924 case FRV_OPERAND_CRI
:
925 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 14, 3, 32, total_length
, pc
, & fields
->f_CRi
);
927 case FRV_OPERAND_CRJ
:
928 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 2, 3, 32, total_length
, pc
, & fields
->f_CRj
);
930 case FRV_OPERAND_CRJ_FLOAT
:
931 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 2, 32, total_length
, pc
, & fields
->f_CRj_float
);
933 case FRV_OPERAND_CRJ_INT
:
936 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 2, 32, total_length
, pc
, & value
);
937 value
= ((value
) + (4));
938 fields
->f_CRj_int
= value
;
941 case FRV_OPERAND_CRK
:
942 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 27, 3, 32, total_length
, pc
, & fields
->f_CRk
);
944 case FRV_OPERAND_FCCI_1
:
945 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 2, 32, total_length
, pc
, & fields
->f_FCCi_1
);
947 case FRV_OPERAND_FCCI_2
:
948 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 2, 32, total_length
, pc
, & fields
->f_FCCi_2
);
950 case FRV_OPERAND_FCCI_3
:
951 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 1, 2, 32, total_length
, pc
, & fields
->f_FCCi_3
);
953 case FRV_OPERAND_FCCK
:
954 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 2, 32, total_length
, pc
, & fields
->f_FCCk
);
956 case FRV_OPERAND_FRDOUBLEI
:
957 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_FRi
);
959 case FRV_OPERAND_FRDOUBLEJ
:
960 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_FRj
);
962 case FRV_OPERAND_FRDOUBLEK
:
963 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_FRk
);
965 case FRV_OPERAND_FRI
:
966 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_FRi
);
968 case FRV_OPERAND_FRINTI
:
969 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_FRi
);
971 case FRV_OPERAND_FRINTIEVEN
:
972 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_FRi
);
974 case FRV_OPERAND_FRINTJ
:
975 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_FRj
);
977 case FRV_OPERAND_FRINTJEVEN
:
978 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_FRj
);
980 case FRV_OPERAND_FRINTK
:
981 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_FRk
);
983 case FRV_OPERAND_FRINTKEVEN
:
984 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_FRk
);
986 case FRV_OPERAND_FRJ
:
987 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_FRj
);
989 case FRV_OPERAND_FRK
:
990 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_FRk
);
992 case FRV_OPERAND_FRKHI
:
993 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_FRk
);
995 case FRV_OPERAND_FRKLO
:
996 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_FRk
);
998 case FRV_OPERAND_GRDOUBLEK
:
999 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_GRk
);
1001 case FRV_OPERAND_GRI
:
1002 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_GRi
);
1004 case FRV_OPERAND_GRJ
:
1005 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_GRj
);
1007 case FRV_OPERAND_GRK
:
1008 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_GRk
);
1010 case FRV_OPERAND_GRKHI
:
1011 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_GRk
);
1013 case FRV_OPERAND_GRKLO
:
1014 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_GRk
);
1016 case FRV_OPERAND_ICCI_1
:
1017 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 2, 32, total_length
, pc
, & fields
->f_ICCi_1
);
1019 case FRV_OPERAND_ICCI_2
:
1020 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 2, 32, total_length
, pc
, & fields
->f_ICCi_2
);
1022 case FRV_OPERAND_ICCI_3
:
1023 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 1, 2, 32, total_length
, pc
, & fields
->f_ICCi_3
);
1025 case FRV_OPERAND_LI
:
1026 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 1, 32, total_length
, pc
, & fields
->f_LI
);
1028 case FRV_OPERAND_LRAD
:
1029 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 1, 32, total_length
, pc
, & fields
->f_LRAD
);
1031 case FRV_OPERAND_LRAE
:
1032 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 1, 32, total_length
, pc
, & fields
->f_LRAE
);
1034 case FRV_OPERAND_LRAS
:
1035 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 3, 1, 32, total_length
, pc
, & fields
->f_LRAS
);
1037 case FRV_OPERAND_TLBPRL
:
1038 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 1, 32, total_length
, pc
, & fields
->f_TLBPRL
);
1040 case FRV_OPERAND_TLBPROPX
:
1041 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 3, 32, total_length
, pc
, & fields
->f_TLBPRopx
);
1043 case FRV_OPERAND_AE
:
1044 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 1, 32, total_length
, pc
, & fields
->f_ae
);
1046 case FRV_OPERAND_CALLANN
:
1047 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 0, 32, total_length
, pc
, & fields
->f_reloc_ann
);
1049 case FRV_OPERAND_CCOND
:
1050 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 12, 1, 32, total_length
, pc
, & fields
->f_ccond
);
1052 case FRV_OPERAND_COND
:
1053 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 1, 32, total_length
, pc
, & fields
->f_cond
);
1055 case FRV_OPERAND_D12
:
1056 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 11, 12, 32, total_length
, pc
, & fields
->f_d12
);
1058 case FRV_OPERAND_DEBUG
:
1059 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 1, 32, total_length
, pc
, & fields
->f_debug
);
1061 case FRV_OPERAND_EIR
:
1062 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_eir
);
1064 case FRV_OPERAND_HINT
:
1065 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 2, 32, total_length
, pc
, & fields
->f_hint
);
1067 case FRV_OPERAND_HINT_NOT_TAKEN
:
1068 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 2, 32, total_length
, pc
, & fields
->f_hint
);
1070 case FRV_OPERAND_HINT_TAKEN
:
1071 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 2, 32, total_length
, pc
, & fields
->f_hint
);
1073 case FRV_OPERAND_LABEL16
:
1076 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
);
1077 value
= ((((value
) << (2))) + (pc
));
1078 fields
->f_label16
= value
;
1081 case FRV_OPERAND_LABEL24
:
1083 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 30, 6, 32, total_length
, pc
, & fields
->f_labelH6
);
1084 if (length
<= 0) break;
1085 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 18, 32, total_length
, pc
, & fields
->f_labelL18
);
1086 if (length
<= 0) break;
1088 FLD (f_label24
) = ((((((((FLD (f_labelH6
)) << (18))) | (FLD (f_labelL18
)))) << (2))) + (pc
));
1092 case FRV_OPERAND_LDANN
:
1093 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 0, 32, total_length
, pc
, & fields
->f_reloc_ann
);
1095 case FRV_OPERAND_LDDANN
:
1096 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 0, 32, total_length
, pc
, & fields
->f_reloc_ann
);
1098 case FRV_OPERAND_LOCK
:
1099 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 1, 32, total_length
, pc
, & fields
->f_lock
);
1101 case FRV_OPERAND_PACK
:
1102 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 31, 1, 32, total_length
, pc
, & fields
->f_pack
);
1104 case FRV_OPERAND_S10
:
1105 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 9, 10, 32, total_length
, pc
, & fields
->f_s10
);
1107 case FRV_OPERAND_S12
:
1108 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 11, 12, 32, total_length
, pc
, & fields
->f_d12
);
1110 case FRV_OPERAND_S16
:
1111 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 15, 16, 32, total_length
, pc
, & fields
->f_s16
);
1113 case FRV_OPERAND_S5
:
1114 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 4, 5, 32, total_length
, pc
, & fields
->f_s5
);
1116 case FRV_OPERAND_S6
:
1117 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 5, 6, 32, total_length
, pc
, & fields
->f_s6
);
1119 case FRV_OPERAND_S6_1
:
1120 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 11, 6, 32, total_length
, pc
, & fields
->f_s6_1
);
1122 case FRV_OPERAND_SLO16
:
1123 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 15, 16, 32, total_length
, pc
, & fields
->f_s16
);
1125 case FRV_OPERAND_SPR
:
1127 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_spr_h
);
1128 if (length
<= 0) break;
1129 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_spr_l
);
1130 if (length
<= 0) break;
1132 FLD (f_spr
) = ((((FLD (f_spr_h
)) << (6))) | (FLD (f_spr_l
)));
1136 case FRV_OPERAND_U12
:
1138 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 17, 6, 32, total_length
, pc
, & fields
->f_u12_h
);
1139 if (length
<= 0) break;
1140 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_u12_l
);
1141 if (length
<= 0) break;
1143 FLD (f_u12
) = ((((FLD (f_u12_h
)) << (6))) | (FLD (f_u12_l
)));
1147 case FRV_OPERAND_U16
:
1148 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 16, 32, total_length
, pc
, & fields
->f_u16
);
1150 case FRV_OPERAND_U6
:
1151 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_u6
);
1153 case FRV_OPERAND_UHI16
:
1154 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 16, 32, total_length
, pc
, & fields
->f_u16
);
1156 case FRV_OPERAND_ULO16
:
1157 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 16, 32, total_length
, pc
, & fields
->f_u16
);
1161 /* xgettext:c-format */
1162 fprintf (stderr
, _("Unrecognized field %d while decoding insn.\n"),
1170 cgen_insert_fn
* const frv_cgen_insert_handlers
[] =
1175 cgen_extract_fn
* const frv_cgen_extract_handlers
[] =
1177 extract_insn_normal
,
1180 int frv_cgen_get_int_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1181 bfd_vma
frv_cgen_get_vma_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1183 /* Getting values from cgen_fields is handled by a collection of functions.
1184 They are distinguished by the type of the VALUE argument they return.
1185 TODO: floating point, inlining support, remove cases where result type
1189 frv_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1191 const CGEN_FIELDS
* fields
)
1197 case FRV_OPERAND_A0
:
1198 value
= fields
->f_A
;
1200 case FRV_OPERAND_A1
:
1201 value
= fields
->f_A
;
1203 case FRV_OPERAND_ACC40SI
:
1204 value
= fields
->f_ACC40Si
;
1206 case FRV_OPERAND_ACC40SK
:
1207 value
= fields
->f_ACC40Sk
;
1209 case FRV_OPERAND_ACC40UI
:
1210 value
= fields
->f_ACC40Ui
;
1212 case FRV_OPERAND_ACC40UK
:
1213 value
= fields
->f_ACC40Uk
;
1215 case FRV_OPERAND_ACCGI
:
1216 value
= fields
->f_ACCGi
;
1218 case FRV_OPERAND_ACCGK
:
1219 value
= fields
->f_ACCGk
;
1221 case FRV_OPERAND_CCI
:
1222 value
= fields
->f_CCi
;
1224 case FRV_OPERAND_CPRDOUBLEK
:
1225 value
= fields
->f_CPRk
;
1227 case FRV_OPERAND_CPRI
:
1228 value
= fields
->f_CPRi
;
1230 case FRV_OPERAND_CPRJ
:
1231 value
= fields
->f_CPRj
;
1233 case FRV_OPERAND_CPRK
:
1234 value
= fields
->f_CPRk
;
1236 case FRV_OPERAND_CRI
:
1237 value
= fields
->f_CRi
;
1239 case FRV_OPERAND_CRJ
:
1240 value
= fields
->f_CRj
;
1242 case FRV_OPERAND_CRJ_FLOAT
:
1243 value
= fields
->f_CRj_float
;
1245 case FRV_OPERAND_CRJ_INT
:
1246 value
= fields
->f_CRj_int
;
1248 case FRV_OPERAND_CRK
:
1249 value
= fields
->f_CRk
;
1251 case FRV_OPERAND_FCCI_1
:
1252 value
= fields
->f_FCCi_1
;
1254 case FRV_OPERAND_FCCI_2
:
1255 value
= fields
->f_FCCi_2
;
1257 case FRV_OPERAND_FCCI_3
:
1258 value
= fields
->f_FCCi_3
;
1260 case FRV_OPERAND_FCCK
:
1261 value
= fields
->f_FCCk
;
1263 case FRV_OPERAND_FRDOUBLEI
:
1264 value
= fields
->f_FRi
;
1266 case FRV_OPERAND_FRDOUBLEJ
:
1267 value
= fields
->f_FRj
;
1269 case FRV_OPERAND_FRDOUBLEK
:
1270 value
= fields
->f_FRk
;
1272 case FRV_OPERAND_FRI
:
1273 value
= fields
->f_FRi
;
1275 case FRV_OPERAND_FRINTI
:
1276 value
= fields
->f_FRi
;
1278 case FRV_OPERAND_FRINTIEVEN
:
1279 value
= fields
->f_FRi
;
1281 case FRV_OPERAND_FRINTJ
:
1282 value
= fields
->f_FRj
;
1284 case FRV_OPERAND_FRINTJEVEN
:
1285 value
= fields
->f_FRj
;
1287 case FRV_OPERAND_FRINTK
:
1288 value
= fields
->f_FRk
;
1290 case FRV_OPERAND_FRINTKEVEN
:
1291 value
= fields
->f_FRk
;
1293 case FRV_OPERAND_FRJ
:
1294 value
= fields
->f_FRj
;
1296 case FRV_OPERAND_FRK
:
1297 value
= fields
->f_FRk
;
1299 case FRV_OPERAND_FRKHI
:
1300 value
= fields
->f_FRk
;
1302 case FRV_OPERAND_FRKLO
:
1303 value
= fields
->f_FRk
;
1305 case FRV_OPERAND_GRDOUBLEK
:
1306 value
= fields
->f_GRk
;
1308 case FRV_OPERAND_GRI
:
1309 value
= fields
->f_GRi
;
1311 case FRV_OPERAND_GRJ
:
1312 value
= fields
->f_GRj
;
1314 case FRV_OPERAND_GRK
:
1315 value
= fields
->f_GRk
;
1317 case FRV_OPERAND_GRKHI
:
1318 value
= fields
->f_GRk
;
1320 case FRV_OPERAND_GRKLO
:
1321 value
= fields
->f_GRk
;
1323 case FRV_OPERAND_ICCI_1
:
1324 value
= fields
->f_ICCi_1
;
1326 case FRV_OPERAND_ICCI_2
:
1327 value
= fields
->f_ICCi_2
;
1329 case FRV_OPERAND_ICCI_3
:
1330 value
= fields
->f_ICCi_3
;
1332 case FRV_OPERAND_LI
:
1333 value
= fields
->f_LI
;
1335 case FRV_OPERAND_LRAD
:
1336 value
= fields
->f_LRAD
;
1338 case FRV_OPERAND_LRAE
:
1339 value
= fields
->f_LRAE
;
1341 case FRV_OPERAND_LRAS
:
1342 value
= fields
->f_LRAS
;
1344 case FRV_OPERAND_TLBPRL
:
1345 value
= fields
->f_TLBPRL
;
1347 case FRV_OPERAND_TLBPROPX
:
1348 value
= fields
->f_TLBPRopx
;
1350 case FRV_OPERAND_AE
:
1351 value
= fields
->f_ae
;
1353 case FRV_OPERAND_CALLANN
:
1354 value
= fields
->f_reloc_ann
;
1356 case FRV_OPERAND_CCOND
:
1357 value
= fields
->f_ccond
;
1359 case FRV_OPERAND_COND
:
1360 value
= fields
->f_cond
;
1362 case FRV_OPERAND_D12
:
1363 value
= fields
->f_d12
;
1365 case FRV_OPERAND_DEBUG
:
1366 value
= fields
->f_debug
;
1368 case FRV_OPERAND_EIR
:
1369 value
= fields
->f_eir
;
1371 case FRV_OPERAND_HINT
:
1372 value
= fields
->f_hint
;
1374 case FRV_OPERAND_HINT_NOT_TAKEN
:
1375 value
= fields
->f_hint
;
1377 case FRV_OPERAND_HINT_TAKEN
:
1378 value
= fields
->f_hint
;
1380 case FRV_OPERAND_LABEL16
:
1381 value
= fields
->f_label16
;
1383 case FRV_OPERAND_LABEL24
:
1384 value
= fields
->f_label24
;
1386 case FRV_OPERAND_LDANN
:
1387 value
= fields
->f_reloc_ann
;
1389 case FRV_OPERAND_LDDANN
:
1390 value
= fields
->f_reloc_ann
;
1392 case FRV_OPERAND_LOCK
:
1393 value
= fields
->f_lock
;
1395 case FRV_OPERAND_PACK
:
1396 value
= fields
->f_pack
;
1398 case FRV_OPERAND_S10
:
1399 value
= fields
->f_s10
;
1401 case FRV_OPERAND_S12
:
1402 value
= fields
->f_d12
;
1404 case FRV_OPERAND_S16
:
1405 value
= fields
->f_s16
;
1407 case FRV_OPERAND_S5
:
1408 value
= fields
->f_s5
;
1410 case FRV_OPERAND_S6
:
1411 value
= fields
->f_s6
;
1413 case FRV_OPERAND_S6_1
:
1414 value
= fields
->f_s6_1
;
1416 case FRV_OPERAND_SLO16
:
1417 value
= fields
->f_s16
;
1419 case FRV_OPERAND_SPR
:
1420 value
= fields
->f_spr
;
1422 case FRV_OPERAND_U12
:
1423 value
= fields
->f_u12
;
1425 case FRV_OPERAND_U16
:
1426 value
= fields
->f_u16
;
1428 case FRV_OPERAND_U6
:
1429 value
= fields
->f_u6
;
1431 case FRV_OPERAND_UHI16
:
1432 value
= fields
->f_u16
;
1434 case FRV_OPERAND_ULO16
:
1435 value
= fields
->f_u16
;
1439 /* xgettext:c-format */
1440 fprintf (stderr
, _("Unrecognized field %d while getting int operand.\n"),
1449 frv_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1451 const CGEN_FIELDS
* fields
)
1457 case FRV_OPERAND_A0
:
1458 value
= fields
->f_A
;
1460 case FRV_OPERAND_A1
:
1461 value
= fields
->f_A
;
1463 case FRV_OPERAND_ACC40SI
:
1464 value
= fields
->f_ACC40Si
;
1466 case FRV_OPERAND_ACC40SK
:
1467 value
= fields
->f_ACC40Sk
;
1469 case FRV_OPERAND_ACC40UI
:
1470 value
= fields
->f_ACC40Ui
;
1472 case FRV_OPERAND_ACC40UK
:
1473 value
= fields
->f_ACC40Uk
;
1475 case FRV_OPERAND_ACCGI
:
1476 value
= fields
->f_ACCGi
;
1478 case FRV_OPERAND_ACCGK
:
1479 value
= fields
->f_ACCGk
;
1481 case FRV_OPERAND_CCI
:
1482 value
= fields
->f_CCi
;
1484 case FRV_OPERAND_CPRDOUBLEK
:
1485 value
= fields
->f_CPRk
;
1487 case FRV_OPERAND_CPRI
:
1488 value
= fields
->f_CPRi
;
1490 case FRV_OPERAND_CPRJ
:
1491 value
= fields
->f_CPRj
;
1493 case FRV_OPERAND_CPRK
:
1494 value
= fields
->f_CPRk
;
1496 case FRV_OPERAND_CRI
:
1497 value
= fields
->f_CRi
;
1499 case FRV_OPERAND_CRJ
:
1500 value
= fields
->f_CRj
;
1502 case FRV_OPERAND_CRJ_FLOAT
:
1503 value
= fields
->f_CRj_float
;
1505 case FRV_OPERAND_CRJ_INT
:
1506 value
= fields
->f_CRj_int
;
1508 case FRV_OPERAND_CRK
:
1509 value
= fields
->f_CRk
;
1511 case FRV_OPERAND_FCCI_1
:
1512 value
= fields
->f_FCCi_1
;
1514 case FRV_OPERAND_FCCI_2
:
1515 value
= fields
->f_FCCi_2
;
1517 case FRV_OPERAND_FCCI_3
:
1518 value
= fields
->f_FCCi_3
;
1520 case FRV_OPERAND_FCCK
:
1521 value
= fields
->f_FCCk
;
1523 case FRV_OPERAND_FRDOUBLEI
:
1524 value
= fields
->f_FRi
;
1526 case FRV_OPERAND_FRDOUBLEJ
:
1527 value
= fields
->f_FRj
;
1529 case FRV_OPERAND_FRDOUBLEK
:
1530 value
= fields
->f_FRk
;
1532 case FRV_OPERAND_FRI
:
1533 value
= fields
->f_FRi
;
1535 case FRV_OPERAND_FRINTI
:
1536 value
= fields
->f_FRi
;
1538 case FRV_OPERAND_FRINTIEVEN
:
1539 value
= fields
->f_FRi
;
1541 case FRV_OPERAND_FRINTJ
:
1542 value
= fields
->f_FRj
;
1544 case FRV_OPERAND_FRINTJEVEN
:
1545 value
= fields
->f_FRj
;
1547 case FRV_OPERAND_FRINTK
:
1548 value
= fields
->f_FRk
;
1550 case FRV_OPERAND_FRINTKEVEN
:
1551 value
= fields
->f_FRk
;
1553 case FRV_OPERAND_FRJ
:
1554 value
= fields
->f_FRj
;
1556 case FRV_OPERAND_FRK
:
1557 value
= fields
->f_FRk
;
1559 case FRV_OPERAND_FRKHI
:
1560 value
= fields
->f_FRk
;
1562 case FRV_OPERAND_FRKLO
:
1563 value
= fields
->f_FRk
;
1565 case FRV_OPERAND_GRDOUBLEK
:
1566 value
= fields
->f_GRk
;
1568 case FRV_OPERAND_GRI
:
1569 value
= fields
->f_GRi
;
1571 case FRV_OPERAND_GRJ
:
1572 value
= fields
->f_GRj
;
1574 case FRV_OPERAND_GRK
:
1575 value
= fields
->f_GRk
;
1577 case FRV_OPERAND_GRKHI
:
1578 value
= fields
->f_GRk
;
1580 case FRV_OPERAND_GRKLO
:
1581 value
= fields
->f_GRk
;
1583 case FRV_OPERAND_ICCI_1
:
1584 value
= fields
->f_ICCi_1
;
1586 case FRV_OPERAND_ICCI_2
:
1587 value
= fields
->f_ICCi_2
;
1589 case FRV_OPERAND_ICCI_3
:
1590 value
= fields
->f_ICCi_3
;
1592 case FRV_OPERAND_LI
:
1593 value
= fields
->f_LI
;
1595 case FRV_OPERAND_LRAD
:
1596 value
= fields
->f_LRAD
;
1598 case FRV_OPERAND_LRAE
:
1599 value
= fields
->f_LRAE
;
1601 case FRV_OPERAND_LRAS
:
1602 value
= fields
->f_LRAS
;
1604 case FRV_OPERAND_TLBPRL
:
1605 value
= fields
->f_TLBPRL
;
1607 case FRV_OPERAND_TLBPROPX
:
1608 value
= fields
->f_TLBPRopx
;
1610 case FRV_OPERAND_AE
:
1611 value
= fields
->f_ae
;
1613 case FRV_OPERAND_CALLANN
:
1614 value
= fields
->f_reloc_ann
;
1616 case FRV_OPERAND_CCOND
:
1617 value
= fields
->f_ccond
;
1619 case FRV_OPERAND_COND
:
1620 value
= fields
->f_cond
;
1622 case FRV_OPERAND_D12
:
1623 value
= fields
->f_d12
;
1625 case FRV_OPERAND_DEBUG
:
1626 value
= fields
->f_debug
;
1628 case FRV_OPERAND_EIR
:
1629 value
= fields
->f_eir
;
1631 case FRV_OPERAND_HINT
:
1632 value
= fields
->f_hint
;
1634 case FRV_OPERAND_HINT_NOT_TAKEN
:
1635 value
= fields
->f_hint
;
1637 case FRV_OPERAND_HINT_TAKEN
:
1638 value
= fields
->f_hint
;
1640 case FRV_OPERAND_LABEL16
:
1641 value
= fields
->f_label16
;
1643 case FRV_OPERAND_LABEL24
:
1644 value
= fields
->f_label24
;
1646 case FRV_OPERAND_LDANN
:
1647 value
= fields
->f_reloc_ann
;
1649 case FRV_OPERAND_LDDANN
:
1650 value
= fields
->f_reloc_ann
;
1652 case FRV_OPERAND_LOCK
:
1653 value
= fields
->f_lock
;
1655 case FRV_OPERAND_PACK
:
1656 value
= fields
->f_pack
;
1658 case FRV_OPERAND_S10
:
1659 value
= fields
->f_s10
;
1661 case FRV_OPERAND_S12
:
1662 value
= fields
->f_d12
;
1664 case FRV_OPERAND_S16
:
1665 value
= fields
->f_s16
;
1667 case FRV_OPERAND_S5
:
1668 value
= fields
->f_s5
;
1670 case FRV_OPERAND_S6
:
1671 value
= fields
->f_s6
;
1673 case FRV_OPERAND_S6_1
:
1674 value
= fields
->f_s6_1
;
1676 case FRV_OPERAND_SLO16
:
1677 value
= fields
->f_s16
;
1679 case FRV_OPERAND_SPR
:
1680 value
= fields
->f_spr
;
1682 case FRV_OPERAND_U12
:
1683 value
= fields
->f_u12
;
1685 case FRV_OPERAND_U16
:
1686 value
= fields
->f_u16
;
1688 case FRV_OPERAND_U6
:
1689 value
= fields
->f_u6
;
1691 case FRV_OPERAND_UHI16
:
1692 value
= fields
->f_u16
;
1694 case FRV_OPERAND_ULO16
:
1695 value
= fields
->f_u16
;
1699 /* xgettext:c-format */
1700 fprintf (stderr
, _("Unrecognized field %d while getting vma operand.\n"),
1708 void frv_cgen_set_int_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, int);
1709 void frv_cgen_set_vma_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, bfd_vma
);
1711 /* Stuffing values in cgen_fields is handled by a collection of functions.
1712 They are distinguished by the type of the VALUE argument they accept.
1713 TODO: floating point, inlining support, remove cases where argument type
1717 frv_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1719 CGEN_FIELDS
* fields
,
1724 case FRV_OPERAND_A0
:
1725 fields
->f_A
= value
;
1727 case FRV_OPERAND_A1
:
1728 fields
->f_A
= value
;
1730 case FRV_OPERAND_ACC40SI
:
1731 fields
->f_ACC40Si
= value
;
1733 case FRV_OPERAND_ACC40SK
:
1734 fields
->f_ACC40Sk
= value
;
1736 case FRV_OPERAND_ACC40UI
:
1737 fields
->f_ACC40Ui
= value
;
1739 case FRV_OPERAND_ACC40UK
:
1740 fields
->f_ACC40Uk
= value
;
1742 case FRV_OPERAND_ACCGI
:
1743 fields
->f_ACCGi
= value
;
1745 case FRV_OPERAND_ACCGK
:
1746 fields
->f_ACCGk
= value
;
1748 case FRV_OPERAND_CCI
:
1749 fields
->f_CCi
= value
;
1751 case FRV_OPERAND_CPRDOUBLEK
:
1752 fields
->f_CPRk
= value
;
1754 case FRV_OPERAND_CPRI
:
1755 fields
->f_CPRi
= value
;
1757 case FRV_OPERAND_CPRJ
:
1758 fields
->f_CPRj
= value
;
1760 case FRV_OPERAND_CPRK
:
1761 fields
->f_CPRk
= value
;
1763 case FRV_OPERAND_CRI
:
1764 fields
->f_CRi
= value
;
1766 case FRV_OPERAND_CRJ
:
1767 fields
->f_CRj
= value
;
1769 case FRV_OPERAND_CRJ_FLOAT
:
1770 fields
->f_CRj_float
= value
;
1772 case FRV_OPERAND_CRJ_INT
:
1773 fields
->f_CRj_int
= value
;
1775 case FRV_OPERAND_CRK
:
1776 fields
->f_CRk
= value
;
1778 case FRV_OPERAND_FCCI_1
:
1779 fields
->f_FCCi_1
= value
;
1781 case FRV_OPERAND_FCCI_2
:
1782 fields
->f_FCCi_2
= value
;
1784 case FRV_OPERAND_FCCI_3
:
1785 fields
->f_FCCi_3
= value
;
1787 case FRV_OPERAND_FCCK
:
1788 fields
->f_FCCk
= value
;
1790 case FRV_OPERAND_FRDOUBLEI
:
1791 fields
->f_FRi
= value
;
1793 case FRV_OPERAND_FRDOUBLEJ
:
1794 fields
->f_FRj
= value
;
1796 case FRV_OPERAND_FRDOUBLEK
:
1797 fields
->f_FRk
= value
;
1799 case FRV_OPERAND_FRI
:
1800 fields
->f_FRi
= value
;
1802 case FRV_OPERAND_FRINTI
:
1803 fields
->f_FRi
= value
;
1805 case FRV_OPERAND_FRINTIEVEN
:
1806 fields
->f_FRi
= value
;
1808 case FRV_OPERAND_FRINTJ
:
1809 fields
->f_FRj
= value
;
1811 case FRV_OPERAND_FRINTJEVEN
:
1812 fields
->f_FRj
= value
;
1814 case FRV_OPERAND_FRINTK
:
1815 fields
->f_FRk
= value
;
1817 case FRV_OPERAND_FRINTKEVEN
:
1818 fields
->f_FRk
= value
;
1820 case FRV_OPERAND_FRJ
:
1821 fields
->f_FRj
= value
;
1823 case FRV_OPERAND_FRK
:
1824 fields
->f_FRk
= value
;
1826 case FRV_OPERAND_FRKHI
:
1827 fields
->f_FRk
= value
;
1829 case FRV_OPERAND_FRKLO
:
1830 fields
->f_FRk
= value
;
1832 case FRV_OPERAND_GRDOUBLEK
:
1833 fields
->f_GRk
= value
;
1835 case FRV_OPERAND_GRI
:
1836 fields
->f_GRi
= value
;
1838 case FRV_OPERAND_GRJ
:
1839 fields
->f_GRj
= value
;
1841 case FRV_OPERAND_GRK
:
1842 fields
->f_GRk
= value
;
1844 case FRV_OPERAND_GRKHI
:
1845 fields
->f_GRk
= value
;
1847 case FRV_OPERAND_GRKLO
:
1848 fields
->f_GRk
= value
;
1850 case FRV_OPERAND_ICCI_1
:
1851 fields
->f_ICCi_1
= value
;
1853 case FRV_OPERAND_ICCI_2
:
1854 fields
->f_ICCi_2
= value
;
1856 case FRV_OPERAND_ICCI_3
:
1857 fields
->f_ICCi_3
= value
;
1859 case FRV_OPERAND_LI
:
1860 fields
->f_LI
= value
;
1862 case FRV_OPERAND_LRAD
:
1863 fields
->f_LRAD
= value
;
1865 case FRV_OPERAND_LRAE
:
1866 fields
->f_LRAE
= value
;
1868 case FRV_OPERAND_LRAS
:
1869 fields
->f_LRAS
= value
;
1871 case FRV_OPERAND_TLBPRL
:
1872 fields
->f_TLBPRL
= value
;
1874 case FRV_OPERAND_TLBPROPX
:
1875 fields
->f_TLBPRopx
= value
;
1877 case FRV_OPERAND_AE
:
1878 fields
->f_ae
= value
;
1880 case FRV_OPERAND_CALLANN
:
1881 fields
->f_reloc_ann
= value
;
1883 case FRV_OPERAND_CCOND
:
1884 fields
->f_ccond
= value
;
1886 case FRV_OPERAND_COND
:
1887 fields
->f_cond
= value
;
1889 case FRV_OPERAND_D12
:
1890 fields
->f_d12
= value
;
1892 case FRV_OPERAND_DEBUG
:
1893 fields
->f_debug
= value
;
1895 case FRV_OPERAND_EIR
:
1896 fields
->f_eir
= value
;
1898 case FRV_OPERAND_HINT
:
1899 fields
->f_hint
= value
;
1901 case FRV_OPERAND_HINT_NOT_TAKEN
:
1902 fields
->f_hint
= value
;
1904 case FRV_OPERAND_HINT_TAKEN
:
1905 fields
->f_hint
= value
;
1907 case FRV_OPERAND_LABEL16
:
1908 fields
->f_label16
= value
;
1910 case FRV_OPERAND_LABEL24
:
1911 fields
->f_label24
= value
;
1913 case FRV_OPERAND_LDANN
:
1914 fields
->f_reloc_ann
= value
;
1916 case FRV_OPERAND_LDDANN
:
1917 fields
->f_reloc_ann
= value
;
1919 case FRV_OPERAND_LOCK
:
1920 fields
->f_lock
= value
;
1922 case FRV_OPERAND_PACK
:
1923 fields
->f_pack
= value
;
1925 case FRV_OPERAND_S10
:
1926 fields
->f_s10
= value
;
1928 case FRV_OPERAND_S12
:
1929 fields
->f_d12
= value
;
1931 case FRV_OPERAND_S16
:
1932 fields
->f_s16
= value
;
1934 case FRV_OPERAND_S5
:
1935 fields
->f_s5
= value
;
1937 case FRV_OPERAND_S6
:
1938 fields
->f_s6
= value
;
1940 case FRV_OPERAND_S6_1
:
1941 fields
->f_s6_1
= value
;
1943 case FRV_OPERAND_SLO16
:
1944 fields
->f_s16
= value
;
1946 case FRV_OPERAND_SPR
:
1947 fields
->f_spr
= value
;
1949 case FRV_OPERAND_U12
:
1950 fields
->f_u12
= value
;
1952 case FRV_OPERAND_U16
:
1953 fields
->f_u16
= value
;
1955 case FRV_OPERAND_U6
:
1956 fields
->f_u6
= value
;
1958 case FRV_OPERAND_UHI16
:
1959 fields
->f_u16
= value
;
1961 case FRV_OPERAND_ULO16
:
1962 fields
->f_u16
= value
;
1966 /* xgettext:c-format */
1967 fprintf (stderr
, _("Unrecognized field %d while setting int operand.\n"),
1974 frv_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1976 CGEN_FIELDS
* fields
,
1981 case FRV_OPERAND_A0
:
1982 fields
->f_A
= value
;
1984 case FRV_OPERAND_A1
:
1985 fields
->f_A
= value
;
1987 case FRV_OPERAND_ACC40SI
:
1988 fields
->f_ACC40Si
= value
;
1990 case FRV_OPERAND_ACC40SK
:
1991 fields
->f_ACC40Sk
= value
;
1993 case FRV_OPERAND_ACC40UI
:
1994 fields
->f_ACC40Ui
= value
;
1996 case FRV_OPERAND_ACC40UK
:
1997 fields
->f_ACC40Uk
= value
;
1999 case FRV_OPERAND_ACCGI
:
2000 fields
->f_ACCGi
= value
;
2002 case FRV_OPERAND_ACCGK
:
2003 fields
->f_ACCGk
= value
;
2005 case FRV_OPERAND_CCI
:
2006 fields
->f_CCi
= value
;
2008 case FRV_OPERAND_CPRDOUBLEK
:
2009 fields
->f_CPRk
= value
;
2011 case FRV_OPERAND_CPRI
:
2012 fields
->f_CPRi
= value
;
2014 case FRV_OPERAND_CPRJ
:
2015 fields
->f_CPRj
= value
;
2017 case FRV_OPERAND_CPRK
:
2018 fields
->f_CPRk
= value
;
2020 case FRV_OPERAND_CRI
:
2021 fields
->f_CRi
= value
;
2023 case FRV_OPERAND_CRJ
:
2024 fields
->f_CRj
= value
;
2026 case FRV_OPERAND_CRJ_FLOAT
:
2027 fields
->f_CRj_float
= value
;
2029 case FRV_OPERAND_CRJ_INT
:
2030 fields
->f_CRj_int
= value
;
2032 case FRV_OPERAND_CRK
:
2033 fields
->f_CRk
= value
;
2035 case FRV_OPERAND_FCCI_1
:
2036 fields
->f_FCCi_1
= value
;
2038 case FRV_OPERAND_FCCI_2
:
2039 fields
->f_FCCi_2
= value
;
2041 case FRV_OPERAND_FCCI_3
:
2042 fields
->f_FCCi_3
= value
;
2044 case FRV_OPERAND_FCCK
:
2045 fields
->f_FCCk
= value
;
2047 case FRV_OPERAND_FRDOUBLEI
:
2048 fields
->f_FRi
= value
;
2050 case FRV_OPERAND_FRDOUBLEJ
:
2051 fields
->f_FRj
= value
;
2053 case FRV_OPERAND_FRDOUBLEK
:
2054 fields
->f_FRk
= value
;
2056 case FRV_OPERAND_FRI
:
2057 fields
->f_FRi
= value
;
2059 case FRV_OPERAND_FRINTI
:
2060 fields
->f_FRi
= value
;
2062 case FRV_OPERAND_FRINTIEVEN
:
2063 fields
->f_FRi
= value
;
2065 case FRV_OPERAND_FRINTJ
:
2066 fields
->f_FRj
= value
;
2068 case FRV_OPERAND_FRINTJEVEN
:
2069 fields
->f_FRj
= value
;
2071 case FRV_OPERAND_FRINTK
:
2072 fields
->f_FRk
= value
;
2074 case FRV_OPERAND_FRINTKEVEN
:
2075 fields
->f_FRk
= value
;
2077 case FRV_OPERAND_FRJ
:
2078 fields
->f_FRj
= value
;
2080 case FRV_OPERAND_FRK
:
2081 fields
->f_FRk
= value
;
2083 case FRV_OPERAND_FRKHI
:
2084 fields
->f_FRk
= value
;
2086 case FRV_OPERAND_FRKLO
:
2087 fields
->f_FRk
= value
;
2089 case FRV_OPERAND_GRDOUBLEK
:
2090 fields
->f_GRk
= value
;
2092 case FRV_OPERAND_GRI
:
2093 fields
->f_GRi
= value
;
2095 case FRV_OPERAND_GRJ
:
2096 fields
->f_GRj
= value
;
2098 case FRV_OPERAND_GRK
:
2099 fields
->f_GRk
= value
;
2101 case FRV_OPERAND_GRKHI
:
2102 fields
->f_GRk
= value
;
2104 case FRV_OPERAND_GRKLO
:
2105 fields
->f_GRk
= value
;
2107 case FRV_OPERAND_ICCI_1
:
2108 fields
->f_ICCi_1
= value
;
2110 case FRV_OPERAND_ICCI_2
:
2111 fields
->f_ICCi_2
= value
;
2113 case FRV_OPERAND_ICCI_3
:
2114 fields
->f_ICCi_3
= value
;
2116 case FRV_OPERAND_LI
:
2117 fields
->f_LI
= value
;
2119 case FRV_OPERAND_LRAD
:
2120 fields
->f_LRAD
= value
;
2122 case FRV_OPERAND_LRAE
:
2123 fields
->f_LRAE
= value
;
2125 case FRV_OPERAND_LRAS
:
2126 fields
->f_LRAS
= value
;
2128 case FRV_OPERAND_TLBPRL
:
2129 fields
->f_TLBPRL
= value
;
2131 case FRV_OPERAND_TLBPROPX
:
2132 fields
->f_TLBPRopx
= value
;
2134 case FRV_OPERAND_AE
:
2135 fields
->f_ae
= value
;
2137 case FRV_OPERAND_CALLANN
:
2138 fields
->f_reloc_ann
= value
;
2140 case FRV_OPERAND_CCOND
:
2141 fields
->f_ccond
= value
;
2143 case FRV_OPERAND_COND
:
2144 fields
->f_cond
= value
;
2146 case FRV_OPERAND_D12
:
2147 fields
->f_d12
= value
;
2149 case FRV_OPERAND_DEBUG
:
2150 fields
->f_debug
= value
;
2152 case FRV_OPERAND_EIR
:
2153 fields
->f_eir
= value
;
2155 case FRV_OPERAND_HINT
:
2156 fields
->f_hint
= value
;
2158 case FRV_OPERAND_HINT_NOT_TAKEN
:
2159 fields
->f_hint
= value
;
2161 case FRV_OPERAND_HINT_TAKEN
:
2162 fields
->f_hint
= value
;
2164 case FRV_OPERAND_LABEL16
:
2165 fields
->f_label16
= value
;
2167 case FRV_OPERAND_LABEL24
:
2168 fields
->f_label24
= value
;
2170 case FRV_OPERAND_LDANN
:
2171 fields
->f_reloc_ann
= value
;
2173 case FRV_OPERAND_LDDANN
:
2174 fields
->f_reloc_ann
= value
;
2176 case FRV_OPERAND_LOCK
:
2177 fields
->f_lock
= value
;
2179 case FRV_OPERAND_PACK
:
2180 fields
->f_pack
= value
;
2182 case FRV_OPERAND_S10
:
2183 fields
->f_s10
= value
;
2185 case FRV_OPERAND_S12
:
2186 fields
->f_d12
= value
;
2188 case FRV_OPERAND_S16
:
2189 fields
->f_s16
= value
;
2191 case FRV_OPERAND_S5
:
2192 fields
->f_s5
= value
;
2194 case FRV_OPERAND_S6
:
2195 fields
->f_s6
= value
;
2197 case FRV_OPERAND_S6_1
:
2198 fields
->f_s6_1
= value
;
2200 case FRV_OPERAND_SLO16
:
2201 fields
->f_s16
= value
;
2203 case FRV_OPERAND_SPR
:
2204 fields
->f_spr
= value
;
2206 case FRV_OPERAND_U12
:
2207 fields
->f_u12
= value
;
2209 case FRV_OPERAND_U16
:
2210 fields
->f_u16
= value
;
2212 case FRV_OPERAND_U6
:
2213 fields
->f_u6
= value
;
2215 case FRV_OPERAND_UHI16
:
2216 fields
->f_u16
= value
;
2218 case FRV_OPERAND_ULO16
:
2219 fields
->f_u16
= value
;
2223 /* xgettext:c-format */
2224 fprintf (stderr
, _("Unrecognized field %d while setting vma operand.\n"),
2230 /* Function to call before using the instruction builder tables. */
2233 frv_cgen_init_ibld_table (CGEN_CPU_DESC cd
)
2235 cd
->insert_handlers
= & frv_cgen_insert_handlers
[0];
2236 cd
->extract_handlers
= & frv_cgen_extract_handlers
[0];
2238 cd
->insert_operand
= frv_cgen_insert_operand
;
2239 cd
->extract_operand
= frv_cgen_extract_operand
;
2241 cd
->get_int_operand
= frv_cgen_get_int_operand
;
2242 cd
->set_int_operand
= frv_cgen_set_int_operand
;
2243 cd
->get_vma_operand
= frv_cgen_get_vma_operand
;
2244 cd
->set_vma_operand
= frv_cgen_set_vma_operand
;