class MCDisassembler

Declaration

class MCDisassembler { /* full declaration omitted */ };

Description

Superclass for all disassemblers. Consumes a memory region and provides an array of assembly instructions.

Declared at: llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:27

Member Variables

protected const llvm::MCSubtargetInfo& STI
protected std::unique_ptr<MCSymbolizer> Symbolizer
public llvm::raw_ostream* CommentStream = nullptr

Method Overview

  • public MCDisassembler(const llvm::MCSubtargetInfo & STI, llvm::MCContext & Ctx)
  • public llvm::MCContext & getContext() const
  • public virtual llvm::MCDisassembler::DecodeStatus getInstruction(llvm::MCInst & Instr, uint64_t & Size, ArrayRef<uint8_t> Bytes, uint64_t Address, llvm::raw_ostream & CStream) const
  • public const llvm::MCSubtargetInfo & getSubtargetInfo() const
  • public virtual llvm::MCDisassembler::DecodeStatus onSymbolStart(llvm::StringRef Name, uint64_t & Size, ArrayRef<uint8_t> Bytes, uint64_t Address, llvm::raw_ostream & CStream) const
  • public void setSymbolizer(std::unique_ptr<MCSymbolizer> Symzer)
  • public void tryAddingPcLoadReferenceComment(int64_t Value, uint64_t Address) const
  • public bool tryAddingSymbolicOperand(llvm::MCInst & Inst, int64_t Value, uint64_t Address, bool IsBranch, uint64_t Offset, uint64_t InstSize) const
  • public virtual ~MCDisassembler()

Methods

MCDisassembler(const llvm::MCSubtargetInfo& STI,
               llvm::MCContext& Ctx)

Declared at: llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:57

Parameters

const llvm::MCSubtargetInfo& STI
llvm::MCContext& Ctx

llvm::MCContext& getContext() const

Declared at: llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:117

virtual llvm::MCDisassembler::DecodeStatus
getInstruction(llvm::MCInst& Instr,
               uint64_t& Size,
               ArrayRef<uint8_t> Bytes,
               uint64_t Address,
               llvm::raw_ostream& CStream) const

Description

Returns the disassembly of a single instruction.

Declared at: llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:77

Parameters

llvm::MCInst& Instr
- An MCInst to populate with the contents of the instruction.
uint64_t& Size
- A value to populate with the size of the instruction, or the number of bytes consumed while attempting to decode an invalid instruction.
ArrayRef<uint8_t> Bytes
- A reference to the actual bytes of the instruction.
uint64_t Address
- The address, in the memory space of region, of the first byte of the instruction.
llvm::raw_ostream& CStream
- The stream to print comments and annotations on.

Returns

- MCDisassembler::Success if the instruction is valid, MCDisassembler::SoftFail if the instruction was disassemblable but invalid, MCDisassembler::Fail if the instruction was invalid.

const llvm::MCSubtargetInfo& getSubtargetInfo()
    const

Declared at: llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:119

virtual llvm::MCDisassembler::DecodeStatus
onSymbolStart(llvm::StringRef Name,
              uint64_t& Size,
              ArrayRef<uint8_t> Bytes,
              uint64_t Address,
              llvm::raw_ostream& CStream) const

Description

May parse any prelude that precedes instructions after the start of a symbol. Needed for some targets, e.g. WebAssembly.

Declared at: llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:92

Parameters

llvm::StringRef Name
- The name of the symbol.
uint64_t& Size
- The number of bytes consumed.
ArrayRef<uint8_t> Bytes
- A reference to the actual bytes at the symbol location.
uint64_t Address
- The address, in the memory space of region, of the first byte of the symbol.
llvm::raw_ostream& CStream
- The stream to print comments and annotations on.

Returns

- MCDisassembler::Success if the bytes are valid, MCDisassembler::Fail if the bytes were invalid.

void setSymbolizer(
    std::unique_ptr<MCSymbolizer> Symzer)

Description

Set \p Symzer as the current symbolizer. This takes ownership of \p Symzer, and deletes the previously set one.

Declared at: llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:115

Parameters

std::unique_ptr<MCSymbolizer> Symzer

void tryAddingPcLoadReferenceComment(
    int64_t Value,
    uint64_t Address) const

Declared at: llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:111

Parameters

int64_t Value
uint64_t Address

bool tryAddingSymbolicOperand(
    llvm::MCInst& Inst,
    int64_t Value,
    uint64_t Address,
    bool IsBranch,
    uint64_t Offset,
    uint64_t InstSize) const

Declared at: llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:106

Parameters

llvm::MCInst& Inst
int64_t Value
uint64_t Address
bool IsBranch
uint64_t Offset
uint64_t InstSize

virtual ~MCDisassembler()

Declared at: llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:60