Path: blob/main/contrib/llvm-project/llvm/utils/TableGen/X86DisassemblerShared.h
35258 views
//===- X86DisassemblerShared.h - Emitter shared header ----------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_UTILS_TABLEGEN_X86DISASSEMBLERSHARED_H9#define LLVM_UTILS_TABLEGEN_X86DISASSEMBLERSHARED_H1011#include <cstring>12#include <string>1314#include "llvm/Support/X86DisassemblerDecoderCommon.h"1516struct InstructionSpecifier {17llvm::X86Disassembler::OperandSpecifier18operands[llvm::X86Disassembler::X86_MAX_OPERANDS];19llvm::X86Disassembler::InstructionContext insnContext;20std::string name;2122InstructionSpecifier() {23insnContext = llvm::X86Disassembler::IC;24name = "";25memset(operands, 0, sizeof(operands));26}27};2829/// Specifies whether a ModR/M byte is needed and (if so) which30/// instruction each possible value of the ModR/M byte corresponds to. Once31/// this information is known, we have narrowed down to a single instruction.32struct ModRMDecision {33uint8_t modrm_type;34llvm::X86Disassembler::InstrUID instructionIDs[256];35};3637/// Specifies which set of ModR/M->instruction tables to look at38/// given a particular opcode.39struct OpcodeDecision {40ModRMDecision modRMDecisions[256];41};4243/// Specifies which opcode->instruction tables to look at given44/// a particular context (set of attributes). Since there are many possible45/// contexts, the decoder first uses CONTEXTS_SYM to determine which context46/// applies given a specific set of attributes. Hence there are only IC_max47/// entries in this table, rather than 2^(ATTR_max).48struct ContextDecision {49OpcodeDecision opcodeDecisions[llvm::X86Disassembler::IC_max];5051ContextDecision() { memset(opcodeDecisions, 0, sizeof(opcodeDecisions)); }52};5354#endif555657