1 /* Instruction building/extraction support for ms1. -*- 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
7 Free Software Foundation, Inc.
9 This file is part of the GNU Binutils and GDB, the GNU debugger.
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2, or (at your option)
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
25 /* ??? Eventually more and more of this stuff can go to cpu-independent files.
37 #include "safe-ctype.h"
40 #define min(a,b) ((a) < (b) ? (a) : (b))
42 #define max(a,b) ((a) > (b) ? (a) : (b))
44 /* Used by the ifield rtx function. */
45 #define FLD(f) (fields->f)
47 static const char * insert_normal
48 (CGEN_CPU_DESC
, long, unsigned int, unsigned int, unsigned int,
49 unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR
);
50 static const char * insert_insn_normal
51 (CGEN_CPU_DESC
, const CGEN_INSN
*,
52 CGEN_FIELDS
*, CGEN_INSN_BYTES_PTR
, bfd_vma
);
53 static int extract_normal
54 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
,
55 unsigned int, unsigned int, unsigned int, unsigned int,
56 unsigned int, unsigned int, bfd_vma
, long *);
57 static int extract_insn_normal
58 (CGEN_CPU_DESC
, const CGEN_INSN
*, CGEN_EXTRACT_INFO
*,
59 CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
61 static void put_insn_int_value
62 (CGEN_CPU_DESC
, CGEN_INSN_BYTES_PTR
, int, int, CGEN_INSN_INT
);
65 static CGEN_INLINE
void insert_1
66 (CGEN_CPU_DESC
, unsigned long, int, int, int, unsigned char *);
67 static CGEN_INLINE
int fill_cache
68 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, int, int, bfd_vma
);
69 static CGEN_INLINE
long extract_1
70 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, int, int, int, unsigned char *, bfd_vma
);
73 /* Operand insertion. */
77 /* Subroutine of insert_normal. */
79 static CGEN_INLINE
void
80 insert_1 (CGEN_CPU_DESC cd
,
90 x
= cgen_get_insn_value (cd
, bufp
, word_length
);
92 /* Written this way to avoid undefined behaviour. */
93 mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
95 shift
= (start
+ 1) - length
;
97 shift
= (word_length
- (start
+ length
));
98 x
= (x
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
100 cgen_put_insn_value (cd
, bufp
, word_length
, (bfd_vma
) x
);
103 #endif /* ! CGEN_INT_INSN_P */
105 /* Default insertion routine.
107 ATTRS is a mask of the boolean attributes.
108 WORD_OFFSET is the offset in bits from the start of the insn of the value.
109 WORD_LENGTH is the length of the word in bits in which the value resides.
110 START is the starting bit number in the word, architecture origin.
111 LENGTH is the length of VALUE in bits.
112 TOTAL_LENGTH is the total length of the insn in bits.
114 The result is an error message or NULL if success. */
116 /* ??? This duplicates functionality with bfd's howto table and
117 bfd_install_relocation. */
118 /* ??? This doesn't handle bfd_vma's. Create another function when
122 insert_normal (CGEN_CPU_DESC cd
,
125 unsigned int word_offset
,
128 unsigned int word_length
,
129 unsigned int total_length
,
130 CGEN_INSN_BYTES_PTR buffer
)
132 static char errbuf
[100];
133 /* Written this way to avoid undefined behaviour. */
134 unsigned long mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
136 /* If LENGTH is zero, this operand doesn't contribute to the value. */
140 if (word_length
> 32)
143 /* For architectures with insns smaller than the base-insn-bitsize,
144 word_length may be too big. */
145 if (cd
->min_insn_bitsize
< cd
->base_insn_bitsize
)
148 && word_length
> total_length
)
149 word_length
= total_length
;
152 /* Ensure VALUE will fit. */
153 if (CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGN_OPT
))
155 long minval
= - (1L << (length
- 1));
156 unsigned long maxval
= mask
;
158 if ((value
> 0 && (unsigned long) value
> maxval
)
161 /* xgettext:c-format */
163 _("operand out of range (%ld not between %ld and %lu)"),
164 value
, minval
, maxval
);
168 else if (! CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGNED
))
170 unsigned long maxval
= mask
;
172 if ((unsigned long) value
> maxval
)
174 /* xgettext:c-format */
176 _("operand out of range (%lu not between 0 and %lu)"),
183 if (! cgen_signed_overflow_ok_p (cd
))
185 long minval
= - (1L << (length
- 1));
186 long maxval
= (1L << (length
- 1)) - 1;
188 if (value
< minval
|| value
> maxval
)
191 /* xgettext:c-format */
192 (errbuf
, _("operand out of range (%ld not between %ld and %ld)"),
193 value
, minval
, maxval
);
204 if (CGEN_INSN_LSB0_P
)
205 shift
= (word_offset
+ start
+ 1) - length
;
207 shift
= total_length
- (word_offset
+ start
+ length
);
208 *buffer
= (*buffer
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
211 #else /* ! CGEN_INT_INSN_P */
214 unsigned char *bufp
= (unsigned char *) buffer
+ word_offset
/ 8;
216 insert_1 (cd
, value
, start
, length
, word_length
, bufp
);
219 #endif /* ! CGEN_INT_INSN_P */
224 /* Default insn builder (insert handler).
225 The instruction is recorded in CGEN_INT_INSN_P byte order (meaning
226 that if CGEN_INSN_BYTES_PTR is an int * and thus, the value is
227 recorded in host byte order, otherwise BUFFER is an array of bytes
228 and the value is recorded in target byte order).
229 The result is an error message or NULL if success. */
232 insert_insn_normal (CGEN_CPU_DESC cd
,
233 const CGEN_INSN
* insn
,
234 CGEN_FIELDS
* fields
,
235 CGEN_INSN_BYTES_PTR buffer
,
238 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
240 const CGEN_SYNTAX_CHAR_TYPE
* syn
;
242 CGEN_INIT_INSERT (cd
);
243 value
= CGEN_INSN_BASE_VALUE (insn
);
245 /* If we're recording insns as numbers (rather than a string of bytes),
246 target byte order handling is deferred until later. */
250 put_insn_int_value (cd
, buffer
, cd
->base_insn_bitsize
,
251 CGEN_FIELDS_BITSIZE (fields
), value
);
255 cgen_put_insn_value (cd
, buffer
, min ((unsigned) cd
->base_insn_bitsize
,
256 (unsigned) CGEN_FIELDS_BITSIZE (fields
)),
259 #endif /* ! CGEN_INT_INSN_P */
261 /* ??? It would be better to scan the format's fields.
262 Still need to be able to insert a value based on the operand though;
263 e.g. storing a branch displacement that got resolved later.
264 Needs more thought first. */
266 for (syn
= CGEN_SYNTAX_STRING (syntax
); * syn
; ++ syn
)
270 if (CGEN_SYNTAX_CHAR_P (* syn
))
273 errmsg
= (* cd
->insert_operand
) (cd
, CGEN_SYNTAX_FIELD (*syn
),
283 /* Cover function to store an insn value into an integral insn. Must go here
284 because it needs <prefix>-desc.h for CGEN_INT_INSN_P. */
287 put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
288 CGEN_INSN_BYTES_PTR buf
,
293 /* For architectures with insns smaller than the base-insn-bitsize,
294 length may be too big. */
295 if (length
> insn_length
)
299 int shift
= insn_length
- length
;
300 /* Written this way to avoid undefined behaviour. */
301 CGEN_INSN_INT mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
303 *buf
= (*buf
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
308 /* Operand extraction. */
310 #if ! CGEN_INT_INSN_P
312 /* Subroutine of extract_normal.
313 Ensure sufficient bytes are cached in EX_INFO.
314 OFFSET is the offset in bytes from the start of the insn of the value.
315 BYTES is the length of the needed value.
316 Returns 1 for success, 0 for failure. */
318 static CGEN_INLINE
int
319 fill_cache (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
320 CGEN_EXTRACT_INFO
*ex_info
,
325 /* It's doubtful that the middle part has already been fetched so
326 we don't optimize that case. kiss. */
328 disassemble_info
*info
= (disassemble_info
*) ex_info
->dis_info
;
330 /* First do a quick check. */
331 mask
= (1 << bytes
) - 1;
332 if (((ex_info
->valid
>> offset
) & mask
) == mask
)
335 /* Search for the first byte we need to read. */
336 for (mask
= 1 << offset
; bytes
> 0; --bytes
, ++offset
, mask
<<= 1)
337 if (! (mask
& ex_info
->valid
))
345 status
= (*info
->read_memory_func
)
346 (pc
, ex_info
->insn_bytes
+ offset
, bytes
, info
);
350 (*info
->memory_error_func
) (status
, pc
, info
);
354 ex_info
->valid
|= ((1 << bytes
) - 1) << offset
;
360 /* Subroutine of extract_normal. */
362 static CGEN_INLINE
long
363 extract_1 (CGEN_CPU_DESC cd
,
364 CGEN_EXTRACT_INFO
*ex_info ATTRIBUTE_UNUSED
,
369 bfd_vma pc ATTRIBUTE_UNUSED
)
374 x
= cgen_get_insn_value (cd
, bufp
, word_length
);
376 if (CGEN_INSN_LSB0_P
)
377 shift
= (start
+ 1) - length
;
379 shift
= (word_length
- (start
+ length
));
383 #endif /* ! CGEN_INT_INSN_P */
385 /* Default extraction routine.
387 INSN_VALUE is the first base_insn_bitsize bits of the insn in host order,
388 or sometimes less for cases like the m32r where the base insn size is 32
389 but some insns are 16 bits.
390 ATTRS is a mask of the boolean attributes. We only need `SIGNED',
391 but for generality we take a bitmask of all of them.
392 WORD_OFFSET is the offset in bits from the start of the insn of the value.
393 WORD_LENGTH is the length of the word in bits in which the value resides.
394 START is the starting bit number in the word, architecture origin.
395 LENGTH is the length of VALUE in bits.
396 TOTAL_LENGTH is the total length of the insn in bits.
398 Returns 1 for success, 0 for failure. */
400 /* ??? The return code isn't properly used. wip. */
402 /* ??? This doesn't handle bfd_vma's. Create another function when
406 extract_normal (CGEN_CPU_DESC cd
,
407 #if ! CGEN_INT_INSN_P
408 CGEN_EXTRACT_INFO
*ex_info
,
410 CGEN_EXTRACT_INFO
*ex_info ATTRIBUTE_UNUSED
,
412 CGEN_INSN_INT insn_value
,
414 unsigned int word_offset
,
417 unsigned int word_length
,
418 unsigned int total_length
,
419 #if ! CGEN_INT_INSN_P
422 bfd_vma pc ATTRIBUTE_UNUSED
,
428 /* If LENGTH is zero, this operand doesn't contribute to the value
429 so give it a standard value of zero. */
436 if (word_length
> 32)
439 /* For architectures with insns smaller than the insn-base-bitsize,
440 word_length may be too big. */
441 if (cd
->min_insn_bitsize
< cd
->base_insn_bitsize
)
444 && word_length
> total_length
)
445 word_length
= total_length
;
448 /* Does the value reside in INSN_VALUE, and at the right alignment? */
450 if (CGEN_INT_INSN_P
|| (word_offset
== 0 && word_length
== total_length
))
452 if (CGEN_INSN_LSB0_P
)
453 value
= insn_value
>> ((word_offset
+ start
+ 1) - length
);
455 value
= insn_value
>> (total_length
- ( word_offset
+ start
+ length
));
458 #if ! CGEN_INT_INSN_P
462 unsigned char *bufp
= ex_info
->insn_bytes
+ word_offset
/ 8;
464 if (word_length
> 32)
467 if (fill_cache (cd
, ex_info
, word_offset
/ 8, word_length
/ 8, pc
) == 0)
470 value
= extract_1 (cd
, ex_info
, start
, length
, word_length
, bufp
, pc
);
473 #endif /* ! CGEN_INT_INSN_P */
475 /* Written this way to avoid undefined behaviour. */
476 mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
480 if (CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGNED
)
481 && (value
& (1L << (length
- 1))))
489 /* Default insn extractor.
491 INSN_VALUE is the first base_insn_bitsize bits, translated to host order.
492 The extracted fields are stored in FIELDS.
493 EX_INFO is used to handle reading variable length insns.
494 Return the length of the insn in bits, or 0 if no match,
495 or -1 if an error occurs fetching data (memory_error_func will have
499 extract_insn_normal (CGEN_CPU_DESC cd
,
500 const CGEN_INSN
*insn
,
501 CGEN_EXTRACT_INFO
*ex_info
,
502 CGEN_INSN_INT insn_value
,
506 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
507 const CGEN_SYNTAX_CHAR_TYPE
*syn
;
509 CGEN_FIELDS_BITSIZE (fields
) = CGEN_INSN_BITSIZE (insn
);
511 CGEN_INIT_EXTRACT (cd
);
513 for (syn
= CGEN_SYNTAX_STRING (syntax
); *syn
; ++syn
)
517 if (CGEN_SYNTAX_CHAR_P (*syn
))
520 length
= (* cd
->extract_operand
) (cd
, CGEN_SYNTAX_FIELD (*syn
),
521 ex_info
, insn_value
, fields
, pc
);
526 /* We recognized and successfully extracted this insn. */
527 return CGEN_INSN_BITSIZE (insn
);
530 /* Machine generated code added here. */
532 const char * ms1_cgen_insert_operand
533 (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, CGEN_INSN_BYTES_PTR
, bfd_vma
);
535 /* Main entry point for operand insertion.
537 This function is basically just a big switch statement. Earlier versions
538 used tables to look up the function to use, but
539 - if the table contains both assembler and disassembler functions then
540 the disassembler contains much of the assembler and vice-versa,
541 - there's a lot of inlining possibilities as things grow,
542 - using a switch statement avoids the function call overhead.
544 This function could be moved into `parse_insn_normal', but keeping it
545 separate makes clear the interface between `parse_insn_normal' and each of
546 the handlers. It's also needed by GAS to insert operands that couldn't be
547 resolved during parsing. */
550 ms1_cgen_insert_operand (CGEN_CPU_DESC cd
,
552 CGEN_FIELDS
* fields
,
553 CGEN_INSN_BYTES_PTR buffer
,
554 bfd_vma pc ATTRIBUTE_UNUSED
)
556 const char * errmsg
= NULL
;
557 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
561 case MS1_OPERAND_A23
:
562 errmsg
= insert_normal (cd
, fields
->f_a23
, 0, 0, 23, 1, 32, total_length
, buffer
);
564 case MS1_OPERAND_BALL
:
565 errmsg
= insert_normal (cd
, fields
->f_ball
, 0, 0, 19, 1, 32, total_length
, buffer
);
567 case MS1_OPERAND_BALL2
:
568 errmsg
= insert_normal (cd
, fields
->f_ball2
, 0, 0, 15, 1, 32, total_length
, buffer
);
570 case MS1_OPERAND_BANKADDR
:
571 errmsg
= insert_normal (cd
, fields
->f_bankaddr
, 0, 0, 25, 13, 32, total_length
, buffer
);
573 case MS1_OPERAND_BRC
:
574 errmsg
= insert_normal (cd
, fields
->f_brc
, 0, 0, 18, 3, 32, total_length
, buffer
);
576 case MS1_OPERAND_BRC2
:
577 errmsg
= insert_normal (cd
, fields
->f_brc2
, 0, 0, 14, 3, 32, total_length
, buffer
);
579 case MS1_OPERAND_CBRB
:
580 errmsg
= insert_normal (cd
, fields
->f_cbrb
, 0, 0, 10, 1, 32, total_length
, buffer
);
582 case MS1_OPERAND_CBS
:
583 errmsg
= insert_normal (cd
, fields
->f_cbs
, 0, 0, 19, 2, 32, total_length
, buffer
);
585 case MS1_OPERAND_CBX
:
586 errmsg
= insert_normal (cd
, fields
->f_cbx
, 0, 0, 14, 3, 32, total_length
, buffer
);
588 case MS1_OPERAND_CCB
:
589 errmsg
= insert_normal (cd
, fields
->f_ccb
, 0, 0, 11, 1, 32, total_length
, buffer
);
591 case MS1_OPERAND_CDB
:
592 errmsg
= insert_normal (cd
, fields
->f_cdb
, 0, 0, 10, 1, 32, total_length
, buffer
);
594 case MS1_OPERAND_CELL
:
595 errmsg
= insert_normal (cd
, fields
->f_cell
, 0, 0, 9, 3, 32, total_length
, buffer
);
597 case MS1_OPERAND_COLNUM
:
598 errmsg
= insert_normal (cd
, fields
->f_colnum
, 0, 0, 18, 3, 32, total_length
, buffer
);
600 case MS1_OPERAND_CONTNUM
:
601 errmsg
= insert_normal (cd
, fields
->f_contnum
, 0, 0, 8, 9, 32, total_length
, buffer
);
603 case MS1_OPERAND_CR
:
604 errmsg
= insert_normal (cd
, fields
->f_cr
, 0, 0, 22, 3, 32, total_length
, buffer
);
606 case MS1_OPERAND_CTXDISP
:
607 errmsg
= insert_normal (cd
, fields
->f_ctxdisp
, 0, 0, 5, 6, 32, total_length
, buffer
);
609 case MS1_OPERAND_DUP
:
610 errmsg
= insert_normal (cd
, fields
->f_dup
, 0, 0, 6, 1, 32, total_length
, buffer
);
612 case MS1_OPERAND_FBDISP
:
613 errmsg
= insert_normal (cd
, fields
->f_fbdisp
, 0, 0, 15, 6, 32, total_length
, buffer
);
615 case MS1_OPERAND_FBINCR
:
616 errmsg
= insert_normal (cd
, fields
->f_fbincr
, 0, 0, 23, 4, 32, total_length
, buffer
);
618 case MS1_OPERAND_FRDR
:
619 errmsg
= insert_normal (cd
, fields
->f_dr
, 0|(1<<CGEN_IFLD_ABS_ADDR
), 0, 19, 4, 32, total_length
, buffer
);
621 case MS1_OPERAND_FRDRRR
:
622 errmsg
= insert_normal (cd
, fields
->f_drrr
, 0|(1<<CGEN_IFLD_ABS_ADDR
), 0, 15, 4, 32, total_length
, buffer
);
624 case MS1_OPERAND_FRSR1
:
625 errmsg
= insert_normal (cd
, fields
->f_sr1
, 0|(1<<CGEN_IFLD_ABS_ADDR
), 0, 23, 4, 32, total_length
, buffer
);
627 case MS1_OPERAND_FRSR2
:
628 errmsg
= insert_normal (cd
, fields
->f_sr2
, 0|(1<<CGEN_IFLD_ABS_ADDR
), 0, 19, 4, 32, total_length
, buffer
);
630 case MS1_OPERAND_ID
:
631 errmsg
= insert_normal (cd
, fields
->f_id
, 0, 0, 14, 1, 32, total_length
, buffer
);
633 case MS1_OPERAND_IMM16
:
635 long value
= fields
->f_imm16s
;
636 value
= ((value
) + (0));
637 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 15, 16, 32, total_length
, buffer
);
640 case MS1_OPERAND_IMM16O
:
642 long value
= fields
->f_imm16s
;
643 value
= ((value
) + (0));
644 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 15, 16, 32, total_length
, buffer
);
647 case MS1_OPERAND_IMM16Z
:
648 errmsg
= insert_normal (cd
, fields
->f_imm16u
, 0, 0, 15, 16, 32, total_length
, buffer
);
650 case MS1_OPERAND_INCAMT
:
651 errmsg
= insert_normal (cd
, fields
->f_incamt
, 0, 0, 19, 8, 32, total_length
, buffer
);
653 case MS1_OPERAND_INCR
:
654 errmsg
= insert_normal (cd
, fields
->f_incr
, 0, 0, 17, 6, 32, total_length
, buffer
);
656 case MS1_OPERAND_LENGTH
:
657 errmsg
= insert_normal (cd
, fields
->f_length
, 0, 0, 15, 3, 32, total_length
, buffer
);
659 case MS1_OPERAND_MASK
:
660 errmsg
= insert_normal (cd
, fields
->f_mask
, 0, 0, 25, 16, 32, total_length
, buffer
);
662 case MS1_OPERAND_MASK1
:
663 errmsg
= insert_normal (cd
, fields
->f_mask1
, 0, 0, 22, 3, 32, total_length
, buffer
);
665 case MS1_OPERAND_MODE
:
666 errmsg
= insert_normal (cd
, fields
->f_mode
, 0, 0, 25, 2, 32, total_length
, buffer
);
668 case MS1_OPERAND_PERM
:
669 errmsg
= insert_normal (cd
, fields
->f_perm
, 0, 0, 25, 2, 32, total_length
, buffer
);
671 case MS1_OPERAND_RBBC
:
672 errmsg
= insert_normal (cd
, fields
->f_rbbc
, 0, 0, 25, 2, 32, total_length
, buffer
);
674 case MS1_OPERAND_RC
:
675 errmsg
= insert_normal (cd
, fields
->f_rc
, 0, 0, 15, 1, 32, total_length
, buffer
);
677 case MS1_OPERAND_RC1
:
678 errmsg
= insert_normal (cd
, fields
->f_rc1
, 0, 0, 11, 1, 32, total_length
, buffer
);
680 case MS1_OPERAND_RC2
:
681 errmsg
= insert_normal (cd
, fields
->f_rc2
, 0, 0, 6, 1, 32, total_length
, buffer
);
683 case MS1_OPERAND_RCNUM
:
684 errmsg
= insert_normal (cd
, fields
->f_rcnum
, 0, 0, 14, 3, 32, total_length
, buffer
);
686 case MS1_OPERAND_RDA
:
687 errmsg
= insert_normal (cd
, fields
->f_rda
, 0, 0, 25, 1, 32, total_length
, buffer
);
689 case MS1_OPERAND_ROWNUM
:
690 errmsg
= insert_normal (cd
, fields
->f_rownum
, 0, 0, 14, 3, 32, total_length
, buffer
);
692 case MS1_OPERAND_ROWNUM1
:
693 errmsg
= insert_normal (cd
, fields
->f_rownum1
, 0, 0, 12, 3, 32, total_length
, buffer
);
695 case MS1_OPERAND_ROWNUM2
:
696 errmsg
= insert_normal (cd
, fields
->f_rownum2
, 0, 0, 9, 3, 32, total_length
, buffer
);
698 case MS1_OPERAND_SIZE
:
699 errmsg
= insert_normal (cd
, fields
->f_size
, 0, 0, 13, 14, 32, total_length
, buffer
);
701 case MS1_OPERAND_TYPE
:
702 errmsg
= insert_normal (cd
, fields
->f_type
, 0, 0, 21, 2, 32, total_length
, buffer
);
704 case MS1_OPERAND_WR
:
705 errmsg
= insert_normal (cd
, fields
->f_wr
, 0, 0, 24, 1, 32, total_length
, buffer
);
707 case MS1_OPERAND_XMODE
:
708 errmsg
= insert_normal (cd
, fields
->f_xmode
, 0, 0, 23, 1, 32, total_length
, buffer
);
712 /* xgettext:c-format */
713 fprintf (stderr
, _("Unrecognized field %d while building insn.\n"),
721 int ms1_cgen_extract_operand
722 (CGEN_CPU_DESC
, int, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
724 /* Main entry point for operand extraction.
725 The result is <= 0 for error, >0 for success.
726 ??? Actual values aren't well defined right now.
728 This function is basically just a big switch statement. Earlier versions
729 used tables to look up the function to use, but
730 - if the table contains both assembler and disassembler functions then
731 the disassembler contains much of the assembler and vice-versa,
732 - there's a lot of inlining possibilities as things grow,
733 - using a switch statement avoids the function call overhead.
735 This function could be moved into `print_insn_normal', but keeping it
736 separate makes clear the interface between `print_insn_normal' and each of
740 ms1_cgen_extract_operand (CGEN_CPU_DESC cd
,
742 CGEN_EXTRACT_INFO
*ex_info
,
743 CGEN_INSN_INT insn_value
,
744 CGEN_FIELDS
* fields
,
747 /* Assume success (for those operands that are nops). */
749 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
753 case MS1_OPERAND_A23
:
754 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 23, 1, 32, total_length
, pc
, & fields
->f_a23
);
756 case MS1_OPERAND_BALL
:
757 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 19, 1, 32, total_length
, pc
, & fields
->f_ball
);
759 case MS1_OPERAND_BALL2
:
760 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 1, 32, total_length
, pc
, & fields
->f_ball2
);
762 case MS1_OPERAND_BANKADDR
:
763 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 13, 32, total_length
, pc
, & fields
->f_bankaddr
);
765 case MS1_OPERAND_BRC
:
766 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 18, 3, 32, total_length
, pc
, & fields
->f_brc
);
768 case MS1_OPERAND_BRC2
:
769 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 14, 3, 32, total_length
, pc
, & fields
->f_brc2
);
771 case MS1_OPERAND_CBRB
:
772 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 10, 1, 32, total_length
, pc
, & fields
->f_cbrb
);
774 case MS1_OPERAND_CBS
:
775 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 19, 2, 32, total_length
, pc
, & fields
->f_cbs
);
777 case MS1_OPERAND_CBX
:
778 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 14, 3, 32, total_length
, pc
, & fields
->f_cbx
);
780 case MS1_OPERAND_CCB
:
781 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 1, 32, total_length
, pc
, & fields
->f_ccb
);
783 case MS1_OPERAND_CDB
:
784 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 10, 1, 32, total_length
, pc
, & fields
->f_cdb
);
786 case MS1_OPERAND_CELL
:
787 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 3, 32, total_length
, pc
, & fields
->f_cell
);
789 case MS1_OPERAND_COLNUM
:
790 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 18, 3, 32, total_length
, pc
, & fields
->f_colnum
);
792 case MS1_OPERAND_CONTNUM
:
793 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 9, 32, total_length
, pc
, & fields
->f_contnum
);
795 case MS1_OPERAND_CR
:
796 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 22, 3, 32, total_length
, pc
, & fields
->f_cr
);
798 case MS1_OPERAND_CTXDISP
:
799 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_ctxdisp
);
801 case MS1_OPERAND_DUP
:
802 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 1, 32, total_length
, pc
, & fields
->f_dup
);
804 case MS1_OPERAND_FBDISP
:
805 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 6, 32, total_length
, pc
, & fields
->f_fbdisp
);
807 case MS1_OPERAND_FBINCR
:
808 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 23, 4, 32, total_length
, pc
, & fields
->f_fbincr
);
810 case MS1_OPERAND_FRDR
:
811 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_ABS_ADDR
), 0, 19, 4, 32, total_length
, pc
, & fields
->f_dr
);
813 case MS1_OPERAND_FRDRRR
:
814 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_ABS_ADDR
), 0, 15, 4, 32, total_length
, pc
, & fields
->f_drrr
);
816 case MS1_OPERAND_FRSR1
:
817 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_ABS_ADDR
), 0, 23, 4, 32, total_length
, pc
, & fields
->f_sr1
);
819 case MS1_OPERAND_FRSR2
:
820 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_ABS_ADDR
), 0, 19, 4, 32, total_length
, pc
, & fields
->f_sr2
);
822 case MS1_OPERAND_ID
:
823 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 14, 1, 32, total_length
, pc
, & fields
->f_id
);
825 case MS1_OPERAND_IMM16
:
828 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 15, 16, 32, total_length
, pc
, & value
);
829 value
= ((value
) + (0));
830 fields
->f_imm16s
= value
;
833 case MS1_OPERAND_IMM16O
:
836 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 15, 16, 32, total_length
, pc
, & value
);
837 value
= ((value
) + (0));
838 fields
->f_imm16s
= value
;
841 case MS1_OPERAND_IMM16Z
:
842 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 16, 32, total_length
, pc
, & fields
->f_imm16u
);
844 case MS1_OPERAND_INCAMT
:
845 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 19, 8, 32, total_length
, pc
, & fields
->f_incamt
);
847 case MS1_OPERAND_INCR
:
848 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 6, 32, total_length
, pc
, & fields
->f_incr
);
850 case MS1_OPERAND_LENGTH
:
851 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 3, 32, total_length
, pc
, & fields
->f_length
);
853 case MS1_OPERAND_MASK
:
854 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 16, 32, total_length
, pc
, & fields
->f_mask
);
856 case MS1_OPERAND_MASK1
:
857 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 22, 3, 32, total_length
, pc
, & fields
->f_mask1
);
859 case MS1_OPERAND_MODE
:
860 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 2, 32, total_length
, pc
, & fields
->f_mode
);
862 case MS1_OPERAND_PERM
:
863 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 2, 32, total_length
, pc
, & fields
->f_perm
);
865 case MS1_OPERAND_RBBC
:
866 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 2, 32, total_length
, pc
, & fields
->f_rbbc
);
868 case MS1_OPERAND_RC
:
869 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 1, 32, total_length
, pc
, & fields
->f_rc
);
871 case MS1_OPERAND_RC1
:
872 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 1, 32, total_length
, pc
, & fields
->f_rc1
);
874 case MS1_OPERAND_RC2
:
875 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 1, 32, total_length
, pc
, & fields
->f_rc2
);
877 case MS1_OPERAND_RCNUM
:
878 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 14, 3, 32, total_length
, pc
, & fields
->f_rcnum
);
880 case MS1_OPERAND_RDA
:
881 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 1, 32, total_length
, pc
, & fields
->f_rda
);
883 case MS1_OPERAND_ROWNUM
:
884 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 14, 3, 32, total_length
, pc
, & fields
->f_rownum
);
886 case MS1_OPERAND_ROWNUM1
:
887 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 12, 3, 32, total_length
, pc
, & fields
->f_rownum1
);
889 case MS1_OPERAND_ROWNUM2
:
890 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 3, 32, total_length
, pc
, & fields
->f_rownum2
);
892 case MS1_OPERAND_SIZE
:
893 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 13, 14, 32, total_length
, pc
, & fields
->f_size
);
895 case MS1_OPERAND_TYPE
:
896 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 21, 2, 32, total_length
, pc
, & fields
->f_type
);
898 case MS1_OPERAND_WR
:
899 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 24, 1, 32, total_length
, pc
, & fields
->f_wr
);
901 case MS1_OPERAND_XMODE
:
902 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 23, 1, 32, total_length
, pc
, & fields
->f_xmode
);
906 /* xgettext:c-format */
907 fprintf (stderr
, _("Unrecognized field %d while decoding insn.\n"),
915 cgen_insert_fn
* const ms1_cgen_insert_handlers
[] =
920 cgen_extract_fn
* const ms1_cgen_extract_handlers
[] =
925 int ms1_cgen_get_int_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
926 bfd_vma
ms1_cgen_get_vma_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
928 /* Getting values from cgen_fields is handled by a collection of functions.
929 They are distinguished by the type of the VALUE argument they return.
930 TODO: floating point, inlining support, remove cases where result type
934 ms1_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
936 const CGEN_FIELDS
* fields
)
942 case MS1_OPERAND_A23
:
943 value
= fields
->f_a23
;
945 case MS1_OPERAND_BALL
:
946 value
= fields
->f_ball
;
948 case MS1_OPERAND_BALL2
:
949 value
= fields
->f_ball2
;
951 case MS1_OPERAND_BANKADDR
:
952 value
= fields
->f_bankaddr
;
954 case MS1_OPERAND_BRC
:
955 value
= fields
->f_brc
;
957 case MS1_OPERAND_BRC2
:
958 value
= fields
->f_brc2
;
960 case MS1_OPERAND_CBRB
:
961 value
= fields
->f_cbrb
;
963 case MS1_OPERAND_CBS
:
964 value
= fields
->f_cbs
;
966 case MS1_OPERAND_CBX
:
967 value
= fields
->f_cbx
;
969 case MS1_OPERAND_CCB
:
970 value
= fields
->f_ccb
;
972 case MS1_OPERAND_CDB
:
973 value
= fields
->f_cdb
;
975 case MS1_OPERAND_CELL
:
976 value
= fields
->f_cell
;
978 case MS1_OPERAND_COLNUM
:
979 value
= fields
->f_colnum
;
981 case MS1_OPERAND_CONTNUM
:
982 value
= fields
->f_contnum
;
984 case MS1_OPERAND_CR
:
985 value
= fields
->f_cr
;
987 case MS1_OPERAND_CTXDISP
:
988 value
= fields
->f_ctxdisp
;
990 case MS1_OPERAND_DUP
:
991 value
= fields
->f_dup
;
993 case MS1_OPERAND_FBDISP
:
994 value
= fields
->f_fbdisp
;
996 case MS1_OPERAND_FBINCR
:
997 value
= fields
->f_fbincr
;
999 case MS1_OPERAND_FRDR
:
1000 value
= fields
->f_dr
;
1002 case MS1_OPERAND_FRDRRR
:
1003 value
= fields
->f_drrr
;
1005 case MS1_OPERAND_FRSR1
:
1006 value
= fields
->f_sr1
;
1008 case MS1_OPERAND_FRSR2
:
1009 value
= fields
->f_sr2
;
1011 case MS1_OPERAND_ID
:
1012 value
= fields
->f_id
;
1014 case MS1_OPERAND_IMM16
:
1015 value
= fields
->f_imm16s
;
1017 case MS1_OPERAND_IMM16O
:
1018 value
= fields
->f_imm16s
;
1020 case MS1_OPERAND_IMM16Z
:
1021 value
= fields
->f_imm16u
;
1023 case MS1_OPERAND_INCAMT
:
1024 value
= fields
->f_incamt
;
1026 case MS1_OPERAND_INCR
:
1027 value
= fields
->f_incr
;
1029 case MS1_OPERAND_LENGTH
:
1030 value
= fields
->f_length
;
1032 case MS1_OPERAND_MASK
:
1033 value
= fields
->f_mask
;
1035 case MS1_OPERAND_MASK1
:
1036 value
= fields
->f_mask1
;
1038 case MS1_OPERAND_MODE
:
1039 value
= fields
->f_mode
;
1041 case MS1_OPERAND_PERM
:
1042 value
= fields
->f_perm
;
1044 case MS1_OPERAND_RBBC
:
1045 value
= fields
->f_rbbc
;
1047 case MS1_OPERAND_RC
:
1048 value
= fields
->f_rc
;
1050 case MS1_OPERAND_RC1
:
1051 value
= fields
->f_rc1
;
1053 case MS1_OPERAND_RC2
:
1054 value
= fields
->f_rc2
;
1056 case MS1_OPERAND_RCNUM
:
1057 value
= fields
->f_rcnum
;
1059 case MS1_OPERAND_RDA
:
1060 value
= fields
->f_rda
;
1062 case MS1_OPERAND_ROWNUM
:
1063 value
= fields
->f_rownum
;
1065 case MS1_OPERAND_ROWNUM1
:
1066 value
= fields
->f_rownum1
;
1068 case MS1_OPERAND_ROWNUM2
:
1069 value
= fields
->f_rownum2
;
1071 case MS1_OPERAND_SIZE
:
1072 value
= fields
->f_size
;
1074 case MS1_OPERAND_TYPE
:
1075 value
= fields
->f_type
;
1077 case MS1_OPERAND_WR
:
1078 value
= fields
->f_wr
;
1080 case MS1_OPERAND_XMODE
:
1081 value
= fields
->f_xmode
;
1085 /* xgettext:c-format */
1086 fprintf (stderr
, _("Unrecognized field %d while getting int operand.\n"),
1095 ms1_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1097 const CGEN_FIELDS
* fields
)
1103 case MS1_OPERAND_A23
:
1104 value
= fields
->f_a23
;
1106 case MS1_OPERAND_BALL
:
1107 value
= fields
->f_ball
;
1109 case MS1_OPERAND_BALL2
:
1110 value
= fields
->f_ball2
;
1112 case MS1_OPERAND_BANKADDR
:
1113 value
= fields
->f_bankaddr
;
1115 case MS1_OPERAND_BRC
:
1116 value
= fields
->f_brc
;
1118 case MS1_OPERAND_BRC2
:
1119 value
= fields
->f_brc2
;
1121 case MS1_OPERAND_CBRB
:
1122 value
= fields
->f_cbrb
;
1124 case MS1_OPERAND_CBS
:
1125 value
= fields
->f_cbs
;
1127 case MS1_OPERAND_CBX
:
1128 value
= fields
->f_cbx
;
1130 case MS1_OPERAND_CCB
:
1131 value
= fields
->f_ccb
;
1133 case MS1_OPERAND_CDB
:
1134 value
= fields
->f_cdb
;
1136 case MS1_OPERAND_CELL
:
1137 value
= fields
->f_cell
;
1139 case MS1_OPERAND_COLNUM
:
1140 value
= fields
->f_colnum
;
1142 case MS1_OPERAND_CONTNUM
:
1143 value
= fields
->f_contnum
;
1145 case MS1_OPERAND_CR
:
1146 value
= fields
->f_cr
;
1148 case MS1_OPERAND_CTXDISP
:
1149 value
= fields
->f_ctxdisp
;
1151 case MS1_OPERAND_DUP
:
1152 value
= fields
->f_dup
;
1154 case MS1_OPERAND_FBDISP
:
1155 value
= fields
->f_fbdisp
;
1157 case MS1_OPERAND_FBINCR
:
1158 value
= fields
->f_fbincr
;
1160 case MS1_OPERAND_FRDR
:
1161 value
= fields
->f_dr
;
1163 case MS1_OPERAND_FRDRRR
:
1164 value
= fields
->f_drrr
;
1166 case MS1_OPERAND_FRSR1
:
1167 value
= fields
->f_sr1
;
1169 case MS1_OPERAND_FRSR2
:
1170 value
= fields
->f_sr2
;
1172 case MS1_OPERAND_ID
:
1173 value
= fields
->f_id
;
1175 case MS1_OPERAND_IMM16
:
1176 value
= fields
->f_imm16s
;
1178 case MS1_OPERAND_IMM16O
:
1179 value
= fields
->f_imm16s
;
1181 case MS1_OPERAND_IMM16Z
:
1182 value
= fields
->f_imm16u
;
1184 case MS1_OPERAND_INCAMT
:
1185 value
= fields
->f_incamt
;
1187 case MS1_OPERAND_INCR
:
1188 value
= fields
->f_incr
;
1190 case MS1_OPERAND_LENGTH
:
1191 value
= fields
->f_length
;
1193 case MS1_OPERAND_MASK
:
1194 value
= fields
->f_mask
;
1196 case MS1_OPERAND_MASK1
:
1197 value
= fields
->f_mask1
;
1199 case MS1_OPERAND_MODE
:
1200 value
= fields
->f_mode
;
1202 case MS1_OPERAND_PERM
:
1203 value
= fields
->f_perm
;
1205 case MS1_OPERAND_RBBC
:
1206 value
= fields
->f_rbbc
;
1208 case MS1_OPERAND_RC
:
1209 value
= fields
->f_rc
;
1211 case MS1_OPERAND_RC1
:
1212 value
= fields
->f_rc1
;
1214 case MS1_OPERAND_RC2
:
1215 value
= fields
->f_rc2
;
1217 case MS1_OPERAND_RCNUM
:
1218 value
= fields
->f_rcnum
;
1220 case MS1_OPERAND_RDA
:
1221 value
= fields
->f_rda
;
1223 case MS1_OPERAND_ROWNUM
:
1224 value
= fields
->f_rownum
;
1226 case MS1_OPERAND_ROWNUM1
:
1227 value
= fields
->f_rownum1
;
1229 case MS1_OPERAND_ROWNUM2
:
1230 value
= fields
->f_rownum2
;
1232 case MS1_OPERAND_SIZE
:
1233 value
= fields
->f_size
;
1235 case MS1_OPERAND_TYPE
:
1236 value
= fields
->f_type
;
1238 case MS1_OPERAND_WR
:
1239 value
= fields
->f_wr
;
1241 case MS1_OPERAND_XMODE
:
1242 value
= fields
->f_xmode
;
1246 /* xgettext:c-format */
1247 fprintf (stderr
, _("Unrecognized field %d while getting vma operand.\n"),
1255 void ms1_cgen_set_int_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, int);
1256 void ms1_cgen_set_vma_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, bfd_vma
);
1258 /* Stuffing values in cgen_fields is handled by a collection of functions.
1259 They are distinguished by the type of the VALUE argument they accept.
1260 TODO: floating point, inlining support, remove cases where argument type
1264 ms1_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1266 CGEN_FIELDS
* fields
,
1271 case MS1_OPERAND_A23
:
1272 fields
->f_a23
= value
;
1274 case MS1_OPERAND_BALL
:
1275 fields
->f_ball
= value
;
1277 case MS1_OPERAND_BALL2
:
1278 fields
->f_ball2
= value
;
1280 case MS1_OPERAND_BANKADDR
:
1281 fields
->f_bankaddr
= value
;
1283 case MS1_OPERAND_BRC
:
1284 fields
->f_brc
= value
;
1286 case MS1_OPERAND_BRC2
:
1287 fields
->f_brc2
= value
;
1289 case MS1_OPERAND_CBRB
:
1290 fields
->f_cbrb
= value
;
1292 case MS1_OPERAND_CBS
:
1293 fields
->f_cbs
= value
;
1295 case MS1_OPERAND_CBX
:
1296 fields
->f_cbx
= value
;
1298 case MS1_OPERAND_CCB
:
1299 fields
->f_ccb
= value
;
1301 case MS1_OPERAND_CDB
:
1302 fields
->f_cdb
= value
;
1304 case MS1_OPERAND_CELL
:
1305 fields
->f_cell
= value
;
1307 case MS1_OPERAND_COLNUM
:
1308 fields
->f_colnum
= value
;
1310 case MS1_OPERAND_CONTNUM
:
1311 fields
->f_contnum
= value
;
1313 case MS1_OPERAND_CR
:
1314 fields
->f_cr
= value
;
1316 case MS1_OPERAND_CTXDISP
:
1317 fields
->f_ctxdisp
= value
;
1319 case MS1_OPERAND_DUP
:
1320 fields
->f_dup
= value
;
1322 case MS1_OPERAND_FBDISP
:
1323 fields
->f_fbdisp
= value
;
1325 case MS1_OPERAND_FBINCR
:
1326 fields
->f_fbincr
= value
;
1328 case MS1_OPERAND_FRDR
:
1329 fields
->f_dr
= value
;
1331 case MS1_OPERAND_FRDRRR
:
1332 fields
->f_drrr
= value
;
1334 case MS1_OPERAND_FRSR1
:
1335 fields
->f_sr1
= value
;
1337 case MS1_OPERAND_FRSR2
:
1338 fields
->f_sr2
= value
;
1340 case MS1_OPERAND_ID
:
1341 fields
->f_id
= value
;
1343 case MS1_OPERAND_IMM16
:
1344 fields
->f_imm16s
= value
;
1346 case MS1_OPERAND_IMM16O
:
1347 fields
->f_imm16s
= value
;
1349 case MS1_OPERAND_IMM16Z
:
1350 fields
->f_imm16u
= value
;
1352 case MS1_OPERAND_INCAMT
:
1353 fields
->f_incamt
= value
;
1355 case MS1_OPERAND_INCR
:
1356 fields
->f_incr
= value
;
1358 case MS1_OPERAND_LENGTH
:
1359 fields
->f_length
= value
;
1361 case MS1_OPERAND_MASK
:
1362 fields
->f_mask
= value
;
1364 case MS1_OPERAND_MASK1
:
1365 fields
->f_mask1
= value
;
1367 case MS1_OPERAND_MODE
:
1368 fields
->f_mode
= value
;
1370 case MS1_OPERAND_PERM
:
1371 fields
->f_perm
= value
;
1373 case MS1_OPERAND_RBBC
:
1374 fields
->f_rbbc
= value
;
1376 case MS1_OPERAND_RC
:
1377 fields
->f_rc
= value
;
1379 case MS1_OPERAND_RC1
:
1380 fields
->f_rc1
= value
;
1382 case MS1_OPERAND_RC2
:
1383 fields
->f_rc2
= value
;
1385 case MS1_OPERAND_RCNUM
:
1386 fields
->f_rcnum
= value
;
1388 case MS1_OPERAND_RDA
:
1389 fields
->f_rda
= value
;
1391 case MS1_OPERAND_ROWNUM
:
1392 fields
->f_rownum
= value
;
1394 case MS1_OPERAND_ROWNUM1
:
1395 fields
->f_rownum1
= value
;
1397 case MS1_OPERAND_ROWNUM2
:
1398 fields
->f_rownum2
= value
;
1400 case MS1_OPERAND_SIZE
:
1401 fields
->f_size
= value
;
1403 case MS1_OPERAND_TYPE
:
1404 fields
->f_type
= value
;
1406 case MS1_OPERAND_WR
:
1407 fields
->f_wr
= value
;
1409 case MS1_OPERAND_XMODE
:
1410 fields
->f_xmode
= value
;
1414 /* xgettext:c-format */
1415 fprintf (stderr
, _("Unrecognized field %d while setting int operand.\n"),
1422 ms1_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1424 CGEN_FIELDS
* fields
,
1429 case MS1_OPERAND_A23
:
1430 fields
->f_a23
= value
;
1432 case MS1_OPERAND_BALL
:
1433 fields
->f_ball
= value
;
1435 case MS1_OPERAND_BALL2
:
1436 fields
->f_ball2
= value
;
1438 case MS1_OPERAND_BANKADDR
:
1439 fields
->f_bankaddr
= value
;
1441 case MS1_OPERAND_BRC
:
1442 fields
->f_brc
= value
;
1444 case MS1_OPERAND_BRC2
:
1445 fields
->f_brc2
= value
;
1447 case MS1_OPERAND_CBRB
:
1448 fields
->f_cbrb
= value
;
1450 case MS1_OPERAND_CBS
:
1451 fields
->f_cbs
= value
;
1453 case MS1_OPERAND_CBX
:
1454 fields
->f_cbx
= value
;
1456 case MS1_OPERAND_CCB
:
1457 fields
->f_ccb
= value
;
1459 case MS1_OPERAND_CDB
:
1460 fields
->f_cdb
= value
;
1462 case MS1_OPERAND_CELL
:
1463 fields
->f_cell
= value
;
1465 case MS1_OPERAND_COLNUM
:
1466 fields
->f_colnum
= value
;
1468 case MS1_OPERAND_CONTNUM
:
1469 fields
->f_contnum
= value
;
1471 case MS1_OPERAND_CR
:
1472 fields
->f_cr
= value
;
1474 case MS1_OPERAND_CTXDISP
:
1475 fields
->f_ctxdisp
= value
;
1477 case MS1_OPERAND_DUP
:
1478 fields
->f_dup
= value
;
1480 case MS1_OPERAND_FBDISP
:
1481 fields
->f_fbdisp
= value
;
1483 case MS1_OPERAND_FBINCR
:
1484 fields
->f_fbincr
= value
;
1486 case MS1_OPERAND_FRDR
:
1487 fields
->f_dr
= value
;
1489 case MS1_OPERAND_FRDRRR
:
1490 fields
->f_drrr
= value
;
1492 case MS1_OPERAND_FRSR1
:
1493 fields
->f_sr1
= value
;
1495 case MS1_OPERAND_FRSR2
:
1496 fields
->f_sr2
= value
;
1498 case MS1_OPERAND_ID
:
1499 fields
->f_id
= value
;
1501 case MS1_OPERAND_IMM16
:
1502 fields
->f_imm16s
= value
;
1504 case MS1_OPERAND_IMM16O
:
1505 fields
->f_imm16s
= value
;
1507 case MS1_OPERAND_IMM16Z
:
1508 fields
->f_imm16u
= value
;
1510 case MS1_OPERAND_INCAMT
:
1511 fields
->f_incamt
= value
;
1513 case MS1_OPERAND_INCR
:
1514 fields
->f_incr
= value
;
1516 case MS1_OPERAND_LENGTH
:
1517 fields
->f_length
= value
;
1519 case MS1_OPERAND_MASK
:
1520 fields
->f_mask
= value
;
1522 case MS1_OPERAND_MASK1
:
1523 fields
->f_mask1
= value
;
1525 case MS1_OPERAND_MODE
:
1526 fields
->f_mode
= value
;
1528 case MS1_OPERAND_PERM
:
1529 fields
->f_perm
= value
;
1531 case MS1_OPERAND_RBBC
:
1532 fields
->f_rbbc
= value
;
1534 case MS1_OPERAND_RC
:
1535 fields
->f_rc
= value
;
1537 case MS1_OPERAND_RC1
:
1538 fields
->f_rc1
= value
;
1540 case MS1_OPERAND_RC2
:
1541 fields
->f_rc2
= value
;
1543 case MS1_OPERAND_RCNUM
:
1544 fields
->f_rcnum
= value
;
1546 case MS1_OPERAND_RDA
:
1547 fields
->f_rda
= value
;
1549 case MS1_OPERAND_ROWNUM
:
1550 fields
->f_rownum
= value
;
1552 case MS1_OPERAND_ROWNUM1
:
1553 fields
->f_rownum1
= value
;
1555 case MS1_OPERAND_ROWNUM2
:
1556 fields
->f_rownum2
= value
;
1558 case MS1_OPERAND_SIZE
:
1559 fields
->f_size
= value
;
1561 case MS1_OPERAND_TYPE
:
1562 fields
->f_type
= value
;
1564 case MS1_OPERAND_WR
:
1565 fields
->f_wr
= value
;
1567 case MS1_OPERAND_XMODE
:
1568 fields
->f_xmode
= value
;
1572 /* xgettext:c-format */
1573 fprintf (stderr
, _("Unrecognized field %d while setting vma operand.\n"),
1579 /* Function to call before using the instruction builder tables. */
1582 ms1_cgen_init_ibld_table (CGEN_CPU_DESC cd
)
1584 cd
->insert_handlers
= & ms1_cgen_insert_handlers
[0];
1585 cd
->extract_handlers
= & ms1_cgen_extract_handlers
[0];
1587 cd
->insert_operand
= ms1_cgen_insert_operand
;
1588 cd
->extract_operand
= ms1_cgen_extract_operand
;
1590 cd
->get_int_operand
= ms1_cgen_get_int_operand
;
1591 cd
->set_int_operand
= ms1_cgen_set_int_operand
;
1592 cd
->get_vma_operand
= ms1_cgen_get_vma_operand
;
1593 cd
->set_vma_operand
= ms1_cgen_set_vma_operand
;