Back to index

cell-binutils  2.17cvs20070401
ia64-asmtab.h
Go to the documentation of this file.
00001 /* ia64-asmtab.h -- Header for compacted IA-64 opcode tables.
00002    Copyright 1999, 2000 Free Software Foundation, Inc.
00003    Contributed by Bob Manson of Cygnus Support <manson@cygnus.com>
00004 
00005    This file is part of GDB, GAS, and the GNU binutils.
00006 
00007    GDB, GAS, and the GNU binutils are free software; you can redistribute
00008    them and/or modify them under the terms of the GNU General Public
00009    License as published by the Free Software Foundation; either version
00010    2, or (at your option) any later version.
00011 
00012    GDB, GAS, and the GNU binutils are distributed in the hope that they
00013    will be useful, but WITHOUT ANY WARRANTY; without even the implied
00014    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
00015    the GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this file; see the file COPYING.  If not, write to the
00019    Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
00020    02110-1301, USA.  */
00021 
00022 #ifndef IA64_ASMTAB_H
00023 #define IA64_ASMTAB_H
00024 
00025 #include "opcode/ia64.h"
00026 
00027 /* The primary opcode table is made up of the following: */
00028 struct ia64_main_table
00029 {
00030   /* The entry in the string table that corresponds to the name of this
00031      opcode. */
00032   unsigned short name_index;
00033 
00034   /* The type of opcode; corresponds to the TYPE field in 
00035      struct ia64_opcode. */
00036   unsigned char opcode_type;
00037 
00038   /* The number of outputs for this opcode. */
00039   unsigned char num_outputs;
00040 
00041   /* The base insn value for this opcode.  It may be modified by completers. */
00042   ia64_insn opcode;
00043 
00044   /* The mask of valid bits in OPCODE. Zeros indicate operand fields. */
00045   ia64_insn mask;
00046 
00047   /* The operands of this instruction.  Corresponds to the OPERANDS field
00048      in struct ia64_opcode. */
00049   unsigned char operands[5];
00050 
00051   /* The flags for this instruction.  Corresponds to the FLAGS field in
00052      struct ia64_opcode. */
00053   short flags;
00054 
00055   /* The tree of completers for this instruction; this is an offset into
00056      completer_table. */
00057   short completers;
00058 };
00059 
00060 /* Each instruction has a set of possible "completers", or additional
00061    suffixes that can alter the instruction's behavior, and which has
00062    potentially different dependencies.
00063 
00064    The completer entries modify certain bits in the instruction opcode.
00065    Which bits are to be modified are marked by the BITS, MASK and
00066    OFFSET fields.  The completer entry may also note dependencies for the
00067    opcode. 
00068 
00069    These completers are arranged in a DAG; the pointers are indexes
00070    into the completer_table array.  The completer DAG is searched by
00071    find_completer () and ia64_find_matching_opcode ().
00072 
00073    Note that each completer needs to be applied in turn, so that if we
00074    have the instruction
00075        cmp.lt.unc
00076    the completer entries for both "lt" and "unc" would need to be applied
00077    to the opcode's value.
00078 
00079    Some instructions do not require any completers; these contain an
00080    empty completer entry.  Instructions that require a completer do
00081    not contain an empty entry.
00082 
00083    Terminal completers (those completers that validly complete an
00084    instruction) are marked by having the TERMINAL_COMPLETER flag set. 
00085 
00086    Only dependencies listed in the terminal completer for an opcode are
00087    considered to apply to that opcode instance. */
00088 
00089 struct ia64_completer_table
00090 {
00091   /* The bit value that this completer sets. */
00092   unsigned int bits;
00093 
00094   /* And its mask. 1s are bits that are to be modified in the 
00095      instruction. */
00096   unsigned int mask;
00097 
00098   /* The entry in the string table that corresponds to the name of this
00099      completer. */
00100   unsigned short name_index;
00101 
00102   /* An alternative completer, or -1 if this is the end of the chain. */
00103   short alternative;
00104 
00105   /* A pointer to the DAG of completers that can potentially follow
00106      this one, or -1. */
00107   short subentries;
00108 
00109   /* The bit offset in the instruction where BITS and MASK should be
00110      applied. */
00111   unsigned char offset : 7;
00112 
00113   unsigned char terminal_completer : 1;
00114 
00115   /* Index into the dependency list table */
00116   short dependencies;
00117 };
00118 
00119 /* This contains sufficient information for the disassembler to resolve
00120    the complete name of the original instruction.  */
00121 struct ia64_dis_names 
00122 {
00123   /* COMPLETER_INDEX represents the tree of completers that make up
00124      the instruction.  The LSB represents the top of the tree for the
00125      specified instruction. 
00126 
00127      A 0 bit indicates to go to the next alternate completer via the
00128      alternative field; a 1 bit indicates that the current completer
00129      is part of the instruction, and to go down the subentries index.
00130      We know we've reached the final completer when we run out of 1
00131      bits.
00132 
00133      There is always at least one 1 bit. */
00134   unsigned int completer_index : 20;
00135 
00136   /* The index in the main_table[] array for the instruction. */
00137   unsigned short insn_index : 11;
00138 
00139   /* If set, the next entry in this table is an alternate possibility
00140      for this instruction encoding.  Which one to use is determined by
00141      the instruction type and other factors (see opcode_verify ()).  */
00142   unsigned int next_flag : 1;
00143 
00144   /* The disassembly priority of this entry among instructions. */
00145   unsigned short priority;
00146 };
00147 
00148 #endif