1 /* Instruction building/extraction support for mep. -*- 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, 2007,
7 2008 Free Software Foundation, Inc.
9 This file is part of libopcodes.
11 This library is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3, or (at your option)
16 It is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19 License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
25 /* ??? Eventually more and more of this stuff can go to cpu-independent files.
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 * mep_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 mep_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 MEP_OPERAND_ADDR24A4
:
571 FLD (f_24u8a4n_hi
) = ((unsigned int) (FLD (f_24u8a4n
)) >> (8));
572 FLD (f_24u8a4n_lo
) = ((unsigned int) (((FLD (f_24u8a4n
)) & (252))) >> (2));
574 errmsg
= insert_normal (cd
, fields
->f_24u8a4n_hi
, 0, 0, 16, 16, 32, total_length
, buffer
);
577 errmsg
= insert_normal (cd
, fields
->f_24u8a4n_lo
, 0, 0, 8, 6, 32, total_length
, buffer
);
582 case MEP_OPERAND_C5RMUIMM20
:
585 FLD (f_c5_rm
) = ((unsigned int) (FLD (f_c5_rmuimm20
)) >> (16));
586 FLD (f_c5_16u16
) = ((FLD (f_c5_rmuimm20
)) & (65535));
588 errmsg
= insert_normal (cd
, fields
->f_c5_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
591 errmsg
= insert_normal (cd
, fields
->f_c5_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
596 case MEP_OPERAND_C5RNMUIMM24
:
599 FLD (f_c5_rnm
) = ((unsigned int) (FLD (f_c5_rnmuimm24
)) >> (16));
600 FLD (f_c5_16u16
) = ((FLD (f_c5_rnmuimm24
)) & (65535));
602 errmsg
= insert_normal (cd
, fields
->f_c5_rnm
, 0, 0, 4, 8, 32, total_length
, buffer
);
605 errmsg
= insert_normal (cd
, fields
->f_c5_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
610 case MEP_OPERAND_CALLNUM
:
613 FLD (f_5
) = ((((unsigned int) (FLD (f_callnum
)) >> (3))) & (1));
614 FLD (f_6
) = ((((unsigned int) (FLD (f_callnum
)) >> (2))) & (1));
615 FLD (f_7
) = ((((unsigned int) (FLD (f_callnum
)) >> (1))) & (1));
616 FLD (f_11
) = ((FLD (f_callnum
)) & (1));
618 errmsg
= insert_normal (cd
, fields
->f_5
, 0, 0, 5, 1, 32, total_length
, buffer
);
621 errmsg
= insert_normal (cd
, fields
->f_6
, 0, 0, 6, 1, 32, total_length
, buffer
);
624 errmsg
= insert_normal (cd
, fields
->f_7
, 0, 0, 7, 1, 32, total_length
, buffer
);
627 errmsg
= insert_normal (cd
, fields
->f_11
, 0, 0, 11, 1, 32, total_length
, buffer
);
632 case MEP_OPERAND_CCCC
:
633 errmsg
= insert_normal (cd
, fields
->f_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
635 case MEP_OPERAND_CCRN
:
638 FLD (f_ccrn_hi
) = ((((unsigned int) (FLD (f_ccrn
)) >> (4))) & (3));
639 FLD (f_ccrn_lo
) = ((FLD (f_ccrn
)) & (15));
641 errmsg
= insert_normal (cd
, fields
->f_ccrn_hi
, 0, 0, 28, 2, 32, total_length
, buffer
);
644 errmsg
= insert_normal (cd
, fields
->f_ccrn_lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
649 case MEP_OPERAND_CDISP10
:
651 long value
= fields
->f_cdisp10
;
652 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
653 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
656 case MEP_OPERAND_CDISP10A2
:
658 long value
= fields
->f_cdisp10
;
659 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
660 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
663 case MEP_OPERAND_CDISP10A4
:
665 long value
= fields
->f_cdisp10
;
666 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
667 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
670 case MEP_OPERAND_CDISP10A8
:
672 long value
= fields
->f_cdisp10
;
673 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
674 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
677 case MEP_OPERAND_CDISP12
:
678 errmsg
= insert_normal (cd
, fields
->f_12s20
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 12, 32, total_length
, buffer
);
680 case MEP_OPERAND_CIMM4
:
681 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
683 case MEP_OPERAND_CIMM5
:
684 errmsg
= insert_normal (cd
, fields
->f_5u24
, 0, 0, 24, 5, 32, total_length
, buffer
);
686 case MEP_OPERAND_CODE16
:
687 errmsg
= insert_normal (cd
, fields
->f_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
689 case MEP_OPERAND_CODE24
:
692 FLD (f_24u4n_hi
) = ((unsigned int) (FLD (f_24u4n
)) >> (16));
693 FLD (f_24u4n_lo
) = ((FLD (f_24u4n
)) & (65535));
695 errmsg
= insert_normal (cd
, fields
->f_24u4n_hi
, 0, 0, 4, 8, 32, total_length
, buffer
);
698 errmsg
= insert_normal (cd
, fields
->f_24u4n_lo
, 0, 0, 16, 16, 32, total_length
, buffer
);
703 case MEP_OPERAND_CP_FLAG
:
705 case MEP_OPERAND_CRN
:
706 errmsg
= insert_normal (cd
, fields
->f_crn
, 0, 0, 4, 4, 32, total_length
, buffer
);
708 case MEP_OPERAND_CRN64
:
709 errmsg
= insert_normal (cd
, fields
->f_crn
, 0, 0, 4, 4, 32, total_length
, buffer
);
711 case MEP_OPERAND_CRNX
:
714 FLD (f_crnx_lo
) = ((FLD (f_crnx
)) & (15));
715 FLD (f_crnx_hi
) = ((unsigned int) (FLD (f_crnx
)) >> (4));
717 errmsg
= insert_normal (cd
, fields
->f_crnx_hi
, 0, 0, 28, 1, 32, total_length
, buffer
);
720 errmsg
= insert_normal (cd
, fields
->f_crnx_lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
725 case MEP_OPERAND_CRNX64
:
728 FLD (f_crnx_lo
) = ((FLD (f_crnx
)) & (15));
729 FLD (f_crnx_hi
) = ((unsigned int) (FLD (f_crnx
)) >> (4));
731 errmsg
= insert_normal (cd
, fields
->f_crnx_hi
, 0, 0, 28, 1, 32, total_length
, buffer
);
734 errmsg
= insert_normal (cd
, fields
->f_crnx_lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
739 case MEP_OPERAND_CROC
:
740 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u7
, 0, 0, 7, 5, 32, total_length
, buffer
);
742 case MEP_OPERAND_CROP
:
743 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u23
, 0, 0, 23, 5, 32, total_length
, buffer
);
745 case MEP_OPERAND_CRPC
:
746 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u26
, 0, 0, 26, 5, 32, total_length
, buffer
);
748 case MEP_OPERAND_CRPP
:
749 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u18
, 0, 0, 18, 5, 32, total_length
, buffer
);
751 case MEP_OPERAND_CRQC
:
752 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u21
, 0, 0, 21, 5, 32, total_length
, buffer
);
754 case MEP_OPERAND_CRQP
:
755 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u13
, 0, 0, 13, 5, 32, total_length
, buffer
);
757 case MEP_OPERAND_CSRN
:
760 FLD (f_csrn_lo
) = ((FLD (f_csrn
)) & (15));
761 FLD (f_csrn_hi
) = ((unsigned int) (FLD (f_csrn
)) >> (4));
763 errmsg
= insert_normal (cd
, fields
->f_csrn_hi
, 0, 0, 15, 1, 32, total_length
, buffer
);
766 errmsg
= insert_normal (cd
, fields
->f_csrn_lo
, 0, 0, 8, 4, 32, total_length
, buffer
);
771 case MEP_OPERAND_CSRN_IDX
:
774 FLD (f_csrn_lo
) = ((FLD (f_csrn
)) & (15));
775 FLD (f_csrn_hi
) = ((unsigned int) (FLD (f_csrn
)) >> (4));
777 errmsg
= insert_normal (cd
, fields
->f_csrn_hi
, 0, 0, 15, 1, 32, total_length
, buffer
);
780 errmsg
= insert_normal (cd
, fields
->f_csrn_lo
, 0, 0, 8, 4, 32, total_length
, buffer
);
785 case MEP_OPERAND_DBG
:
787 case MEP_OPERAND_DEPC
:
789 case MEP_OPERAND_EPC
:
791 case MEP_OPERAND_EXC
:
793 case MEP_OPERAND_HI
:
795 case MEP_OPERAND_IMM16P0
:
798 FLD (f_ivc2_8u0
) = ((((unsigned int) (FLD (f_ivc2_imm16p0
)) >> (8))) & (255));
799 FLD (f_ivc2_8u20
) = ((FLD (f_ivc2_imm16p0
)) & (255));
801 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u0
, 0, 0, 0, 8, 32, total_length
, buffer
);
804 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u20
, 0, 0, 20, 8, 32, total_length
, buffer
);
809 case MEP_OPERAND_IMM3P12
:
810 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u12
, 0, 0, 12, 3, 32, total_length
, buffer
);
812 case MEP_OPERAND_IMM3P25
:
813 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u25
, 0, 0, 25, 3, 32, total_length
, buffer
);
815 case MEP_OPERAND_IMM3P4
:
816 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u4
, 0, 0, 4, 3, 32, total_length
, buffer
);
818 case MEP_OPERAND_IMM3P5
:
819 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u5
, 0, 0, 5, 3, 32, total_length
, buffer
);
821 case MEP_OPERAND_IMM3P9
:
822 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u9
, 0, 0, 9, 3, 32, total_length
, buffer
);
824 case MEP_OPERAND_IMM4P10
:
825 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u10
, 0, 0, 10, 4, 32, total_length
, buffer
);
827 case MEP_OPERAND_IMM4P4
:
828 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u4
, 0, 0, 4, 4, 32, total_length
, buffer
);
830 case MEP_OPERAND_IMM4P8
:
831 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u8
, 0, 0, 8, 4, 32, total_length
, buffer
);
833 case MEP_OPERAND_IMM5P23
:
834 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u23
, 0, 0, 23, 5, 32, total_length
, buffer
);
836 case MEP_OPERAND_IMM5P3
:
837 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u3
, 0, 0, 3, 5, 32, total_length
, buffer
);
839 case MEP_OPERAND_IMM5P7
:
840 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u7
, 0, 0, 7, 5, 32, total_length
, buffer
);
842 case MEP_OPERAND_IMM5P8
:
843 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u8
, 0, 0, 8, 5, 32, total_length
, buffer
);
845 case MEP_OPERAND_IMM6P2
:
846 errmsg
= insert_normal (cd
, fields
->f_ivc2_6u2
, 0, 0, 2, 6, 32, total_length
, buffer
);
848 case MEP_OPERAND_IMM6P6
:
849 errmsg
= insert_normal (cd
, fields
->f_ivc2_6u6
, 0, 0, 6, 6, 32, total_length
, buffer
);
851 case MEP_OPERAND_IMM8P0
:
852 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u0
, 0, 0, 0, 8, 32, total_length
, buffer
);
854 case MEP_OPERAND_IMM8P20
:
855 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u20
, 0, 0, 20, 8, 32, total_length
, buffer
);
857 case MEP_OPERAND_IMM8P4
:
858 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u4
, 0, 0, 4, 8, 32, total_length
, buffer
);
860 case MEP_OPERAND_IVC_X_0_2
:
861 errmsg
= insert_normal (cd
, fields
->f_ivc2_2u0
, 0, 0, 0, 2, 32, total_length
, buffer
);
863 case MEP_OPERAND_IVC_X_0_3
:
864 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u0
, 0, 0, 0, 3, 32, total_length
, buffer
);
866 case MEP_OPERAND_IVC_X_0_4
:
867 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u0
, 0, 0, 0, 4, 32, total_length
, buffer
);
869 case MEP_OPERAND_IVC_X_0_5
:
870 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u0
, 0, 0, 0, 5, 32, total_length
, buffer
);
872 case MEP_OPERAND_IVC_X_6_1
:
873 errmsg
= insert_normal (cd
, fields
->f_ivc2_1u6
, 0, 0, 6, 1, 32, total_length
, buffer
);
875 case MEP_OPERAND_IVC_X_6_2
:
876 errmsg
= insert_normal (cd
, fields
->f_ivc2_2u6
, 0, 0, 6, 2, 32, total_length
, buffer
);
878 case MEP_OPERAND_IVC_X_6_3
:
879 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u6
, 0, 0, 6, 3, 32, total_length
, buffer
);
881 case MEP_OPERAND_IVC2C3CCRN
:
884 FLD (f_ivc2_ccrn_c3hi
) = ((((unsigned int) (FLD (f_ivc2_ccrn_c3
)) >> (4))) & (3));
885 FLD (f_ivc2_ccrn_c3lo
) = ((FLD (f_ivc2_ccrn_c3
)) & (15));
887 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_c3hi
, 0, 0, 28, 2, 32, total_length
, buffer
);
890 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_c3lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
895 case MEP_OPERAND_IVC2CCRN
:
898 FLD (f_ivc2_ccrn_h2
) = ((((unsigned int) (FLD (f_ivc2_ccrn
)) >> (4))) & (3));
899 FLD (f_ivc2_ccrn_lo
) = ((FLD (f_ivc2_ccrn
)) & (15));
901 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_h2
, 0, 0, 20, 2, 32, total_length
, buffer
);
904 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_lo
, 0, 0, 0, 4, 32, total_length
, buffer
);
909 case MEP_OPERAND_IVC2CRN
:
912 FLD (f_ivc2_ccrn_h1
) = ((((unsigned int) (FLD (f_ivc2_crnx
)) >> (4))) & (1));
913 FLD (f_ivc2_ccrn_lo
) = ((FLD (f_ivc2_crnx
)) & (15));
915 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_h1
, 0, 0, 20, 1, 32, total_length
, buffer
);
918 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_lo
, 0, 0, 0, 4, 32, total_length
, buffer
);
923 case MEP_OPERAND_IVC2RM
:
924 errmsg
= insert_normal (cd
, fields
->f_ivc2_crm
, 0, 0, 4, 4, 32, total_length
, buffer
);
926 case MEP_OPERAND_LO
:
928 case MEP_OPERAND_LP
:
930 case MEP_OPERAND_MB0
:
932 case MEP_OPERAND_MB1
:
934 case MEP_OPERAND_ME0
:
936 case MEP_OPERAND_ME1
:
938 case MEP_OPERAND_NPC
:
940 case MEP_OPERAND_OPT
:
942 case MEP_OPERAND_PCABS24A2
:
945 FLD (f_24u5a2n_lo
) = ((unsigned int) (((FLD (f_24u5a2n
)) & (255))) >> (1));
946 FLD (f_24u5a2n_hi
) = ((unsigned int) (FLD (f_24u5a2n
)) >> (8));
948 errmsg
= insert_normal (cd
, fields
->f_24u5a2n_hi
, 0, 0, 16, 16, 32, total_length
, buffer
);
951 errmsg
= insert_normal (cd
, fields
->f_24u5a2n_lo
, 0, 0, 5, 7, 32, total_length
, buffer
);
956 case MEP_OPERAND_PCREL12A2
:
958 long value
= fields
->f_12s4a2
;
959 value
= ((int) (((value
) - (pc
))) >> (1));
960 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 4, 11, 32, total_length
, buffer
);
963 case MEP_OPERAND_PCREL17A2
:
965 long value
= fields
->f_17s16a2
;
966 value
= ((int) (((value
) - (pc
))) >> (1));
967 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 16, 16, 32, total_length
, buffer
);
970 case MEP_OPERAND_PCREL24A2
:
973 FLD (f_24s5a2n
) = ((FLD (f_24s5a2n
)) - (pc
));
974 FLD (f_24s5a2n_lo
) = ((unsigned int) (((FLD (f_24s5a2n
)) & (254))) >> (1));
975 FLD (f_24s5a2n_hi
) = ((int) (FLD (f_24s5a2n
)) >> (8));
977 errmsg
= insert_normal (cd
, fields
->f_24s5a2n_hi
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 16, 16, 32, total_length
, buffer
);
980 errmsg
= insert_normal (cd
, fields
->f_24s5a2n_lo
, 0|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 5, 7, 32, total_length
, buffer
);
985 case MEP_OPERAND_PCREL8A2
:
987 long value
= fields
->f_8s8a2
;
988 value
= ((int) (((value
) - (pc
))) >> (1));
989 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 8, 7, 32, total_length
, buffer
);
992 case MEP_OPERAND_PSW
:
994 case MEP_OPERAND_R0
:
996 case MEP_OPERAND_R1
:
998 case MEP_OPERAND_RL
:
999 errmsg
= insert_normal (cd
, fields
->f_rl
, 0, 0, 12, 4, 32, total_length
, buffer
);
1001 case MEP_OPERAND_RL5
:
1002 errmsg
= insert_normal (cd
, fields
->f_rl5
, 0, 0, 20, 4, 32, total_length
, buffer
);
1004 case MEP_OPERAND_RM
:
1005 errmsg
= insert_normal (cd
, fields
->f_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
1007 case MEP_OPERAND_RMA
:
1008 errmsg
= insert_normal (cd
, fields
->f_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
1010 case MEP_OPERAND_RN
:
1011 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1013 case MEP_OPERAND_RN3
:
1014 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1016 case MEP_OPERAND_RN3C
:
1017 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1019 case MEP_OPERAND_RN3L
:
1020 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1022 case MEP_OPERAND_RN3S
:
1023 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1025 case MEP_OPERAND_RN3UC
:
1026 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1028 case MEP_OPERAND_RN3UL
:
1029 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1031 case MEP_OPERAND_RN3US
:
1032 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1034 case MEP_OPERAND_RNC
:
1035 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1037 case MEP_OPERAND_RNL
:
1038 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1040 case MEP_OPERAND_RNS
:
1041 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1043 case MEP_OPERAND_RNUC
:
1044 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1046 case MEP_OPERAND_RNUL
:
1047 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1049 case MEP_OPERAND_RNUS
:
1050 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1052 case MEP_OPERAND_SAR
:
1054 case MEP_OPERAND_SDISP16
:
1055 errmsg
= insert_normal (cd
, fields
->f_16s16
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, buffer
);
1057 case MEP_OPERAND_SIMM16
:
1058 errmsg
= insert_normal (cd
, fields
->f_16s16
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, buffer
);
1060 case MEP_OPERAND_SIMM16P0
:
1063 FLD (f_ivc2_8u0
) = ((((unsigned int) (FLD (f_ivc2_simm16p0
)) >> (8))) & (255));
1064 FLD (f_ivc2_8u20
) = ((FLD (f_ivc2_simm16p0
)) & (255));
1066 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u0
, 0, 0, 0, 8, 32, total_length
, buffer
);
1069 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u20
, 0, 0, 20, 8, 32, total_length
, buffer
);
1074 case MEP_OPERAND_SIMM6
:
1075 errmsg
= insert_normal (cd
, fields
->f_6s8
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 6, 32, total_length
, buffer
);
1077 case MEP_OPERAND_SIMM8
:
1078 errmsg
= insert_normal (cd
, fields
->f_8s8
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 8, 32, total_length
, buffer
);
1080 case MEP_OPERAND_SIMM8P0
:
1081 errmsg
= insert_normal (cd
, fields
->f_ivc2_8s0
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 0, 8, 32, total_length
, buffer
);
1083 case MEP_OPERAND_SIMM8P20
:
1084 errmsg
= insert_normal (cd
, fields
->f_ivc2_8s20
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 8, 32, total_length
, buffer
);
1086 case MEP_OPERAND_SIMM8P4
:
1087 errmsg
= insert_normal (cd
, fields
->f_ivc2_8s4
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 4, 8, 32, total_length
, buffer
);
1089 case MEP_OPERAND_SP
:
1091 case MEP_OPERAND_SPR
:
1093 case MEP_OPERAND_TP
:
1095 case MEP_OPERAND_TPR
:
1097 case MEP_OPERAND_UDISP2
:
1098 errmsg
= insert_normal (cd
, fields
->f_2u6
, 0, 0, 6, 2, 32, total_length
, buffer
);
1100 case MEP_OPERAND_UDISP7
:
1101 errmsg
= insert_normal (cd
, fields
->f_7u9
, 0, 0, 9, 7, 32, total_length
, buffer
);
1103 case MEP_OPERAND_UDISP7A2
:
1105 long value
= fields
->f_7u9a2
;
1106 value
= ((unsigned int) (value
) >> (1));
1107 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 6, 32, total_length
, buffer
);
1110 case MEP_OPERAND_UDISP7A4
:
1112 long value
= fields
->f_7u9a4
;
1113 value
= ((unsigned int) (value
) >> (2));
1114 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 5, 32, total_length
, buffer
);
1117 case MEP_OPERAND_UIMM16
:
1118 errmsg
= insert_normal (cd
, fields
->f_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
1120 case MEP_OPERAND_UIMM2
:
1121 errmsg
= insert_normal (cd
, fields
->f_2u10
, 0, 0, 10, 2, 32, total_length
, buffer
);
1123 case MEP_OPERAND_UIMM24
:
1126 FLD (f_24u8n_hi
) = ((unsigned int) (FLD (f_24u8n
)) >> (8));
1127 FLD (f_24u8n_lo
) = ((FLD (f_24u8n
)) & (255));
1129 errmsg
= insert_normal (cd
, fields
->f_24u8n_hi
, 0, 0, 16, 16, 32, total_length
, buffer
);
1132 errmsg
= insert_normal (cd
, fields
->f_24u8n_lo
, 0, 0, 8, 8, 32, total_length
, buffer
);
1137 case MEP_OPERAND_UIMM3
:
1138 errmsg
= insert_normal (cd
, fields
->f_3u5
, 0, 0, 5, 3, 32, total_length
, buffer
);
1140 case MEP_OPERAND_UIMM4
:
1141 errmsg
= insert_normal (cd
, fields
->f_4u8
, 0, 0, 8, 4, 32, total_length
, buffer
);
1143 case MEP_OPERAND_UIMM5
:
1144 errmsg
= insert_normal (cd
, fields
->f_5u8
, 0, 0, 8, 5, 32, total_length
, buffer
);
1146 case MEP_OPERAND_UIMM7A4
:
1148 long value
= fields
->f_7u9a4
;
1149 value
= ((unsigned int) (value
) >> (2));
1150 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 5, 32, total_length
, buffer
);
1153 case MEP_OPERAND_ZERO
:
1157 /* xgettext:c-format */
1158 fprintf (stderr
, _("Unrecognized field %d while building insn.\n"),
1166 int mep_cgen_extract_operand
1167 (CGEN_CPU_DESC
, int, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
1169 /* Main entry point for operand extraction.
1170 The result is <= 0 for error, >0 for success.
1171 ??? Actual values aren't well defined right now.
1173 This function is basically just a big switch statement. Earlier versions
1174 used tables to look up the function to use, but
1175 - if the table contains both assembler and disassembler functions then
1176 the disassembler contains much of the assembler and vice-versa,
1177 - there's a lot of inlining possibilities as things grow,
1178 - using a switch statement avoids the function call overhead.
1180 This function could be moved into `print_insn_normal', but keeping it
1181 separate makes clear the interface between `print_insn_normal' and each of
1185 mep_cgen_extract_operand (CGEN_CPU_DESC cd
,
1187 CGEN_EXTRACT_INFO
*ex_info
,
1188 CGEN_INSN_INT insn_value
,
1189 CGEN_FIELDS
* fields
,
1192 /* Assume success (for those operands that are nops). */
1194 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
1198 case MEP_OPERAND_ADDR24A4
:
1200 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u8a4n_hi
);
1201 if (length
<= 0) break;
1202 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 6, 32, total_length
, pc
, & fields
->f_24u8a4n_lo
);
1203 if (length
<= 0) break;
1204 FLD (f_24u8a4n
) = ((((FLD (f_24u8a4n_hi
)) << (8))) | (((FLD (f_24u8a4n_lo
)) << (2))));
1207 case MEP_OPERAND_C5RMUIMM20
:
1209 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_c5_rm
);
1210 if (length
<= 0) break;
1211 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_c5_16u16
);
1212 if (length
<= 0) break;
1214 FLD (f_c5_rmuimm20
) = ((FLD (f_c5_16u16
)) | (((FLD (f_c5_rm
)) << (16))));
1218 case MEP_OPERAND_C5RNMUIMM24
:
1220 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_c5_rnm
);
1221 if (length
<= 0) break;
1222 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_c5_16u16
);
1223 if (length
<= 0) break;
1225 FLD (f_c5_rnmuimm24
) = ((FLD (f_c5_16u16
)) | (((FLD (f_c5_rnm
)) << (16))));
1229 case MEP_OPERAND_CALLNUM
:
1231 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 1, 32, total_length
, pc
, & fields
->f_5
);
1232 if (length
<= 0) break;
1233 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 1, 32, total_length
, pc
, & fields
->f_6
);
1234 if (length
<= 0) break;
1235 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 1, 32, total_length
, pc
, & fields
->f_7
);
1236 if (length
<= 0) break;
1237 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 1, 32, total_length
, pc
, & fields
->f_11
);
1238 if (length
<= 0) break;
1239 FLD (f_callnum
) = ((((FLD (f_5
)) << (3))) | (((((FLD (f_6
)) << (2))) | (((((FLD (f_7
)) << (1))) | (FLD (f_11
)))))));
1242 case MEP_OPERAND_CCCC
:
1243 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1245 case MEP_OPERAND_CCRN
:
1247 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 2, 32, total_length
, pc
, & fields
->f_ccrn_hi
);
1248 if (length
<= 0) break;
1249 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ccrn_lo
);
1250 if (length
<= 0) break;
1251 FLD (f_ccrn
) = ((((FLD (f_ccrn_hi
)) << (4))) | (FLD (f_ccrn_lo
)));
1254 case MEP_OPERAND_CDISP10
:
1257 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1258 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
1259 fields
->f_cdisp10
= value
;
1262 case MEP_OPERAND_CDISP10A2
:
1265 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1266 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
1267 fields
->f_cdisp10
= value
;
1270 case MEP_OPERAND_CDISP10A4
:
1273 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1274 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
1275 fields
->f_cdisp10
= value
;
1278 case MEP_OPERAND_CDISP10A8
:
1281 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1282 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
1283 fields
->f_cdisp10
= value
;
1286 case MEP_OPERAND_CDISP12
:
1287 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 12, 32, total_length
, pc
, & fields
->f_12s20
);
1289 case MEP_OPERAND_CIMM4
:
1290 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1292 case MEP_OPERAND_CIMM5
:
1293 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 24, 5, 32, total_length
, pc
, & fields
->f_5u24
);
1295 case MEP_OPERAND_CODE16
:
1296 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_16u16
);
1298 case MEP_OPERAND_CODE24
:
1300 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_24u4n_hi
);
1301 if (length
<= 0) break;
1302 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u4n_lo
);
1303 if (length
<= 0) break;
1304 FLD (f_24u4n
) = ((((FLD (f_24u4n_hi
)) << (16))) | (FLD (f_24u4n_lo
)));
1307 case MEP_OPERAND_CP_FLAG
:
1309 case MEP_OPERAND_CRN
:
1310 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crn
);
1312 case MEP_OPERAND_CRN64
:
1313 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crn
);
1315 case MEP_OPERAND_CRNX
:
1317 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 1, 32, total_length
, pc
, & fields
->f_crnx_hi
);
1318 if (length
<= 0) break;
1319 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crnx_lo
);
1320 if (length
<= 0) break;
1321 FLD (f_crnx
) = ((((FLD (f_crnx_hi
)) << (4))) | (FLD (f_crnx_lo
)));
1324 case MEP_OPERAND_CRNX64
:
1326 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 1, 32, total_length
, pc
, & fields
->f_crnx_hi
);
1327 if (length
<= 0) break;
1328 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crnx_lo
);
1329 if (length
<= 0) break;
1330 FLD (f_crnx
) = ((((FLD (f_crnx_hi
)) << (4))) | (FLD (f_crnx_lo
)));
1333 case MEP_OPERAND_CROC
:
1334 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u7
);
1336 case MEP_OPERAND_CROP
:
1337 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 23, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u23
);
1339 case MEP_OPERAND_CRPC
:
1340 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u26
);
1342 case MEP_OPERAND_CRPP
:
1343 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 18, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u18
);
1345 case MEP_OPERAND_CRQC
:
1346 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 21, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u21
);
1348 case MEP_OPERAND_CRQP
:
1349 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 13, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u13
);
1351 case MEP_OPERAND_CSRN
:
1353 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 1, 32, total_length
, pc
, & fields
->f_csrn_hi
);
1354 if (length
<= 0) break;
1355 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_csrn_lo
);
1356 if (length
<= 0) break;
1357 FLD (f_csrn
) = ((((FLD (f_csrn_hi
)) << (4))) | (FLD (f_csrn_lo
)));
1360 case MEP_OPERAND_CSRN_IDX
:
1362 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 1, 32, total_length
, pc
, & fields
->f_csrn_hi
);
1363 if (length
<= 0) break;
1364 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_csrn_lo
);
1365 if (length
<= 0) break;
1366 FLD (f_csrn
) = ((((FLD (f_csrn_hi
)) << (4))) | (FLD (f_csrn_lo
)));
1369 case MEP_OPERAND_DBG
:
1371 case MEP_OPERAND_DEPC
:
1373 case MEP_OPERAND_EPC
:
1375 case MEP_OPERAND_EXC
:
1377 case MEP_OPERAND_HI
:
1379 case MEP_OPERAND_IMM16P0
:
1381 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1382 if (length
<= 0) break;
1383 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1384 if (length
<= 0) break;
1386 FLD (f_ivc2_imm16p0
) = ((FLD (f_ivc2_8u20
)) | (((FLD (f_ivc2_8u0
)) << (8))));
1390 case MEP_OPERAND_IMM3P12
:
1391 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 12, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u12
);
1393 case MEP_OPERAND_IMM3P25
:
1394 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u25
);
1396 case MEP_OPERAND_IMM3P4
:
1397 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u4
);
1399 case MEP_OPERAND_IMM3P5
:
1400 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u5
);
1402 case MEP_OPERAND_IMM3P9
:
1403 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u9
);
1405 case MEP_OPERAND_IMM4P10
:
1406 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 10, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u10
);
1408 case MEP_OPERAND_IMM4P4
:
1409 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u4
);
1411 case MEP_OPERAND_IMM4P8
:
1412 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u8
);
1414 case MEP_OPERAND_IMM5P23
:
1415 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 23, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u23
);
1417 case MEP_OPERAND_IMM5P3
:
1418 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 3, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u3
);
1420 case MEP_OPERAND_IMM5P7
:
1421 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u7
);
1423 case MEP_OPERAND_IMM5P8
:
1424 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u8
);
1426 case MEP_OPERAND_IMM6P2
:
1427 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 2, 6, 32, total_length
, pc
, & fields
->f_ivc2_6u2
);
1429 case MEP_OPERAND_IMM6P6
:
1430 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 6, 32, total_length
, pc
, & fields
->f_ivc2_6u6
);
1432 case MEP_OPERAND_IMM8P0
:
1433 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1435 case MEP_OPERAND_IMM8P20
:
1436 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1438 case MEP_OPERAND_IMM8P4
:
1439 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u4
);
1441 case MEP_OPERAND_IVC_X_0_2
:
1442 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 2, 32, total_length
, pc
, & fields
->f_ivc2_2u0
);
1444 case MEP_OPERAND_IVC_X_0_3
:
1445 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u0
);
1447 case MEP_OPERAND_IVC_X_0_4
:
1448 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u0
);
1450 case MEP_OPERAND_IVC_X_0_5
:
1451 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u0
);
1453 case MEP_OPERAND_IVC_X_6_1
:
1454 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 1, 32, total_length
, pc
, & fields
->f_ivc2_1u6
);
1456 case MEP_OPERAND_IVC_X_6_2
:
1457 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 2, 32, total_length
, pc
, & fields
->f_ivc2_2u6
);
1459 case MEP_OPERAND_IVC_X_6_3
:
1460 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u6
);
1462 case MEP_OPERAND_IVC2C3CCRN
:
1464 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 2, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_c3hi
);
1465 if (length
<= 0) break;
1466 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_c3lo
);
1467 if (length
<= 0) break;
1468 FLD (f_ivc2_ccrn_c3
) = ((((FLD (f_ivc2_ccrn_c3hi
)) << (4))) | (FLD (f_ivc2_ccrn_c3lo
)));
1471 case MEP_OPERAND_IVC2CCRN
:
1473 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 2, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_h2
);
1474 if (length
<= 0) break;
1475 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_lo
);
1476 if (length
<= 0) break;
1477 FLD (f_ivc2_ccrn
) = ((((FLD (f_ivc2_ccrn_h2
)) << (4))) | (FLD (f_ivc2_ccrn_lo
)));
1480 case MEP_OPERAND_IVC2CRN
:
1482 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 1, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_h1
);
1483 if (length
<= 0) break;
1484 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_lo
);
1485 if (length
<= 0) break;
1486 FLD (f_ivc2_crnx
) = ((((FLD (f_ivc2_ccrn_h1
)) << (4))) | (FLD (f_ivc2_ccrn_lo
)));
1489 case MEP_OPERAND_IVC2RM
:
1490 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ivc2_crm
);
1492 case MEP_OPERAND_LO
:
1494 case MEP_OPERAND_LP
:
1496 case MEP_OPERAND_MB0
:
1498 case MEP_OPERAND_MB1
:
1500 case MEP_OPERAND_ME0
:
1502 case MEP_OPERAND_ME1
:
1504 case MEP_OPERAND_NPC
:
1506 case MEP_OPERAND_OPT
:
1508 case MEP_OPERAND_PCABS24A2
:
1510 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u5a2n_hi
);
1511 if (length
<= 0) break;
1512 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 7, 32, total_length
, pc
, & fields
->f_24u5a2n_lo
);
1513 if (length
<= 0) break;
1514 FLD (f_24u5a2n
) = ((((FLD (f_24u5a2n_hi
)) << (8))) | (((FLD (f_24u5a2n_lo
)) << (1))));
1517 case MEP_OPERAND_PCREL12A2
:
1520 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 4, 11, 32, total_length
, pc
, & value
);
1521 value
= ((((value
) << (1))) + (pc
));
1522 fields
->f_12s4a2
= value
;
1525 case MEP_OPERAND_PCREL17A2
:
1528 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 16, 16, 32, total_length
, pc
, & value
);
1529 value
= ((((value
) << (1))) + (pc
));
1530 fields
->f_17s16a2
= value
;
1533 case MEP_OPERAND_PCREL24A2
:
1535 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 16, 16, 32, total_length
, pc
, & fields
->f_24s5a2n_hi
);
1536 if (length
<= 0) break;
1537 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 5, 7, 32, total_length
, pc
, & fields
->f_24s5a2n_lo
);
1538 if (length
<= 0) break;
1539 FLD (f_24s5a2n
) = ((((((FLD (f_24s5a2n_hi
)) << (8))) | (((FLD (f_24s5a2n_lo
)) << (1))))) + (pc
));
1542 case MEP_OPERAND_PCREL8A2
:
1545 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 8, 7, 32, total_length
, pc
, & value
);
1546 value
= ((((value
) << (1))) + (pc
));
1547 fields
->f_8s8a2
= value
;
1550 case MEP_OPERAND_PSW
:
1552 case MEP_OPERAND_R0
:
1554 case MEP_OPERAND_R1
:
1556 case MEP_OPERAND_RL
:
1557 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 12, 4, 32, total_length
, pc
, & fields
->f_rl
);
1559 case MEP_OPERAND_RL5
:
1560 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 4, 32, total_length
, pc
, & fields
->f_rl5
);
1562 case MEP_OPERAND_RM
:
1563 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1565 case MEP_OPERAND_RMA
:
1566 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1568 case MEP_OPERAND_RN
:
1569 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1571 case MEP_OPERAND_RN3
:
1572 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1574 case MEP_OPERAND_RN3C
:
1575 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1577 case MEP_OPERAND_RN3L
:
1578 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1580 case MEP_OPERAND_RN3S
:
1581 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1583 case MEP_OPERAND_RN3UC
:
1584 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1586 case MEP_OPERAND_RN3UL
:
1587 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1589 case MEP_OPERAND_RN3US
:
1590 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1592 case MEP_OPERAND_RNC
:
1593 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1595 case MEP_OPERAND_RNL
:
1596 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1598 case MEP_OPERAND_RNS
:
1599 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1601 case MEP_OPERAND_RNUC
:
1602 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1604 case MEP_OPERAND_RNUL
:
1605 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1607 case MEP_OPERAND_RNUS
:
1608 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1610 case MEP_OPERAND_SAR
:
1612 case MEP_OPERAND_SDISP16
:
1613 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, pc
, & fields
->f_16s16
);
1615 case MEP_OPERAND_SIMM16
:
1616 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, pc
, & fields
->f_16s16
);
1618 case MEP_OPERAND_SIMM16P0
:
1620 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1621 if (length
<= 0) break;
1622 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1623 if (length
<= 0) break;
1625 FLD (f_ivc2_simm16p0
) = ((FLD (f_ivc2_8u20
)) | (((FLD (f_ivc2_8u0
)) << (8))));
1629 case MEP_OPERAND_SIMM6
:
1630 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 6, 32, total_length
, pc
, & fields
->f_6s8
);
1632 case MEP_OPERAND_SIMM8
:
1633 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 8, 32, total_length
, pc
, & fields
->f_8s8
);
1635 case MEP_OPERAND_SIMM8P0
:
1636 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8s0
);
1638 case MEP_OPERAND_SIMM8P20
:
1639 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8s20
);
1641 case MEP_OPERAND_SIMM8P4
:
1642 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 4, 8, 32, total_length
, pc
, & fields
->f_ivc2_8s4
);
1644 case MEP_OPERAND_SP
:
1646 case MEP_OPERAND_SPR
:
1648 case MEP_OPERAND_TP
:
1650 case MEP_OPERAND_TPR
:
1652 case MEP_OPERAND_UDISP2
:
1653 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 2, 32, total_length
, pc
, & fields
->f_2u6
);
1655 case MEP_OPERAND_UDISP7
:
1656 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 7, 32, total_length
, pc
, & fields
->f_7u9
);
1658 case MEP_OPERAND_UDISP7A2
:
1661 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 6, 32, total_length
, pc
, & value
);
1662 value
= ((value
) << (1));
1663 fields
->f_7u9a2
= value
;
1666 case MEP_OPERAND_UDISP7A4
:
1669 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 5, 32, total_length
, pc
, & value
);
1670 value
= ((value
) << (2));
1671 fields
->f_7u9a4
= value
;
1674 case MEP_OPERAND_UIMM16
:
1675 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_16u16
);
1677 case MEP_OPERAND_UIMM2
:
1678 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 10, 2, 32, total_length
, pc
, & fields
->f_2u10
);
1680 case MEP_OPERAND_UIMM24
:
1682 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u8n_hi
);
1683 if (length
<= 0) break;
1684 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 8, 32, total_length
, pc
, & fields
->f_24u8n_lo
);
1685 if (length
<= 0) break;
1686 FLD (f_24u8n
) = ((((FLD (f_24u8n_hi
)) << (8))) | (FLD (f_24u8n_lo
)));
1689 case MEP_OPERAND_UIMM3
:
1690 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_3u5
);
1692 case MEP_OPERAND_UIMM4
:
1693 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_4u8
);
1695 case MEP_OPERAND_UIMM5
:
1696 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 5, 32, total_length
, pc
, & fields
->f_5u8
);
1698 case MEP_OPERAND_UIMM7A4
:
1701 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 5, 32, total_length
, pc
, & value
);
1702 value
= ((value
) << (2));
1703 fields
->f_7u9a4
= value
;
1706 case MEP_OPERAND_ZERO
:
1710 /* xgettext:c-format */
1711 fprintf (stderr
, _("Unrecognized field %d while decoding insn.\n"),
1719 cgen_insert_fn
* const mep_cgen_insert_handlers
[] =
1724 cgen_extract_fn
* const mep_cgen_extract_handlers
[] =
1726 extract_insn_normal
,
1729 int mep_cgen_get_int_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1730 bfd_vma
mep_cgen_get_vma_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1732 /* Getting values from cgen_fields is handled by a collection of functions.
1733 They are distinguished by the type of the VALUE argument they return.
1734 TODO: floating point, inlining support, remove cases where result type
1738 mep_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1740 const CGEN_FIELDS
* fields
)
1746 case MEP_OPERAND_ADDR24A4
:
1747 value
= fields
->f_24u8a4n
;
1749 case MEP_OPERAND_C5RMUIMM20
:
1750 value
= fields
->f_c5_rmuimm20
;
1752 case MEP_OPERAND_C5RNMUIMM24
:
1753 value
= fields
->f_c5_rnmuimm24
;
1755 case MEP_OPERAND_CALLNUM
:
1756 value
= fields
->f_callnum
;
1758 case MEP_OPERAND_CCCC
:
1759 value
= fields
->f_rm
;
1761 case MEP_OPERAND_CCRN
:
1762 value
= fields
->f_ccrn
;
1764 case MEP_OPERAND_CDISP10
:
1765 value
= fields
->f_cdisp10
;
1767 case MEP_OPERAND_CDISP10A2
:
1768 value
= fields
->f_cdisp10
;
1770 case MEP_OPERAND_CDISP10A4
:
1771 value
= fields
->f_cdisp10
;
1773 case MEP_OPERAND_CDISP10A8
:
1774 value
= fields
->f_cdisp10
;
1776 case MEP_OPERAND_CDISP12
:
1777 value
= fields
->f_12s20
;
1779 case MEP_OPERAND_CIMM4
:
1780 value
= fields
->f_rn
;
1782 case MEP_OPERAND_CIMM5
:
1783 value
= fields
->f_5u24
;
1785 case MEP_OPERAND_CODE16
:
1786 value
= fields
->f_16u16
;
1788 case MEP_OPERAND_CODE24
:
1789 value
= fields
->f_24u4n
;
1791 case MEP_OPERAND_CP_FLAG
:
1794 case MEP_OPERAND_CRN
:
1795 value
= fields
->f_crn
;
1797 case MEP_OPERAND_CRN64
:
1798 value
= fields
->f_crn
;
1800 case MEP_OPERAND_CRNX
:
1801 value
= fields
->f_crnx
;
1803 case MEP_OPERAND_CRNX64
:
1804 value
= fields
->f_crnx
;
1806 case MEP_OPERAND_CROC
:
1807 value
= fields
->f_ivc2_5u7
;
1809 case MEP_OPERAND_CROP
:
1810 value
= fields
->f_ivc2_5u23
;
1812 case MEP_OPERAND_CRPC
:
1813 value
= fields
->f_ivc2_5u26
;
1815 case MEP_OPERAND_CRPP
:
1816 value
= fields
->f_ivc2_5u18
;
1818 case MEP_OPERAND_CRQC
:
1819 value
= fields
->f_ivc2_5u21
;
1821 case MEP_OPERAND_CRQP
:
1822 value
= fields
->f_ivc2_5u13
;
1824 case MEP_OPERAND_CSRN
:
1825 value
= fields
->f_csrn
;
1827 case MEP_OPERAND_CSRN_IDX
:
1828 value
= fields
->f_csrn
;
1830 case MEP_OPERAND_DBG
:
1833 case MEP_OPERAND_DEPC
:
1836 case MEP_OPERAND_EPC
:
1839 case MEP_OPERAND_EXC
:
1842 case MEP_OPERAND_HI
:
1845 case MEP_OPERAND_IMM16P0
:
1846 value
= fields
->f_ivc2_imm16p0
;
1848 case MEP_OPERAND_IMM3P12
:
1849 value
= fields
->f_ivc2_3u12
;
1851 case MEP_OPERAND_IMM3P25
:
1852 value
= fields
->f_ivc2_3u25
;
1854 case MEP_OPERAND_IMM3P4
:
1855 value
= fields
->f_ivc2_3u4
;
1857 case MEP_OPERAND_IMM3P5
:
1858 value
= fields
->f_ivc2_3u5
;
1860 case MEP_OPERAND_IMM3P9
:
1861 value
= fields
->f_ivc2_3u9
;
1863 case MEP_OPERAND_IMM4P10
:
1864 value
= fields
->f_ivc2_4u10
;
1866 case MEP_OPERAND_IMM4P4
:
1867 value
= fields
->f_ivc2_4u4
;
1869 case MEP_OPERAND_IMM4P8
:
1870 value
= fields
->f_ivc2_4u8
;
1872 case MEP_OPERAND_IMM5P23
:
1873 value
= fields
->f_ivc2_5u23
;
1875 case MEP_OPERAND_IMM5P3
:
1876 value
= fields
->f_ivc2_5u3
;
1878 case MEP_OPERAND_IMM5P7
:
1879 value
= fields
->f_ivc2_5u7
;
1881 case MEP_OPERAND_IMM5P8
:
1882 value
= fields
->f_ivc2_5u8
;
1884 case MEP_OPERAND_IMM6P2
:
1885 value
= fields
->f_ivc2_6u2
;
1887 case MEP_OPERAND_IMM6P6
:
1888 value
= fields
->f_ivc2_6u6
;
1890 case MEP_OPERAND_IMM8P0
:
1891 value
= fields
->f_ivc2_8u0
;
1893 case MEP_OPERAND_IMM8P20
:
1894 value
= fields
->f_ivc2_8u20
;
1896 case MEP_OPERAND_IMM8P4
:
1897 value
= fields
->f_ivc2_8u4
;
1899 case MEP_OPERAND_IVC_X_0_2
:
1900 value
= fields
->f_ivc2_2u0
;
1902 case MEP_OPERAND_IVC_X_0_3
:
1903 value
= fields
->f_ivc2_3u0
;
1905 case MEP_OPERAND_IVC_X_0_4
:
1906 value
= fields
->f_ivc2_4u0
;
1908 case MEP_OPERAND_IVC_X_0_5
:
1909 value
= fields
->f_ivc2_5u0
;
1911 case MEP_OPERAND_IVC_X_6_1
:
1912 value
= fields
->f_ivc2_1u6
;
1914 case MEP_OPERAND_IVC_X_6_2
:
1915 value
= fields
->f_ivc2_2u6
;
1917 case MEP_OPERAND_IVC_X_6_3
:
1918 value
= fields
->f_ivc2_3u6
;
1920 case MEP_OPERAND_IVC2C3CCRN
:
1921 value
= fields
->f_ivc2_ccrn_c3
;
1923 case MEP_OPERAND_IVC2CCRN
:
1924 value
= fields
->f_ivc2_ccrn
;
1926 case MEP_OPERAND_IVC2CRN
:
1927 value
= fields
->f_ivc2_crnx
;
1929 case MEP_OPERAND_IVC2RM
:
1930 value
= fields
->f_ivc2_crm
;
1932 case MEP_OPERAND_LO
:
1935 case MEP_OPERAND_LP
:
1938 case MEP_OPERAND_MB0
:
1941 case MEP_OPERAND_MB1
:
1944 case MEP_OPERAND_ME0
:
1947 case MEP_OPERAND_ME1
:
1950 case MEP_OPERAND_NPC
:
1953 case MEP_OPERAND_OPT
:
1956 case MEP_OPERAND_PCABS24A2
:
1957 value
= fields
->f_24u5a2n
;
1959 case MEP_OPERAND_PCREL12A2
:
1960 value
= fields
->f_12s4a2
;
1962 case MEP_OPERAND_PCREL17A2
:
1963 value
= fields
->f_17s16a2
;
1965 case MEP_OPERAND_PCREL24A2
:
1966 value
= fields
->f_24s5a2n
;
1968 case MEP_OPERAND_PCREL8A2
:
1969 value
= fields
->f_8s8a2
;
1971 case MEP_OPERAND_PSW
:
1974 case MEP_OPERAND_R0
:
1977 case MEP_OPERAND_R1
:
1980 case MEP_OPERAND_RL
:
1981 value
= fields
->f_rl
;
1983 case MEP_OPERAND_RL5
:
1984 value
= fields
->f_rl5
;
1986 case MEP_OPERAND_RM
:
1987 value
= fields
->f_rm
;
1989 case MEP_OPERAND_RMA
:
1990 value
= fields
->f_rm
;
1992 case MEP_OPERAND_RN
:
1993 value
= fields
->f_rn
;
1995 case MEP_OPERAND_RN3
:
1996 value
= fields
->f_rn3
;
1998 case MEP_OPERAND_RN3C
:
1999 value
= fields
->f_rn3
;
2001 case MEP_OPERAND_RN3L
:
2002 value
= fields
->f_rn3
;
2004 case MEP_OPERAND_RN3S
:
2005 value
= fields
->f_rn3
;
2007 case MEP_OPERAND_RN3UC
:
2008 value
= fields
->f_rn3
;
2010 case MEP_OPERAND_RN3UL
:
2011 value
= fields
->f_rn3
;
2013 case MEP_OPERAND_RN3US
:
2014 value
= fields
->f_rn3
;
2016 case MEP_OPERAND_RNC
:
2017 value
= fields
->f_rn
;
2019 case MEP_OPERAND_RNL
:
2020 value
= fields
->f_rn
;
2022 case MEP_OPERAND_RNS
:
2023 value
= fields
->f_rn
;
2025 case MEP_OPERAND_RNUC
:
2026 value
= fields
->f_rn
;
2028 case MEP_OPERAND_RNUL
:
2029 value
= fields
->f_rn
;
2031 case MEP_OPERAND_RNUS
:
2032 value
= fields
->f_rn
;
2034 case MEP_OPERAND_SAR
:
2037 case MEP_OPERAND_SDISP16
:
2038 value
= fields
->f_16s16
;
2040 case MEP_OPERAND_SIMM16
:
2041 value
= fields
->f_16s16
;
2043 case MEP_OPERAND_SIMM16P0
:
2044 value
= fields
->f_ivc2_simm16p0
;
2046 case MEP_OPERAND_SIMM6
:
2047 value
= fields
->f_6s8
;
2049 case MEP_OPERAND_SIMM8
:
2050 value
= fields
->f_8s8
;
2052 case MEP_OPERAND_SIMM8P0
:
2053 value
= fields
->f_ivc2_8s0
;
2055 case MEP_OPERAND_SIMM8P20
:
2056 value
= fields
->f_ivc2_8s20
;
2058 case MEP_OPERAND_SIMM8P4
:
2059 value
= fields
->f_ivc2_8s4
;
2061 case MEP_OPERAND_SP
:
2064 case MEP_OPERAND_SPR
:
2067 case MEP_OPERAND_TP
:
2070 case MEP_OPERAND_TPR
:
2073 case MEP_OPERAND_UDISP2
:
2074 value
= fields
->f_2u6
;
2076 case MEP_OPERAND_UDISP7
:
2077 value
= fields
->f_7u9
;
2079 case MEP_OPERAND_UDISP7A2
:
2080 value
= fields
->f_7u9a2
;
2082 case MEP_OPERAND_UDISP7A4
:
2083 value
= fields
->f_7u9a4
;
2085 case MEP_OPERAND_UIMM16
:
2086 value
= fields
->f_16u16
;
2088 case MEP_OPERAND_UIMM2
:
2089 value
= fields
->f_2u10
;
2091 case MEP_OPERAND_UIMM24
:
2092 value
= fields
->f_24u8n
;
2094 case MEP_OPERAND_UIMM3
:
2095 value
= fields
->f_3u5
;
2097 case MEP_OPERAND_UIMM4
:
2098 value
= fields
->f_4u8
;
2100 case MEP_OPERAND_UIMM5
:
2101 value
= fields
->f_5u8
;
2103 case MEP_OPERAND_UIMM7A4
:
2104 value
= fields
->f_7u9a4
;
2106 case MEP_OPERAND_ZERO
:
2111 /* xgettext:c-format */
2112 fprintf (stderr
, _("Unrecognized field %d while getting int operand.\n"),
2121 mep_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
2123 const CGEN_FIELDS
* fields
)
2129 case MEP_OPERAND_ADDR24A4
:
2130 value
= fields
->f_24u8a4n
;
2132 case MEP_OPERAND_C5RMUIMM20
:
2133 value
= fields
->f_c5_rmuimm20
;
2135 case MEP_OPERAND_C5RNMUIMM24
:
2136 value
= fields
->f_c5_rnmuimm24
;
2138 case MEP_OPERAND_CALLNUM
:
2139 value
= fields
->f_callnum
;
2141 case MEP_OPERAND_CCCC
:
2142 value
= fields
->f_rm
;
2144 case MEP_OPERAND_CCRN
:
2145 value
= fields
->f_ccrn
;
2147 case MEP_OPERAND_CDISP10
:
2148 value
= fields
->f_cdisp10
;
2150 case MEP_OPERAND_CDISP10A2
:
2151 value
= fields
->f_cdisp10
;
2153 case MEP_OPERAND_CDISP10A4
:
2154 value
= fields
->f_cdisp10
;
2156 case MEP_OPERAND_CDISP10A8
:
2157 value
= fields
->f_cdisp10
;
2159 case MEP_OPERAND_CDISP12
:
2160 value
= fields
->f_12s20
;
2162 case MEP_OPERAND_CIMM4
:
2163 value
= fields
->f_rn
;
2165 case MEP_OPERAND_CIMM5
:
2166 value
= fields
->f_5u24
;
2168 case MEP_OPERAND_CODE16
:
2169 value
= fields
->f_16u16
;
2171 case MEP_OPERAND_CODE24
:
2172 value
= fields
->f_24u4n
;
2174 case MEP_OPERAND_CP_FLAG
:
2177 case MEP_OPERAND_CRN
:
2178 value
= fields
->f_crn
;
2180 case MEP_OPERAND_CRN64
:
2181 value
= fields
->f_crn
;
2183 case MEP_OPERAND_CRNX
:
2184 value
= fields
->f_crnx
;
2186 case MEP_OPERAND_CRNX64
:
2187 value
= fields
->f_crnx
;
2189 case MEP_OPERAND_CROC
:
2190 value
= fields
->f_ivc2_5u7
;
2192 case MEP_OPERAND_CROP
:
2193 value
= fields
->f_ivc2_5u23
;
2195 case MEP_OPERAND_CRPC
:
2196 value
= fields
->f_ivc2_5u26
;
2198 case MEP_OPERAND_CRPP
:
2199 value
= fields
->f_ivc2_5u18
;
2201 case MEP_OPERAND_CRQC
:
2202 value
= fields
->f_ivc2_5u21
;
2204 case MEP_OPERAND_CRQP
:
2205 value
= fields
->f_ivc2_5u13
;
2207 case MEP_OPERAND_CSRN
:
2208 value
= fields
->f_csrn
;
2210 case MEP_OPERAND_CSRN_IDX
:
2211 value
= fields
->f_csrn
;
2213 case MEP_OPERAND_DBG
:
2216 case MEP_OPERAND_DEPC
:
2219 case MEP_OPERAND_EPC
:
2222 case MEP_OPERAND_EXC
:
2225 case MEP_OPERAND_HI
:
2228 case MEP_OPERAND_IMM16P0
:
2229 value
= fields
->f_ivc2_imm16p0
;
2231 case MEP_OPERAND_IMM3P12
:
2232 value
= fields
->f_ivc2_3u12
;
2234 case MEP_OPERAND_IMM3P25
:
2235 value
= fields
->f_ivc2_3u25
;
2237 case MEP_OPERAND_IMM3P4
:
2238 value
= fields
->f_ivc2_3u4
;
2240 case MEP_OPERAND_IMM3P5
:
2241 value
= fields
->f_ivc2_3u5
;
2243 case MEP_OPERAND_IMM3P9
:
2244 value
= fields
->f_ivc2_3u9
;
2246 case MEP_OPERAND_IMM4P10
:
2247 value
= fields
->f_ivc2_4u10
;
2249 case MEP_OPERAND_IMM4P4
:
2250 value
= fields
->f_ivc2_4u4
;
2252 case MEP_OPERAND_IMM4P8
:
2253 value
= fields
->f_ivc2_4u8
;
2255 case MEP_OPERAND_IMM5P23
:
2256 value
= fields
->f_ivc2_5u23
;
2258 case MEP_OPERAND_IMM5P3
:
2259 value
= fields
->f_ivc2_5u3
;
2261 case MEP_OPERAND_IMM5P7
:
2262 value
= fields
->f_ivc2_5u7
;
2264 case MEP_OPERAND_IMM5P8
:
2265 value
= fields
->f_ivc2_5u8
;
2267 case MEP_OPERAND_IMM6P2
:
2268 value
= fields
->f_ivc2_6u2
;
2270 case MEP_OPERAND_IMM6P6
:
2271 value
= fields
->f_ivc2_6u6
;
2273 case MEP_OPERAND_IMM8P0
:
2274 value
= fields
->f_ivc2_8u0
;
2276 case MEP_OPERAND_IMM8P20
:
2277 value
= fields
->f_ivc2_8u20
;
2279 case MEP_OPERAND_IMM8P4
:
2280 value
= fields
->f_ivc2_8u4
;
2282 case MEP_OPERAND_IVC_X_0_2
:
2283 value
= fields
->f_ivc2_2u0
;
2285 case MEP_OPERAND_IVC_X_0_3
:
2286 value
= fields
->f_ivc2_3u0
;
2288 case MEP_OPERAND_IVC_X_0_4
:
2289 value
= fields
->f_ivc2_4u0
;
2291 case MEP_OPERAND_IVC_X_0_5
:
2292 value
= fields
->f_ivc2_5u0
;
2294 case MEP_OPERAND_IVC_X_6_1
:
2295 value
= fields
->f_ivc2_1u6
;
2297 case MEP_OPERAND_IVC_X_6_2
:
2298 value
= fields
->f_ivc2_2u6
;
2300 case MEP_OPERAND_IVC_X_6_3
:
2301 value
= fields
->f_ivc2_3u6
;
2303 case MEP_OPERAND_IVC2C3CCRN
:
2304 value
= fields
->f_ivc2_ccrn_c3
;
2306 case MEP_OPERAND_IVC2CCRN
:
2307 value
= fields
->f_ivc2_ccrn
;
2309 case MEP_OPERAND_IVC2CRN
:
2310 value
= fields
->f_ivc2_crnx
;
2312 case MEP_OPERAND_IVC2RM
:
2313 value
= fields
->f_ivc2_crm
;
2315 case MEP_OPERAND_LO
:
2318 case MEP_OPERAND_LP
:
2321 case MEP_OPERAND_MB0
:
2324 case MEP_OPERAND_MB1
:
2327 case MEP_OPERAND_ME0
:
2330 case MEP_OPERAND_ME1
:
2333 case MEP_OPERAND_NPC
:
2336 case MEP_OPERAND_OPT
:
2339 case MEP_OPERAND_PCABS24A2
:
2340 value
= fields
->f_24u5a2n
;
2342 case MEP_OPERAND_PCREL12A2
:
2343 value
= fields
->f_12s4a2
;
2345 case MEP_OPERAND_PCREL17A2
:
2346 value
= fields
->f_17s16a2
;
2348 case MEP_OPERAND_PCREL24A2
:
2349 value
= fields
->f_24s5a2n
;
2351 case MEP_OPERAND_PCREL8A2
:
2352 value
= fields
->f_8s8a2
;
2354 case MEP_OPERAND_PSW
:
2357 case MEP_OPERAND_R0
:
2360 case MEP_OPERAND_R1
:
2363 case MEP_OPERAND_RL
:
2364 value
= fields
->f_rl
;
2366 case MEP_OPERAND_RL5
:
2367 value
= fields
->f_rl5
;
2369 case MEP_OPERAND_RM
:
2370 value
= fields
->f_rm
;
2372 case MEP_OPERAND_RMA
:
2373 value
= fields
->f_rm
;
2375 case MEP_OPERAND_RN
:
2376 value
= fields
->f_rn
;
2378 case MEP_OPERAND_RN3
:
2379 value
= fields
->f_rn3
;
2381 case MEP_OPERAND_RN3C
:
2382 value
= fields
->f_rn3
;
2384 case MEP_OPERAND_RN3L
:
2385 value
= fields
->f_rn3
;
2387 case MEP_OPERAND_RN3S
:
2388 value
= fields
->f_rn3
;
2390 case MEP_OPERAND_RN3UC
:
2391 value
= fields
->f_rn3
;
2393 case MEP_OPERAND_RN3UL
:
2394 value
= fields
->f_rn3
;
2396 case MEP_OPERAND_RN3US
:
2397 value
= fields
->f_rn3
;
2399 case MEP_OPERAND_RNC
:
2400 value
= fields
->f_rn
;
2402 case MEP_OPERAND_RNL
:
2403 value
= fields
->f_rn
;
2405 case MEP_OPERAND_RNS
:
2406 value
= fields
->f_rn
;
2408 case MEP_OPERAND_RNUC
:
2409 value
= fields
->f_rn
;
2411 case MEP_OPERAND_RNUL
:
2412 value
= fields
->f_rn
;
2414 case MEP_OPERAND_RNUS
:
2415 value
= fields
->f_rn
;
2417 case MEP_OPERAND_SAR
:
2420 case MEP_OPERAND_SDISP16
:
2421 value
= fields
->f_16s16
;
2423 case MEP_OPERAND_SIMM16
:
2424 value
= fields
->f_16s16
;
2426 case MEP_OPERAND_SIMM16P0
:
2427 value
= fields
->f_ivc2_simm16p0
;
2429 case MEP_OPERAND_SIMM6
:
2430 value
= fields
->f_6s8
;
2432 case MEP_OPERAND_SIMM8
:
2433 value
= fields
->f_8s8
;
2435 case MEP_OPERAND_SIMM8P0
:
2436 value
= fields
->f_ivc2_8s0
;
2438 case MEP_OPERAND_SIMM8P20
:
2439 value
= fields
->f_ivc2_8s20
;
2441 case MEP_OPERAND_SIMM8P4
:
2442 value
= fields
->f_ivc2_8s4
;
2444 case MEP_OPERAND_SP
:
2447 case MEP_OPERAND_SPR
:
2450 case MEP_OPERAND_TP
:
2453 case MEP_OPERAND_TPR
:
2456 case MEP_OPERAND_UDISP2
:
2457 value
= fields
->f_2u6
;
2459 case MEP_OPERAND_UDISP7
:
2460 value
= fields
->f_7u9
;
2462 case MEP_OPERAND_UDISP7A2
:
2463 value
= fields
->f_7u9a2
;
2465 case MEP_OPERAND_UDISP7A4
:
2466 value
= fields
->f_7u9a4
;
2468 case MEP_OPERAND_UIMM16
:
2469 value
= fields
->f_16u16
;
2471 case MEP_OPERAND_UIMM2
:
2472 value
= fields
->f_2u10
;
2474 case MEP_OPERAND_UIMM24
:
2475 value
= fields
->f_24u8n
;
2477 case MEP_OPERAND_UIMM3
:
2478 value
= fields
->f_3u5
;
2480 case MEP_OPERAND_UIMM4
:
2481 value
= fields
->f_4u8
;
2483 case MEP_OPERAND_UIMM5
:
2484 value
= fields
->f_5u8
;
2486 case MEP_OPERAND_UIMM7A4
:
2487 value
= fields
->f_7u9a4
;
2489 case MEP_OPERAND_ZERO
:
2494 /* xgettext:c-format */
2495 fprintf (stderr
, _("Unrecognized field %d while getting vma operand.\n"),
2503 void mep_cgen_set_int_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, int);
2504 void mep_cgen_set_vma_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, bfd_vma
);
2506 /* Stuffing values in cgen_fields is handled by a collection of functions.
2507 They are distinguished by the type of the VALUE argument they accept.
2508 TODO: floating point, inlining support, remove cases where argument type
2512 mep_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
2514 CGEN_FIELDS
* fields
,
2519 case MEP_OPERAND_ADDR24A4
:
2520 fields
->f_24u8a4n
= value
;
2522 case MEP_OPERAND_C5RMUIMM20
:
2523 fields
->f_c5_rmuimm20
= value
;
2525 case MEP_OPERAND_C5RNMUIMM24
:
2526 fields
->f_c5_rnmuimm24
= value
;
2528 case MEP_OPERAND_CALLNUM
:
2529 fields
->f_callnum
= value
;
2531 case MEP_OPERAND_CCCC
:
2532 fields
->f_rm
= value
;
2534 case MEP_OPERAND_CCRN
:
2535 fields
->f_ccrn
= value
;
2537 case MEP_OPERAND_CDISP10
:
2538 fields
->f_cdisp10
= value
;
2540 case MEP_OPERAND_CDISP10A2
:
2541 fields
->f_cdisp10
= value
;
2543 case MEP_OPERAND_CDISP10A4
:
2544 fields
->f_cdisp10
= value
;
2546 case MEP_OPERAND_CDISP10A8
:
2547 fields
->f_cdisp10
= value
;
2549 case MEP_OPERAND_CDISP12
:
2550 fields
->f_12s20
= value
;
2552 case MEP_OPERAND_CIMM4
:
2553 fields
->f_rn
= value
;
2555 case MEP_OPERAND_CIMM5
:
2556 fields
->f_5u24
= value
;
2558 case MEP_OPERAND_CODE16
:
2559 fields
->f_16u16
= value
;
2561 case MEP_OPERAND_CODE24
:
2562 fields
->f_24u4n
= value
;
2564 case MEP_OPERAND_CP_FLAG
:
2566 case MEP_OPERAND_CRN
:
2567 fields
->f_crn
= value
;
2569 case MEP_OPERAND_CRN64
:
2570 fields
->f_crn
= value
;
2572 case MEP_OPERAND_CRNX
:
2573 fields
->f_crnx
= value
;
2575 case MEP_OPERAND_CRNX64
:
2576 fields
->f_crnx
= value
;
2578 case MEP_OPERAND_CROC
:
2579 fields
->f_ivc2_5u7
= value
;
2581 case MEP_OPERAND_CROP
:
2582 fields
->f_ivc2_5u23
= value
;
2584 case MEP_OPERAND_CRPC
:
2585 fields
->f_ivc2_5u26
= value
;
2587 case MEP_OPERAND_CRPP
:
2588 fields
->f_ivc2_5u18
= value
;
2590 case MEP_OPERAND_CRQC
:
2591 fields
->f_ivc2_5u21
= value
;
2593 case MEP_OPERAND_CRQP
:
2594 fields
->f_ivc2_5u13
= value
;
2596 case MEP_OPERAND_CSRN
:
2597 fields
->f_csrn
= value
;
2599 case MEP_OPERAND_CSRN_IDX
:
2600 fields
->f_csrn
= value
;
2602 case MEP_OPERAND_DBG
:
2604 case MEP_OPERAND_DEPC
:
2606 case MEP_OPERAND_EPC
:
2608 case MEP_OPERAND_EXC
:
2610 case MEP_OPERAND_HI
:
2612 case MEP_OPERAND_IMM16P0
:
2613 fields
->f_ivc2_imm16p0
= value
;
2615 case MEP_OPERAND_IMM3P12
:
2616 fields
->f_ivc2_3u12
= value
;
2618 case MEP_OPERAND_IMM3P25
:
2619 fields
->f_ivc2_3u25
= value
;
2621 case MEP_OPERAND_IMM3P4
:
2622 fields
->f_ivc2_3u4
= value
;
2624 case MEP_OPERAND_IMM3P5
:
2625 fields
->f_ivc2_3u5
= value
;
2627 case MEP_OPERAND_IMM3P9
:
2628 fields
->f_ivc2_3u9
= value
;
2630 case MEP_OPERAND_IMM4P10
:
2631 fields
->f_ivc2_4u10
= value
;
2633 case MEP_OPERAND_IMM4P4
:
2634 fields
->f_ivc2_4u4
= value
;
2636 case MEP_OPERAND_IMM4P8
:
2637 fields
->f_ivc2_4u8
= value
;
2639 case MEP_OPERAND_IMM5P23
:
2640 fields
->f_ivc2_5u23
= value
;
2642 case MEP_OPERAND_IMM5P3
:
2643 fields
->f_ivc2_5u3
= value
;
2645 case MEP_OPERAND_IMM5P7
:
2646 fields
->f_ivc2_5u7
= value
;
2648 case MEP_OPERAND_IMM5P8
:
2649 fields
->f_ivc2_5u8
= value
;
2651 case MEP_OPERAND_IMM6P2
:
2652 fields
->f_ivc2_6u2
= value
;
2654 case MEP_OPERAND_IMM6P6
:
2655 fields
->f_ivc2_6u6
= value
;
2657 case MEP_OPERAND_IMM8P0
:
2658 fields
->f_ivc2_8u0
= value
;
2660 case MEP_OPERAND_IMM8P20
:
2661 fields
->f_ivc2_8u20
= value
;
2663 case MEP_OPERAND_IMM8P4
:
2664 fields
->f_ivc2_8u4
= value
;
2666 case MEP_OPERAND_IVC_X_0_2
:
2667 fields
->f_ivc2_2u0
= value
;
2669 case MEP_OPERAND_IVC_X_0_3
:
2670 fields
->f_ivc2_3u0
= value
;
2672 case MEP_OPERAND_IVC_X_0_4
:
2673 fields
->f_ivc2_4u0
= value
;
2675 case MEP_OPERAND_IVC_X_0_5
:
2676 fields
->f_ivc2_5u0
= value
;
2678 case MEP_OPERAND_IVC_X_6_1
:
2679 fields
->f_ivc2_1u6
= value
;
2681 case MEP_OPERAND_IVC_X_6_2
:
2682 fields
->f_ivc2_2u6
= value
;
2684 case MEP_OPERAND_IVC_X_6_3
:
2685 fields
->f_ivc2_3u6
= value
;
2687 case MEP_OPERAND_IVC2C3CCRN
:
2688 fields
->f_ivc2_ccrn_c3
= value
;
2690 case MEP_OPERAND_IVC2CCRN
:
2691 fields
->f_ivc2_ccrn
= value
;
2693 case MEP_OPERAND_IVC2CRN
:
2694 fields
->f_ivc2_crnx
= value
;
2696 case MEP_OPERAND_IVC2RM
:
2697 fields
->f_ivc2_crm
= value
;
2699 case MEP_OPERAND_LO
:
2701 case MEP_OPERAND_LP
:
2703 case MEP_OPERAND_MB0
:
2705 case MEP_OPERAND_MB1
:
2707 case MEP_OPERAND_ME0
:
2709 case MEP_OPERAND_ME1
:
2711 case MEP_OPERAND_NPC
:
2713 case MEP_OPERAND_OPT
:
2715 case MEP_OPERAND_PCABS24A2
:
2716 fields
->f_24u5a2n
= value
;
2718 case MEP_OPERAND_PCREL12A2
:
2719 fields
->f_12s4a2
= value
;
2721 case MEP_OPERAND_PCREL17A2
:
2722 fields
->f_17s16a2
= value
;
2724 case MEP_OPERAND_PCREL24A2
:
2725 fields
->f_24s5a2n
= value
;
2727 case MEP_OPERAND_PCREL8A2
:
2728 fields
->f_8s8a2
= value
;
2730 case MEP_OPERAND_PSW
:
2732 case MEP_OPERAND_R0
:
2734 case MEP_OPERAND_R1
:
2736 case MEP_OPERAND_RL
:
2737 fields
->f_rl
= value
;
2739 case MEP_OPERAND_RL5
:
2740 fields
->f_rl5
= value
;
2742 case MEP_OPERAND_RM
:
2743 fields
->f_rm
= value
;
2745 case MEP_OPERAND_RMA
:
2746 fields
->f_rm
= value
;
2748 case MEP_OPERAND_RN
:
2749 fields
->f_rn
= value
;
2751 case MEP_OPERAND_RN3
:
2752 fields
->f_rn3
= value
;
2754 case MEP_OPERAND_RN3C
:
2755 fields
->f_rn3
= value
;
2757 case MEP_OPERAND_RN3L
:
2758 fields
->f_rn3
= value
;
2760 case MEP_OPERAND_RN3S
:
2761 fields
->f_rn3
= value
;
2763 case MEP_OPERAND_RN3UC
:
2764 fields
->f_rn3
= value
;
2766 case MEP_OPERAND_RN3UL
:
2767 fields
->f_rn3
= value
;
2769 case MEP_OPERAND_RN3US
:
2770 fields
->f_rn3
= value
;
2772 case MEP_OPERAND_RNC
:
2773 fields
->f_rn
= value
;
2775 case MEP_OPERAND_RNL
:
2776 fields
->f_rn
= value
;
2778 case MEP_OPERAND_RNS
:
2779 fields
->f_rn
= value
;
2781 case MEP_OPERAND_RNUC
:
2782 fields
->f_rn
= value
;
2784 case MEP_OPERAND_RNUL
:
2785 fields
->f_rn
= value
;
2787 case MEP_OPERAND_RNUS
:
2788 fields
->f_rn
= value
;
2790 case MEP_OPERAND_SAR
:
2792 case MEP_OPERAND_SDISP16
:
2793 fields
->f_16s16
= value
;
2795 case MEP_OPERAND_SIMM16
:
2796 fields
->f_16s16
= value
;
2798 case MEP_OPERAND_SIMM16P0
:
2799 fields
->f_ivc2_simm16p0
= value
;
2801 case MEP_OPERAND_SIMM6
:
2802 fields
->f_6s8
= value
;
2804 case MEP_OPERAND_SIMM8
:
2805 fields
->f_8s8
= value
;
2807 case MEP_OPERAND_SIMM8P0
:
2808 fields
->f_ivc2_8s0
= value
;
2810 case MEP_OPERAND_SIMM8P20
:
2811 fields
->f_ivc2_8s20
= value
;
2813 case MEP_OPERAND_SIMM8P4
:
2814 fields
->f_ivc2_8s4
= value
;
2816 case MEP_OPERAND_SP
:
2818 case MEP_OPERAND_SPR
:
2820 case MEP_OPERAND_TP
:
2822 case MEP_OPERAND_TPR
:
2824 case MEP_OPERAND_UDISP2
:
2825 fields
->f_2u6
= value
;
2827 case MEP_OPERAND_UDISP7
:
2828 fields
->f_7u9
= value
;
2830 case MEP_OPERAND_UDISP7A2
:
2831 fields
->f_7u9a2
= value
;
2833 case MEP_OPERAND_UDISP7A4
:
2834 fields
->f_7u9a4
= value
;
2836 case MEP_OPERAND_UIMM16
:
2837 fields
->f_16u16
= value
;
2839 case MEP_OPERAND_UIMM2
:
2840 fields
->f_2u10
= value
;
2842 case MEP_OPERAND_UIMM24
:
2843 fields
->f_24u8n
= value
;
2845 case MEP_OPERAND_UIMM3
:
2846 fields
->f_3u5
= value
;
2848 case MEP_OPERAND_UIMM4
:
2849 fields
->f_4u8
= value
;
2851 case MEP_OPERAND_UIMM5
:
2852 fields
->f_5u8
= value
;
2854 case MEP_OPERAND_UIMM7A4
:
2855 fields
->f_7u9a4
= value
;
2857 case MEP_OPERAND_ZERO
:
2861 /* xgettext:c-format */
2862 fprintf (stderr
, _("Unrecognized field %d while setting int operand.\n"),
2869 mep_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
2871 CGEN_FIELDS
* fields
,
2876 case MEP_OPERAND_ADDR24A4
:
2877 fields
->f_24u8a4n
= value
;
2879 case MEP_OPERAND_C5RMUIMM20
:
2880 fields
->f_c5_rmuimm20
= value
;
2882 case MEP_OPERAND_C5RNMUIMM24
:
2883 fields
->f_c5_rnmuimm24
= value
;
2885 case MEP_OPERAND_CALLNUM
:
2886 fields
->f_callnum
= value
;
2888 case MEP_OPERAND_CCCC
:
2889 fields
->f_rm
= value
;
2891 case MEP_OPERAND_CCRN
:
2892 fields
->f_ccrn
= value
;
2894 case MEP_OPERAND_CDISP10
:
2895 fields
->f_cdisp10
= value
;
2897 case MEP_OPERAND_CDISP10A2
:
2898 fields
->f_cdisp10
= value
;
2900 case MEP_OPERAND_CDISP10A4
:
2901 fields
->f_cdisp10
= value
;
2903 case MEP_OPERAND_CDISP10A8
:
2904 fields
->f_cdisp10
= value
;
2906 case MEP_OPERAND_CDISP12
:
2907 fields
->f_12s20
= value
;
2909 case MEP_OPERAND_CIMM4
:
2910 fields
->f_rn
= value
;
2912 case MEP_OPERAND_CIMM5
:
2913 fields
->f_5u24
= value
;
2915 case MEP_OPERAND_CODE16
:
2916 fields
->f_16u16
= value
;
2918 case MEP_OPERAND_CODE24
:
2919 fields
->f_24u4n
= value
;
2921 case MEP_OPERAND_CP_FLAG
:
2923 case MEP_OPERAND_CRN
:
2924 fields
->f_crn
= value
;
2926 case MEP_OPERAND_CRN64
:
2927 fields
->f_crn
= value
;
2929 case MEP_OPERAND_CRNX
:
2930 fields
->f_crnx
= value
;
2932 case MEP_OPERAND_CRNX64
:
2933 fields
->f_crnx
= value
;
2935 case MEP_OPERAND_CROC
:
2936 fields
->f_ivc2_5u7
= value
;
2938 case MEP_OPERAND_CROP
:
2939 fields
->f_ivc2_5u23
= value
;
2941 case MEP_OPERAND_CRPC
:
2942 fields
->f_ivc2_5u26
= value
;
2944 case MEP_OPERAND_CRPP
:
2945 fields
->f_ivc2_5u18
= value
;
2947 case MEP_OPERAND_CRQC
:
2948 fields
->f_ivc2_5u21
= value
;
2950 case MEP_OPERAND_CRQP
:
2951 fields
->f_ivc2_5u13
= value
;
2953 case MEP_OPERAND_CSRN
:
2954 fields
->f_csrn
= value
;
2956 case MEP_OPERAND_CSRN_IDX
:
2957 fields
->f_csrn
= value
;
2959 case MEP_OPERAND_DBG
:
2961 case MEP_OPERAND_DEPC
:
2963 case MEP_OPERAND_EPC
:
2965 case MEP_OPERAND_EXC
:
2967 case MEP_OPERAND_HI
:
2969 case MEP_OPERAND_IMM16P0
:
2970 fields
->f_ivc2_imm16p0
= value
;
2972 case MEP_OPERAND_IMM3P12
:
2973 fields
->f_ivc2_3u12
= value
;
2975 case MEP_OPERAND_IMM3P25
:
2976 fields
->f_ivc2_3u25
= value
;
2978 case MEP_OPERAND_IMM3P4
:
2979 fields
->f_ivc2_3u4
= value
;
2981 case MEP_OPERAND_IMM3P5
:
2982 fields
->f_ivc2_3u5
= value
;
2984 case MEP_OPERAND_IMM3P9
:
2985 fields
->f_ivc2_3u9
= value
;
2987 case MEP_OPERAND_IMM4P10
:
2988 fields
->f_ivc2_4u10
= value
;
2990 case MEP_OPERAND_IMM4P4
:
2991 fields
->f_ivc2_4u4
= value
;
2993 case MEP_OPERAND_IMM4P8
:
2994 fields
->f_ivc2_4u8
= value
;
2996 case MEP_OPERAND_IMM5P23
:
2997 fields
->f_ivc2_5u23
= value
;
2999 case MEP_OPERAND_IMM5P3
:
3000 fields
->f_ivc2_5u3
= value
;
3002 case MEP_OPERAND_IMM5P7
:
3003 fields
->f_ivc2_5u7
= value
;
3005 case MEP_OPERAND_IMM5P8
:
3006 fields
->f_ivc2_5u8
= value
;
3008 case MEP_OPERAND_IMM6P2
:
3009 fields
->f_ivc2_6u2
= value
;
3011 case MEP_OPERAND_IMM6P6
:
3012 fields
->f_ivc2_6u6
= value
;
3014 case MEP_OPERAND_IMM8P0
:
3015 fields
->f_ivc2_8u0
= value
;
3017 case MEP_OPERAND_IMM8P20
:
3018 fields
->f_ivc2_8u20
= value
;
3020 case MEP_OPERAND_IMM8P4
:
3021 fields
->f_ivc2_8u4
= value
;
3023 case MEP_OPERAND_IVC_X_0_2
:
3024 fields
->f_ivc2_2u0
= value
;
3026 case MEP_OPERAND_IVC_X_0_3
:
3027 fields
->f_ivc2_3u0
= value
;
3029 case MEP_OPERAND_IVC_X_0_4
:
3030 fields
->f_ivc2_4u0
= value
;
3032 case MEP_OPERAND_IVC_X_0_5
:
3033 fields
->f_ivc2_5u0
= value
;
3035 case MEP_OPERAND_IVC_X_6_1
:
3036 fields
->f_ivc2_1u6
= value
;
3038 case MEP_OPERAND_IVC_X_6_2
:
3039 fields
->f_ivc2_2u6
= value
;
3041 case MEP_OPERAND_IVC_X_6_3
:
3042 fields
->f_ivc2_3u6
= value
;
3044 case MEP_OPERAND_IVC2C3CCRN
:
3045 fields
->f_ivc2_ccrn_c3
= value
;
3047 case MEP_OPERAND_IVC2CCRN
:
3048 fields
->f_ivc2_ccrn
= value
;
3050 case MEP_OPERAND_IVC2CRN
:
3051 fields
->f_ivc2_crnx
= value
;
3053 case MEP_OPERAND_IVC2RM
:
3054 fields
->f_ivc2_crm
= value
;
3056 case MEP_OPERAND_LO
:
3058 case MEP_OPERAND_LP
:
3060 case MEP_OPERAND_MB0
:
3062 case MEP_OPERAND_MB1
:
3064 case MEP_OPERAND_ME0
:
3066 case MEP_OPERAND_ME1
:
3068 case MEP_OPERAND_NPC
:
3070 case MEP_OPERAND_OPT
:
3072 case MEP_OPERAND_PCABS24A2
:
3073 fields
->f_24u5a2n
= value
;
3075 case MEP_OPERAND_PCREL12A2
:
3076 fields
->f_12s4a2
= value
;
3078 case MEP_OPERAND_PCREL17A2
:
3079 fields
->f_17s16a2
= value
;
3081 case MEP_OPERAND_PCREL24A2
:
3082 fields
->f_24s5a2n
= value
;
3084 case MEP_OPERAND_PCREL8A2
:
3085 fields
->f_8s8a2
= value
;
3087 case MEP_OPERAND_PSW
:
3089 case MEP_OPERAND_R0
:
3091 case MEP_OPERAND_R1
:
3093 case MEP_OPERAND_RL
:
3094 fields
->f_rl
= value
;
3096 case MEP_OPERAND_RL5
:
3097 fields
->f_rl5
= value
;
3099 case MEP_OPERAND_RM
:
3100 fields
->f_rm
= value
;
3102 case MEP_OPERAND_RMA
:
3103 fields
->f_rm
= value
;
3105 case MEP_OPERAND_RN
:
3106 fields
->f_rn
= value
;
3108 case MEP_OPERAND_RN3
:
3109 fields
->f_rn3
= value
;
3111 case MEP_OPERAND_RN3C
:
3112 fields
->f_rn3
= value
;
3114 case MEP_OPERAND_RN3L
:
3115 fields
->f_rn3
= value
;
3117 case MEP_OPERAND_RN3S
:
3118 fields
->f_rn3
= value
;
3120 case MEP_OPERAND_RN3UC
:
3121 fields
->f_rn3
= value
;
3123 case MEP_OPERAND_RN3UL
:
3124 fields
->f_rn3
= value
;
3126 case MEP_OPERAND_RN3US
:
3127 fields
->f_rn3
= value
;
3129 case MEP_OPERAND_RNC
:
3130 fields
->f_rn
= value
;
3132 case MEP_OPERAND_RNL
:
3133 fields
->f_rn
= value
;
3135 case MEP_OPERAND_RNS
:
3136 fields
->f_rn
= value
;
3138 case MEP_OPERAND_RNUC
:
3139 fields
->f_rn
= value
;
3141 case MEP_OPERAND_RNUL
:
3142 fields
->f_rn
= value
;
3144 case MEP_OPERAND_RNUS
:
3145 fields
->f_rn
= value
;
3147 case MEP_OPERAND_SAR
:
3149 case MEP_OPERAND_SDISP16
:
3150 fields
->f_16s16
= value
;
3152 case MEP_OPERAND_SIMM16
:
3153 fields
->f_16s16
= value
;
3155 case MEP_OPERAND_SIMM16P0
:
3156 fields
->f_ivc2_simm16p0
= value
;
3158 case MEP_OPERAND_SIMM6
:
3159 fields
->f_6s8
= value
;
3161 case MEP_OPERAND_SIMM8
:
3162 fields
->f_8s8
= value
;
3164 case MEP_OPERAND_SIMM8P0
:
3165 fields
->f_ivc2_8s0
= value
;
3167 case MEP_OPERAND_SIMM8P20
:
3168 fields
->f_ivc2_8s20
= value
;
3170 case MEP_OPERAND_SIMM8P4
:
3171 fields
->f_ivc2_8s4
= value
;
3173 case MEP_OPERAND_SP
:
3175 case MEP_OPERAND_SPR
:
3177 case MEP_OPERAND_TP
:
3179 case MEP_OPERAND_TPR
:
3181 case MEP_OPERAND_UDISP2
:
3182 fields
->f_2u6
= value
;
3184 case MEP_OPERAND_UDISP7
:
3185 fields
->f_7u9
= value
;
3187 case MEP_OPERAND_UDISP7A2
:
3188 fields
->f_7u9a2
= value
;
3190 case MEP_OPERAND_UDISP7A4
:
3191 fields
->f_7u9a4
= value
;
3193 case MEP_OPERAND_UIMM16
:
3194 fields
->f_16u16
= value
;
3196 case MEP_OPERAND_UIMM2
:
3197 fields
->f_2u10
= value
;
3199 case MEP_OPERAND_UIMM24
:
3200 fields
->f_24u8n
= value
;
3202 case MEP_OPERAND_UIMM3
:
3203 fields
->f_3u5
= value
;
3205 case MEP_OPERAND_UIMM4
:
3206 fields
->f_4u8
= value
;
3208 case MEP_OPERAND_UIMM5
:
3209 fields
->f_5u8
= value
;
3211 case MEP_OPERAND_UIMM7A4
:
3212 fields
->f_7u9a4
= value
;
3214 case MEP_OPERAND_ZERO
:
3218 /* xgettext:c-format */
3219 fprintf (stderr
, _("Unrecognized field %d while setting vma operand.\n"),
3225 /* Function to call before using the instruction builder tables. */
3228 mep_cgen_init_ibld_table (CGEN_CPU_DESC cd
)
3230 cd
->insert_handlers
= & mep_cgen_insert_handlers
[0];
3231 cd
->extract_handlers
= & mep_cgen_extract_handlers
[0];
3233 cd
->insert_operand
= mep_cgen_insert_operand
;
3234 cd
->extract_operand
= mep_cgen_extract_operand
;
3236 cd
->get_int_operand
= mep_cgen_get_int_operand
;
3237 cd
->set_int_operand
= mep_cgen_set_int_operand
;
3238 cd
->get_vma_operand
= mep_cgen_get_vma_operand
;
3239 cd
->set_vma_operand
= mep_cgen_set_vma_operand
;