LLVM
8.0.1
|
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "X86DisassemblerDecoder.h"
#include "X86GenDisassemblerTables.inc"
Go to the source code of this file.
Classes | |
struct | ModRMDecision |
Specifies whether a ModR/M byte is needed and (if so) which instruction each possible value of the ModR/M byte corresponds to. More... | |
struct | OpcodeDecision |
Specifies which set of ModR/M->instruction tables to look at given a particular opcode. More... | |
struct | ContextDecision |
Specifies which opcode->instruction tables to look at given a particular context (set of attributes). More... | |
Macros | |
#define | debug(s) do { Debug(__FILE__, __LINE__, s); } while (0) |
#define | CONSUME_FUNC(name, type) |
#define | GENERIC_FIXUP_FUNC(name, base, prefix, mask) |
Functions | |
static InstructionContext | contextForAttrs (uint16_t attrMask) |
static int | modRMRequired (OpcodeType type, InstructionContext insnContext, uint16_t opcode) |
static InstrUID | decode (OpcodeType type, InstructionContext insnContext, uint8_t opcode, uint8_t modRM) |
static const struct InstructionSpecifier * | specifierForUID (InstrUID uid) |
static int | consumeByte (struct InternalInstruction *insn, uint8_t *byte) |
static int | lookAtByte (struct InternalInstruction *insn, uint8_t *byte) |
static void | unconsumeByte (struct InternalInstruction *insn) |
static void | dbgprintf (struct InternalInstruction *insn, const char *format,...) |
static bool | isREX (struct InternalInstruction *insn, uint8_t prefix) |
static void | setPrefixPresent (struct InternalInstruction *insn, uint8_t prefix) |
static int | readPrefixes (struct InternalInstruction *insn) |
static int | readModRM (struct InternalInstruction *insn) |
static int | readOpcode (struct InternalInstruction *insn) |
static int | getIDWithAttrMask (uint16_t *instructionID, struct InternalInstruction *insn, uint16_t attrMask) |
static bool | is16BitEquivalent (const char *orig, const char *equiv) |
static bool | is64Bit (const char *name) |
static int | getID (struct InternalInstruction *insn, const void *miiArg) |
static int | readSIB (struct InternalInstruction *insn) |
static int | readDisplacement (struct InternalInstruction *insn) |
static int | fixupReg (struct InternalInstruction *insn, const struct OperandSpecifier *op) |
static int | readOpcodeRegister (struct InternalInstruction *insn, uint8_t size) |
static int | readImmediate (struct InternalInstruction *insn, uint8_t size) |
static int | readVVVV (struct InternalInstruction *insn) |
static int | readMaskRegister (struct InternalInstruction *insn) |
static int | readOperands (struct InternalInstruction *insn) |
Definition at line 227 of file X86DisassemblerDecoder.cpp.
#define debug | ( | s | ) | do { Debug(__FILE__, __LINE__, s); } while (0) |
Definition at line 51 of file X86DisassemblerDecoder.cpp.
Referenced by decode(), fixupReg(), readImmediate(), readOperands(), readPrefixes(), and readSIB().
#define GENERIC_FIXUP_FUNC | ( | name, | |
base, | |||
prefix, | |||
mask | |||
) |
Definition at line 1424 of file X86DisassemblerDecoder.cpp.
|
static |
Definition at line 203 of file X86DisassemblerDecoder.cpp.
References llvm::X86Disassembler::InternalInstruction::reader, llvm::X86Disassembler::InternalInstruction::readerArg, and llvm::X86Disassembler::InternalInstruction::readerCursor.
Referenced by readImmediate(), readModRM(), readOpcode(), readPrefixes(), and readSIB().
|
static |
Definition at line 64 of file X86DisassemblerDecoder.cpp.
References CONTEXTS_SYM.
Referenced by getIDWithAttrMask().
|
static |
Definition at line 270 of file X86DisassemblerDecoder.cpp.
References llvm::format().
Referenced by llvm::X86Disassembler::decodeInstruction(), fixupReg(), getID(), readDisplacement(), readImmediate(), readMaskRegister(), readModRM(), readOpcode(), readOpcodeRegister(), readOperands(), readPrefixes(), readSIB(), and readVVVV().
|
static |
Definition at line 125 of file X86DisassemblerDecoder.cpp.
References debug, ModRMDecision::instructionIDs, modFromModRM, ModRMDecision::modrm_type, llvm::X86Disassembler::ONEBYTE, ONEBYTE_SYM, THREEBYTE38_SYM, THREEBYTE3A_SYM, llvm::X86Disassembler::THREEBYTE_38, llvm::X86Disassembler::THREEBYTE_3A, llvm::X86Disassembler::THREEDNOW_MAP, THREEDNOW_MAP_SYM, llvm::X86Disassembler::TWOBYTE, TWOBYTE_SYM, llvm::X86Disassembler::XOP8_MAP, XOP8_MAP_SYM, llvm::X86Disassembler::XOP9_MAP, XOP9_MAP_SYM, llvm::X86Disassembler::XOPA_MAP, and XOPA_MAP_SYM.
Referenced by encodeCnt(), and getIDWithAttrMask().
|
static |
Definition at line 1521 of file X86DisassemblerDecoder.cpp.
References CASE_ENCODING_RM, dbgprintf(), and debug.
Referenced by readOperands().
|
static |
Definition at line 853 of file X86DisassemblerDecoder.cpp.
References aaaFromEVEX4of4, bFromEVEX4of4, llvm::StringRef::data(), dbgprintf(), getIDWithAttrMask(), llvm::X86Disassembler::GetInstrName(), llvm::X86Disassembler::InternalInstruction::hasAdSize, llvm::X86Disassembler::InternalInstruction::hasOpSize, llvm::X86Disassembler::InternalInstruction::instructionID, is16BitEquivalent(), is64Bit(), l2FromEVEX4of4, lFromEVEX4of4, lFromVEX2of2, lFromVEX3of3, lFromXOP3of3, llvm::X86Disassembler::InternalInstruction::mandatoryPrefix, llvm::X86Disassembler::InternalInstruction::mode, llvm::X86Disassembler::MODE_16BIT, llvm::X86Disassembler::MODE_64BIT, llvm::X86Disassembler::ONEBYTE, llvm::X86Disassembler::InternalInstruction::opcode, llvm::X86Disassembler::InternalInstruction::opcodeType, ppFromEVEX3of4, ppFromVEX2of2, ppFromVEX3of3, ppFromXOP3of3, llvm::X86Disassembler::InternalInstruction::repeatPrefix, llvm::X86Disassembler::InternalInstruction::rexPrefix, llvm::X86Disassembler::InternalInstruction::spec, specifierForUID(), llvm::X86Disassembler::THREEBYTE_38, llvm::X86Disassembler::TWOBYTE, llvm::X86Disassembler::TYPE_EVEX, llvm::X86Disassembler::TYPE_NO_VEX_XOP, llvm::X86Disassembler::TYPE_VEX_2B, llvm::X86Disassembler::TYPE_VEX_3B, llvm::X86Disassembler::TYPE_XOP, llvm::X86Disassembler::InternalInstruction::vectorExtensionPrefix, llvm::X86Disassembler::InternalInstruction::vectorExtensionType, llvm::X86Disassembler::VEX_PREFIX_66, llvm::X86Disassembler::VEX_PREFIX_F2, llvm::X86Disassembler::VEX_PREFIX_F3, wFromEVEX3of4, wFromVEX3of3, wFromXOP3of3, and zFromEVEX4of4.
Referenced by llvm::X86Disassembler::decodeInstruction(), llvm::MemoryAccess::getID(), llvm::RegisterBankInfo::InstructionMapping::InstructionMapping(), llvm::RegisterBankInfo::InstructionMapping::isValid(), okayForPHIOfOps(), llvm::RegisterBankInfo::InstructionMapping::print(), llvm::MemoryDef::print(), llvm::MemoryPhi::print(), and llvm::MemoryAccess::setBlock().
|
static |
Definition at line 772 of file X86DisassemblerDecoder.cpp.
References contextForAttrs(), decode(), llvm::X86Disassembler::InternalInstruction::modRM, modRMRequired(), llvm::X86Disassembler::InternalInstruction::opcode, llvm::X86Disassembler::InternalInstruction::opcodeType, and readModRM().
Referenced by getID().
Definition at line 808 of file X86DisassemblerDecoder.cpp.
Referenced by getID().
Definition at line 833 of file X86DisassemblerDecoder.cpp.
Referenced by llvm::object::MachOObjectFile::BindRebaseAddress(), llvm::object::MachOObjectFile::bindTable(), llvm::CC_X86_VectorCallAssignRegister(), llvm::object::MachOObjectFile::checkSymbolTable(), llvm::createX86FixupSetCC(), createX86MCAsmInfo(), llvm::NVPTXAsmPrinter::doFinalization(), dumpRelocs(), llvm::PPCFrameLowering::eliminateCallFramePseudoInstr(), llvm::PPCRegisterInfo::eliminateFrameIndex(), llvm::NVPTXFrameLowering::emitPrologue(), getAccessVariant(), llvm::object::MachOObjectFile::getBytesInAddress(), getDataLayoutString(), getEffectiveRelocModel(), llvm::object::MachOObjectFile::getFileFormatName(), getFixupKindLog2Size(), llvm::object::MachOObjectFile::getHeader64(), getID(), llvm::object::MachOObjectFile::getNValue(), getOpenCLAlignment(), llvm::X86TargetLowering::getRegForInlineAsmConstraint(), llvm::PPCTargetLowering::getRegisterByName(), getRelaxedOpcode(), llvm::object::MachOObjectFile::getRelocation(), llvm::object::MachOObjectFile::getRelocationSymbol(), llvm::object::MachOObjectFile::getSectionAddress(), llvm::object::MachOObjectFile::getSectionAlignment(), llvm::object::MachOObjectFile::getSectionContents(), llvm::object::MachOObjectFile::getSectionSize(), llvm::object::MachOObjectFile::getSymbolByIndex(), llvm::object::MachOObjectFile::getSymbolIndex(), llvm::X86Subtarget::hasCMov(), llvm::X86Subtarget::hasMFence(), llvm::X86::isCalleePop(), isInSymtab(), llvm::object::MachOObjectFile::isSectionStripped(), llvm::X86Subtarget::isTargetNaCl32(), llvm::X86Subtarget::isTargetNaCl64(), isWeak(), llvm::X86Subtarget::isXRaySupported(), llvm::object::MachOObjectFile::lazyBindTable(), llvm::PPCRegisterInfo::lowerDynamicAreaOffset(), llvm::SparcTargetLowering::LowerF128Compare(), llvm::object::MachOObjectFile::moveSymbolNext(), llvm::object::MachOObjectFile::rebaseTable(), llvm::object::MachOObjectFile::symbol_end(), llvm::object::MachOObjectFile::weakBindTable(), llvm::X86ELFMCAsmInfo::X86ELFMCAsmInfo(), and llvm::X86MCAsmInfoDarwin::X86MCAsmInfoDarwin().
|
static |
Definition at line 286 of file X86DisassemblerDecoder.cpp.
References llvm::X86Disassembler::InternalInstruction::mode, and llvm::X86Disassembler::MODE_64BIT.
Referenced by readPrefixes(), and setPrefixPresent().
|
static |
Definition at line 219 of file X86DisassemblerDecoder.cpp.
References llvm::X86Disassembler::InternalInstruction::reader, llvm::X86Disassembler::InternalInstruction::readerArg, and llvm::X86Disassembler::InternalInstruction::readerCursor.
Referenced by readPrefixes(), and setPrefixPresent().
|
static |
Definition at line 79 of file X86DisassemblerDecoder.cpp.
References OpcodeDecision::modRMDecisions, llvm::X86Disassembler::ONEBYTE, ONEBYTE_SYM, ContextDecision::opcodeDecisions, THREEBYTE38_SYM, THREEBYTE3A_SYM, llvm::X86Disassembler::THREEBYTE_38, llvm::X86Disassembler::THREEBYTE_3A, llvm::X86Disassembler::THREEDNOW_MAP, THREEDNOW_MAP_SYM, llvm::X86Disassembler::TWOBYTE, TWOBYTE_SYM, llvm::X86Disassembler::XOP8_MAP, XOP8_MAP_SYM, llvm::X86Disassembler::XOP9_MAP, XOP9_MAP_SYM, llvm::X86Disassembler::XOPA_MAP, and XOPA_MAP_SYM.
Referenced by getIDWithAttrMask().
|
static |
Definition at line 1237 of file X86DisassemblerDecoder.cpp.
References llvm::X86Disassembler::InternalInstruction::consumedDisplacement, dbgprintf(), llvm::X86Disassembler::InternalInstruction::displacement, llvm::X86Disassembler::InternalInstruction::displacementOffset, llvm::X86Disassembler::EA_DISP_16, llvm::X86Disassembler::EA_DISP_32, llvm::X86Disassembler::EA_DISP_8, llvm::X86Disassembler::EA_DISP_NONE, llvm::X86Disassembler::InternalInstruction::eaDisplacement, llvm::X86Disassembler::InternalInstruction::readerCursor, and llvm::X86Disassembler::InternalInstruction::startLocation.
Referenced by readModRM().
|
static |
Definition at line 1620 of file X86DisassemblerDecoder.cpp.
References consumeByte(), dbgprintf(), debug, llvm::X86Disassembler::InternalInstruction::immediateOffset, llvm::X86Disassembler::InternalInstruction::immediates, llvm::X86Disassembler::InternalInstruction::immediateSize, llvm::X86Disassembler::InternalInstruction::numImmediatesConsumed, llvm::X86Disassembler::InternalInstruction::readerCursor, llvm::size(), and llvm::X86Disassembler::InternalInstruction::startLocation.
Referenced by readOperands().
|
static |
Definition at line 1704 of file X86DisassemblerDecoder.cpp.
References aaaFromEVEX4of4, dbgprintf(), llvm::X86Disassembler::TYPE_EVEX, llvm::X86Disassembler::InternalInstruction::vectorExtensionPrefix, llvm::X86Disassembler::InternalInstruction::vectorExtensionType, and llvm::X86Disassembler::InternalInstruction::writemask.
Referenced by readOperands().
|
static |
Definition at line 1282 of file X86DisassemblerDecoder.cpp.
References llvm::X86Disassembler::InternalInstruction::addressSize, bFromREX, consumeByte(), llvm::X86Disassembler::InternalInstruction::consumedModRM, dbgprintf(), llvm::X86Disassembler::InternalInstruction::displacementSize, llvm::X86Disassembler::EA_BASE_NONE, llvm::X86Disassembler::EA_DISP_16, llvm::X86Disassembler::EA_DISP_32, llvm::X86Disassembler::EA_DISP_8, llvm::X86Disassembler::EA_DISP_NONE, llvm::X86Disassembler::InternalInstruction::eaBase, llvm::X86Disassembler::InternalInstruction::eaDisplacement, llvm::X86Disassembler::InternalInstruction::eaRegBase, LLVM_FALLTHROUGH, llvm::X86Disassembler::InternalInstruction::mode, llvm::X86Disassembler::MODE_64BIT, modFromModRM, llvm::X86Disassembler::InternalInstruction::modRM, r2FromEVEX2of4, readDisplacement(), readSIB(), llvm::X86Disassembler::InternalInstruction::reg, llvm::X86Disassembler::InternalInstruction::regBase, regFromModRM, llvm::X86Disassembler::InternalInstruction::registerSize, llvm::X86Disassembler::InternalInstruction::rexPrefix, rFromREX, rmFromModRM, llvm::X86Disassembler::TYPE_EVEX, llvm::X86Disassembler::InternalInstruction::vectorExtensionPrefix, llvm::X86Disassembler::InternalInstruction::vectorExtensionType, and xFromEVEX2of4.
Referenced by getIDWithAttrMask(), readOpcode(), readOperands(), and readPrefixes().
|
static |
Definition at line 644 of file X86DisassemblerDecoder.cpp.
References consumeByte(), dbgprintf(), llvm::X86Disassembler::InternalInstruction::mandatoryPrefix, mmFromEVEX2of4, mmmmmFromVEX2of3, mmmmmFromXOP2of3, llvm::X86Disassembler::ONEBYTE, llvm::X86Disassembler::InternalInstruction::opcode, llvm::X86Disassembler::InternalInstruction::opcodeType, readModRM(), llvm::X86Disassembler::THREEBYTE_38, llvm::X86Disassembler::THREEBYTE_3A, llvm::X86Disassembler::THREEDNOW_MAP, llvm::X86Disassembler::TWOBYTE, llvm::X86Disassembler::TYPE_EVEX, llvm::X86Disassembler::TYPE_VEX_2B, llvm::X86Disassembler::TYPE_VEX_3B, llvm::X86Disassembler::TYPE_XOP, llvm::X86Disassembler::InternalInstruction::vectorExtensionPrefix, llvm::X86Disassembler::InternalInstruction::vectorExtensionType, llvm::X86Disassembler::VEX_LOB_0F, llvm::X86Disassembler::VEX_LOB_0F38, llvm::X86Disassembler::VEX_LOB_0F3A, llvm::X86Disassembler::XOP8_MAP, llvm::X86Disassembler::XOP9_MAP, llvm::X86Disassembler::XOP_MAP_SELECT_8, llvm::X86Disassembler::XOP_MAP_SELECT_9, llvm::X86Disassembler::XOP_MAP_SELECT_A, and llvm::X86Disassembler::XOPA_MAP.
Referenced by llvm::X86Disassembler::decodeInstruction().
|
static |
Definition at line 1573 of file X86DisassemblerDecoder.cpp.
References bFromREX, dbgprintf(), llvm::X86Disassembler::InternalInstruction::opcode, llvm::X86Disassembler::InternalInstruction::opcodeRegister, llvm::X86Disassembler::InternalInstruction::registerSize, and llvm::X86Disassembler::InternalInstruction::rexPrefix.
Referenced by readOperands().
|
static |
Definition at line 1722 of file X86DisassemblerDecoder.cpp.
References llvm::X86Disassembler::InternalInstruction::addressSize, CASE_ENCODING_RM, CASE_ENCODING_VSIB, dbgprintf(), debug, llvm::X86Disassembler::InternalInstruction::displacement, llvm::X86Disassembler::EA_DISP_8, llvm::X86Disassembler::InternalInstruction::eaBase, llvm::X86Disassembler::InternalInstruction::eaDisplacement, fixupReg(), llvm::X86Disassembler::InternalInstruction::immediates, llvm::X86Disassembler::InternalInstruction::immediateSize, l2FromEVEX4of4, lFromEVEX4of4, llvm::X86Disassembler::InternalInstruction::mode, llvm::X86Disassembler::MODE_64BIT, llvm::X86Disassembler::InternalInstruction::numImmediatesConsumed, llvm::X86Disassembler::InstructionSpecifier::operands, llvm::X86Disassembler::InternalInstruction::RC, readImmediate(), readMaskRegister(), readModRM(), readOpcodeRegister(), readVVVV(), llvm::X86Disassembler::SIB_INDEX_NONE, llvm::X86Disassembler::InternalInstruction::sibIndex, llvm::X86Disassembler::InternalInstruction::sibIndexBase, llvm::X86Disassembler::InternalInstruction::spec, llvm::X86Disassembler::TYPE_EVEX, v2FromEVEX4of4, llvm::X86Disassembler::InternalInstruction::vectorExtensionPrefix, llvm::X86Disassembler::InternalInstruction::vectorExtensionType, and llvm::X86Disassembler::InternalInstruction::vvvv.
Referenced by llvm::X86Disassembler::decodeInstruction().
|
static |
Definition at line 338 of file X86DisassemblerDecoder.cpp.
References llvm::X86Disassembler::InternalInstruction::addressSize, bFromEVEX2of4, bFromVEX2of3, bFromXOP2of3, consumeByte(), dbgprintf(), debug, llvm::X86Disassembler::InternalInstruction::displacementSize, llvm::X86Disassembler::InternalInstruction::hasAdSize, llvm::X86Disassembler::InternalInstruction::hasOpSize, llvm::X86Disassembler::InternalInstruction::immediateSize, isPrefix(), isREX(), lookAtByte(), llvm::X86Disassembler::InternalInstruction::mode, llvm::X86Disassembler::MODE_16BIT, llvm::X86Disassembler::MODE_32BIT, llvm::X86Disassembler::MODE_64BIT, nextByte(), ppFromVEX2of2, ppFromXOP3of3, llvm::X86Disassembler::InternalInstruction::readerCursor, readModRM(), llvm::X86Disassembler::InternalInstruction::registerSize, llvm::X86Disassembler::InternalInstruction::rexPrefix, rFromEVEX2of4, rFromVEX2of2, rFromVEX2of3, rFromXOP2of3, llvm::X86Disassembler::SEG_OVERRIDE_CS, llvm::X86Disassembler::SEG_OVERRIDE_DS, llvm::X86Disassembler::SEG_OVERRIDE_ES, llvm::X86Disassembler::SEG_OVERRIDE_FS, llvm::X86Disassembler::SEG_OVERRIDE_GS, llvm::X86Disassembler::SEG_OVERRIDE_SS, llvm::X86Disassembler::InternalInstruction::segmentOverride, setPrefixPresent(), llvm::X86Disassembler::InternalInstruction::startLocation, llvm::X86Disassembler::TYPE_EVEX, llvm::X86Disassembler::TYPE_NO_VEX_XOP, llvm::X86Disassembler::TYPE_VEX_2B, llvm::X86Disassembler::TYPE_VEX_3B, llvm::X86Disassembler::TYPE_XOP, unconsumeByte(), llvm::X86Disassembler::InternalInstruction::vectorExtensionPrefix, llvm::X86Disassembler::InternalInstruction::vectorExtensionType, llvm::X86Disassembler::VEX_PREFIX_66, wFromEVEX3of4, wFromREX, wFromVEX3of3, wFromXOP3of3, llvm::X86Disassembler::InternalInstruction::xAcquireRelease, xFromEVEX2of4, xFromVEX2of3, and xFromXOP2of3.
Referenced by llvm::X86Disassembler::decodeInstruction().
|
static |
Definition at line 1161 of file X86DisassemblerDecoder.cpp.
References llvm::X86Disassembler::InternalInstruction::addressSize, baseFromSIB, bFromREX, consumeByte(), llvm::X86Disassembler::InternalInstruction::consumedSIB, dbgprintf(), debug, llvm::X86Disassembler::EA_DISP_32, llvm::X86Disassembler::EA_DISP_8, llvm::X86Disassembler::InternalInstruction::eaDisplacement, indexFromSIB, modFromModRM, llvm::X86Disassembler::InternalInstruction::modRM, llvm::X86Disassembler::InternalInstruction::rexPrefix, scaleFromSIB, llvm::X86Disassembler::InternalInstruction::sib, llvm::X86Disassembler::SIB_BASE_NONE, llvm::X86Disassembler::SIB_INDEX_NONE, llvm::X86Disassembler::InternalInstruction::sibBase, llvm::X86Disassembler::InternalInstruction::sibIndex, llvm::X86Disassembler::InternalInstruction::sibIndexBase, llvm::X86Disassembler::InternalInstruction::sibScale, and xFromREX.
Referenced by readModRM().
|
static |
Definition at line 1674 of file X86DisassemblerDecoder.cpp.
References dbgprintf(), llvm::X86Disassembler::InternalInstruction::mode, llvm::X86Disassembler::MODE_64BIT, llvm::X86Disassembler::TYPE_EVEX, llvm::X86Disassembler::TYPE_VEX_2B, llvm::X86Disassembler::TYPE_VEX_3B, llvm::X86Disassembler::TYPE_XOP, v2FromEVEX4of4, llvm::X86Disassembler::InternalInstruction::vectorExtensionPrefix, llvm::X86Disassembler::InternalInstruction::vectorExtensionType, llvm::X86Disassembler::InternalInstruction::vvvv, vvvvFromEVEX3of4, vvvvFromVEX2of2, vvvvFromVEX3of3, and vvvvFromXOP3of3.
Referenced by readOperands().
|
static |
Definition at line 298 of file X86DisassemblerDecoder.cpp.
References llvm::X86Disassembler::InternalInstruction::hasLockPrefix, isREX(), lookAtByte(), llvm::X86Disassembler::InternalInstruction::mandatoryPrefix, nextByte(), and llvm::X86Disassembler::InternalInstruction::repeatPrefix.
Referenced by readPrefixes().
|
static |
Definition at line 189 of file X86DisassemblerDecoder.cpp.
References INSTRUCTIONS_SYM.
Referenced by getID().
|
static |
Definition at line 223 of file X86DisassemblerDecoder.cpp.
References llvm::X86Disassembler::InternalInstruction::readerCursor.
Referenced by readPrefixes().