1*3d8817e4Smiod /* ia64-asmtab.h -- Header for compacted IA-64 opcode tables. 2*3d8817e4Smiod Copyright 1999, 2000 Free Software Foundation, Inc. 3*3d8817e4Smiod Contributed by Bob Manson of Cygnus Support <manson@cygnus.com> 4*3d8817e4Smiod 5*3d8817e4Smiod This file is part of GDB, GAS, and the GNU binutils. 6*3d8817e4Smiod 7*3d8817e4Smiod GDB, GAS, and the GNU binutils are free software; you can redistribute 8*3d8817e4Smiod them and/or modify them under the terms of the GNU General Public 9*3d8817e4Smiod License as published by the Free Software Foundation; either version 10*3d8817e4Smiod 2, or (at your option) any later version. 11*3d8817e4Smiod 12*3d8817e4Smiod GDB, GAS, and the GNU binutils are distributed in the hope that they 13*3d8817e4Smiod will be useful, but WITHOUT ANY WARRANTY; without even the implied 14*3d8817e4Smiod warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 15*3d8817e4Smiod the GNU General Public License for more details. 16*3d8817e4Smiod 17*3d8817e4Smiod You should have received a copy of the GNU General Public License 18*3d8817e4Smiod along with this file; see the file COPYING. If not, write to the 19*3d8817e4Smiod Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 20*3d8817e4Smiod 02110-1301, USA. */ 21*3d8817e4Smiod 22*3d8817e4Smiod #ifndef IA64_ASMTAB_H 23*3d8817e4Smiod #define IA64_ASMTAB_H 24*3d8817e4Smiod 25*3d8817e4Smiod #include "opcode/ia64.h" 26*3d8817e4Smiod 27*3d8817e4Smiod /* The primary opcode table is made up of the following: */ 28*3d8817e4Smiod struct ia64_main_table 29*3d8817e4Smiod { 30*3d8817e4Smiod /* The entry in the string table that corresponds to the name of this 31*3d8817e4Smiod opcode. */ 32*3d8817e4Smiod unsigned short name_index; 33*3d8817e4Smiod 34*3d8817e4Smiod /* The type of opcode; corresponds to the TYPE field in 35*3d8817e4Smiod struct ia64_opcode. */ 36*3d8817e4Smiod unsigned char opcode_type; 37*3d8817e4Smiod 38*3d8817e4Smiod /* The number of outputs for this opcode. */ 39*3d8817e4Smiod unsigned char num_outputs; 40*3d8817e4Smiod 41*3d8817e4Smiod /* The base insn value for this opcode. It may be modified by completers. */ 42*3d8817e4Smiod ia64_insn opcode; 43*3d8817e4Smiod 44*3d8817e4Smiod /* The mask of valid bits in OPCODE. Zeros indicate operand fields. */ 45*3d8817e4Smiod ia64_insn mask; 46*3d8817e4Smiod 47*3d8817e4Smiod /* The operands of this instruction. Corresponds to the OPERANDS field 48*3d8817e4Smiod in struct ia64_opcode. */ 49*3d8817e4Smiod unsigned char operands[5]; 50*3d8817e4Smiod 51*3d8817e4Smiod /* The flags for this instruction. Corresponds to the FLAGS field in 52*3d8817e4Smiod struct ia64_opcode. */ 53*3d8817e4Smiod short flags; 54*3d8817e4Smiod 55*3d8817e4Smiod /* The tree of completers for this instruction; this is an offset into 56*3d8817e4Smiod completer_table. */ 57*3d8817e4Smiod short completers; 58*3d8817e4Smiod }; 59*3d8817e4Smiod 60*3d8817e4Smiod /* Each instruction has a set of possible "completers", or additional 61*3d8817e4Smiod suffixes that can alter the instruction's behavior, and which has 62*3d8817e4Smiod potentially different dependencies. 63*3d8817e4Smiod 64*3d8817e4Smiod The completer entries modify certain bits in the instruction opcode. 65*3d8817e4Smiod Which bits are to be modified are marked by the BITS, MASK and 66*3d8817e4Smiod OFFSET fields. The completer entry may also note dependencies for the 67*3d8817e4Smiod opcode. 68*3d8817e4Smiod 69*3d8817e4Smiod These completers are arranged in a DAG; the pointers are indexes 70*3d8817e4Smiod into the completer_table array. The completer DAG is searched by 71*3d8817e4Smiod find_completer () and ia64_find_matching_opcode (). 72*3d8817e4Smiod 73*3d8817e4Smiod Note that each completer needs to be applied in turn, so that if we 74*3d8817e4Smiod have the instruction 75*3d8817e4Smiod cmp.lt.unc 76*3d8817e4Smiod the completer entries for both "lt" and "unc" would need to be applied 77*3d8817e4Smiod to the opcode's value. 78*3d8817e4Smiod 79*3d8817e4Smiod Some instructions do not require any completers; these contain an 80*3d8817e4Smiod empty completer entry. Instructions that require a completer do 81*3d8817e4Smiod not contain an empty entry. 82*3d8817e4Smiod 83*3d8817e4Smiod Terminal completers (those completers that validly complete an 84*3d8817e4Smiod instruction) are marked by having the TERMINAL_COMPLETER flag set. 85*3d8817e4Smiod 86*3d8817e4Smiod Only dependencies listed in the terminal completer for an opcode are 87*3d8817e4Smiod considered to apply to that opcode instance. */ 88*3d8817e4Smiod 89*3d8817e4Smiod struct ia64_completer_table 90*3d8817e4Smiod { 91*3d8817e4Smiod /* The bit value that this completer sets. */ 92*3d8817e4Smiod unsigned int bits; 93*3d8817e4Smiod 94*3d8817e4Smiod /* And its mask. 1s are bits that are to be modified in the 95*3d8817e4Smiod instruction. */ 96*3d8817e4Smiod unsigned int mask; 97*3d8817e4Smiod 98*3d8817e4Smiod /* The entry in the string table that corresponds to the name of this 99*3d8817e4Smiod completer. */ 100*3d8817e4Smiod unsigned short name_index; 101*3d8817e4Smiod 102*3d8817e4Smiod /* An alternative completer, or -1 if this is the end of the chain. */ 103*3d8817e4Smiod short alternative; 104*3d8817e4Smiod 105*3d8817e4Smiod /* A pointer to the DAG of completers that can potentially follow 106*3d8817e4Smiod this one, or -1. */ 107*3d8817e4Smiod short subentries; 108*3d8817e4Smiod 109*3d8817e4Smiod /* The bit offset in the instruction where BITS and MASK should be 110*3d8817e4Smiod applied. */ 111*3d8817e4Smiod unsigned char offset : 7; 112*3d8817e4Smiod 113*3d8817e4Smiod unsigned char terminal_completer : 1; 114*3d8817e4Smiod 115*3d8817e4Smiod /* Index into the dependency list table */ 116*3d8817e4Smiod short dependencies; 117*3d8817e4Smiod }; 118*3d8817e4Smiod 119*3d8817e4Smiod /* This contains sufficient information for the disassembler to resolve 120*3d8817e4Smiod the complete name of the original instruction. */ 121*3d8817e4Smiod struct ia64_dis_names 122*3d8817e4Smiod { 123*3d8817e4Smiod /* COMPLETER_INDEX represents the tree of completers that make up 124*3d8817e4Smiod the instruction. The LSB represents the top of the tree for the 125*3d8817e4Smiod specified instruction. 126*3d8817e4Smiod 127*3d8817e4Smiod A 0 bit indicates to go to the next alternate completer via the 128*3d8817e4Smiod alternative field; a 1 bit indicates that the current completer 129*3d8817e4Smiod is part of the instruction, and to go down the subentries index. 130*3d8817e4Smiod We know we've reached the final completer when we run out of 1 131*3d8817e4Smiod bits. 132*3d8817e4Smiod 133*3d8817e4Smiod There is always at least one 1 bit. */ 134*3d8817e4Smiod unsigned int completer_index : 20; 135*3d8817e4Smiod 136*3d8817e4Smiod /* The index in the main_table[] array for the instruction. */ 137*3d8817e4Smiod unsigned short insn_index : 11; 138*3d8817e4Smiod 139*3d8817e4Smiod /* If set, the next entry in this table is an alternate possibility 140*3d8817e4Smiod for this instruction encoding. Which one to use is determined by 141*3d8817e4Smiod the instruction type and other factors (see opcode_verify ()). */ 142*3d8817e4Smiod unsigned int next_flag : 1; 143*3d8817e4Smiod 144*3d8817e4Smiod /* The disassembly priority of this entry among instructions. */ 145*3d8817e4Smiod unsigned short priority; 146*3d8817e4Smiod }; 147*3d8817e4Smiod 148*3d8817e4Smiod #endif 149