18ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan//===- X86RecognizableInstr.h - Disassembler instruction spec ----*- C++ -*-===//
28ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan//
38ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan//                     The LLVM Compiler Infrastructure
48ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan//
58ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan// This file is distributed under the University of Illinois Open Source
68ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan// License. See LICENSE.TXT for details.
78ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan//
88ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan//===----------------------------------------------------------------------===//
98ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan//
108ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan// This file is part of the X86 Disassembler Emitter.
118ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan// It contains the interface of a single recognizable instruction.
128ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan// Documentation for the disassembler emitter in general can be found in
138ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan//  X86DisasemblerEmitter.h.
148ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan//
158ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan//===----------------------------------------------------------------------===//
168ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan
1737ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines#ifndef LLVM_UTILS_TABLEGEN_X86RECOGNIZABLEINSTR_H
1837ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines#define LLVM_UTILS_TABLEGEN_X86RECOGNIZABLEINSTR_H
198ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan
208ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan#include "CodeGenTarget.h"
214ffd89fa4d2788611187d1a534d2ed46adf1702cChandler Carruth#include "X86DisassemblerTables.h"
224ffd89fa4d2788611187d1a534d2ed46adf1702cChandler Carruth#include "llvm/Support/DataTypes.h"
234ffd89fa4d2788611187d1a534d2ed46adf1702cChandler Carruth#include "llvm/TableGen/Record.h"
248ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan
258ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanannamespace llvm {
268ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan
278ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanannamespace X86Disassembler {
288ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan
298ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan/// RecognizableInstr - Encapsulates all information required to decode a single
308ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan///   instruction, as extracted from the LLVM instruction tables.  Has methods
318ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan///   to interpret the information available in the LLVM tables, and to emit the
328ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan///   instruction into DisassemblerTables.
338ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callananclass RecognizableInstr {
348ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callananprivate:
358ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// The opcode of the instruction, as used in an MCInst
368ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  InstrUID UID;
378ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// The record from the .td files corresponding to this instruction
388ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  const Record* Rec;
3936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  /// The OpPrefix field from the record
4036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  uint8_t OpPrefix;
4136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  /// The OpMap field from the record
4236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  uint8_t OpMap;
438ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// The opcode field from the record; this is the opcode used in the Intel
448ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// encoding and therefore distinct from the UID
458ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  uint8_t Opcode;
468ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// The form field from the record
478ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  uint8_t Form;
4836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  // The encoding field from the record
4936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  uint8_t Encoding;
5036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  /// The OpSize field from the record
5136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  uint8_t OpSize;
52ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines  /// The AdSize field from the record
53ebe69fe11e48d322045d5949c83283927a0d790bStephen Hines  uint8_t AdSize;
548ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// The hasREX_WPrefix field from the record
558ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  bool HasREX_WPrefix;
5636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  /// The hasVEX_4V field from the record
5736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  bool HasVEX_4V;
5836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  /// The hasVEX_4VOp3 field from the record
5936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  bool HasVEX_4VOp3;
60a21e2eae3def2fe39caed861dcb73c76c715569bSean Callanan  /// The hasVEX_WPrefix field from the record
61a21e2eae3def2fe39caed861dcb73c76c715569bSean Callanan  bool HasVEX_WPrefix;
62a21e2eae3def2fe39caed861dcb73c76c715569bSean Callanan  /// Inferred from the operands; indicates whether the L bit in the VEX prefix is set
63a21e2eae3def2fe39caed861dcb73c76c715569bSean Callanan  bool HasVEX_LPrefix;
64e6a3a2990e3f783c906e9db58e55439cb06f9fa5Craig Topper  /// The hasMemOp4Prefix field from the record
65e6a3a2990e3f783c906e9db58e55439cb06f9fa5Craig Topper  bool HasMemOp4Prefix;
66e6a3a2990e3f783c906e9db58e55439cb06f9fa5Craig Topper  /// The ignoreVEX_L field from the record
676744a17dcfb941d9fdd869b9f06e20660e18ff88Craig Topper  bool IgnoresVEX_L;
68c18f4efc5dd24adcc653806455fc7ae8508e9c66Elena Demikhovsky  /// The hasEVEX_L2Prefix field from the record
69c18f4efc5dd24adcc653806455fc7ae8508e9c66Elena Demikhovsky  bool HasEVEX_L2Prefix;
70c18f4efc5dd24adcc653806455fc7ae8508e9c66Elena Demikhovsky  /// The hasEVEX_K field from the record
71c18f4efc5dd24adcc653806455fc7ae8508e9c66Elena Demikhovsky  bool HasEVEX_K;
72633f98bdfa266871dcd17ab27af1594c6cc31d9eElena Demikhovsky  /// The hasEVEX_KZ field from the record
73633f98bdfa266871dcd17ab27af1594c6cc31d9eElena Demikhovsky  bool HasEVEX_KZ;
74c18f4efc5dd24adcc653806455fc7ae8508e9c66Elena Demikhovsky  /// The hasEVEX_B field from the record
75c18f4efc5dd24adcc653806455fc7ae8508e9c66Elena Demikhovsky  bool HasEVEX_B;
7636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  /// The isCodeGenOnly field from the record
778ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  bool IsCodeGenOnly;
7836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  /// The ForceDisassemble field from the record
7936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  bool ForceDisassemble;
8037ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines  // The CD8_Scale field from the record
8137ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines  uint8_t CD8_Scale;
824da632e6e09b96db4b3f9202cde4e6ca732001c1Craig Topper  // Whether the instruction has the predicate "In64BitMode"
837105259ce8e9fd78ce9fc1b7a9aaab123fb5db64Eli Friedman  bool Is64Bit;
844da632e6e09b96db4b3f9202cde4e6ca732001c1Craig Topper  // Whether the instruction has the predicate "In32BitMode"
854da632e6e09b96db4b3f9202cde4e6ca732001c1Craig Topper  bool Is32Bit;
8617730847d59c919d97f097d46a3fcba1888e5300Craig Topper
878ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// The instruction name as listed in the tables
888ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  std::string Name;
8936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
908ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// Indicates whether the instruction should be emitted into the decode
918ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// tables; regardless, it will be emitted into the instruction info table
928ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  bool ShouldBeEmitted;
938ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan
948ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// The operands of the instruction, as listed in the CodeGenInstruction.
958ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// They are not one-to-one with operands listed in the MCInst; for example,
968ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// memory operands expand to 5 operands in the MCInst
97c240bb0ede0541426254d0e0dc81d891beda4b22Chris Lattner  const std::vector<CGIOperandList::OperandInfo>* Operands;
98c240bb0ede0541426254d0e0dc81d891beda4b22Chris Lattner
998ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// The description of the instruction that is emitted into the instruction
1008ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// info table
1018ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  InstructionSpecifier* Spec;
1028ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan
1038ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// insnContext - Returns the primary context in which the instruction is
1048ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   valid.
1058ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///
1068ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// @return - The context in which the instruction is valid.
1078ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  InstructionContext insnContext() const;
1088a312fb3aaec90537d434a5cc41edf566ff80dcaCraig Topper
1098ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// typeFromString - Translates an operand type from the string provided in
1108ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   the LLVM tables to an OperandType for use in the operand specifier.
1118ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///
1128ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// @param s              - The string, as extracted by calling Rec->getName()
1138ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///                         on a CodeGenInstruction::OperandInfo.
1148ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// @param hasREX_WPrefix - Indicates whether the instruction has a REX.W
1158ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///                         prefix.  If it does, 32-bit register operands stay
1168ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///                         32-bit regardless of the operand size.
11736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  /// @param OpSize           Indicates the operand size of the instruction.
11836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  ///                         If register size does not match OpSize, then
11936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  ///                         register sizes keep their size.
1208ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// @return               - The operand's type.
12136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  static OperandType typeFromString(const std::string& s,
12236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines                                    bool hasREX_WPrefix, uint8_t OpSize);
12336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
1248ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// immediateEncodingFromString - Translates an immediate encoding from the
1258ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   string provided in the LLVM tables to an OperandEncoding for use in
1268ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   the operand specifier.
1278ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///
12836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  /// @param s       - See typeFromString().
12936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  /// @param OpSize  - Indicates whether this is an OpSize16 instruction.
13036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  ///                  If it is not, then 16-bit immediate operands stay 16-bit.
13136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  /// @return        - The operand's encoding.
1328ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  static OperandEncoding immediateEncodingFromString(const std::string &s,
13336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines                                                     uint8_t OpSize);
13436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
1358ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// rmRegisterEncodingFromString - Like immediateEncodingFromString, but
1368ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   handles operands that are in the REG field of the ModR/M byte.
1378ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  static OperandEncoding rmRegisterEncodingFromString(const std::string &s,
13836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines                                                      uint8_t OpSize);
13936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
1408ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// rmRegisterEncodingFromString - Like immediateEncodingFromString, but
1418ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   handles operands that are in the REG field of the ModR/M byte.
1428ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  static OperandEncoding roRegisterEncodingFromString(const std::string &s,
14336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines                                                      uint8_t OpSize);
1448ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  static OperandEncoding memoryEncodingFromString(const std::string &s,
14536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines                                                  uint8_t OpSize);
1468ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  static OperandEncoding relocationEncodingFromString(const std::string &s,
14736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines                                                      uint8_t OpSize);
1488ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  static OperandEncoding opcodeModifierEncodingFromString(const std::string &s,
14936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines                                                          uint8_t OpSize);
150a21e2eae3def2fe39caed861dcb73c76c715569bSean Callanan  static OperandEncoding vvvvRegisterEncodingFromString(const std::string &s,
15136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines                                                        uint8_t OpSize);
152c18f4efc5dd24adcc653806455fc7ae8508e9c66Elena Demikhovsky  static OperandEncoding writemaskRegisterEncodingFromString(const std::string &s,
15336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines                                                             uint8_t OpSize);
15436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
15537ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines  /// \brief Adjust the encoding type for an operand based on the instruction.
15637ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines  void adjustOperandEncoding(OperandEncoding &encoding);
15737ed9c199ca639565f6ce88105f9e39e898d82d0Stephen Hines
1588ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// handleOperand - Converts a single operand from the LLVM table format to
1598ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   the emitted table format, handling any duplicate operands it encounters
1608ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   and then one non-duplicate.
1618ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///
1628ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// @param optional             - Determines whether to assert that the
1638ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///                               operand exists.
1648ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// @param operandIndex         - The index into the generated operand table.
1658ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///                               Incremented by this function one or more
1668ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///                               times to reflect possible duplicate
1678ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///                               operands).
1688ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// @param physicalOperandIndex - The index of the current operand into the
1698ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///                               set of non-duplicate ('physical') operands.
1708ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///                               Incremented by this function once.
1718ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// @param numPhysicalOperands  - The number of non-duplicate operands in the
1728ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///                               instructions.
1738ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// @param operandMapping       - The operand mapping, which has an entry for
1748ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///                               each operand that indicates whether it is a
1758ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///                               duplicate, and of what.
1768ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  void handleOperand(bool optional,
1778ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan                     unsigned &operandIndex,
1788ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan                     unsigned &physicalOperandIndex,
179de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar                     unsigned numPhysicalOperands,
1805aba78bd8056dc407bcbce4080ffcd12b13c7342Craig Topper                     const unsigned *operandMapping,
1818ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan                     OperandEncoding (*encodingFromString)
1828ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan                       (const std::string&,
18336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines                        uint8_t OpSize));
18436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
1858ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// shouldBeEmitted - Returns the shouldBeEmitted field.  Although filter()
1868ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   filters out many instructions, at various points in decoding we
1878ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   determine that the instruction should not actually be decodable.  In
1888ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   particular, MMX MOV instructions aren't emitted, but they're only
1898ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   identified during operand parsing.
1908ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///
1918ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// @return - true if at this point we believe the instruction should be
1928ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   emitted; false if not.  This will return false if filter() returns false
1938ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   once emitInstructionSpecifier() has been called.
1948ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  bool shouldBeEmitted() const {
1958ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan    return ShouldBeEmitted;
1968ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  }
1978ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan
1988ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// emitInstructionSpecifier - Loads the instruction specifier for the current
1998ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   instruction into a DisassemblerTables.
2008ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///
20136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  void emitInstructionSpecifier();
2028ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan
2038ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// emitDecodePath - Populates the proper fields in the decode tables
2048ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   corresponding to the decode paths for this instruction.
2058ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///
2062d9eb72178af8e79dc6432cd1b7d29bde16da1b9Dmitri Gribenko  /// \param tables The DisassemblerTables to populate with the decode
2078ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///               decode information for the current instruction.
2088ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  void emitDecodePath(DisassemblerTables &tables) const;
2098ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan
2108ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// Constructor - Initializes a RecognizableInstr with the appropriate fields
2118ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   from a CodeGenInstruction.
2128ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///
2132d9eb72178af8e79dc6432cd1b7d29bde16da1b9Dmitri Gribenko  /// \param tables The DisassemblerTables that the specifier will be added to.
2142d9eb72178af8e79dc6432cd1b7d29bde16da1b9Dmitri Gribenko  /// \param insn   The CodeGenInstruction to extract information from.
2152d9eb72178af8e79dc6432cd1b7d29bde16da1b9Dmitri Gribenko  /// \param uid    The unique ID of the current instruction.
2168ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  RecognizableInstr(DisassemblerTables &tables,
2178ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan                    const CodeGenInstruction &insn,
2188ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan                    InstrUID uid);
2198ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callananpublic:
2208ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  /// processInstr - Accepts a CodeGenInstruction and loads decode information
2218ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///   for it into a DisassemblerTables if appropriate.
2228ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///
2232d9eb72178af8e79dc6432cd1b7d29bde16da1b9Dmitri Gribenko  /// \param tables The DiassemblerTables to be populated with decode
2248ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///               information.
2252d9eb72178af8e79dc6432cd1b7d29bde16da1b9Dmitri Gribenko  /// \param insn   The CodeGenInstruction to be used as a source for this
2268ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  ///               information.
2272d9eb72178af8e79dc6432cd1b7d29bde16da1b9Dmitri Gribenko  /// \param uid    The unique ID of the instruction.
2288ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan  static void processInstr(DisassemblerTables &tables,
2298ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan                           const CodeGenInstruction &insn,
2308ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan                           InstrUID uid);
2318ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan};
2328ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan
2338ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan} // namespace X86Disassembler
2348ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan
2358ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan} // namespace llvm
2368ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan
2378ed9f51663bc5533f36ca62e5668ae08e9a1313fSean Callanan#endif
238