ia64-asmtab.h 5.0 KB

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