LLVM API Documentation

Classes | Typedefs | Enumerations | Functions | Variables
llvm::X86Disassembler Namespace Reference

Classes

class  X86GenericDisassembler
struct  InstructionSpecifier
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. Reads a single byte from the instruction's address space.
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.
typedef uint16_t InstrUID

Enumerations

enum  EABase { EA_BASE_NONE }
 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_*). More...
enum  SIBIndex { SIB_INDEX_NONE }
 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. More...
enum  SIBBase { SIB_BASE_NONE }
 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
 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  ModifierType { MODIFIER_max }
enum  DisassemblerMode { MODE_16BIT, MODE_32BIT, MODE_64BIT }

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.
void Debug (const char *file, unsigned line, const char *s)
 Print a message to debugs()
const char * GetInstrName (unsigned Opcode, const void *mii)

Variables

static const unsigned X86_MAX_OPERANDS = 6

Typedef Documentation

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 486 of file X86DisassemblerDecoder.h.

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 494 of file X86DisassemblerDecoder.h.

Definition at line 296 of file X86DisassemblerDecoderCommon.h.


Enumeration Type Documentation

Enumerator:
ATTR_max 

Definition at line 66 of file X86DisassemblerDecoderCommon.h.

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 508 of file X86DisassemblerDecoderCommon.h.

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 

Definition at line 385 of file X86DisassemblerDecoder.h.

Possible displacement types for effective-address computations.

Enumerator:
EA_DISP_NONE 
EA_DISP_8 
EA_DISP_16 
EA_DISP_32 

Definition at line 421 of file X86DisassemblerDecoder.h.

Enumerator:
IC_max 

Definition at line 271 of file X86DisassemblerDecoderCommon.h.

Enumerator:
MODIFIER_max 

Definition at line 497 of file X86DisassemblerDecoderCommon.h.

Enumerator:
MODRM_max 

Definition at line 322 of file X86DisassemblerDecoderCommon.h.

Enumerator:
ONEBYTE 
TWOBYTE 
THREEBYTE_38 
THREEBYTE_3A 
XOP8_MAP 
XOP9_MAP 
XOPA_MAP 

Definition at line 279 of file X86DisassemblerDecoderCommon.h.

Enumerator:
ENCODING_max 

Definition at line 378 of file X86DisassemblerDecoderCommon.h.

Enumerator:
TYPE_max 

Definition at line 479 of file X86DisassemblerDecoderCommon.h.

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

Definition at line 429 of file X86DisassemblerDecoder.h.

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 437 of file X86DisassemblerDecoder.h.

All possible values of the SIB base field.

Enumerator:
SIB_BASE_NONE 

Definition at line 412 of file X86DisassemblerDecoder.h.

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 

Definition at line 400 of file X86DisassemblerDecoder.h.

Enumerator:
TYPE_NO_VEX_XOP 
TYPE_VEX_2B 
TYPE_VEX_3B 
TYPE_EVEX 
TYPE_XOP 

Definition at line 469 of file X86DisassemblerDecoder.h.

Possible values for the VEX.m-mmmm field.

Enumerator:
VEX_LOB_0F 
VEX_LOB_0F38 
VEX_LOB_0F3A 

Definition at line 449 of file X86DisassemblerDecoder.h.

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 462 of file X86DisassemblerDecoder.h.

Enumerator:
XOP_MAP_SELECT_8 
XOP_MAP_SELECT_9 
XOP_MAP_SELECT_A 

Definition at line 455 of file X86DisassemblerDecoder.h.


Function Documentation

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 42 of file X86Disassembler.cpp.

References llvm::dbgs().

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 1809 of file X86DisassemblerDecoder.cpp.

References dbgprintf(), llvm::X86Disassembler::InternalInstruction::dlog, llvm::X86Disassembler::InternalInstruction::dlogArg, getID(), llvm::X86Disassembler::InternalInstruction::instructionID, llvm::X86Disassembler::InternalInstruction::length, logger(), llvm::LibFunc::memset, 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 llvm::AArch64Disassembler::getInstruction(), and llvm::X86Disassembler::X86GenericDisassembler::getInstruction().

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

Definition at line 47 of file X86Disassembler.cpp.

References llvm::MCInstrInfo::getName().

Referenced by getID().


Variable Documentation

Definition at line 503 of file X86DisassemblerDecoderCommon.h.