2009-12-19 10:59:52 +08:00
|
|
|
//===- X86DisassemblerShared.h - Emitter shared header ----------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2009-12-19 10:59:52 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_UTILS_TABLEGEN_X86DISASSEMBLERSHARED_H
|
|
|
|
#define LLVM_UTILS_TABLEGEN_X86DISASSEMBLERSHARED_H
|
2009-12-19 10:59:52 +08:00
|
|
|
|
2015-04-08 14:03:17 +08:00
|
|
|
#include <cstring>
|
2012-12-04 18:37:14 +08:00
|
|
|
#include <string>
|
2009-12-19 10:59:52 +08:00
|
|
|
|
2018-03-24 07:58:20 +08:00
|
|
|
#include "llvm/Support/X86DisassemblerDecoderCommon.h"
|
2009-12-19 10:59:52 +08:00
|
|
|
|
2014-04-21 05:35:26 +08:00
|
|
|
struct InstructionSpecifier {
|
2014-04-21 06:10:16 +08:00
|
|
|
llvm::X86Disassembler::OperandSpecifier
|
|
|
|
operands[llvm::X86Disassembler::X86_MAX_OPERANDS];
|
2014-04-21 05:35:26 +08:00
|
|
|
llvm::X86Disassembler::InstructionContext insnContext;
|
|
|
|
std::string name;
|
|
|
|
|
|
|
|
InstructionSpecifier() {
|
|
|
|
insnContext = llvm::X86Disassembler::IC;
|
|
|
|
name = "";
|
|
|
|
memset(operands, 0, sizeof(operands));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-04-21 05:52:16 +08:00
|
|
|
/// Specifies whether a ModR/M byte is needed and (if so) which
|
|
|
|
/// instruction each possible value of the ModR/M byte corresponds to. Once
|
|
|
|
/// this information is known, we have narrowed down to a single instruction.
|
|
|
|
struct ModRMDecision {
|
|
|
|
uint8_t modrm_type;
|
|
|
|
llvm::X86Disassembler::InstrUID instructionIDs[256];
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Specifies which set of ModR/M->instruction tables to look at
|
|
|
|
/// given a particular opcode.
|
|
|
|
struct OpcodeDecision {
|
|
|
|
ModRMDecision modRMDecisions[256];
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Specifies which opcode->instruction tables to look at given
|
|
|
|
/// a particular context (set of attributes). Since there are many possible
|
|
|
|
/// contexts, the decoder first uses CONTEXTS_SYM to determine which context
|
|
|
|
/// applies given a specific set of attributes. Hence there are only IC_max
|
|
|
|
/// entries in this table, rather than 2^(ATTR_max).
|
|
|
|
struct ContextDecision {
|
|
|
|
OpcodeDecision opcodeDecisions[llvm::X86Disassembler::IC_max];
|
2018-03-24 15:15:47 +08:00
|
|
|
|
|
|
|
ContextDecision() {
|
|
|
|
memset(opcodeDecisions, 0, sizeof(opcodeDecisions));
|
|
|
|
}
|
2014-04-21 05:52:16 +08:00
|
|
|
};
|
|
|
|
|
2009-12-19 10:59:52 +08:00
|
|
|
#endif
|