LLVM API Documentation
#include <MCDisassembler.h>


Public Types | |
| enum | DecodeStatus { Fail = 0, SoftFail = 1, Success = 3 } |
Public Member Functions | |
| MCDisassembler (const MCSubtargetInfo &STI) | |
| Constructor - Performs initial setup for the disassembler. | |
| virtual | ~MCDisassembler () |
| virtual DecodeStatus | getInstruction (MCInst &instr, uint64_t &size, const MemoryObject ®ion, uint64_t address, raw_ostream &vStream, raw_ostream &cStream) const =0 |
| void | setupForSymbolicDisassembly (LLVMOpInfoCallback getOpInfo, LLVMSymbolLookupCallback symbolLookUp, void *disInfo, MCContext *ctx) |
| LLVMOpInfoCallback | getLLVMOpInfoCallback () const |
| LLVMSymbolLookupCallback | getLLVMSymbolLookupCallback () const |
| void * | getDisInfoBlock () const |
| MCContext * | getMCContext () const |
Public Attributes | |
| raw_ostream * | CommentStream |
Protected Attributes | |
| const MCSubtargetInfo & | STI |
MCDisassembler - Superclass for all disassemblers. Consumes a memory region and provides an array of assembly instructions.
Definition at line 25 of file MCDisassembler.h.
Ternary decode status. Most backends will just use Fail and Success, however some have a concept of an instruction with understandable semantics but which is architecturally incorrect. An example of this is ARM UNPREDICTABLE instructions which are disassemblable but cause undefined behaviour.
Because it makes sense to disassemble these instructions, there is a "soft fail" failure mode that indicates the MCInst& is valid but architecturally incorrect.
The enum numbers are deliberately chosen such that reduction from Success->SoftFail ->Fail can be done with a simple bitwise-AND:
LEFT & TOP = | Success Unpredictable Fail --------------+----------------------------------- Success | Success Unpredictable Fail Unpredictable | Unpredictable Unpredictable Fail Fail | Fail Fail Fail
An easy way of encoding this is as 0b11, 0b01, 0b00 for Success, SoftFail, Fail respectively.
Definition at line 49 of file MCDisassembler.h.
| llvm::MCDisassembler::MCDisassembler | ( | const MCSubtargetInfo & | STI | ) | [inline] |
Constructor - Performs initial setup for the disassembler.
Definition at line 56 of file MCDisassembler.h.
| MCDisassembler::~MCDisassembler | ( | ) | [virtual] |
Definition at line 13 of file MCDisassembler.cpp.
| void* llvm::MCDisassembler::getDisInfoBlock | ( | ) | const [inline] |
Definition at line 116 of file MCDisassembler.h.
Referenced by tryAddingPcLoadReferenceComment(), and tryAddingSymbolicOperand().
| virtual DecodeStatus llvm::MCDisassembler::getInstruction | ( | MCInst & | instr, |
| uint64_t & | size, | ||
| const MemoryObject & | region, | ||
| uint64_t | address, | ||
| raw_ostream & | vStream, | ||
| raw_ostream & | cStream | ||
| ) | const [pure virtual] |
getInstruction - Returns the disassembly of a single instruction.
| instr | - An MCInst to populate with the contents of the instruction. |
| size | - A value to populate with the size of the instruction, or the number of bytes consumed while attempting to decode an invalid instruction. |
| region | - The memory object to use as a source for machine code. |
| address | - The address, in the memory space of region, of the first byte of the instruction. |
| vStream | - The stream to print warnings and diagnostic messages on. |
| cStream | - The stream to print comments and annotations on. |
Implemented in llvm::X86Disassembler::X86GenericDisassembler, and llvm::MBlazeDisassembler.
Referenced by LLVMDisasmInstruction().
| LLVMOpInfoCallback llvm::MCDisassembler::getLLVMOpInfoCallback | ( | ) | const [inline] |
Definition at line 112 of file MCDisassembler.h.
Referenced by tryAddingSymbolicOperand().
| LLVMSymbolLookupCallback llvm::MCDisassembler::getLLVMSymbolLookupCallback | ( | ) | const [inline] |
Definition at line 113 of file MCDisassembler.h.
Referenced by tryAddingPcLoadReferenceComment(), and tryAddingSymbolicOperand().
| MCContext* llvm::MCDisassembler::getMCContext | ( | ) | const [inline] |
Definition at line 117 of file MCDisassembler.h.
Referenced by tryAddingSymbolicOperand().
| void llvm::MCDisassembler::setupForSymbolicDisassembly | ( | LLVMOpInfoCallback | getOpInfo, |
| LLVMSymbolLookupCallback | symbolLookUp, | ||
| void * | disInfo, | ||
| MCContext * | ctx | ||
| ) | [inline] |
Definition at line 103 of file MCDisassembler.h.
Referenced by LLVMCreateDisasmCPU().
raw_ostream* llvm::MCDisassembler::CommentStream [mutable] |
Definition at line 121 of file MCDisassembler.h.
Referenced by llvm::X86Disassembler::X86GenericDisassembler::getInstruction(), tryAddingPcLoadReferenceComment(), and tryAddingSymbolicOperand().
const MCSubtargetInfo& llvm::MCDisassembler::STI [protected] |
Definition at line 100 of file MCDisassembler.h.