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_IVC2CCRN
:
884 FLD (f_ivc2_ccrn_h2
) = ((((unsigned int) (FLD (f_ivc2_ccrn
)) >> (4))) & (3));
885 FLD (f_ivc2_ccrn_lo
) = ((FLD (f_ivc2_ccrn
)) & (15));
887 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_h2
, 0, 0, 20, 2, 32, total_length
, buffer
);
890 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_lo
, 0, 0, 0, 4, 32, total_length
, buffer
);
895 case MEP_OPERAND_IVC2CRN
:
898 FLD (f_ivc2_ccrn_h1
) = ((((unsigned int) (FLD (f_ivc2_crnx
)) >> (4))) & (1));
899 FLD (f_ivc2_ccrn_lo
) = ((FLD (f_ivc2_crnx
)) & (15));
901 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_h1
, 0, 0, 20, 1, 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_IVC2RM
:
910 errmsg
= insert_normal (cd
, fields
->f_ivc2_crm
, 0, 0, 4, 4, 32, total_length
, buffer
);
912 case MEP_OPERAND_LO
:
914 case MEP_OPERAND_LP
:
916 case MEP_OPERAND_MB0
:
918 case MEP_OPERAND_MB1
:
920 case MEP_OPERAND_ME0
:
922 case MEP_OPERAND_ME1
:
924 case MEP_OPERAND_NPC
:
926 case MEP_OPERAND_OPT
:
928 case MEP_OPERAND_PCABS24A2
:
931 FLD (f_24u5a2n_lo
) = ((unsigned int) (((FLD (f_24u5a2n
)) & (255))) >> (1));
932 FLD (f_24u5a2n_hi
) = ((unsigned int) (FLD (f_24u5a2n
)) >> (8));
934 errmsg
= insert_normal (cd
, fields
->f_24u5a2n_hi
, 0, 0, 16, 16, 32, total_length
, buffer
);
937 errmsg
= insert_normal (cd
, fields
->f_24u5a2n_lo
, 0, 0, 5, 7, 32, total_length
, buffer
);
942 case MEP_OPERAND_PCREL12A2
:
944 long value
= fields
->f_12s4a2
;
945 value
= ((int) (((value
) - (pc
))) >> (1));
946 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 4, 11, 32, total_length
, buffer
);
949 case MEP_OPERAND_PCREL17A2
:
951 long value
= fields
->f_17s16a2
;
952 value
= ((int) (((value
) - (pc
))) >> (1));
953 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 16, 16, 32, total_length
, buffer
);
956 case MEP_OPERAND_PCREL24A2
:
959 FLD (f_24s5a2n
) = ((FLD (f_24s5a2n
)) - (pc
));
960 FLD (f_24s5a2n_lo
) = ((unsigned int) (((FLD (f_24s5a2n
)) & (254))) >> (1));
961 FLD (f_24s5a2n_hi
) = ((int) (FLD (f_24s5a2n
)) >> (8));
963 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
);
966 errmsg
= insert_normal (cd
, fields
->f_24s5a2n_lo
, 0|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 5, 7, 32, total_length
, buffer
);
971 case MEP_OPERAND_PCREL8A2
:
973 long value
= fields
->f_8s8a2
;
974 value
= ((int) (((value
) - (pc
))) >> (1));
975 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 8, 7, 32, total_length
, buffer
);
978 case MEP_OPERAND_PSW
:
980 case MEP_OPERAND_R0
:
982 case MEP_OPERAND_R1
:
984 case MEP_OPERAND_RL
:
985 errmsg
= insert_normal (cd
, fields
->f_rl
, 0, 0, 12, 4, 32, total_length
, buffer
);
987 case MEP_OPERAND_RL5
:
988 errmsg
= insert_normal (cd
, fields
->f_rl5
, 0, 0, 20, 4, 32, total_length
, buffer
);
990 case MEP_OPERAND_RM
:
991 errmsg
= insert_normal (cd
, fields
->f_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
993 case MEP_OPERAND_RMA
:
994 errmsg
= insert_normal (cd
, fields
->f_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
996 case MEP_OPERAND_RN
:
997 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
999 case MEP_OPERAND_RN3
:
1000 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1002 case MEP_OPERAND_RN3C
:
1003 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1005 case MEP_OPERAND_RN3L
:
1006 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1008 case MEP_OPERAND_RN3S
:
1009 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1011 case MEP_OPERAND_RN3UC
:
1012 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1014 case MEP_OPERAND_RN3UL
:
1015 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1017 case MEP_OPERAND_RN3US
:
1018 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1020 case MEP_OPERAND_RNC
:
1021 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1023 case MEP_OPERAND_RNL
:
1024 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1026 case MEP_OPERAND_RNS
:
1027 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1029 case MEP_OPERAND_RNUC
:
1030 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1032 case MEP_OPERAND_RNUL
:
1033 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1035 case MEP_OPERAND_RNUS
:
1036 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1038 case MEP_OPERAND_SAR
:
1040 case MEP_OPERAND_SDISP16
:
1041 errmsg
= insert_normal (cd
, fields
->f_16s16
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, buffer
);
1043 case MEP_OPERAND_SIMM16
:
1044 errmsg
= insert_normal (cd
, fields
->f_16s16
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, buffer
);
1046 case MEP_OPERAND_SIMM16P0
:
1049 FLD (f_ivc2_8u0
) = ((((unsigned int) (FLD (f_ivc2_simm16p0
)) >> (8))) & (255));
1050 FLD (f_ivc2_8u20
) = ((FLD (f_ivc2_simm16p0
)) & (255));
1052 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u0
, 0, 0, 0, 8, 32, total_length
, buffer
);
1055 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u20
, 0, 0, 20, 8, 32, total_length
, buffer
);
1060 case MEP_OPERAND_SIMM6
:
1061 errmsg
= insert_normal (cd
, fields
->f_6s8
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 6, 32, total_length
, buffer
);
1063 case MEP_OPERAND_SIMM8
:
1064 errmsg
= insert_normal (cd
, fields
->f_8s8
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 8, 32, total_length
, buffer
);
1066 case MEP_OPERAND_SIMM8P0
:
1067 errmsg
= insert_normal (cd
, fields
->f_ivc2_8s0
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 0, 8, 32, total_length
, buffer
);
1069 case MEP_OPERAND_SIMM8P4
:
1070 errmsg
= insert_normal (cd
, fields
->f_ivc2_8s4
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 4, 8, 32, total_length
, buffer
);
1072 case MEP_OPERAND_SP
:
1074 case MEP_OPERAND_SPR
:
1076 case MEP_OPERAND_TP
:
1078 case MEP_OPERAND_TPR
:
1080 case MEP_OPERAND_UDISP2
:
1081 errmsg
= insert_normal (cd
, fields
->f_2u6
, 0, 0, 6, 2, 32, total_length
, buffer
);
1083 case MEP_OPERAND_UDISP7
:
1084 errmsg
= insert_normal (cd
, fields
->f_7u9
, 0, 0, 9, 7, 32, total_length
, buffer
);
1086 case MEP_OPERAND_UDISP7A2
:
1088 long value
= fields
->f_7u9a2
;
1089 value
= ((unsigned int) (value
) >> (1));
1090 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 6, 32, total_length
, buffer
);
1093 case MEP_OPERAND_UDISP7A4
:
1095 long value
= fields
->f_7u9a4
;
1096 value
= ((unsigned int) (value
) >> (2));
1097 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 5, 32, total_length
, buffer
);
1100 case MEP_OPERAND_UIMM16
:
1101 errmsg
= insert_normal (cd
, fields
->f_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
1103 case MEP_OPERAND_UIMM2
:
1104 errmsg
= insert_normal (cd
, fields
->f_2u10
, 0, 0, 10, 2, 32, total_length
, buffer
);
1106 case MEP_OPERAND_UIMM24
:
1109 FLD (f_24u8n_hi
) = ((unsigned int) (FLD (f_24u8n
)) >> (8));
1110 FLD (f_24u8n_lo
) = ((FLD (f_24u8n
)) & (255));
1112 errmsg
= insert_normal (cd
, fields
->f_24u8n_hi
, 0, 0, 16, 16, 32, total_length
, buffer
);
1115 errmsg
= insert_normal (cd
, fields
->f_24u8n_lo
, 0, 0, 8, 8, 32, total_length
, buffer
);
1120 case MEP_OPERAND_UIMM3
:
1121 errmsg
= insert_normal (cd
, fields
->f_3u5
, 0, 0, 5, 3, 32, total_length
, buffer
);
1123 case MEP_OPERAND_UIMM4
:
1124 errmsg
= insert_normal (cd
, fields
->f_4u8
, 0, 0, 8, 4, 32, total_length
, buffer
);
1126 case MEP_OPERAND_UIMM5
:
1127 errmsg
= insert_normal (cd
, fields
->f_5u8
, 0, 0, 8, 5, 32, total_length
, buffer
);
1129 case MEP_OPERAND_UIMM7A4
:
1131 long value
= fields
->f_7u9a4
;
1132 value
= ((unsigned int) (value
) >> (2));
1133 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 5, 32, total_length
, buffer
);
1136 case MEP_OPERAND_ZERO
:
1140 /* xgettext:c-format */
1141 fprintf (stderr
, _("Unrecognized field %d while building insn.\n"),
1149 int mep_cgen_extract_operand
1150 (CGEN_CPU_DESC
, int, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
1152 /* Main entry point for operand extraction.
1153 The result is <= 0 for error, >0 for success.
1154 ??? Actual values aren't well defined right now.
1156 This function is basically just a big switch statement. Earlier versions
1157 used tables to look up the function to use, but
1158 - if the table contains both assembler and disassembler functions then
1159 the disassembler contains much of the assembler and vice-versa,
1160 - there's a lot of inlining possibilities as things grow,
1161 - using a switch statement avoids the function call overhead.
1163 This function could be moved into `print_insn_normal', but keeping it
1164 separate makes clear the interface between `print_insn_normal' and each of
1168 mep_cgen_extract_operand (CGEN_CPU_DESC cd
,
1170 CGEN_EXTRACT_INFO
*ex_info
,
1171 CGEN_INSN_INT insn_value
,
1172 CGEN_FIELDS
* fields
,
1175 /* Assume success (for those operands that are nops). */
1177 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
1181 case MEP_OPERAND_ADDR24A4
:
1183 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u8a4n_hi
);
1184 if (length
<= 0) break;
1185 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 6, 32, total_length
, pc
, & fields
->f_24u8a4n_lo
);
1186 if (length
<= 0) break;
1187 FLD (f_24u8a4n
) = ((((FLD (f_24u8a4n_hi
)) << (8))) | (((FLD (f_24u8a4n_lo
)) << (2))));
1190 case MEP_OPERAND_C5RMUIMM20
:
1192 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_c5_rm
);
1193 if (length
<= 0) break;
1194 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_c5_16u16
);
1195 if (length
<= 0) break;
1197 FLD (f_c5_rmuimm20
) = ((FLD (f_c5_16u16
)) | (((FLD (f_c5_rm
)) << (16))));
1201 case MEP_OPERAND_C5RNMUIMM24
:
1203 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_c5_rnm
);
1204 if (length
<= 0) break;
1205 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_c5_16u16
);
1206 if (length
<= 0) break;
1208 FLD (f_c5_rnmuimm24
) = ((FLD (f_c5_16u16
)) | (((FLD (f_c5_rnm
)) << (16))));
1212 case MEP_OPERAND_CALLNUM
:
1214 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 1, 32, total_length
, pc
, & fields
->f_5
);
1215 if (length
<= 0) break;
1216 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 1, 32, total_length
, pc
, & fields
->f_6
);
1217 if (length
<= 0) break;
1218 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 1, 32, total_length
, pc
, & fields
->f_7
);
1219 if (length
<= 0) break;
1220 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 1, 32, total_length
, pc
, & fields
->f_11
);
1221 if (length
<= 0) break;
1222 FLD (f_callnum
) = ((((FLD (f_5
)) << (3))) | (((((FLD (f_6
)) << (2))) | (((((FLD (f_7
)) << (1))) | (FLD (f_11
)))))));
1225 case MEP_OPERAND_CCCC
:
1226 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1228 case MEP_OPERAND_CCRN
:
1230 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 2, 32, total_length
, pc
, & fields
->f_ccrn_hi
);
1231 if (length
<= 0) break;
1232 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ccrn_lo
);
1233 if (length
<= 0) break;
1234 FLD (f_ccrn
) = ((((FLD (f_ccrn_hi
)) << (4))) | (FLD (f_ccrn_lo
)));
1237 case MEP_OPERAND_CDISP10
:
1240 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1241 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)));
1242 fields
->f_cdisp10
= value
;
1245 case MEP_OPERAND_CDISP10A2
:
1248 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1249 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)));
1250 fields
->f_cdisp10
= value
;
1253 case MEP_OPERAND_CDISP10A4
:
1256 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1257 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)));
1258 fields
->f_cdisp10
= value
;
1261 case MEP_OPERAND_CDISP10A8
:
1264 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1265 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)));
1266 fields
->f_cdisp10
= value
;
1269 case MEP_OPERAND_CDISP12
:
1270 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 12, 32, total_length
, pc
, & fields
->f_12s20
);
1272 case MEP_OPERAND_CIMM4
:
1273 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1275 case MEP_OPERAND_CIMM5
:
1276 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 24, 5, 32, total_length
, pc
, & fields
->f_5u24
);
1278 case MEP_OPERAND_CODE16
:
1279 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_16u16
);
1281 case MEP_OPERAND_CODE24
:
1283 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_24u4n_hi
);
1284 if (length
<= 0) break;
1285 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u4n_lo
);
1286 if (length
<= 0) break;
1287 FLD (f_24u4n
) = ((((FLD (f_24u4n_hi
)) << (16))) | (FLD (f_24u4n_lo
)));
1290 case MEP_OPERAND_CP_FLAG
:
1292 case MEP_OPERAND_CRN
:
1293 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crn
);
1295 case MEP_OPERAND_CRN64
:
1296 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crn
);
1298 case MEP_OPERAND_CRNX
:
1300 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 1, 32, total_length
, pc
, & fields
->f_crnx_hi
);
1301 if (length
<= 0) break;
1302 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crnx_lo
);
1303 if (length
<= 0) break;
1304 FLD (f_crnx
) = ((((FLD (f_crnx_hi
)) << (4))) | (FLD (f_crnx_lo
)));
1307 case MEP_OPERAND_CRNX64
:
1309 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 1, 32, total_length
, pc
, & fields
->f_crnx_hi
);
1310 if (length
<= 0) break;
1311 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crnx_lo
);
1312 if (length
<= 0) break;
1313 FLD (f_crnx
) = ((((FLD (f_crnx_hi
)) << (4))) | (FLD (f_crnx_lo
)));
1316 case MEP_OPERAND_CROC
:
1317 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u7
);
1319 case MEP_OPERAND_CROP
:
1320 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 23, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u23
);
1322 case MEP_OPERAND_CRPC
:
1323 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u26
);
1325 case MEP_OPERAND_CRPP
:
1326 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 18, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u18
);
1328 case MEP_OPERAND_CRQC
:
1329 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 21, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u21
);
1331 case MEP_OPERAND_CRQP
:
1332 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 13, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u13
);
1334 case MEP_OPERAND_CSRN
:
1336 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 1, 32, total_length
, pc
, & fields
->f_csrn_hi
);
1337 if (length
<= 0) break;
1338 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_csrn_lo
);
1339 if (length
<= 0) break;
1340 FLD (f_csrn
) = ((((FLD (f_csrn_hi
)) << (4))) | (FLD (f_csrn_lo
)));
1343 case MEP_OPERAND_CSRN_IDX
:
1345 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 1, 32, total_length
, pc
, & fields
->f_csrn_hi
);
1346 if (length
<= 0) break;
1347 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_csrn_lo
);
1348 if (length
<= 0) break;
1349 FLD (f_csrn
) = ((((FLD (f_csrn_hi
)) << (4))) | (FLD (f_csrn_lo
)));
1352 case MEP_OPERAND_DBG
:
1354 case MEP_OPERAND_DEPC
:
1356 case MEP_OPERAND_EPC
:
1358 case MEP_OPERAND_EXC
:
1360 case MEP_OPERAND_HI
:
1362 case MEP_OPERAND_IMM16P0
:
1364 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1365 if (length
<= 0) break;
1366 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1367 if (length
<= 0) break;
1369 FLD (f_ivc2_imm16p0
) = ((FLD (f_ivc2_8u20
)) | (((FLD (f_ivc2_8u0
)) << (8))));
1373 case MEP_OPERAND_IMM3P12
:
1374 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 12, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u12
);
1376 case MEP_OPERAND_IMM3P25
:
1377 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u25
);
1379 case MEP_OPERAND_IMM3P4
:
1380 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u4
);
1382 case MEP_OPERAND_IMM3P5
:
1383 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u5
);
1385 case MEP_OPERAND_IMM3P9
:
1386 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u9
);
1388 case MEP_OPERAND_IMM4P10
:
1389 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 10, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u10
);
1391 case MEP_OPERAND_IMM4P4
:
1392 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u4
);
1394 case MEP_OPERAND_IMM4P8
:
1395 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u8
);
1397 case MEP_OPERAND_IMM5P23
:
1398 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 23, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u23
);
1400 case MEP_OPERAND_IMM5P3
:
1401 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 3, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u3
);
1403 case MEP_OPERAND_IMM5P7
:
1404 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u7
);
1406 case MEP_OPERAND_IMM5P8
:
1407 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u8
);
1409 case MEP_OPERAND_IMM6P2
:
1410 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 2, 6, 32, total_length
, pc
, & fields
->f_ivc2_6u2
);
1412 case MEP_OPERAND_IMM6P6
:
1413 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 6, 32, total_length
, pc
, & fields
->f_ivc2_6u6
);
1415 case MEP_OPERAND_IMM8P0
:
1416 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1418 case MEP_OPERAND_IMM8P20
:
1419 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1421 case MEP_OPERAND_IMM8P4
:
1422 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u4
);
1424 case MEP_OPERAND_IVC_X_0_2
:
1425 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 2, 32, total_length
, pc
, & fields
->f_ivc2_2u0
);
1427 case MEP_OPERAND_IVC_X_0_3
:
1428 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u0
);
1430 case MEP_OPERAND_IVC_X_0_4
:
1431 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u0
);
1433 case MEP_OPERAND_IVC_X_0_5
:
1434 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u0
);
1436 case MEP_OPERAND_IVC_X_6_1
:
1437 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 1, 32, total_length
, pc
, & fields
->f_ivc2_1u6
);
1439 case MEP_OPERAND_IVC_X_6_2
:
1440 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 2, 32, total_length
, pc
, & fields
->f_ivc2_2u6
);
1442 case MEP_OPERAND_IVC_X_6_3
:
1443 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u6
);
1445 case MEP_OPERAND_IVC2CCRN
:
1447 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 2, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_h2
);
1448 if (length
<= 0) break;
1449 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_lo
);
1450 if (length
<= 0) break;
1451 FLD (f_ivc2_ccrn
) = ((((FLD (f_ivc2_ccrn_h2
)) << (4))) | (FLD (f_ivc2_ccrn_lo
)));
1454 case MEP_OPERAND_IVC2CRN
:
1456 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 1, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_h1
);
1457 if (length
<= 0) break;
1458 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_lo
);
1459 if (length
<= 0) break;
1460 FLD (f_ivc2_crnx
) = ((((FLD (f_ivc2_ccrn_h1
)) << (4))) | (FLD (f_ivc2_ccrn_lo
)));
1463 case MEP_OPERAND_IVC2RM
:
1464 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ivc2_crm
);
1466 case MEP_OPERAND_LO
:
1468 case MEP_OPERAND_LP
:
1470 case MEP_OPERAND_MB0
:
1472 case MEP_OPERAND_MB1
:
1474 case MEP_OPERAND_ME0
:
1476 case MEP_OPERAND_ME1
:
1478 case MEP_OPERAND_NPC
:
1480 case MEP_OPERAND_OPT
:
1482 case MEP_OPERAND_PCABS24A2
:
1484 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u5a2n_hi
);
1485 if (length
<= 0) break;
1486 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 7, 32, total_length
, pc
, & fields
->f_24u5a2n_lo
);
1487 if (length
<= 0) break;
1488 FLD (f_24u5a2n
) = ((((FLD (f_24u5a2n_hi
)) << (8))) | (((FLD (f_24u5a2n_lo
)) << (1))));
1491 case MEP_OPERAND_PCREL12A2
:
1494 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
);
1495 value
= ((((value
) << (1))) + (pc
));
1496 fields
->f_12s4a2
= value
;
1499 case MEP_OPERAND_PCREL17A2
:
1502 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
);
1503 value
= ((((value
) << (1))) + (pc
));
1504 fields
->f_17s16a2
= value
;
1507 case MEP_OPERAND_PCREL24A2
:
1509 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
);
1510 if (length
<= 0) break;
1511 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
);
1512 if (length
<= 0) break;
1513 FLD (f_24s5a2n
) = ((((((FLD (f_24s5a2n_hi
)) << (8))) | (((FLD (f_24s5a2n_lo
)) << (1))))) + (pc
));
1516 case MEP_OPERAND_PCREL8A2
:
1519 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
);
1520 value
= ((((value
) << (1))) + (pc
));
1521 fields
->f_8s8a2
= value
;
1524 case MEP_OPERAND_PSW
:
1526 case MEP_OPERAND_R0
:
1528 case MEP_OPERAND_R1
:
1530 case MEP_OPERAND_RL
:
1531 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 12, 4, 32, total_length
, pc
, & fields
->f_rl
);
1533 case MEP_OPERAND_RL5
:
1534 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 4, 32, total_length
, pc
, & fields
->f_rl5
);
1536 case MEP_OPERAND_RM
:
1537 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1539 case MEP_OPERAND_RMA
:
1540 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1542 case MEP_OPERAND_RN
:
1543 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1545 case MEP_OPERAND_RN3
:
1546 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1548 case MEP_OPERAND_RN3C
:
1549 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1551 case MEP_OPERAND_RN3L
:
1552 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1554 case MEP_OPERAND_RN3S
:
1555 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1557 case MEP_OPERAND_RN3UC
:
1558 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1560 case MEP_OPERAND_RN3UL
:
1561 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1563 case MEP_OPERAND_RN3US
:
1564 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1566 case MEP_OPERAND_RNC
:
1567 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1569 case MEP_OPERAND_RNL
:
1570 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1572 case MEP_OPERAND_RNS
:
1573 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1575 case MEP_OPERAND_RNUC
:
1576 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1578 case MEP_OPERAND_RNUL
:
1579 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1581 case MEP_OPERAND_RNUS
:
1582 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1584 case MEP_OPERAND_SAR
:
1586 case MEP_OPERAND_SDISP16
:
1587 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, pc
, & fields
->f_16s16
);
1589 case MEP_OPERAND_SIMM16
:
1590 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, pc
, & fields
->f_16s16
);
1592 case MEP_OPERAND_SIMM16P0
:
1594 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1595 if (length
<= 0) break;
1596 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1597 if (length
<= 0) break;
1599 FLD (f_ivc2_simm16p0
) = ((FLD (f_ivc2_8u20
)) | (((FLD (f_ivc2_8u0
)) << (8))));
1603 case MEP_OPERAND_SIMM6
:
1604 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 6, 32, total_length
, pc
, & fields
->f_6s8
);
1606 case MEP_OPERAND_SIMM8
:
1607 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 8, 32, total_length
, pc
, & fields
->f_8s8
);
1609 case MEP_OPERAND_SIMM8P0
:
1610 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8s0
);
1612 case MEP_OPERAND_SIMM8P4
:
1613 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 4, 8, 32, total_length
, pc
, & fields
->f_ivc2_8s4
);
1615 case MEP_OPERAND_SP
:
1617 case MEP_OPERAND_SPR
:
1619 case MEP_OPERAND_TP
:
1621 case MEP_OPERAND_TPR
:
1623 case MEP_OPERAND_UDISP2
:
1624 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 2, 32, total_length
, pc
, & fields
->f_2u6
);
1626 case MEP_OPERAND_UDISP7
:
1627 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 7, 32, total_length
, pc
, & fields
->f_7u9
);
1629 case MEP_OPERAND_UDISP7A2
:
1632 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 6, 32, total_length
, pc
, & value
);
1633 value
= ((value
) << (1));
1634 fields
->f_7u9a2
= value
;
1637 case MEP_OPERAND_UDISP7A4
:
1640 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 5, 32, total_length
, pc
, & value
);
1641 value
= ((value
) << (2));
1642 fields
->f_7u9a4
= value
;
1645 case MEP_OPERAND_UIMM16
:
1646 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_16u16
);
1648 case MEP_OPERAND_UIMM2
:
1649 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 10, 2, 32, total_length
, pc
, & fields
->f_2u10
);
1651 case MEP_OPERAND_UIMM24
:
1653 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u8n_hi
);
1654 if (length
<= 0) break;
1655 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 8, 32, total_length
, pc
, & fields
->f_24u8n_lo
);
1656 if (length
<= 0) break;
1657 FLD (f_24u8n
) = ((((FLD (f_24u8n_hi
)) << (8))) | (FLD (f_24u8n_lo
)));
1660 case MEP_OPERAND_UIMM3
:
1661 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_3u5
);
1663 case MEP_OPERAND_UIMM4
:
1664 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_4u8
);
1666 case MEP_OPERAND_UIMM5
:
1667 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 5, 32, total_length
, pc
, & fields
->f_5u8
);
1669 case MEP_OPERAND_UIMM7A4
:
1672 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 5, 32, total_length
, pc
, & value
);
1673 value
= ((value
) << (2));
1674 fields
->f_7u9a4
= value
;
1677 case MEP_OPERAND_ZERO
:
1681 /* xgettext:c-format */
1682 fprintf (stderr
, _("Unrecognized field %d while decoding insn.\n"),
1690 cgen_insert_fn
* const mep_cgen_insert_handlers
[] =
1695 cgen_extract_fn
* const mep_cgen_extract_handlers
[] =
1697 extract_insn_normal
,
1700 int mep_cgen_get_int_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1701 bfd_vma
mep_cgen_get_vma_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1703 /* Getting values from cgen_fields is handled by a collection of functions.
1704 They are distinguished by the type of the VALUE argument they return.
1705 TODO: floating point, inlining support, remove cases where result type
1709 mep_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1711 const CGEN_FIELDS
* fields
)
1717 case MEP_OPERAND_ADDR24A4
:
1718 value
= fields
->f_24u8a4n
;
1720 case MEP_OPERAND_C5RMUIMM20
:
1721 value
= fields
->f_c5_rmuimm20
;
1723 case MEP_OPERAND_C5RNMUIMM24
:
1724 value
= fields
->f_c5_rnmuimm24
;
1726 case MEP_OPERAND_CALLNUM
:
1727 value
= fields
->f_callnum
;
1729 case MEP_OPERAND_CCCC
:
1730 value
= fields
->f_rm
;
1732 case MEP_OPERAND_CCRN
:
1733 value
= fields
->f_ccrn
;
1735 case MEP_OPERAND_CDISP10
:
1736 value
= fields
->f_cdisp10
;
1738 case MEP_OPERAND_CDISP10A2
:
1739 value
= fields
->f_cdisp10
;
1741 case MEP_OPERAND_CDISP10A4
:
1742 value
= fields
->f_cdisp10
;
1744 case MEP_OPERAND_CDISP10A8
:
1745 value
= fields
->f_cdisp10
;
1747 case MEP_OPERAND_CDISP12
:
1748 value
= fields
->f_12s20
;
1750 case MEP_OPERAND_CIMM4
:
1751 value
= fields
->f_rn
;
1753 case MEP_OPERAND_CIMM5
:
1754 value
= fields
->f_5u24
;
1756 case MEP_OPERAND_CODE16
:
1757 value
= fields
->f_16u16
;
1759 case MEP_OPERAND_CODE24
:
1760 value
= fields
->f_24u4n
;
1762 case MEP_OPERAND_CP_FLAG
:
1765 case MEP_OPERAND_CRN
:
1766 value
= fields
->f_crn
;
1768 case MEP_OPERAND_CRN64
:
1769 value
= fields
->f_crn
;
1771 case MEP_OPERAND_CRNX
:
1772 value
= fields
->f_crnx
;
1774 case MEP_OPERAND_CRNX64
:
1775 value
= fields
->f_crnx
;
1777 case MEP_OPERAND_CROC
:
1778 value
= fields
->f_ivc2_5u7
;
1780 case MEP_OPERAND_CROP
:
1781 value
= fields
->f_ivc2_5u23
;
1783 case MEP_OPERAND_CRPC
:
1784 value
= fields
->f_ivc2_5u26
;
1786 case MEP_OPERAND_CRPP
:
1787 value
= fields
->f_ivc2_5u18
;
1789 case MEP_OPERAND_CRQC
:
1790 value
= fields
->f_ivc2_5u21
;
1792 case MEP_OPERAND_CRQP
:
1793 value
= fields
->f_ivc2_5u13
;
1795 case MEP_OPERAND_CSRN
:
1796 value
= fields
->f_csrn
;
1798 case MEP_OPERAND_CSRN_IDX
:
1799 value
= fields
->f_csrn
;
1801 case MEP_OPERAND_DBG
:
1804 case MEP_OPERAND_DEPC
:
1807 case MEP_OPERAND_EPC
:
1810 case MEP_OPERAND_EXC
:
1813 case MEP_OPERAND_HI
:
1816 case MEP_OPERAND_IMM16P0
:
1817 value
= fields
->f_ivc2_imm16p0
;
1819 case MEP_OPERAND_IMM3P12
:
1820 value
= fields
->f_ivc2_3u12
;
1822 case MEP_OPERAND_IMM3P25
:
1823 value
= fields
->f_ivc2_3u25
;
1825 case MEP_OPERAND_IMM3P4
:
1826 value
= fields
->f_ivc2_3u4
;
1828 case MEP_OPERAND_IMM3P5
:
1829 value
= fields
->f_ivc2_3u5
;
1831 case MEP_OPERAND_IMM3P9
:
1832 value
= fields
->f_ivc2_3u9
;
1834 case MEP_OPERAND_IMM4P10
:
1835 value
= fields
->f_ivc2_4u10
;
1837 case MEP_OPERAND_IMM4P4
:
1838 value
= fields
->f_ivc2_4u4
;
1840 case MEP_OPERAND_IMM4P8
:
1841 value
= fields
->f_ivc2_4u8
;
1843 case MEP_OPERAND_IMM5P23
:
1844 value
= fields
->f_ivc2_5u23
;
1846 case MEP_OPERAND_IMM5P3
:
1847 value
= fields
->f_ivc2_5u3
;
1849 case MEP_OPERAND_IMM5P7
:
1850 value
= fields
->f_ivc2_5u7
;
1852 case MEP_OPERAND_IMM5P8
:
1853 value
= fields
->f_ivc2_5u8
;
1855 case MEP_OPERAND_IMM6P2
:
1856 value
= fields
->f_ivc2_6u2
;
1858 case MEP_OPERAND_IMM6P6
:
1859 value
= fields
->f_ivc2_6u6
;
1861 case MEP_OPERAND_IMM8P0
:
1862 value
= fields
->f_ivc2_8u0
;
1864 case MEP_OPERAND_IMM8P20
:
1865 value
= fields
->f_ivc2_8u20
;
1867 case MEP_OPERAND_IMM8P4
:
1868 value
= fields
->f_ivc2_8u4
;
1870 case MEP_OPERAND_IVC_X_0_2
:
1871 value
= fields
->f_ivc2_2u0
;
1873 case MEP_OPERAND_IVC_X_0_3
:
1874 value
= fields
->f_ivc2_3u0
;
1876 case MEP_OPERAND_IVC_X_0_4
:
1877 value
= fields
->f_ivc2_4u0
;
1879 case MEP_OPERAND_IVC_X_0_5
:
1880 value
= fields
->f_ivc2_5u0
;
1882 case MEP_OPERAND_IVC_X_6_1
:
1883 value
= fields
->f_ivc2_1u6
;
1885 case MEP_OPERAND_IVC_X_6_2
:
1886 value
= fields
->f_ivc2_2u6
;
1888 case MEP_OPERAND_IVC_X_6_3
:
1889 value
= fields
->f_ivc2_3u6
;
1891 case MEP_OPERAND_IVC2CCRN
:
1892 value
= fields
->f_ivc2_ccrn
;
1894 case MEP_OPERAND_IVC2CRN
:
1895 value
= fields
->f_ivc2_crnx
;
1897 case MEP_OPERAND_IVC2RM
:
1898 value
= fields
->f_ivc2_crm
;
1900 case MEP_OPERAND_LO
:
1903 case MEP_OPERAND_LP
:
1906 case MEP_OPERAND_MB0
:
1909 case MEP_OPERAND_MB1
:
1912 case MEP_OPERAND_ME0
:
1915 case MEP_OPERAND_ME1
:
1918 case MEP_OPERAND_NPC
:
1921 case MEP_OPERAND_OPT
:
1924 case MEP_OPERAND_PCABS24A2
:
1925 value
= fields
->f_24u5a2n
;
1927 case MEP_OPERAND_PCREL12A2
:
1928 value
= fields
->f_12s4a2
;
1930 case MEP_OPERAND_PCREL17A2
:
1931 value
= fields
->f_17s16a2
;
1933 case MEP_OPERAND_PCREL24A2
:
1934 value
= fields
->f_24s5a2n
;
1936 case MEP_OPERAND_PCREL8A2
:
1937 value
= fields
->f_8s8a2
;
1939 case MEP_OPERAND_PSW
:
1942 case MEP_OPERAND_R0
:
1945 case MEP_OPERAND_R1
:
1948 case MEP_OPERAND_RL
:
1949 value
= fields
->f_rl
;
1951 case MEP_OPERAND_RL5
:
1952 value
= fields
->f_rl5
;
1954 case MEP_OPERAND_RM
:
1955 value
= fields
->f_rm
;
1957 case MEP_OPERAND_RMA
:
1958 value
= fields
->f_rm
;
1960 case MEP_OPERAND_RN
:
1961 value
= fields
->f_rn
;
1963 case MEP_OPERAND_RN3
:
1964 value
= fields
->f_rn3
;
1966 case MEP_OPERAND_RN3C
:
1967 value
= fields
->f_rn3
;
1969 case MEP_OPERAND_RN3L
:
1970 value
= fields
->f_rn3
;
1972 case MEP_OPERAND_RN3S
:
1973 value
= fields
->f_rn3
;
1975 case MEP_OPERAND_RN3UC
:
1976 value
= fields
->f_rn3
;
1978 case MEP_OPERAND_RN3UL
:
1979 value
= fields
->f_rn3
;
1981 case MEP_OPERAND_RN3US
:
1982 value
= fields
->f_rn3
;
1984 case MEP_OPERAND_RNC
:
1985 value
= fields
->f_rn
;
1987 case MEP_OPERAND_RNL
:
1988 value
= fields
->f_rn
;
1990 case MEP_OPERAND_RNS
:
1991 value
= fields
->f_rn
;
1993 case MEP_OPERAND_RNUC
:
1994 value
= fields
->f_rn
;
1996 case MEP_OPERAND_RNUL
:
1997 value
= fields
->f_rn
;
1999 case MEP_OPERAND_RNUS
:
2000 value
= fields
->f_rn
;
2002 case MEP_OPERAND_SAR
:
2005 case MEP_OPERAND_SDISP16
:
2006 value
= fields
->f_16s16
;
2008 case MEP_OPERAND_SIMM16
:
2009 value
= fields
->f_16s16
;
2011 case MEP_OPERAND_SIMM16P0
:
2012 value
= fields
->f_ivc2_simm16p0
;
2014 case MEP_OPERAND_SIMM6
:
2015 value
= fields
->f_6s8
;
2017 case MEP_OPERAND_SIMM8
:
2018 value
= fields
->f_8s8
;
2020 case MEP_OPERAND_SIMM8P0
:
2021 value
= fields
->f_ivc2_8s0
;
2023 case MEP_OPERAND_SIMM8P4
:
2024 value
= fields
->f_ivc2_8s4
;
2026 case MEP_OPERAND_SP
:
2029 case MEP_OPERAND_SPR
:
2032 case MEP_OPERAND_TP
:
2035 case MEP_OPERAND_TPR
:
2038 case MEP_OPERAND_UDISP2
:
2039 value
= fields
->f_2u6
;
2041 case MEP_OPERAND_UDISP7
:
2042 value
= fields
->f_7u9
;
2044 case MEP_OPERAND_UDISP7A2
:
2045 value
= fields
->f_7u9a2
;
2047 case MEP_OPERAND_UDISP7A4
:
2048 value
= fields
->f_7u9a4
;
2050 case MEP_OPERAND_UIMM16
:
2051 value
= fields
->f_16u16
;
2053 case MEP_OPERAND_UIMM2
:
2054 value
= fields
->f_2u10
;
2056 case MEP_OPERAND_UIMM24
:
2057 value
= fields
->f_24u8n
;
2059 case MEP_OPERAND_UIMM3
:
2060 value
= fields
->f_3u5
;
2062 case MEP_OPERAND_UIMM4
:
2063 value
= fields
->f_4u8
;
2065 case MEP_OPERAND_UIMM5
:
2066 value
= fields
->f_5u8
;
2068 case MEP_OPERAND_UIMM7A4
:
2069 value
= fields
->f_7u9a4
;
2071 case MEP_OPERAND_ZERO
:
2076 /* xgettext:c-format */
2077 fprintf (stderr
, _("Unrecognized field %d while getting int operand.\n"),
2086 mep_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
2088 const CGEN_FIELDS
* fields
)
2094 case MEP_OPERAND_ADDR24A4
:
2095 value
= fields
->f_24u8a4n
;
2097 case MEP_OPERAND_C5RMUIMM20
:
2098 value
= fields
->f_c5_rmuimm20
;
2100 case MEP_OPERAND_C5RNMUIMM24
:
2101 value
= fields
->f_c5_rnmuimm24
;
2103 case MEP_OPERAND_CALLNUM
:
2104 value
= fields
->f_callnum
;
2106 case MEP_OPERAND_CCCC
:
2107 value
= fields
->f_rm
;
2109 case MEP_OPERAND_CCRN
:
2110 value
= fields
->f_ccrn
;
2112 case MEP_OPERAND_CDISP10
:
2113 value
= fields
->f_cdisp10
;
2115 case MEP_OPERAND_CDISP10A2
:
2116 value
= fields
->f_cdisp10
;
2118 case MEP_OPERAND_CDISP10A4
:
2119 value
= fields
->f_cdisp10
;
2121 case MEP_OPERAND_CDISP10A8
:
2122 value
= fields
->f_cdisp10
;
2124 case MEP_OPERAND_CDISP12
:
2125 value
= fields
->f_12s20
;
2127 case MEP_OPERAND_CIMM4
:
2128 value
= fields
->f_rn
;
2130 case MEP_OPERAND_CIMM5
:
2131 value
= fields
->f_5u24
;
2133 case MEP_OPERAND_CODE16
:
2134 value
= fields
->f_16u16
;
2136 case MEP_OPERAND_CODE24
:
2137 value
= fields
->f_24u4n
;
2139 case MEP_OPERAND_CP_FLAG
:
2142 case MEP_OPERAND_CRN
:
2143 value
= fields
->f_crn
;
2145 case MEP_OPERAND_CRN64
:
2146 value
= fields
->f_crn
;
2148 case MEP_OPERAND_CRNX
:
2149 value
= fields
->f_crnx
;
2151 case MEP_OPERAND_CRNX64
:
2152 value
= fields
->f_crnx
;
2154 case MEP_OPERAND_CROC
:
2155 value
= fields
->f_ivc2_5u7
;
2157 case MEP_OPERAND_CROP
:
2158 value
= fields
->f_ivc2_5u23
;
2160 case MEP_OPERAND_CRPC
:
2161 value
= fields
->f_ivc2_5u26
;
2163 case MEP_OPERAND_CRPP
:
2164 value
= fields
->f_ivc2_5u18
;
2166 case MEP_OPERAND_CRQC
:
2167 value
= fields
->f_ivc2_5u21
;
2169 case MEP_OPERAND_CRQP
:
2170 value
= fields
->f_ivc2_5u13
;
2172 case MEP_OPERAND_CSRN
:
2173 value
= fields
->f_csrn
;
2175 case MEP_OPERAND_CSRN_IDX
:
2176 value
= fields
->f_csrn
;
2178 case MEP_OPERAND_DBG
:
2181 case MEP_OPERAND_DEPC
:
2184 case MEP_OPERAND_EPC
:
2187 case MEP_OPERAND_EXC
:
2190 case MEP_OPERAND_HI
:
2193 case MEP_OPERAND_IMM16P0
:
2194 value
= fields
->f_ivc2_imm16p0
;
2196 case MEP_OPERAND_IMM3P12
:
2197 value
= fields
->f_ivc2_3u12
;
2199 case MEP_OPERAND_IMM3P25
:
2200 value
= fields
->f_ivc2_3u25
;
2202 case MEP_OPERAND_IMM3P4
:
2203 value
= fields
->f_ivc2_3u4
;
2205 case MEP_OPERAND_IMM3P5
:
2206 value
= fields
->f_ivc2_3u5
;
2208 case MEP_OPERAND_IMM3P9
:
2209 value
= fields
->f_ivc2_3u9
;
2211 case MEP_OPERAND_IMM4P10
:
2212 value
= fields
->f_ivc2_4u10
;
2214 case MEP_OPERAND_IMM4P4
:
2215 value
= fields
->f_ivc2_4u4
;
2217 case MEP_OPERAND_IMM4P8
:
2218 value
= fields
->f_ivc2_4u8
;
2220 case MEP_OPERAND_IMM5P23
:
2221 value
= fields
->f_ivc2_5u23
;
2223 case MEP_OPERAND_IMM5P3
:
2224 value
= fields
->f_ivc2_5u3
;
2226 case MEP_OPERAND_IMM5P7
:
2227 value
= fields
->f_ivc2_5u7
;
2229 case MEP_OPERAND_IMM5P8
:
2230 value
= fields
->f_ivc2_5u8
;
2232 case MEP_OPERAND_IMM6P2
:
2233 value
= fields
->f_ivc2_6u2
;
2235 case MEP_OPERAND_IMM6P6
:
2236 value
= fields
->f_ivc2_6u6
;
2238 case MEP_OPERAND_IMM8P0
:
2239 value
= fields
->f_ivc2_8u0
;
2241 case MEP_OPERAND_IMM8P20
:
2242 value
= fields
->f_ivc2_8u20
;
2244 case MEP_OPERAND_IMM8P4
:
2245 value
= fields
->f_ivc2_8u4
;
2247 case MEP_OPERAND_IVC_X_0_2
:
2248 value
= fields
->f_ivc2_2u0
;
2250 case MEP_OPERAND_IVC_X_0_3
:
2251 value
= fields
->f_ivc2_3u0
;
2253 case MEP_OPERAND_IVC_X_0_4
:
2254 value
= fields
->f_ivc2_4u0
;
2256 case MEP_OPERAND_IVC_X_0_5
:
2257 value
= fields
->f_ivc2_5u0
;
2259 case MEP_OPERAND_IVC_X_6_1
:
2260 value
= fields
->f_ivc2_1u6
;
2262 case MEP_OPERAND_IVC_X_6_2
:
2263 value
= fields
->f_ivc2_2u6
;
2265 case MEP_OPERAND_IVC_X_6_3
:
2266 value
= fields
->f_ivc2_3u6
;
2268 case MEP_OPERAND_IVC2CCRN
:
2269 value
= fields
->f_ivc2_ccrn
;
2271 case MEP_OPERAND_IVC2CRN
:
2272 value
= fields
->f_ivc2_crnx
;
2274 case MEP_OPERAND_IVC2RM
:
2275 value
= fields
->f_ivc2_crm
;
2277 case MEP_OPERAND_LO
:
2280 case MEP_OPERAND_LP
:
2283 case MEP_OPERAND_MB0
:
2286 case MEP_OPERAND_MB1
:
2289 case MEP_OPERAND_ME0
:
2292 case MEP_OPERAND_ME1
:
2295 case MEP_OPERAND_NPC
:
2298 case MEP_OPERAND_OPT
:
2301 case MEP_OPERAND_PCABS24A2
:
2302 value
= fields
->f_24u5a2n
;
2304 case MEP_OPERAND_PCREL12A2
:
2305 value
= fields
->f_12s4a2
;
2307 case MEP_OPERAND_PCREL17A2
:
2308 value
= fields
->f_17s16a2
;
2310 case MEP_OPERAND_PCREL24A2
:
2311 value
= fields
->f_24s5a2n
;
2313 case MEP_OPERAND_PCREL8A2
:
2314 value
= fields
->f_8s8a2
;
2316 case MEP_OPERAND_PSW
:
2319 case MEP_OPERAND_R0
:
2322 case MEP_OPERAND_R1
:
2325 case MEP_OPERAND_RL
:
2326 value
= fields
->f_rl
;
2328 case MEP_OPERAND_RL5
:
2329 value
= fields
->f_rl5
;
2331 case MEP_OPERAND_RM
:
2332 value
= fields
->f_rm
;
2334 case MEP_OPERAND_RMA
:
2335 value
= fields
->f_rm
;
2337 case MEP_OPERAND_RN
:
2338 value
= fields
->f_rn
;
2340 case MEP_OPERAND_RN3
:
2341 value
= fields
->f_rn3
;
2343 case MEP_OPERAND_RN3C
:
2344 value
= fields
->f_rn3
;
2346 case MEP_OPERAND_RN3L
:
2347 value
= fields
->f_rn3
;
2349 case MEP_OPERAND_RN3S
:
2350 value
= fields
->f_rn3
;
2352 case MEP_OPERAND_RN3UC
:
2353 value
= fields
->f_rn3
;
2355 case MEP_OPERAND_RN3UL
:
2356 value
= fields
->f_rn3
;
2358 case MEP_OPERAND_RN3US
:
2359 value
= fields
->f_rn3
;
2361 case MEP_OPERAND_RNC
:
2362 value
= fields
->f_rn
;
2364 case MEP_OPERAND_RNL
:
2365 value
= fields
->f_rn
;
2367 case MEP_OPERAND_RNS
:
2368 value
= fields
->f_rn
;
2370 case MEP_OPERAND_RNUC
:
2371 value
= fields
->f_rn
;
2373 case MEP_OPERAND_RNUL
:
2374 value
= fields
->f_rn
;
2376 case MEP_OPERAND_RNUS
:
2377 value
= fields
->f_rn
;
2379 case MEP_OPERAND_SAR
:
2382 case MEP_OPERAND_SDISP16
:
2383 value
= fields
->f_16s16
;
2385 case MEP_OPERAND_SIMM16
:
2386 value
= fields
->f_16s16
;
2388 case MEP_OPERAND_SIMM16P0
:
2389 value
= fields
->f_ivc2_simm16p0
;
2391 case MEP_OPERAND_SIMM6
:
2392 value
= fields
->f_6s8
;
2394 case MEP_OPERAND_SIMM8
:
2395 value
= fields
->f_8s8
;
2397 case MEP_OPERAND_SIMM8P0
:
2398 value
= fields
->f_ivc2_8s0
;
2400 case MEP_OPERAND_SIMM8P4
:
2401 value
= fields
->f_ivc2_8s4
;
2403 case MEP_OPERAND_SP
:
2406 case MEP_OPERAND_SPR
:
2409 case MEP_OPERAND_TP
:
2412 case MEP_OPERAND_TPR
:
2415 case MEP_OPERAND_UDISP2
:
2416 value
= fields
->f_2u6
;
2418 case MEP_OPERAND_UDISP7
:
2419 value
= fields
->f_7u9
;
2421 case MEP_OPERAND_UDISP7A2
:
2422 value
= fields
->f_7u9a2
;
2424 case MEP_OPERAND_UDISP7A4
:
2425 value
= fields
->f_7u9a4
;
2427 case MEP_OPERAND_UIMM16
:
2428 value
= fields
->f_16u16
;
2430 case MEP_OPERAND_UIMM2
:
2431 value
= fields
->f_2u10
;
2433 case MEP_OPERAND_UIMM24
:
2434 value
= fields
->f_24u8n
;
2436 case MEP_OPERAND_UIMM3
:
2437 value
= fields
->f_3u5
;
2439 case MEP_OPERAND_UIMM4
:
2440 value
= fields
->f_4u8
;
2442 case MEP_OPERAND_UIMM5
:
2443 value
= fields
->f_5u8
;
2445 case MEP_OPERAND_UIMM7A4
:
2446 value
= fields
->f_7u9a4
;
2448 case MEP_OPERAND_ZERO
:
2453 /* xgettext:c-format */
2454 fprintf (stderr
, _("Unrecognized field %d while getting vma operand.\n"),
2462 void mep_cgen_set_int_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, int);
2463 void mep_cgen_set_vma_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, bfd_vma
);
2465 /* Stuffing values in cgen_fields is handled by a collection of functions.
2466 They are distinguished by the type of the VALUE argument they accept.
2467 TODO: floating point, inlining support, remove cases where argument type
2471 mep_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
2473 CGEN_FIELDS
* fields
,
2478 case MEP_OPERAND_ADDR24A4
:
2479 fields
->f_24u8a4n
= value
;
2481 case MEP_OPERAND_C5RMUIMM20
:
2482 fields
->f_c5_rmuimm20
= value
;
2484 case MEP_OPERAND_C5RNMUIMM24
:
2485 fields
->f_c5_rnmuimm24
= value
;
2487 case MEP_OPERAND_CALLNUM
:
2488 fields
->f_callnum
= value
;
2490 case MEP_OPERAND_CCCC
:
2491 fields
->f_rm
= value
;
2493 case MEP_OPERAND_CCRN
:
2494 fields
->f_ccrn
= value
;
2496 case MEP_OPERAND_CDISP10
:
2497 fields
->f_cdisp10
= value
;
2499 case MEP_OPERAND_CDISP10A2
:
2500 fields
->f_cdisp10
= value
;
2502 case MEP_OPERAND_CDISP10A4
:
2503 fields
->f_cdisp10
= value
;
2505 case MEP_OPERAND_CDISP10A8
:
2506 fields
->f_cdisp10
= value
;
2508 case MEP_OPERAND_CDISP12
:
2509 fields
->f_12s20
= value
;
2511 case MEP_OPERAND_CIMM4
:
2512 fields
->f_rn
= value
;
2514 case MEP_OPERAND_CIMM5
:
2515 fields
->f_5u24
= value
;
2517 case MEP_OPERAND_CODE16
:
2518 fields
->f_16u16
= value
;
2520 case MEP_OPERAND_CODE24
:
2521 fields
->f_24u4n
= value
;
2523 case MEP_OPERAND_CP_FLAG
:
2525 case MEP_OPERAND_CRN
:
2526 fields
->f_crn
= value
;
2528 case MEP_OPERAND_CRN64
:
2529 fields
->f_crn
= value
;
2531 case MEP_OPERAND_CRNX
:
2532 fields
->f_crnx
= value
;
2534 case MEP_OPERAND_CRNX64
:
2535 fields
->f_crnx
= value
;
2537 case MEP_OPERAND_CROC
:
2538 fields
->f_ivc2_5u7
= value
;
2540 case MEP_OPERAND_CROP
:
2541 fields
->f_ivc2_5u23
= value
;
2543 case MEP_OPERAND_CRPC
:
2544 fields
->f_ivc2_5u26
= value
;
2546 case MEP_OPERAND_CRPP
:
2547 fields
->f_ivc2_5u18
= value
;
2549 case MEP_OPERAND_CRQC
:
2550 fields
->f_ivc2_5u21
= value
;
2552 case MEP_OPERAND_CRQP
:
2553 fields
->f_ivc2_5u13
= value
;
2555 case MEP_OPERAND_CSRN
:
2556 fields
->f_csrn
= value
;
2558 case MEP_OPERAND_CSRN_IDX
:
2559 fields
->f_csrn
= value
;
2561 case MEP_OPERAND_DBG
:
2563 case MEP_OPERAND_DEPC
:
2565 case MEP_OPERAND_EPC
:
2567 case MEP_OPERAND_EXC
:
2569 case MEP_OPERAND_HI
:
2571 case MEP_OPERAND_IMM16P0
:
2572 fields
->f_ivc2_imm16p0
= value
;
2574 case MEP_OPERAND_IMM3P12
:
2575 fields
->f_ivc2_3u12
= value
;
2577 case MEP_OPERAND_IMM3P25
:
2578 fields
->f_ivc2_3u25
= value
;
2580 case MEP_OPERAND_IMM3P4
:
2581 fields
->f_ivc2_3u4
= value
;
2583 case MEP_OPERAND_IMM3P5
:
2584 fields
->f_ivc2_3u5
= value
;
2586 case MEP_OPERAND_IMM3P9
:
2587 fields
->f_ivc2_3u9
= value
;
2589 case MEP_OPERAND_IMM4P10
:
2590 fields
->f_ivc2_4u10
= value
;
2592 case MEP_OPERAND_IMM4P4
:
2593 fields
->f_ivc2_4u4
= value
;
2595 case MEP_OPERAND_IMM4P8
:
2596 fields
->f_ivc2_4u8
= value
;
2598 case MEP_OPERAND_IMM5P23
:
2599 fields
->f_ivc2_5u23
= value
;
2601 case MEP_OPERAND_IMM5P3
:
2602 fields
->f_ivc2_5u3
= value
;
2604 case MEP_OPERAND_IMM5P7
:
2605 fields
->f_ivc2_5u7
= value
;
2607 case MEP_OPERAND_IMM5P8
:
2608 fields
->f_ivc2_5u8
= value
;
2610 case MEP_OPERAND_IMM6P2
:
2611 fields
->f_ivc2_6u2
= value
;
2613 case MEP_OPERAND_IMM6P6
:
2614 fields
->f_ivc2_6u6
= value
;
2616 case MEP_OPERAND_IMM8P0
:
2617 fields
->f_ivc2_8u0
= value
;
2619 case MEP_OPERAND_IMM8P20
:
2620 fields
->f_ivc2_8u20
= value
;
2622 case MEP_OPERAND_IMM8P4
:
2623 fields
->f_ivc2_8u4
= value
;
2625 case MEP_OPERAND_IVC_X_0_2
:
2626 fields
->f_ivc2_2u0
= value
;
2628 case MEP_OPERAND_IVC_X_0_3
:
2629 fields
->f_ivc2_3u0
= value
;
2631 case MEP_OPERAND_IVC_X_0_4
:
2632 fields
->f_ivc2_4u0
= value
;
2634 case MEP_OPERAND_IVC_X_0_5
:
2635 fields
->f_ivc2_5u0
= value
;
2637 case MEP_OPERAND_IVC_X_6_1
:
2638 fields
->f_ivc2_1u6
= value
;
2640 case MEP_OPERAND_IVC_X_6_2
:
2641 fields
->f_ivc2_2u6
= value
;
2643 case MEP_OPERAND_IVC_X_6_3
:
2644 fields
->f_ivc2_3u6
= value
;
2646 case MEP_OPERAND_IVC2CCRN
:
2647 fields
->f_ivc2_ccrn
= value
;
2649 case MEP_OPERAND_IVC2CRN
:
2650 fields
->f_ivc2_crnx
= value
;
2652 case MEP_OPERAND_IVC2RM
:
2653 fields
->f_ivc2_crm
= value
;
2655 case MEP_OPERAND_LO
:
2657 case MEP_OPERAND_LP
:
2659 case MEP_OPERAND_MB0
:
2661 case MEP_OPERAND_MB1
:
2663 case MEP_OPERAND_ME0
:
2665 case MEP_OPERAND_ME1
:
2667 case MEP_OPERAND_NPC
:
2669 case MEP_OPERAND_OPT
:
2671 case MEP_OPERAND_PCABS24A2
:
2672 fields
->f_24u5a2n
= value
;
2674 case MEP_OPERAND_PCREL12A2
:
2675 fields
->f_12s4a2
= value
;
2677 case MEP_OPERAND_PCREL17A2
:
2678 fields
->f_17s16a2
= value
;
2680 case MEP_OPERAND_PCREL24A2
:
2681 fields
->f_24s5a2n
= value
;
2683 case MEP_OPERAND_PCREL8A2
:
2684 fields
->f_8s8a2
= value
;
2686 case MEP_OPERAND_PSW
:
2688 case MEP_OPERAND_R0
:
2690 case MEP_OPERAND_R1
:
2692 case MEP_OPERAND_RL
:
2693 fields
->f_rl
= value
;
2695 case MEP_OPERAND_RL5
:
2696 fields
->f_rl5
= value
;
2698 case MEP_OPERAND_RM
:
2699 fields
->f_rm
= value
;
2701 case MEP_OPERAND_RMA
:
2702 fields
->f_rm
= value
;
2704 case MEP_OPERAND_RN
:
2705 fields
->f_rn
= value
;
2707 case MEP_OPERAND_RN3
:
2708 fields
->f_rn3
= value
;
2710 case MEP_OPERAND_RN3C
:
2711 fields
->f_rn3
= value
;
2713 case MEP_OPERAND_RN3L
:
2714 fields
->f_rn3
= value
;
2716 case MEP_OPERAND_RN3S
:
2717 fields
->f_rn3
= value
;
2719 case MEP_OPERAND_RN3UC
:
2720 fields
->f_rn3
= value
;
2722 case MEP_OPERAND_RN3UL
:
2723 fields
->f_rn3
= value
;
2725 case MEP_OPERAND_RN3US
:
2726 fields
->f_rn3
= value
;
2728 case MEP_OPERAND_RNC
:
2729 fields
->f_rn
= value
;
2731 case MEP_OPERAND_RNL
:
2732 fields
->f_rn
= value
;
2734 case MEP_OPERAND_RNS
:
2735 fields
->f_rn
= value
;
2737 case MEP_OPERAND_RNUC
:
2738 fields
->f_rn
= value
;
2740 case MEP_OPERAND_RNUL
:
2741 fields
->f_rn
= value
;
2743 case MEP_OPERAND_RNUS
:
2744 fields
->f_rn
= value
;
2746 case MEP_OPERAND_SAR
:
2748 case MEP_OPERAND_SDISP16
:
2749 fields
->f_16s16
= value
;
2751 case MEP_OPERAND_SIMM16
:
2752 fields
->f_16s16
= value
;
2754 case MEP_OPERAND_SIMM16P0
:
2755 fields
->f_ivc2_simm16p0
= value
;
2757 case MEP_OPERAND_SIMM6
:
2758 fields
->f_6s8
= value
;
2760 case MEP_OPERAND_SIMM8
:
2761 fields
->f_8s8
= value
;
2763 case MEP_OPERAND_SIMM8P0
:
2764 fields
->f_ivc2_8s0
= value
;
2766 case MEP_OPERAND_SIMM8P4
:
2767 fields
->f_ivc2_8s4
= value
;
2769 case MEP_OPERAND_SP
:
2771 case MEP_OPERAND_SPR
:
2773 case MEP_OPERAND_TP
:
2775 case MEP_OPERAND_TPR
:
2777 case MEP_OPERAND_UDISP2
:
2778 fields
->f_2u6
= value
;
2780 case MEP_OPERAND_UDISP7
:
2781 fields
->f_7u9
= value
;
2783 case MEP_OPERAND_UDISP7A2
:
2784 fields
->f_7u9a2
= value
;
2786 case MEP_OPERAND_UDISP7A4
:
2787 fields
->f_7u9a4
= value
;
2789 case MEP_OPERAND_UIMM16
:
2790 fields
->f_16u16
= value
;
2792 case MEP_OPERAND_UIMM2
:
2793 fields
->f_2u10
= value
;
2795 case MEP_OPERAND_UIMM24
:
2796 fields
->f_24u8n
= value
;
2798 case MEP_OPERAND_UIMM3
:
2799 fields
->f_3u5
= value
;
2801 case MEP_OPERAND_UIMM4
:
2802 fields
->f_4u8
= value
;
2804 case MEP_OPERAND_UIMM5
:
2805 fields
->f_5u8
= value
;
2807 case MEP_OPERAND_UIMM7A4
:
2808 fields
->f_7u9a4
= value
;
2810 case MEP_OPERAND_ZERO
:
2814 /* xgettext:c-format */
2815 fprintf (stderr
, _("Unrecognized field %d while setting int operand.\n"),
2822 mep_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
2824 CGEN_FIELDS
* fields
,
2829 case MEP_OPERAND_ADDR24A4
:
2830 fields
->f_24u8a4n
= value
;
2832 case MEP_OPERAND_C5RMUIMM20
:
2833 fields
->f_c5_rmuimm20
= value
;
2835 case MEP_OPERAND_C5RNMUIMM24
:
2836 fields
->f_c5_rnmuimm24
= value
;
2838 case MEP_OPERAND_CALLNUM
:
2839 fields
->f_callnum
= value
;
2841 case MEP_OPERAND_CCCC
:
2842 fields
->f_rm
= value
;
2844 case MEP_OPERAND_CCRN
:
2845 fields
->f_ccrn
= value
;
2847 case MEP_OPERAND_CDISP10
:
2848 fields
->f_cdisp10
= value
;
2850 case MEP_OPERAND_CDISP10A2
:
2851 fields
->f_cdisp10
= value
;
2853 case MEP_OPERAND_CDISP10A4
:
2854 fields
->f_cdisp10
= value
;
2856 case MEP_OPERAND_CDISP10A8
:
2857 fields
->f_cdisp10
= value
;
2859 case MEP_OPERAND_CDISP12
:
2860 fields
->f_12s20
= value
;
2862 case MEP_OPERAND_CIMM4
:
2863 fields
->f_rn
= value
;
2865 case MEP_OPERAND_CIMM5
:
2866 fields
->f_5u24
= value
;
2868 case MEP_OPERAND_CODE16
:
2869 fields
->f_16u16
= value
;
2871 case MEP_OPERAND_CODE24
:
2872 fields
->f_24u4n
= value
;
2874 case MEP_OPERAND_CP_FLAG
:
2876 case MEP_OPERAND_CRN
:
2877 fields
->f_crn
= value
;
2879 case MEP_OPERAND_CRN64
:
2880 fields
->f_crn
= value
;
2882 case MEP_OPERAND_CRNX
:
2883 fields
->f_crnx
= value
;
2885 case MEP_OPERAND_CRNX64
:
2886 fields
->f_crnx
= value
;
2888 case MEP_OPERAND_CROC
:
2889 fields
->f_ivc2_5u7
= value
;
2891 case MEP_OPERAND_CROP
:
2892 fields
->f_ivc2_5u23
= value
;
2894 case MEP_OPERAND_CRPC
:
2895 fields
->f_ivc2_5u26
= value
;
2897 case MEP_OPERAND_CRPP
:
2898 fields
->f_ivc2_5u18
= value
;
2900 case MEP_OPERAND_CRQC
:
2901 fields
->f_ivc2_5u21
= value
;
2903 case MEP_OPERAND_CRQP
:
2904 fields
->f_ivc2_5u13
= value
;
2906 case MEP_OPERAND_CSRN
:
2907 fields
->f_csrn
= value
;
2909 case MEP_OPERAND_CSRN_IDX
:
2910 fields
->f_csrn
= value
;
2912 case MEP_OPERAND_DBG
:
2914 case MEP_OPERAND_DEPC
:
2916 case MEP_OPERAND_EPC
:
2918 case MEP_OPERAND_EXC
:
2920 case MEP_OPERAND_HI
:
2922 case MEP_OPERAND_IMM16P0
:
2923 fields
->f_ivc2_imm16p0
= value
;
2925 case MEP_OPERAND_IMM3P12
:
2926 fields
->f_ivc2_3u12
= value
;
2928 case MEP_OPERAND_IMM3P25
:
2929 fields
->f_ivc2_3u25
= value
;
2931 case MEP_OPERAND_IMM3P4
:
2932 fields
->f_ivc2_3u4
= value
;
2934 case MEP_OPERAND_IMM3P5
:
2935 fields
->f_ivc2_3u5
= value
;
2937 case MEP_OPERAND_IMM3P9
:
2938 fields
->f_ivc2_3u9
= value
;
2940 case MEP_OPERAND_IMM4P10
:
2941 fields
->f_ivc2_4u10
= value
;
2943 case MEP_OPERAND_IMM4P4
:
2944 fields
->f_ivc2_4u4
= value
;
2946 case MEP_OPERAND_IMM4P8
:
2947 fields
->f_ivc2_4u8
= value
;
2949 case MEP_OPERAND_IMM5P23
:
2950 fields
->f_ivc2_5u23
= value
;
2952 case MEP_OPERAND_IMM5P3
:
2953 fields
->f_ivc2_5u3
= value
;
2955 case MEP_OPERAND_IMM5P7
:
2956 fields
->f_ivc2_5u7
= value
;
2958 case MEP_OPERAND_IMM5P8
:
2959 fields
->f_ivc2_5u8
= value
;
2961 case MEP_OPERAND_IMM6P2
:
2962 fields
->f_ivc2_6u2
= value
;
2964 case MEP_OPERAND_IMM6P6
:
2965 fields
->f_ivc2_6u6
= value
;
2967 case MEP_OPERAND_IMM8P0
:
2968 fields
->f_ivc2_8u0
= value
;
2970 case MEP_OPERAND_IMM8P20
:
2971 fields
->f_ivc2_8u20
= value
;
2973 case MEP_OPERAND_IMM8P4
:
2974 fields
->f_ivc2_8u4
= value
;
2976 case MEP_OPERAND_IVC_X_0_2
:
2977 fields
->f_ivc2_2u0
= value
;
2979 case MEP_OPERAND_IVC_X_0_3
:
2980 fields
->f_ivc2_3u0
= value
;
2982 case MEP_OPERAND_IVC_X_0_4
:
2983 fields
->f_ivc2_4u0
= value
;
2985 case MEP_OPERAND_IVC_X_0_5
:
2986 fields
->f_ivc2_5u0
= value
;
2988 case MEP_OPERAND_IVC_X_6_1
:
2989 fields
->f_ivc2_1u6
= value
;
2991 case MEP_OPERAND_IVC_X_6_2
:
2992 fields
->f_ivc2_2u6
= value
;
2994 case MEP_OPERAND_IVC_X_6_3
:
2995 fields
->f_ivc2_3u6
= value
;
2997 case MEP_OPERAND_IVC2CCRN
:
2998 fields
->f_ivc2_ccrn
= value
;
3000 case MEP_OPERAND_IVC2CRN
:
3001 fields
->f_ivc2_crnx
= value
;
3003 case MEP_OPERAND_IVC2RM
:
3004 fields
->f_ivc2_crm
= value
;
3006 case MEP_OPERAND_LO
:
3008 case MEP_OPERAND_LP
:
3010 case MEP_OPERAND_MB0
:
3012 case MEP_OPERAND_MB1
:
3014 case MEP_OPERAND_ME0
:
3016 case MEP_OPERAND_ME1
:
3018 case MEP_OPERAND_NPC
:
3020 case MEP_OPERAND_OPT
:
3022 case MEP_OPERAND_PCABS24A2
:
3023 fields
->f_24u5a2n
= value
;
3025 case MEP_OPERAND_PCREL12A2
:
3026 fields
->f_12s4a2
= value
;
3028 case MEP_OPERAND_PCREL17A2
:
3029 fields
->f_17s16a2
= value
;
3031 case MEP_OPERAND_PCREL24A2
:
3032 fields
->f_24s5a2n
= value
;
3034 case MEP_OPERAND_PCREL8A2
:
3035 fields
->f_8s8a2
= value
;
3037 case MEP_OPERAND_PSW
:
3039 case MEP_OPERAND_R0
:
3041 case MEP_OPERAND_R1
:
3043 case MEP_OPERAND_RL
:
3044 fields
->f_rl
= value
;
3046 case MEP_OPERAND_RL5
:
3047 fields
->f_rl5
= value
;
3049 case MEP_OPERAND_RM
:
3050 fields
->f_rm
= value
;
3052 case MEP_OPERAND_RMA
:
3053 fields
->f_rm
= value
;
3055 case MEP_OPERAND_RN
:
3056 fields
->f_rn
= value
;
3058 case MEP_OPERAND_RN3
:
3059 fields
->f_rn3
= value
;
3061 case MEP_OPERAND_RN3C
:
3062 fields
->f_rn3
= value
;
3064 case MEP_OPERAND_RN3L
:
3065 fields
->f_rn3
= value
;
3067 case MEP_OPERAND_RN3S
:
3068 fields
->f_rn3
= value
;
3070 case MEP_OPERAND_RN3UC
:
3071 fields
->f_rn3
= value
;
3073 case MEP_OPERAND_RN3UL
:
3074 fields
->f_rn3
= value
;
3076 case MEP_OPERAND_RN3US
:
3077 fields
->f_rn3
= value
;
3079 case MEP_OPERAND_RNC
:
3080 fields
->f_rn
= value
;
3082 case MEP_OPERAND_RNL
:
3083 fields
->f_rn
= value
;
3085 case MEP_OPERAND_RNS
:
3086 fields
->f_rn
= value
;
3088 case MEP_OPERAND_RNUC
:
3089 fields
->f_rn
= value
;
3091 case MEP_OPERAND_RNUL
:
3092 fields
->f_rn
= value
;
3094 case MEP_OPERAND_RNUS
:
3095 fields
->f_rn
= value
;
3097 case MEP_OPERAND_SAR
:
3099 case MEP_OPERAND_SDISP16
:
3100 fields
->f_16s16
= value
;
3102 case MEP_OPERAND_SIMM16
:
3103 fields
->f_16s16
= value
;
3105 case MEP_OPERAND_SIMM16P0
:
3106 fields
->f_ivc2_simm16p0
= value
;
3108 case MEP_OPERAND_SIMM6
:
3109 fields
->f_6s8
= value
;
3111 case MEP_OPERAND_SIMM8
:
3112 fields
->f_8s8
= value
;
3114 case MEP_OPERAND_SIMM8P0
:
3115 fields
->f_ivc2_8s0
= value
;
3117 case MEP_OPERAND_SIMM8P4
:
3118 fields
->f_ivc2_8s4
= value
;
3120 case MEP_OPERAND_SP
:
3122 case MEP_OPERAND_SPR
:
3124 case MEP_OPERAND_TP
:
3126 case MEP_OPERAND_TPR
:
3128 case MEP_OPERAND_UDISP2
:
3129 fields
->f_2u6
= value
;
3131 case MEP_OPERAND_UDISP7
:
3132 fields
->f_7u9
= value
;
3134 case MEP_OPERAND_UDISP7A2
:
3135 fields
->f_7u9a2
= value
;
3137 case MEP_OPERAND_UDISP7A4
:
3138 fields
->f_7u9a4
= value
;
3140 case MEP_OPERAND_UIMM16
:
3141 fields
->f_16u16
= value
;
3143 case MEP_OPERAND_UIMM2
:
3144 fields
->f_2u10
= value
;
3146 case MEP_OPERAND_UIMM24
:
3147 fields
->f_24u8n
= value
;
3149 case MEP_OPERAND_UIMM3
:
3150 fields
->f_3u5
= value
;
3152 case MEP_OPERAND_UIMM4
:
3153 fields
->f_4u8
= value
;
3155 case MEP_OPERAND_UIMM5
:
3156 fields
->f_5u8
= value
;
3158 case MEP_OPERAND_UIMM7A4
:
3159 fields
->f_7u9a4
= value
;
3161 case MEP_OPERAND_ZERO
:
3165 /* xgettext:c-format */
3166 fprintf (stderr
, _("Unrecognized field %d while setting vma operand.\n"),
3172 /* Function to call before using the instruction builder tables. */
3175 mep_cgen_init_ibld_table (CGEN_CPU_DESC cd
)
3177 cd
->insert_handlers
= & mep_cgen_insert_handlers
[0];
3178 cd
->extract_handlers
= & mep_cgen_extract_handlers
[0];
3180 cd
->insert_operand
= mep_cgen_insert_operand
;
3181 cd
->extract_operand
= mep_cgen_extract_operand
;
3183 cd
->get_int_operand
= mep_cgen_get_int_operand
;
3184 cd
->set_int_operand
= mep_cgen_set_int_operand
;
3185 cd
->get_vma_operand
= mep_cgen_get_vma_operand
;
3186 cd
->set_vma_operand
= mep_cgen_set_vma_operand
;