X86DisassemblerShared.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //===- X86DisassemblerShared.h - Emitter shared header ----------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef LLVM_UTILS_TABLEGEN_X86DISASSEMBLERSHARED_H
  10. #define LLVM_UTILS_TABLEGEN_X86DISASSEMBLERSHARED_H
  11. #include <cstring>
  12. #include <string>
  13. #include "../../lib/Target/X86/Disassembler/X86DisassemblerDecoderCommon.h"
  14. struct InstructionSpecifier {
  15. llvm::X86Disassembler::OperandSpecifier
  16. operands[llvm::X86Disassembler::X86_MAX_OPERANDS];
  17. llvm::X86Disassembler::InstructionContext insnContext;
  18. std::string name;
  19. InstructionSpecifier() {
  20. insnContext = llvm::X86Disassembler::IC;
  21. name = "";
  22. memset(operands, 0, sizeof(operands));
  23. }
  24. };
  25. /// Specifies whether a ModR/M byte is needed and (if so) which
  26. /// instruction each possible value of the ModR/M byte corresponds to. Once
  27. /// this information is known, we have narrowed down to a single instruction.
  28. struct ModRMDecision {
  29. uint8_t modrm_type;
  30. llvm::X86Disassembler::InstrUID instructionIDs[256];
  31. };
  32. /// Specifies which set of ModR/M->instruction tables to look at
  33. /// given a particular opcode.
  34. struct OpcodeDecision {
  35. ModRMDecision modRMDecisions[256];
  36. };
  37. /// Specifies which opcode->instruction tables to look at given
  38. /// a particular context (set of attributes). Since there are many possible
  39. /// contexts, the decoder first uses CONTEXTS_SYM to determine which context
  40. /// applies given a specific set of attributes. Hence there are only IC_max
  41. /// entries in this table, rather than 2^(ATTR_max).
  42. struct ContextDecision {
  43. OpcodeDecision opcodeDecisions[llvm::X86Disassembler::IC_max];
  44. };
  45. #endif