LLVM 20.0.0git
Macros | Typedefs | Functions | Variables
XtensaDisassembler.cpp File Reference
#include "MCTargetDesc/XtensaMCTargetDesc.h"
#include "TargetInfo/XtensaTargetInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDecoderOps.h"
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/Endian.h"
#include "XtensaGenDisassemblerTables.inc"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "Xtensa-disassembler"
 

Typedefs

using DecodeStatus = MCDisassembler::DecodeStatus
 

Functions

static MCDisassemblercreateXtensaDisassembler (const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
 
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeXtensaDisassembler ()
 
static DecodeStatus DecodeARRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
 
static DecodeStatus DecodeSRRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const void *Decoder)
 
static bool tryAddingSymbolicOperand (int64_t Value, bool isBranch, uint64_t Address, uint64_t Offset, uint64_t InstSize, MCInst &MI, const void *Decoder)
 
static DecodeStatus decodeCallOperand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeJumpOperand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeBranchOperand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeL32ROperand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeImm8Operand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeImm8_sh8Operand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeImm12Operand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeUimm4Operand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeUimm5Operand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeImm1_16Operand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeImm1n_15Operand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeImm32n_95Operand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeShimm1_31Operand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeB4constOperand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeB4constuOperand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeMem8Operand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeMem16Operand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeMem32Operand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus decodeMem32nOperand (MCInst &Inst, uint64_t Imm, int64_t Address, const void *Decoder)
 
static DecodeStatus readInstruction16 (ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint64_t &Insn, bool IsLittleEndian)
 Read two bytes from the ArrayRef and return 16 bit data sorted according to the given endianness.
 
static DecodeStatus readInstruction24 (ArrayRef< uint8_t > Bytes, uint64_t Address, uint64_t &Size, uint64_t &Insn, bool IsLittleEndian)
 Read three bytes from the ArrayRef and return 24 bit data.
 

Variables

static const unsigned ARDecoderTable []
 
static const unsigned SRDecoderTable [] = {Xtensa::SAR, 3}
 
static int64_t TableB4const [16]
 
static int64_t TableB4constu [16]
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "Xtensa-disassembler"

Definition at line 28 of file XtensaDisassembler.cpp.

Typedef Documentation

◆ DecodeStatus

Definition at line 30 of file XtensaDisassembler.cpp.

Function Documentation

◆ createXtensaDisassembler()

static MCDisassembler * createXtensaDisassembler ( const Target T,
const MCSubtargetInfo STI,
MCContext Ctx 
)
static

Definition at line 49 of file XtensaDisassembler.cpp.

Referenced by LLVMInitializeXtensaDisassembler().

◆ DecodeARRegisterClass()

static DecodeStatus DecodeARRegisterClass ( MCInst Inst,
uint64_t  RegNo,
uint64_t  Address,
const void *  Decoder 
)
static

◆ decodeB4constOperand()

static DecodeStatus decodeB4constOperand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeB4constuOperand()

static DecodeStatus decodeB4constuOperand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeBranchOperand()

static DecodeStatus decodeBranchOperand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeCallOperand()

static DecodeStatus decodeCallOperand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeImm12Operand()

static DecodeStatus decodeImm12Operand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeImm1_16Operand()

static DecodeStatus decodeImm1_16Operand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeImm1n_15Operand()

static DecodeStatus decodeImm1n_15Operand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeImm32n_95Operand()

static DecodeStatus decodeImm32n_95Operand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeImm8_sh8Operand()

static DecodeStatus decodeImm8_sh8Operand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeImm8Operand()

static DecodeStatus decodeImm8Operand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeJumpOperand()

static DecodeStatus decodeJumpOperand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeL32ROperand()

static DecodeStatus decodeL32ROperand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeMem16Operand()

static DecodeStatus decodeMem16Operand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeMem32nOperand()

static DecodeStatus decodeMem32nOperand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeMem32Operand()

static DecodeStatus decodeMem32Operand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeMem8Operand()

static DecodeStatus decodeMem8Operand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeShimm1_31Operand()

static DecodeStatus decodeShimm1_31Operand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ DecodeSRRegisterClass()

static DecodeStatus DecodeSRRegisterClass ( MCInst Inst,
uint64_t  RegNo,
uint64_t  Address,
const void *  Decoder 
)
static

◆ decodeUimm4Operand()

static DecodeStatus decodeUimm4Operand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ decodeUimm5Operand()

static DecodeStatus decodeUimm5Operand ( MCInst Inst,
uint64_t  Imm,
int64_t  Address,
const void *  Decoder 
)
static

◆ LLVMInitializeXtensaDisassembler()

LLVM_EXTERNAL_VISIBILITY void LLVMInitializeXtensaDisassembler ( )

◆ readInstruction16()

static DecodeStatus readInstruction16 ( ArrayRef< uint8_t Bytes,
uint64_t  Address,
uint64_t Size,
uint64_t Insn,
bool  IsLittleEndian 
)
static

Read two bytes from the ArrayRef and return 16 bit data sorted according to the given endianness.

Definition at line 276 of file XtensaDisassembler.cpp.

References llvm::MCDisassembler::Fail, Insn, llvm::report_fatal_error(), llvm::ArrayRef< T >::size(), Size, and llvm::MCDisassembler::Success.

◆ readInstruction24()

static DecodeStatus readInstruction24 ( ArrayRef< uint8_t Bytes,
uint64_t  Address,
uint64_t Size,
uint64_t Insn,
bool  IsLittleEndian 
)
static

Read three bytes from the ArrayRef and return 24 bit data.

Definition at line 295 of file XtensaDisassembler.cpp.

References llvm::MCDisassembler::Fail, Insn, llvm::report_fatal_error(), llvm::ArrayRef< T >::size(), Size, and llvm::MCDisassembler::Success.

◆ tryAddingSymbolicOperand()

static bool tryAddingSymbolicOperand ( int64_t  Value,
bool  isBranch,
uint64_t  Address,
uint64_t  Offset,
uint64_t  InstSize,
MCInst MI,
const void *  Decoder 
)
static

Variable Documentation

◆ ARDecoderTable

const unsigned ARDecoderTable[]
static
Initial value:
= {
Xtensa::A0, Xtensa::SP, Xtensa::A2, Xtensa::A3, Xtensa::A4, Xtensa::A5,
Xtensa::A6, Xtensa::A7, Xtensa::A8, Xtensa::A9, Xtensa::A10, Xtensa::A11,
Xtensa::A12, Xtensa::A13, Xtensa::A14, Xtensa::A15}

Definition at line 60 of file XtensaDisassembler.cpp.

Referenced by DecodeARRegisterClass().

◆ SRDecoderTable

const unsigned SRDecoderTable[] = {Xtensa::SAR, 3}
static

Definition at line 76 of file XtensaDisassembler.cpp.

Referenced by DecodeSRRegisterClass().

◆ TableB4const

int64_t TableB4const[16]
static
Initial value:
= {-1, 1, 2, 3, 4, 5, 6, 7,
8, 10, 12, 16, 32, 64, 128, 256}

Definition at line 221 of file XtensaDisassembler.cpp.

Referenced by decodeB4constOperand().

◆ TableB4constu

int64_t TableB4constu[16]
static
Initial value:
= {32768, 65536, 2, 3, 4, 5, 6, 7,
8, 10, 12, 16, 32, 64, 128, 256}

Definition at line 231 of file XtensaDisassembler.cpp.

Referenced by decodeB4constuOperand().