LLVM  14.0.0git
Macros | Typedefs | Functions
AMDGPUDisassembler.cpp File Reference
#include "Disassembler/AMDGPUDisassembler.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
#include "TargetInfo/AMDGPUTargetInfo.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "llvm-c/DisassemblerTypes.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixedLenDisassembler.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/Support/AMDHSAKernelDescriptor.h"
#include "AMDGPUGenDisassemblerTables.inc"
Include dependency graph for AMDGPUDisassembler.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "amdgpu-disassembler"
 
#define SGPR_MAX
 
#define DECODE_OPERAND(StaticDecoderName, DecoderName)
 
#define DECODE_OPERAND_REG(RegClass)   DECODE_OPERAND(Decode##RegClass##RegisterClass, decodeOperand_##RegClass)
 
#define DECODE_SDWA(DecName)   DECODE_OPERAND(decodeSDWA##DecName, decodeSDWA##DecName)
 
#define PRINT_DIRECTIVE(DIRECTIVE, MASK)
 
#define PRINT_DIRECTIVE(DIRECTIVE, MASK)
 

Typedefs

using DecodeStatus = llvm::MCDisassembler::DecodeStatus
 

Functions

static MCDisassembler::DecodeStatus addOperand (MCInst &Inst, const MCOperand &Opnd)
 
static int insertNamedMCOperand (MCInst &MI, const MCOperand &Op, uint16_t NameIdx)
 
static DecodeStatus decodeSoppBrTarget (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeSMEMOffset (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeBoolReg (MCInst &Inst, unsigned Val, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_VSrc16 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_VSrcV216 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_VSrcV232 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_VS_16 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_VS_32 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_AReg_64 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_AReg_128 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_AReg_256 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_AReg_512 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_AReg_1024 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_VReg_64 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_VReg_128 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_VReg_256 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_VReg_512 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_VReg_1024 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_f32kimm (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_f16kimm (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_VS_16_Deferred (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_VS_32_Deferred (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static bool IsAGPROperand (const MCInst &Inst, int OpIdx, const MCRegisterInfo *MRI)
 
static DecodeStatus decodeOperand_AVLdSt_Any (MCInst &Inst, unsigned Imm, AMDGPUDisassembler::OpWidthTy Opw, const void *Decoder)
 
static DecodeStatus DecodeAVLdSt_32RegisterClass (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus DecodeAVLdSt_64RegisterClass (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus DecodeAVLdSt_96RegisterClass (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus DecodeAVLdSt_128RegisterClass (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_SReg_32 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
static DecodeStatus decodeOperand_VGPR_32 (MCInst &Inst, unsigned Imm, uint64_t Addr, const void *Decoder)
 
template<typename T >
static T eatBytes (ArrayRef< uint8_t > &Bytes)
 
static bool isValidDPP8 (const MCInst &MI)
 
static int64_t getInlineImmVal32 (unsigned Imm)
 
static int64_t getInlineImmVal64 (unsigned Imm)
 
static int64_t getInlineImmVal16 (unsigned Imm)
 
static MCSymbolizercreateAMDGPUSymbolizer (const Triple &, LLVMOpInfoCallback, LLVMSymbolLookupCallback, void *DisInfo, MCContext *Ctx, std::unique_ptr< MCRelocationInfo > &&RelInfo)
 
static MCDisassemblercreateAMDGPUDisassembler (const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
 
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUDisassembler ()
 

Detailed Description

This file contains definition for AMDGPU ISA disassembler

Definition in file AMDGPUDisassembler.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "amdgpu-disassembler"

Definition at line 34 of file AMDGPUDisassembler.cpp.

◆ DECODE_OPERAND

#define DECODE_OPERAND (   StaticDecoderName,
  DecoderName 
)
Value:
static DecodeStatus StaticDecoderName(MCInst &Inst, \
unsigned Imm, \
uint64_t /*Addr*/, \
const void *Decoder) { \
auto DAsm = static_cast<const AMDGPUDisassembler*>(Decoder); \
return addOperand(Inst, DAsm->DecoderName(Imm)); \
}

Definition at line 104 of file AMDGPUDisassembler.cpp.

◆ DECODE_OPERAND_REG

#define DECODE_OPERAND_REG (   RegClass)    DECODE_OPERAND(Decode##RegClass##RegisterClass, decodeOperand_##RegClass)

Definition at line 113 of file AMDGPUDisassembler.cpp.

◆ DECODE_SDWA

#define DECODE_SDWA (   DecName)    DECODE_OPERAND(decodeSDWA##DecName, decodeSDWA##DecName)

Definition at line 393 of file AMDGPUDisassembler.cpp.

◆ PRINT_DIRECTIVE [1/2]

#define PRINT_DIRECTIVE (   DIRECTIVE,
  MASK 
)
Value:
do { \
KdStream << Indent << DIRECTIVE " " \
<< ((FourByteBuffer & MASK) >> (MASK##_SHIFT)) << '\n'; \
} while (0)

Definition at line 1532 of file AMDGPUDisassembler.cpp.

◆ PRINT_DIRECTIVE [2/2]

#define PRINT_DIRECTIVE (   DIRECTIVE,
  MASK 
)
Value:
do { \
KdStream << Indent << DIRECTIVE " " \
<< ((TwoByteBuffer & MASK) >> (MASK##_SHIFT)) << '\n'; \
} while (0)

Definition at line 1532 of file AMDGPUDisassembler.cpp.

◆ SGPR_MAX

#define SGPR_MAX

Typedef Documentation

◆ DecodeStatus

Definition at line 40 of file AMDGPUDisassembler.cpp.

Function Documentation

◆ addOperand()

static MCDisassembler::DecodeStatus addOperand ( MCInst Inst,
const MCOperand Opnd 
)
inlinestatic

◆ createAMDGPUDisassembler()

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

◆ createAMDGPUSymbolizer()

static MCSymbolizer* createAMDGPUSymbolizer ( const Triple ,
LLVMOpInfoCallback  ,
LLVMSymbolLookupCallback  ,
void *  DisInfo,
MCContext Ctx,
std::unique_ptr< MCRelocationInfo > &&  RelInfo 
)
static

Definition at line 1929 of file AMDGPUDisassembler.cpp.

References move.

Referenced by LLVMInitializeAMDGPUDisassembler().

◆ DecodeAVLdSt_128RegisterClass()

static DecodeStatus DecodeAVLdSt_128RegisterClass ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

◆ DecodeAVLdSt_32RegisterClass()

static DecodeStatus DecodeAVLdSt_32RegisterClass ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

◆ DecodeAVLdSt_64RegisterClass()

static DecodeStatus DecodeAVLdSt_64RegisterClass ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

◆ DecodeAVLdSt_96RegisterClass()

static DecodeStatus DecodeAVLdSt_96RegisterClass ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

◆ decodeBoolReg()

static DecodeStatus decodeBoolReg ( MCInst Inst,
unsigned  Val,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 98 of file AMDGPUDisassembler.cpp.

References addOperand().

◆ decodeOperand_AReg_1024()

static DecodeStatus decodeOperand_AReg_1024 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 220 of file AMDGPUDisassembler.cpp.

References addOperand(), and llvm::AMDGPUDisassembler::OPW1024.

◆ decodeOperand_AReg_128()

static DecodeStatus decodeOperand_AReg_128 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 196 of file AMDGPUDisassembler.cpp.

References addOperand(), and llvm::AMDGPUDisassembler::OPW128.

◆ decodeOperand_AReg_256()

static DecodeStatus decodeOperand_AReg_256 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 204 of file AMDGPUDisassembler.cpp.

References addOperand(), and llvm::AMDGPUDisassembler::OPW256.

◆ decodeOperand_AReg_512()

static DecodeStatus decodeOperand_AReg_512 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 212 of file AMDGPUDisassembler.cpp.

References addOperand(), and llvm::AMDGPUDisassembler::OPW512.

◆ decodeOperand_AReg_64()

static DecodeStatus decodeOperand_AReg_64 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 188 of file AMDGPUDisassembler.cpp.

References addOperand(), and llvm::AMDGPUDisassembler::OPW64.

◆ decodeOperand_AVLdSt_Any()

static DecodeStatus decodeOperand_AVLdSt_Any ( MCInst Inst,
unsigned  Imm,
AMDGPUDisassembler::OpWidthTy  Opw,
const void *  Decoder 
)
static

◆ decodeOperand_f16kimm()

static DecodeStatus decodeOperand_f16kimm ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 274 of file AMDGPUDisassembler.cpp.

References addOperand().

◆ decodeOperand_f32kimm()

static DecodeStatus decodeOperand_f32kimm ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 268 of file AMDGPUDisassembler.cpp.

References addOperand().

◆ decodeOperand_SReg_32()

static DecodeStatus decodeOperand_SReg_32 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 377 of file AMDGPUDisassembler.cpp.

References addOperand().

◆ decodeOperand_VGPR_32()

static DecodeStatus decodeOperand_VGPR_32 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 385 of file AMDGPUDisassembler.cpp.

References addOperand(), and llvm::AMDGPUDisassembler::OPW32.

◆ decodeOperand_VReg_1024()

static DecodeStatus decodeOperand_VReg_1024 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 260 of file AMDGPUDisassembler.cpp.

References addOperand(), and llvm::AMDGPUDisassembler::OPW1024.

◆ decodeOperand_VReg_128()

static DecodeStatus decodeOperand_VReg_128 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 236 of file AMDGPUDisassembler.cpp.

References addOperand(), and llvm::AMDGPUDisassembler::OPW128.

◆ decodeOperand_VReg_256()

static DecodeStatus decodeOperand_VReg_256 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 244 of file AMDGPUDisassembler.cpp.

References addOperand(), and llvm::AMDGPUDisassembler::OPW256.

◆ decodeOperand_VReg_512()

static DecodeStatus decodeOperand_VReg_512 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 252 of file AMDGPUDisassembler.cpp.

References addOperand(), and llvm::AMDGPUDisassembler::OPW512.

◆ decodeOperand_VReg_64()

static DecodeStatus decodeOperand_VReg_64 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 228 of file AMDGPUDisassembler.cpp.

References addOperand(), and llvm::AMDGPUDisassembler::OPW64.

◆ decodeOperand_VS_16()

static DecodeStatus decodeOperand_VS_16 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 172 of file AMDGPUDisassembler.cpp.

References addOperand().

◆ decodeOperand_VS_16_Deferred()

static DecodeStatus decodeOperand_VS_16_Deferred ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 280 of file AMDGPUDisassembler.cpp.

References addOperand(), and llvm::AMDGPUDisassembler::OPW16.

◆ decodeOperand_VS_32()

static DecodeStatus decodeOperand_VS_32 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 180 of file AMDGPUDisassembler.cpp.

References addOperand().

◆ decodeOperand_VS_32_Deferred()

static DecodeStatus decodeOperand_VS_32_Deferred ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 288 of file AMDGPUDisassembler.cpp.

References addOperand(), and llvm::AMDGPUDisassembler::OPW32.

◆ decodeOperand_VSrc16()

static DecodeStatus decodeOperand_VSrc16 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 148 of file AMDGPUDisassembler.cpp.

References addOperand().

◆ decodeOperand_VSrcV216()

static DecodeStatus decodeOperand_VSrcV216 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 156 of file AMDGPUDisassembler.cpp.

References addOperand().

◆ decodeOperand_VSrcV232()

static DecodeStatus decodeOperand_VSrcV232 ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 164 of file AMDGPUDisassembler.cpp.

References addOperand().

◆ decodeSMEMOffset()

static DecodeStatus decodeSMEMOffset ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

Definition at line 86 of file AMDGPUDisassembler.cpp.

References addOperand(), llvm::MCOperand::createImm(), and Offset.

◆ decodeSoppBrTarget()

static DecodeStatus decodeSoppBrTarget ( MCInst Inst,
unsigned  Imm,
uint64_t  Addr,
const void *  Decoder 
)
static

◆ eatBytes()

template<typename T >
static T eatBytes ( ArrayRef< uint8_t > &  Bytes)
inlinestatic

◆ getInlineImmVal16()

static int64_t getInlineImmVal16 ( unsigned  Imm)
static

Definition at line 1161 of file AMDGPUDisassembler.cpp.

References llvm_unreachable.

Referenced by llvm::AMDGPUDisassembler::decodeFPImmed().

◆ getInlineImmVal32()

static int64_t getInlineImmVal32 ( unsigned  Imm)
static

◆ getInlineImmVal64()

static int64_t getInlineImmVal64 ( unsigned  Imm)
static

◆ insertNamedMCOperand()

static int insertNamedMCOperand ( MCInst MI,
const MCOperand Op,
uint16_t  NameIdx 
)
static

◆ IsAGPROperand()

static bool IsAGPROperand ( const MCInst Inst,
int  OpIdx,
const MCRegisterInfo MRI 
)
static

Definition at line 296 of file AMDGPUDisassembler.cpp.

References llvm::MCInst::getOperand(), MRI, and Reg.

Referenced by decodeOperand_AVLdSt_Any().

◆ isValidDPP8()

static bool isValidDPP8 ( const MCInst MI)
static

◆ LLVMInitializeAMDGPUDisassembler()

LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUDisassembler ( )
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::AMDGPUDisassembler
Definition: AMDGPUDisassembler.h:34
llvm::AMDGPU::EncValues::SGPR_MAX_GFX10
@ SGPR_MAX_GFX10
Definition: SIDefines.h:270
llvm::MCDisassembler::DecodeStatus
DecodeStatus
Ternary decode status.
Definition: MCDisassembler.h:100
llvm::AMDGPU::isGFX10Plus
bool isGFX10Plus(const MCSubtargetInfo &STI)
Definition: AMDGPUBaseInfo.cpp:1457
llvm::AMDGPU::EncValues::SGPR_MAX_SI
@ SGPR_MAX_SI
Definition: SIDefines.h:269
uint64_t
addOperand
static MCDisassembler::DecodeStatus addOperand(MCInst &Inst, const MCOperand &Opnd)
Definition: AMDGPUDisassembler.cpp:54