1 /* Instruction building/extraction support for arc. -*- 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)
16 It is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19 License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
25 /* ??? Eventually more and more of this stuff can go to cpu-independent files.
37 #include "safe-ctype.h"
40 #define min(a,b) ((a) < (b) ? (a) : (b))
42 #define max(a,b) ((a) > (b) ? (a) : (b))
44 /* Used by the ifield rtx function. */
45 #define FLD(f) (fields->f)
47 static const char * insert_normal
48 (CGEN_CPU_DESC
, long, unsigned int, unsigned int, unsigned int,
49 unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR
);
50 static const char * insert_insn_normal
51 (CGEN_CPU_DESC
, const CGEN_INSN
*,
52 CGEN_FIELDS
*, CGEN_INSN_BYTES_PTR
, bfd_vma
);
53 static int extract_normal
54 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
,
55 unsigned int, unsigned int, unsigned int, unsigned int,
56 unsigned int, unsigned int, bfd_vma
, long *);
57 static int extract_insn_normal
58 (CGEN_CPU_DESC
, const CGEN_INSN
*, CGEN_EXTRACT_INFO
*,
59 CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
61 static void put_insn_int_value
62 (CGEN_CPU_DESC
, CGEN_INSN_BYTES_PTR
, int, int, CGEN_INSN_INT
);
65 static CGEN_INLINE
void insert_1
66 (CGEN_CPU_DESC
, unsigned long, int, int, int, unsigned char *);
67 static CGEN_INLINE
int fill_cache
68 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, int, int, bfd_vma
);
69 static CGEN_INLINE
long extract_1
70 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, int, int, int, unsigned char *, bfd_vma
);
73 /* Operand insertion. */
77 /* Subroutine of insert_normal. */
79 static CGEN_INLINE
void
80 insert_1 (CGEN_CPU_DESC cd
,
90 x
= cgen_get_insn_value (cd
, bufp
, word_length
);
92 /* Written this way to avoid undefined behaviour. */
93 mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
95 shift
= (start
+ 1) - length
;
97 shift
= (word_length
- (start
+ length
));
98 x
= (x
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
100 cgen_put_insn_value (cd
, bufp
, word_length
, (bfd_vma
) x
);
103 #endif /* ! CGEN_INT_INSN_P */
105 /* Default insertion routine.
107 ATTRS is a mask of the boolean attributes.
108 WORD_OFFSET is the offset in bits from the start of the insn of the value.
109 WORD_LENGTH is the length of the word in bits in which the value resides.
110 START is the starting bit number in the word, architecture origin.
111 LENGTH is the length of VALUE in bits.
112 TOTAL_LENGTH is the total length of the insn in bits.
114 The result is an error message or NULL if success. */
116 /* ??? This duplicates functionality with bfd's howto table and
117 bfd_install_relocation. */
118 /* ??? This doesn't handle bfd_vma's. Create another function when
122 insert_normal (CGEN_CPU_DESC cd
,
125 unsigned int word_offset
,
128 unsigned int word_length
,
129 unsigned int total_length
,
130 CGEN_INSN_BYTES_PTR buffer
)
132 static char errbuf
[100];
133 /* Written this way to avoid undefined behaviour. */
134 unsigned long mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
136 /* If LENGTH is zero, this operand doesn't contribute to the value. */
140 if (word_length
> 32)
143 /* For architectures with insns smaller than the base-insn-bitsize,
144 word_length may be too big. */
145 if (cd
->min_insn_bitsize
< cd
->base_insn_bitsize
)
148 && word_length
> total_length
)
149 word_length
= total_length
;
152 /* Ensure VALUE will fit. */
153 if (CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGN_OPT
))
155 long minval
= - (1L << (length
- 1));
156 unsigned long maxval
= mask
;
158 if ((value
> 0 && (unsigned long) value
> maxval
)
161 /* xgettext:c-format */
163 _("operand out of range (%ld not between %ld and %lu)"),
164 value
, minval
, maxval
);
168 else if (! CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGNED
))
170 unsigned long maxval
= mask
;
171 unsigned long val
= (unsigned long) value
;
173 /* For hosts with a word size > 32 check to see if value has been sign
174 extended beyond 32 bits. If so then ignore these higher sign bits
175 as the user is attempting to store a 32-bit signed value into an
176 unsigned 32-bit field which is allowed. */
177 if (sizeof (unsigned long) > 4 && ((value
>> 32) == -1))
182 /* xgettext:c-format */
184 _("operand out of range (0x%lx not between 0 and 0x%lx)"),
191 if (! cgen_signed_overflow_ok_p (cd
))
193 long minval
= - (1L << (length
- 1));
194 long maxval
= (1L << (length
- 1)) - 1;
196 if (value
< minval
|| value
> maxval
)
199 /* xgettext:c-format */
200 (errbuf
, _("operand out of range (%ld not between %ld and %ld)"),
201 value
, minval
, maxval
);
212 if (CGEN_INSN_LSB0_P
)
213 shift
= (word_offset
+ start
+ 1) - length
;
215 shift
= total_length
- (word_offset
+ start
+ length
);
216 *buffer
= (*buffer
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
219 #else /* ! CGEN_INT_INSN_P */
222 unsigned char *bufp
= (unsigned char *) buffer
+ word_offset
/ 8;
224 insert_1 (cd
, value
, start
, length
, word_length
, bufp
);
227 #endif /* ! CGEN_INT_INSN_P */
232 /* Default insn builder (insert handler).
233 The instruction is recorded in CGEN_INT_INSN_P byte order (meaning
234 that if CGEN_INSN_BYTES_PTR is an int * and thus, the value is
235 recorded in host byte order, otherwise BUFFER is an array of bytes
236 and the value is recorded in target byte order).
237 The result is an error message or NULL if success. */
240 insert_insn_normal (CGEN_CPU_DESC cd
,
241 const CGEN_INSN
* insn
,
242 CGEN_FIELDS
* fields
,
243 CGEN_INSN_BYTES_PTR buffer
,
246 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
248 const CGEN_SYNTAX_CHAR_TYPE
* syn
;
250 CGEN_INIT_INSERT (cd
);
251 value
= CGEN_INSN_BASE_VALUE (insn
);
253 /* If we're recording insns as numbers (rather than a string of bytes),
254 target byte order handling is deferred until later. */
258 put_insn_int_value (cd
, buffer
, cd
->base_insn_bitsize
,
259 CGEN_FIELDS_BITSIZE (fields
), value
);
263 cgen_put_insn_value (cd
, buffer
, min ((unsigned) cd
->base_insn_bitsize
,
264 (unsigned) CGEN_FIELDS_BITSIZE (fields
)),
267 #endif /* ! CGEN_INT_INSN_P */
269 /* ??? It would be better to scan the format's fields.
270 Still need to be able to insert a value based on the operand though;
271 e.g. storing a branch displacement that got resolved later.
272 Needs more thought first. */
274 for (syn
= CGEN_SYNTAX_STRING (syntax
); * syn
; ++ syn
)
278 if (CGEN_SYNTAX_CHAR_P (* syn
))
281 errmsg
= (* cd
->insert_operand
) (cd
, CGEN_SYNTAX_FIELD (*syn
),
291 /* Cover function to store an insn value into an integral insn. Must go here
292 because it needs <prefix>-desc.h for CGEN_INT_INSN_P. */
295 put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
296 CGEN_INSN_BYTES_PTR buf
,
301 /* For architectures with insns smaller than the base-insn-bitsize,
302 length may be too big. */
303 if (length
> insn_length
)
307 int shift
= insn_length
- length
;
308 /* Written this way to avoid undefined behaviour. */
309 CGEN_INSN_INT mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
311 *buf
= (*buf
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
316 /* Operand extraction. */
318 #if ! CGEN_INT_INSN_P
320 /* Subroutine of extract_normal.
321 Ensure sufficient bytes are cached in EX_INFO.
322 OFFSET is the offset in bytes from the start of the insn of the value.
323 BYTES is the length of the needed value.
324 Returns 1 for success, 0 for failure. */
326 static CGEN_INLINE
int
327 fill_cache (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
328 CGEN_EXTRACT_INFO
*ex_info
,
333 /* It's doubtful that the middle part has already been fetched so
334 we don't optimize that case. kiss. */
336 disassemble_info
*info
= (disassemble_info
*) ex_info
->dis_info
;
338 /* First do a quick check. */
339 mask
= (1 << bytes
) - 1;
340 if (((ex_info
->valid
>> offset
) & mask
) == mask
)
343 /* Search for the first byte we need to read. */
344 for (mask
= 1 << offset
; bytes
> 0; --bytes
, ++offset
, mask
<<= 1)
345 if (! (mask
& ex_info
->valid
))
353 status
= (*info
->read_memory_func
)
354 (pc
, ex_info
->insn_bytes
+ offset
, bytes
, info
);
358 (*info
->memory_error_func
) (status
, pc
, info
);
362 ex_info
->valid
|= ((1 << bytes
) - 1) << offset
;
368 /* Subroutine of extract_normal. */
370 static CGEN_INLINE
long
371 extract_1 (CGEN_CPU_DESC cd
,
372 CGEN_EXTRACT_INFO
*ex_info ATTRIBUTE_UNUSED
,
377 bfd_vma pc ATTRIBUTE_UNUSED
)
382 x
= cgen_get_insn_value (cd
, bufp
, word_length
);
384 if (CGEN_INSN_LSB0_P
)
385 shift
= (start
+ 1) - length
;
387 shift
= (word_length
- (start
+ length
));
391 #endif /* ! CGEN_INT_INSN_P */
393 /* Default extraction routine.
395 INSN_VALUE is the first base_insn_bitsize bits of the insn in host order,
396 or sometimes less for cases like the m32r where the base insn size is 32
397 but some insns are 16 bits.
398 ATTRS is a mask of the boolean attributes. We only need `SIGNED',
399 but for generality we take a bitmask of all of them.
400 WORD_OFFSET is the offset in bits from the start of the insn of the value.
401 WORD_LENGTH is the length of the word in bits in which the value resides.
402 START is the starting bit number in the word, architecture origin.
403 LENGTH is the length of VALUE in bits.
404 TOTAL_LENGTH is the total length of the insn in bits.
406 Returns 1 for success, 0 for failure. */
408 /* ??? The return code isn't properly used. wip. */
410 /* ??? This doesn't handle bfd_vma's. Create another function when
414 extract_normal (CGEN_CPU_DESC cd
,
415 #if ! CGEN_INT_INSN_P
416 CGEN_EXTRACT_INFO
*ex_info
,
418 CGEN_EXTRACT_INFO
*ex_info ATTRIBUTE_UNUSED
,
420 CGEN_INSN_INT insn_value
,
422 unsigned int word_offset
,
425 unsigned int word_length
,
426 unsigned int total_length
,
427 #if ! CGEN_INT_INSN_P
430 bfd_vma pc ATTRIBUTE_UNUSED
,
436 /* If LENGTH is zero, this operand doesn't contribute to the value
437 so give it a standard value of zero. */
444 if (word_length
> 32)
447 /* For architectures with insns smaller than the insn-base-bitsize,
448 word_length may be too big. */
449 if (cd
->min_insn_bitsize
< cd
->base_insn_bitsize
)
451 if (word_offset
+ word_length
> total_length
)
452 word_length
= total_length
- word_offset
;
455 /* Does the value reside in INSN_VALUE, and at the right alignment? */
457 if (CGEN_INT_INSN_P
|| (word_offset
== 0 && word_length
== total_length
))
459 if (CGEN_INSN_LSB0_P
)
460 value
= insn_value
>> ((word_offset
+ start
+ 1) - length
);
462 value
= insn_value
>> (total_length
- ( word_offset
+ start
+ length
));
465 #if ! CGEN_INT_INSN_P
469 unsigned char *bufp
= ex_info
->insn_bytes
+ word_offset
/ 8;
471 if (word_length
> 32)
474 if (fill_cache (cd
, ex_info
, word_offset
/ 8, word_length
/ 8, pc
) == 0)
477 value
= extract_1 (cd
, ex_info
, start
, length
, word_length
, bufp
, pc
);
480 #endif /* ! CGEN_INT_INSN_P */
482 /* Written this way to avoid undefined behaviour. */
483 mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
487 if (CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGNED
)
488 && (value
& (1L << (length
- 1))))
496 /* Default insn extractor.
498 INSN_VALUE is the first base_insn_bitsize bits, translated to host order.
499 The extracted fields are stored in FIELDS.
500 EX_INFO is used to handle reading variable length insns.
501 Return the length of the insn in bits, or 0 if no match,
502 or -1 if an error occurs fetching data (memory_error_func will have
506 extract_insn_normal (CGEN_CPU_DESC cd
,
507 const CGEN_INSN
*insn
,
508 CGEN_EXTRACT_INFO
*ex_info
,
509 CGEN_INSN_INT insn_value
,
513 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
514 const CGEN_SYNTAX_CHAR_TYPE
*syn
;
516 CGEN_FIELDS_BITSIZE (fields
) = CGEN_INSN_BITSIZE (insn
);
518 CGEN_INIT_EXTRACT (cd
);
520 for (syn
= CGEN_SYNTAX_STRING (syntax
); *syn
; ++syn
)
524 if (CGEN_SYNTAX_CHAR_P (*syn
))
527 length
= (* cd
->extract_operand
) (cd
, CGEN_SYNTAX_FIELD (*syn
),
528 ex_info
, insn_value
, fields
, pc
);
533 /* We recognized and successfully extracted this insn. */
534 return CGEN_INSN_BITSIZE (insn
);
537 /* Machine generated code added here. */
539 const char * arc_cgen_insert_operand
540 (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, CGEN_INSN_BYTES_PTR
, bfd_vma
);
542 /* Main entry point for operand insertion.
544 This function is basically just a big switch statement. Earlier versions
545 used tables to look up the function to use, but
546 - if the table contains both assembler and disassembler functions then
547 the disassembler contains much of the assembler and vice-versa,
548 - there's a lot of inlining possibilities as things grow,
549 - using a switch statement avoids the function call overhead.
551 This function could be moved into `parse_insn_normal', but keeping it
552 separate makes clear the interface between `parse_insn_normal' and each of
553 the handlers. It's also needed by GAS to insert operands that couldn't be
554 resolved during parsing. */
557 arc_cgen_insert_operand (CGEN_CPU_DESC cd
,
559 CGEN_FIELDS
* fields
,
560 CGEN_INSN_BYTES_PTR buffer
,
561 bfd_vma pc ATTRIBUTE_UNUSED
)
563 const char * errmsg
= NULL
;
564 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
568 case ARC_OPERAND_EXDI
:
569 errmsg
= insert_normal (cd
, fields
->f_F
, 0, 0, 16, 1, 32, total_length
, buffer
);
572 errmsg
= insert_normal (cd
, fields
->f_F
, 0, 0, 16, 1, 32, total_length
, buffer
);
574 case ARC_OPERAND_F0
:
575 errmsg
= insert_normal (cd
, fields
->f_F
, 0, 0, 16, 1, 32, total_length
, buffer
);
577 case ARC_OPERAND_F1
:
578 errmsg
= insert_normal (cd
, fields
->f_F
, 0, 0, 16, 1, 32, total_length
, buffer
);
580 case ARC_OPERAND_F1F
:
581 errmsg
= insert_normal (cd
, fields
->f_F
, 0, 0, 16, 1, 32, total_length
, buffer
);
583 case ARC_OPERAND_GP
:
585 case ARC_OPERAND_LDODI
:
586 errmsg
= insert_normal (cd
, fields
->f_LDODi
, 0, 0, 20, 1, 32, total_length
, buffer
);
588 case ARC_OPERAND_LDRDI
:
589 errmsg
= insert_normal (cd
, fields
->f_LDRDi
, 0, 0, 16, 1, 32, total_length
, buffer
);
591 case ARC_OPERAND_NE
:
593 case ARC_OPERAND_PCL
:
595 case ARC_OPERAND_QCONDB
:
596 errmsg
= insert_normal (cd
, fields
->f_cond_Q
, 0, 0, 27, 5, 32, total_length
, buffer
);
598 case ARC_OPERAND_QCONDI
:
599 errmsg
= insert_normal (cd
, fields
->f_cond_Q
, 0, 0, 27, 5, 32, total_length
, buffer
);
601 case ARC_OPERAND_QCONDJ
:
602 errmsg
= insert_normal (cd
, fields
->f_cond_Q
, 0, 0, 27, 5, 32, total_length
, buffer
);
604 case ARC_OPERAND_R0
:
606 case ARC_OPERAND_R31
:
608 case ARC_OPERAND_RA
:
609 errmsg
= insert_normal (cd
, fields
->f_op_A
, 0, 0, 26, 6, 32, total_length
, buffer
);
611 case ARC_OPERAND_RA_0
:
612 errmsg
= insert_normal (cd
, fields
->f_op_A
, 0, 0, 26, 6, 32, total_length
, buffer
);
614 case ARC_OPERAND_RB
:
617 FLD (f_op__b
) = ((FLD (f_op_B
)) & (7));
618 FLD (f_B_5_3
) = ((unsigned int) (FLD (f_op_B
)) >> (3));
620 errmsg
= insert_normal (cd
, fields
->f_op__b
, 0, 0, 5, 3, 32, total_length
, buffer
);
623 errmsg
= insert_normal (cd
, fields
->f_B_5_3
, 0, 0, 17, 3, 32, total_length
, buffer
);
628 case ARC_OPERAND_RB_0
:
631 FLD (f_op__b
) = ((FLD (f_op_B
)) & (7));
632 FLD (f_B_5_3
) = ((unsigned int) (FLD (f_op_B
)) >> (3));
634 errmsg
= insert_normal (cd
, fields
->f_op__b
, 0, 0, 5, 3, 32, total_length
, buffer
);
637 errmsg
= insert_normal (cd
, fields
->f_B_5_3
, 0, 0, 17, 3, 32, total_length
, buffer
);
642 case ARC_OPERAND_RC
:
643 errmsg
= insert_normal (cd
, fields
->f_op_C
, 0, 0, 20, 6, 32, total_length
, buffer
);
645 case ARC_OPERAND_RC_ILINK
:
646 errmsg
= insert_normal (cd
, fields
->f_op_Cj
, 0, 0, 20, 6, 32, total_length
, buffer
);
648 case ARC_OPERAND_RC_NOILINK
:
649 errmsg
= insert_normal (cd
, fields
->f_op_Cj
, 0, 0, 20, 6, 32, total_length
, buffer
);
651 case ARC_OPERAND_R_A
:
652 errmsg
= insert_normal (cd
, fields
->f_op__a
, 0, 0, 13, 3, 32, total_length
, buffer
);
654 case ARC_OPERAND_R_B
:
655 errmsg
= insert_normal (cd
, fields
->f_op__b
, 0, 0, 5, 3, 32, total_length
, buffer
);
657 case ARC_OPERAND_R_C
:
658 errmsg
= insert_normal (cd
, fields
->f_op__c
, 0, 0, 8, 3, 32, total_length
, buffer
);
660 case ARC_OPERAND_RCC
:
661 errmsg
= insert_normal (cd
, fields
->f_brcond
, 0, 0, 28, 4, 32, total_length
, buffer
);
663 case ARC_OPERAND_RCCS
:
664 errmsg
= insert_normal (cd
, fields
->f_brscond
, 0, 0, 8, 1, 32, total_length
, buffer
);
666 case ARC_OPERAND_RH
:
669 FLD (f_h_2_0
) = ((FLD (f_op_h
)) & (7));
670 FLD (f_h_5_3
) = ((unsigned int) (FLD (f_op_h
)) >> (3));
672 errmsg
= insert_normal (cd
, fields
->f_h_2_0
, 0, 0, 8, 3, 32, total_length
, buffer
);
675 errmsg
= insert_normal (cd
, fields
->f_h_5_3
, 0, 0, 13, 3, 32, total_length
, buffer
);
680 case ARC_OPERAND_SP
:
682 case ARC_OPERAND_STODI
:
683 errmsg
= insert_normal (cd
, fields
->f_STODi
, 0, 0, 26, 1, 32, total_length
, buffer
);
685 case ARC_OPERAND_U6
:
686 errmsg
= insert_normal (cd
, fields
->f_u6
, 0, 0, 20, 6, 32, total_length
, buffer
);
688 case ARC_OPERAND_U6X2
:
690 long value
= fields
->f_u6x2
;
691 value
= ((unsigned int) (value
) >> (1));
692 errmsg
= insert_normal (cd
, value
, 0, 0, 20, 6, 32, total_length
, buffer
);
695 case ARC_OPERAND__AW
:
697 case ARC_OPERAND__L
:
699 case ARC_OPERAND__S
:
701 case ARC_OPERAND_CBIT
:
703 case ARC_OPERAND_DELAY_N
:
704 errmsg
= insert_normal (cd
, fields
->f_delay_N
, 0, 0, 26, 1, 32, total_length
, buffer
);
706 case ARC_OPERAND_DUMMY_OP
:
707 errmsg
= insert_normal (cd
, fields
->f_dummy
, 0, 0, 16, 16, 32, total_length
, buffer
);
709 case ARC_OPERAND_I2COND
:
710 errmsg
= insert_normal (cd
, fields
->f_cond_i2
, 0, 0, 5, 2, 32, total_length
, buffer
);
712 case ARC_OPERAND_I3COND
:
713 errmsg
= insert_normal (cd
, fields
->f_cond_i3
, 0, 0, 7, 3, 32, total_length
, buffer
);
715 case ARC_OPERAND_LABEL10
:
717 long value
= fields
->f_rel10
;
718 value
= ((int) (((value
) - (((pc
) & (-4))))) >> (1));
719 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 7, 9, 32, total_length
, buffer
);
722 case ARC_OPERAND_LABEL13A
:
724 long value
= fields
->f_rel13bl
;
725 value
= ((int) (((value
) - (((pc
) & (-4))))) >> (2));
726 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 5, 11, 32, total_length
, buffer
);
729 case ARC_OPERAND_LABEL21
:
732 FLD (f_d21l
) = ((((unsigned int) (((FLD (f_rel21
)) - (((pc
) & (-4))))) >> (1))) & (1023));
733 FLD (f_d21h
) = ((unsigned int) (((FLD (f_rel21
)) - (((pc
) & (-4))))) >> (11));
735 errmsg
= insert_normal (cd
, fields
->f_d21l
, 0, 0, 5, 10, 32, total_length
, buffer
);
738 errmsg
= insert_normal (cd
, fields
->f_d21h
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 10, 32, total_length
, buffer
);
743 case ARC_OPERAND_LABEL21A
:
746 FLD (f_d21bl
) = ((((unsigned int) (((FLD (f_rel21bl
)) - (((pc
) & (-4))))) >> (2))) & (511));
747 FLD (f_d21h
) = ((unsigned int) (((FLD (f_rel21bl
)) - (((pc
) & (-4))))) >> (11));
749 errmsg
= insert_normal (cd
, fields
->f_d21bl
, 0, 0, 5, 9, 32, total_length
, buffer
);
752 errmsg
= insert_normal (cd
, fields
->f_d21h
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 10, 32, total_length
, buffer
);
757 case ARC_OPERAND_LABEL25
:
760 FLD (f_d21l
) = ((((unsigned int) (((FLD (f_rel25
)) - (((pc
) & (-4))))) >> (1))) & (1023));
761 FLD (f_d25m
) = ((unsigned int) (((FLD (f_rel25
)) - (((pc
) & (-4))))) >> (11));
762 FLD (f_d25h
) = ((unsigned int) (((FLD (f_rel25
)) - (((pc
) & (-4))))) >> (21));
764 errmsg
= insert_normal (cd
, fields
->f_d21l
, 0, 0, 5, 10, 32, total_length
, buffer
);
767 errmsg
= insert_normal (cd
, fields
->f_d25m
, 0, 0, 16, 10, 32, total_length
, buffer
);
770 errmsg
= insert_normal (cd
, fields
->f_d25h
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 28, 4, 32, total_length
, buffer
);
775 case ARC_OPERAND_LABEL25A
:
778 FLD (f_d21bl
) = ((((unsigned int) (((FLD (f_rel25bl
)) - (((pc
) & (-4))))) >> (2))) & (511));
779 FLD (f_d25m
) = ((unsigned int) (((FLD (f_rel25bl
)) - (((pc
) & (-4))))) >> (11));
780 FLD (f_d25h
) = ((unsigned int) (((FLD (f_rel25bl
)) - (((pc
) & (-4))))) >> (21));
782 errmsg
= insert_normal (cd
, fields
->f_d21bl
, 0, 0, 5, 9, 32, total_length
, buffer
);
785 errmsg
= insert_normal (cd
, fields
->f_d25m
, 0, 0, 16, 10, 32, total_length
, buffer
);
788 errmsg
= insert_normal (cd
, fields
->f_d25h
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 28, 4, 32, total_length
, buffer
);
793 case ARC_OPERAND_LABEL7
:
795 long value
= fields
->f_rel7
;
796 value
= ((int) (((value
) - (((pc
) & (-4))))) >> (1));
797 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 10, 6, 32, total_length
, buffer
);
800 case ARC_OPERAND_LABEL8
:
802 long value
= fields
->f_rel8
;
803 value
= ((int) (((value
) - (((pc
) & (-4))))) >> (1));
804 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 9, 7, 32, total_length
, buffer
);
807 case ARC_OPERAND_LABEL9
:
810 FLD (f_d9l
) = ((((unsigned int) (((FLD (f_rel9
)) - (((pc
) & (-4))))) >> (1))) & (127));
811 FLD (f_d9h
) = ((unsigned int) (((FLD (f_rel9
)) - (((pc
) & (-4))))) >> (8));
813 errmsg
= insert_normal (cd
, fields
->f_d9l
, 0, 0, 8, 7, 32, total_length
, buffer
);
816 errmsg
= insert_normal (cd
, fields
->f_d9h
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 1, 32, total_length
, buffer
);
821 case ARC_OPERAND_LBIT
:
823 case ARC_OPERAND_NBIT
:
825 case ARC_OPERAND_S12
:
828 FLD (f_u6
) = ((FLD (f_s12
)) & (63));
829 FLD (f_s12h
) = ((unsigned int) (FLD (f_s12
)) >> (6));
831 errmsg
= insert_normal (cd
, fields
->f_u6
, 0, 0, 20, 6, 32, total_length
, buffer
);
834 errmsg
= insert_normal (cd
, fields
->f_s12h
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 26, 6, 32, total_length
, buffer
);
839 case ARC_OPERAND_S12X2
:
842 FLD (f_u6
) = ((((unsigned int) (FLD (f_s12x2
)) >> (1))) & (63));
843 FLD (f_s12h
) = ((unsigned int) (FLD (f_s12x2
)) >> (7));
845 errmsg
= insert_normal (cd
, fields
->f_u6
, 0, 0, 20, 6, 32, total_length
, buffer
);
848 errmsg
= insert_normal (cd
, fields
->f_s12h
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 26, 6, 32, total_length
, buffer
);
853 case ARC_OPERAND_S1BIT
:
855 case ARC_OPERAND_S2BIT
:
857 case ARC_OPERAND_S9
:
860 FLD (f_u8
) = ((FLD (f_s9
)) & (255));
861 FLD (f_d9h
) = ((unsigned int) (FLD (f_s9
)) >> (8));
863 errmsg
= insert_normal (cd
, fields
->f_u8
, 0, 0, 8, 8, 32, total_length
, buffer
);
866 errmsg
= insert_normal (cd
, fields
->f_d9h
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 1, 32, total_length
, buffer
);
871 case ARC_OPERAND_S9X4
:
873 long value
= fields
->f_s9x4
;
874 value
= ((unsigned int) (value
) >> (2));
875 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 7, 9, 32, total_length
, buffer
);
878 case ARC_OPERAND_SC_S9_
:
880 long value
= fields
->f_s9x4
;
881 value
= ((unsigned int) (value
) >> (2));
882 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 7, 9, 32, total_length
, buffer
);
885 case ARC_OPERAND_SC_S9B
:
886 errmsg
= insert_normal (cd
, fields
->f_s9x1
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 7, 9, 32, total_length
, buffer
);
888 case ARC_OPERAND_SC_S9W
:
890 long value
= fields
->f_s9x2
;
891 value
= ((unsigned int) (value
) >> (1));
892 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 7, 9, 32, total_length
, buffer
);
895 case ARC_OPERAND_SC_U5_
:
897 long value
= fields
->f_u5x4
;
898 value
= ((unsigned int) (value
) >> (2));
899 errmsg
= insert_normal (cd
, value
, 0, 0, 11, 5, 32, total_length
, buffer
);
902 case ARC_OPERAND_SC_U5B
:
903 errmsg
= insert_normal (cd
, fields
->f_u5
, 0, 0, 11, 5, 32, total_length
, buffer
);
905 case ARC_OPERAND_SC_U5W
:
907 long value
= fields
->f_u5x2
;
908 value
= ((unsigned int) (value
) >> (1));
909 errmsg
= insert_normal (cd
, value
, 0, 0, 11, 5, 32, total_length
, buffer
);
912 case ARC_OPERAND_TRAPNUM
:
913 errmsg
= insert_normal (cd
, fields
->f_trapnum
, 0, 0, 5, 6, 32, total_length
, buffer
);
915 case ARC_OPERAND_U3
:
916 errmsg
= insert_normal (cd
, fields
->f_u3
, 0, 0, 13, 3, 32, total_length
, buffer
);
918 case ARC_OPERAND_U5
:
919 errmsg
= insert_normal (cd
, fields
->f_u5
, 0, 0, 11, 5, 32, total_length
, buffer
);
921 case ARC_OPERAND_U5X4
:
923 long value
= fields
->f_u5x4
;
924 value
= ((unsigned int) (value
) >> (2));
925 errmsg
= insert_normal (cd
, value
, 0, 0, 11, 5, 32, total_length
, buffer
);
928 case ARC_OPERAND_U7
:
929 errmsg
= insert_normal (cd
, fields
->f_u7
, 0, 0, 9, 7, 32, total_length
, buffer
);
931 case ARC_OPERAND_U8
:
932 errmsg
= insert_normal (cd
, fields
->f_u8
, 0, 0, 8, 8, 32, total_length
, buffer
);
934 case ARC_OPERAND_U8X4
:
936 long value
= fields
->f_u8x4
;
937 value
= ((unsigned int) (value
) >> (2));
938 errmsg
= insert_normal (cd
, value
, 0, 0, 8, 8, 32, total_length
, buffer
);
941 case ARC_OPERAND_UNCONDB
:
943 case ARC_OPERAND_UNCONDI
:
945 case ARC_OPERAND_UNCONDJ
:
947 case ARC_OPERAND_VBIT
:
949 case ARC_OPERAND_ZBIT
:
953 /* xgettext:c-format */
954 fprintf (stderr
, _("Unrecognized field %d while building insn.\n"),
962 int arc_cgen_extract_operand
963 (CGEN_CPU_DESC
, int, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
965 /* Main entry point for operand extraction.
966 The result is <= 0 for error, >0 for success.
967 ??? Actual values aren't well defined right now.
969 This function is basically just a big switch statement. Earlier versions
970 used tables to look up the function to use, but
971 - if the table contains both assembler and disassembler functions then
972 the disassembler contains much of the assembler and vice-versa,
973 - there's a lot of inlining possibilities as things grow,
974 - using a switch statement avoids the function call overhead.
976 This function could be moved into `print_insn_normal', but keeping it
977 separate makes clear the interface between `print_insn_normal' and each of
981 arc_cgen_extract_operand (CGEN_CPU_DESC cd
,
983 CGEN_EXTRACT_INFO
*ex_info
,
984 CGEN_INSN_INT insn_value
,
985 CGEN_FIELDS
* fields
,
988 /* Assume success (for those operands that are nops). */
990 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
994 case ARC_OPERAND_EXDI
:
995 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 1, 32, total_length
, pc
, & fields
->f_F
);
998 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 1, 32, total_length
, pc
, & fields
->f_F
);
1000 case ARC_OPERAND_F0
:
1001 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 1, 32, total_length
, pc
, & fields
->f_F
);
1003 case ARC_OPERAND_F1
:
1004 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 1, 32, total_length
, pc
, & fields
->f_F
);
1006 case ARC_OPERAND_F1F
:
1007 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 1, 32, total_length
, pc
, & fields
->f_F
);
1009 case ARC_OPERAND_GP
:
1011 case ARC_OPERAND_LDODI
:
1012 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 1, 32, total_length
, pc
, & fields
->f_LDODi
);
1014 case ARC_OPERAND_LDRDI
:
1015 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 1, 32, total_length
, pc
, & fields
->f_LDRDi
);
1017 case ARC_OPERAND_NE
:
1019 case ARC_OPERAND_PCL
:
1021 case ARC_OPERAND_QCONDB
:
1022 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 27, 5, 32, total_length
, pc
, & fields
->f_cond_Q
);
1024 case ARC_OPERAND_QCONDI
:
1025 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 27, 5, 32, total_length
, pc
, & fields
->f_cond_Q
);
1027 case ARC_OPERAND_QCONDJ
:
1028 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 27, 5, 32, total_length
, pc
, & fields
->f_cond_Q
);
1030 case ARC_OPERAND_R0
:
1032 case ARC_OPERAND_R31
:
1034 case ARC_OPERAND_RA
:
1035 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 6, 32, total_length
, pc
, & fields
->f_op_A
);
1037 case ARC_OPERAND_RA_0
:
1038 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 6, 32, total_length
, pc
, & fields
->f_op_A
);
1040 case ARC_OPERAND_RB
:
1042 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_op__b
);
1043 if (length
<= 0) break;
1044 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 3, 32, total_length
, pc
, & fields
->f_B_5_3
);
1045 if (length
<= 0) break;
1047 FLD (f_op_B
) = ((FLD (f_op__b
)) | (((FLD (f_B_5_3
)) << (3))));
1051 case ARC_OPERAND_RB_0
:
1053 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_op__b
);
1054 if (length
<= 0) break;
1055 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 17, 3, 32, total_length
, pc
, & fields
->f_B_5_3
);
1056 if (length
<= 0) break;
1058 FLD (f_op_B
) = ((FLD (f_op__b
)) | (((FLD (f_B_5_3
)) << (3))));
1062 case ARC_OPERAND_RC
:
1063 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 6, 32, total_length
, pc
, & fields
->f_op_C
);
1065 case ARC_OPERAND_RC_ILINK
:
1066 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 6, 32, total_length
, pc
, & fields
->f_op_Cj
);
1068 case ARC_OPERAND_RC_NOILINK
:
1069 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 6, 32, total_length
, pc
, & fields
->f_op_Cj
);
1071 case ARC_OPERAND_R_A
:
1072 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 13, 3, 32, total_length
, pc
, & fields
->f_op__a
);
1074 case ARC_OPERAND_R_B
:
1075 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_op__b
);
1077 case ARC_OPERAND_R_C
:
1078 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 3, 32, total_length
, pc
, & fields
->f_op__c
);
1080 case ARC_OPERAND_RCC
:
1081 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 4, 32, total_length
, pc
, & fields
->f_brcond
);
1083 case ARC_OPERAND_RCCS
:
1084 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 1, 32, total_length
, pc
, & fields
->f_brscond
);
1086 case ARC_OPERAND_RH
:
1088 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 3, 32, total_length
, pc
, & fields
->f_h_2_0
);
1089 if (length
<= 0) break;
1090 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 13, 3, 32, total_length
, pc
, & fields
->f_h_5_3
);
1091 if (length
<= 0) break;
1093 FLD (f_op_h
) = ((FLD (f_h_2_0
)) | (((FLD (f_h_5_3
)) << (3))));
1097 case ARC_OPERAND_SP
:
1099 case ARC_OPERAND_STODI
:
1100 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 1, 32, total_length
, pc
, & fields
->f_STODi
);
1102 case ARC_OPERAND_U6
:
1103 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 6, 32, total_length
, pc
, & fields
->f_u6
);
1105 case ARC_OPERAND_U6X2
:
1108 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 6, 32, total_length
, pc
, & value
);
1109 value
= ((value
) << (1));
1110 fields
->f_u6x2
= value
;
1113 case ARC_OPERAND__AW
:
1115 case ARC_OPERAND__L
:
1117 case ARC_OPERAND__S
:
1119 case ARC_OPERAND_CBIT
:
1121 case ARC_OPERAND_DELAY_N
:
1122 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 1, 32, total_length
, pc
, & fields
->f_delay_N
);
1124 case ARC_OPERAND_DUMMY_OP
:
1125 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_dummy
);
1127 case ARC_OPERAND_I2COND
:
1128 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 2, 32, total_length
, pc
, & fields
->f_cond_i2
);
1130 case ARC_OPERAND_I3COND
:
1131 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 3, 32, total_length
, pc
, & fields
->f_cond_i3
);
1133 case ARC_OPERAND_LABEL10
:
1136 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 7, 9, 32, total_length
, pc
, & value
);
1137 value
= ((((value
) << (1))) + (((pc
) & (-4))));
1138 fields
->f_rel10
= value
;
1141 case ARC_OPERAND_LABEL13A
:
1144 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 5, 11, 32, total_length
, pc
, & value
);
1145 value
= ((((value
) << (2))) + (((pc
) & (-4))));
1146 fields
->f_rel13bl
= value
;
1149 case ARC_OPERAND_LABEL21
:
1151 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 10, 32, total_length
, pc
, & fields
->f_d21l
);
1152 if (length
<= 0) break;
1153 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 10, 32, total_length
, pc
, & fields
->f_d21h
);
1154 if (length
<= 0) break;
1156 FLD (f_rel21
) = ((((((FLD (f_d21l
)) << (1))) | (((FLD (f_d21h
)) << (11))))) + (((pc
) & (-4))));
1160 case ARC_OPERAND_LABEL21A
:
1162 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 9, 32, total_length
, pc
, & fields
->f_d21bl
);
1163 if (length
<= 0) break;
1164 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 10, 32, total_length
, pc
, & fields
->f_d21h
);
1165 if (length
<= 0) break;
1167 FLD (f_rel21bl
) = ((((((FLD (f_d21bl
)) << (2))) | (((FLD (f_d21h
)) << (11))))) + (((pc
) & (-4))));
1171 case ARC_OPERAND_LABEL25
:
1173 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 10, 32, total_length
, pc
, & fields
->f_d21l
);
1174 if (length
<= 0) break;
1175 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 10, 32, total_length
, pc
, & fields
->f_d25m
);
1176 if (length
<= 0) break;
1177 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 28, 4, 32, total_length
, pc
, & fields
->f_d25h
);
1178 if (length
<= 0) break;
1180 FLD (f_rel25
) = ((((((((FLD (f_d21l
)) << (1))) | (((FLD (f_d25m
)) << (11))))) | (((FLD (f_d25h
)) << (21))))) + (((pc
) & (-4))));
1184 case ARC_OPERAND_LABEL25A
:
1186 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 9, 32, total_length
, pc
, & fields
->f_d21bl
);
1187 if (length
<= 0) break;
1188 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 10, 32, total_length
, pc
, & fields
->f_d25m
);
1189 if (length
<= 0) break;
1190 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 28, 4, 32, total_length
, pc
, & fields
->f_d25h
);
1191 if (length
<= 0) break;
1193 FLD (f_rel25bl
) = ((((((((FLD (f_d21bl
)) << (2))) | (((FLD (f_d25m
)) << (11))))) | (((FLD (f_d25h
)) << (21))))) + (((pc
) & (-4))));
1197 case ARC_OPERAND_LABEL7
:
1200 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 10, 6, 32, total_length
, pc
, & value
);
1201 value
= ((((value
) << (1))) + (((pc
) & (-4))));
1202 fields
->f_rel7
= value
;
1205 case ARC_OPERAND_LABEL8
:
1208 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 9, 7, 32, total_length
, pc
, & value
);
1209 value
= ((((value
) << (1))) + (((pc
) & (-4))));
1210 fields
->f_rel8
= value
;
1213 case ARC_OPERAND_LABEL9
:
1215 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 7, 32, total_length
, pc
, & fields
->f_d9l
);
1216 if (length
<= 0) break;
1217 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 1, 32, total_length
, pc
, & fields
->f_d9h
);
1218 if (length
<= 0) break;
1220 FLD (f_rel9
) = ((((((FLD (f_d9l
)) << (1))) | (((FLD (f_d9h
)) << (8))))) + (((pc
) & (-4))));
1224 case ARC_OPERAND_LBIT
:
1226 case ARC_OPERAND_NBIT
:
1228 case ARC_OPERAND_S12
:
1230 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 6, 32, total_length
, pc
, & fields
->f_u6
);
1231 if (length
<= 0) break;
1232 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 26, 6, 32, total_length
, pc
, & fields
->f_s12h
);
1233 if (length
<= 0) break;
1235 FLD (f_s12
) = ((FLD (f_u6
)) | (((FLD (f_s12h
)) << (6))));
1239 case ARC_OPERAND_S12X2
:
1241 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 6, 32, total_length
, pc
, & fields
->f_u6
);
1242 if (length
<= 0) break;
1243 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 26, 6, 32, total_length
, pc
, & fields
->f_s12h
);
1244 if (length
<= 0) break;
1246 FLD (f_s12x2
) = ((((FLD (f_u6
)) << (1))) | (((FLD (f_s12h
)) << (7))));
1250 case ARC_OPERAND_S1BIT
:
1252 case ARC_OPERAND_S2BIT
:
1254 case ARC_OPERAND_S9
:
1256 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 8, 32, total_length
, pc
, & fields
->f_u8
);
1257 if (length
<= 0) break;
1258 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 1, 32, total_length
, pc
, & fields
->f_d9h
);
1259 if (length
<= 0) break;
1261 FLD (f_s9
) = ((FLD (f_u8
)) | (((FLD (f_d9h
)) << (8))));
1265 case ARC_OPERAND_S9X4
:
1268 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 7, 9, 32, total_length
, pc
, & value
);
1269 value
= ((value
) << (2));
1270 fields
->f_s9x4
= value
;
1273 case ARC_OPERAND_SC_S9_
:
1276 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 7, 9, 32, total_length
, pc
, & value
);
1277 value
= ((value
) << (2));
1278 fields
->f_s9x4
= value
;
1281 case ARC_OPERAND_SC_S9B
:
1282 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 7, 9, 32, total_length
, pc
, & fields
->f_s9x1
);
1284 case ARC_OPERAND_SC_S9W
:
1287 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 7, 9, 32, total_length
, pc
, & value
);
1288 value
= ((value
) << (1));
1289 fields
->f_s9x2
= value
;
1292 case ARC_OPERAND_SC_U5_
:
1295 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 5, 32, total_length
, pc
, & value
);
1296 value
= ((value
) << (2));
1297 fields
->f_u5x4
= value
;
1300 case ARC_OPERAND_SC_U5B
:
1301 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 5, 32, total_length
, pc
, & fields
->f_u5
);
1303 case ARC_OPERAND_SC_U5W
:
1306 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 5, 32, total_length
, pc
, & value
);
1307 value
= ((value
) << (1));
1308 fields
->f_u5x2
= value
;
1311 case ARC_OPERAND_TRAPNUM
:
1312 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 6, 32, total_length
, pc
, & fields
->f_trapnum
);
1314 case ARC_OPERAND_U3
:
1315 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 13, 3, 32, total_length
, pc
, & fields
->f_u3
);
1317 case ARC_OPERAND_U5
:
1318 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 5, 32, total_length
, pc
, & fields
->f_u5
);
1320 case ARC_OPERAND_U5X4
:
1323 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 5, 32, total_length
, pc
, & value
);
1324 value
= ((value
) << (2));
1325 fields
->f_u5x4
= value
;
1328 case ARC_OPERAND_U7
:
1329 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 7, 32, total_length
, pc
, & fields
->f_u7
);
1331 case ARC_OPERAND_U8
:
1332 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 8, 32, total_length
, pc
, & fields
->f_u8
);
1334 case ARC_OPERAND_U8X4
:
1337 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 8, 32, total_length
, pc
, & value
);
1338 value
= ((value
) << (2));
1339 fields
->f_u8x4
= value
;
1342 case ARC_OPERAND_UNCONDB
:
1344 case ARC_OPERAND_UNCONDI
:
1346 case ARC_OPERAND_UNCONDJ
:
1348 case ARC_OPERAND_VBIT
:
1350 case ARC_OPERAND_ZBIT
:
1354 /* xgettext:c-format */
1355 fprintf (stderr
, _("Unrecognized field %d while decoding insn.\n"),
1363 cgen_insert_fn
* const arc_cgen_insert_handlers
[] =
1368 cgen_extract_fn
* const arc_cgen_extract_handlers
[] =
1370 extract_insn_normal
,
1373 int arc_cgen_get_int_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1374 bfd_vma
arc_cgen_get_vma_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1376 /* Getting values from cgen_fields is handled by a collection of functions.
1377 They are distinguished by the type of the VALUE argument they return.
1378 TODO: floating point, inlining support, remove cases where result type
1382 arc_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1384 const CGEN_FIELDS
* fields
)
1390 case ARC_OPERAND_EXDI
:
1391 value
= fields
->f_F
;
1393 case ARC_OPERAND_F
:
1394 value
= fields
->f_F
;
1396 case ARC_OPERAND_F0
:
1397 value
= fields
->f_F
;
1399 case ARC_OPERAND_F1
:
1400 value
= fields
->f_F
;
1402 case ARC_OPERAND_F1F
:
1403 value
= fields
->f_F
;
1405 case ARC_OPERAND_GP
:
1408 case ARC_OPERAND_LDODI
:
1409 value
= fields
->f_LDODi
;
1411 case ARC_OPERAND_LDRDI
:
1412 value
= fields
->f_LDRDi
;
1414 case ARC_OPERAND_NE
:
1417 case ARC_OPERAND_PCL
:
1420 case ARC_OPERAND_QCONDB
:
1421 value
= fields
->f_cond_Q
;
1423 case ARC_OPERAND_QCONDI
:
1424 value
= fields
->f_cond_Q
;
1426 case ARC_OPERAND_QCONDJ
:
1427 value
= fields
->f_cond_Q
;
1429 case ARC_OPERAND_R0
:
1432 case ARC_OPERAND_R31
:
1435 case ARC_OPERAND_RA
:
1436 value
= fields
->f_op_A
;
1438 case ARC_OPERAND_RA_0
:
1439 value
= fields
->f_op_A
;
1441 case ARC_OPERAND_RB
:
1442 value
= fields
->f_op_B
;
1444 case ARC_OPERAND_RB_0
:
1445 value
= fields
->f_op_B
;
1447 case ARC_OPERAND_RC
:
1448 value
= fields
->f_op_C
;
1450 case ARC_OPERAND_RC_ILINK
:
1451 value
= fields
->f_op_Cj
;
1453 case ARC_OPERAND_RC_NOILINK
:
1454 value
= fields
->f_op_Cj
;
1456 case ARC_OPERAND_R_A
:
1457 value
= fields
->f_op__a
;
1459 case ARC_OPERAND_R_B
:
1460 value
= fields
->f_op__b
;
1462 case ARC_OPERAND_R_C
:
1463 value
= fields
->f_op__c
;
1465 case ARC_OPERAND_RCC
:
1466 value
= fields
->f_brcond
;
1468 case ARC_OPERAND_RCCS
:
1469 value
= fields
->f_brscond
;
1471 case ARC_OPERAND_RH
:
1472 value
= fields
->f_op_h
;
1474 case ARC_OPERAND_SP
:
1477 case ARC_OPERAND_STODI
:
1478 value
= fields
->f_STODi
;
1480 case ARC_OPERAND_U6
:
1481 value
= fields
->f_u6
;
1483 case ARC_OPERAND_U6X2
:
1484 value
= fields
->f_u6x2
;
1486 case ARC_OPERAND__AW
:
1489 case ARC_OPERAND__L
:
1492 case ARC_OPERAND__S
:
1495 case ARC_OPERAND_CBIT
:
1498 case ARC_OPERAND_DELAY_N
:
1499 value
= fields
->f_delay_N
;
1501 case ARC_OPERAND_DUMMY_OP
:
1502 value
= fields
->f_dummy
;
1504 case ARC_OPERAND_I2COND
:
1505 value
= fields
->f_cond_i2
;
1507 case ARC_OPERAND_I3COND
:
1508 value
= fields
->f_cond_i3
;
1510 case ARC_OPERAND_LABEL10
:
1511 value
= fields
->f_rel10
;
1513 case ARC_OPERAND_LABEL13A
:
1514 value
= fields
->f_rel13bl
;
1516 case ARC_OPERAND_LABEL21
:
1517 value
= fields
->f_rel21
;
1519 case ARC_OPERAND_LABEL21A
:
1520 value
= fields
->f_rel21bl
;
1522 case ARC_OPERAND_LABEL25
:
1523 value
= fields
->f_rel25
;
1525 case ARC_OPERAND_LABEL25A
:
1526 value
= fields
->f_rel25bl
;
1528 case ARC_OPERAND_LABEL7
:
1529 value
= fields
->f_rel7
;
1531 case ARC_OPERAND_LABEL8
:
1532 value
= fields
->f_rel8
;
1534 case ARC_OPERAND_LABEL9
:
1535 value
= fields
->f_rel9
;
1537 case ARC_OPERAND_LBIT
:
1540 case ARC_OPERAND_NBIT
:
1543 case ARC_OPERAND_S12
:
1544 value
= fields
->f_s12
;
1546 case ARC_OPERAND_S12X2
:
1547 value
= fields
->f_s12x2
;
1549 case ARC_OPERAND_S1BIT
:
1552 case ARC_OPERAND_S2BIT
:
1555 case ARC_OPERAND_S9
:
1556 value
= fields
->f_s9
;
1558 case ARC_OPERAND_S9X4
:
1559 value
= fields
->f_s9x4
;
1561 case ARC_OPERAND_SC_S9_
:
1562 value
= fields
->f_s9x4
;
1564 case ARC_OPERAND_SC_S9B
:
1565 value
= fields
->f_s9x1
;
1567 case ARC_OPERAND_SC_S9W
:
1568 value
= fields
->f_s9x2
;
1570 case ARC_OPERAND_SC_U5_
:
1571 value
= fields
->f_u5x4
;
1573 case ARC_OPERAND_SC_U5B
:
1574 value
= fields
->f_u5
;
1576 case ARC_OPERAND_SC_U5W
:
1577 value
= fields
->f_u5x2
;
1579 case ARC_OPERAND_TRAPNUM
:
1580 value
= fields
->f_trapnum
;
1582 case ARC_OPERAND_U3
:
1583 value
= fields
->f_u3
;
1585 case ARC_OPERAND_U5
:
1586 value
= fields
->f_u5
;
1588 case ARC_OPERAND_U5X4
:
1589 value
= fields
->f_u5x4
;
1591 case ARC_OPERAND_U7
:
1592 value
= fields
->f_u7
;
1594 case ARC_OPERAND_U8
:
1595 value
= fields
->f_u8
;
1597 case ARC_OPERAND_U8X4
:
1598 value
= fields
->f_u8x4
;
1600 case ARC_OPERAND_UNCONDB
:
1603 case ARC_OPERAND_UNCONDI
:
1606 case ARC_OPERAND_UNCONDJ
:
1609 case ARC_OPERAND_VBIT
:
1612 case ARC_OPERAND_ZBIT
:
1617 /* xgettext:c-format */
1618 fprintf (stderr
, _("Unrecognized field %d while getting int operand.\n"),
1627 arc_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1629 const CGEN_FIELDS
* fields
)
1635 case ARC_OPERAND_EXDI
:
1636 value
= fields
->f_F
;
1638 case ARC_OPERAND_F
:
1639 value
= fields
->f_F
;
1641 case ARC_OPERAND_F0
:
1642 value
= fields
->f_F
;
1644 case ARC_OPERAND_F1
:
1645 value
= fields
->f_F
;
1647 case ARC_OPERAND_F1F
:
1648 value
= fields
->f_F
;
1650 case ARC_OPERAND_GP
:
1653 case ARC_OPERAND_LDODI
:
1654 value
= fields
->f_LDODi
;
1656 case ARC_OPERAND_LDRDI
:
1657 value
= fields
->f_LDRDi
;
1659 case ARC_OPERAND_NE
:
1662 case ARC_OPERAND_PCL
:
1665 case ARC_OPERAND_QCONDB
:
1666 value
= fields
->f_cond_Q
;
1668 case ARC_OPERAND_QCONDI
:
1669 value
= fields
->f_cond_Q
;
1671 case ARC_OPERAND_QCONDJ
:
1672 value
= fields
->f_cond_Q
;
1674 case ARC_OPERAND_R0
:
1677 case ARC_OPERAND_R31
:
1680 case ARC_OPERAND_RA
:
1681 value
= fields
->f_op_A
;
1683 case ARC_OPERAND_RA_0
:
1684 value
= fields
->f_op_A
;
1686 case ARC_OPERAND_RB
:
1687 value
= fields
->f_op_B
;
1689 case ARC_OPERAND_RB_0
:
1690 value
= fields
->f_op_B
;
1692 case ARC_OPERAND_RC
:
1693 value
= fields
->f_op_C
;
1695 case ARC_OPERAND_RC_ILINK
:
1696 value
= fields
->f_op_Cj
;
1698 case ARC_OPERAND_RC_NOILINK
:
1699 value
= fields
->f_op_Cj
;
1701 case ARC_OPERAND_R_A
:
1702 value
= fields
->f_op__a
;
1704 case ARC_OPERAND_R_B
:
1705 value
= fields
->f_op__b
;
1707 case ARC_OPERAND_R_C
:
1708 value
= fields
->f_op__c
;
1710 case ARC_OPERAND_RCC
:
1711 value
= fields
->f_brcond
;
1713 case ARC_OPERAND_RCCS
:
1714 value
= fields
->f_brscond
;
1716 case ARC_OPERAND_RH
:
1717 value
= fields
->f_op_h
;
1719 case ARC_OPERAND_SP
:
1722 case ARC_OPERAND_STODI
:
1723 value
= fields
->f_STODi
;
1725 case ARC_OPERAND_U6
:
1726 value
= fields
->f_u6
;
1728 case ARC_OPERAND_U6X2
:
1729 value
= fields
->f_u6x2
;
1731 case ARC_OPERAND__AW
:
1734 case ARC_OPERAND__L
:
1737 case ARC_OPERAND__S
:
1740 case ARC_OPERAND_CBIT
:
1743 case ARC_OPERAND_DELAY_N
:
1744 value
= fields
->f_delay_N
;
1746 case ARC_OPERAND_DUMMY_OP
:
1747 value
= fields
->f_dummy
;
1749 case ARC_OPERAND_I2COND
:
1750 value
= fields
->f_cond_i2
;
1752 case ARC_OPERAND_I3COND
:
1753 value
= fields
->f_cond_i3
;
1755 case ARC_OPERAND_LABEL10
:
1756 value
= fields
->f_rel10
;
1758 case ARC_OPERAND_LABEL13A
:
1759 value
= fields
->f_rel13bl
;
1761 case ARC_OPERAND_LABEL21
:
1762 value
= fields
->f_rel21
;
1764 case ARC_OPERAND_LABEL21A
:
1765 value
= fields
->f_rel21bl
;
1767 case ARC_OPERAND_LABEL25
:
1768 value
= fields
->f_rel25
;
1770 case ARC_OPERAND_LABEL25A
:
1771 value
= fields
->f_rel25bl
;
1773 case ARC_OPERAND_LABEL7
:
1774 value
= fields
->f_rel7
;
1776 case ARC_OPERAND_LABEL8
:
1777 value
= fields
->f_rel8
;
1779 case ARC_OPERAND_LABEL9
:
1780 value
= fields
->f_rel9
;
1782 case ARC_OPERAND_LBIT
:
1785 case ARC_OPERAND_NBIT
:
1788 case ARC_OPERAND_S12
:
1789 value
= fields
->f_s12
;
1791 case ARC_OPERAND_S12X2
:
1792 value
= fields
->f_s12x2
;
1794 case ARC_OPERAND_S1BIT
:
1797 case ARC_OPERAND_S2BIT
:
1800 case ARC_OPERAND_S9
:
1801 value
= fields
->f_s9
;
1803 case ARC_OPERAND_S9X4
:
1804 value
= fields
->f_s9x4
;
1806 case ARC_OPERAND_SC_S9_
:
1807 value
= fields
->f_s9x4
;
1809 case ARC_OPERAND_SC_S9B
:
1810 value
= fields
->f_s9x1
;
1812 case ARC_OPERAND_SC_S9W
:
1813 value
= fields
->f_s9x2
;
1815 case ARC_OPERAND_SC_U5_
:
1816 value
= fields
->f_u5x4
;
1818 case ARC_OPERAND_SC_U5B
:
1819 value
= fields
->f_u5
;
1821 case ARC_OPERAND_SC_U5W
:
1822 value
= fields
->f_u5x2
;
1824 case ARC_OPERAND_TRAPNUM
:
1825 value
= fields
->f_trapnum
;
1827 case ARC_OPERAND_U3
:
1828 value
= fields
->f_u3
;
1830 case ARC_OPERAND_U5
:
1831 value
= fields
->f_u5
;
1833 case ARC_OPERAND_U5X4
:
1834 value
= fields
->f_u5x4
;
1836 case ARC_OPERAND_U7
:
1837 value
= fields
->f_u7
;
1839 case ARC_OPERAND_U8
:
1840 value
= fields
->f_u8
;
1842 case ARC_OPERAND_U8X4
:
1843 value
= fields
->f_u8x4
;
1845 case ARC_OPERAND_UNCONDB
:
1848 case ARC_OPERAND_UNCONDI
:
1851 case ARC_OPERAND_UNCONDJ
:
1854 case ARC_OPERAND_VBIT
:
1857 case ARC_OPERAND_ZBIT
:
1862 /* xgettext:c-format */
1863 fprintf (stderr
, _("Unrecognized field %d while getting vma operand.\n"),
1871 void arc_cgen_set_int_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, int);
1872 void arc_cgen_set_vma_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, bfd_vma
);
1874 /* Stuffing values in cgen_fields is handled by a collection of functions.
1875 They are distinguished by the type of the VALUE argument they accept.
1876 TODO: floating point, inlining support, remove cases where argument type
1880 arc_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1882 CGEN_FIELDS
* fields
,
1887 case ARC_OPERAND_EXDI
:
1888 fields
->f_F
= value
;
1890 case ARC_OPERAND_F
:
1891 fields
->f_F
= value
;
1893 case ARC_OPERAND_F0
:
1894 fields
->f_F
= value
;
1896 case ARC_OPERAND_F1
:
1897 fields
->f_F
= value
;
1899 case ARC_OPERAND_F1F
:
1900 fields
->f_F
= value
;
1902 case ARC_OPERAND_GP
:
1904 case ARC_OPERAND_LDODI
:
1905 fields
->f_LDODi
= value
;
1907 case ARC_OPERAND_LDRDI
:
1908 fields
->f_LDRDi
= value
;
1910 case ARC_OPERAND_NE
:
1912 case ARC_OPERAND_PCL
:
1914 case ARC_OPERAND_QCONDB
:
1915 fields
->f_cond_Q
= value
;
1917 case ARC_OPERAND_QCONDI
:
1918 fields
->f_cond_Q
= value
;
1920 case ARC_OPERAND_QCONDJ
:
1921 fields
->f_cond_Q
= value
;
1923 case ARC_OPERAND_R0
:
1925 case ARC_OPERAND_R31
:
1927 case ARC_OPERAND_RA
:
1928 fields
->f_op_A
= value
;
1930 case ARC_OPERAND_RA_0
:
1931 fields
->f_op_A
= value
;
1933 case ARC_OPERAND_RB
:
1934 fields
->f_op_B
= value
;
1936 case ARC_OPERAND_RB_0
:
1937 fields
->f_op_B
= value
;
1939 case ARC_OPERAND_RC
:
1940 fields
->f_op_C
= value
;
1942 case ARC_OPERAND_RC_ILINK
:
1943 fields
->f_op_Cj
= value
;
1945 case ARC_OPERAND_RC_NOILINK
:
1946 fields
->f_op_Cj
= value
;
1948 case ARC_OPERAND_R_A
:
1949 fields
->f_op__a
= value
;
1951 case ARC_OPERAND_R_B
:
1952 fields
->f_op__b
= value
;
1954 case ARC_OPERAND_R_C
:
1955 fields
->f_op__c
= value
;
1957 case ARC_OPERAND_RCC
:
1958 fields
->f_brcond
= value
;
1960 case ARC_OPERAND_RCCS
:
1961 fields
->f_brscond
= value
;
1963 case ARC_OPERAND_RH
:
1964 fields
->f_op_h
= value
;
1966 case ARC_OPERAND_SP
:
1968 case ARC_OPERAND_STODI
:
1969 fields
->f_STODi
= value
;
1971 case ARC_OPERAND_U6
:
1972 fields
->f_u6
= value
;
1974 case ARC_OPERAND_U6X2
:
1975 fields
->f_u6x2
= value
;
1977 case ARC_OPERAND__AW
:
1979 case ARC_OPERAND__L
:
1981 case ARC_OPERAND__S
:
1983 case ARC_OPERAND_CBIT
:
1985 case ARC_OPERAND_DELAY_N
:
1986 fields
->f_delay_N
= value
;
1988 case ARC_OPERAND_DUMMY_OP
:
1989 fields
->f_dummy
= value
;
1991 case ARC_OPERAND_I2COND
:
1992 fields
->f_cond_i2
= value
;
1994 case ARC_OPERAND_I3COND
:
1995 fields
->f_cond_i3
= value
;
1997 case ARC_OPERAND_LABEL10
:
1998 fields
->f_rel10
= value
;
2000 case ARC_OPERAND_LABEL13A
:
2001 fields
->f_rel13bl
= value
;
2003 case ARC_OPERAND_LABEL21
:
2004 fields
->f_rel21
= value
;
2006 case ARC_OPERAND_LABEL21A
:
2007 fields
->f_rel21bl
= value
;
2009 case ARC_OPERAND_LABEL25
:
2010 fields
->f_rel25
= value
;
2012 case ARC_OPERAND_LABEL25A
:
2013 fields
->f_rel25bl
= value
;
2015 case ARC_OPERAND_LABEL7
:
2016 fields
->f_rel7
= value
;
2018 case ARC_OPERAND_LABEL8
:
2019 fields
->f_rel8
= value
;
2021 case ARC_OPERAND_LABEL9
:
2022 fields
->f_rel9
= value
;
2024 case ARC_OPERAND_LBIT
:
2026 case ARC_OPERAND_NBIT
:
2028 case ARC_OPERAND_S12
:
2029 fields
->f_s12
= value
;
2031 case ARC_OPERAND_S12X2
:
2032 fields
->f_s12x2
= value
;
2034 case ARC_OPERAND_S1BIT
:
2036 case ARC_OPERAND_S2BIT
:
2038 case ARC_OPERAND_S9
:
2039 fields
->f_s9
= value
;
2041 case ARC_OPERAND_S9X4
:
2042 fields
->f_s9x4
= value
;
2044 case ARC_OPERAND_SC_S9_
:
2045 fields
->f_s9x4
= value
;
2047 case ARC_OPERAND_SC_S9B
:
2048 fields
->f_s9x1
= value
;
2050 case ARC_OPERAND_SC_S9W
:
2051 fields
->f_s9x2
= value
;
2053 case ARC_OPERAND_SC_U5_
:
2054 fields
->f_u5x4
= value
;
2056 case ARC_OPERAND_SC_U5B
:
2057 fields
->f_u5
= value
;
2059 case ARC_OPERAND_SC_U5W
:
2060 fields
->f_u5x2
= value
;
2062 case ARC_OPERAND_TRAPNUM
:
2063 fields
->f_trapnum
= value
;
2065 case ARC_OPERAND_U3
:
2066 fields
->f_u3
= value
;
2068 case ARC_OPERAND_U5
:
2069 fields
->f_u5
= value
;
2071 case ARC_OPERAND_U5X4
:
2072 fields
->f_u5x4
= value
;
2074 case ARC_OPERAND_U7
:
2075 fields
->f_u7
= value
;
2077 case ARC_OPERAND_U8
:
2078 fields
->f_u8
= value
;
2080 case ARC_OPERAND_U8X4
:
2081 fields
->f_u8x4
= value
;
2083 case ARC_OPERAND_UNCONDB
:
2085 case ARC_OPERAND_UNCONDI
:
2087 case ARC_OPERAND_UNCONDJ
:
2089 case ARC_OPERAND_VBIT
:
2091 case ARC_OPERAND_ZBIT
:
2095 /* xgettext:c-format */
2096 fprintf (stderr
, _("Unrecognized field %d while setting int operand.\n"),
2103 arc_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
2105 CGEN_FIELDS
* fields
,
2110 case ARC_OPERAND_EXDI
:
2111 fields
->f_F
= value
;
2113 case ARC_OPERAND_F
:
2114 fields
->f_F
= value
;
2116 case ARC_OPERAND_F0
:
2117 fields
->f_F
= value
;
2119 case ARC_OPERAND_F1
:
2120 fields
->f_F
= value
;
2122 case ARC_OPERAND_F1F
:
2123 fields
->f_F
= value
;
2125 case ARC_OPERAND_GP
:
2127 case ARC_OPERAND_LDODI
:
2128 fields
->f_LDODi
= value
;
2130 case ARC_OPERAND_LDRDI
:
2131 fields
->f_LDRDi
= value
;
2133 case ARC_OPERAND_NE
:
2135 case ARC_OPERAND_PCL
:
2137 case ARC_OPERAND_QCONDB
:
2138 fields
->f_cond_Q
= value
;
2140 case ARC_OPERAND_QCONDI
:
2141 fields
->f_cond_Q
= value
;
2143 case ARC_OPERAND_QCONDJ
:
2144 fields
->f_cond_Q
= value
;
2146 case ARC_OPERAND_R0
:
2148 case ARC_OPERAND_R31
:
2150 case ARC_OPERAND_RA
:
2151 fields
->f_op_A
= value
;
2153 case ARC_OPERAND_RA_0
:
2154 fields
->f_op_A
= value
;
2156 case ARC_OPERAND_RB
:
2157 fields
->f_op_B
= value
;
2159 case ARC_OPERAND_RB_0
:
2160 fields
->f_op_B
= value
;
2162 case ARC_OPERAND_RC
:
2163 fields
->f_op_C
= value
;
2165 case ARC_OPERAND_RC_ILINK
:
2166 fields
->f_op_Cj
= value
;
2168 case ARC_OPERAND_RC_NOILINK
:
2169 fields
->f_op_Cj
= value
;
2171 case ARC_OPERAND_R_A
:
2172 fields
->f_op__a
= value
;
2174 case ARC_OPERAND_R_B
:
2175 fields
->f_op__b
= value
;
2177 case ARC_OPERAND_R_C
:
2178 fields
->f_op__c
= value
;
2180 case ARC_OPERAND_RCC
:
2181 fields
->f_brcond
= value
;
2183 case ARC_OPERAND_RCCS
:
2184 fields
->f_brscond
= value
;
2186 case ARC_OPERAND_RH
:
2187 fields
->f_op_h
= value
;
2189 case ARC_OPERAND_SP
:
2191 case ARC_OPERAND_STODI
:
2192 fields
->f_STODi
= value
;
2194 case ARC_OPERAND_U6
:
2195 fields
->f_u6
= value
;
2197 case ARC_OPERAND_U6X2
:
2198 fields
->f_u6x2
= value
;
2200 case ARC_OPERAND__AW
:
2202 case ARC_OPERAND__L
:
2204 case ARC_OPERAND__S
:
2206 case ARC_OPERAND_CBIT
:
2208 case ARC_OPERAND_DELAY_N
:
2209 fields
->f_delay_N
= value
;
2211 case ARC_OPERAND_DUMMY_OP
:
2212 fields
->f_dummy
= value
;
2214 case ARC_OPERAND_I2COND
:
2215 fields
->f_cond_i2
= value
;
2217 case ARC_OPERAND_I3COND
:
2218 fields
->f_cond_i3
= value
;
2220 case ARC_OPERAND_LABEL10
:
2221 fields
->f_rel10
= value
;
2223 case ARC_OPERAND_LABEL13A
:
2224 fields
->f_rel13bl
= value
;
2226 case ARC_OPERAND_LABEL21
:
2227 fields
->f_rel21
= value
;
2229 case ARC_OPERAND_LABEL21A
:
2230 fields
->f_rel21bl
= value
;
2232 case ARC_OPERAND_LABEL25
:
2233 fields
->f_rel25
= value
;
2235 case ARC_OPERAND_LABEL25A
:
2236 fields
->f_rel25bl
= value
;
2238 case ARC_OPERAND_LABEL7
:
2239 fields
->f_rel7
= value
;
2241 case ARC_OPERAND_LABEL8
:
2242 fields
->f_rel8
= value
;
2244 case ARC_OPERAND_LABEL9
:
2245 fields
->f_rel9
= value
;
2247 case ARC_OPERAND_LBIT
:
2249 case ARC_OPERAND_NBIT
:
2251 case ARC_OPERAND_S12
:
2252 fields
->f_s12
= value
;
2254 case ARC_OPERAND_S12X2
:
2255 fields
->f_s12x2
= value
;
2257 case ARC_OPERAND_S1BIT
:
2259 case ARC_OPERAND_S2BIT
:
2261 case ARC_OPERAND_S9
:
2262 fields
->f_s9
= value
;
2264 case ARC_OPERAND_S9X4
:
2265 fields
->f_s9x4
= value
;
2267 case ARC_OPERAND_SC_S9_
:
2268 fields
->f_s9x4
= value
;
2270 case ARC_OPERAND_SC_S9B
:
2271 fields
->f_s9x1
= value
;
2273 case ARC_OPERAND_SC_S9W
:
2274 fields
->f_s9x2
= value
;
2276 case ARC_OPERAND_SC_U5_
:
2277 fields
->f_u5x4
= value
;
2279 case ARC_OPERAND_SC_U5B
:
2280 fields
->f_u5
= value
;
2282 case ARC_OPERAND_SC_U5W
:
2283 fields
->f_u5x2
= value
;
2285 case ARC_OPERAND_TRAPNUM
:
2286 fields
->f_trapnum
= value
;
2288 case ARC_OPERAND_U3
:
2289 fields
->f_u3
= value
;
2291 case ARC_OPERAND_U5
:
2292 fields
->f_u5
= value
;
2294 case ARC_OPERAND_U5X4
:
2295 fields
->f_u5x4
= value
;
2297 case ARC_OPERAND_U7
:
2298 fields
->f_u7
= value
;
2300 case ARC_OPERAND_U8
:
2301 fields
->f_u8
= value
;
2303 case ARC_OPERAND_U8X4
:
2304 fields
->f_u8x4
= value
;
2306 case ARC_OPERAND_UNCONDB
:
2308 case ARC_OPERAND_UNCONDI
:
2310 case ARC_OPERAND_UNCONDJ
:
2312 case ARC_OPERAND_VBIT
:
2314 case ARC_OPERAND_ZBIT
:
2318 /* xgettext:c-format */
2319 fprintf (stderr
, _("Unrecognized field %d while setting vma operand.\n"),
2325 /* Function to call before using the instruction builder tables. */
2328 arc_cgen_init_ibld_table (CGEN_CPU_DESC cd
)
2330 cd
->insert_handlers
= & arc_cgen_insert_handlers
[0];
2331 cd
->extract_handlers
= & arc_cgen_extract_handlers
[0];
2333 cd
->insert_operand
= arc_cgen_insert_operand
;
2334 cd
->extract_operand
= arc_cgen_extract_operand
;
2336 cd
->get_int_operand
= arc_cgen_get_int_operand
;
2337 cd
->set_int_operand
= arc_cgen_set_int_operand
;
2338 cd
->get_vma_operand
= arc_cgen_get_vma_operand
;
2339 cd
->set_vma_operand
= arc_cgen_set_vma_operand
;