1*3d8817e4Smiod /* Instruction building/extraction support for frv. -*- C -*-
2*3d8817e4Smiod 
3*3d8817e4Smiod    THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator.
4*3d8817e4Smiod    - the resultant file is machine generated, cgen-ibld.in isn't
5*3d8817e4Smiod 
6*3d8817e4Smiod    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2006
7*3d8817e4Smiod    Free Software Foundation, Inc.
8*3d8817e4Smiod 
9*3d8817e4Smiod    This file is part of the GNU Binutils and GDB, the GNU debugger.
10*3d8817e4Smiod 
11*3d8817e4Smiod    This program is free software; you can redistribute it and/or modify
12*3d8817e4Smiod    it under the terms of the GNU General Public License as published by
13*3d8817e4Smiod    the Free Software Foundation; either version 2, or (at your option)
14*3d8817e4Smiod    any later version.
15*3d8817e4Smiod 
16*3d8817e4Smiod    This program is distributed in the hope that it will be useful,
17*3d8817e4Smiod    but WITHOUT ANY WARRANTY; without even the implied warranty of
18*3d8817e4Smiod    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19*3d8817e4Smiod    GNU General Public License for more details.
20*3d8817e4Smiod 
21*3d8817e4Smiod    You should have received a copy of the GNU General Public License
22*3d8817e4Smiod    along with this program; if not, write to the Free Software Foundation, Inc.,
23*3d8817e4Smiod    51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
24*3d8817e4Smiod 
25*3d8817e4Smiod /* ??? Eventually more and more of this stuff can go to cpu-independent files.
26*3d8817e4Smiod    Keep that in mind.  */
27*3d8817e4Smiod 
28*3d8817e4Smiod #include "sysdep.h"
29*3d8817e4Smiod #include <stdio.h>
30*3d8817e4Smiod #include "ansidecl.h"
31*3d8817e4Smiod #include "dis-asm.h"
32*3d8817e4Smiod #include "bfd.h"
33*3d8817e4Smiod #include "symcat.h"
34*3d8817e4Smiod #include "frv-desc.h"
35*3d8817e4Smiod #include "frv-opc.h"
36*3d8817e4Smiod #include "opintl.h"
37*3d8817e4Smiod #include "safe-ctype.h"
38*3d8817e4Smiod 
39*3d8817e4Smiod #undef  min
40*3d8817e4Smiod #define min(a,b) ((a) < (b) ? (a) : (b))
41*3d8817e4Smiod #undef  max
42*3d8817e4Smiod #define max(a,b) ((a) > (b) ? (a) : (b))
43*3d8817e4Smiod 
44*3d8817e4Smiod /* Used by the ifield rtx function.  */
45*3d8817e4Smiod #define FLD(f) (fields->f)
46*3d8817e4Smiod 
47*3d8817e4Smiod static const char * insert_normal
48*3d8817e4Smiod   (CGEN_CPU_DESC, long, unsigned int, unsigned int, unsigned int,
49*3d8817e4Smiod    unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR);
50*3d8817e4Smiod static const char * insert_insn_normal
51*3d8817e4Smiod   (CGEN_CPU_DESC, const CGEN_INSN *,
52*3d8817e4Smiod    CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma);
53*3d8817e4Smiod static int extract_normal
54*3d8817e4Smiod   (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, CGEN_INSN_INT,
55*3d8817e4Smiod    unsigned int, unsigned int, unsigned int, unsigned int,
56*3d8817e4Smiod    unsigned int, unsigned int, bfd_vma, long *);
57*3d8817e4Smiod static int extract_insn_normal
58*3d8817e4Smiod   (CGEN_CPU_DESC, const CGEN_INSN *, CGEN_EXTRACT_INFO *,
59*3d8817e4Smiod    CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma);
60*3d8817e4Smiod #if CGEN_INT_INSN_P
61*3d8817e4Smiod static void put_insn_int_value
62*3d8817e4Smiod   (CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT);
63*3d8817e4Smiod #endif
64*3d8817e4Smiod #if ! CGEN_INT_INSN_P
65*3d8817e4Smiod static CGEN_INLINE void insert_1
66*3d8817e4Smiod   (CGEN_CPU_DESC, unsigned long, int, int, int, unsigned char *);
67*3d8817e4Smiod static CGEN_INLINE int fill_cache
68*3d8817e4Smiod   (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *,  int, int, bfd_vma);
69*3d8817e4Smiod static CGEN_INLINE long extract_1
70*3d8817e4Smiod   (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, int, unsigned char *, bfd_vma);
71*3d8817e4Smiod #endif
72*3d8817e4Smiod 
73*3d8817e4Smiod /* Operand insertion.  */
74*3d8817e4Smiod 
75*3d8817e4Smiod #if ! CGEN_INT_INSN_P
76*3d8817e4Smiod 
77*3d8817e4Smiod /* Subroutine of insert_normal.  */
78*3d8817e4Smiod 
79*3d8817e4Smiod static CGEN_INLINE void
insert_1(CGEN_CPU_DESC cd,unsigned long value,int start,int length,int word_length,unsigned char * bufp)80*3d8817e4Smiod insert_1 (CGEN_CPU_DESC cd,
81*3d8817e4Smiod 	  unsigned long value,
82*3d8817e4Smiod 	  int start,
83*3d8817e4Smiod 	  int length,
84*3d8817e4Smiod 	  int word_length,
85*3d8817e4Smiod 	  unsigned char *bufp)
86*3d8817e4Smiod {
87*3d8817e4Smiod   unsigned long x,mask;
88*3d8817e4Smiod   int shift;
89*3d8817e4Smiod 
90*3d8817e4Smiod   x = cgen_get_insn_value (cd, bufp, word_length);
91*3d8817e4Smiod 
92*3d8817e4Smiod   /* Written this way to avoid undefined behaviour.  */
93*3d8817e4Smiod   mask = (((1L << (length - 1)) - 1) << 1) | 1;
94*3d8817e4Smiod   if (CGEN_INSN_LSB0_P)
95*3d8817e4Smiod     shift = (start + 1) - length;
96*3d8817e4Smiod   else
97*3d8817e4Smiod     shift = (word_length - (start + length));
98*3d8817e4Smiod   x = (x & ~(mask << shift)) | ((value & mask) << shift);
99*3d8817e4Smiod 
100*3d8817e4Smiod   cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x);
101*3d8817e4Smiod }
102*3d8817e4Smiod 
103*3d8817e4Smiod #endif /* ! CGEN_INT_INSN_P */
104*3d8817e4Smiod 
105*3d8817e4Smiod /* Default insertion routine.
106*3d8817e4Smiod 
107*3d8817e4Smiod    ATTRS is a mask of the boolean attributes.
108*3d8817e4Smiod    WORD_OFFSET is the offset in bits from the start of the insn of the value.
109*3d8817e4Smiod    WORD_LENGTH is the length of the word in bits in which the value resides.
110*3d8817e4Smiod    START is the starting bit number in the word, architecture origin.
111*3d8817e4Smiod    LENGTH is the length of VALUE in bits.
112*3d8817e4Smiod    TOTAL_LENGTH is the total length of the insn in bits.
113*3d8817e4Smiod 
114*3d8817e4Smiod    The result is an error message or NULL if success.  */
115*3d8817e4Smiod 
116*3d8817e4Smiod /* ??? This duplicates functionality with bfd's howto table and
117*3d8817e4Smiod    bfd_install_relocation.  */
118*3d8817e4Smiod /* ??? This doesn't handle bfd_vma's.  Create another function when
119*3d8817e4Smiod    necessary.  */
120*3d8817e4Smiod 
121*3d8817e4Smiod static const char *
insert_normal(CGEN_CPU_DESC cd,long value,unsigned int attrs,unsigned int word_offset,unsigned int start,unsigned int length,unsigned int word_length,unsigned int total_length,CGEN_INSN_BYTES_PTR buffer)122*3d8817e4Smiod insert_normal (CGEN_CPU_DESC cd,
123*3d8817e4Smiod 	       long value,
124*3d8817e4Smiod 	       unsigned int attrs,
125*3d8817e4Smiod 	       unsigned int word_offset,
126*3d8817e4Smiod 	       unsigned int start,
127*3d8817e4Smiod 	       unsigned int length,
128*3d8817e4Smiod 	       unsigned int word_length,
129*3d8817e4Smiod 	       unsigned int total_length,
130*3d8817e4Smiod 	       CGEN_INSN_BYTES_PTR buffer)
131*3d8817e4Smiod {
132*3d8817e4Smiod   static char errbuf[100];
133*3d8817e4Smiod   /* Written this way to avoid undefined behaviour.  */
134*3d8817e4Smiod   unsigned long mask = (((1L << (length - 1)) - 1) << 1) | 1;
135*3d8817e4Smiod 
136*3d8817e4Smiod   /* If LENGTH is zero, this operand doesn't contribute to the value.  */
137*3d8817e4Smiod   if (length == 0)
138*3d8817e4Smiod     return NULL;
139*3d8817e4Smiod 
140*3d8817e4Smiod   if (word_length > 32)
141*3d8817e4Smiod     abort ();
142*3d8817e4Smiod 
143*3d8817e4Smiod   /* For architectures with insns smaller than the base-insn-bitsize,
144*3d8817e4Smiod      word_length may be too big.  */
145*3d8817e4Smiod   if (cd->min_insn_bitsize < cd->base_insn_bitsize)
146*3d8817e4Smiod     {
147*3d8817e4Smiod       if (word_offset == 0
148*3d8817e4Smiod 	  && word_length > total_length)
149*3d8817e4Smiod 	word_length = total_length;
150*3d8817e4Smiod     }
151*3d8817e4Smiod 
152*3d8817e4Smiod   /* Ensure VALUE will fit.  */
153*3d8817e4Smiod   if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGN_OPT))
154*3d8817e4Smiod     {
155*3d8817e4Smiod       long minval = - (1L << (length - 1));
156*3d8817e4Smiod       unsigned long maxval = mask;
157*3d8817e4Smiod 
158*3d8817e4Smiod       if ((value > 0 && (unsigned long) value > maxval)
159*3d8817e4Smiod 	  || value < minval)
160*3d8817e4Smiod 	{
161*3d8817e4Smiod 	  /* xgettext:c-format */
162*3d8817e4Smiod 	  sprintf (errbuf,
163*3d8817e4Smiod 		   _("operand out of range (%ld not between %ld and %lu)"),
164*3d8817e4Smiod 		   value, minval, maxval);
165*3d8817e4Smiod 	  return errbuf;
166*3d8817e4Smiod 	}
167*3d8817e4Smiod     }
168*3d8817e4Smiod   else if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED))
169*3d8817e4Smiod     {
170*3d8817e4Smiod       unsigned long maxval = mask;
171*3d8817e4Smiod       unsigned long val = (unsigned long) value;
172*3d8817e4Smiod 
173*3d8817e4Smiod       /* For hosts with a word size > 32 check to see if value has been sign
174*3d8817e4Smiod 	 extended beyond 32 bits.  If so then ignore these higher sign bits
175*3d8817e4Smiod 	 as the user is attempting to store a 32-bit signed value into an
176*3d8817e4Smiod 	 unsigned 32-bit field which is allowed.  */
177*3d8817e4Smiod       if (sizeof (unsigned long) > 4 && ((value >> 32) == -1))
178*3d8817e4Smiod 	val &= 0xFFFFFFFF;
179*3d8817e4Smiod 
180*3d8817e4Smiod       if (val > maxval)
181*3d8817e4Smiod 	{
182*3d8817e4Smiod 	  /* xgettext:c-format */
183*3d8817e4Smiod 	  sprintf (errbuf,
184*3d8817e4Smiod 		   _("operand out of range (0x%lx not between 0 and 0x%lx)"),
185*3d8817e4Smiod 		   val, maxval);
186*3d8817e4Smiod 	  return errbuf;
187*3d8817e4Smiod 	}
188*3d8817e4Smiod     }
189*3d8817e4Smiod   else
190*3d8817e4Smiod     {
191*3d8817e4Smiod       if (! cgen_signed_overflow_ok_p (cd))
192*3d8817e4Smiod 	{
193*3d8817e4Smiod 	  long minval = - (1L << (length - 1));
194*3d8817e4Smiod 	  long maxval =   (1L << (length - 1)) - 1;
195*3d8817e4Smiod 
196*3d8817e4Smiod 	  if (value < minval || value > maxval)
197*3d8817e4Smiod 	    {
198*3d8817e4Smiod 	      sprintf
199*3d8817e4Smiod 		/* xgettext:c-format */
200*3d8817e4Smiod 		(errbuf, _("operand out of range (%ld not between %ld and %ld)"),
201*3d8817e4Smiod 		 value, minval, maxval);
202*3d8817e4Smiod 	      return errbuf;
203*3d8817e4Smiod 	    }
204*3d8817e4Smiod 	}
205*3d8817e4Smiod     }
206*3d8817e4Smiod 
207*3d8817e4Smiod #if CGEN_INT_INSN_P
208*3d8817e4Smiod 
209*3d8817e4Smiod   {
210*3d8817e4Smiod     int shift;
211*3d8817e4Smiod 
212*3d8817e4Smiod     if (CGEN_INSN_LSB0_P)
213*3d8817e4Smiod       shift = (word_offset + start + 1) - length;
214*3d8817e4Smiod     else
215*3d8817e4Smiod       shift = total_length - (word_offset + start + length);
216*3d8817e4Smiod     *buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
217*3d8817e4Smiod   }
218*3d8817e4Smiod 
219*3d8817e4Smiod #else /* ! CGEN_INT_INSN_P */
220*3d8817e4Smiod 
221*3d8817e4Smiod   {
222*3d8817e4Smiod     unsigned char *bufp = (unsigned char *) buffer + word_offset / 8;
223*3d8817e4Smiod 
224*3d8817e4Smiod     insert_1 (cd, value, start, length, word_length, bufp);
225*3d8817e4Smiod   }
226*3d8817e4Smiod 
227*3d8817e4Smiod #endif /* ! CGEN_INT_INSN_P */
228*3d8817e4Smiod 
229*3d8817e4Smiod   return NULL;
230*3d8817e4Smiod }
231*3d8817e4Smiod 
232*3d8817e4Smiod /* Default insn builder (insert handler).
233*3d8817e4Smiod    The instruction is recorded in CGEN_INT_INSN_P byte order (meaning
234*3d8817e4Smiod    that if CGEN_INSN_BYTES_PTR is an int * and thus, the value is
235*3d8817e4Smiod    recorded in host byte order, otherwise BUFFER is an array of bytes
236*3d8817e4Smiod    and the value is recorded in target byte order).
237*3d8817e4Smiod    The result is an error message or NULL if success.  */
238*3d8817e4Smiod 
239*3d8817e4Smiod static const char *
insert_insn_normal(CGEN_CPU_DESC cd,const CGEN_INSN * insn,CGEN_FIELDS * fields,CGEN_INSN_BYTES_PTR buffer,bfd_vma pc)240*3d8817e4Smiod insert_insn_normal (CGEN_CPU_DESC cd,
241*3d8817e4Smiod 		    const CGEN_INSN * insn,
242*3d8817e4Smiod 		    CGEN_FIELDS * fields,
243*3d8817e4Smiod 		    CGEN_INSN_BYTES_PTR buffer,
244*3d8817e4Smiod 		    bfd_vma pc)
245*3d8817e4Smiod {
246*3d8817e4Smiod   const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
247*3d8817e4Smiod   unsigned long value;
248*3d8817e4Smiod   const CGEN_SYNTAX_CHAR_TYPE * syn;
249*3d8817e4Smiod 
250*3d8817e4Smiod   CGEN_INIT_INSERT (cd);
251*3d8817e4Smiod   value = CGEN_INSN_BASE_VALUE (insn);
252*3d8817e4Smiod 
253*3d8817e4Smiod   /* If we're recording insns as numbers (rather than a string of bytes),
254*3d8817e4Smiod      target byte order handling is deferred until later.  */
255*3d8817e4Smiod 
256*3d8817e4Smiod #if CGEN_INT_INSN_P
257*3d8817e4Smiod 
258*3d8817e4Smiod   put_insn_int_value (cd, buffer, cd->base_insn_bitsize,
259*3d8817e4Smiod 		      CGEN_FIELDS_BITSIZE (fields), value);
260*3d8817e4Smiod 
261*3d8817e4Smiod #else
262*3d8817e4Smiod 
263*3d8817e4Smiod   cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize,
264*3d8817e4Smiod 					(unsigned) CGEN_FIELDS_BITSIZE (fields)),
265*3d8817e4Smiod 		       value);
266*3d8817e4Smiod 
267*3d8817e4Smiod #endif /* ! CGEN_INT_INSN_P */
268*3d8817e4Smiod 
269*3d8817e4Smiod   /* ??? It would be better to scan the format's fields.
270*3d8817e4Smiod      Still need to be able to insert a value based on the operand though;
271*3d8817e4Smiod      e.g. storing a branch displacement that got resolved later.
272*3d8817e4Smiod      Needs more thought first.  */
273*3d8817e4Smiod 
274*3d8817e4Smiod   for (syn = CGEN_SYNTAX_STRING (syntax); * syn; ++ syn)
275*3d8817e4Smiod     {
276*3d8817e4Smiod       const char *errmsg;
277*3d8817e4Smiod 
278*3d8817e4Smiod       if (CGEN_SYNTAX_CHAR_P (* syn))
279*3d8817e4Smiod 	continue;
280*3d8817e4Smiod 
281*3d8817e4Smiod       errmsg = (* cd->insert_operand) (cd, CGEN_SYNTAX_FIELD (*syn),
282*3d8817e4Smiod 				       fields, buffer, pc);
283*3d8817e4Smiod       if (errmsg)
284*3d8817e4Smiod 	return errmsg;
285*3d8817e4Smiod     }
286*3d8817e4Smiod 
287*3d8817e4Smiod   return NULL;
288*3d8817e4Smiod }
289*3d8817e4Smiod 
290*3d8817e4Smiod #if CGEN_INT_INSN_P
291*3d8817e4Smiod /* Cover function to store an insn value into an integral insn.  Must go here
292*3d8817e4Smiod    because it needs <prefix>-desc.h for CGEN_INT_INSN_P.  */
293*3d8817e4Smiod 
294*3d8817e4Smiod static void
put_insn_int_value(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,CGEN_INSN_BYTES_PTR buf,int length,int insn_length,CGEN_INSN_INT value)295*3d8817e4Smiod put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
296*3d8817e4Smiod 		    CGEN_INSN_BYTES_PTR buf,
297*3d8817e4Smiod 		    int length,
298*3d8817e4Smiod 		    int insn_length,
299*3d8817e4Smiod 		    CGEN_INSN_INT value)
300*3d8817e4Smiod {
301*3d8817e4Smiod   /* For architectures with insns smaller than the base-insn-bitsize,
302*3d8817e4Smiod      length may be too big.  */
303*3d8817e4Smiod   if (length > insn_length)
304*3d8817e4Smiod     *buf = value;
305*3d8817e4Smiod   else
306*3d8817e4Smiod     {
307*3d8817e4Smiod       int shift = insn_length - length;
308*3d8817e4Smiod       /* Written this way to avoid undefined behaviour.  */
309*3d8817e4Smiod       CGEN_INSN_INT mask = (((1L << (length - 1)) - 1) << 1) | 1;
310*3d8817e4Smiod 
311*3d8817e4Smiod       *buf = (*buf & ~(mask << shift)) | ((value & mask) << shift);
312*3d8817e4Smiod     }
313*3d8817e4Smiod }
314*3d8817e4Smiod #endif
315*3d8817e4Smiod 
316*3d8817e4Smiod /* Operand extraction.  */
317*3d8817e4Smiod 
318*3d8817e4Smiod #if ! CGEN_INT_INSN_P
319*3d8817e4Smiod 
320*3d8817e4Smiod /* Subroutine of extract_normal.
321*3d8817e4Smiod    Ensure sufficient bytes are cached in EX_INFO.
322*3d8817e4Smiod    OFFSET is the offset in bytes from the start of the insn of the value.
323*3d8817e4Smiod    BYTES is the length of the needed value.
324*3d8817e4Smiod    Returns 1 for success, 0 for failure.  */
325*3d8817e4Smiod 
326*3d8817e4Smiod static CGEN_INLINE int
fill_cache(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,CGEN_EXTRACT_INFO * ex_info,int offset,int bytes,bfd_vma pc)327*3d8817e4Smiod fill_cache (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
328*3d8817e4Smiod 	    CGEN_EXTRACT_INFO *ex_info,
329*3d8817e4Smiod 	    int offset,
330*3d8817e4Smiod 	    int bytes,
331*3d8817e4Smiod 	    bfd_vma pc)
332*3d8817e4Smiod {
333*3d8817e4Smiod   /* It's doubtful that the middle part has already been fetched so
334*3d8817e4Smiod      we don't optimize that case.  kiss.  */
335*3d8817e4Smiod   unsigned int mask;
336*3d8817e4Smiod   disassemble_info *info = (disassemble_info *) ex_info->dis_info;
337*3d8817e4Smiod 
338*3d8817e4Smiod   /* First do a quick check.  */
339*3d8817e4Smiod   mask = (1 << bytes) - 1;
340*3d8817e4Smiod   if (((ex_info->valid >> offset) & mask) == mask)
341*3d8817e4Smiod     return 1;
342*3d8817e4Smiod 
343*3d8817e4Smiod   /* Search for the first byte we need to read.  */
344*3d8817e4Smiod   for (mask = 1 << offset; bytes > 0; --bytes, ++offset, mask <<= 1)
345*3d8817e4Smiod     if (! (mask & ex_info->valid))
346*3d8817e4Smiod       break;
347*3d8817e4Smiod 
348*3d8817e4Smiod   if (bytes)
349*3d8817e4Smiod     {
350*3d8817e4Smiod       int status;
351*3d8817e4Smiod 
352*3d8817e4Smiod       pc += offset;
353*3d8817e4Smiod       status = (*info->read_memory_func)
354*3d8817e4Smiod 	(pc, ex_info->insn_bytes + offset, bytes, info);
355*3d8817e4Smiod 
356*3d8817e4Smiod       if (status != 0)
357*3d8817e4Smiod 	{
358*3d8817e4Smiod 	  (*info->memory_error_func) (status, pc, info);
359*3d8817e4Smiod 	  return 0;
360*3d8817e4Smiod 	}
361*3d8817e4Smiod 
362*3d8817e4Smiod       ex_info->valid |= ((1 << bytes) - 1) << offset;
363*3d8817e4Smiod     }
364*3d8817e4Smiod 
365*3d8817e4Smiod   return 1;
366*3d8817e4Smiod }
367*3d8817e4Smiod 
368*3d8817e4Smiod /* Subroutine of extract_normal.  */
369*3d8817e4Smiod 
370*3d8817e4Smiod static CGEN_INLINE long
extract_1(CGEN_CPU_DESC cd,CGEN_EXTRACT_INFO * ex_info ATTRIBUTE_UNUSED,int start,int length,int word_length,unsigned char * bufp,bfd_vma pc ATTRIBUTE_UNUSED)371*3d8817e4Smiod extract_1 (CGEN_CPU_DESC cd,
372*3d8817e4Smiod 	   CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED,
373*3d8817e4Smiod 	   int start,
374*3d8817e4Smiod 	   int length,
375*3d8817e4Smiod 	   int word_length,
376*3d8817e4Smiod 	   unsigned char *bufp,
377*3d8817e4Smiod 	   bfd_vma pc ATTRIBUTE_UNUSED)
378*3d8817e4Smiod {
379*3d8817e4Smiod   unsigned long x;
380*3d8817e4Smiod   int shift;
381*3d8817e4Smiod 
382*3d8817e4Smiod   x = cgen_get_insn_value (cd, bufp, word_length);
383*3d8817e4Smiod 
384*3d8817e4Smiod   if (CGEN_INSN_LSB0_P)
385*3d8817e4Smiod     shift = (start + 1) - length;
386*3d8817e4Smiod   else
387*3d8817e4Smiod     shift = (word_length - (start + length));
388*3d8817e4Smiod   return x >> shift;
389*3d8817e4Smiod }
390*3d8817e4Smiod 
391*3d8817e4Smiod #endif /* ! CGEN_INT_INSN_P */
392*3d8817e4Smiod 
393*3d8817e4Smiod /* Default extraction routine.
394*3d8817e4Smiod 
395*3d8817e4Smiod    INSN_VALUE is the first base_insn_bitsize bits of the insn in host order,
396*3d8817e4Smiod    or sometimes less for cases like the m32r where the base insn size is 32
397*3d8817e4Smiod    but some insns are 16 bits.
398*3d8817e4Smiod    ATTRS is a mask of the boolean attributes.  We only need `SIGNED',
399*3d8817e4Smiod    but for generality we take a bitmask of all of them.
400*3d8817e4Smiod    WORD_OFFSET is the offset in bits from the start of the insn of the value.
401*3d8817e4Smiod    WORD_LENGTH is the length of the word in bits in which the value resides.
402*3d8817e4Smiod    START is the starting bit number in the word, architecture origin.
403*3d8817e4Smiod    LENGTH is the length of VALUE in bits.
404*3d8817e4Smiod    TOTAL_LENGTH is the total length of the insn in bits.
405*3d8817e4Smiod 
406*3d8817e4Smiod    Returns 1 for success, 0 for failure.  */
407*3d8817e4Smiod 
408*3d8817e4Smiod /* ??? The return code isn't properly used.  wip.  */
409*3d8817e4Smiod 
410*3d8817e4Smiod /* ??? This doesn't handle bfd_vma's.  Create another function when
411*3d8817e4Smiod    necessary.  */
412*3d8817e4Smiod 
413*3d8817e4Smiod static int
extract_normal(CGEN_CPU_DESC cd,CGEN_EXTRACT_INFO * ex_info,CGEN_INSN_INT insn_value,unsigned int attrs,unsigned int word_offset,unsigned int start,unsigned int length,unsigned int word_length,unsigned int total_length,bfd_vma pc,long * valuep)414*3d8817e4Smiod extract_normal (CGEN_CPU_DESC cd,
415*3d8817e4Smiod #if ! CGEN_INT_INSN_P
416*3d8817e4Smiod 		CGEN_EXTRACT_INFO *ex_info,
417*3d8817e4Smiod #else
418*3d8817e4Smiod 		CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED,
419*3d8817e4Smiod #endif
420*3d8817e4Smiod 		CGEN_INSN_INT insn_value,
421*3d8817e4Smiod 		unsigned int attrs,
422*3d8817e4Smiod 		unsigned int word_offset,
423*3d8817e4Smiod 		unsigned int start,
424*3d8817e4Smiod 		unsigned int length,
425*3d8817e4Smiod 		unsigned int word_length,
426*3d8817e4Smiod 		unsigned int total_length,
427*3d8817e4Smiod #if ! CGEN_INT_INSN_P
428*3d8817e4Smiod 		bfd_vma pc,
429*3d8817e4Smiod #else
430*3d8817e4Smiod 		bfd_vma pc ATTRIBUTE_UNUSED,
431*3d8817e4Smiod #endif
432*3d8817e4Smiod 		long *valuep)
433*3d8817e4Smiod {
434*3d8817e4Smiod   long value, mask;
435*3d8817e4Smiod 
436*3d8817e4Smiod   /* If LENGTH is zero, this operand doesn't contribute to the value
437*3d8817e4Smiod      so give it a standard value of zero.  */
438*3d8817e4Smiod   if (length == 0)
439*3d8817e4Smiod     {
440*3d8817e4Smiod       *valuep = 0;
441*3d8817e4Smiod       return 1;
442*3d8817e4Smiod     }
443*3d8817e4Smiod 
444*3d8817e4Smiod   if (word_length > 32)
445*3d8817e4Smiod     abort ();
446*3d8817e4Smiod 
447*3d8817e4Smiod   /* For architectures with insns smaller than the insn-base-bitsize,
448*3d8817e4Smiod      word_length may be too big.  */
449*3d8817e4Smiod   if (cd->min_insn_bitsize < cd->base_insn_bitsize)
450*3d8817e4Smiod     {
451*3d8817e4Smiod       if (word_offset + word_length > total_length)
452*3d8817e4Smiod 	word_length = total_length - word_offset;
453*3d8817e4Smiod     }
454*3d8817e4Smiod 
455*3d8817e4Smiod   /* Does the value reside in INSN_VALUE, and at the right alignment?  */
456*3d8817e4Smiod 
457*3d8817e4Smiod   if (CGEN_INT_INSN_P || (word_offset == 0 && word_length == total_length))
458*3d8817e4Smiod     {
459*3d8817e4Smiod       if (CGEN_INSN_LSB0_P)
460*3d8817e4Smiod 	value = insn_value >> ((word_offset + start + 1) - length);
461*3d8817e4Smiod       else
462*3d8817e4Smiod 	value = insn_value >> (total_length - ( word_offset + start + length));
463*3d8817e4Smiod     }
464*3d8817e4Smiod 
465*3d8817e4Smiod #if ! CGEN_INT_INSN_P
466*3d8817e4Smiod 
467*3d8817e4Smiod   else
468*3d8817e4Smiod     {
469*3d8817e4Smiod       unsigned char *bufp = ex_info->insn_bytes + word_offset / 8;
470*3d8817e4Smiod 
471*3d8817e4Smiod       if (word_length > 32)
472*3d8817e4Smiod 	abort ();
473*3d8817e4Smiod 
474*3d8817e4Smiod       if (fill_cache (cd, ex_info, word_offset / 8, word_length / 8, pc) == 0)
475*3d8817e4Smiod 	return 0;
476*3d8817e4Smiod 
477*3d8817e4Smiod       value = extract_1 (cd, ex_info, start, length, word_length, bufp, pc);
478*3d8817e4Smiod     }
479*3d8817e4Smiod 
480*3d8817e4Smiod #endif /* ! CGEN_INT_INSN_P */
481*3d8817e4Smiod 
482*3d8817e4Smiod   /* Written this way to avoid undefined behaviour.  */
483*3d8817e4Smiod   mask = (((1L << (length - 1)) - 1) << 1) | 1;
484*3d8817e4Smiod 
485*3d8817e4Smiod   value &= mask;
486*3d8817e4Smiod   /* sign extend? */
487*3d8817e4Smiod   if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)
488*3d8817e4Smiod       && (value & (1L << (length - 1))))
489*3d8817e4Smiod     value |= ~mask;
490*3d8817e4Smiod 
491*3d8817e4Smiod   *valuep = value;
492*3d8817e4Smiod 
493*3d8817e4Smiod   return 1;
494*3d8817e4Smiod }
495*3d8817e4Smiod 
496*3d8817e4Smiod /* Default insn extractor.
497*3d8817e4Smiod 
498*3d8817e4Smiod    INSN_VALUE is the first base_insn_bitsize bits, translated to host order.
499*3d8817e4Smiod    The extracted fields are stored in FIELDS.
500*3d8817e4Smiod    EX_INFO is used to handle reading variable length insns.
501*3d8817e4Smiod    Return the length of the insn in bits, or 0 if no match,
502*3d8817e4Smiod    or -1 if an error occurs fetching data (memory_error_func will have
503*3d8817e4Smiod    been called).  */
504*3d8817e4Smiod 
505*3d8817e4Smiod static int
extract_insn_normal(CGEN_CPU_DESC cd,const CGEN_INSN * insn,CGEN_EXTRACT_INFO * ex_info,CGEN_INSN_INT insn_value,CGEN_FIELDS * fields,bfd_vma pc)506*3d8817e4Smiod extract_insn_normal (CGEN_CPU_DESC cd,
507*3d8817e4Smiod 		     const CGEN_INSN *insn,
508*3d8817e4Smiod 		     CGEN_EXTRACT_INFO *ex_info,
509*3d8817e4Smiod 		     CGEN_INSN_INT insn_value,
510*3d8817e4Smiod 		     CGEN_FIELDS *fields,
511*3d8817e4Smiod 		     bfd_vma pc)
512*3d8817e4Smiod {
513*3d8817e4Smiod   const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
514*3d8817e4Smiod   const CGEN_SYNTAX_CHAR_TYPE *syn;
515*3d8817e4Smiod 
516*3d8817e4Smiod   CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
517*3d8817e4Smiod 
518*3d8817e4Smiod   CGEN_INIT_EXTRACT (cd);
519*3d8817e4Smiod 
520*3d8817e4Smiod   for (syn = CGEN_SYNTAX_STRING (syntax); *syn; ++syn)
521*3d8817e4Smiod     {
522*3d8817e4Smiod       int length;
523*3d8817e4Smiod 
524*3d8817e4Smiod       if (CGEN_SYNTAX_CHAR_P (*syn))
525*3d8817e4Smiod 	continue;
526*3d8817e4Smiod 
527*3d8817e4Smiod       length = (* cd->extract_operand) (cd, CGEN_SYNTAX_FIELD (*syn),
528*3d8817e4Smiod 					ex_info, insn_value, fields, pc);
529*3d8817e4Smiod       if (length <= 0)
530*3d8817e4Smiod 	return length;
531*3d8817e4Smiod     }
532*3d8817e4Smiod 
533*3d8817e4Smiod   /* We recognized and successfully extracted this insn.  */
534*3d8817e4Smiod   return CGEN_INSN_BITSIZE (insn);
535*3d8817e4Smiod }
536*3d8817e4Smiod 
537*3d8817e4Smiod /* Machine generated code added here.  */
538*3d8817e4Smiod 
539*3d8817e4Smiod const char * frv_cgen_insert_operand
540*3d8817e4Smiod   (CGEN_CPU_DESC, int, CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma);
541*3d8817e4Smiod 
542*3d8817e4Smiod /* Main entry point for operand insertion.
543*3d8817e4Smiod 
544*3d8817e4Smiod    This function is basically just a big switch statement.  Earlier versions
545*3d8817e4Smiod    used tables to look up the function to use, but
546*3d8817e4Smiod    - if the table contains both assembler and disassembler functions then
547*3d8817e4Smiod      the disassembler contains much of the assembler and vice-versa,
548*3d8817e4Smiod    - there's a lot of inlining possibilities as things grow,
549*3d8817e4Smiod    - using a switch statement avoids the function call overhead.
550*3d8817e4Smiod 
551*3d8817e4Smiod    This function could be moved into `parse_insn_normal', but keeping it
552*3d8817e4Smiod    separate makes clear the interface between `parse_insn_normal' and each of
553*3d8817e4Smiod    the handlers.  It's also needed by GAS to insert operands that couldn't be
554*3d8817e4Smiod    resolved during parsing.  */
555*3d8817e4Smiod 
556*3d8817e4Smiod const char *
frv_cgen_insert_operand(CGEN_CPU_DESC cd,int opindex,CGEN_FIELDS * fields,CGEN_INSN_BYTES_PTR buffer,bfd_vma pc ATTRIBUTE_UNUSED)557*3d8817e4Smiod frv_cgen_insert_operand (CGEN_CPU_DESC cd,
558*3d8817e4Smiod 			     int opindex,
559*3d8817e4Smiod 			     CGEN_FIELDS * fields,
560*3d8817e4Smiod 			     CGEN_INSN_BYTES_PTR buffer,
561*3d8817e4Smiod 			     bfd_vma pc ATTRIBUTE_UNUSED)
562*3d8817e4Smiod {
563*3d8817e4Smiod   const char * errmsg = NULL;
564*3d8817e4Smiod   unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);
565*3d8817e4Smiod 
566*3d8817e4Smiod   switch (opindex)
567*3d8817e4Smiod     {
568*3d8817e4Smiod     case FRV_OPERAND_A0 :
569*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_A, 0, 0, 17, 1, 32, total_length, buffer);
570*3d8817e4Smiod       break;
571*3d8817e4Smiod     case FRV_OPERAND_A1 :
572*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_A, 0, 0, 17, 1, 32, total_length, buffer);
573*3d8817e4Smiod       break;
574*3d8817e4Smiod     case FRV_OPERAND_ACC40SI :
575*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_ACC40Si, 0, 0, 17, 6, 32, total_length, buffer);
576*3d8817e4Smiod       break;
577*3d8817e4Smiod     case FRV_OPERAND_ACC40SK :
578*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_ACC40Sk, 0, 0, 30, 6, 32, total_length, buffer);
579*3d8817e4Smiod       break;
580*3d8817e4Smiod     case FRV_OPERAND_ACC40UI :
581*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_ACC40Ui, 0, 0, 17, 6, 32, total_length, buffer);
582*3d8817e4Smiod       break;
583*3d8817e4Smiod     case FRV_OPERAND_ACC40UK :
584*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_ACC40Uk, 0, 0, 30, 6, 32, total_length, buffer);
585*3d8817e4Smiod       break;
586*3d8817e4Smiod     case FRV_OPERAND_ACCGI :
587*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_ACCGi, 0, 0, 17, 6, 32, total_length, buffer);
588*3d8817e4Smiod       break;
589*3d8817e4Smiod     case FRV_OPERAND_ACCGK :
590*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_ACCGk, 0, 0, 30, 6, 32, total_length, buffer);
591*3d8817e4Smiod       break;
592*3d8817e4Smiod     case FRV_OPERAND_CCI :
593*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_CCi, 0, 0, 11, 3, 32, total_length, buffer);
594*3d8817e4Smiod       break;
595*3d8817e4Smiod     case FRV_OPERAND_CPRDOUBLEK :
596*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_CPRk, 0, 0, 30, 6, 32, total_length, buffer);
597*3d8817e4Smiod       break;
598*3d8817e4Smiod     case FRV_OPERAND_CPRI :
599*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_CPRi, 0, 0, 17, 6, 32, total_length, buffer);
600*3d8817e4Smiod       break;
601*3d8817e4Smiod     case FRV_OPERAND_CPRJ :
602*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_CPRj, 0, 0, 5, 6, 32, total_length, buffer);
603*3d8817e4Smiod       break;
604*3d8817e4Smiod     case FRV_OPERAND_CPRK :
605*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_CPRk, 0, 0, 30, 6, 32, total_length, buffer);
606*3d8817e4Smiod       break;
607*3d8817e4Smiod     case FRV_OPERAND_CRI :
608*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_CRi, 0, 0, 14, 3, 32, total_length, buffer);
609*3d8817e4Smiod       break;
610*3d8817e4Smiod     case FRV_OPERAND_CRJ :
611*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_CRj, 0, 0, 2, 3, 32, total_length, buffer);
612*3d8817e4Smiod       break;
613*3d8817e4Smiod     case FRV_OPERAND_CRJ_FLOAT :
614*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_CRj_float, 0, 0, 26, 2, 32, total_length, buffer);
615*3d8817e4Smiod       break;
616*3d8817e4Smiod     case FRV_OPERAND_CRJ_INT :
617*3d8817e4Smiod       {
618*3d8817e4Smiod         long value = fields->f_CRj_int;
619*3d8817e4Smiod         value = ((value) - (4));
620*3d8817e4Smiod         errmsg = insert_normal (cd, value, 0, 0, 26, 2, 32, total_length, buffer);
621*3d8817e4Smiod       }
622*3d8817e4Smiod       break;
623*3d8817e4Smiod     case FRV_OPERAND_CRK :
624*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_CRk, 0, 0, 27, 3, 32, total_length, buffer);
625*3d8817e4Smiod       break;
626*3d8817e4Smiod     case FRV_OPERAND_FCCI_1 :
627*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FCCi_1, 0, 0, 11, 2, 32, total_length, buffer);
628*3d8817e4Smiod       break;
629*3d8817e4Smiod     case FRV_OPERAND_FCCI_2 :
630*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FCCi_2, 0, 0, 26, 2, 32, total_length, buffer);
631*3d8817e4Smiod       break;
632*3d8817e4Smiod     case FRV_OPERAND_FCCI_3 :
633*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FCCi_3, 0, 0, 1, 2, 32, total_length, buffer);
634*3d8817e4Smiod       break;
635*3d8817e4Smiod     case FRV_OPERAND_FCCK :
636*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FCCk, 0, 0, 26, 2, 32, total_length, buffer);
637*3d8817e4Smiod       break;
638*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEI :
639*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FRi, 0, 0, 17, 6, 32, total_length, buffer);
640*3d8817e4Smiod       break;
641*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEJ :
642*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FRj, 0, 0, 5, 6, 32, total_length, buffer);
643*3d8817e4Smiod       break;
644*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEK :
645*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer);
646*3d8817e4Smiod       break;
647*3d8817e4Smiod     case FRV_OPERAND_FRI :
648*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FRi, 0, 0, 17, 6, 32, total_length, buffer);
649*3d8817e4Smiod       break;
650*3d8817e4Smiod     case FRV_OPERAND_FRINTI :
651*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FRi, 0, 0, 17, 6, 32, total_length, buffer);
652*3d8817e4Smiod       break;
653*3d8817e4Smiod     case FRV_OPERAND_FRINTIEVEN :
654*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FRi, 0, 0, 17, 6, 32, total_length, buffer);
655*3d8817e4Smiod       break;
656*3d8817e4Smiod     case FRV_OPERAND_FRINTJ :
657*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FRj, 0, 0, 5, 6, 32, total_length, buffer);
658*3d8817e4Smiod       break;
659*3d8817e4Smiod     case FRV_OPERAND_FRINTJEVEN :
660*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FRj, 0, 0, 5, 6, 32, total_length, buffer);
661*3d8817e4Smiod       break;
662*3d8817e4Smiod     case FRV_OPERAND_FRINTK :
663*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer);
664*3d8817e4Smiod       break;
665*3d8817e4Smiod     case FRV_OPERAND_FRINTKEVEN :
666*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer);
667*3d8817e4Smiod       break;
668*3d8817e4Smiod     case FRV_OPERAND_FRJ :
669*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FRj, 0, 0, 5, 6, 32, total_length, buffer);
670*3d8817e4Smiod       break;
671*3d8817e4Smiod     case FRV_OPERAND_FRK :
672*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer);
673*3d8817e4Smiod       break;
674*3d8817e4Smiod     case FRV_OPERAND_FRKHI :
675*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer);
676*3d8817e4Smiod       break;
677*3d8817e4Smiod     case FRV_OPERAND_FRKLO :
678*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_FRk, 0, 0, 30, 6, 32, total_length, buffer);
679*3d8817e4Smiod       break;
680*3d8817e4Smiod     case FRV_OPERAND_GRDOUBLEK :
681*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_GRk, 0, 0, 30, 6, 32, total_length, buffer);
682*3d8817e4Smiod       break;
683*3d8817e4Smiod     case FRV_OPERAND_GRI :
684*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_GRi, 0, 0, 17, 6, 32, total_length, buffer);
685*3d8817e4Smiod       break;
686*3d8817e4Smiod     case FRV_OPERAND_GRJ :
687*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_GRj, 0, 0, 5, 6, 32, total_length, buffer);
688*3d8817e4Smiod       break;
689*3d8817e4Smiod     case FRV_OPERAND_GRK :
690*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_GRk, 0, 0, 30, 6, 32, total_length, buffer);
691*3d8817e4Smiod       break;
692*3d8817e4Smiod     case FRV_OPERAND_GRKHI :
693*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_GRk, 0, 0, 30, 6, 32, total_length, buffer);
694*3d8817e4Smiod       break;
695*3d8817e4Smiod     case FRV_OPERAND_GRKLO :
696*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_GRk, 0, 0, 30, 6, 32, total_length, buffer);
697*3d8817e4Smiod       break;
698*3d8817e4Smiod     case FRV_OPERAND_ICCI_1 :
699*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_ICCi_1, 0, 0, 11, 2, 32, total_length, buffer);
700*3d8817e4Smiod       break;
701*3d8817e4Smiod     case FRV_OPERAND_ICCI_2 :
702*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_ICCi_2, 0, 0, 26, 2, 32, total_length, buffer);
703*3d8817e4Smiod       break;
704*3d8817e4Smiod     case FRV_OPERAND_ICCI_3 :
705*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_ICCi_3, 0, 0, 1, 2, 32, total_length, buffer);
706*3d8817e4Smiod       break;
707*3d8817e4Smiod     case FRV_OPERAND_LI :
708*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_LI, 0, 0, 25, 1, 32, total_length, buffer);
709*3d8817e4Smiod       break;
710*3d8817e4Smiod     case FRV_OPERAND_LRAD :
711*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_LRAD, 0, 0, 4, 1, 32, total_length, buffer);
712*3d8817e4Smiod       break;
713*3d8817e4Smiod     case FRV_OPERAND_LRAE :
714*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_LRAE, 0, 0, 5, 1, 32, total_length, buffer);
715*3d8817e4Smiod       break;
716*3d8817e4Smiod     case FRV_OPERAND_LRAS :
717*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_LRAS, 0, 0, 3, 1, 32, total_length, buffer);
718*3d8817e4Smiod       break;
719*3d8817e4Smiod     case FRV_OPERAND_TLBPRL :
720*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_TLBPRL, 0, 0, 25, 1, 32, total_length, buffer);
721*3d8817e4Smiod       break;
722*3d8817e4Smiod     case FRV_OPERAND_TLBPROPX :
723*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_TLBPRopx, 0, 0, 28, 3, 32, total_length, buffer);
724*3d8817e4Smiod       break;
725*3d8817e4Smiod     case FRV_OPERAND_AE :
726*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_ae, 0, 0, 25, 1, 32, total_length, buffer);
727*3d8817e4Smiod       break;
728*3d8817e4Smiod     case FRV_OPERAND_CALLANN :
729*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_reloc_ann, 0, 0, 0, 0, 32, total_length, buffer);
730*3d8817e4Smiod       break;
731*3d8817e4Smiod     case FRV_OPERAND_CCOND :
732*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_ccond, 0, 0, 12, 1, 32, total_length, buffer);
733*3d8817e4Smiod       break;
734*3d8817e4Smiod     case FRV_OPERAND_COND :
735*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_cond, 0, 0, 8, 1, 32, total_length, buffer);
736*3d8817e4Smiod       break;
737*3d8817e4Smiod     case FRV_OPERAND_D12 :
738*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_d12, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 12, 32, total_length, buffer);
739*3d8817e4Smiod       break;
740*3d8817e4Smiod     case FRV_OPERAND_DEBUG :
741*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_debug, 0, 0, 25, 1, 32, total_length, buffer);
742*3d8817e4Smiod       break;
743*3d8817e4Smiod     case FRV_OPERAND_EIR :
744*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_eir, 0, 0, 17, 6, 32, total_length, buffer);
745*3d8817e4Smiod       break;
746*3d8817e4Smiod     case FRV_OPERAND_HINT :
747*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_hint, 0, 0, 17, 2, 32, total_length, buffer);
748*3d8817e4Smiod       break;
749*3d8817e4Smiod     case FRV_OPERAND_HINT_NOT_TAKEN :
750*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_hint, 0, 0, 17, 2, 32, total_length, buffer);
751*3d8817e4Smiod       break;
752*3d8817e4Smiod     case FRV_OPERAND_HINT_TAKEN :
753*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_hint, 0, 0, 17, 2, 32, total_length, buffer);
754*3d8817e4Smiod       break;
755*3d8817e4Smiod     case FRV_OPERAND_LABEL16 :
756*3d8817e4Smiod       {
757*3d8817e4Smiod         long value = fields->f_label16;
758*3d8817e4Smiod         value = ((int) (((value) - (pc))) >> (2));
759*3d8817e4Smiod         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 15, 16, 32, total_length, buffer);
760*3d8817e4Smiod       }
761*3d8817e4Smiod       break;
762*3d8817e4Smiod     case FRV_OPERAND_LABEL24 :
763*3d8817e4Smiod       {
764*3d8817e4Smiod {
765*3d8817e4Smiod   FLD (f_labelH6) = ((int) (((FLD (f_label24)) - (pc))) >> (20));
766*3d8817e4Smiod   FLD (f_labelL18) = ((((unsigned int) (((FLD (f_label24)) - (pc))) >> (2))) & (262143));
767*3d8817e4Smiod }
768*3d8817e4Smiod         errmsg = insert_normal (cd, fields->f_labelH6, 0|(1<<CGEN_IFLD_SIGNED), 0, 30, 6, 32, total_length, buffer);
769*3d8817e4Smiod         if (errmsg)
770*3d8817e4Smiod           break;
771*3d8817e4Smiod         errmsg = insert_normal (cd, fields->f_labelL18, 0, 0, 17, 18, 32, total_length, buffer);
772*3d8817e4Smiod         if (errmsg)
773*3d8817e4Smiod           break;
774*3d8817e4Smiod       }
775*3d8817e4Smiod       break;
776*3d8817e4Smiod     case FRV_OPERAND_LDANN :
777*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_reloc_ann, 0, 0, 0, 0, 32, total_length, buffer);
778*3d8817e4Smiod       break;
779*3d8817e4Smiod     case FRV_OPERAND_LDDANN :
780*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_reloc_ann, 0, 0, 0, 0, 32, total_length, buffer);
781*3d8817e4Smiod       break;
782*3d8817e4Smiod     case FRV_OPERAND_LOCK :
783*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_lock, 0, 0, 25, 1, 32, total_length, buffer);
784*3d8817e4Smiod       break;
785*3d8817e4Smiod     case FRV_OPERAND_PACK :
786*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_pack, 0, 0, 31, 1, 32, total_length, buffer);
787*3d8817e4Smiod       break;
788*3d8817e4Smiod     case FRV_OPERAND_S10 :
789*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_s10, 0|(1<<CGEN_IFLD_SIGNED), 0, 9, 10, 32, total_length, buffer);
790*3d8817e4Smiod       break;
791*3d8817e4Smiod     case FRV_OPERAND_S12 :
792*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_d12, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 12, 32, total_length, buffer);
793*3d8817e4Smiod       break;
794*3d8817e4Smiod     case FRV_OPERAND_S16 :
795*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_s16, 0|(1<<CGEN_IFLD_SIGNED), 0, 15, 16, 32, total_length, buffer);
796*3d8817e4Smiod       break;
797*3d8817e4Smiod     case FRV_OPERAND_S5 :
798*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_s5, 0|(1<<CGEN_IFLD_SIGNED), 0, 4, 5, 32, total_length, buffer);
799*3d8817e4Smiod       break;
800*3d8817e4Smiod     case FRV_OPERAND_S6 :
801*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_s6, 0|(1<<CGEN_IFLD_SIGNED), 0, 5, 6, 32, total_length, buffer);
802*3d8817e4Smiod       break;
803*3d8817e4Smiod     case FRV_OPERAND_S6_1 :
804*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_s6_1, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 6, 32, total_length, buffer);
805*3d8817e4Smiod       break;
806*3d8817e4Smiod     case FRV_OPERAND_SLO16 :
807*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_s16, 0|(1<<CGEN_IFLD_SIGNED), 0, 15, 16, 32, total_length, buffer);
808*3d8817e4Smiod       break;
809*3d8817e4Smiod     case FRV_OPERAND_SPR :
810*3d8817e4Smiod       {
811*3d8817e4Smiod {
812*3d8817e4Smiod   FLD (f_spr_h) = ((unsigned int) (FLD (f_spr)) >> (6));
813*3d8817e4Smiod   FLD (f_spr_l) = ((FLD (f_spr)) & (63));
814*3d8817e4Smiod }
815*3d8817e4Smiod         errmsg = insert_normal (cd, fields->f_spr_h, 0, 0, 30, 6, 32, total_length, buffer);
816*3d8817e4Smiod         if (errmsg)
817*3d8817e4Smiod           break;
818*3d8817e4Smiod         errmsg = insert_normal (cd, fields->f_spr_l, 0, 0, 17, 6, 32, total_length, buffer);
819*3d8817e4Smiod         if (errmsg)
820*3d8817e4Smiod           break;
821*3d8817e4Smiod       }
822*3d8817e4Smiod       break;
823*3d8817e4Smiod     case FRV_OPERAND_U12 :
824*3d8817e4Smiod       {
825*3d8817e4Smiod {
826*3d8817e4Smiod   FLD (f_u12_h) = ((int) (FLD (f_u12)) >> (6));
827*3d8817e4Smiod   FLD (f_u12_l) = ((FLD (f_u12)) & (63));
828*3d8817e4Smiod }
829*3d8817e4Smiod         errmsg = insert_normal (cd, fields->f_u12_h, 0|(1<<CGEN_IFLD_SIGNED), 0, 17, 6, 32, total_length, buffer);
830*3d8817e4Smiod         if (errmsg)
831*3d8817e4Smiod           break;
832*3d8817e4Smiod         errmsg = insert_normal (cd, fields->f_u12_l, 0, 0, 5, 6, 32, total_length, buffer);
833*3d8817e4Smiod         if (errmsg)
834*3d8817e4Smiod           break;
835*3d8817e4Smiod       }
836*3d8817e4Smiod       break;
837*3d8817e4Smiod     case FRV_OPERAND_U16 :
838*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_u16, 0, 0, 15, 16, 32, total_length, buffer);
839*3d8817e4Smiod       break;
840*3d8817e4Smiod     case FRV_OPERAND_U6 :
841*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_u6, 0, 0, 5, 6, 32, total_length, buffer);
842*3d8817e4Smiod       break;
843*3d8817e4Smiod     case FRV_OPERAND_UHI16 :
844*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_u16, 0, 0, 15, 16, 32, total_length, buffer);
845*3d8817e4Smiod       break;
846*3d8817e4Smiod     case FRV_OPERAND_ULO16 :
847*3d8817e4Smiod       errmsg = insert_normal (cd, fields->f_u16, 0, 0, 15, 16, 32, total_length, buffer);
848*3d8817e4Smiod       break;
849*3d8817e4Smiod 
850*3d8817e4Smiod     default :
851*3d8817e4Smiod       /* xgettext:c-format */
852*3d8817e4Smiod       fprintf (stderr, _("Unrecognized field %d while building insn.\n"),
853*3d8817e4Smiod 	       opindex);
854*3d8817e4Smiod       abort ();
855*3d8817e4Smiod   }
856*3d8817e4Smiod 
857*3d8817e4Smiod   return errmsg;
858*3d8817e4Smiod }
859*3d8817e4Smiod 
860*3d8817e4Smiod int frv_cgen_extract_operand
861*3d8817e4Smiod   (CGEN_CPU_DESC, int, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma);
862*3d8817e4Smiod 
863*3d8817e4Smiod /* Main entry point for operand extraction.
864*3d8817e4Smiod    The result is <= 0 for error, >0 for success.
865*3d8817e4Smiod    ??? Actual values aren't well defined right now.
866*3d8817e4Smiod 
867*3d8817e4Smiod    This function is basically just a big switch statement.  Earlier versions
868*3d8817e4Smiod    used tables to look up the function to use, but
869*3d8817e4Smiod    - if the table contains both assembler and disassembler functions then
870*3d8817e4Smiod      the disassembler contains much of the assembler and vice-versa,
871*3d8817e4Smiod    - there's a lot of inlining possibilities as things grow,
872*3d8817e4Smiod    - using a switch statement avoids the function call overhead.
873*3d8817e4Smiod 
874*3d8817e4Smiod    This function could be moved into `print_insn_normal', but keeping it
875*3d8817e4Smiod    separate makes clear the interface between `print_insn_normal' and each of
876*3d8817e4Smiod    the handlers.  */
877*3d8817e4Smiod 
878*3d8817e4Smiod int
frv_cgen_extract_operand(CGEN_CPU_DESC cd,int opindex,CGEN_EXTRACT_INFO * ex_info,CGEN_INSN_INT insn_value,CGEN_FIELDS * fields,bfd_vma pc)879*3d8817e4Smiod frv_cgen_extract_operand (CGEN_CPU_DESC cd,
880*3d8817e4Smiod 			     int opindex,
881*3d8817e4Smiod 			     CGEN_EXTRACT_INFO *ex_info,
882*3d8817e4Smiod 			     CGEN_INSN_INT insn_value,
883*3d8817e4Smiod 			     CGEN_FIELDS * fields,
884*3d8817e4Smiod 			     bfd_vma pc)
885*3d8817e4Smiod {
886*3d8817e4Smiod   /* Assume success (for those operands that are nops).  */
887*3d8817e4Smiod   int length = 1;
888*3d8817e4Smiod   unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);
889*3d8817e4Smiod 
890*3d8817e4Smiod   switch (opindex)
891*3d8817e4Smiod     {
892*3d8817e4Smiod     case FRV_OPERAND_A0 :
893*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 1, 32, total_length, pc, & fields->f_A);
894*3d8817e4Smiod       break;
895*3d8817e4Smiod     case FRV_OPERAND_A1 :
896*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 1, 32, total_length, pc, & fields->f_A);
897*3d8817e4Smiod       break;
898*3d8817e4Smiod     case FRV_OPERAND_ACC40SI :
899*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_ACC40Si);
900*3d8817e4Smiod       break;
901*3d8817e4Smiod     case FRV_OPERAND_ACC40SK :
902*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_ACC40Sk);
903*3d8817e4Smiod       break;
904*3d8817e4Smiod     case FRV_OPERAND_ACC40UI :
905*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_ACC40Ui);
906*3d8817e4Smiod       break;
907*3d8817e4Smiod     case FRV_OPERAND_ACC40UK :
908*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_ACC40Uk);
909*3d8817e4Smiod       break;
910*3d8817e4Smiod     case FRV_OPERAND_ACCGI :
911*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_ACCGi);
912*3d8817e4Smiod       break;
913*3d8817e4Smiod     case FRV_OPERAND_ACCGK :
914*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_ACCGk);
915*3d8817e4Smiod       break;
916*3d8817e4Smiod     case FRV_OPERAND_CCI :
917*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 11, 3, 32, total_length, pc, & fields->f_CCi);
918*3d8817e4Smiod       break;
919*3d8817e4Smiod     case FRV_OPERAND_CPRDOUBLEK :
920*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_CPRk);
921*3d8817e4Smiod       break;
922*3d8817e4Smiod     case FRV_OPERAND_CPRI :
923*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_CPRi);
924*3d8817e4Smiod       break;
925*3d8817e4Smiod     case FRV_OPERAND_CPRJ :
926*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_CPRj);
927*3d8817e4Smiod       break;
928*3d8817e4Smiod     case FRV_OPERAND_CPRK :
929*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_CPRk);
930*3d8817e4Smiod       break;
931*3d8817e4Smiod     case FRV_OPERAND_CRI :
932*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 14, 3, 32, total_length, pc, & fields->f_CRi);
933*3d8817e4Smiod       break;
934*3d8817e4Smiod     case FRV_OPERAND_CRJ :
935*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 2, 3, 32, total_length, pc, & fields->f_CRj);
936*3d8817e4Smiod       break;
937*3d8817e4Smiod     case FRV_OPERAND_CRJ_FLOAT :
938*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & fields->f_CRj_float);
939*3d8817e4Smiod       break;
940*3d8817e4Smiod     case FRV_OPERAND_CRJ_INT :
941*3d8817e4Smiod       {
942*3d8817e4Smiod         long value;
943*3d8817e4Smiod         length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & value);
944*3d8817e4Smiod         value = ((value) + (4));
945*3d8817e4Smiod         fields->f_CRj_int = value;
946*3d8817e4Smiod       }
947*3d8817e4Smiod       break;
948*3d8817e4Smiod     case FRV_OPERAND_CRK :
949*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 27, 3, 32, total_length, pc, & fields->f_CRk);
950*3d8817e4Smiod       break;
951*3d8817e4Smiod     case FRV_OPERAND_FCCI_1 :
952*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 11, 2, 32, total_length, pc, & fields->f_FCCi_1);
953*3d8817e4Smiod       break;
954*3d8817e4Smiod     case FRV_OPERAND_FCCI_2 :
955*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & fields->f_FCCi_2);
956*3d8817e4Smiod       break;
957*3d8817e4Smiod     case FRV_OPERAND_FCCI_3 :
958*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 1, 2, 32, total_length, pc, & fields->f_FCCi_3);
959*3d8817e4Smiod       break;
960*3d8817e4Smiod     case FRV_OPERAND_FCCK :
961*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & fields->f_FCCk);
962*3d8817e4Smiod       break;
963*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEI :
964*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_FRi);
965*3d8817e4Smiod       break;
966*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEJ :
967*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_FRj);
968*3d8817e4Smiod       break;
969*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEK :
970*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk);
971*3d8817e4Smiod       break;
972*3d8817e4Smiod     case FRV_OPERAND_FRI :
973*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_FRi);
974*3d8817e4Smiod       break;
975*3d8817e4Smiod     case FRV_OPERAND_FRINTI :
976*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_FRi);
977*3d8817e4Smiod       break;
978*3d8817e4Smiod     case FRV_OPERAND_FRINTIEVEN :
979*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_FRi);
980*3d8817e4Smiod       break;
981*3d8817e4Smiod     case FRV_OPERAND_FRINTJ :
982*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_FRj);
983*3d8817e4Smiod       break;
984*3d8817e4Smiod     case FRV_OPERAND_FRINTJEVEN :
985*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_FRj);
986*3d8817e4Smiod       break;
987*3d8817e4Smiod     case FRV_OPERAND_FRINTK :
988*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk);
989*3d8817e4Smiod       break;
990*3d8817e4Smiod     case FRV_OPERAND_FRINTKEVEN :
991*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk);
992*3d8817e4Smiod       break;
993*3d8817e4Smiod     case FRV_OPERAND_FRJ :
994*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_FRj);
995*3d8817e4Smiod       break;
996*3d8817e4Smiod     case FRV_OPERAND_FRK :
997*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk);
998*3d8817e4Smiod       break;
999*3d8817e4Smiod     case FRV_OPERAND_FRKHI :
1000*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk);
1001*3d8817e4Smiod       break;
1002*3d8817e4Smiod     case FRV_OPERAND_FRKLO :
1003*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_FRk);
1004*3d8817e4Smiod       break;
1005*3d8817e4Smiod     case FRV_OPERAND_GRDOUBLEK :
1006*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_GRk);
1007*3d8817e4Smiod       break;
1008*3d8817e4Smiod     case FRV_OPERAND_GRI :
1009*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_GRi);
1010*3d8817e4Smiod       break;
1011*3d8817e4Smiod     case FRV_OPERAND_GRJ :
1012*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_GRj);
1013*3d8817e4Smiod       break;
1014*3d8817e4Smiod     case FRV_OPERAND_GRK :
1015*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_GRk);
1016*3d8817e4Smiod       break;
1017*3d8817e4Smiod     case FRV_OPERAND_GRKHI :
1018*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_GRk);
1019*3d8817e4Smiod       break;
1020*3d8817e4Smiod     case FRV_OPERAND_GRKLO :
1021*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_GRk);
1022*3d8817e4Smiod       break;
1023*3d8817e4Smiod     case FRV_OPERAND_ICCI_1 :
1024*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 11, 2, 32, total_length, pc, & fields->f_ICCi_1);
1025*3d8817e4Smiod       break;
1026*3d8817e4Smiod     case FRV_OPERAND_ICCI_2 :
1027*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 2, 32, total_length, pc, & fields->f_ICCi_2);
1028*3d8817e4Smiod       break;
1029*3d8817e4Smiod     case FRV_OPERAND_ICCI_3 :
1030*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 1, 2, 32, total_length, pc, & fields->f_ICCi_3);
1031*3d8817e4Smiod       break;
1032*3d8817e4Smiod     case FRV_OPERAND_LI :
1033*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_LI);
1034*3d8817e4Smiod       break;
1035*3d8817e4Smiod     case FRV_OPERAND_LRAD :
1036*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 1, 32, total_length, pc, & fields->f_LRAD);
1037*3d8817e4Smiod       break;
1038*3d8817e4Smiod     case FRV_OPERAND_LRAE :
1039*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 1, 32, total_length, pc, & fields->f_LRAE);
1040*3d8817e4Smiod       break;
1041*3d8817e4Smiod     case FRV_OPERAND_LRAS :
1042*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 3, 1, 32, total_length, pc, & fields->f_LRAS);
1043*3d8817e4Smiod       break;
1044*3d8817e4Smiod     case FRV_OPERAND_TLBPRL :
1045*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_TLBPRL);
1046*3d8817e4Smiod       break;
1047*3d8817e4Smiod     case FRV_OPERAND_TLBPROPX :
1048*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 3, 32, total_length, pc, & fields->f_TLBPRopx);
1049*3d8817e4Smiod       break;
1050*3d8817e4Smiod     case FRV_OPERAND_AE :
1051*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_ae);
1052*3d8817e4Smiod       break;
1053*3d8817e4Smiod     case FRV_OPERAND_CALLANN :
1054*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 0, 32, total_length, pc, & fields->f_reloc_ann);
1055*3d8817e4Smiod       break;
1056*3d8817e4Smiod     case FRV_OPERAND_CCOND :
1057*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 12, 1, 32, total_length, pc, & fields->f_ccond);
1058*3d8817e4Smiod       break;
1059*3d8817e4Smiod     case FRV_OPERAND_COND :
1060*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 1, 32, total_length, pc, & fields->f_cond);
1061*3d8817e4Smiod       break;
1062*3d8817e4Smiod     case FRV_OPERAND_D12 :
1063*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 12, 32, total_length, pc, & fields->f_d12);
1064*3d8817e4Smiod       break;
1065*3d8817e4Smiod     case FRV_OPERAND_DEBUG :
1066*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_debug);
1067*3d8817e4Smiod       break;
1068*3d8817e4Smiod     case FRV_OPERAND_EIR :
1069*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_eir);
1070*3d8817e4Smiod       break;
1071*3d8817e4Smiod     case FRV_OPERAND_HINT :
1072*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 2, 32, total_length, pc, & fields->f_hint);
1073*3d8817e4Smiod       break;
1074*3d8817e4Smiod     case FRV_OPERAND_HINT_NOT_TAKEN :
1075*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 2, 32, total_length, pc, & fields->f_hint);
1076*3d8817e4Smiod       break;
1077*3d8817e4Smiod     case FRV_OPERAND_HINT_TAKEN :
1078*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 2, 32, total_length, pc, & fields->f_hint);
1079*3d8817e4Smiod       break;
1080*3d8817e4Smiod     case FRV_OPERAND_LABEL16 :
1081*3d8817e4Smiod       {
1082*3d8817e4Smiod         long value;
1083*3d8817e4Smiod         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 15, 16, 32, total_length, pc, & value);
1084*3d8817e4Smiod         value = ((((value) << (2))) + (pc));
1085*3d8817e4Smiod         fields->f_label16 = value;
1086*3d8817e4Smiod       }
1087*3d8817e4Smiod       break;
1088*3d8817e4Smiod     case FRV_OPERAND_LABEL24 :
1089*3d8817e4Smiod       {
1090*3d8817e4Smiod         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 30, 6, 32, total_length, pc, & fields->f_labelH6);
1091*3d8817e4Smiod         if (length <= 0) break;
1092*3d8817e4Smiod         length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 18, 32, total_length, pc, & fields->f_labelL18);
1093*3d8817e4Smiod         if (length <= 0) break;
1094*3d8817e4Smiod {
1095*3d8817e4Smiod   FLD (f_label24) = ((((((((FLD (f_labelH6)) << (18))) | (FLD (f_labelL18)))) << (2))) + (pc));
1096*3d8817e4Smiod }
1097*3d8817e4Smiod       }
1098*3d8817e4Smiod       break;
1099*3d8817e4Smiod     case FRV_OPERAND_LDANN :
1100*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 0, 32, total_length, pc, & fields->f_reloc_ann);
1101*3d8817e4Smiod       break;
1102*3d8817e4Smiod     case FRV_OPERAND_LDDANN :
1103*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 0, 32, total_length, pc, & fields->f_reloc_ann);
1104*3d8817e4Smiod       break;
1105*3d8817e4Smiod     case FRV_OPERAND_LOCK :
1106*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 1, 32, total_length, pc, & fields->f_lock);
1107*3d8817e4Smiod       break;
1108*3d8817e4Smiod     case FRV_OPERAND_PACK :
1109*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 31, 1, 32, total_length, pc, & fields->f_pack);
1110*3d8817e4Smiod       break;
1111*3d8817e4Smiod     case FRV_OPERAND_S10 :
1112*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 9, 10, 32, total_length, pc, & fields->f_s10);
1113*3d8817e4Smiod       break;
1114*3d8817e4Smiod     case FRV_OPERAND_S12 :
1115*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 12, 32, total_length, pc, & fields->f_d12);
1116*3d8817e4Smiod       break;
1117*3d8817e4Smiod     case FRV_OPERAND_S16 :
1118*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 15, 16, 32, total_length, pc, & fields->f_s16);
1119*3d8817e4Smiod       break;
1120*3d8817e4Smiod     case FRV_OPERAND_S5 :
1121*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 4, 5, 32, total_length, pc, & fields->f_s5);
1122*3d8817e4Smiod       break;
1123*3d8817e4Smiod     case FRV_OPERAND_S6 :
1124*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 5, 6, 32, total_length, pc, & fields->f_s6);
1125*3d8817e4Smiod       break;
1126*3d8817e4Smiod     case FRV_OPERAND_S6_1 :
1127*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 11, 6, 32, total_length, pc, & fields->f_s6_1);
1128*3d8817e4Smiod       break;
1129*3d8817e4Smiod     case FRV_OPERAND_SLO16 :
1130*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 15, 16, 32, total_length, pc, & fields->f_s16);
1131*3d8817e4Smiod       break;
1132*3d8817e4Smiod     case FRV_OPERAND_SPR :
1133*3d8817e4Smiod       {
1134*3d8817e4Smiod         length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 6, 32, total_length, pc, & fields->f_spr_h);
1135*3d8817e4Smiod         if (length <= 0) break;
1136*3d8817e4Smiod         length = extract_normal (cd, ex_info, insn_value, 0, 0, 17, 6, 32, total_length, pc, & fields->f_spr_l);
1137*3d8817e4Smiod         if (length <= 0) break;
1138*3d8817e4Smiod {
1139*3d8817e4Smiod   FLD (f_spr) = ((((FLD (f_spr_h)) << (6))) | (FLD (f_spr_l)));
1140*3d8817e4Smiod }
1141*3d8817e4Smiod       }
1142*3d8817e4Smiod       break;
1143*3d8817e4Smiod     case FRV_OPERAND_U12 :
1144*3d8817e4Smiod       {
1145*3d8817e4Smiod         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 17, 6, 32, total_length, pc, & fields->f_u12_h);
1146*3d8817e4Smiod         if (length <= 0) break;
1147*3d8817e4Smiod         length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_u12_l);
1148*3d8817e4Smiod         if (length <= 0) break;
1149*3d8817e4Smiod {
1150*3d8817e4Smiod   FLD (f_u12) = ((((FLD (f_u12_h)) << (6))) | (FLD (f_u12_l)));
1151*3d8817e4Smiod }
1152*3d8817e4Smiod       }
1153*3d8817e4Smiod       break;
1154*3d8817e4Smiod     case FRV_OPERAND_U16 :
1155*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 16, 32, total_length, pc, & fields->f_u16);
1156*3d8817e4Smiod       break;
1157*3d8817e4Smiod     case FRV_OPERAND_U6 :
1158*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_u6);
1159*3d8817e4Smiod       break;
1160*3d8817e4Smiod     case FRV_OPERAND_UHI16 :
1161*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 16, 32, total_length, pc, & fields->f_u16);
1162*3d8817e4Smiod       break;
1163*3d8817e4Smiod     case FRV_OPERAND_ULO16 :
1164*3d8817e4Smiod       length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 16, 32, total_length, pc, & fields->f_u16);
1165*3d8817e4Smiod       break;
1166*3d8817e4Smiod 
1167*3d8817e4Smiod     default :
1168*3d8817e4Smiod       /* xgettext:c-format */
1169*3d8817e4Smiod       fprintf (stderr, _("Unrecognized field %d while decoding insn.\n"),
1170*3d8817e4Smiod 	       opindex);
1171*3d8817e4Smiod       abort ();
1172*3d8817e4Smiod     }
1173*3d8817e4Smiod 
1174*3d8817e4Smiod   return length;
1175*3d8817e4Smiod }
1176*3d8817e4Smiod 
1177*3d8817e4Smiod cgen_insert_fn * const frv_cgen_insert_handlers[] =
1178*3d8817e4Smiod {
1179*3d8817e4Smiod   insert_insn_normal,
1180*3d8817e4Smiod };
1181*3d8817e4Smiod 
1182*3d8817e4Smiod cgen_extract_fn * const frv_cgen_extract_handlers[] =
1183*3d8817e4Smiod {
1184*3d8817e4Smiod   extract_insn_normal,
1185*3d8817e4Smiod };
1186*3d8817e4Smiod 
1187*3d8817e4Smiod int frv_cgen_get_int_operand     (CGEN_CPU_DESC, int, const CGEN_FIELDS *);
1188*3d8817e4Smiod bfd_vma frv_cgen_get_vma_operand (CGEN_CPU_DESC, int, const CGEN_FIELDS *);
1189*3d8817e4Smiod 
1190*3d8817e4Smiod /* Getting values from cgen_fields is handled by a collection of functions.
1191*3d8817e4Smiod    They are distinguished by the type of the VALUE argument they return.
1192*3d8817e4Smiod    TODO: floating point, inlining support, remove cases where result type
1193*3d8817e4Smiod    not appropriate.  */
1194*3d8817e4Smiod 
1195*3d8817e4Smiod int
frv_cgen_get_int_operand(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,int opindex,const CGEN_FIELDS * fields)1196*3d8817e4Smiod frv_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1197*3d8817e4Smiod 			     int opindex,
1198*3d8817e4Smiod 			     const CGEN_FIELDS * fields)
1199*3d8817e4Smiod {
1200*3d8817e4Smiod   int value;
1201*3d8817e4Smiod 
1202*3d8817e4Smiod   switch (opindex)
1203*3d8817e4Smiod     {
1204*3d8817e4Smiod     case FRV_OPERAND_A0 :
1205*3d8817e4Smiod       value = fields->f_A;
1206*3d8817e4Smiod       break;
1207*3d8817e4Smiod     case FRV_OPERAND_A1 :
1208*3d8817e4Smiod       value = fields->f_A;
1209*3d8817e4Smiod       break;
1210*3d8817e4Smiod     case FRV_OPERAND_ACC40SI :
1211*3d8817e4Smiod       value = fields->f_ACC40Si;
1212*3d8817e4Smiod       break;
1213*3d8817e4Smiod     case FRV_OPERAND_ACC40SK :
1214*3d8817e4Smiod       value = fields->f_ACC40Sk;
1215*3d8817e4Smiod       break;
1216*3d8817e4Smiod     case FRV_OPERAND_ACC40UI :
1217*3d8817e4Smiod       value = fields->f_ACC40Ui;
1218*3d8817e4Smiod       break;
1219*3d8817e4Smiod     case FRV_OPERAND_ACC40UK :
1220*3d8817e4Smiod       value = fields->f_ACC40Uk;
1221*3d8817e4Smiod       break;
1222*3d8817e4Smiod     case FRV_OPERAND_ACCGI :
1223*3d8817e4Smiod       value = fields->f_ACCGi;
1224*3d8817e4Smiod       break;
1225*3d8817e4Smiod     case FRV_OPERAND_ACCGK :
1226*3d8817e4Smiod       value = fields->f_ACCGk;
1227*3d8817e4Smiod       break;
1228*3d8817e4Smiod     case FRV_OPERAND_CCI :
1229*3d8817e4Smiod       value = fields->f_CCi;
1230*3d8817e4Smiod       break;
1231*3d8817e4Smiod     case FRV_OPERAND_CPRDOUBLEK :
1232*3d8817e4Smiod       value = fields->f_CPRk;
1233*3d8817e4Smiod       break;
1234*3d8817e4Smiod     case FRV_OPERAND_CPRI :
1235*3d8817e4Smiod       value = fields->f_CPRi;
1236*3d8817e4Smiod       break;
1237*3d8817e4Smiod     case FRV_OPERAND_CPRJ :
1238*3d8817e4Smiod       value = fields->f_CPRj;
1239*3d8817e4Smiod       break;
1240*3d8817e4Smiod     case FRV_OPERAND_CPRK :
1241*3d8817e4Smiod       value = fields->f_CPRk;
1242*3d8817e4Smiod       break;
1243*3d8817e4Smiod     case FRV_OPERAND_CRI :
1244*3d8817e4Smiod       value = fields->f_CRi;
1245*3d8817e4Smiod       break;
1246*3d8817e4Smiod     case FRV_OPERAND_CRJ :
1247*3d8817e4Smiod       value = fields->f_CRj;
1248*3d8817e4Smiod       break;
1249*3d8817e4Smiod     case FRV_OPERAND_CRJ_FLOAT :
1250*3d8817e4Smiod       value = fields->f_CRj_float;
1251*3d8817e4Smiod       break;
1252*3d8817e4Smiod     case FRV_OPERAND_CRJ_INT :
1253*3d8817e4Smiod       value = fields->f_CRj_int;
1254*3d8817e4Smiod       break;
1255*3d8817e4Smiod     case FRV_OPERAND_CRK :
1256*3d8817e4Smiod       value = fields->f_CRk;
1257*3d8817e4Smiod       break;
1258*3d8817e4Smiod     case FRV_OPERAND_FCCI_1 :
1259*3d8817e4Smiod       value = fields->f_FCCi_1;
1260*3d8817e4Smiod       break;
1261*3d8817e4Smiod     case FRV_OPERAND_FCCI_2 :
1262*3d8817e4Smiod       value = fields->f_FCCi_2;
1263*3d8817e4Smiod       break;
1264*3d8817e4Smiod     case FRV_OPERAND_FCCI_3 :
1265*3d8817e4Smiod       value = fields->f_FCCi_3;
1266*3d8817e4Smiod       break;
1267*3d8817e4Smiod     case FRV_OPERAND_FCCK :
1268*3d8817e4Smiod       value = fields->f_FCCk;
1269*3d8817e4Smiod       break;
1270*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEI :
1271*3d8817e4Smiod       value = fields->f_FRi;
1272*3d8817e4Smiod       break;
1273*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEJ :
1274*3d8817e4Smiod       value = fields->f_FRj;
1275*3d8817e4Smiod       break;
1276*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEK :
1277*3d8817e4Smiod       value = fields->f_FRk;
1278*3d8817e4Smiod       break;
1279*3d8817e4Smiod     case FRV_OPERAND_FRI :
1280*3d8817e4Smiod       value = fields->f_FRi;
1281*3d8817e4Smiod       break;
1282*3d8817e4Smiod     case FRV_OPERAND_FRINTI :
1283*3d8817e4Smiod       value = fields->f_FRi;
1284*3d8817e4Smiod       break;
1285*3d8817e4Smiod     case FRV_OPERAND_FRINTIEVEN :
1286*3d8817e4Smiod       value = fields->f_FRi;
1287*3d8817e4Smiod       break;
1288*3d8817e4Smiod     case FRV_OPERAND_FRINTJ :
1289*3d8817e4Smiod       value = fields->f_FRj;
1290*3d8817e4Smiod       break;
1291*3d8817e4Smiod     case FRV_OPERAND_FRINTJEVEN :
1292*3d8817e4Smiod       value = fields->f_FRj;
1293*3d8817e4Smiod       break;
1294*3d8817e4Smiod     case FRV_OPERAND_FRINTK :
1295*3d8817e4Smiod       value = fields->f_FRk;
1296*3d8817e4Smiod       break;
1297*3d8817e4Smiod     case FRV_OPERAND_FRINTKEVEN :
1298*3d8817e4Smiod       value = fields->f_FRk;
1299*3d8817e4Smiod       break;
1300*3d8817e4Smiod     case FRV_OPERAND_FRJ :
1301*3d8817e4Smiod       value = fields->f_FRj;
1302*3d8817e4Smiod       break;
1303*3d8817e4Smiod     case FRV_OPERAND_FRK :
1304*3d8817e4Smiod       value = fields->f_FRk;
1305*3d8817e4Smiod       break;
1306*3d8817e4Smiod     case FRV_OPERAND_FRKHI :
1307*3d8817e4Smiod       value = fields->f_FRk;
1308*3d8817e4Smiod       break;
1309*3d8817e4Smiod     case FRV_OPERAND_FRKLO :
1310*3d8817e4Smiod       value = fields->f_FRk;
1311*3d8817e4Smiod       break;
1312*3d8817e4Smiod     case FRV_OPERAND_GRDOUBLEK :
1313*3d8817e4Smiod       value = fields->f_GRk;
1314*3d8817e4Smiod       break;
1315*3d8817e4Smiod     case FRV_OPERAND_GRI :
1316*3d8817e4Smiod       value = fields->f_GRi;
1317*3d8817e4Smiod       break;
1318*3d8817e4Smiod     case FRV_OPERAND_GRJ :
1319*3d8817e4Smiod       value = fields->f_GRj;
1320*3d8817e4Smiod       break;
1321*3d8817e4Smiod     case FRV_OPERAND_GRK :
1322*3d8817e4Smiod       value = fields->f_GRk;
1323*3d8817e4Smiod       break;
1324*3d8817e4Smiod     case FRV_OPERAND_GRKHI :
1325*3d8817e4Smiod       value = fields->f_GRk;
1326*3d8817e4Smiod       break;
1327*3d8817e4Smiod     case FRV_OPERAND_GRKLO :
1328*3d8817e4Smiod       value = fields->f_GRk;
1329*3d8817e4Smiod       break;
1330*3d8817e4Smiod     case FRV_OPERAND_ICCI_1 :
1331*3d8817e4Smiod       value = fields->f_ICCi_1;
1332*3d8817e4Smiod       break;
1333*3d8817e4Smiod     case FRV_OPERAND_ICCI_2 :
1334*3d8817e4Smiod       value = fields->f_ICCi_2;
1335*3d8817e4Smiod       break;
1336*3d8817e4Smiod     case FRV_OPERAND_ICCI_3 :
1337*3d8817e4Smiod       value = fields->f_ICCi_3;
1338*3d8817e4Smiod       break;
1339*3d8817e4Smiod     case FRV_OPERAND_LI :
1340*3d8817e4Smiod       value = fields->f_LI;
1341*3d8817e4Smiod       break;
1342*3d8817e4Smiod     case FRV_OPERAND_LRAD :
1343*3d8817e4Smiod       value = fields->f_LRAD;
1344*3d8817e4Smiod       break;
1345*3d8817e4Smiod     case FRV_OPERAND_LRAE :
1346*3d8817e4Smiod       value = fields->f_LRAE;
1347*3d8817e4Smiod       break;
1348*3d8817e4Smiod     case FRV_OPERAND_LRAS :
1349*3d8817e4Smiod       value = fields->f_LRAS;
1350*3d8817e4Smiod       break;
1351*3d8817e4Smiod     case FRV_OPERAND_TLBPRL :
1352*3d8817e4Smiod       value = fields->f_TLBPRL;
1353*3d8817e4Smiod       break;
1354*3d8817e4Smiod     case FRV_OPERAND_TLBPROPX :
1355*3d8817e4Smiod       value = fields->f_TLBPRopx;
1356*3d8817e4Smiod       break;
1357*3d8817e4Smiod     case FRV_OPERAND_AE :
1358*3d8817e4Smiod       value = fields->f_ae;
1359*3d8817e4Smiod       break;
1360*3d8817e4Smiod     case FRV_OPERAND_CALLANN :
1361*3d8817e4Smiod       value = fields->f_reloc_ann;
1362*3d8817e4Smiod       break;
1363*3d8817e4Smiod     case FRV_OPERAND_CCOND :
1364*3d8817e4Smiod       value = fields->f_ccond;
1365*3d8817e4Smiod       break;
1366*3d8817e4Smiod     case FRV_OPERAND_COND :
1367*3d8817e4Smiod       value = fields->f_cond;
1368*3d8817e4Smiod       break;
1369*3d8817e4Smiod     case FRV_OPERAND_D12 :
1370*3d8817e4Smiod       value = fields->f_d12;
1371*3d8817e4Smiod       break;
1372*3d8817e4Smiod     case FRV_OPERAND_DEBUG :
1373*3d8817e4Smiod       value = fields->f_debug;
1374*3d8817e4Smiod       break;
1375*3d8817e4Smiod     case FRV_OPERAND_EIR :
1376*3d8817e4Smiod       value = fields->f_eir;
1377*3d8817e4Smiod       break;
1378*3d8817e4Smiod     case FRV_OPERAND_HINT :
1379*3d8817e4Smiod       value = fields->f_hint;
1380*3d8817e4Smiod       break;
1381*3d8817e4Smiod     case FRV_OPERAND_HINT_NOT_TAKEN :
1382*3d8817e4Smiod       value = fields->f_hint;
1383*3d8817e4Smiod       break;
1384*3d8817e4Smiod     case FRV_OPERAND_HINT_TAKEN :
1385*3d8817e4Smiod       value = fields->f_hint;
1386*3d8817e4Smiod       break;
1387*3d8817e4Smiod     case FRV_OPERAND_LABEL16 :
1388*3d8817e4Smiod       value = fields->f_label16;
1389*3d8817e4Smiod       break;
1390*3d8817e4Smiod     case FRV_OPERAND_LABEL24 :
1391*3d8817e4Smiod       value = fields->f_label24;
1392*3d8817e4Smiod       break;
1393*3d8817e4Smiod     case FRV_OPERAND_LDANN :
1394*3d8817e4Smiod       value = fields->f_reloc_ann;
1395*3d8817e4Smiod       break;
1396*3d8817e4Smiod     case FRV_OPERAND_LDDANN :
1397*3d8817e4Smiod       value = fields->f_reloc_ann;
1398*3d8817e4Smiod       break;
1399*3d8817e4Smiod     case FRV_OPERAND_LOCK :
1400*3d8817e4Smiod       value = fields->f_lock;
1401*3d8817e4Smiod       break;
1402*3d8817e4Smiod     case FRV_OPERAND_PACK :
1403*3d8817e4Smiod       value = fields->f_pack;
1404*3d8817e4Smiod       break;
1405*3d8817e4Smiod     case FRV_OPERAND_S10 :
1406*3d8817e4Smiod       value = fields->f_s10;
1407*3d8817e4Smiod       break;
1408*3d8817e4Smiod     case FRV_OPERAND_S12 :
1409*3d8817e4Smiod       value = fields->f_d12;
1410*3d8817e4Smiod       break;
1411*3d8817e4Smiod     case FRV_OPERAND_S16 :
1412*3d8817e4Smiod       value = fields->f_s16;
1413*3d8817e4Smiod       break;
1414*3d8817e4Smiod     case FRV_OPERAND_S5 :
1415*3d8817e4Smiod       value = fields->f_s5;
1416*3d8817e4Smiod       break;
1417*3d8817e4Smiod     case FRV_OPERAND_S6 :
1418*3d8817e4Smiod       value = fields->f_s6;
1419*3d8817e4Smiod       break;
1420*3d8817e4Smiod     case FRV_OPERAND_S6_1 :
1421*3d8817e4Smiod       value = fields->f_s6_1;
1422*3d8817e4Smiod       break;
1423*3d8817e4Smiod     case FRV_OPERAND_SLO16 :
1424*3d8817e4Smiod       value = fields->f_s16;
1425*3d8817e4Smiod       break;
1426*3d8817e4Smiod     case FRV_OPERAND_SPR :
1427*3d8817e4Smiod       value = fields->f_spr;
1428*3d8817e4Smiod       break;
1429*3d8817e4Smiod     case FRV_OPERAND_U12 :
1430*3d8817e4Smiod       value = fields->f_u12;
1431*3d8817e4Smiod       break;
1432*3d8817e4Smiod     case FRV_OPERAND_U16 :
1433*3d8817e4Smiod       value = fields->f_u16;
1434*3d8817e4Smiod       break;
1435*3d8817e4Smiod     case FRV_OPERAND_U6 :
1436*3d8817e4Smiod       value = fields->f_u6;
1437*3d8817e4Smiod       break;
1438*3d8817e4Smiod     case FRV_OPERAND_UHI16 :
1439*3d8817e4Smiod       value = fields->f_u16;
1440*3d8817e4Smiod       break;
1441*3d8817e4Smiod     case FRV_OPERAND_ULO16 :
1442*3d8817e4Smiod       value = fields->f_u16;
1443*3d8817e4Smiod       break;
1444*3d8817e4Smiod 
1445*3d8817e4Smiod     default :
1446*3d8817e4Smiod       /* xgettext:c-format */
1447*3d8817e4Smiod       fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
1448*3d8817e4Smiod 		       opindex);
1449*3d8817e4Smiod       abort ();
1450*3d8817e4Smiod   }
1451*3d8817e4Smiod 
1452*3d8817e4Smiod   return value;
1453*3d8817e4Smiod }
1454*3d8817e4Smiod 
1455*3d8817e4Smiod bfd_vma
frv_cgen_get_vma_operand(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,int opindex,const CGEN_FIELDS * fields)1456*3d8817e4Smiod frv_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1457*3d8817e4Smiod 			     int opindex,
1458*3d8817e4Smiod 			     const CGEN_FIELDS * fields)
1459*3d8817e4Smiod {
1460*3d8817e4Smiod   bfd_vma value;
1461*3d8817e4Smiod 
1462*3d8817e4Smiod   switch (opindex)
1463*3d8817e4Smiod     {
1464*3d8817e4Smiod     case FRV_OPERAND_A0 :
1465*3d8817e4Smiod       value = fields->f_A;
1466*3d8817e4Smiod       break;
1467*3d8817e4Smiod     case FRV_OPERAND_A1 :
1468*3d8817e4Smiod       value = fields->f_A;
1469*3d8817e4Smiod       break;
1470*3d8817e4Smiod     case FRV_OPERAND_ACC40SI :
1471*3d8817e4Smiod       value = fields->f_ACC40Si;
1472*3d8817e4Smiod       break;
1473*3d8817e4Smiod     case FRV_OPERAND_ACC40SK :
1474*3d8817e4Smiod       value = fields->f_ACC40Sk;
1475*3d8817e4Smiod       break;
1476*3d8817e4Smiod     case FRV_OPERAND_ACC40UI :
1477*3d8817e4Smiod       value = fields->f_ACC40Ui;
1478*3d8817e4Smiod       break;
1479*3d8817e4Smiod     case FRV_OPERAND_ACC40UK :
1480*3d8817e4Smiod       value = fields->f_ACC40Uk;
1481*3d8817e4Smiod       break;
1482*3d8817e4Smiod     case FRV_OPERAND_ACCGI :
1483*3d8817e4Smiod       value = fields->f_ACCGi;
1484*3d8817e4Smiod       break;
1485*3d8817e4Smiod     case FRV_OPERAND_ACCGK :
1486*3d8817e4Smiod       value = fields->f_ACCGk;
1487*3d8817e4Smiod       break;
1488*3d8817e4Smiod     case FRV_OPERAND_CCI :
1489*3d8817e4Smiod       value = fields->f_CCi;
1490*3d8817e4Smiod       break;
1491*3d8817e4Smiod     case FRV_OPERAND_CPRDOUBLEK :
1492*3d8817e4Smiod       value = fields->f_CPRk;
1493*3d8817e4Smiod       break;
1494*3d8817e4Smiod     case FRV_OPERAND_CPRI :
1495*3d8817e4Smiod       value = fields->f_CPRi;
1496*3d8817e4Smiod       break;
1497*3d8817e4Smiod     case FRV_OPERAND_CPRJ :
1498*3d8817e4Smiod       value = fields->f_CPRj;
1499*3d8817e4Smiod       break;
1500*3d8817e4Smiod     case FRV_OPERAND_CPRK :
1501*3d8817e4Smiod       value = fields->f_CPRk;
1502*3d8817e4Smiod       break;
1503*3d8817e4Smiod     case FRV_OPERAND_CRI :
1504*3d8817e4Smiod       value = fields->f_CRi;
1505*3d8817e4Smiod       break;
1506*3d8817e4Smiod     case FRV_OPERAND_CRJ :
1507*3d8817e4Smiod       value = fields->f_CRj;
1508*3d8817e4Smiod       break;
1509*3d8817e4Smiod     case FRV_OPERAND_CRJ_FLOAT :
1510*3d8817e4Smiod       value = fields->f_CRj_float;
1511*3d8817e4Smiod       break;
1512*3d8817e4Smiod     case FRV_OPERAND_CRJ_INT :
1513*3d8817e4Smiod       value = fields->f_CRj_int;
1514*3d8817e4Smiod       break;
1515*3d8817e4Smiod     case FRV_OPERAND_CRK :
1516*3d8817e4Smiod       value = fields->f_CRk;
1517*3d8817e4Smiod       break;
1518*3d8817e4Smiod     case FRV_OPERAND_FCCI_1 :
1519*3d8817e4Smiod       value = fields->f_FCCi_1;
1520*3d8817e4Smiod       break;
1521*3d8817e4Smiod     case FRV_OPERAND_FCCI_2 :
1522*3d8817e4Smiod       value = fields->f_FCCi_2;
1523*3d8817e4Smiod       break;
1524*3d8817e4Smiod     case FRV_OPERAND_FCCI_3 :
1525*3d8817e4Smiod       value = fields->f_FCCi_3;
1526*3d8817e4Smiod       break;
1527*3d8817e4Smiod     case FRV_OPERAND_FCCK :
1528*3d8817e4Smiod       value = fields->f_FCCk;
1529*3d8817e4Smiod       break;
1530*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEI :
1531*3d8817e4Smiod       value = fields->f_FRi;
1532*3d8817e4Smiod       break;
1533*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEJ :
1534*3d8817e4Smiod       value = fields->f_FRj;
1535*3d8817e4Smiod       break;
1536*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEK :
1537*3d8817e4Smiod       value = fields->f_FRk;
1538*3d8817e4Smiod       break;
1539*3d8817e4Smiod     case FRV_OPERAND_FRI :
1540*3d8817e4Smiod       value = fields->f_FRi;
1541*3d8817e4Smiod       break;
1542*3d8817e4Smiod     case FRV_OPERAND_FRINTI :
1543*3d8817e4Smiod       value = fields->f_FRi;
1544*3d8817e4Smiod       break;
1545*3d8817e4Smiod     case FRV_OPERAND_FRINTIEVEN :
1546*3d8817e4Smiod       value = fields->f_FRi;
1547*3d8817e4Smiod       break;
1548*3d8817e4Smiod     case FRV_OPERAND_FRINTJ :
1549*3d8817e4Smiod       value = fields->f_FRj;
1550*3d8817e4Smiod       break;
1551*3d8817e4Smiod     case FRV_OPERAND_FRINTJEVEN :
1552*3d8817e4Smiod       value = fields->f_FRj;
1553*3d8817e4Smiod       break;
1554*3d8817e4Smiod     case FRV_OPERAND_FRINTK :
1555*3d8817e4Smiod       value = fields->f_FRk;
1556*3d8817e4Smiod       break;
1557*3d8817e4Smiod     case FRV_OPERAND_FRINTKEVEN :
1558*3d8817e4Smiod       value = fields->f_FRk;
1559*3d8817e4Smiod       break;
1560*3d8817e4Smiod     case FRV_OPERAND_FRJ :
1561*3d8817e4Smiod       value = fields->f_FRj;
1562*3d8817e4Smiod       break;
1563*3d8817e4Smiod     case FRV_OPERAND_FRK :
1564*3d8817e4Smiod       value = fields->f_FRk;
1565*3d8817e4Smiod       break;
1566*3d8817e4Smiod     case FRV_OPERAND_FRKHI :
1567*3d8817e4Smiod       value = fields->f_FRk;
1568*3d8817e4Smiod       break;
1569*3d8817e4Smiod     case FRV_OPERAND_FRKLO :
1570*3d8817e4Smiod       value = fields->f_FRk;
1571*3d8817e4Smiod       break;
1572*3d8817e4Smiod     case FRV_OPERAND_GRDOUBLEK :
1573*3d8817e4Smiod       value = fields->f_GRk;
1574*3d8817e4Smiod       break;
1575*3d8817e4Smiod     case FRV_OPERAND_GRI :
1576*3d8817e4Smiod       value = fields->f_GRi;
1577*3d8817e4Smiod       break;
1578*3d8817e4Smiod     case FRV_OPERAND_GRJ :
1579*3d8817e4Smiod       value = fields->f_GRj;
1580*3d8817e4Smiod       break;
1581*3d8817e4Smiod     case FRV_OPERAND_GRK :
1582*3d8817e4Smiod       value = fields->f_GRk;
1583*3d8817e4Smiod       break;
1584*3d8817e4Smiod     case FRV_OPERAND_GRKHI :
1585*3d8817e4Smiod       value = fields->f_GRk;
1586*3d8817e4Smiod       break;
1587*3d8817e4Smiod     case FRV_OPERAND_GRKLO :
1588*3d8817e4Smiod       value = fields->f_GRk;
1589*3d8817e4Smiod       break;
1590*3d8817e4Smiod     case FRV_OPERAND_ICCI_1 :
1591*3d8817e4Smiod       value = fields->f_ICCi_1;
1592*3d8817e4Smiod       break;
1593*3d8817e4Smiod     case FRV_OPERAND_ICCI_2 :
1594*3d8817e4Smiod       value = fields->f_ICCi_2;
1595*3d8817e4Smiod       break;
1596*3d8817e4Smiod     case FRV_OPERAND_ICCI_3 :
1597*3d8817e4Smiod       value = fields->f_ICCi_3;
1598*3d8817e4Smiod       break;
1599*3d8817e4Smiod     case FRV_OPERAND_LI :
1600*3d8817e4Smiod       value = fields->f_LI;
1601*3d8817e4Smiod       break;
1602*3d8817e4Smiod     case FRV_OPERAND_LRAD :
1603*3d8817e4Smiod       value = fields->f_LRAD;
1604*3d8817e4Smiod       break;
1605*3d8817e4Smiod     case FRV_OPERAND_LRAE :
1606*3d8817e4Smiod       value = fields->f_LRAE;
1607*3d8817e4Smiod       break;
1608*3d8817e4Smiod     case FRV_OPERAND_LRAS :
1609*3d8817e4Smiod       value = fields->f_LRAS;
1610*3d8817e4Smiod       break;
1611*3d8817e4Smiod     case FRV_OPERAND_TLBPRL :
1612*3d8817e4Smiod       value = fields->f_TLBPRL;
1613*3d8817e4Smiod       break;
1614*3d8817e4Smiod     case FRV_OPERAND_TLBPROPX :
1615*3d8817e4Smiod       value = fields->f_TLBPRopx;
1616*3d8817e4Smiod       break;
1617*3d8817e4Smiod     case FRV_OPERAND_AE :
1618*3d8817e4Smiod       value = fields->f_ae;
1619*3d8817e4Smiod       break;
1620*3d8817e4Smiod     case FRV_OPERAND_CALLANN :
1621*3d8817e4Smiod       value = fields->f_reloc_ann;
1622*3d8817e4Smiod       break;
1623*3d8817e4Smiod     case FRV_OPERAND_CCOND :
1624*3d8817e4Smiod       value = fields->f_ccond;
1625*3d8817e4Smiod       break;
1626*3d8817e4Smiod     case FRV_OPERAND_COND :
1627*3d8817e4Smiod       value = fields->f_cond;
1628*3d8817e4Smiod       break;
1629*3d8817e4Smiod     case FRV_OPERAND_D12 :
1630*3d8817e4Smiod       value = fields->f_d12;
1631*3d8817e4Smiod       break;
1632*3d8817e4Smiod     case FRV_OPERAND_DEBUG :
1633*3d8817e4Smiod       value = fields->f_debug;
1634*3d8817e4Smiod       break;
1635*3d8817e4Smiod     case FRV_OPERAND_EIR :
1636*3d8817e4Smiod       value = fields->f_eir;
1637*3d8817e4Smiod       break;
1638*3d8817e4Smiod     case FRV_OPERAND_HINT :
1639*3d8817e4Smiod       value = fields->f_hint;
1640*3d8817e4Smiod       break;
1641*3d8817e4Smiod     case FRV_OPERAND_HINT_NOT_TAKEN :
1642*3d8817e4Smiod       value = fields->f_hint;
1643*3d8817e4Smiod       break;
1644*3d8817e4Smiod     case FRV_OPERAND_HINT_TAKEN :
1645*3d8817e4Smiod       value = fields->f_hint;
1646*3d8817e4Smiod       break;
1647*3d8817e4Smiod     case FRV_OPERAND_LABEL16 :
1648*3d8817e4Smiod       value = fields->f_label16;
1649*3d8817e4Smiod       break;
1650*3d8817e4Smiod     case FRV_OPERAND_LABEL24 :
1651*3d8817e4Smiod       value = fields->f_label24;
1652*3d8817e4Smiod       break;
1653*3d8817e4Smiod     case FRV_OPERAND_LDANN :
1654*3d8817e4Smiod       value = fields->f_reloc_ann;
1655*3d8817e4Smiod       break;
1656*3d8817e4Smiod     case FRV_OPERAND_LDDANN :
1657*3d8817e4Smiod       value = fields->f_reloc_ann;
1658*3d8817e4Smiod       break;
1659*3d8817e4Smiod     case FRV_OPERAND_LOCK :
1660*3d8817e4Smiod       value = fields->f_lock;
1661*3d8817e4Smiod       break;
1662*3d8817e4Smiod     case FRV_OPERAND_PACK :
1663*3d8817e4Smiod       value = fields->f_pack;
1664*3d8817e4Smiod       break;
1665*3d8817e4Smiod     case FRV_OPERAND_S10 :
1666*3d8817e4Smiod       value = fields->f_s10;
1667*3d8817e4Smiod       break;
1668*3d8817e4Smiod     case FRV_OPERAND_S12 :
1669*3d8817e4Smiod       value = fields->f_d12;
1670*3d8817e4Smiod       break;
1671*3d8817e4Smiod     case FRV_OPERAND_S16 :
1672*3d8817e4Smiod       value = fields->f_s16;
1673*3d8817e4Smiod       break;
1674*3d8817e4Smiod     case FRV_OPERAND_S5 :
1675*3d8817e4Smiod       value = fields->f_s5;
1676*3d8817e4Smiod       break;
1677*3d8817e4Smiod     case FRV_OPERAND_S6 :
1678*3d8817e4Smiod       value = fields->f_s6;
1679*3d8817e4Smiod       break;
1680*3d8817e4Smiod     case FRV_OPERAND_S6_1 :
1681*3d8817e4Smiod       value = fields->f_s6_1;
1682*3d8817e4Smiod       break;
1683*3d8817e4Smiod     case FRV_OPERAND_SLO16 :
1684*3d8817e4Smiod       value = fields->f_s16;
1685*3d8817e4Smiod       break;
1686*3d8817e4Smiod     case FRV_OPERAND_SPR :
1687*3d8817e4Smiod       value = fields->f_spr;
1688*3d8817e4Smiod       break;
1689*3d8817e4Smiod     case FRV_OPERAND_U12 :
1690*3d8817e4Smiod       value = fields->f_u12;
1691*3d8817e4Smiod       break;
1692*3d8817e4Smiod     case FRV_OPERAND_U16 :
1693*3d8817e4Smiod       value = fields->f_u16;
1694*3d8817e4Smiod       break;
1695*3d8817e4Smiod     case FRV_OPERAND_U6 :
1696*3d8817e4Smiod       value = fields->f_u6;
1697*3d8817e4Smiod       break;
1698*3d8817e4Smiod     case FRV_OPERAND_UHI16 :
1699*3d8817e4Smiod       value = fields->f_u16;
1700*3d8817e4Smiod       break;
1701*3d8817e4Smiod     case FRV_OPERAND_ULO16 :
1702*3d8817e4Smiod       value = fields->f_u16;
1703*3d8817e4Smiod       break;
1704*3d8817e4Smiod 
1705*3d8817e4Smiod     default :
1706*3d8817e4Smiod       /* xgettext:c-format */
1707*3d8817e4Smiod       fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
1708*3d8817e4Smiod 		       opindex);
1709*3d8817e4Smiod       abort ();
1710*3d8817e4Smiod   }
1711*3d8817e4Smiod 
1712*3d8817e4Smiod   return value;
1713*3d8817e4Smiod }
1714*3d8817e4Smiod 
1715*3d8817e4Smiod void frv_cgen_set_int_operand  (CGEN_CPU_DESC, int, CGEN_FIELDS *, int);
1716*3d8817e4Smiod void frv_cgen_set_vma_operand  (CGEN_CPU_DESC, int, CGEN_FIELDS *, bfd_vma);
1717*3d8817e4Smiod 
1718*3d8817e4Smiod /* Stuffing values in cgen_fields is handled by a collection of functions.
1719*3d8817e4Smiod    They are distinguished by the type of the VALUE argument they accept.
1720*3d8817e4Smiod    TODO: floating point, inlining support, remove cases where argument type
1721*3d8817e4Smiod    not appropriate.  */
1722*3d8817e4Smiod 
1723*3d8817e4Smiod void
frv_cgen_set_int_operand(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,int opindex,CGEN_FIELDS * fields,int value)1724*3d8817e4Smiod frv_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1725*3d8817e4Smiod 			     int opindex,
1726*3d8817e4Smiod 			     CGEN_FIELDS * fields,
1727*3d8817e4Smiod 			     int value)
1728*3d8817e4Smiod {
1729*3d8817e4Smiod   switch (opindex)
1730*3d8817e4Smiod     {
1731*3d8817e4Smiod     case FRV_OPERAND_A0 :
1732*3d8817e4Smiod       fields->f_A = value;
1733*3d8817e4Smiod       break;
1734*3d8817e4Smiod     case FRV_OPERAND_A1 :
1735*3d8817e4Smiod       fields->f_A = value;
1736*3d8817e4Smiod       break;
1737*3d8817e4Smiod     case FRV_OPERAND_ACC40SI :
1738*3d8817e4Smiod       fields->f_ACC40Si = value;
1739*3d8817e4Smiod       break;
1740*3d8817e4Smiod     case FRV_OPERAND_ACC40SK :
1741*3d8817e4Smiod       fields->f_ACC40Sk = value;
1742*3d8817e4Smiod       break;
1743*3d8817e4Smiod     case FRV_OPERAND_ACC40UI :
1744*3d8817e4Smiod       fields->f_ACC40Ui = value;
1745*3d8817e4Smiod       break;
1746*3d8817e4Smiod     case FRV_OPERAND_ACC40UK :
1747*3d8817e4Smiod       fields->f_ACC40Uk = value;
1748*3d8817e4Smiod       break;
1749*3d8817e4Smiod     case FRV_OPERAND_ACCGI :
1750*3d8817e4Smiod       fields->f_ACCGi = value;
1751*3d8817e4Smiod       break;
1752*3d8817e4Smiod     case FRV_OPERAND_ACCGK :
1753*3d8817e4Smiod       fields->f_ACCGk = value;
1754*3d8817e4Smiod       break;
1755*3d8817e4Smiod     case FRV_OPERAND_CCI :
1756*3d8817e4Smiod       fields->f_CCi = value;
1757*3d8817e4Smiod       break;
1758*3d8817e4Smiod     case FRV_OPERAND_CPRDOUBLEK :
1759*3d8817e4Smiod       fields->f_CPRk = value;
1760*3d8817e4Smiod       break;
1761*3d8817e4Smiod     case FRV_OPERAND_CPRI :
1762*3d8817e4Smiod       fields->f_CPRi = value;
1763*3d8817e4Smiod       break;
1764*3d8817e4Smiod     case FRV_OPERAND_CPRJ :
1765*3d8817e4Smiod       fields->f_CPRj = value;
1766*3d8817e4Smiod       break;
1767*3d8817e4Smiod     case FRV_OPERAND_CPRK :
1768*3d8817e4Smiod       fields->f_CPRk = value;
1769*3d8817e4Smiod       break;
1770*3d8817e4Smiod     case FRV_OPERAND_CRI :
1771*3d8817e4Smiod       fields->f_CRi = value;
1772*3d8817e4Smiod       break;
1773*3d8817e4Smiod     case FRV_OPERAND_CRJ :
1774*3d8817e4Smiod       fields->f_CRj = value;
1775*3d8817e4Smiod       break;
1776*3d8817e4Smiod     case FRV_OPERAND_CRJ_FLOAT :
1777*3d8817e4Smiod       fields->f_CRj_float = value;
1778*3d8817e4Smiod       break;
1779*3d8817e4Smiod     case FRV_OPERAND_CRJ_INT :
1780*3d8817e4Smiod       fields->f_CRj_int = value;
1781*3d8817e4Smiod       break;
1782*3d8817e4Smiod     case FRV_OPERAND_CRK :
1783*3d8817e4Smiod       fields->f_CRk = value;
1784*3d8817e4Smiod       break;
1785*3d8817e4Smiod     case FRV_OPERAND_FCCI_1 :
1786*3d8817e4Smiod       fields->f_FCCi_1 = value;
1787*3d8817e4Smiod       break;
1788*3d8817e4Smiod     case FRV_OPERAND_FCCI_2 :
1789*3d8817e4Smiod       fields->f_FCCi_2 = value;
1790*3d8817e4Smiod       break;
1791*3d8817e4Smiod     case FRV_OPERAND_FCCI_3 :
1792*3d8817e4Smiod       fields->f_FCCi_3 = value;
1793*3d8817e4Smiod       break;
1794*3d8817e4Smiod     case FRV_OPERAND_FCCK :
1795*3d8817e4Smiod       fields->f_FCCk = value;
1796*3d8817e4Smiod       break;
1797*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEI :
1798*3d8817e4Smiod       fields->f_FRi = value;
1799*3d8817e4Smiod       break;
1800*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEJ :
1801*3d8817e4Smiod       fields->f_FRj = value;
1802*3d8817e4Smiod       break;
1803*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEK :
1804*3d8817e4Smiod       fields->f_FRk = value;
1805*3d8817e4Smiod       break;
1806*3d8817e4Smiod     case FRV_OPERAND_FRI :
1807*3d8817e4Smiod       fields->f_FRi = value;
1808*3d8817e4Smiod       break;
1809*3d8817e4Smiod     case FRV_OPERAND_FRINTI :
1810*3d8817e4Smiod       fields->f_FRi = value;
1811*3d8817e4Smiod       break;
1812*3d8817e4Smiod     case FRV_OPERAND_FRINTIEVEN :
1813*3d8817e4Smiod       fields->f_FRi = value;
1814*3d8817e4Smiod       break;
1815*3d8817e4Smiod     case FRV_OPERAND_FRINTJ :
1816*3d8817e4Smiod       fields->f_FRj = value;
1817*3d8817e4Smiod       break;
1818*3d8817e4Smiod     case FRV_OPERAND_FRINTJEVEN :
1819*3d8817e4Smiod       fields->f_FRj = value;
1820*3d8817e4Smiod       break;
1821*3d8817e4Smiod     case FRV_OPERAND_FRINTK :
1822*3d8817e4Smiod       fields->f_FRk = value;
1823*3d8817e4Smiod       break;
1824*3d8817e4Smiod     case FRV_OPERAND_FRINTKEVEN :
1825*3d8817e4Smiod       fields->f_FRk = value;
1826*3d8817e4Smiod       break;
1827*3d8817e4Smiod     case FRV_OPERAND_FRJ :
1828*3d8817e4Smiod       fields->f_FRj = value;
1829*3d8817e4Smiod       break;
1830*3d8817e4Smiod     case FRV_OPERAND_FRK :
1831*3d8817e4Smiod       fields->f_FRk = value;
1832*3d8817e4Smiod       break;
1833*3d8817e4Smiod     case FRV_OPERAND_FRKHI :
1834*3d8817e4Smiod       fields->f_FRk = value;
1835*3d8817e4Smiod       break;
1836*3d8817e4Smiod     case FRV_OPERAND_FRKLO :
1837*3d8817e4Smiod       fields->f_FRk = value;
1838*3d8817e4Smiod       break;
1839*3d8817e4Smiod     case FRV_OPERAND_GRDOUBLEK :
1840*3d8817e4Smiod       fields->f_GRk = value;
1841*3d8817e4Smiod       break;
1842*3d8817e4Smiod     case FRV_OPERAND_GRI :
1843*3d8817e4Smiod       fields->f_GRi = value;
1844*3d8817e4Smiod       break;
1845*3d8817e4Smiod     case FRV_OPERAND_GRJ :
1846*3d8817e4Smiod       fields->f_GRj = value;
1847*3d8817e4Smiod       break;
1848*3d8817e4Smiod     case FRV_OPERAND_GRK :
1849*3d8817e4Smiod       fields->f_GRk = value;
1850*3d8817e4Smiod       break;
1851*3d8817e4Smiod     case FRV_OPERAND_GRKHI :
1852*3d8817e4Smiod       fields->f_GRk = value;
1853*3d8817e4Smiod       break;
1854*3d8817e4Smiod     case FRV_OPERAND_GRKLO :
1855*3d8817e4Smiod       fields->f_GRk = value;
1856*3d8817e4Smiod       break;
1857*3d8817e4Smiod     case FRV_OPERAND_ICCI_1 :
1858*3d8817e4Smiod       fields->f_ICCi_1 = value;
1859*3d8817e4Smiod       break;
1860*3d8817e4Smiod     case FRV_OPERAND_ICCI_2 :
1861*3d8817e4Smiod       fields->f_ICCi_2 = value;
1862*3d8817e4Smiod       break;
1863*3d8817e4Smiod     case FRV_OPERAND_ICCI_3 :
1864*3d8817e4Smiod       fields->f_ICCi_3 = value;
1865*3d8817e4Smiod       break;
1866*3d8817e4Smiod     case FRV_OPERAND_LI :
1867*3d8817e4Smiod       fields->f_LI = value;
1868*3d8817e4Smiod       break;
1869*3d8817e4Smiod     case FRV_OPERAND_LRAD :
1870*3d8817e4Smiod       fields->f_LRAD = value;
1871*3d8817e4Smiod       break;
1872*3d8817e4Smiod     case FRV_OPERAND_LRAE :
1873*3d8817e4Smiod       fields->f_LRAE = value;
1874*3d8817e4Smiod       break;
1875*3d8817e4Smiod     case FRV_OPERAND_LRAS :
1876*3d8817e4Smiod       fields->f_LRAS = value;
1877*3d8817e4Smiod       break;
1878*3d8817e4Smiod     case FRV_OPERAND_TLBPRL :
1879*3d8817e4Smiod       fields->f_TLBPRL = value;
1880*3d8817e4Smiod       break;
1881*3d8817e4Smiod     case FRV_OPERAND_TLBPROPX :
1882*3d8817e4Smiod       fields->f_TLBPRopx = value;
1883*3d8817e4Smiod       break;
1884*3d8817e4Smiod     case FRV_OPERAND_AE :
1885*3d8817e4Smiod       fields->f_ae = value;
1886*3d8817e4Smiod       break;
1887*3d8817e4Smiod     case FRV_OPERAND_CALLANN :
1888*3d8817e4Smiod       fields->f_reloc_ann = value;
1889*3d8817e4Smiod       break;
1890*3d8817e4Smiod     case FRV_OPERAND_CCOND :
1891*3d8817e4Smiod       fields->f_ccond = value;
1892*3d8817e4Smiod       break;
1893*3d8817e4Smiod     case FRV_OPERAND_COND :
1894*3d8817e4Smiod       fields->f_cond = value;
1895*3d8817e4Smiod       break;
1896*3d8817e4Smiod     case FRV_OPERAND_D12 :
1897*3d8817e4Smiod       fields->f_d12 = value;
1898*3d8817e4Smiod       break;
1899*3d8817e4Smiod     case FRV_OPERAND_DEBUG :
1900*3d8817e4Smiod       fields->f_debug = value;
1901*3d8817e4Smiod       break;
1902*3d8817e4Smiod     case FRV_OPERAND_EIR :
1903*3d8817e4Smiod       fields->f_eir = value;
1904*3d8817e4Smiod       break;
1905*3d8817e4Smiod     case FRV_OPERAND_HINT :
1906*3d8817e4Smiod       fields->f_hint = value;
1907*3d8817e4Smiod       break;
1908*3d8817e4Smiod     case FRV_OPERAND_HINT_NOT_TAKEN :
1909*3d8817e4Smiod       fields->f_hint = value;
1910*3d8817e4Smiod       break;
1911*3d8817e4Smiod     case FRV_OPERAND_HINT_TAKEN :
1912*3d8817e4Smiod       fields->f_hint = value;
1913*3d8817e4Smiod       break;
1914*3d8817e4Smiod     case FRV_OPERAND_LABEL16 :
1915*3d8817e4Smiod       fields->f_label16 = value;
1916*3d8817e4Smiod       break;
1917*3d8817e4Smiod     case FRV_OPERAND_LABEL24 :
1918*3d8817e4Smiod       fields->f_label24 = value;
1919*3d8817e4Smiod       break;
1920*3d8817e4Smiod     case FRV_OPERAND_LDANN :
1921*3d8817e4Smiod       fields->f_reloc_ann = value;
1922*3d8817e4Smiod       break;
1923*3d8817e4Smiod     case FRV_OPERAND_LDDANN :
1924*3d8817e4Smiod       fields->f_reloc_ann = value;
1925*3d8817e4Smiod       break;
1926*3d8817e4Smiod     case FRV_OPERAND_LOCK :
1927*3d8817e4Smiod       fields->f_lock = value;
1928*3d8817e4Smiod       break;
1929*3d8817e4Smiod     case FRV_OPERAND_PACK :
1930*3d8817e4Smiod       fields->f_pack = value;
1931*3d8817e4Smiod       break;
1932*3d8817e4Smiod     case FRV_OPERAND_S10 :
1933*3d8817e4Smiod       fields->f_s10 = value;
1934*3d8817e4Smiod       break;
1935*3d8817e4Smiod     case FRV_OPERAND_S12 :
1936*3d8817e4Smiod       fields->f_d12 = value;
1937*3d8817e4Smiod       break;
1938*3d8817e4Smiod     case FRV_OPERAND_S16 :
1939*3d8817e4Smiod       fields->f_s16 = value;
1940*3d8817e4Smiod       break;
1941*3d8817e4Smiod     case FRV_OPERAND_S5 :
1942*3d8817e4Smiod       fields->f_s5 = value;
1943*3d8817e4Smiod       break;
1944*3d8817e4Smiod     case FRV_OPERAND_S6 :
1945*3d8817e4Smiod       fields->f_s6 = value;
1946*3d8817e4Smiod       break;
1947*3d8817e4Smiod     case FRV_OPERAND_S6_1 :
1948*3d8817e4Smiod       fields->f_s6_1 = value;
1949*3d8817e4Smiod       break;
1950*3d8817e4Smiod     case FRV_OPERAND_SLO16 :
1951*3d8817e4Smiod       fields->f_s16 = value;
1952*3d8817e4Smiod       break;
1953*3d8817e4Smiod     case FRV_OPERAND_SPR :
1954*3d8817e4Smiod       fields->f_spr = value;
1955*3d8817e4Smiod       break;
1956*3d8817e4Smiod     case FRV_OPERAND_U12 :
1957*3d8817e4Smiod       fields->f_u12 = value;
1958*3d8817e4Smiod       break;
1959*3d8817e4Smiod     case FRV_OPERAND_U16 :
1960*3d8817e4Smiod       fields->f_u16 = value;
1961*3d8817e4Smiod       break;
1962*3d8817e4Smiod     case FRV_OPERAND_U6 :
1963*3d8817e4Smiod       fields->f_u6 = value;
1964*3d8817e4Smiod       break;
1965*3d8817e4Smiod     case FRV_OPERAND_UHI16 :
1966*3d8817e4Smiod       fields->f_u16 = value;
1967*3d8817e4Smiod       break;
1968*3d8817e4Smiod     case FRV_OPERAND_ULO16 :
1969*3d8817e4Smiod       fields->f_u16 = value;
1970*3d8817e4Smiod       break;
1971*3d8817e4Smiod 
1972*3d8817e4Smiod     default :
1973*3d8817e4Smiod       /* xgettext:c-format */
1974*3d8817e4Smiod       fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
1975*3d8817e4Smiod 		       opindex);
1976*3d8817e4Smiod       abort ();
1977*3d8817e4Smiod   }
1978*3d8817e4Smiod }
1979*3d8817e4Smiod 
1980*3d8817e4Smiod void
frv_cgen_set_vma_operand(CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,int opindex,CGEN_FIELDS * fields,bfd_vma value)1981*3d8817e4Smiod frv_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1982*3d8817e4Smiod 			     int opindex,
1983*3d8817e4Smiod 			     CGEN_FIELDS * fields,
1984*3d8817e4Smiod 			     bfd_vma value)
1985*3d8817e4Smiod {
1986*3d8817e4Smiod   switch (opindex)
1987*3d8817e4Smiod     {
1988*3d8817e4Smiod     case FRV_OPERAND_A0 :
1989*3d8817e4Smiod       fields->f_A = value;
1990*3d8817e4Smiod       break;
1991*3d8817e4Smiod     case FRV_OPERAND_A1 :
1992*3d8817e4Smiod       fields->f_A = value;
1993*3d8817e4Smiod       break;
1994*3d8817e4Smiod     case FRV_OPERAND_ACC40SI :
1995*3d8817e4Smiod       fields->f_ACC40Si = value;
1996*3d8817e4Smiod       break;
1997*3d8817e4Smiod     case FRV_OPERAND_ACC40SK :
1998*3d8817e4Smiod       fields->f_ACC40Sk = value;
1999*3d8817e4Smiod       break;
2000*3d8817e4Smiod     case FRV_OPERAND_ACC40UI :
2001*3d8817e4Smiod       fields->f_ACC40Ui = value;
2002*3d8817e4Smiod       break;
2003*3d8817e4Smiod     case FRV_OPERAND_ACC40UK :
2004*3d8817e4Smiod       fields->f_ACC40Uk = value;
2005*3d8817e4Smiod       break;
2006*3d8817e4Smiod     case FRV_OPERAND_ACCGI :
2007*3d8817e4Smiod       fields->f_ACCGi = value;
2008*3d8817e4Smiod       break;
2009*3d8817e4Smiod     case FRV_OPERAND_ACCGK :
2010*3d8817e4Smiod       fields->f_ACCGk = value;
2011*3d8817e4Smiod       break;
2012*3d8817e4Smiod     case FRV_OPERAND_CCI :
2013*3d8817e4Smiod       fields->f_CCi = value;
2014*3d8817e4Smiod       break;
2015*3d8817e4Smiod     case FRV_OPERAND_CPRDOUBLEK :
2016*3d8817e4Smiod       fields->f_CPRk = value;
2017*3d8817e4Smiod       break;
2018*3d8817e4Smiod     case FRV_OPERAND_CPRI :
2019*3d8817e4Smiod       fields->f_CPRi = value;
2020*3d8817e4Smiod       break;
2021*3d8817e4Smiod     case FRV_OPERAND_CPRJ :
2022*3d8817e4Smiod       fields->f_CPRj = value;
2023*3d8817e4Smiod       break;
2024*3d8817e4Smiod     case FRV_OPERAND_CPRK :
2025*3d8817e4Smiod       fields->f_CPRk = value;
2026*3d8817e4Smiod       break;
2027*3d8817e4Smiod     case FRV_OPERAND_CRI :
2028*3d8817e4Smiod       fields->f_CRi = value;
2029*3d8817e4Smiod       break;
2030*3d8817e4Smiod     case FRV_OPERAND_CRJ :
2031*3d8817e4Smiod       fields->f_CRj = value;
2032*3d8817e4Smiod       break;
2033*3d8817e4Smiod     case FRV_OPERAND_CRJ_FLOAT :
2034*3d8817e4Smiod       fields->f_CRj_float = value;
2035*3d8817e4Smiod       break;
2036*3d8817e4Smiod     case FRV_OPERAND_CRJ_INT :
2037*3d8817e4Smiod       fields->f_CRj_int = value;
2038*3d8817e4Smiod       break;
2039*3d8817e4Smiod     case FRV_OPERAND_CRK :
2040*3d8817e4Smiod       fields->f_CRk = value;
2041*3d8817e4Smiod       break;
2042*3d8817e4Smiod     case FRV_OPERAND_FCCI_1 :
2043*3d8817e4Smiod       fields->f_FCCi_1 = value;
2044*3d8817e4Smiod       break;
2045*3d8817e4Smiod     case FRV_OPERAND_FCCI_2 :
2046*3d8817e4Smiod       fields->f_FCCi_2 = value;
2047*3d8817e4Smiod       break;
2048*3d8817e4Smiod     case FRV_OPERAND_FCCI_3 :
2049*3d8817e4Smiod       fields->f_FCCi_3 = value;
2050*3d8817e4Smiod       break;
2051*3d8817e4Smiod     case FRV_OPERAND_FCCK :
2052*3d8817e4Smiod       fields->f_FCCk = value;
2053*3d8817e4Smiod       break;
2054*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEI :
2055*3d8817e4Smiod       fields->f_FRi = value;
2056*3d8817e4Smiod       break;
2057*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEJ :
2058*3d8817e4Smiod       fields->f_FRj = value;
2059*3d8817e4Smiod       break;
2060*3d8817e4Smiod     case FRV_OPERAND_FRDOUBLEK :
2061*3d8817e4Smiod       fields->f_FRk = value;
2062*3d8817e4Smiod       break;
2063*3d8817e4Smiod     case FRV_OPERAND_FRI :
2064*3d8817e4Smiod       fields->f_FRi = value;
2065*3d8817e4Smiod       break;
2066*3d8817e4Smiod     case FRV_OPERAND_FRINTI :
2067*3d8817e4Smiod       fields->f_FRi = value;
2068*3d8817e4Smiod       break;
2069*3d8817e4Smiod     case FRV_OPERAND_FRINTIEVEN :
2070*3d8817e4Smiod       fields->f_FRi = value;
2071*3d8817e4Smiod       break;
2072*3d8817e4Smiod     case FRV_OPERAND_FRINTJ :
2073*3d8817e4Smiod       fields->f_FRj = value;
2074*3d8817e4Smiod       break;
2075*3d8817e4Smiod     case FRV_OPERAND_FRINTJEVEN :
2076*3d8817e4Smiod       fields->f_FRj = value;
2077*3d8817e4Smiod       break;
2078*3d8817e4Smiod     case FRV_OPERAND_FRINTK :
2079*3d8817e4Smiod       fields->f_FRk = value;
2080*3d8817e4Smiod       break;
2081*3d8817e4Smiod     case FRV_OPERAND_FRINTKEVEN :
2082*3d8817e4Smiod       fields->f_FRk = value;
2083*3d8817e4Smiod       break;
2084*3d8817e4Smiod     case FRV_OPERAND_FRJ :
2085*3d8817e4Smiod       fields->f_FRj = value;
2086*3d8817e4Smiod       break;
2087*3d8817e4Smiod     case FRV_OPERAND_FRK :
2088*3d8817e4Smiod       fields->f_FRk = value;
2089*3d8817e4Smiod       break;
2090*3d8817e4Smiod     case FRV_OPERAND_FRKHI :
2091*3d8817e4Smiod       fields->f_FRk = value;
2092*3d8817e4Smiod       break;
2093*3d8817e4Smiod     case FRV_OPERAND_FRKLO :
2094*3d8817e4Smiod       fields->f_FRk = value;
2095*3d8817e4Smiod       break;
2096*3d8817e4Smiod     case FRV_OPERAND_GRDOUBLEK :
2097*3d8817e4Smiod       fields->f_GRk = value;
2098*3d8817e4Smiod       break;
2099*3d8817e4Smiod     case FRV_OPERAND_GRI :
2100*3d8817e4Smiod       fields->f_GRi = value;
2101*3d8817e4Smiod       break;
2102*3d8817e4Smiod     case FRV_OPERAND_GRJ :
2103*3d8817e4Smiod       fields->f_GRj = value;
2104*3d8817e4Smiod       break;
2105*3d8817e4Smiod     case FRV_OPERAND_GRK :
2106*3d8817e4Smiod       fields->f_GRk = value;
2107*3d8817e4Smiod       break;
2108*3d8817e4Smiod     case FRV_OPERAND_GRKHI :
2109*3d8817e4Smiod       fields->f_GRk = value;
2110*3d8817e4Smiod       break;
2111*3d8817e4Smiod     case FRV_OPERAND_GRKLO :
2112*3d8817e4Smiod       fields->f_GRk = value;
2113*3d8817e4Smiod       break;
2114*3d8817e4Smiod     case FRV_OPERAND_ICCI_1 :
2115*3d8817e4Smiod       fields->f_ICCi_1 = value;
2116*3d8817e4Smiod       break;
2117*3d8817e4Smiod     case FRV_OPERAND_ICCI_2 :
2118*3d8817e4Smiod       fields->f_ICCi_2 = value;
2119*3d8817e4Smiod       break;
2120*3d8817e4Smiod     case FRV_OPERAND_ICCI_3 :
2121*3d8817e4Smiod       fields->f_ICCi_3 = value;
2122*3d8817e4Smiod       break;
2123*3d8817e4Smiod     case FRV_OPERAND_LI :
2124*3d8817e4Smiod       fields->f_LI = value;
2125*3d8817e4Smiod       break;
2126*3d8817e4Smiod     case FRV_OPERAND_LRAD :
2127*3d8817e4Smiod       fields->f_LRAD = value;
2128*3d8817e4Smiod       break;
2129*3d8817e4Smiod     case FRV_OPERAND_LRAE :
2130*3d8817e4Smiod       fields->f_LRAE = value;
2131*3d8817e4Smiod       break;
2132*3d8817e4Smiod     case FRV_OPERAND_LRAS :
2133*3d8817e4Smiod       fields->f_LRAS = value;
2134*3d8817e4Smiod       break;
2135*3d8817e4Smiod     case FRV_OPERAND_TLBPRL :
2136*3d8817e4Smiod       fields->f_TLBPRL = value;
2137*3d8817e4Smiod       break;
2138*3d8817e4Smiod     case FRV_OPERAND_TLBPROPX :
2139*3d8817e4Smiod       fields->f_TLBPRopx = value;
2140*3d8817e4Smiod       break;
2141*3d8817e4Smiod     case FRV_OPERAND_AE :
2142*3d8817e4Smiod       fields->f_ae = value;
2143*3d8817e4Smiod       break;
2144*3d8817e4Smiod     case FRV_OPERAND_CALLANN :
2145*3d8817e4Smiod       fields->f_reloc_ann = value;
2146*3d8817e4Smiod       break;
2147*3d8817e4Smiod     case FRV_OPERAND_CCOND :
2148*3d8817e4Smiod       fields->f_ccond = value;
2149*3d8817e4Smiod       break;
2150*3d8817e4Smiod     case FRV_OPERAND_COND :
2151*3d8817e4Smiod       fields->f_cond = value;
2152*3d8817e4Smiod       break;
2153*3d8817e4Smiod     case FRV_OPERAND_D12 :
2154*3d8817e4Smiod       fields->f_d12 = value;
2155*3d8817e4Smiod       break;
2156*3d8817e4Smiod     case FRV_OPERAND_DEBUG :
2157*3d8817e4Smiod       fields->f_debug = value;
2158*3d8817e4Smiod       break;
2159*3d8817e4Smiod     case FRV_OPERAND_EIR :
2160*3d8817e4Smiod       fields->f_eir = value;
2161*3d8817e4Smiod       break;
2162*3d8817e4Smiod     case FRV_OPERAND_HINT :
2163*3d8817e4Smiod       fields->f_hint = value;
2164*3d8817e4Smiod       break;
2165*3d8817e4Smiod     case FRV_OPERAND_HINT_NOT_TAKEN :
2166*3d8817e4Smiod       fields->f_hint = value;
2167*3d8817e4Smiod       break;
2168*3d8817e4Smiod     case FRV_OPERAND_HINT_TAKEN :
2169*3d8817e4Smiod       fields->f_hint = value;
2170*3d8817e4Smiod       break;
2171*3d8817e4Smiod     case FRV_OPERAND_LABEL16 :
2172*3d8817e4Smiod       fields->f_label16 = value;
2173*3d8817e4Smiod       break;
2174*3d8817e4Smiod     case FRV_OPERAND_LABEL24 :
2175*3d8817e4Smiod       fields->f_label24 = value;
2176*3d8817e4Smiod       break;
2177*3d8817e4Smiod     case FRV_OPERAND_LDANN :
2178*3d8817e4Smiod       fields->f_reloc_ann = value;
2179*3d8817e4Smiod       break;
2180*3d8817e4Smiod     case FRV_OPERAND_LDDANN :
2181*3d8817e4Smiod       fields->f_reloc_ann = value;
2182*3d8817e4Smiod       break;
2183*3d8817e4Smiod     case FRV_OPERAND_LOCK :
2184*3d8817e4Smiod       fields->f_lock = value;
2185*3d8817e4Smiod       break;
2186*3d8817e4Smiod     case FRV_OPERAND_PACK :
2187*3d8817e4Smiod       fields->f_pack = value;
2188*3d8817e4Smiod       break;
2189*3d8817e4Smiod     case FRV_OPERAND_S10 :
2190*3d8817e4Smiod       fields->f_s10 = value;
2191*3d8817e4Smiod       break;
2192*3d8817e4Smiod     case FRV_OPERAND_S12 :
2193*3d8817e4Smiod       fields->f_d12 = value;
2194*3d8817e4Smiod       break;
2195*3d8817e4Smiod     case FRV_OPERAND_S16 :
2196*3d8817e4Smiod       fields->f_s16 = value;
2197*3d8817e4Smiod       break;
2198*3d8817e4Smiod     case FRV_OPERAND_S5 :
2199*3d8817e4Smiod       fields->f_s5 = value;
2200*3d8817e4Smiod       break;
2201*3d8817e4Smiod     case FRV_OPERAND_S6 :
2202*3d8817e4Smiod       fields->f_s6 = value;
2203*3d8817e4Smiod       break;
2204*3d8817e4Smiod     case FRV_OPERAND_S6_1 :
2205*3d8817e4Smiod       fields->f_s6_1 = value;
2206*3d8817e4Smiod       break;
2207*3d8817e4Smiod     case FRV_OPERAND_SLO16 :
2208*3d8817e4Smiod       fields->f_s16 = value;
2209*3d8817e4Smiod       break;
2210*3d8817e4Smiod     case FRV_OPERAND_SPR :
2211*3d8817e4Smiod       fields->f_spr = value;
2212*3d8817e4Smiod       break;
2213*3d8817e4Smiod     case FRV_OPERAND_U12 :
2214*3d8817e4Smiod       fields->f_u12 = value;
2215*3d8817e4Smiod       break;
2216*3d8817e4Smiod     case FRV_OPERAND_U16 :
2217*3d8817e4Smiod       fields->f_u16 = value;
2218*3d8817e4Smiod       break;
2219*3d8817e4Smiod     case FRV_OPERAND_U6 :
2220*3d8817e4Smiod       fields->f_u6 = value;
2221*3d8817e4Smiod       break;
2222*3d8817e4Smiod     case FRV_OPERAND_UHI16 :
2223*3d8817e4Smiod       fields->f_u16 = value;
2224*3d8817e4Smiod       break;
2225*3d8817e4Smiod     case FRV_OPERAND_ULO16 :
2226*3d8817e4Smiod       fields->f_u16 = value;
2227*3d8817e4Smiod       break;
2228*3d8817e4Smiod 
2229*3d8817e4Smiod     default :
2230*3d8817e4Smiod       /* xgettext:c-format */
2231*3d8817e4Smiod       fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),
2232*3d8817e4Smiod 		       opindex);
2233*3d8817e4Smiod       abort ();
2234*3d8817e4Smiod   }
2235*3d8817e4Smiod }
2236*3d8817e4Smiod 
2237*3d8817e4Smiod /* Function to call before using the instruction builder tables.  */
2238*3d8817e4Smiod 
2239*3d8817e4Smiod void
frv_cgen_init_ibld_table(CGEN_CPU_DESC cd)2240*3d8817e4Smiod frv_cgen_init_ibld_table (CGEN_CPU_DESC cd)
2241*3d8817e4Smiod {
2242*3d8817e4Smiod   cd->insert_handlers = & frv_cgen_insert_handlers[0];
2243*3d8817e4Smiod   cd->extract_handlers = & frv_cgen_extract_handlers[0];
2244*3d8817e4Smiod 
2245*3d8817e4Smiod   cd->insert_operand = frv_cgen_insert_operand;
2246*3d8817e4Smiod   cd->extract_operand = frv_cgen_extract_operand;
2247*3d8817e4Smiod 
2248*3d8817e4Smiod   cd->get_int_operand = frv_cgen_get_int_operand;
2249*3d8817e4Smiod   cd->set_int_operand = frv_cgen_set_int_operand;
2250*3d8817e4Smiod   cd->get_vma_operand = frv_cgen_get_vma_operand;
2251*3d8817e4Smiod   cd->set_vma_operand = frv_cgen_set_vma_operand;
2252*3d8817e4Smiod }
2253