LLVM 22.0.0git
SystemZDisassembler.cpp File Reference
#include "MCTargetDesc/SystemZMCTargetDesc.h"
#include "TargetInfo/SystemZTargetInfo.h"
#include "llvm/MC/MCDecoder.h"
#include "llvm/MC/MCDecoderOps.h"
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
#include <cstdint>
#include "SystemZGenDisassemblerTables.inc"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "systemz-disassembler"

Functions

static MCDisassemblercreateSystemZDisassembler (const Target &T, const MCSubtargetInfo &STI, MCContext &Ctx)
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZDisassembler ()
static bool tryAddingSymbolicOperand (int64_t Value, bool IsBranch, uint64_t Address, uint64_t Offset, uint64_t Width, MCInst &MI, const MCDisassembler *Decoder)
 tryAddingSymbolicOperand - trys to add a symbolic operand in place of the immediate Value in the MCInst.
static DecodeStatus decodeRegisterClass (MCInst &Inst, uint64_t RegNo, const unsigned *Regs, unsigned Size, bool IsAddr=false)
static DecodeStatus DecodeGR32BitRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGRH32BitRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGR64BitRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeGR128BitRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeADDR32BitRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeADDR64BitRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeFP32BitRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeFP64BitRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeFP128BitRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeVR32BitRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeVR64BitRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeVR128BitRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeAR32BitRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus DecodeCR64BitRegisterClass (MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder)
template<unsigned N>
static DecodeStatus decodeUImmOperand (MCInst &Inst, uint64_t Imm)
template<unsigned N>
static DecodeStatus decodeSImmOperand (MCInst &Inst, uint64_t Imm)
static DecodeStatus decodeU1ImmOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodeU2ImmOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodeU3ImmOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodeU4ImmOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodeU8ImmOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodeU12ImmOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodeU16ImmOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodeU32ImmOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodeS8ImmOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodeS16ImmOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodeS20ImmOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodeS32ImmOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
template<unsigned N>
static DecodeStatus decodeLenOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
template<unsigned N>
static DecodeStatus decodePCDBLOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, bool isBranch, const MCDisassembler *Decoder)
static DecodeStatus decodePC12DBLBranchOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodePC16DBLBranchOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodePC24DBLBranchOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodePC32DBLBranchOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)
static DecodeStatus decodePC32DBLOperand (MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder)

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "systemz-disassembler"

Definition at line 25 of file SystemZDisassembler.cpp.

Function Documentation

◆ createSystemZDisassembler()

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

Definition at line 44 of file SystemZDisassembler.cpp.

References T.

Referenced by LLVMInitializeSystemZDisassembler().

◆ DecodeADDR32BitRegisterClass()

DecodeStatus DecodeADDR32BitRegisterClass ( MCInst & Inst,
uint64_t RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 125 of file SystemZDisassembler.cpp.

References decodeRegisterClass(), and llvm::SystemZMC::GR32Regs.

◆ DecodeADDR64BitRegisterClass()

DecodeStatus DecodeADDR64BitRegisterClass ( MCInst & Inst,
uint64_t RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 131 of file SystemZDisassembler.cpp.

References decodeRegisterClass(), and llvm::SystemZMC::GR64Regs.

◆ DecodeAR32BitRegisterClass()

DecodeStatus DecodeAR32BitRegisterClass ( MCInst & Inst,
uint64_t RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 172 of file SystemZDisassembler.cpp.

References llvm::SystemZMC::AR32Regs, and decodeRegisterClass().

◆ DecodeCR64BitRegisterClass()

DecodeStatus DecodeCR64BitRegisterClass ( MCInst & Inst,
uint64_t RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 178 of file SystemZDisassembler.cpp.

References llvm::SystemZMC::CR64Regs, and decodeRegisterClass().

◆ DecodeFP128BitRegisterClass()

DecodeStatus DecodeFP128BitRegisterClass ( MCInst & Inst,
uint64_t RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 148 of file SystemZDisassembler.cpp.

References decodeRegisterClass(), and llvm::SystemZMC::FP128Regs.

◆ DecodeFP32BitRegisterClass()

DecodeStatus DecodeFP32BitRegisterClass ( MCInst & Inst,
uint64_t RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 136 of file SystemZDisassembler.cpp.

References decodeRegisterClass(), and llvm::SystemZMC::FP32Regs.

◆ DecodeFP64BitRegisterClass()

DecodeStatus DecodeFP64BitRegisterClass ( MCInst & Inst,
uint64_t RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 142 of file SystemZDisassembler.cpp.

References decodeRegisterClass(), and llvm::SystemZMC::FP64Regs.

◆ DecodeGR128BitRegisterClass()

DecodeStatus DecodeGR128BitRegisterClass ( MCInst & Inst,
uint64_t RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 118 of file SystemZDisassembler.cpp.

References decodeRegisterClass(), and llvm::SystemZMC::GR128Regs.

◆ DecodeGR32BitRegisterClass()

DecodeStatus DecodeGR32BitRegisterClass ( MCInst & Inst,
uint64_t RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 100 of file SystemZDisassembler.cpp.

References decodeRegisterClass(), and llvm::SystemZMC::GR32Regs.

◆ DecodeGR64BitRegisterClass()

DecodeStatus DecodeGR64BitRegisterClass ( MCInst & Inst,
uint64_t RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 112 of file SystemZDisassembler.cpp.

References decodeRegisterClass(), and llvm::SystemZMC::GR64Regs.

◆ DecodeGRH32BitRegisterClass()

DecodeStatus DecodeGRH32BitRegisterClass ( MCInst & Inst,
uint64_t RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 106 of file SystemZDisassembler.cpp.

References decodeRegisterClass(), and llvm::SystemZMC::GRH32Regs.

◆ decodeLenOperand()

◆ decodePC12DBLBranchOperand()

DecodeStatus decodePC12DBLBranchOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 296 of file SystemZDisassembler.cpp.

References decodePCDBLOperand().

◆ decodePC16DBLBranchOperand()

DecodeStatus decodePC16DBLBranchOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 302 of file SystemZDisassembler.cpp.

References decodePCDBLOperand().

◆ decodePC24DBLBranchOperand()

DecodeStatus decodePC24DBLBranchOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 308 of file SystemZDisassembler.cpp.

References decodePCDBLOperand().

◆ decodePC32DBLBranchOperand()

DecodeStatus decodePC32DBLBranchOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 314 of file SystemZDisassembler.cpp.

References decodePCDBLOperand().

◆ decodePC32DBLOperand()

DecodeStatus decodePC32DBLOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 320 of file SystemZDisassembler.cpp.

References decodePCDBLOperand().

◆ decodePCDBLOperand()

◆ decodeRegisterClass()

◆ decodeS16ImmOperand()

DecodeStatus decodeS16ImmOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 254 of file SystemZDisassembler.cpp.

References decodeSImmOperand().

◆ decodeS20ImmOperand()

DecodeStatus decodeS20ImmOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 260 of file SystemZDisassembler.cpp.

References decodeSImmOperand().

◆ decodeS32ImmOperand()

DecodeStatus decodeS32ImmOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 266 of file SystemZDisassembler.cpp.

References decodeSImmOperand().

◆ decodeS8ImmOperand()

DecodeStatus decodeS8ImmOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 248 of file SystemZDisassembler.cpp.

References decodeSImmOperand().

◆ decodeSImmOperand()

◆ decodeU12ImmOperand()

DecodeStatus decodeU12ImmOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 230 of file SystemZDisassembler.cpp.

References decodeUImmOperand().

◆ decodeU16ImmOperand()

DecodeStatus decodeU16ImmOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 236 of file SystemZDisassembler.cpp.

References decodeUImmOperand().

◆ decodeU1ImmOperand()

DecodeStatus decodeU1ImmOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 200 of file SystemZDisassembler.cpp.

References decodeUImmOperand().

◆ decodeU2ImmOperand()

DecodeStatus decodeU2ImmOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 206 of file SystemZDisassembler.cpp.

References decodeUImmOperand().

◆ decodeU32ImmOperand()

DecodeStatus decodeU32ImmOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 242 of file SystemZDisassembler.cpp.

References decodeUImmOperand().

◆ decodeU3ImmOperand()

DecodeStatus decodeU3ImmOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 212 of file SystemZDisassembler.cpp.

References decodeUImmOperand().

◆ decodeU4ImmOperand()

DecodeStatus decodeU4ImmOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 218 of file SystemZDisassembler.cpp.

References decodeUImmOperand().

◆ decodeU8ImmOperand()

DecodeStatus decodeU8ImmOperand ( MCInst & Inst,
uint64_t Imm,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 224 of file SystemZDisassembler.cpp.

References decodeUImmOperand().

◆ decodeUImmOperand()

◆ DecodeVR128BitRegisterClass()

DecodeStatus DecodeVR128BitRegisterClass ( MCInst & Inst,
uint64_t RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 166 of file SystemZDisassembler.cpp.

References decodeRegisterClass(), and llvm::SystemZMC::VR128Regs.

◆ DecodeVR32BitRegisterClass()

DecodeStatus DecodeVR32BitRegisterClass ( MCInst & Inst,
uint64_t RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 154 of file SystemZDisassembler.cpp.

References decodeRegisterClass(), and llvm::SystemZMC::VR32Regs.

◆ DecodeVR64BitRegisterClass()

DecodeStatus DecodeVR64BitRegisterClass ( MCInst & Inst,
uint64_t RegNo,
uint64_t Address,
const MCDisassembler * Decoder )
static

Definition at line 160 of file SystemZDisassembler.cpp.

References decodeRegisterClass(), and llvm::SystemZMC::VR64Regs.

◆ LLVMInitializeSystemZDisassembler()

◆ tryAddingSymbolicOperand()

bool tryAddingSymbolicOperand ( int64_t Value,
bool IsBranch,
uint64_t Address,
uint64_t Offset,
uint64_t Width,
MCInst & MI,
const MCDisassembler * Decoder )
static

tryAddingSymbolicOperand - trys to add a symbolic operand in place of the immediate Value in the MCInst.

Parameters
Value- The immediate Value, has had any PC adjustment made by the caller.
isBranch- If the instruction is a branch instruction
Address- The starting address of the instruction
Offset- The byte offset to this immediate in the instruction
Width- The byte width of this immediate in the instruction

If the getOpInfo() function was set when setupForSymbolicDisassembly() was called then that function is called to get any symbolic information for the immediate in the instruction using the Address, Offset and Width. If that returns non-zero then the symbolic information it returns is used to create an MCExpr and that is added as an operand to the MCInst. If getOpInfo() returns zero and isBranch is true then a symbol look up for immediate Value is done and if a symbol is found an MCExpr is created with that, else an MCExpr with the immediate Value is created. This function returns true if it adds an operand to the MCInst and false otherwise.

Definition at line 77 of file SystemZDisassembler.cpp.

References MI, llvm::Offset, and llvm::MCDisassembler::tryAddingSymbolicOperand().

Referenced by decodePCDBLOperand().