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));
653 errmsg = insert_normal (cd, value, 0, 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));
660 errmsg = insert_normal (cd, value, 0, 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));
667 errmsg = insert_normal (cd, value, 0, 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));
674 errmsg = insert_normal (cd, value, 0, 0, 22, 10, 32, total_length, buffer);
677 case MEP_OPERAND_CDISP12 :
678 errmsg = insert_normal (cd, fields->f_12s20, 0, 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_CSRN :
742 FLD (f_csrn_lo) = ((FLD (f_csrn)) & (15));
743 FLD (f_csrn_hi) = ((unsigned int) (FLD (f_csrn)) >> (4));
745 errmsg = insert_normal (cd, fields->f_csrn_hi, 0, 0, 15, 1, 32, total_length, buffer);
748 errmsg = insert_normal (cd, fields->f_csrn_lo, 0, 0, 8, 4, 32, total_length, buffer);
753 case MEP_OPERAND_CSRN_IDX :
756 FLD (f_csrn_lo) = ((FLD (f_csrn)) & (15));
757 FLD (f_csrn_hi) = ((unsigned int) (FLD (f_csrn)) >> (4));
759 errmsg = insert_normal (cd, fields->f_csrn_hi, 0, 0, 15, 1, 32, total_length, buffer);
762 errmsg = insert_normal (cd, fields->f_csrn_lo, 0, 0, 8, 4, 32, total_length, buffer);
767 case MEP_OPERAND_DBG :
769 case MEP_OPERAND_DEPC :
771 case MEP_OPERAND_EPC :
773 case MEP_OPERAND_EXC :
775 case MEP_OPERAND_HI :
777 case MEP_OPERAND_LO :
779 case MEP_OPERAND_LP :
781 case MEP_OPERAND_MB0 :
783 case MEP_OPERAND_MB1 :
785 case MEP_OPERAND_ME0 :
787 case MEP_OPERAND_ME1 :
789 case MEP_OPERAND_NPC :
791 case MEP_OPERAND_OPT :
793 case MEP_OPERAND_PCABS24A2 :
796 FLD (f_24u5a2n_lo) = ((unsigned int) (((FLD (f_24u5a2n)) & (255))) >> (1));
797 FLD (f_24u5a2n_hi) = ((unsigned int) (FLD (f_24u5a2n)) >> (8));
799 errmsg = insert_normal (cd, fields->f_24u5a2n_hi, 0, 0, 16, 16, 32, total_length, buffer);
802 errmsg = insert_normal (cd, fields->f_24u5a2n_lo, 0, 0, 5, 7, 32, total_length, buffer);
807 case MEP_OPERAND_PCREL12A2 :
809 long value = fields->f_12s4a2;
810 value = ((int) (((value) - (pc))) >> (1));
811 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 4, 11, 32, total_length, buffer);
814 case MEP_OPERAND_PCREL17A2 :
816 long value = fields->f_17s16a2;
817 value = ((int) (((value) - (pc))) >> (1));
818 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 16, 16, 32, total_length, buffer);
821 case MEP_OPERAND_PCREL24A2 :
824 FLD (f_24s5a2n) = ((FLD (f_24s5a2n)) - (pc));
825 FLD (f_24s5a2n_lo) = ((unsigned int) (((FLD (f_24s5a2n)) & (254))) >> (1));
826 FLD (f_24s5a2n_hi) = ((int) (FLD (f_24s5a2n)) >> (8));
828 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);
831 errmsg = insert_normal (cd, fields->f_24s5a2n_lo, 0|(1<<CGEN_IFLD_PCREL_ADDR), 0, 5, 7, 32, total_length, buffer);
836 case MEP_OPERAND_PCREL8A2 :
838 long value = fields->f_8s8a2;
839 value = ((int) (((value) - (pc))) >> (1));
840 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 8, 7, 32, total_length, buffer);
843 case MEP_OPERAND_PSW :
845 case MEP_OPERAND_R0 :
847 case MEP_OPERAND_R1 :
849 case MEP_OPERAND_RL :
850 errmsg = insert_normal (cd, fields->f_rl, 0, 0, 12, 4, 32, total_length, buffer);
852 case MEP_OPERAND_RL5 :
853 errmsg = insert_normal (cd, fields->f_rl5, 0, 0, 20, 4, 32, total_length, buffer);
855 case MEP_OPERAND_RM :
856 errmsg = insert_normal (cd, fields->f_rm, 0, 0, 8, 4, 32, total_length, buffer);
858 case MEP_OPERAND_RMA :
859 errmsg = insert_normal (cd, fields->f_rm, 0, 0, 8, 4, 32, total_length, buffer);
861 case MEP_OPERAND_RN :
862 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
864 case MEP_OPERAND_RN3 :
865 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
867 case MEP_OPERAND_RN3C :
868 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
870 case MEP_OPERAND_RN3L :
871 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
873 case MEP_OPERAND_RN3S :
874 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
876 case MEP_OPERAND_RN3UC :
877 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
879 case MEP_OPERAND_RN3UL :
880 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
882 case MEP_OPERAND_RN3US :
883 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
885 case MEP_OPERAND_RNC :
886 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
888 case MEP_OPERAND_RNL :
889 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
891 case MEP_OPERAND_RNS :
892 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
894 case MEP_OPERAND_RNUC :
895 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
897 case MEP_OPERAND_RNUL :
898 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
900 case MEP_OPERAND_RNUS :
901 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
903 case MEP_OPERAND_SAR :
905 case MEP_OPERAND_SDISP16 :
906 errmsg = insert_normal (cd, fields->f_16s16, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, buffer);
908 case MEP_OPERAND_SIMM16 :
909 errmsg = insert_normal (cd, fields->f_16s16, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, buffer);
911 case MEP_OPERAND_SIMM6 :
912 errmsg = insert_normal (cd, fields->f_6s8, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 6, 32, total_length, buffer);
914 case MEP_OPERAND_SIMM8 :
915 errmsg = insert_normal (cd, fields->f_8s8, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 8, 32, total_length, buffer);
917 case MEP_OPERAND_SP :
919 case MEP_OPERAND_SPR :
921 case MEP_OPERAND_TP :
923 case MEP_OPERAND_TPR :
925 case MEP_OPERAND_UDISP2 :
926 errmsg = insert_normal (cd, fields->f_2u6, 0, 0, 6, 2, 32, total_length, buffer);
928 case MEP_OPERAND_UDISP7 :
929 errmsg = insert_normal (cd, fields->f_7u9, 0, 0, 9, 7, 32, total_length, buffer);
931 case MEP_OPERAND_UDISP7A2 :
933 long value = fields->f_7u9a2;
934 value = ((unsigned int) (value) >> (1));
935 errmsg = insert_normal (cd, value, 0, 0, 9, 6, 32, total_length, buffer);
938 case MEP_OPERAND_UDISP7A4 :
940 long value = fields->f_7u9a4;
941 value = ((unsigned int) (value) >> (2));
942 errmsg = insert_normal (cd, value, 0, 0, 9, 5, 32, total_length, buffer);
945 case MEP_OPERAND_UIMM16 :
946 errmsg = insert_normal (cd, fields->f_16u16, 0, 0, 16, 16, 32, total_length, buffer);
948 case MEP_OPERAND_UIMM2 :
949 errmsg = insert_normal (cd, fields->f_2u10, 0, 0, 10, 2, 32, total_length, buffer);
951 case MEP_OPERAND_UIMM24 :
954 FLD (f_24u8n_hi) = ((unsigned int) (FLD (f_24u8n)) >> (8));
955 FLD (f_24u8n_lo) = ((FLD (f_24u8n)) & (255));
957 errmsg = insert_normal (cd, fields->f_24u8n_hi, 0, 0, 16, 16, 32, total_length, buffer);
960 errmsg = insert_normal (cd, fields->f_24u8n_lo, 0, 0, 8, 8, 32, total_length, buffer);
965 case MEP_OPERAND_UIMM3 :
966 errmsg = insert_normal (cd, fields->f_3u5, 0, 0, 5, 3, 32, total_length, buffer);
968 case MEP_OPERAND_UIMM4 :
969 errmsg = insert_normal (cd, fields->f_4u8, 0, 0, 8, 4, 32, total_length, buffer);
971 case MEP_OPERAND_UIMM5 :
972 errmsg = insert_normal (cd, fields->f_5u8, 0, 0, 8, 5, 32, total_length, buffer);
974 case MEP_OPERAND_UIMM7A4 :
976 long value = fields->f_7u9a4;
977 value = ((unsigned int) (value) >> (2));
978 errmsg = insert_normal (cd, value, 0, 0, 9, 5, 32, total_length, buffer);
981 case MEP_OPERAND_ZERO :
985 /* xgettext:c-format */
986 fprintf (stderr, _("Unrecognized field %d while building insn.\n"),
994 int mep_cgen_extract_operand
995 (CGEN_CPU_DESC, int, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma);
997 /* Main entry point for operand extraction.
998 The result is <= 0 for error, >0 for success.
999 ??? Actual values aren't well defined right now.
1001 This function is basically just a big switch statement. Earlier versions
1002 used tables to look up the function to use, but
1003 - if the table contains both assembler and disassembler functions then
1004 the disassembler contains much of the assembler and vice-versa,
1005 - there's a lot of inlining possibilities as things grow,
1006 - using a switch statement avoids the function call overhead.
1008 This function could be moved into `print_insn_normal', but keeping it
1009 separate makes clear the interface between `print_insn_normal' and each of
1013 mep_cgen_extract_operand (CGEN_CPU_DESC cd,
1015 CGEN_EXTRACT_INFO *ex_info,
1016 CGEN_INSN_INT insn_value,
1017 CGEN_FIELDS * fields,
1020 /* Assume success (for those operands that are nops). */
1022 unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);
1026 case MEP_OPERAND_ADDR24A4 :
1028 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u8a4n_hi);
1029 if (length <= 0) break;
1030 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 6, 32, total_length, pc, & fields->f_24u8a4n_lo);
1031 if (length <= 0) break;
1032 FLD (f_24u8a4n) = ((((FLD (f_24u8a4n_hi)) << (8))) | (((FLD (f_24u8a4n_lo)) << (2))));
1035 case MEP_OPERAND_C5RMUIMM20 :
1037 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_c5_rm);
1038 if (length <= 0) break;
1039 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_c5_16u16);
1040 if (length <= 0) break;
1042 FLD (f_c5_rmuimm20) = ((FLD (f_c5_16u16)) | (((FLD (f_c5_rm)) << (16))));
1046 case MEP_OPERAND_C5RNMUIMM24 :
1048 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 8, 32, total_length, pc, & fields->f_c5_rnm);
1049 if (length <= 0) break;
1050 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_c5_16u16);
1051 if (length <= 0) break;
1053 FLD (f_c5_rnmuimm24) = ((FLD (f_c5_16u16)) | (((FLD (f_c5_rnm)) << (16))));
1057 case MEP_OPERAND_CALLNUM :
1059 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 1, 32, total_length, pc, & fields->f_5);
1060 if (length <= 0) break;
1061 length = extract_normal (cd, ex_info, insn_value, 0, 0, 6, 1, 32, total_length, pc, & fields->f_6);
1062 if (length <= 0) break;
1063 length = extract_normal (cd, ex_info, insn_value, 0, 0, 7, 1, 32, total_length, pc, & fields->f_7);
1064 if (length <= 0) break;
1065 length = extract_normal (cd, ex_info, insn_value, 0, 0, 11, 1, 32, total_length, pc, & fields->f_11);
1066 if (length <= 0) break;
1067 FLD (f_callnum) = ((((FLD (f_5)) << (3))) | (((((FLD (f_6)) << (2))) | (((((FLD (f_7)) << (1))) | (FLD (f_11)))))));
1070 case MEP_OPERAND_CCCC :
1071 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_rm);
1073 case MEP_OPERAND_CCRN :
1075 length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 2, 32, total_length, pc, & fields->f_ccrn_hi);
1076 if (length <= 0) break;
1077 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_ccrn_lo);
1078 if (length <= 0) break;
1079 FLD (f_ccrn) = ((((FLD (f_ccrn_hi)) << (4))) | (FLD (f_ccrn_lo)));
1082 case MEP_OPERAND_CDISP10 :
1085 length = extract_normal (cd, ex_info, insn_value, 0, 0, 22, 10, 32, total_length, pc, & value);
1086 value = ((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value));
1087 fields->f_cdisp10 = value;
1090 case MEP_OPERAND_CDISP10A2 :
1093 length = extract_normal (cd, ex_info, insn_value, 0, 0, 22, 10, 32, total_length, pc, & value);
1094 value = ((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value));
1095 fields->f_cdisp10 = value;
1098 case MEP_OPERAND_CDISP10A4 :
1101 length = extract_normal (cd, ex_info, insn_value, 0, 0, 22, 10, 32, total_length, pc, & value);
1102 value = ((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value));
1103 fields->f_cdisp10 = value;
1106 case MEP_OPERAND_CDISP10A8 :
1109 length = extract_normal (cd, ex_info, insn_value, 0, 0, 22, 10, 32, total_length, pc, & value);
1110 value = ((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value));
1111 fields->f_cdisp10 = value;
1114 case MEP_OPERAND_CDISP12 :
1115 length = extract_normal (cd, ex_info, insn_value, 0, 0, 20, 12, 32, total_length, pc, & fields->f_12s20);
1117 case MEP_OPERAND_CIMM4 :
1118 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1120 case MEP_OPERAND_CIMM5 :
1121 length = extract_normal (cd, ex_info, insn_value, 0, 0, 24, 5, 32, total_length, pc, & fields->f_5u24);
1123 case MEP_OPERAND_CODE16 :
1124 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_16u16);
1126 case MEP_OPERAND_CODE24 :
1128 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 8, 32, total_length, pc, & fields->f_24u4n_hi);
1129 if (length <= 0) break;
1130 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u4n_lo);
1131 if (length <= 0) break;
1132 FLD (f_24u4n) = ((((FLD (f_24u4n_hi)) << (16))) | (FLD (f_24u4n_lo)));
1135 case MEP_OPERAND_CP_FLAG :
1137 case MEP_OPERAND_CRN :
1138 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crn);
1140 case MEP_OPERAND_CRN64 :
1141 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crn);
1143 case MEP_OPERAND_CRNX :
1145 length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 1, 32, total_length, pc, & fields->f_crnx_hi);
1146 if (length <= 0) break;
1147 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crnx_lo);
1148 if (length <= 0) break;
1149 FLD (f_crnx) = ((((FLD (f_crnx_hi)) << (4))) | (FLD (f_crnx_lo)));
1152 case MEP_OPERAND_CRNX64 :
1154 length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 1, 32, total_length, pc, & fields->f_crnx_hi);
1155 if (length <= 0) break;
1156 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crnx_lo);
1157 if (length <= 0) break;
1158 FLD (f_crnx) = ((((FLD (f_crnx_hi)) << (4))) | (FLD (f_crnx_lo)));
1161 case MEP_OPERAND_CSRN :
1163 length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 1, 32, total_length, pc, & fields->f_csrn_hi);
1164 if (length <= 0) break;
1165 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_csrn_lo);
1166 if (length <= 0) break;
1167 FLD (f_csrn) = ((((FLD (f_csrn_hi)) << (4))) | (FLD (f_csrn_lo)));
1170 case MEP_OPERAND_CSRN_IDX :
1172 length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 1, 32, total_length, pc, & fields->f_csrn_hi);
1173 if (length <= 0) break;
1174 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_csrn_lo);
1175 if (length <= 0) break;
1176 FLD (f_csrn) = ((((FLD (f_csrn_hi)) << (4))) | (FLD (f_csrn_lo)));
1179 case MEP_OPERAND_DBG :
1181 case MEP_OPERAND_DEPC :
1183 case MEP_OPERAND_EPC :
1185 case MEP_OPERAND_EXC :
1187 case MEP_OPERAND_HI :
1189 case MEP_OPERAND_LO :
1191 case MEP_OPERAND_LP :
1193 case MEP_OPERAND_MB0 :
1195 case MEP_OPERAND_MB1 :
1197 case MEP_OPERAND_ME0 :
1199 case MEP_OPERAND_ME1 :
1201 case MEP_OPERAND_NPC :
1203 case MEP_OPERAND_OPT :
1205 case MEP_OPERAND_PCABS24A2 :
1207 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u5a2n_hi);
1208 if (length <= 0) break;
1209 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 7, 32, total_length, pc, & fields->f_24u5a2n_lo);
1210 if (length <= 0) break;
1211 FLD (f_24u5a2n) = ((((FLD (f_24u5a2n_hi)) << (8))) | (((FLD (f_24u5a2n_lo)) << (1))));
1214 case MEP_OPERAND_PCREL12A2 :
1217 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);
1218 value = ((((value) << (1))) + (pc));
1219 fields->f_12s4a2 = value;
1222 case MEP_OPERAND_PCREL17A2 :
1225 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);
1226 value = ((((value) << (1))) + (pc));
1227 fields->f_17s16a2 = value;
1230 case MEP_OPERAND_PCREL24A2 :
1232 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);
1233 if (length <= 0) break;
1234 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);
1235 if (length <= 0) break;
1236 FLD (f_24s5a2n) = ((((((FLD (f_24s5a2n_hi)) << (8))) | (((FLD (f_24s5a2n_lo)) << (1))))) + (pc));
1239 case MEP_OPERAND_PCREL8A2 :
1242 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);
1243 value = ((((value) << (1))) + (pc));
1244 fields->f_8s8a2 = value;
1247 case MEP_OPERAND_PSW :
1249 case MEP_OPERAND_R0 :
1251 case MEP_OPERAND_R1 :
1253 case MEP_OPERAND_RL :
1254 length = extract_normal (cd, ex_info, insn_value, 0, 0, 12, 4, 32, total_length, pc, & fields->f_rl);
1256 case MEP_OPERAND_RL5 :
1257 length = extract_normal (cd, ex_info, insn_value, 0, 0, 20, 4, 32, total_length, pc, & fields->f_rl5);
1259 case MEP_OPERAND_RM :
1260 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_rm);
1262 case MEP_OPERAND_RMA :
1263 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_rm);
1265 case MEP_OPERAND_RN :
1266 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1268 case MEP_OPERAND_RN3 :
1269 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1271 case MEP_OPERAND_RN3C :
1272 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1274 case MEP_OPERAND_RN3L :
1275 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1277 case MEP_OPERAND_RN3S :
1278 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1280 case MEP_OPERAND_RN3UC :
1281 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1283 case MEP_OPERAND_RN3UL :
1284 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1286 case MEP_OPERAND_RN3US :
1287 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1289 case MEP_OPERAND_RNC :
1290 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1292 case MEP_OPERAND_RNL :
1293 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1295 case MEP_OPERAND_RNS :
1296 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1298 case MEP_OPERAND_RNUC :
1299 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1301 case MEP_OPERAND_RNUL :
1302 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1304 case MEP_OPERAND_RNUS :
1305 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1307 case MEP_OPERAND_SAR :
1309 case MEP_OPERAND_SDISP16 :
1310 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & fields->f_16s16);
1312 case MEP_OPERAND_SIMM16 :
1313 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & fields->f_16s16);
1315 case MEP_OPERAND_SIMM6 :
1316 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 6, 32, total_length, pc, & fields->f_6s8);
1318 case MEP_OPERAND_SIMM8 :
1319 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 8, 32, total_length, pc, & fields->f_8s8);
1321 case MEP_OPERAND_SP :
1323 case MEP_OPERAND_SPR :
1325 case MEP_OPERAND_TP :
1327 case MEP_OPERAND_TPR :
1329 case MEP_OPERAND_UDISP2 :
1330 length = extract_normal (cd, ex_info, insn_value, 0, 0, 6, 2, 32, total_length, pc, & fields->f_2u6);
1332 case MEP_OPERAND_UDISP7 :
1333 length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 7, 32, total_length, pc, & fields->f_7u9);
1335 case MEP_OPERAND_UDISP7A2 :
1338 length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 6, 32, total_length, pc, & value);
1339 value = ((value) << (1));
1340 fields->f_7u9a2 = value;
1343 case MEP_OPERAND_UDISP7A4 :
1346 length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 5, 32, total_length, pc, & value);
1347 value = ((value) << (2));
1348 fields->f_7u9a4 = value;
1351 case MEP_OPERAND_UIMM16 :
1352 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_16u16);
1354 case MEP_OPERAND_UIMM2 :
1355 length = extract_normal (cd, ex_info, insn_value, 0, 0, 10, 2, 32, total_length, pc, & fields->f_2u10);
1357 case MEP_OPERAND_UIMM24 :
1359 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u8n_hi);
1360 if (length <= 0) break;
1361 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 8, 32, total_length, pc, & fields->f_24u8n_lo);
1362 if (length <= 0) break;
1363 FLD (f_24u8n) = ((((FLD (f_24u8n_hi)) << (8))) | (FLD (f_24u8n_lo)));
1366 case MEP_OPERAND_UIMM3 :
1367 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_3u5);
1369 case MEP_OPERAND_UIMM4 :
1370 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_4u8);
1372 case MEP_OPERAND_UIMM5 :
1373 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 5, 32, total_length, pc, & fields->f_5u8);
1375 case MEP_OPERAND_UIMM7A4 :
1378 length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 5, 32, total_length, pc, & value);
1379 value = ((value) << (2));
1380 fields->f_7u9a4 = value;
1383 case MEP_OPERAND_ZERO :
1387 /* xgettext:c-format */
1388 fprintf (stderr, _("Unrecognized field %d while decoding insn.\n"),
1396 cgen_insert_fn * const mep_cgen_insert_handlers[] =
1401 cgen_extract_fn * const mep_cgen_extract_handlers[] =
1403 extract_insn_normal,
1406 int mep_cgen_get_int_operand (CGEN_CPU_DESC, int, const CGEN_FIELDS *);
1407 bfd_vma mep_cgen_get_vma_operand (CGEN_CPU_DESC, int, const CGEN_FIELDS *);
1409 /* Getting values from cgen_fields is handled by a collection of functions.
1410 They are distinguished by the type of the VALUE argument they return.
1411 TODO: floating point, inlining support, remove cases where result type
1415 mep_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1417 const CGEN_FIELDS * fields)
1423 case MEP_OPERAND_ADDR24A4 :
1424 value = fields->f_24u8a4n;
1426 case MEP_OPERAND_C5RMUIMM20 :
1427 value = fields->f_c5_rmuimm20;
1429 case MEP_OPERAND_C5RNMUIMM24 :
1430 value = fields->f_c5_rnmuimm24;
1432 case MEP_OPERAND_CALLNUM :
1433 value = fields->f_callnum;
1435 case MEP_OPERAND_CCCC :
1436 value = fields->f_rm;
1438 case MEP_OPERAND_CCRN :
1439 value = fields->f_ccrn;
1441 case MEP_OPERAND_CDISP10 :
1442 value = fields->f_cdisp10;
1444 case MEP_OPERAND_CDISP10A2 :
1445 value = fields->f_cdisp10;
1447 case MEP_OPERAND_CDISP10A4 :
1448 value = fields->f_cdisp10;
1450 case MEP_OPERAND_CDISP10A8 :
1451 value = fields->f_cdisp10;
1453 case MEP_OPERAND_CDISP12 :
1454 value = fields->f_12s20;
1456 case MEP_OPERAND_CIMM4 :
1457 value = fields->f_rn;
1459 case MEP_OPERAND_CIMM5 :
1460 value = fields->f_5u24;
1462 case MEP_OPERAND_CODE16 :
1463 value = fields->f_16u16;
1465 case MEP_OPERAND_CODE24 :
1466 value = fields->f_24u4n;
1468 case MEP_OPERAND_CP_FLAG :
1471 case MEP_OPERAND_CRN :
1472 value = fields->f_crn;
1474 case MEP_OPERAND_CRN64 :
1475 value = fields->f_crn;
1477 case MEP_OPERAND_CRNX :
1478 value = fields->f_crnx;
1480 case MEP_OPERAND_CRNX64 :
1481 value = fields->f_crnx;
1483 case MEP_OPERAND_CSRN :
1484 value = fields->f_csrn;
1486 case MEP_OPERAND_CSRN_IDX :
1487 value = fields->f_csrn;
1489 case MEP_OPERAND_DBG :
1492 case MEP_OPERAND_DEPC :
1495 case MEP_OPERAND_EPC :
1498 case MEP_OPERAND_EXC :
1501 case MEP_OPERAND_HI :
1504 case MEP_OPERAND_LO :
1507 case MEP_OPERAND_LP :
1510 case MEP_OPERAND_MB0 :
1513 case MEP_OPERAND_MB1 :
1516 case MEP_OPERAND_ME0 :
1519 case MEP_OPERAND_ME1 :
1522 case MEP_OPERAND_NPC :
1525 case MEP_OPERAND_OPT :
1528 case MEP_OPERAND_PCABS24A2 :
1529 value = fields->f_24u5a2n;
1531 case MEP_OPERAND_PCREL12A2 :
1532 value = fields->f_12s4a2;
1534 case MEP_OPERAND_PCREL17A2 :
1535 value = fields->f_17s16a2;
1537 case MEP_OPERAND_PCREL24A2 :
1538 value = fields->f_24s5a2n;
1540 case MEP_OPERAND_PCREL8A2 :
1541 value = fields->f_8s8a2;
1543 case MEP_OPERAND_PSW :
1546 case MEP_OPERAND_R0 :
1549 case MEP_OPERAND_R1 :
1552 case MEP_OPERAND_RL :
1553 value = fields->f_rl;
1555 case MEP_OPERAND_RL5 :
1556 value = fields->f_rl5;
1558 case MEP_OPERAND_RM :
1559 value = fields->f_rm;
1561 case MEP_OPERAND_RMA :
1562 value = fields->f_rm;
1564 case MEP_OPERAND_RN :
1565 value = fields->f_rn;
1567 case MEP_OPERAND_RN3 :
1568 value = fields->f_rn3;
1570 case MEP_OPERAND_RN3C :
1571 value = fields->f_rn3;
1573 case MEP_OPERAND_RN3L :
1574 value = fields->f_rn3;
1576 case MEP_OPERAND_RN3S :
1577 value = fields->f_rn3;
1579 case MEP_OPERAND_RN3UC :
1580 value = fields->f_rn3;
1582 case MEP_OPERAND_RN3UL :
1583 value = fields->f_rn3;
1585 case MEP_OPERAND_RN3US :
1586 value = fields->f_rn3;
1588 case MEP_OPERAND_RNC :
1589 value = fields->f_rn;
1591 case MEP_OPERAND_RNL :
1592 value = fields->f_rn;
1594 case MEP_OPERAND_RNS :
1595 value = fields->f_rn;
1597 case MEP_OPERAND_RNUC :
1598 value = fields->f_rn;
1600 case MEP_OPERAND_RNUL :
1601 value = fields->f_rn;
1603 case MEP_OPERAND_RNUS :
1604 value = fields->f_rn;
1606 case MEP_OPERAND_SAR :
1609 case MEP_OPERAND_SDISP16 :
1610 value = fields->f_16s16;
1612 case MEP_OPERAND_SIMM16 :
1613 value = fields->f_16s16;
1615 case MEP_OPERAND_SIMM6 :
1616 value = fields->f_6s8;
1618 case MEP_OPERAND_SIMM8 :
1619 value = fields->f_8s8;
1621 case MEP_OPERAND_SP :
1624 case MEP_OPERAND_SPR :
1627 case MEP_OPERAND_TP :
1630 case MEP_OPERAND_TPR :
1633 case MEP_OPERAND_UDISP2 :
1634 value = fields->f_2u6;
1636 case MEP_OPERAND_UDISP7 :
1637 value = fields->f_7u9;
1639 case MEP_OPERAND_UDISP7A2 :
1640 value = fields->f_7u9a2;
1642 case MEP_OPERAND_UDISP7A4 :
1643 value = fields->f_7u9a4;
1645 case MEP_OPERAND_UIMM16 :
1646 value = fields->f_16u16;
1648 case MEP_OPERAND_UIMM2 :
1649 value = fields->f_2u10;
1651 case MEP_OPERAND_UIMM24 :
1652 value = fields->f_24u8n;
1654 case MEP_OPERAND_UIMM3 :
1655 value = fields->f_3u5;
1657 case MEP_OPERAND_UIMM4 :
1658 value = fields->f_4u8;
1660 case MEP_OPERAND_UIMM5 :
1661 value = fields->f_5u8;
1663 case MEP_OPERAND_UIMM7A4 :
1664 value = fields->f_7u9a4;
1666 case MEP_OPERAND_ZERO :
1671 /* xgettext:c-format */
1672 fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
1681 mep_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1683 const CGEN_FIELDS * fields)
1689 case MEP_OPERAND_ADDR24A4 :
1690 value = fields->f_24u8a4n;
1692 case MEP_OPERAND_C5RMUIMM20 :
1693 value = fields->f_c5_rmuimm20;
1695 case MEP_OPERAND_C5RNMUIMM24 :
1696 value = fields->f_c5_rnmuimm24;
1698 case MEP_OPERAND_CALLNUM :
1699 value = fields->f_callnum;
1701 case MEP_OPERAND_CCCC :
1702 value = fields->f_rm;
1704 case MEP_OPERAND_CCRN :
1705 value = fields->f_ccrn;
1707 case MEP_OPERAND_CDISP10 :
1708 value = fields->f_cdisp10;
1710 case MEP_OPERAND_CDISP10A2 :
1711 value = fields->f_cdisp10;
1713 case MEP_OPERAND_CDISP10A4 :
1714 value = fields->f_cdisp10;
1716 case MEP_OPERAND_CDISP10A8 :
1717 value = fields->f_cdisp10;
1719 case MEP_OPERAND_CDISP12 :
1720 value = fields->f_12s20;
1722 case MEP_OPERAND_CIMM4 :
1723 value = fields->f_rn;
1725 case MEP_OPERAND_CIMM5 :
1726 value = fields->f_5u24;
1728 case MEP_OPERAND_CODE16 :
1729 value = fields->f_16u16;
1731 case MEP_OPERAND_CODE24 :
1732 value = fields->f_24u4n;
1734 case MEP_OPERAND_CP_FLAG :
1737 case MEP_OPERAND_CRN :
1738 value = fields->f_crn;
1740 case MEP_OPERAND_CRN64 :
1741 value = fields->f_crn;
1743 case MEP_OPERAND_CRNX :
1744 value = fields->f_crnx;
1746 case MEP_OPERAND_CRNX64 :
1747 value = fields->f_crnx;
1749 case MEP_OPERAND_CSRN :
1750 value = fields->f_csrn;
1752 case MEP_OPERAND_CSRN_IDX :
1753 value = fields->f_csrn;
1755 case MEP_OPERAND_DBG :
1758 case MEP_OPERAND_DEPC :
1761 case MEP_OPERAND_EPC :
1764 case MEP_OPERAND_EXC :
1767 case MEP_OPERAND_HI :
1770 case MEP_OPERAND_LO :
1773 case MEP_OPERAND_LP :
1776 case MEP_OPERAND_MB0 :
1779 case MEP_OPERAND_MB1 :
1782 case MEP_OPERAND_ME0 :
1785 case MEP_OPERAND_ME1 :
1788 case MEP_OPERAND_NPC :
1791 case MEP_OPERAND_OPT :
1794 case MEP_OPERAND_PCABS24A2 :
1795 value = fields->f_24u5a2n;
1797 case MEP_OPERAND_PCREL12A2 :
1798 value = fields->f_12s4a2;
1800 case MEP_OPERAND_PCREL17A2 :
1801 value = fields->f_17s16a2;
1803 case MEP_OPERAND_PCREL24A2 :
1804 value = fields->f_24s5a2n;
1806 case MEP_OPERAND_PCREL8A2 :
1807 value = fields->f_8s8a2;
1809 case MEP_OPERAND_PSW :
1812 case MEP_OPERAND_R0 :
1815 case MEP_OPERAND_R1 :
1818 case MEP_OPERAND_RL :
1819 value = fields->f_rl;
1821 case MEP_OPERAND_RL5 :
1822 value = fields->f_rl5;
1824 case MEP_OPERAND_RM :
1825 value = fields->f_rm;
1827 case MEP_OPERAND_RMA :
1828 value = fields->f_rm;
1830 case MEP_OPERAND_RN :
1831 value = fields->f_rn;
1833 case MEP_OPERAND_RN3 :
1834 value = fields->f_rn3;
1836 case MEP_OPERAND_RN3C :
1837 value = fields->f_rn3;
1839 case MEP_OPERAND_RN3L :
1840 value = fields->f_rn3;
1842 case MEP_OPERAND_RN3S :
1843 value = fields->f_rn3;
1845 case MEP_OPERAND_RN3UC :
1846 value = fields->f_rn3;
1848 case MEP_OPERAND_RN3UL :
1849 value = fields->f_rn3;
1851 case MEP_OPERAND_RN3US :
1852 value = fields->f_rn3;
1854 case MEP_OPERAND_RNC :
1855 value = fields->f_rn;
1857 case MEP_OPERAND_RNL :
1858 value = fields->f_rn;
1860 case MEP_OPERAND_RNS :
1861 value = fields->f_rn;
1863 case MEP_OPERAND_RNUC :
1864 value = fields->f_rn;
1866 case MEP_OPERAND_RNUL :
1867 value = fields->f_rn;
1869 case MEP_OPERAND_RNUS :
1870 value = fields->f_rn;
1872 case MEP_OPERAND_SAR :
1875 case MEP_OPERAND_SDISP16 :
1876 value = fields->f_16s16;
1878 case MEP_OPERAND_SIMM16 :
1879 value = fields->f_16s16;
1881 case MEP_OPERAND_SIMM6 :
1882 value = fields->f_6s8;
1884 case MEP_OPERAND_SIMM8 :
1885 value = fields->f_8s8;
1887 case MEP_OPERAND_SP :
1890 case MEP_OPERAND_SPR :
1893 case MEP_OPERAND_TP :
1896 case MEP_OPERAND_TPR :
1899 case MEP_OPERAND_UDISP2 :
1900 value = fields->f_2u6;
1902 case MEP_OPERAND_UDISP7 :
1903 value = fields->f_7u9;
1905 case MEP_OPERAND_UDISP7A2 :
1906 value = fields->f_7u9a2;
1908 case MEP_OPERAND_UDISP7A4 :
1909 value = fields->f_7u9a4;
1911 case MEP_OPERAND_UIMM16 :
1912 value = fields->f_16u16;
1914 case MEP_OPERAND_UIMM2 :
1915 value = fields->f_2u10;
1917 case MEP_OPERAND_UIMM24 :
1918 value = fields->f_24u8n;
1920 case MEP_OPERAND_UIMM3 :
1921 value = fields->f_3u5;
1923 case MEP_OPERAND_UIMM4 :
1924 value = fields->f_4u8;
1926 case MEP_OPERAND_UIMM5 :
1927 value = fields->f_5u8;
1929 case MEP_OPERAND_UIMM7A4 :
1930 value = fields->f_7u9a4;
1932 case MEP_OPERAND_ZERO :
1937 /* xgettext:c-format */
1938 fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
1946 void mep_cgen_set_int_operand (CGEN_CPU_DESC, int, CGEN_FIELDS *, int);
1947 void mep_cgen_set_vma_operand (CGEN_CPU_DESC, int, CGEN_FIELDS *, bfd_vma);
1949 /* Stuffing values in cgen_fields is handled by a collection of functions.
1950 They are distinguished by the type of the VALUE argument they accept.
1951 TODO: floating point, inlining support, remove cases where argument type
1955 mep_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1957 CGEN_FIELDS * fields,
1962 case MEP_OPERAND_ADDR24A4 :
1963 fields->f_24u8a4n = value;
1965 case MEP_OPERAND_C5RMUIMM20 :
1966 fields->f_c5_rmuimm20 = value;
1968 case MEP_OPERAND_C5RNMUIMM24 :
1969 fields->f_c5_rnmuimm24 = value;
1971 case MEP_OPERAND_CALLNUM :
1972 fields->f_callnum = value;
1974 case MEP_OPERAND_CCCC :
1975 fields->f_rm = value;
1977 case MEP_OPERAND_CCRN :
1978 fields->f_ccrn = value;
1980 case MEP_OPERAND_CDISP10 :
1981 fields->f_cdisp10 = value;
1983 case MEP_OPERAND_CDISP10A2 :
1984 fields->f_cdisp10 = value;
1986 case MEP_OPERAND_CDISP10A4 :
1987 fields->f_cdisp10 = value;
1989 case MEP_OPERAND_CDISP10A8 :
1990 fields->f_cdisp10 = value;
1992 case MEP_OPERAND_CDISP12 :
1993 fields->f_12s20 = value;
1995 case MEP_OPERAND_CIMM4 :
1996 fields->f_rn = value;
1998 case MEP_OPERAND_CIMM5 :
1999 fields->f_5u24 = value;
2001 case MEP_OPERAND_CODE16 :
2002 fields->f_16u16 = value;
2004 case MEP_OPERAND_CODE24 :
2005 fields->f_24u4n = value;
2007 case MEP_OPERAND_CP_FLAG :
2009 case MEP_OPERAND_CRN :
2010 fields->f_crn = value;
2012 case MEP_OPERAND_CRN64 :
2013 fields->f_crn = value;
2015 case MEP_OPERAND_CRNX :
2016 fields->f_crnx = value;
2018 case MEP_OPERAND_CRNX64 :
2019 fields->f_crnx = value;
2021 case MEP_OPERAND_CSRN :
2022 fields->f_csrn = value;
2024 case MEP_OPERAND_CSRN_IDX :
2025 fields->f_csrn = value;
2027 case MEP_OPERAND_DBG :
2029 case MEP_OPERAND_DEPC :
2031 case MEP_OPERAND_EPC :
2033 case MEP_OPERAND_EXC :
2035 case MEP_OPERAND_HI :
2037 case MEP_OPERAND_LO :
2039 case MEP_OPERAND_LP :
2041 case MEP_OPERAND_MB0 :
2043 case MEP_OPERAND_MB1 :
2045 case MEP_OPERAND_ME0 :
2047 case MEP_OPERAND_ME1 :
2049 case MEP_OPERAND_NPC :
2051 case MEP_OPERAND_OPT :
2053 case MEP_OPERAND_PCABS24A2 :
2054 fields->f_24u5a2n = value;
2056 case MEP_OPERAND_PCREL12A2 :
2057 fields->f_12s4a2 = value;
2059 case MEP_OPERAND_PCREL17A2 :
2060 fields->f_17s16a2 = value;
2062 case MEP_OPERAND_PCREL24A2 :
2063 fields->f_24s5a2n = value;
2065 case MEP_OPERAND_PCREL8A2 :
2066 fields->f_8s8a2 = value;
2068 case MEP_OPERAND_PSW :
2070 case MEP_OPERAND_R0 :
2072 case MEP_OPERAND_R1 :
2074 case MEP_OPERAND_RL :
2075 fields->f_rl = value;
2077 case MEP_OPERAND_RL5 :
2078 fields->f_rl5 = value;
2080 case MEP_OPERAND_RM :
2081 fields->f_rm = value;
2083 case MEP_OPERAND_RMA :
2084 fields->f_rm = value;
2086 case MEP_OPERAND_RN :
2087 fields->f_rn = value;
2089 case MEP_OPERAND_RN3 :
2090 fields->f_rn3 = value;
2092 case MEP_OPERAND_RN3C :
2093 fields->f_rn3 = value;
2095 case MEP_OPERAND_RN3L :
2096 fields->f_rn3 = value;
2098 case MEP_OPERAND_RN3S :
2099 fields->f_rn3 = value;
2101 case MEP_OPERAND_RN3UC :
2102 fields->f_rn3 = value;
2104 case MEP_OPERAND_RN3UL :
2105 fields->f_rn3 = value;
2107 case MEP_OPERAND_RN3US :
2108 fields->f_rn3 = value;
2110 case MEP_OPERAND_RNC :
2111 fields->f_rn = value;
2113 case MEP_OPERAND_RNL :
2114 fields->f_rn = value;
2116 case MEP_OPERAND_RNS :
2117 fields->f_rn = value;
2119 case MEP_OPERAND_RNUC :
2120 fields->f_rn = value;
2122 case MEP_OPERAND_RNUL :
2123 fields->f_rn = value;
2125 case MEP_OPERAND_RNUS :
2126 fields->f_rn = value;
2128 case MEP_OPERAND_SAR :
2130 case MEP_OPERAND_SDISP16 :
2131 fields->f_16s16 = value;
2133 case MEP_OPERAND_SIMM16 :
2134 fields->f_16s16 = value;
2136 case MEP_OPERAND_SIMM6 :
2137 fields->f_6s8 = value;
2139 case MEP_OPERAND_SIMM8 :
2140 fields->f_8s8 = value;
2142 case MEP_OPERAND_SP :
2144 case MEP_OPERAND_SPR :
2146 case MEP_OPERAND_TP :
2148 case MEP_OPERAND_TPR :
2150 case MEP_OPERAND_UDISP2 :
2151 fields->f_2u6 = value;
2153 case MEP_OPERAND_UDISP7 :
2154 fields->f_7u9 = value;
2156 case MEP_OPERAND_UDISP7A2 :
2157 fields->f_7u9a2 = value;
2159 case MEP_OPERAND_UDISP7A4 :
2160 fields->f_7u9a4 = value;
2162 case MEP_OPERAND_UIMM16 :
2163 fields->f_16u16 = value;
2165 case MEP_OPERAND_UIMM2 :
2166 fields->f_2u10 = value;
2168 case MEP_OPERAND_UIMM24 :
2169 fields->f_24u8n = value;
2171 case MEP_OPERAND_UIMM3 :
2172 fields->f_3u5 = value;
2174 case MEP_OPERAND_UIMM4 :
2175 fields->f_4u8 = value;
2177 case MEP_OPERAND_UIMM5 :
2178 fields->f_5u8 = value;
2180 case MEP_OPERAND_UIMM7A4 :
2181 fields->f_7u9a4 = value;
2183 case MEP_OPERAND_ZERO :
2187 /* xgettext:c-format */
2188 fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
2195 mep_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
2197 CGEN_FIELDS * fields,
2202 case MEP_OPERAND_ADDR24A4 :
2203 fields->f_24u8a4n = value;
2205 case MEP_OPERAND_C5RMUIMM20 :
2206 fields->f_c5_rmuimm20 = value;
2208 case MEP_OPERAND_C5RNMUIMM24 :
2209 fields->f_c5_rnmuimm24 = value;
2211 case MEP_OPERAND_CALLNUM :
2212 fields->f_callnum = value;
2214 case MEP_OPERAND_CCCC :
2215 fields->f_rm = value;
2217 case MEP_OPERAND_CCRN :
2218 fields->f_ccrn = value;
2220 case MEP_OPERAND_CDISP10 :
2221 fields->f_cdisp10 = value;
2223 case MEP_OPERAND_CDISP10A2 :
2224 fields->f_cdisp10 = value;
2226 case MEP_OPERAND_CDISP10A4 :
2227 fields->f_cdisp10 = value;
2229 case MEP_OPERAND_CDISP10A8 :
2230 fields->f_cdisp10 = value;
2232 case MEP_OPERAND_CDISP12 :
2233 fields->f_12s20 = value;
2235 case MEP_OPERAND_CIMM4 :
2236 fields->f_rn = value;
2238 case MEP_OPERAND_CIMM5 :
2239 fields->f_5u24 = value;
2241 case MEP_OPERAND_CODE16 :
2242 fields->f_16u16 = value;
2244 case MEP_OPERAND_CODE24 :
2245 fields->f_24u4n = value;
2247 case MEP_OPERAND_CP_FLAG :
2249 case MEP_OPERAND_CRN :
2250 fields->f_crn = value;
2252 case MEP_OPERAND_CRN64 :
2253 fields->f_crn = value;
2255 case MEP_OPERAND_CRNX :
2256 fields->f_crnx = value;
2258 case MEP_OPERAND_CRNX64 :
2259 fields->f_crnx = value;
2261 case MEP_OPERAND_CSRN :
2262 fields->f_csrn = value;
2264 case MEP_OPERAND_CSRN_IDX :
2265 fields->f_csrn = value;
2267 case MEP_OPERAND_DBG :
2269 case MEP_OPERAND_DEPC :
2271 case MEP_OPERAND_EPC :
2273 case MEP_OPERAND_EXC :
2275 case MEP_OPERAND_HI :
2277 case MEP_OPERAND_LO :
2279 case MEP_OPERAND_LP :
2281 case MEP_OPERAND_MB0 :
2283 case MEP_OPERAND_MB1 :
2285 case MEP_OPERAND_ME0 :
2287 case MEP_OPERAND_ME1 :
2289 case MEP_OPERAND_NPC :
2291 case MEP_OPERAND_OPT :
2293 case MEP_OPERAND_PCABS24A2 :
2294 fields->f_24u5a2n = value;
2296 case MEP_OPERAND_PCREL12A2 :
2297 fields->f_12s4a2 = value;
2299 case MEP_OPERAND_PCREL17A2 :
2300 fields->f_17s16a2 = value;
2302 case MEP_OPERAND_PCREL24A2 :
2303 fields->f_24s5a2n = value;
2305 case MEP_OPERAND_PCREL8A2 :
2306 fields->f_8s8a2 = value;
2308 case MEP_OPERAND_PSW :
2310 case MEP_OPERAND_R0 :
2312 case MEP_OPERAND_R1 :
2314 case MEP_OPERAND_RL :
2315 fields->f_rl = value;
2317 case MEP_OPERAND_RL5 :
2318 fields->f_rl5 = value;
2320 case MEP_OPERAND_RM :
2321 fields->f_rm = value;
2323 case MEP_OPERAND_RMA :
2324 fields->f_rm = value;
2326 case MEP_OPERAND_RN :
2327 fields->f_rn = value;
2329 case MEP_OPERAND_RN3 :
2330 fields->f_rn3 = value;
2332 case MEP_OPERAND_RN3C :
2333 fields->f_rn3 = value;
2335 case MEP_OPERAND_RN3L :
2336 fields->f_rn3 = value;
2338 case MEP_OPERAND_RN3S :
2339 fields->f_rn3 = value;
2341 case MEP_OPERAND_RN3UC :
2342 fields->f_rn3 = value;
2344 case MEP_OPERAND_RN3UL :
2345 fields->f_rn3 = value;
2347 case MEP_OPERAND_RN3US :
2348 fields->f_rn3 = value;
2350 case MEP_OPERAND_RNC :
2351 fields->f_rn = value;
2353 case MEP_OPERAND_RNL :
2354 fields->f_rn = value;
2356 case MEP_OPERAND_RNS :
2357 fields->f_rn = value;
2359 case MEP_OPERAND_RNUC :
2360 fields->f_rn = value;
2362 case MEP_OPERAND_RNUL :
2363 fields->f_rn = value;
2365 case MEP_OPERAND_RNUS :
2366 fields->f_rn = value;
2368 case MEP_OPERAND_SAR :
2370 case MEP_OPERAND_SDISP16 :
2371 fields->f_16s16 = value;
2373 case MEP_OPERAND_SIMM16 :
2374 fields->f_16s16 = value;
2376 case MEP_OPERAND_SIMM6 :
2377 fields->f_6s8 = value;
2379 case MEP_OPERAND_SIMM8 :
2380 fields->f_8s8 = value;
2382 case MEP_OPERAND_SP :
2384 case MEP_OPERAND_SPR :
2386 case MEP_OPERAND_TP :
2388 case MEP_OPERAND_TPR :
2390 case MEP_OPERAND_UDISP2 :
2391 fields->f_2u6 = value;
2393 case MEP_OPERAND_UDISP7 :
2394 fields->f_7u9 = value;
2396 case MEP_OPERAND_UDISP7A2 :
2397 fields->f_7u9a2 = value;
2399 case MEP_OPERAND_UDISP7A4 :
2400 fields->f_7u9a4 = value;
2402 case MEP_OPERAND_UIMM16 :
2403 fields->f_16u16 = value;
2405 case MEP_OPERAND_UIMM2 :
2406 fields->f_2u10 = value;
2408 case MEP_OPERAND_UIMM24 :
2409 fields->f_24u8n = value;
2411 case MEP_OPERAND_UIMM3 :
2412 fields->f_3u5 = value;
2414 case MEP_OPERAND_UIMM4 :
2415 fields->f_4u8 = value;
2417 case MEP_OPERAND_UIMM5 :
2418 fields->f_5u8 = value;
2420 case MEP_OPERAND_UIMM7A4 :
2421 fields->f_7u9a4 = value;
2423 case MEP_OPERAND_ZERO :
2427 /* xgettext:c-format */
2428 fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),
2434 /* Function to call before using the instruction builder tables. */
2437 mep_cgen_init_ibld_table (CGEN_CPU_DESC cd)
2439 cd->insert_handlers = & mep_cgen_insert_handlers[0];
2440 cd->extract_handlers = & mep_cgen_extract_handlers[0];
2442 cd->insert_operand = mep_cgen_insert_operand;
2443 cd->extract_operand = mep_cgen_extract_operand;
2445 cd->get_int_operand = mep_cgen_get_int_operand;
2446 cd->set_int_operand = mep_cgen_set_int_operand;
2447 cd->get_vma_operand = mep_cgen_get_vma_operand;
2448 cd->set_vma_operand = mep_cgen_set_vma_operand;