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