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, 2006
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
;
171 unsigned long val
= (unsigned long) value
;
173 /* For hosts with a word size > 32 check to see if value has been sign
174 extended beyond 32 bits. If so then ignore these higher sign bits
175 as the user is attempting to store a 32-bit signed value into an
176 unsigned 32-bit field which is allowed. */
177 if (sizeof (unsigned long) > 4 && ((value
>> 32) == -1))
182 /* xgettext:c-format */
184 _("operand out of range (0x%lx not between 0 and 0x%lx)"),
191 if (! cgen_signed_overflow_ok_p (cd
))
193 long minval
= - (1L << (length
- 1));
194 long maxval
= (1L << (length
- 1)) - 1;
196 if (value
< minval
|| value
> maxval
)
199 /* xgettext:c-format */
200 (errbuf
, _("operand out of range (%ld not between %ld and %ld)"),
201 value
, minval
, maxval
);
212 if (CGEN_INSN_LSB0_P
)
213 shift
= (word_offset
+ start
+ 1) - length
;
215 shift
= total_length
- (word_offset
+ start
+ length
);
216 *buffer
= (*buffer
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
219 #else /* ! CGEN_INT_INSN_P */
222 unsigned char *bufp
= (unsigned char *) buffer
+ word_offset
/ 8;
224 insert_1 (cd
, value
, start
, length
, word_length
, bufp
);
227 #endif /* ! CGEN_INT_INSN_P */
232 /* Default insn builder (insert handler).
233 The instruction is recorded in CGEN_INT_INSN_P byte order (meaning
234 that if CGEN_INSN_BYTES_PTR is an int * and thus, the value is
235 recorded in host byte order, otherwise BUFFER is an array of bytes
236 and the value is recorded in target byte order).
237 The result is an error message or NULL if success. */
240 insert_insn_normal (CGEN_CPU_DESC cd
,
241 const CGEN_INSN
* insn
,
242 CGEN_FIELDS
* fields
,
243 CGEN_INSN_BYTES_PTR buffer
,
246 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
248 const CGEN_SYNTAX_CHAR_TYPE
* syn
;
250 CGEN_INIT_INSERT (cd
);
251 value
= CGEN_INSN_BASE_VALUE (insn
);
253 /* If we're recording insns as numbers (rather than a string of bytes),
254 target byte order handling is deferred until later. */
258 put_insn_int_value (cd
, buffer
, cd
->base_insn_bitsize
,
259 CGEN_FIELDS_BITSIZE (fields
), value
);
263 cgen_put_insn_value (cd
, buffer
, min ((unsigned) cd
->base_insn_bitsize
,
264 (unsigned) CGEN_FIELDS_BITSIZE (fields
)),
267 #endif /* ! CGEN_INT_INSN_P */
269 /* ??? It would be better to scan the format's fields.
270 Still need to be able to insert a value based on the operand though;
271 e.g. storing a branch displacement that got resolved later.
272 Needs more thought first. */
274 for (syn
= CGEN_SYNTAX_STRING (syntax
); * syn
; ++ syn
)
278 if (CGEN_SYNTAX_CHAR_P (* syn
))
281 errmsg
= (* cd
->insert_operand
) (cd
, CGEN_SYNTAX_FIELD (*syn
),
291 /* Cover function to store an insn value into an integral insn. Must go here
292 because it needs <prefix>-desc.h for CGEN_INT_INSN_P. */
295 put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
296 CGEN_INSN_BYTES_PTR buf
,
301 /* For architectures with insns smaller than the base-insn-bitsize,
302 length may be too big. */
303 if (length
> insn_length
)
307 int shift
= insn_length
- length
;
308 /* Written this way to avoid undefined behaviour. */
309 CGEN_INSN_INT mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
311 *buf
= (*buf
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
316 /* Operand extraction. */
318 #if ! CGEN_INT_INSN_P
320 /* Subroutine of extract_normal.
321 Ensure sufficient bytes are cached in EX_INFO.
322 OFFSET is the offset in bytes from the start of the insn of the value.
323 BYTES is the length of the needed value.
324 Returns 1 for success, 0 for failure. */
326 static CGEN_INLINE
int
327 fill_cache (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
328 CGEN_EXTRACT_INFO
*ex_info
,
333 /* It's doubtful that the middle part has already been fetched so
334 we don't optimize that case. kiss. */
336 disassemble_info
*info
= (disassemble_info
*) ex_info
->dis_info
;
338 /* First do a quick check. */
339 mask
= (1 << bytes
) - 1;
340 if (((ex_info
->valid
>> offset
) & mask
) == mask
)
343 /* Search for the first byte we need to read. */
344 for (mask
= 1 << offset
; bytes
> 0; --bytes
, ++offset
, mask
<<= 1)
345 if (! (mask
& ex_info
->valid
))
353 status
= (*info
->read_memory_func
)
354 (pc
, ex_info
->insn_bytes
+ offset
, bytes
, info
);
358 (*info
->memory_error_func
) (status
, pc
, info
);
362 ex_info
->valid
|= ((1 << bytes
) - 1) << offset
;
368 /* Subroutine of extract_normal. */
370 static CGEN_INLINE
long
371 extract_1 (CGEN_CPU_DESC cd
,
372 CGEN_EXTRACT_INFO
*ex_info ATTRIBUTE_UNUSED
,
377 bfd_vma pc ATTRIBUTE_UNUSED
)
382 x
= cgen_get_insn_value (cd
, bufp
, word_length
);
384 if (CGEN_INSN_LSB0_P
)
385 shift
= (start
+ 1) - length
;
387 shift
= (word_length
- (start
+ length
));
391 #endif /* ! CGEN_INT_INSN_P */
393 /* Default extraction routine.
395 INSN_VALUE is the first base_insn_bitsize bits of the insn in host order,
396 or sometimes less for cases like the m32r where the base insn size is 32
397 but some insns are 16 bits.
398 ATTRS is a mask of the boolean attributes. We only need `SIGNED',
399 but for generality we take a bitmask of all of them.
400 WORD_OFFSET is the offset in bits from the start of the insn of the value.
401 WORD_LENGTH is the length of the word in bits in which the value resides.
402 START is the starting bit number in the word, architecture origin.
403 LENGTH is the length of VALUE in bits.
404 TOTAL_LENGTH is the total length of the insn in bits.
406 Returns 1 for success, 0 for failure. */
408 /* ??? The return code isn't properly used. wip. */
410 /* ??? This doesn't handle bfd_vma's. Create another function when
414 extract_normal (CGEN_CPU_DESC cd
,
415 #if ! CGEN_INT_INSN_P
416 CGEN_EXTRACT_INFO
*ex_info
,
418 CGEN_EXTRACT_INFO
*ex_info ATTRIBUTE_UNUSED
,
420 CGEN_INSN_INT insn_value
,
422 unsigned int word_offset
,
425 unsigned int word_length
,
426 unsigned int total_length
,
427 #if ! CGEN_INT_INSN_P
430 bfd_vma pc ATTRIBUTE_UNUSED
,
436 /* If LENGTH is zero, this operand doesn't contribute to the value
437 so give it a standard value of zero. */
444 if (word_length
> 32)
447 /* For architectures with insns smaller than the insn-base-bitsize,
448 word_length may be too big. */
449 if (cd
->min_insn_bitsize
< cd
->base_insn_bitsize
)
451 if (word_offset
+ word_length
> total_length
)
452 word_length
= total_length
- word_offset
;
455 /* Does the value reside in INSN_VALUE, and at the right alignment? */
457 if (CGEN_INT_INSN_P
|| (word_offset
== 0 && word_length
== total_length
))
459 if (CGEN_INSN_LSB0_P
)
460 value
= insn_value
>> ((word_offset
+ start
+ 1) - length
);
462 value
= insn_value
>> (total_length
- ( word_offset
+ start
+ length
));
465 #if ! CGEN_INT_INSN_P
469 unsigned char *bufp
= ex_info
->insn_bytes
+ word_offset
/ 8;
471 if (word_length
> 32)
474 if (fill_cache (cd
, ex_info
, word_offset
/ 8, word_length
/ 8, pc
) == 0)
477 value
= extract_1 (cd
, ex_info
, start
, length
, word_length
, bufp
, pc
);
480 #endif /* ! CGEN_INT_INSN_P */
482 /* Written this way to avoid undefined behaviour. */
483 mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
487 if (CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGNED
)
488 && (value
& (1L << (length
- 1))))
496 /* Default insn extractor.
498 INSN_VALUE is the first base_insn_bitsize bits, translated to host order.
499 The extracted fields are stored in FIELDS.
500 EX_INFO is used to handle reading variable length insns.
501 Return the length of the insn in bits, or 0 if no match,
502 or -1 if an error occurs fetching data (memory_error_func will have
506 extract_insn_normal (CGEN_CPU_DESC cd
,
507 const CGEN_INSN
*insn
,
508 CGEN_EXTRACT_INFO
*ex_info
,
509 CGEN_INSN_INT insn_value
,
513 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
514 const CGEN_SYNTAX_CHAR_TYPE
*syn
;
516 CGEN_FIELDS_BITSIZE (fields
) = CGEN_INSN_BITSIZE (insn
);
518 CGEN_INIT_EXTRACT (cd
);
520 for (syn
= CGEN_SYNTAX_STRING (syntax
); *syn
; ++syn
)
524 if (CGEN_SYNTAX_CHAR_P (*syn
))
527 length
= (* cd
->extract_operand
) (cd
, CGEN_SYNTAX_FIELD (*syn
),
528 ex_info
, insn_value
, fields
, pc
);
533 /* We recognized and successfully extracted this insn. */
534 return CGEN_INSN_BITSIZE (insn
);
537 /* Machine generated code added here. */
539 const char * frv_cgen_insert_operand
540 (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, CGEN_INSN_BYTES_PTR
, bfd_vma
);
542 /* Main entry point for operand insertion.
544 This function is basically just a big switch statement. Earlier versions
545 used tables to look up the function to use, but
546 - if the table contains both assembler and disassembler functions then
547 the disassembler contains much of the assembler and vice-versa,
548 - there's a lot of inlining possibilities as things grow,
549 - using a switch statement avoids the function call overhead.
551 This function could be moved into `parse_insn_normal', but keeping it
552 separate makes clear the interface between `parse_insn_normal' and each of
553 the handlers. It's also needed by GAS to insert operands that couldn't be
554 resolved during parsing. */
557 frv_cgen_insert_operand (CGEN_CPU_DESC cd
,
559 CGEN_FIELDS
* fields
,
560 CGEN_INSN_BYTES_PTR buffer
,
561 bfd_vma pc ATTRIBUTE_UNUSED
)
563 const char * errmsg
= NULL
;
564 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
568 case FRV_OPERAND_A0
:
569 errmsg
= insert_normal (cd
, fields
->f_A
, 0, 0, 17, 1, 32, total_length
, buffer
);
571 case FRV_OPERAND_A1
:
572 errmsg
= insert_normal (cd
, fields
->f_A
, 0, 0, 17, 1, 32, total_length
, buffer
);
574 case FRV_OPERAND_ACC40SI
:
575 errmsg
= insert_normal (cd
, fields
->f_ACC40Si
, 0, 0, 17, 6, 32, total_length
, buffer
);
577 case FRV_OPERAND_ACC40SK
:
578 errmsg
= insert_normal (cd
, fields
->f_ACC40Sk
, 0, 0, 30, 6, 32, total_length
, buffer
);
580 case FRV_OPERAND_ACC40UI
:
581 errmsg
= insert_normal (cd
, fields
->f_ACC40Ui
, 0, 0, 17, 6, 32, total_length
, buffer
);
583 case FRV_OPERAND_ACC40UK
:
584 errmsg
= insert_normal (cd
, fields
->f_ACC40Uk
, 0, 0, 30, 6, 32, total_length
, buffer
);
586 case FRV_OPERAND_ACCGI
:
587 errmsg
= insert_normal (cd
, fields
->f_ACCGi
, 0, 0, 17, 6, 32, total_length
, buffer
);
589 case FRV_OPERAND_ACCGK
:
590 errmsg
= insert_normal (cd
, fields
->f_ACCGk
, 0, 0, 30, 6, 32, total_length
, buffer
);
592 case FRV_OPERAND_CCI
:
593 errmsg
= insert_normal (cd
, fields
->f_CCi
, 0, 0, 11, 3, 32, total_length
, buffer
);
595 case FRV_OPERAND_CPRDOUBLEK
:
596 errmsg
= insert_normal (cd
, fields
->f_CPRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
598 case FRV_OPERAND_CPRI
:
599 errmsg
= insert_normal (cd
, fields
->f_CPRi
, 0, 0, 17, 6, 32, total_length
, buffer
);
601 case FRV_OPERAND_CPRJ
:
602 errmsg
= insert_normal (cd
, fields
->f_CPRj
, 0, 0, 5, 6, 32, total_length
, buffer
);
604 case FRV_OPERAND_CPRK
:
605 errmsg
= insert_normal (cd
, fields
->f_CPRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
607 case FRV_OPERAND_CRI
:
608 errmsg
= insert_normal (cd
, fields
->f_CRi
, 0, 0, 14, 3, 32, total_length
, buffer
);
610 case FRV_OPERAND_CRJ
:
611 errmsg
= insert_normal (cd
, fields
->f_CRj
, 0, 0, 2, 3, 32, total_length
, buffer
);
613 case FRV_OPERAND_CRJ_FLOAT
:
614 errmsg
= insert_normal (cd
, fields
->f_CRj_float
, 0, 0, 26, 2, 32, total_length
, buffer
);
616 case FRV_OPERAND_CRJ_INT
:
618 long value
= fields
->f_CRj_int
;
619 value
= ((value
) - (4));
620 errmsg
= insert_normal (cd
, value
, 0, 0, 26, 2, 32, total_length
, buffer
);
623 case FRV_OPERAND_CRK
:
624 errmsg
= insert_normal (cd
, fields
->f_CRk
, 0, 0, 27, 3, 32, total_length
, buffer
);
626 case FRV_OPERAND_FCCI_1
:
627 errmsg
= insert_normal (cd
, fields
->f_FCCi_1
, 0, 0, 11, 2, 32, total_length
, buffer
);
629 case FRV_OPERAND_FCCI_2
:
630 errmsg
= insert_normal (cd
, fields
->f_FCCi_2
, 0, 0, 26, 2, 32, total_length
, buffer
);
632 case FRV_OPERAND_FCCI_3
:
633 errmsg
= insert_normal (cd
, fields
->f_FCCi_3
, 0, 0, 1, 2, 32, total_length
, buffer
);
635 case FRV_OPERAND_FCCK
:
636 errmsg
= insert_normal (cd
, fields
->f_FCCk
, 0, 0, 26, 2, 32, total_length
, buffer
);
638 case FRV_OPERAND_FRDOUBLEI
:
639 errmsg
= insert_normal (cd
, fields
->f_FRi
, 0, 0, 17, 6, 32, total_length
, buffer
);
641 case FRV_OPERAND_FRDOUBLEJ
:
642 errmsg
= insert_normal (cd
, fields
->f_FRj
, 0, 0, 5, 6, 32, total_length
, buffer
);
644 case FRV_OPERAND_FRDOUBLEK
:
645 errmsg
= insert_normal (cd
, fields
->f_FRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
647 case FRV_OPERAND_FRI
:
648 errmsg
= insert_normal (cd
, fields
->f_FRi
, 0, 0, 17, 6, 32, total_length
, buffer
);
650 case FRV_OPERAND_FRINTI
:
651 errmsg
= insert_normal (cd
, fields
->f_FRi
, 0, 0, 17, 6, 32, total_length
, buffer
);
653 case FRV_OPERAND_FRINTIEVEN
:
654 errmsg
= insert_normal (cd
, fields
->f_FRi
, 0, 0, 17, 6, 32, total_length
, buffer
);
656 case FRV_OPERAND_FRINTJ
:
657 errmsg
= insert_normal (cd
, fields
->f_FRj
, 0, 0, 5, 6, 32, total_length
, buffer
);
659 case FRV_OPERAND_FRINTJEVEN
:
660 errmsg
= insert_normal (cd
, fields
->f_FRj
, 0, 0, 5, 6, 32, total_length
, buffer
);
662 case FRV_OPERAND_FRINTK
:
663 errmsg
= insert_normal (cd
, fields
->f_FRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
665 case FRV_OPERAND_FRINTKEVEN
:
666 errmsg
= insert_normal (cd
, fields
->f_FRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
668 case FRV_OPERAND_FRJ
:
669 errmsg
= insert_normal (cd
, fields
->f_FRj
, 0, 0, 5, 6, 32, total_length
, buffer
);
671 case FRV_OPERAND_FRK
:
672 errmsg
= insert_normal (cd
, fields
->f_FRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
674 case FRV_OPERAND_FRKHI
:
675 errmsg
= insert_normal (cd
, fields
->f_FRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
677 case FRV_OPERAND_FRKLO
:
678 errmsg
= insert_normal (cd
, fields
->f_FRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
680 case FRV_OPERAND_GRDOUBLEK
:
681 errmsg
= insert_normal (cd
, fields
->f_GRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
683 case FRV_OPERAND_GRI
:
684 errmsg
= insert_normal (cd
, fields
->f_GRi
, 0, 0, 17, 6, 32, total_length
, buffer
);
686 case FRV_OPERAND_GRJ
:
687 errmsg
= insert_normal (cd
, fields
->f_GRj
, 0, 0, 5, 6, 32, total_length
, buffer
);
689 case FRV_OPERAND_GRK
:
690 errmsg
= insert_normal (cd
, fields
->f_GRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
692 case FRV_OPERAND_GRKHI
:
693 errmsg
= insert_normal (cd
, fields
->f_GRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
695 case FRV_OPERAND_GRKLO
:
696 errmsg
= insert_normal (cd
, fields
->f_GRk
, 0, 0, 30, 6, 32, total_length
, buffer
);
698 case FRV_OPERAND_ICCI_1
:
699 errmsg
= insert_normal (cd
, fields
->f_ICCi_1
, 0, 0, 11, 2, 32, total_length
, buffer
);
701 case FRV_OPERAND_ICCI_2
:
702 errmsg
= insert_normal (cd
, fields
->f_ICCi_2
, 0, 0, 26, 2, 32, total_length
, buffer
);
704 case FRV_OPERAND_ICCI_3
:
705 errmsg
= insert_normal (cd
, fields
->f_ICCi_3
, 0, 0, 1, 2, 32, total_length
, buffer
);
707 case FRV_OPERAND_LI
:
708 errmsg
= insert_normal (cd
, fields
->f_LI
, 0, 0, 25, 1, 32, total_length
, buffer
);
710 case FRV_OPERAND_LRAD
:
711 errmsg
= insert_normal (cd
, fields
->f_LRAD
, 0, 0, 4, 1, 32, total_length
, buffer
);
713 case FRV_OPERAND_LRAE
:
714 errmsg
= insert_normal (cd
, fields
->f_LRAE
, 0, 0, 5, 1, 32, total_length
, buffer
);
716 case FRV_OPERAND_LRAS
:
717 errmsg
= insert_normal (cd
, fields
->f_LRAS
, 0, 0, 3, 1, 32, total_length
, buffer
);
719 case FRV_OPERAND_TLBPRL
:
720 errmsg
= insert_normal (cd
, fields
->f_TLBPRL
, 0, 0, 25, 1, 32, total_length
, buffer
);
722 case FRV_OPERAND_TLBPROPX
:
723 errmsg
= insert_normal (cd
, fields
->f_TLBPRopx
, 0, 0, 28, 3, 32, total_length
, buffer
);
725 case FRV_OPERAND_AE
:
726 errmsg
= insert_normal (cd
, fields
->f_ae
, 0, 0, 25, 1, 32, total_length
, buffer
);
728 case FRV_OPERAND_CALLANN
:
729 errmsg
= insert_normal (cd
, fields
->f_reloc_ann
, 0, 0, 0, 0, 32, total_length
, buffer
);
731 case FRV_OPERAND_CCOND
:
732 errmsg
= insert_normal (cd
, fields
->f_ccond
, 0, 0, 12, 1, 32, total_length
, buffer
);
734 case FRV_OPERAND_COND
:
735 errmsg
= insert_normal (cd
, fields
->f_cond
, 0, 0, 8, 1, 32, total_length
, buffer
);
737 case FRV_OPERAND_D12
:
738 errmsg
= insert_normal (cd
, fields
->f_d12
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 11, 12, 32, total_length
, buffer
);
740 case FRV_OPERAND_DEBUG
:
741 errmsg
= insert_normal (cd
, fields
->f_debug
, 0, 0, 25, 1, 32, total_length
, buffer
);
743 case FRV_OPERAND_EIR
:
744 errmsg
= insert_normal (cd
, fields
->f_eir
, 0, 0, 17, 6, 32, total_length
, buffer
);
746 case FRV_OPERAND_HINT
:
747 errmsg
= insert_normal (cd
, fields
->f_hint
, 0, 0, 17, 2, 32, total_length
, buffer
);
749 case FRV_OPERAND_HINT_NOT_TAKEN
:
750 errmsg
= insert_normal (cd
, fields
->f_hint
, 0, 0, 17, 2, 32, total_length
, buffer
);
752 case FRV_OPERAND_HINT_TAKEN
:
753 errmsg
= insert_normal (cd
, fields
->f_hint
, 0, 0, 17, 2, 32, total_length
, buffer
);
755 case FRV_OPERAND_LABEL16
:
757 long value
= fields
->f_label16
;
758 value
= ((int) (((value
) - (pc
))) >> (2));
759 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 15, 16, 32, total_length
, buffer
);
762 case FRV_OPERAND_LABEL24
:
765 FLD (f_labelH6
) = ((int) (((FLD (f_label24
)) - (pc
))) >> (20));
766 FLD (f_labelL18
) = ((((unsigned int) (((FLD (f_label24
)) - (pc
))) >> (2))) & (262143));
768 errmsg
= insert_normal (cd
, fields
->f_labelH6
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 30, 6, 32, total_length
, buffer
);
771 errmsg
= insert_normal (cd
, fields
->f_labelL18
, 0, 0, 17, 18, 32, total_length
, buffer
);
776 case FRV_OPERAND_LDANN
:
777 errmsg
= insert_normal (cd
, fields
->f_reloc_ann
, 0, 0, 0, 0, 32, total_length
, buffer
);
779 case FRV_OPERAND_LDDANN
:
780 errmsg
= insert_normal (cd
, fields
->f_reloc_ann
, 0, 0, 0, 0, 32, total_length
, buffer
);
782 case FRV_OPERAND_LOCK
:
783 errmsg
= insert_normal (cd
, fields
->f_lock
, 0, 0, 25, 1, 32, total_length
, buffer
);
785 case FRV_OPERAND_PACK
:
786 errmsg
= insert_normal (cd
, fields
->f_pack
, 0, 0, 31, 1, 32, total_length
, buffer
);
788 case FRV_OPERAND_S10
:
789 errmsg
= insert_normal (cd
, fields
->f_s10
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 9, 10, 32, total_length
, buffer
);
791 case FRV_OPERAND_S12
:
792 errmsg
= insert_normal (cd
, fields
->f_d12
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 11, 12, 32, total_length
, buffer
);
794 case FRV_OPERAND_S16
:
795 errmsg
= insert_normal (cd
, fields
->f_s16
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 15, 16, 32, total_length
, buffer
);
797 case FRV_OPERAND_S5
:
798 errmsg
= insert_normal (cd
, fields
->f_s5
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 4, 5, 32, total_length
, buffer
);
800 case FRV_OPERAND_S6
:
801 errmsg
= insert_normal (cd
, fields
->f_s6
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 5, 6, 32, total_length
, buffer
);
803 case FRV_OPERAND_S6_1
:
804 errmsg
= insert_normal (cd
, fields
->f_s6_1
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 11, 6, 32, total_length
, buffer
);
806 case FRV_OPERAND_SLO16
:
807 errmsg
= insert_normal (cd
, fields
->f_s16
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 15, 16, 32, total_length
, buffer
);
809 case FRV_OPERAND_SPR
:
812 FLD (f_spr_h
) = ((unsigned int) (FLD (f_spr
)) >> (6));
813 FLD (f_spr_l
) = ((FLD (f_spr
)) & (63));
815 errmsg
= insert_normal (cd
, fields
->f_spr_h
, 0, 0, 30, 6, 32, total_length
, buffer
);
818 errmsg
= insert_normal (cd
, fields
->f_spr_l
, 0, 0, 17, 6, 32, total_length
, buffer
);
823 case FRV_OPERAND_U12
:
826 FLD (f_u12_h
) = ((int) (FLD (f_u12
)) >> (6));
827 FLD (f_u12_l
) = ((FLD (f_u12
)) & (63));
829 errmsg
= insert_normal (cd
, fields
->f_u12_h
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 17, 6, 32, total_length
, buffer
);
832 errmsg
= insert_normal (cd
, fields
->f_u12_l
, 0, 0, 5, 6, 32, total_length
, buffer
);
837 case FRV_OPERAND_U16
:
838 errmsg
= insert_normal (cd
, fields
->f_u16
, 0, 0, 15, 16, 32, total_length
, buffer
);
840 case FRV_OPERAND_U6
:
841 errmsg
= insert_normal (cd
, fields
->f_u6
, 0, 0, 5, 6, 32, total_length
, buffer
);
843 case FRV_OPERAND_UHI16
:
844 errmsg
= insert_normal (cd
, fields
->f_u16
, 0, 0, 15, 16, 32, total_length
, buffer
);
846 case FRV_OPERAND_ULO16
:
847 errmsg
= insert_normal (cd
, fields
->f_u16
, 0, 0, 15, 16, 32, total_length
, buffer
);
851 /* xgettext:c-format */
852 fprintf (stderr
, _("Unrecognized field %d while building insn.\n"),
860 int frv_cgen_extract_operand
861 (CGEN_CPU_DESC
, int, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
863 /* Main entry point for operand extraction.
864 The result is <= 0 for error, >0 for success.
865 ??? Actual values aren't well defined right now.
867 This function is basically just a big switch statement. Earlier versions
868 used tables to look up the function to use, but
869 - if the table contains both assembler and disassembler functions then
870 the disassembler contains much of the assembler and vice-versa,
871 - there's a lot of inlining possibilities as things grow,
872 - using a switch statement avoids the function call overhead.
874 This function could be moved into `print_insn_normal', but keeping it
875 separate makes clear the interface between `print_insn_normal' and each of
879 frv_cgen_extract_operand (CGEN_CPU_DESC cd
,
881 CGEN_EXTRACT_INFO
*ex_info
,
882 CGEN_INSN_INT insn_value
,
883 CGEN_FIELDS
* fields
,
886 /* Assume success (for those operands that are nops). */
888 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
892 case FRV_OPERAND_A0
:
893 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 1, 32, total_length
, pc
, & fields
->f_A
);
895 case FRV_OPERAND_A1
:
896 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 1, 32, total_length
, pc
, & fields
->f_A
);
898 case FRV_OPERAND_ACC40SI
:
899 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_ACC40Si
);
901 case FRV_OPERAND_ACC40SK
:
902 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_ACC40Sk
);
904 case FRV_OPERAND_ACC40UI
:
905 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_ACC40Ui
);
907 case FRV_OPERAND_ACC40UK
:
908 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_ACC40Uk
);
910 case FRV_OPERAND_ACCGI
:
911 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_ACCGi
);
913 case FRV_OPERAND_ACCGK
:
914 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_ACCGk
);
916 case FRV_OPERAND_CCI
:
917 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 3, 32, total_length
, pc
, & fields
->f_CCi
);
919 case FRV_OPERAND_CPRDOUBLEK
:
920 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_CPRk
);
922 case FRV_OPERAND_CPRI
:
923 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_CPRi
);
925 case FRV_OPERAND_CPRJ
:
926 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_CPRj
);
928 case FRV_OPERAND_CPRK
:
929 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_CPRk
);
931 case FRV_OPERAND_CRI
:
932 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 14, 3, 32, total_length
, pc
, & fields
->f_CRi
);
934 case FRV_OPERAND_CRJ
:
935 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 2, 3, 32, total_length
, pc
, & fields
->f_CRj
);
937 case FRV_OPERAND_CRJ_FLOAT
:
938 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 2, 32, total_length
, pc
, & fields
->f_CRj_float
);
940 case FRV_OPERAND_CRJ_INT
:
943 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 2, 32, total_length
, pc
, & value
);
944 value
= ((value
) + (4));
945 fields
->f_CRj_int
= value
;
948 case FRV_OPERAND_CRK
:
949 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 27, 3, 32, total_length
, pc
, & fields
->f_CRk
);
951 case FRV_OPERAND_FCCI_1
:
952 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 2, 32, total_length
, pc
, & fields
->f_FCCi_1
);
954 case FRV_OPERAND_FCCI_2
:
955 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 2, 32, total_length
, pc
, & fields
->f_FCCi_2
);
957 case FRV_OPERAND_FCCI_3
:
958 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 1, 2, 32, total_length
, pc
, & fields
->f_FCCi_3
);
960 case FRV_OPERAND_FCCK
:
961 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 2, 32, total_length
, pc
, & fields
->f_FCCk
);
963 case FRV_OPERAND_FRDOUBLEI
:
964 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_FRi
);
966 case FRV_OPERAND_FRDOUBLEJ
:
967 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_FRj
);
969 case FRV_OPERAND_FRDOUBLEK
:
970 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_FRk
);
972 case FRV_OPERAND_FRI
:
973 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_FRi
);
975 case FRV_OPERAND_FRINTI
:
976 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_FRi
);
978 case FRV_OPERAND_FRINTIEVEN
:
979 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_FRi
);
981 case FRV_OPERAND_FRINTJ
:
982 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_FRj
);
984 case FRV_OPERAND_FRINTJEVEN
:
985 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_FRj
);
987 case FRV_OPERAND_FRINTK
:
988 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_FRk
);
990 case FRV_OPERAND_FRINTKEVEN
:
991 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_FRk
);
993 case FRV_OPERAND_FRJ
:
994 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_FRj
);
996 case FRV_OPERAND_FRK
:
997 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_FRk
);
999 case FRV_OPERAND_FRKHI
:
1000 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_FRk
);
1002 case FRV_OPERAND_FRKLO
:
1003 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_FRk
);
1005 case FRV_OPERAND_GRDOUBLEK
:
1006 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_GRk
);
1008 case FRV_OPERAND_GRI
:
1009 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_GRi
);
1011 case FRV_OPERAND_GRJ
:
1012 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_GRj
);
1014 case FRV_OPERAND_GRK
:
1015 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_GRk
);
1017 case FRV_OPERAND_GRKHI
:
1018 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_GRk
);
1020 case FRV_OPERAND_GRKLO
:
1021 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_GRk
);
1023 case FRV_OPERAND_ICCI_1
:
1024 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 2, 32, total_length
, pc
, & fields
->f_ICCi_1
);
1026 case FRV_OPERAND_ICCI_2
:
1027 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 2, 32, total_length
, pc
, & fields
->f_ICCi_2
);
1029 case FRV_OPERAND_ICCI_3
:
1030 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 1, 2, 32, total_length
, pc
, & fields
->f_ICCi_3
);
1032 case FRV_OPERAND_LI
:
1033 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 1, 32, total_length
, pc
, & fields
->f_LI
);
1035 case FRV_OPERAND_LRAD
:
1036 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 1, 32, total_length
, pc
, & fields
->f_LRAD
);
1038 case FRV_OPERAND_LRAE
:
1039 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 1, 32, total_length
, pc
, & fields
->f_LRAE
);
1041 case FRV_OPERAND_LRAS
:
1042 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 3, 1, 32, total_length
, pc
, & fields
->f_LRAS
);
1044 case FRV_OPERAND_TLBPRL
:
1045 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 1, 32, total_length
, pc
, & fields
->f_TLBPRL
);
1047 case FRV_OPERAND_TLBPROPX
:
1048 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 3, 32, total_length
, pc
, & fields
->f_TLBPRopx
);
1050 case FRV_OPERAND_AE
:
1051 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 1, 32, total_length
, pc
, & fields
->f_ae
);
1053 case FRV_OPERAND_CALLANN
:
1054 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 0, 32, total_length
, pc
, & fields
->f_reloc_ann
);
1056 case FRV_OPERAND_CCOND
:
1057 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 12, 1, 32, total_length
, pc
, & fields
->f_ccond
);
1059 case FRV_OPERAND_COND
:
1060 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 1, 32, total_length
, pc
, & fields
->f_cond
);
1062 case FRV_OPERAND_D12
:
1063 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 11, 12, 32, total_length
, pc
, & fields
->f_d12
);
1065 case FRV_OPERAND_DEBUG
:
1066 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 1, 32, total_length
, pc
, & fields
->f_debug
);
1068 case FRV_OPERAND_EIR
:
1069 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_eir
);
1071 case FRV_OPERAND_HINT
:
1072 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 2, 32, total_length
, pc
, & fields
->f_hint
);
1074 case FRV_OPERAND_HINT_NOT_TAKEN
:
1075 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 2, 32, total_length
, pc
, & fields
->f_hint
);
1077 case FRV_OPERAND_HINT_TAKEN
:
1078 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 2, 32, total_length
, pc
, & fields
->f_hint
);
1080 case FRV_OPERAND_LABEL16
:
1083 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
);
1084 value
= ((((value
) << (2))) + (pc
));
1085 fields
->f_label16
= value
;
1088 case FRV_OPERAND_LABEL24
:
1090 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 30, 6, 32, total_length
, pc
, & fields
->f_labelH6
);
1091 if (length
<= 0) break;
1092 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 18, 32, total_length
, pc
, & fields
->f_labelL18
);
1093 if (length
<= 0) break;
1095 FLD (f_label24
) = ((((((((FLD (f_labelH6
)) << (18))) | (FLD (f_labelL18
)))) << (2))) + (pc
));
1099 case FRV_OPERAND_LDANN
:
1100 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 0, 32, total_length
, pc
, & fields
->f_reloc_ann
);
1102 case FRV_OPERAND_LDDANN
:
1103 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 0, 32, total_length
, pc
, & fields
->f_reloc_ann
);
1105 case FRV_OPERAND_LOCK
:
1106 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 1, 32, total_length
, pc
, & fields
->f_lock
);
1108 case FRV_OPERAND_PACK
:
1109 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 31, 1, 32, total_length
, pc
, & fields
->f_pack
);
1111 case FRV_OPERAND_S10
:
1112 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 9, 10, 32, total_length
, pc
, & fields
->f_s10
);
1114 case FRV_OPERAND_S12
:
1115 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 11, 12, 32, total_length
, pc
, & fields
->f_d12
);
1117 case FRV_OPERAND_S16
:
1118 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 15, 16, 32, total_length
, pc
, & fields
->f_s16
);
1120 case FRV_OPERAND_S5
:
1121 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 4, 5, 32, total_length
, pc
, & fields
->f_s5
);
1123 case FRV_OPERAND_S6
:
1124 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 5, 6, 32, total_length
, pc
, & fields
->f_s6
);
1126 case FRV_OPERAND_S6_1
:
1127 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 11, 6, 32, total_length
, pc
, & fields
->f_s6_1
);
1129 case FRV_OPERAND_SLO16
:
1130 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 15, 16, 32, total_length
, pc
, & fields
->f_s16
);
1132 case FRV_OPERAND_SPR
:
1134 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 30, 6, 32, total_length
, pc
, & fields
->f_spr_h
);
1135 if (length
<= 0) break;
1136 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_spr_l
);
1137 if (length
<= 0) break;
1139 FLD (f_spr
) = ((((FLD (f_spr_h
)) << (6))) | (FLD (f_spr_l
)));
1143 case FRV_OPERAND_U12
:
1145 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 17, 6, 32, total_length
, pc
, & fields
->f_u12_h
);
1146 if (length
<= 0) break;
1147 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_u12_l
);
1148 if (length
<= 0) break;
1150 FLD (f_u12
) = ((((FLD (f_u12_h
)) << (6))) | (FLD (f_u12_l
)));
1154 case FRV_OPERAND_U16
:
1155 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 16, 32, total_length
, pc
, & fields
->f_u16
);
1157 case FRV_OPERAND_U6
:
1158 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_u6
);
1160 case FRV_OPERAND_UHI16
:
1161 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 16, 32, total_length
, pc
, & fields
->f_u16
);
1163 case FRV_OPERAND_ULO16
:
1164 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 16, 32, total_length
, pc
, & fields
->f_u16
);
1168 /* xgettext:c-format */
1169 fprintf (stderr
, _("Unrecognized field %d while decoding insn.\n"),
1177 cgen_insert_fn
* const frv_cgen_insert_handlers
[] =
1182 cgen_extract_fn
* const frv_cgen_extract_handlers
[] =
1184 extract_insn_normal
,
1187 int frv_cgen_get_int_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1188 bfd_vma
frv_cgen_get_vma_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1190 /* Getting values from cgen_fields is handled by a collection of functions.
1191 They are distinguished by the type of the VALUE argument they return.
1192 TODO: floating point, inlining support, remove cases where result type
1196 frv_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1198 const CGEN_FIELDS
* fields
)
1204 case FRV_OPERAND_A0
:
1205 value
= fields
->f_A
;
1207 case FRV_OPERAND_A1
:
1208 value
= fields
->f_A
;
1210 case FRV_OPERAND_ACC40SI
:
1211 value
= fields
->f_ACC40Si
;
1213 case FRV_OPERAND_ACC40SK
:
1214 value
= fields
->f_ACC40Sk
;
1216 case FRV_OPERAND_ACC40UI
:
1217 value
= fields
->f_ACC40Ui
;
1219 case FRV_OPERAND_ACC40UK
:
1220 value
= fields
->f_ACC40Uk
;
1222 case FRV_OPERAND_ACCGI
:
1223 value
= fields
->f_ACCGi
;
1225 case FRV_OPERAND_ACCGK
:
1226 value
= fields
->f_ACCGk
;
1228 case FRV_OPERAND_CCI
:
1229 value
= fields
->f_CCi
;
1231 case FRV_OPERAND_CPRDOUBLEK
:
1232 value
= fields
->f_CPRk
;
1234 case FRV_OPERAND_CPRI
:
1235 value
= fields
->f_CPRi
;
1237 case FRV_OPERAND_CPRJ
:
1238 value
= fields
->f_CPRj
;
1240 case FRV_OPERAND_CPRK
:
1241 value
= fields
->f_CPRk
;
1243 case FRV_OPERAND_CRI
:
1244 value
= fields
->f_CRi
;
1246 case FRV_OPERAND_CRJ
:
1247 value
= fields
->f_CRj
;
1249 case FRV_OPERAND_CRJ_FLOAT
:
1250 value
= fields
->f_CRj_float
;
1252 case FRV_OPERAND_CRJ_INT
:
1253 value
= fields
->f_CRj_int
;
1255 case FRV_OPERAND_CRK
:
1256 value
= fields
->f_CRk
;
1258 case FRV_OPERAND_FCCI_1
:
1259 value
= fields
->f_FCCi_1
;
1261 case FRV_OPERAND_FCCI_2
:
1262 value
= fields
->f_FCCi_2
;
1264 case FRV_OPERAND_FCCI_3
:
1265 value
= fields
->f_FCCi_3
;
1267 case FRV_OPERAND_FCCK
:
1268 value
= fields
->f_FCCk
;
1270 case FRV_OPERAND_FRDOUBLEI
:
1271 value
= fields
->f_FRi
;
1273 case FRV_OPERAND_FRDOUBLEJ
:
1274 value
= fields
->f_FRj
;
1276 case FRV_OPERAND_FRDOUBLEK
:
1277 value
= fields
->f_FRk
;
1279 case FRV_OPERAND_FRI
:
1280 value
= fields
->f_FRi
;
1282 case FRV_OPERAND_FRINTI
:
1283 value
= fields
->f_FRi
;
1285 case FRV_OPERAND_FRINTIEVEN
:
1286 value
= fields
->f_FRi
;
1288 case FRV_OPERAND_FRINTJ
:
1289 value
= fields
->f_FRj
;
1291 case FRV_OPERAND_FRINTJEVEN
:
1292 value
= fields
->f_FRj
;
1294 case FRV_OPERAND_FRINTK
:
1295 value
= fields
->f_FRk
;
1297 case FRV_OPERAND_FRINTKEVEN
:
1298 value
= fields
->f_FRk
;
1300 case FRV_OPERAND_FRJ
:
1301 value
= fields
->f_FRj
;
1303 case FRV_OPERAND_FRK
:
1304 value
= fields
->f_FRk
;
1306 case FRV_OPERAND_FRKHI
:
1307 value
= fields
->f_FRk
;
1309 case FRV_OPERAND_FRKLO
:
1310 value
= fields
->f_FRk
;
1312 case FRV_OPERAND_GRDOUBLEK
:
1313 value
= fields
->f_GRk
;
1315 case FRV_OPERAND_GRI
:
1316 value
= fields
->f_GRi
;
1318 case FRV_OPERAND_GRJ
:
1319 value
= fields
->f_GRj
;
1321 case FRV_OPERAND_GRK
:
1322 value
= fields
->f_GRk
;
1324 case FRV_OPERAND_GRKHI
:
1325 value
= fields
->f_GRk
;
1327 case FRV_OPERAND_GRKLO
:
1328 value
= fields
->f_GRk
;
1330 case FRV_OPERAND_ICCI_1
:
1331 value
= fields
->f_ICCi_1
;
1333 case FRV_OPERAND_ICCI_2
:
1334 value
= fields
->f_ICCi_2
;
1336 case FRV_OPERAND_ICCI_3
:
1337 value
= fields
->f_ICCi_3
;
1339 case FRV_OPERAND_LI
:
1340 value
= fields
->f_LI
;
1342 case FRV_OPERAND_LRAD
:
1343 value
= fields
->f_LRAD
;
1345 case FRV_OPERAND_LRAE
:
1346 value
= fields
->f_LRAE
;
1348 case FRV_OPERAND_LRAS
:
1349 value
= fields
->f_LRAS
;
1351 case FRV_OPERAND_TLBPRL
:
1352 value
= fields
->f_TLBPRL
;
1354 case FRV_OPERAND_TLBPROPX
:
1355 value
= fields
->f_TLBPRopx
;
1357 case FRV_OPERAND_AE
:
1358 value
= fields
->f_ae
;
1360 case FRV_OPERAND_CALLANN
:
1361 value
= fields
->f_reloc_ann
;
1363 case FRV_OPERAND_CCOND
:
1364 value
= fields
->f_ccond
;
1366 case FRV_OPERAND_COND
:
1367 value
= fields
->f_cond
;
1369 case FRV_OPERAND_D12
:
1370 value
= fields
->f_d12
;
1372 case FRV_OPERAND_DEBUG
:
1373 value
= fields
->f_debug
;
1375 case FRV_OPERAND_EIR
:
1376 value
= fields
->f_eir
;
1378 case FRV_OPERAND_HINT
:
1379 value
= fields
->f_hint
;
1381 case FRV_OPERAND_HINT_NOT_TAKEN
:
1382 value
= fields
->f_hint
;
1384 case FRV_OPERAND_HINT_TAKEN
:
1385 value
= fields
->f_hint
;
1387 case FRV_OPERAND_LABEL16
:
1388 value
= fields
->f_label16
;
1390 case FRV_OPERAND_LABEL24
:
1391 value
= fields
->f_label24
;
1393 case FRV_OPERAND_LDANN
:
1394 value
= fields
->f_reloc_ann
;
1396 case FRV_OPERAND_LDDANN
:
1397 value
= fields
->f_reloc_ann
;
1399 case FRV_OPERAND_LOCK
:
1400 value
= fields
->f_lock
;
1402 case FRV_OPERAND_PACK
:
1403 value
= fields
->f_pack
;
1405 case FRV_OPERAND_S10
:
1406 value
= fields
->f_s10
;
1408 case FRV_OPERAND_S12
:
1409 value
= fields
->f_d12
;
1411 case FRV_OPERAND_S16
:
1412 value
= fields
->f_s16
;
1414 case FRV_OPERAND_S5
:
1415 value
= fields
->f_s5
;
1417 case FRV_OPERAND_S6
:
1418 value
= fields
->f_s6
;
1420 case FRV_OPERAND_S6_1
:
1421 value
= fields
->f_s6_1
;
1423 case FRV_OPERAND_SLO16
:
1424 value
= fields
->f_s16
;
1426 case FRV_OPERAND_SPR
:
1427 value
= fields
->f_spr
;
1429 case FRV_OPERAND_U12
:
1430 value
= fields
->f_u12
;
1432 case FRV_OPERAND_U16
:
1433 value
= fields
->f_u16
;
1435 case FRV_OPERAND_U6
:
1436 value
= fields
->f_u6
;
1438 case FRV_OPERAND_UHI16
:
1439 value
= fields
->f_u16
;
1441 case FRV_OPERAND_ULO16
:
1442 value
= fields
->f_u16
;
1446 /* xgettext:c-format */
1447 fprintf (stderr
, _("Unrecognized field %d while getting int operand.\n"),
1456 frv_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1458 const CGEN_FIELDS
* fields
)
1464 case FRV_OPERAND_A0
:
1465 value
= fields
->f_A
;
1467 case FRV_OPERAND_A1
:
1468 value
= fields
->f_A
;
1470 case FRV_OPERAND_ACC40SI
:
1471 value
= fields
->f_ACC40Si
;
1473 case FRV_OPERAND_ACC40SK
:
1474 value
= fields
->f_ACC40Sk
;
1476 case FRV_OPERAND_ACC40UI
:
1477 value
= fields
->f_ACC40Ui
;
1479 case FRV_OPERAND_ACC40UK
:
1480 value
= fields
->f_ACC40Uk
;
1482 case FRV_OPERAND_ACCGI
:
1483 value
= fields
->f_ACCGi
;
1485 case FRV_OPERAND_ACCGK
:
1486 value
= fields
->f_ACCGk
;
1488 case FRV_OPERAND_CCI
:
1489 value
= fields
->f_CCi
;
1491 case FRV_OPERAND_CPRDOUBLEK
:
1492 value
= fields
->f_CPRk
;
1494 case FRV_OPERAND_CPRI
:
1495 value
= fields
->f_CPRi
;
1497 case FRV_OPERAND_CPRJ
:
1498 value
= fields
->f_CPRj
;
1500 case FRV_OPERAND_CPRK
:
1501 value
= fields
->f_CPRk
;
1503 case FRV_OPERAND_CRI
:
1504 value
= fields
->f_CRi
;
1506 case FRV_OPERAND_CRJ
:
1507 value
= fields
->f_CRj
;
1509 case FRV_OPERAND_CRJ_FLOAT
:
1510 value
= fields
->f_CRj_float
;
1512 case FRV_OPERAND_CRJ_INT
:
1513 value
= fields
->f_CRj_int
;
1515 case FRV_OPERAND_CRK
:
1516 value
= fields
->f_CRk
;
1518 case FRV_OPERAND_FCCI_1
:
1519 value
= fields
->f_FCCi_1
;
1521 case FRV_OPERAND_FCCI_2
:
1522 value
= fields
->f_FCCi_2
;
1524 case FRV_OPERAND_FCCI_3
:
1525 value
= fields
->f_FCCi_3
;
1527 case FRV_OPERAND_FCCK
:
1528 value
= fields
->f_FCCk
;
1530 case FRV_OPERAND_FRDOUBLEI
:
1531 value
= fields
->f_FRi
;
1533 case FRV_OPERAND_FRDOUBLEJ
:
1534 value
= fields
->f_FRj
;
1536 case FRV_OPERAND_FRDOUBLEK
:
1537 value
= fields
->f_FRk
;
1539 case FRV_OPERAND_FRI
:
1540 value
= fields
->f_FRi
;
1542 case FRV_OPERAND_FRINTI
:
1543 value
= fields
->f_FRi
;
1545 case FRV_OPERAND_FRINTIEVEN
:
1546 value
= fields
->f_FRi
;
1548 case FRV_OPERAND_FRINTJ
:
1549 value
= fields
->f_FRj
;
1551 case FRV_OPERAND_FRINTJEVEN
:
1552 value
= fields
->f_FRj
;
1554 case FRV_OPERAND_FRINTK
:
1555 value
= fields
->f_FRk
;
1557 case FRV_OPERAND_FRINTKEVEN
:
1558 value
= fields
->f_FRk
;
1560 case FRV_OPERAND_FRJ
:
1561 value
= fields
->f_FRj
;
1563 case FRV_OPERAND_FRK
:
1564 value
= fields
->f_FRk
;
1566 case FRV_OPERAND_FRKHI
:
1567 value
= fields
->f_FRk
;
1569 case FRV_OPERAND_FRKLO
:
1570 value
= fields
->f_FRk
;
1572 case FRV_OPERAND_GRDOUBLEK
:
1573 value
= fields
->f_GRk
;
1575 case FRV_OPERAND_GRI
:
1576 value
= fields
->f_GRi
;
1578 case FRV_OPERAND_GRJ
:
1579 value
= fields
->f_GRj
;
1581 case FRV_OPERAND_GRK
:
1582 value
= fields
->f_GRk
;
1584 case FRV_OPERAND_GRKHI
:
1585 value
= fields
->f_GRk
;
1587 case FRV_OPERAND_GRKLO
:
1588 value
= fields
->f_GRk
;
1590 case FRV_OPERAND_ICCI_1
:
1591 value
= fields
->f_ICCi_1
;
1593 case FRV_OPERAND_ICCI_2
:
1594 value
= fields
->f_ICCi_2
;
1596 case FRV_OPERAND_ICCI_3
:
1597 value
= fields
->f_ICCi_3
;
1599 case FRV_OPERAND_LI
:
1600 value
= fields
->f_LI
;
1602 case FRV_OPERAND_LRAD
:
1603 value
= fields
->f_LRAD
;
1605 case FRV_OPERAND_LRAE
:
1606 value
= fields
->f_LRAE
;
1608 case FRV_OPERAND_LRAS
:
1609 value
= fields
->f_LRAS
;
1611 case FRV_OPERAND_TLBPRL
:
1612 value
= fields
->f_TLBPRL
;
1614 case FRV_OPERAND_TLBPROPX
:
1615 value
= fields
->f_TLBPRopx
;
1617 case FRV_OPERAND_AE
:
1618 value
= fields
->f_ae
;
1620 case FRV_OPERAND_CALLANN
:
1621 value
= fields
->f_reloc_ann
;
1623 case FRV_OPERAND_CCOND
:
1624 value
= fields
->f_ccond
;
1626 case FRV_OPERAND_COND
:
1627 value
= fields
->f_cond
;
1629 case FRV_OPERAND_D12
:
1630 value
= fields
->f_d12
;
1632 case FRV_OPERAND_DEBUG
:
1633 value
= fields
->f_debug
;
1635 case FRV_OPERAND_EIR
:
1636 value
= fields
->f_eir
;
1638 case FRV_OPERAND_HINT
:
1639 value
= fields
->f_hint
;
1641 case FRV_OPERAND_HINT_NOT_TAKEN
:
1642 value
= fields
->f_hint
;
1644 case FRV_OPERAND_HINT_TAKEN
:
1645 value
= fields
->f_hint
;
1647 case FRV_OPERAND_LABEL16
:
1648 value
= fields
->f_label16
;
1650 case FRV_OPERAND_LABEL24
:
1651 value
= fields
->f_label24
;
1653 case FRV_OPERAND_LDANN
:
1654 value
= fields
->f_reloc_ann
;
1656 case FRV_OPERAND_LDDANN
:
1657 value
= fields
->f_reloc_ann
;
1659 case FRV_OPERAND_LOCK
:
1660 value
= fields
->f_lock
;
1662 case FRV_OPERAND_PACK
:
1663 value
= fields
->f_pack
;
1665 case FRV_OPERAND_S10
:
1666 value
= fields
->f_s10
;
1668 case FRV_OPERAND_S12
:
1669 value
= fields
->f_d12
;
1671 case FRV_OPERAND_S16
:
1672 value
= fields
->f_s16
;
1674 case FRV_OPERAND_S5
:
1675 value
= fields
->f_s5
;
1677 case FRV_OPERAND_S6
:
1678 value
= fields
->f_s6
;
1680 case FRV_OPERAND_S6_1
:
1681 value
= fields
->f_s6_1
;
1683 case FRV_OPERAND_SLO16
:
1684 value
= fields
->f_s16
;
1686 case FRV_OPERAND_SPR
:
1687 value
= fields
->f_spr
;
1689 case FRV_OPERAND_U12
:
1690 value
= fields
->f_u12
;
1692 case FRV_OPERAND_U16
:
1693 value
= fields
->f_u16
;
1695 case FRV_OPERAND_U6
:
1696 value
= fields
->f_u6
;
1698 case FRV_OPERAND_UHI16
:
1699 value
= fields
->f_u16
;
1701 case FRV_OPERAND_ULO16
:
1702 value
= fields
->f_u16
;
1706 /* xgettext:c-format */
1707 fprintf (stderr
, _("Unrecognized field %d while getting vma operand.\n"),
1715 void frv_cgen_set_int_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, int);
1716 void frv_cgen_set_vma_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, bfd_vma
);
1718 /* Stuffing values in cgen_fields is handled by a collection of functions.
1719 They are distinguished by the type of the VALUE argument they accept.
1720 TODO: floating point, inlining support, remove cases where argument type
1724 frv_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1726 CGEN_FIELDS
* fields
,
1731 case FRV_OPERAND_A0
:
1732 fields
->f_A
= value
;
1734 case FRV_OPERAND_A1
:
1735 fields
->f_A
= value
;
1737 case FRV_OPERAND_ACC40SI
:
1738 fields
->f_ACC40Si
= value
;
1740 case FRV_OPERAND_ACC40SK
:
1741 fields
->f_ACC40Sk
= value
;
1743 case FRV_OPERAND_ACC40UI
:
1744 fields
->f_ACC40Ui
= value
;
1746 case FRV_OPERAND_ACC40UK
:
1747 fields
->f_ACC40Uk
= value
;
1749 case FRV_OPERAND_ACCGI
:
1750 fields
->f_ACCGi
= value
;
1752 case FRV_OPERAND_ACCGK
:
1753 fields
->f_ACCGk
= value
;
1755 case FRV_OPERAND_CCI
:
1756 fields
->f_CCi
= value
;
1758 case FRV_OPERAND_CPRDOUBLEK
:
1759 fields
->f_CPRk
= value
;
1761 case FRV_OPERAND_CPRI
:
1762 fields
->f_CPRi
= value
;
1764 case FRV_OPERAND_CPRJ
:
1765 fields
->f_CPRj
= value
;
1767 case FRV_OPERAND_CPRK
:
1768 fields
->f_CPRk
= value
;
1770 case FRV_OPERAND_CRI
:
1771 fields
->f_CRi
= value
;
1773 case FRV_OPERAND_CRJ
:
1774 fields
->f_CRj
= value
;
1776 case FRV_OPERAND_CRJ_FLOAT
:
1777 fields
->f_CRj_float
= value
;
1779 case FRV_OPERAND_CRJ_INT
:
1780 fields
->f_CRj_int
= value
;
1782 case FRV_OPERAND_CRK
:
1783 fields
->f_CRk
= value
;
1785 case FRV_OPERAND_FCCI_1
:
1786 fields
->f_FCCi_1
= value
;
1788 case FRV_OPERAND_FCCI_2
:
1789 fields
->f_FCCi_2
= value
;
1791 case FRV_OPERAND_FCCI_3
:
1792 fields
->f_FCCi_3
= value
;
1794 case FRV_OPERAND_FCCK
:
1795 fields
->f_FCCk
= value
;
1797 case FRV_OPERAND_FRDOUBLEI
:
1798 fields
->f_FRi
= value
;
1800 case FRV_OPERAND_FRDOUBLEJ
:
1801 fields
->f_FRj
= value
;
1803 case FRV_OPERAND_FRDOUBLEK
:
1804 fields
->f_FRk
= value
;
1806 case FRV_OPERAND_FRI
:
1807 fields
->f_FRi
= value
;
1809 case FRV_OPERAND_FRINTI
:
1810 fields
->f_FRi
= value
;
1812 case FRV_OPERAND_FRINTIEVEN
:
1813 fields
->f_FRi
= value
;
1815 case FRV_OPERAND_FRINTJ
:
1816 fields
->f_FRj
= value
;
1818 case FRV_OPERAND_FRINTJEVEN
:
1819 fields
->f_FRj
= value
;
1821 case FRV_OPERAND_FRINTK
:
1822 fields
->f_FRk
= value
;
1824 case FRV_OPERAND_FRINTKEVEN
:
1825 fields
->f_FRk
= value
;
1827 case FRV_OPERAND_FRJ
:
1828 fields
->f_FRj
= value
;
1830 case FRV_OPERAND_FRK
:
1831 fields
->f_FRk
= value
;
1833 case FRV_OPERAND_FRKHI
:
1834 fields
->f_FRk
= value
;
1836 case FRV_OPERAND_FRKLO
:
1837 fields
->f_FRk
= value
;
1839 case FRV_OPERAND_GRDOUBLEK
:
1840 fields
->f_GRk
= value
;
1842 case FRV_OPERAND_GRI
:
1843 fields
->f_GRi
= value
;
1845 case FRV_OPERAND_GRJ
:
1846 fields
->f_GRj
= value
;
1848 case FRV_OPERAND_GRK
:
1849 fields
->f_GRk
= value
;
1851 case FRV_OPERAND_GRKHI
:
1852 fields
->f_GRk
= value
;
1854 case FRV_OPERAND_GRKLO
:
1855 fields
->f_GRk
= value
;
1857 case FRV_OPERAND_ICCI_1
:
1858 fields
->f_ICCi_1
= value
;
1860 case FRV_OPERAND_ICCI_2
:
1861 fields
->f_ICCi_2
= value
;
1863 case FRV_OPERAND_ICCI_3
:
1864 fields
->f_ICCi_3
= value
;
1866 case FRV_OPERAND_LI
:
1867 fields
->f_LI
= value
;
1869 case FRV_OPERAND_LRAD
:
1870 fields
->f_LRAD
= value
;
1872 case FRV_OPERAND_LRAE
:
1873 fields
->f_LRAE
= value
;
1875 case FRV_OPERAND_LRAS
:
1876 fields
->f_LRAS
= value
;
1878 case FRV_OPERAND_TLBPRL
:
1879 fields
->f_TLBPRL
= value
;
1881 case FRV_OPERAND_TLBPROPX
:
1882 fields
->f_TLBPRopx
= value
;
1884 case FRV_OPERAND_AE
:
1885 fields
->f_ae
= value
;
1887 case FRV_OPERAND_CALLANN
:
1888 fields
->f_reloc_ann
= value
;
1890 case FRV_OPERAND_CCOND
:
1891 fields
->f_ccond
= value
;
1893 case FRV_OPERAND_COND
:
1894 fields
->f_cond
= value
;
1896 case FRV_OPERAND_D12
:
1897 fields
->f_d12
= value
;
1899 case FRV_OPERAND_DEBUG
:
1900 fields
->f_debug
= value
;
1902 case FRV_OPERAND_EIR
:
1903 fields
->f_eir
= value
;
1905 case FRV_OPERAND_HINT
:
1906 fields
->f_hint
= value
;
1908 case FRV_OPERAND_HINT_NOT_TAKEN
:
1909 fields
->f_hint
= value
;
1911 case FRV_OPERAND_HINT_TAKEN
:
1912 fields
->f_hint
= value
;
1914 case FRV_OPERAND_LABEL16
:
1915 fields
->f_label16
= value
;
1917 case FRV_OPERAND_LABEL24
:
1918 fields
->f_label24
= value
;
1920 case FRV_OPERAND_LDANN
:
1921 fields
->f_reloc_ann
= value
;
1923 case FRV_OPERAND_LDDANN
:
1924 fields
->f_reloc_ann
= value
;
1926 case FRV_OPERAND_LOCK
:
1927 fields
->f_lock
= value
;
1929 case FRV_OPERAND_PACK
:
1930 fields
->f_pack
= value
;
1932 case FRV_OPERAND_S10
:
1933 fields
->f_s10
= value
;
1935 case FRV_OPERAND_S12
:
1936 fields
->f_d12
= value
;
1938 case FRV_OPERAND_S16
:
1939 fields
->f_s16
= value
;
1941 case FRV_OPERAND_S5
:
1942 fields
->f_s5
= value
;
1944 case FRV_OPERAND_S6
:
1945 fields
->f_s6
= value
;
1947 case FRV_OPERAND_S6_1
:
1948 fields
->f_s6_1
= value
;
1950 case FRV_OPERAND_SLO16
:
1951 fields
->f_s16
= value
;
1953 case FRV_OPERAND_SPR
:
1954 fields
->f_spr
= value
;
1956 case FRV_OPERAND_U12
:
1957 fields
->f_u12
= value
;
1959 case FRV_OPERAND_U16
:
1960 fields
->f_u16
= value
;
1962 case FRV_OPERAND_U6
:
1963 fields
->f_u6
= value
;
1965 case FRV_OPERAND_UHI16
:
1966 fields
->f_u16
= value
;
1968 case FRV_OPERAND_ULO16
:
1969 fields
->f_u16
= value
;
1973 /* xgettext:c-format */
1974 fprintf (stderr
, _("Unrecognized field %d while setting int operand.\n"),
1981 frv_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1983 CGEN_FIELDS
* fields
,
1988 case FRV_OPERAND_A0
:
1989 fields
->f_A
= value
;
1991 case FRV_OPERAND_A1
:
1992 fields
->f_A
= value
;
1994 case FRV_OPERAND_ACC40SI
:
1995 fields
->f_ACC40Si
= value
;
1997 case FRV_OPERAND_ACC40SK
:
1998 fields
->f_ACC40Sk
= value
;
2000 case FRV_OPERAND_ACC40UI
:
2001 fields
->f_ACC40Ui
= value
;
2003 case FRV_OPERAND_ACC40UK
:
2004 fields
->f_ACC40Uk
= value
;
2006 case FRV_OPERAND_ACCGI
:
2007 fields
->f_ACCGi
= value
;
2009 case FRV_OPERAND_ACCGK
:
2010 fields
->f_ACCGk
= value
;
2012 case FRV_OPERAND_CCI
:
2013 fields
->f_CCi
= value
;
2015 case FRV_OPERAND_CPRDOUBLEK
:
2016 fields
->f_CPRk
= value
;
2018 case FRV_OPERAND_CPRI
:
2019 fields
->f_CPRi
= value
;
2021 case FRV_OPERAND_CPRJ
:
2022 fields
->f_CPRj
= value
;
2024 case FRV_OPERAND_CPRK
:
2025 fields
->f_CPRk
= value
;
2027 case FRV_OPERAND_CRI
:
2028 fields
->f_CRi
= value
;
2030 case FRV_OPERAND_CRJ
:
2031 fields
->f_CRj
= value
;
2033 case FRV_OPERAND_CRJ_FLOAT
:
2034 fields
->f_CRj_float
= value
;
2036 case FRV_OPERAND_CRJ_INT
:
2037 fields
->f_CRj_int
= value
;
2039 case FRV_OPERAND_CRK
:
2040 fields
->f_CRk
= value
;
2042 case FRV_OPERAND_FCCI_1
:
2043 fields
->f_FCCi_1
= value
;
2045 case FRV_OPERAND_FCCI_2
:
2046 fields
->f_FCCi_2
= value
;
2048 case FRV_OPERAND_FCCI_3
:
2049 fields
->f_FCCi_3
= value
;
2051 case FRV_OPERAND_FCCK
:
2052 fields
->f_FCCk
= value
;
2054 case FRV_OPERAND_FRDOUBLEI
:
2055 fields
->f_FRi
= value
;
2057 case FRV_OPERAND_FRDOUBLEJ
:
2058 fields
->f_FRj
= value
;
2060 case FRV_OPERAND_FRDOUBLEK
:
2061 fields
->f_FRk
= value
;
2063 case FRV_OPERAND_FRI
:
2064 fields
->f_FRi
= value
;
2066 case FRV_OPERAND_FRINTI
:
2067 fields
->f_FRi
= value
;
2069 case FRV_OPERAND_FRINTIEVEN
:
2070 fields
->f_FRi
= value
;
2072 case FRV_OPERAND_FRINTJ
:
2073 fields
->f_FRj
= value
;
2075 case FRV_OPERAND_FRINTJEVEN
:
2076 fields
->f_FRj
= value
;
2078 case FRV_OPERAND_FRINTK
:
2079 fields
->f_FRk
= value
;
2081 case FRV_OPERAND_FRINTKEVEN
:
2082 fields
->f_FRk
= value
;
2084 case FRV_OPERAND_FRJ
:
2085 fields
->f_FRj
= value
;
2087 case FRV_OPERAND_FRK
:
2088 fields
->f_FRk
= value
;
2090 case FRV_OPERAND_FRKHI
:
2091 fields
->f_FRk
= value
;
2093 case FRV_OPERAND_FRKLO
:
2094 fields
->f_FRk
= value
;
2096 case FRV_OPERAND_GRDOUBLEK
:
2097 fields
->f_GRk
= value
;
2099 case FRV_OPERAND_GRI
:
2100 fields
->f_GRi
= value
;
2102 case FRV_OPERAND_GRJ
:
2103 fields
->f_GRj
= value
;
2105 case FRV_OPERAND_GRK
:
2106 fields
->f_GRk
= value
;
2108 case FRV_OPERAND_GRKHI
:
2109 fields
->f_GRk
= value
;
2111 case FRV_OPERAND_GRKLO
:
2112 fields
->f_GRk
= value
;
2114 case FRV_OPERAND_ICCI_1
:
2115 fields
->f_ICCi_1
= value
;
2117 case FRV_OPERAND_ICCI_2
:
2118 fields
->f_ICCi_2
= value
;
2120 case FRV_OPERAND_ICCI_3
:
2121 fields
->f_ICCi_3
= value
;
2123 case FRV_OPERAND_LI
:
2124 fields
->f_LI
= value
;
2126 case FRV_OPERAND_LRAD
:
2127 fields
->f_LRAD
= value
;
2129 case FRV_OPERAND_LRAE
:
2130 fields
->f_LRAE
= value
;
2132 case FRV_OPERAND_LRAS
:
2133 fields
->f_LRAS
= value
;
2135 case FRV_OPERAND_TLBPRL
:
2136 fields
->f_TLBPRL
= value
;
2138 case FRV_OPERAND_TLBPROPX
:
2139 fields
->f_TLBPRopx
= value
;
2141 case FRV_OPERAND_AE
:
2142 fields
->f_ae
= value
;
2144 case FRV_OPERAND_CALLANN
:
2145 fields
->f_reloc_ann
= value
;
2147 case FRV_OPERAND_CCOND
:
2148 fields
->f_ccond
= value
;
2150 case FRV_OPERAND_COND
:
2151 fields
->f_cond
= value
;
2153 case FRV_OPERAND_D12
:
2154 fields
->f_d12
= value
;
2156 case FRV_OPERAND_DEBUG
:
2157 fields
->f_debug
= value
;
2159 case FRV_OPERAND_EIR
:
2160 fields
->f_eir
= value
;
2162 case FRV_OPERAND_HINT
:
2163 fields
->f_hint
= value
;
2165 case FRV_OPERAND_HINT_NOT_TAKEN
:
2166 fields
->f_hint
= value
;
2168 case FRV_OPERAND_HINT_TAKEN
:
2169 fields
->f_hint
= value
;
2171 case FRV_OPERAND_LABEL16
:
2172 fields
->f_label16
= value
;
2174 case FRV_OPERAND_LABEL24
:
2175 fields
->f_label24
= value
;
2177 case FRV_OPERAND_LDANN
:
2178 fields
->f_reloc_ann
= value
;
2180 case FRV_OPERAND_LDDANN
:
2181 fields
->f_reloc_ann
= value
;
2183 case FRV_OPERAND_LOCK
:
2184 fields
->f_lock
= value
;
2186 case FRV_OPERAND_PACK
:
2187 fields
->f_pack
= value
;
2189 case FRV_OPERAND_S10
:
2190 fields
->f_s10
= value
;
2192 case FRV_OPERAND_S12
:
2193 fields
->f_d12
= value
;
2195 case FRV_OPERAND_S16
:
2196 fields
->f_s16
= value
;
2198 case FRV_OPERAND_S5
:
2199 fields
->f_s5
= value
;
2201 case FRV_OPERAND_S6
:
2202 fields
->f_s6
= value
;
2204 case FRV_OPERAND_S6_1
:
2205 fields
->f_s6_1
= value
;
2207 case FRV_OPERAND_SLO16
:
2208 fields
->f_s16
= value
;
2210 case FRV_OPERAND_SPR
:
2211 fields
->f_spr
= value
;
2213 case FRV_OPERAND_U12
:
2214 fields
->f_u12
= value
;
2216 case FRV_OPERAND_U16
:
2217 fields
->f_u16
= value
;
2219 case FRV_OPERAND_U6
:
2220 fields
->f_u6
= value
;
2222 case FRV_OPERAND_UHI16
:
2223 fields
->f_u16
= value
;
2225 case FRV_OPERAND_ULO16
:
2226 fields
->f_u16
= value
;
2230 /* xgettext:c-format */
2231 fprintf (stderr
, _("Unrecognized field %d while setting vma operand.\n"),
2237 /* Function to call before using the instruction builder tables. */
2240 frv_cgen_init_ibld_table (CGEN_CPU_DESC cd
)
2242 cd
->insert_handlers
= & frv_cgen_insert_handlers
[0];
2243 cd
->extract_handlers
= & frv_cgen_extract_handlers
[0];
2245 cd
->insert_operand
= frv_cgen_insert_operand
;
2246 cd
->extract_operand
= frv_cgen_extract_operand
;
2248 cd
->get_int_operand
= frv_cgen_get_int_operand
;
2249 cd
->set_int_operand
= frv_cgen_set_int_operand
;
2250 cd
->get_vma_operand
= frv_cgen_get_vma_operand
;
2251 cd
->set_vma_operand
= frv_cgen_set_vma_operand
;