Back to index

cell-binutils  2.17cvs20070401
mep-ibld.c
Go to the documentation of this file.
00001 /* Instruction building/extraction support for mep. -*- C -*-
00002 
00003    THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator.
00004    - the resultant file is machine generated, cgen-ibld.in isn't
00005 
00006    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2006
00007    Free Software Foundation, Inc.
00008 
00009    This file is part of the GNU Binutils and GDB, the GNU debugger.
00010 
00011    This program is free software; you can redistribute it and/or modify
00012    it under the terms of the GNU General Public License as published by
00013    the Free Software Foundation; either version 2, or (at your option)
00014    any later version.
00015 
00016    This program is distributed in the hope that it will be useful,
00017    but WITHOUT ANY WARRANTY; without even the implied warranty of
00018    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019    GNU General Public License for more details.
00020 
00021    You should have received a copy of the GNU General Public License
00022    along with this program; if not, write to the Free Software Foundation, Inc.,
00023    51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00024 
00025 /* ??? Eventually more and more of this stuff can go to cpu-independent files.
00026    Keep that in mind.  */
00027 
00028 #include "sysdep.h"
00029 #include <stdio.h>
00030 #include "ansidecl.h"
00031 #include "dis-asm.h"
00032 #include "bfd.h"
00033 #include "symcat.h"
00034 #include "mep-desc.h"
00035 #include "mep-opc.h"
00036 #include "opintl.h"
00037 #include "safe-ctype.h"
00038 
00039 #undef  min
00040 #define min(a,b) ((a) < (b) ? (a) : (b))
00041 #undef  max
00042 #define max(a,b) ((a) > (b) ? (a) : (b))
00043 
00044 /* Used by the ifield rtx function.  */
00045 #define FLD(f) (fields->f)
00046 
00047 static const char * insert_normal
00048   (CGEN_CPU_DESC, long, unsigned int, unsigned int, unsigned int,
00049    unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR);
00050 static const char * insert_insn_normal
00051   (CGEN_CPU_DESC, const CGEN_INSN *,
00052    CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma);
00053 static int extract_normal
00054   (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, CGEN_INSN_INT,
00055    unsigned int, unsigned int, unsigned int, unsigned int,
00056    unsigned int, unsigned int, bfd_vma, long *);
00057 static int extract_insn_normal
00058   (CGEN_CPU_DESC, const CGEN_INSN *, CGEN_EXTRACT_INFO *,
00059    CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma);
00060 #if CGEN_INT_INSN_P
00061 static void put_insn_int_value
00062   (CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT);
00063 #endif
00064 #if ! CGEN_INT_INSN_P
00065 static CGEN_INLINE void insert_1
00066   (CGEN_CPU_DESC, unsigned long, int, int, int, unsigned char *);
00067 static CGEN_INLINE int fill_cache
00068   (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *,  int, int, bfd_vma);
00069 static CGEN_INLINE long extract_1
00070   (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, int, unsigned char *, bfd_vma);
00071 #endif
00072 
00073 /* Operand insertion.  */
00074 
00075 #if ! CGEN_INT_INSN_P
00076 
00077 /* Subroutine of insert_normal.  */
00078 
00079 static CGEN_INLINE void
00080 insert_1 (CGEN_CPU_DESC cd,
00081          unsigned long value,
00082          int start,
00083          int length,
00084          int word_length,
00085          unsigned char *bufp)
00086 {
00087   unsigned long x,mask;
00088   int shift;
00089 
00090   x = cgen_get_insn_value (cd, bufp, word_length);
00091 
00092   /* Written this way to avoid undefined behaviour.  */
00093   mask = (((1L << (length - 1)) - 1) << 1) | 1;
00094   if (CGEN_INSN_LSB0_P)
00095     shift = (start + 1) - length;
00096   else
00097     shift = (word_length - (start + length));
00098   x = (x & ~(mask << shift)) | ((value & mask) << shift);
00099 
00100   cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x);
00101 }
00102 
00103 #endif /* ! CGEN_INT_INSN_P */
00104 
00105 /* Default insertion routine.
00106 
00107    ATTRS is a mask of the boolean attributes.
00108    WORD_OFFSET is the offset in bits from the start of the insn of the value.
00109    WORD_LENGTH is the length of the word in bits in which the value resides.
00110    START is the starting bit number in the word, architecture origin.
00111    LENGTH is the length of VALUE in bits.
00112    TOTAL_LENGTH is the total length of the insn in bits.
00113 
00114    The result is an error message or NULL if success.  */
00115 
00116 /* ??? This duplicates functionality with bfd's howto table and
00117    bfd_install_relocation.  */
00118 /* ??? This doesn't handle bfd_vma's.  Create another function when
00119    necessary.  */
00120 
00121 static const char *
00122 insert_normal (CGEN_CPU_DESC cd,
00123               long value,
00124               unsigned int attrs,
00125               unsigned int word_offset,
00126               unsigned int start,
00127               unsigned int length,
00128               unsigned int word_length,
00129               unsigned int total_length,
00130               CGEN_INSN_BYTES_PTR buffer)
00131 {
00132   static char errbuf[100];
00133   /* Written this way to avoid undefined behaviour.  */
00134   unsigned long mask = (((1L << (length - 1)) - 1) << 1) | 1;
00135 
00136   /* If LENGTH is zero, this operand doesn't contribute to the value.  */
00137   if (length == 0)
00138     return NULL;
00139 
00140   if (word_length > 32)
00141     abort ();
00142 
00143   /* For architectures with insns smaller than the base-insn-bitsize,
00144      word_length may be too big.  */
00145   if (cd->min_insn_bitsize < cd->base_insn_bitsize)
00146     {
00147       if (word_offset == 0
00148          && word_length > total_length)
00149        word_length = total_length;
00150     }
00151 
00152   /* Ensure VALUE will fit.  */
00153   if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGN_OPT))
00154     {
00155       long minval = - (1L << (length - 1));
00156       unsigned long maxval = mask;
00157       
00158       if ((value > 0 && (unsigned long) value > maxval)
00159          || value < minval)
00160        {
00161          /* xgettext:c-format */
00162          sprintf (errbuf,
00163                  _("operand out of range (%ld not between %ld and %lu)"),
00164                  value, minval, maxval);
00165          return errbuf;
00166        }
00167     }
00168   else if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED))
00169     {
00170       unsigned long maxval = mask;
00171       unsigned long val = (unsigned long) value;
00172 
00173       /* For hosts with a word size > 32 check to see if value has been sign
00174         extended beyond 32 bits.  If so then ignore these higher sign bits
00175         as the user is attempting to store a 32-bit signed value into an
00176         unsigned 32-bit field which is allowed.  */
00177       if (sizeof (unsigned long) > 4 && ((value >> 32) == -1))
00178        val &= 0xFFFFFFFF;
00179 
00180       if (val > maxval)
00181        {
00182          /* xgettext:c-format */
00183          sprintf (errbuf,
00184                  _("operand out of range (0x%lx not between 0 and 0x%lx)"),
00185                  val, maxval);
00186          return errbuf;
00187        }
00188     }
00189   else
00190     {
00191       if (! cgen_signed_overflow_ok_p (cd))
00192        {
00193          long minval = - (1L << (length - 1));
00194          long maxval =   (1L << (length - 1)) - 1;
00195          
00196          if (value < minval || value > maxval)
00197            {
00198              sprintf
00199               /* xgettext:c-format */
00200               (errbuf, _("operand out of range (%ld not between %ld and %ld)"),
00201                value, minval, maxval);
00202              return errbuf;
00203            }
00204        }
00205     }
00206 
00207 #if CGEN_INT_INSN_P
00208 
00209   {
00210     int shift;
00211 
00212     if (CGEN_INSN_LSB0_P)
00213       shift = (word_offset + start + 1) - length;
00214     else
00215       shift = total_length - (word_offset + start + length);
00216     *buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
00217   }
00218 
00219 #else /* ! CGEN_INT_INSN_P */
00220 
00221   {
00222     unsigned char *bufp = (unsigned char *) buffer + word_offset / 8;
00223 
00224     insert_1 (cd, value, start, length, word_length, bufp);
00225   }
00226 
00227 #endif /* ! CGEN_INT_INSN_P */
00228 
00229   return NULL;
00230 }
00231 
00232 /* Default insn builder (insert handler).
00233    The instruction is recorded in CGEN_INT_INSN_P byte order (meaning
00234    that if CGEN_INSN_BYTES_PTR is an int * and thus, the value is
00235    recorded in host byte order, otherwise BUFFER is an array of bytes
00236    and the value is recorded in target byte order).
00237    The result is an error message or NULL if success.  */
00238 
00239 static const char *
00240 insert_insn_normal (CGEN_CPU_DESC cd,
00241                   const CGEN_INSN * insn,
00242                   CGEN_FIELDS * fields,
00243                   CGEN_INSN_BYTES_PTR buffer,
00244                   bfd_vma pc)
00245 {
00246   const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
00247   unsigned long value;
00248   const CGEN_SYNTAX_CHAR_TYPE * syn;
00249 
00250   CGEN_INIT_INSERT (cd);
00251   value = CGEN_INSN_BASE_VALUE (insn);
00252 
00253   /* If we're recording insns as numbers (rather than a string of bytes),
00254      target byte order handling is deferred until later.  */
00255 
00256 #if CGEN_INT_INSN_P
00257 
00258   put_insn_int_value (cd, buffer, cd->base_insn_bitsize,
00259                     CGEN_FIELDS_BITSIZE (fields), value);
00260 
00261 #else
00262 
00263   cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize,
00264                                    (unsigned) CGEN_FIELDS_BITSIZE (fields)),
00265                      value);
00266 
00267 #endif /* ! CGEN_INT_INSN_P */
00268 
00269   /* ??? It would be better to scan the format's fields.
00270      Still need to be able to insert a value based on the operand though;
00271      e.g. storing a branch displacement that got resolved later.
00272      Needs more thought first.  */
00273 
00274   for (syn = CGEN_SYNTAX_STRING (syntax); * syn; ++ syn)
00275     {
00276       const char *errmsg;
00277 
00278       if (CGEN_SYNTAX_CHAR_P (* syn))
00279        continue;
00280 
00281       errmsg = (* cd->insert_operand) (cd, CGEN_SYNTAX_FIELD (*syn),
00282                                    fields, buffer, pc);
00283       if (errmsg)
00284        return errmsg;
00285     }
00286 
00287   return NULL;
00288 }
00289 
00290 #if CGEN_INT_INSN_P
00291 /* Cover function to store an insn value into an integral insn.  Must go here
00292    because it needs <prefix>-desc.h for CGEN_INT_INSN_P.  */
00293 
00294 static void
00295 put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
00296                   CGEN_INSN_BYTES_PTR buf,
00297                   int length,
00298                   int insn_length,
00299                   CGEN_INSN_INT value)
00300 {
00301   /* For architectures with insns smaller than the base-insn-bitsize,
00302      length may be too big.  */
00303   if (length > insn_length)
00304     *buf = value;
00305   else
00306     {
00307       int shift = insn_length - length;
00308       /* Written this way to avoid undefined behaviour.  */
00309       CGEN_INSN_INT mask = (((1L << (length - 1)) - 1) << 1) | 1;
00310 
00311       *buf = (*buf & ~(mask << shift)) | ((value & mask) << shift);
00312     }
00313 }
00314 #endif
00315 
00316 /* Operand extraction.  */
00317 
00318 #if ! CGEN_INT_INSN_P
00319 
00320 /* Subroutine of extract_normal.
00321    Ensure sufficient bytes are cached in EX_INFO.
00322    OFFSET is the offset in bytes from the start of the insn of the value.
00323    BYTES is the length of the needed value.
00324    Returns 1 for success, 0 for failure.  */
00325 
00326 static CGEN_INLINE int
00327 fill_cache (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
00328            CGEN_EXTRACT_INFO *ex_info,
00329            int offset,
00330            int bytes,
00331            bfd_vma pc)
00332 {
00333   /* It's doubtful that the middle part has already been fetched so
00334      we don't optimize that case.  kiss.  */
00335   unsigned int mask;
00336   disassemble_info *info = (disassemble_info *) ex_info->dis_info;
00337 
00338   /* First do a quick check.  */
00339   mask = (1 << bytes) - 1;
00340   if (((ex_info->valid >> offset) & mask) == mask)
00341     return 1;
00342 
00343   /* Search for the first byte we need to read.  */
00344   for (mask = 1 << offset; bytes > 0; --bytes, ++offset, mask <<= 1)
00345     if (! (mask & ex_info->valid))
00346       break;
00347 
00348   if (bytes)
00349     {
00350       int status;
00351 
00352       pc += offset;
00353       status = (*info->read_memory_func)
00354        (pc, ex_info->insn_bytes + offset, bytes, info);
00355 
00356       if (status != 0)
00357        {
00358          (*info->memory_error_func) (status, pc, info);
00359          return 0;
00360        }
00361 
00362       ex_info->valid |= ((1 << bytes) - 1) << offset;
00363     }
00364 
00365   return 1;
00366 }
00367 
00368 /* Subroutine of extract_normal.  */
00369 
00370 static CGEN_INLINE long
00371 extract_1 (CGEN_CPU_DESC cd,
00372           CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED,
00373           int start,
00374           int length,
00375           int word_length,
00376           unsigned char *bufp,
00377           bfd_vma pc ATTRIBUTE_UNUSED)
00378 {
00379   unsigned long x;
00380   int shift;
00381 
00382   x = cgen_get_insn_value (cd, bufp, word_length);
00383 
00384   if (CGEN_INSN_LSB0_P)
00385     shift = (start + 1) - length;
00386   else
00387     shift = (word_length - (start + length));
00388   return x >> shift;
00389 }
00390 
00391 #endif /* ! CGEN_INT_INSN_P */
00392 
00393 /* Default extraction routine.
00394 
00395    INSN_VALUE is the first base_insn_bitsize bits of the insn in host order,
00396    or sometimes less for cases like the m32r where the base insn size is 32
00397    but some insns are 16 bits.
00398    ATTRS is a mask of the boolean attributes.  We only need `SIGNED',
00399    but for generality we take a bitmask of all of them.
00400    WORD_OFFSET is the offset in bits from the start of the insn of the value.
00401    WORD_LENGTH is the length of the word in bits in which the value resides.
00402    START is the starting bit number in the word, architecture origin.
00403    LENGTH is the length of VALUE in bits.
00404    TOTAL_LENGTH is the total length of the insn in bits.
00405 
00406    Returns 1 for success, 0 for failure.  */
00407 
00408 /* ??? The return code isn't properly used.  wip.  */
00409 
00410 /* ??? This doesn't handle bfd_vma's.  Create another function when
00411    necessary.  */
00412 
00413 static int
00414 extract_normal (CGEN_CPU_DESC cd,
00415 #if ! CGEN_INT_INSN_P
00416               CGEN_EXTRACT_INFO *ex_info,
00417 #else
00418               CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED,
00419 #endif
00420               CGEN_INSN_INT insn_value,
00421               unsigned int attrs,
00422               unsigned int word_offset,
00423               unsigned int start,
00424               unsigned int length,
00425               unsigned int word_length,
00426               unsigned int total_length,
00427 #if ! CGEN_INT_INSN_P
00428               bfd_vma pc,
00429 #else
00430               bfd_vma pc ATTRIBUTE_UNUSED,
00431 #endif
00432               long *valuep)
00433 {
00434   long value, mask;
00435 
00436   /* If LENGTH is zero, this operand doesn't contribute to the value
00437      so give it a standard value of zero.  */
00438   if (length == 0)
00439     {
00440       *valuep = 0;
00441       return 1;
00442     }
00443 
00444   if (word_length > 32)
00445     abort ();
00446 
00447   /* For architectures with insns smaller than the insn-base-bitsize,
00448      word_length may be too big.  */
00449   if (cd->min_insn_bitsize < cd->base_insn_bitsize)
00450     {
00451       if (word_offset + word_length > total_length)
00452        word_length = total_length - word_offset;
00453     }
00454 
00455   /* Does the value reside in INSN_VALUE, and at the right alignment?  */
00456 
00457   if (CGEN_INT_INSN_P || (word_offset == 0 && word_length == total_length))
00458     {
00459       if (CGEN_INSN_LSB0_P)
00460        value = insn_value >> ((word_offset + start + 1) - length);
00461       else
00462        value = insn_value >> (total_length - ( word_offset + start + length));
00463     }
00464 
00465 #if ! CGEN_INT_INSN_P
00466 
00467   else
00468     {
00469       unsigned char *bufp = ex_info->insn_bytes + word_offset / 8;
00470 
00471       if (word_length > 32)
00472        abort ();
00473 
00474       if (fill_cache (cd, ex_info, word_offset / 8, word_length / 8, pc) == 0)
00475        return 0;
00476 
00477       value = extract_1 (cd, ex_info, start, length, word_length, bufp, pc);
00478     }
00479 
00480 #endif /* ! CGEN_INT_INSN_P */
00481 
00482   /* Written this way to avoid undefined behaviour.  */
00483   mask = (((1L << (length - 1)) - 1) << 1) | 1;
00484 
00485   value &= mask;
00486   /* sign extend? */
00487   if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)
00488       && (value & (1L << (length - 1))))
00489     value |= ~mask;
00490 
00491   *valuep = value;
00492 
00493   return 1;
00494 }
00495 
00496 /* Default insn extractor.
00497 
00498    INSN_VALUE is the first base_insn_bitsize bits, translated to host order.
00499    The extracted fields are stored in FIELDS.
00500    EX_INFO is used to handle reading variable length insns.
00501    Return the length of the insn in bits, or 0 if no match,
00502    or -1 if an error occurs fetching data (memory_error_func will have
00503    been called).  */
00504 
00505 static int
00506 extract_insn_normal (CGEN_CPU_DESC cd,
00507                    const CGEN_INSN *insn,
00508                    CGEN_EXTRACT_INFO *ex_info,
00509                    CGEN_INSN_INT insn_value,
00510                    CGEN_FIELDS *fields,
00511                    bfd_vma pc)
00512 {
00513   const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
00514   const CGEN_SYNTAX_CHAR_TYPE *syn;
00515 
00516   CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
00517 
00518   CGEN_INIT_EXTRACT (cd);
00519 
00520   for (syn = CGEN_SYNTAX_STRING (syntax); *syn; ++syn)
00521     {
00522       int length;
00523 
00524       if (CGEN_SYNTAX_CHAR_P (*syn))
00525        continue;
00526 
00527       length = (* cd->extract_operand) (cd, CGEN_SYNTAX_FIELD (*syn),
00528                                    ex_info, insn_value, fields, pc);
00529       if (length <= 0)
00530        return length;
00531     }
00532 
00533   /* We recognized and successfully extracted this insn.  */
00534   return CGEN_INSN_BITSIZE (insn);
00535 }
00536 
00537 /* Machine generated code added here.  */
00538 
00539 const char * mep_cgen_insert_operand
00540   (CGEN_CPU_DESC, int, CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma);
00541 
00542 /* Main entry point for operand insertion.
00543 
00544    This function is basically just a big switch statement.  Earlier versions
00545    used tables to look up the function to use, but
00546    - if the table contains both assembler and disassembler functions then
00547      the disassembler contains much of the assembler and vice-versa,
00548    - there's a lot of inlining possibilities as things grow,
00549    - using a switch statement avoids the function call overhead.
00550 
00551    This function could be moved into `parse_insn_normal', but keeping it
00552    separate makes clear the interface between `parse_insn_normal' and each of
00553    the handlers.  It's also needed by GAS to insert operands that couldn't be
00554    resolved during parsing.  */
00555 
00556 const char *
00557 mep_cgen_insert_operand (CGEN_CPU_DESC cd,
00558                           int opindex,
00559                           CGEN_FIELDS * fields,
00560                           CGEN_INSN_BYTES_PTR buffer,
00561                           bfd_vma pc ATTRIBUTE_UNUSED)
00562 {
00563   const char * errmsg = NULL;
00564   unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);
00565 
00566   switch (opindex)
00567     {
00568     case MEP_OPERAND_ADDR24A4 :
00569       {
00570 {
00571   FLD (f_24u8a4n_hi) = ((unsigned int) (FLD (f_24u8a4n)) >> (8));
00572   FLD (f_24u8a4n_lo) = ((unsigned int) (((FLD (f_24u8a4n)) & (252))) >> (2));
00573 }
00574         errmsg = insert_normal (cd, fields->f_24u8a4n_hi, 0, 0, 16, 16, 32, total_length, buffer);
00575         if (errmsg)
00576           break;
00577         errmsg = insert_normal (cd, fields->f_24u8a4n_lo, 0, 0, 8, 6, 32, total_length, buffer);
00578         if (errmsg)
00579           break;
00580       }
00581       break;
00582     case MEP_OPERAND_CALLNUM :
00583       {
00584 {
00585   FLD (f_5) = ((((unsigned int) (FLD (f_callnum)) >> (3))) & (1));
00586   FLD (f_6) = ((((unsigned int) (FLD (f_callnum)) >> (2))) & (1));
00587   FLD (f_7) = ((((unsigned int) (FLD (f_callnum)) >> (1))) & (1));
00588   FLD (f_11) = ((FLD (f_callnum)) & (1));
00589 }
00590         errmsg = insert_normal (cd, fields->f_5, 0, 0, 5, 1, 32, total_length, buffer);
00591         if (errmsg)
00592           break;
00593         errmsg = insert_normal (cd, fields->f_6, 0, 0, 6, 1, 32, total_length, buffer);
00594         if (errmsg)
00595           break;
00596         errmsg = insert_normal (cd, fields->f_7, 0, 0, 7, 1, 32, total_length, buffer);
00597         if (errmsg)
00598           break;
00599         errmsg = insert_normal (cd, fields->f_11, 0, 0, 11, 1, 32, total_length, buffer);
00600         if (errmsg)
00601           break;
00602       }
00603       break;
00604     case MEP_OPERAND_CCCC :
00605       errmsg = insert_normal (cd, fields->f_rm, 0, 0, 8, 4, 32, total_length, buffer);
00606       break;
00607     case MEP_OPERAND_CCRN :
00608       {
00609 {
00610   FLD (f_ccrn_hi) = ((((unsigned int) (FLD (f_ccrn)) >> (4))) & (3));
00611   FLD (f_ccrn_lo) = ((FLD (f_ccrn)) & (15));
00612 }
00613         errmsg = insert_normal (cd, fields->f_ccrn_hi, 0, 0, 28, 2, 32, total_length, buffer);
00614         if (errmsg)
00615           break;
00616         errmsg = insert_normal (cd, fields->f_ccrn_lo, 0, 0, 4, 4, 32, total_length, buffer);
00617         if (errmsg)
00618           break;
00619       }
00620       break;
00621     case MEP_OPERAND_CDISP8 :
00622       errmsg = insert_normal (cd, fields->f_8s24, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 8, 32, total_length, buffer);
00623       break;
00624     case MEP_OPERAND_CDISP8A2 :
00625       {
00626         long value = fields->f_8s24a2;
00627         value = ((int) (value) >> (1));
00628         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 7, 32, total_length, buffer);
00629       }
00630       break;
00631     case MEP_OPERAND_CDISP8A4 :
00632       {
00633         long value = fields->f_8s24a4;
00634         value = ((int) (value) >> (2));
00635         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 6, 32, total_length, buffer);
00636       }
00637       break;
00638     case MEP_OPERAND_CDISP8A8 :
00639       {
00640         long value = fields->f_8s24a8;
00641         value = ((int) (value) >> (3));
00642         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 5, 32, total_length, buffer);
00643       }
00644       break;
00645     case MEP_OPERAND_CIMM4 :
00646       errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
00647       break;
00648     case MEP_OPERAND_CIMM5 :
00649       errmsg = insert_normal (cd, fields->f_5u24, 0, 0, 24, 5, 32, total_length, buffer);
00650       break;
00651     case MEP_OPERAND_CODE16 :
00652       errmsg = insert_normal (cd, fields->f_16u16, 0, 0, 16, 16, 32, total_length, buffer);
00653       break;
00654     case MEP_OPERAND_CODE24 :
00655       {
00656 {
00657   FLD (f_24u4n_hi) = ((unsigned int) (FLD (f_24u4n)) >> (16));
00658   FLD (f_24u4n_lo) = ((FLD (f_24u4n)) & (65535));
00659 }
00660         errmsg = insert_normal (cd, fields->f_24u4n_hi, 0, 0, 4, 8, 32, total_length, buffer);
00661         if (errmsg)
00662           break;
00663         errmsg = insert_normal (cd, fields->f_24u4n_lo, 0, 0, 16, 16, 32, total_length, buffer);
00664         if (errmsg)
00665           break;
00666       }
00667       break;
00668     case MEP_OPERAND_CP_FLAG :
00669       break;
00670     case MEP_OPERAND_CRN :
00671       errmsg = insert_normal (cd, fields->f_crn, 0, 0, 4, 4, 32, total_length, buffer);
00672       break;
00673     case MEP_OPERAND_CRN64 :
00674       errmsg = insert_normal (cd, fields->f_crn, 0, 0, 4, 4, 32, total_length, buffer);
00675       break;
00676     case MEP_OPERAND_CRNX :
00677       {
00678 {
00679   FLD (f_crnx_lo) = ((FLD (f_crnx)) & (15));
00680   FLD (f_crnx_hi) = ((unsigned int) (FLD (f_crnx)) >> (4));
00681 }
00682         errmsg = insert_normal (cd, fields->f_crnx_hi, 0, 0, 28, 1, 32, total_length, buffer);
00683         if (errmsg)
00684           break;
00685         errmsg = insert_normal (cd, fields->f_crnx_lo, 0, 0, 4, 4, 32, total_length, buffer);
00686         if (errmsg)
00687           break;
00688       }
00689       break;
00690     case MEP_OPERAND_CRNX64 :
00691       {
00692 {
00693   FLD (f_crnx_lo) = ((FLD (f_crnx)) & (15));
00694   FLD (f_crnx_hi) = ((unsigned int) (FLD (f_crnx)) >> (4));
00695 }
00696         errmsg = insert_normal (cd, fields->f_crnx_hi, 0, 0, 28, 1, 32, total_length, buffer);
00697         if (errmsg)
00698           break;
00699         errmsg = insert_normal (cd, fields->f_crnx_lo, 0, 0, 4, 4, 32, total_length, buffer);
00700         if (errmsg)
00701           break;
00702       }
00703       break;
00704     case MEP_OPERAND_CSRN :
00705       {
00706 {
00707   FLD (f_csrn_lo) = ((FLD (f_csrn)) & (15));
00708   FLD (f_csrn_hi) = ((unsigned int) (FLD (f_csrn)) >> (4));
00709 }
00710         errmsg = insert_normal (cd, fields->f_csrn_hi, 0, 0, 15, 1, 32, total_length, buffer);
00711         if (errmsg)
00712           break;
00713         errmsg = insert_normal (cd, fields->f_csrn_lo, 0, 0, 8, 4, 32, total_length, buffer);
00714         if (errmsg)
00715           break;
00716       }
00717       break;
00718     case MEP_OPERAND_CSRN_IDX :
00719       {
00720 {
00721   FLD (f_csrn_lo) = ((FLD (f_csrn)) & (15));
00722   FLD (f_csrn_hi) = ((unsigned int) (FLD (f_csrn)) >> (4));
00723 }
00724         errmsg = insert_normal (cd, fields->f_csrn_hi, 0, 0, 15, 1, 32, total_length, buffer);
00725         if (errmsg)
00726           break;
00727         errmsg = insert_normal (cd, fields->f_csrn_lo, 0, 0, 8, 4, 32, total_length, buffer);
00728         if (errmsg)
00729           break;
00730       }
00731       break;
00732     case MEP_OPERAND_DBG :
00733       break;
00734     case MEP_OPERAND_DEPC :
00735       break;
00736     case MEP_OPERAND_EPC :
00737       break;
00738     case MEP_OPERAND_EXC :
00739       break;
00740     case MEP_OPERAND_FMAX_CCRN :
00741       errmsg = insert_normal (cd, fields->f_fmax_4_4, 0, 0, 4, 4, 32, total_length, buffer);
00742       break;
00743     case MEP_OPERAND_FMAX_FRD :
00744       {
00745 {
00746   FLD (f_fmax_4_4) = ((FLD (f_fmax_frd)) & (15));
00747   FLD (f_fmax_28_1) = ((unsigned int) (FLD (f_fmax_frd)) >> (4));
00748 }
00749         errmsg = insert_normal (cd, fields->f_fmax_28_1, 0, 0, 28, 1, 32, total_length, buffer);
00750         if (errmsg)
00751           break;
00752         errmsg = insert_normal (cd, fields->f_fmax_4_4, 0, 0, 4, 4, 32, total_length, buffer);
00753         if (errmsg)
00754           break;
00755       }
00756       break;
00757     case MEP_OPERAND_FMAX_FRD_INT :
00758       {
00759 {
00760   FLD (f_fmax_4_4) = ((FLD (f_fmax_frd)) & (15));
00761   FLD (f_fmax_28_1) = ((unsigned int) (FLD (f_fmax_frd)) >> (4));
00762 }
00763         errmsg = insert_normal (cd, fields->f_fmax_28_1, 0, 0, 28, 1, 32, total_length, buffer);
00764         if (errmsg)
00765           break;
00766         errmsg = insert_normal (cd, fields->f_fmax_4_4, 0, 0, 4, 4, 32, total_length, buffer);
00767         if (errmsg)
00768           break;
00769       }
00770       break;
00771     case MEP_OPERAND_FMAX_FRM :
00772       {
00773 {
00774   FLD (f_fmax_24_4) = ((FLD (f_fmax_frm)) & (15));
00775   FLD (f_fmax_30_1) = ((unsigned int) (FLD (f_fmax_frm)) >> (4));
00776 }
00777         errmsg = insert_normal (cd, fields->f_fmax_30_1, 0, 0, 30, 1, 32, total_length, buffer);
00778         if (errmsg)
00779           break;
00780         errmsg = insert_normal (cd, fields->f_fmax_24_4, 0, 0, 24, 4, 32, total_length, buffer);
00781         if (errmsg)
00782           break;
00783       }
00784       break;
00785     case MEP_OPERAND_FMAX_FRN :
00786       {
00787 {
00788   FLD (f_fmax_20_4) = ((FLD (f_fmax_frn)) & (15));
00789   FLD (f_fmax_29_1) = ((unsigned int) (FLD (f_fmax_frn)) >> (4));
00790 }
00791         errmsg = insert_normal (cd, fields->f_fmax_29_1, 0, 0, 29, 1, 32, total_length, buffer);
00792         if (errmsg)
00793           break;
00794         errmsg = insert_normal (cd, fields->f_fmax_20_4, 0, 0, 20, 4, 32, total_length, buffer);
00795         if (errmsg)
00796           break;
00797       }
00798       break;
00799     case MEP_OPERAND_FMAX_FRN_INT :
00800       {
00801 {
00802   FLD (f_fmax_20_4) = ((FLD (f_fmax_frn)) & (15));
00803   FLD (f_fmax_29_1) = ((unsigned int) (FLD (f_fmax_frn)) >> (4));
00804 }
00805         errmsg = insert_normal (cd, fields->f_fmax_29_1, 0, 0, 29, 1, 32, total_length, buffer);
00806         if (errmsg)
00807           break;
00808         errmsg = insert_normal (cd, fields->f_fmax_20_4, 0, 0, 20, 4, 32, total_length, buffer);
00809         if (errmsg)
00810           break;
00811       }
00812       break;
00813     case MEP_OPERAND_FMAX_RM :
00814       errmsg = insert_normal (cd, fields->f_fmax_rm, 0, 0, 8, 4, 32, total_length, buffer);
00815       break;
00816     case MEP_OPERAND_HI :
00817       break;
00818     case MEP_OPERAND_LO :
00819       break;
00820     case MEP_OPERAND_LP :
00821       break;
00822     case MEP_OPERAND_MB0 :
00823       break;
00824     case MEP_OPERAND_MB1 :
00825       break;
00826     case MEP_OPERAND_ME0 :
00827       break;
00828     case MEP_OPERAND_ME1 :
00829       break;
00830     case MEP_OPERAND_NPC :
00831       break;
00832     case MEP_OPERAND_OPT :
00833       break;
00834     case MEP_OPERAND_PCABS24A2 :
00835       {
00836 {
00837   FLD (f_24u5a2n_lo) = ((unsigned int) (((FLD (f_24u5a2n)) & (255))) >> (1));
00838   FLD (f_24u5a2n_hi) = ((unsigned int) (FLD (f_24u5a2n)) >> (8));
00839 }
00840         errmsg = insert_normal (cd, fields->f_24u5a2n_hi, 0, 0, 16, 16, 32, total_length, buffer);
00841         if (errmsg)
00842           break;
00843         errmsg = insert_normal (cd, fields->f_24u5a2n_lo, 0, 0, 5, 7, 32, total_length, buffer);
00844         if (errmsg)
00845           break;
00846       }
00847       break;
00848     case MEP_OPERAND_PCREL12A2 :
00849       {
00850         long value = fields->f_12s4a2;
00851         value = ((int) (((value) - (pc))) >> (1));
00852         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 4, 11, 32, total_length, buffer);
00853       }
00854       break;
00855     case MEP_OPERAND_PCREL17A2 :
00856       {
00857         long value = fields->f_17s16a2;
00858         value = ((int) (((value) - (pc))) >> (1));
00859         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 16, 16, 32, total_length, buffer);
00860       }
00861       break;
00862     case MEP_OPERAND_PCREL24A2 :
00863       {
00864 {
00865   FLD (f_24s5a2n) = ((FLD (f_24s5a2n)) - (pc));
00866   FLD (f_24s5a2n_lo) = ((unsigned int) (((FLD (f_24s5a2n)) & (254))) >> (1));
00867   FLD (f_24s5a2n_hi) = ((int) (FLD (f_24s5a2n)) >> (8));
00868 }
00869         errmsg = insert_normal (cd, fields->f_24s5a2n_hi, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 16, 16, 32, total_length, buffer);
00870         if (errmsg)
00871           break;
00872         errmsg = insert_normal (cd, fields->f_24s5a2n_lo, 0|(1<<CGEN_IFLD_PCREL_ADDR), 0, 5, 7, 32, total_length, buffer);
00873         if (errmsg)
00874           break;
00875       }
00876       break;
00877     case MEP_OPERAND_PCREL8A2 :
00878       {
00879         long value = fields->f_8s8a2;
00880         value = ((int) (((value) - (pc))) >> (1));
00881         errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 8, 7, 32, total_length, buffer);
00882       }
00883       break;
00884     case MEP_OPERAND_PSW :
00885       break;
00886     case MEP_OPERAND_R0 :
00887       break;
00888     case MEP_OPERAND_R1 :
00889       break;
00890     case MEP_OPERAND_RL :
00891       errmsg = insert_normal (cd, fields->f_rl, 0, 0, 12, 4, 32, total_length, buffer);
00892       break;
00893     case MEP_OPERAND_RM :
00894       errmsg = insert_normal (cd, fields->f_rm, 0, 0, 8, 4, 32, total_length, buffer);
00895       break;
00896     case MEP_OPERAND_RMA :
00897       errmsg = insert_normal (cd, fields->f_rm, 0, 0, 8, 4, 32, total_length, buffer);
00898       break;
00899     case MEP_OPERAND_RN :
00900       errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
00901       break;
00902     case MEP_OPERAND_RN3 :
00903       errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
00904       break;
00905     case MEP_OPERAND_RN3C :
00906       errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
00907       break;
00908     case MEP_OPERAND_RN3L :
00909       errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
00910       break;
00911     case MEP_OPERAND_RN3S :
00912       errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
00913       break;
00914     case MEP_OPERAND_RN3UC :
00915       errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
00916       break;
00917     case MEP_OPERAND_RN3UL :
00918       errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
00919       break;
00920     case MEP_OPERAND_RN3US :
00921       errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
00922       break;
00923     case MEP_OPERAND_RNC :
00924       errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
00925       break;
00926     case MEP_OPERAND_RNL :
00927       errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
00928       break;
00929     case MEP_OPERAND_RNS :
00930       errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
00931       break;
00932     case MEP_OPERAND_RNUC :
00933       errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
00934       break;
00935     case MEP_OPERAND_RNUL :
00936       errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
00937       break;
00938     case MEP_OPERAND_RNUS :
00939       errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
00940       break;
00941     case MEP_OPERAND_SAR :
00942       break;
00943     case MEP_OPERAND_SDISP16 :
00944       errmsg = insert_normal (cd, fields->f_16s16, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, buffer);
00945       break;
00946     case MEP_OPERAND_SIMM16 :
00947       errmsg = insert_normal (cd, fields->f_16s16, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, buffer);
00948       break;
00949     case MEP_OPERAND_SIMM6 :
00950       errmsg = insert_normal (cd, fields->f_6s8, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 6, 32, total_length, buffer);
00951       break;
00952     case MEP_OPERAND_SIMM8 :
00953       errmsg = insert_normal (cd, fields->f_8s8, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 8, 32, total_length, buffer);
00954       break;
00955     case MEP_OPERAND_SP :
00956       break;
00957     case MEP_OPERAND_SPR :
00958       break;
00959     case MEP_OPERAND_TP :
00960       break;
00961     case MEP_OPERAND_TPR :
00962       break;
00963     case MEP_OPERAND_UDISP2 :
00964       errmsg = insert_normal (cd, fields->f_2u6, 0, 0, 6, 2, 32, total_length, buffer);
00965       break;
00966     case MEP_OPERAND_UDISP7 :
00967       errmsg = insert_normal (cd, fields->f_7u9, 0, 0, 9, 7, 32, total_length, buffer);
00968       break;
00969     case MEP_OPERAND_UDISP7A2 :
00970       {
00971         long value = fields->f_7u9a2;
00972         value = ((unsigned int) (value) >> (1));
00973         errmsg = insert_normal (cd, value, 0, 0, 9, 6, 32, total_length, buffer);
00974       }
00975       break;
00976     case MEP_OPERAND_UDISP7A4 :
00977       {
00978         long value = fields->f_7u9a4;
00979         value = ((unsigned int) (value) >> (2));
00980         errmsg = insert_normal (cd, value, 0, 0, 9, 5, 32, total_length, buffer);
00981       }
00982       break;
00983     case MEP_OPERAND_UIMM16 :
00984       errmsg = insert_normal (cd, fields->f_16u16, 0, 0, 16, 16, 32, total_length, buffer);
00985       break;
00986     case MEP_OPERAND_UIMM2 :
00987       errmsg = insert_normal (cd, fields->f_2u10, 0, 0, 10, 2, 32, total_length, buffer);
00988       break;
00989     case MEP_OPERAND_UIMM24 :
00990       {
00991 {
00992   FLD (f_24u8n_hi) = ((unsigned int) (FLD (f_24u8n)) >> (8));
00993   FLD (f_24u8n_lo) = ((FLD (f_24u8n)) & (255));
00994 }
00995         errmsg = insert_normal (cd, fields->f_24u8n_hi, 0, 0, 16, 16, 32, total_length, buffer);
00996         if (errmsg)
00997           break;
00998         errmsg = insert_normal (cd, fields->f_24u8n_lo, 0, 0, 8, 8, 32, total_length, buffer);
00999         if (errmsg)
01000           break;
01001       }
01002       break;
01003     case MEP_OPERAND_UIMM3 :
01004       errmsg = insert_normal (cd, fields->f_3u5, 0, 0, 5, 3, 32, total_length, buffer);
01005       break;
01006     case MEP_OPERAND_UIMM4 :
01007       errmsg = insert_normal (cd, fields->f_4u8, 0, 0, 8, 4, 32, total_length, buffer);
01008       break;
01009     case MEP_OPERAND_UIMM5 :
01010       errmsg = insert_normal (cd, fields->f_5u8, 0, 0, 8, 5, 32, total_length, buffer);
01011       break;
01012     case MEP_OPERAND_UIMM7A4 :
01013       {
01014         long value = fields->f_7u9a4;
01015         value = ((unsigned int) (value) >> (2));
01016         errmsg = insert_normal (cd, value, 0, 0, 9, 5, 32, total_length, buffer);
01017       }
01018       break;
01019     case MEP_OPERAND_ZERO :
01020       break;
01021 
01022     default :
01023       /* xgettext:c-format */
01024       fprintf (stderr, _("Unrecognized field %d while building insn.\n"),
01025               opindex);
01026       abort ();
01027   }
01028 
01029   return errmsg;
01030 }
01031 
01032 int mep_cgen_extract_operand
01033   (CGEN_CPU_DESC, int, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma);
01034 
01035 /* Main entry point for operand extraction.
01036    The result is <= 0 for error, >0 for success.
01037    ??? Actual values aren't well defined right now.
01038 
01039    This function is basically just a big switch statement.  Earlier versions
01040    used tables to look up the function to use, but
01041    - if the table contains both assembler and disassembler functions then
01042      the disassembler contains much of the assembler and vice-versa,
01043    - there's a lot of inlining possibilities as things grow,
01044    - using a switch statement avoids the function call overhead.
01045 
01046    This function could be moved into `print_insn_normal', but keeping it
01047    separate makes clear the interface between `print_insn_normal' and each of
01048    the handlers.  */
01049 
01050 int
01051 mep_cgen_extract_operand (CGEN_CPU_DESC cd,
01052                           int opindex,
01053                           CGEN_EXTRACT_INFO *ex_info,
01054                           CGEN_INSN_INT insn_value,
01055                           CGEN_FIELDS * fields,
01056                           bfd_vma pc)
01057 {
01058   /* Assume success (for those operands that are nops).  */
01059   int length = 1;
01060   unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);
01061 
01062   switch (opindex)
01063     {
01064     case MEP_OPERAND_ADDR24A4 :
01065       {
01066         length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u8a4n_hi);
01067         if (length <= 0) break;
01068         length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 6, 32, total_length, pc, & fields->f_24u8a4n_lo);
01069         if (length <= 0) break;
01070   FLD (f_24u8a4n) = ((((FLD (f_24u8a4n_hi)) << (8))) | (((FLD (f_24u8a4n_lo)) << (2))));
01071       }
01072       break;
01073     case MEP_OPERAND_CALLNUM :
01074       {
01075         length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 1, 32, total_length, pc, & fields->f_5);
01076         if (length <= 0) break;
01077         length = extract_normal (cd, ex_info, insn_value, 0, 0, 6, 1, 32, total_length, pc, & fields->f_6);
01078         if (length <= 0) break;
01079         length = extract_normal (cd, ex_info, insn_value, 0, 0, 7, 1, 32, total_length, pc, & fields->f_7);
01080         if (length <= 0) break;
01081         length = extract_normal (cd, ex_info, insn_value, 0, 0, 11, 1, 32, total_length, pc, & fields->f_11);
01082         if (length <= 0) break;
01083   FLD (f_callnum) = ((((FLD (f_5)) << (3))) | (((((FLD (f_6)) << (2))) | (((((FLD (f_7)) << (1))) | (FLD (f_11)))))));
01084       }
01085       break;
01086     case MEP_OPERAND_CCCC :
01087       length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_rm);
01088       break;
01089     case MEP_OPERAND_CCRN :
01090       {
01091         length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 2, 32, total_length, pc, & fields->f_ccrn_hi);
01092         if (length <= 0) break;
01093         length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_ccrn_lo);
01094         if (length <= 0) break;
01095   FLD (f_ccrn) = ((((FLD (f_ccrn_hi)) << (4))) | (FLD (f_ccrn_lo)));
01096       }
01097       break;
01098     case MEP_OPERAND_CDISP8 :
01099       length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 8, 32, total_length, pc, & fields->f_8s24);
01100       break;
01101     case MEP_OPERAND_CDISP8A2 :
01102       {
01103         long value;
01104         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 7, 32, total_length, pc, & value);
01105         value = ((value) << (1));
01106         fields->f_8s24a2 = value;
01107       }
01108       break;
01109     case MEP_OPERAND_CDISP8A4 :
01110       {
01111         long value;
01112         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 6, 32, total_length, pc, & value);
01113         value = ((value) << (2));
01114         fields->f_8s24a4 = value;
01115       }
01116       break;
01117     case MEP_OPERAND_CDISP8A8 :
01118       {
01119         long value;
01120         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 24, 5, 32, total_length, pc, & value);
01121         value = ((value) << (3));
01122         fields->f_8s24a8 = value;
01123       }
01124       break;
01125     case MEP_OPERAND_CIMM4 :
01126       length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
01127       break;
01128     case MEP_OPERAND_CIMM5 :
01129       length = extract_normal (cd, ex_info, insn_value, 0, 0, 24, 5, 32, total_length, pc, & fields->f_5u24);
01130       break;
01131     case MEP_OPERAND_CODE16 :
01132       length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_16u16);
01133       break;
01134     case MEP_OPERAND_CODE24 :
01135       {
01136         length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 8, 32, total_length, pc, & fields->f_24u4n_hi);
01137         if (length <= 0) break;
01138         length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u4n_lo);
01139         if (length <= 0) break;
01140   FLD (f_24u4n) = ((((FLD (f_24u4n_hi)) << (16))) | (FLD (f_24u4n_lo)));
01141       }
01142       break;
01143     case MEP_OPERAND_CP_FLAG :
01144       break;
01145     case MEP_OPERAND_CRN :
01146       length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crn);
01147       break;
01148     case MEP_OPERAND_CRN64 :
01149       length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crn);
01150       break;
01151     case MEP_OPERAND_CRNX :
01152       {
01153         length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 1, 32, total_length, pc, & fields->f_crnx_hi);
01154         if (length <= 0) break;
01155         length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crnx_lo);
01156         if (length <= 0) break;
01157   FLD (f_crnx) = ((((FLD (f_crnx_hi)) << (4))) | (FLD (f_crnx_lo)));
01158       }
01159       break;
01160     case MEP_OPERAND_CRNX64 :
01161       {
01162         length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 1, 32, total_length, pc, & fields->f_crnx_hi);
01163         if (length <= 0) break;
01164         length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crnx_lo);
01165         if (length <= 0) break;
01166   FLD (f_crnx) = ((((FLD (f_crnx_hi)) << (4))) | (FLD (f_crnx_lo)));
01167       }
01168       break;
01169     case MEP_OPERAND_CSRN :
01170       {
01171         length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 1, 32, total_length, pc, & fields->f_csrn_hi);
01172         if (length <= 0) break;
01173         length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_csrn_lo);
01174         if (length <= 0) break;
01175   FLD (f_csrn) = ((((FLD (f_csrn_hi)) << (4))) | (FLD (f_csrn_lo)));
01176       }
01177       break;
01178     case MEP_OPERAND_CSRN_IDX :
01179       {
01180         length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 1, 32, total_length, pc, & fields->f_csrn_hi);
01181         if (length <= 0) break;
01182         length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_csrn_lo);
01183         if (length <= 0) break;
01184   FLD (f_csrn) = ((((FLD (f_csrn_hi)) << (4))) | (FLD (f_csrn_lo)));
01185       }
01186       break;
01187     case MEP_OPERAND_DBG :
01188       break;
01189     case MEP_OPERAND_DEPC :
01190       break;
01191     case MEP_OPERAND_EPC :
01192       break;
01193     case MEP_OPERAND_EXC :
01194       break;
01195     case MEP_OPERAND_FMAX_CCRN :
01196       length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_fmax_4_4);
01197       break;
01198     case MEP_OPERAND_FMAX_FRD :
01199       {
01200         length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 1, 32, total_length, pc, & fields->f_fmax_28_1);
01201         if (length <= 0) break;
01202         length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_fmax_4_4);
01203         if (length <= 0) break;
01204   FLD (f_fmax_frd) = ((((FLD (f_fmax_28_1)) << (4))) | (FLD (f_fmax_4_4)));
01205       }
01206       break;
01207     case MEP_OPERAND_FMAX_FRD_INT :
01208       {
01209         length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 1, 32, total_length, pc, & fields->f_fmax_28_1);
01210         if (length <= 0) break;
01211         length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_fmax_4_4);
01212         if (length <= 0) break;
01213   FLD (f_fmax_frd) = ((((FLD (f_fmax_28_1)) << (4))) | (FLD (f_fmax_4_4)));
01214       }
01215       break;
01216     case MEP_OPERAND_FMAX_FRM :
01217       {
01218         length = extract_normal (cd, ex_info, insn_value, 0, 0, 30, 1, 32, total_length, pc, & fields->f_fmax_30_1);
01219         if (length <= 0) break;
01220         length = extract_normal (cd, ex_info, insn_value, 0, 0, 24, 4, 32, total_length, pc, & fields->f_fmax_24_4);
01221         if (length <= 0) break;
01222   FLD (f_fmax_frm) = ((((FLD (f_fmax_30_1)) << (4))) | (FLD (f_fmax_24_4)));
01223       }
01224       break;
01225     case MEP_OPERAND_FMAX_FRN :
01226       {
01227         length = extract_normal (cd, ex_info, insn_value, 0, 0, 29, 1, 32, total_length, pc, & fields->f_fmax_29_1);
01228         if (length <= 0) break;
01229         length = extract_normal (cd, ex_info, insn_value, 0, 0, 20, 4, 32, total_length, pc, & fields->f_fmax_20_4);
01230         if (length <= 0) break;
01231   FLD (f_fmax_frn) = ((((FLD (f_fmax_29_1)) << (4))) | (FLD (f_fmax_20_4)));
01232       }
01233       break;
01234     case MEP_OPERAND_FMAX_FRN_INT :
01235       {
01236         length = extract_normal (cd, ex_info, insn_value, 0, 0, 29, 1, 32, total_length, pc, & fields->f_fmax_29_1);
01237         if (length <= 0) break;
01238         length = extract_normal (cd, ex_info, insn_value, 0, 0, 20, 4, 32, total_length, pc, & fields->f_fmax_20_4);
01239         if (length <= 0) break;
01240   FLD (f_fmax_frn) = ((((FLD (f_fmax_29_1)) << (4))) | (FLD (f_fmax_20_4)));
01241       }
01242       break;
01243     case MEP_OPERAND_FMAX_RM :
01244       length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_fmax_rm);
01245       break;
01246     case MEP_OPERAND_HI :
01247       break;
01248     case MEP_OPERAND_LO :
01249       break;
01250     case MEP_OPERAND_LP :
01251       break;
01252     case MEP_OPERAND_MB0 :
01253       break;
01254     case MEP_OPERAND_MB1 :
01255       break;
01256     case MEP_OPERAND_ME0 :
01257       break;
01258     case MEP_OPERAND_ME1 :
01259       break;
01260     case MEP_OPERAND_NPC :
01261       break;
01262     case MEP_OPERAND_OPT :
01263       break;
01264     case MEP_OPERAND_PCABS24A2 :
01265       {
01266         length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u5a2n_hi);
01267         if (length <= 0) break;
01268         length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 7, 32, total_length, pc, & fields->f_24u5a2n_lo);
01269         if (length <= 0) break;
01270   FLD (f_24u5a2n) = ((((FLD (f_24u5a2n_hi)) << (8))) | (((FLD (f_24u5a2n_lo)) << (1))));
01271       }
01272       break;
01273     case MEP_OPERAND_PCREL12A2 :
01274       {
01275         long value;
01276         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 4, 11, 32, total_length, pc, & value);
01277         value = ((((value) << (1))) + (pc));
01278         fields->f_12s4a2 = value;
01279       }
01280       break;
01281     case MEP_OPERAND_PCREL17A2 :
01282       {
01283         long value;
01284         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 16, 16, 32, total_length, pc, & value);
01285         value = ((((value) << (1))) + (pc));
01286         fields->f_17s16a2 = value;
01287       }
01288       break;
01289     case MEP_OPERAND_PCREL24A2 :
01290       {
01291         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 16, 16, 32, total_length, pc, & fields->f_24s5a2n_hi);
01292         if (length <= 0) break;
01293         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_PCREL_ADDR), 0, 5, 7, 32, total_length, pc, & fields->f_24s5a2n_lo);
01294         if (length <= 0) break;
01295   FLD (f_24s5a2n) = ((((((FLD (f_24s5a2n_hi)) << (8))) | (((FLD (f_24s5a2n_lo)) << (1))))) + (pc));
01296       }
01297       break;
01298     case MEP_OPERAND_PCREL8A2 :
01299       {
01300         long value;
01301         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 8, 7, 32, total_length, pc, & value);
01302         value = ((((value) << (1))) + (pc));
01303         fields->f_8s8a2 = value;
01304       }
01305       break;
01306     case MEP_OPERAND_PSW :
01307       break;
01308     case MEP_OPERAND_R0 :
01309       break;
01310     case MEP_OPERAND_R1 :
01311       break;
01312     case MEP_OPERAND_RL :
01313       length = extract_normal (cd, ex_info, insn_value, 0, 0, 12, 4, 32, total_length, pc, & fields->f_rl);
01314       break;
01315     case MEP_OPERAND_RM :
01316       length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_rm);
01317       break;
01318     case MEP_OPERAND_RMA :
01319       length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_rm);
01320       break;
01321     case MEP_OPERAND_RN :
01322       length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
01323       break;
01324     case MEP_OPERAND_RN3 :
01325       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
01326       break;
01327     case MEP_OPERAND_RN3C :
01328       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
01329       break;
01330     case MEP_OPERAND_RN3L :
01331       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
01332       break;
01333     case MEP_OPERAND_RN3S :
01334       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
01335       break;
01336     case MEP_OPERAND_RN3UC :
01337       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
01338       break;
01339     case MEP_OPERAND_RN3UL :
01340       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
01341       break;
01342     case MEP_OPERAND_RN3US :
01343       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
01344       break;
01345     case MEP_OPERAND_RNC :
01346       length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
01347       break;
01348     case MEP_OPERAND_RNL :
01349       length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
01350       break;
01351     case MEP_OPERAND_RNS :
01352       length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
01353       break;
01354     case MEP_OPERAND_RNUC :
01355       length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
01356       break;
01357     case MEP_OPERAND_RNUL :
01358       length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
01359       break;
01360     case MEP_OPERAND_RNUS :
01361       length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
01362       break;
01363     case MEP_OPERAND_SAR :
01364       break;
01365     case MEP_OPERAND_SDISP16 :
01366       length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & fields->f_16s16);
01367       break;
01368     case MEP_OPERAND_SIMM16 :
01369       length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & fields->f_16s16);
01370       break;
01371     case MEP_OPERAND_SIMM6 :
01372       length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 6, 32, total_length, pc, & fields->f_6s8);
01373       break;
01374     case MEP_OPERAND_SIMM8 :
01375       length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 8, 32, total_length, pc, & fields->f_8s8);
01376       break;
01377     case MEP_OPERAND_SP :
01378       break;
01379     case MEP_OPERAND_SPR :
01380       break;
01381     case MEP_OPERAND_TP :
01382       break;
01383     case MEP_OPERAND_TPR :
01384       break;
01385     case MEP_OPERAND_UDISP2 :
01386       length = extract_normal (cd, ex_info, insn_value, 0, 0, 6, 2, 32, total_length, pc, & fields->f_2u6);
01387       break;
01388     case MEP_OPERAND_UDISP7 :
01389       length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 7, 32, total_length, pc, & fields->f_7u9);
01390       break;
01391     case MEP_OPERAND_UDISP7A2 :
01392       {
01393         long value;
01394         length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 6, 32, total_length, pc, & value);
01395         value = ((value) << (1));
01396         fields->f_7u9a2 = value;
01397       }
01398       break;
01399     case MEP_OPERAND_UDISP7A4 :
01400       {
01401         long value;
01402         length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 5, 32, total_length, pc, & value);
01403         value = ((value) << (2));
01404         fields->f_7u9a4 = value;
01405       }
01406       break;
01407     case MEP_OPERAND_UIMM16 :
01408       length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_16u16);
01409       break;
01410     case MEP_OPERAND_UIMM2 :
01411       length = extract_normal (cd, ex_info, insn_value, 0, 0, 10, 2, 32, total_length, pc, & fields->f_2u10);
01412       break;
01413     case MEP_OPERAND_UIMM24 :
01414       {
01415         length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u8n_hi);
01416         if (length <= 0) break;
01417         length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 8, 32, total_length, pc, & fields->f_24u8n_lo);
01418         if (length <= 0) break;
01419   FLD (f_24u8n) = ((((FLD (f_24u8n_hi)) << (8))) | (FLD (f_24u8n_lo)));
01420       }
01421       break;
01422     case MEP_OPERAND_UIMM3 :
01423       length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_3u5);
01424       break;
01425     case MEP_OPERAND_UIMM4 :
01426       length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_4u8);
01427       break;
01428     case MEP_OPERAND_UIMM5 :
01429       length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 5, 32, total_length, pc, & fields->f_5u8);
01430       break;
01431     case MEP_OPERAND_UIMM7A4 :
01432       {
01433         long value;
01434         length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 5, 32, total_length, pc, & value);
01435         value = ((value) << (2));
01436         fields->f_7u9a4 = value;
01437       }
01438       break;
01439     case MEP_OPERAND_ZERO :
01440       break;
01441 
01442     default :
01443       /* xgettext:c-format */
01444       fprintf (stderr, _("Unrecognized field %d while decoding insn.\n"),
01445               opindex);
01446       abort ();
01447     }
01448 
01449   return length;
01450 }
01451 
01452 cgen_insert_fn * const mep_cgen_insert_handlers[] = 
01453 {
01454   insert_insn_normal,
01455 };
01456 
01457 cgen_extract_fn * const mep_cgen_extract_handlers[] = 
01458 {
01459   extract_insn_normal,
01460 };
01461 
01462 int mep_cgen_get_int_operand     (CGEN_CPU_DESC, int, const CGEN_FIELDS *);
01463 bfd_vma mep_cgen_get_vma_operand (CGEN_CPU_DESC, int, const CGEN_FIELDS *);
01464 
01465 /* Getting values from cgen_fields is handled by a collection of functions.
01466    They are distinguished by the type of the VALUE argument they return.
01467    TODO: floating point, inlining support, remove cases where result type
01468    not appropriate.  */
01469 
01470 int
01471 mep_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
01472                           int opindex,
01473                           const CGEN_FIELDS * fields)
01474 {
01475   int value;
01476 
01477   switch (opindex)
01478     {
01479     case MEP_OPERAND_ADDR24A4 :
01480       value = fields->f_24u8a4n;
01481       break;
01482     case MEP_OPERAND_CALLNUM :
01483       value = fields->f_callnum;
01484       break;
01485     case MEP_OPERAND_CCCC :
01486       value = fields->f_rm;
01487       break;
01488     case MEP_OPERAND_CCRN :
01489       value = fields->f_ccrn;
01490       break;
01491     case MEP_OPERAND_CDISP8 :
01492       value = fields->f_8s24;
01493       break;
01494     case MEP_OPERAND_CDISP8A2 :
01495       value = fields->f_8s24a2;
01496       break;
01497     case MEP_OPERAND_CDISP8A4 :
01498       value = fields->f_8s24a4;
01499       break;
01500     case MEP_OPERAND_CDISP8A8 :
01501       value = fields->f_8s24a8;
01502       break;
01503     case MEP_OPERAND_CIMM4 :
01504       value = fields->f_rn;
01505       break;
01506     case MEP_OPERAND_CIMM5 :
01507       value = fields->f_5u24;
01508       break;
01509     case MEP_OPERAND_CODE16 :
01510       value = fields->f_16u16;
01511       break;
01512     case MEP_OPERAND_CODE24 :
01513       value = fields->f_24u4n;
01514       break;
01515     case MEP_OPERAND_CP_FLAG :
01516       value = 0;
01517       break;
01518     case MEP_OPERAND_CRN :
01519       value = fields->f_crn;
01520       break;
01521     case MEP_OPERAND_CRN64 :
01522       value = fields->f_crn;
01523       break;
01524     case MEP_OPERAND_CRNX :
01525       value = fields->f_crnx;
01526       break;
01527     case MEP_OPERAND_CRNX64 :
01528       value = fields->f_crnx;
01529       break;
01530     case MEP_OPERAND_CSRN :
01531       value = fields->f_csrn;
01532       break;
01533     case MEP_OPERAND_CSRN_IDX :
01534       value = fields->f_csrn;
01535       break;
01536     case MEP_OPERAND_DBG :
01537       value = 0;
01538       break;
01539     case MEP_OPERAND_DEPC :
01540       value = 0;
01541       break;
01542     case MEP_OPERAND_EPC :
01543       value = 0;
01544       break;
01545     case MEP_OPERAND_EXC :
01546       value = 0;
01547       break;
01548     case MEP_OPERAND_FMAX_CCRN :
01549       value = fields->f_fmax_4_4;
01550       break;
01551     case MEP_OPERAND_FMAX_FRD :
01552       value = fields->f_fmax_frd;
01553       break;
01554     case MEP_OPERAND_FMAX_FRD_INT :
01555       value = fields->f_fmax_frd;
01556       break;
01557     case MEP_OPERAND_FMAX_FRM :
01558       value = fields->f_fmax_frm;
01559       break;
01560     case MEP_OPERAND_FMAX_FRN :
01561       value = fields->f_fmax_frn;
01562       break;
01563     case MEP_OPERAND_FMAX_FRN_INT :
01564       value = fields->f_fmax_frn;
01565       break;
01566     case MEP_OPERAND_FMAX_RM :
01567       value = fields->f_fmax_rm;
01568       break;
01569     case MEP_OPERAND_HI :
01570       value = 0;
01571       break;
01572     case MEP_OPERAND_LO :
01573       value = 0;
01574       break;
01575     case MEP_OPERAND_LP :
01576       value = 0;
01577       break;
01578     case MEP_OPERAND_MB0 :
01579       value = 0;
01580       break;
01581     case MEP_OPERAND_MB1 :
01582       value = 0;
01583       break;
01584     case MEP_OPERAND_ME0 :
01585       value = 0;
01586       break;
01587     case MEP_OPERAND_ME1 :
01588       value = 0;
01589       break;
01590     case MEP_OPERAND_NPC :
01591       value = 0;
01592       break;
01593     case MEP_OPERAND_OPT :
01594       value = 0;
01595       break;
01596     case MEP_OPERAND_PCABS24A2 :
01597       value = fields->f_24u5a2n;
01598       break;
01599     case MEP_OPERAND_PCREL12A2 :
01600       value = fields->f_12s4a2;
01601       break;
01602     case MEP_OPERAND_PCREL17A2 :
01603       value = fields->f_17s16a2;
01604       break;
01605     case MEP_OPERAND_PCREL24A2 :
01606       value = fields->f_24s5a2n;
01607       break;
01608     case MEP_OPERAND_PCREL8A2 :
01609       value = fields->f_8s8a2;
01610       break;
01611     case MEP_OPERAND_PSW :
01612       value = 0;
01613       break;
01614     case MEP_OPERAND_R0 :
01615       value = 0;
01616       break;
01617     case MEP_OPERAND_R1 :
01618       value = 0;
01619       break;
01620     case MEP_OPERAND_RL :
01621       value = fields->f_rl;
01622       break;
01623     case MEP_OPERAND_RM :
01624       value = fields->f_rm;
01625       break;
01626     case MEP_OPERAND_RMA :
01627       value = fields->f_rm;
01628       break;
01629     case MEP_OPERAND_RN :
01630       value = fields->f_rn;
01631       break;
01632     case MEP_OPERAND_RN3 :
01633       value = fields->f_rn3;
01634       break;
01635     case MEP_OPERAND_RN3C :
01636       value = fields->f_rn3;
01637       break;
01638     case MEP_OPERAND_RN3L :
01639       value = fields->f_rn3;
01640       break;
01641     case MEP_OPERAND_RN3S :
01642       value = fields->f_rn3;
01643       break;
01644     case MEP_OPERAND_RN3UC :
01645       value = fields->f_rn3;
01646       break;
01647     case MEP_OPERAND_RN3UL :
01648       value = fields->f_rn3;
01649       break;
01650     case MEP_OPERAND_RN3US :
01651       value = fields->f_rn3;
01652       break;
01653     case MEP_OPERAND_RNC :
01654       value = fields->f_rn;
01655       break;
01656     case MEP_OPERAND_RNL :
01657       value = fields->f_rn;
01658       break;
01659     case MEP_OPERAND_RNS :
01660       value = fields->f_rn;
01661       break;
01662     case MEP_OPERAND_RNUC :
01663       value = fields->f_rn;
01664       break;
01665     case MEP_OPERAND_RNUL :
01666       value = fields->f_rn;
01667       break;
01668     case MEP_OPERAND_RNUS :
01669       value = fields->f_rn;
01670       break;
01671     case MEP_OPERAND_SAR :
01672       value = 0;
01673       break;
01674     case MEP_OPERAND_SDISP16 :
01675       value = fields->f_16s16;
01676       break;
01677     case MEP_OPERAND_SIMM16 :
01678       value = fields->f_16s16;
01679       break;
01680     case MEP_OPERAND_SIMM6 :
01681       value = fields->f_6s8;
01682       break;
01683     case MEP_OPERAND_SIMM8 :
01684       value = fields->f_8s8;
01685       break;
01686     case MEP_OPERAND_SP :
01687       value = 0;
01688       break;
01689     case MEP_OPERAND_SPR :
01690       value = 0;
01691       break;
01692     case MEP_OPERAND_TP :
01693       value = 0;
01694       break;
01695     case MEP_OPERAND_TPR :
01696       value = 0;
01697       break;
01698     case MEP_OPERAND_UDISP2 :
01699       value = fields->f_2u6;
01700       break;
01701     case MEP_OPERAND_UDISP7 :
01702       value = fields->f_7u9;
01703       break;
01704     case MEP_OPERAND_UDISP7A2 :
01705       value = fields->f_7u9a2;
01706       break;
01707     case MEP_OPERAND_UDISP7A4 :
01708       value = fields->f_7u9a4;
01709       break;
01710     case MEP_OPERAND_UIMM16 :
01711       value = fields->f_16u16;
01712       break;
01713     case MEP_OPERAND_UIMM2 :
01714       value = fields->f_2u10;
01715       break;
01716     case MEP_OPERAND_UIMM24 :
01717       value = fields->f_24u8n;
01718       break;
01719     case MEP_OPERAND_UIMM3 :
01720       value = fields->f_3u5;
01721       break;
01722     case MEP_OPERAND_UIMM4 :
01723       value = fields->f_4u8;
01724       break;
01725     case MEP_OPERAND_UIMM5 :
01726       value = fields->f_5u8;
01727       break;
01728     case MEP_OPERAND_UIMM7A4 :
01729       value = fields->f_7u9a4;
01730       break;
01731     case MEP_OPERAND_ZERO :
01732       value = 0;
01733       break;
01734 
01735     default :
01736       /* xgettext:c-format */
01737       fprintf (stderr, _("Unrecognized field %d while getting int operand.\n"),
01738                      opindex);
01739       abort ();
01740   }
01741 
01742   return value;
01743 }
01744 
01745 bfd_vma
01746 mep_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
01747                           int opindex,
01748                           const CGEN_FIELDS * fields)
01749 {
01750   bfd_vma value;
01751 
01752   switch (opindex)
01753     {
01754     case MEP_OPERAND_ADDR24A4 :
01755       value = fields->f_24u8a4n;
01756       break;
01757     case MEP_OPERAND_CALLNUM :
01758       value = fields->f_callnum;
01759       break;
01760     case MEP_OPERAND_CCCC :
01761       value = fields->f_rm;
01762       break;
01763     case MEP_OPERAND_CCRN :
01764       value = fields->f_ccrn;
01765       break;
01766     case MEP_OPERAND_CDISP8 :
01767       value = fields->f_8s24;
01768       break;
01769     case MEP_OPERAND_CDISP8A2 :
01770       value = fields->f_8s24a2;
01771       break;
01772     case MEP_OPERAND_CDISP8A4 :
01773       value = fields->f_8s24a4;
01774       break;
01775     case MEP_OPERAND_CDISP8A8 :
01776       value = fields->f_8s24a8;
01777       break;
01778     case MEP_OPERAND_CIMM4 :
01779       value = fields->f_rn;
01780       break;
01781     case MEP_OPERAND_CIMM5 :
01782       value = fields->f_5u24;
01783       break;
01784     case MEP_OPERAND_CODE16 :
01785       value = fields->f_16u16;
01786       break;
01787     case MEP_OPERAND_CODE24 :
01788       value = fields->f_24u4n;
01789       break;
01790     case MEP_OPERAND_CP_FLAG :
01791       value = 0;
01792       break;
01793     case MEP_OPERAND_CRN :
01794       value = fields->f_crn;
01795       break;
01796     case MEP_OPERAND_CRN64 :
01797       value = fields->f_crn;
01798       break;
01799     case MEP_OPERAND_CRNX :
01800       value = fields->f_crnx;
01801       break;
01802     case MEP_OPERAND_CRNX64 :
01803       value = fields->f_crnx;
01804       break;
01805     case MEP_OPERAND_CSRN :
01806       value = fields->f_csrn;
01807       break;
01808     case MEP_OPERAND_CSRN_IDX :
01809       value = fields->f_csrn;
01810       break;
01811     case MEP_OPERAND_DBG :
01812       value = 0;
01813       break;
01814     case MEP_OPERAND_DEPC :
01815       value = 0;
01816       break;
01817     case MEP_OPERAND_EPC :
01818       value = 0;
01819       break;
01820     case MEP_OPERAND_EXC :
01821       value = 0;
01822       break;
01823     case MEP_OPERAND_FMAX_CCRN :
01824       value = fields->f_fmax_4_4;
01825       break;
01826     case MEP_OPERAND_FMAX_FRD :
01827       value = fields->f_fmax_frd;
01828       break;
01829     case MEP_OPERAND_FMAX_FRD_INT :
01830       value = fields->f_fmax_frd;
01831       break;
01832     case MEP_OPERAND_FMAX_FRM :
01833       value = fields->f_fmax_frm;
01834       break;
01835     case MEP_OPERAND_FMAX_FRN :
01836       value = fields->f_fmax_frn;
01837       break;
01838     case MEP_OPERAND_FMAX_FRN_INT :
01839       value = fields->f_fmax_frn;
01840       break;
01841     case MEP_OPERAND_FMAX_RM :
01842       value = fields->f_fmax_rm;
01843       break;
01844     case MEP_OPERAND_HI :
01845       value = 0;
01846       break;
01847     case MEP_OPERAND_LO :
01848       value = 0;
01849       break;
01850     case MEP_OPERAND_LP :
01851       value = 0;
01852       break;
01853     case MEP_OPERAND_MB0 :
01854       value = 0;
01855       break;
01856     case MEP_OPERAND_MB1 :
01857       value = 0;
01858       break;
01859     case MEP_OPERAND_ME0 :
01860       value = 0;
01861       break;
01862     case MEP_OPERAND_ME1 :
01863       value = 0;
01864       break;
01865     case MEP_OPERAND_NPC :
01866       value = 0;
01867       break;
01868     case MEP_OPERAND_OPT :
01869       value = 0;
01870       break;
01871     case MEP_OPERAND_PCABS24A2 :
01872       value = fields->f_24u5a2n;
01873       break;
01874     case MEP_OPERAND_PCREL12A2 :
01875       value = fields->f_12s4a2;
01876       break;
01877     case MEP_OPERAND_PCREL17A2 :
01878       value = fields->f_17s16a2;
01879       break;
01880     case MEP_OPERAND_PCREL24A2 :
01881       value = fields->f_24s5a2n;
01882       break;
01883     case MEP_OPERAND_PCREL8A2 :
01884       value = fields->f_8s8a2;
01885       break;
01886     case MEP_OPERAND_PSW :
01887       value = 0;
01888       break;
01889     case MEP_OPERAND_R0 :
01890       value = 0;
01891       break;
01892     case MEP_OPERAND_R1 :
01893       value = 0;
01894       break;
01895     case MEP_OPERAND_RL :
01896       value = fields->f_rl;
01897       break;
01898     case MEP_OPERAND_RM :
01899       value = fields->f_rm;
01900       break;
01901     case MEP_OPERAND_RMA :
01902       value = fields->f_rm;
01903       break;
01904     case MEP_OPERAND_RN :
01905       value = fields->f_rn;
01906       break;
01907     case MEP_OPERAND_RN3 :
01908       value = fields->f_rn3;
01909       break;
01910     case MEP_OPERAND_RN3C :
01911       value = fields->f_rn3;
01912       break;
01913     case MEP_OPERAND_RN3L :
01914       value = fields->f_rn3;
01915       break;
01916     case MEP_OPERAND_RN3S :
01917       value = fields->f_rn3;
01918       break;
01919     case MEP_OPERAND_RN3UC :
01920       value = fields->f_rn3;
01921       break;
01922     case MEP_OPERAND_RN3UL :
01923       value = fields->f_rn3;
01924       break;
01925     case MEP_OPERAND_RN3US :
01926       value = fields->f_rn3;
01927       break;
01928     case MEP_OPERAND_RNC :
01929       value = fields->f_rn;
01930       break;
01931     case MEP_OPERAND_RNL :
01932       value = fields->f_rn;
01933       break;
01934     case MEP_OPERAND_RNS :
01935       value = fields->f_rn;
01936       break;
01937     case MEP_OPERAND_RNUC :
01938       value = fields->f_rn;
01939       break;
01940     case MEP_OPERAND_RNUL :
01941       value = fields->f_rn;
01942       break;
01943     case MEP_OPERAND_RNUS :
01944       value = fields->f_rn;
01945       break;
01946     case MEP_OPERAND_SAR :
01947       value = 0;
01948       break;
01949     case MEP_OPERAND_SDISP16 :
01950       value = fields->f_16s16;
01951       break;
01952     case MEP_OPERAND_SIMM16 :
01953       value = fields->f_16s16;
01954       break;
01955     case MEP_OPERAND_SIMM6 :
01956       value = fields->f_6s8;
01957       break;
01958     case MEP_OPERAND_SIMM8 :
01959       value = fields->f_8s8;
01960       break;
01961     case MEP_OPERAND_SP :
01962       value = 0;
01963       break;
01964     case MEP_OPERAND_SPR :
01965       value = 0;
01966       break;
01967     case MEP_OPERAND_TP :
01968       value = 0;
01969       break;
01970     case MEP_OPERAND_TPR :
01971       value = 0;
01972       break;
01973     case MEP_OPERAND_UDISP2 :
01974       value = fields->f_2u6;
01975       break;
01976     case MEP_OPERAND_UDISP7 :
01977       value = fields->f_7u9;
01978       break;
01979     case MEP_OPERAND_UDISP7A2 :
01980       value = fields->f_7u9a2;
01981       break;
01982     case MEP_OPERAND_UDISP7A4 :
01983       value = fields->f_7u9a4;
01984       break;
01985     case MEP_OPERAND_UIMM16 :
01986       value = fields->f_16u16;
01987       break;
01988     case MEP_OPERAND_UIMM2 :
01989       value = fields->f_2u10;
01990       break;
01991     case MEP_OPERAND_UIMM24 :
01992       value = fields->f_24u8n;
01993       break;
01994     case MEP_OPERAND_UIMM3 :
01995       value = fields->f_3u5;
01996       break;
01997     case MEP_OPERAND_UIMM4 :
01998       value = fields->f_4u8;
01999       break;
02000     case MEP_OPERAND_UIMM5 :
02001       value = fields->f_5u8;
02002       break;
02003     case MEP_OPERAND_UIMM7A4 :
02004       value = fields->f_7u9a4;
02005       break;
02006     case MEP_OPERAND_ZERO :
02007       value = 0;
02008       break;
02009 
02010     default :
02011       /* xgettext:c-format */
02012       fprintf (stderr, _("Unrecognized field %d while getting vma operand.\n"),
02013                      opindex);
02014       abort ();
02015   }
02016 
02017   return value;
02018 }
02019 
02020 void mep_cgen_set_int_operand  (CGEN_CPU_DESC, int, CGEN_FIELDS *, int);
02021 void mep_cgen_set_vma_operand  (CGEN_CPU_DESC, int, CGEN_FIELDS *, bfd_vma);
02022 
02023 /* Stuffing values in cgen_fields is handled by a collection of functions.
02024    They are distinguished by the type of the VALUE argument they accept.
02025    TODO: floating point, inlining support, remove cases where argument type
02026    not appropriate.  */
02027 
02028 void
02029 mep_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
02030                           int opindex,
02031                           CGEN_FIELDS * fields,
02032                           int value)
02033 {
02034   switch (opindex)
02035     {
02036     case MEP_OPERAND_ADDR24A4 :
02037       fields->f_24u8a4n = value;
02038       break;
02039     case MEP_OPERAND_CALLNUM :
02040       fields->f_callnum = value;
02041       break;
02042     case MEP_OPERAND_CCCC :
02043       fields->f_rm = value;
02044       break;
02045     case MEP_OPERAND_CCRN :
02046       fields->f_ccrn = value;
02047       break;
02048     case MEP_OPERAND_CDISP8 :
02049       fields->f_8s24 = value;
02050       break;
02051     case MEP_OPERAND_CDISP8A2 :
02052       fields->f_8s24a2 = value;
02053       break;
02054     case MEP_OPERAND_CDISP8A4 :
02055       fields->f_8s24a4 = value;
02056       break;
02057     case MEP_OPERAND_CDISP8A8 :
02058       fields->f_8s24a8 = value;
02059       break;
02060     case MEP_OPERAND_CIMM4 :
02061       fields->f_rn = value;
02062       break;
02063     case MEP_OPERAND_CIMM5 :
02064       fields->f_5u24 = value;
02065       break;
02066     case MEP_OPERAND_CODE16 :
02067       fields->f_16u16 = value;
02068       break;
02069     case MEP_OPERAND_CODE24 :
02070       fields->f_24u4n = value;
02071       break;
02072     case MEP_OPERAND_CP_FLAG :
02073       break;
02074     case MEP_OPERAND_CRN :
02075       fields->f_crn = value;
02076       break;
02077     case MEP_OPERAND_CRN64 :
02078       fields->f_crn = value;
02079       break;
02080     case MEP_OPERAND_CRNX :
02081       fields->f_crnx = value;
02082       break;
02083     case MEP_OPERAND_CRNX64 :
02084       fields->f_crnx = value;
02085       break;
02086     case MEP_OPERAND_CSRN :
02087       fields->f_csrn = value;
02088       break;
02089     case MEP_OPERAND_CSRN_IDX :
02090       fields->f_csrn = value;
02091       break;
02092     case MEP_OPERAND_DBG :
02093       break;
02094     case MEP_OPERAND_DEPC :
02095       break;
02096     case MEP_OPERAND_EPC :
02097       break;
02098     case MEP_OPERAND_EXC :
02099       break;
02100     case MEP_OPERAND_FMAX_CCRN :
02101       fields->f_fmax_4_4 = value;
02102       break;
02103     case MEP_OPERAND_FMAX_FRD :
02104       fields->f_fmax_frd = value;
02105       break;
02106     case MEP_OPERAND_FMAX_FRD_INT :
02107       fields->f_fmax_frd = value;
02108       break;
02109     case MEP_OPERAND_FMAX_FRM :
02110       fields->f_fmax_frm = value;
02111       break;
02112     case MEP_OPERAND_FMAX_FRN :
02113       fields->f_fmax_frn = value;
02114       break;
02115     case MEP_OPERAND_FMAX_FRN_INT :
02116       fields->f_fmax_frn = value;
02117       break;
02118     case MEP_OPERAND_FMAX_RM :
02119       fields->f_fmax_rm = value;
02120       break;
02121     case MEP_OPERAND_HI :
02122       break;
02123     case MEP_OPERAND_LO :
02124       break;
02125     case MEP_OPERAND_LP :
02126       break;
02127     case MEP_OPERAND_MB0 :
02128       break;
02129     case MEP_OPERAND_MB1 :
02130       break;
02131     case MEP_OPERAND_ME0 :
02132       break;
02133     case MEP_OPERAND_ME1 :
02134       break;
02135     case MEP_OPERAND_NPC :
02136       break;
02137     case MEP_OPERAND_OPT :
02138       break;
02139     case MEP_OPERAND_PCABS24A2 :
02140       fields->f_24u5a2n = value;
02141       break;
02142     case MEP_OPERAND_PCREL12A2 :
02143       fields->f_12s4a2 = value;
02144       break;
02145     case MEP_OPERAND_PCREL17A2 :
02146       fields->f_17s16a2 = value;
02147       break;
02148     case MEP_OPERAND_PCREL24A2 :
02149       fields->f_24s5a2n = value;
02150       break;
02151     case MEP_OPERAND_PCREL8A2 :
02152       fields->f_8s8a2 = value;
02153       break;
02154     case MEP_OPERAND_PSW :
02155       break;
02156     case MEP_OPERAND_R0 :
02157       break;
02158     case MEP_OPERAND_R1 :
02159       break;
02160     case MEP_OPERAND_RL :
02161       fields->f_rl = value;
02162       break;
02163     case MEP_OPERAND_RM :
02164       fields->f_rm = value;
02165       break;
02166     case MEP_OPERAND_RMA :
02167       fields->f_rm = value;
02168       break;
02169     case MEP_OPERAND_RN :
02170       fields->f_rn = value;
02171       break;
02172     case MEP_OPERAND_RN3 :
02173       fields->f_rn3 = value;
02174       break;
02175     case MEP_OPERAND_RN3C :
02176       fields->f_rn3 = value;
02177       break;
02178     case MEP_OPERAND_RN3L :
02179       fields->f_rn3 = value;
02180       break;
02181     case MEP_OPERAND_RN3S :
02182       fields->f_rn3 = value;
02183       break;
02184     case MEP_OPERAND_RN3UC :
02185       fields->f_rn3 = value;
02186       break;
02187     case MEP_OPERAND_RN3UL :
02188       fields->f_rn3 = value;
02189       break;
02190     case MEP_OPERAND_RN3US :
02191       fields->f_rn3 = value;
02192       break;
02193     case MEP_OPERAND_RNC :
02194       fields->f_rn = value;
02195       break;
02196     case MEP_OPERAND_RNL :
02197       fields->f_rn = value;
02198       break;
02199     case MEP_OPERAND_RNS :
02200       fields->f_rn = value;
02201       break;
02202     case MEP_OPERAND_RNUC :
02203       fields->f_rn = value;
02204       break;
02205     case MEP_OPERAND_RNUL :
02206       fields->f_rn = value;
02207       break;
02208     case MEP_OPERAND_RNUS :
02209       fields->f_rn = value;
02210       break;
02211     case MEP_OPERAND_SAR :
02212       break;
02213     case MEP_OPERAND_SDISP16 :
02214       fields->f_16s16 = value;
02215       break;
02216     case MEP_OPERAND_SIMM16 :
02217       fields->f_16s16 = value;
02218       break;
02219     case MEP_OPERAND_SIMM6 :
02220       fields->f_6s8 = value;
02221       break;
02222     case MEP_OPERAND_SIMM8 :
02223       fields->f_8s8 = value;
02224       break;
02225     case MEP_OPERAND_SP :
02226       break;
02227     case MEP_OPERAND_SPR :
02228       break;
02229     case MEP_OPERAND_TP :
02230       break;
02231     case MEP_OPERAND_TPR :
02232       break;
02233     case MEP_OPERAND_UDISP2 :
02234       fields->f_2u6 = value;
02235       break;
02236     case MEP_OPERAND_UDISP7 :
02237       fields->f_7u9 = value;
02238       break;
02239     case MEP_OPERAND_UDISP7A2 :
02240       fields->f_7u9a2 = value;
02241       break;
02242     case MEP_OPERAND_UDISP7A4 :
02243       fields->f_7u9a4 = value;
02244       break;
02245     case MEP_OPERAND_UIMM16 :
02246       fields->f_16u16 = value;
02247       break;
02248     case MEP_OPERAND_UIMM2 :
02249       fields->f_2u10 = value;
02250       break;
02251     case MEP_OPERAND_UIMM24 :
02252       fields->f_24u8n = value;
02253       break;
02254     case MEP_OPERAND_UIMM3 :
02255       fields->f_3u5 = value;
02256       break;
02257     case MEP_OPERAND_UIMM4 :
02258       fields->f_4u8 = value;
02259       break;
02260     case MEP_OPERAND_UIMM5 :
02261       fields->f_5u8 = value;
02262       break;
02263     case MEP_OPERAND_UIMM7A4 :
02264       fields->f_7u9a4 = value;
02265       break;
02266     case MEP_OPERAND_ZERO :
02267       break;
02268 
02269     default :
02270       /* xgettext:c-format */
02271       fprintf (stderr, _("Unrecognized field %d while setting int operand.\n"),
02272                      opindex);
02273       abort ();
02274   }
02275 }
02276 
02277 void
02278 mep_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
02279                           int opindex,
02280                           CGEN_FIELDS * fields,
02281                           bfd_vma value)
02282 {
02283   switch (opindex)
02284     {
02285     case MEP_OPERAND_ADDR24A4 :
02286       fields->f_24u8a4n = value;
02287       break;
02288     case MEP_OPERAND_CALLNUM :
02289       fields->f_callnum = value;
02290       break;
02291     case MEP_OPERAND_CCCC :
02292       fields->f_rm = value;
02293       break;
02294     case MEP_OPERAND_CCRN :
02295       fields->f_ccrn = value;
02296       break;
02297     case MEP_OPERAND_CDISP8 :
02298       fields->f_8s24 = value;
02299       break;
02300     case MEP_OPERAND_CDISP8A2 :
02301       fields->f_8s24a2 = value;
02302       break;
02303     case MEP_OPERAND_CDISP8A4 :
02304       fields->f_8s24a4 = value;
02305       break;
02306     case MEP_OPERAND_CDISP8A8 :
02307       fields->f_8s24a8 = value;
02308       break;
02309     case MEP_OPERAND_CIMM4 :
02310       fields->f_rn = value;
02311       break;
02312     case MEP_OPERAND_CIMM5 :
02313       fields->f_5u24 = value;
02314       break;
02315     case MEP_OPERAND_CODE16 :
02316       fields->f_16u16 = value;
02317       break;
02318     case MEP_OPERAND_CODE24 :
02319       fields->f_24u4n = value;
02320       break;
02321     case MEP_OPERAND_CP_FLAG :
02322       break;
02323     case MEP_OPERAND_CRN :
02324       fields->f_crn = value;
02325       break;
02326     case MEP_OPERAND_CRN64 :
02327       fields->f_crn = value;
02328       break;
02329     case MEP_OPERAND_CRNX :
02330       fields->f_crnx = value;
02331       break;
02332     case MEP_OPERAND_CRNX64 :
02333       fields->f_crnx = value;
02334       break;
02335     case MEP_OPERAND_CSRN :
02336       fields->f_csrn = value;
02337       break;
02338     case MEP_OPERAND_CSRN_IDX :
02339       fields->f_csrn = value;
02340       break;
02341     case MEP_OPERAND_DBG :
02342       break;
02343     case MEP_OPERAND_DEPC :
02344       break;
02345     case MEP_OPERAND_EPC :
02346       break;
02347     case MEP_OPERAND_EXC :
02348       break;
02349     case MEP_OPERAND_FMAX_CCRN :
02350       fields->f_fmax_4_4 = value;
02351       break;
02352     case MEP_OPERAND_FMAX_FRD :
02353       fields->f_fmax_frd = value;
02354       break;
02355     case MEP_OPERAND_FMAX_FRD_INT :
02356       fields->f_fmax_frd = value;
02357       break;
02358     case MEP_OPERAND_FMAX_FRM :
02359       fields->f_fmax_frm = value;
02360       break;
02361     case MEP_OPERAND_FMAX_FRN :
02362       fields->f_fmax_frn = value;
02363       break;
02364     case MEP_OPERAND_FMAX_FRN_INT :
02365       fields->f_fmax_frn = value;
02366       break;
02367     case MEP_OPERAND_FMAX_RM :
02368       fields->f_fmax_rm = value;
02369       break;
02370     case MEP_OPERAND_HI :
02371       break;
02372     case MEP_OPERAND_LO :
02373       break;
02374     case MEP_OPERAND_LP :
02375       break;
02376     case MEP_OPERAND_MB0 :
02377       break;
02378     case MEP_OPERAND_MB1 :
02379       break;
02380     case MEP_OPERAND_ME0 :
02381       break;
02382     case MEP_OPERAND_ME1 :
02383       break;
02384     case MEP_OPERAND_NPC :
02385       break;
02386     case MEP_OPERAND_OPT :
02387       break;
02388     case MEP_OPERAND_PCABS24A2 :
02389       fields->f_24u5a2n = value;
02390       break;
02391     case MEP_OPERAND_PCREL12A2 :
02392       fields->f_12s4a2 = value;
02393       break;
02394     case MEP_OPERAND_PCREL17A2 :
02395       fields->f_17s16a2 = value;
02396       break;
02397     case MEP_OPERAND_PCREL24A2 :
02398       fields->f_24s5a2n = value;
02399       break;
02400     case MEP_OPERAND_PCREL8A2 :
02401       fields->f_8s8a2 = value;
02402       break;
02403     case MEP_OPERAND_PSW :
02404       break;
02405     case MEP_OPERAND_R0 :
02406       break;
02407     case MEP_OPERAND_R1 :
02408       break;
02409     case MEP_OPERAND_RL :
02410       fields->f_rl = value;
02411       break;
02412     case MEP_OPERAND_RM :
02413       fields->f_rm = value;
02414       break;
02415     case MEP_OPERAND_RMA :
02416       fields->f_rm = value;
02417       break;
02418     case MEP_OPERAND_RN :
02419       fields->f_rn = value;
02420       break;
02421     case MEP_OPERAND_RN3 :
02422       fields->f_rn3 = value;
02423       break;
02424     case MEP_OPERAND_RN3C :
02425       fields->f_rn3 = value;
02426       break;
02427     case MEP_OPERAND_RN3L :
02428       fields->f_rn3 = value;
02429       break;
02430     case MEP_OPERAND_RN3S :
02431       fields->f_rn3 = value;
02432       break;
02433     case MEP_OPERAND_RN3UC :
02434       fields->f_rn3 = value;
02435       break;
02436     case MEP_OPERAND_RN3UL :
02437       fields->f_rn3 = value;
02438       break;
02439     case MEP_OPERAND_RN3US :
02440       fields->f_rn3 = value;
02441       break;
02442     case MEP_OPERAND_RNC :
02443       fields->f_rn = value;
02444       break;
02445     case MEP_OPERAND_RNL :
02446       fields->f_rn = value;
02447       break;
02448     case MEP_OPERAND_RNS :
02449       fields->f_rn = value;
02450       break;
02451     case MEP_OPERAND_RNUC :
02452       fields->f_rn = value;
02453       break;
02454     case MEP_OPERAND_RNUL :
02455       fields->f_rn = value;
02456       break;
02457     case MEP_OPERAND_RNUS :
02458       fields->f_rn = value;
02459       break;
02460     case MEP_OPERAND_SAR :
02461       break;
02462     case MEP_OPERAND_SDISP16 :
02463       fields->f_16s16 = value;
02464       break;
02465     case MEP_OPERAND_SIMM16 :
02466       fields->f_16s16 = value;
02467       break;
02468     case MEP_OPERAND_SIMM6 :
02469       fields->f_6s8 = value;
02470       break;
02471     case MEP_OPERAND_SIMM8 :
02472       fields->f_8s8 = value;
02473       break;
02474     case MEP_OPERAND_SP :
02475       break;
02476     case MEP_OPERAND_SPR :
02477       break;
02478     case MEP_OPERAND_TP :
02479       break;
02480     case MEP_OPERAND_TPR :
02481       break;
02482     case MEP_OPERAND_UDISP2 :
02483       fields->f_2u6 = value;
02484       break;
02485     case MEP_OPERAND_UDISP7 :
02486       fields->f_7u9 = value;
02487       break;
02488     case MEP_OPERAND_UDISP7A2 :
02489       fields->f_7u9a2 = value;
02490       break;
02491     case MEP_OPERAND_UDISP7A4 :
02492       fields->f_7u9a4 = value;
02493       break;
02494     case MEP_OPERAND_UIMM16 :
02495       fields->f_16u16 = value;
02496       break;
02497     case MEP_OPERAND_UIMM2 :
02498       fields->f_2u10 = value;
02499       break;
02500     case MEP_OPERAND_UIMM24 :
02501       fields->f_24u8n = value;
02502       break;
02503     case MEP_OPERAND_UIMM3 :
02504       fields->f_3u5 = value;
02505       break;
02506     case MEP_OPERAND_UIMM4 :
02507       fields->f_4u8 = value;
02508       break;
02509     case MEP_OPERAND_UIMM5 :
02510       fields->f_5u8 = value;
02511       break;
02512     case MEP_OPERAND_UIMM7A4 :
02513       fields->f_7u9a4 = value;
02514       break;
02515     case MEP_OPERAND_ZERO :
02516       break;
02517 
02518     default :
02519       /* xgettext:c-format */
02520       fprintf (stderr, _("Unrecognized field %d while setting vma operand.\n"),
02521                      opindex);
02522       abort ();
02523   }
02524 }
02525 
02526 /* Function to call before using the instruction builder tables.  */
02527 
02528 void
02529 mep_cgen_init_ibld_table (CGEN_CPU_DESC cd)
02530 {
02531   cd->insert_handlers = & mep_cgen_insert_handlers[0];
02532   cd->extract_handlers = & mep_cgen_extract_handlers[0];
02533 
02534   cd->insert_operand = mep_cgen_insert_operand;
02535   cd->extract_operand = mep_cgen_extract_operand;
02536 
02537   cd->get_int_operand = mep_cgen_get_int_operand;
02538   cd->set_int_operand = mep_cgen_set_int_operand;
02539   cd->get_vma_operand = mep_cgen_get_vma_operand;
02540   cd->set_vma_operand = mep_cgen_set_vma_operand;
02541 }