daily update
[binutils.git] / opcodes / mep-ibld.c
blob803e499053fe082663cbfb43822d9de01e92a213
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 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)
14 any later version.
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.
26 Keep that in mind. */
28 #include "sysdep.h"
29 #include <stdio.h>
30 #include "ansidecl.h"
31 #include "dis-asm.h"
32 #include "bfd.h"
33 #include "symcat.h"
34 #include "mep-desc.h"
35 #include "mep-opc.h"
36 #include "opintl.h"
37 #include "safe-ctype.h"
39 #undef min
40 #define min(a,b) ((a) < (b) ? (a) : (b))
41 #undef max
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);
60 #if CGEN_INT_INSN_P
61 static void put_insn_int_value
62 (CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT);
63 #endif
64 #if ! CGEN_INT_INSN_P
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);
71 #endif
73 /* Operand insertion. */
75 #if ! CGEN_INT_INSN_P
77 /* Subroutine of insert_normal. */
79 static CGEN_INLINE void
80 insert_1 (CGEN_CPU_DESC cd,
81 unsigned long value,
82 int start,
83 int length,
84 int word_length,
85 unsigned char *bufp)
87 unsigned long x,mask;
88 int shift;
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;
94 if (CGEN_INSN_LSB0_P)
95 shift = (start + 1) - length;
96 else
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
119 necessary. */
121 static const char *
122 insert_normal (CGEN_CPU_DESC cd,
123 long value,
124 unsigned int attrs,
125 unsigned int word_offset,
126 unsigned int start,
127 unsigned int length,
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. */
137 if (length == 0)
138 return NULL;
140 if (word_length > 32)
141 abort ();
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)
147 if (word_offset == 0
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)
159 || value < minval)
161 /* xgettext:c-format */
162 sprintf (errbuf,
163 _("operand out of range (%ld not between %ld and %lu)"),
164 value, minval, maxval);
165 return errbuf;
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))
178 val &= 0xFFFFFFFF;
180 if (val > maxval)
182 /* xgettext:c-format */
183 sprintf (errbuf,
184 _("operand out of range (0x%lx not between 0 and 0x%lx)"),
185 val, maxval);
186 return errbuf;
189 else
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)
198 sprintf
199 /* xgettext:c-format */
200 (errbuf, _("operand out of range (%ld not between %ld and %ld)"),
201 value, minval, maxval);
202 return errbuf;
207 #if CGEN_INT_INSN_P
210 int shift;
212 if (CGEN_INSN_LSB0_P)
213 shift = (word_offset + start + 1) - length;
214 else
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 */
229 return NULL;
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. */
239 static const char *
240 insert_insn_normal (CGEN_CPU_DESC cd,
241 const CGEN_INSN * insn,
242 CGEN_FIELDS * fields,
243 CGEN_INSN_BYTES_PTR buffer,
244 bfd_vma pc)
246 const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
247 unsigned long value;
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. */
256 #if CGEN_INT_INSN_P
258 put_insn_int_value (cd, buffer, cd->base_insn_bitsize,
259 CGEN_FIELDS_BITSIZE (fields), value);
261 #else
263 cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize,
264 (unsigned) CGEN_FIELDS_BITSIZE (fields)),
265 value);
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)
276 const char *errmsg;
278 if (CGEN_SYNTAX_CHAR_P (* syn))
279 continue;
281 errmsg = (* cd->insert_operand) (cd, CGEN_SYNTAX_FIELD (*syn),
282 fields, buffer, pc);
283 if (errmsg)
284 return errmsg;
287 return NULL;
290 #if CGEN_INT_INSN_P
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. */
294 static void
295 put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
296 CGEN_INSN_BYTES_PTR buf,
297 int length,
298 int insn_length,
299 CGEN_INSN_INT value)
301 /* For architectures with insns smaller than the base-insn-bitsize,
302 length may be too big. */
303 if (length > insn_length)
304 *buf = value;
305 else
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);
314 #endif
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,
329 int offset,
330 int bytes,
331 bfd_vma pc)
333 /* It's doubtful that the middle part has already been fetched so
334 we don't optimize that case. kiss. */
335 unsigned int mask;
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)
341 return 1;
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))
346 break;
348 if (bytes)
350 int status;
352 pc += offset;
353 status = (*info->read_memory_func)
354 (pc, ex_info->insn_bytes + offset, bytes, info);
356 if (status != 0)
358 (*info->memory_error_func) (status, pc, info);
359 return 0;
362 ex_info->valid |= ((1 << bytes) - 1) << offset;
365 return 1;
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,
373 int start,
374 int length,
375 int word_length,
376 unsigned char *bufp,
377 bfd_vma pc ATTRIBUTE_UNUSED)
379 unsigned long x;
380 int shift;
382 x = cgen_get_insn_value (cd, bufp, word_length);
384 if (CGEN_INSN_LSB0_P)
385 shift = (start + 1) - length;
386 else
387 shift = (word_length - (start + length));
388 return x >> shift;
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
411 necessary. */
413 static int
414 extract_normal (CGEN_CPU_DESC cd,
415 #if ! CGEN_INT_INSN_P
416 CGEN_EXTRACT_INFO *ex_info,
417 #else
418 CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED,
419 #endif
420 CGEN_INSN_INT insn_value,
421 unsigned int attrs,
422 unsigned int word_offset,
423 unsigned int start,
424 unsigned int length,
425 unsigned int word_length,
426 unsigned int total_length,
427 #if ! CGEN_INT_INSN_P
428 bfd_vma pc,
429 #else
430 bfd_vma pc ATTRIBUTE_UNUSED,
431 #endif
432 long *valuep)
434 long value, mask;
436 /* If LENGTH is zero, this operand doesn't contribute to the value
437 so give it a standard value of zero. */
438 if (length == 0)
440 *valuep = 0;
441 return 1;
444 if (word_length > 32)
445 abort ();
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);
461 else
462 value = insn_value >> (total_length - ( word_offset + start + length));
465 #if ! CGEN_INT_INSN_P
467 else
469 unsigned char *bufp = ex_info->insn_bytes + word_offset / 8;
471 if (word_length > 32)
472 abort ();
474 if (fill_cache (cd, ex_info, word_offset / 8, word_length / 8, pc) == 0)
475 return 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;
485 value &= mask;
486 /* sign extend? */
487 if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)
488 && (value & (1L << (length - 1))))
489 value |= ~mask;
491 *valuep = value;
493 return 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
503 been called). */
505 static int
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,
510 CGEN_FIELDS *fields,
511 bfd_vma pc)
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)
522 int length;
524 if (CGEN_SYNTAX_CHAR_P (*syn))
525 continue;
527 length = (* cd->extract_operand) (cd, CGEN_SYNTAX_FIELD (*syn),
528 ex_info, insn_value, fields, pc);
529 if (length <= 0)
530 return length;
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. */
556 const char *
557 mep_cgen_insert_operand (CGEN_CPU_DESC cd,
558 int opindex,
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);
566 switch (opindex)
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);
575 if (errmsg)
576 break;
577 errmsg = insert_normal (cd, fields->f_24u8a4n_lo, 0, 0, 8, 6, 32, total_length, buffer);
578 if (errmsg)
579 break;
581 break;
582 case MEP_OPERAND_CALLNUM :
585 FLD (f_5) = ((((unsigned int) (FLD (f_callnum)) >> (3))) & (1));
586 FLD (f_6) = ((((unsigned int) (FLD (f_callnum)) >> (2))) & (1));
587 FLD (f_7) = ((((unsigned int) (FLD (f_callnum)) >> (1))) & (1));
588 FLD (f_11) = ((FLD (f_callnum)) & (1));
590 errmsg = insert_normal (cd, fields->f_5, 0, 0, 5, 1, 32, total_length, buffer);
591 if (errmsg)
592 break;
593 errmsg = insert_normal (cd, fields->f_6, 0, 0, 6, 1, 32, total_length, buffer);
594 if (errmsg)
595 break;
596 errmsg = insert_normal (cd, fields->f_7, 0, 0, 7, 1, 32, total_length, buffer);
597 if (errmsg)
598 break;
599 errmsg = insert_normal (cd, fields->f_11, 0, 0, 11, 1, 32, total_length, buffer);
600 if (errmsg)
601 break;
603 break;
604 case MEP_OPERAND_CCCC :
605 errmsg = insert_normal (cd, fields->f_rm, 0, 0, 8, 4, 32, total_length, buffer);
606 break;
607 case MEP_OPERAND_CCRN :
610 FLD (f_ccrn_hi) = ((((unsigned int) (FLD (f_ccrn)) >> (4))) & (3));
611 FLD (f_ccrn_lo) = ((FLD (f_ccrn)) & (15));
613 errmsg = insert_normal (cd, fields->f_ccrn_hi, 0, 0, 28, 2, 32, total_length, buffer);
614 if (errmsg)
615 break;
616 errmsg = insert_normal (cd, fields->f_ccrn_lo, 0, 0, 4, 4, 32, total_length, buffer);
617 if (errmsg)
618 break;
620 break;
621 case MEP_OPERAND_CDISP8 :
622 errmsg = insert_normal (cd, fields->f_8s24, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 8, 32, total_length, buffer);
623 break;
624 case MEP_OPERAND_CDISP8A2 :
626 long value = fields->f_8s24a2;
627 value = ((int) (value) >> (1));
628 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 7, 32, total_length, buffer);
630 break;
631 case MEP_OPERAND_CDISP8A4 :
633 long value = fields->f_8s24a4;
634 value = ((int) (value) >> (2));
635 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 6, 32, total_length, buffer);
637 break;
638 case MEP_OPERAND_CDISP8A8 :
640 long value = fields->f_8s24a8;
641 value = ((int) (value) >> (3));
642 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 5, 32, total_length, buffer);
644 break;
645 case MEP_OPERAND_CIMM4 :
646 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
647 break;
648 case MEP_OPERAND_CIMM5 :
649 errmsg = insert_normal (cd, fields->f_5u24, 0, 0, 24, 5, 32, total_length, buffer);
650 break;
651 case MEP_OPERAND_CODE16 :
652 errmsg = insert_normal (cd, fields->f_16u16, 0, 0, 16, 16, 32, total_length, buffer);
653 break;
654 case MEP_OPERAND_CODE24 :
657 FLD (f_24u4n_hi) = ((unsigned int) (FLD (f_24u4n)) >> (16));
658 FLD (f_24u4n_lo) = ((FLD (f_24u4n)) & (65535));
660 errmsg = insert_normal (cd, fields->f_24u4n_hi, 0, 0, 4, 8, 32, total_length, buffer);
661 if (errmsg)
662 break;
663 errmsg = insert_normal (cd, fields->f_24u4n_lo, 0, 0, 16, 16, 32, total_length, buffer);
664 if (errmsg)
665 break;
667 break;
668 case MEP_OPERAND_CP_FLAG :
669 break;
670 case MEP_OPERAND_CRN :
671 errmsg = insert_normal (cd, fields->f_crn, 0, 0, 4, 4, 32, total_length, buffer);
672 break;
673 case MEP_OPERAND_CRN64 :
674 errmsg = insert_normal (cd, fields->f_crn, 0, 0, 4, 4, 32, total_length, buffer);
675 break;
676 case MEP_OPERAND_CRNX :
679 FLD (f_crnx_lo) = ((FLD (f_crnx)) & (15));
680 FLD (f_crnx_hi) = ((unsigned int) (FLD (f_crnx)) >> (4));
682 errmsg = insert_normal (cd, fields->f_crnx_hi, 0, 0, 28, 1, 32, total_length, buffer);
683 if (errmsg)
684 break;
685 errmsg = insert_normal (cd, fields->f_crnx_lo, 0, 0, 4, 4, 32, total_length, buffer);
686 if (errmsg)
687 break;
689 break;
690 case MEP_OPERAND_CRNX64 :
693 FLD (f_crnx_lo) = ((FLD (f_crnx)) & (15));
694 FLD (f_crnx_hi) = ((unsigned int) (FLD (f_crnx)) >> (4));
696 errmsg = insert_normal (cd, fields->f_crnx_hi, 0, 0, 28, 1, 32, total_length, buffer);
697 if (errmsg)
698 break;
699 errmsg = insert_normal (cd, fields->f_crnx_lo, 0, 0, 4, 4, 32, total_length, buffer);
700 if (errmsg)
701 break;
703 break;
704 case MEP_OPERAND_CSRN :
707 FLD (f_csrn_lo) = ((FLD (f_csrn)) & (15));
708 FLD (f_csrn_hi) = ((unsigned int) (FLD (f_csrn)) >> (4));
710 errmsg = insert_normal (cd, fields->f_csrn_hi, 0, 0, 15, 1, 32, total_length, buffer);
711 if (errmsg)
712 break;
713 errmsg = insert_normal (cd, fields->f_csrn_lo, 0, 0, 8, 4, 32, total_length, buffer);
714 if (errmsg)
715 break;
717 break;
718 case MEP_OPERAND_CSRN_IDX :
721 FLD (f_csrn_lo) = ((FLD (f_csrn)) & (15));
722 FLD (f_csrn_hi) = ((unsigned int) (FLD (f_csrn)) >> (4));
724 errmsg = insert_normal (cd, fields->f_csrn_hi, 0, 0, 15, 1, 32, total_length, buffer);
725 if (errmsg)
726 break;
727 errmsg = insert_normal (cd, fields->f_csrn_lo, 0, 0, 8, 4, 32, total_length, buffer);
728 if (errmsg)
729 break;
731 break;
732 case MEP_OPERAND_DBG :
733 break;
734 case MEP_OPERAND_DEPC :
735 break;
736 case MEP_OPERAND_EPC :
737 break;
738 case MEP_OPERAND_EXC :
739 break;
740 case MEP_OPERAND_FMAX_CCRN :
741 errmsg = insert_normal (cd, fields->f_fmax_4_4, 0, 0, 4, 4, 32, total_length, buffer);
742 break;
743 case MEP_OPERAND_FMAX_FRD :
746 FLD (f_fmax_4_4) = ((FLD (f_fmax_frd)) & (15));
747 FLD (f_fmax_28_1) = ((unsigned int) (FLD (f_fmax_frd)) >> (4));
749 errmsg = insert_normal (cd, fields->f_fmax_28_1, 0, 0, 28, 1, 32, total_length, buffer);
750 if (errmsg)
751 break;
752 errmsg = insert_normal (cd, fields->f_fmax_4_4, 0, 0, 4, 4, 32, total_length, buffer);
753 if (errmsg)
754 break;
756 break;
757 case MEP_OPERAND_FMAX_FRD_INT :
760 FLD (f_fmax_4_4) = ((FLD (f_fmax_frd)) & (15));
761 FLD (f_fmax_28_1) = ((unsigned int) (FLD (f_fmax_frd)) >> (4));
763 errmsg = insert_normal (cd, fields->f_fmax_28_1, 0, 0, 28, 1, 32, total_length, buffer);
764 if (errmsg)
765 break;
766 errmsg = insert_normal (cd, fields->f_fmax_4_4, 0, 0, 4, 4, 32, total_length, buffer);
767 if (errmsg)
768 break;
770 break;
771 case MEP_OPERAND_FMAX_FRM :
774 FLD (f_fmax_24_4) = ((FLD (f_fmax_frm)) & (15));
775 FLD (f_fmax_30_1) = ((unsigned int) (FLD (f_fmax_frm)) >> (4));
777 errmsg = insert_normal (cd, fields->f_fmax_30_1, 0, 0, 30, 1, 32, total_length, buffer);
778 if (errmsg)
779 break;
780 errmsg = insert_normal (cd, fields->f_fmax_24_4, 0, 0, 24, 4, 32, total_length, buffer);
781 if (errmsg)
782 break;
784 break;
785 case MEP_OPERAND_FMAX_FRN :
788 FLD (f_fmax_20_4) = ((FLD (f_fmax_frn)) & (15));
789 FLD (f_fmax_29_1) = ((unsigned int) (FLD (f_fmax_frn)) >> (4));
791 errmsg = insert_normal (cd, fields->f_fmax_29_1, 0, 0, 29, 1, 32, total_length, buffer);
792 if (errmsg)
793 break;
794 errmsg = insert_normal (cd, fields->f_fmax_20_4, 0, 0, 20, 4, 32, total_length, buffer);
795 if (errmsg)
796 break;
798 break;
799 case MEP_OPERAND_FMAX_FRN_INT :
802 FLD (f_fmax_20_4) = ((FLD (f_fmax_frn)) & (15));
803 FLD (f_fmax_29_1) = ((unsigned int) (FLD (f_fmax_frn)) >> (4));
805 errmsg = insert_normal (cd, fields->f_fmax_29_1, 0, 0, 29, 1, 32, total_length, buffer);
806 if (errmsg)
807 break;
808 errmsg = insert_normal (cd, fields->f_fmax_20_4, 0, 0, 20, 4, 32, total_length, buffer);
809 if (errmsg)
810 break;
812 break;
813 case MEP_OPERAND_FMAX_RM :
814 errmsg = insert_normal (cd, fields->f_fmax_rm, 0, 0, 8, 4, 32, total_length, buffer);
815 break;
816 case MEP_OPERAND_HI :
817 break;
818 case MEP_OPERAND_LO :
819 break;
820 case MEP_OPERAND_LP :
821 break;
822 case MEP_OPERAND_MB0 :
823 break;
824 case MEP_OPERAND_MB1 :
825 break;
826 case MEP_OPERAND_ME0 :
827 break;
828 case MEP_OPERAND_ME1 :
829 break;
830 case MEP_OPERAND_NPC :
831 break;
832 case MEP_OPERAND_OPT :
833 break;
834 case MEP_OPERAND_PCABS24A2 :
837 FLD (f_24u5a2n_lo) = ((unsigned int) (((FLD (f_24u5a2n)) & (255))) >> (1));
838 FLD (f_24u5a2n_hi) = ((unsigned int) (FLD (f_24u5a2n)) >> (8));
840 errmsg = insert_normal (cd, fields->f_24u5a2n_hi, 0, 0, 16, 16, 32, total_length, buffer);
841 if (errmsg)
842 break;
843 errmsg = insert_normal (cd, fields->f_24u5a2n_lo, 0, 0, 5, 7, 32, total_length, buffer);
844 if (errmsg)
845 break;
847 break;
848 case MEP_OPERAND_PCREL12A2 :
850 long value = fields->f_12s4a2;
851 value = ((int) (((value) - (pc))) >> (1));
852 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 4, 11, 32, total_length, buffer);
854 break;
855 case MEP_OPERAND_PCREL17A2 :
857 long value = fields->f_17s16a2;
858 value = ((int) (((value) - (pc))) >> (1));
859 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 16, 16, 32, total_length, buffer);
861 break;
862 case MEP_OPERAND_PCREL24A2 :
865 FLD (f_24s5a2n) = ((FLD (f_24s5a2n)) - (pc));
866 FLD (f_24s5a2n_lo) = ((unsigned int) (((FLD (f_24s5a2n)) & (254))) >> (1));
867 FLD (f_24s5a2n_hi) = ((int) (FLD (f_24s5a2n)) >> (8));
869 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);
870 if (errmsg)
871 break;
872 errmsg = insert_normal (cd, fields->f_24s5a2n_lo, 0|(1<<CGEN_IFLD_PCREL_ADDR), 0, 5, 7, 32, total_length, buffer);
873 if (errmsg)
874 break;
876 break;
877 case MEP_OPERAND_PCREL8A2 :
879 long value = fields->f_8s8a2;
880 value = ((int) (((value) - (pc))) >> (1));
881 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 8, 7, 32, total_length, buffer);
883 break;
884 case MEP_OPERAND_PSW :
885 break;
886 case MEP_OPERAND_R0 :
887 break;
888 case MEP_OPERAND_R1 :
889 break;
890 case MEP_OPERAND_RL :
891 errmsg = insert_normal (cd, fields->f_rl, 0, 0, 12, 4, 32, total_length, buffer);
892 break;
893 case MEP_OPERAND_RM :
894 errmsg = insert_normal (cd, fields->f_rm, 0, 0, 8, 4, 32, total_length, buffer);
895 break;
896 case MEP_OPERAND_RMA :
897 errmsg = insert_normal (cd, fields->f_rm, 0, 0, 8, 4, 32, total_length, buffer);
898 break;
899 case MEP_OPERAND_RN :
900 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
901 break;
902 case MEP_OPERAND_RN3 :
903 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
904 break;
905 case MEP_OPERAND_RN3C :
906 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
907 break;
908 case MEP_OPERAND_RN3L :
909 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
910 break;
911 case MEP_OPERAND_RN3S :
912 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
913 break;
914 case MEP_OPERAND_RN3UC :
915 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
916 break;
917 case MEP_OPERAND_RN3UL :
918 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
919 break;
920 case MEP_OPERAND_RN3US :
921 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
922 break;
923 case MEP_OPERAND_RNC :
924 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
925 break;
926 case MEP_OPERAND_RNL :
927 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
928 break;
929 case MEP_OPERAND_RNS :
930 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
931 break;
932 case MEP_OPERAND_RNUC :
933 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
934 break;
935 case MEP_OPERAND_RNUL :
936 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
937 break;
938 case MEP_OPERAND_RNUS :
939 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
940 break;
941 case MEP_OPERAND_SAR :
942 break;
943 case MEP_OPERAND_SDISP16 :
944 errmsg = insert_normal (cd, fields->f_16s16, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, buffer);
945 break;
946 case MEP_OPERAND_SIMM16 :
947 errmsg = insert_normal (cd, fields->f_16s16, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, buffer);
948 break;
949 case MEP_OPERAND_SIMM6 :
950 errmsg = insert_normal (cd, fields->f_6s8, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 6, 32, total_length, buffer);
951 break;
952 case MEP_OPERAND_SIMM8 :
953 errmsg = insert_normal (cd, fields->f_8s8, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 8, 32, total_length, buffer);
954 break;
955 case MEP_OPERAND_SP :
956 break;
957 case MEP_OPERAND_SPR :
958 break;
959 case MEP_OPERAND_TP :
960 break;
961 case MEP_OPERAND_TPR :
962 break;
963 case MEP_OPERAND_UDISP2 :
964 errmsg = insert_normal (cd, fields->f_2u6, 0, 0, 6, 2, 32, total_length, buffer);
965 break;
966 case MEP_OPERAND_UDISP7 :
967 errmsg = insert_normal (cd, fields->f_7u9, 0, 0, 9, 7, 32, total_length, buffer);
968 break;
969 case MEP_OPERAND_UDISP7A2 :
971 long value = fields->f_7u9a2;
972 value = ((unsigned int) (value) >> (1));
973 errmsg = insert_normal (cd, value, 0, 0, 9, 6, 32, total_length, buffer);
975 break;
976 case MEP_OPERAND_UDISP7A4 :
978 long value = fields->f_7u9a4;
979 value = ((unsigned int) (value) >> (2));
980 errmsg = insert_normal (cd, value, 0, 0, 9, 5, 32, total_length, buffer);
982 break;
983 case MEP_OPERAND_UIMM16 :
984 errmsg = insert_normal (cd, fields->f_16u16, 0, 0, 16, 16, 32, total_length, buffer);
985 break;
986 case MEP_OPERAND_UIMM2 :
987 errmsg = insert_normal (cd, fields->f_2u10, 0, 0, 10, 2, 32, total_length, buffer);
988 break;
989 case MEP_OPERAND_UIMM24 :
992 FLD (f_24u8n_hi) = ((unsigned int) (FLD (f_24u8n)) >> (8));
993 FLD (f_24u8n_lo) = ((FLD (f_24u8n)) & (255));
995 errmsg = insert_normal (cd, fields->f_24u8n_hi, 0, 0, 16, 16, 32, total_length, buffer);
996 if (errmsg)
997 break;
998 errmsg = insert_normal (cd, fields->f_24u8n_lo, 0, 0, 8, 8, 32, total_length, buffer);
999 if (errmsg)
1000 break;
1002 break;
1003 case MEP_OPERAND_UIMM3 :
1004 errmsg = insert_normal (cd, fields->f_3u5, 0, 0, 5, 3, 32, total_length, buffer);
1005 break;
1006 case MEP_OPERAND_UIMM4 :
1007 errmsg = insert_normal (cd, fields->f_4u8, 0, 0, 8, 4, 32, total_length, buffer);
1008 break;
1009 case MEP_OPERAND_UIMM5 :
1010 errmsg = insert_normal (cd, fields->f_5u8, 0, 0, 8, 5, 32, total_length, buffer);
1011 break;
1012 case MEP_OPERAND_UIMM7A4 :
1014 long value = fields->f_7u9a4;
1015 value = ((unsigned int) (value) >> (2));
1016 errmsg = insert_normal (cd, value, 0, 0, 9, 5, 32, total_length, buffer);
1018 break;
1019 case MEP_OPERAND_ZERO :
1020 break;
1022 default :
1023 /* xgettext:c-format */
1024 fprintf (stderr, _("Unrecognized field %d while building insn.\n"),
1025 opindex);
1026 abort ();
1029 return errmsg;
1032 int mep_cgen_extract_operand
1033 (CGEN_CPU_DESC, int, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma);
1035 /* Main entry point for operand extraction.
1036 The result is <= 0 for error, >0 for success.
1037 ??? Actual values aren't well defined right now.
1039 This function is basically just a big switch statement. Earlier versions
1040 used tables to look up the function to use, but
1041 - if the table contains both assembler and disassembler functions then
1042 the disassembler contains much of the assembler and vice-versa,
1043 - there's a lot of inlining possibilities as things grow,
1044 - using a switch statement avoids the function call overhead.
1046 This function could be moved into `print_insn_normal', but keeping it
1047 separate makes clear the interface between `print_insn_normal' and each of
1048 the handlers. */
1051 mep_cgen_extract_operand (CGEN_CPU_DESC cd,
1052 int opindex,
1053 CGEN_EXTRACT_INFO *ex_info,
1054 CGEN_INSN_INT insn_value,
1055 CGEN_FIELDS * fields,
1056 bfd_vma pc)
1058 /* Assume success (for those operands that are nops). */
1059 int length = 1;
1060 unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);
1062 switch (opindex)
1064 case MEP_OPERAND_ADDR24A4 :
1066 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u8a4n_hi);
1067 if (length <= 0) break;
1068 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 6, 32, total_length, pc, & fields->f_24u8a4n_lo);
1069 if (length <= 0) break;
1070 FLD (f_24u8a4n) = ((((FLD (f_24u8a4n_hi)) << (8))) | (((FLD (f_24u8a4n_lo)) << (2))));
1072 break;
1073 case MEP_OPERAND_CALLNUM :
1075 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 1, 32, total_length, pc, & fields->f_5);
1076 if (length <= 0) break;
1077 length = extract_normal (cd, ex_info, insn_value, 0, 0, 6, 1, 32, total_length, pc, & fields->f_6);
1078 if (length <= 0) break;
1079 length = extract_normal (cd, ex_info, insn_value, 0, 0, 7, 1, 32, total_length, pc, & fields->f_7);
1080 if (length <= 0) break;
1081 length = extract_normal (cd, ex_info, insn_value, 0, 0, 11, 1, 32, total_length, pc, & fields->f_11);
1082 if (length <= 0) break;
1083 FLD (f_callnum) = ((((FLD (f_5)) << (3))) | (((((FLD (f_6)) << (2))) | (((((FLD (f_7)) << (1))) | (FLD (f_11)))))));
1085 break;
1086 case MEP_OPERAND_CCCC :
1087 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_rm);
1088 break;
1089 case MEP_OPERAND_CCRN :
1091 length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 2, 32, total_length, pc, & fields->f_ccrn_hi);
1092 if (length <= 0) break;
1093 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_ccrn_lo);
1094 if (length <= 0) break;
1095 FLD (f_ccrn) = ((((FLD (f_ccrn_hi)) << (4))) | (FLD (f_ccrn_lo)));
1097 break;
1098 case MEP_OPERAND_CDISP8 :
1099 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 8, 32, total_length, pc, & fields->f_8s24);
1100 break;
1101 case MEP_OPERAND_CDISP8A2 :
1103 long value;
1104 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 7, 32, total_length, pc, & value);
1105 value = ((value) << (1));
1106 fields->f_8s24a2 = value;
1108 break;
1109 case MEP_OPERAND_CDISP8A4 :
1111 long value;
1112 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 6, 32, total_length, pc, & value);
1113 value = ((value) << (2));
1114 fields->f_8s24a4 = value;
1116 break;
1117 case MEP_OPERAND_CDISP8A8 :
1119 long value;
1120 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 5, 32, total_length, pc, & value);
1121 value = ((value) << (3));
1122 fields->f_8s24a8 = value;
1124 break;
1125 case MEP_OPERAND_CIMM4 :
1126 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1127 break;
1128 case MEP_OPERAND_CIMM5 :
1129 length = extract_normal (cd, ex_info, insn_value, 0, 0, 24, 5, 32, total_length, pc, & fields->f_5u24);
1130 break;
1131 case MEP_OPERAND_CODE16 :
1132 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_16u16);
1133 break;
1134 case MEP_OPERAND_CODE24 :
1136 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 8, 32, total_length, pc, & fields->f_24u4n_hi);
1137 if (length <= 0) break;
1138 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u4n_lo);
1139 if (length <= 0) break;
1140 FLD (f_24u4n) = ((((FLD (f_24u4n_hi)) << (16))) | (FLD (f_24u4n_lo)));
1142 break;
1143 case MEP_OPERAND_CP_FLAG :
1144 break;
1145 case MEP_OPERAND_CRN :
1146 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crn);
1147 break;
1148 case MEP_OPERAND_CRN64 :
1149 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crn);
1150 break;
1151 case MEP_OPERAND_CRNX :
1153 length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 1, 32, total_length, pc, & fields->f_crnx_hi);
1154 if (length <= 0) break;
1155 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crnx_lo);
1156 if (length <= 0) break;
1157 FLD (f_crnx) = ((((FLD (f_crnx_hi)) << (4))) | (FLD (f_crnx_lo)));
1159 break;
1160 case MEP_OPERAND_CRNX64 :
1162 length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 1, 32, total_length, pc, & fields->f_crnx_hi);
1163 if (length <= 0) break;
1164 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crnx_lo);
1165 if (length <= 0) break;
1166 FLD (f_crnx) = ((((FLD (f_crnx_hi)) << (4))) | (FLD (f_crnx_lo)));
1168 break;
1169 case MEP_OPERAND_CSRN :
1171 length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 1, 32, total_length, pc, & fields->f_csrn_hi);
1172 if (length <= 0) break;
1173 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_csrn_lo);
1174 if (length <= 0) break;
1175 FLD (f_csrn) = ((((FLD (f_csrn_hi)) << (4))) | (FLD (f_csrn_lo)));
1177 break;
1178 case MEP_OPERAND_CSRN_IDX :
1180 length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 1, 32, total_length, pc, & fields->f_csrn_hi);
1181 if (length <= 0) break;
1182 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_csrn_lo);
1183 if (length <= 0) break;
1184 FLD (f_csrn) = ((((FLD (f_csrn_hi)) << (4))) | (FLD (f_csrn_lo)));
1186 break;
1187 case MEP_OPERAND_DBG :
1188 break;
1189 case MEP_OPERAND_DEPC :
1190 break;
1191 case MEP_OPERAND_EPC :
1192 break;
1193 case MEP_OPERAND_EXC :
1194 break;
1195 case MEP_OPERAND_FMAX_CCRN :
1196 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_fmax_4_4);
1197 break;
1198 case MEP_OPERAND_FMAX_FRD :
1200 length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 1, 32, total_length, pc, & fields->f_fmax_28_1);
1201 if (length <= 0) break;
1202 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_fmax_4_4);
1203 if (length <= 0) break;
1204 FLD (f_fmax_frd) = ((((FLD (f_fmax_28_1)) << (4))) | (FLD (f_fmax_4_4)));
1206 break;
1207 case MEP_OPERAND_FMAX_FRD_INT :
1209 length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 1, 32, total_length, pc, & fields->f_fmax_28_1);
1210 if (length <= 0) break;
1211 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_fmax_4_4);
1212 if (length <= 0) break;
1213 FLD (f_fmax_frd) = ((((FLD (f_fmax_28_1)) << (4))) | (FLD (f_fmax_4_4)));
1215 break;
1216 case MEP_OPERAND_FMAX_FRM :
1218 length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 1, 32, total_length, pc, & fields->f_fmax_30_1);
1219 if (length <= 0) break;
1220 length = extract_normal (cd, ex_info, insn_value, 0, 0, 24, 4, 32, total_length, pc, & fields->f_fmax_24_4);
1221 if (length <= 0) break;
1222 FLD (f_fmax_frm) = ((((FLD (f_fmax_30_1)) << (4))) | (FLD (f_fmax_24_4)));
1224 break;
1225 case MEP_OPERAND_FMAX_FRN :
1227 length = extract_normal (cd, ex_info, insn_value, 0, 0, 29, 1, 32, total_length, pc, & fields->f_fmax_29_1);
1228 if (length <= 0) break;
1229 length = extract_normal (cd, ex_info, insn_value, 0, 0, 20, 4, 32, total_length, pc, & fields->f_fmax_20_4);
1230 if (length <= 0) break;
1231 FLD (f_fmax_frn) = ((((FLD (f_fmax_29_1)) << (4))) | (FLD (f_fmax_20_4)));
1233 break;
1234 case MEP_OPERAND_FMAX_FRN_INT :
1236 length = extract_normal (cd, ex_info, insn_value, 0, 0, 29, 1, 32, total_length, pc, & fields->f_fmax_29_1);
1237 if (length <= 0) break;
1238 length = extract_normal (cd, ex_info, insn_value, 0, 0, 20, 4, 32, total_length, pc, & fields->f_fmax_20_4);
1239 if (length <= 0) break;
1240 FLD (f_fmax_frn) = ((((FLD (f_fmax_29_1)) << (4))) | (FLD (f_fmax_20_4)));
1242 break;
1243 case MEP_OPERAND_FMAX_RM :
1244 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_fmax_rm);
1245 break;
1246 case MEP_OPERAND_HI :
1247 break;
1248 case MEP_OPERAND_LO :
1249 break;
1250 case MEP_OPERAND_LP :
1251 break;
1252 case MEP_OPERAND_MB0 :
1253 break;
1254 case MEP_OPERAND_MB1 :
1255 break;
1256 case MEP_OPERAND_ME0 :
1257 break;
1258 case MEP_OPERAND_ME1 :
1259 break;
1260 case MEP_OPERAND_NPC :
1261 break;
1262 case MEP_OPERAND_OPT :
1263 break;
1264 case MEP_OPERAND_PCABS24A2 :
1266 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u5a2n_hi);
1267 if (length <= 0) break;
1268 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 7, 32, total_length, pc, & fields->f_24u5a2n_lo);
1269 if (length <= 0) break;
1270 FLD (f_24u5a2n) = ((((FLD (f_24u5a2n_hi)) << (8))) | (((FLD (f_24u5a2n_lo)) << (1))));
1272 break;
1273 case MEP_OPERAND_PCREL12A2 :
1275 long value;
1276 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);
1277 value = ((((value) << (1))) + (pc));
1278 fields->f_12s4a2 = value;
1280 break;
1281 case MEP_OPERAND_PCREL17A2 :
1283 long value;
1284 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);
1285 value = ((((value) << (1))) + (pc));
1286 fields->f_17s16a2 = value;
1288 break;
1289 case MEP_OPERAND_PCREL24A2 :
1291 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);
1292 if (length <= 0) break;
1293 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);
1294 if (length <= 0) break;
1295 FLD (f_24s5a2n) = ((((((FLD (f_24s5a2n_hi)) << (8))) | (((FLD (f_24s5a2n_lo)) << (1))))) + (pc));
1297 break;
1298 case MEP_OPERAND_PCREL8A2 :
1300 long value;
1301 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);
1302 value = ((((value) << (1))) + (pc));
1303 fields->f_8s8a2 = value;
1305 break;
1306 case MEP_OPERAND_PSW :
1307 break;
1308 case MEP_OPERAND_R0 :
1309 break;
1310 case MEP_OPERAND_R1 :
1311 break;
1312 case MEP_OPERAND_RL :
1313 length = extract_normal (cd, ex_info, insn_value, 0, 0, 12, 4, 32, total_length, pc, & fields->f_rl);
1314 break;
1315 case MEP_OPERAND_RM :
1316 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_rm);
1317 break;
1318 case MEP_OPERAND_RMA :
1319 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_rm);
1320 break;
1321 case MEP_OPERAND_RN :
1322 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1323 break;
1324 case MEP_OPERAND_RN3 :
1325 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1326 break;
1327 case MEP_OPERAND_RN3C :
1328 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1329 break;
1330 case MEP_OPERAND_RN3L :
1331 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1332 break;
1333 case MEP_OPERAND_RN3S :
1334 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1335 break;
1336 case MEP_OPERAND_RN3UC :
1337 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1338 break;
1339 case MEP_OPERAND_RN3UL :
1340 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1341 break;
1342 case MEP_OPERAND_RN3US :
1343 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1344 break;
1345 case MEP_OPERAND_RNC :
1346 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1347 break;
1348 case MEP_OPERAND_RNL :
1349 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1350 break;
1351 case MEP_OPERAND_RNS :
1352 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1353 break;
1354 case MEP_OPERAND_RNUC :
1355 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1356 break;
1357 case MEP_OPERAND_RNUL :
1358 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1359 break;
1360 case MEP_OPERAND_RNUS :
1361 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1362 break;
1363 case MEP_OPERAND_SAR :
1364 break;
1365 case MEP_OPERAND_SDISP16 :
1366 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & fields->f_16s16);
1367 break;
1368 case MEP_OPERAND_SIMM16 :
1369 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & fields->f_16s16);
1370 break;
1371 case MEP_OPERAND_SIMM6 :
1372 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 6, 32, total_length, pc, & fields->f_6s8);
1373 break;
1374 case MEP_OPERAND_SIMM8 :
1375 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 8, 32, total_length, pc, & fields->f_8s8);
1376 break;
1377 case MEP_OPERAND_SP :
1378 break;
1379 case MEP_OPERAND_SPR :
1380 break;
1381 case MEP_OPERAND_TP :
1382 break;
1383 case MEP_OPERAND_TPR :
1384 break;
1385 case MEP_OPERAND_UDISP2 :
1386 length = extract_normal (cd, ex_info, insn_value, 0, 0, 6, 2, 32, total_length, pc, & fields->f_2u6);
1387 break;
1388 case MEP_OPERAND_UDISP7 :
1389 length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 7, 32, total_length, pc, & fields->f_7u9);
1390 break;
1391 case MEP_OPERAND_UDISP7A2 :
1393 long value;
1394 length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 6, 32, total_length, pc, & value);
1395 value = ((value) << (1));
1396 fields->f_7u9a2 = value;
1398 break;
1399 case MEP_OPERAND_UDISP7A4 :
1401 long value;
1402 length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 5, 32, total_length, pc, & value);
1403 value = ((value) << (2));
1404 fields->f_7u9a4 = value;
1406 break;
1407 case MEP_OPERAND_UIMM16 :
1408 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_16u16);
1409 break;
1410 case MEP_OPERAND_UIMM2 :
1411 length = extract_normal (cd, ex_info, insn_value, 0, 0, 10, 2, 32, total_length, pc, & fields->f_2u10);
1412 break;
1413 case MEP_OPERAND_UIMM24 :
1415 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u8n_hi);
1416 if (length <= 0) break;
1417 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 8, 32, total_length, pc, & fields->f_24u8n_lo);
1418 if (length <= 0) break;
1419 FLD (f_24u8n) = ((((FLD (f_24u8n_hi)) << (8))) | (FLD (f_24u8n_lo)));
1421 break;
1422 case MEP_OPERAND_UIMM3 :
1423 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_3u5);
1424 break;
1425 case MEP_OPERAND_UIMM4 :
1426 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_4u8);
1427 break;
1428 case MEP_OPERAND_UIMM5 :
1429 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 5, 32, total_length, pc, & fields->f_5u8);
1430 break;
1431 case MEP_OPERAND_UIMM7A4 :
1433 long value;
1434 length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 5, 32, total_length, pc, & value);
1435 value = ((value) << (2));
1436 fields->f_7u9a4 = value;
1438 break;
1439 case MEP_OPERAND_ZERO :
1440 break;
1442 default :
1443 /* xgettext:c-format */
1444 fprintf (stderr, _("Unrecognized field %d while decoding insn.\n"),
1445 opindex);
1446 abort ();
1449 return length;
1452 cgen_insert_fn * const mep_cgen_insert_handlers[] =
1454 insert_insn_normal,
1457 cgen_extract_fn * const mep_cgen_extract_handlers[] =
1459 extract_insn_normal,
1462 int mep_cgen_get_int_operand (CGEN_CPU_DESC, int, const CGEN_FIELDS *);
1463 bfd_vma mep_cgen_get_vma_operand (CGEN_CPU_DESC, int, const CGEN_FIELDS *);
1465 /* Getting values from cgen_fields is handled by a collection of functions.
1466 They are distinguished by the type of the VALUE argument they return.
1467 TODO: floating point, inlining support, remove cases where result type
1468 not appropriate. */
1471 mep_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1472 int opindex,
1473 const CGEN_FIELDS * fields)
1475 int value;
1477 switch (opindex)
1479 case MEP_OPERAND_ADDR24A4 :
1480 value = fields->f_24u8a4n;
1481 break;
1482 case MEP_OPERAND_CALLNUM :
1483 value = fields->f_callnum;
1484 break;
1485 case MEP_OPERAND_CCCC :
1486 value = fields->f_rm;
1487 break;
1488 case MEP_OPERAND_CCRN :
1489 value = fields->f_ccrn;
1490 break;
1491 case MEP_OPERAND_CDISP8 :
1492 value = fields->f_8s24;
1493 break;
1494 case MEP_OPERAND_CDISP8A2 :
1495 value = fields->f_8s24a2;
1496 break;
1497 case MEP_OPERAND_CDISP8A4 :
1498 value = fields->f_8s24a4;
1499 break;
1500 case MEP_OPERAND_CDISP8A8 :
1501 value = fields->f_8s24a8;
1502 break;
1503 case MEP_OPERAND_CIMM4 :
1504 value = fields->f_rn;
1505 break;
1506 case MEP_OPERAND_CIMM5 :
1507 value = fields->f_5u24;
1508 break;
1509 case MEP_OPERAND_CODE16 :
1510 value = fields->f_16u16;
1511 break;
1512 case MEP_OPERAND_CODE24 :
1513 value = fields->f_24u4n;
1514 break;
1515 case MEP_OPERAND_CP_FLAG :
1516 value = 0;
1517 break;
1518 case MEP_OPERAND_CRN :
1519 value = fields->f_crn;
1520 break;
1521 case MEP_OPERAND_CRN64 :
1522 value = fields->f_crn;
1523 break;
1524 case MEP_OPERAND_CRNX :
1525 value = fields->f_crnx;
1526 break;
1527 case MEP_OPERAND_CRNX64 :
1528 value = fields->f_crnx;
1529 break;
1530 case MEP_OPERAND_CSRN :
1531 value = fields->f_csrn;
1532 break;
1533 case MEP_OPERAND_CSRN_IDX :
1534 value = fields->f_csrn;
1535 break;
1536 case MEP_OPERAND_DBG :
1537 value = 0;
1538 break;
1539 case MEP_OPERAND_DEPC :
1540 value = 0;
1541 break;
1542 case MEP_OPERAND_EPC :
1543 value = 0;
1544 break;
1545 case MEP_OPERAND_EXC :
1546 value = 0;
1547 break;
1548 case MEP_OPERAND_FMAX_CCRN :
1549 value = fields->f_fmax_4_4;
1550 break;
1551 case MEP_OPERAND_FMAX_FRD :
1552 value = fields->f_fmax_frd;
1553 break;
1554 case MEP_OPERAND_FMAX_FRD_INT :
1555 value = fields->f_fmax_frd;
1556 break;
1557 case MEP_OPERAND_FMAX_FRM :
1558 value = fields->f_fmax_frm;
1559 break;
1560 case MEP_OPERAND_FMAX_FRN :
1561 value = fields->f_fmax_frn;
1562 break;
1563 case MEP_OPERAND_FMAX_FRN_INT :
1564 value = fields->f_fmax_frn;
1565 break;
1566 case MEP_OPERAND_FMAX_RM :
1567 value = fields->f_fmax_rm;
1568 break;
1569 case MEP_OPERAND_HI :
1570 value = 0;
1571 break;
1572 case MEP_OPERAND_LO :
1573 value = 0;
1574 break;
1575 case MEP_OPERAND_LP :
1576 value = 0;
1577 break;
1578 case MEP_OPERAND_MB0 :
1579 value = 0;
1580 break;
1581 case MEP_OPERAND_MB1 :
1582 value = 0;
1583 break;
1584 case MEP_OPERAND_ME0 :
1585 value = 0;
1586 break;
1587 case MEP_OPERAND_ME1 :
1588 value = 0;
1589 break;
1590 case MEP_OPERAND_NPC :
1591 value = 0;
1592 break;
1593 case MEP_OPERAND_OPT :
1594 value = 0;
1595 break;
1596 case MEP_OPERAND_PCABS24A2 :
1597 value = fields->f_24u5a2n;
1598 break;
1599 case MEP_OPERAND_PCREL12A2 :
1600 value = fields->f_12s4a2;
1601 break;
1602 case MEP_OPERAND_PCREL17A2 :
1603 value = fields->f_17s16a2;
1604 break;
1605 case MEP_OPERAND_PCREL24A2 :
1606 value = fields->f_24s5a2n;
1607 break;
1608 case MEP_OPERAND_PCREL8A2 :
1609 value = fields->f_8s8a2;
1610 break;
1611 case MEP_OPERAND_PSW :
1612 value = 0;
1613 break;
1614 case MEP_OPERAND_R0 :
1615 value = 0;
1616 break;
1617 case MEP_OPERAND_R1 :
1618 value = 0;
1619 break;
1620 case MEP_OPERAND_RL :
1621 value = fields->f_rl;
1622 break;
1623 case MEP_OPERAND_RM :
1624 value = fields->f_rm;
1625 break;
1626 case MEP_OPERAND_RMA :
1627 value = fields->f_rm;
1628 break;
1629 case MEP_OPERAND_RN :
1630 value = fields->f_rn;
1631 break;
1632 case MEP_OPERAND_RN3 :
1633 value = fields->f_rn3;
1634 break;
1635 case MEP_OPERAND_RN3C :
1636 value = fields->f_rn3;
1637 break;
1638 case MEP_OPERAND_RN3L :
1639 value = fields->f_rn3;
1640 break;
1641 case MEP_OPERAND_RN3S :
1642 value = fields->f_rn3;
1643 break;
1644 case MEP_OPERAND_RN3UC :
1645 value = fields->f_rn3;
1646 break;
1647 case MEP_OPERAND_RN3UL :
1648 value = fields->f_rn3;
1649 break;
1650 case MEP_OPERAND_RN3US :
1651 value = fields->f_rn3;
1652 break;
1653 case MEP_OPERAND_RNC :
1654 value = fields->f_rn;
1655 break;
1656 case MEP_OPERAND_RNL :
1657 value = fields->f_rn;
1658 break;
1659 case MEP_OPERAND_RNS :
1660 value = fields->f_rn;
1661 break;
1662 case MEP_OPERAND_RNUC :
1663 value = fields->f_rn;
1664 break;
1665 case MEP_OPERAND_RNUL :
1666 value = fields->f_rn;
1667 break;
1668 case MEP_OPERAND_RNUS :
1669 value = fields->f_rn;
1670 break;
1671 case MEP_OPERAND_SAR :
1672 value = 0;
1673 break;
1674 case MEP_OPERAND_SDISP16 :
1675 value = fields->f_16s16;
1676 break;
1677 case MEP_OPERAND_SIMM16 :
1678 value = fields->f_16s16;
1679 break;
1680 case MEP_OPERAND_SIMM6 :
1681 value = fields->f_6s8;
1682 break;
1683 case MEP_OPERAND_SIMM8 :
1684 value = fields->f_8s8;
1685 break;
1686 case MEP_OPERAND_SP :
1687 value = 0;
1688 break;
1689 case MEP_OPERAND_SPR :
1690 value = 0;
1691 break;
1692 case MEP_OPERAND_TP :
1693 value = 0;
1694 break;
1695 case MEP_OPERAND_TPR :
1696 value = 0;
1697 break;
1698 case MEP_OPERAND_UDISP2 :
1699 value = fields->f_2u6;
1700 break;
1701 case MEP_OPERAND_UDISP7 :
1702 value = fields->f_7u9;
1703 break;
1704 case MEP_OPERAND_UDISP7A2 :
1705 value = fields->f_7u9a2;
1706 break;
1707 case MEP_OPERAND_UDISP7A4 :
1708 value = fields->f_7u9a4;
1709 break;
1710 case MEP_OPERAND_UIMM16 :
1711 value = fields->f_16u16;
1712 break;
1713 case MEP_OPERAND_UIMM2 :
1714 value = fields->f_2u10;
1715 break;
1716 case MEP_OPERAND_UIMM24 :
1717 value = fields->f_24u8n;
1718 break;
1719 case MEP_OPERAND_UIMM3 :
1720 value = fields->f_3u5;
1721 break;
1722 case MEP_OPERAND_UIMM4 :
1723 value = fields->f_4u8;
1724 break;
1725 case MEP_OPERAND_UIMM5 :
1726 value = fields->f_5u8;
1727 break;
1728 case MEP_OPERAND_UIMM7A4 :
1729 value = fields->f_7u9a4;
1730 break;
1731 case MEP_OPERAND_ZERO :
1732 value = 0;
1733 break;
1735 default :
1736 /* xgettext:c-format */
1737 fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
1738 opindex);
1739 abort ();
1742 return value;
1745 bfd_vma
1746 mep_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1747 int opindex,
1748 const CGEN_FIELDS * fields)
1750 bfd_vma value;
1752 switch (opindex)
1754 case MEP_OPERAND_ADDR24A4 :
1755 value = fields->f_24u8a4n;
1756 break;
1757 case MEP_OPERAND_CALLNUM :
1758 value = fields->f_callnum;
1759 break;
1760 case MEP_OPERAND_CCCC :
1761 value = fields->f_rm;
1762 break;
1763 case MEP_OPERAND_CCRN :
1764 value = fields->f_ccrn;
1765 break;
1766 case MEP_OPERAND_CDISP8 :
1767 value = fields->f_8s24;
1768 break;
1769 case MEP_OPERAND_CDISP8A2 :
1770 value = fields->f_8s24a2;
1771 break;
1772 case MEP_OPERAND_CDISP8A4 :
1773 value = fields->f_8s24a4;
1774 break;
1775 case MEP_OPERAND_CDISP8A8 :
1776 value = fields->f_8s24a8;
1777 break;
1778 case MEP_OPERAND_CIMM4 :
1779 value = fields->f_rn;
1780 break;
1781 case MEP_OPERAND_CIMM5 :
1782 value = fields->f_5u24;
1783 break;
1784 case MEP_OPERAND_CODE16 :
1785 value = fields->f_16u16;
1786 break;
1787 case MEP_OPERAND_CODE24 :
1788 value = fields->f_24u4n;
1789 break;
1790 case MEP_OPERAND_CP_FLAG :
1791 value = 0;
1792 break;
1793 case MEP_OPERAND_CRN :
1794 value = fields->f_crn;
1795 break;
1796 case MEP_OPERAND_CRN64 :
1797 value = fields->f_crn;
1798 break;
1799 case MEP_OPERAND_CRNX :
1800 value = fields->f_crnx;
1801 break;
1802 case MEP_OPERAND_CRNX64 :
1803 value = fields->f_crnx;
1804 break;
1805 case MEP_OPERAND_CSRN :
1806 value = fields->f_csrn;
1807 break;
1808 case MEP_OPERAND_CSRN_IDX :
1809 value = fields->f_csrn;
1810 break;
1811 case MEP_OPERAND_DBG :
1812 value = 0;
1813 break;
1814 case MEP_OPERAND_DEPC :
1815 value = 0;
1816 break;
1817 case MEP_OPERAND_EPC :
1818 value = 0;
1819 break;
1820 case MEP_OPERAND_EXC :
1821 value = 0;
1822 break;
1823 case MEP_OPERAND_FMAX_CCRN :
1824 value = fields->f_fmax_4_4;
1825 break;
1826 case MEP_OPERAND_FMAX_FRD :
1827 value = fields->f_fmax_frd;
1828 break;
1829 case MEP_OPERAND_FMAX_FRD_INT :
1830 value = fields->f_fmax_frd;
1831 break;
1832 case MEP_OPERAND_FMAX_FRM :
1833 value = fields->f_fmax_frm;
1834 break;
1835 case MEP_OPERAND_FMAX_FRN :
1836 value = fields->f_fmax_frn;
1837 break;
1838 case MEP_OPERAND_FMAX_FRN_INT :
1839 value = fields->f_fmax_frn;
1840 break;
1841 case MEP_OPERAND_FMAX_RM :
1842 value = fields->f_fmax_rm;
1843 break;
1844 case MEP_OPERAND_HI :
1845 value = 0;
1846 break;
1847 case MEP_OPERAND_LO :
1848 value = 0;
1849 break;
1850 case MEP_OPERAND_LP :
1851 value = 0;
1852 break;
1853 case MEP_OPERAND_MB0 :
1854 value = 0;
1855 break;
1856 case MEP_OPERAND_MB1 :
1857 value = 0;
1858 break;
1859 case MEP_OPERAND_ME0 :
1860 value = 0;
1861 break;
1862 case MEP_OPERAND_ME1 :
1863 value = 0;
1864 break;
1865 case MEP_OPERAND_NPC :
1866 value = 0;
1867 break;
1868 case MEP_OPERAND_OPT :
1869 value = 0;
1870 break;
1871 case MEP_OPERAND_PCABS24A2 :
1872 value = fields->f_24u5a2n;
1873 break;
1874 case MEP_OPERAND_PCREL12A2 :
1875 value = fields->f_12s4a2;
1876 break;
1877 case MEP_OPERAND_PCREL17A2 :
1878 value = fields->f_17s16a2;
1879 break;
1880 case MEP_OPERAND_PCREL24A2 :
1881 value = fields->f_24s5a2n;
1882 break;
1883 case MEP_OPERAND_PCREL8A2 :
1884 value = fields->f_8s8a2;
1885 break;
1886 case MEP_OPERAND_PSW :
1887 value = 0;
1888 break;
1889 case MEP_OPERAND_R0 :
1890 value = 0;
1891 break;
1892 case MEP_OPERAND_R1 :
1893 value = 0;
1894 break;
1895 case MEP_OPERAND_RL :
1896 value = fields->f_rl;
1897 break;
1898 case MEP_OPERAND_RM :
1899 value = fields->f_rm;
1900 break;
1901 case MEP_OPERAND_RMA :
1902 value = fields->f_rm;
1903 break;
1904 case MEP_OPERAND_RN :
1905 value = fields->f_rn;
1906 break;
1907 case MEP_OPERAND_RN3 :
1908 value = fields->f_rn3;
1909 break;
1910 case MEP_OPERAND_RN3C :
1911 value = fields->f_rn3;
1912 break;
1913 case MEP_OPERAND_RN3L :
1914 value = fields->f_rn3;
1915 break;
1916 case MEP_OPERAND_RN3S :
1917 value = fields->f_rn3;
1918 break;
1919 case MEP_OPERAND_RN3UC :
1920 value = fields->f_rn3;
1921 break;
1922 case MEP_OPERAND_RN3UL :
1923 value = fields->f_rn3;
1924 break;
1925 case MEP_OPERAND_RN3US :
1926 value = fields->f_rn3;
1927 break;
1928 case MEP_OPERAND_RNC :
1929 value = fields->f_rn;
1930 break;
1931 case MEP_OPERAND_RNL :
1932 value = fields->f_rn;
1933 break;
1934 case MEP_OPERAND_RNS :
1935 value = fields->f_rn;
1936 break;
1937 case MEP_OPERAND_RNUC :
1938 value = fields->f_rn;
1939 break;
1940 case MEP_OPERAND_RNUL :
1941 value = fields->f_rn;
1942 break;
1943 case MEP_OPERAND_RNUS :
1944 value = fields->f_rn;
1945 break;
1946 case MEP_OPERAND_SAR :
1947 value = 0;
1948 break;
1949 case MEP_OPERAND_SDISP16 :
1950 value = fields->f_16s16;
1951 break;
1952 case MEP_OPERAND_SIMM16 :
1953 value = fields->f_16s16;
1954 break;
1955 case MEP_OPERAND_SIMM6 :
1956 value = fields->f_6s8;
1957 break;
1958 case MEP_OPERAND_SIMM8 :
1959 value = fields->f_8s8;
1960 break;
1961 case MEP_OPERAND_SP :
1962 value = 0;
1963 break;
1964 case MEP_OPERAND_SPR :
1965 value = 0;
1966 break;
1967 case MEP_OPERAND_TP :
1968 value = 0;
1969 break;
1970 case MEP_OPERAND_TPR :
1971 value = 0;
1972 break;
1973 case MEP_OPERAND_UDISP2 :
1974 value = fields->f_2u6;
1975 break;
1976 case MEP_OPERAND_UDISP7 :
1977 value = fields->f_7u9;
1978 break;
1979 case MEP_OPERAND_UDISP7A2 :
1980 value = fields->f_7u9a2;
1981 break;
1982 case MEP_OPERAND_UDISP7A4 :
1983 value = fields->f_7u9a4;
1984 break;
1985 case MEP_OPERAND_UIMM16 :
1986 value = fields->f_16u16;
1987 break;
1988 case MEP_OPERAND_UIMM2 :
1989 value = fields->f_2u10;
1990 break;
1991 case MEP_OPERAND_UIMM24 :
1992 value = fields->f_24u8n;
1993 break;
1994 case MEP_OPERAND_UIMM3 :
1995 value = fields->f_3u5;
1996 break;
1997 case MEP_OPERAND_UIMM4 :
1998 value = fields->f_4u8;
1999 break;
2000 case MEP_OPERAND_UIMM5 :
2001 value = fields->f_5u8;
2002 break;
2003 case MEP_OPERAND_UIMM7A4 :
2004 value = fields->f_7u9a4;
2005 break;
2006 case MEP_OPERAND_ZERO :
2007 value = 0;
2008 break;
2010 default :
2011 /* xgettext:c-format */
2012 fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
2013 opindex);
2014 abort ();
2017 return value;
2020 void mep_cgen_set_int_operand (CGEN_CPU_DESC, int, CGEN_FIELDS *, int);
2021 void mep_cgen_set_vma_operand (CGEN_CPU_DESC, int, CGEN_FIELDS *, bfd_vma);
2023 /* Stuffing values in cgen_fields is handled by a collection of functions.
2024 They are distinguished by the type of the VALUE argument they accept.
2025 TODO: floating point, inlining support, remove cases where argument type
2026 not appropriate. */
2028 void
2029 mep_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
2030 int opindex,
2031 CGEN_FIELDS * fields,
2032 int value)
2034 switch (opindex)
2036 case MEP_OPERAND_ADDR24A4 :
2037 fields->f_24u8a4n = value;
2038 break;
2039 case MEP_OPERAND_CALLNUM :
2040 fields->f_callnum = value;
2041 break;
2042 case MEP_OPERAND_CCCC :
2043 fields->f_rm = value;
2044 break;
2045 case MEP_OPERAND_CCRN :
2046 fields->f_ccrn = value;
2047 break;
2048 case MEP_OPERAND_CDISP8 :
2049 fields->f_8s24 = value;
2050 break;
2051 case MEP_OPERAND_CDISP8A2 :
2052 fields->f_8s24a2 = value;
2053 break;
2054 case MEP_OPERAND_CDISP8A4 :
2055 fields->f_8s24a4 = value;
2056 break;
2057 case MEP_OPERAND_CDISP8A8 :
2058 fields->f_8s24a8 = value;
2059 break;
2060 case MEP_OPERAND_CIMM4 :
2061 fields->f_rn = value;
2062 break;
2063 case MEP_OPERAND_CIMM5 :
2064 fields->f_5u24 = value;
2065 break;
2066 case MEP_OPERAND_CODE16 :
2067 fields->f_16u16 = value;
2068 break;
2069 case MEP_OPERAND_CODE24 :
2070 fields->f_24u4n = value;
2071 break;
2072 case MEP_OPERAND_CP_FLAG :
2073 break;
2074 case MEP_OPERAND_CRN :
2075 fields->f_crn = value;
2076 break;
2077 case MEP_OPERAND_CRN64 :
2078 fields->f_crn = value;
2079 break;
2080 case MEP_OPERAND_CRNX :
2081 fields->f_crnx = value;
2082 break;
2083 case MEP_OPERAND_CRNX64 :
2084 fields->f_crnx = value;
2085 break;
2086 case MEP_OPERAND_CSRN :
2087 fields->f_csrn = value;
2088 break;
2089 case MEP_OPERAND_CSRN_IDX :
2090 fields->f_csrn = value;
2091 break;
2092 case MEP_OPERAND_DBG :
2093 break;
2094 case MEP_OPERAND_DEPC :
2095 break;
2096 case MEP_OPERAND_EPC :
2097 break;
2098 case MEP_OPERAND_EXC :
2099 break;
2100 case MEP_OPERAND_FMAX_CCRN :
2101 fields->f_fmax_4_4 = value;
2102 break;
2103 case MEP_OPERAND_FMAX_FRD :
2104 fields->f_fmax_frd = value;
2105 break;
2106 case MEP_OPERAND_FMAX_FRD_INT :
2107 fields->f_fmax_frd = value;
2108 break;
2109 case MEP_OPERAND_FMAX_FRM :
2110 fields->f_fmax_frm = value;
2111 break;
2112 case MEP_OPERAND_FMAX_FRN :
2113 fields->f_fmax_frn = value;
2114 break;
2115 case MEP_OPERAND_FMAX_FRN_INT :
2116 fields->f_fmax_frn = value;
2117 break;
2118 case MEP_OPERAND_FMAX_RM :
2119 fields->f_fmax_rm = value;
2120 break;
2121 case MEP_OPERAND_HI :
2122 break;
2123 case MEP_OPERAND_LO :
2124 break;
2125 case MEP_OPERAND_LP :
2126 break;
2127 case MEP_OPERAND_MB0 :
2128 break;
2129 case MEP_OPERAND_MB1 :
2130 break;
2131 case MEP_OPERAND_ME0 :
2132 break;
2133 case MEP_OPERAND_ME1 :
2134 break;
2135 case MEP_OPERAND_NPC :
2136 break;
2137 case MEP_OPERAND_OPT :
2138 break;
2139 case MEP_OPERAND_PCABS24A2 :
2140 fields->f_24u5a2n = value;
2141 break;
2142 case MEP_OPERAND_PCREL12A2 :
2143 fields->f_12s4a2 = value;
2144 break;
2145 case MEP_OPERAND_PCREL17A2 :
2146 fields->f_17s16a2 = value;
2147 break;
2148 case MEP_OPERAND_PCREL24A2 :
2149 fields->f_24s5a2n = value;
2150 break;
2151 case MEP_OPERAND_PCREL8A2 :
2152 fields->f_8s8a2 = value;
2153 break;
2154 case MEP_OPERAND_PSW :
2155 break;
2156 case MEP_OPERAND_R0 :
2157 break;
2158 case MEP_OPERAND_R1 :
2159 break;
2160 case MEP_OPERAND_RL :
2161 fields->f_rl = value;
2162 break;
2163 case MEP_OPERAND_RM :
2164 fields->f_rm = value;
2165 break;
2166 case MEP_OPERAND_RMA :
2167 fields->f_rm = value;
2168 break;
2169 case MEP_OPERAND_RN :
2170 fields->f_rn = value;
2171 break;
2172 case MEP_OPERAND_RN3 :
2173 fields->f_rn3 = value;
2174 break;
2175 case MEP_OPERAND_RN3C :
2176 fields->f_rn3 = value;
2177 break;
2178 case MEP_OPERAND_RN3L :
2179 fields->f_rn3 = value;
2180 break;
2181 case MEP_OPERAND_RN3S :
2182 fields->f_rn3 = value;
2183 break;
2184 case MEP_OPERAND_RN3UC :
2185 fields->f_rn3 = value;
2186 break;
2187 case MEP_OPERAND_RN3UL :
2188 fields->f_rn3 = value;
2189 break;
2190 case MEP_OPERAND_RN3US :
2191 fields->f_rn3 = value;
2192 break;
2193 case MEP_OPERAND_RNC :
2194 fields->f_rn = value;
2195 break;
2196 case MEP_OPERAND_RNL :
2197 fields->f_rn = value;
2198 break;
2199 case MEP_OPERAND_RNS :
2200 fields->f_rn = value;
2201 break;
2202 case MEP_OPERAND_RNUC :
2203 fields->f_rn = value;
2204 break;
2205 case MEP_OPERAND_RNUL :
2206 fields->f_rn = value;
2207 break;
2208 case MEP_OPERAND_RNUS :
2209 fields->f_rn = value;
2210 break;
2211 case MEP_OPERAND_SAR :
2212 break;
2213 case MEP_OPERAND_SDISP16 :
2214 fields->f_16s16 = value;
2215 break;
2216 case MEP_OPERAND_SIMM16 :
2217 fields->f_16s16 = value;
2218 break;
2219 case MEP_OPERAND_SIMM6 :
2220 fields->f_6s8 = value;
2221 break;
2222 case MEP_OPERAND_SIMM8 :
2223 fields->f_8s8 = value;
2224 break;
2225 case MEP_OPERAND_SP :
2226 break;
2227 case MEP_OPERAND_SPR :
2228 break;
2229 case MEP_OPERAND_TP :
2230 break;
2231 case MEP_OPERAND_TPR :
2232 break;
2233 case MEP_OPERAND_UDISP2 :
2234 fields->f_2u6 = value;
2235 break;
2236 case MEP_OPERAND_UDISP7 :
2237 fields->f_7u9 = value;
2238 break;
2239 case MEP_OPERAND_UDISP7A2 :
2240 fields->f_7u9a2 = value;
2241 break;
2242 case MEP_OPERAND_UDISP7A4 :
2243 fields->f_7u9a4 = value;
2244 break;
2245 case MEP_OPERAND_UIMM16 :
2246 fields->f_16u16 = value;
2247 break;
2248 case MEP_OPERAND_UIMM2 :
2249 fields->f_2u10 = value;
2250 break;
2251 case MEP_OPERAND_UIMM24 :
2252 fields->f_24u8n = value;
2253 break;
2254 case MEP_OPERAND_UIMM3 :
2255 fields->f_3u5 = value;
2256 break;
2257 case MEP_OPERAND_UIMM4 :
2258 fields->f_4u8 = value;
2259 break;
2260 case MEP_OPERAND_UIMM5 :
2261 fields->f_5u8 = value;
2262 break;
2263 case MEP_OPERAND_UIMM7A4 :
2264 fields->f_7u9a4 = value;
2265 break;
2266 case MEP_OPERAND_ZERO :
2267 break;
2269 default :
2270 /* xgettext:c-format */
2271 fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
2272 opindex);
2273 abort ();
2277 void
2278 mep_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
2279 int opindex,
2280 CGEN_FIELDS * fields,
2281 bfd_vma value)
2283 switch (opindex)
2285 case MEP_OPERAND_ADDR24A4 :
2286 fields->f_24u8a4n = value;
2287 break;
2288 case MEP_OPERAND_CALLNUM :
2289 fields->f_callnum = value;
2290 break;
2291 case MEP_OPERAND_CCCC :
2292 fields->f_rm = value;
2293 break;
2294 case MEP_OPERAND_CCRN :
2295 fields->f_ccrn = value;
2296 break;
2297 case MEP_OPERAND_CDISP8 :
2298 fields->f_8s24 = value;
2299 break;
2300 case MEP_OPERAND_CDISP8A2 :
2301 fields->f_8s24a2 = value;
2302 break;
2303 case MEP_OPERAND_CDISP8A4 :
2304 fields->f_8s24a4 = value;
2305 break;
2306 case MEP_OPERAND_CDISP8A8 :
2307 fields->f_8s24a8 = value;
2308 break;
2309 case MEP_OPERAND_CIMM4 :
2310 fields->f_rn = value;
2311 break;
2312 case MEP_OPERAND_CIMM5 :
2313 fields->f_5u24 = value;
2314 break;
2315 case MEP_OPERAND_CODE16 :
2316 fields->f_16u16 = value;
2317 break;
2318 case MEP_OPERAND_CODE24 :
2319 fields->f_24u4n = value;
2320 break;
2321 case MEP_OPERAND_CP_FLAG :
2322 break;
2323 case MEP_OPERAND_CRN :
2324 fields->f_crn = value;
2325 break;
2326 case MEP_OPERAND_CRN64 :
2327 fields->f_crn = value;
2328 break;
2329 case MEP_OPERAND_CRNX :
2330 fields->f_crnx = value;
2331 break;
2332 case MEP_OPERAND_CRNX64 :
2333 fields->f_crnx = value;
2334 break;
2335 case MEP_OPERAND_CSRN :
2336 fields->f_csrn = value;
2337 break;
2338 case MEP_OPERAND_CSRN_IDX :
2339 fields->f_csrn = value;
2340 break;
2341 case MEP_OPERAND_DBG :
2342 break;
2343 case MEP_OPERAND_DEPC :
2344 break;
2345 case MEP_OPERAND_EPC :
2346 break;
2347 case MEP_OPERAND_EXC :
2348 break;
2349 case MEP_OPERAND_FMAX_CCRN :
2350 fields->f_fmax_4_4 = value;
2351 break;
2352 case MEP_OPERAND_FMAX_FRD :
2353 fields->f_fmax_frd = value;
2354 break;
2355 case MEP_OPERAND_FMAX_FRD_INT :
2356 fields->f_fmax_frd = value;
2357 break;
2358 case MEP_OPERAND_FMAX_FRM :
2359 fields->f_fmax_frm = value;
2360 break;
2361 case MEP_OPERAND_FMAX_FRN :
2362 fields->f_fmax_frn = value;
2363 break;
2364 case MEP_OPERAND_FMAX_FRN_INT :
2365 fields->f_fmax_frn = value;
2366 break;
2367 case MEP_OPERAND_FMAX_RM :
2368 fields->f_fmax_rm = value;
2369 break;
2370 case MEP_OPERAND_HI :
2371 break;
2372 case MEP_OPERAND_LO :
2373 break;
2374 case MEP_OPERAND_LP :
2375 break;
2376 case MEP_OPERAND_MB0 :
2377 break;
2378 case MEP_OPERAND_MB1 :
2379 break;
2380 case MEP_OPERAND_ME0 :
2381 break;
2382 case MEP_OPERAND_ME1 :
2383 break;
2384 case MEP_OPERAND_NPC :
2385 break;
2386 case MEP_OPERAND_OPT :
2387 break;
2388 case MEP_OPERAND_PCABS24A2 :
2389 fields->f_24u5a2n = value;
2390 break;
2391 case MEP_OPERAND_PCREL12A2 :
2392 fields->f_12s4a2 = value;
2393 break;
2394 case MEP_OPERAND_PCREL17A2 :
2395 fields->f_17s16a2 = value;
2396 break;
2397 case MEP_OPERAND_PCREL24A2 :
2398 fields->f_24s5a2n = value;
2399 break;
2400 case MEP_OPERAND_PCREL8A2 :
2401 fields->f_8s8a2 = value;
2402 break;
2403 case MEP_OPERAND_PSW :
2404 break;
2405 case MEP_OPERAND_R0 :
2406 break;
2407 case MEP_OPERAND_R1 :
2408 break;
2409 case MEP_OPERAND_RL :
2410 fields->f_rl = value;
2411 break;
2412 case MEP_OPERAND_RM :
2413 fields->f_rm = value;
2414 break;
2415 case MEP_OPERAND_RMA :
2416 fields->f_rm = value;
2417 break;
2418 case MEP_OPERAND_RN :
2419 fields->f_rn = value;
2420 break;
2421 case MEP_OPERAND_RN3 :
2422 fields->f_rn3 = value;
2423 break;
2424 case MEP_OPERAND_RN3C :
2425 fields->f_rn3 = value;
2426 break;
2427 case MEP_OPERAND_RN3L :
2428 fields->f_rn3 = value;
2429 break;
2430 case MEP_OPERAND_RN3S :
2431 fields->f_rn3 = value;
2432 break;
2433 case MEP_OPERAND_RN3UC :
2434 fields->f_rn3 = value;
2435 break;
2436 case MEP_OPERAND_RN3UL :
2437 fields->f_rn3 = value;
2438 break;
2439 case MEP_OPERAND_RN3US :
2440 fields->f_rn3 = value;
2441 break;
2442 case MEP_OPERAND_RNC :
2443 fields->f_rn = value;
2444 break;
2445 case MEP_OPERAND_RNL :
2446 fields->f_rn = value;
2447 break;
2448 case MEP_OPERAND_RNS :
2449 fields->f_rn = value;
2450 break;
2451 case MEP_OPERAND_RNUC :
2452 fields->f_rn = value;
2453 break;
2454 case MEP_OPERAND_RNUL :
2455 fields->f_rn = value;
2456 break;
2457 case MEP_OPERAND_RNUS :
2458 fields->f_rn = value;
2459 break;
2460 case MEP_OPERAND_SAR :
2461 break;
2462 case MEP_OPERAND_SDISP16 :
2463 fields->f_16s16 = value;
2464 break;
2465 case MEP_OPERAND_SIMM16 :
2466 fields->f_16s16 = value;
2467 break;
2468 case MEP_OPERAND_SIMM6 :
2469 fields->f_6s8 = value;
2470 break;
2471 case MEP_OPERAND_SIMM8 :
2472 fields->f_8s8 = value;
2473 break;
2474 case MEP_OPERAND_SP :
2475 break;
2476 case MEP_OPERAND_SPR :
2477 break;
2478 case MEP_OPERAND_TP :
2479 break;
2480 case MEP_OPERAND_TPR :
2481 break;
2482 case MEP_OPERAND_UDISP2 :
2483 fields->f_2u6 = value;
2484 break;
2485 case MEP_OPERAND_UDISP7 :
2486 fields->f_7u9 = value;
2487 break;
2488 case MEP_OPERAND_UDISP7A2 :
2489 fields->f_7u9a2 = value;
2490 break;
2491 case MEP_OPERAND_UDISP7A4 :
2492 fields->f_7u9a4 = value;
2493 break;
2494 case MEP_OPERAND_UIMM16 :
2495 fields->f_16u16 = value;
2496 break;
2497 case MEP_OPERAND_UIMM2 :
2498 fields->f_2u10 = value;
2499 break;
2500 case MEP_OPERAND_UIMM24 :
2501 fields->f_24u8n = value;
2502 break;
2503 case MEP_OPERAND_UIMM3 :
2504 fields->f_3u5 = value;
2505 break;
2506 case MEP_OPERAND_UIMM4 :
2507 fields->f_4u8 = value;
2508 break;
2509 case MEP_OPERAND_UIMM5 :
2510 fields->f_5u8 = value;
2511 break;
2512 case MEP_OPERAND_UIMM7A4 :
2513 fields->f_7u9a4 = value;
2514 break;
2515 case MEP_OPERAND_ZERO :
2516 break;
2518 default :
2519 /* xgettext:c-format */
2520 fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),
2521 opindex);
2522 abort ();
2526 /* Function to call before using the instruction builder tables. */
2528 void
2529 mep_cgen_init_ibld_table (CGEN_CPU_DESC cd)
2531 cd->insert_handlers = & mep_cgen_insert_handlers[0];
2532 cd->extract_handlers = & mep_cgen_extract_handlers[0];
2534 cd->insert_operand = mep_cgen_insert_operand;
2535 cd->extract_operand = mep_cgen_extract_operand;
2537 cd->get_int_operand = mep_cgen_get_int_operand;
2538 cd->set_int_operand = mep_cgen_set_int_operand;
2539 cd->get_vma_operand = mep_cgen_get_vma_operand;
2540 cd->set_vma_operand = mep_cgen_set_vma_operand;