LLVM  6.0.0svn
Classes | Typedefs | Enumerations | Functions | Variables
llvm::X86Disassembler Namespace Reference

Classes

struct  InstructionSpecifier
 The specification for how to extract and interpret a full instruction and its operands. More...
 
struct  InternalInstruction
 The x86 internal instruction, which is produced by the decoder. More...
 
struct  OperandSpecifier
 The specification for how to extract and interpret one operand. More...
 

Typedefs

typedef int(* byteReader_t) (const void *arg, uint8_t *byte, uint64_t address)
 Type for the byte reader that the consumer must provide to the decoder. More...
 
typedef void(* dlog_t) (void *arg, const char *log)
 Type for the logging function that the consumer can provide to get debugging output from the decoder. More...
 
typedef uint16_t InstrUID
 

Enumerations

enum  EABase { EA_BASE_NONE, EA_max }
 All possible values of the base field for effective-address computations, a.k.a. More...
 
enum  SIBIndex { SIB_INDEX_NONE, SIB_INDEX_max }
 All possible values of the SIB index field. More...
 
enum  SIBBase { SIB_BASE_NONE, SIB_BASE_max }
 All possible values of the SIB base field. More...
 
enum  EADisplacement { EA_DISP_NONE, EA_DISP_8, EA_DISP_16, EA_DISP_32 }
 Possible displacement types for effective-address computations. More...
 
enum  Reg { MODRM_REG_max }
 All possible values of the reg field in the ModR/M byte. More...
 
enum  SegmentOverride {
  SEG_OVERRIDE_NONE, SEG_OVERRIDE_CS, SEG_OVERRIDE_SS, SEG_OVERRIDE_DS,
  SEG_OVERRIDE_ES, SEG_OVERRIDE_FS, SEG_OVERRIDE_GS, SEG_OVERRIDE_max
}
 All possible segment overrides. More...
 
enum  VEXLeadingOpcodeByte { VEX_LOB_0F = 0x1, VEX_LOB_0F38 = 0x2, VEX_LOB_0F3A = 0x3 }
 Possible values for the VEX.m-mmmm field. More...
 
enum  XOPMapSelect { XOP_MAP_SELECT_8 = 0x8, XOP_MAP_SELECT_9 = 0x9, XOP_MAP_SELECT_A = 0xA }
 
enum  VEXPrefixCode { VEX_PREFIX_NONE = 0x0, VEX_PREFIX_66 = 0x1, VEX_PREFIX_F3 = 0x2, VEX_PREFIX_F2 = 0x3 }
 Possible values for the VEX.pp/EVEX.pp field. More...
 
enum  VectorExtensionType {
  TYPE_NO_VEX_XOP = 0x0, TYPE_VEX_2B = 0x1, TYPE_VEX_3B = 0x2, TYPE_EVEX = 0x3,
  TYPE_XOP = 0x4
}
 
enum  attributeBits { ATTR_max }
 
enum  InstructionContext { IC_max }
 
enum  OpcodeType {
  ONEBYTE = 0, TWOBYTE = 1, THREEBYTE_38 = 2, THREEBYTE_3A = 3,
  XOP8_MAP = 4, XOP9_MAP = 5, XOPA_MAP = 6
}
 
enum  ModRMDecisionType { MODRM_max }
 
enum  OperandEncoding { ENCODING_max }
 
enum  OperandType { TYPE_max }
 
enum  DisassemblerMode { MODE_16BIT, MODE_32BIT, MODE_64BIT }
 Decoding mode for the Intel disassembler. More...
 

Functions

int decodeInstruction (InternalInstruction *insn, byteReader_t reader, const void *readerArg, dlog_t logger, void *loggerArg, const void *miiArg, uint64_t startLoc, DisassemblerMode mode)
 Decode one instruction and store the decoding results in a buffer provided by the consumer. More...
 
void Debug (const char *file, unsigned line, const char *s)
 Print a message to debugs() More...
 
StringRef GetInstrName (unsigned Opcode, const void *mii)
 

Variables

static const unsigned X86_MAX_OPERANDS = 6
 

Typedef Documentation

◆ byteReader_t

typedef int(* llvm::X86Disassembler::byteReader_t) (const void *arg, uint8_t *byte, uint64_t address)

Type for the byte reader that the consumer must provide to the decoder.

Reads a single byte from the instruction's address space.

Parameters
argA baton that the consumer can associate with any internal state that it needs.
byteA pointer to a single byte in memory that should be set to contain the value at address.
addressThe address in the instruction's address space that should be read from.
Returns
-1 if the byte cannot be read for any reason; 0 otherwise.

Definition at line 508 of file X86DisassemblerDecoder.h.

◆ dlog_t

typedef void(* llvm::X86Disassembler::dlog_t) (void *arg, const char *log)

Type for the logging function that the consumer can provide to get debugging output from the decoder.

Parameters
argA baton that the consumer can associate with any internal state that it needs.
logA string that contains the message. Will be reused after the logger returns.

Definition at line 516 of file X86DisassemblerDecoder.h.

◆ InstrUID

Definition at line 301 of file X86DisassemblerDecoderCommon.h.

Enumeration Type Documentation

◆ attributeBits

Enumerator
ATTR_max 

Definition at line 66 of file X86DisassemblerDecoderCommon.h.

◆ DisassemblerMode

Decoding mode for the Intel disassembler.

16-bit, 32-bit, and 64-bit mode are supported, and represent real mode, IA-32e, and IA-32e in 64-bit mode, respectively.

Enumerator
MODE_16BIT 
MODE_32BIT 
MODE_64BIT 

Definition at line 456 of file X86DisassemblerDecoderCommon.h.

◆ EABase

All possible values of the base field for effective-address computations, a.k.a.

the Mod and R/M fields of the ModR/M byte. We distinguish between bases (EA_BASE_*) and registers that just happen to be referred to when Mod == 0b11 (EA_REG_*).

Enumerator
EA_BASE_NONE 
EA_max 

Definition at line 407 of file X86DisassemblerDecoder.h.

◆ EADisplacement

Possible displacement types for effective-address computations.

Enumerator
EA_DISP_NONE 
EA_DISP_8 
EA_DISP_16 
EA_DISP_32 

Definition at line 443 of file X86DisassemblerDecoder.h.

◆ InstructionContext

Enumerator
IC_max 

Definition at line 276 of file X86DisassemblerDecoderCommon.h.

◆ ModRMDecisionType

Enumerator
MODRM_max 

Definition at line 327 of file X86DisassemblerDecoderCommon.h.

◆ OpcodeType

Enumerator
ONEBYTE 
TWOBYTE 
THREEBYTE_38 
THREEBYTE_3A 
XOP8_MAP 
XOP9_MAP 
XOPA_MAP 

Definition at line 284 of file X86DisassemblerDecoderCommon.h.

◆ OperandEncoding

Enumerator
ENCODING_max 

Definition at line 393 of file X86DisassemblerDecoderCommon.h.

◆ OperandType

Enumerator
TYPE_max 

Definition at line 439 of file X86DisassemblerDecoderCommon.h.

◆ Reg

All possible values of the reg field in the ModR/M byte.

Enumerator
MODRM_REG_max 

Definition at line 451 of file X86DisassemblerDecoder.h.

◆ SegmentOverride

All possible segment overrides.

Enumerator
SEG_OVERRIDE_NONE 
SEG_OVERRIDE_CS 
SEG_OVERRIDE_SS 
SEG_OVERRIDE_DS 
SEG_OVERRIDE_ES 
SEG_OVERRIDE_FS 
SEG_OVERRIDE_GS 
SEG_OVERRIDE_max 

Definition at line 459 of file X86DisassemblerDecoder.h.

◆ SIBBase

All possible values of the SIB base field.

Enumerator
SIB_BASE_NONE 
SIB_BASE_max 

Definition at line 434 of file X86DisassemblerDecoder.h.

◆ SIBIndex

All possible values of the SIB index field.

borrows entries from ALL_EA_BASES with the special case that sib is synonymous with NONE. Vector SIB: index can be XMM or YMM.

Enumerator
SIB_INDEX_NONE 
SIB_INDEX_max 

Definition at line 422 of file X86DisassemblerDecoder.h.

◆ VectorExtensionType

Enumerator
TYPE_NO_VEX_XOP 
TYPE_VEX_2B 
TYPE_VEX_3B 
TYPE_EVEX 
TYPE_XOP 

Definition at line 491 of file X86DisassemblerDecoder.h.

◆ VEXLeadingOpcodeByte

Possible values for the VEX.m-mmmm field.

Enumerator
VEX_LOB_0F 
VEX_LOB_0F38 
VEX_LOB_0F3A 

Definition at line 471 of file X86DisassemblerDecoder.h.

◆ VEXPrefixCode

Possible values for the VEX.pp/EVEX.pp field.

Enumerator
VEX_PREFIX_NONE 
VEX_PREFIX_66 
VEX_PREFIX_F3 
VEX_PREFIX_F2 

Definition at line 484 of file X86DisassemblerDecoder.h.

◆ XOPMapSelect

Enumerator
XOP_MAP_SELECT_8 
XOP_MAP_SELECT_9 
XOP_MAP_SELECT_A 

Definition at line 477 of file X86DisassemblerDecoder.h.

Function Documentation

◆ Debug()

void llvm::X86Disassembler::Debug ( const char file,
unsigned  line,
const char s 
)

Print a message to debugs()

Parameters
fileThe name of the file printing the debug message.
lineThe line number that printed the debug message.
sThe message to print.

Definition at line 95 of file X86Disassembler.cpp.

References llvm::dbgs().

◆ decodeInstruction()

int llvm::X86Disassembler::decodeInstruction ( InternalInstruction insn,
byteReader_t  reader,
const void *  readerArg,
dlog_t  logger,
void *  loggerArg,
const void *  miiArg,
uint64_t  startLoc,
DisassemblerMode  mode 
)

Decode one instruction and store the decoding results in a buffer provided by the consumer.

Parameters
insnThe buffer to store the instruction in. Allocated by the consumer.
readerThe byteReader_t for the bytes to be read.
readerArgAn argument to pass to the reader for storing context specific to the consumer. May be NULL.
loggerThe dlog_t to be used in printing status messages from the disassembler. May be NULL.
loggerArgAn argument to pass to the logger for storing context specific to the logger. May be NULL.
startLocThe address (in the reader's address space) of the first byte in the instruction.
modeThe mode (16-bit, 32-bit, 64-bit) to decode in.
Returns
Nonzero if there was an error during decode, 0 otherwise.

Definition at line 1873 of file X86DisassemblerDecoder.cpp.

References dbgprintf(), llvm::X86Disassembler::InternalInstruction::dlog, llvm::X86Disassembler::InternalInstruction::dlogArg, getID(), llvm::X86Disassembler::InternalInstruction::instructionID, llvm::X86Disassembler::InternalInstruction::length, logger(), mode, llvm::X86Disassembler::InternalInstruction::mode, llvm::X86Disassembler::InternalInstruction::numImmediatesConsumed, llvm::X86Disassembler::InstructionSpecifier::operands, llvm::X86Disassembler::InternalInstruction::operands, llvm::X86Disassembler::InternalInstruction::reader, llvm::X86Disassembler::InternalInstruction::readerArg, llvm::X86Disassembler::InternalInstruction::readerCursor, readOpcode(), readOperands(), readPrefixes(), llvm::X86Disassembler::InternalInstruction::spec, and llvm::X86Disassembler::InternalInstruction::startLocation.

Referenced by AddThumb1SBit(), adjustDuplex(), checkDecodedInstruction(), decodeBDVAddr64Disp12Operand(), decodeCRBitMOperand(), DecodeL4RSrcDstSrcDstInstruction(), DecodeLdRLImmInstruction(), decodeSImmOperandAndLsl1(), getDecoderTable(), llvm::AArch64Disassembler::getInstruction(), llvm::LanaiDisassembler::getInstruction(), logger(), readInstruction32(), readInstruction64(), and llvm::AMDGPUDisassembler::tryDecodeInst().

◆ GetInstrName()

StringRef llvm::X86Disassembler::GetInstrName ( unsigned  Opcode,
const void *  mii 
)

Definition at line 100 of file X86Disassembler.cpp.

References llvm::MCInstrInfo::getName().

Referenced by getID().

Variable Documentation

◆ X86_MAX_OPERANDS

const unsigned llvm::X86Disassembler::X86_MAX_OPERANDS = 6
static

Definition at line 451 of file X86DisassemblerDecoderCommon.h.